3 * $Id: err.h,v 1.1 2002/01/25 19:34:45 mdw Exp $
7 * (c) 2001 Mark Wooding
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Jog: Programming for a jogging machine.
14 * Jog is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * Jog is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with Jog; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /*----- Revision history --------------------------------------------------*
32 * Revision 1.1 2002/01/25 19:34:45 mdw
44 /*----- Header files ------------------------------------------------------*/
52 /*----- Error codes -------------------------------------------------------*/
54 /* --- Abort codes --- *
56 * Only for the most serious errors, pertaining to the log file.
59 #define ERRABORT_LOGOPEN 1u /* Log file wouldn't open */
60 #define ERRABORT_LOGWRITE 2u /* Couldn't write to log file */
62 /* --- Error contexts and reason codes --- *
64 * Most errors are reported as a group of three numeric codes. These are, in
67 * * the `context' code, which describes where whatever it was went wrong
70 * * the `reason' code (specific to a particular context), which describes
71 * what the program was trying to do at the time; and
73 * * the `error' code (again specific to a particular context, but usually
74 * an @errno@ error code), which explains what the problem actually was.
77 #define ERR_EXC 1u /* mLib exception error code */
78 /* Reason code is zero; error code is exception number */
80 #define ERR_RXGLUE 2u /* REXX interface stuff */
81 # define ERRRX_SCRIPTREAD 1u /* Problem reading script file */
82 # define ERRRX_INTERP 2u /* Error code from interpreter */
83 # define ERRRX_INIT 3u /* Initialization error */
85 #define ERR_RXERR 3u /* REXX error */
86 /* Reason code is line number; error code is REXX error number */
88 #define ERR_TXPORT 4u /* Transport switch stuff */
89 # define ERRTX_BADTX 1u /* Unknown transport name */
90 # define ERRTX_CREATE 2u /* Error creating transport */
91 # define ERRTX_WRITE 3u /* Error writing to transport */
92 # define ERRTX_READ 4u /* Read error from transport */
93 # define ERRTX_CONFIG 5u /* Error in configuration */
95 /*----- Functions provided ------------------------------------------------*/
97 /* --- @err_abort@ --- *
99 * Arguments: @int reason@ = abort reason code
100 * @unsigned long err@ = abort error code
101 * @const char *msg@ = error message
105 * Use: Reports a fatal error.
108 extern void err_abortv(int /*reason*/, unsigned long /*err*/,
109 const char */
*msg*/
, va_list */
*ap*/
);
111 extern void err_abort(int /*reason*/, unsigned long /*err*/,
112 const char */
*msg*/
, ...);
114 /* --- @err_init@ --- *
120 * Use: Attempts to initialize the logging system. It is a
121 * catastrophic failure if logging can't start up.
124 extern void err_init(void);
126 /* --- @err_report@ --- *
128 * Arguments: @int ctx@ = context code
129 * @int reason@ = reason code
130 * @unsigned long err@ = system error code
131 * @const char *msg@ = textual message to log
135 * Use: Reports an error. Doesn't abort anything unless something
136 * really serious happens.
139 extern void err_reportv(int /*ctx*/, int /*reason*/, unsigned long /*err*/,
140 const char */
*msg*/
, va_list */
*ap*/
);
142 extern void err_report(int /*ctx*/, int /*reason*/, unsigned long /*err*/,
143 const char */
*msg*/
, ...);
145 /* --- @err_log@ --- *
147 * Arguments: @const char *msg@ = textual message to log
151 * Use: Logs a message.
154 extern void err_logv(const char */
*msg*/
, va_list */
*ap*/
);
156 extern void err_log(const char */
*msg*/
, ...);
158 /*----- That's all, folks -------------------------------------------------*/