Ver Fonte

* local browser stuff corrected

pierre há 26 anos atrás
pai
commit
05b6362265

+ 5 - 2
compiler/browcol.pas

@@ -544,7 +544,7 @@ begin
     labelsym     : S:='label';
     absolutesym  : S:='abs';
     propertysym  : S:='prop';
-    funcretsym   : S:='func';
+    funcretsym   : S:='res';
     macrosym     : S:='macro';
   else S:='';
   end;
@@ -1230,7 +1230,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.16  1999-05-13 21:59:20  peter
+  Revision 1.17  1999-06-22 16:24:39  pierre
+   * local browser stuff corrected
+
+  Revision 1.16  1999/05/13 21:59:20  peter
     * removed oldppu code
     * warning if objpas is loaded from uses
     * first things for new deref writing

+ 8 - 1
compiler/compiler.pas

@@ -229,7 +229,11 @@ begin
    begin
      olddo_stop:=do_stop;
      recoverpospointer:=@recoverpos;
+{$ifdef TP}
      do_stop:=recoverstop;
+{$else TP}
+     do_stop:=@recoverstop;
+{$endif TP}
 {$endif USEEXCEPT}
      starttime:=getrealtime;
      parser.compile(inputdir+inputfile+inputextension,false);
@@ -267,7 +271,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.22  1999-05-17 14:24:32  pierre
+  Revision 1.23  1999-06-22 16:24:41  pierre
+   * local browser stuff corrected
+
+  Revision 1.22  1999/05/17 14:24:32  pierre
    * DoneCompiler called later to prevent accessing invalid data
 
   Revision 1.21  1999/05/04 21:44:39  florian

+ 10 - 54
compiler/m68k.pas

@@ -26,7 +26,7 @@ unit m68k;
   interface
 
     uses
-       cobjects,aasm;
+       cobjects,aasm,globtype;
 
     const
       { if real fpu is used }
@@ -255,30 +255,14 @@ unit m68k;
 
     type
 
-       pai_extended = ^tai_extended;
-
-       { generates an extended - processor specific }
-       tai_extended = object(tai)
-          value : bestreal;
-          constructor init(_value : bestreal);
-       end;
-
-       pai_comp = ^tai_comp;
-
-       { generates a comp - processor specific  }
-       tai_comp = object(tai)
-          value : bestreal;
-          constructor init(_value : bestreal);
-       end;
-
        pai_labeled = ^tai_labeled;
 
        tai_labeled = object(tai)
           _operator : tasmop;
           _op1: tregister;
-          lab : plabel;
-          constructor init(op : tasmop; l : plabel);
-          constructor init_reg(op: tasmop; l : plabel; reg: tregister);
+          lab : pasmlabel;
+          constructor init(op : tasmop; l : pasmlabel);
+          constructor init_reg(op: tasmop; l : pasmlabel; reg: tregister);
           destructor done;virtual;
        end;
 
@@ -338,12 +322,6 @@ unit m68k;
       destructor done;virtual;
        end;
 
-const
-       ait_bestreal = ait_real_64bit;
-type
-       pai_bestreal = pai_double;
-       tai_bestreal = tai_double;
-
     const
        maxvarregs = 5;
        varregs : array[1..maxvarregs] of tregister =
@@ -1544,7 +1522,7 @@ type
                               TAI_LABELED
  ****************************************************************************}
 
-    constructor tai_labeled.init(op : tasmop; l : plabel);
+    constructor tai_labeled.init(op : tasmop; l : pasmlabel);
 
       begin
          inherited init;
@@ -1556,7 +1534,7 @@ type
          inc(lab^.refcount);
       end;
 
-    constructor tai_labeled.init_reg(op : tasmop; l : plabel; reg: tregister);
+    constructor tai_labeled.init_reg(op : tasmop; l : pasmlabel; reg: tregister);
 
       begin
          inherited init;
@@ -1580,35 +1558,13 @@ type
            End;
          inherited done;
       end;
