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

19. SUBCOMPILATION AND GLOBAL STORAGE

19.1 Syntax

segment                ::=program|proceduredec
program                ::=statement
globaldec              ::=GLOBAL gldeclist GLOBEND;
gldeclist              ::=blockidentifier : simpledeclist|gldeclist blockidentifier:simpledidist
label                  ::=gl? lidentifier:|ENTRY digit:
proceduredec           ::=gl? PROCEDURE pidentifier(xacc ret?); statement;
gl                     ::=GLABEL
externaldec            ::=EXTERNAL externallist;
externallist           ::=spec|externallist, spec
spec                   ::=pidentifier|lidentifier|pidentifier(xacc)|lidentifier(xacc)
blockidentifier        ::=identifier
topglobaldec           ::=TOPGLOBAL blockidentifier:simpledeclist GLOBEND;
lowerglobaldec         ::=GLOBAL lowergldeclist GLOBEND;
lowergldeclist         ::=blockidentifier:celldeclist|lowergldeclist blockidentifier:celldeclist
puredec                ::=PURE storagedeclist PUREND;
storagedeclist         ::=storagedec|storagedeclist storagedec
storagedec             ::=celldec|basedec|lowerdec|globaldec|topglobaldec|lowerglobaldec
nonplasyddec           ::=NONPLASYD externallist;
nonplasydstatement     ::=pidentifier|lidentifier|pidentifier(integer)|lidentifier(integer)

19.2 Subcompilation

So far PLASYD programs have been considered as though they had to be compiled in one run. The program, apart from the trivial case of a single statement, would consist of a block as shown in the examples of earlier sections. It is however possible to split a program into a number of segments which may be compiled separately and then consolidated to form a program.

Each segment must be either a master segment which takes the form of a block, or a procedure which takes the form of a procedure declaration. Any complete program must contain at most one master segment and zero or more procedure segments.

Unless specifically declared, all identifiers will be local to the segment in which they are declared. The same identifier may be used for different purposes in different segments. Communication of variables between segments is provided by the GLOBAL declaration. Indicating which procedure calls refer to other segments and the link accumulator involved, is provided by the EXTERNAL declaration.

19.3 Global Names

Since identifiers are normally local to the block in which they are declared or at most, global to the segment being compiled, a special declaration is needed to indicate that a procedure name or label may be accessed from a separately compiled segment. This is done by preceding the label definition or the procedure declaration by the symbol GLABEL (global label).

For example:

GLABEL OUT: X:=X+X3;
GLABEL PROCEDURE FRED(X1); 
X:=X+X3;

The GLABEL qualifier will ensure that the compiling system wi11 keep a record of the identifier concerned for use in other segments. The name of a separately compiled procedure is automatically a global label and the symbol GLABEL is not required in this case.

A global label or procedure name may be called or GOTO'd from any external segment in the same way as a local label or procedure name could. However each separately compiled segment must inform the compiler of the external global labels that it is using and, if it is to call any of them as procedures then the link accumulator to be used must be specified. This is done by the EXTERNAL declaration. For example:

EXTERNAL OUT,IN,FRED(X1),IGNATIUS(X4);

The EXTERNAL declaration specifies which identifiers out of the set of global labels will be used by this segment. If an identifier does not appear in an EXTERNAL declaration then it can be used as a local identifier in spite of the fact that it may be declared as a global label in another segment of the program. This interchangeability between labels and procedures applies to global identifiers in the same way as it does with local ones. Labels of procedures must be declared as EXTERNAL before they are used.

An example of a three segment program might be:

[SEGEMENT 1]
BEGIN
EXTERNAL FRED,DICK(X1),HARRY (X1);
PROCEDURE LCL(X1);X0:=0;
GLABEL PROCEDURE TOM(X1);
BEGIN
  X6:=0;
  GOTO ND; 
END;
HARRY;
GOTO FRED;
GLABEL SID:X4:=0;
GOTO DICK;
ND:X7:=0;
END
[SEGMENT  2] 
PROCEDURE  HARRY(X1); 
BEGIN
  X2:=0; 
END;
[SEGMENT  3] 
PROCEDURE  DICK(X1); 
BEGIN
  EXTERNAL  SID,TOM;
  
  X5:=0; 
  GOTO TOM;
GLABEL FRED: X3:=0;
       GOTO SID; 
END;

This three segment program sets the integer accumulators X2 to X7 to zero in order. Notice how procedure DICK is called using a GOTO statement. The EXTERNAL declaration may indicate a link accumulator for a global label even if it is not used. The procedures HARRY and DICK are assumed to be global as they have been compiled as separate segments.

A procedure or label defined as global may also be used locally.

19.4 Entry Points

Every program must contain at least one entry point at which the program can be started. This is done by an entry label and this may precede any statement in the same way as a label. For example:

BEGIN
  INTEGER I,J,K;
  X1:=0;
ENTRY 1:X2:=0; 
ENTRY 9:X3:=0; 
END

The particular entry point needed during any particular run of the program is specified to the operating system by reference to this digit. A maximum of 10 entry points are permitted for the program. Each entry point is distinguished by the numbers 0 to 9. It is necessary to insert a space between the symbol ENTRY and the following digit.

19.5 Global Variables

The simplest method of communication between a set of segments is to have a set of variables which are global or common to them all. Accumulators are automatically defined as being common to all segments. Cells are defined as common by using the GLOBAL declaration which consists of a set of cell declarations enclosed between the words GLOBAL and GLOBEND. Immediately following the word GLOBAL and before the first declaration, an identifier name must be given followed by a colon. This name is the one given to the global storage area defined by the GLOBAL declaration.

