next up previous contents index
Next: The Program Structure Up: SIC Programming Manual Previous: Introduction

   
Initializing SIC: The Command Language Structure

SIC is a multi-language interpretor. Each language must be initialized by means of an appropriate call to the routine SIC_LOAD. This routine has the following calling list:  
          SIC_LOAD(LANG,HELP,MCOM,VOCAB,VERSION)
LANG is a Character constant (less than 12 characters) which gives the name of the language. LANG need not be distinct from the command names, and it must not include the character $\backslash$ which will appear in the internal HELP of SICTMCOM is the number of commands and options appearing in the language vocabulary VOCAB. All commands in a SIC language are CHARACTER*12 constants in which the first character is a reserved code. Lower case characters are NOT allowed, but the special character "_" may appear. All other special characters have (or may have in the future) some specific meaning in SICThe following is the DATA initialization statement of SIC itself given as an example of language.
        CHARACTER*12 VOCAB(MVOCAB)
        INTEGER SIC_COMMANDS,USER_COMMANDS
        PARAMETER (SIC_COMMANDS=34)
        PARAMETER (USER_COMMANDS=MVOCAB-SIC_COMMANDS)
        DATA VOCAB/
     +  ' BREAK',       ' CONTINUE',    '$DCL',         '/PROCESS',
     +  ' DEFINE',      '/GLOBAL',      ' DELETE',      '/SYMBOL',
     +  '/VARIABLE',    '#EDIT',        ' ELSE',        ' ENDIF',
     +  ' EXAMINE',     '/GLOBAL',      '#EXIT',        ' FOR',
     +  '/WHILE',       '*HELP',        ' IF',          ' LET',
     +  '/NEW',         '/PROMPT',      ' NEXT',        ' ON',
     +  ' PAUSE',       '#QUIT',        '#RECALL',      ' RETURN',
     +  ' SAY',         ' SIC',         '$SYMBOL',      '/INQUIRE',
     +  '*TYPE',        ' @',           USER_COMMANDS*' '/
The first character code is interpreted as follow
<space> Usual command
/ Option of the preceding command
# Command forbidden in the stack and in procedures. Commands of this type are still written in the Log_File.
$ Special command which must not be inserted automatically in the stack. Commands of this type are written in the Log_File
* Purely informative command, which is only useful in an interactive session. Commands of this type are not written in the Log_File and not inserted in the Stack.

The * code can also be used for complex commands using alphanumeric keywords that you wish to expand yourself before saving them in the Log_File and the Stack, or for commands that may require to output several records (See SIC_INSERT, SIC_LOG and SIC_LIRE). The GreG command DRAW is an example of this.

The programmer should be careful about deciding what attribute to give to any command. All the options referring to a command must immediately follow it. At initialization time, SIC recognizes the options and set up a table of pointers connecting the options to their respective commands. A failure to respect the adequate order results in a very strange vocabulary.

Finally, VERSION is a character string which must contain the version number, and may contain the date of last modification, the name of the programmer,... The following example is recommended for optimum presentation (respect the alignment of the date for different languages):

          VERSION='1.0   21-APR-1984   Programmer Name'

In addition to setting the vocabulary, the programmer must decide the program prompt, the log file and the Stack usage. This is entirely optional because SIC provides default setups, and it is done using routine  

          SIC_OPT (PROMPT,LOGFILE,MEMORY)
where PROMPT is a character string (less than 8 characters) defining the prompt (SIC adds automatically the caret > at end of prompt), LOGFILE is a character string defining the Log_File for the session and MEMORY is a logical flag defining the Stack usage. There two modes for Stack usage: the first mode defines the Stack as an internal procedure which is entirely at the disposition of the user (MEMORY=.FALSE.), the second mode defines the stack as an internal Log_File, in which almost all commands (with the restriction in the command code) typed at the top level in Read Mode are automatically written to the Stack (MEMORY=.TRUE.). This mode provides a playback capability for interactive sessions. Modes can be commuted at run time using SIC command SIC MEMORY .

Default values are 'SIC', 'LOG' and .TRUE. respectively. Hence, if you use the defaults, the Log_File can also be defined by an assignation to logical name LOG. The call to SIC_OPT is completely effective if placed before any call to SIC_LOAD. Otherwise, only the prompt will be changed.


next up previous contents index
Next: The Program Structure Up: SIC Programming Manual Previous: Introduction
Gildas manager
2002-06-07