编译开关,预编译,输出调试信息

//编译开关,预编译
//1、异常时输出调试信息
{$IFDEF DEBUG}
  OUTPUTDEBUGSTRINGW(PChar('发送请求:' + inttostr(APIIndex) + '--' + ReqID));  //2、输出调试信息
{$ENDIF}
//3、debug模式下输出异常
  try
  Except
  {$IFDEF DEBUG}
  OUTPUTDEBUGSTRINGW(PChar('异常: 发生在Next '));
  {$ENDIF}
  end;
  //4、自定义
    {$IFDEF ADDebug}
  FDebugId := InterlockedIncrement(DebugId);
  outputdebugstring(PChar(Format('Create %s (%d)', [Classname, FDebugId])));
  {$ENDIF}
 //5、 一个函数
{$IFDEF ADDebug}
destructor TXmlNameTable.Destroy;
begin
  outputdebugstring(PChar(Format('Destroy %s (%d)', [Classname, FDebugId])));
  inherited;
end;
{$ENDIF}
//6、深层条件编译
{$IF CompilerVersion>=18}{$DEFINE Regions}{$IFEND}
{$IFDEF Regions}{$REGION 'Constantes Declaration'}{$ENDIF}
const
  BinXmlSignatureSize = Length('< binary-xml >');
  BinXmlSignature: AnsiString = '< binary-xml >';
  AnsiCodepage = CP_ACP;  // set CP_UTF8 if you want to use UTF8-encoded AnsiStrings
  XSTR_NULL = '{{null}}';
  SourceBufferSize=$4000;
{$IFDEF Regions}{$ENDREGION}{$ENDIF}
{$IFDEF Regions}{$REGION 'Globle Variables'}{$ENDIF}
var
  DefaultPreserveWhiteSpace: Boolean = False;
  DefaultIndentText: TXmlString = #9;
  XMLPathDelimiter: TXmlString = '\';
  {$if not Defined(XML_WIDE_CHARS) and not Defined(Unicode)}
  XMLCodepage: Word = AnsiCodepage;  //Codepage used for TXmlString
  {$ifend}
{$IFDEF Regions}{$ENDREGION}{$ENDIF}

 

posted @ 2016-08-11 09:15  海蓝7  阅读(489)  评论(0)    收藏  举报