Document ID: TC-IEG-051

$Revision: 1.12 $
$Date: 2001/01/21 16:40:00 $


IEGSE STOL Reference Guide


0.0 Contents

  1. STOL statement directives
  2. Operator-Operand compatibility
  3. Related Information


1.0 STOL statement directives


@ ASK BEGIN COMPILE DECLARE
ELSE END IF END LOOP END PROC ESCAPE
GO GOTO IF IEGSE_DB_SOURCE IEGSE_ENG_DATA
IEGSE_FORCE_RAW IEGSE_HIRCMD_LIMITS IEGSE_LOGFILE IEGSE_LOGGING IEGSE_OUTHEX
IEGSE_OUTDN_ID IEGSE_STALE LET LOAD LOOP
PROC RETURN START WAIT WRITE


@

Composes and sends a command to instrument, test equipment or internally to IEGSE.

Applicable Environment

IEGSE Extension

OPERATORPROCEDUREYES

Format

@nmemonic [parameter_list]

Arguments

nmemonic
The command identifier (name). This is used to locate the appropriate database record which contains the information required to parse the parameters and prepare the data to be sent to the target destination.

parameter_list
The command may require parameters. These are specified as a comma (,) separated list. The parameter types and order are defined by the database record associated with nmemonic.If any discrepency is found between the database parameter list specification and that received the statement fails.

IEGSE Implementation Notes

  1. The @ statement composes and sends the command. There is no direct connection between the command stream and any telemetry, it is therefore the users responsibility to check via returned telemetry whether a command has been received or executed correctly at the destination. The example procedure below demonstrates how this can be achieved when sending a command to the HIRDLS instrument.
  2. If the command is of class CRITICAL confirmation is required from the operator before it is dispatched. Sending such a command from the operator window results in an explicit prompt. When a procedure encounters a class CRITICAL command it enters a wait state. The operator sends a GO to allow the command to be dispatched and the procedure to continue.

Examples

Operator

CSTOL> @hir_ipu_settime 1, X#ffff, 0
Sends hirdls instrument command hir_ipu_settime which requires three integer parameters.

CSTOL> @gse_sample_eng off
Sends IEGSE realtime node command gse_sample_eng which requires one logical parameter.

Procedure


proc comtest7
declare variable $current_count = 0 DN 

begin

; use local variable to store current value of SCCMDS_RCVCT
let $current_count = SCCMDS_RCVCT

; send command
@HIR_SSH_SAFE

write "Command sent"

oo:
	; wait for telemetry parameter SCCMDS_RCVCT to change to indicate
	; command received

	if ($current_count = SCCMDS_RCVCT) 
		write "Current count = :", $current_count
		; 1/2 second polling wait
		wait 0:0:0.5
		goto oo:
	end if

write "Current count = :", SCCMDS_RCVCT

end proc

ASK

Requests user input in response to a prompt string. The input is stored in a STOL local variable and can therefore be used to control the flow of execution of a procedure.

Applicable Environment

IEGSE Extension

ProcedureNO

Format

ASK $local_variable text_string

Arguments

$local_variable
A local variable which stores the result of the request. The type of $local_variable determines the type of input expected.

text_string
Request prompt string.

IEGSE Implementation Notes

  1. The ASK command will only accept input into local variables of the following STOL types :
  2. The prompt string is output and input data is delivered via the procedure's I/O window as shown below.

Examples

proc ask_demo2
declare variable $count = 0.0 
begin

ask $count "Real value please "

if ($count < 0.0) 
	write $count, " is Negative"
else
	write $count, " is Positive"
endif

end proc
Produces the following output in the procedure I/O window
Ask-Question> Real value please
Ask-Response> 6.52
6.52  is Positive
Procedure ask_demo2 exited. Code : NORMAL

BEGIN

Denotes the start of the executable section of a STOL procedure.

Applicable Environment

IEGSE Extension

ProcedureNO

Format

BEGIN

Arguments

None

IEGSE Implementation Notes

Like the OASIS-CC implementation the use of the BEGIN statement is not mandatory, merely recommended.

Examples

The use of the BEGIN statement is shown in all the example procedures in this document.


COMPILE

