Example:
%GCL PRINT 3 + 4
Example:
%GCL // This is a comment PRINT 3 + 4 // This is also a comment
routine (list)
where routine is the name of a DISLIN routine and list the parameters of the routine separated by commas.
Example:
%GCL METAFL ('CONS') DISINI () GRAF (0., 10., 0., 2., 0., 5., 0., 1.) DISFIN ()
v = function (list)
where function is the name of a DISLIN function and list the parameters of the function separated by commas.
DISGCL checks the number and types of parameters passed to DISLIN routines. If an error occurs, a warning is printed on the screen and the call of the routine will be ignored.
Example:
N = TRMLEN (1)DISGCL will print the warning:
>>>> Paramter mismatch User : TRMLEN (I) Correct: TRMLEN (S)The abbreviations in parameter mismatch warnings have the meaning:
I | denotes an integer parameter. |
X | denotes a floating point, integer or double parameter. |
D | denotes a double parameter. |
S | denotes a string. |
BR | denotes a byte array. |
IR | denotes an integer array. |
FR | denotes a floating point array. |
DR | denotes a double array. |
command [list]
where command is the name of a DISGCL command and list the parameters of the command separated by commas. Several DISGCL commands are explained in the next chapter.
Example:
PRINT FALLOC(10)
vray = { list }
where list is a constant list of integers or floating point numbers separated by commas. Additional note:
IF (expr) statement
Example:
IF (I < 10) A = 1
IF (expression) statements ELSE IF (expression) statements ELSE statements END IFIf expression is true, the statements in the IF block will be executed; if expression is false, control is transferred to the next ELSE IF, ELSE or END IF statement.
Example:
IF (A > 0) ISIGN = 1 ELSE IF (A < 0) ISIGN = -1 ELSE ISIGN = 0 END IFAdditional notes:
SWITCH (iexpr) CASE n1: statements CASE n2: statements .......... DEFAULT: statements END SWITCHEach case must be labeled by an INT constant while iexpr can be an integer expression. If a case matches iexpr, execution starts at that case. The case labeled DEFAULT is executed if none of the other cases are satisfied. The DEFAULT case is optional.
The following example counts the number of characters and the number of blanks in a string .
%GCL S = 'This is a test' I = 0 NCHAR = 0 NBLANK = 0 WHILE (S[I] != 0) SWITCH (S[I]) CASE 32: NBLANK = NBLANK + 1 DEFAULT: NCHAR = NCHAR + 1 END SWITCH I = I + 1 END WHILE PRINT NCHAR, NBLANKAdditional notes:
DO v = expr1, expr2 [,expr3] statements END DOwhere
v | is a loop counter. |
expr1 | is an expression that initializes v. |
expr2 | is an expression that defines the end of the loop range. |
expr3 | is an optional expression that will be used as an increment for the loop counter. The value cannot equal zero. The default value is 1. |
The following restrictions apply to DO loops:
WHILE (expr) statements END WHILEExample:
I = 0 SUM = 0 WHILE (I < 10) I = I + 1 SUM = SUM + I END WHILEThe following restrictions apply to WHILE loops:
Example:
I = 0 WHILE (I < 10) I = I + 1 PRINT I IF (I == 3) BREAK END WHILEThe output of the example is:
1 2 3Additional note:
Example:
DO I = 1, 5 IF (I == 3) CONTINUE PRINT I END DOThe output of the example is:
1 2 4 5
GOTO Label
where Label is the name of a label. For label names, the same rules as for variable names are applied.
The target of the GOTO statement must be a label statement which has the syntax:
Label:
Example:
I = 0 L1: I = I + 1 PRINT I IF (I < 5) GOTO L1The output of the example is:
1 2 3 4
$Command
where Command is a system command.
Example:
$DIR
displays the files in the current directory if the operating system is MS-DOS or VMS (use $ls for UNIX).