Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ Contents1. Introduction2. Regions3. Display routines4. SPROGS files5. The file format6. Character fonts7. Index variables8. Efficiency of picture storage9. The sequence list10. Further facilities11. SPROGS on the 1906A12. An example film13. SPROGS preprocessor14. Future extensionsAppendices
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

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

Contents
1. Introduction
2. Regions
3. Display routines
4. SPROGS files
5. The file format
6. Character fonts
7. Index variables
8. Efficiency of picture storage
9. The sequence list
10. Further facilities
11. SPROGS on the 1906A
12. An example film
13. SPROGS preprocessor
14. Future extensions
Appendices

Chapter 13: SPROGS PREPROCESSOR

13.1 Use of Preprocessor

The SPROGS system has been written in FORTRAN to make it available to FORTRAN users, and to ease the job of implementing it elsewhere. However, there are a number of syntactic drawbacks to this language which tend to make a SPROGS program unreadable. The principal ones are:

  1. The fixed format
  2. The need to precede all subroutine names by CALL
  3. Using real constants as arguments even when the value required is integral
  4. The use of functions to access file names and index variables
  5. The need for routines to provide arithmetic capability for index variables

The preprocessor allows simpler formats to be used. However, as it also allows ordinary FORTRAN statements to pass through unaltered, it may be used in a general program. It produces FORTRAN source output which is sent to the compiler.

13.2 Command Format

Lines to be processed have * in column 1. All other lines are assumed to be correct FORTRAN and are passed over unchanged.

The general format of a command is:

* RTNAM(arg1,arg2,....)

More than one command may appear on a line, separated by ;. the asterisk is only used at the beginning of the line.

RTNAM will be preceded by CALL, and the routine arguments may also be changed. The above line then becomes:

      CALL RTNAM(arg1' ,arg2',....)

The arguments correspond to the form expected in the full FORTRAN form of the call (with certain syntactic changes). However, the two routines TEXT and VTEXT have a simpler form, omitting the character count:

* TEXT ('string') 
* VTEXT ('string')

Also, the routines WHILE and IFS have the form:

* WHILE arg1 cond arg2 DO 
* IFS arg1 cond arg2 DO

where cond can be a symbolic representation of the condition. For example:

* WHILE arg1 >= arg2 DO

becomes:

      CALL WHILE (arg1, 'LE', arg2)

RTNAM is assumed to be a SPROGS routine, and the argument simplification is based on this assumption. However, any routine satisfying the same conditions may be passed through the preprocessor.

13.3 Constant Arguments

With the exception of TEXT, VTEXT and ANAME, all arguments to SPROGS routines are expected to be of type REAL. However, it is possible to specify an integral constant as an integer in the command line. The preprocessor will change it into a real constant. For example:

* TOXY (3,5)      or
* TOXY (3.0,5.0) 

becomes

       CALL TOXY (3.0,5.0)

13.4 File Names

Files are specified by their text name in quotes wherever they appear. Thus, one writes:

* STSAV ('FRED' ,1) 
* STDF ('JIM') 
* DRAW ('ABC')

The preprocessor will provide a variable of the form:

      ZZZn

for each file name, assign the ANAME value to this variable, and replace the quoted text name by this variable wherever it appears. ANAME should not be used explicitly. For example:

* STDF ('JIM')         becomes 
      CALL STDF (ZZZ3) with        ZZZ3=ANAME ('JIM')

13.5 Index Variable References

An index variable reference in an argument is indicated by £ followed by the index variable text name, not in quotes. For example:

* TOXY (3,£A)             becomes
      CALL TOXY(3.0,PR2(ZZZ4)) with ZZZ4=ANAME ('A')

The function PR should not be used explicitly.

Index variable triples are expressed by enclosing the three names in square brackets, and replacing £ by % in the variable name. For example:

* VEC (1,2,3,[%F,%N,%C])     becomes 
      CALL VEC (1.0,2.0,3.0,AR4(ZZZ5,ZZZ6,ZZZ7))
                            with ZZZ5 = ANAME ('F')
                                 ZZZ6 = ANAME ('N')
                                 ZZZ7 = ANAME ('C')

Alternatively, one name can be given to the triple and that name used as an argument. (There is no parallel SPROGS command for this format.)

* #XY IS [%F,%N,%C]
* VEC (1,2,3,#XY)

is equivalent to the previous example.

There is currently a restriction on this shorthand form, in that the three variables may not have been used before, and may not appear in another triple. The previous form does not have this restriction.

13.6 Index Variable Arithmetic

It is possible to use arithmetic symbols in place of the routines ADD, SUB, LOAD etc. For example:

* %X=5             becomes      CALL LOAD(ZZZ8,5.0) 
* %X=£X+10         becomes      CALL ADD (ZZZ8, 10.0) 
* %X=£Y/5          becomes      CALL LOAD(ZZZ8,PR2(ZZZ9)) 
                                CALL DVD(ZZZ8,5.0) 
* £X=5             becomes      CALL LOAD (PR1(ZZZ8),5.0)
                        [index X contain the name of the desired variable]
* %X='JIM'         becomes      CALL LOAD(ZZZ8,ZZZ3)

All arithmetic symbols are treated strictly from left to right.

For example:

* %X=£Y+£F*3

becomes

      CALL LOAD(ZZZ8,PR2(ZZZ9)) 
      CALL ADD(ZZZ8,PR2(ZZZ5)) 
      CALL MPY(ZZZ8,3.0)

From the above, it can be seen that % will refer to the variable name, while £ will refer to a PR reference. Thus:

* %X=%Y       becomes    CALL LOAD(ZZZ8,ZZZ9)
* £X=£Y       becomes     CALL LOAD (PR1(ZZZ8),PR2(ZZZ9))

13.7 Data Files

It is possible to combine many calls of NULL in one line, for example:

* NULLS (3,5, £CD)

becomes

      CALL NULL (3.0) 
      CALL NULL (5.0)
      CALL NULL (PR1(ZZZ10))

13.8 Activating the Preprocessor

The command:

*$START

turns on the preprocessor in a given routine. Before the end the command:

*$END

must be used to turn it off. More than one routine may be processed, but these two commands must be used in each. The whole set must end with:

****

A 1906A file containing these routines is passed to the SPROGS macro by the parameter PRE. The resulting FORTRAN is appended to the first *CR file, which either should not exist, or should have the appropriate traps set. For more details, see the SPROGS macro definition.

]3.9 Example

