From 3f5541e9960f2dac916e1b6727f2bf14cdaf5048 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 15 Dec 2002 19:34:31 +0000 Subject: [PATCH] + some front end stuff for vs_hidden added --- compiler/cclasses.pas | 23 ++++++++- compiler/pdecsub.pas | 10 +++- compiler/symdef.pas | 113 ++++++++++++++++++++++++------------------ 3 files changed, 95 insertions(+), 51 deletions(-) diff --git a/compiler/cclasses.pas b/compiler/cclasses.pas index d5c62bdd59..8847636c47 100644 --- a/compiler/cclasses.pas +++ b/compiler/cclasses.pas @@ -78,6 +78,8 @@ interface procedure Clear; { inserts an Item } procedure Insert(Item:TLinkedListItem); + { inserts an Item after Loc } + procedure InsertAfter(Item,Loc : TLinkedListItem); { concats an Item } procedure Concat(Item:TLinkedListItem); { deletes an Item } @@ -318,7 +320,7 @@ implementation begin {$ifndef Delphi} inc(TotalMem,memavail-startmem); -{$endif} +{$endif} startmem:=0; end; end; @@ -472,6 +474,20 @@ end; end; + procedure TLinkedList.InsertAfter(Item,Loc : TLinkedListItem); + begin + Item.Next:=Loc.Next; + Loc.Next:=Item; + Item.Previous:=Loc; + if assigned(Item.Next) then + Item.Next.Previous:=Item + else + { if we've no next item, we've to adjust FLast } + FLast:=Item; + inc(FCount); + end; + + procedure TLinkedList.Concat(Item:TLinkedListItem); begin if FFirst=nil then @@ -1821,7 +1837,10 @@ end; end. { $Log$ - Revision 1.21 2002-11-24 18:18:39 carl + Revision 1.22 2002-12-15 19:34:31 florian + + some front end stuff for vs_hidden added + + Revision 1.21 2002/11/24 18:18:39 carl - remove some unused defines Revision 1.20 2002/10/05 12:43:23 carl diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index 682c411ca4..964b5bd105 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -128,7 +128,7 @@ implementation (tsym(indexnext).typ=varsym) and (copy(tvarsym(indexnext).name,1,4)='high') then begin - { removing it is to complicated, + { removing it is too complicated, we just hide it PM } highname:='hidden'+copy(tvarsym(indexnext).name,5,high(name)); Message(parser_w_cdecl_has_no_high); @@ -365,6 +365,9 @@ implementation begin hvs:=tvarsym.create('$high'+vs.name,s32bittype); hvs.varspez:=vs_const; +{$ifdef vs_hidden} + aktprocdef.concatpara(s32bittype,hvs,vs_hidden,nil); +{$endif vs_hidden} currparast.insert(hvs); end; aktprocdef.concatpara(tt,vs,varspez,tdefaultvalue); @@ -2076,7 +2079,10 @@ const end. { $Log$ - Revision 1.87 2002-12-07 14:27:07 carl + Revision 1.88 2002-12-15 19:34:31 florian + + some front end stuff for vs_hidden added + + Revision 1.87 2002/12/07 14:27:07 carl * 3% memory optimization * changed some types + added type checking with different size for call node and for diff --git a/compiler/symdef.pas b/compiler/symdef.pas index 41e8002f67..95a3682d67 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -3186,12 +3186,22 @@ implementation hp : TParaItem; hpc : tconstsym; begin + { look for a visible parameter } hp:=TParaItem(Para.last); + while assigned(hp) do + begin + if hp.paratyp<>vs_hidden then + break; + hp:=TParaItem(hp.previous); + end; + { no visible parameter? } if not(assigned(hp)) then begin typename_paras:=''; exit; end; + + hp:=TParaItem(Para.last); s:='('; while assigned(hp) do begin @@ -3201,50 +3211,53 @@ implementation s:=s+'const' else if hp.paratyp=vs_out then s:=s+'out'; - if assigned(hp.paratype.def.typesym) then + if hp.paratyp<>vs_hidden then begin - if hp.paratyp in [vs_var,vs_const,vs_out] then - s := s + ' '; - hs:=hp.paratype.def.typesym.realname; - if hs[1]<>'$' then - s:=s+hp.paratype.def.typesym.realname - else - s:=s+hp.paratype.def.gettypename; - end; - { default value } - if assigned(hp.defaultvalue) then - begin - hpc:=tconstsym(hp.defaultvalue); - hs:=''; - case hpc.consttyp of - conststring, - constresourcestring : - hs:=strpas(pchar(hpc.value.valueptr)); - constreal : - str(pbestreal(hpc.value.valueptr)^,hs); - constord : - hs:=tostr(hpc.value.valueord); - constpointer : - hs:=tostr(hpc.value.valueordptr); - constbool : - begin - if hpc.value.valueord<>0 then - hs:='TRUE' - else - hs:='FALSE'; + if assigned(hp.paratype.def.typesym) then + begin + if hp.paratyp in [vs_var,vs_const,vs_out] then + s := s + ' '; + hs:=hp.paratype.def.typesym.realname; + if hs[1]<>'$' then + s:=s+hp.paratype.def.typesym.realname + else + s:=s+hp.paratype.def.gettypename; + end; + { default value } + if assigned(hp.defaultvalue) then + begin + hpc:=tconstsym(hp.defaultvalue); + hs:=''; + case hpc.consttyp of + conststring, + constresourcestring : + hs:=strpas(pchar(hpc.value.valueptr)); + constreal : + str(pbestreal(hpc.value.valueptr)^,hs); + constord : + hs:=tostr(hpc.value.valueord); + constpointer : + hs:=tostr(hpc.value.valueordptr); + constbool : + begin + if hpc.value.valueord<>0 then + hs:='TRUE' + else + hs:='FALSE'; + end; + constnil : + hs:='nil'; + constchar : + hs:=chr(hpc.value.valueord); + constset : + hs:=''; end; - constnil : - hs:='nil'; - constchar : - hs:=chr(hpc.value.valueord); - constset : - hs:=''; - end; - if hs<>'' then - s:=s+'="'+hs+'"'; - end; + if hs<>'' then + s:=s+'="'+hs+'"'; + end; + end; hp:=TParaItem(hp.previous); - if assigned(hp) then + if assigned(hp) and (hp.paratyp<>vs_hidden) then s:=s+','; end; s:=s+')'; @@ -3810,17 +3823,20 @@ implementation end; { we need to use the symtable where the procsym is inserted, because that is visible to the world } - s:=mangledname_prefix('',procsym.owner)+procsym.name+'$'; + s:=mangledname_prefix('',procsym.owner)+procsym.name; if overloadnumber>0 then - s:=s+tostr(overloadnumber)+'$'; + s:=s+'$'+tostr(overloadnumber); { add parameter types } hp:=TParaItem(Para.last); + if assigned(hp) and (hp.paratyp<>vs_hidden) then + s:=s+'$'; while assigned(hp) do begin - s:=s+hp.paratype.def.mangledparaname; + if hp.paratyp<>vs_hidden then + s:=s+hp.paratype.def.mangledparaname; hp:=TParaItem(hp.previous); - if assigned(hp) then - s:=s+'$'; + if assigned(hp) and (hp.paratyp<>vs_hidden) then + s:=s+'$'; end; _mangledname:=stringdup(s); mangledname:=_mangledname^; @@ -5522,7 +5538,10 @@ implementation end. { $Log$ - Revision 1.116 2002-12-15 11:26:02 peter + Revision 1.117 2002-12-15 19:34:31 florian + + some front end stuff for vs_hidden added + + Revision 1.116 2002/12/15 11:26:02 peter * ignore vs_hidden parameters when choosing overloaded proc Revision 1.115 2002/12/07 14:27:09 carl