123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <html lang="en">
- <head>
- <title>Execution Modes - avram - a virtual machine code interpreter</title>
- <meta http-equiv="Content-Type" content="text/html">
- <meta name="description" content="avram - a virtual machine code interpreter">
- <meta name="generator" content="makeinfo 4.13">
- <link title="Top" rel="start" href="index.html#Top">
- <link rel="up" href="Invocation.html#Invocation" title="Invocation">
- <link rel="prev" href="Command-Line-Parsing.html#Command-Line-Parsing" title="Command Line Parsing">
- <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
- <meta http-equiv="Content-Style-Type" content="text/css">
- <style type="text/css"><!--
- pre.display { font-family:inherit }
- pre.format { font-family:inherit }
- pre.smalldisplay { font-family:inherit; font-size:smaller }
- pre.smallformat { font-family:inherit; font-size:smaller }
- pre.smallexample { font-size:smaller }
- pre.smalllisp { font-size:smaller }
- span.sc { font-variant:small-caps }
- span.roman { font-family:serif; font-weight:normal; }
- span.sansserif { font-family:sans-serif; font-weight:normal; }
- --></style>
- </head>
- <body>
- <div class="node">
- <a name="Execution-Modes"></a>
- <p>
- Previous: <a rel="previous" accesskey="p" href="Command-Line-Parsing.html#Command-Line-Parsing">Command Line Parsing</a>,
- Up: <a rel="up" accesskey="u" href="Invocation.html#Invocation">Invocation</a>
- <hr>
- </div>
- <h4 class="subsection">3.4.2 Execution Modes</h4>
- <p>Some functions declared in <samp><span class="file">exmodes.h</span></samp> are useful for executing
- interactive applications or filter mode transducers in a manner
- consistent with the specifications described in the previous chapter.
- <div class="defun">
- — Function: void <b>avm_interact</b> (<var>list avm_interactor, int step_mode, int ask_to_overwrite_mode, int quiet_mode</var>)<var><a name="index-avm_005finteract-593"></a></var><br>
- <blockquote>
- <p>This function executes an interactive virtual code application. The
- parameters have these interpretations.
- <dl>
- <dt><var>avm_interactor</var><dd>is the virtual code for a function that performs as specified in
- <a href="Output-From-Interactive-Applications.html#Output-From-Interactive-Applications">Output From Interactive Applications</a>.
- <br><dt><var>step_mode</var><dd>will cause all shell commands to be echoed if set to a non-zero
- value, and will cause the program to pause after each shell command
- until a key is pressed.
- <br><dt><var>ask_to_overwrite_mode</var><dd>can be set to a non-zero value by the caller to cause the program to ask
- permission of the user to overwrite any existing files in cases where
- the virtual code returns a file list as described in <a href="Mixed-Modes-of-Interaction.html#Mixed-Modes-of-Interaction">Mixed Modes of Interaction</a>.
- <br><dt><var>quiet_mode</var><dd>can be set to a non-zero value to suppress console messages in the case
- of file output per <a href="Mixed-Modes-of-Interaction.html#Mixed-Modes-of-Interaction">Mixed Modes of Interaction</a>.
- </dl>
- <p>The meaning of this function is accessible to any reader willing to slog
- through <a href="Output-From-Interactive-Applications.html#Output-From-Interactive-Applications">Output From Interactive Applications</a>. The only subtle
- point is that <var>avm_interactor</var> parameter in this function
- does not correspond to the virtual code application that <code>avram</code>
- reads from a virtual code file, but to the result computed when the
- application read from the file is applied to the data structure
- representing the command line and environment.
- <p>Any of the memory overflows or i/o errors possible with other functions
- in the library are possible from this one as well, and will also cause
- it to print an error message and halt the program. A badly designed
- <a name="index-deadlock-594"></a>virtual code application could cause a deadlock, which will not be
- detected or reported
- </p></blockquote></div>
- <div class="defun">
- — Function: void <b>avm_trace_interaction</b> ()<var><a name="index-avm_005ftrace_005finteraction-595"></a></var><br>
- <blockquote>
- <p>This function enables diagnostic output for the <code>avm_recoverable_interact</code>
- function.
- </p></blockquote></div>
- <div class="defun">
- — Function: void <b>avm_disable_interaction</b> ()<var><a name="index-avm_005fdisable_005finteraction-596"></a></var><br>
- <blockquote>
- <p>This function causes <code>avm_interact</code> and <code>avm_recoverable_interact</code>
- to terminate with an error instead of executing, as required by the
- <code>--jail</code> command line option.
- </p></blockquote></div>
- <div class="defun">
- — Function: list <b>avm_recoverable_interact</b> (<var>list interactor, int *fault</var>)<var><a name="index-avm_005frecoverable_005finteract-597"></a></var><br>
- <blockquote>
- <p>This function is similar to <code>avm_interact</code> but always closes the
- pipe and performs no file i/o, and will return an error message rather
- than exiting. Otherwise it returns a transcript of the intereaction as
- a list of lists of strings represented as lists of character
- encodings. It implements the <var>interact</var> combinator with the
- virtual code for the transducer function given as the parameter. A
- prior call to <code>avm_trace_interaction</code> will cause diagnostic
- information to be written to standard output when this function is
- executed.
- </p></blockquote></div>
- <div class="defun">
- — Function: void <b>avm_byte_transduce</b> (<var>list operator</var>)<var><a name="index-avm_005fbyte_005ftransduce-598"></a></var><br>
- <blockquote>
- <p>This function executes a filter mode byte transducer application, which
- behaves as described in <a href="Byte-Transducers.html#Byte-Transducers">Byte Transducers</a>. The argument is the
- virtual code for the application, which would be found in a virtual code
- file. There are limited opportunities for i/o errors, as only standard
- input and standard output are involved with this function, but fatal
- errors due to memory overflow are possible.
- </p></blockquote></div>
- <div class="defun">
- — Function: void <b>avm_line_map</b> (<var>list operator</var>)<var><a name="index-avm_005fline_005fmap-599"></a></var><br>
- <blockquote>
- <p>This function executes line mapped filter mode applications, which are
- explained in <a href="Line-Maps.html#Line-Maps">Line Maps</a>. The argument is the virtual code for the
- application. Similar comments to those above apply.
- </p></blockquote></div>
- <div class="defun">
- — Function: void <b>avm_initialize_exmodes</b> ()<var><a name="index-avm_005finitialize_005fexmodes-600"></a></var><br>
- <blockquote>
- <p>This function should be called before any of the other functions in this
- section in order to initialize some local variables. Results are
- undefined if this function isn't called first.
- </p></blockquote></div>
- <div class="defun">
- — Function: void <b>avm_count_exmodes</b> ()<var><a name="index-avm_005fcount_005fexmodes-601"></a></var><br>
- <blockquote>
- <p>This function doesn't do anything in the present version of the library,
- but should be called after the last call to any of the other functions
- in this section in order to maintain compatibility with future versions,
- which may use it for cleaning up local variables.
- </p></blockquote></div>
- </body></html>
|