Files
envi-code/SourceCode/Code2026/inc/AecDebug.h
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

45 lines
1.2 KiB
C

#if !defined(__AECDEBUG_H__)
#define __AECDEBUG_H__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
void _cdecl AecTrace(const TCHAR* lpszFormat, ...);
#ifdef _DEBUG
#define AecTrace ::AecTrace
#define AECASSERT(f) assert(f)
#ifndef _WINBASE_
//extracted from winbase.h so that we don't have to pull in the whole header
extern "C" void _stdcall OutputDebugStringA(const TCHAR* lpOutputString);
extern "C" void _stdcall OutputDebugStringW(const unsigned short* lpOutputString);
#ifdef UNICODE
#define OutputDebugString OutputDebugStringW
#else
#define OutputDebugString OutputDebugStringA
#endif // !UNICODE
#endif //_WINBASE
// determine number of elements in an array (not bytes)
#define _count_of(array) (sizeof(array)/sizeof(array[0]))
inline void _cdecl AecTrace(LPCTSTR lpszFormat, ...)
{
va_list args;
va_start(args, lpszFormat);
int nBuf;
TCHAR szBuffer[512];
nBuf = _vsntprintf(szBuffer, _count_of(szBuffer), lpszFormat, args);
// was there an error?
AECASSERT(nBuf >= 0);
::OutputDebugString(szBuffer);
va_end(args);
}
#else
#define AecTrace 1?(void)0: ::AecTrace
#define AECASSERT(f) ((void)0)
#endif // _DEBUG
#endif // __AECACAD_H__