|
40 | 40 |
|
41 | 41 | namespace ojph { |
42 | 42 |
|
43 | | - /////////////////////////////////////////////////////////////////////////// |
| 43 | + //////////////////////////////////////////////////////////////////////////// |
44 | 44 | void set_error_stream(FILE *s); |
45 | 45 |
|
46 | | - /////////////////////////////////////////////////////////////////////////// |
47 | | - void set_output_stream(FILE *s); |
| 46 | + //////////////////////////////////////////////////////////////////////////// |
| 47 | + void set_warning_stream(FILE *s); |
48 | 48 |
|
49 | | - /////////////////////////////////////////////////////////////////////////// |
50 | | - void error(int error_code, const char* file_name, int line_num); |
| 49 | + //////////////////////////////////////////////////////////////////////////// |
| 50 | + void warn(int warn_code, const char* file_name, int line_num, |
| 51 | + const char *fmt, ...) |
| 52 | + #ifdef OJPH_COMPILER_GNUC |
| 53 | + __attribute__((format(printf, 4, 5))) |
| 54 | + #endif |
| 55 | + ; |
51 | 56 |
|
| 57 | + //////////////////////////////////////////////////////////////////////////// |
| 58 | + void error(int error_code, const char* file_name, int line_num, |
| 59 | + const char *fmt, ...) |
| 60 | + #ifdef OJPH_COMPILER_GNUC |
| 61 | + __attribute__((format(printf, 4, 5))) |
| 62 | + #endif |
| 63 | + ; |
52 | 64 | } |
53 | 65 |
|
| 66 | +////////////////////////////////////////////////////////////////////////////// |
| 67 | +#if (defined OJPH_OS_WINDOWS) |
| 68 | + #define __OJPHFILE__ \ |
| 69 | + (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) |
| 70 | +#else |
| 71 | + #define __OJPHFILE__ \ |
| 72 | + (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) |
| 73 | +#endif |
| 74 | +////////////////////////////////////////////////////////////////////////////// |
| 75 | +#define OJPH_WARN(t, ...) ojph::warn(t, __OJPHFILE__, __LINE__, __VA_ARGS__); |
| 76 | +////////////////////////////////////////////////////////////////////////////// |
| 77 | +#define OJPH_ERROR(t, ...) ojph::error(t, __OJPHFILE__, __LINE__,__VA_ARGS__); |
| 78 | + |
| 79 | + |
54 | 80 | #endif // !OJPH_MESSAGE_H |
0 commit comments