Main Page | Modules | Class List | File List | Class Members | File Members

gan_err.h

Go to the documentation of this file.
00001 
00150 /* This library is free software; you can redistribute it and/or
00151    modify it under the terms of the GNU Lesser General Public
00152    License as published by the Free Software Foundation; either
00153    version 2.1 of the License, or (at your option) any later version.
00154 
00155    This library is distributed in the hope that it will be useful,
00156    but WITHOUT ANY WARRANTY; without even the implied warranty of
00157    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00158    Lesser General Public License for more details.
00159 
00160    You should have received a copy of the GNU Lesser General Public
00161    License along with this library; if not, write to the Free Software
00162    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00163 */
00164 
00165 #ifndef _GAN_ERR_H
00166 #define _GAN_ERR_H
00167 
00168 #include <gandalf/common/misc_defs.h>
00169 
00170 #ifdef __cplusplus
00171 extern "C" {
00172 #endif
00173 
00189 typedef void (*Gan_ErrorReporterFunc)(void);
00190 
00191 
00196 #define GAN_ERR_DFL ((Gan_ErrorReporterFunc) 0) /* Set default error reporter*/
00197 #define GAN_ERR_IGN ((Gan_ErrorReporterFunc) 1) /* Ignore error reporting*/
00198 
00199 
00205 #define GAN_EC_OK    0
00206 #define GAN_EC_FAIL -1
00207 
00208 #define GAN_EC_BASE  0
00209 /*----------------------------------------------------------------------*/
00210 #define GAN_EC_DFT (GAN_EC_BASE+1000)        /* Default error codes */
00211 #define GAN_EC_DFT_DEEP_ERROR  (GAN_EC_DFT +  1) /* Error in exception module*/
00212 #define GAN_EC_DFT_SPARE       (GAN_EC_DFT +  2) /* Spare record -placeholder*/
00213 #define GAN_EC_DFT_BAD_N       (GAN_EC_DFT +  3) /* gan_err_get_error(), */
00214                                                 /* Index out of bounds*/
00215 #define GAN_EC_DFT_EMPTY       (GAN_EC_DFT +  4) /* Empty trace, */
00216                                                 /* gan_err_get_error(), */
00217 
00231  void gan_err_register ( const char *func_name, int err_code, const char *message );
00232 
00247  void gan_err_register_with_number ( const char *func_name, int err_code, const char *message, int number );
00248 
00249 
00250 
00268 typedef enum { GAN_ERR_TRACE_OFF, GAN_ERR_TRACE_ON } Gan_TraceMode;
00269 
00270 
00271  Gan_ErrorReporterFunc
00272           gan_err_set_reporter(Gan_ErrorReporterFunc app_error_reporter);
00273  Gan_ErrorReporterFunc gan_err_get_reporter( void );
00274  void gan_err_report( void );
00275  int gan_err_register_fileline(
00276                  const char * func_name,
00277                  int          err_code,
00278                  const char * file_name, /* Typically use __FILE__ */
00279                  int          line_number, /* Typically use __LINE__ */
00280                  const char * message,
00281                  int          number);
00282  void gan_err_set_trace( Gan_TraceMode trace_mode );
00283  void gan_err_flush_trace(void);
00284  int gan_err_get_error_count(void);
00285  int gan_err_get_error ( int           n,
00286                                     const char ** func_name,
00287                                     int         * err_code,
00288                                     const char ** file_name,
00289                                     int         * line_number,
00290                                     const char ** message,
00291                                     int         * number);
00292 
00293 /* error test macros compiled out when NDEBUG is defined */
00294 
00308  Gan_Bool gan_err_test_bool ( Gan_Bool test, char *funcname,
00309                              int code, char *message );
00310 
00325  int gan_err_test_int ( Gan_Bool test, char *funcname,
00326                        int code, char *message );
00327 
00342  int gan_err_test_uint ( Gan_Bool test, char *funcname,
00343                         int code, char *message );
00344 
00345 
00360  void *gan_err_test_ptr ( Gan_Bool test, char *funcname,
00361                          int code, char *message );
00362 
00377  double gan_err_test_double ( Gan_Bool test, char *funcname,
00378                              int code, char *message );
00379 
00394  float gan_err_test_float ( Gan_Bool test, char *funcname,
00395                            int code, char *message );
00396 
00405 #ifdef __cplusplus
00406 }
00407 #endif
00408 
00409 #endif /* #ifndef _GAN_ERR_H */

Generated on Fri Mar 17 12:44:47 2006 by  doxygen 1.3.9.1