Main Page | Modules | Class List | Directories | 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,
00232                         const char *message );
00233 
00234 
00235 
00253 typedef enum { GAN_ERR_TRACE_OFF, GAN_ERR_TRACE_ON } Gan_TraceMode;
00254 
00255 
00256 Gan_ErrorReporterFunc
00257           gan_err_set_reporter(Gan_ErrorReporterFunc app_error_reporter);
00258 Gan_ErrorReporterFunc gan_err_get_reporter( void );
00259 void gan_err_report( void );
00260 int gan_err_register_fileline(
00261                  const char * func_name,
00262                  int          err_code,
00263                  const char * file_name, /* Typically use __FILE__ */
00264                  int          line_number, /* Typically use __LINE__ */
00265                  const char * message);
00266 void gan_err_set_trace( Gan_TraceMode trace_mode );
00267 void gan_err_flush_trace(void);
00268 int gan_err_get_error_count(void);
00269 int gan_err_get_error ( int           n,
00270                         const char ** func_name,
00271                         int         * err_code,
00272                         const char ** file_name,
00273                         int         * line_number,
00274                         const char ** message );
00275 
00276 /* error test macros compiled out when NDEBUG is defined */
00277 
00291 Gan_Bool gan_err_test_bool ( Gan_Bool test, char *funcname,
00292                              int code, char *message );
00293 
00308 int gan_err_test_int ( Gan_Bool test, char *funcname,
00309                        int code, char *message );
00310 
00325 int gan_err_test_uint ( Gan_Bool test, char *funcname,
00326                         int code, char *message );
00327 
00328 
00343 void *gan_err_test_ptr ( Gan_Bool test, char *funcname,
00344                          int code, char *message );
00345 
00360 double gan_err_test_double ( Gan_Bool test, char *funcname,
00361                              int code, char *message );
00362 
00377 float gan_err_test_float ( Gan_Bool test, char *funcname,
00378                            int code, char *message );
00379 
00388 #ifdef __cplusplus
00389 }
00390 #endif
00391 
00392 #endif /* #ifndef _GAN_ERR_H */

Generated on Sat May 21 23:52:47 2005 by  doxygen 1.4.3