{*******************************************************}
{                                                       }
{       Pascal Script Source File                       }
{       Run by RemObjects Pascal Script in CnWizards    }
{                                                       }
{       Generated by CnPack IDE Wizards                 }
{                                                       }
{*******************************************************}

// 注意尽量调用 Trace 系列方法，以防 Log 系列方法因未定义 DEBUG 而禁用

program CnDebugDemo;

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  CnDebug;

function Calc(N: Integer): Integer;
begin
  CnDebugger.TraceEnter('Calc', '');
  if N > 0 then
    Result := N * Calc(N - 1)
  else
    Result := 1;
  CnDebugger.TraceInteger(Result, 'Result');
  CnDebugger.TraceLeave('Calc', '');
end;

var
  I: Integer;

begin
  CnDebugger.StartDebugViewer;
  
  CnDebugger.TraceMsg('CnDebugDemo');
  Calc(6);

  CnDebugger.StartTimeMark(1, 'loop');
  for I := 1 to 10000 do
    ;
  CnDebugger.StopTimeMark(1, 'loop');

  CnDebugger.TraceObject(Application.MainForm);
  
  CnDebugger.EvaluateControlUnderPos(Mouse.CursorPos);
end.
 
