Xmipp  v3.23.11-Nereus
error.h
Go to the documentation of this file.
1 /*............................................................................
2  Filename: error.h
3 
4  Project: Biomedical Imaging Library
5 
6  Author: Philippe Thevenaz
7  Swiss Federal Institute of Technology--Lausanne
8  Biomedical Imaging Group
9  EPFL/DMT/IOA
10  BM-Ecublens
11  CH-1015 Lausanne
12  Switzerland
13 
14  Date: February 24, 1999
15 
16  Purpose: Declaration of macro for error message
17 ............................................................................*/
18 
19 
20 
21 /****************************************************************************/
22 /* Defines */
23 /****************************************************************************/
24 
25 /*--------------------------------------------------------------------------*/
26 #undef WRITE_ERROR
27 #define WRITE_ERROR(FunctionName, String) \
28  { \
29  char ErrorMessage[256]; \
30  if (sprintf(ErrorMessage, #FunctionName " at line %ld in " \
31  __FILE__ ": ERROR---", (long)__LINE__) == EOF) \
32  MessageDisplay("\a"); \
33  else { \
34  MessageDisplay(ErrorMessage); \
35  MessageDisplay(" " String "\n"); \
36  } \
37  }
38 
39 /*--------------------------------------------------------------------------*/
40 #undef WRITE_WARNING
41 #ifdef DEBUG
42 #define WRITE_WARNING(FunctionName, String) \
43  { \
44  char ErrorMessage[256]; \
45  void *isValidIdentifier; \
46  isValidIdentifier = (void *)(*FunctionName); \
47  if (((strstr(DEBUG_CONTEXT, "|" #FunctionName "|") != (char *)NULL) \
48  || (strstr(DEBUG_CONTEXT, "|*|") != (char *)NULL)) \
49  && ((strstr(DEBUG_LEVEL, "|WARNING|") != (char *)NULL) \
50  || (strstr(DEBUG_LEVEL, "|*|") != (char *)NULL))) { \
51  if (sprintf(ErrorMessage, #FunctionName " at line %ld in " \
52  __FILE__ ": WARNING---", (long)__LINE__) == EOF) \
53  MessageDisplay("\a"); \
54  else { \
55  MessageDisplay(ErrorMessage); \
56  MessageDisplay(" " String "\n"); \
57  } \
58  } \
59  }
60 #else
61 #define WRITE_WARNING(FunctionName, String) \
62  { \
63  char ErrorMessage[256]; \
64  if (sprintf(ErrorMessage, #FunctionName " at line %ld in " \
65  __FILE__ ": WARNING---", (long)__LINE__) == EOF) \
66  MessageDisplay("\a"); \
67  else { \
68  MessageDisplay(ErrorMessage); \
69  MessageDisplay(" " String "\n"); \
70  } \
71  }
72 #endif
73