Government of Canada Ottawa Ontario FLECS/RT-11 USER'S GUIDE IMPLEMENTATION VERSION 28.01 April 1980 FLECS/RT-11 V28 USER'S GUIDE 2 FORWARD _______ This document and the software it describes, are edited versions of work performed by Mr.Terry Beyer (herein refered to as the author) of the University of Oregon. COPYRIGHT _________ This manual is in the public domain and may be altered or reproduced without the explicit permission of the author. SUPPORT _______ Support for the RT-11 implementation of FLECS may be obtained from the design authority stated within this document. The department however, reserves the right to terminate support at any time without notice. DISCLAIMER __________ Although care has been taken to ensure the correct functioning of the FLECS system, neither the author nor the University of Oregon nor any agency of the Government of Canada shall be liable for any direct or indirect, incidental, consequential or specific damages of any kind, or from any cause whatsoever arising out of, or in any way connected with, the use or performance of the FLECS system or its documentation. ACKNOWLEDGEMENTS ________________ The author is indebted to many people for assistance of one form or another during the course of this project. Mike Dunlap, Kevin McCoy and Peter Moulton deserve special thanks for many helpful and fruitful discussions, suggestions, and encouragements. I am grateful to my wife Kathleen, who assisted in many ways including shielding me from the harsh reality of JCL and IBM 360 assembly language. Text preparation was adroitly accomplished by Marva VanNatta, Allyene Tom, Diane Lane and Kathleen Beyer. This project was initiated while the author was working under a grant provided by the Office of Scientific and Scholarly Research of the Graduate School at the University of Oregon. Work on the project has also been supported in part by the Department of Computer Science and by the Computing Centre of the University of Oregon. FLECS/RT-11 V28 USER'S GUIDE 3 TABLE OF CONTENTS 1. FLECS OVERVIEW .................................. 04 2. FLECS DECISION STRUCTURES ....................... 10 3. FLECS LOOP STRUCTURES ........................... 13 4. INTERNAL PROCEDURES ............................. 15 5. FLECS/RT-11 TRANSLATION DIRECTIVES .............. 18 6. OTHER FLECS/RT-11 FEATURES ...................... 21 7. RESTRICTIONS .................................... 22 8. HINTS TOWARDS A CODING STANDARD ................. 25 9. RUNNING THE TRANSLATOR UNDER RT-11............... 27 10. ERROR HANDLING .................................. 30 Appendix A - RT-11 INSTALLATION PROCEDURES .......... 33 Appendix B - FLECS SUMMARY .......................... 37 FLECS/RT-11 V28 USER'S GUIDE 4 FLECS/RT-11 USER'S GUIDE IMPLEMENTATION VERSION 28 1. FLECS OVERVIEW _____ ________ 1.1 INTRODUCTION ____________ FORTRAN contains four basic mechanisms for controlling program flow: CALL/RETURN, IF, DO and various forms of the GOTO. FLECS is a language extension of FORTRAN which has additional control mechanisms. These mechanisms make it easier to write FORTRAN by eliminating much of the clerical detail associated with constructing FORTRAN programs. FLECS is also easier to read and comprehend than FORTRAN. 1.2 SCOPE OF DOCUMENT _____ __ ________ This manual is intended to be a brief but complete introduction to FLECS and its RT-11 implementation. It is not intended to be a primer on FLECS or structured programming. The reader is assumed to be a knowledgeable FORTRAN programmer. 1.3 PORTABILITY ___________ For programmers to whom transportability of their programs is a concern, it should be noted that the FLECS translator source code is in the public domain and is made freely available. The translator was written with transportablilty in mind and should require little effort to move from one machine to another. Those interested in moving FLECS to a machine other than a PDP-11 running RT-11 should contact: Mr. Terry Beyer Computing Centre University of Oregon Eugene, Oregon 97409 Telephone: (503) 686-4416 1.4 RT-11 IMPLEMENTATION DESIGN AUTHORITY _____ ______________ ______ _________ The RT-11 implementation of FLECS described in this document may be obtained from: National Defence Headquarters Ottawa Ontario Canada K1A 0K4 Attention: Mr. G. L. Adams (DACS 2) Telephone: (613) 993-9624 FLECS/RT-11 V28 USER'S GUIDE 5 1.5 RT-11 IMPLEMENTATION STANDARDIZATION _____ ______________ _______________ As with all "implementations", the RT-11 implementation has some enhancements which make it a little more useable, but slightly different from pure FLECS. Since "local improvements" tend to destroy standardization and hence transportability, the user may easily edit out any non-standard features, should it become necessary to move any programs to a different system. 1.6 HOW FLECS WORKS ___ _____ _____ FLECS is implemented as a preprocessor which translates FLECS programs into FORTRAN programs. The resulting FORTRAN program is then processed in the usual way. The translator also produces a nicely formatted listing of the FLECS program which graphically presents the control structures used. Diagram 1-1 illustrates the translating process. Diagram 1-1 The Translation Process .----------. .------------. .-----------. . FLECS . ! FLECS ! . FORTRAN . . SOURCE . --------> ! TRANSLATOR ! -----> . SOURCE . .__________. !____________! .___________. ! v .------------. ! INDENTED ! ! LISTING ! !____________! 1.7 RETENTION OF FORTRAN FEATURES _________ __ _______ ________ The FLECS translator examines each statement in the FLECS program to see if it is either a translation directive (a statement which controls translation but does not actually generate any FORTRAN code) or an extended statement (a statement which is valid in FLECS but not in FORTRAN). If it is recognized as an extended statement, the translator generates the corresponding FORTRAN statements. If it is recognized as a translation directive, the appropriate action is performed (such as causing the listing to go to top-of-form). FLECS/RT-11 V28 USER'S GUIDE 6 If however, the statement is not recognized as either an extended statement or a translation directive, then the translator assumes it must be a FORTRAN statement and passes it through unaltered. Thus the FLECS system does not restrict the use of FORTRAN, it simply provides a set of additional statements which may be used. In particular, GOTOs, arithmetic IFs, CALLs, arithmetic statement functions, and any other FORTRAN statements, compiler dependant or otherwise, may be used in a FLECS program. 1.8 CORRELATION OF FLECS AND FORTRAN SOURCES ___________ __ _____ ___ _______ _______ One difficulty of preprocessor systems like FLECS is that error messages which come from the FORTRAN compiler must be related back to the original FLECS source program. This difficulty is all but eliminated in the RT-11 implementation because both the FLECS line numbers and the FORTRAN line numbers (not to be confused with FORTRAN statement numbers) are placed on the listings output by the FLECS translator. Since RT-11 FORTRAN compiler errors are given at the end of compilation in terms of the line number, only the one listing need be consulted. There is seldom any need to cross-compare the FLECS listing and its associated FORTRAN listing. On those rare occasions when cross-comparison is required, the programmer may insert sequence numbers in columns 76 to 80 in the FLECS source program or have the FLECS translator do it automatically for him. The sequence numbers are carried through to the FORTRAN code and hence FORTRAN errors which are reported, may be found by manually tracing them back from the FORTRAN listing to the FLECS source. 1.9 STRUCTURED STATEMENTS __________ __________ A basic notion of FLECS is the structured statement which consists of a control phrase and its scope. FORTRAN has two _______ ______ _____ structured statements, the logical IF and the DO. For example, in the FORTRAN statement IF (A.GT.B) A=B The portion IF (A.GT.B) is the control phrase while A=B is its scope. Similarily, in the FORTRAN program segment DO 100 I=1,10 A(I)=B(I)+C L(I)=I-K(I) 100 CONTINUE the line DO 100 I=1,10 is the control phrase and the remaining lines are the scope. Each control phrase consists of two parts, a keyword and some _______ additional information called the specification. In the above _____________ FLECS/RT-11 V28 USER'S GUIDE 7 examples, IF and DO were the keywords. Note that in FORTRAN and in FLECS, not all statements have a scope. Some such as CALL, the arithmetic IFs and the GOTOs have only a control phrase. These are called simple statements. ______ __________ The problem with the FORTRAN logical IF statement is that its scope may contain only a single simple statement. This restriction is eliminated in the case of the DO, but at the cost of clerical detail (having to stop thinking about the problem while a statement number is invented). Note also that the IF specification is enclosed in parentheses while the DO specification is not. In FLECS, there is a uniform convention for writing control phrases and indicating their scopes. To write a structured statement, the keyword is placed first on a line, followed by its specification enclosed in parentheses. The remainder of the line is left blank or may contain one simple statement as its scope. If a simple statement is included on the same line as the structured statement, a single-line structured statement is ___________ __________ _________ created. If a simple statement is not included on the same line as the structured statement, then the scope is placed on successive lines creating a multi-line structured statement. The scope of __________ __________ _________ each multi-line structured statement is terminated with a FIN. The following examples illustrate. IF (X.EQ.Y) !A multi-line IF. U=V+W S=T*G FIN DO (I=1,100) !A multi-line DO. A(I)=B(I)+C C=C*3.14159 FIN !Note no statement number. DO (I=1,100) A(I)=0 !A single line DO. Nesting of structured statements is permitted to any depth. Here is an example of nested structured statements. IF (X.EQ.Y) !Start of level 1. U=V+W DO (I=1,N) !Start of level 2. A(I)=B(I)+C C=C*2.14-3.14159 FIN !End of level 2. R=S+T FIN !End of level 1. FLECS/RT-11 V28 USER'S GUIDE 8 Since each control phrase must begin on a new line, it is not possible to have a one-line structured statement whose scope consists of a structured statement. As an example, the following is not valid in FLECS. __ ___ _____ IF (A.EQ.B) DO (I=1,10) C(I)=D(I) To achieve the effect desired above, the IF must be written in the multi-line form as in the following example. IF (A.EQ.B) DO (I=1,10) C(I)=D(I) FIN In addition to IF and DO, FLECS provides some additional structured statements not available in FORTRAN. These will be discussed later. 1.10 INDENTED LISTING OF SOURCE LINES ________ _______ __ ______ _____ In the examples of multi-line structured statements above, the statements in the scope were indented in an "L" shape. The indentation effect helps to reveal the structure of the program. The FLECS translator performs this indentation automatically and enhances the effect by adding trace-back dots which join each keyword to its matching FIN. The following example illustrates. DO (I=1,10) . A(I)=B(I) . C(I)=B(I)*3.14159 ...FIN The rules for indentations are quite simple and uniform. The control phrase of a multi-line structured statement always causes indentation of the statements that follow. Nothing else causes indentation. A level of indentation (i.e. a scope) is always terminated with a FIN. Nothing else terminates a level of indentation. When writing a FLECS program on paper, the programmer should adopt the indentation and line drawing conventions shown above. When preparing a FLECS source program with a text editor, however, each line should begin after a tab character or on column 7. If the programmer attempts to introduce his own indentation by using leading tabs or blanks, the FLECS translator will ignore them. The correctly indented listing is a tremendous aid in reading and working with FLECS programs. Except for the dots and indentations, the lines appear exacly as they appear in the source program and internal spacing (as opposed to leading FLECS/RT-11 V28 USER'S GUIDE 9 spacing) is preserved. There is seldom any need to refer to a straight listing of the unindented source. 1.11 COMMENTS ________ In order to prevent interruption of the trace-back dots which indicate the scope, a comment line which contains only blanks in columns 2 through 6 will be listed with columns 7 through 72 indented at the then-current level of indentation (as if the line were an executable statement). If however, one or more non-blank characters appear in columns 2 through 6, it will be listed without indentation. As an additional aid to readability, blank lines may be inserted in the source (without a C in column 1) and will be treated as empty comments. In addition to regular FORTRAN comments as indicated by a C in column 1, in-line comments are also supported. Any text appended to a line following an exclamation mark (!) is treated as a comment. FLECS/RT-11 V28 USER'S GUIDE 10 2. FLECS DECISION STRUCTURES _____ ________ __________ Structured statements which control the execution of their scopes on the basis of a logical expression test are called decision structures. 2.1 IF __ The IF statement causes a logical expression to be evaluated. If the value is true, the scope is executed once and control passes to the next statement. If the value is false, control passes directly to the next statement without execution of the scope. Examples: IF (A.GT.B) X=R*COS(A) IF ((T.GT.0).AND.(S.LT.R)) . I=I+1 . Z=0.1 ...FIN 2.2 UNLESS ______ The UNLESS statement is functionally equivalent to an "IF (.NOT.---)" statement but is useful because it is more readable in most contexts. Example: UNLESS (ERROR) . READ (1,1) A . WRITE(2,2) A ...FIN 2.3 WHEN/ELSE _________ The WHEN/ELSE statements correspond to the IF/THEN/ELSE statements of ALGOL, PL/1, PASCAL etc. In FLECS, both the WHEN and the ELSE act as structured statements although only the WHEN has a specification. The ELSE statement must immediately follow the scope of the WHEN. After the specifier of the WHEN is evaluated, one and only one of the two scopes is executed. The scope of the WHEN is executed if the expression is true and the scope of the ELSE is executed if the expression is false. In either case, control then passes to the next statement following the scope of the ELSE statement. Examples: WHEN (X.EQ.0) ANSWER=.FALSE. ELSE ANSWER=.TRUE. FLECS/RT-11 V28 USER'S GUIDE 11 WHEN (GOODANSWER) . X=R*SIN(THETA) . CALL EVALU8(X) ...FIN ELSE . TRIES=TRIES+1 . TYPE *,' PROGRAM-I-Your answer was bad.' ...FIN Notes: WHEN and ELSE always come as a pair of statements, never separately. Either the WHEN or the ELSE or both may assume the multi-line form. ELSE is considered to be a control phrase, hence cannot be placed on the same line as the WHEN. 2.4 CONDITIONAL ___________ The CONDITIONAL statement is based on the LISP conditional. A list of logical expressions is evaluated one by one until the first expression to be true is encountered. The scope corresponding to that expression is executed and control then passes to the first statement following the CONDITIONAL. If all expressions are false, no scope is executed. (See however, the note about OTHERWISE below). Examples: CONDITIONAL . (X.LT.-5) U=U+W . (X.LE..1) U=U-W . (X.LE.1.) U=U*W ...FIN CONDITIONAL . (A.EQ.B) Z=1 . (A.LE.C) . . Z=2 . . R=X-4 . ...FIN . (A.GT.D) Z=Z-1 . (OTHERWISE) Z=0 ...FIN Notes: The CONDITIONAL itself does not possess a one-line form. Each element of the CONDITIONAL however, is treated as a structured statement and may be in a one-line or a multi-line form. FLECS/RT-11 V28 USER'S GUIDE 12 The reserved word OTHERWISE represents a catchall condition. (OTHERWISE) is equivalent to (.TRUE.). 2.5 SELECT ______ The SELECT statement is similar to the CONDITIONAL but is more specalized. It allows the specification to be tested for equality to each element in a list of expressions. When the first matching expression is encountered, the corresponding scope is executed and the SELECT statement terminates. Any type of expression (integer, real, complex etc.) may be used as long as the underlying FORTRAN system allows such expressions to be compared with an .EQ. or .NE. operator. Example: OPCODE=MEMORY(PC) SELECT (OPCODE) . (JMP) PC=MEMORY(PC+2) . (ADD) . . SRC=MEMORY(PC+2) . . DST=MEMORY(PC+4) . . MEMORY(DST)=MEMORY(DST)+MEMORY(SRC) . . PC=PC+6 . ...FIN . (NOP) PC=PC+2 . (OTHERWISE) CALL TRAP4(PC) ...FIN Notes: As in the case of CONDITIONAL, at most one of the elements of the SELECT will be executed. The catchall OTHERWISE may also be used in a SELECT statement. (OTHERWISE) in our example would be equivalent to (OPCODE.EQ.OPCODE). The specification of the SELECT is evaluated for each comparison in the list. Lengthy, time consuming or non-reproduceable expressions should be pre-computed, assigned to a variable and then the variable used in its place. FLECS/RT-11 V28 USER'S GUIDE 13 3. FLECS LOOP STRUCTURES _____ ____ __________ Loop structures all have scopes which are executed a variable number of times depending on the specified conditions. Of the five loops presented, the most useful are the DO, the WHILE and the REPEAT UNTIL. To avoid confusion, the REPEAT WHILE and the UNTIL loops should not be used unless absolutely necessary. Except for the DO, the presence of the keyword REPEAT directs that testing be done at the end of the loop. If REPEAT is not ___ present then testing is done at the beginning of the loop. 3.1 DO __ The FLECS DO loop is functionally identical to the FORTRAN DO loop. The only differences are syntactical. In the FLECS DO loop, the statement number is omitted from the specification, the specification is enclosed in parentheses and the scope may be either single-line or multi-line. Examples: DO (I=1,N) A(I)=0.0 DO (J=4,62,2) . B(J)=B(J-1)*B(J-2) . C(J)=SIN(B(J)) ...FIN Notes: With FORTRAN/RT-11, testing is done at the end of the loop. As a consequence, all DO loops will be executed at least once regardless of the specification parameters. 3.1 WHILE _____ The WHILE loop causes its scope to be repeatedly executed while a specified condition is true. The condition is checked prior to the first execution of the scope. If the condition is false, the scope will never be executed at all. Examples: WHILE (X.LT.A(I)) I=I+1 WHILE (P.NE.0) . VAL(P)=VAL(P)+1 . P=LINK(P) ...FIN FLECS/RT-11 V28 USER'S GUIDE 14 3.2 REPEAT WHILE ______ _____ The REPEAT WHILE is similar to the WHILE loop except that the use of the REPEAT verb causes the test to be logically moved to the end of the loop. Since the condition is not checked until after the first execution of the scope, the scope will always be executed at least once. The condition indicates under what conditions the scope is to be repeated. ________ Examples: REPEAT WHILE (N.EQ.M(I)) I=I+1 3.3 UNTIL _____ The UNTIL loop causes its scope to be repeatedly executed until a specified condition becomes true. The condition is checked prior to the first execution of the scope, thus if the condition is initially true, the scope will not be executed at all. The UNTIL is functionally equivalent to WHILE (.NOT.---). Examples: UNTIL (X.EQ.A(I)) I=I+1 3.5 REPEAT UNTIL ______ _____ By using the REPEAT verb, the test can be logically moved to the end of the loop. The REPEAT UNTIL loop causes its scope to be repeatedly executed until a specified condition becomes true. The condition is not checked until after the first execution of the scope thus the scope will always be executed at least once. The condition indicates under what conditions the repetition of __________ the scope is to be terminated. Examples: REPEAT UNTIL (END_OF_FILE) . END_OF_FILE=.TRUE. . READ (1,1,END=100) A,B,C . END_OF_FILE=.FALSE. 100 . UNLESS (END_OF_FILE) WRITE(2,2) A,B,C ...FIN FLECS/RT-11 V28 USER'S GUIDE 15 4. INTERNAL PROCEDURES ________ __________ In FLECS, a sequence of statements may be declared an internal ________ procedure and given a name. The procedure may then be invoked _________ from any point in the program by simply giving its name. 4.1 INTERNAL PROCEDURE NAMES ________ _________ _____ Procedure names may be any string of letters, digits and hyphens (i.e. minus signs) beginning with a letter and containing at least one hyphen. Internal blanks are not allowed. The only restriction on the length of a name is that it may not be continued onto a second line. Examples of valid internal procedure names: INITIALIZE-ARRAYS GIVE-WARNING SORT-INTO-DESCENDING-ORDER INITIATE-PHASE-3 4.2 INTERNAL PROCEDURE DECLARATIONS ________ _________ ____________ A procedure declaration consists of the keyword "TO" followed by _________ ___________ the procedure name and its scope. The set of statements comprising the procedure is called its scope. If the scope consists of a single simple statement, it may be placed on the same line as the "TO" and the procedure name, otherwise the statements of the scope are placed on the following lines and terminated with a FIN. These rules are analogous with the rules for forming the scope of a structured statement. Examples: TO DO-NOTHING CONTINUE TO SUMMARIZE-THE-FILE . INITIALIZE-SUMMARY . OPEN-FILES . REPEAT UNTIL (ENDOFFILE) . . READ-A-RECORD . . WHEN (ENDOFFILE) CLOSE-FILES . . ELSE UPDATE-THE-SUMMARY . ...FIN ...FIN 4.3 REFERENCING AN INTERNAL PROCEDURE ___________ __ ________ _________ An internal procedure reference is a procedure name appearing ________ _________ _________ where an executable statement would be expected. In fact, an internal procedure reference is an executable simple statement __ and thus may be used in the scope of a structured statement as in the last example. FLECS/RT-11 V28 USER'S GUIDE 16 When control reaches a procedure reference during execution of a FLECS program, a return address is saved and control is transferred to the first statement in the procedure. When control reaches the end of the procedure's scope, control is transferred back to the statement logically following the procedure reference. A typical FLECS program consists of a sequence of FORTRAN declarations: (e.g. SUBROUTINE, INTEGER, DIMENSION, COMMON, etc.) followed by a sequence of executable statements called the body of the program followed by the FLECS internal procedure ____ declarations if any, and finally the END statement. As an example, a complete (but uninteresting) FLECS program follows which illustrates the placement of the procedure declarations. It is shown exacly as it would be listed by the FLECS/RT-11 implementation. Note both the FLECS and the FORTRAN line numbers on the left, the use of blank lines by the programmer and the dashed lines generated by the translator to separate procedure declarations. Example: 0001 C Interactive Program to Compute X**2. 0002 C A zero input terminates execution. 0003 0004 001 REAL X,XSQ 0005 0006 002 REPEAT UNTIL (X.EQ.0.) 0007 005 . GET-A-VALUE-OF-X 0008 007 . UNLESS (X.EQ.0.) 0009 009 . . COMPUTE-RESULT 0010 010 . . TYPE *,' X SQUARED = ',XSQ 0011 . ...FIN 0012 ...FIN 0013 0014 011 CALL EXIT -------------------------------------- 0015 TO GET-A-VALUE-OF-X 0016 012 . TYPE 10 0017 013 10 . FORMAT('$Give me an X? ') 0018 014 . ACCEPT 20,X 0019 015 20 . FORMAT(F10.5) 0020 016 ...FIN -------------------------------------- 0021 017 TO COMPUTE-RESULT XSQ=X*X 0022 0023 019 END FLECS/RT-11 V28 USER'S GUIDE 17 Notes: All internal procedure declarations must be placed at the end of the program just prior to the END statement. The appearance of the first "TO" statement terminates the body of the program. The translator expects to see nothing but procedure declarations from that point on. In particular, the translator will reject FORMAT statements; thus they cannot be placed just before the END statement in the program. The suggested place for FORMAT statements is at the beginning of the program immediately following the data declaration section (i.e. make FORMAT look like part of the data declaration). The order of internal procedure declarations is not important. The translator prints an alphabetical procedure cross reference table at the end of the listing to assist in finding procedure references and declarations. Procedure declarations may not be nested. The following example is not valid in FLECS. ___ _____ TO DO-THE-WHOLE-THING . A=B+C . TO DO-PART-OF-THE-THING . . B=C+D . ...FIN ...FIN A procedure may reference any other procedures but may not reference itself. Dynamic recursion of procedure referencing is not allowed. All program variables are global and accessable to the statements in any internal procedure or the program body. There is no formal mechanism for defining or passing parameters to an internal procedure. When parameter passing is needed, the FORTRAN function or subroutine mechanisms should be used. The FLECS translator automatically separates procedure declarations on the listing by dashed lines thus improving the aesthetics of the output. Do not confuse internal procedures with FORTRAN function or subroutine subprograms. Internal procedures form a part of a function or subroutine subprogram, or of course, a main program. FLECS/RT-11 V28 USER'S GUIDE 18 5. FLECS/RT-11 TRANSLATION DIRECTIVES ___________ ___________ __________ The RT-11 implementation of FLECS allows the user to specify several translation directives that are not available in standard FLECS or in FORTRAN/RT-11. They actually make using FLECS under RT-11 easier. Should the programs have to be transported to a different system with only standard FLECS, the RT-11 implementation can be standardized simply by editing out any translation directives used. Translation directives are not shown on the listings produced by FLECS, they are only visible in the actual source code. Most translation directives start with a "$" in column 1 with the first letter of the specific command in column 2. All others have regular FLECS format. 5.1 $FORTRAN/$NFORTRAN __________________ The $NFORTRAN or $NF directive turns off FORTRAN output (which speeds up FLECS processing). The $FORTRAN or $F directive turns it back on again. Users should be aware that in most cases, turning off FORTRAN output will result in FORTRAN code which is incomplete for compilation. 5.2 $LIST/$NLIST ____________ The $NLIST or $NL directive turns listing output off (to speed up FLECS processing on already debugged sections of code). The $LIST or $L directive turns the listing back on. 5.3 $PAGE _____ The $PAGE or $P directive causes a form-feed to be output to the listing so that the user may start appropriate sections of code at the top-of-form. Note that the FLECS translator never outputs form-feeds except when requested by the $PAGE directive. 5.4 $X/$NX ______ The $X and $NX directives facilitate the conditional translation of source lines which have an "X" in column 1. When $X is invoked, all lines which have an "X" in column 1 are translated or are passed through to FORTRAN as appropriate. When $NX is invoked, all lines which have a "X" in column 1 are totally ignored (not even listed). FLECS/RT-11 V28 USER'S GUIDE 19 Notes: $NX is the default condition at the commencement of translation. If an input line is processed with an "X" in column 1 and there is a "C" or a "D" in column 2, the "C" or the "D" will be moved to column 1 and the statement treated as a comment. The use of the FORTRAN debug option (conditional compilation of lines with "D" in column 1) is not recommended in FLECS. The line numbering on the listings will be incorrect and may lead the user astray. $X/$NX should be used instead. 5.5 INCLUDE _______ The INCLUDE directive is simular to the INCLUDE statement available in FORTRAN IV PLUS. It allows source input to to be "included" from a secondary input file. Format: INCLUDE DEV:FILNAM.EXT In the following example, files "COM1.CMB" and "COM2.CMB" contain "COMMON /ABC/ A,B,C" and "COMMON /DEF/ D,E,F" respectively. The program would be entered via the editor as: PROGRAM MAIN INCLUDE COM1.CMB INCLUDE COM2.CMB CALL SUB1 CALL SUB2 CALL EXIT END SUBROUTINE SUB1 INCLUDE COM1.CMB RETURN END SUBROUTINE SUB2 INCLUDE COM2.CMB RETURN END Notes: INCLUDE statements must begin immediately in column 7 or after a tab character. FLECS/RT-11 V28 USER'S GUIDE 20 DEV:FILNAM.EXT must be separated from the INCLUDE keyword by 1 and only 1 space. A file which is being included may not include another file (i.e. INCLUDE nesting is only 1 deep). If the device "DEV:" is not given in the file specification, then the standard user default device "DK:" is used. Inline comments may not be placed on the same line as an INCLUDE statement. Use of the INCLUDE is especially usefull when there are a large number of programs which reference the same COMMON block. Normally, when changes occur to a COMMON block, every program which references it must be individually edited. If however, the COMMON block is in its own file and INCLUDEd into the programs, then only the one file need be edited. The common block change will be in effect when each program is re-translated. FLECS/RT-11 V28 USER'S GUIDE 21 6. OTHER FLECS/RT-11 FEATURES _____ ___________ ________ 6.1 EXTENDED VARIABLES ________ _________ FORTRAN/RT-11 allows the use of variable names longer than six characters (although only the first 6 are recognized). Unfortunately, variables like "ENDOFFILE" or "VALOFXSQUARED" are not very readable. FLECS/RT-11 allows the underscore character "_" to be used as part of a variable name. Hence, the above examples may be written as "END_OF_FILE" or "VAL_OF_X_SQUARED" which greatly enhances their readability. Notes: All that the current implementation does to the "_" characters it encounters, is to replace them with the character "I". Hence the variable "END_OF_FILE" would be seen in the FORTRAN compiler as "ENDIOF". Users should be careful that the names of variables with underscores in them do not inadvertantly clash with variables used elsewhere. For example, the variables "INITIAL" and "IN_T_AGAIN" both work out to be "INITIA". FLECS/RT-11 V28 USER'S GUIDE 22 7. RESTRICTIONS ____________ If FLECS were implemented by a nice intelligent compiler, this section would be much shorter. Currently however, FLECS is implemented by a sturdy but naive translator. Thus the FLECS programmer must observe the following restrictions. 7.1 STATEMENT NUMBERING _________ _________ FLECS must invent many statement numbers in creating the FORTRAN program. It does so by beginning with 32767 (the largest 16 bit integer) and generating successively smaller numbers as it needs them. Never use a statement number which is likely to be produced by the translator. A good rule-of-thumb is to avoid using 5 digit _____ _____ _ _____ statement numbers. _________ _______ 7.2 VARIABLE CONVENTIONS ________ ___________ The FLECS translator must generate integer variable names. It does so by using names of the form "Innnnn" where nnnnn is a 5 digit number generated similar to the statement numbers mentioned in section 7.1. Never use a variable of the form "Innnnn" which is likely to be produced by the translator. A good rule-of-thumb is to avoid _____ using variables of the form "Innnnn". _____ _________ __ ___ ____ _________ 7.3 TYPE DECLARATIONS ___ ____ ____________ FLECS generates variables of the form "Innnnn" which must be INTEGER. Never cause them to be declared as any other type. For example the declaration "IMPLICIT REAL (A-Z)" leads to trouble. Try "IMPLICIT REAL (A-H,J-Z)" instead. 7.4 CONTINUATION LINES ____________ _____ The translator does not recognize continuation lines in the source file. This doesn't mean that they can't be used, just that the translator doesn't recognize them. Pure FORTRAN statements may be continued since each statement and ___ its continuations will be passed through the translator without alteration (see section 1.6). Extended FLECS statements however, ________ _____ __________ ________ may not be continued (including the IF statement). ___ ___ __ _________ Note that the FORTRAN/RT-11 convention of a tab, followed by a numeric character denoting a continuation line, may not be used. FORTRAN continuation lines must begin in column 6 with leading _______ ____________ _____ ____ _____ __ ______ _ ____ _______ spaces only (i.e. no leading tabs). ______ ____ _____ __ _______ _____ The reasons one might wish to continue a FLECS statement are 1) it is a structured statement or procedure declaration with a one FLECS/RT-11 V28 USER'S GUIDE 23 statement scope too long to fit on a line, or 2) it contains an excessively long specification portion, or 3) both of the above. Problem 1 can be avoided by going to the multi-line form. Frequently, problem 2 can be avoided when the specification is an expression (logical or otherwise), by assigning the expression to a variable in a preceding statement and then using the variable as the specification. 7.5 BLANKS ARE SEPARATORS ______ ___ __________ Blanks are meaningful separators in FLECS statements. Don't put ______ ___ __________ __________ __ _____ __________ them in dumb places like the middle of identifiers or keywords and do use them to separate distinct words like REPEAT and UNTIL. __ 7.6 FLECS INDENTATION _____ ___________ User indentation will be ignored by FLECS; this way, the listings will always reveal the true structure of the program (as understood by the translator, of course). 7.7 FORMAT STATEMENT PLACEMENT ______ _________ _________ As far as the translator is concerned, FORMAT statements are executable FORTRAN statements since it doesn't recognize them as extended FLECS statements. Thus, only place FORMAT statements ____ _____ ______ __________ where an executable FORTRAN statement would be acceptable. _____ __ __________ _______ _________ _____ __ __________ It is recomended that FORMAT statements be placed after any data declarations but before the body of the program. Don't put them between the end of a WHEN and the beginning of an ELSE or between procedure declarations. Incorrect examples: WHEN (FLAG) WRITE (1,1) 1 FORMAT(' TITLE:') ELSE LINE=LINE+1 TO WRITE-HEADER . PAGE=PAGE+1 . WRITE (1,1) PAGE ...FIN 1 FORMAT(' PAGE: ',I3) 7.8 RESERVED WORDS ________ _____ The translator, being simple-minded, recognizes extended FLECS statements by the process of scanning the first identifier on the line. If the identifier is one of the FLECS keywords (IF, WHEN etc.) the line is assumed to be an extended statement and is treaded as such. Thus, FLECS keywords are reserved words and may _____ ________ ___ ________ _____ ___ ___ not be used as variable names. ___ __ ____ __ ________ _____ FLECS/RT-11 V28 USER'S GUIDE 24 Should it be absolutely necessary, a variable name, say WHEN, may be slipped past the translator by embedding a blank within it. Thus "WH EN" will look like "WH" followed by "EN" to the translator which is blank sensitive, but like "WHEN" to the compiler which ignores blanks. 7.9 PARENTHESES AND HOLLERITH CONSTANTS ___________ ___ _________ _________ In scanning a parenthesized specification, the translator scans from left to right to find the right parenthesis which matches the initial left parenthesis of the specification. The translator, however, is ignorant of FORTRAN systax including the concept of Hollerith constants and will treat Hollerith parentheses as syntactic parentheses. Never place Hollerith constants containing unbalanced parentheses _____ _____ _________ _________ __________ __________ ___________ within specifications. ______ ______________ If necessary, assign such constants to a variable and place the variable in the specification. Incorrect Example: IF (J.EQ.'(') DO-SOMETHING Correct Example: LP='(' IF (J.EQ.LP) DO-SOMETHING 7.10 RETURNS,STOPS AND EXITS _____________ ___ _____ The FLECS translator will not supply the statements necessary to cause appropriate termination of main and subprograms. Thus it __ is necessary to include the appropriate RETURN, STOP or CALL EXIT __ _________ __ _______ ___ ___________ _______ ____ __ ____ ____ statement prior to the first internal procedure declaration. _________ _____ __ ___ _____ ________ _________ ___________ Failure to do so will result in control entering the scope of the first procedure after the body of the program. One mistake often made by novice FLECSers is to put the RETURN statement between the procedure declarations and the END statement. 7.11 EXCLAMATION MARKS AND UNDERSCORES ___________ _____ ___ ___________ Exclamation marks "!" and underscores "_" have special meanings to the translator (inline comments and extended variables). The underscore character may not be used in literal strings of the ___ ___ form '_' and both may only use the form "1H!". The translator recognizes the "1H" and will not action the normal special meaning. FLECS/RT-11 V28 USER'S GUIDE 25 8. HINTS TOWARDS A CODING STANDARD _____ _______ _ ______ ________ There have been numerous specifications written on how one should go about developing top-down structured programs. In most cases, the points brought out are no more than good common-sense programming practices. As an aid to programmers, the following hints should be helpful in writing good FLECS code which will be both readable and maintainable. 8.1 MODULARITY __________ Each individual program used to implement functions at all levels of the software hierarch should be highly independent, single-functioned modules. 8.2 MODULE READABILITY ______ ___________ A module should never exceed 200 lines of code and the body of the program should be easily readable on one page. Implement the body such that the use of internal procedures and subroutine calls, coupled with the flow-control, makes it read almost like pseudo-code. 8.3 USE OF INTERNAL PROCEDURES ___ __ ________ __________ Don't go internal procedure crazy. Novice FLECSers fall quickly in love with them and wind up with one huge, slow to translate file. Use internal procedures only when the routine is discrete to a given program. Use the call mechanism when a routine is referenced from many different programs. For example: CALL INIT !TO INITIALIZE THE DATA BASE vs. INITIALIZE-THE-DATA-BASE Note also that CALLed subroutines may be overlayed (using the nice RT-11 overlay feature) but internal procedures cannot. 8.4 GLOBAL DEFINITIONS ______ ___________ All references to centralized assignments and definitions should be coherently generated using the "INCLUDE" statement rather than retyping all the required references in each and every program. 8.5 SOURCE FILES ______ _____ Each module should be contained in its own source file. Subroutines and function subprograms which are called by only one module should be included in the same file. FLECS/RT-11 V28 USER'S GUIDE 26 8.6 USE LOGICAL VARIABLES ___ _______ _________ FLECS tends to require the use of flow control flags. Use "LOGICAL*1" data for this purpose rather than numeric value checking, the result will be more readable. Bad example: REPEAT UNTIL (I.EQ.1) . I=INPUT(DATA) . UNLESS (I.EQ.1) CALL OUTPUT(DATA) ...FIN END Good example: (at least more readable) LOGICAL*1 END_OF_FILE,INPUT REPEAT UNTIL (END_OF_FILE) . END_OF_FILE=INPUT(DATA) . UNLESS (END_OF_FILE) CALL OUTPUT(DATA) ...FIN END 8.7 NEVER GOTO _____ ____ Never use a "GOTO" statement, there is always another way. If ______ you think you must, for the purpose of an "abnormal" exit from a loop (or something), then review your basic structured programming. Set a flag! Set a flag! Set a flag! FLECS/RT-11 V28 USER'S GUIDE 27 9. RUNNING THE TRANSLATOR _______ ___ __________ Special care has been taken to ensure that this implementation "follows the rules" for RT-11 system programs. It works pretty much like you would expect (assuming you have used other RT-11 programs) and should offer no surprises. 9.1 STARTING THE TRANSLATOR ________ ___ __________ FLECS is normally on the system disk "SY:" and is started with the KMON command "R". For example: .R FLECS If FLECS is on the user disk, or some other media, it is started with the KMON command "RUN". For example: .RU DT1:FLECS Note: denotes the "return" key on the keyboard. 9.2 COMMAND STRING INTERPRETOR (CSI) INPUT _______ ______ ___________ _____ _____ Control input to the FLECS translator is via a standard CSI command of the form: [fort-out][,list-out]=flecs-input Notes: Each field (fort-out, list-out etc.) is a file specification of the form "DEV:FILNAM.EXT". Fields enclosed in square brackets "[]" indicate optional file specifications. The default device for all file specifications is the standard user default "DK:". The "flecs-input" file contains the FLECS source code. The "fort-out" file, if specified, receives the generated FORTRAN source code. The "list-out" file, if specified, receives the indented listings. The default extension for "fort-out" is ".FOR". The default extension for "list-out" is ".LST". The default extension for "flecs-input" is ".FLX". FLECS/RT-11 V28 USER'S GUIDE 28 9.3 CSI SWITCHES ___ ________ The following switches may be used to enhance the FLECS control commands. /W:n Select listing width n where 64<=n<=136. The default listing width is 132. /X Translate all lines with an X in column 1 independant of any ___ conditional translation requests made using the $X and $NX directives. /S Place the FLECS line numbers into the sequence position of the generated FORTRAN code. This is occasionally useful when relating the FLECS sources to the FORTRAN sources. /F Generate a FORTRAN file of the same name and on the same device as the FLECS input file. The CSI specification "*ABC/F" would be exactly the same as "*ABC=ABC". /L Generate a listing file of the same name and on the same device as the FLECS input file. The CSI command "*ABC/L" would be exactly the same as "*,ABC=ABC". /P Generate a listing on the printer "LP:". The CSI command "*ABC/P" is exactly the same as "*,LP:=ABC". /T Generate a listing on the system console "TT:". The CSI command "*ABC/T" is exactly the same as "*,TT:=ABC". /I Indent the source file to produce a new source file that has the same indentation as the corresponding listing-file. This is often useful for editing purposes. No output file specifications may be given with /I; output goes to the file "DK:FLECS.TMP". Upon completion, the flecs-input file is renamed to have the extension ".BAK" and "DK:FLECS.TMP" is renamed to the same name as the original flecs-input files. /N Suppress processing of INCLUDE directives. This switch is selected automatically with /I. 9.4 NULL HANDLER ____ _______ When no FORTRAN or listing output is requested, output goes to the bit-bucket device "NL:". For correct operation the null ___ ____ device handler "NL:" must be installed. ______ _______ _____ ____ __ _________ 9.5 EXAMPLES ________ To translate the file "DK:ABC.FLX" into "DK:ABC.FOR" and then compile it into "DK:ABC.OBJ", both of the following examples could be used. Listings are sent to "LP:". FLECS/RT-11 V28 USER'S GUIDE 29 Example 1 .INS NL: !If not already done. .R FLECS !Start the translator. *ABC,LP:=ABC !Tell it what to translate. *^C !Return to KMON via a control C. .R FORTRAN !Start the FORTRAN compiler. *ABC,LP:/L:MAP=ABC !List only the map portion. *^C !Return to KMON via a control C. Example 2 .R FLECS !Start the translator. *ABC/P/F !Use /P and /F to specify output. .FORT/LIST/SHOW:MAP ABC !High level compile. 9.6 OPERATION UNDER TSX _________ _____ ___ Under the TSX time-sharing executive for RT-11 (circa S&H Computer Leasing , Nashville Tenn.), the FLECS translator may be invoked via a pseudo high-level command (assuming FLECS.SAV is on SY:). To perform the same functions as the examples of section 9.5, the following commands could be used. Example 3 .FLECS ABC/P/F !High level translation. .FORT/LIST/SHOW:MAP ABC !High level compile. FLECS/RT-11 V28 USER'S GUIDE 30 10. ERROR HANDLING _____ ________ This section provides a framework for understanding the error handling mechanisms of version 28 of the FLECS translator. The system described below is at an early point in its evolution, but has proven to be quite workable. The FLECS translator examines a FLECS program on a line-by-line basis. As each line is encountered, it is first subjected to a limited syntax analysis followed by a context analysis. Errors may be detected during either of these analyses. It is also possible for errors to go undetected by the translator. Note that the occurrence of any major error will cause the translator to cease generating any FORTRAN output (although the FLECS listing and error logging will of course continue). 10.1 SYNTAX ERRORS ______ ______ When a syntax error is detected, the statement is ignored. On ___ _________ __ _______ the FLECS listing the line number of the statement is overprinted with dashes to indicate that the statement has been ignored. The nature of the syntax error is given in a message on the following line. The fact that a statement has been ignored may, of course, cause some context errors in later statements. For example, the control phrase "WHEN (X(I).LT.(3+4)" has a missing right parenthesis. This statement will be ignored, causing as a minimum, the subsequent "ELSE" to be out of context. The programmer should of course be aware of such effects. More is said about them in the next section. 10.2 CONTEXT ERRORS _______ ______ If a statement successfully passes the syntax analysis, it is checked to see if it is in the appropriate context within the program. For example, an ELSE must appear following a WHEN and nowhere else. If an ELSE does not appear at the appropriate point or if it appears at some other point, then a context error has occurred. A frequent source of context errors in the initial stages of development, comes from miscounting the number of FINs needed at some point in the program. With the exception of excess FINs which do not match any preceding control phrase and are ignored (as indicated by overprinting the line number), all context errors are treated with a uniform strategy. When an out-of-context source statement is encountered, the translator generates a "STATEMENT(S) NEEDED" message. It then invents and processes a sequence of statements which, if they had been included at that point in the program, would have placed the original source statement in a correct context. A message is given for each such statement invented. The original source statement is then processed in the newly created context. FLECS/RT-11 V28 USER'S GUIDE 31 By inventing statements, the translator is not trying to patch up the program so that it will run correctly, it is simply trying to adjust the local context so that the original source statement and the statements which follow will be acceptable on a context basis. As in the case of context errors generated by ignoring a syntactically incorrect statement, such an adjustment of context frequently causes further context errors later on. This is called propagation of context errors. ___________ __ _______ ______ One nice feature of the context adjustment strategy is that context errors cannot progagate past a recognizable procedure declaration. This is because the "TO" declaration is in context only at indentation level 0. Thus to place it in context, the translator must invent enough statements to terminate all open control structures which procede the "TO". The programmer who modularizes his program into a collection of relatively short internal procedures, limits the potential for propagation of context errors. 10.3 UNDETECTED ERRORS __________ ______ The FLECS translator is ignorant of most details of FORTRAN syntax. Thus most FORTRAN syntax errors will be detected by the FORTRAN compiler not the FLECS translator. In addition, there are two major classes of FLECS errors which will be caught by the compiler not the translator. The first class of undetected errors involve misspelled FLECS keywords. A misspelled keyword will not be recognized by the translator. The line on which it occurs will be assumed to be a FORTRAN statement and will be passed unaltered to the compiler, which will no doubt object to it. For example, a common error is to spell UNTIL with two Ls. Such statements are passed to the compiler, which then produces an error message. The fact that an intended control phrase was not recognized frequently causes a later context error since a level of indentation will not be triggered. The second class of undetected error involves unbalanced parentheses. When scanning a parenthesized specification, the translator is looking for a matching right parenthesis. If the matching parenthesis is encountered before the end of the line, the remainder of the line is scanned. If the remainder is blank or consists of a recognizable internal procedure reference, all is well. If neither of the above two cases hold, the remainder of the line is assumed (without checking) to be a simple FORTRAN _______ statement which is passed to the compiler. Of course, this assumption may be wrong, thus the statement WHEN (X.LT.A(I)+Z)) X=0 is broken into keyword "WHEN", specification "(X.LT.A(I)+Z)" and FORTRAN statement ") X=0". Needless to say, the compiler will object to ") X=0" as a statement. FLECS/RT-11 V28 USER'S GUIDE 32 10.4 FORTRAN/RT-11 OTS ERRORS _____________ ___ ______ The FLECS translator is itself a FLECS program and, at runtime, it operates with the standard FORTRAN/RT-11 object time system (OTS). Occasionally, the translator will bomb-out with an appropriate OTS error message. Usually, these errors are a result of how you are using the system (like trying to get a listing on a non-existant line printer), rather than as a result of a programming error. There is one case however, where this is not so; if an OTS error 28 (OPEN FAILED FOR FILE) occurs, it could be that the flecs-input, stated in the CSI command string, could not be found or that the ___ file specification used in an INCLUDE statement could not be ____ _____________ ____ __ __ _______ _________ _____ ___ __ found. Mysterious error 28s are usually traced to the latter. _____ 10.5 OTHER ERRORS _____ ______ The translator detects a variety of other errors such as multiply defined, or undefined procedure references. The error messages are self-explanatory (really and truly!!). FLECS/RT-11 V28 USER'S GUIDE 33 A. INSTALLATION NOTES ____________ _____ This appendix contains the information necessary to install implementation 28 of the FLECS/RT-11 translator. A.1 BEFORE YOU START ______ ___ _____ Copy the distribution kit to a working disk, you should not use the original just in case something goes wrong. A.2 CONTENTS OF THE DISTRIBUTION KIT ________ __ ___ ____________ ___ FLECS .DOC - This file. FLXDOC.RNO - The RUNOFF version of this file. FLXREN.DOC - Implementation release notes. FLXMIN.SAV - An executable version of the translator which will run on a minimal RT-11 system (16KW with SJ monitor). It is fully overlayed,single-buffered and linked against a NHD library. FLXREG.SAV - An executable version of the translator which will run on a typical RT-11/PDP-11 system. It is minimally overlayed, double-buffered and linked against an NHD library. FLXGEN.COM - A command file for automatic translation and compilation of pre-processor itself. FLXHDR.FLX - Header information to be INCLUDEd into each source file. FLXBLK.FLX - Blockdata for common system parameters. FLECS .FLX - Main line source code file. FLXIO .FLX - RT-11 I/O interface sources. FLXGO .FLX - RT-11 file initialization sources. FLXGOS.FLX - Same as FLXGO.FLX but for single buffered I/O. FLXANL.FLX - Analyzer sources. FLXLST.FLX - Listing generator sources. FLXSUP.FLX - Miscellaneous support program sources. DATIME.FLX,DATEIN.FLX,TIMEIN.FLX - Date and time entry demo. FLECS/RT-11 V28 USER'S GUIDE 34 A.3 RUNABLE TRANSLATORS DISTRUBUTED _______ ___________ ___________ There are two runable versions of the translator included in the distribution kit, FLXMIN and FLXREG; the attributes of each are discribed in section A.2. It may be that one of the distributed versions will satisfy your requirements. If this is the case, simply copy the appropriate one to SY:FLECS.SAV and you are ready to go. If not, then a complete build will have to be performed as outlined in the following sections. A.4 INSTALLATION STEPS ____________ _____ The following steps outline the installation procedure. 1 - Select the most useable, distributed runable version of the translator. FLXMIN is small enough to run on a 16KW SJ system but is very slow. If you have more than 24KW, use FLXREG. For the purpose of building a tailored translator, rename the selected translator to "FLECS.SAV". For example; .COPY FLXREG.SAV FLECS.SAV 2 - Translate the .FLX sources into .OBJ modules using the supplied FLXMIN and your FORTRAN compiler. 3 - Link the .OBJ modules to create FLECS.SAV, a version of the preprocessor tailored for your specific system. 4 - Test FLECS.SAV by retranslating and compiling the distrubuted source files. A.5 TO COMPILE THE SOURCES __ _______ ___ _______ The source files may be translated into the .OBJ modules using a command file supplied for this purpose "FLXGEN.COM", or done manually. If done manually, print a copy of "FLXGEN.COM" and "play it by ear". To use the command file enter: .ASSIGN xxx: DK: .ASSIGN yyy: OUP: .@FLXGEN Where "xxx" is the source input device and "yyy" is the target device which is to receive the .OBJ modules. "xxx" and "yyy" may be the same device. FLECS.SAV is sent to SY:. Notes The source files must be on device 'DK:' so that INCLUDEd files ____ may be found. FLECS/RT-11 V28 USER'S GUIDE 35 There must be at least 250 contiguous free blocks on the output device for the translation to be successful. Example If the sources are on a diskette mounted in DY0: and an RL01 mounted in DL1: is to be used for the object files, the following commands should be entered. .ASSIGN DY0: DK: .ASSIGN DL1: OUP: .@FLXGEN -compilation log given here - *ignore any compilation warnings* A.6 LINKING FLECS.SAV _______ _________ There are numerous ways in which the object modules may be linked, depending on your particular system's configuration. The following examples illustrate. 1 - FORTRAN library part of SYSLIB and SJ or FB is used on a system with full memory (28KW). .R LINK *SY:FLECS=OUP:FLECS,FLXSUP,FLXIO/I/C *OUP:FLXBLK/C *OUP:FLXANL/C *OUP:FLXLST/O:1/C *OUP:FLXGO/O:1 Library search? $SHORT Library search? *^C 2 - FORTRAN library part of SYSLIB and SJ used on a system with minimum useable memory (or for use under TSX). .R LINK *SY:FLECS=OUP:FLECS,FLXSUP,FLXIO/I/C *OUP:FLXBLK/C *OUP:FLXANL/O:1/C *OUP:FLXLST/O:1/C *OUP:FLXGOS/O:1 Library search? $SHORT Library search? *^C FLECS/RT-11 V28 USER'S GUIDE 36 3 - FORTRAN library in file "SY:FORLIB.OBJ" and SJ used on a system with minimum memory (16KB). .R LINK *SY:FLECS=OUP:FLECS,FLXSUP,FLXIO/F/I/C *OUP:FLXBLK/C *OUP:FLXANL/O:1/C *OUP:FLXLST/O:1/C *OUP:FLXGOS/O:1 Library search? $SHORT Library search? *^C 4 - FORTRAN library in file "SY:FORLIB.OBJ" and XM used on a system with extended memory (RT-11 V04 and FORTRAN V2.5 only). The extended memory support module in file "SY:EXTEND.OBJ". .R LINK *SY:FLECS=OUP:FLECS,FLXSUP,FLXIO/I/V/C *SY:EXTEND/C *OUP:FLXBLK/C *OUP:FLXANL/V:1:1/C *OUP:FLXLST/V:1:2/C *OUP:FLXGOS/V:1:2 Library search? $SHORT Library search? *^C Note: FLXANL,FLXLST and FLXGO or FLXGOS may be be overlayed against each other in any disk or virtual scheme. A.7 TO TEST YOUR FLECS.SAV __ ____ ____ _________ To test your tailored version of the translator, copy "SY:FLECS.SAV" to "DK:FLECS.SAV" and @FLXGEN again. A.8 DEC SOFTWARE VERSIONS ___ ________ ________ The above installation procedure assumes RT-11 V03, RT-11 V03B or RT-11 V04. If an earlier version is used, you will have to enter the command files by hand (or edit them into batch files). Subsequent releases after RT-11 V04 should be compatible. FORTRAN V02.5 or FORTRAN V02.1 with Software dispatch patch number 5 installed should be used. To use an earlier version or V02.1 without patch 5, the carriage control parameters of the IASIGN calls in FLXGO.FLX will have to be complimented. FLECS/RT-11 V28 USER'S GUIDE 37 B. FLECS SUMMARY _____ _______ B.1 EXTENDED FLECS STATEMENTS ________ _____ __________ IF - Execute the scope if the condition is true. UNLESS - Execute the scope if the condition is false (i.e. unless the condition is true). WHEN/ELSE - Execute the scope of the WHEN if the condition is true, else execute the scope of the ELSE. CONDITIONAL - Execute the scope of the first condition found true. SELECT - Execute the scope of the first element to which a match is made. DO - Repeat the scope for the specified number of times. WHILE - Execute the scope while a condition is true. UNTIL - Execute the scope while a condition is false (i.e. until it is true). REPEAT WHILE - Execute the scope until a condition becomes false. REPEAT UNTIL - Execute the scope until a condition becomes true. B.2 TRANSLATION DIRECTIVES ___________ __________ $F/$NF - Turns FORTRAN output generation on/off. $L/$NL - Turns listing output generation on/off. $P - Causes listing to go to top-of-form. $X/$NX - Turns conditional translation of lines with an "X" in column 1 on/off. INCLUDE - Includes source lines from an alternate secondary input file.