hedgewars/uDebug.pas
author igorko
Wed, 01 Dec 2010 20:43:35 +0300
changeset 4440 360268b56eac
parent 4403 0dfe26f48ec1
child 4900 8ad0e23e6d63
permissions -rw-r--r--
Translation update
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4403
unc0rr
parents:
diff changeset
     1
{$INCLUDE "options.inc"}
unc0rr
parents:
diff changeset
     2
unc0rr
parents:
diff changeset
     3
unit uDebug;
unc0rr
parents:
diff changeset
     4
unc0rr
parents:
diff changeset
     5
interface
unc0rr
parents:
diff changeset
     6
unc0rr
parents:
diff changeset
     7
procedure OutError(Msg: shortstring; isFatalError: boolean);
unc0rr
parents:
diff changeset
     8
procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline;
unc0rr
parents:
diff changeset
     9
procedure SDLTry(Assert: boolean; isFatal: boolean);
unc0rr
parents:
diff changeset
    10
unc0rr
parents:
diff changeset
    11
implementation
unc0rr
parents:
diff changeset
    12
uses SDLh, uConsole, uCommands;
unc0rr
parents:
diff changeset
    13
unc0rr
parents:
diff changeset
    14
procedure OutError(Msg: shortstring; isFatalError: boolean);
unc0rr
parents:
diff changeset
    15
begin
unc0rr
parents:
diff changeset
    16
WriteLnToConsole(Msg);
unc0rr
parents:
diff changeset
    17
if isFatalError then
unc0rr
parents:
diff changeset
    18
    begin
unc0rr
parents:
diff changeset
    19
    ParseCommand('fatal ' + GetLastConsoleLine, true);
unc0rr
parents:
diff changeset
    20
    SDL_Quit;
unc0rr
parents:
diff changeset
    21
    halt(1)
unc0rr
parents:
diff changeset
    22
    end
unc0rr
parents:
diff changeset
    23
end;
unc0rr
parents:
diff changeset
    24
unc0rr
parents:
diff changeset
    25
procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean);
unc0rr
parents:
diff changeset
    26
begin
unc0rr
parents:
diff changeset
    27
if not Assert then OutError(Msg, isFatal)
unc0rr
parents:
diff changeset
    28
end;
unc0rr
parents:
diff changeset
    29
unc0rr
parents:
diff changeset
    30
procedure SDLTry(Assert: boolean; isFatal: boolean);
unc0rr
parents:
diff changeset
    31
begin
unc0rr
parents:
diff changeset
    32
if not Assert then OutError(SDL_GetError, isFatal)
unc0rr
parents:
diff changeset
    33
end;
unc0rr
parents:
diff changeset
    34
unc0rr
parents:
diff changeset
    35
end.