Character-Oriented-Interaction.html 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <html lang="en">
  2. <head>
  3. <title>Character Oriented Interaction - avram - a virtual machine code interpreter</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="avram - a virtual machine code interpreter">
  6. <meta name="generator" content="makeinfo 4.13">
  7. <link title="Top" rel="start" href="index.html#Top">
  8. <link rel="up" href="Output-From-Interactive-Applications.html#Output-From-Interactive-Applications" title="Output From Interactive Applications">
  9. <link rel="prev" href="Line-Oriented-Interaction.html#Line-Oriented-Interaction" title="Line Oriented Interaction">
  10. <link rel="next" href="Mixed-Modes-of-Interaction.html#Mixed-Modes-of-Interaction" title="Mixed Modes of Interaction">
  11. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  12. <meta http-equiv="Content-Style-Type" content="text/css">
  13. <style type="text/css"><!--
  14. pre.display { font-family:inherit }
  15. pre.format { font-family:inherit }
  16. pre.smalldisplay { font-family:inherit; font-size:smaller }
  17. pre.smallformat { font-family:inherit; font-size:smaller }
  18. pre.smallexample { font-size:smaller }
  19. pre.smalllisp { font-size:smaller }
  20. span.sc { font-variant:small-caps }
  21. span.roman { font-family:serif; font-weight:normal; }
  22. span.sansserif { font-family:sans-serif; font-weight:normal; }
  23. --></style>
  24. </head>
  25. <body>
  26. <div class="node">
  27. <a name="Character-Oriented-Interaction"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="Mixed-Modes-of-Interaction.html#Mixed-Modes-of-Interaction">Mixed Modes of Interaction</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="Line-Oriented-Interaction.html#Line-Oriented-Interaction">Line Oriented Interaction</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="Output-From-Interactive-Applications.html#Output-From-Interactive-Applications">Output From Interactive Applications</a>
  32. <hr>
  33. </div>
  34. <h5 class="subsubsection">2.6.4.2 Character Oriented Interaction</h5>
  35. <p>A character oriented style of interaction involves the function always
  36. returning a data structure of the form <code>(</code><var>state</var><code>,(</code><var>command
  37. lines</var><code>,nil))</code>. The <var>state</var> and <var>command lines</var> fields serve
  38. <a name="index-command-line-236"></a>exactly the same purposes respectively as they do in the case of line
  39. oriented interaction. The field that would be occupied by the
  40. <var>prompt strings</var> list in the case of line oriented interaction is
  41. identically <code>nil</code> in this style.
  42. <p>When this style is used, <code>avram</code> spawns a process and/or sends
  43. <a name="index-spawning-processes-237"></a>command lines to it as in the case of line oriented interaction, but
  44. attempts to read only a single character from it per iteration. When the
  45. character is received, <code>avram</code> applies the function to the pair
  46. <code>(</code><var>state</var><code>,</code><var>character</var><code>)</code> in order to obtain the next state
  47. and the next list of command lines. If the process has terminated, a
  48. <code>nil</code> value is used in place of the character. If the process is
  49. quiescent, deadlock ensues.
  50. <p>The character oriented style is a lower level protocol that shifts more
  51. of the burden of analyzing the process's output to the virtual code
  52. application. It can do anything line oriented interaction can do except
  53. proceeding immediately without waiting to receive any output from the
  54. process. It may also allow more general criteria (in effect) than the
  55. matching of a fixed prompt string to delimit the received data, for
  56. those pathological processes that may require such things.
  57. <p>Applications using character oriented interaction need to deal with line
  58. <a name="index-line-breaks-238"></a>breaks explicitly among the received characters, unlike the case with
  59. line oriented interaction, where the line breaks are implicit in the
  60. <a name="index-Unix-239"></a>list of received strings. Contrary to the convention for Unix text
  61. files, line breaks in the output of a process are indicated by character
  62. code 13 followed by character code 10.
  63. </body></html>