Переглянути джерело

+ browsing updated and developed
records and objects fields are also stored

pierre 27 роки тому
батько
коміт
b2661d12be
7 змінених файлів з 163 додано та 25 видалено
  1. 66 12
      compiler/browser.pas
  2. 11 2
      compiler/files.pas
  3. 6 1
      compiler/gdb.pas
  4. 18 1
      compiler/parser.pas
  5. 49 6
      compiler/pmodules.pas
  6. 6 2
      compiler/switches.pas
  7. 7 1
      compiler/symppu.inc

+ 66 - 12
compiler/browser.pas

@@ -67,8 +67,9 @@ type
     procedure closelog;
     procedure ident;
     procedure unident;
-    procedure browse_symbol(s : string);
+    procedure browse_symbol(const sr : string);
     procedure list_elements;
+    procedure list_debug_infos;
   end;
 
 var
@@ -222,6 +223,30 @@ implementation
          stderrlog:=false;
       end;
 
+    procedure tbrowser.list_debug_infos;
+{$ifndef debug}
+      begin
+      end;
+{$else debug}
+      var
+         hp : pmodule;
+         ff : pinputfile;
+      begin
+         hp:=pmodule(loaded_units.first);
+         while assigned(hp) do
+           begin
+              addlog('Unit '+hp^.modulename^+' has index '+tostr(hp^.unit_index));
+              ff:=hp^.sourcefiles.files;
+              while assigned(ff) do
+                begin
+                   addlog('File '+ff^.name^+' index '+tostr(ff^.ref_index));
+                   ff:=ff^.ref_next;
+                end;
+              hp:=pmodule(hp^.next);
+           end;
+      end;
+{$endif debug}
+      
     procedure tbrowser.addlog(const s:string);
       begin
         if not logopen then
@@ -265,12 +290,12 @@ implementation
       end;
 
 
-    procedure tbrowser.browse_symbol(s : string);
+    procedure tbrowser.browse_symbol(const sr : string);
       var
          sym,symb : psym;
          symt : psymtable;
          hp : pmodule;
-         ss : string;
+         s,ss : string;
          p : byte;
 
          procedure next_substring;
@@ -286,11 +311,32 @@ implementation
                   ss:=s;
                   s:='';
                 end;
+              addlog('substring : '+ss);
           end;
       begin
+         s:=sr;
          symt:=symtablestack;
          next_substring;
-         sym:=symt^.search(ss);
+         if assigned(symt) then
+           begin
+              sym:=symt^.search(ss);
+              if sym=nil then
+                sym:=symt^.search(upper(ss));
+           end
+         else
+           sym:=nil;
+         if assigned(sym) and (sym^.typ=unitsym) and (s<>'') then
+           begin
+              addlog('Unitsym found !');
+              symt:=punitsym(sym)^.unitsymtable;
+              if assigned(symt) then
+                begin
+                   next_substring;
+                   sym:=symt^.search(ss);
+                end
+              else
+                sym:=nil;
+           end;
          if not assigned(sym) then
            begin
               symt:=nil;
@@ -298,7 +344,7 @@ implementation
               hp:=pmodule(loaded_units.first);
               while assigned(hp) do
                 begin
-                   if hp^.modulename^=ss then
+                   if hp^.modulename^=upper(ss) then
                      begin
                         symt:=hp^.symtable;
                         break;
@@ -314,15 +360,11 @@ implementation
                 begin
                    next_substring;
                    sym:=symt^.search(ss);
+                   if sym=nil then
+                     sym:=symt^.search(upper(ss));
                 end;
            end;
 
-         if (sym^.typ=unitsym) and (s<>'') then
-           begin
-              symt:=punitsym(sym)^.unitsymtable;
-              next_substring;
-              sym:=symt^.search(ss);
-           end;
          while assigned(sym) and (s<>'') do
            begin
               next_substring;
@@ -336,6 +378,8 @@ implementation
                           else
                             symt:=pobjectdef(ptypesym(sym)^.definition)^.publicsyms;
                           sym:=symt^.search(ss);
+                          if sym=nil then
+                            sym:=symt^.search(upper(ss));
                        end;
                   end;
                 varsym :
@@ -347,16 +391,22 @@ implementation
                           else
                             symt:=pobjectdef(pvarsym(sym)^.definition)^.publicsyms;
                           sym:=symt^.search(ss);
+                          if sym=nil then
+                            sym:=symt^.search(upper(ss));
                        end;
                   end;
                 procsym :
                   begin
                      symt:=pprocsym(sym)^.definition^.parast;
                      symb:=symt^.search(ss);
+                     if symb=nil then
+                       symb:=symt^.search(upper(ss));
                      if not assigned(symb) then
                        begin
                           symt:=pprocsym(sym)^.definition^.parast;
                           sym:=symt^.search(ss);
+                          if symb=nil then
+                            symb:=symt^.search(upper(ss));
                        end
                      else
                        sym:=symb;
