Assert 过程原形
[code]procedure Assert (expr :Boolean [; const msg: string]);[/code]
在system.pas 里 Assert 的实现是:
procedure _Assert(const Message, Filename: AnsiString; LineNumber: Integer);
{$IFDEF PUREPASCAL}
begin
if Assigned(AssertErrorProc) then
AssertErrorProc(Message, Filename, LineNumber, Pointer(-1))
else
Error(reAssertionFailed); // loses return address
end;
{$ELSE}
asm
PUSH EBX
{$IFDEF PIC}
PUSH EAX
PUSH ECX
CALL GetGOT
MOV EBX, EAX
MOV EAX, [EBX].AssertErrorProc
CMP [EAX], 0
POP ECX
POP EAX
{$ELSE}
CMP AssertErrorProc,0
{$ENDIF}
JNZ @@1
MOV AL,reAssertionFailed
CALL Error
JMP @@exit
@@1: PUSH [ESP+4].Pointer
{$IFDE