Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef StreamError_h
00021 #define StreamError_h
00022
00023 #include <stdio.h>
00024 #include <stdarg.h>
00025
00026 #ifndef __GNUC__
00027 #define __attribute__(x)
00028 #endif
00029
00030 extern int streamDebug;
00031 extern void (*StreamPrintTimestampFunction)(char* buffer, int size);
00032
00033 void StreamError(int line, const char* file, const char* fmt, ...)
00034 __attribute__ ((format(printf,3,4)));
00035
00036 void StreamVError(int line, const char* file, const char* fmt, va_list args)
00037 __attribute__ ((format(printf,3,0)));
00038
00039 void StreamError(const char* fmt, ...)
00040 __attribute__ ((format(printf,1,2)));
00041
00042 inline void StreamVError(const char* fmt, va_list args)
00043 {
00044 StreamVError(0, NULL, fmt, args);
00045 }
00046
00047 class StreamDebugClass
00048 {
00049 const char* file;
00050 int line;
00051 public:
00052 StreamDebugClass(const char* file, int line) :
00053 file(file), line(line) {}
00054 int print(const char* fmt, ...)
00055 __attribute__ ((format(printf,2,3)));
00056 };
00057
00058 inline StreamDebugClass
00059 StreamDebugObject(const char* file, int line)
00060 { return StreamDebugClass(file, line); }
00061
00062 #define error StreamError
00063 #define debug (!streamDebug)?0:StreamDebugObject(__FILE__,__LINE__).print
00064
00065 #if (__GNUC__ == 2 && __GNUC_MINOR__ == 7)
00066
00067 #define NO_TEMPORARY
00068 #endif
00069
00070 #endif