PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/avram.html/Error-Reporting.html

https://github.com/gueststar/Avram
HTML | 173 lines | 141 code | 8 blank | 24 comment | 0 complexity | cf75998b8e98d8aebc808953f6324218 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
  2. <html>
  3. <!-- Created on December 10, 2012 by texi2html 1.82
  4. texi2html was written by:
  5. Lionel Cons <Lionel.Cons@cern.ch> (original author)
  6. Karl Berry <karl@freefriends.org>
  7. Olaf Bachmann <obachman@mathematik.uni-kl.de>
  8. and many others.
  9. Maintained by: Many creative people.
  10. Send bugs and suggestions to <texi2html-bug@nongnu.org>
  11. -->
  12. <head>
  13. <title>avram - a virtual machine code interpreter: 3.6 Error Reporting</title>
  14. <meta name="description" content="avram - a virtual machine code interpreter: 3.6 Error Reporting">
  15. <meta name="keywords" content="avram - a virtual machine code interpreter: 3.6 Error Reporting">
  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="Error-Reporting"></a>
  40. <table cellpadding="1" cellspacing="1" border="0">
  41. <tr><td valign="middle" align="left">[<a href="Version-Management.html#Version-Management" title="Previous section in reading order"> &lt; </a>]</td>
  42. <td valign="middle" align="left">[<a href="Profiling.html#Profiling" 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="Library-Reference.html#Library-Reference" 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="Error-Reporting-1"></a>
  58. <h2 class="section">3.6 Error Reporting</h2>
  59. <a name="index-error-messages-3"></a>
  60. <p>Most of the error reporting by other functions in the library is done by
  61. way of the functions declared in &lsquo;<tt>error.h</tt>&rsquo;. These function
  62. communicate directly with the user through standard error. Client
  63. programs should also use these functions where possible for the sake of
  64. a uniform interface.
  65. </p>
  66. <dl>
  67. <dt><a name="index-avm_005fset_005fprogram_005fname"></a><u>Function:</u> void <b>avm_set_program_name</b><i> (char *<var>argv0</var>)</i></dt>
  68. <dd><p>The argument to this function should be the address of a null terminated
  69. string holding the name of the program to be reported in error messages
  70. that begin with a program name. Typically this string will be the name
  71. of the program as it was invoked on the command line, possibly with path
  72. components stripped from it. An alternative would be to set it to the
  73. name of a virtual code application being evaluated. If this function is
  74. never called, the name <code>&quot;avram&quot;</code> is used by default. Space for a
  75. copy of the program name is allocated by this function, and a fatal
  76. memory overflow error is possible if there is insufficient space available.
  77. </p></dd></dl>
  78. <dl>
  79. <dt><a name="index-avm_005fprogram_005fname"></a><u>Function:</u> char* <b>avm_program_name</b><i> ()</i></dt>
  80. <dd><p>This function returns a pointer to a null terminated character string
  81. holding the program name presently in use. It will be either the name
  82. most recently set by <code>avm_set_program_name</code>, or the default name
  83. <code>&quot;avram&quot;</code> if none has been set. The string whose address is
  84. returned should not be modified by the caller.
  85. </p></dd></dl>
  86. <dl>
  87. <dt><a name="index-avm_005fwarning"></a><u>Function:</u> void <b>avm_warning</b><i> (char *<var>message</var>)</i></dt>
  88. <dd><p>This function writes the null terminated string whose address is given
  89. to standard error, prefaced by the program name and followed by a line
  90. break.
  91. </p></dd></dl>
  92. <dl>
  93. <dt><a name="index-avm_005ferror"></a><u>Function:</u> void <b>avm_error</b><i> (char *<var>message</var>)</i></dt>
  94. <dd><p>This function writes the null terminated string whose address is given
  95. to standard error, prefaced by the program name and followed by a line
  96. break, as <code>avm_warning</code>, but it then terminates the process with an
  97. exit code of 1.
  98. </p></dd></dl>
  99. <dl>
  100. <dt><a name="index-avm_005ffatal_005fio_005ferror"></a><u>Function:</u> void <b>avm_fatal_io_error</b><i> (char *<var>message</var>, char *<var>filename</var>, int <var>reason</var>)</i></dt>
  101. <dd><p>This function is useful for reporting errors caused in the course of
  102. reading or writing files. The message is written to standard error
  103. prefaced by the program name, and incorporating the name of the relevant
  104. file. The <code><var>reason</var></code> should be the error code obtained from the
  105. standard <code>errno</code> variable, which will be translated to an
  106. <a name="index-strerror-4"></a>
  107. informative message if possible by the standard <code>strerror</code> function
  108. and appended to the message. After the message is written, the process
  109. will terminate with an exit code of 1.
  110. </p></dd></dl>
  111. <dl>
  112. <dt><a name="index-avm_005fnon_005ffatal_005fio_005ferror"></a><u>Function:</u> void <b>avm_non_fatal_io_error</b><i> (char *<var>message</var>, char *<var>filename</var>, int <var>reason</var>)</i></dt>
  113. <dd><p>This function does the same as <code>avm_fatal_io_error</code> except that it
  114. doesn&rsquo;t exit the program, and allows control to return to the caller,
  115. which should take appropriate action.
  116. </p></dd></dl>
  117. <dl>
  118. <dt><a name="index-avm_005finternal_005ferror"></a><u>Function:</u> void <b>avm_internal_error</b><i> (int <var>code</var>)</i></dt>
  119. <dd><p>This function is used to report internal errors and halt the
  120. program. The error message is written to standard error prefaced by the
  121. program name and followed by a line break. The code should be a unique
  122. integer constant (i.e., not one that&rsquo;s used for any other internal
  123. error), that will be printed as part of the error message as an aid to
  124. the maintainer.
  125. </p>
  126. <p>This function should be used by client programs only in the event of
  127. conditions that constitute some violation of a required invariant. It
  128. indicates to the user that something has gone wrong with the program,
  129. for which a bug report would be appropriate.
  130. </p></dd></dl>
  131. <dl>
  132. <dt><a name="index-avm_005freclamation_005ffailure"></a><u>Function:</u> void <b>avm_reclamation_failure</b><i> (char *<var>entity</var>, counter <var>count</var>)</i></dt>
  133. <dd><p>This function is used only by the <code>avm_count</code> functions to report
  134. unreclaimed storage. The <code><var>count</var></code> is the number of units of
  135. storage left unreclaimed, and the <code><var>entity</var></code> is the address of
  136. a null terminated string describing the type of unreclaimed entity, such
  137. as <code>&quot;lists&quot;</code> or <code>&quot;branches&quot;</code>. The message is written to
  138. standard error followed by a line break, but the program is not halted
  139. and control returns to the caller.
  140. </p></dd></dl>
  141. <hr size="1">
  142. <table cellpadding="1" cellspacing="1" border="0">
  143. <tr><td valign="middle" align="left">[<a href="Version-Management.html#Version-Management" title="Previous section in reading order"> &lt; </a>]</td>
  144. <td valign="middle" align="left">[<a href="Profiling.html#Profiling" title="Next section in reading order"> &gt; </a>]</td>
  145. <td valign="middle" align="left"> &nbsp; </td>
  146. <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
  147. <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Up section"> Up </a>]</td>
  148. <td valign="middle" align="left">[<a href="Character-Table.html#Character-Table" title="Next chapter"> &gt;&gt; </a>]</td>
  149. <td valign="middle" align="left"> &nbsp; </td>
  150. <td valign="middle" align="left"> &nbsp; </td>
  151. <td valign="middle" align="left"> &nbsp; </td>
  152. <td valign="middle" align="left"> &nbsp; </td>
  153. <td valign="middle" align="left">[<a href="avram.html#Top" title="Cover (top) of document">Top</a>]</td>
  154. <td valign="middle" align="left">[<a href="avram_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
  155. <td valign="middle" align="left">[<a href="Function-Index.html#Function-Index" title="Index">Index</a>]</td>
  156. <td valign="middle" align="left">[<a href="avram_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
  157. </tr></table>
  158. <p>
  159. <font size="-1">
  160. This document was generated on <i>December 10, 2012</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>.
  161. </font>
  162. <br>
  163. </p>
  164. </body>
  165. </html>