summaryrefslogtreecommitdiff
path: root/src/include/cctk_WarnLevel.h
blob: a2a7b53117631a1b79c105b8cd861e53fbd263bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
 /*@@
   @header    cctk_WarnLevel.h
   @date      Wed Feb 17 00:53:55 1999
   @author    Tom Goodale
   @desc 
   Header for the warning functions.
   @enddesc 
   @version $Header$
 @@*/

#ifndef _CCTK_WARNLEVEL_H_
#define _CCTK_WARNLEVEL_H_

#include <cctk_Config.h>

#ifdef CCODE

#ifdef __cplusplus 
extern "C" 
{
#endif

int CCTK_Warn(int level, 
               int line, 
               const char *file, 
               const char *thorn, 
               const char *message);
int CCTK_VWarn(int level, 
                int line, 
                const char *file, 
                const char *thorn, 
                const char *format, ...)
  CCTK_ATTRIBUTE_FORMAT(printf, 5, 6);

void CCTK_Error(int line, 
                const char *file, 
                const char *thorn, 
                const char *message)
  CCTK_ATTRIBUTE_NORETURN;

void CCTK_VError(int line, 
                 const char *file, 
                 const char *thorn, 
                 const char *format, ...)
  CCTK_ATTRIBUTE_FORMAT(printf, 4, 5)
  CCTK_ATTRIBUTE_NORETURN;
int CCTK_VParamWarn (const char *thorn,
                     const char *format,
                     ...)
  CCTK_ATTRIBUTE_FORMAT(printf, 2, 3);
int CCTK_ParamWarn(const char *thorn, const char *message);
int CCTK_Info(const char *thorn, const char *message);
int CCTK_VInfo(const char *thorn, const char *format, ...)
  CCTK_ATTRIBUTE_FORMAT(printf, 2, 3);

/* prototypes for warn/info callback routines */

typedef void (*cctk_warnfunc)(int level,
                              int line,
                              const char *file, 
                              const char *thorn,
                              const char *message,
                              void *data);
                            
typedef void (*cctk_infofunc)(const char *thorn,
                              const char *message,
                              void *data);                            

/* prototypes for warn/info registration routines */
int CCTK_WarnCallbackRegister(int minlevel,
                              int maxlevel,
                              void *data,
                              cctk_warnfunc callback);
                              

int CCTK_InfoCallbackRegister(void *data, 
                              cctk_infofunc callback);
                              

#ifdef __cplusplus 
}
#endif

#endif  /* CCODE */

/* suggested values for warning levels (courtesy of Steve, PR#1742) */
#define CCTK_WARN_ABORT    0    /* abort the Cactus run */
#define CCTK_WARN_ALERT    1    /* the results of this run will be wrong, */
                                /* and this will surprise the user, */
                                /* but we can still continue the run */
#define CCTK_WARN_COMPLAIN 2    /* the user should know about this, */
                                /* but the problem is not terribly */
                                /* surprising */
#define CCTK_WARN_PICKY    3    /* this is for small problems that can */
                                /* probably be ignored, but that careful */
                                /* people may want to know about */
#define CCTK_WARN_DEBUG    4    /* these messages are probably useful */
                                /* only for debugging purposes */

#endif  /* ! _CCTK_WARNLEVEL_H_ */