LAL  7.5.0.1-8083555
XLALError.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007 Jolien Creighton, Kipp Cannon
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with with program; see the file COPYING. If not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19 
20 #ifndef XLALERROR_H
21 #define XLALERROR_H
22 
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <stdarg.h>
26 #include <stddef.h>
27 #include <lal/LALAtomicDatatypes.h>
28 #include <lal/LALString.h>
29 
30 #if defined(__cplusplus)
31 extern "C" {
32 #elif 0
33 } /* so that editors will match preceding brace */
34 #endif
35 
36 
37 /**
38  * \defgroup XLALError_h Header XLALError.h
39  * \ingroup lal_std
40  * \author Creighton, J. D. E.
41  * \date 2005
42  * \brief This header covers routines to provide the XLAL interface error
43  * handling.
44  *
45  * ### XLAL Errors ###
46  *
47  * When an XLAL routine fails, the routine should set the <tt>xlalErrno</tt> to
48  * an appropriate error number and return with the appropriate error code. The
49  * return value depends on the return type of the XLAL function. Furthermore,
50  * the XLAL error handler should be invoked.
51  *
52  * Whenever possible (i.e., always), standard XLAL error macros should be used
53  * when generating an error. These macros (i) invoke the current error handler,
54  * (ii) set the error code to the specified value, and (iii) return with the
55  * correct return value. In addition, these macros may take an optional
56  * printf-like format string (along with additional parameters for this format
57  * string) to provide additional information about the nature of the failure.
58  * The error macros that should be used are:
59  *
60  * <tt> #XLAL_ERROR(errnum [, fmt [, ...]])</tt> for XLAL routines returning an
61  * integer type.
62  *
63  * <tt> #XLAL_ERROR_VOID(errnum [, fmt [, ...]])</tt> for XLAL routines with no
64  * return value.
65  *
66  * <tt> #XLAL_ERROR_NULL(errnum [, fmt [, ...]])</tt> for XLAL routines returning
67  * a pointer.
68  *
69  * <tt> #XLAL_ERROR_REAL4(errnum [, fmt [, ...]])</tt> for XLAL routines
70  * returning a <tt>REAL4</tt> floating-point value.
71  *
72  * <tt> #XLAL_ERROR_REAL8(errnum [, fmt [, ...]])</tt> for XLAL routines
73  * returning a <tt>REAL8</tt> floating-point value.
74  *
75  * Assert-like error checking can be performed with <tt>#XLAL_CHECK</tt>-style
76  * macros. Unlike <tt>assert()</tt> statements, <tt>#XLAL_CHECK</tt> macros
77  * do <i>not</i> get removed when the code is compiled with <tt>-DNDEBUG</tt>.
78  *
79  * Additional error, warning, and informational messages can be generated using
80  * the routines <tt>XLALPrintError()</tt>, <tt>XLALPrintWarning()</tt> and
81  * <tt>XLALPrintInfo()</tt>. These routines (which work just like
82  * <tt>printf()</tt>) print or suppress the message depending on the value of
83  * <tt>lalDebugLevel</tt>. To print error/warning/info messages with a
84  * standard format, use the macros
85  * <tt>#XLAL_PRINT_ERROR(fmt [, ...])</tt>
86  * <tt>#XLAL_PRINT_WARNING(fmt [, ...])</tt>
87  * <tt>#XLAL_PRINT_INFO(fmt [, ...])</tt>
88  *
89  * On rare occations, you may be prepared for an XLAL routine to fail, and may
90  * want to handle the failure immediately. In these circumstances, the XLAL
91  * error handler needs to be disabled before the routine is called so that the
92  * failure can be caught. The <tt>#XLAL_TRY(statement,errnum)</tt> macro is
93  * designed to be used in these situations. Here is an example:
94  * \code
95  * REAL8 XLALLogFactorial(INT4 n)
96  * {
97  * REAL8 y;
98  * int errnum;
99  * XLAL_TRY(y = XLALGammaFunction(n + 1), errnum);
100  * if (XLAL_IS_REAL8_FAIL_NAN(y))
101  * switch (errnum) {
102  * case XLAL_ERANGE:
103  * y = n * (log(n) - 1);
104  * y += 0.5 * log(2.0 * LAL_PI * n);
105  * return y;
106  * default:
107  * XLALSetErrno(errnum);
108  * XLAL_ERROR_REAL8(XLAL_EFUNC);
109  * }
110  * return log(y);
111  * }
112  * \endcode
113  *
114  * ### XLAL Function Return Codes ###
115  *
116  * XLAL functions that return an integer-type will return <tt>#XLAL_FAILURE</tt>
117  * on failure. XLAL functions that return a pointer will return <tt>NULL</tt>
118  * on failure.
119  *
120  * The LAL specification requires that XLAL functions that return a
121  * floating-point type (either ::REAL4 or ::REAL8) should return
122  * a particular value to indicate an error. These values are given by the
123  * macros <tt>#XLAL_REAL4_FAIL_NAN</tt> and <tt>#XLAL_REAL8_FAIL_NAN</tt> (they
124  * are Not a Number or NaN values). To implement these we choose hexadecimal
125  * representations and then provide static functions that return the equivalent
126  * ::REAL4 or ::REAL8 values. The macros then invoke these
127  * functions. This is done so that the compiler can easily inline the
128  * functions (or eliminate them if they are not used). Conversion from the
129  * hexadecimal representation to the floating-point representation is done
130  * using a union.
131  *
132  * The LAL specification also requires that there be two macros,
133  * <tt>#XLAL_IS_REAL4_FAIL_NAN(val)</tt> and
134  * <tt>#XLAL_IS_REAL8_FAIL_NAN(val)</tt> that will test if val is one of these
135  * XLAL-specific fail NaNs. Again these macros invoke static functions that
136  * return the result of the comparison. The cmparison itself is done with the
137  * hexadecimal representation.
138  *
139  * ### XLAL Error Codes ###
140  *
141  * The LAL specification requires particular return code and error values.
142  * These are implemented here as enumeration constants in the
143  * ::XLALErrorValue enumeration.
144  */
145 /** @{ */
146 
147 
148 #ifndef SWIG /* exclude from SWIG interface */
149 
150 
151 /*
152  *
153  * Use these functions to print arbitrary messages as errors or warnings.
154  *
155  */
156 
157 /** Prints an error message if error printing is enabled by lalDebugLevel. */
158 int XLALPrintError(const char *fmt, ...) _LAL_GCC_PRINTF_FORMAT_(1,2);
159 
160 /** Prints a warning message if warning printing is enabled by lalDebugLevel. */
161 int XLALPrintWarning(const char *fmt, ...) _LAL_GCC_PRINTF_FORMAT_(1,2);
162 
163 /** Prints an info message if info printing is enabled by lalDebugLevel. */
164 int XLALPrintInfo(const char *fmt, ...) _LAL_GCC_PRINTF_FORMAT_(1,2);
165 
166 /** Prints an error message if error printing is enabled by lalDebugLevel. */
167 int XLALVPrintError(const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(1);
168 
169 /** Prints a warning message if warning printing is enabled by lalDebugLevel. */
170 int XLALVPrintWarning(const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(1);
171 
172 /** Prints an info message if info printing is enabled by lalDebugLevel. */
173 int XLALVPrintInfo(const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(1);
174 
175 
176 /*
177  *
178  * Miscelaneous routines to print information with standard formatting.
179  *
180  */
181 
182 /**
183  * Print an error message with standard XLAL formatting (if error messages
184  * are enabled by lalDebugLevel).
185  */
186 void XLALPrintErrorMessage(const char *func, const char *file, int line,
187  const char *fmt, ...) _LAL_GCC_PRINTF_FORMAT_(4,5);
188 
189 /**
190  * Print an warning message with standard XLAL formatting (if warning messages
191  * are enabled by lalDebugLevel).
192  */
193 void XLALPrintWarningMessage(const char *func, const char *file, int line,
194  const char *fmt, ...) _LAL_GCC_PRINTF_FORMAT_(4,5);
195 
196 /**
197  * Print an info message with standard XLAL formatting (if info messages
198  * are enabled by lalDebugLevel).
199  */
200 void XLALPrintInfoMessage(const char *func, const char *file, int line,
201  const char *fmt, ...) _LAL_GCC_PRINTF_FORMAT_(4,5);
202 
203 /**
204  * Print an error message with standard XLAL formatting (if error messages
205  * are enabled by lalDebugLevel).
206  */
207 void XLALVPrintErrorMessage(const char *func, const char *file, int line,
208  const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(4);
209 
210 /**
211  * Print an warning message with standard XLAL formatting (if warning messages
212  * are enabled by lalDebugLevel).
213  */
214 void XLALVPrintWarningMessage(const char *func, const char *file, int line,
215  const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(4);
216 
217 /**
218  * Print an error message with standard XLAL formatting (if error messages
219  * are enabled by lalDebugLevel).
220  */
221 void XLALVPrintInfoMessage(const char *func, const char *file, int line,
222  const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(4);
223 
224 /** Prints a progress bar at the "info" verbosity level. */
225 int XLALPrintProgressBar(double);
226 
227 /** Prints a deprecation warning at the "warning" verbosity level. */
228 #define XLAL_PRINT_DEPRECATION_WARNING(replacement) \
229  do { \
230  static int _xlal_print_deprecation_warning_ = 1; \
231  if (_xlal_print_deprecation_warning_) { \
232  XLALPrintWarning( \
233  "\nDEPRECATION WARNING: program has invoked obsolete function %s(). " \
234  "Please see %s() for information about a replacement.\n", \
235  __func__, replacement); \
236  _xlal_print_deprecation_warning_ = 0; \
237  } \
238  } while(0)
239 
240 
241 /*
242  *
243  * Macros that will print error/warning/info messages with a standard format.
244  *
245  */
246 
247 /**
248  * \brief Macro that will print an error message with a standard format.
249  *
250  * Prototype: <b>XLAL_PRINT_ERROR(fmt [, ...])</b>
251  *
252  * \b Parameters:<ul>
253  * <li> \b fmt A printf-like format string.
254  * <li> \b ... (Optional) Arguments to the format string.
255  * </ul>
256  */
257 #define XLAL_PRINT_ERROR(...) \
258  XLALPrintErrorMessage(__func__, __FILE__, __LINE__, __VA_ARGS__)
259 
260 /**
261  * \brief Macro that will print a warning message with a standard format.
262  *
263  * Prototype: <b>XLAL_PRINT_WARNING(fmt [, ...])</b>
264  *
265  * \b Parameters:<ul>
266  * <li> \b fmt A printf-like format string.
267  * <li> \b ... (Optional) Arguments to the format string.
268  * </ul>
269  */
270 #define XLAL_PRINT_WARNING(...) \
271  XLALPrintWarningMessage(__func__, __FILE__, __LINE__, __VA_ARGS__)
272 
273 /**
274  * \brief Macro that will print an info message with a standard format.
275  *
276  * Prototype: <b>XLAL_PRINT_INFO(fmt [, ...])</b>
277  *
278  * \b Parameters:<ul>
279  * <li> \b fmt A printf-like format string.
280  * <li> \b ... (Optional) Arguments to the format string.
281  * </ul>
282  */
283 #define XLAL_PRINT_INFO(...) \
284  XLALPrintInfoMessage(__func__, __FILE__, __LINE__, __VA_ARGS__)
285 
286 
287 /*
288  *
289  * The LAL specification requires that XLAL functions that return a
290  * floating-point type (either <tt>REAL4</tt> or <tt>REAL8</tt>) should return
291  * a particular value to indicate an error. These values are given by the
292  * macros <tt>XLAL_REAL4_FAIL_NAN</tt> and <tt>XLAL_REAL8_FAIL_NAN</tt> (they
293  * are Not a Number or NaN values). To implement these we choose hexadecimal
294  * representations and then provide static functions that return the equivalent
295  * <tt>REAL4</tt> or <tt>REAL8</tt> values. The macros then invoke these
296  * functions. This is done so that the compiler can easily inline the
297  * functions (or eliminate them if they are not used). Conversion from the
298  * hexadecimal representation to the floating-point representation is done
299  * using a union.
300  *
301  * The LAL specification also requires that there be two macros,
302  * <tt>XLAL_IS_REAL4_FAIL_NAN(val)</tt> and
303  * <tt>XLAL_IS_REAL8_FAIL_NAN(val)</tt> that will
304  * test if val is one of these XLAL-specific fail NaNs. Again these macros
305  * invoke static functions that return the result of the comparison. The
306  * comparison itself is done with the hexadecimal representation.
307  *
308  */
309 
310 /* Hexadecimal representation of the <tt>REAL4</tt> and <tt>REAL8</tt> NaN
311  * failure bit pattern. */
312 #define XLAL_REAL4_FAIL_NAN_INT 0x7fc001a1 /**< Hexadecimal representation of <tt>REAL4</tt> NaN failure bit pattern */
313 #define XLAL_REAL8_FAIL_NAN_INT LAL_INT8_C(0x7ff80000000001a1) /**< Hexadecimal representation of <tt>REAL8</tt> NaN failure bit pattern */
314 
315 /*
316  * The floating point values themselves are returned by static functions that
317  * can be easily inlined by the compiler; similarly, the routines to test if a
318  * value is the LAL failure NaN can also be inlined.
319  */
320 
321 /** Returns the value of the XLAL <tt>REAL4</tt> failure NaN. */
322 static _LAL_INLINE_ REAL4 XLALREAL4FailNaN(void);
324 {
325  volatile const union {
326  INT4 i;
327  REAL4 x;
328  } val = {
330  return val.x;
331 }
332 
333 /** Returns the value of the XLAL <tt>REAL8</tt> failure NaN. */
334 static _LAL_INLINE_ REAL8 XLALREAL8FailNaN(void);
336 {
337  volatile const union {
338  INT8 i;
339  REAL8 x;
340  } val = {
342  return val.x;
343 }
344 
345 /** Tests if a value is an XLAL <tt>REAL4</tt> failure NaN. */
346 static _LAL_INLINE_ int XLALIsREAL4FailNaN(REAL4 val);
348 {
349  volatile const union {
350  INT4 i;
351  unsigned char s[4];
352  } a = {
354  volatile union {
355  REAL4 x;
356  unsigned char s[4];
357  } b;
358  size_t n;
359  b.x = val;
360  for (n = 0; n < sizeof(val); ++n)
361  if (a.s[n] != b.s[n])
362  return 0;
363  return 1;
364 }
365 
366 /** Tests if a value is an XLAL <tt>REAL8</tt> failure NaN. */
367 static _LAL_INLINE_ int XLALIsREAL8FailNaN(REAL8 val);
369 {
370  volatile const union {
371  INT8 i;
372  unsigned char s[8];
373  } a = {
375  volatile union {
376  REAL8 x;
377  unsigned char s[8];
378  } b;
379  size_t n;
380  b.x = val;
381  for (n = 0; n < sizeof(val); ++n)
382  if (a.s[n] != b.s[n])
383  return 0;
384  return 1;
385 }
386 
387 /* Here are the macro constants for the fail NaNs. */
388 #define XLAL_REAL4_FAIL_NAN ( XLALREAL4FailNaN() ) /**< Floating-point value of the XLAL <tt>REAL4</tt> failure NaN. */
389 #define XLAL_REAL8_FAIL_NAN ( XLALREAL8FailNaN() ) /**< Floating-point value of the XLAL <tt>REAL8</tt> failure NaN. */
390 
391 /* Here are the macros to test for fail NaNs. */
392 #define XLAL_IS_REAL4_FAIL_NAN(val) XLALIsREAL4FailNaN(val) /**< Tests if <tt>val</tt> is a XLAL <tt>REAL4</tt> failure NaN. */
393 #define XLAL_IS_REAL8_FAIL_NAN(val) XLALIsREAL8FailNaN(val) /**< Tests if <tt>val</tt> is a XLAL <tt>REAL8</tt> failure NaN. */
394 
395 
396 #endif /* SWIG */
397 
398 
399 /** XLAL error numbers and return values. */
401  XLAL_SUCCESS = 0, /**< Success return value (not an error number) */
402  XLAL_FAILURE = -1, /**< Failure return value (not an error number) */
403 
404  /* these are standard error numbers */
405  XLAL_ENOENT = 2, /**< No such file or directory */
406  XLAL_EIO = 5, /**< I/O error */
407  XLAL_ENOMEM = 12, /**< Memory allocation error */
408  XLAL_EFAULT = 14, /**< Invalid pointer */
409  XLAL_EINVAL = 22, /**< Invalid argument */
410  XLAL_EDOM = 33, /**< Input domain error */
411  XLAL_ERANGE = 34, /**< Output range error */
412  XLAL_ENOSYS = 38, /**< Function not implemented */
413 
414  /* extended error numbers start at 128 ...
415  * should be beyond normal errnos */
416 
417  /* these are common errors for XLAL functions */
418  XLAL_EFAILED = 128, /**< Generic failure */
419  XLAL_EBADLEN = 129, /**< Inconsistent or invalid length */
420  XLAL_ESIZE = 130, /**< Wrong size */
421  XLAL_EDIMS = 131, /**< Wrong dimensions */
422  XLAL_ETYPE = 132, /**< Wrong or unknown type */
423  XLAL_ETIME = 133, /**< Invalid time */
424  XLAL_EFREQ = 134, /**< Invalid freqency */
425  XLAL_EUNIT = 135, /**< Invalid units */
426  XLAL_ENAME = 136, /**< Wrong name */
427  XLAL_EDATA = 137, /**< Invalid data */
428 
429  /* user-defined errors */
430  XLAL_EUSR0 = 200, /**< User-defined error 0 */
431  XLAL_EUSR1 = 201, /**< User-defined error 1 */
432  XLAL_EUSR2 = 202, /**< User-defined error 2 */
433  XLAL_EUSR3 = 203, /**< User-defined error 3 */
434  XLAL_EUSR4 = 204, /**< User-defined error 4 */
435  XLAL_EUSR5 = 205, /**< User-defined error 5 */
436  XLAL_EUSR6 = 206, /**< User-defined error 6 */
437  XLAL_EUSR7 = 207, /**< User-defined error 7 */
438  XLAL_EUSR8 = 208, /**< User-defined error 8 */
439  XLAL_EUSR9 = 209, /**< User-defined error 9 */
440 
441  /* external or internal errors */
442  XLAL_ESYS = 254, /**< System error */
443  XLAL_EERR = 255, /**< Internal error */
444 
445  /* specific mathematical and numerical errors start at 256 */
446 
447  /* IEEE floating point errors */
448  XLAL_EFPINVAL = 256, /**< IEEE Invalid floating point operation, eg sqrt(-1), 0/0 */
449  XLAL_EFPDIV0 = 257, /**< IEEE Division by zero floating point error */
450  XLAL_EFPOVRFLW = 258, /**< IEEE Floating point overflow error */
451  XLAL_EFPUNDFLW = 259, /**< IEEE Floating point underflow error */
452  XLAL_EFPINEXCT = 260, /**< IEEE Floating point inexact error */
453 
454  /* numerical algorithm errors */
455  XLAL_EMAXITER = 261, /**< Exceeded maximum number of iterations */
456  XLAL_EDIVERGE = 262, /**< Series is diverging */
457  XLAL_ESING = 263, /**< Apparent singularity detected */
458  XLAL_ETOL = 264, /**< Failed to reach specified tolerance */
459  XLAL_ELOSS = 265, /**< Loss of accuracy */
460 
461  /* failure from within a function call: "or" error number with this */
462  XLAL_EFUNC = 1024 /**< Internal function call failed bit: "or" this with existing error number */
463 };
464 
465 
466 #ifndef SWIG /* exclude from SWIG interface */
467 
468 
469 /*
470  *
471  * These functions provide message associated with an error code and print
472  * an error message associated with the error code. The macro XLAL_PERROR
473  * fills in the current file and line information and uses the current
474  * value of xlalErrno as the error number.
475  *
476  */
477 
478 /** Returns the error message associated with an error number. */
479 const char *XLALErrorString(int errnum);
480 
481 /** Prints an error message for a particular error code in a standard format. */
482 void XLALPerror(const char *func, const char *file, int line, int errnum);
483 
484 /** Prints an error message for the current value of <tt>xlalErrno</tt>. */
485 #define XLAL_PERROR( ) XLALPerror(__func__, __FILE__, __LINE__, xlalErrno)
486 
487 
488 /*
489  *
490  * Here is the XLAL error handler type and the routines that set it.
491  * Also provide is the default error handler.
492  *
493  */
494 
495 /** The XLAL error handler type. */
496 typedef void XLALErrorHandlerType(const char *func, const char *file,
497  int line, int errnum);
498 
499 /** The default XLAL error handler. */
500 void XLALDefaultErrorHandler(const char *func, const char *file, int line,
501  int errnum);
502 /** A silent XLAL error handler. */
503 void XLALSilentErrorHandler(const char *func, const char *file, int line,
504  int errnum);
505 
506 /* Other useful XLAL error handlers. */
507 /** The XLAL error handler that raises SIGABRT. */
508 void XLALAbortErrorHandler(const char *func, const char *file, int line,
509  int errnum);
510 /** The XLAL error handler that calls exit. */
511 void XLALExitErrorHandler(const char *func, const char *file, int line,
512  int errnum);
513 /** The XLAL error handler that prints a function call backtrace then raises SIGABRT. */
514 void XLALBacktraceErrorHandler(const char *func, const char *file,
515  int line, int errnum);
516 
517 /** Function to return pointer to the XLAL error handler function pointer. */
519 
520 /** Sets the error handler to a new handler and returns the old handler. */
522  newHandler);
523 
524 /** Sets the error handler to the default handler and returns the old handler. */
526 /** Sets the error handler to a silent handler and returns the old handler. */
528 
529 
530 #endif /* SWIG */
531 
532 
533 /*
534  *
535  * Here are the routines that set or clear the XLAL error number.
536  *
537  */
538 
539 #ifdef SWIG /* SWIG interface directives */
540 SWIGLAL(DISABLE_EXCEPTIONS(XLALSetErrno, XLALGetBaseErrno, XLALClearErrno));
541 #endif /* SWIG */
542 
543 /** Sets the XLAL error number to errnum, returns the new value. */
544 int XLALSetErrno(int errnum);
545 
546 /** Gets the XLAL base error number ignoring the internal-function-failed flag. */
547 int XLALGetBaseErrno(void);
548 
549 /** Clears the XLAL error number, returns the old value. */
550 int XLALClearErrno(void);
551 
552 
553 #ifndef SWIG /* exclude from SWIG interface */
554 
555 
556 /*
557  *
558  * The LAL specifiation requires that the XLAL error number be a modifiable
559  * lvalue. Similarly, the function pointer to the XLAL error handler is
560  * a modifiable lvalue. These are implemented as macros that dereference
561  * pointers to the current value (in the current thread). The pointer is
562  * returned by the functions XLALGetErrnoPtr and XLALGetErrorHandlerPtr.
563  * Here these functions and macros are defined.
564  *
565  */
566 
567 /** Function to return pointer to the XLAL error number. */
568 int *XLALGetErrnoPtr(void);
569 
570 /* these are the modifiable lvalues for xlalErrno and XLALErrorHandler */
571 #define xlalErrno ( * XLALGetErrnoPtr() ) /**< Modifiable lvalue containing the XLAL error number */
572 #define XLALErrorHandler ( * XLALGetErrorHandlerPtr() ) /**< Modifiable lvalue containing the XLAL error handler */
573 
574 
575 /**
576  * A macro to (i) disable the XLAL error handling and preserve the
577  * current value of xlalErrno (ii) perform a statement that involves an
578  * XLAL function call and (iii) restore the XLAL error handler and value of
579  * xlalErrno while setting variable errnum to the xlalErrno set by the
580  * statement.
581  */
582 #define XLAL_TRY( statement, errnum ) \
583  do { \
584  XLALErrorHandlerType *xlalSaveErrorHandler; \
585  int xlalSaveErrno; \
586  xlalSaveErrorHandler = XLALSetSilentErrorHandler(); \
587  xlalSaveErrno = xlalErrno; \
588  XLALClearErrno(); \
589  statement ; \
590  errnum = xlalErrno; \
591  xlalErrno = xlalSaveErrno; \
592  XLALSetErrorHandler(xlalSaveErrorHandler); \
593  } while (0)
594 
595 /**
596  * Performs the same actions as XLAL_TRY(), but additionally silences
597  * any error/warning/etc. messages being printed while statement is
598  * executed, regardless of the value of #lalDebugLevel.
599  */
600 #define XLAL_TRY_SILENT( statement, errnum ) \
601  do { \
602  int xlalSaveDebugLevel = lalDebugLevel; \
603  XLALClobberDebugLevel(xlalSaveDebugLevel & ~(LALERRORBIT | LALWARNINGBIT | LALINFOBIT | LALTRACEBIT)); \
604  XLAL_TRY(statement, errnum); \
605  XLALClobberDebugLevel(xlalSaveDebugLevel); \
606  } while (0)
607 
608 /*
609  *
610  * Here are the routines and macros that are used to report errors when
611  * an XLAL function fails. They (i) set the XLAL error number and (ii)
612  * invoke the XLAL error handler. The macros also (iii) return the
613  * appropriate failure codes. The macros should be used to report all
614  * failures.
615  *
616  */
617 
618 /**
619  * Routine to set the XLAL error number and invoke the XLAL error handler.
620  * It is used by the error macros.
621  */
622 void XLALError(const char *func,
623  /**< name of function where the error occurs */
624  const char *file,
625  /**< source file name (use the __FILE__ macro) */
626  int line, /**< source line number (use the __LINE__ macro) */
627  int errnum /**< error code */
628  );
629 
630 /** \cond DONT_DOXYGEN */
631 /*
632  * Helper macros for internal use only:
633  * To allow for a possibly empty error message, these macros use
634  * snprintf(buf, sizeof(buf), "X" __VA_ARGS__)
635  * to print any error message preceded by "X" (to silence -Wformat-zero-length)
636  * to a buffer 'buf', then print the error message with XLAL_PRINT_ERROR() only
637  * if 'buf' contains any characters after the "X". This construct allows for
638  * XLAL_ERROR(XLAL_EFUNC);
639  * XLAL_ERROR(XLAL_EFUNC, "%i < 0", n);
640  * It does not allow a non-literal format string, e.g.
641  * const char *fmt = "%i < 0"; XLAL_ERROR(XLAL_EFUNC, fmt, n);
642  * but since this is a security risk, -Wformat does not allow this anyway.
643  */
644 
645 #define _XLAL_ERROR_IMPL_(statement, errnum, ...) \
646  do { \
647  char _XLAL_ERROR_IMPL_buf_[1024]; \
648  XLALStringPrint(_XLAL_ERROR_IMPL_buf_, sizeof(_XLAL_ERROR_IMPL_buf_), "X" __VA_ARGS__); \
649  if (_XLAL_ERROR_IMPL_buf_[1] != 0) { \
650  XLAL_PRINT_ERROR("%s", &_XLAL_ERROR_IMPL_buf_[1]); \
651  } \
652  XLALError(__func__, __FILE__, __LINE__, errnum); \
653  statement; \
654  } while (0)
655 
656 #define _XLAL_CHECK_IMPL_(statement, assertion, errnum, ...) \
657  do { \
658  if (!(assertion)) { \
659  char _XLAL_CHECK_IMPL_buf_[1024]; \
660  XLALStringPrint(_XLAL_CHECK_IMPL_buf_, sizeof(_XLAL_CHECK_IMPL_buf_), "X" __VA_ARGS__); \
661  if (_XLAL_CHECK_IMPL_buf_[1] != 0) { \
662  XLAL_PRINT_ERROR("%s", &_XLAL_CHECK_IMPL_buf_[1]); \
663  } else { \
664  XLAL_PRINT_ERROR("Check failed: %s", #assertion); \
665  } \
666  XLALError(__func__, __FILE__, __LINE__, errnum); \
667  statement; \
668  } \
669  } while (0)
670 
671 /** \endcond */
672 
673 /**
674  * \brief Macro to invoke the <tt>XLALError()</tt> function and return
675  * with code val (it should not really be used itself, but forms the basis for
676  * other macros).
677  *
678  * Prototype: <b>XLAL_ERROR_VAL(val, errnum [, fmt [, ...]])</b>
679  *
680  * \b Parameters:<ul>
681  * <li> \b val The value to return.
682  * <li> \b errnum The XLAL error number to set.
683  * <li> \b fmt (Optional) Format string for additional error information.
684  * <li> \b ... (Optional) Additional arguments for printf-like format.
685  * </ul>
686  */
687 #define XLAL_ERROR_VAL(val, ...) _XLAL_ERROR_IMPL_(return val, __VA_ARGS__)
688 
689 /**
690  * Macro to invoke a failure from a XLAL routine returning an integer.
691  *
692  * Prototype: <b>XLAL_ERROR(errnum [, fmt [, ...]])</b>
693  *
694  * \b Parameters:<ul>
695  * <li> \b errnum The XLAL error number to set.
696  * <li> \b fmt (Optional) Format string for additional error information.
697  * <li> \b ... (Optional) Additional arguments for printf-like format.
698  * </ul>
699  */
700 #define XLAL_ERROR(...) _XLAL_ERROR_IMPL_(return (int)XLAL_FAILURE, __VA_ARGS__)
701 
702 /**
703  * Macro to invoke a failure from a XLAL routine returning a pointer.
704  *
705  * Prototype: <b>XLAL_ERROR_NULL(errnum [, fmt [, ...]])</b>
706  *
707  * \b Parameters:<ul>
708  * <li> \b errnum The XLAL error number to set.
709  * <li> \b fmt (Optional) Format string for additional error information.
710  * <li> \b ... (Optional) Additional arguments for printf-like format.
711  * </ul>
712  */
713 #define XLAL_ERROR_NULL(...) _XLAL_ERROR_IMPL_(return NULL, __VA_ARGS__)
714 
715 /**
716  * \brief Macro to invoke a failure from a XLAL routine returning void.
717  *
718  * Prototype: <b>XLAL_ERROR_VOID(errnum [, fmt [, ...]])</b>
719  *
720  * \b Parameters:<ul>
721  * <li> \b errnum The XLAL error number to set.
722  * <li> \b fmt (Optional) Format string for additional error information.
723  * <li> \b ... (Optional) Additional arguments for printf-like format.
724  * </ul>
725  */
726 #define XLAL_ERROR_VOID(...) _XLAL_ERROR_IMPL_(return, __VA_ARGS__)
727 
728 /**
729  * \brief Macro to invoke a failure from a XLAL routine returning a <tt>REAL4</tt>.
730  *
731  * Prototype: <b>XLAL_ERROR_REAL4(errnum [, fmt [, ...]])</b>
732  *
733  * \b Parameters:<ul>
734  * <li> \b errnum The XLAL error number to set.
735  * <li> \b fmt (Optional) Format string for additional error information.
736  * <li> \b ... (Optional) Additional arguments for printf-like format.
737  * </ul>
738  */
739 #define XLAL_ERROR_REAL4(...) _XLAL_ERROR_IMPL_(return XLAL_REAL4_FAIL_NAN, __VA_ARGS__)
740 
741 /**
742  * \brief Macro to invoke a failure from a XLAL routine returning a <tt>REAL8</tt>.
743  *
744  * Prototype <b>XLAL_ERROR_REAL8(errnum [, fmt [, ...]])</b>
745  *
746  * \b Parameters:<ul>
747  * <li> \b errnum The XLAL error number to set.
748  * <li> \b fmt (Optional) Format string for additional error information.
749  * <li> \b ... (Optional) Additional arguments for printf-like format.
750  * </ul>
751  */
752 #define XLAL_ERROR_REAL8(...) _XLAL_ERROR_IMPL_(return XLAL_REAL8_FAIL_NAN, __VA_ARGS__)
753 
754 /**
755  * \brief Macro to invoke a failure from a C <tt>main()</tt> routine.
756  *
757  * Prototype <b>XLAL_ERROR_MAIN(errnum [, fmt [, ...]])</b>
758  *
759  * \b Parameters:<ul>
760  * <li> \b errnum The XLAL error number to set.
761  * <li> \b fmt (Optional) Format string for additional error information.
762  * <li> \b ... (Optional) Additional arguments for printf-like format.
763  * </ul>
764  */
765 #define XLAL_ERROR_MAIN(...) _XLAL_ERROR_IMPL_(return EXIT_FAILURE, __VA_ARGS__)
766 
767 /**
768  * \brief Macro to invoke a failure by jumping to a <tt>XLAL_FAIL</tt> label.
769  *
770  * Prototype <b>XLAL_ERROR_FAIL(errnum [, fmt [, ...]])</b>
771  *
772  * \b Parameters:<ul>
773  * <li> \b errnum The XLAL error number to set.
774  * <li> \b fmt (Optional) Format string for additional error information.
775  * <li> \b ... (Optional) Additional arguments for printf-like format.
776  * </ul>
777  */
778 #define XLAL_ERROR_FAIL(...) _XLAL_ERROR_IMPL_(goto XLAL_FAIL, __VA_ARGS__)
779 
780 /**
781  * \brief Macro to test an assertion; if it is not true, invoke the
782  * <tt>XLALError()</tt> function and return with code val (it should not really
783  * be used itself, but forms the basis for other macros).
784  *
785  * Prototype: <b>XLAL_CHECK_VAL(val, assertion, errnum [, fmt [, ...]])</b>
786  *
787  * \b Parameters:<ul>
788  * <li> \b val The value to return.
789  * <li> \b assertion The assertion to test.
790  * <li> \b errnum The XLAL error number to set if the assertion is false.
791  * <li> \b fmt (Optional) Format string for additional error information.
792  * <li> \b ... (Optional) Additional arguments for printf-like format.
793  * </ul>
794  */
795 #define XLAL_CHECK_VAL(val, assertion, ...) _XLAL_CHECK_IMPL_(return val, assertion, __VA_ARGS__)
796 
797 /**
798  * \brief Macro to test an assertion and invoke a failure if it is not true
799  * in a function that returns an integer.
800  *
801  * Prototype: <b>XLAL_CHECK(assertion, errnum [, fmt [, ...]])</b>
802  *
803  * \b Parameters:<ul>
804  * <li> \b assertion The assertion to test.
805  * <li> \b errnum The XLAL error number to set if the assertion is false.
806  * <li> \b fmt (Optional) Format string for additional error information.
807  * <li> \b ... (Optional) Additional arguments for printf-like format.
808  * </ul>
809  */
810 #define XLAL_CHECK(assertion, ...) _XLAL_CHECK_IMPL_(return (int)XLAL_FAILURE, assertion, __VA_ARGS__)
811 
812 /**
813  * \brief Macro to test an assertion and invoke a failure if it is not true
814  * in a function that returns a pointer.
815  *
816  * Prototype: <b>XLAL_CHECK_NULL(assertion, errnum [, fmt [, ...]])</b>
817  *
818  * \b Parameters:<ul>
819  * <li> \b assertion The assertion to test.
820  * <li> \b errnum The XLAL error number to set if the assertion is false.
821  * <li> \b fmt (Optional) Format string for additional error information.
822  * <li> \b ... (Optional) Additional arguments for printf-like format.
823  * </ul>
824  */
825 #define XLAL_CHECK_NULL(assertion, ...) _XLAL_CHECK_IMPL_(return NULL, assertion, __VA_ARGS__)
826 
827 /**
828  * \brief Macro to test an assertion and invoke a failure if it is not true
829  * in a function that returns void.
830  *
831  * Prototype: <b>XLAL_CHECK_VOID(assertion, errnum [, fmt [, ...]])</b>
832  *
833  * \b Parameters:<ul>
834  * <li> \b assertion The assertion to test.
835  * <li> \b errnum The XLAL error number to set if the assertion is false.
836  * <li> \b fmt (Optional) Format string for additional error information.
837  * <li> \b ... (Optional) Additional arguments for printf-like format.
838  * </ul>
839  */
840 #define XLAL_CHECK_VOID(assertion, ...) _XLAL_CHECK_IMPL_(return, assertion, __VA_ARGS__)
841 
842 /**
843  * \brief Macro to test an assertion and invoke a failure if it is not true
844  * in a function that returns a <tt>REAL4</tt>.
845  *
846  * Prototype: <b>XLAL_CHECK_REAL4(assertion, errnum [, fmt [, ...]])</b>
847  *
848  * \b Parameters:<ul>
849  * <li> \b assertion The assertion to test.
850  * <li> \b errnum The XLAL error number to set if the assertion is false.
851  * <li> \b fmt (Optional) Format string for additional error information.
852  * <li> \b ... (Optional) Additional arguments for printf-like format.
853  * </ul>
854  */
855 #define XLAL_CHECK_REAL4(assertion, ...) _XLAL_CHECK_IMPL_(return XLAL_REAL4_FAIL_NAN, assertion, __VA_ARGS__)
856 
857 /**
858  * \brief Macro to test an assertion and invoke a failure if it is not true
859  * in a function that returns a <tt>REAL8</tt>.
860  *
861  * Prototype: <b>XLAL_CHECK_REAL8(assertion, errnum [, fmt [, ...]])</b>
862  *
863  * \b Parameters:<ul>
864  * <li> \b assertion The assertion to test.
865  * <li> \b errnum The XLAL error number to set if the assertion is false.
866  * <li> \b fmt (Optional) Format string for additional error information.
867  * <li> \b ... (Optional) Additional arguments for printf-like format.
868  * </ul>
869  */
870 #define XLAL_CHECK_REAL8(assertion, ...) _XLAL_CHECK_IMPL_(return XLAL_REAL8_FAIL_NAN, assertion, __VA_ARGS__)
871 
872 /**
873  * \brief Macro to test an assertion and invoke a failure if it is not true
874  * in a C <tt>main()</tt> routine.
875  *
876  * Prototype: <b>XLAL_CHECK_MAIN(assertion, errnum [, fmt [, ...]])</b>
877  *
878  * \b Parameters:<ul>
879  * <li> \b assertion The assertion to test.
880  * <li> \b errnum The XLAL error number to set if the assertion is false.
881  * <li> \b fmt (Optional) Format string for additional error information.
882  * <li> \b ... (Optional) Additional arguments for printf-like format.
883  * </ul>
884  */
885 #define XLAL_CHECK_MAIN(assertion, ...) _XLAL_CHECK_IMPL_(return EXIT_FAILURE, assertion, __VA_ARGS__)
886 
887 /**
888  * \brief Macro to test an assertion and invoke a failure if it is not true
889  * by jumping to a <tt>XLAL_FAIL</tt> label.
890  *
891  * Prototype: <b>XLAL_CHECK_FAIL(assertion, errnum [, fmt [, ...]])</b>
892  *
893  * \b Parameters:<ul>
894  * <li> \b assertion The assertion to test.
895  * <li> \b errnum The XLAL error number to set if the assertion is false.
896  * <li> \b fmt (Optional) Format string for additional error information.
897  * <li> \b ... (Optional) Additional arguments for printf-like format.
898  * </ul>
899  */
900 #define XLAL_CHECK_FAIL(assertion, ...) _XLAL_CHECK_IMPL_(goto XLAL_FAIL, assertion, __VA_ARGS__)
901 
902 /**
903  * \brief Macro to test an assertion and invoke a failure if it is not true
904  * by calling <tt>lalAbortHook()</tt>.
905  *
906  * Prototype: <b>XLAL_CHECK_ABORT(assertion)</b>
907  *
908  * \b Parameters:<ul>
909  * <li> \b assertion The assertion to test.
910  * </ul>
911  */
912 #define XLAL_CHECK_ABORT(assertion) \
913  do { \
914  if (!(assertion)) { \
915  XLAL_PRINT_ERROR("Check failed: %s", #assertion); \
916  lalAbortHook("XLAL_CHECK_ABORT() failed"); \
917  } \
918  } while (0)
919 
920 /**
921  * \brief Macro to test an assertion and invoke a failure if it is not true
922  * by calling <tt>exit(1)</tt>.
923  *
924  * Prototype: <b>XLAL_CHECK_EXIT(assertion)</b>
925  *
926  * \b Parameters:<ul>
927  * <li> \b assertion The assertion to test.
928  * </ul>
929  */
930 #define XLAL_CHECK_EXIT(assertion) \
931  do { \
932  if (!(assertion)) { \
933  XLAL_PRINT_ERROR("Check failed: %s", #assertion); \
934  exit(1); \
935  } \
936  } while (0)
937 
938 
939 #endif /* SWIG */
940 
941 
942 /** @} */
943 
944 #if 0
945 { /* so that editors will match succeeding brace */
946 #elif defined(__cplusplus)
947 }
948 #endif
949 
950 #endif /* XLALERROR_H */
#define _LAL_GCC_VPRINTF_FORMAT_(NFMT)
Definition: LALStddef.h:48
#define _LAL_INLINE_
Definition: LALStddef.h:36
#define _LAL_GCC_PRINTF_FORMAT_(NFMT, NARG)
Definition: LALStddef.h:47
double REAL8
Double precision real floating-point number (8 bytes).
int64_t INT8
Eight-byte signed integer; on some platforms this is equivalent to long int instead.
int32_t INT4
Four-byte signed integer.
float REAL4
Single precision real floating-point number (4 bytes).
static const INT4 a
Definition: Random.c:79
static _LAL_INLINE_ REAL8 XLALREAL8FailNaN(void)
Returns the value of the XLAL REAL8 failure NaN.
Definition: XLALError.h:335
void XLALBacktraceErrorHandler(const char *func, const char *file, int line, int errnum)
The XLAL error handler that prints a function call backtrace then raises SIGABRT.
Definition: XLALError.c:615
int int int int XLALVPrintError(const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(1)
Prints an error message if error printing is enabled by lalDebugLevel.
Definition: XLALError.c:50
void XLALVPrintWarningMessage(const char *func, const char *file, int line, const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(4)
Print an warning message with standard XLAL formatting (if warning messages are enabled by lalDebugLe...
Definition: XLALError.c:118
int XLALVPrintInfo(const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(1)
Prints an info message if info printing is enabled by lalDebugLevel.
Definition: XLALError.c:62
void XLALSilentErrorHandler(const char *func, const char *file, int line, int errnum)
A silent XLAL error handler.
void XLALError(const char *func, const char *file, int line, int errnum)
Routine to set the XLAL error number and invoke the XLAL error handler.
Definition: XLALError.c:582
void XLALAbortErrorHandler(const char *func, const char *file, int line, int errnum)
The XLAL error handler that raises SIGABRT.
Definition: XLALError.c:599
int * XLALGetErrnoPtr(void)
Function to return pointer to the XLAL error number.
Definition: XLALError.c:209
XLALErrorHandlerType * XLALSetSilentErrorHandler(void)
Sets the error handler to a silent handler and returns the old handler.
Definition: XLALError.c:392
int XLALVPrintWarning(const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(1)
Prints a warning message if warning printing is enabled by lalDebugLevel.
Definition: XLALError.c:56
const char * XLALErrorString(int errnum)
Returns the error message associated with an error number.
Definition: XLALError.c:409
int XLALGetBaseErrno(void)
Gets the XLAL base error number ignoring the internal-function-failed flag.
Definition: XLALError.c:356
int int int XLALPrintInfo(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
Prints an info message if info printing is enabled by lalDebugLevel.
#define XLAL_REAL4_FAIL_NAN_INT
Hexadecimal representation of REAL4 NaN failure bit pattern.
Definition: XLALError.h:312
XLALErrorHandlerType ** XLALGetErrorHandlerPtr(void)
Function to return pointer to the XLAL error handler function pointer.
Definition: XLALError.c:218
int XLALSetErrno(int errnum)
Sets the XLAL error number to errnum, returns the new value.
Definition: XLALError.c:327
XLALErrorHandlerType * XLALSetDefaultErrorHandler(void)
Sets the error handler to the default handler and returns the old handler.
Definition: XLALError.c:383
void void void XLALPrintInfoMessage(const char *func, const char *file, int line, const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(4
Print an info message with standard XLAL formatting (if info messages are enabled by lalDebugLevel).
void XLALExitErrorHandler(const char *func, const char *file, int line, int errnum)
The XLAL error handler that calls exit.
Definition: XLALError.c:607
static _LAL_INLINE_ REAL4 XLALREAL4FailNaN(void)
Returns the value of the XLAL REAL4 failure NaN.
Definition: XLALError.h:323
void XLALDefaultErrorHandler(const char *func, const char *file, int line, int errnum)
The default XLAL error handler.
Definition: XLALError.c:561
void XLALVPrintInfoMessage(const char *func, const char *file, int line, const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(4)
Print an error message with standard XLAL formatting (if error messages are enabled by lalDebugLevel)...
Definition: XLALError.c:132
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
Prints an error message if error printing is enabled by lalDebugLevel.
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
Prints a warning message if warning printing is enabled by lalDebugLevel.
void void void void XLALVPrintErrorMessage(const char *func, const char *file, int line, const char *fmt, va_list ap) _LAL_GCC_VPRINTF_FORMAT_(4)
Print an error message with standard XLAL formatting (if error messages are enabled by lalDebugLevel)...
Definition: XLALError.c:104
XLALErrorValue
XLAL error numbers and return values.
Definition: XLALError.h:400
void XLALErrorHandlerType(const char *func, const char *file, int line, int errnum)
The XLAL error handler type.
Definition: XLALError.h:496
void void XLALPrintWarningMessage(const char *func, const char *file, int line, const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(4
Print an warning message with standard XLAL formatting (if warning messages are enabled by lalDebugLe...
int XLALClearErrno(void)
Clears the XLAL error number, returns the old value.
Definition: XLALError.c:363
int XLALPrintProgressBar(double)
Prints a progress bar at the "info" verbosity level.
Definition: XLALError.c:181
static _LAL_INLINE_ int XLALIsREAL4FailNaN(REAL4 val)
Tests if a value is an XLAL REAL4 failure NaN.
Definition: XLALError.h:347
void XLALPerror(const char *func, const char *file, int line, int errnum)
Prints an error message for a particular error code in a standard format.
Definition: XLALError.c:539
void XLALPrintErrorMessage(const char *func, const char *file, int line, const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(4
Print an error message with standard XLAL formatting (if error messages are enabled by lalDebugLevel)...
#define XLAL_REAL8_FAIL_NAN_INT
Hexadecimal representation of REAL8 NaN failure bit pattern.
Definition: XLALError.h:313
static _LAL_INLINE_ int XLALIsREAL8FailNaN(REAL8 val)
Tests if a value is an XLAL REAL8 failure NaN.
Definition: XLALError.h:368
XLALErrorHandlerType * XLALSetErrorHandler(XLALErrorHandlerType *newHandler)
Sets the error handler to a new handler and returns the old handler.
Definition: XLALError.c:372
@ XLAL_ESING
Apparent singularity detected.
Definition: XLALError.h:457
@ XLAL_EUSR7
User-defined error 7.
Definition: XLALError.h:437
@ XLAL_EBADLEN
Inconsistent or invalid length.
Definition: XLALError.h:419
@ XLAL_EUSR4
User-defined error 4.
Definition: XLALError.h:434
@ XLAL_EUSR6
User-defined error 6.
Definition: XLALError.h:436
@ XLAL_EFPINEXCT
IEEE Floating point inexact error.
Definition: XLALError.h:452
@ XLAL_EUNIT
Invalid units.
Definition: XLALError.h:425
@ XLAL_EUSR9
User-defined error 9.
Definition: XLALError.h:439
@ XLAL_EUSR3
User-defined error 3.
Definition: XLALError.h:433
@ XLAL_EFREQ
Invalid freqency.
Definition: XLALError.h:424
@ XLAL_EDIVERGE
Series is diverging.
Definition: XLALError.h:456
@ XLAL_ENOMEM
Memory allocation error.
Definition: XLALError.h:407
@ XLAL_EDATA
Invalid data.
Definition: XLALError.h:427
@ XLAL_SUCCESS
Success return value (not an error number)
Definition: XLALError.h:401
@ XLAL_EFPINVAL
IEEE Invalid floating point operation, eg sqrt(-1), 0/0.
Definition: XLALError.h:448
@ XLAL_EFAULT
Invalid pointer.
Definition: XLALError.h:408
@ XLAL_EUSR0
User-defined error 0.
Definition: XLALError.h:430
@ XLAL_ERANGE
Output range error.
Definition: XLALError.h:411
@ XLAL_ENAME
Wrong name.
Definition: XLALError.h:426
@ XLAL_ENOENT
No such file or directory.
Definition: XLALError.h:405
@ XLAL_EFUNC
Internal function call failed bit: "or" this with existing error number.
Definition: XLALError.h:462
@ XLAL_EMAXITER
Exceeded maximum number of iterations.
Definition: XLALError.h:455
@ XLAL_ELOSS
Loss of accuracy.
Definition: XLALError.h:459
@ XLAL_ETOL
Failed to reach specified tolerance.
Definition: XLALError.h:458
@ XLAL_EERR
Internal error.
Definition: XLALError.h:443
@ XLAL_EUSR2
User-defined error 2.
Definition: XLALError.h:432
@ XLAL_EDOM
Input domain error.
Definition: XLALError.h:410
@ XLAL_EUSR8
User-defined error 8.
Definition: XLALError.h:438
@ XLAL_ETYPE
Wrong or unknown type.
Definition: XLALError.h:422
@ XLAL_ESIZE
Wrong size.
Definition: XLALError.h:420
@ XLAL_EIO
I/O error.
Definition: XLALError.h:406
@ XLAL_EUSR5
User-defined error 5.
Definition: XLALError.h:435
@ XLAL_EUSR1
User-defined error 1.
Definition: XLALError.h:431
@ XLAL_EDIMS
Wrong dimensions.
Definition: XLALError.h:421
@ XLAL_ESYS
System error.
Definition: XLALError.h:442
@ XLAL_EINVAL
Invalid argument.
Definition: XLALError.h:409
@ XLAL_EFPOVRFLW
IEEE Floating point overflow error.
Definition: XLALError.h:450
@ XLAL_EFAILED
Generic failure.
Definition: XLALError.h:418
@ XLAL_ENOSYS
Function not implemented.
Definition: XLALError.h:412
@ XLAL_EFPUNDFLW
IEEE Floating point underflow error.
Definition: XLALError.h:451
@ XLAL_FAILURE
Failure return value (not an error number)
Definition: XLALError.h:402
@ XLAL_ETIME
Invalid time.
Definition: XLALError.h:423
@ XLAL_EFPDIV0
IEEE Division by zero floating point error.
Definition: XLALError.h:449