/doc/avram.html/Error-Reporting.html
HTML | 173 lines | 141 code | 8 blank | 24 comment | 0 complexity | cf75998b8e98d8aebc808953f6324218 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
- <html>
- <!-- Created on December 10, 2012 by texi2html 1.82
- texi2html was written by:
- Lionel Cons <Lionel.Cons@cern.ch> (original author)
- Karl Berry <karl@freefriends.org>
- Olaf Bachmann <obachman@mathematik.uni-kl.de>
- and many others.
- Maintained by: Many creative people.
- Send bugs and suggestions to <texi2html-bug@nongnu.org>
- -->
- <head>
- <title>avram - a virtual machine code interpreter: 3.6 Error Reporting</title>
- <meta name="description" content="avram - a virtual machine code interpreter: 3.6 Error Reporting">
- <meta name="keywords" content="avram - a virtual machine code interpreter: 3.6 Error Reporting">
- <meta name="resource-type" content="document">
- <meta name="distribution" content="global">
- <meta name="Generator" content="texi2html 1.82">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <style type="text/css">
- <!--
- a.summary-letter {text-decoration: none}
- blockquote.smallquotation {font-size: smaller}
- pre.display {font-family: serif}
- pre.format {font-family: serif}
- pre.menu-comment {font-family: serif}
- pre.menu-preformatted {font-family: serif}
- pre.smalldisplay {font-family: serif; font-size: smaller}
- pre.smallexample {font-size: smaller}
- pre.smallformat {font-family: serif; font-size: smaller}
- pre.smalllisp {font-size: smaller}
- span.roman {font-family:serif; font-weight:normal;}
- span.sansserif {font-family:sans-serif; font-weight:normal;}
- ul.toc {list-style: none}
- -->
- </style>
- </head>
- <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
- <a name="Error-Reporting"></a>
- <table cellpadding="1" cellspacing="1" border="0">
- <tr><td valign="middle" align="left">[<a href="Version-Management.html#Version-Management" title="Previous section in reading order"> < </a>]</td>
- <td valign="middle" align="left">[<a href="Profiling.html#Profiling" title="Next section in reading order"> > </a>]</td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
- <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Up section"> Up </a>]</td>
- <td valign="middle" align="left">[<a href="Character-Table.html#Character-Table" title="Next chapter"> >> </a>]</td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left">[<a href="avram.html#Top" title="Cover (top) of document">Top</a>]</td>
- <td valign="middle" align="left">[<a href="avram_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
- <td valign="middle" align="left">[<a href="Function-Index.html#Function-Index" title="Index">Index</a>]</td>
- <td valign="middle" align="left">[<a href="avram_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
- </tr></table>
- <hr size="1">
- <a name="Error-Reporting-1"></a>
- <h2 class="section">3.6 Error Reporting</h2>
- <a name="index-error-messages-3"></a>
- <p>Most of the error reporting by other functions in the library is done by
- way of the functions declared in ‘<tt>error.h</tt>’. These function
- communicate directly with the user through standard error. Client
- programs should also use these functions where possible for the sake of
- a uniform interface.
- </p>
- <dl>
- <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>
- <dd><p>The argument to this function should be the address of a null terminated
- string holding the name of the program to be reported in error messages
- that begin with a program name. Typically this string will be the name
- of the program as it was invoked on the command line, possibly with path
- components stripped from it. An alternative would be to set it to the
- name of a virtual code application being evaluated. If this function is
- never called, the name <code>"avram"</code> is used by default. Space for a
- copy of the program name is allocated by this function, and a fatal
- memory overflow error is possible if there is insufficient space available.
- </p></dd></dl>
- <dl>
- <dt><a name="index-avm_005fprogram_005fname"></a><u>Function:</u> char* <b>avm_program_name</b><i> ()</i></dt>
- <dd><p>This function returns a pointer to a null terminated character string
- holding the program name presently in use. It will be either the name
- most recently set by <code>avm_set_program_name</code>, or the default name
- <code>"avram"</code> if none has been set. The string whose address is
- returned should not be modified by the caller.
- </p></dd></dl>
- <dl>
- <dt><a name="index-avm_005fwarning"></a><u>Function:</u> void <b>avm_warning</b><i> (char *<var>message</var>)</i></dt>
- <dd><p>This function writes the null terminated string whose address is given
- to standard error, prefaced by the program name and followed by a line
- break.
- </p></dd></dl>
- <dl>
- <dt><a name="index-avm_005ferror"></a><u>Function:</u> void <b>avm_error</b><i> (char *<var>message</var>)</i></dt>
- <dd><p>This function writes the null terminated string whose address is given
- to standard error, prefaced by the program name and followed by a line
- break, as <code>avm_warning</code>, but it then terminates the process with an
- exit code of 1.
- </p></dd></dl>
- <dl>
- <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>
- <dd><p>This function is useful for reporting errors caused in the course of
- reading or writing files. The message is written to standard error
- prefaced by the program name, and incorporating the name of the relevant
- file. The <code><var>reason</var></code> should be the error code obtained from the
- standard <code>errno</code> variable, which will be translated to an
- <a name="index-strerror-4"></a>
- informative message if possible by the standard <code>strerror</code> function
- and appended to the message. After the message is written, the process
- will terminate with an exit code of 1.
- </p></dd></dl>
- <dl>
- <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>
- <dd><p>This function does the same as <code>avm_fatal_io_error</code> except that it
- doesn’t exit the program, and allows control to return to the caller,
- which should take appropriate action.
- </p></dd></dl>
- <dl>
- <dt><a name="index-avm_005finternal_005ferror"></a><u>Function:</u> void <b>avm_internal_error</b><i> (int <var>code</var>)</i></dt>
- <dd><p>This function is used to report internal errors and halt the
- program. The error message is written to standard error prefaced by the
- program name and followed by a line break. The code should be a unique
- integer constant (i.e., not one that’s used for any other internal
- error), that will be printed as part of the error message as an aid to
- the maintainer.
- </p>
- <p>This function should be used by client programs only in the event of
- conditions that constitute some violation of a required invariant. It
- indicates to the user that something has gone wrong with the program,
- for which a bug report would be appropriate.
- </p></dd></dl>
- <dl>
- <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>
- <dd><p>This function is used only by the <code>avm_count</code> functions to report
- unreclaimed storage. The <code><var>count</var></code> is the number of units of
- storage left unreclaimed, and the <code><var>entity</var></code> is the address of
- a null terminated string describing the type of unreclaimed entity, such
- as <code>"lists"</code> or <code>"branches"</code>. The message is written to
- standard error followed by a line break, but the program is not halted
- and control returns to the caller.
- </p></dd></dl>
- <hr size="1">
- <table cellpadding="1" cellspacing="1" border="0">
- <tr><td valign="middle" align="left">[<a href="Version-Management.html#Version-Management" title="Previous section in reading order"> < </a>]</td>
- <td valign="middle" align="left">[<a href="Profiling.html#Profiling" title="Next section in reading order"> > </a>]</td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
- <td valign="middle" align="left">[<a href="Library-Reference.html#Library-Reference" title="Up section"> Up </a>]</td>
- <td valign="middle" align="left">[<a href="Character-Table.html#Character-Table" title="Next chapter"> >> </a>]</td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left">[<a href="avram.html#Top" title="Cover (top) of document">Top</a>]</td>
- <td valign="middle" align="left">[<a href="avram_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
- <td valign="middle" align="left">[<a href="Function-Index.html#Function-Index" title="Index">Index</a>]</td>
- <td valign="middle" align="left">[<a href="avram_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
- </tr></table>
- <p>
- <font size="-1">
- This document was generated on <i>December 10, 2012</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>.
- </font>
- <br>
- </p>
- </body>
- </html>