Execution-Modes.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
  2. <html>
  3. <!-- Created on December 10, 2012 by texi2html 1.82
  4. texi2html was written by:
  5. Lionel Cons <[email protected]> (original author)
  6. Karl Berry <[email protected]>
  7. Olaf Bachmann <[email protected]>
  8. and many others.
  9. Maintained by: Many creative people.
  10. Send bugs and suggestions to <[email protected]>
  11. -->
  12. <head>
  13. <title>avram - a virtual machine code interpreter: 3.4.2 Execution Modes</title>
  14. <meta name="description" content="avram - a virtual machine code interpreter: 3.4.2 Execution Modes">
  15. <meta name="keywords" content="avram - a virtual machine code interpreter: 3.4.2 Execution Modes">
  16. <meta name="resource-type" content="document">
  17. <meta name="distribution" content="global">
  18. <meta name="Generator" content="texi2html 1.82">
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <style type="text/css">
  21. <!--
  22. a.summary-letter {text-decoration: none}
  23. blockquote.smallquotation {font-size: smaller}
  24. pre.display {font-family: serif}
  25. pre.format {font-family: serif}
  26. pre.menu-comment {font-family: serif}
  27. pre.menu-preformatted {font-family: serif}
  28. pre.smalldisplay {font-family: serif; font-size: smaller}
  29. pre.smallexample {font-size: smaller}
  30. pre.smallformat {font-family: serif; font-size: smaller}
  31. pre.smalllisp {font-size: smaller}
  32. span.roman {font-family:serif; font-weight:normal;}
  33. span.sansserif {font-family:sans-serif; font-weight:normal;}
  34. ul.toc {list-style: none}
  35. -->
  36. </style>
  37. </head>
  38. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  39. <a name="Execution-Modes"></a>
  40. <table cellpadding="1" cellspacing="1" border="0">
  41. <tr><td valign="middle" align="left">[<a href="Command-Line-Parsing.html#Command-Line-Parsing" title="Previous section in reading order"> &lt; </a>]</td>
  42. <td valign="middle" align="left">[<a href="Version-Management.html#Version-Management" title="Next section in reading order"> &gt; </a>]</td>
  43. <td valign="middle" align="left"> &nbsp; </td>
  44. <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
  45. <td valign="middle" align="left">[<a href="Invocation.html#Invocation" title="Up section"> Up </a>]</td>
  46. <td valign="middle" align="left">[<a href="Character-Table.html#Character-Table" title="Next chapter"> &gt;&gt; </a>]</td>
  47. <td valign="middle" align="left"> &nbsp; </td>
  48. <td valign="middle" align="left"> &nbsp; </td>
  49. <td valign="middle" align="left"> &nbsp; </td>
  50. <td valign="middle" align="left"> &nbsp; </td>
  51. <td valign="middle" align="left">[<a href="avram.html#Top" title="Cover (top) of document">Top</a>]</td>
  52. <td valign="middle" align="left">[<a href="avram_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
  53. <td valign="middle" align="left">[<a href="Function-Index.html#Function-Index" title="Index">Index</a>]</td>
  54. <td valign="middle" align="left">[<a href="avram_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
  55. </tr></table>
  56. <hr size="1">
  57. <a name="Execution-Modes-1"></a>
  58. <h3 class="subsection">3.4.2 Execution Modes</h3>
  59. <p>Some functions declared in &lsquo;<tt>exmodes.h</tt>&rsquo; are useful for executing
  60. interactive applications or filter mode transducers in a manner
  61. consistent with the specifications described in the previous chapter.
  62. </p>
  63. <dl>
  64. <dt><a name="index-avm_005finteract"></a><u>Function:</u> void <b>avm_interact</b><i> (list <var>avm_interactor</var>, int <var>step_mode</var>, int <var>ask_to_overwrite_mode</var>, int <var>quiet_mode</var>)</i></dt>
  65. <dd>
  66. <p>This function executes an interactive virtual code application. The
  67. parameters have these interpretations.
  68. </p>
  69. <dl compact="compact">
  70. <dt> <code><var>avm_interactor</var></code></dt>
  71. <dd><p>is the virtual code for a function that performs as specified in
  72. <a href="Output-From-Interactive-Applications.html#Output-From-Interactive-Applications">Output From Interactive Applications</a>.
  73. </p></dd>
  74. <dt> <code><var>step_mode</var></code></dt>
  75. <dd><p>will cause all shell commands to be echoed if set to a non-zero
  76. value, and will cause the program to pause after each shell command
  77. until a key is pressed.
  78. </p></dd>
  79. <dt> <code><var>ask_to_overwrite_mode</var></code></dt>
  80. <dd><p>can be set to a non-zero value by the caller to cause the program to ask
  81. permission of the user to overwrite any existing files in cases where
  82. 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>.
  83. </p></dd>
  84. <dt> <code><var>quiet_mode</var></code></dt>
  85. <dd><p>can be set to a non-zero value to suppress console messages in the case
  86. of file output per <a href="Mixed-Modes-of-Interaction.html#Mixed-Modes-of-Interaction">Mixed Modes of Interaction</a>.
  87. </p></dd>
  88. </dl>
  89. <p>The meaning of this function is accessible to any reader willing to slog
  90. through <a href="Output-From-Interactive-Applications.html#Output-From-Interactive-Applications">Output From Interactive Applications</a>. The only subtle
  91. point is that <code><var>avm_interactor</var></code> parameter in this function
  92. does not correspond to the virtual code application that <code>avram</code>
  93. reads from a virtual code file, but to the result computed when the
  94. application read from the file is applied to the data structure
  95. representing the command line and environment.
  96. </p>
  97. <p>Any of the memory overflows or i/o errors possible with other functions
  98. in the library are possible from this one as well, and will also cause
  99. it to print an error message and halt the program. A badly designed
  100. <a name="index-deadlock-2"></a>
  101. virtual code application could cause a deadlock, which will not be
  102. detected or reported
  103. </p></dd></dl>
  104. <dl>
  105. <dt><a name="index-avm_005ftrace_005finteraction"></a><u>Function:</u> void <b>avm_trace_interaction</b><i> ()</i></dt>
  106. <dd>
  107. <p>This function enables diagnostic output for the <code>avm_recoverable_interact</code>
  108. function.
  109. </p></dd></dl>
  110. <dl>
  111. <dt><a name="index-avm_005fdisable_005finteraction"></a><u>Function:</u> void <b>avm_disable_interaction</b><i> ()</i></dt>
  112. <dd>
  113. <p>This function causes <code>avm_interact</code> and <code>avm_recoverable_interact</code>
  114. to terminate with an error instead of executing, as required by the
  115. <code>--jail</code> command line option.
  116. </p></dd></dl>
  117. <dl>
  118. <dt><a name="index-avm_005frecoverable_005finteract"></a><u>Function:</u> list <b>avm_recoverable_interact</b><i> (list <var>interactor</var>, int <var>*fault</var>)</i></dt>
  119. <dd>
  120. <p>This function is similar to <code>avm_interact</code> but always closes the
  121. pipe and performs no file i/o, and will return an error message rather
  122. than exiting. Otherwise it returns a transcript of the intereaction as
  123. a list of lists of strings represented as lists of character
  124. encodings. It implements the <var>interact</var> combinator with the
  125. virtual code for the transducer function given as the parameter. A
  126. prior call to <code>avm_trace_interaction</code> will cause diagnostic
  127. information to be written to standard output when this function is
  128. executed.
  129. </p></dd></dl>
  130. <dl>
  131. <dt><a name="index-avm_005fbyte_005ftransduce"></a><u>Function:</u> void <b>avm_byte_transduce</b><i> (list <var>operator</var>)</i></dt>
  132. <dd>
  133. <p>This function executes a filter mode byte transducer application, which
  134. behaves as described in <a href="Byte-Transducers.html#Byte-Transducers">Byte Transducers</a>. The argument is the
  135. virtual code for the application, which would be found in a virtual code
  136. file. There are limited opportunities for i/o errors, as only standard
  137. input and standard output are involved with this function, but fatal
  138. errors due to memory overflow are possible.
  139. </p></dd></dl>
  140. <dl>
  141. <dt><a name="index-avm_005fline_005fmap"></a><u>Function:</u> void <b>avm_line_map</b><i> (list <var>operator</var>)</i></dt>
  142. <dd>
  143. <p>This function executes line mapped filter mode applications, which are
  144. explained in <a href="Line-Maps.html#Line-Maps">Line Maps</a>. The argument is the virtual code for the
  145. application. Similar comments to those above apply.
  146. </p></dd></dl>
  147. <dl>
  148. <dt><a name="index-avm_005finitialize_005fexmodes"></a><u>Function:</u> void <b>avm_initialize_exmodes</b><i> ()</i></dt>
  149. <dd>
  150. <p>This function should be called before any of the other functions in this
  151. section in order to initialize some local variables. Results are
  152. undefined if this function isn&rsquo;t called first.
  153. </p></dd></dl>
  154. <dl>
  155. <dt><a name="index-avm_005fcount_005fexmodes"></a><u>Function:</u> void <b>avm_count_exmodes</b><i> ()</i></dt>
  156. <dd>
  157. <p>This function doesn&rsquo;t do anything in the present version of the library,
  158. but should be called after the last call to any of the other functions
  159. in this section in order to maintain compatibility with future versions,
  160. which may use it for cleaning up local variables.
  161. </p></dd></dl>
  162. <hr size="1">
  163. <table cellpadding="1" cellspacing="1" border="0">
  164. <tr><td valign="middle" align="left">[<a href="Command-Line-Parsing.html#Command-Line-Parsing" title="Previous section in reading order"> &lt; </a>]</td>
  165. <td valign="middle" align="left">[<a href="Version-Management.html#Version-Management" title="Next section in reading order"> &gt; </a>]</td>
  166. <td valign="middle" align="left"> &nbsp; </td>
  167. <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
  168. <td valign="middle" align="left">[<a href="Invocation.html#Invocation" title="Up section"> Up </a>]</td>
  169. <td valign="middle" align="left">[<a href="Character-Table.html#Character-Table" title="Next chapter"> &gt;&gt; </a>]</td>
  170. <td valign="middle" align="left"> &nbsp; </td>
  171. <td valign="middle" align="left"> &nbsp; </td>
  172. <td valign="middle" align="left"> &nbsp; </td>
  173. <td valign="middle" align="left"> &nbsp; </td>
  174. <td valign="middle" align="left">[<a href="avram.html#Top" title="Cover (top) of document">Top</a>]</td>
  175. <td valign="middle" align="left">[<a href="avram_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
  176. <td valign="middle" align="left">[<a href="Function-Index.html#Function-Index" title="Index">Index</a>]</td>
  177. <td valign="middle" align="left">[<a href="avram_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
  178. </tr></table>
  179. <p>
  180. <font size="-1">
  181. This document was generated on <i>December 10, 2012</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>.
  182. </font>
  183. <br>
  184. </p>
  185. </body>
  186. </html>