hedgewars/uUtils.pas
changeset 8498 eecadca7db50
parent 8425 4f226963faef
child 8575 228fbb2a76a4
equal deleted inserted replaced
8497:c5605c6f5bb3 8498:eecadca7db50
    81 procedure stopLoadingIndicator; cdecl; external;
    81 procedure stopLoadingIndicator; cdecl; external;
    82 procedure saveFinishedSynching; cdecl; external;
    82 procedure saveFinishedSynching; cdecl; external;
    83 function  isApplePhone: Boolean; cdecl; external;
    83 function  isApplePhone: Boolean; cdecl; external;
    84 procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external;
    84 procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external;
    85 {$ENDIF}
    85 {$ENDIF}
       
    86 
       
    87 function  sanitizeForLog(s: shortstring): shortstring;
       
    88 function  sanitizeCharForLog(c: char): shortstring;
    86 
    89 
    87 procedure initModule(isNotPreview: boolean);
    90 procedure initModule(isNotPreview: boolean);
    88 procedure freeModule;
    91 procedure freeModule;
    89 
    92 
    90 
    93 
   439 {$ELSE}
   442 {$ELSE}
   440     getScreenDPI:= 1;
   443     getScreenDPI:= 1;
   441 {$ENDIF}
   444 {$ENDIF}
   442 end;
   445 end;
   443 
   446 
       
   447 function  sanitizeForLog(s: shortstring): shortstring;
       
   448 var i: byte;
       
   449     r: shortstring;
       
   450 begin
       
   451     r[0]:= s[0];
       
   452     for i:= 1 to length(s) do
       
   453         if (s[i] < #32) or (s[i] > #127) then
       
   454             r[i]:= '?'
       
   455             else
       
   456             r[i]:= s[i];
       
   457             
       
   458     sanitizeForLog:= r
       
   459 end;
       
   460 
       
   461 function  sanitizeCharForLog(c: char): shortstring;
       
   462 var r: shortstring;
       
   463 begin
       
   464     if (c < #32) or (c > #127) then
       
   465         r:= '#' + inttostr(byte(c))
       
   466         else
       
   467         r:= c;
       
   468             
       
   469     sanitizeCharForLog:= r
       
   470 end;
       
   471 
   444 procedure initModule(isNotPreview: boolean);
   472 procedure initModule(isNotPreview: boolean);
   445 {$IFDEF DEBUGFILE}
   473 {$IFDEF DEBUGFILE}
   446 var logfileBase: shortstring;
   474 var logfileBase: shortstring;
   447     i: LongInt;
   475     i: LongInt;
   448 {$ENDIF}
   476 {$ENDIF}