hedgewars/uConsole.pas
changeset 10490 b30b8d39d662
parent 10108 c68cf030eded
child 11046 47a8c19ecb60
equal deleted inserted replaced
10489:bde3e43d7b27 10490:b30b8d39d662
    22 interface
    22 interface
    23 
    23 
    24 
    24 
    25 procedure WriteToConsole(s: shortstring);
    25 procedure WriteToConsole(s: shortstring);
    26 procedure WriteLnToConsole(s: shortstring);
    26 procedure WriteLnToConsole(s: shortstring);
    27 function  ShortStringAsPChar(s: shortstring): PChar;
       
    28 
    27 
    29 var lastConsoleline : shortstring;
    28 var lastConsoleline : shortstring;
    30 
    29 
    31 implementation
    30 implementation
    32 uses Types, uUtils {$IFDEF ANDROID}, log in 'log.pas'{$ENDIF};
    31 uses Types, uUtils {$IFDEF ANDROID}, log in 'log.pas'{$ENDIF};
    53     WriteLn(stderr, '');
    52     WriteLn(stderr, '');
    54 {$ENDIF}
    53 {$ENDIF}
    55 {$ENDIF}
    54 {$ENDIF}
    56     lastConsoleline:= s;
    55     lastConsoleline:= s;
    57 end;
    56 end;
    58 
    57 {$IFDEF ANDROID}
    59 function ShortStringAsPChar(s: shortstring) : PChar;
    58 function ShortStringAsPChar(s: shortstring) : PChar;
    60 begin
    59 begin
    61     if Length(s) = High(s) then
    60     if Length(s) = High(s) then
    62         Dec(s[0]);
    61         Dec(s[0]);
    63     s[Ord(Length(s))+1] := #0;
    62     s[Ord(Length(s))+1] := #0;
       
    63     // returning pointer to stack, rly?
    64     ShortStringAsPChar:= @s[1];
    64     ShortStringAsPChar:= @s[1];
    65 end;
    65 end;
    66 
    66 {$ENDIF}
    67 
    67 
    68 end.
    68 end.