The following routine is a rewrite of the WIPE routine, given in Section 12.5. The FORTRAN program generated by the preprocessor is also given.

      SUBROUTINE WIPE(A) 
      DIMENSION A(4) 
C   A(l) is the first file, 
C   A(2) the second 
C   A(3) is the number of frames to cover the wipe
C   A(4) is the number of a spare region
*$START 
*RDBASE (%SW); RDPLIM(%XP,%XMINR,%YMINR,%XMAXR,%YMAXR)
*RGPLIM (-1 ,A(4) ,0, 0, 1023, 1023) 
*RGPRM (A(4), 0, 0, 1, 0, £SW) 
*RGPRM (-1, -1 , -1 , -1 , -1 , 0)
*%XCNT=0
*WHILE £XCNT <= A(3) DO
*BEGINS
* %XLIM = A(3)-£XCNT/A(3)
* %XSTP = £XMAXR-£XMINR*£XLIM+£XMINR
* %XLIM = £XLIM*1023
* RGLIM (A(4),0,0,£XLIM,1023) 
* RGPLIM (A(4),£XP,£XMINR,£YMINR,£XSTP,£YMAXR) 
* DRAW (A(l)) 
* RGLIM (A(4),£XLIM,0,1023,1023) 
* RGPLIM (A(4),£XP,£XSTP,£YMINR,£XMAXR,£YMAXR) 
* DRAW (A(2)) 
* %XCNT = £XCNT+1 ; ADVFLM 
*ENDS
*RGPLIM (-1,£XP,£XMINR,£YMINR,£XMAXR,£YMAXR)
*RGPRM (-l,-1,-l,-1,-l,£SW)
*$END
      RETURN 
      END
      SUBROUTINE WIPE(A) 
      DIMENSION A(4) 
C  A(l) is the first file, 
C  A(2) the second 
C  A(3) is the number of frames to cover the wipes 
C  A(4) is the number of a spare region 
      GOTO 99088 
99087 CONTINUE 
      CALL RDBASE(ZZZ1) 
      CALL RDPLIM(ZZZ2,ZZZ3,ZZZ4,ZZZ5,ZZZ6) 
      CALL RGPLIM(-1.0,A(4),0.0,0.0,1023.0,1023.0) 
      CALL RGPRM(A(4),0.0,0.0,1.0,0.0,PR6(ZZZ1)) 
      CALL RGPRM(-1.0,-1.0,-1.0,-1.0,-1.0,0.0) 
      CALL LOAD(ZZZ7,0.0) 
      CALL WHILE (PR1(ZZZ7),'LE',A(3)) 
      CALL BEGINS 
      CALL LOAD(ZZZ8,A(3)) 
      CALL SUB(ZZZ8,PR2(ZZZ7)) 
      CALL DVD(ZZZ8,A(3)) 
      CALL LOAD(ZZZ9,PR2(ZZZ5)) 
      CALL SUB(ZZZ9,PR2(ZZZ3)) 
      CALL MPY(ZZZ9,PR2(ZZZ8)) 
      CALL ADD(ZZZ9,PR2(ZZZ3)) 
      CALL MPY(ZZZ8,1023.0) 
      CALL RGLIM(A(4),0.0,0.0,PR4(ZZZ8),1023.0) 
      CALL RGPLIM(A(4),PR2(ZZZ2),PR3(ZZZ3),PR4(ZZZ4),PR5(ZZZ9),PR6(ZZZ6)) 
      CALL DRAW (A(1)) 
      CALL RGLIM(A(4),PR2(ZZZ8),0.0,1023.0,1023.0) 
      CALL RGPLIM(A(4),PR2(ZZZ2),PR3(ZZZ9),PR4(ZZZ4),PR5(ZZZ5),PR6(ZZZ6)) 
      CALL DRAW(A(2)) 
      CALL ADD(ZZZ7,1.0) 
      CALL ADVFLM 
      CALL ENDS 
      CALL RGPLIM(-1.0,PR2(ZZZ2),PR3(ZZZ3),PR4(ZZZ4),PR5(ZZZ5),PR6(ZZZ6)) 
      CALL RGPRM(-1.0,-1.0,-1.0,-1.0,-1.0,PR6(ZZZI)) 
      GOTO 99089 
99088 ZZZ1 = ANAME ('SW') 
      ZZZ2 = ANAME ('XP') 
      ZZZ3 = ANAME ('XMINR ) 
      ZZZ4 = ANAME ('YMINR') 
      ZZZ5 = ANAME ('XMAXR') 
      ZZZ6 = ANAME('YMAXR') 
      ZZZ7 = ANAME ('XCNT' ) 
      ZZZ8 = ANAME('XLIM') 
      ZZZ9 = ANAME('XSTP') 
      GOTO 99087 
99089 CONTINUE 
      RETURN 
      END
⇑ 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