Compiles a STOL procedure into an intermediate object format which can be run by using the START directive.

Applicable Environment

IEGSE Extension

OperatorProcedureNO

Format

COMPILE procedure_list

Arguments

procedure_list
The list of procedures to be compiled. If there is more than one the list is separated using commas (,). The procedure name only is given, i.e. the first part of the filename (without the .pro extension).

IEGSE Implementation Notes

  1. The procedure source file must be named name.pro where name is the name of the procedure in lowercase. COMPILE searches for the file name.pro in the following locations
    • The directories specified by the [stol]:srcdir configuration variable.
    • The users directory $HOME/stol.
  2. The compiled object code is written a file. This object file is named name.obj. This is in contrast to OASIS-CC where compiled procedures are registered and stored in dynamic memory after compilation.
  3. The object file is written to the first directory specified by the configuration file variable [stol]:objdir for which the user has write permission, or if that fails the directory where the source file was located. If the user does not have write permission to any of these directories the statement fails.

Examples

Operator

CSTOL>compile ask_demo1, ask_demo2
Compiles two procedures.

Procedure


proc starter
; procedure to compile and run another procedure
begin
compile kk
start kk
end proc

DECLARE

Defines the type of procedure input parameters and declares local variables and constants for use within a STOL procedure.

Applicable Environment

IEGSE Extension

ProcedureNO

Format

DECLARE mode var_name = def_value

Arguments

var_name
The name of the variable. It must be a local variable, i.e. begin with a dollar sign ($).

mode
Can take the following values :

INPUT
Identifies var_name as one of the input parameters to the procedure. Each input parameter must have an associated DECLARE statement.

VARIABLE
Identifies var_name as a local variable.

CONSTANT
Identifies var_name as a local constant. A error will occur if a subsequent attempt to assign a value to it using LET is made.

def_value
The type of var_name is set to that implied by the value def_value. The value of var_name is then set to def_value.

IEGSE Implementation Notes

  1. The optional range specification as defined by OASIS-CC CSTOL is NOT available in the IEGSE implementation.

Examples


proc demo1 $ident $count
;
; Procedure showing a variety of declare statements
;
; A procedure that takes two input arguments :
; The first is an identifier passed as string.
; The second is a integer providing a number of times a loop is to be 
; completed. If the the loop count goes beyond limit which is set below the 
; procedure waits for the operator for further instructions.
;
declare input $count = 0
declare input $ident = "string"
declare variable $done = 0
declare variable $limit = 2
declare constant $pause_time = 0:0:2.5

begin

write "Identifier : ", $ident

; top of loop
loop $count

let $done = $done + 1
write "Times through = ", $done

	if ($done > $limit) 
		write "Limit passed (Maximum ", $limit,")"
		wait
	end if 

wait $pause_time
end loop
; bottom of loop
end proc


ELSE

Denotes the start of a clause within a IF conditional control structure.

Applicable Environment

IEGSE Extension

PROCEDURENO

Format

ELSE [ IF clause_expression ]

Arguments

If no arguments are supplied ELSE identifies the actions which occur if none of the clause expressions of an IF structure evaluate as TRUE. Otherwise the clause expression is supplied as described in the IF reference page.

IEGSE Implementation Notes

There does not need to be a space between the ELSE and the IF if a clause expression is to be used. It is slightly unclear from the OASIS-CC documentation, but it is probable that a space may be required in CSTOL. Hence it is recommended in the interests of compatibility that a space is inserted between the ELSE and the IF.

Examples


proc else_show $k
declare input $k = 0
begin

if ($k > 0) 
	write "Positive"
else if ($k < 0) 
	write "Negative"
else
	write "Must be zero"
end if
end proc

END

Denotes the end of a program structure.

Applicable Environment

IEGSE Extension

PROCEDURENO

Format

END structure

Arguments

structure may take the following values.

IF
Identifies the end of an IF structure.

LOOP
Identifies the end of a LOOP structure.

PROC
Identifies the end of a procedure

IEGSE Implementation Notes

There does not need to be a space between the END and structure a clause expression is to be used. It is slightly unclear from the OASIS-CC documentation, but it is probable that a space may be required in CSTOL. Hence it is recommended in the interests of compatibility that a space is inserted between the END directive and structure.

