s2let  2.2.0
Fast wavelets on the sphere
s2let_error.h
Go to the documentation of this file.
1 #ifndef S2LET_ERROR
2 #define S2LET_ERROR
3 
4 #include <stdio.h>
5 #include <ssht/ssht.h>
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 // Put this macro in a block so that it can be used with single-line
12 // if-statements.
13 #define S2LET_ERROR_GENERIC(comment) \
14 { \
15  printf("ERROR: %s.\n", comment); \
16  printf("ERROR: %s <%s> %s %s %s %d.\n", \
17  "Occurred in function", \
18  __PRETTY_FUNCTION__, \
19  "of file", __FILE__, \
20  "on line", __LINE__); \
21  exit(1); \
22 }
23 
24 #define S2LET_ERROR_MEM_ALLOC_CHECK(pointer) \
25  if(pointer == NULL) { \
26  S2LET_ERROR_GENERIC("Memory allocation failed") \
27  }
28 
29 #ifdef __cplusplus
30 }
31 #endif
32 #endif