next up previous contents index
Next: Loops Up: SIC as a programming Previous: SIC as a programming   Contents   Index

Procedures (or Command Files)

SIC has command procedure capabilities. A procedure is an external file containing valid commands. The SIC variables PRO%NARG (number of arguments) and PRO%ARG[:] (arguments as an array of character strings) can be accessed from within the procedure; they describe the arguments passed to the procedure when it was invoked. The tokens &1, &2, ..., &8 can also be used in the body of the procedure, its arguments will be substituted for these tokens. Substitution occurs also within the character strings. A procedure is executed by

        SIC> @ Procedure_Name [P1 ... PN]

Commands are read from the file Procedure_Name (with a default extension depending on the calling program or the user) and executed. P1 is a parameter string to be evaluated from PRO%ARG[1] or substituted to the token &1 during execution. Up to nine parameters may be passed to the procedure. The commands are echoed to the user's terminal if the VERIFY switch is set ON. Most programs using SIC define a default procedure extension equal to the program name (such as .GREG, .CLASS, etc...). If not specified, the default macro extension is .PRO. It can be listed and changed using command SIC EXTENSION.

Procedures (or any text file indeed) can be typed from within SIC using the command TYPE.

        SIC> TYPE Procedure_Name

If no argument is given to TYPE, the stack buffer is listed.


next up previous contents index
Next: Loops Up: SIC as a programming Previous: SIC as a programming   Contents   Index
Gildas manager 2014-07-01