* some variant <-> dyn. array stuff

This commit is contained in:
florian 2002-12-05 14:27:25 +00:00
parent 1b2a455ced
commit 121ca40b39
8 changed files with 2344 additions and 33 deletions

2251
compiler/defbase.pas Normal file

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,7 @@ interface
tequaltype = (
te_incompatible,
te_convert_operator,
te_convert_l2, { compatible conversion with possible loss of data }
te_convert_l2, { compatible conversion with possible loss of data }
te_convert_l1, { compatible conversion }
te_equal, { the definitions are equal }
te_exact
@ -78,7 +78,9 @@ interface
tc_char_2_char,
tc_normal_2_smallset,
tc_dynarray_2_openarray,
tc_pwchar_2_string
tc_pwchar_2_string,
tc_variant_2_dynarray,
tc_dynarray_2_variant
);
function compare_defs_ext(def_from,def_to : tdef;
@ -551,6 +553,14 @@ implementation
b:=te_convert_l1;
end;
end;
variantdef :
begin
if is_dynamic_array(def_to) then
begin
doconv:=tc_variant_2_dynarray;
b:=te_convert_l1;
end;
end;
end;
end;
end;
@ -1149,7 +1159,10 @@ implementation
end.
{
$Log$
Revision 1.4 2002-12-01 22:07:41 carl
Revision 1.5 2002-12-05 14:27:26 florian
* some variant <-> dyn. array stuff
Revision 1.4 2002/12/01 22:07:41 carl
* warning of portabilitiy problems with parasize / localsize
+ some added documentation
@ -1164,4 +1177,4 @@ end.
* merged isconvertable and is_equal into compare_defs(_ext)
* made operator search faster by walking the list only once
}
}

View File

@ -354,7 +354,9 @@ implementation
{$ifdef fpc}@{$endif}second_char_to_char,
{$ifdef fpc}@{$endif}second_nothing, { normal_2_smallset }
{$ifdef fpc}@{$endif}second_nothing, { dynarray_2_openarray }
{$ifdef fpc}@{$endif}second_nothing { pwchar_2_string }
{$ifdef fpc}@{$endif}second_nothing, { pwchar_2_string }
{$ifdef fpc}@{$endif}second_nothing, { variant_2_dynarray }
{$ifdef fpc}@{$endif}second_nothing { dynarray_2_variant}
);
type
tprocedureofobject = procedure of object;
@ -404,6 +406,10 @@ implementation
tc_char_2_char : second_char_to_char;
tc_normal_2_smallset : second_nothing;
tc_dynarray_2_openarray : second_nothing;
tc_pwchar_2_string : second_nothing;
tc_variant_2_dynarray : second_nothing;
tc_dynarray_2_variant : second_nothing;
else internalerror(2002101101);
end;
end;
{$endif}
@ -413,7 +419,10 @@ begin
end.
{
$Log$
Revision 1.52 2002-11-25 17:43:26 peter
Revision 1.53 2002-12-05 14:27:42 florian
* some variant <-> dyn. array stuff
Revision 1.52 2002/11/25 17:43:26 peter
* splitted defbase in defutil,symutil,defcmp
* merged isconvertable and is_equal into compare_defs(_ext)
* made operator search faster by walking the list only once

View File

@ -248,7 +248,9 @@ implementation
@second_char_to_char,
@second_nothing, { normal_2_smallset }
@second_nothing, { dynarray_2_openarray }
@second_nothing { tc_pwchar_2_string }
@second_nothing, { tc_pwchar_2_string }
{$ifdef fpc}@{$endif}second_nothing, { variant_2_dynarray }
{$ifdef fpc}@{$endif}second_nothing { dynarray_2_variant}
);
type
tprocedureofobject = procedure of object;
@ -294,7 +296,10 @@ begin
end.
{
$Log$
Revision 1.6 2002-11-25 17:43:27 peter
Revision 1.7 2002-12-05 14:27:53 florian
* some variant <-> dyn. array stuff
Revision 1.6 2002/11/25 17:43:27 peter
* splitted defbase in defutil,symutil,defcmp
* merged isconvertable and is_equal into compare_defs(_ext)
* made operator search faster by walking the list only once
@ -317,4 +322,4 @@ end.
* out of bound references should now be handled correctly
}
}

View File

