* More objpas fixes

This commit is contained in:
marco 2003-09-06 21:22:07 +00:00
parent c40f4381dc
commit 8245f51217
2 changed files with 62 additions and 14 deletions

View File

@ -133,8 +133,8 @@ begin
while (result=0) and (I<length) do while (result=0) and (I<length) do
begin begin
result:=byte(P1^)-byte(P2^); result:=byte(P1^)-byte(P2^);
P1:=P1+1; P1:=pchar(P1)+1; // VP compat.
P2:=P2+1; P2:=pchar(P2)+1;
i := i + 1; i := i + 1;
end ; end ;
end ; end ;
@ -150,8 +150,8 @@ begin
Result := False; Result := False;
exit; exit;
end; end;
Inc(P1); Inc(pchar(P1));
Inc(P2); Inc(pchar(P2));
end; end;
Result := True; Result := True;
end; end;
@ -543,10 +543,12 @@ begin
end ; end ;
{$IFNDEF VIRTUALPASCAL}
function IntToStr(Value: int64): string; function IntToStr(Value: int64): string;
begin begin
System.Str(Value, result); System.Str(Value, result);
end ; end ;
{$ENDIF}
function IntToStr(Value: QWord): string; function IntToStr(Value: QWord): string;
begin begin
@ -570,7 +572,7 @@ begin
end ; end ;
end ; end ;
{$IFNDEF VIRTUALPASCAL} // overloading
function IntToHex(Value: int64; Digits: integer): string; function IntToHex(Value: int64; Digits: integer): string;
var i: integer; var i: integer;
begin begin
@ -581,14 +583,17 @@ begin
value := value shr 4; value := value shr 4;
end ; end ;
end ; end ;
{$ENDIF}
{ StrToInt converts the string S to an integer value, { StrToInt converts the string S to an integer value,
if S does not represent a valid integer value EConvertError is raised } if S does not represent a valid integer value EConvertError is raised }
function StrToInt(const S: string): integer; function StrToInt(const S: string): integer;
{$IFDEF VIRTUALPASCAL}
var Error: longint;
{$ELSE}
var Error: word; var Error: word;
{$ENDIF}
begin begin
Val(S, result, Error); Val(S, result, Error);
if Error <> 0 then raise EConvertError.createfmt(SInValidInteger,[S]); if Error <> 0 then raise EConvertError.createfmt(SInValidInteger,[S]);
@ -596,8 +601,11 @@ end ;
function StrToInt64(const S: string): int64; function StrToInt64(const S: string): int64;
{$IFDEF VIRTUALPASCAL}
var Error: longint;
{$ELSE}
var Error: word; var Error: word;
{$ENDIF}
begin begin
Val(S, result, Error); Val(S, result, Error);
@ -609,7 +617,11 @@ end ;
Default is returned in case S does not represent a valid integer value } Default is returned in case S does not represent a valid integer value }
function StrToIntDef(const S: string; Default: integer): integer; function StrToIntDef(const S: string; Default: integer): integer;
{$IFDEF VIRTUALPASCAL}
var Error: longint;
{$ELSE}
var Error: word; var Error: word;
{$ENDIF}
begin begin
Val(S, result, Error); Val(S, result, Error);
if Error <> 0 then result := Default; if Error <> 0 then result := Default;
@ -619,7 +631,11 @@ end ;
Default is returned in case S does not represent a valid integer value } Default is returned in case S does not represent a valid integer value }
function StrToInt64Def(const S: string; Default: int64): int64; function StrToInt64Def(const S: string; Default: int64): int64;
{$IFDEF VIRTUALPASCAL}
var Error: longint;
{$ELSE}
var Error: word; var Error: word;
{$ENDIF}
begin begin
Val(S, result, Error); Val(S, result, Error);
if Error <> 0 then result := Default; if Error <> 0 then result := Default;
@ -689,7 +705,11 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : Longint;
Procedure ReadInteger; Procedure ReadInteger;
Var Code : Word; {$IFDEF VIRTUALPASCAL}
var Code: longint;
{$ELSE}
var Code: word;
{$ENDIF}
begin begin
If Value<>-1 then exit; // Was already read. If Value<>-1 then exit; // Was already read.
@ -790,7 +810,11 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : Longint;
Prec:=-1; Prec:=-1;
Value:=-1; Value:=-1;
inc(chpos); inc(chpos);
If Fmt[Chpos]='%' then exit('%'); If Fmt[Chpos]='%' then
begin
Result:='%';
exit; // VP fix
end;
ReadIndex; ReadIndex;
ReadLeft; ReadLeft;
ReadWidth; ReadWidth;
@ -864,8 +888,11 @@ begin
'D' : begin 'D' : begin
if Checkarg(vtinteger,false) then if Checkarg(vtinteger,false) then
Str(Args[Doarg].VInteger,ToAdd) Str(Args[Doarg].VInteger,ToAdd)
{$IFNDEF VIRTUALPASCAL}
else if CheckArg(vtInt64,true) then else if CheckArg(vtInt64,true) then
Str(Args[DoArg].VInt64^,toadd); Str(Args[DoArg].VInt64^,toadd)
{$ENDIF}
;
Width:=Abs(width); Width:=Abs(width);
Index:=Prec-Length(ToAdd); Index:=Prec-Length(ToAdd);
If ToAdd[1]<>'-' then If ToAdd[1]<>'-' then
@ -1239,7 +1266,11 @@ function StrToBool(const S: string): Boolean;
Var Var
Temp : String; Temp : String;
D : Double; D : Double;
Code : word; {$IFDEF VIRTUALPASCAL}
Code: longint;
{$ELSE}
Code: word;
{$ENDIF}
begin begin
Temp:=upcase(S); Temp:=upcase(S);
@ -1969,7 +2000,10 @@ const
{ {
$Log$ $Log$
Revision 1.25 2002-12-23 23:26:08 florian Revision 1.26 2003-09-06 21:22:07 marco
* More objpas fixes
Revision 1.25 2002/12/23 23:26:08 florian
+ addition to previous commit, forgot to save in the editor + addition to previous commit, forgot to save in the editor
Revision 1.23 2002/11/28 22:26:30 michael Revision 1.23 2002/11/28 22:26:30 michael

View File

@ -50,8 +50,13 @@ Const
EmptyStr : string = ''; EmptyStr : string = '';
NullStr : PString = @EmptyStr; NullStr : PString = @EmptyStr;
{$IFDEF VIRTUALPASCAL}
EmptyWideStr : AnsiString = '';
NullWideStr : PString = @EmptyWideStr;
{$ELSE}
EmptyWideStr : WideString = ''; EmptyWideStr : WideString = '';
// NullWideStr : PWideString = @EmptyWideStr; // NullWideStr : PWideString = @EmptyWideStr;
{$ENDIF}
function NewStr(const S: string): PString; function NewStr(const S: string): PString;
procedure DisposeStr(S: PString); procedure DisposeStr(S: PString);
@ -86,14 +91,20 @@ function AnsiExtractQuotedStr(Const Src: PChar; Quote: Char): string;
function AdjustLineBreaks(const S: string): string; function AdjustLineBreaks(const S: string): string;
function IsValidIdent(const Ident: string): boolean; function IsValidIdent(const Ident: string): boolean;
function IntToStr(Value: integer): string; function IntToStr(Value: integer): string;
{$IFNDEF VIRTUALPASCAL}
function IntToStr(Value: Int64): string; function IntToStr(Value: Int64): string;
{$ENDIF}
function IntToStr(Value: QWord): string; function IntToStr(Value: QWord): string;
function IntToHex(Value: integer; Digits: integer): string; function IntToHex(Value: integer; Digits: integer): string;
function IntToHex(Value: Int64; Digits: integer): string; function IntToHex(Value: Int64; Digits: integer): string;
function StrToInt(const s: string): integer; function StrToInt(const s: string): integer;
{$IFNDEF VIRTUALPASCAL}
function StrToInt64(const s: string): int64; function StrToInt64(const s: string): int64;
{$ENDIF}
function StrToIntDef(const S: string; Default: integer): integer; function StrToIntDef(const S: string; Default: integer): integer;
{$IFNDEF VIRTUALPASCAL}
function StrToInt64Def(const S: string; Default: int64): int64; function StrToInt64Def(const S: string; Default: int64): int64;
{$ENDIF}
function LoadStr(Ident: integer): string; function LoadStr(Ident: integer): string;
// function FmtLoadStr(Ident: integer; const Args: array of const): string; // function FmtLoadStr(Ident: integer; const Args: array of const): string;
Function Format (Const Fmt : String; const Args : Array of const) : String; Function Format (Const Fmt : String; const Args : Array of const) : String;
@ -149,7 +160,10 @@ function BCDToInt(Value: integer): integer;
{ {
$Log$ $Log$
Revision 1.16 2002-12-24 23:33:37 peter Revision 1.17 2003-09-06 21:22:08 marco
* More objpas fixes
Revision 1.16 2002/12/24 23:33:37 peter
* export StrToFloatDef * export StrToFloatDef
Revision 1.15 2002/12/23 23:12:34 florian Revision 1.15 2002/12/23 23:12:34 florian