ssm
Runtime Library for the Sparse Synchronous Model
ssm-debug.h
Go to the documentation of this file.
1 #ifndef _SSM_DEBUG_H
2 #define _SSM_DEBUG_H
3 
10 // FIXME!
11 #undef DEBUG
12 
13 #ifdef DEBUG
14 #include <stdio.h> /* TODO: should only be included for debug */
15 
16 /* FIXME: This is kind of an ugly hack. */
17 struct debug_buffer {
18  char buf[32];
19 };
20 
22 struct debug_sv {
23  const char *var_name;
24  const char *type_name;
25  struct debug_buffer (*value_repr)(struct ssm_sv *);
26 };
27 
29 struct debug_act {
30  const char *act_name;
31 };
32 
33 #define DEBUG_ACT_SET_ACT_NAME(actd, name) ((actd).act_name = (name))
34 #define DEBUG_SV_SET_VAR_NAME(svd, name) ((svd).var_name = (name))
35 #define DEBUG_SV_SET_TYPE_NAME(svd, name) ((svd).type_name = (name))
36 #define DEBUG_SV_SET_VALUE_REPR(svd, vr) ((svd).value_repr = (vr))
37 
38 #define DEBUG_ACT_GET_ACT_NAME(actd) (actd).act_name
39 #define DEBUG_SV_GET_VAR_NAME(svd) (svd).var_name
40 #define DEBUG_SV_GET_TYPE_NAME(svd) (svd).type_name
41 #define DEBUG_SV_GET_VALUE_REPR(svd, sv) (svd).value_repr(sv).buf
42 
43 #else
44 
45 #define DEBUG_ACT_SET_ACT_NAME(actd, name) \
46  do { \
47  } while (0)
48 #define DEBUG_SV_SET_VAR_NAME(svd, name) \
49  do { \
50  } while (0)
51 #define DEBUG_SV_SET_TYPE_NAME(svd, name) \
52  do { \
53  } while (0)
54 #define DEBUG_SV_SET_VALUE_REPR(svd, vr) \
55  do { \
56  } while (0)
57 
58 #define DEBUG_ACT_GET_ACT_NAME(actd) "(no DEBUG; act name unavailable)"
59 #define DEBUG_SV_GET_VAR_NAME(svd) "(no DEBUG; var name unavailable)"
60 #define DEBUG_SV_GET_TYPE_NAME(svd) "(no DEBUG; type name unavailable)"
61 #define DEBUG_SV_GET_VALUE_REPR(svd, sv) "(no DEBUG; value unavailable)"
62 
63 #endif /* ifdef DEBUG */
64 
65 #ifndef DEBUG_TRACE
66 #define DEBUG_TRACE(...) \
67  do { \
68  } while (0)
69 #endif
70 
71 #ifndef DEBUG_PRINT
72 #define DEBUG_PRINT(...) \
73  do { \
74  } while (0)
75 #endif
76 
77 #ifndef DEBUG_ASSERT
78 #define DEBUG_ASSERT(assertion, ...) \
79  do { \
80  } while (0)
81 #endif
82 
83 #endif /* ifndef _SSM_DEBUG_H */
A variable that may have scheduled updates and triggers.
Definition: ssm.h:206