Input-Data-Structure.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <html lang="en">
  2. <head>
  3. <title>Input Data Structure - 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="Parameter-Mode-Interface.html#Parameter-Mode-Interface" title="Parameter Mode Interface">
  9. <link rel="prev" href="Parameter-Mode-Interface.html#Parameter-Mode-Interface" title="Parameter Mode Interface">
  10. <link rel="next" href="Input-for-Mapped-Applications.html#Input-for-Mapped-Applications" title="Input for Mapped Applications">
  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="Input-Data-Structure"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="Input-for-Mapped-Applications.html#Input-for-Mapped-Applications">Input for Mapped Applications</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="Parameter-Mode-Interface.html#Parameter-Mode-Interface">Parameter Mode Interface</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="Parameter-Mode-Interface.html#Parameter-Mode-Interface">Parameter Mode Interface</a>
  32. <hr>
  33. </div>
  34. <h4 class="subsection">2.6.1 Input Data Structure</h4>
  35. <p>The data structure that is used as the argument to the parameter mode
  36. application incorporates all the information about the command line and
  37. <a name="index-environment-202"></a><a name="index-command-line-203"></a>the environment variables. It is in the form of a triple
  38. <code>((</code><var>files</var><code>,</code><var>options</var><code>),</code><var>environs</var><code>)</code>. The fields have
  39. these interpretations.
  40. <dl>
  41. <dt><var>files</var><dd>is a list of quadruples
  42. <code>((</code><var>date</var><code>,</code><var>path</var><code>),(</code><var>preamble</var><code>,</code><var>contents</var><code>))</code>, with
  43. one quadruple for each input file named on the command line (but not the
  44. virtual code file or the <code>avram</code> executable). The list will be in
  45. the same order as the filenames on the command line, and is not affected
  46. by options interspersed with them. The fields in each item have the
  47. following interpretations.
  48. <dl>
  49. <dt><var>date</var><dd>is the time stamp of the file in as a character string in the usual
  50. <a name="index-time-stamp-204"></a><a name="index-date-205"></a><a name="index-system-time-206"></a><a name="index-current-time-207"></a><a name="index-Unix-208"></a>Unix format, for example, <code>Fri Jan 19 14:34:44 GMT 2001</code>. If the
  51. file corresponds to standard input, the current system time and date are
  52. used.
  53. <br><dt><var>path</var><dd>is the full path of the file, expressed as a list of strings. If the
  54. <a name="index-file-names-209"></a><a name="index-paths-210"></a><a name="index-absolute-path-211"></a><a name="index-relative-path-212"></a>file corresponds to standard input, the list is empty. Otherwise, the
  55. first string in the list is the file name. The next is the name of the
  56. file's parent directory, if any. The next is the parent of the parent,
  57. and so on. The root directory is indicated by the empty string, so that
  58. any path ending with the empty string is an absolute path, while any path
  59. ending with a non-empty string is relative to the current working
  60. directory. Path separators (i.e., slashes) are omitted.
  61. <br><dt><var>preamble</var><dd>In the case of a text file, or any file not conforming to the format in
  62. <a name="index-preamble-213"></a><a href="File-Format.html#File-Format">File Format</a>, this field is <code>nil</code>. Otherwise, this field contains
  63. the preamble of the file expressed as a list of strings, or contains
  64. just the empty string if the file has no preamble. Any leading hashes in
  65. the preamble of the file are stripped.
  66. <br><dt><var>contents</var><dd>In the case of a text file (as indicated by the <var>preamble</var> field), this
  67. <a name="index-text-files-214"></a>field will contain a list of character strings, with each line of the file
  68. contained in a character string. Otherwise, it can contain data in any
  69. format, which are obtained by converting the data section of the file
  70. to a tree.
  71. </dl>
  72. <br><dt><var>options</var><dd>is a list of quadruples of the form
  73. <code>((</code><var>position</var><code>,</code><var>longform</var><code>),(</code><var>keyword</var><code>,</code><var>params</var><code>))</code>
  74. with one quadruple for each option appearing on the command line after
  75. the name of the virtual code file.
  76. <dl>
  77. <dt><var>position</var><dd>is a natural number indicating the position of the option on the command
  78. <a name="index-naturals-215"></a><a name="index-command-line-216"></a>line. The position numbers of all the options will form an ascending
  79. sequence, but not necessarily consecutive nor starting with zero. The
  80. missing numbers in the sequence will correspond to the positions of the
  81. file names on the command line, allowing their positions to be inferred by
  82. applications for which the position matters.
  83. <br><dt><var>longform</var><dd>is a boolean value which is true if the option starts with two or more
  84. <a name="index-booleans-217"></a>dashes but false otherwise.
  85. <br><dt><var>keyword</var><dd>is the key word of the option expressed as a character string. For example
  86. in the case of a command line option <kbd>--foo=bar,baz</kbd>, the keyword is
  87. <code>foo</code>. Leading dashes are stripped.
  88. <br><dt><var>params</var><dd>is a list of character strings identifying the parameters for the
  89. command line option in question. In the case of an option of the form
  90. <kbd>--foo=bar,baz</kbd>, the first character string in the list will be
  91. <code>bar</code> and the next will be <code>baz</code>. The same applies if the
  92. option is written <kbd>--foo bar,baz</kbd> or <kbd>--foo =bar,baz</kbd>. If there
  93. are no parameters associated with the option, the list is empty.
  94. </dl>
  95. <br><dt><var>environs</var><dd>is a list of pairs of character strings, with one pair in the list for
  96. <a name="index-environment-218"></a>each environment variable. The identifier is the left string in the
  97. pair, and the value is the right. For example, if the environment
  98. contains the definition <code>OSTYPE=linux-gnu</code>, there will be a pair in
  99. the list whose left side is the string <code>OSTYPE</code> and whose
  100. right side is the string <code>linux-gnu</code>.
  101. </dl>
  102. </body></html>