comedilib/doc/error_funcref.txt
Bernd Porr 0d8c6e9661 Comedilib.pdf can now be generated with
dblatex -t pdf ./comedilib.xml

There were two major issues in the comedilb.xml:
1) there were too many nested sections so that
   latex ran out of sub-sub-sub-sub-sections.
2) A section needs a title and can no longer
   exist without one. The first line
   of the textfiles contains now the title
   and will be inserted by mkref into the xml file.

todo: switch from xmlto to dblatex for the pdf generation
and re-enable it in the makefile.
2012-04-23 00:23:03 +01:00

130 lines
4.5 KiB
Text

Error reporting
Function: comedi_errno -- number of last Comedilib error
Retval: int
Param: void
Description:
When a Comedilib function fails, it usually returns -1 or
NULL, depending on the return type. An internal library
variable stores an error number, which can be retrieved with
comedi_errno(). This error number can be converted to a
human-readable form by the functions
<link linkend="func-ref-comedi-perror"><function>comedi_perror</function></link>
and
<link linkend="func-ref-comedi-strerror"><function>comedi_strerror</function></link>
.
These functions are intended to mimic the behavior of the
standard C library functions perror(), strerror(), and errno.
In particular, Comedilib functions sometimes return an error
that is generated inside the C library; the comedi error
message in this case is the same as the C library.
The function comedi_errno() returns an integer describing
the most recent comedilib error. This integer may be used
as the errnum parameter for comedi_strerror().
Function: comedi_loglevel -- change Comedilib logging properties
Retval: int
Param: int loglevel
Description:
This function affects the output of debugging and error messages
from Comedilib. By increasing the loglevel, additional debugging
information will be printed. Error and debugging messages are
printed to the stream stderr.
The default loglevel can be set by using the environment variable
COMEDI_LOGLEVEL. The default loglevel is 1.
In order to conserve resources, some debugging information is
disabled by default when Comedilib is compiled.
The meaning of the loglevels is as follows:
<table frame="box" rules="all">
<tr>
<th>Loglevel</th>
<th>Behavior</th>
</tr>
<tr>
<td>0</td>
<td>Comedilib prints nothing.</td>
</tr>
<tr>
<td>1</td>
<td>
(default) Comedilib prints error messages when
there is a self-consistency error (i.e., an internal bug.)
</td>
</tr>
<tr>
<td>2</td>
<td>
Comedilib prints an error message when an invalid
parameter is passed.
</td>
</tr>
<tr>
<td>3</td>
<td>
Comedilib prints an error message whenever an
error is generated in the Comedilib library or in the C library,
when called by Comedilib.
</td>
</tr>
<tr>
<td>4</td>
<td>Comedilib prints a lot of junk.</td>
</tr>
</table>
Returns:
This function returns the previous loglevel.
Function: comedi_perror -- print a Comedilib error message
Retval: void
Param: const char * s
Description:
When a Comedilib function fails, it usually returns -1 or
NULL, depending on the return type. An internal library
variable stores an error number, which can be retrieved with
<link linkend="func-ref-comedi-errno"><function>comedi_errno</function></link>
. This error number can be converted to a
human-readable form by the functions
comedi_perror() or
<link linkend="func-ref-comedi-strerror"><function>comedi_strerror</function></link>
.
These functions are intended to mimic the behavior of the
standard C library functions perror(), strerror(), and errno.
In particular, Comedilib functions sometimes return an error
that is generated inside the C library; the comedi error
message in this case is the same as the C library.
The function comedi_perror() prints an error message to stderr.
The error message consists of the argument string, a colon, a
space, a description of the error condition, and a new line.
Function: comedi_strerror -- return string describing Comedilib error code
Retval: const char *
Param: int errnum
Description:
When a Comedilib function fails, it usually returns -1 or
NULL, depending on the return type. An internal library
variable stores an error number, which can be retrieved with
comedi_errno(). This error number can be converted to a
human-readable form by the functions
<link linkend="func-ref-comedi-perror"><function>comedi_perror</function></link>
or comedi_strerror().
These functions are intended to mimic the behavior of the
standard C library functions perror(), strerror(), and errno.
In particular, Comedilib functions sometimes return an error
that is generated inside the C library; the comedi error
message in this case is the same as the C library.
The function comedi_strerror() returns a pointer to a
character string
describing the Comedilib error <parameter>errnum</parameter>.
The returned string may be
modified by a subsequent call to a strerr or perror function
(either the libc or Comedilib versions).
An unrecognized error number will
return a pointer to the string "undefined error", or similar.