-{****************************************************************************
-                               TAI_EXTENDED
- ****************************************************************************}
-
-    constructor tai_extended.init(_value : bestreal);
-
-      begin
-         inherited init;
-         typ:=ait_real_extended;
-         value:=_value;
-      end;
-
-
-{****************************************************************************
-                               TAI_COMP
- ****************************************************************************}
-
-    constructor tai_comp.init(_value : bestreal);
-
-      begin
-         inherited init;
-         typ:=ait_comp;
-         value:=_value;
-      end;
-
 end.
 {
   $Log$
-  Revision 1.10  1998-10-29 11:35:45  florian
+  Revision 1.11  1999-06-22 16:24:42  pierre
+   * local browser stuff corrected
+
+  Revision 1.10  1998/10/29 11:35:45  florian
     * some dll support for win32
     * fixed assembler writing for PalmOS
 

+ 8 - 1
compiler/pstatmnt.pas

@@ -1119,15 +1119,19 @@ unit pstatmnt;
 
       var
          funcretsym : pfuncretsym;
+         storepos : tfileposinfo; 
 
       begin
          if procinfo.retdef<>pdef(voiddef) then
            begin
               { if the current is a function aktprocsym is non nil }
               { and there is a local symtable set }
+              storepos:=tokenpos;
+              tokenpos:=aktprocsym^.fileinfo;
               funcretsym:=new(pfuncretsym,init(aktprocsym^.name,@procinfo));
               { insert in local symtable }
               symtablestack^.insert(funcretsym);
+              tokenpos:=storepos;
               if ret_in_acc(procinfo.retdef) or (procinfo.retdef^.deftype=floatdef) then
                 procinfo.retoffset:=-funcretsym^.address;
               procinfo.funcretsym:=funcretsym;
@@ -1272,7 +1276,10 @@ unit pstatmnt;
 end.
 {
   $Log$
-  Revision 1.89  1999-06-17 13:19:54  pierre
+  Revision 1.90  1999-06-22 16:24:43  pierre
+   * local browser stuff corrected
+
+  Revision 1.89  1999/06/17 13:19:54  pierre
    * merged from 0_99_12 branch
 
   Revision 1.88.2.1  1999/06/17 12:51:46  pierre

+ 7 - 36
compiler/symdef.inc

@@ -2304,6 +2304,7 @@
           to check same names in parast and localst }
          localst^.next:=parast;
          defref:=nil;
+         crossref:=nil;
          lastwritten:=nil;
          refcount:=0;
          if (cs_browser in aktmoduleswitches) and make_ref then
@@ -2400,45 +2401,12 @@ Const local_symtable_index : longint = $8001;
           begin
 {$ifndef NOLOCALBROWSER}
              pdo:=_class;
-             if assigned(pdo) and (owner^.symtabletype<>localsymtable) then
-               localsymtablestack:=pdo^.publicsyms;
-             if owner^.symtabletype<>localsymtable then
-               while assigned(pdo) do
-                 begin
-                    if pdo^.publicsyms<>aktrecordsymtable then
-                      begin
-                         pdo^.publicsyms^.unitid:=local_symtable_index;
-                         inc(local_symtable_index);
-                      end;
-                    pdo:=pdo^.childof;
-                 end;
-
              new(parast,loadas(parasymtable));
-             parast^.next:=localsymtablestack;
-             localsymtablestack:=parast;
-             parast^.unitid:=local_symtable_index;
-             inc(local_symtable_index);
+             parast^.next:=owner;
              parast^.load_browser;
              new(localst,loadas(localsymtable));
-             localst^.next:=localsymtablestack;
-             localsymtablestack:=localst;
-             localst^.unitid:=local_symtable_index;
-             inc(local_symtable_index);
+             localst^.next:=parast;
              localst^.load_browser;
-             { decrement for }
-             local_symtable_index:=local_symtable_index-2;
-             localsymtablestack:=localsymtablestack^.next^.next;
-             pdo:=_class;
-             if (owner^.symtabletype<>localsymtable) then
-               localsymtablestack:=nil;
-             if (owner^.symtabletype<>localsymtable) then
-               while assigned(pdo) do
-                 begin
-                    if pdo^.publicsyms<>aktrecordsymtable then
-                      dec(local_symtable_index);
-                    pdo:=pdo^.childof;
-                 end;
-
 {$endif ndef NOLOCALBROWSER}
           end;
       end;
@@ -3494,7 +3462,10 @@ Const local_symtable_index : longint = $8001;
 
 {
   $Log$
-  Revision 1.129  1999-06-02 22:44:21  pierre
+  Revision 1.130  1999-06-22 16:24:44  pierre
+   * local browser stuff corrected
+
+  Revision 1.129  1999/06/02 22:44:21  pierre
    * previous wrong log corrected
 
   Revision 1.128  1999/06/02 22:25:52  pierre

+ 5 - 1
compiler/symdefh.inc

@@ -395,6 +395,7 @@
           { browser info }
           lastref,
           defref,
+          crossref,
           lastwritten : pref;
           refcount : longint;
           _class : pobjectdef;
@@ -520,7 +521,10 @@
 
 {
   $Log$
-  Revision 1.32  1999-06-02 10:11:51  florian
+  Revision 1.33  1999-06-22 16:24:45  pierre
+   * local browser stuff corrected
+
+  Revision 1.32  1999/06/02 10:11:51  florian
     * make cycle fixed i.e. compilation with 0.99.10
     * some fixes for qword
     * start of register calling conventions

+ 24 - 1
compiler/symppu.inc

@@ -138,6 +138,24 @@
                       current_ppu^.putword(p^.owner^.unitid);
                       break;
                     end;
+                  staticsymtable :
+                    begin
+                      current_ppu^.putbyte(ord(derefaktstaticindex));
+                      current_ppu^.putword(p^.indexnr);
+                      break;
+                    end;
+                  localsymtable :
+                    begin
+                      p:=p^.owner^.defowner;
+                      current_ppu^.putbyte(ord(dereflocal));
+                      current_ppu^.putword(p^.indexnr);
+                    end;
+                  parasymtable :
+                    begin
+                      p:=p^.owner^.defowner;
+                      current_ppu^.putbyte(ord(derefpara));
+                      current_ppu^.putword(p^.indexnr);
+                    end;
                   objectsymtable,
                   recordsymtable :
                     begin
@@ -392,6 +410,8 @@
                 break;
               end;
             derefindex,
+            derefpara,
+            dereflocal,
             derefrecord :
               begin
                 new(p,init(b,current_ppu^.getword));
@@ -560,7 +580,10 @@
 
 {
   $Log$
-  Revision 1.41  1999-05-14 17:52:28  peter
+  Revision 1.42  1999-06-22 16:24:47  pierre
+   * local browser stuff corrected
+
+  Revision 1.41  1999/05/14 17:52:28  peter
     * new deref code
 
   Revision 1.40  1999/05/13 21:59:44  peter

+ 7 - 3
compiler/symsym.inc

@@ -436,12 +436,13 @@
 
 
     procedure tprocsym.load_references;
-      (* var
+      (*var
         prdef,prdef2 : pprocdef;
         b : byte; *)
       begin
          inherited load_references;
-         (* prdef:=definition;
+         (*prdef:=definition;
+           done in tsymtable.load_browser (PM)
          { take care about operators !!  }
          if (current_module^.flags and uf_has_browser) <>0 then
            while assigned(prdef) and (prdef^.owner=definition^.owner) do
@@ -2014,7 +2015,10 @@
 
 {
   $Log$
-  Revision 1.94  1999-06-03 16:25:05  pierre
+  Revision 1.95  1999-06-22 16:24:48  pierre
+   * local browser stuff corrected
+
+  Revision 1.94  1999/06/03 16:25:05  pierre
    * local Cvar stabs corrected
 
   Revision 1.93  1999/05/27 19:45:06  peter

+ 29 - 21
compiler/symtable.pas

@@ -91,7 +91,9 @@ unit symtable;
        end;
 
       { Deref entry options }
-      tdereftype = (derefnil,derefaktrecordindex,derefaktstaticindex,derefunit,derefrecord,derefindex);
+      tdereftype = (derefnil,derefaktrecordindex,derefaktstaticindex,
+                    derefunit,derefrecord,derefindex,
+                    dereflocal,derefpara);
 
       pderef = ^tderef;
       tderef = object
@@ -637,25 +639,6 @@ implementation
                         Symbol / Definition Resolving
 *****************************************************************************}
 
-const localsymtablestack : psymtable = nil;
-
-    function find_local_symtable(index : word) : psymtable;
-    var
-       p : psymtable;
-      begin
-         p:=localsymtablestack;
-         while assigned(p) do
-           begin
-              if p^.unitid=index then break
-              else
-                p:=p^.next;
-           end;
-         if (p=nil) then
-           comment(v_fatal,'Error in local browser');
-         find_local_symtable:=p;
-      end;
-
-
     procedure resolvederef(var p:pderef;var st:psymtable;var idx:word);
       var
         hp : pderef;
@@ -696,10 +679,32 @@ const localsymtablestack : psymtable = nil;
                    internalerror(556658);
                  end;
                end;
+             dereflocal :
+               begin
+                  pd:=st^.getdefnr(p^.index);
+                  case pd^.deftype of
+                    procdef :
+                      st:=pprocdef(pd)^.localst;
+                    else
+                   internalerror(556658);
+                 end;
+               end;
+             derefpara :
+               begin
+                  pd:=st^.getdefnr(p^.index);
+                  case pd^.deftype of
+                    procdef :
+                      st:=pprocdef(pd)^.parast;
+                    else
+                   internalerror(556658);
+                 end;
+               end;
              derefindex :
                begin
                  idx:=p^.index;
                end;
+             else
+               internalerror(556658);
            end;
            hp:=p;
            p:=p^.next;
@@ -2301,7 +2306,10 @@ const localsymtablestack : psymtable = nil;
 end.
 {
   $Log$
-  Revision 1.21  1999-06-08 22:23:50  pierre
+  Revision 1.22  1999-06-22 16:24:49  pierre
+   * local browser stuff corrected
+
+  Revision 1.21  1999/06/08 22:23:50  pierre
    * staticppusymtable was loaded a tsymtable instead of tunitsymtable
 
   Revision 1.20  1999/06/02 22:44:23  pierre

+ 153 - 4
compiler/utils/msgdif.pp

@@ -22,6 +22,7 @@ Type
   PMsg = ^TMsg;
   TMsg = Record
      Line : Longint;
+     suppress : boolean;
      enum : TEnum;
      text : TText;
      Next,Prev : PMsg;
@@ -44,6 +45,7 @@ begin
   with P^ do
     begin
     Line:=L;
+    suppress:=false;
     Text:=T;
     enum:=E;
     next:=Nil;
@@ -205,7 +207,16 @@ procedure WriteReorderedFile(FileName : string;orgnext,diffnext : PMsg);
                      readln(t3,s3);
                      inc(i3);
                   end;
-                writeln(t,s3);
+                write(t,orgnext^.enum,'=');
+                if assigned(orgnext^.equivalent) then
+                  begin
+                     writeln(t,orgnext^.equivalent^.text);
+                     if assigned(orgnext^.equivalent^.filenext) and
+                        (orgnext^.equivalent^.line+1=orgnext^.equivalent^.filenext^.line) then
+                        orgnext^.equivalent^.suppress:=true;
+                  end
+                else
+                  writeln(t,orgnext^.text);
                 inc(i);
                 readln(t3,s3);
                 inc(i3);
@@ -229,7 +240,8 @@ procedure WriteReorderedFile(FileName : string;orgnext,diffnext : PMsg);
             begin
                if assigned(diffnext^.Equivalent) then
                  begin
-                    if diffnext^.equivalent<>orgnext then
+                    if (diffnext^.equivalent<>orgnext) and
+                    not(diffnext^.suppress) then
                       Writeln('Problem inside WriteReorderedFile');
                     Writeln(t,s);
                     s:='';
@@ -246,9 +258,143 @@ procedure WriteReorderedFile(FileName : string;orgnext,diffnext : PMsg);
                     if diffnext^.Equivalent^.Text=diffnext^.Text then
                       Writeln(diffnext^.Enum,': ',DiffFileName,'(',i2,') not translated');
                     Diffnext:=Diffnext^.FileNext;
+                    while assigned(diffnext) and (diffnext^.suppress) do
+                      diffnext:=diffnext^.filenext;
+                    nextdiffkept:=diffnext;
+                    while assigned(nextdiffkept) and
+                      ((nextdiffkept^.equivalent=nil) or
+                       (nextdiffkept^.suppress)) do
+                      nextdiffkept:=nextdiffkept^.filenext;
+                    Orgnext:=orgnext^.filenext;
+                 end
+               else
+                 begin
+                    { Skip removed enum in errore.msg}
+                    { maybe a renaming of an enum !}
+                    Writeln(diffnext^.enum,' commented out');
+                    Writeln(t,'%%% ',s);
+                    inc(i);
+                    readln(t2,s);
+                    inc(i2);
+                    Diffnext:=Diffnext^.FileNext;
                     nextdiffkept:=diffnext;
                     while assigned(nextdiffkept) and (nextdiffkept^.equivalent=nil) do
                       nextdiffkept:=nextdiffkept^.filenext;
+                    if assigned(diffnext) then
+                      while (i2<diffnext^.line) do
+                        begin
+                           writeln(t,'%%% ',s);
+                           inc(i);
+                           readln(t2,s);
+                           inc(i2);
+                        end;
+                 end;
+            end
+          else
+            begin
+               writeln(t,s);
+               inc(i);
+               s:='';
+            end;
+       end;
+     Close(t);
+     Close(t2);
+     Close(t3);
+  end;
+
+procedure WriteReorderedFile2(FileName : string;orgnext,diffnext : PMsg);
+  var t,t2,t3 : text;
+      i,i2,i3 : longint;
+      s,s3 : string;
+      CurrentMsg : PMsg;
+      nextdiffkept : pmsg;
+  begin
+     Assign(t,FileName);
+     Rewrite(t);
+     Writeln(t,'%%% Reordering of ',DiffFileName,' respective to ',OrgFileName);
+     Writeln(t,'%%% Contains all comments from ',DiffFileName);
+     Assign(t2,DiffFileName);
+     Reset(t2);
+     Assign(t3,OrgFileName);
+     Reset(t3);
+     i:=2;i2:=0;i3:=0;
+     s:='';s3:='';
+     nextdiffkept:=diffnext;
+     while assigned(nextdiffkept) and (nextdiffkept^.equivalent=nil) do
+       nextdiffkept:=nextdiffkept^.filenext;
+     While not eof(t2) do
+       begin
+          while assigned(orgnext) and not(eof(t3)) do
+             begin
+                { Insert a new error msg with the english comments }
+                while i3<orgnext^.line do
+                  begin
+                     readln(t3,s3);
+                     inc(i3);
+                     if i3<orgnext^.line then
+                       begin
+                          writeln(t,s3);
+                          inc(i);
+                       end;
+                  end;
+                write(t,orgnext^.enum,'=');
+                if assigned(orgnext^.equivalent) then
+                  begin
+                     writeln(t,orgnext^.equivalent^.text);
+                     if assigned(orgnext^.equivalent^.filenext) and
+                        (orgnext^.equivalent^.line+1=orgnext^.equivalent^.filenext^.line) then
+                        orgnext^.equivalent^.suppress:=true;
+                  end
+                else
+                  writeln(t,orgnext^.text);
+                inc(i);
+                readln(t3,s3);
+                inc(i3);
+                while (s3<>'') and (s3[1] in ['#','%']) do
+                  begin
+                     writeln(t,s3);
+                     inc(i);
+                     readln(t3,s3);
+                     inc(i3);
+                  end;
+                Writeln('New error ',orgnext^.enum,' added');
+                orgnext:=orgnext^.filenext;
+             end;
+          if s='' then
+            begin
+               readln(t2,s);
+               inc(i2);
+            end;
+          if assigned(orgnext) and
+             assigned(diffnext) and (i2=diffnext^.line) then
+            begin
+               if assigned(diffnext^.Equivalent) then
+                 begin
+                    if (diffnext^.equivalent<>orgnext) and
+                    not(diffnext^.suppress) then
+                      Writeln('Problem inside WriteReorderedFile');
+                    Writeln(t,s);
+                    s:='';
+                    inc(i);
+                    readln(t2,s);
+                    inc(i2);
+                    while (s<>'') and (s[1] in ['#','%']) do
+                      begin
+                         writeln(t,s);
+                         inc(i);
+                         readln(t2,s);
+                         inc(i2);
+                      end;
+                    if diffnext^.Equivalent^.Text=diffnext^.Text then
+                      Writeln(diffnext^.Enum,': ',DiffFileName,'(',i2,') not translated');
+                    Diffnext:=Diffnext^.FileNext;
+                    while assigned(diffnext) and (diffnext^.suppress) do
+                      diffnext:=diffnext^.filenext;
+                    nextdiffkept:=diffnext;
+                    while assigned(nextdiffkept) and
+                      ((nextdiffkept^.equivalent=nil) or
+                       (nextdiffkept^.suppress)) do
+                      nextdiffkept:=nextdiffkept^.filenext;
                     Orgnext:=orgnext^.filenext;
                  end
                else
@@ -291,11 +437,14 @@ begin
   ProcessFile(OrgFileName,orgroot,orgfirst);
   ProcessFile(DiffFileName,diffRoot,difffirst);
   ShowDiff (OrgRoot,DiffRoot);
-  WriteReorderedFile('new.msg',orgfirst,difffirst);
+  WriteReorderedFile2('new.msg',orgfirst,difffirst);
 end.
 {
   $Log$
-  Revision 1.5  1999-06-11 13:06:45  peter
+  Revision 1.6  1999-06-22 16:24:52  pierre
+   * local browser stuff corrected
+
+  Revision 1.5  1999/06/11 13:06:45  peter
     * fixed crash with errorn.msg
 
   Revision 1.4  1999/06/09 12:17:34  pierre