Standard-Input-Representation.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <html lang="en">
  2. <head>
  3. <title>Standard Input Representation - 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="Loading-All-of-Standard-Input-at-Once.html#Loading-All-of-Standard-Input-at-Once" title="Loading All of Standard Input at Once">
  9. <link rel="prev" href="Loading-All-of-Standard-Input-at-Once.html#Loading-All-of-Standard-Input-at-Once" title="Loading All of Standard Input at Once">
  10. <link rel="next" href="Standard-Output-Representation.html#Standard-Output-Representation" title="Standard Output Representation">
  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="Standard-Input-Representation"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="Standard-Output-Representation.html#Standard-Output-Representation">Standard Output Representation</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="Loading-All-of-Standard-Input-at-Once.html#Loading-All-of-Standard-Input-at-Once">Loading All of Standard Input at Once</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="Loading-All-of-Standard-Input-at-Once.html#Loading-All-of-Standard-Input-at-Once">Loading All of Standard Input at Once</a>
  32. <hr>
  33. </div>
  34. <h5 class="subsubsection">2.5.1.1 Standard Input Representation</h5>
  35. <p><a name="index-standard-input-179"></a>The representation for the standard input file used as the argument to
  36. the function depends both on the file format and on the command line
  37. options specified when the application is invoked. The
  38. <a name="index-g_t_0040code_007bunparameterized_007d-command-line-option-180"></a><a name="index-g_t_0040code_007braw_002dmode_007d-command-line-option-181"></a><samp><span class="option">--unparameterized</span></samp> and <samp><span class="option">--raw-output</span></samp> options make no
  39. difference to the input representation, and the <samp><span class="option">--line-map</span></samp>
  40. and <samp><span class="option">--byte-transducer</span></samp> options are not relevant to this mode of
  41. operation. That leaves four possible combined settings of the
  42. <a name="index-g_t_0040code_007bchoice_002dof_002doutput_007d-command-line-option-182"></a><a name="index-g_t_0040code_007bforce_002dtext_002dinput_007d-command-line-option-183"></a><samp><span class="option">--choice-of-output</span></samp> and <samp><span class="option">--force-text-input</span></samp> options. If
  43. standard input conforms to the data file format specification <a href="File-Format.html#File-Format">File Format</a>,
  44. the following effects are possible.
  45. <ul>
  46. <li>If neither <samp><span class="option">--choice-of-output</span></samp> nor
  47. <samp><span class="option">--force-text-input</span></samp> is used, the argument to the function will
  48. be given directly by the tree encoded in the data section of the
  49. file. The preamble of the file will be ignored.
  50. <li>If the <samp><span class="option">--choice-of-output</span></samp> option is used
  51. and the <samp><span class="option">--force-text-input</span></samp> option is not used, the argument to
  52. the function will be a pair <code>(</code><var>preamble</var><code>,</code><var>contents</var><code>)</code>,
  53. where <var>preamble</var> is a list of character strings taken from the
  54. preamble of the file (with leading hashes stripped), and <var>contents</var>
  55. is the tree represented in the data section of the file.
  56. <li>If the <samp><span class="option">--choice-of-output</span></samp> option is not used
  57. and the <samp><span class="option">--force-text-input</span></samp> option is used, the argument to the
  58. function will be the whole file as a list of character strings. I.e.,
  59. both the preamble and the data sections are included, hashes are not
  60. stripped from the preamble, and the data section is not converted to the
  61. tree it represents.
  62. <li>If the <samp><span class="option">--choice-of-output</span></samp> option is used
  63. and the <samp><span class="option">--force-text-input</span></samp> option is also used, the argument to the
  64. the function will be a pair <code>(nil,</code><var>contents</var><code>)</code>, where the
  65. contents are the list of character strings as in the previous case.
  66. </ul>
  67. <p><a name="index-file-format-184"></a>If standard input does not conform to the data file format specification
  68. in <a href="File-Format.html#File-Format">File Format</a>, then it is assumed to be a text file. The
  69. <samp><span class="option">--force-text-input</span></samp> option makes no difference, and there are
  70. only two possible effects, depending on whether
  71. <samp><span class="option">--choice-of-output</span></samp> is used. They correspond to the latter two
  72. cases above, where <samp><span class="option">--force-text-input</span></samp> is used.
  73. <p><a name="index-preamble-185"></a><a name="index-text-files-186"></a>The idea of the <samp><span class="option">--choice-of-output</span></samp> option is that it is used
  74. only for applications that are smart enough to be aware of the
  75. <code>(</code><var>preamble</var><code>,</code><var>contents</var><code>)</code> convention. A non-empty preamble
  76. implies a data file whose contents could be any type, but an empty
  77. preamble implies a text file whose contents can only be a list of
  78. character strings. (In the case of a data file with no preamble, the
  79. list of the empty string is used for the preamble to distinguish it from
  80. a text file.)
  81. <p>Dumb applications that never want to deal with anything but text files
  82. should be invoked with <samp><span class="option">--force-text-input</span></samp>. Otherwise, they have
  83. to be prepared for either text or data as arguments.
  84. <p>The use of both options at once is unproductive as far as the input
  85. format is concerned, but may be justified when the output is to be a
  86. data file and the input is text only.
  87. </body></html>