.!To create FLECS.HLP .! .! .R RUNOFF .! *FLECS.HLP=FLECS.RNH/CR/RI:8/VAR:DEC .! *FLX11.HLP=FLECS.RNH/CR/RI:8/VAR:PDP .! .vr DEC,+,- .vr PDP,+,- .lm 0 .rm 60 .nf .c 60;^&FLECS Version 22H(126)\& .c 60;^&FORTRAN Language with Extended Control Structures\& .s 4 .c 60;^&Executing FLECS\& .s 2 To execute FLECS, type... .s 1 .^&R_ FLECS\& *^&command-line\& .s 1 "command-line" may be in any of the following forms: .s 1 .if DEC O,L,I=S/sw -> From .FLX input source file "S"... output .FOR file if "O" is present, output .LST file if "L" is present, output .FIN file if "I" is present, and list errors to the TTY: S/sw -> equivalent to O,L=S above _^Z -> terminate execution with statistics _^C -> terminate execution immediately .endif DEC .if PDP O,L,I=S/sw -> From .FLX input source file "S"... output .FTX file if "O" is present, output .FLL file if "L" is present, output .FIN file if "I" is present, and list errors to the TT: S/sw -> equivalent to O,L=S above _^Z -> terminate execution _^C -> terminate execution immediately .endif PDP .s 2 Each file specification may have the form... .s 1 .if DEC dev:file.ext[path] .endif DEC .if PDP dev:file.ext .endif PDP .s 1 Symbol Meaning Default ------ ------- ------- .if DEC dev: device DSK: (input), input "dev:" (output) file file name none (input), input "file" (output) _.ext extension .FLX for FLECS source (input) .FOR for FORTRAN source (output) .LST for listing (output) .FIN for indented source (output) [path] ppn,sfd,... job's current path .endif DEC .if PDP dev: device DK: file file name none (input), input "file" (output) _.ext extension .FLX for FLECS source (input) .FTX for FORTRAN source (output) .FLL for listing (output) .FIN for indented source (output) .endif PDP .s 2 /sw is an optional list of switches from the following: .s 1 Switch Meaning ------ ------- .f .lm 12 .rm 60 .if DEC .i -12;/INCLUDE####Translate debugging lines with "D" in column 1 as normal FLECS statements (normally these lines are completely ignored). .s 1 .i -12;/STANDARD###Output a .FIN file with standard FORTRAN format--with no line sequence numbers and with no tabs, only spaces, in columns 1 thru 6; default is /NOSTANDARD. .s 1 .i -12;/NUMBER#####Include SOS line numbers on output .FIN file; default is /NONUMBER. .endif DEC .if PDP .i -12;/C##########Include comment lines in generated FORTRAN file. .i -12;/D##########Translate debugging lines with "D" in column 1 as normal FLECS statements (normally these lines are completely ignored). .i -12;/L##########Include FLECS listing line _#'s in columns 75-80 of generated FORTRAN file. .i -12;/N##########Generate a new indented source file. .endif PDP .f .lm 0 .rm 60 .if DEC .pg ^&COMPILe-Class Commands\&: .s 2 FLECS will also work with any of the COMPIL-class commands, such as... .s 1 .c 60;COMPIL, LOAD, EXEC, etc. .s 1 When files with .FLX extensions are included in any of these commands, each file is first preprocessed by FLECS. Then, the resulting .FOR file is automatically compiled by FORTRAN-10. Any /LIST switches included will apply only to the FLECS phase and not to the FORTRAN step. .s 1 FLECS listing and FORTRAN files will have the same line sequence numbers as found on the input FLECS file. When the input file has no sequence numbers, FLECS will automatically number output files from 10 by 10, re-starting at 10 for each routine as it is encountered. .s 1 Switches to FLECS and FORTRAN may be given in COMPIL-class commands by using the form: .nf .s 1 .^&COMPILE_ progrm.FLX(sw1/sw2/sw3.../swN)\& .s 1 .f For example, the command to compile the file TEST.FLX, include debugging code, and create a listing file named TEST.LST is... .nf .s 1 .^&COMPILE_ TEST.FLX(INCLUDE)/LIST\& .s 1 .f Any switches for the FORTRAN compiler may be given along with the FLECS switches. FLECS will ignore any unrecognized switches and pass all switches to the FORTRAN compiler. For example, to compile the file TEST.FLX as above and to have FORTRAN generate code to do array subscript checking, the command below would be used: .nf .s 1 .^&COMPILE_ TEST.FLX(INCLUDE/DEBUG:BOUNDS)/LIST\& .s 1 .f .endif DEC .pg .c 60;^&FLECS Statement Syntax\& .s 4 .nf keyword (specification) scope .s 1 where... "keyword" indicates the structure type "specification" depends on keyword given "scope" the statement(s) controlled .s 2 The scope FLECS structures may have two forms: .s 1 keyword (specification) statement .s 1 keyword (specification) . statement-1 . statement-2 : : . statement-n ...FIN .s 2 .f .lm 8 .rm 52 Note: In the second example above, the user need not indent statements 1 to n, nor type the dots; the FIN statement is part of the FLECS structured statement's syntax and is required, however. The indentation and bracket drawn with dots appears only in the FLECS listing file and is provided to aid the programmer in recognizing the scope of the various structured statements coded. Each line of the user's code (the .FLX input file) should begin at the normal FORTRAN-IV column 7 position (unless a tab (_^I) is used) and should not be indented. .s 2 Note: Any line in a FLECS program may optionally end with a comment in the standard form allowed by .if DEC FORTRAN-10, .endif DEC .if PDP RT-11 FORTRAN, .endif PDP i.e., with an exclamation point followed by text to be taken as a comment. Thus the full form for FLECS structured statements is: .lm 0 .rm 60 .nf .s 1 keyword (specification) scope !comment .s 1 .f .pg .nf .c 60;^&FLECS Control Structures\& .s 4 ^&Legend\&: .s [L] = Logical expression [E] = Expression (any type) [I] = DO iteration specification [_#] = Loop nesting level $ = Scope, 1 or more statement .s 4 ^&Alternative Structures\&: .s 3 WHEN ( [L] ) $1 ELSE $2 IF ( [L] ) $ UNLESS ( [L] ) $ or IF ( [L] ) THEN $1 ELSE $2 -------------- ------------------ -------------------- | | | v v v /-_\ T /-_\ F T /-_\ F <[L]>---+ <[L]>---+ +---<[L]>---+ _\-/ | _\-/ | | _\-/ | | v | v v v F | $ T | $ $1 $2 | | | | | | |<----+ |<----+ +---->+<----+ | | | v v v .pg ^&Alternative Structures (continued)\&: .s 3 CONDITIONAL SELECT ( [E] ) . ( [L1] ) $1 . ( [E1] ) $1 . ( [L2] ) $2 . ( [E2] ) $2 . . . . . . . ( [Ln] ) $n . ( [En] ) $n ...FIN ...FIN -------------------- -------------------- | | v v /-_\ /-_\ / _\ T /[E]_\ T <[L1] >--->$1-->+ < .EQ.>--->$1-->+ _\ / | _\[E1]/ | _\-/ | _\-/ | | | | | F | | F | | v | v | /-_\ | /-_\ | / _\ T | /[E]_\ T | <[L2] >--->$2-->+ < .EQ.>--->$2-->+ _\ / | _\[E2]/ | _\-/ | _\-/ | | | | | F | | F | | ~ ~ ~ ~ : : : : ~ ~ ~ ~ | | | | v | v | /-_\ | /-_\ | / _\ T | /[E]_\ T | <[Ln] >--->$n-->+ < .EQ.>--->$n-->+ _\ / | _\[En]/ | _\-/ | _\-/ | | | | | F | | F | | |<-----------+ |<-----------+ | | v v .s 2 .f .lm 8 .rm 52 Note: OTHERWISE may be used in CONDITIONAL and SELECT statements as a final condition which is "always .TRUE.". .nf .lm 0 .rm 60 .pg ^&Repetitive Structures\&: .s 3 WHILE ( [L] ) $ REPEAT WHILE ( [L] ) $ ------------------ ------------------------- | | | +-----+ v | F /-_\ T F /-_\ T | +---<[L]>---+ +---<[L]>-->| | _\-/ | | _\-/ | | _^ | | _^ | | | v | | v | | $ | | $ | | | | | | | +-----+ | +-----+ | | +-----+ +-----+ | | v v .s 3 UNTIL ( [L] ) $ REPEAT UNTIL ( [L] ) $ ------------------ ------------------------- | | | +-----+ v | T /-_\ F T /-_\ F | +---<[L]>---+ +---<[L]>-->| | _\-/ | | _\-/ | | _^ | | _^ | | | v | | v | | $ | | $ | | | | | | | +-----+ | +-----+ | | +-----+ +-----+ | | v v .pg ^&Repetitive Structures (continued)\&: .s 3 LOOP (init;[L];incr) $ REPEAT LOOP (init;[L];incr) $ ------------------------ ------------------------------- | | | +-----+ v | init v | init v | F /-_\ T F /-_\ T | +---<[L]>---+ +---<[L]>-->| | _\-/ | | _\-/ | | _^ | | _^ | | | v | | v | incr $ | incr $ | _^ | | _^ | | | | | | | | +-----+ | +-----+ | | +-----+ +-----+ | | v v .s 3 [ REPEAT ] LOOP DO ( [I] ) $ ------------------ ------------------------- | | | +-----+ | | v Fail/-_\Suc | +-----+ +---<[I]>-->| _^ | | _\-/ | | | | _^ | | v | | v | $ | | $ | | | | | +-----+ | +-----+ | +-----+ | v .pg ^&Branch Statements\&: .s 3 NEXT [ [_#] ] BREAK [ [_#] ] ------------------ --------------------- | | v v /-_\ /-_\ +---< >----+ +---< >----+ | _\-/ | | _\-/ | | _^ | | _^ | | | | | | | | | NEXT v | BREAK v | |<=====$ |<===========$ | | | | | | | +------+ | +------+ | | +-----+ +-----+ | | v v .s 4 ^&Internal Procedures\&: .s 3 procedure-name TO procedure-name $ ---------------- --------------------- | | +-----+ | | | v ---+ v procedure-name $ | <--+ | | | | | +-----+ v .s 2 .f .lm 8 .rm 52 Note: Place a RETURN, STOP, or CALL EXIT statement ahead of the first TO statement. .nf .lm 0 .rm 60 .f .pg .c 60;^&FLECS Statement Extensions\& .s 4 ^&RETURN Statement\&: .s 2 .nf RETURN ( [E] ) .s 1 .f _...which will automatically set the function name equal to the value of the expression [E] and return to the invoking proceedure, thus returning a value of [E] as the value of the function. .s 2 .lm 8 .rm 52 Note: This statement format is only valid (recognized) in external function-subroutines; found anywhere else, it will remain unchanged in the output file. .lm 0 .rm 60 .s 4 ^&INCLUDE Statement\&: .s 2 .nf INCLUDE "filespec" .s 1 .f _...where the defaults for the file specification are device .if DEC DSK:, extension .FLX, and the job's current path. .endif DEC .if PDP DK: and extension .FLX. .endif PDP This statement causes the entire contents of the file specified to appear as if it was input at the point where the INCLUDE statement is encountered. INCLUDE'd files may be nested to a maximum of 5 levels, and any included statements will appear in the FLECS listing file. .if DEC .s 2 .lm 8 .rm 52 Note: The syntax for the FLECS INCLUDE statement differs from FORTRAN-10's by the type of quote character used--FLECS uses double quotes ("), FORTRAN-10 uses single quotes ('). Both types of statements may appear in FLECS programs. INCLUDEs with double quotes are done by FLECS and may include FLECS structured statements for translation into FORTRAN; INCLUDES with single quotes are ignored by FLECS and passed to FORTRAN and must not cause any FLECS statements to be included by FORTRAN! .lm 0 .rm 60 .endif DEC .pg ^&STRING Statement\&: .s 2 .nf 1) STRING variable (_#-chars) .s 1 2) STRING variable 'text' .s 1 .f The two forms of the STRING statement given above have been added to FLECS to aid in the use of "FLECS-format" strings in FLECS programs. This format uses an integer array to store strings with the current length of the string in the first word and the text of the string .if DEC packed in A5 format in the remainder of the array. .endif DEC .if PDP packed in A2 format in the remainder of the array. In addition, one extra character is allocated at the end of each RT-11 string to allow the user to null terminate the string for compatibility with SYSLIB. .endif PDP Thus, the first form above may be used to dimension an integer array with 1#+#the number of words necessary to store the given number of characters. The second form uses the length of the text specified as the length of the string and will both dimension the integer array and initialize the string to the specified text. The text string is a standard FORTRAN literal and embedded single quotes (') may be represented as usual by two single quotes (''). String declarations of either type may appear separated by commas in the same statement, but the STRING statement, like all FLECS statements, may not be continued to a new line--only one line of text is allowed per STRING statement. .if DEC .s 1 The file FOR:STRLIB.REL contains a library of subroutines for use with "FLECS-format" strings. For a complete description of these routines, consult the file FOR:STRLIB.PLM. Use the following form of the COMPIL-class command LOAD to link a FLECS program with the required routines from this library: .nf .s 1 .^&LOAD_ progrm.FLX(NOWARN),FOR:STRLIB.REL/LIB\& .s 2 .f .lm 8 .rm 52 Note: Use of the STRING statement in FLECS programs will usually result in mixing INTEGER and DATA statements in the resulting FORTRAN code. While most modern FORTRAN compilers (including FORTRAN-10) can deal with such occurrences, most also insist on producing a warning message for each statement which appears out of order according to the "traditional" rules for statement ordering. To turn off this message from FORTRAN-10 (which inherited this archaic trait!) use the /NOWARN switch when compiling FLECS files using the STRING statement as follows: .lm 0 .rm 60 .nf .s 1 .^&COMPILE_ progrm.FLX(NOWARN)\& .s 1 .f .endif DEC .pg ^&FLECS System Commands\&: .s 2 .nf $ [ ] .s 2 .f .lm 12 .rm 60 .i -12;$TRUE#######Sets the value of the specified argument, a conditional translation flag, to TRUE (maximum 10 flags). .s 1 .i -12;$FALSE######Sets the value of the specified argument to FALSE. .s 1 .i -12;$IF#########Turns on translation of subsequent input source lines only if the specified argument is TRUE. .s 1 .i -12;$UNLESS#####Turns on translation of subsequent input source lines only if the specified argument is FALSE. .s 1 .i -12;$FIN########Cancels effect of most recent $IF or $UNLESS, restores the decision to translate or not to its previous value. .s 1 .i -12;$DEFINE#####Defines its first argument as a symbol which is to be replaced by its second argument whenever found in the input file. .s 1 .i -12;$PAGE#######Output a form feed to the listing file (does not take an argument). .s 1 .i -12;$[NO]LIST###Turn off (on) output to the listing file. .lm 0 .rm 60 .pg .c 60;^&FLECS Restrictions\& .s 4 .ls .if DEC .le;Do not use statement numbers of the form 9xxxx or variables of the form I9xxxx, as these are created and used by FLECS. .endif DEC .if PDP .le;Do not use statement numbers of the form 3xxxx or variables of the form I3xxxx, as these are created and used by FLECS. .endif PDP .le;FLECS structured statements may not be continued to a second line. Statements not processed by FLECS, however, may be continued in the normal manner of FORTRAN-IV. .le;Blanks are NOT TRANSPARENT to FLECS. This means that while "D#O" is valid for the keyword "DO" in FORTRAN-IV, it is not valid in FLECS. All FLECS keywords are reserved and may not be used as variable names. .le;Any statements which are not recognized by FLECS (eg., assignments, FORMATs, ENCODE/DECODEs, PARAMETERs, etc.) are passed unchanged to FORTRAN. Such statements are assumed to be executable by FLECS and must be placed only where executable statements may appear. For example, the following code is in error... .nf .s 1 WHEN (X.EQ.0) TYPE 1 1 FORMAT (1X,'Division by Zero') ELSE Z=Y/X .s 1 .f _...since the ELSE statement must be the first "executable" statement after the scope of the preceding WHEN statement. The correct code, in this case, would be... .nf .s 1 WHEN (X.EQ.0) . TYPE 1 1 . FORMAT (1X,'Division by Zero') ...FIN ELSE Z=Y/X .s 1 .f .le;FLECS control phrases may not contain parentheses inside Hollerith literals. .els may appear. For example, the following code is in error... .nf .s 1 WHEN (X.EQ.0) TYPE 1 1 FORMAT (1X,'Division by Zero') ELSE Z=Y/X .s 1 .f _...since the ELSE statement must be the first "executable" statement af