Examples

proc end_demo $k
declare input $k = 0
declare variable $i = 0
begin

loop 10
	write $i
	let $i = $i + 1
end loop

if ($k > 0) 
	write "Positive"
else if ($k < 0) 
	write "Negative"
else
	write "Must be zero"
end if

end proc

ESCAPE

Provides a method of breaking out of a LOOP structure. ESCAPE is used in conjunction with an IF statement. The statement only has meaning in the context of a LOOPand will generate a compile error if used anywhere else in a procedure.

Applicable Environment

IEGSE Extension

PROCEDURENO

Format

ESCAPE

Arguments

None

IEGSE Implementation Notes

None

Examples

proc escape1
declare variable $aa = 0
begin
; break out of counted loop
loop 5
let $aa = $aa + 1
	if ($aa > 3) 
		write "condition hit $aa = ", $aa
		write "going to escape"
		escape
	end if
end loop
write "escaped out of loop $aa = ", $aa
end proc

GO

Used by the operator to instruct the current procedure to continue after a suspension. The suspension may have been initiated by the operator or be the result of an unconditional WAIT statement in the procedure, a child procedure exiting on error or the procedure requiring confirmation before sending a restricted command.

Applicable Environment

IEGSE Extension

OPERATORNO

Format

GO

Arguments

None

IEGSE Implementation Notes

None

Examples

None


GOTO

Provides a means of performing an unconditional branch.

Applicable Environment

IEGSE Extension

PROCEDURENO

Format

GOTO label

Arguments

label is the location within the procedure where execution is redirected to by the GOTO statement.

IEGSE Implementation Notes

  1. GOTO can only be used within procedures. OASIS-CC CSTOL allows GOTOs to be issued by the operator to change the flow of execution. Thisfacility has not been implemented on the IEGSE.
  2. GOTO cannot be used to cause the flow of execution to jump into loops or IF structures. Compilation errors are generated if this is attempted.

Examples

proc goto_demo
declare variable $count = 2
begin

label1: 

let $count = $count + 1
write $count
	if ($count > 10) 
	goto end:
	end if

goto label1: 

end:
write "finished"

end proc

IEGSE_DB_SOURCE

Used to determine which database a given parameter is being sourced from. A message is written to the standard output, hence it will be captured in the output log if logging is activated.

This statement is intended for diagnostic purposes and to indicate the current status following the use of the IEGSE_ENG_DATA statement.

Applicable Environment

IEGSE Extension

OPERATORPROCEDUREYES

Format

IEGSE_DB_SOURCE parameter

Arguments

parameter
Name of parameter (HIRDLS, IEGSE or test equipment) to be looked up. If the parameter is not recognised after searching all the databases a message saying so is output.

IEGSE Implementation Notes

None.

Examples


CSTOL> iegse_dbsource ipstat_1
IPSTAT_1 sourced from HIRDLS_SCI_TELEMETRY database


CSTOL> iegse_dbsource ipstat_pp
Not associated with a database

IEGSE_ENG_DATA

If set ON makes STOL search the HIRDLS engineering data first for the any subsequent telemetry parameters. By default the science data is searched first.

Applicable Environment

IEGSE Extension

PROCEDUREYES

Format

IEGSE_ENG_DATA ON | OFF

Arguments

ON | OFF
Determines whether the action associated with IEGSE_ENG_DATA is activated.

IEGSE Implementation Notes

None.

Examples



proc s1
iegse_eng_data    on
begin

iegse_dbsource SCCMDS_RCVCT
write SCCMDS_RCVCT
iegse_eng_data    off
iegse_dbsource SCCMDS_REJCT
write SCCMDS_RCVCT
end proc

IEGSE_FORCE_RAW

Global variables received in raw (data number) form can converted to engineering unit or state type values. In which case their type is deemed to be either to be that associated with the conversion. This directive forces STOL to treat the global variable as type data number (raw).

Applicable Environment

IEGSE Extension

PROCEDUREYES

Format

IEGSE_FORCE_RAW ON | OFF

Arguments

