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:
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.
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.
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)
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')
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.
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))
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))
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.
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)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