00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GSL_ERRNO_H__
00021 #define __GSL_ERRNO_H__
00022
00023 #include <stdio.h>
00024 #include <errno.h>
00025 #include "biu/qrng/gsl_types.h"
00026
00027 #undef __BEGIN_DECLS
00028 #undef __END_DECLS
00029 #ifdef __cplusplus
00030 # define __BEGIN_DECLS extern "C" {
00031 # define __END_DECLS }
00032 #else
00033 # define __BEGIN_DECLS
00034 # define __END_DECLS
00035 #endif
00036
00037 __BEGIN_DECLS
00038
00039 enum {
00040 GSL_SUCCESS = 0,
00041 GSL_FAILURE = -1,
00042 GSL_CONTINUE = -2,
00043 GSL_EDOM = 1,
00044 GSL_ERANGE = 2,
00045 GSL_EFAULT = 3,
00046 GSL_EINVAL = 4,
00047 GSL_EFAILED = 5,
00048 GSL_EFACTOR = 6,
00049 GSL_ESANITY = 7,
00050 GSL_ENOMEM = 8,
00051 GSL_EBADFUNC = 9,
00052 GSL_ERUNAWAY = 10,
00053 GSL_EMAXITER = 11,
00054 GSL_EZERODIV = 12,
00055 GSL_EBADTOL = 13,
00056 GSL_ETOL = 14,
00057 GSL_EUNDRFLW = 15,
00058 GSL_EOVRFLW = 16,
00059 GSL_ELOSS = 17,
00060 GSL_EROUND = 18,
00061 GSL_EBADLEN = 19,
00062 GSL_ENOTSQR = 20,
00063 GSL_ESING = 21,
00064 GSL_EDIVERGE = 22,
00065 GSL_EUNSUP = 23,
00066 GSL_EUNIMPL = 24,
00067 GSL_ECACHE = 25,
00068 GSL_ETABLE = 26,
00069 GSL_ENOPROG = 27,
00070 GSL_ENOPROGJ = 28,
00071 GSL_ETOLF = 29,
00072 GSL_ETOLX = 30,
00073 GSL_ETOLG = 31,
00074 GSL_EOF = 32
00075 } ;
00076
00077 void gsl_error (const char * reason, const char * file, int line,
00078 int gsl_errno);
00079
00080 void gsl_stream_printf (const char *label, const char *file,
00081 int line, const char *reason);
00082
00083 const char * gsl_strerror (const int gsl_errno);
00084
00085 typedef void gsl_error_handler_t (const char * reason, const char * file,
00086 int line, int gsl_errno);
00087
00088 typedef void gsl_stream_handler_t (const char * label, const char * file,
00089 int line, const char * reason);
00090
00091 gsl_error_handler_t *
00092 gsl_set_error_handler (gsl_error_handler_t * new_handler);
00093
00094 gsl_error_handler_t *
00095 gsl_set_error_handler_off (void);
00096
00097 gsl_stream_handler_t *
00098 gsl_set_stream_handler (gsl_stream_handler_t * new_handler);
00099
00100 FILE * gsl_set_stream (FILE * new_stream);
00101
00102
00103
00104 #define GSL_ERROR(reason, gsl_errno) \
00105 do { \
00106 gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
00107 return gsl_errno ; \
00108 } while (0)
00109
00110
00111
00112 #define GSL_ERROR_VAL(reason, gsl_errno, value) \
00113 do { \
00114 gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
00115 return value ; \
00116 } while (0)
00117
00118
00119
00120
00121 #define GSL_ERROR_VOID(reason, gsl_errno) \
00122 do { \
00123 gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
00124 return ; \
00125 } while (0)
00126
00127
00128
00129 #define GSL_ERROR_NULL(reason, gsl_errno) GSL_ERROR_VAL(reason, gsl_errno, 0)
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 #define GSL_ERROR_SELECT_2(a,b) ((a) != GSL_SUCCESS ? (a) : ((b) != GSL_SUCCESS ? (b) : GSL_SUCCESS))
00146 #define GSL_ERROR_SELECT_3(a,b,c) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_2(b,c))
00147 #define GSL_ERROR_SELECT_4(a,b,c,d) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_3(b,c,d))
00148 #define GSL_ERROR_SELECT_5(a,b,c,d,e) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_4(b,c,d,e))
00149
00150 #define GSL_STATUS_UPDATE(sp, s) do { if ((s) != GSL_SUCCESS) *(sp) = (s);} while(0)
00151
00152 __END_DECLS
00153
00154 #endif