There are 4 other files named cocos.sim in the archive. Click here to see a list.
00020 COMMENT COCOS - Conditional Compilation in SIMULA;
00030 COMMENT =========================================;
00050 COMMENT COCOS is a program to allow one SIMULA source program to
00060 COMMENT compile into several differing programs. A preprocessor
00070 COMMENT selects statements from the initial source program according
00080 COMMENT to selection statements. The initial source program can also
00090 COMMENT be compiled directly as one of the versions.
00110 COMMENT In the future, some SIMULA compilers may include the
00120 COMMENT interpretation of the COCOS commands, or some other similar
00130 COMMENT scheme, so that no preprocessing is necessary.
00150 COMMENT COCOS commands all begin with % in the first character
00160 COMMENT position of an input line. (COCOS commands can also begin
00170 COMMENT with "COMMENT%" which must be the first non-blank text on a
00180 COMMENT source program line. The source program should not contain
00190 COMMENT any such lines beginning with COMMENT% except COCOS command
00200 COMMENT lines.)
00220 COMMENT The four COCOS commands are:
00240 COMMENT %COCOS <variable> = <value>
00250 COMMENT %IF <variable>
00260 COMMENT %IFNOT <variable>
00270 COMMENT %IFEND <variable> (%ENDIF also allowd)
00290 COMMENT The commands may, but must not end with semicolon. There
00300 COMMENT should be no other text on these command lines.
00320 COMMENT <variable> can be any valid SIMULA identifier. COCOS
00330 COMMENT variables are however always global throughout the whole
00340 COMMENT program and can have the same name as other identifiers
00350 COMMENT in the program.
00370 COMMENT <value> can only take the values TRUE or FALSE.
00390 COMMENT Example: Output:
00410 COMMENT BEGIN COMMENT BEGIN
00420 COMMENT %COCOS GERMAN = FALSE; COMMENT outtext("I am.");
00430 COMMENT %IF GERMAN; COMMENT outimage;
00440 COMMENT outtext("Ich bin."); COMMENT END;
00450 COMMENT %IFNOT GERMAN;
00460 COMMENT outtext("I am.");
00470 COMMENT %IFEND GERMAN;
00480 COMMENT outimage;
00490 COMMENT END;
00510 COMMENT With %COCOS GERMAN = TRUE, the output file will include "Ich
00520 COMMENT bin." instead of "I am.". With each switch is associated
00530 COMMENT three values, the variable name (<variable>), the value
00540 COMMENT (<value>) and the condition.
00560 COMMENT %IF gives the condition the value YES. %IFEND gives the
00570 COMMENT condition the value NEUTRAL. %IFNOT gives the condition the
00580 COMMENT value NO. No COCOS command lines are copied to the compilable
00590 COMMENT program. Other lines are copied only if for all TRUE
00600 COMMENT switches, the condition is yes or neutral, and for all FALSE
00610 COMMENT switches, the condition is no or neutral.
00630 COMMENT There can be more than one %COCOS commands for the same
00640 COMMENT variable in a processed program. The last command is valid.
00660 COMMENT If a %IF... command is encountered with no known value for
00670 COMMENT the switch, then COCOS will ask the conversational terminal
00680 COMMENT for a value.
00692 COMMENT When COCOS is executed, you can give the following command
00694 COMMENT string:
00696 COMMENT <outfile>=<infile>/<variable1>:<value1>/variable2>:<value2>...
00700 COMMENT END OF COMMENT;