hostmsg.h
Go to the documentation of this file.
1 
20 #pragma once
21 
22 #include <stddef.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 void host_printf(const char* fmt, ...);
29 void host_printfp(const char* fmt, const char* pretty_function, ...);
30 size_t host_nputs(const char* str, size_t length);
31 void host_puts(const char* str);
32 
33 #ifdef __cplusplus
34 #define hostmsg(fmt, ...) host_printfp(fmt "\n", __PRETTY_FUNCTION__, ##__VA_ARGS__)
35 #else
36 #define hostmsg(fmt, ...) host_printfp(fmt "\n", __func__, ##__VA_ARGS__)
37 #endif
38 
42 #define host_debug(level, fmt, ...) \
43  do { \
44  if(host_debug_level >= (level)) { \
45  host_printf(fmt "\n", ##__VA_ARGS__); \
46  } \
47  } while(0)
48 
49 #define host_debug_e(fmt, ...) host_debug(0, "Error! " fmt, ##__VA_ARGS__)
50 #define host_debug_w(fmt, ...) host_debug(1, "Warning! " fmt, ##__VA_ARGS__)
51 #define host_debug_i(fmt, ...) host_debug(2, fmt, ##__VA_ARGS__)
52 
53 extern int host_debug_level;
54 
55 #ifdef __cplusplus
56 }
57 #endif
void host_printf(const char *fmt,...)
void host_printfp(const char *fmt, const char *pretty_function,...)
int host_debug_level
void host_puts(const char *str)
size_t host_nputs(const char *str, size_t length)
#define str(s)
Definition: testrunner.h:124