* small ansistring fixes

* val_ansistr_sint destsize changed to longint
  * don't write low/hi ascii with -al
This commit is contained in:
peter 1999-06-09 23:00:11 +00:00
parent 78aebb31d3
commit e1b6682670
3 changed files with 64 additions and 49 deletions

View File

@ -230,9 +230,8 @@ implementation
emit_reg_reg(A_OR,S_L,R_EAX,R_EAX); emit_reg_reg(A_OR,S_L,R_EAX,R_EAX);
popusedregisters(pushedregs); popusedregisters(pushedregs);
maybe_loadesi; maybe_loadesi;
{ done in temptoremove (PM) ungetiftempansi(p^.left^.location.reference);
ungetiftemp(p^.left^.location.reference); ungetiftempansi(p^.right^.location.reference);
ungetiftemp(p^.right^.location.reference); }
end; end;
end; end;
{ the result of ansicompare is signed } { the result of ansicompare is signed }
@ -2111,7 +2110,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.64 1999-06-02 10:11:39 florian Revision 1.65 1999-06-09 23:00:11 peter
* small ansistring fixes
* val_ansistr_sint destsize changed to longint
* don't write low/hi ascii with -al
Revision 1.64 1999/06/02 10:11:39 florian
* make cycle fixed i.e. compilation with 0.99.10 * make cycle fixed i.e. compilation with 0.99.10
* some fixes for qword * some fixes for qword
* start of register calling conventions * start of register calling conventions

View File

@ -326,7 +326,7 @@ unit temp_gen;
{$endif} {$endif}
templist^.temptype:=tt_ansistring; templist^.temptype:=tt_ansistring;
{ set result to false, we don't need an decr_ansistr } { set result to false, we don't need an decr_ansistr }
gettempansistringreference:=false; gettempansistringreference:=true;
end; end;
exprasmlist^.concat(new(paitempalloc,alloc(ref.offset,target_os.size_of_pointer))); exprasmlist^.concat(new(paitempalloc,alloc(ref.offset,target_os.size_of_pointer)));
end; end;
@ -524,7 +524,12 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.31 1999-06-01 22:46:26 pierre Revision 1.32 1999-06-09 23:00:13 peter
* small ansistring fixes
* val_ansistr_sint destsize changed to longint
* don't write low/hi ascii with -al
Revision 1.31 1999/06/01 22:46:26 pierre
* extdebug wrong warning removed * extdebug wrong warning removed
Revision 1.30 1999/05/31 20:35:47 peter Revision 1.30 1999/05/31 20:35:47 peter

View File

