Ver código fonte

Extract the code to export the symbols of a unit to its own function in pkgutil so that less functions need to be exported.

pmodules.pas, proc_package:
  * move code to export the symbols of a unit to new function export_unit
pkgutil.pas:
  + new function export_unit
  - remove exports of procexport, varexport and insert_export

git-svn-id: branches/svenbarth/packages@28840 -
svenbarth 10 anos atrás
pai
commit
1ca193885f
2 arquivos alterados com 21 adições e 15 exclusões
  1. 20 4
      compiler/pkgutil.pas
  2. 1 11
      compiler/pmodules.pas

+ 20 - 4
compiler/pkgutil.pas

@@ -26,11 +26,12 @@ unit pkgutil;
 
 
 interface
 interface
 
 
+  uses
+    fmodule;
+
   procedure createimportlibfromexports;
   procedure createimportlibfromexports;
   Function RewritePPU(const PPUFn,PPLFn:String):Boolean;
   Function RewritePPU(const PPUFn,PPLFn:String):Boolean;
-  procedure insert_export(sym : TObject;arg:pointer);
-  procedure procexport(const s : string);
-  procedure varexport(const s : string);
+  procedure export_unit(u:tmodule);
 
 
 implementation
 implementation
 
 
@@ -40,7 +41,7 @@ implementation
     cutils,cclasses,
     cutils,cclasses,
     verbose,
     verbose,
     symtype,symconst,symsym,symdef,symbase,
     symtype,symconst,symsym,symdef,symbase,
-    ppu,entfile,fmodule,
+    ppu,entfile,
     export;
     export;
 
 
   procedure procexport(const s : string);
   procedure procexport(const s : string);
@@ -113,6 +114,21 @@ implementation
     end;
     end;
 
 
 
 
+  procedure export_unit(u: tmodule);
+    begin
+      u.globalsymtable.symlist.ForEachCall(@insert_export,u.globalsymtable);
+      { check localsymtable for exports too to get public symbols }
+      u.localsymtable.symlist.ForEachCall(@insert_export,u.localsymtable);
+
+      { create special exports }
+      if (u.flags and uf_init)<>0 then
+        procexport(make_mangledname('INIT$',u.globalsymtable,''));
+      if (u.flags and uf_finalize)<>0 then
+        procexport(make_mangledname('FINALIZE$',u.globalsymtable,''));
+      if (u.flags and uf_threadvars)=uf_threadvars then
+        varexport(make_mangledname('THREADVARLIST',u.globalsymtable,''));
+    end;
+
   Function RewritePPU(const PPUFn,PPLFn:String):Boolean;
   Function RewritePPU(const PPUFn,PPLFn:String):Boolean;
     Var
     Var
       MakeStatic : Boolean;
       MakeStatic : Boolean;

+ 1 - 11
compiler/pmodules.pas

@@ -1504,17 +1504,7 @@ type
          uu:=tused_unit(usedunits.first);
          uu:=tused_unit(usedunits.first);
          while assigned(uu) do
          while assigned(uu) do
            begin
            begin
-             uu.u.globalsymtable.symlist.ForEachCall(@insert_export,uu.u.globalsymtable);
-             { check localsymtable for exports too to get public symbols }
-             uu.u.localsymtable.symlist.ForEachCall(@insert_export,uu.u.localsymtable);
-
-             { create special exports }
-             if (uu.u.flags and uf_init)<>0 then
-               procexport(make_mangledname('INIT$',uu.u.globalsymtable,''));
-             if (uu.u.flags and uf_finalize)<>0 then
-               procexport(make_mangledname('FINALIZE$',uu.u.globalsymtable,''));
-             if (uu.u.flags and uf_threadvars)=uf_threadvars then
-               varexport(make_mangledname('THREADVARLIST',uu.u.globalsymtable,''));
+             export_unit(uu.u);
 
 
              uu:=tused_unit(uu.next);
              uu:=tused_unit(uu.next);
            end;
            end;