Standard-Output-Representation.html 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <html lang="en">
  2. <head>
  3. <title>Standard Output 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="Standard-Input-Representation.html#Standard-Input-Representation" title="Standard Input Representation">
  10. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  11. <meta http-equiv="Content-Style-Type" content="text/css">
  12. <style type="text/css"><!--
  13. pre.display { font-family:inherit }
  14. pre.format { font-family:inherit }
  15. pre.smalldisplay { font-family:inherit; font-size:smaller }
  16. pre.smallformat { font-family:inherit; font-size:smaller }
  17. pre.smallexample { font-size:smaller }
  18. pre.smalllisp { font-size:smaller }
  19. span.sc { font-variant:small-caps }
  20. span.roman { font-family:serif; font-weight:normal; }
  21. span.sansserif { font-family:sans-serif; font-weight:normal; }
  22. --></style>
  23. </head>
  24. <body>
  25. <div class="node">
  26. <a name="Standard-Output-Representation"></a>
  27. <p>
  28. Previous:&nbsp;<a rel="previous" accesskey="p" href="Standard-Input-Representation.html#Standard-Input-Representation">Standard Input Representation</a>,
  29. 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>
  30. <hr>
  31. </div>
  32. <h5 class="subsubsection">2.5.1.2 Standard Output Representation</h5>
  33. <p><a name="index-standard-output-187"></a><a name="index-g_t_0040code_007braw_002doutput_007d-command-line-option-188"></a><a name="index-g_t_0040code_007bchoice_002dof_002doutput_007d-command-line-option-189"></a>As in the case of standard input, the representation for standard output
  34. that the function is expected to return depends on the command line
  35. options with which the application is invoked. The only relevant options
  36. are <samp><span class="option">--raw-output</span></samp> and <samp><span class="option">--choice-of-output</span></samp>, which are
  37. mutually exclusive.
  38. <ul>
  39. <li>If neither option is selected, the result returned by the function must
  40. be a list of character strings.
  41. <li>If <samp><span class="option">--raw-output</span></samp> is used, the result returned by the
  42. function is unconstrained, and it will be written as a data file with no
  43. preamble, following the format specified in <a href="File-Format.html#File-Format">File Format</a>.
  44. <li>If <samp><span class="option">--choice-of-output</span></samp> is used, the result returned by the
  45. function must be a pair <code>(</code><var>preamble</var><code>,</code><var>contents</var><code>)</code>.
  46. </ul>
  47. <p><a name="index-preamble-190"></a>In the last case, the preamble determines how the file will be written.
  48. If it is meant to be a text file, the preamble should be <code>nil</code>, and
  49. the contents should be a list of character strings. If it is meant to be
  50. a data file, the preamble should be a non-empty list of character
  51. strings, and the format of the contents is unconstrained. To express a
  52. data file with no preamble, the preamble should be the list containing
  53. the empty string, rather than being empty.
  54. <p>In the result returned by the function, the preamble lines should not
  55. include leading hash characters, because they are automatically added to
  56. the output to enforce consistency with the data file format. However,
  57. they should include trailing backslashes as continuation characters
  58. where appropriate. The hashes that are automatically added will be
  59. automatically stripped by <code>avram</code> on behalf of whatever application
  60. uses the file.
  61. <p><a name="index-character-strings-191"></a><a name="index-printing-algorithm-192"></a>Any file can be written as a list of character strings, even &ldquo;text&rdquo;
  62. files that are full of unprintable characters, and even &ldquo;text&rdquo; files
  63. that happen to conform to the format used for data files. However, if
  64. the application intends to write a data file in the standard format used
  65. by other virtual code applications, it can do so more quickly and easily
  66. by having the virtual machine do the formatting automatically with the
  67. <samp><span class="option">--choice-of-output</span></samp> option than by implementing the algorithm in
  68. <a href="Concrete-Syntax.html#Concrete-Syntax">Concrete Syntax</a>, from scratch in virtual code.
  69. </body></html>