@ -69,6 +69,8 @@ interface
function resulttype_interface_to_guid : tnode;
function resulttype_dynarray_to_openarray : tnode;
function resulttype_pwchar_to_string : tnode;
function resulttype_variant_to_dynarray : tnode;
function resulttype_dynarray_to_variant : tnode;
function resulttype_call_helper(c : tconverttype) : tnode;
protected
function first_int_to_int : tnode;virtual;
@ -311,12 +313,12 @@ implementation
hp : tarrayconstructornode;
begin
if p.nodetype<>arrayconstructorn then
internalerror(200205105);
new(constset);
internalerror(200205105);
new(constset);
{$ifdef oldset}
FillChar(constset^,sizeof(constset^),0);
{$else}
constset^:=[];
constset^:=[];
{$endif}
htype.reset;
constsetlo:=0;
@ -900,6 +902,7 @@ implementation
result.resulttype := resulttype;
end;
function ttypeconvnode.resulttype_pwchar_to_string : tnode;
begin
@ -910,6 +913,24 @@ implementation
end;
function ttypeconvnode.resulttype_variant_to_dynarray : tnode;
begin
result := ccallnode.createinternres(
'fpc_variant_to_dynarray',
ccallparanode.create(caddrnode.create(crttinode.create(tstoreddef(resulttype.def),initrtti)),
ccallparanode.create(left,nil)
),resulttype);
left := nil;
end;
function ttypeconvnode.resulttype_dynarray_to_variant : tnode;
begin
end;
function ttypeconvnode.resulttype_call_helper(c : tconverttype) : tnode;
{$ifdef fpc}
const
@ -943,7 +964,9 @@ implementation
{ char_2_char } @ttypeconvnode.resulttype_char_to_char,
{ normal_2_smallset} nil,
{ dynarray_2_openarray} @resulttype_dynarray_to_openarray,
{ pwchar_2_string} @resulttype_pwchar_to_string
{ pwchar_2_string} @resulttype_pwchar_to_string,
{ variant_2_dynarray} @resulttype_variant_to_dynarray,
{ dynarray_2_variant} @resulttype_dynarray_to_variant
);
type
tprocedureofobject = function : tnode of object;
@ -980,6 +1003,8 @@ implementation
tc_char_2_char : resulttype_char_to_char;
tc_dynarray_2_openarray : resulttype_dynarray_to_openarray;
tc_pwchar_2_string : resulttype_pwchar_to_string;
tc_variant_2_dynarray : resulttype_variant_to_dynarray;
tc_dynarray_2_variant : resulttype_dynarray_to_variant;
end;
end;
{$Endif fpc}
@ -1672,6 +1697,8 @@ implementation
@ttypeconvnode._first_char_to_char,
@ttypeconvnode._first_nothing,
@ttypeconvnode._first_nothing,
nil,
nil,
nil
);
type
@ -1994,7 +2021,10 @@ begin
end.
{
$Log$
Revision 1.93 2002-11-30 10:45:14 carl
Revision 1.94 2002-12-05 14:27:26 florian
* some variant <-> dyn. array stuff
Revision 1.93 2002/11/30 10:45:14 carl
* fix bug with checking of duplicated items in sets (new sets bug only)
Revision 1.92 2002/11/27 19:43:21 carl

View File

@ -74,27 +74,17 @@ implementation
procedure tppccallnode.load_framepointer;
begin
{ if we call a nested function in a method, we must }
{ push also SELF! }
{ THAT'S NOT TRUE, we have to load ESI via frame pointer }
{ access }
{
begin
loadesi:=false;
emit_reg(A_PUSH,S_L,R_ESI);
end;
}
{
if lexlevel=(tprocdef(procdefinition).parast.symtablelevel) then
begin
reference_reset_base(href,procinfo^.framepointer,procinfo^.framepointer_offset);
cg.a_param_ref(exprasmlist,OS_ADDR,href,-1);
cg.a_param_ref(exprasmlist,OS_ADDR,href,paramanager.getframepointerloc(procinfo.procdef));
end
{ this is only true if the difference is one !!
but it cannot be more !! }
else if (lexlevel=(tprocdef(procdefinition).parast.symtablelevel)-1) then
begin
cg.a_param_reg(exprasmlist,OS_ADDR,procinfo^.framepointer,-1);
cg.a_param_reg(exprasmlist,OS_ADDR,procinfo^.framepointer,paramanager.getframepointerloc(procinfo.procdef));
end
else if (lexlevel>(tprocdef(procdefinition).parast.symtablelevel)) then
begin
@ -121,7 +111,10 @@ begin
end.
{
$Log$
Revision 1.3 2002-11-25 17:43:28 peter
Revision 1.4 2002-12-05 14:28:12 florian
* some variant <-> dyn. array stuff
Revision 1.3 2002/11/25 17:43:28 peter
* splitted defbase in defutil,symutil,defcmp
* merged isconvertable and is_equal into compare_defs(_ext)
* made operator search faster by walking the list only once

View File

@ -346,7 +346,9 @@ implementation
@second_char_to_char,
@second_nothing, { normal_2_smallset }
@second_nothing, { dynarray_2_openarray }
@second_nothing
@second_nothing,
{$ifdef fpc}@{$endif}second_nothing, { variant_2_dynarray }
{$ifdef fpc}@{$endif}second_nothing { dynarray_2_variant}
);
type
tprocedureofobject = procedure of object;
@ -392,7 +394,10 @@ begin
end.
{
$Log$
Revision 1.27 2002-11-25 17:43:28 peter
Revision 1.28 2002-12-05 14:28:13 florian
* some variant <-> dyn. array stuff
Revision 1.27 2002/11/25 17:43:28 peter
* splitted defbase in defutil,symutil,defcmp
* merged isconvertable and is_equal into compare_defs(_ext)
* made operator search faster by walking the list only once
@ -474,4 +479,4 @@ end.
Revision 1.5 2002/04/06 18:13:02 jonas
* several powerpc-related additions and fixes
}
}

View File

@ -375,7 +375,9 @@ implementation
@second_char_to_char,
@second_nothing, { normal_2_smallset }
@second_nothing, { dynarray_2_openarray }
@second_nothing
@second_nothing,
{$ifdef fpc}@{$endif}second_nothing, { variant_2_dynarray }
{$ifdef fpc}@{$endif}second_nothing { dynarray_2_variant}
);
type
tprocedureofobject = procedure of object;
@ -421,7 +423,10 @@ begin
end.
{
$Log$
Revision 1.8 2002-11-25 17:43:28 peter
Revision 1.9 2002-12-05 14:28:03 florian
* some variant <-> dyn. array stuff
Revision 1.8 2002/11/25 17:43:28 peter
* splitted defbase in defutil,symutil,defcmp
* merged isconvertable and is_equal into compare_defs(_ext)
* made operator search faster by walking the list only once
@ -514,4 +519,4 @@ end.
+ generic constructor calls
+ start of tassembler / tmodulebase class cleanup
}
}