3 * $Id: err.h,v 1.2 2002/02/02 19:16:46 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.
36 /*----- Header files ------------------------------------------------------*/
44 /*----- Error codes -------------------------------------------------------*/
46 /* --- Abort codes --- *
48 * Only for the most serious errors, pertaining to the log file.
51 #define ERRABORT_LOGOPEN 1u /* Log file wouldn't open */
52 #define ERRABORT_LOGWRITE 2u /* Couldn't write to log file */
54 /* --- Error contexts and reason codes --- *
56 * Most errors are reported as a group of three numeric codes. These are, in
59 * * the `context' code, which describes where whatever it was went wrong
62 * * the `reason' code (specific to a particular context), which describes
63 * what the program was trying to do at the time; and
65 * * the `error' code (again specific to a particular context, but usually
66 * an @errno@ error code), which explains what the problem actually was.
69 #define ERR_EXC 1u /* mLib exception error code */
70 /* Reason code is zero; error code is exception number */
72 #define ERR_RXGLUE 2u /* REXX interface stuff */
73 # define ERRRX_SCRIPTREAD 1u /* Problem reading script file */
74 # define ERRRX_INTERP 2u /* Error code from interpreter */
75 # define ERRRX_INIT 3u /* Initialization error */
77 #define ERR_RXERR 3u /* REXX error */
78 /* Reason code is line number; error code is REXX error number */
80 #define ERR_TXPORT 4u /* Transport switch stuff */
81 # define ERRTX_BADTX 1u /* Unknown transport name */
82 # define ERRTX_CREATE 2u /* Error creating transport */
83 # define ERRTX_WRITE 3u /* Error writing to transport */
84 # define ERRTX_READ 4u /* Read error from transport */
85 # define ERRTX_CONFIG 5u /* Error in configuration */
87 #define ERR_AUDIO 5u /* Audio subsystem */
88 # define ERRAU_NOTFOUND 1u /* Requested sample wasn't found */
89 # define ERRAU_OPEN 2u /* Couldn't read sample file */
90 # define ERRAU_INIT 3u /* Couldn't initialize audio */
92 /*----- Functions provided ------------------------------------------------*/
94 /* --- @err_abort@ --- *
96 * Arguments: @int reason@ = abort reason code
97 * @unsigned long err@ = abort error code
98 * @const char *msg@ = error message
102 * Use: Reports a fatal error.
105 extern void err_abortv(int /*reason*/, unsigned long /*err*/,
106 const char */*msg*/, va_list */*ap*/);
108 extern void err_abort(int /*reason*/, unsigned long /*err*/,
109 const char */*msg*/, ...);
111 /* --- @err_init@ --- *
117 * Use: Attempts to initialize the logging system. It is a
118 * catastrophic failure if logging can't start up.
121 extern void err_init(void);
123 /* --- @err_report@ --- *
125 * Arguments: @int ctx@ = context code
126 * @int reason@ = reason code
127 * @unsigned long err@ = system error code
128 * @const char *msg@ = textual message to log
132 * Use: Reports an error. Doesn't abort anything unless something
133 * really serious happens.
136 extern void err_reportv(int /*ctx*/, int /*reason*/, unsigned long /*err*/,
137 const char */*msg*/, va_list */*ap*/);
139 extern void err_report(int /*ctx*/, int /*reason*/, unsigned long /*err*/,
140 const char */*msg*/, ...);
142 /* --- @err_log@ --- *
144 * Arguments: @const char *msg@ = textual message to log
148 * Use: Logs a message.
151 extern void err_logv(const char */*msg*/, va_list */*ap*/);
153 extern void err_log(const char */*msg*/, ...);
155 /*----- That's all, folks -------------------------------------------------*/