@ -392,36 +392,34 @@ Procedure SetLength (Var S : AnsiString; l : Longint);
Var Var
Temp : Pointer; Temp : Pointer;
begin begin
If (Pointer(S)=Nil) and (l>0) then if (l>0) then
begin begin
{ Need a complete new string...} if Pointer(S)=nil then
Pointer(s):=NewAnsiString(l); begin
PAnsiRec(Pointer(S)-FirstOff)^.Len:=l; { Need a complete new string...}
PAnsiRec(Pointer(S)-FirstOff)^.MaxLen:=l; Pointer(s):=NewAnsiString(l);
PByte (Pointer(S)+l)^:=0; end
end else
else if l>0 then If (PAnsiRec(Pointer(S)-FirstOff)^.Maxlen < L) or
begin (PAnsiRec(Pointer(S)-FirstOff)^.Ref <> 1) then
If (PAnsiRec(Pointer(S)-FirstOff)^.Maxlen < L) or begin
(PAnsiRec(Pointer(S)-FirstOff)^.Ref <> 1) then { Reallocation is needed... }
begin Temp:=Pointer(NewAnsiString(L));
{ Reallocation is needed... } if Length(S)>0 then
Temp:=Pointer(NewAnsiString(L)); Move (Pointer(S)^,Temp^,Length(S)+1);
if Length(S)>0 then ansistr_decr_ref (Pointer(S));
Move (Pointer(S)^,Temp^,Length(S)+1); Pointer(S):=Temp;
ansistr_decr_ref (Pointer(S)); end;
Pointer(S):=Temp; { Force nil termination in case it gets shorter }
end
else
//!! Force nil termination in case it gets shorter
PByte(Pointer(S)+l)^:=0; PByte(Pointer(S)+l)^:=0;
PAnsiRec(Pointer(S)-FirstOff)^.Len:=l; PAnsiRec(Pointer(S)-FirstOff)^.Len:=l;
end end
else else
{ Length=0 }
begin begin
ansistr_decr_ref (Pointer(S)); { Length=0 }
Pointer(S):=Nil; if Pointer(S)<>nil then
ansistr_decr_ref (Pointer(S));
Pointer(S):=Nil;
end; end;
end; end;
@ -498,40 +496,43 @@ begin
pos := j; pos := j;
end; end;
{$IfDef ValInternCompiled} {$IfDef ValInternCompiled}
Function ValAnsiFloat(Const S : AnsiString; Var Code : ValSInt): ValReal; [public, alias:'FPC_VAL_REAL_ANSISTR']; Function ValAnsiFloat(Const S : AnsiString; Var Code : ValSInt): ValReal; [public, alias:'FPC_VAL_REAL_ANSISTR'];
Var SS : String; Var
SS : String;
begin begin
AnsiStr_To_ShortStr(SS,Pointer(S)); AnsiStr_To_ShortStr(SS,Pointer(S));
ValAnsiFloat := ValFloat(SS,Code); ValAnsiFloat := ValFloat(SS,Code);
end; end;
Function ValAnsiUnsigendInt (Const S : AnsiString; Code : ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_ANSISTR']; Function ValAnsiUnsigendInt (Const S : AnsiString; Code : ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_ANSISTR'];
Var SS : ShortString; Var
SS : ShortString;
begin begin
AnsiStr_To_ShortStr(SS,Pointer(S)); AnsiStr_To_ShortStr(SS,Pointer(S));
ValAnsiUnsigendInt := ValUnsignedInt(SS,Code); ValAnsiUnsigendInt := ValUnsignedInt(SS,Code);
end; end;
Function ValAnsiSignedInt (DestSize: Byte; Const S : AnsiString; Var Code : ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_ANSISTR']; Function ValAnsiSignedInt (DestSize: longint; Const S : AnsiString; Var Code : ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_ANSISTR'];
Var
Var SS : ShortString; SS : ShortString;
begin begin
AnsiStr_To_ShortStr (SS,Pointer(S)); AnsiStr_To_ShortStr (SS,Pointer(S));
ValAnsiSignedInt := ValSignedInt(DestSize,SS,Code); ValAnsiSignedInt := ValSignedInt(DestSize,SS,Code);
end; end;
{$IfDef SUPPORT_FIXED} {$IfDef SUPPORT_FIXED}
Function ValAnsiFixed(Const S : AnsiString; Var Code : ValSint): ValReal; [public, alias:'FPC_VAL_FIXED_ANSISTR']; Function ValAnsiFixed(Const S : AnsiString; Var Code : ValSint): ValReal; [public, alias:'FPC_VAL_FIXED_ANSISTR'];
Var SS : String; Var
SS : String;
begin begin
AnsiStr_To_ShortStr (SS,Pointer(S)); AnsiStr_To_ShortStr (SS,Pointer(S));
ValAnsiFixed := Fixed(ValFloat(SS,Code)); ValAnsiFixed := Fixed(ValFloat(SS,Code));
end; end;
{$EndIf SUPPORT_FIXED} {$EndIf SUPPORT_FIXED}
@ -784,7 +785,12 @@ end;
{ {
$Log$ $Log$
Revision 1.27 1999-06-05 20:48:56 michael Revision 1.28 1999-06-09 23:00:16 peter
* small ansistring fixes
* val_ansistr_sint destsize changed to longint
* don't write low/hi ascii with -al
Revision 1.27 1999/06/05 20:48:56 michael
Copy checks index now for negative values. Copy checks index now for negative values.
Revision 1.26 1999/05/31 20:37:39 peter Revision 1.26 1999/05/31 20:37:39 peter