Monitor interface routines
Keywords: gildas-prog

Next: SIC Arguments Retrieving Routines Up: SIC Callable Routines Previous: SIC Callable Routines Contents Index

##
Monitor interface routines

    Available subroutines:
            SIC_BEGIN       SIC_OPT         SIC_RUN
            SIC_INSERT      SIC_LOG         SIC_LANG
    Available functions:
            SIC_CTRLC       SIC_LIRE        SIC_INTER_STATE

To build a program around the SIC monitor, different routines are provided. Some must always be used, like `SIC_BEGIN`, others are simply provided for additional capabilities. These routines have a standard `SIC_` like name and are fully described in this section.

`SIC_BEGIN (LANG,HELP,NCOM,CCOM,VERSION,Dispatch,Error)`

This subroutine initialize a SIC language and thus is usually the first one called. All arguments are unchanged by the routines and may be passed as immediate values.

- `LANG Character*(*).`
  The language name, as it will appear in the `HELP` and will be returned by SIC after command line processing. It is truncated to 12 characters if necessary.
- `HELP Character*(*).`
  The logical name for the `HELP` file corresponding to the language being initialized.
- `NCOM Integer.`
  The number of command and options, i.e. the dimension of the `CCOM` character array
- `CCOM Character*(*) array of dimension NCOM.`
  Contains the vocabulary of the language. The structure of the command vocabulary is described elsewhere in this document.
- `VERSION Character*(*).`
  A string to indicate the version number, the last modified date, the programmer name,... which will appear as a message with the language name at run time when using the SIC VERSION command
- `Dispatch` The dispatching routine
- `Error` The error handling routine

`SIC_INSERT(LINE)`

This routine is only useful when the Stack Buffer is used to store commands. This is the default, and the case when the flag `MEMORY` was set to `.TRUE.` in the first call to `SIC_OPT`. It can be changed with the `SIC MEMORY` command. `SIC_INSERT` is used to put a command line into the Stack buffer, a very useful possibility for some applications, when several lines must be put or when the command line must be expanded by the user program before the insertion is made.

Note however that command lines are automatically inserted in the Stack Buffer by the monitor for usual commands. This is the standard way of using the Stack insertion mode, since it automatically takes into account many things like the execution level before deciding whether an insertion must occur. Using directly `SIC_INSERT` usually implies to disable the automatic insertion by the monitor (using the character code * in the definition of the associated command, c.f. Section ). You need also to perform a call to `SIC_LIRE` to check the SIC execution mode (you should only call `SIC_INSERT` when `SIC_LIRE()` is equal to 0) and associated calls to `SIC_LOG` to write the same information in the `LOG` file. The insertion does not occur if the memory flag is turned off (`SIC MEMORY OFF`).

- `LINE Character*(*)`.

`SUBROUTINE SIC_LOG (LINE,NL,LIRE)`

This subroutine writes `LINE(1:NL)` into the Log_File if `LIRE=0.` `LIRE` is here necessary for consistency with the internal pointer indicating if SIC is processing a macro, the stack or the loop. This pointer can be retrieved by the function `SIC_LIRE`. A call to `SIC_LOG` when `LIRE` is not 0 has no action.

- `LINE Character*(*)` Input
- `NL Integer` Input
- `LIRE Integer` Input

`SUBROUTINE SIC_LANG(LANG)`

This subroutine returns the name of the language corresponding to the last command analysed. It is called only when building the library version of a multi-language application.

- `LANG Character*(*)` is returned by the routine

`LOGICAL FUNCTION SIC_CTRLC ( )`

SIC itself traps the `<^C>` by generating a `PAUSE` at the end of the command which was being executed when `<^C>` was pressed. You may want in time-consuming applications to check yourself at specific points whether `<^C>` has been pressed. `SIC_CTRLC` allows you to do so, and resets an internal flag to `.FALSE.` when called. It returns `.TRUE.` if `<^C>` has been pressed since either the last command completed execution or the last time it was called (using the most recent event), `.FALSE.` otherwise.

`INTEGER FUNCTION SIC_LIRE ( )`

This subroutine returns the internal pointer of SIC indicating where SIC is currently reading its commands. `SIC_LIRE` may take the values

- -10 Subroutine mode
- -2 Reading in the Loop buffer
- -1 Called from `SIC_RUN` with `ICODE = -1`
- 0 Interactive mode
- I0 Reading in macro number I

`LOGICAL FUNCTION SIC_INTER_STATE( )`

This subroutine returns `.TRUE.` if the session is interactive, `.FALSE.` otherwise. This is the case if SIC is ran during a batch process.

Next: SIC Arguments Retrieving Routines Up: SIC Callable Routines Previous: SIC Callable Routines Contents Index