File: execute.tex

package info (click to toggle)
sollya 7.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 13,864 kB
  • sloc: ansic: 117,441; yacc: 8,822; lex: 2,419; makefile: 870; cpp: 76
file content (62 lines) | stat: -rw-r--r-- 2,269 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
\subsection{execute}
\label{labexecute}
\noindent Name: \textbf{execute}\\
\phantom{aaa}executes the content of a file\\[0.2cm]
\noindent Library name:\\
\verb|   void sollya_lib_execute(sollya_obj_t)|\\[0.2cm]
\noindent Usage: 
\begin{center}
\textbf{execute}(\emph{filename}) : \textsf{string} $\rightarrow$ \textsf{void}\\
\end{center}
Parameters: 
\begin{itemize}
\item \emph{filename} is a string representing a file name
\end{itemize}
\noindent Description: \begin{itemize}

\item \textbf{execute} opens the file indicated by \emph{filename}, and executes the sequence of 
   commands it contains. This command is evaluated at execution time: this way you
   can modify the file \emph{filename} (for instance using \textbf{bashexecute}) and execute it
   just after.

\item If \emph{filename} contains a command \textbf{execute}, it will be executed recursively.

\item If \emph{filename} contains a call to \textbf{restart}, it will be neglected.

\item If \emph{filename} contains a call to \textbf{quit}, the commands following \textbf{quit}
   in \emph{filename} will be neglected.
\end{itemize}
\noindent Example 1: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> a=2;
> a;
2
> print("a=1;") > "example.sollya";
> execute("example.sollya"); 
> a;
1
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 2: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> verbosity=1!;
> print("a=1; restart; a=2;") > "example.sollya";
> execute("example.sollya"); 
Warning: a restart command has been used in a file read into another.
This restart command will be neglected.
> a;
2
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 3: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> verbosity=1!;
> print("a=1; quit; a=2;") > "example.sollya";
> execute("example.sollya"); 
Warning: the execution of a file read by execute demanded stopping the interpret
ation but it is not stopped.
> a;
1
\end{Verbatim}
\end{minipage}\end{center}
See also: \textbf{parse} (\ref{labparse}), \textbf{readfile} (\ref{labreadfile}), \textbf{write} (\ref{labwrite}), \textbf{print} (\ref{labprint}), \textbf{bashexecute} (\ref{labbashexecute}), \textbf{quit} (\ref{labquit}), \textbf{restart} (\ref{labrestart})