Browse Source

* make it compilable with TP
+ small COM problems solved to compile classes.pp

florian 27 years ago
parent
commit
f956607284
3 changed files with 72 additions and 38 deletions
  1. 55 33
      compiler/pdecl.pas
  2. 9 1
      compiler/scandir.inc
  3. 8 4
      compiler/switches.pas

+ 55 - 33
compiler/pdecl.pas

@@ -230,6 +230,13 @@ unit pdecl;
       begin
          s:=pattern;
          consume(ID);
+         { classes can be used also in classes }
+         if (curobjectname=pattern) and aktobjectdef^.isclass then
+           begin
+              id_type:=aktobjectdef;
+              exit;
+           end;
+         { objects can be parameters }
          if (testcurobject=2) and (curobjectname=pattern) then
            begin
               id_type:=aktobjectdef;
@@ -930,36 +937,41 @@ unit pdecl;
          procinfo._class:=aktclass;
          testcurobject:=1;
          curobjectname:=n;
-         while token<>_END do
+
+         { short class declaration ? }
+         if token<>SEMICOLON then
            begin
-              if (token=ID) and (pattern='PRIVATE') then
-                begin
-                   consume(ID);
-                   actmembertype:=sp_private;
-                   current_object_option:=sp_private;
-                end;
-              if (token=ID) and (pattern='PROTECTED') then
-                begin
-                   consume(ID);
-                   current_object_option:=sp_protected;
-                   actmembertype:=sp_protected;
-                end;
-              if (token=ID) and (pattern='PUBLIC') then
-                begin
-                   consume(ID);
-                   current_object_option:=sp_public;
-                   actmembertype:=sp_public;
-                end;
-              if (token=ID) and (pattern='PUBLISHED') then
+              while token<>_END do
                 begin
-                   consume(ID);
-                   current_object_option:=sp_public;
-                   actmembertype:=sp_public;
+                   if (token=ID) and (pattern='PRIVATE') then
+                     begin
+                        consume(ID);
+                        actmembertype:=sp_private;
+                        current_object_option:=sp_private;
+                     end;
+                   if (token=ID) and (pattern='PROTECTED') then
+                     begin
+                        consume(ID);
+                        current_object_option:=sp_protected;
+                        actmembertype:=sp_protected;
+                     end;
+                   if (token=ID) and (pattern='PUBLIC') then
+                     begin
+                        consume(ID);
+                        current_object_option:=sp_public;
+                        actmembertype:=sp_public;
+                     end;
+                   if (token=ID) and (pattern='PUBLISHED') then
+                     begin
+                        consume(ID);
+                        current_object_option:=sp_public;
+                        actmembertype:=sp_public;
+                     end;
+                   object_komponenten;
                 end;
-              object_komponenten;
+              current_object_option:=sp_public;
+              consume(_END);
            end;
-         current_object_option:=sp_public;
-         consume(_END);
          testcurobject:=0;
          curobjectname:='';
 
@@ -1096,12 +1108,6 @@ unit pdecl;
             until false;
             dec(testcurobject);
             consume(RKLAMMER);
-            if token=_OF then
-              begin
-                 consume(_OF);
-                 consume(_OBJECT);
-                 procvardef^.options:=procvardef^.options or pomethodpointer;
-              end;
          end;
        handle_procvar:=procvardef;
     end;
@@ -1387,6 +1393,12 @@ unit pdecl;
               begin
                  consume(_PROCEDURE);
                  p:=handle_procvar;
+                 if token=_OF then
+                   begin
+                      consume(_OF);
+                      consume(_OBJECT);
+                      pprocvardef(p)^.options:=pprocvardef(p)^.options or pomethodpointer;
+                   end;
               end;
             _FUNCTION:
               begin
@@ -1394,6 +1406,12 @@ unit pdecl;
                  p:=handle_procvar;
                  consume(COLON);
                  pprocvardef(p)^.retdef:=single_type(hs);
+                 if token=_OF then
+                   begin
+                      consume(_OF);
+                      consume(_OBJECT);
+                      pprocvardef(p)^.options:=pprocvardef(p)^.options or pomethodpointer;
+                   end;
               end;
             else
               expr_type;
@@ -1735,7 +1753,11 @@ unit pdecl;
 end.
 {
   $Log$
-  Revision 1.10  1998-04-27 23:10:28  peter
+  Revision 1.11  1998-04-28 11:45:52  florian
+    * make it compilable with TP
+    + small COM problems solved to compile classes.pp
+
+  Revision 1.10  1998/04/27 23:10:28  peter
     + new scanner
     * $makelib -> if smartlink
     * small filename fixes pmodule.setfilename

+ 9 - 1
compiler/scandir.inc

@@ -784,7 +784,11 @@ const
             if t<>_DIR_NONE then
              begin
                p:=directiveproc[t];
+{$ifdef FPC}
                if assigned(p) then
+{$else}
+               if @p<>nil then
+{$endif}
                 p(t);
              end
             else
@@ -797,7 +801,11 @@ const
 
 {
   $Log$
-  Revision 1.2  1998-04-28 10:09:54  pierre
+  Revision 1.3  1998-04-28 11:45:53  florian
+    * make it compilable with TP
+    + small COM problems solved to compile classes.pp
+
+  Revision 1.2  1998/04/28 10:09:54  pierre
     * typo error in asm style reading corrected
 
   Revision 1.1  1998/04/27 23:13:53  peter

+ 8 - 4
compiler/switches.pas

@@ -118,14 +118,14 @@ begin
                     end
                    else
                     Message(scan_w_switch_is_global);
-                   if assigned(proc) then
-                    begin
+
                     {$ifdef FPC}
+                    if assigned(proc) then
                       proc();
                     {$else}
+                    if @proc<>nil then
                       proc;
                     {$endif}
-                    end;
                  end;
       end;
    end;
@@ -158,7 +158,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.1  1998-04-27 23:13:53  peter
+  Revision 1.2  1998-04-28 11:45:53  florian
+    * make it compilable with TP
+    + small COM problems solved to compile classes.pp
+
+  Revision 1.1  1998/04/27 23:13:53  peter
     + the new files for the scanner
 
 }