libfiu (internal) 0.90
fiu.h
Go to the documentation of this file.
00001 
00011 #ifndef _FIU_H
00012 #define _FIU_H
00013 
00014 
00015 /* Controls whether the external code enables libfiu or not. */
00016 #ifdef FIU_ENABLE
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 
00031 int fiu_init(unsigned int flags);
00032 
00038 int fiu_fail(const char *name);
00039 
00048 void *fiu_failinfo(void);
00049 
00052 #define fiu_do_on(name, action) \
00053         do { \
00054                 if (fiu_fail(name)) { \
00055                         action; \
00056                 } \
00057         } while (0)
00058 
00060 #define fiu_exit_on(name) fiu_do_on(name, exit(EXIT_FAILURE))
00061 
00064 #define fiu_return_on(name, retval) fiu_do_on(name, return retval)
00065 
00066 
00067 #ifdef __cplusplus
00068 }
00069 #endif
00070 
00071 #else
00072 /* These are used when fiu not enabled. They should match fiu-local.h but we
00073  * don't include it to avoid a circular dependency. */
00074 
00075 #define fiu_init(flags) 0
00076 #define fiu_fail(name) 0
00077 #define fiu_failinfo() NULL
00078 #define fiu_do_on(name, action)
00079 #define fiu_exit_on(name)
00080 #define fiu_return_on(name, retval)
00081 
00082 #endif /* FIU_ENABLE */
00083 
00084 #endif /* _FIU_H */
00085