Browse Source

+ changes for resourcestrings

michael 26 years ago
parent
commit
85ff3e15db
3 changed files with 58 additions and 8 deletions
  1. 8 5
      compiler/hcodegen.pas
  2. 45 2
      compiler/pmodules.pas
  3. 5 1
      compiler/ppu.pas

+ 8 - 5
compiler/hcodegen.pas

@@ -151,7 +151,7 @@ unit hcodegen;
 implementation
 
      uses
-        systems,globals,files,strings;
+        systems,globals,files,strings,cresstr;
 
 {*****************************************************************************
             override the message calls to set codegenerror
@@ -253,7 +253,7 @@ implementation
          asmsymbollist:=new(pasmsymbollist,init);
          asmsymbollist^.usehash;
          { resourcestrings }
-         resourcestringlist:=nil;
+         ResetResourceStrings;
       end;
 
 
@@ -276,8 +276,8 @@ implementation
          { assembler symbols }
          dispose(asmsymbollist,done);
          { resource strings }
-         if assigned(resourcestringlist) then
-          dispose(resourcestringlist,done);
+         { if assigned(resourcestringlist) then
+          dispose(resourcestringlist,done); }
       end;
 
 
@@ -296,7 +296,10 @@ end.
 
 {
   $Log$
-  Revision 1.39  1999-08-19 13:10:18  pierre
+  Revision 1.40  1999-08-24 12:01:32  michael
+  + changes for resourcestrings
+
+  Revision 1.39  1999/08/19 13:10:18  pierre
    + faillabel for _FAIL
 
   Revision 1.38  1999/08/16 18:23:56  peter

+ 45 - 2
compiler/pmodules.pas

@@ -111,6 +111,39 @@ unit pmodules;
 {$endif GDB}
       end;
 
+    Procedure InsertResourceTablesTable;
+
+      var
+        hp : pused_unit;
+        ResourceStringTables : taasmoutput;
+        count : longint;
+      begin
+        ResourceStringTables.init;
+        count:=0;
+        hp:=pused_unit(usedunits.first);
+        while assigned(hp) do
+         begin
+           If (hp^.u^.flags and uf_has_resources)=uf_has_resources then
+             ResourceStringTables.concat(new(pai_const_symbol,initname(hp^.u^.modulename^+'_RESOURCESTRINGTABLE')));
+           hp:=Pused_unit(hp^.next);
+           inc(count);
+         end;
+        { TableCount }
+        With ResourceStringTables do
+          begin
+          insert(new(pai_const,init_32bit(count)));
+          insert(new(pai_symbol,initname_global('FPC_RESOURCESTRINGTABLES',0)));
+          concat(new(pai_symbol_end,initname('FPC_RESOURCESTRINGTABLES')));
+          end;
+        { insert in data segment }
+        if (cs_smartlink in aktmoduleswitches) then
+          datasegment^.concat(new(pai_cut,init));
+        datasegment^.concatlist(@ResourceStringTables);
+        ResourceStringTables.done;
+      end;
+    
+    
+
     procedure InsertInitFinalTable;
       var
         hp : pused_unit;
@@ -1068,6 +1101,12 @@ unit pmodules;
 
          { the last char should always be a point }
          consume(_POINT);
+         
+         If ResourceStringList<>Nil then
+           begin
+           insertresourcestrings;
+           current_module^.flags:=current_module^.flags or uf_has_resources;
+           end;
 
          { avoid self recursive destructor call !! PM }
          aktprocsym^.definition^.localst:=nil;
@@ -1324,10 +1363,11 @@ unit pmodules;
 
          { insert heap }
          insertresourcestrings;
+         insertResourceTablesTable;
          insertinitfinaltable;
          insertheap;
          inserttargetspecific;
-
+    
          datasize:=symtablestack^.datasize;
 
          { finish asmlist by adding segment starts }
@@ -1369,7 +1409,10 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.142  1999-08-16 15:35:27  pierre
+  Revision 1.143  1999-08-24 12:01:34  michael
+  + changes for resourcestrings
+
+  Revision 1.142  1999/08/16 15:35:27  pierre
     * fix for DLL relocation problems
     * external bss vars had wrong stabs for pecoff
     + -WB11000000 to specify default image base, allows to

+ 5 - 1
compiler/ppu.pas

@@ -126,6 +126,7 @@ const
   uf_local_browser = $200;
   uf_no_link       = $400; { unit has no .o generated, but can still have
                              external linking! }
+  uf_has_resources = $800; { unit has resource section }
 
 type
 {$ifdef m68k}
@@ -903,7 +904,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.38  1999-08-15 10:47:48  peter
+  Revision 1.39  1999-08-24 12:01:36  michael
+  + changes for resourcestrings
+
+  Revision 1.38  1999/08/15 10:47:48  peter
     + normalset,smallset writing
 
   Revision 1.37  1999/08/02 23:13:20  florian