mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 13:19:12 +02:00
* reverted partially r11598 because it breaks delphi compatibility and e.g. tw3721.pp
git-svn-id: trunk@13398 -
This commit is contained in:
parent
3f98f6a5d0
commit
87df99a53d
@ -35,18 +35,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ declaring this breaks delphi compatibility and e.g. tw3721.pp
|
||||||
FUNCTION NewStr (Const S: ShortString): PShortString;
|
FUNCTION NewStr (Const S: ShortString): PShortString;
|
||||||
VAR P: PShortString;
|
VAR P: PShortString;
|
||||||
BEGIN
|
BEGIN
|
||||||
If (S = '') Then
|
If (S = '') Then
|
||||||
P := Nil
|
P := Nil
|
||||||
Else
|
Else
|
||||||
Begin { Return nil }
|
Begin { Return nil }
|
||||||
GetMem(P, Length(S) + 1); { Allocate memory }
|
GetMem(P, Length(S) + 1); { Allocate memory }
|
||||||
If (P<>Nil) Then P^ := S; { Hold string }
|
If (P<>Nil) Then P^ := S; { Hold string }
|
||||||
End;
|
End;
|
||||||
NewStr := P; { Return result }
|
NewStr := P; { Return result }
|
||||||
END;
|
END;
|
||||||
|
}
|
||||||
|
|
||||||
{ DisposeStr frees the memory occupied by S }
|
{ DisposeStr frees the memory occupied by S }
|
||||||
|
|
||||||
@ -251,7 +253,7 @@ end;
|
|||||||
|
|
||||||
type
|
type
|
||||||
TCaseTranslationTable = array[0..255] of char;
|
TCaseTranslationTable = array[0..255] of char;
|
||||||
|
|
||||||
var
|
var
|
||||||
{ Tables with upper and lowercase forms of character sets.
|
{ Tables with upper and lowercase forms of character sets.
|
||||||
MUST be initialized with the correct code-pages }
|
MUST be initialized with the correct code-pages }
|
||||||
@ -333,7 +335,7 @@ begin
|
|||||||
Result:=Ord(S1^)-Ord(S2^); //!! Must be replaced by ansi characters !!
|
Result:=Ord(S1^)-Ord(S2^); //!! Must be replaced by ansi characters !!
|
||||||
Inc(S1);
|
Inc(S1);
|
||||||
Inc(S2);
|
Inc(S2);
|
||||||
end;
|
end;
|
||||||
if (Result=0) and (S1^<>S2^) then // loop ended because exactly one has #0
|
if (Result=0) and (S1^<>S2^) then // loop ended because exactly one has #0
|
||||||
if S1^=#0 then // shorter string is smaller
|
if S1^=#0 then // shorter string is smaller
|
||||||
result:=-1
|
result:=-1
|
||||||
@ -1759,7 +1761,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// from textmode IDE util funcs.
|
// from textmode IDE util funcs.
|
||||||
function BoolToStr(B: boolean; const TrueS, FalseS: string): string;
|
function BoolToStr(B: boolean; const TrueS, FalseS: string): string;
|
||||||
begin
|
begin
|
||||||
if B then Result:=TrueS else BoolToStr:=FalseS;
|
if B then Result:=TrueS else BoolToStr:=FalseS;
|
||||||
end;
|
end;
|
||||||
@ -2048,7 +2050,7 @@ Var
|
|||||||
places, remove decimal point. }
|
places, remove decimal point. }
|
||||||
If (DecimalPoint < len) And (Digits[DecimalPoint + 1] = ' ') Then
|
If (DecimalPoint < len) And (Digits[DecimalPoint + 1] = ' ') Then
|
||||||
Digits[DecimalPoint] := ' ';
|
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}
|
MVC : If - sign is encountered, replace it too, and put at position 1}
|
||||||
I:=DecimalPoint-Placehold[2];
|
I:=DecimalPoint-Placehold[2];
|
||||||
J:=0;
|
J:=0;
|
||||||
@ -2085,7 +2087,7 @@ Var
|
|||||||
|
|
||||||
{ Find and cut out exponent. Always the
|
{ Find and cut out exponent. Always the
|
||||||
last 6 characters in the string.
|
last 6 characters in the string.
|
||||||
-> 0000E+0000
|
-> 0000E+0000
|
||||||
*** No, not always the last 6 characters, this depends on
|
*** No, not always the last 6 characters, this depends on
|
||||||
the maximally supported precision (JM)}
|
the maximally supported precision (JM)}
|
||||||
I:=Pos('E',Digits);
|
I:=Pos('E',Digits);
|
||||||
|
@ -67,7 +67,8 @@ Const
|
|||||||
Var TrueBoolStrs,
|
Var TrueBoolStrs,
|
||||||
FalseBoolStrs : Array of String;
|
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;
|
function NewStr(const S: string): PString; overload;
|
||||||
procedure DisposeStr(S: PString); overload;
|
procedure DisposeStr(S: PString); overload;
|
||||||
procedure DisposeStr(S: PShortString); overload;
|
procedure DisposeStr(S: PShortString); overload;
|
||||||
@ -210,7 +211,7 @@ Function FormatCurr(const Format: string; Value: Currency; Const FormatSettings:
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
function StrToBool(const S: string): Boolean;
|
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 BoolToStr(B: Boolean;const TrueS,FalseS:string): string; inline;
|
||||||
function StrToBoolDef(const S: string; Default: Boolean): Boolean;
|
function StrToBoolDef(const S: string; Default: Boolean): Boolean;
|
||||||
function TryStrToBool(const S: string; out Value: Boolean): Boolean;
|
function TryStrToBool(const S: string; out Value: Boolean): Boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user