@@ -417,7 +467,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.7  1998-09-21 08:45:05  pierre
+  Revision 1.8  1998-09-22 17:13:42  pierre
+    + browsing updated and developed
+      records and objects fields are also stored
+
+  Revision 1.7  1998/09/21 08:45:05  pierre
     + added vmt_offset in tobjectdef.write for fututre use
       (first steps to have objects without vmt if no virtual !!)
     + added fpu_used field for tabstractprocdef  :

+ 11 - 2
compiler/files.pas

@@ -123,7 +123,9 @@ unit files;
           unitcount     : word;     { local unit counter }
           unit_index    : word;     { global counter for browser }
           symtable      : pointer;  { pointer to the psymtable of this unit }
-
+{$ifdef UseBrowser}
+          implsymtable  : pointer;
+{$endif UseBrowser}
           uses_imports  : boolean;  { Set if the module imports from DLL's.}
           imports       : plinkedlist;
 
@@ -795,6 +797,9 @@ unit files;
          scanner:=nil;
          map:=nil;
          symtable:=nil;
+{$ifdef UseBrowser}
+         implsymtable:=nil;
+{$endif UseBrowser}
          flags:=0;
          crc:=0;
          unitcount:=1;
@@ -887,7 +892,11 @@ unit files;
 end.
 {
   $Log$
-  Revision 1.46  1998-09-21 08:45:10  pierre
+  Revision 1.47  1998-09-22 17:13:43  pierre
+    + browsing updated and developed
+      records and objects fields are also stored
+
+  Revision 1.46  1998/09/21 08:45:10  pierre
     + added vmt_offset in tobjectdef.write for fututre use
       (first steps to have objects without vmt if no virtual !!)
     + added fpu_used field for tabstractprocdef  :

+ 6 - 1
compiler/gdb.pas

@@ -174,6 +174,7 @@ N_BINCL to N_EINCL
                if do_count then
                  begin
                    dbx_counter^ := dbx_counter^+byte(st[i]);
+                   { skip file number }
                    if st[i] = '(' then
                      begin
                         inc(i);
@@ -242,7 +243,11 @@ end.
 
 {
   $Log$
-  Revision 1.2  1998-07-10 08:31:38  pierre
+  Revision 1.3  1998-09-22 17:13:45  pierre
+    + browsing updated and developed
+      records and objects fields are also stored
+
+  Revision 1.2  1998/07/10 08:31:38  pierre
     *  Just the N_FNAME to N_FUN substitution for stabs of functions
       thanks again Daniel !!
 

+ 18 - 1
compiler/parser.pas

@@ -136,6 +136,11 @@ unit parser;
          oldaktoptprocessor : tprocessors;
          oldaktasmmode      : tasmmode;
 
+{$ifdef usebrowser}
+{$ifdef debug}
+         hp : pmodule;
+{$endif debug}
+{$endif usebrowser}
 
       begin
          inc(compile_level);
@@ -356,6 +361,14 @@ unit parser;
              end;
 {$ifdef UseBrowser}
           { Write Browser }
+{$ifdef debug}
+            hp:=pmodule(loaded_units.first);
+            while assigned(hp) do
+              begin
+                 writeln('Unit ',hp^.modulename^,' has index ',hp^.unit_index);
+                 hp:=pmodule(hp^.next);
+              end;
+{$endif debug}
             if cs_browser in aktmoduleswitches then
               if Browse.elements_to_list^.empty then
                 begin
@@ -373,7 +386,11 @@ unit parser;
 end.
 {
   $Log$
-  Revision 1.47  1998-09-21 09:00:18  peter
+  Revision 1.48  1998-09-22 17:13:48  pierre
+    + browsing updated and developed
+      records and objects fields are also stored
+
+  Revision 1.47  1998/09/21 09:00:18  peter
     * reset_gdb_info only when debuginfo is set
 
   Revision 1.46  1998/09/21 08:45:12  pierre

+ 49 - 6
compiler/pmodules.pas

@@ -255,6 +255,14 @@ unit pmodules;
              punitsymtable(current_module^.symtable)^.
                load_symtable_refs;
           end;
+        if ((current_module^.flags and uf_has_browser)<>0) and
+           (cs_local_browser in aktmoduleswitches) then
+          begin
+             current_module^.implsymtable:=new(psymtable,load);
+             psymtable(current_module^.implsymtable)^.name:=
+               stringdup('implementation of '+psymtable(current_module^.symtable)^.name^);
+             psymtable(current_module^.implsymtable)^.load_browser;
+          end;
 {$endif UseBrowser}
         { remove the map, it's not needed anymore }
         dispose(current_module^.map);
@@ -345,6 +353,7 @@ unit pmodules;
          if (not assigned(st)) then
           begin
           { if the unit is loaded remove it first }
+          { this creates problem with the browser !! }
             if assigned(hp) then
              begin
                { remove the old unit }
@@ -650,7 +659,11 @@ unit pmodules;
 
          { number the definitions, so a deref from other units works }
          refsymtable^.number_defs;
-
+{$ifdef UseBrowser}
+         refsymtable^.number_symbols;
+         { we don't want implementation units symbols in unitsymtable !! PM }
+         refsymtable:=p;
+{$endif UseBrowser}
          { Read the implementation units }
          parse_implementation_uses(unitst);
 
@@ -724,6 +737,9 @@ unit pmodules;
          { size of the static data }
          datasize:=symtablestack^.datasize;
 
+         { avoid self recursive destructor call !! PM }
+         aktprocsym^.definition^.localst:=nil;
+         
          { unsed static symbols ? }
          symtablestack^.allsymbolsused;
 
@@ -741,7 +757,10 @@ unit pmodules;
          current_module^.in_implementation:=false;
          { deletes all symtables generated in the implementation part }
          while symtablestack^.symtabletype<>globalsymtable do
-           dellexlevel;
+           if cs_local_browser in aktmoduleswitches then
+             symtablestack:=symtablestack^.next
+           else
+             dellexlevel;
 
          { tests, if all forwards are resolved }
          symtablestack^.check_forwards;
@@ -755,7 +774,17 @@ unit pmodules;
 
          {Write out the unit if the compile was succesfull.}
          if status.errorcount=0 then
-          writeunitas(current_module^.ppufilename^,punitsymtable(symtablestack));
+          begin
+             writeunitas(current_module^.ppufilename^,punitsymtable(symtablestack));
+{$ifdef UseBrowser}
+            if cs_local_browser in aktmoduleswitches then
+              begin
+                 current_module^.implsymtable:=refsymtable;
+                 refsymtable^.write;
+                 refsymtable^.write_browser;
+              end;
+{$endif UseBrowser}
+          end;
 
 {$ifdef GDB}
          pu:=pused_unit(usedunits.first);
@@ -822,8 +851,17 @@ unit pmodules;
          { of the program                                              }
          st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
 
+         { necessary for browser }
+         loaded_units.insert(current_module);
+
+
          {Generate a procsym.}
          make_ref:=false;
+         { this was missing !!
+           the procdef was registered to systemunit
+           after the defhasharray was set !!
+           so the defhasharray became wrong !! PM }
+         symtablestack:=st;
          aktprocsym:=new(Pprocsym,init('main'));
          aktprocsym^.definition:=new(Pprocdef,init);
          aktprocsym^.definition^.options:=aktprocsym^.definition^.options or poproginit;
@@ -836,8 +874,6 @@ unit pmodules;
 
          refsymtable:=st;
 
-         { necessary for browser }
-         loaded_units.insert(current_module);
 
          {Insert the symbols of the system unit into the stack of symbol
           tables.}
@@ -887,6 +923,9 @@ unit pmodules;
          compile_proc_body(names,true,false);
          names.done;
 
+         { avoid self recursive destructor call !! PM }
+         aktprocsym^.definition^.localst:=nil;
+         
          codegen_doneprocedure;
 
          consume(POINT);
@@ -928,7 +967,11 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.51  1998-09-22 15:40:55  peter
+  Revision 1.52  1998-09-22 17:13:49  pierre
+    + browsing updated and developed
+      records and objects fields are also stored
+
+  Revision 1.51  1998/09/22 15:40:55  peter
     * some extra ifdef GDB
 
   Revision 1.50  1998/09/21 08:45:17  pierre

+ 6 - 2
compiler/switches.pas

@@ -53,7 +53,7 @@ const
    {I} (typesw:localsw; setsw:ord(cs_check_io)),
    {J} (typesw:illegalsw; setsw:ord(cs_localnone)),
    {K} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
-   {L} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
+   {L} (typesw:modulesw; setsw:ord(cs_local_browser)),
    {M} (typesw:localsw; setsw:ord(cs_generate_rtti)),
    {N} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
    {O} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
@@ -154,7 +154,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.12  1998-09-01 12:52:05  peter
+  Revision 1.13  1998-09-22 17:13:52  pierre
+    + browsing updated and developed
+      records and objects fields are also stored
+
+  Revision 1.12  1998/09/01 12:52:05  peter
     + a lot of delphi switches
 
   Revision 1.11  1998/08/18 20:52:21  peter

+ 7 - 1
compiler/symppu.inc

@@ -196,6 +196,8 @@
 {$ifdef UseBrowser}
             if cs_browser in aktmoduleswitches then
              flags:=flags or uf_has_browser;
+            if cs_local_browser in aktmoduleswitches then
+             flags:=flags or uf_local_browser;
 {$endif UseBrowser}
           end;
 
@@ -441,7 +443,11 @@
 
 {
   $Log$
-  Revision 1.16  1998-09-22 15:40:56  peter
+  Revision 1.17  1998-09-22 17:13:53  pierre
+    + browsing updated and developed
+      records and objects fields are also stored
+
+  Revision 1.16  1998/09/22 15:40:56  peter
     * some extra ifdef GDB
 
   Revision 1.15  1998/09/21 08:45:23  pierre