1 /** D bindings for GSL.
2     Authors:    Chibisi Chima-Okereke
3     Copyright:  Copyright (c) 2016, Chibisi Chima-Okereke. All rights reserved.
4     License:    Boost License 1.0
5 */
6 
7 module gsl.errno;
8 import core.stdc.stdio : FILE;
9 
10 extern (C):
11 
12 enum GSL_SUCCESS  = 0; 
13 enum GSL_FAILURE  = -1;
14 enum GSL_CONTINUE = -2;  /* iteration has not converged */
15 enum GSL_EDOM     = 1;   /* input domain error; e.g sqrt(-1) */
16 enum GSL_ERANGE   = 2;   /* output range error; e.g. exp(1e100) */
17 enum GSL_EFAULT   = 3;   /* invalid pointer */
18 enum GSL_EINVAL   = 4;   /* invalid argument supplied by user */
19 enum GSL_EFAILED  = 5;   /* generic failure */
20 enum GSL_EFACTOR  = 6;   /* factorization failed */
21 enum GSL_ESANITY  = 7;   /* sanity check failed - shouldn't happen */
22 enum GSL_ENOMEM   = 8;   /* malloc failed */
23 enum GSL_EBADFUNC = 9;   /* problem with user-supplied function */
24 enum GSL_ERUNAWAY = 10;  /* iterative process is out of control */
25 enum GSL_EMAXITER = 11;  /* exceeded max number of iterations */
26 enum GSL_EZERODIV = 12;  /* tried to divide by zero */
27 enum GSL_EBADTOL  = 13;  /* user specified an invalid tolerance */
28 enum GSL_ETOL     = 14;  /* failed to reach the specified tolerance */
29 enum GSL_EUNDRFLW = 15;  /* underflow */
30 enum GSL_EOVRFLW  = 16;  /* overflow  */
31 enum GSL_ELOSS    = 17;  /* loss of accuracy */
32 enum GSL_EROUND   = 18;  /* failed because of roundoff error */
33 enum GSL_EBADLEN  = 19;  /* matrix, vector lengths are not conformant */
34 enum GSL_ENOTSQR  = 20;  /* matrix not square */
35 enum GSL_ESING    = 21;  /* apparent singularity detected */
36 enum GSL_EDIVERGE = 22;  /* integral or series is divergent */
37 enum GSL_EUNSUP   = 23;  /* requested feature is not supported by the hardware */
38 enum GSL_EUNIMPL  = 24;  /* requested feature not (yet) implemented */
39 enum GSL_ECACHE   = 25;  /* cache limit exceeded */
40 enum GSL_ETABLE   = 26;  /* table limit exceeded */
41 enum GSL_ENOPROG  = 27;  /* iteration is not making progress towards solution */
42 enum GSL_ENOPROGJ = 28;  /* jacobian evaluations are not improving the solution */
43 enum GSL_ETOLF    = 29;  /* cannot reach the specified tolerance in F */
44 enum GSL_ETOLX    = 30;  /* cannot reach the specified tolerance in X */
45 enum GSL_ETOLG    = 31;  /* cannot reach the specified tolerance in gradient */
46 enum GSL_EOF      = 32;   /* end of file */
47 
48 
49 void gsl_error (const(char)* reason, const(char)* file, int line, int gsl_errno);
50 
51 void gsl_stream_printf (const(char)* label, const(char)* file, int line, const(char)* reason);
52 
53 const(char)* gsl_strerror (const int gsl_errno);
54 
55 alias gsl_error_handler_t = void function(const(char)* reason, const(char)* file, int line, int gsl_errno);
56 alias gsl_stream_handler_t = void function(const(char)* label, const(char)* file, int line, const(char)* reason);
57 
58 gsl_error_handler_t* gsl_set_error_handler (gsl_error_handler_t* new_handler);
59 gsl_error_handler_t* gsl_set_error_handler_off();
60 gsl_stream_handler_t* gsl_set_stream_handler (gsl_stream_handler_t* new_handler);
61 
62 FILE* gsl_set_stream (FILE* new_stream);
63