Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

stilcom.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright (c) 2006 International Business Machines Corporation
00003  * All rights reserved. This program and the accompanying materials
00004  * are made available under the terms of the Common Public License v1.0
00005  * which accompanies this distribution, and is available at
00006  * http://www.opensource.org/licenses/cpl1.0.php
00007  *
00008  * Contributors:
00009  *    Douglas Sprague, Joel Wheeler - initial API and implementation
00010  *
00011  *****************************************************************************/
00012 
00013 #ifndef COM_H
00014 #define COM_H
00015 
00016 /*=== C Libraries ===========================================================*/
00017 #include <iostream>
00018 #include <fstream>
00019 #include <netinet/in.h>  // network byte order & host byte order routines
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 // if linux/gcc 64bit or AIX/xlC 64bit
00034 #if defined(__LP64__) || defined(__64BIT__)
00035 typedef unsigned int             ULONG;            // 64 bits
00036 typedef signed int               LONG;
00037 #else
00038 typedef unsigned long int        ULONG;            // 32 bits
00039 typedef signed long int          LONG;
00040 #endif
00041 typedef unsigned short int       USHORT;           // 16 bits
00042 typedef signed short int         SHORT;
00043 typedef signed long long int     LONG_LONG;        // 64 bits
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 /*=== Macros ================================================================*/
00052 
00053 //#ifdef _LARGE_FILES
00054 //#define fseek   fseeko
00055 //#endif
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 /* the types of messages                                                     */
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 /*=== Global Variables=======================================================*/
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 /* generate a severity level trace message                                   */
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 /* common message handler/formatter (-6 for the T,S,E,W,I,NOID & STATS msgs) */
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 /*=== Common Function Prototypes ============================================*/
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 /* COM_H */

This page last updated on 6 Jul 2007

SourceForge.net Logo