hedgewars/uConsole.pas
branchhedgeroid
changeset 5460 c33b4daa4ce4
parent 5286 22c1f4833a86
child 5661 45618bdce725
equal deleted inserted replaced
5458:c3d01ba3ba3c 5460:c33b4daa4ce4
    24 procedure initModule;
    24 procedure initModule;
    25 procedure freeModule;
    25 procedure freeModule;
    26 procedure WriteToConsole(s: shortstring);
    26 procedure WriteToConsole(s: shortstring);
    27 procedure WriteLnToConsole(s: shortstring);
    27 procedure WriteLnToConsole(s: shortstring);
    28 function  GetLastConsoleLine: shortstring;
    28 function  GetLastConsoleLine: shortstring;
    29 function ShortStringAsPChar(var s: shortstring): PChar;
    29 function ShortStringAsPChar(s: shortstring): PChar;
    30 
    30 
    31 implementation
    31 implementation
    32 uses Types, uVariables, uUtils {$IFDEF ANDROID}, log in 'log.pas'{$ENDIF};
    32 uses Types, uVariables, uUtils {$IFDEF ANDROID}, log in 'log.pas'{$ENDIF};
    33 
    33 
    34 const cLineWidth: LongInt = 0;
    34 const cLineWidth: LongInt = 0;
    52 var Len: LongInt;
    52 var Len: LongInt;
    53     done: boolean;
    53     done: boolean;
    54 begin
    54 begin
    55 {$IFNDEF NOCONSOLE}
    55 {$IFNDEF NOCONSOLE}
    56  {$IFDEF ANDROID}
    56  {$IFDEF ANDROID}
    57   Log.__android_log_write(Log.Android_LOG_DEBUG, 'HW_Engine', ShortStringAsPChar(s));
    57   Log.__android_log_write(Log.Android_LOG_DEBUG, 'HW_Engine', ShortStringAsPChar('[Con]' + s));
    58 {$ELSE}
    58 {$ELSE}
    59 AddFileLog('[Con] ' + s);
    59 AddFileLog('[Con] ' + s);
    60 Write(stderr, s);
    60 Write(stderr, s);
    61 done:= false;
    61 done:= false;
    62 
    62 
   123 procedure freeModule;
   123 procedure freeModule;
   124 begin
   124 begin
   125 
   125 
   126 end;
   126 end;
   127 
   127 
   128 Function ShortStringAsPChar(var S: ShortString) : PChar;
   128 Function ShortStringAsPChar(S: ShortString) : PChar;
   129 Var NewString : String;
   129 Var NewString : String;
   130 Begin
   130 Begin
   131 if Length(S) = High(S) then Dec(S[0]);
   131 if Length(S) = High(S) then Dec(S[0]);
   132 s[Ord(Length(s))+1] := #0;
   132 s[Ord(Length(s))+1] := #0;
   133 Result := @S[1];
   133 Result := @S[1];