From 87df99a53d2f04d138d08c72d8470d581f7e653e Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 16 Jul 2009 21:01:27 +0000 Subject: [PATCH] * reverted partially r11598 because it breaks delphi compatibility and e.g. tw3721.pp git-svn-id: trunk@13398 - --- rtl/objpas/sysutils/sysstr.inc | 18 ++++++++++-------- rtl/objpas/sysutils/sysstrh.inc | 5 +++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/rtl/objpas/sysutils/sysstr.inc b/rtl/objpas/sysutils/sysstr.inc index 285162ad5a..027f6a3655 100644 --- a/rtl/objpas/sysutils/sysstr.inc +++ b/rtl/objpas/sysutils/sysstr.inc @@ -35,18 +35,20 @@ begin end; end; +{ declaring this breaks delphi compatibility and e.g. tw3721.pp FUNCTION NewStr (Const S: ShortString): PShortString; VAR P: PShortString; BEGIN - If (S = '') Then - P := Nil - Else + If (S = '') Then + P := Nil + Else Begin { Return nil } GetMem(P, Length(S) + 1); { Allocate memory } If (P<>Nil) Then P^ := S; { Hold string } End; NewStr := P; { Return result } END; +} { DisposeStr frees the memory occupied by S } @@ -251,7 +253,7 @@ end; type TCaseTranslationTable = array[0..255] of char; - + var { Tables with upper and lowercase forms of character sets. MUST be initialized with the correct code-pages } @@ -333,7 +335,7 @@ begin Result:=Ord(S1^)-Ord(S2^); //!! Must be replaced by ansi characters !! Inc(S1); Inc(S2); - end; + end; if (Result=0) and (S1^<>S2^) then // loop ended because exactly one has #0 if S1^=#0 then // shorter string is smaller result:=-1 @@ -1759,7 +1761,7 @@ begin end; // from textmode IDE util funcs. -function BoolToStr(B: boolean; const TrueS, FalseS: string): string; +function BoolToStr(B: boolean; const TrueS, FalseS: string): string; begin if B then Result:=TrueS else BoolToStr:=FalseS; end; @@ -2048,7 +2050,7 @@ Var places, remove decimal point. } If (DecimalPoint < len) And (Digits[DecimalPoint + 1] = ' ') Then Digits[DecimalPoint] := ' '; - { Convert spaces left from obligatory decimal point to zeroes. + { Convert spaces left from obligatory decimal point to zeroes. MVC : If - sign is encountered, replace it too, and put at position 1} I:=DecimalPoint-Placehold[2]; J:=0; @@ -2085,7 +2087,7 @@ Var { Find and cut out exponent. Always the last 6 characters in the string. - -> 0000E+0000 + -> 0000E+0000 *** No, not always the last 6 characters, this depends on the maximally supported precision (JM)} I:=Pos('E',Digits); diff --git a/rtl/objpas/sysutils/sysstrh.inc b/rtl/objpas/sysutils/sysstrh.inc index 579ab3ec90..4c1a801799 100644 --- a/rtl/objpas/sysutils/sysstrh.inc +++ b/rtl/objpas/sysutils/sysstrh.inc @@ -67,7 +67,8 @@ Const Var TrueBoolStrs, FalseBoolStrs : Array of String; -function NewStr(Const S: ShortString): PShortString; overload; +// declaring this breaks delphi compatibility and e.g. tw3721.pp +// function NewStr(Const S: ShortString): PShortString; overload; function NewStr(const S: string): PString; overload; procedure DisposeStr(S: PString); overload; procedure DisposeStr(S: PShortString); overload; @@ -210,7 +211,7 @@ Function FormatCurr(const Format: string; Value: Currency; Const FormatSettings: {$endif} function StrToBool(const S: string): Boolean; -function BoolToStr(B: Boolean;UseBoolStrs:Boolean=False): string; +function BoolToStr(B: Boolean;UseBoolStrs:Boolean=False): string; function BoolToStr(B: Boolean;const TrueS,FalseS:string): string; inline; function StrToBoolDef(const S: string; Default: Boolean): Boolean; function TryStrToBool(const S: string; out Value: Boolean): Boolean;