📄 trace.h
字号:
#pragma option push -b -a8 -pc -A- /*P_O_Push*/
/* trace.h */
/*
* (C) Copyright Microsoft Corporation 1991-1993.
* All Rights Reserved.
*/
#if (defined(WIN32_SUPPORT) || defined(MSWIN_SUPPORT))
#ifndef DONT_INCLUDE_MEMORY_H
#include <memory.h>
#endif
#endif
#ifdef ASYNCTRACE
#include <dbgtrace.h>
#endif
#ifdef WIN32_SUPPORT
#define sepudcpy(X,Y,Z) memcpy(X,Y,Z)
#endif
#ifdef DOS_SUPPORT
extern int _cdecl far com_sprintf( char far *, const char far *, ... );
#define SPRINTF(x) com_sprintf x;
#else
#if (defined(WIN32_SUPPORT) || defined(MSWIN_SUPPORT))
/***************************************************************************/
/* Temporary for Win32: in Win32 DLLs in PDK2, sprintf is not available: */
/* use wsprintf instead. */
/***************************************************************************/
#define SPRINTF(x) wsprintf x;
#else
#define SPRINTF(x) sprintf x;
#endif
#endif
/*****************************************************************************/
/* Comm Server Critical Section macros. */
/*****************************************************************************/
#ifdef WIN32_SUPPORT
typedef struct cscritsec
{
BOOL Inited;
CRITICAL_SECTION CritSec;
} CSCRITSEC;
#define CSENTERCRITSEC(x) if (!((x)->Inited)) \
{ \
InitializeCriticalSection(&((x)->CritSec)); \
(x)->Inited = TRUE; \
} \
EnterCriticalSection(&((x)->CritSec))
#define CSEXITCRITSEC(x) LeaveCriticalSection(&((x)->CritSec))
#define CSLEAVECRITSEC(x) LeaveCriticalSection(&((x)->CritSec))
#endif
/*****************************************************************************/
/* Global flags and variables */
/*****************************************************************************/
#ifdef MSWIN_SUPPORT
#define com_str com_logstr
#endif
#ifdef WIN32_SUPPORT
extern CSCRITSEC crit_comlog;
extern CSCRITSEC crit_dlbtrc;
extern CSCRITSEC crit_dlblog;
extern UCHAR com_str[256];
extern UCHAR com_logstr[256];
#else
#ifndef MSWIN_SUPPORT
extern ULONG pascal com_trcsem;
extern ULONG pascal com_logsem;
extern ULONG pascal dlb_logsem;
extern ULONG pascal dlb_trcsem;
extern UCHAR pascal com_str[256];
#endif
#endif
#ifndef WIN32_SUPPORT
extern UCHAR pascal com_logstr[256];
#endif
/*****************************************************************************/
/* TRACEn macro definitions */
/*****************************************************************************/
#ifdef NOTRC
#define TRCLVL 20
#else
# ifndef TRCLVL
#define TRCLVL 0
# endif
#endif
#ifdef WIN32_SUPPORT /*NTRC*/
#if (!defined(ASYNCTRACE) || defined(NOTRC) )
#if TRCLVL < 3 /*NTRC*/
#define TRACE2() TRACEX(2,(com_mod, (const UCHAR *) /*NTRC*/
#else /*NTRC*/
#define TRACE2() TRACEZ(( /*NTRC*/
#endif /*NTRC*/
#if TRCLVL < 5 /*NTRC*/
#define TRACE4() TRACEX(4,(com_mod, (const UCHAR *) /*NTRC*/
#else /*NTRC*/
#define TRACE4() TRACEZ(( /*NTRC*/
#endif /*NTRC*/
#if TRCLVL < 7 /*NTRC*/
#define TRACE6() TRACEX(6,(com_mod, (const UCHAR *) /*NTRC*/
#else /*NTRC*/
#define TRACE6() TRACEZ(( /*NTRC*/
#endif /*NTRC*/
#if TRCLVL < 9 /*NTRC*/
#define TRACE8() TRACEX(8,(com_mod, (const UCHAR *) /*NTRC*/
#else /*NTRC*/
#define TRACE8() TRACEZ(( /*NTRC*/
#endif /*NTRC*/
#if TRCLVL < 11 /*NTRC*/
#define TRACE10() TRACEX(10,(com_mod, (const UCHAR *) /*NTRC*/
#else /*NTRC*/
#define TRACE10() TRACEZ(( /*NTRC*/
#endif /*NTRC*/
#if TRCLVL < 13 /*NTRC*/
#define TRACE12() TRACEX(12,(com_mod, (const UCHAR *) /*NTRC*/
#else /*NTRC*/
#define TRACE12() TRACEZ(( /*NTRC*/
#endif /*NTRC*/
#if TRCLVL < 17 /*NTRC*/
#define TRACE16() TRACEX(16,(com_mod, (const UCHAR *) /*NTRC*/
#else /*NTRC*/
#define TRACE16() TRACEZ(( /*NTRC*/
#endif /*NTRC*/
#else
#define TRACE2() DEBUGTRACEX(((long)NULL, (const char *)
#define TRACE4() DEBUGTRACEX(((long)NULL, (const char *)
#define TRACE6() ERRORTRACEX(((long)NULL, (const char *)
#define TRACE8() ERRORTRACEX(((long)NULL, (const char *)
#define TRACE10() ERRORTRACEX(((long)NULL, (const char *)
#define TRACE12() FATALTRACEX(((long)NULL, (const char *)
#define TRACE16() FATALTRACEX(((long)NULL, (const char *)
#define DEBUGTRACEX(x) DebugTrace x
#define ERRORTRACEX(x) ErrorTrace x
#define FATALTRACEX(x) FatalTrace x
#define TRACET(y) \
if (y >= ptrc->intlvl) { SYSTEMTIME st; \
GetSystemTime(&st); \
SPRINTF((Time_Msg,"Time %2.2hu:%2.2hu.%2.2hu", \
st.wMinute, \
st.wSecond, \
(st.wMilliseconds/10))); \
DebugTrace(NULL, Time_Msg); \
}
#define COM_ENTRY(x) DWORD rc = 0; \
DWORD rc2 = 0; \
TraceQuietEnter(x)
#endif
#else /*NTRC*/
#if TRCLVL < 3
#define TRACE2() TRACEX(2,(com_str,
#else /*NTRC*/
#define TRACE2() TRACEZ((
#endif
#if TRCLVL < 5
#define TRACE4() TRACEX(4,(com_str,
#else
#define TRACE4() TRACEZ((
#endif
#if TRCLVL < 7
#define TRACE6() TRACEX(6,(com_str,
#else
#define TRACE6() TRACEZ((
#endif
#if TRCLVL < 9
#define TRACE8() TRACEX(8,(com_str,
#else
#define TRACE8() TRACEZ((
#endif
#if TRCLVL < 11
#define TRACE10() TRACEX(10,(com_str,
#else
#define TRACE10() TRACEZ((
#endif
#if TRCLVL < 13
#define TRACE12() TRACEX(12,(com_str,
#else
#define TRACE12() TRACEZ((
#endif
#if TRCLVL < 17
#define TRACE16() TRACEX(16,(com_str,
#else
#define TRACE16() TRACEZ((
#endif
#endif /*NTRC*/
#if TRCLVL < 20
#ifdef DOS_SUPPORT
#define TRACEX(w,x) \
if (ptrc && (w >= ptrc->intlvl)) { \
if (ptrc->nocat) \
CMDSemRequest(&com_trcsem,10000); \
SPRINTF(x); \
seputrc(w,com_mod); \
}
#else
#ifdef MSWIN_SUPPORT
#define TRACEX(w,x) \
if (ptrc && (w >= ptrc->intlvl)) { \
SPRINTF(x); \
seputrc(w,com_mod,ptrc, com_str); \
}
#else
#ifdef WIN32_SUPPORT
#define TRACEX(w,x) if (w >= ptrc->intlvl) InternalTrace x; /*NTRC*/
#else
#define TRACEX(w,x) \
if (ptrc && (w >= ptrc->intlvl)) { \
DosSemRequest(&dlb_trcsem,10000L); \
SPRINTF(x); \
seputrc_w(com_str,w,com_mod); \
DosSemClear(&dlb_trcsem); \
}
#endif
#endif
#endif
#else
#define TRACEX(w,x)
#endif
#define TRACEZ(x)
#if TRCLVL < 20
#ifdef DOS_SUPPORT
#define COM_ENTRY(x) UCHAR com_mod[6]; \
sepudcpy(com_mod,x,6)
#else
#ifdef WIN32_SUPPORT
#ifndef ASYNCTRACE
#define COM_ENTRY(x) DWORD rc = 0; \
DWORD rc2 = 0; \
UCHAR com_mod[6]; \
sepudcpy(com_mod,x,6)
#else
#define COM_ENTRY(x) DWORD rc = 0; \
DWORD rc2 = 0; \
TraceQuietEnter(x)
#endif
#else
#define COM_ENTRY(x) USHORT rc = 0; \
UCHAR com_mod[6]; \
sepudcpy(com_mod,x,6)
#endif
#endif
#else
#ifdef DOS_SUPPORT
#define COM_ENTRY(x)
#else
#ifdef WIN32_SUPPORT
#ifndef ASYNCTRACE
#define COM_ENTRY(x) DWORD rc = 0; DWORD rc2=0
#else
#define COM_ENTRY(x) DWORD rc = 0; \
DWORD rc2 = 0; \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -