COCOS.HLP COCOS.HLP 1977-07-19 Revised: 1978-07-30 COCOS - Conditional Compilation in SIMULA ========================================= COCOS is a program to allow one SIMULA source program to compile into several differing programs. A preprocessor selects statements from the initial source program according to selection statements. The initial source program can also be compiled directly as one of the versions. In the future, some SIMULA compilers may include the interpre- tation of the COCOS commands, or some other similar scheme, so that no preprocessing is necessary. COCOS commands all begin with % in the first character position of a source program line. Such lines are ignored by the DECsystem-10 SIMULA compiler release 4. (COCOS also accepts command lines beginning with COMMENT% as the first non-blank text on a source program line.) The source program should not contain any lines beginning with % in column 1 or with COMMENT% except COCOS command lines. The four COCOS commands are: %COCOS = %IF %IFNOT %IFEND (%ENDIF is equivalent) The commands may, but must not end with semicolon (;). There should be no other text on these command lines. can be any valid SIMULA identifier. COCOS variables are however always global throughout the whole program and can have the same name as other identifiers in the program. can only take the values TRUE or FALSE. Example: Output: BEGIN BEGIN %COCOS GERMAN = FALSE; outtext("I am."); %IF GERMAN; outimage; outtext("Ich bin."); END; %IFNOT GERMAN; outtext("I am."); %IFEND GERMAN; outimage; END; With %COCOS GERMAN = TRUE, the output file will include "Ich bin." instead of "I am.". With each switch is associated three values, the variable name (), the value () and the condition. %IF gives the condition the value YES. %IFEND gives the condition the value NEUTRAL. %IFNOT gives the condition the value NO. No COCOS command lines are copied to the compilable program. Other lines are copied only if for all TRUE switches, the condition is yes or neutral, and for all FALSE switches, the conditiion is no or neutral. There can be more than one %COCOS commands for the same variable in a processed program. The last command is valid. If a %IF... command is encountered with no known value for the switch, then COCOS will ask the conversational terminal for a value. When COCOS is executed, you can give the following command string: =/:/variable2>: ...