Răsfoiți Sursa

+ some front end stuff for vs_hidden added

florian 22 ani în urmă
părinte
comite
3f5541e996
3 a modificat fișierele cu 95 adăugiri și 51 ștergeri
  1. 21 2
      compiler/cclasses.pas
  2. 8 2
      compiler/pdecsub.pas
  3. 66 47
      compiler/symdef.pas

+ 21 - 2
compiler/cclasses.pas

@@ -78,6 +78,8 @@ interface
           procedure Clear;
           procedure Clear;
           { inserts an Item }
           { inserts an Item }
           procedure Insert(Item:TLinkedListItem);
           procedure Insert(Item:TLinkedListItem);
+          { inserts an Item after Loc }
+          procedure InsertAfter(Item,Loc : TLinkedListItem);
           { concats an Item }
           { concats an Item }
           procedure Concat(Item:TLinkedListItem);
           procedure Concat(Item:TLinkedListItem);
           { deletes an Item }
           { deletes an Item }
@@ -318,7 +320,7 @@ implementation
          begin
          begin
 {$ifndef Delphi}
 {$ifndef Delphi}
            inc(TotalMem,memavail-startmem);
            inc(TotalMem,memavail-startmem);
-{$endif}           
+{$endif}
            startmem:=0;
            startmem:=0;
          end;
          end;
       end;
       end;
@@ -472,6 +474,20 @@ end;
       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);
     procedure TLinkedList.Concat(Item:TLinkedListItem);
       begin
       begin
         if FFirst=nil then
         if FFirst=nil then
@@ -1821,7 +1837,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $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
     - remove some unused defines
 
 
   Revision 1.20  2002/10/05 12:43:23  carl
   Revision 1.20  2002/10/05 12:43:23  carl

+ 8 - 2
compiler/pdecsub.pas

@@ -128,7 +128,7 @@ implementation
                  (tsym(indexnext).typ=varsym) and
                  (tsym(indexnext).typ=varsym) and
                  (copy(tvarsym(indexnext).name,1,4)='high') then
                  (copy(tvarsym(indexnext).name,1,4)='high') then
                begin
                begin
-                 { removing it is to complicated,
+                 { removing it is too complicated,
                    we just hide it PM }
                    we just hide it PM }
                  highname:='hidden'+copy(tvarsym(indexnext).name,5,high(name));
                  highname:='hidden'+copy(tvarsym(indexnext).name,5,high(name));
                  Message(parser_w_cdecl_has_no_high);
                  Message(parser_w_cdecl_has_no_high);
@@ -365,6 +365,9 @@ implementation
                       begin
                       begin
                         hvs:=tvarsym.create('$high'+vs.name,s32bittype);
                         hvs:=tvarsym.create('$high'+vs.name,s32bittype);
                         hvs.varspez:=vs_const;
                         hvs.varspez:=vs_const;
+{$ifdef vs_hidden}
+                        aktprocdef.concatpara(s32bittype,hvs,vs_hidden,nil);
+{$endif vs_hidden}
                         currparast.insert(hvs);
                         currparast.insert(hvs);
                       end;
                       end;
                      aktprocdef.concatpara(tt,vs,varspez,tdefaultvalue);
                      aktprocdef.concatpara(tt,vs,varspez,tdefaultvalue);
@@ -2076,7 +2079,10 @@ const
 end.
 end.
 {
 {
   $Log$
   $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
     * 3% memory optimization
     * changed some types
     * changed some types
     + added type checking with different size for call node and for
     + added type checking with different size for call node and for

+ 66 - 47
compiler/symdef.pas

@@ -3186,12 +3186,22 @@ implementation
         hp : TParaItem;
         hp : TParaItem;
         hpc : tconstsym;
         hpc : tconstsym;
       begin
       begin
+        { look for a visible parameter }
         hp:=TParaItem(Para.last);
         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
         if not(assigned(hp)) then
           begin
           begin
              typename_paras:='';
              typename_paras:='';
              exit;
              exit;
           end;
           end;
+
+        hp:=TParaItem(Para.last);
         s:='(';
         s:='(';
         while assigned(hp) do
         while assigned(hp) do
          begin
          begin
@@ -3201,50 +3211,53 @@ implementation
              s:=s+'const'
              s:=s+'const'
            else if hp.paratyp=vs_out then
            else if hp.paratyp=vs_out then
              s:=s+'out';
              s:=s+'out';
-           if assigned(hp.paratype.def.typesym) then
+           if hp.paratyp<>vs_hidden then
              begin
              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:='<set>';
                   end;
                   end;
-                constnil :
-                  hs:='nil';
-                constchar :
-                  hs:=chr(hpc.value.valueord);
-                constset :
-                  hs:='<set>';
-              end;
-              if hs<>'' then
-               s:=s+'="'+hs+'"';
-            end;
+                  if hs<>'' then
+                   s:=s+'="'+hs+'"';
+                end;
+             end;
            hp:=TParaItem(hp.previous);
            hp:=TParaItem(hp.previous);
-           if assigned(hp) then
+           if assigned(hp) and (hp.paratyp<>vs_hidden) then
             s:=s+',';
             s:=s+',';
          end;
          end;
         s:=s+')';
         s:=s+')';
@@ -3810,17 +3823,20 @@ implementation
          end;
          end;
         { we need to use the symtable where the procsym is inserted,
         { we need to use the symtable where the procsym is inserted,
           because that is visible to the world }
           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
         if overloadnumber>0 then
-         s:=s+tostr(overloadnumber)+'$';
+         s:=s+'$'+tostr(overloadnumber);
         { add parameter types }
         { add parameter types }
         hp:=TParaItem(Para.last);
         hp:=TParaItem(Para.last);
+        if assigned(hp) and (hp.paratyp<>vs_hidden) then
+          s:=s+'$';
         while assigned(hp) do
         while assigned(hp) do
          begin
          begin
-           s:=s+hp.paratype.def.mangledparaname;
+           if hp.paratyp<>vs_hidden then
+             s:=s+hp.paratype.def.mangledparaname;
            hp:=TParaItem(hp.previous);
            hp:=TParaItem(hp.previous);
-           if assigned(hp) then
-            s:=s+'$';
+           if assigned(hp) and (hp.paratyp<>vs_hidden) then
+             s:=s+'$';
          end;
          end;
         _mangledname:=stringdup(s);
         _mangledname:=stringdup(s);
         mangledname:=_mangledname^;
         mangledname:=_mangledname^;
@@ -5522,7 +5538,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * ignore vs_hidden parameters when choosing overloaded proc
 
 
   Revision 1.115  2002/12/07 14:27:09  carl
   Revision 1.115  2002/12/07 14:27:09  carl