clibs
Tiny but handy utility libraries for C
print.h
Go to the documentation of this file.
1 
8 #ifndef CLIBS_PRINT_H
9 #define CLIBS_PRINT_H
10 
11 #ifdef __cplusplus
12  #include <cstdio>
13 #else
14  #include <stdio.h>
15 #endif
16 
17 #ifndef END_OF_LINE
18  #define END_OF_LINE "\n"
19 #endif
20 
27 #ifndef PRINT
28  #define PRINT(format, ...) { \
29  fprintf(stdout, format, ##__VA_ARGS__); \
30  }
31 #endif
32 
38 #ifndef PERROR
39  #define PERROR(format, ...) { \
40  fprintf(stderr, format, ##__VA_ARGS__); \
41  }
42 #endif
43 
49 #ifndef PUTS
50  #define PUTS(format, ...) { \
51  fprintf(stdout, format "%s", ##__VA_ARGS__, END_OF_LINE); \
52  }
53 #endif
54 
60 #ifndef PUTERR
61  #define PUTERR(format, ...) { \
62  fprintf(stderr, format "%s", ##__VA_ARGS__, END_OF_LINE); \
63  }
64 #endif
65 
73 #ifndef DEBUG_INFO
74  #define DEBUG_INFO(format, ...) { \
75  fprintf(stderr, "(%s:%d) " format "%s", \
76  __FILE__, __LINE__, ##__VA_ARGS__, END_OF_LINE); \
77  }
78 #endif
79 
80 #endif /* CLIBS_PRINT_H */