ON | OFF
Determines whether the action associated with IEGSE_FORCE_RAW is activated.

IEGSE Implementation Notes

None.

Examples


proc ex_rawforce
declare variable $my_pthresh = 12.0 V
declare variable $my_nthresh = -12.0 V

begin

write "PSS_PCU_P15V (Engineering) ", PSS_PCU_P15V

if (PSS_PCU_P15V < $my_pthresh) 
write "PSS +15V Out of range", PSS_PCU_P15V , "( < ", $my_pthresh, ")"
end if

iegse_force_raw on
write "PSS_PCU_P15V (Raw) ", PSS_PCU_P15V

iegse_force_raw off

if (PSS_PCU_N15V > $my_nthresh) 
write "PSS -15V Out of range", PSS_PCU_N15V , "( > ", $my_nthresh, ")"
end if
end proc

IEGSE_HIRCMD_LIMITS

Before commands are dispatched to the instrument STOL checks the values of any parameters to ensure that they are within a range specified in the command's database record.

Applicable Environment

IEGSE Extension

OPERATORPROCEDUREYES

Format

IEGSE_HIRCMD_LIMITS ON | OFF

Arguments

ON | OFF
Determines whether the action associated with IEGSE_HIRCMD_LIMITS is activated.

IEGSE Implementation Notes

  1. When this HIRDLS command limit checking OFF, a parameter is allowed to take any value, provided that the value does not overwrite another parameters position in the final command bitstring or the packet header as defined by the GIRD. The position of the left most (LSB) bit of the parameter in the bit string is fixed. IEGSE_HIRCMD_LIMITS allows a value which fills bits to the right of the start position of the previous parameter or command header (in the case of the first parameter).

Examples

proc hc_limit

begin

; By default HIRDLS command limit checking is ON

; Turn HIRDLS command limit checking OFF
;
iegse_hircmd_limits off

; Send command with an out of range parameter 
@hir_ipu_chopfreq 17000
write "Out of range parameter sent"

; This time send command with another out of range parameter, but whose 
; value is within defined bit pattern for parameter
@hir_ipu_chopfreq 2000
write "Another out of range parameter sent"

; Turn HIRDLS command limit checking back ON
iegse_hircmd_limits on

; Whichever of the two commands tried now will fail.
; @hir_ipu_chopfreq 17000
 @hir_ipu_chopfreq 2000

; Procedure should never get to this line
write "Something went wrong"

end proc

IEGSE_LOGFILE

Produces a logfile which contains configuration information about the IEGSE and instrument software and databases. All output from the procedure is recorded in the logfile. Logging can be controlled within the procedure by using the IEGSE_LOGGING statement. The use of IEGSE_LOGFILE causes logging to be turned on.

Applicable Environment

IEGSE Extension

PROCEDUREYES

Format

IEGSE_LOGFILE log_output_file

Arguments