For example:

GLOBAL
ABC:
REAL A(10),B,C;
INTEGER I,J,K;
GLOBEND;

defines a global area consisting of 27 locations which have been given the name ABC. Several global areas can be defined in each segment either by defining each separately or by enclosing them all in the same brackets. For example:

GLOBAL 
DEF:
INTEGER I,J; 
GLOBEND;
GLOBAL 
GHI:
INTEGER K,L; 
GLOBEND;

defines two global areas with names DEF and GHI. These could equally well have been defined by:

GLOBAL 
DEF:
INTEGER I,J; 
GHI:
INTEGER K,L; 
GLOBEND;

All segments having a global declaration with the same name can access the cells defined in the declaration. For example, a second segment might have a global name ABC defined as follows:

GLOBAL
ABC:
REAL X(5),Y(6),Z;
INTEGER M(3),N(3);
GLOBEND;

This defines a global area of 30 locations with the name ABC. The actual length of the area allocated to ABC is the maximum of all the global declarations with that name. If the two declarations above for ABC were the only ones that appeared, then a global area of length 30 would be allocated. It is important to notice that the name itself is all that need be the same. The individual declarations themselves may be quite different. Locations are allocated to variables as they appear in the declaration. In the example the first location of ABC has the name A(0) in the first segment and X(0) in the second. As the second declaration defines an area which is 3 locations longer than the first, the array N does not have any equivalent in the first segment. Examples of cells that do share the same location are:

[A(4), X(4)] [A(5), Y(0)] [B, Y(5)] [C, Z] [I, M(0)] [K, M(2)]

The declarations above have been defining global areas in upper storage. It is possible to include BASE declarations within the set of upper cell declarations if they are required. GLOBAL declarations may also define areas of lower storage by enclosing the cell declarations between the brackets LOWER and LOWEND. For example:

LOWER 
GLOBAL 
ABC:
REAL X(5) 
GLOBEND; 
LOWEND;

defines an area of lower storage which is 10 locations in length and has the name ABC. Users should ensure that all global declarations with the same name in a program are either all upper declarations or all lower. It is possible to have the GLOBAL declaration outside the LOWER.

Cells defined as global may be initialised in the same way as any other cell. However, it is sensible to define the initial values in only one segment for a particular global declaration. If two segments have different initial values set for the same cell in a global declaration, then the actual value taken is undefined.

The names given to global areas must be distinct from those given to cells, procedures or labels in that segment. For example:

GLOBAL
ABC:
INTEGER ABC;
GLOBEND;

is not allowed.

It is sometimes necessary to define one global area which is located at the end of the allocated storage and can be of any length up to the limit available on the computer or allowed by the operating system. This is defined in PLASYD by a special TOPGLOBAL declaration similar in form to the standard GLOBAL declaration. In all segments comprising the program, there should only be one global area defined as TOPGLOBAL. If this global area is declared in several segments, then each declaration should be given as TOPGLOBAL. For example:

TOPGLOBAL 
ABC:
INTEGER I(1); 
GLOBEND;

defines ABC as TOPGLOBAL. Although only one storage location has been defined in ABC, as it is the last area allocated, the user may effectively let the array I be of any length. This is particularly useful for stack organisation where the actual depth of the stack is unknown until run time. The method of implementation of TOPGLOBAL is different under GEORGE 3 and GEORGE 4. Sparse programs under GEORGE 4 have TOPGLOBAL allocated at a high quire boundary (512K) while GEORGE 3 and GEORGE 4 dense programs allocate it immediately following the other allocated storage areas.

19.6 PURE Declaration

An area of storage can be designated as PURE by enclosing the declarations defining the area inside the brackets PURE and PUREND. For example:

PURE
LOWER
INTEGER A=1, B=2;
LOWEND;
GLOBAL FRED:
REAL C= 3.0;
GLOBEND;
GLOBAL XYZ:
LOWER
INTEGER D=5, E=7;
LOWEND;
GLOBEND;
PUREND;

This defines three distinct areas of storage, the lower area holding A and B; the upper global area called FRED and the lower global area called XYZ. Each area is defined as PURE which means that at consolidation time the areas will be marked as not requiring to be written to. On a paged 1906A, this does mean that the relevant pages can be marked as read only and this will stop any unexpected writing. Unfortunately, the current algorithm adopted by the consolidator is only to separate out pure and impure parts if it does not cause any additional 1024 word pages to be defined. For example, if the total impure lower storage was 500 words and the pure lower storage defined was 50 words, then both would be put in the same page. However, if both areas had been 700 words long, then two pages would be needed and the consolidator would then separate the pure and impure parts. As can be seen from the example, there is no point in defining pure storage which has not been initialised. Its main use is for storing preset tables.

19.7 NONPLASYD Declaration and Statement

The NONPLASYD declaration and statement allow a PLASYD program to call segments with multiple unlabelled entry points. The declaration has a similar form to the EXTERNAL statement and approximately the same meaning except that an entry to the label or procedure may be made at an address displaced from the entry point itself. Unlike the standard procedure or GOTO statement, the NONPLASYD version follows the identifier with an integer which defines the displacement from the entry point where the procedure is to be entered. For example:

JACK(3);

will enter the separately compiled procedure JACK at an instruction three after the entry point for JACK. Similarly:

GOTO JACK(4);

jumps to procedure JACK at a position four instructions past the entry point.

The bracketed integer may be omitted, in which case it is assumed to be zero. Thus:

JACK(0); 
JACK;

are equivalent procedure calls.

⇑ 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