2 * @brief General purpose macros.
11 extern FILE *model_out;
13 #define model_print(fmt, ...) do { fprintf(model_out, fmt, ##__VA_ARGS__); } while (0)
16 #define DEBUG(fmt, ...) do { model_print("*** %25s(): line %-4d *** " fmt, __func__, __LINE__, ##__VA_ARGS__); } while (0)
17 #define DBG() DEBUG("\n")
18 #define DBG_ENABLED() (1)
20 #define DEBUG(fmt, ...)
22 #define DBG_ENABLED() (0)
25 void assert_hook(void);
28 #define ASSERT(expr) \
31 fprintf(stderr, "Error: assertion failed in %s at line %d\n", __FILE__, __LINE__); \
33 model_print_summary(); \
39 #define ASSERT(expr) \
41 #endif /* CONFIG_ASSERT */
43 #define error_msg(...) fprintf(stderr, "Error: " __VA_ARGS__)
45 void print_trace(void);
46 void model_print_summary(void);
47 #endif /* __COMMON_H__ */