Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ Contents1. Introduction2. Basic symbols and comments3. Identifiers, accumulators and cells4. Types and values5. Addresses and storage allocation6. Simple cell designation7. Assignment statements8. Integer accumulator assignments9. Real accumulator assignments10. Long accumulator assignments11. Cell assignments12. Block structure13. Procedures and labels14. Conditional and control statements15. Functions16. Cell declarations17. Synonym declarations18. Storage allocation19. Subcompilation and global storage20. Define statements, conditional compilation and include statements21. Compiler directives22. FORTRAN/PLASYD mixed programming23. ALGOL/PLASYD mixed programming24. Useful library routines25. Use of TASK macro to compile PLASYD programs26. SMO cell designation27. Compiler output28. PLAN instructions not provided for in PLASYD □ Appendices □ 1: Errors and comments2: 1900 character set3: Syntax definitions in alphabetical order4: Use of program XMED5: 1900 order code6: Code genereated for typical PLASYD statements7: A sample PLASYD program8: Less commonly used directivesReferences
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACLLiteratureICL 1906A manualsPLASYD
ACLLiteratureICL 1906A manualsPLASYD
ACL ACD C&A INF CCD CISD Archives
Further reading

Contents1. Introduction2. Basic symbols and comments3. Identifiers, accumulators and cells4. Types and values5. Addresses and storage allocation6. Simple cell designation7. Assignment statements8. Integer accumulator assignments9. Real accumulator assignments10. Long accumulator assignments11. Cell assignments12. Block structure13. Procedures and labels14. Conditional and control statements15. Functions16. Cell declarations17. Synonym declarations18. Storage allocation19. Subcompilation and global storage20. Define statements, conditional compilation and include statements21. Compiler directives22. FORTRAN/PLASYD mixed programming23. ALGOL/PLASYD mixed programming24. Useful library routines25. Use of TASK macro to compile PLASYD programs26. SMO cell designation27. Compiler output28. PLAN instructions not provided for in PLASYD
Appendices
1: Errors and comments2: 1900 character set3: Syntax definitions in alphabetical order4: Use of program XMED5: 1900 order code6: Code genereated for typical PLASYD statements7: A sample PLASYD program8: Less commonly used directivesReferences

20. DEFINE STATEMENTS, CONDITIONAL COMPILATION AND INCLUDE STATEMENTS

definestat     ::=DEFINE deflist;
deflist        ::=identifier=defexpr|deflist, identifier=defexpr
defexpr        ::=defprim|defprim aop defbasic
defprim        ::=defbasic|$fixedcellidentifier|@fcd-@fcd|
                  £cellidentifier-£cellidentifier|
                  @instruction identifier-@instruction identifier
aop            ::=+|-|*|/
defbasic       ::=integer|identifier (where identifier has previously been defined)
fed            ::=integer|identifier(integer)|identifer(-integer)
conditcomp     ::=?integer(section of program)?integer
                  (where the two integers are the same and in the
                  range 1-10 inclusive. There must be no spaces
                  between the ?, the integer and the parentheses)
includestatement::=INCLUDE(subfilename)|INCLUDE(subfilename, SL)
subfilename    ::=identifier . identifier
instridentifier::=lidentifier|pidentifier

20.2 Defined Identifiers

The define statement provides a means of associating an absolute integer value with an identifier at compile time. An identifier defined in this way may then be used at any point at which the corresponding integer value would be valid.

NB. The identifier does not label a storage cell, and cannot therefore be assigned to or altered in any way by the program. For example, consider the following section of code:

LOWER INTEGER TABLE1(10) = (0*10),TABLE2(10);
.............................
FOR X1:=0 STEP 1 UNTIL 9 DO
BEGIN X6:=TABLE1(X1);TABLE2(X1):=TABLE2(X1)+X6;END;

If the size of the tables is later altered, at least four alterations must be made to the program code. If, however, the code was:

DEFINE N=10,P=N-1;
LOWER INTEGER TABLE1(N) = (0*N),TABLE2(N):
................................
FOR X1:=0 STEP 1 UNTIL P DO  ......

only the DEFINE statement would need to be altered.

The forms of expression which may be used in DEFINE statements are:

  1. A literal value or a previously defined identifier, for example:
    DEFINE A=3,B=#100CNT,C='XYZ',D=B;
    
  2. An absolute expression consisting of:
    1. the displacement of a fixed cell, for example:
      DEFINE E=$TABLE1(1),F=$TABLE2;
      
      the value given is the displacement of the cell considered as a number of words,
    2. the difference between the bases Of two identifiers or addresses of two fixed cells, for example:
      DEFINE G=£TABLE2-£TABLE1;H=@TABLE2-(@TABLE1(3);
      
      each pair of cells must be both in upper or both in lower storage, also both must be in the same common block or neither must be in common.
    3. the difference between the addresses of two instruction identifiers, for example:
      DEFINE I=@SIN-@COS;
      
      where SIN and COS are either procedure or label identifiers.
    All identifiers used in types (i), (ii) and (iii) must have been previously declared. The value given in types (ii) and (iii) is the difference between the two addresses considered as a number of words.
  3. Any of the forms given in (a) and (b) followed by any number of operator/operand pairs. The permitted operators are:
    + - * /
    
    and the operands must be literals or previously defined identifiers. The operations are carried out from left to right, and all intermediate and final results must be single length integer values, for example:
    DEFINE J=A+1/2*'?';
    
    In this case, if (A+1)/2 is not an exact integer it will be rounded down.

20.3 Compile Time Control over Code Generated

Sections of code can be included in a program, and either compiled or ignored according to the setting of bits in the switch word. For example, the line of code:

?1( X4:=A ?2( +B ?3( -C )?3 )?2 ?3( *D )?3 ; )?1 

will have the following effect:

Switch 1       Switch 2       Switch 3       Code Compiled
off             on/off         on/off         none
on              off            off            X4:=A;
on              off            on             X4:=A*D;
on              on             off            X4:=A+B;
on              on             on             X4:=A+B-C*D;

Note that the scopes of conditional brackets may be nested and may even overlap, but that in the case of overlapping scopes the effect achieved may not be that intended.

For example, it is permissible to write:

?1(JOE;?2(SID;)?1FRED;)?2

but the effect is as follows:

Switch 1       Switch 2       Code Compiled
off             off            FRED;
off             on             FRED;
on              off            JOE;
on              on             JOE;SID;FRED;

20.4 Use of Text-form Libraries

The use of the INCLUDE statement, which must appear on a line by itself, causes the contents of the specified subfile to be compiled as if they appeared at that point in the program. The contents of the subfile may be any number of statements or declarations, or even parts of statements These may not include further INCLUDE statements. If the parameter SL is given, the subfile code is shortlisted, if not it is listed as if it were part of the main program file except that the lines will not be numbered.

A situation in which the INCLUDE facility would be useful is where a large global declaration is required in several segments. In this case the global declaration could be placed in a subfile and included wherever required. If INCLUDE statements are to be used in a program then a MACROFILE or PUBLICFILE directive must be given, and the file containing the text to be included must be assigned to the compiler. Note, if the macrofile is empty this will cause the compiler to fail.

Source text can be placed in subfile form in direct access files by use of the utility program #XMED, which is described in the Compiling Systems Manual. Note that there is no subfile parameter which specifies the language PLASYD. The parameters *FORTRAN, *EMA, or *ALGOL can be used instead. The program #XMED may be found in a file entitled :SUBLIB.PROGRAM XMED, and an example of a simple job using it is given in Appendix 4.

⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site