mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-03 20:03:45 +02:00
+ pchar -> string conversion
This commit is contained in:
parent
03ba16b03f
commit
bfc89b2587
@ -456,10 +456,10 @@ implementation
|
|||||||
push_int(p^.resulttype^.size-1);
|
push_int(p^.resulttype^.size-1);
|
||||||
gettempofsizereference(p^.resulttype^.size,p^.location.reference);
|
gettempofsizereference(p^.resulttype^.size,p^.location.reference);
|
||||||
emitpushreferenceaddr(exprasmlist,p^.location.reference);
|
emitpushreferenceaddr(exprasmlist,p^.location.reference);
|
||||||
case p^.right^.location.loc of
|
case p^.left^.location.loc of
|
||||||
LOC_REGISTER,LOC_CREGISTER:
|
LOC_REGISTER,LOC_CREGISTER:
|
||||||
begin
|
begin
|
||||||
exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,p^.right^.location.register)));
|
exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,p^.left^.location.register)));
|
||||||
ungetregister32(p^.left^.location.register);
|
ungetregister32(p^.left^.location.register);
|
||||||
end;
|
end;
|
||||||
LOC_REFERENCE,LOC_MEM:
|
LOC_REFERENCE,LOC_MEM:
|
||||||
@ -1078,12 +1078,40 @@ implementation
|
|||||||
emitl(A_LABEL,l2);
|
emitl(A_LABEL,l2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure second_pchar_to_ansistring(p,hp : ptree;convtyp : tconverttype);
|
|
||||||
|
|
||||||
|
procedure second_pchar_to_string(p,hp : ptree;convtyp : tconverttype);
|
||||||
|
var
|
||||||
|
pushed : tpushed;
|
||||||
|
begin
|
||||||
|
case pstringdef(p^.resulttype)^.string_typ of
|
||||||
|
st_shortstring : begin
|
||||||
|
pushusedregisters(pushed,$ff);
|
||||||
|
stringdispose(p^.location.reference.symbol);
|
||||||
|
gettempofsizereference(p^.resulttype^.size,p^.location.reference);
|
||||||
|
case p^.left^.location.loc of
|
||||||
|
LOC_REGISTER,LOC_CREGISTER:
|
||||||
|
begin
|
||||||
|
exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,p^.left^.location.register)));
|
||||||
|
ungetregister32(p^.left^.location.register);
|
||||||
|
end;
|
||||||
|
LOC_REFERENCE,LOC_MEM:
|
||||||
|
begin
|
||||||
|
emit_push_mem(p^.left^.location.reference);
|
||||||
|
del_reference(p^.left^.location.reference);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
emitpushreferenceaddr(exprasmlist,p^.location.reference);
|
||||||
|
emitcall('FPC_PCHAR_TO_STR',true);
|
||||||
|
maybe_loadesi;
|
||||||
|
popusedregisters(pushed);
|
||||||
|
end;
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
p^.location.loc:=LOC_REGISTER;
|
p^.location.loc:=LOC_REGISTER;
|
||||||
internalerror(12121);
|
internalerror(12121);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure second_nothing(p,hp : ptree;convtyp : tconverttype);
|
procedure second_nothing(p,hp : ptree;convtyp : tconverttype);
|
||||||
begin
|
begin
|
||||||
@ -1123,7 +1151,7 @@ implementation
|
|||||||
second_nothing,
|
second_nothing,
|
||||||
second_load_smallset,
|
second_load_smallset,
|
||||||
second_ansistring_to_pchar,
|
second_ansistring_to_pchar,
|
||||||
second_pchar_to_ansistring);
|
second_pchar_to_string);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ this isn't good coding, I think tc_bool_2_int, shouldn't be }
|
{ this isn't good coding, I think tc_bool_2_int, shouldn't be }
|
||||||
@ -1253,7 +1281,10 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.21 1998-09-20 17:46:47 florian
|
Revision 1.22 1998-09-22 15:34:09 peter
|
||||||
|
+ pchar -> string conversion
|
||||||
|
|
||||||
|
Revision 1.21 1998/09/20 17:46:47 florian
|
||||||
* some things regarding ansistrings fixed
|
* some things regarding ansistrings fixed
|
||||||
|
|
||||||
Revision 1.20 1998/09/17 09:42:12 peter
|
Revision 1.20 1998/09/17 09:42:12 peter
|
||||||
|
@ -527,14 +527,18 @@ unit pass_1;
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
}
|
}
|
||||||
{ pchar can be assigned to ansistrings }
|
|
||||||
if ((def_from^.deftype=pointerdef) and
|
{ pchar can be assigned to short/ansistrings }
|
||||||
|
if (def_to^.deftype=stringdef) and
|
||||||
|
((def_from^.deftype=pointerdef) and
|
||||||
(ppointerdef(def_from)^.definition^.deftype=orddef) and
|
(ppointerdef(def_from)^.definition^.deftype=orddef) and
|
||||||
(porddef(ppointerdef(def_from)^.definition)^.typ=uchar)) and
|
(porddef(ppointerdef(def_from)^.definition)^.typ=uchar)) then
|
||||||
is_ansistring(def_to) then
|
|
||||||
begin
|
begin
|
||||||
doconv:=tc_pchar_2_ansistring;
|
if (pstringdef(def_to)^.string_typ in [st_shortstring,st_ansistring]) then
|
||||||
|
begin
|
||||||
|
doconv:=tc_pchar_2_string;
|
||||||
b:=true;
|
b:=true;
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -5512,7 +5516,10 @@ unit pass_1;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.88 1998-09-21 08:45:14 pierre
|
Revision 1.89 1998-09-22 15:34:10 peter
|
||||||
|
+ pchar -> string conversion
|
||||||
|
|
||||||
|
Revision 1.88 1998/09/21 08:45:14 pierre
|
||||||
+ added vmt_offset in tobjectdef.write for fututre use
|
+ added vmt_offset in tobjectdef.write for fututre use
|
||||||
(first steps to have objects without vmt if no virtual !!)
|
(first steps to have objects without vmt if no virtual !!)
|
||||||
+ added fpu_used field for tabstractprocdef :
|
+ added fpu_used field for tabstractprocdef :
|
||||||
|
@ -147,7 +147,7 @@ unit tree;
|
|||||||
tc_fix_2_real,tc_int_2_fix,tc_real_2_real,
|
tc_fix_2_real,tc_int_2_fix,tc_real_2_real,
|
||||||
tc_chararray_2_string,
|
tc_chararray_2_string,
|
||||||
tc_proc2procvar,tc_cchar_charpointer,tc_load_smallset,
|
tc_proc2procvar,tc_cchar_charpointer,tc_load_smallset,
|
||||||
tc_ansistring_2_pchar,tc_pchar_2_ansistring);
|
tc_ansistring_2_pchar,tc_pchar_2_string);
|
||||||
|
|
||||||
{ allows to determine which elementes are to be replaced }
|
{ allows to determine which elementes are to be replaced }
|
||||||
tdisposetyp = (dt_nothing,dt_leftright,dt_left,
|
tdisposetyp = (dt_nothing,dt_leftright,dt_left,
|
||||||
@ -1567,7 +1567,10 @@ unit tree;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.39 1998-09-21 08:45:27 pierre
|
Revision 1.40 1998-09-22 15:34:07 peter
|
||||||
|
+ pchar -> string conversion
|
||||||
|
|
||||||
|
Revision 1.39 1998/09/21 08:45:27 pierre
|
||||||
+ added vmt_offset in tobjectdef.write for fututre use
|
+ added vmt_offset in tobjectdef.write for fututre use
|
||||||
(first steps to have objects without vmt if no virtual !!)
|
(first steps to have objects without vmt if no virtual !!)
|
||||||
+ added fpu_used field for tabstractprocdef :
|
+ added fpu_used field for tabstractprocdef :
|
||||||
|
Loading…
Reference in New Issue
Block a user