Raw-Files.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
  2. <html>
  3. <!-- Created on November 8, 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.3.2 Raw Files</title>
  14. <meta name="description" content="avram - a virtual machine code interpreter: 3.3.2 Raw Files">
  15. <meta name="keywords" content="avram - a virtual machine code interpreter: 3.3.2 Raw Files">
  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="Raw-Files"></a>
  40. <table cellpadding="1" cellspacing="1" border="0">
  41. <tr><td valign="middle" align="left">[<a href="File-Names.html#File-Names" title="Previous section in reading order"> &lt; </a>]</td>
  42. <td valign="middle" align="left">[<a href="Formatted-Input.html#Formatted-Input" 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="File-Manipulation.html#File-Manipulation" 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="Raw-Files-1"></a>
  58. <h3 class="subsection">3.3.2 Raw Files</h3>
  59. <p>Some low level operations involving lists and data files are provided by
  60. these functions, which are declared in the header file &lsquo;<tt>rawio.h</tt>&rsquo;.
  61. </p>
  62. <dl>
  63. <dt><a name="index-avm_005freceived_005flist"></a><u>Function:</u> list <b>avm_received_list</b><i> (FILE *<var>object</var>, char *<var>filename</var>)</i></dt>
  64. <dd><p>This function is a convenient way of transferring data directly from a
  65. raw format file into a list in memory. It might typically be used to
  66. load the virtual code for an application that has been written to a file
  67. by a compiler.
  68. </p>
  69. <dl compact="compact">
  70. <dt> <code><var>object</var></code></dt>
  71. <dd><p>is the address of a file which should
  72. already be open for reading before this function is called, and will be
  73. read from its current position.
  74. </p></dd>
  75. <dt> <code><var>filename</var></code></dt>
  76. <dd><p>should be set by the caller to the address of a null terminated string
  77. containing the name of the file, but is not used unless it needs to be
  78. printed as part of an error message. If it is a null pointer, standard
  79. input is assumed.
  80. </p></dd>
  81. </dl>
  82. <p>The result returned is a list containing data read from the file.
  83. </p>
  84. <p>The file format is described in <a href="File-Format.html#File-Format">File Format</a>. The preamble section
  85. of the file, if any, is ignored. If the file ends prematurely or
  86. otherwise conflicts with the format, the program is aborted with a
  87. message of
  88. <a name="index-invalid-raw-file-format-1"></a>
  89. </p>
  90. <table><tr><td>&nbsp;</td><td><pre class="display"><code><var>program-name</var>: invalid raw file format in <var>filename</var></code>
  91. </pre></td></tr></table>
  92. <p>written to standard error. The program will also be aborted by this
  93. function in the event of a memory overflow.
  94. </p>
  95. <p>The file is left open when this function returns, and could therefore be
  96. used to store other data after the end of the list. The end of a list is
  97. detected automatically by this function, and it reads no further,
  98. leaving the file position on the next character, if any.
  99. </p></dd></dl>
  100. <dl>
  101. <dt><a name="index-avm_005fsend_005flist"></a><u>Function:</u> void <b>avm_send_list</b><i> (FILE *<var>repository</var>, list <var>operand</var>, char *<var>filename</var>)</i></dt>
  102. <dd><p>This function can be used to transfer data from a list in memory to a
  103. file, essentially by implementing the printing algorithm described in
  104. <a href="Bit-String-Encoding.html#Bit-String-Encoding">Bit String Encoding</a>.
  105. </p>
  106. <dl compact="compact">
  107. <dt> <code><var>repository</var></code></dt>
  108. <dd><p>is the address of a file already open for writing, to which the data are
  109. written starting from the current position.
  110. </p></dd>
  111. <dt> <code><var>operand</var></code></dt>
  112. <dd><p>is the list containing the data to be written
  113. </p></dd>
  114. <dt> <code><var>filename</var></code> </dt>
  115. <dd><p>is the address of a null terminated string containing the name of the
  116. file that will be reported in an error message if necessary.
  117. </p></dd>
  118. </dl>
  119. <p>No preamble section is written by this function, but one could be
  120. <a name="index-preamble-5"></a>
  121. written to the file by the caller prior to calling it. Error messages
  122. are possible either because of i/o errors or because of insufficient
  123. memory. I/o errors are not fatal and will result only in a warning
  124. message being printed to standard error, but a memory overflow will
  125. cause the process to abort. An i/o error message reported by this
  126. function would be of the form
  127. <a name="index-can_0027t-write-1"></a>
  128. </p>
  129. <table><tr><td>&nbsp;</td><td><pre class="display"><code><var>program-name</var>: can't write to <var>filename</var></code>
  130. </pre></td></tr></table>
  131. <p>followed by the diagnostic obtained from the standard <code>strerror</code>
  132. <a name="index-strerror-1"></a>
  133. function if it exists on the host platform. The file is left open when
  134. this function returns.
  135. </p></dd></dl>
  136. <dl>
  137. <dt><a name="index-avm_005finitialize_005frawio"></a><u>Function:</u> void <b>avm_initialize_rawio</b><i> ()</i></dt>
  138. <dd><p>This function initializes some necessary data structures for the
  139. functions in this section, and should be called prior to them at the
  140. beginning of a run.
  141. </p></dd></dl>
  142. <dl>
  143. <dt><a name="index-avm_005fcount_005frawio"></a><u>Function:</u> void <b>avm_count_rawio</b><i> ()</i></dt>
  144. <dd><p>This function does nothing in the present version of the library, but
  145. should be called after the last call to all of the other functions in
  146. this section in order to maintain compatibility with future versions of
  147. the library. Future versions may decide to use this function to do some
  148. cleaning up of local data structures.
  149. </p></dd></dl>
  150. <hr size="1">
  151. <table cellpadding="1" cellspacing="1" border="0">
  152. <tr><td valign="middle" align="left">[<a href="File-Names.html#File-Names" title="Previous section in reading order"> &lt; </a>]</td>
  153. <td valign="middle" align="left">[<a href="Formatted-Input.html#Formatted-Input" title="Next section in reading order"> &gt; </a>]</td>
  154. <td valign="middle" align="left"> &nbsp; </td>
  155. <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
  156. <td valign="middle" align="left">[<a href="File-Manipulation.html#File-Manipulation" title="Up section"> Up </a>]</td>
  157. <td valign="middle" align="left">[<a href="Character-Table.html#Character-Table" title="Next chapter"> &gt;&gt; </a>]</td>
  158. <td valign="middle" align="left"> &nbsp; </td>
  159. <td valign="middle" align="left"> &nbsp; </td>
  160. <td valign="middle" align="left"> &nbsp; </td>
  161. <td valign="middle" align="left"> &nbsp; </td>
  162. <td valign="middle" align="left">[<a href="avram.html#Top" title="Cover (top) of document">Top</a>]</td>
  163. <td valign="middle" align="left">[<a href="avram_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
  164. <td valign="middle" align="left">[<a href="Function-Index.html#Function-Index" title="Index">Index</a>]</td>
  165. <td valign="middle" align="left">[<a href="avram_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
  166. </tr></table>
  167. <p>
  168. <font size="-1">
  169. This document was generated on <i>November 8, 2012</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>.
  170. </font>
  171. <br>
  172. </p>
  173. </body>
  174. </html>