Appendix B - Scripting - Multitech ProxyServer MTPSR2-201 User Manual

Hide thumbs Also See for ProxyServer MTPSR2-201:
Table of Contents

Advertisement

Appendix B - Scripting

The script file can be used to automate certain operation. The script file is a text file containing a
sequence of commands. The structure of a script file is succinctly expressed by the following
grammar.
Script Language Grammar
<program>
<declarations>
<var_type>
<statement_list>
<statement>
<if_statement>
ENDIF
<for_statement>
<while_statement> =WHILE <expression> DO <statement_list> ENDWHILE
<switch_statement>=SWITCH <expression> {CASE <integer_const> <statement_list> I
<elementary_statement>
<expression>
<expression>I
OPERATOR
<proc_declaration> =PROC <identifier>/(<parameter_list>)} { :<vartype> };FORWARD ;
<proc_declaration> =PROC <identifier>/(<parameter_list>)} / : <vartype> / ;
<parameter_list>
<argument_list>
Execution starts at the PROC main. PROC main cannot have any arguments. All the variables
have to be declared before use. All procedures must be declared before calling. Recursion is
allowed in procedures.
To define mutually recursive procedures, use the FORWARD directive to indicate that the
procedure body is defined later in the source file. Procedures defined with the FORWARD
directive should have all the parameters and return value (if any) specified, the actual definition of
the procedure body should not contain the formal parameter list or the return value. An example
of forward defined procedures is given below:
proc a(integer x,y) : integer,forward:
proc b(integer u,v) : integer,forward:
proc a;
integer t;
/*Some more code here. */
t=b(x,y);
/*Some more code here. */
return(t);
endproc
proc b;
return(a(u,v);
endproc
=<declarations> <proc_declarations>
={<var_type> <identifier> {, <indentifier> } ; }
=INTEGER I STRING
={<statement>}
=<elementary_statement> I <if_statement> I<for_statement> I
<while_statement> I <switch_statement>
=IF <expression> THEN <statement_list> {ELSE<statement_list> }
=FOR <indentifier>=<expression> TO IDOWNTO <expression} STEP
<expression> / DO <statement_list> ENDFOR
CASE <string_const> <statement_list> I
DEFAULT <statement_list> }
ENDSWITCH
=<identifier> = <expression> ; I <identifier> / (<expression>
{,<expression> } ) /; I GOTO <identifier> ; I <identifier> : I ;
=<expression> OPERATOR <expression> I {<expression> } I /
- <expression> I<identifier> / (<expression> {, <expression> } ) /
= < I <= I > I >= I == I != I && I II I + I - I * I / I !
<declarations> <statement_list>ENDPROC
=<argument_list> { ; <argument_list>}
={VAR} <var_type> <identifier> {<identifier>}
Appendix B - Scripting
57

Advertisement

Table of Contents
loading

Table of Contents