00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef COM_H
00014 #define COM_H
00015
00016
00017 #include <iostream>
00018 #include <fstream>
00019 #include <netinet/in.h>
00020
00021
00022 typedef int BOOLEAN;
00023 #ifndef TRUE
00024 #define TRUE 1
00025 #endif
00026 #ifndef FALSE
00027 #define FALSE 0
00028 #endif
00029 typedef char *STRING;
00030 typedef unsigned char UCHAR;
00031 typedef signed char SCHAR;
00032
00033
00034 #if defined(__LP64__) || defined(__64BIT__)
00035 typedef unsigned int ULONG;
00036 typedef signed int LONG;
00037 #else
00038 typedef unsigned long int ULONG;
00039 typedef signed long int LONG;
00040 #endif
00041 typedef unsigned short int USHORT;
00042 typedef signed short int SHORT;
00043 typedef signed long long int LONG_LONG;
00044 typedef unsigned long long int LONG_ULONG;
00045 typedef float FLOAT;
00046 typedef double DOUBLE;
00047 typedef long double LDOUBLE;
00048
00049 typedef LONG_LONG TIME_T;
00050
00051
00052
00053
00054
00055
00056
00057 #ifndef MIN
00058 #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
00059 #endif
00060
00061 #ifndef MAX
00062 #define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
00063 #endif
00064
00065 #ifndef ABS
00066 #define ABS(X) ((X) < 0 ? -(X) : (X))
00067 #endif
00068
00069 #ifndef INRANGE
00070 #define INRANGE(X,Y,Z) ((X) >= (Y) && (X) <= (Z))
00071 #endif
00072
00073
00074 enum MSG_LEV_ {SEV_T,SEV_S,SEV_E,SEV_W,SEV_I,NOID,FLUSH,STATS,SEV_1,SEV_2,SEV_3,SEV_4,SEV_5};
00075
00076
00077 extern LONG COM_RC;
00078 extern LONG COM_SRC;
00079 extern LONG COM_ABORT_RC;
00080 extern LONG COM_DBGLEV;
00081 extern LONG COM_MSGFLUSH;
00082
00083
00084 #define TRACEID(FNAME,TRACELEV)\
00085 LONG SRC = 0;\
00086 const char* FUNCNAME = FNAME;\
00087 MSG(TRACELEV,("entering ..."));
00088
00089 #define MSGSTR com_msgstr
00090
00091
00092 #define MSG(SEVLEV,PRINTFARG) \
00093 if (SEVLEV-6 <= COM_DBGLEV) \
00094 com_msg(SEVLEV,(const char*)FUNCNAME,&SRC,(const char*)com_msgstr PRINTFARG);
00095
00096
00097
00098 LONG com_abortrc(STRING);
00099 LONG com_debuglevel(STRING);
00100 void com_msg(MSG_LEV_, const char*, LONG *, const char*);
00101 const char* com_msgstr(const char*,...);
00102
00103 #endif