From 7dfcc480ba1e19bd3232349fc733caef94034292 Mon Sep 17 00:00:00 2001 From: stainer_t Date: Mon, 8 Sep 2025 13:48:49 +0200 Subject: Initial commit from Polytechnique Montreal --- doc/IGE335/AppendixB.tex | 92 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 doc/IGE335/AppendixB.tex (limited to 'doc/IGE335/AppendixB.tex') diff --git a/doc/IGE335/AppendixB.tex b/doc/IGE335/AppendixB.tex new file mode 100644 index 0000000..c8fd8ac --- /dev/null +++ b/doc/IGE335/AppendixB.tex @@ -0,0 +1,92 @@ +\section{THE CLE-2000 CONTROL LANGUAGE} + +The CLE-2000 control language allows loops, conditional testing and +macro-processor capabilities to be included in the generalized driver input +deck. A reversed polish notation (RPN) calculator named {\tt EVALUATE} is also +provided. An example of conditional testing is shown in the following example +involving two modules: + +\vskip 0.4cm + +\noindent\begin{tabular}{|l|} +\hline \\ +{\tt INTEGER INDEX ;} \\ +{\tt MODULE MOD1: MOD2: ;} \\ +. \\ +. \\ +. \\ +{\tt EVALUATE INDEX := 0 ;} \\ +{\tt REPEAT} \\ +{\tt ~~~~~EVALUATE INDEX := INDEX 1 + ;} \\ +{\tt ~~~~~IF INDEX 3 > THEN} \\ +{\tt ~~~~~~~~~~}{\sl (list of output objects)} {\tt := MOD1:} {\sl (list of input objects) {\tt ::} (data input for {\tt MOD1:})} {\tt ; }\\ +{\tt ~~~~~ELSE} \\ +{\tt ~~~~~~~~~~}{\sl (list of output objects)} {\tt := MOD2:} {\sl (list of input objects) {\tt ::} (data input for {\tt MOD2:})} {\tt ;} \\ +{\tt ~~~~~ENDIF ;} \\ +{\tt UNTIL INDEX 7 >= ;} \\ +\\ \\ \hline +\end{tabular} + +\vskip 0.4cm + +An input deck will be built as a collection of +\begin{itemize} +\item {\tt PARAMETER}, {\tt MODULE}, {\tt PROCEDURE}, {\tt LINKED}$\_${\tt LIST}, {\tt XSM}$\_${\tt FILE}, {\tt SEQ}$\_${\tt BINARY}, {\tt SEQ}$\_${\tt ASCII}, +{\tt DIRECT}$\_${\tt ACCESS}, {\tt HDF5}$\_${\tt FILE}, {\tt INTEGER}, {\tt REAL}, {\tt CHARACTER}, {\tt DOUBLE} and {\tt LOGICAL} declarations; +\item {\tt MODULE} and {\tt PROCEDURE} calls; +\item {\tt EVALUATE} statements, {\tt ECHO} statements and conditional logic involving variables. +\end{itemize} + +This type of programming provides the user with much more flexibility than +the conventional approaches. It is possible to build new applications without +recompilation, simply by changing the order of the module calls and by making +modifications to the conditional logic. It is very simple to develop a +user-defined function even if this possibility is not programmed into any +module. + +The CLE-2000 control language brings the following capabilities to any code built around the generalized driver: + +\begin{itemize} +\item {\tt INTEGER}, {\tt REAL}, {\tt CHARACTER}, {\tt DOUBLE} and {\tt +LOGICAL} declarations to contain control language and macro-processor variables. + +\item macro processor variables. For example, it is possible to define a variable {\tt VAR1} as equal to a real number and to use {\tt <>} in place of this real number later on. + +\item reversed polish notation calculator. A calculator is called each time the statement {\tt EVALUATE} is used. For example, the statement + \begin{verbatim} +EVALUATE VAR1 := 4.0 6.0 + ; + \end{verbatim} +would assign the result 10.0 to the variable {\tt VAR1}. Logical operations are fully supported. + +\item a simple printer. For example, the variable {\tt VAR1} can be printed using the command + \begin{verbatim} +ECHO VAR1 ; + \end{verbatim} + +\item three types of control loops. The available control loops are: + +\begin{itemize} +\item {\tt IF} {\sl (logical expression)} {\tt THEN} {\sl (user instructions)} {\tt ELSE} {\sl (user instructions)} {\tt ENDIF ;} +\item {\tt REPEAT} {\sl (user instructions)} {\tt UNTIL} {\sl (logical expression)} {\tt ;} +\item {\tt WHILE} {\sl (logical expression)} {\tt DO} {\sl (user instructions)} {\tt ENDWHILE ;} +\end{itemize} + +\end{itemize} + +\vskip 0.2cm + +Note that the {\tt EVALUATE} and {\tt ECHO} statements are {\sl not} modules of the generalized driver. A few rules and constraints +should be known on order to write valid datasets: +\begin{itemize} +\item CLE-2000 script files ({\tt *.x2m} or {\tt *.c2m}) are UNIX {\sc ascii} files {\sl not DOS files}. +\item A line of CLE-2000 code cannot exceed 132 {\sc ascii} characters. +\item Only the first 120 {\sc ascii} characters are significant. +\item All {\sc ascii} characters following a ``{\tt *}'' or a ``{\tt !}'' are considered as comments. +\item All {\sc ascii} characters between ``{\tt (*}'' and ``{\tt *)}'' are considered as comments. +\item Character case is significant. +\item The space character ``~'' is the separator. It is obligatory. +\item Tab characters are forbidden (you should disable automatic tabs on the editor). +\item The main script has a ``{\tt .x2m}'' suffix. Called scripts have a ``{\tt .c2m}'' suffix. +\item If a script is contained in a UNIX file ``{\tt myscript.x2m}'' or ``{\tt myscript.c2m}'', its CLE-2000 name is ``{\tt myscript}''. This name cannot exceed 12 characters. +\end{itemize} + -- cgit v1.2.3