File indexing completed on 2025-01-18 10:00:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef __GSL_ERRNO_H__
0021 #define __GSL_ERRNO_H__
0022
0023 #include <stdio.h>
0024 #include <errno.h>
0025 #include <gsl/gsl_types.h>
0026
0027 #undef __BEGIN_DECLS
0028 #undef __END_DECLS
0029 #ifdef __cplusplus
0030 # define __BEGIN_DECLS extern "C" {
0031 # define __END_DECLS }
0032 #else
0033 # define __BEGIN_DECLS
0034 # define __END_DECLS
0035 #endif
0036
0037 __BEGIN_DECLS
0038
0039 enum {
0040 GSL_SUCCESS = 0,
0041 GSL_FAILURE = -1,
0042 GSL_CONTINUE = -2,
0043 GSL_EDOM = 1,
0044 GSL_ERANGE = 2,
0045 GSL_EFAULT = 3,
0046 GSL_EINVAL = 4,
0047 GSL_EFAILED = 5,
0048 GSL_EFACTOR = 6,
0049 GSL_ESANITY = 7,
0050 GSL_ENOMEM = 8,
0051 GSL_EBADFUNC = 9,
0052 GSL_ERUNAWAY = 10,
0053 GSL_EMAXITER = 11,
0054 GSL_EZERODIV = 12,
0055 GSL_EBADTOL = 13,
0056 GSL_ETOL = 14,
0057 GSL_EUNDRFLW = 15,
0058 GSL_EOVRFLW = 16,
0059 GSL_ELOSS = 17,
0060 GSL_EROUND = 18,
0061 GSL_EBADLEN = 19,
0062 GSL_ENOTSQR = 20,
0063 GSL_ESING = 21,
0064 GSL_EDIVERGE = 22,
0065 GSL_EUNSUP = 23,
0066 GSL_EUNIMPL = 24,
0067 GSL_ECACHE = 25,
0068 GSL_ETABLE = 26,
0069 GSL_ENOPROG = 27,
0070 GSL_ENOPROGJ = 28,
0071 GSL_ETOLF = 29,
0072 GSL_ETOLX = 30,
0073 GSL_ETOLG = 31,
0074 GSL_EOF = 32
0075 } ;
0076
0077 void gsl_error (const char * reason, const char * file, int line,
0078 int gsl_errno);
0079
0080 void gsl_stream_printf (const char *label, const char *file,
0081 int line, const char *reason);
0082
0083 const char * gsl_strerror (const int gsl_errno);
0084
0085 typedef void gsl_error_handler_t (const char * reason, const char * file,
0086 int line, int gsl_errno);
0087
0088 typedef void gsl_stream_handler_t (const char * label, const char * file,
0089 int line, const char * reason);
0090
0091 gsl_error_handler_t *
0092 gsl_set_error_handler (gsl_error_handler_t * new_handler);
0093
0094 gsl_error_handler_t *
0095 gsl_set_error_handler_off (void);
0096
0097 gsl_stream_handler_t *
0098 gsl_set_stream_handler (gsl_stream_handler_t * new_handler);
0099
0100 FILE * gsl_set_stream (FILE * new_stream);
0101
0102
0103
0104 #define GSL_ERROR(reason, gsl_errno) \
0105 do { \
0106 gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
0107 return gsl_errno ; \
0108 } while (0)
0109
0110
0111
0112 #define GSL_ERROR_VAL(reason, gsl_errno, value) \
0113 do { \
0114 gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
0115 return value ; \
0116 } while (0)
0117
0118
0119
0120
0121 #define GSL_ERROR_VOID(reason, gsl_errno) \
0122 do { \
0123 gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
0124 return ; \
0125 } while (0)
0126
0127
0128
0129 #define GSL_ERROR_NULL(reason, gsl_errno) GSL_ERROR_VAL(reason, gsl_errno, 0)
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145 #define GSL_ERROR_SELECT_2(a,b) ((a) != GSL_SUCCESS ? (a) : ((b) != GSL_SUCCESS ? (b) : GSL_SUCCESS))
0146 #define GSL_ERROR_SELECT_3(a,b,c) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_2(b,c))
0147 #define GSL_ERROR_SELECT_4(a,b,c,d) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_3(b,c,d))
0148 #define GSL_ERROR_SELECT_5(a,b,c,d,e) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_4(b,c,d,e))
0149
0150 #define GSL_STATUS_UPDATE(sp, s) do { if ((s) != GSL_SUCCESS) *(sp) = (s);} while(0)
0151
0152 __END_DECLS
0153
0154 #endif