home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vgserv45.zip / BASE / HPTWGS2 / include / fcwtrace.h < prev    next >
C/C++ Source or Header  |  2001-03-21  |  5KB  |  142 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /*                           OCO SOURCE MATERIALS                            */
  4. /*                             IBM CONFIDENTIAL                              */
  5. /*                                    OR                                     */
  6. /*                        IBM CONFIDENTIAL RESTRICTED                        */
  7. /*            WHEN COMBINED WITH THE AGGREGATED OCO SOURCE MODULES           */
  8. /*                           FOR THIS PROGRAM PRODUCT                        */
  9. /*                                                                           */
  10. /*   VisualAge Generator Server for OS/2, AIX, HP-UX, SUN, and Windows NT    */
  11. /*                          Version 4.0  5697-C28                            */
  12. /*                    (C) COPYRIGHT IBM CORP. 1994,1998                      */
  13. /*                                                                           */
  14. /*****************************************************************************/
  15. /*****************************************************************************/
  16. /*                                                                           */
  17. /*    Date     Userid          Description of problem                        */
  18. /*                                                                           */
  19. /*  08/19/98   proffer         4070    -  Add support for Sun                */
  20. /*                                                                           */
  21. /*****************************************************************************/
  22. #ifndef FCWTRACE_H
  23. #  define FCWTRACE_H
  24.  
  25. #if defined FCW_NT
  26. #include <wtypes.h>
  27.  
  28. #elif defined FCW_UNIX
  29. #include <fcntl.h>
  30. #endif
  31.  
  32. #define BUFINIT       0
  33. #define BUFINCOMPLETE 1
  34.  
  35. /*-------------------------------------------------------------------------*/
  36. /* TraceFile class                                                         */
  37. /*-------------------------------------------------------------------------*/
  38. class TraceFile
  39. {
  40.   public:
  41.  
  42.     TraceFile();
  43.     ~TraceFile();
  44.  
  45.     TraceFile& operator << (const char);
  46.     TraceFile& operator << (const char*);
  47.     TraceFile& operator << (const long);
  48.     TraceFile& operator << (const float);
  49.     TraceFile& operator << (TraceFile& (*f)(TraceFile&));
  50.     TraceFile& operator << (TraceFile& (*f)(TraceFile&, long));
  51.  
  52.     void       FormatDump  (const long len=0);
  53.     void       SetAppName  ( char* name );               // *ODBC*
  54.  
  55.     friend TraceFile& hexT (TraceFile& tf);
  56.  
  57.     int                IsOn();                          // general trace *ODBC*
  58.     int                OdbcOn();                        // internal ODBC trace
  59.  
  60.   private:
  61.  
  62.     enum             { prcTrace=1,  callTrace=2,  sqlTrace=4, fileTrace=8,
  63.                        sysTrace=16, timeTrace=32, DsTrace=64, odbcTrace=128,
  64.                        aixTrace=256 };
  65.     int      traceOption;                                // *ODBC*
  66.     char     appName[9];                                 // *ODBC*
  67.  
  68. #if defined FCW_OS2
  69.     FILELOCK    filelock;
  70.     int         hFile;
  71.  
  72. #elif defined FCW_NT
  73.     HANDLE       hFile;
  74.  
  75. #elif defined FCW_UNIX
  76.     struct flock filelock;
  77.     int         hFile;
  78. #endif
  79.  
  80.     Bool         bOpen;
  81.     Bool         bFileLock;
  82.  
  83.     Bool         bHexFormat;
  84.     Bool         bDumpFormat;
  85.     Bool         bWithinDump;
  86.     int          DumpLen;
  87.  
  88.     void         Hold();
  89.     void         Release();
  90.  
  91.     void         *pImpData;                        // implementation data
  92.  
  93.     char         traceBuffer[255];
  94.     int          hkWord;
  95.     char*        bufPtr;
  96.     char*        curBufPtr;
  97.     int          bufLen;
  98.     int          sLen;
  99.     int          bufStatus;
  100.  
  101.  
  102. };
  103.  
  104. TraceFile& EXPORT endT (TraceFile& tf);
  105.  
  106. TraceFile& EXPORT hexT (TraceFile& tf);
  107.  
  108. TraceFile* EXPORT GetTraceFile();
  109.  
  110.  
  111. /*-------------------------------------------------------------------------*/
  112. /* File locking flags                                                      */
  113. /*-------------------------------------------------------------------------*/
  114. #define FILELOCK_ATOMIC 0x0000000000000002
  115. #define FILELOCK_SHARE  0x0000000000000001
  116.  
  117. //extern int TRACEOPTIONS;
  118. //extern TraceFile* PTRACEFILE;
  119.  
  120. //#define Trace *PTRACEFILE
  121.  
  122. /*-------------------------------------------------------------------------*/
  123. /*  Define tracing options flags here...                                   */
  124. /*-------------------------------------------------------------------------*/
  125. //#define VGTRACE_XXX 0x00000000
  126. //#define VGTRACE_YYY 0x00000001
  127.  
  128. //inline
  129. //int isVgTraceOn()
  130. //{
  131. //  return TRACEOPTIONS;
  132. //}
  133.  
  134. //inline
  135. //int isVgTraceXXX()
  136. //{
  137. //  return TRACEOPTIONS & VGTRACE_XXX;
  138. //}
  139.  
  140.  
  141. #endif
  142.