Wikia

Delphi Programming

Assert

2,918pages on
this wiki
Talk0
in "Option|Project|Directories/Conditionals"
in "Conditional": DEBUG
interface
{$ifDEF DEBUG} {$D+} {$else} {$D-} {$endIF}
procedure...
begin
..
  {$ifOPT D+}Assert(n>1, 'n>1');{$endIF}
..
end;
PROCEDURE Assert(Cond: boolean; const Msg: string);
var
  progSeg,
  progOfs: word;
begin
  asm
      mov ax, [bp+04]            
      mov es, ax
      mov ax, word ptr es:0      
      mov progSeg, ax            
      mov ax, [bp+02]
      mov progOfs, ax            
  end;

  if (Cond = FALSE) then begin
    mmDebug.Lines.Add(Msg + ' at location ' +
                              IntToHex(progSeg, 4) +':' +IntToHex(progOfs, 4) );
    ShowModal;
  end;
end;

--NNN nmanca 20:10, 13 August 2008 (UTC)

Around Wikia's network

Random Wiki