From f956607284b3fdb7b672e97abc3ae9fdd09d1a95 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 28 Apr 1998 11:45:52 +0000 Subject: [PATCH] * make it compilable with TP + small COM problems solved to compile classes.pp --- compiler/pdecl.pas | 88 +++++++++++++++++++++++++++---------------- compiler/scandir.inc | 10 ++++- compiler/switches.pas | 12 ++++-- 3 files changed, 72 insertions(+), 38 deletions(-) diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index cf316ae1b9..7ec6c7de09 100644 --- a/compiler/pdecl.pas +++ b/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 + while token<>_END do begin - consume(ID); - actmembertype:=sp_private; - current_object_option:=sp_private; + 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; - 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; + 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 diff --git a/compiler/scandir.inc b/compiler/scandir.inc index 5904b30eed..9dcd207e51 100644 --- a/compiler/scandir.inc +++ b/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 diff --git a/compiler/switches.pas b/compiler/switches.pas index 6e705bb3f2..dcc0e79a3d 100644 --- a/compiler/switches.pas +++ b/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 } \ No newline at end of file