log_output_file
A string expression identifying the name of the file where the log information will be written. The filename extension (.log) is optional if log_output_file is not a full pathname (i.e. doesn't start with a / character).

IEGSE Implementation Notes

  1. If log_output_file is not a full pathname the output is written to the users directory $HOME/stol/log.
  2. If a logfile of the same name exists when IEGSE_LOGFILE is called, the old logfile is saved a file called log_output_fileOLD_nn, where nn is an integer.
  3. Sub-procedures inherit their parent's logfile and logging status.
  4. It is recommended that IEGSE_LOGFILE is placed in the declarative section of the procedure, i.e. before the BEGIN statement. This captures the full procedure startup information in the log file.

Examples

proc comlog
declare variable $current_count = 0 DN

; log information will be written to xxx.log in directory ~/stol/log
iegse_logfile "xxx"

begin

let $current_count = SCCMDS_RCVCT

@HIR_SSH_SAFE

write "Command HIR_SSH_SAFE sent "
write "Initial command count = :", $current_count

; turn logging off
iegse_logging off

oo:
      if ($current_count = SCCMDS_RCVCT)
            write "Current count = :", $current_count
            wait 0:0:0.5
            goto oo:
      end if

; turn logging back on
iegse_logging on
write "New command count = :", SCCMDS_RCVCT

end proc


IEGSE_LOGGING

Controls whether logging in active or not within a procedure.

Applicable Environment

IEGSE Extension

PROCEDUREYES

Format

IEGSE_LOGGING ON | OFF

Arguments

ON | OFF
Determines whether IEGSE_LOGGING turns logging ON or OFF.

IEGSE Implementation Notes

The current logfile must have been identified by a IEGSE_LOGFILE call.

Examples

See example associated with IEGSE_LOGFILE above.


IEGSE_OUTDN_ID

If set off causes STOL not to print the DN identifier to data number variables and expressions output using the WRITE command. By default STOL will print the DN identifier.

Applicable Environment

IEGSE Extension

OPERATORPROCEDUREYES

Format

IEGSE_OUTDN_ID ON | OFF

Arguments

ON | OFF
Determines whether the action associated with IEGSE_OUTDN_ID is activated.

IEGSE Implementation Notes

  1. This directive was incorporated to allow STOL output to look more "natural" particularly in log files used for recording of output of formal instrument test procedures.

Examples


proc outdn

begin

write "SIG_DAT_13 ==> ", SIG_DAT_13
iegse_outdn_id off
write "SIG_DAT_13 ==> ", SIG_DAT_13

end proc

Produces the following output in the procedure I/O window.


SIG_DAT_13 ==>  12 DN
SIG_DAT_13 ==>  12
Procedure outdn exited. Code : NORMAL

IEGSE_OUTHEX

If set on causes STOL to format any integer or data number (raw) type variables and expressions as hexadecimal when output using the WRITE directive. By default STOL formats these variables and expressions as decimals.

Applicable Environment

IEGSE Extension

OPERATORPROCEDUREYES

Format

IEGSE_OUTHEX ON | OFF

Arguments

ON | OFF
Determines whether the action associated with IEGSE_OUTHEX is activated.

IEGSE Implementation Notes

    There is no way to format different items of a WRITE statement as either decimal or hexadecimal on an individual basis.

Examples


proc outhex

begin

write "SIG_DAT_13 ==> ", SIG_DAT_13
iegse_outhex on
write "SIG_DAT_13 ==> ", SIG_DAT_13
iegse_outdn_id off
write "SIG_DAT_13 ==> ", SIG_DAT_13
end proc
Produces the following output in the procedure I/O window.

SIG_DAT_13 ==>  12 DN
SIG_DAT_13 ==>  X#c DN
SIG_DAT_13 ==>  X#c
Procedure outhex exited. Code : NORMAL

IEGSE_STALE

Activates/deactivates the mechanism which causes STOL to generate an error if a global variable (telemetry item) is accessed when it is considered stale because it has not been subject to an acquisition update for longer than a period specified in the input_data database record.

Applicable Environment

IEGSE Extension

OPERATORPROCEDUREYES

Format

IEGSE_STALE ON | OFF

Arguments

ON | OFF
Determines whether the action associated with IEGSE_STALE is activated.

IEGSE Implementation Notes

  1. NOT YET IMPLEMENTED (as of 990611).
  2. Whether a telemetry point has it's stale status tracked is defined by the input_data database record associated with the telemetry point.

Examples


proc t_out

iegse_stale on
begin

loop 10

write SIG_DAT_02
wait 0:0:1
end loop

end proc

IF

IF is the main conditional control structure available in CSTOL. Each IF must have an associated END IF, and there may be optional ELSE and ELSE IF clauses.

Applicable Environment

IEGSE Extension

PROCEDURENO

Format

IF clause_expression

Arguments

clause_expression is a relational expression protected by a pair of brackets - ( ... ). See the IEGSE STOL User Guide for more details of STOL expressions.

IEGSE Implementation Notes

In CSTOL the enclosing ( ... ) brackets may be optional. In the IEGSE implementation they must be used.

Examples

proc if_show $k
declare input $k = 0
begin

; if with else / else if
if ($k > 0) 
	write "Positive"
else if ($k < 0) 
	write "Negative"
else
	write "Must be zero"
end if

; "bare" if
if ($k = 0) 
	write "Was Zero"
end if 

end proc

LET

Assign a value to a local or special variable.

Applicable Environment

IEGSE Extension

PROCEDURENO

Format

LET var = expression

Arguments

var
A variable which has previously been identified in a DECLARE statement or non-readonly special variable.

expression
A valid STOL expression (see IEGSE STOL User Guide for more details of STOL expressions). The type of expression must be the consistent with that implied in the DECLARE statement, or be an allowed assignment according to the CSTOL operator-operand compatibility rules.

IEGSE Implementation Notes

Examples

proc let_demo
declare variable $count = 2
begin

label1: 

let $count = $count + 1
write $count
	if ($count > 10) 
	goto end:
	end if

goto label1: 

end:
write "finished"

end proc

LOAD

Send a file containing HIRDLS command packets to the instrument. This file will have been prepared using the uplink_p utility.

Applicable Environment

IEGSE Extension

OPERATORPROCEDURENO

Format

LOAD [upload_file]

Arguments

upload_file
A string expression identifying the name of the file containing the HIRDLS command packets. The filename extension (.upl) is optional if upload_file is not a full pathname (i.e. doesn't start with a / character).

IEGSE Implementation Notes

  1. The directory search order if upload_file is not a full pathname is
    • The directories as specified by the configuration parameter [stol]:upldir.
    • The users own directory $HOME/stol. This is where uplink_p places upload files by default.
  2. If upload_file contains any restricted commands, the operator is required to give a confirmation before the any of the commands are dispatched to the instrument.
  3. If the file cannot be found or the upload file checksum indicates a corrupted file the upload process is halted. No data is sent to the instrument.

Examples

CSTOL>LOAD "/tmp/my_up.upl"
Full pathname upload

CSTOL>LOAD "new_sci_form" 
Searches for a file named new_sci_form.upl as described in the above IEGSE Implementation Notes.

LOOP

LOOP must have an associated END LOOP.

Applicable Environment

IEGSE Extension

PROCEDURENO

Format

LOOP [count]

Arguments

If count is not given the ESCAPE or a GOTO must be used to break out an indefinite iteration. If count is given there will be a maximum of count cycles of the loop. count must be a positive integer. The special variable $$LOOP_COUNT contains the number of cycles the loop has completed. $$LOOP_COUNT is initialised to zero at the start of each


PROC

Identifies the start of a STOL procedure.

Applicable Environment

IEGSE Extension

PROCEDURENO

Format

PROC proc_name [parameter_list]

Arguments

proc_name
The name of the procedure. This must start with a letter and contain only letters, digits and underscore characters.

parameter_list
The parameters required to be used when the procedure is started. This is a ASCII space separated list. Each item in the parameter list must be the subject of a DECLARE INPUT statement.

IEGSE Implementation Notes

  1. proc_name must be 14 characters or less.
  2. Only one PROC is allowed per file, i.e. each STOL procedure must be contained within it's own source file.
  3. The name of the file containing the procedure needs to be name.pro where name is proc_name converted to lowercase.

Examples


proc my_proc $text $count
; Procedure that takes two parameters
; $text : string
; $count : integer
;
declare input $text="word"
declare input $count=0
begin
loop $count
write $count, $text 
end loop
end proc

RETURN

OPERATOR USAGE
If sent by the operator RETURN kills the currently executing procedure and places it's parent (if any) in an unconditional wait state.

PROCEDURE USAGE
Causes the current procedure to exit and returns execution to it's parent procedure (if any).

Applicable Environment

IEGSE Extension

OPERATORPROCEDURENO

Format

RETURN [ALL]

Arguments

ALL
If ALL is specified the current procedure either return or is killed and all it's ancestors in the current procedure chain are killed.

IEGSE Implementation Notes

A sub-procedure should use RETURN to return control to the parent in the case of successful completion. There is no method of returning a value (error code) to the parent procedure. If an error return is required it is better to use WRITE to write an error message and WAIT to place the procedure in an unconditional wait.

Examples



START

Loads a STOL procedure object file and if successful starts execution.

Applicable Environment

IEGSE Extension

OPERATORPROCEDURENO

Format

START proc_name [parameter_list]

Arguments

proc_name
Name of procedure to execute.

parameter_list
A comma separated list of parameters.

IEGSE Implementation Notes

  1. Procedure object files are stored in a number of different path locations in the IEGSE central node filesystem. The search order is given by the configuration parameter [stol]:objdir. If a file name name.obj is not found in a directory specified by [stol]:objdir, the search for the file continues in directories given by [stol]:srcdir and then finally in the users own directory $HOME/stol.
  2. Each procedure runs as a separate operating system (Unix/Posix) process.
  3. A procedure started by the operator heads its own procedure chain and all sub-procedures started by it and it's descendants are part of that chain.
  4. If a procedure is running when the operator starts a new procedure, the original procedure is placed in an unconditional wait state and the new procedure becomes the current procedure.
  5. If procedure starts a new procedure which subsequents exits on error or is killed by the operator with a RETURN instruction the parent is placed in an unconditional wait state.
  6. Up to 24 procedures can be loaded at any time, however only one, the current procedure can be executing instructions.
  7. There is a limit to nesting level/depth at which sub-procedures can be created. The maximum nesting level should not be more than 4. It is the users responsibility to keep within this limit.
  8. There are no error recovery mechanisms implemented. If the procedure generates/encounters any error, it exits.

Examples

CSTOL>start comtest1
Starts a procedure, comtest1 which requires no parameters

CSTOL>start my_proc "typing", 6
Starts a procedure, my_proc which requires two parameters

WAIT

Applicable Environment

IEGSE Extension

OPERATORPROCEDURENO

Format

WAIT [expression]

Arguments

expression
If not given the procedure enters an unconditional wait state. The expression be either a conditional, a delta time, or a clock_time expression. The latter two cause the procedure to enter a timed wait state, otherwise the wait is conditional on the expression evaluating true.

IEGSE Implementation Notes

  1. When sent from the operator the WAIT applies to the current executing procedure.
  2. Conditional waits are only valid in procedures.

Examples

Operator

CSTOL>WAIT
Send unconditional wait instruction to currently executing procedure.
CSTOL>WAIT (SVA_STATUS /= 8 DN) 
Conditional waits not allowed from operator console
Fails with error message

Procedure


proc com_wait
declare variable $current_count = 0 DN  
declare variable $period = 0:0:10   
declare variable $timeout = /-0:0:0 

begin

let $current_count = SCCMDS_RCVCT

@HIR_SSH_SAFE
let $timeout = $$current_time + $period

; Wait on either telemetry point incrementing indicating command received
; or a timeout (specified by local variable "$period") occuring.

wait ((SCCMDS_RCVCT > $current_count) or ($$current_time > $timeout))

; Check if timeout caused conditional WAIT to evaluate TRUE

if ($current_count = SCCMDS_RCVCT) 
	write "Command timed out"
	; Use unconditional WAIT to get operator intervention 
	; because command has not been sent
	wait
end if

end proc

WRITE

Writes STOL expressions to standard output.

Applicable Environment

IEGSE Extension

OPERATORPROCEDURENO

Format

WRITE list

Arguments

list
Comma separated list of expressions.

IEGSE Implementation Notes

  1. A WRITE statement in a procedure produces output in the procedure's I/O window.
  2. By default WRITE outputs integers decimal values. Use the IEGSE_OUTHEX to produce hexadecimal output.
  3. By default WRITE outputs global variables as raw data values unless there exists a engineering or state conversion database entry in which case the output the converted type becomes the default. The IEGSE_FORCE_RAW statement allows converted global variable to output their raw value.
  4. Each WRITE statement corresponds to one line of output.

Examples


proc time
; Procedure demonstrating arithmetic and use of write.
declare variable $ww = 10:0:0.0
declare variable $xx = 10:0:0.0
declare variable $del = 10:0:0.0
declare variable $clk = 1995/1-10:0:0.0
declare variable $cc = 1995/1-10:0:0.0
declare variable $dd = 1995/1-10:0:0.0
declare variable $ee = 0
declare variable $ff = 0
begin

write "56 + 90 =",56 + 90
let $ee = 10
write "some number = ",$ee
let $ff = 9
write "some other number = ",$ff
write "first / second = ",$ee/$ff
let $ww = ::10.0
let $xx = ::11.0
let $cc = 1995/234-11:23:00.0
let $dd = 1995/234-11:26:45.3
let $clk = /-0:0:0.0
let $del = 0:0:0.0
write "add delta to delta ",$ww,"+",$xx," = ",$ww + $xx
let $del = $ww + $xx
write "delta", $del
write "sub delta from delta ",$ww,"-",$xx," = ",$ww - $xx
let $del = $ww - $xx
write "delta", $del
write "add delta to clock ",$ww,"-",$cc," = ",$ww + $cc
let $clk = $ww + $cc
write "clock", $clk
write "mul delta by int ",$ww,"*",$ff," = ",$ww * $ff
let $del = $ww * $ff
write "delta", $del
write "div delta by int ",$ww,"/",$ff," = ",$ww / $ff
let $del = $ww / $ff
write "delta", $del
write "sub delta from clock ",$cc,"-",$ww," = ",$cc - $ww
let $clk = $cc - $ww
write "clock", $clk
write "sub clock from clock ",$dd,"-",$cc," = ",$dd - $cc
let $del = $dd - $cc
write "delta", $del

let $del = $del * 12
write "delta * 12 = ", $del

let $clk = $clk + ::25.1
write "clock + ::25.1 = ", $clk

end proc

2.0 STOL Operator-Operand Compatibility Information

The IEGSE STOL implementation is exactly compliant with the OASIS-CC v02.05.12 documentation in this respect. In the following tables the row indicates the type of the first (left) operand and the column indicates the type of the second (right) operand. Where a combination results in a blank cell the operation is not allowed. The cell gives the result type of the operation (except for assignment where the results follows from the row type).

For example in the following code segment

declare variable $margin = 0.1
declare variable $high_val = 0.0
declare input $para = 2
begin 
let $high_val = ($para * $margin) + $para 
the multiplication is (integer * real) hence the multiplication below indicates that the result will be of type real real. This means the next expression is (real + integer) and looking at the addition table indicates that the result will be real.

2.1 Assignment (=)

integerrealclockdeltastatetextdneuunsigned
integerOKOK



OK
OK
realOKOK




OK
OK
clock

OK





delta


OK




state



OK



text




OK


dnOK




OK

eu
OK




OK

unsignedOK






OK

2.2 Addition (+)

integerrealclockdeltastatetextdneuunsigned
integerintegerreal





unsigned
realrealreal





real
clock


clock




delta

clock
delta




state








text




text


dn





dn

eu






eu

unsignedunsignedreal





unsigned

2.3 Subtraction (-)

integerrealclockdeltastatetextdneuunsigned
integerintegerreal





unsigned
realrealreal





real
clock

delta
clock




delta


delta




state








text








dn





dn

eu






eu

unsignedunsignedreal





unsigned

2.4 Multiplication (*)

integerrealclockdeltastatetextdn
euunsigned
integerintegerreal
delta



eu
unsigned
realrealreal




eu
real
clock








deltadelta







state








text








dn








eueu
eu







unsignedunsignedreal





unsigned

2.5 Division (/)

integerrealclockdeltastatetextdn
eu
unsigned
integerintegerreal





unsigned
realrealreal





real
clock








deltadelta







state








text








dn








eueu
eu







unsignedunsignedreal





unsigned

2.6 Modulo (mod)

Only applicable to integer operands producing integer result.

2.7 Exponentiation (**)

Exponent operand must be an integer, the other operand can be of either integer or real type and the operation result id of that type.

2.7 Logical (and, not, or, xor)

Only applicable to integer operands producing integer result (bitwise operations), or boolean operands producing boolean result.

2.9 Relational operators

2.9.1 Equals (=) and Not Equals (/=)

Operands must of same type except in case where one operand can be integer and the other one real.

2.9.2 Other relational operators (<=, =>, <, >)

As above except not allowed for text and state type operands.

3.0 Related Information

Return to IEGSE Home

Document ID: TC-IEG-051


Modified --> $Revision: 1.12 $ $Date: 2001/01/21 16:40:00 $

HIRDLS IEGSE Support
Department of Physics,
University of Oxford,
Oxford, OX1 3PU, UK.