浏览代码

* complete Object Pascal support moved to objpas unit

florian 27 年之前
父节点
当前提交
4a9ba91007
共有 4 个文件被更改,包括 12 次插入408 次删除
  1. 0 258
      rtl/inc/objpas.inc
  2. 0 98
      rtl/inc/objpash.inc
  3. 5 32
      rtl/inc/system.inc
  4. 7 20
      rtl/inc/systemh.inc

+ 0 - 258
rtl/inc/objpas.inc

@@ -1,258 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1997,98 by Florian Klaempfl
-    member of the Free Pascal development team
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-{***********************************************************************
-  This file includes the system and processor independed
-  implementations of some Object Pascal features
-
-  This file is intended to be used with Free Pascal and should be
-  included in the system unit.
- ***********************************************************************}
-
-{************************************************************************}
-{                          misc. routines                                }
-{************************************************************************}
-
-  { the reverse order of the parameters make code generation easier }
-  function _is(aclass : tclass;aobject : tobject) : boolean;[public,alias: 'DO_IS'];
-
-    begin
-       _is:=aobject.inheritsfrom(aclass);
-    end;
-
-  { the reverse order of the parameters make code generation easier }
-  procedure _as(aclass : tclass;aobject : tobject);[public,alias: 'DO_AS'];
-
-    begin
-       if assigned(aobject) and not(aobject.inheritsfrom(aclass)) then
-         { throw an exception }
-    end;
-
-  procedure abstracterror;[public,alias: 'ABSTRACTERROR'];
-
-    type
-       proc = procedure;
-
-    begin
-       if assigned(abstracterrorproc) then
-         proc(abstracterrorproc)()
-       else
-         runerror(210);
-    end;
-
-{************************************************************************}
-{                               TOBJECT                                  }
-{************************************************************************}
-
-    constructor tobject.create;
-
-      begin
-      end;
-
-    destructor tobject.destroy;
-
-      begin
-      end;
-
-    procedure tobject.free;
-
-      begin
-         if self<>nil then
-           destroy;
-      end;
-
-    class function tobject.instancesize : longint;
-
-      type
-         plongint = ^longint;
-
-      begin
-         { type of self is class of tobject => it points to the vmt }
-         { the size is saved at offset 0                            }
-         instancesize:=plongint(self)^;
-      end;
-
-    class function tobject.initinstance(instance : pointer) : tobject;
-
-      type
-         ppointer = ^pointer;
-
-      begin
-         fillchar(instance^,self.instancesize,0);
-         { insert VMT pointer into the new created memory area }
-         { (in class methods self contains the VMT!)           }
-         ppointer(instance)^:=pointer(self);
-         initinstance:=tobject(instance);
-      end;
-
-    class function tobject.classparent : tclass;
-
-      type
-         ptclass = ^tclass;
-
-      begin
-         { type of self is class of tobject => it points to the vmt }
-         { the parent vmt is saved at offset 8                      } 
-         classparent:=(ptclass(self)+8)^;
-      end;
-
-    class function tobject.newinstance : tobject;
-
-      var
-         p : pointer;
-
-      begin
-         getmem(p,instancesize);
-         initinstance(p);
-         newinstance:=tobject(p);
-      end;
-
-    procedure tobject.freeinstance;
-
-      var
-         p : pointer;
-
-      begin
-         { !!! we should finalize some data }
-
-         { self is a register, so we can't pass it call by reference }
-         p:=pointer(self);
-         freemem(p,instancesize);
-      end;
-
-    function tobject.classtype : tclass;
-
-      begin
-         classtype:=tclass(pointer(self)^)
-      end;
-
-    class function tobject.methodaddress(const name : shortstring) : pointer;
-
-      begin
-      end;
-
-    class function tobject.methodname(address : pointer) : shortstring;
-
-      begin
-      end;
-
-    function tobject.fieldaddress(const name : shortstring) : pointer;
-
-      begin
-      end;
-
-    function tobject.safecallexception(exceptobject : tobject;
-      exceptaddr : pointer) : integer;
-
-      begin
-      end;
-
-    class function tobject.classinfo : pointer;
-
-      begin
-      end;
-
-    class function tobject.classname : shortstring;
-
-      begin
-      end;
-
-    class function tobject.classnameis(const name : string) : boolean;
-
-      begin
-      end;
-
-    class function tobject.inheritsfrom(aclass : tclass) : boolean;
-
-      var
-         c : tclass;
-
-      begin
-         c:=self;
-         while assigned(c) do
-           begin
-              if c=aclass then
-                begin
-                   inheritsfrom:=true;
-                   exit;
-                end;
-              c:=c.classparent;
-           end;
-         inheritsfrom:=false;
-      end;
-
-    procedure tobject.dispatch(var message);
-
-      begin
-      end;
-
-    procedure tobject.defaulthandler(var message);
-
-      begin
-      end;
-
-    procedure tobject.cleanupinstance;
-
-      begin
-      end;
-
-{
-  $Log$
-  Revision 1.1  1998-03-25 11:18:43  root
-  Initial revision
-
-  Revision 1.9  1998/02/03 22:12:25  florian
-    + helper routines for is and as
-    * fix of tobject.classparent
-    + tobject.inheritsfrom
-
-  Revision 1.8  1998/01/27 22:05:09  florian
-    * again small fixes to DOM (Delphi Object Model)
-
-  Revision 1.7  1998/01/26 12:00:18  michael
-  + Added log at the end
-
-
-  
-  Working file: rtl/inc/objpas.inc
-  description:
-  ----------------------------
-  revision 1.6
-  date: 1998/01/25 22:30:49;  author: florian;  state: Exp;  lines: +3 -3
-    * DOM: some fixes to tobject and the con-/destructor help routines
-  ----------------------------
-  revision 1.5
-  date: 1998/01/23 18:08:31;  author: florian;  state: Exp;  lines: +19 -6
-    * more bugs in FCL object model removed
-  ----------------------------
-  revision 1.4
-  date: 1998/01/23 10:48:32;  author: florian;  state: Exp;  lines: +63 -7
-    * syntax errors fixed
-    + implementation of all methods added, at least with empty body
-  ----------------------------
-  revision 1.3
-  date: 1998/01/16 23:10:53;  author: florian;  state: Exp;  lines: +19 -1
-    + some tobject stuff
-  ----------------------------
-  revision 1.2
-  date: 1998/01/10 11:08:58;  author: florian;  state: Exp;  lines: +53 -1
-    + start of tobject impkentations
-  ----------------------------
-  revision 1.1
-  date: 1998/01/09 16:05:43;  author: florian;  state: Exp;
-    + ojbpash.inc and objpas.inc
-    * $E- from objects.pp removed to avoid a warning
-  =============================================================================
-}

+ 0 - 98
rtl/inc/objpash.inc

@@ -1,98 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1997,98 by Florian Klaempfl
-    member of the Free Pascal development team
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-{***********************************************************************
-  This file contains the base declarations of Object Pascal
-  as declared by Delphi 3.0
-
-  This file is intended to be used with Free Pascal and should be
-  included in the system unit.
- ***********************************************************************}
-
-type
-  tobject = class;   
-  tclass = class of tobject;
-
-  tobject = class
-     { please don't change the order of virtual methods, because      }
-     { their vmt offsets are used by some assembler code which uses   }
-     { hard coded addresses      (FK)                                 }
-     constructor create;
-     destructor destroy;virtual;
-     class function newinstance : tobject;virtual;
-     procedure freeinstance;virtual;
-     procedure free;
-     class function initinstance(instance : pointer) : tobject;
-     procedure cleanupinstance;
-     function classtype : tclass;
-     class function classinfo : pointer;
-     class function classname : shortstring;
-     class function classnameis(const name : string) : boolean;
-     class function classparent : tclass;
-     class function instancesize : longint;                                          
-     class function inheritsfrom(aclass : tclass) : boolean;
-
-     { message handling routines }
-     procedure dispatch(var message);
-     procedure defaulthandler(var message);virtual;
-
-     class function methodaddress(const name : shortstring) : pointer;
-     class function methodname(address : pointer) : shortstring;
-     function fieldaddress(const name : shortstring) : pointer;
-
-     { interface functions, I don't know if we need this }
-{
-     function getinterface(const iid : tguid;out obj) : boolean;
-     class function getinterfaceentry(const iid : tguid) : pinterfaceentry;
-     class function getinterfacetable : pinterfacetable;
-}
-     function safecallexception(exceptobject : tobject;
-       exceptaddr : pointer) : integer;virtual;
-  end;
-
-  var
-     abstracterrorproc : pointer;
-
-{
-  $Log$
-  Revision 1.1  1998-03-25 11:18:43  root
-  Initial revision
-
-  Revision 1.5  1998/01/27 22:05:10  florian
-    * again small fixes to DOM (Delphi Object Model)
-
-  Revision 1.4  1998/01/26 12:00:25  michael
-  + Added log at the end
-
-
-  
-  Working file: rtl/inc/objpash.inc
-  description:
-  ----------------------------
-  revision 1.3
-  date: 1998/01/23 15:54:49;  author: florian;  state: Exp;  lines: +5 -2
-    + small extensions to FCL object model
-  ----------------------------
-  revision 1.2
-  date: 1998/01/23 10:48:32;  author: florian;  state: Exp;  lines: +5 -1
-    * syntax errors fixed
-    + implementation of all methods added, at least with empty body
-  ----------------------------
-  revision 1.1
-  date: 1998/01/09 16:05:43;  author: florian;  state: Exp;
-    + ojbpash.inc and objpas.inc
-    * $E- from objects.pp removed to avoid a warning
-  =============================================================================
-}

+ 5 - 32
rtl/inc/system.inc

@@ -276,36 +276,6 @@ End;
 
 {$i sstrings.inc}
 
-{****************************************************************************
-                Subroutines for delphi-Style object handling are in objpas.inc
-****************************************************************************}
-
-{$IFDEF VER_ABOVE0_9_7}
-{ Old versions don't like this }
-
-{$ifdef DELPHI_EXTENSIONS}
-
-{$i objpas.inc}
-
-{$else }
-constructor tobject.create;
-Begin
-End;
-
-destructor tobject.destroy;
-Begin
-End;
-
-procedure tobject.free;
-Begin
-   if pointer(self)<>nil then
-     destroy;
-End;
-{$ENDIF DELPHI_Extensions}
-
-{$ENDIF VER_ABOVE0_9_7}
-
-
 {*****************************************************************************
                              Miscellaneous
 *****************************************************************************}
@@ -444,8 +414,11 @@ End;
 
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:43  root
-  Initial revision
+  Revision 1.2  1998-03-25 23:39:17  florian
+    * complete Object Pascal support moved to objpas unit
+
+  Revision 1.1.1.1  1998/03/25 11:18:43  root
+  * Restored version
 
   Revision 1.29  1998/02/07 05:31:22  carl
     * bugfix of Swap with cardinal (no return value was set)

+ 7 - 20
rtl/inc/systemh.inc

@@ -367,26 +367,10 @@ Procedure getdir(drivenr:byte;Var dir:string);
 Function IOResult:Word;
 Function Sptr:Longint;
 
-
-{*****************************************************************************
-                       Delpi-Type Object is declared in objpash.inc
+{****************************************************************************
+                The whole Delphi stuff is in the unit objpas
 *****************************************************************************}
 
-{$IFDEF VER_ABOVE0_9_7}
-{$ifdef DELPHI_EXTENSIONS}
-Type
-  ShortSTring = string;
-{$i objpash.inc}
-{$else}
-Type
-  tobject = class
-    constructor create;
-    destructor destroy;virtual;
-    procedure free;
-  End;
-{$ENDIF}
-{$ENDIF}
-
 {*****************************************************************************
                           Init / Exit / ExitProc
 *****************************************************************************}
@@ -403,8 +387,11 @@ Procedure AddExitProc(Proc:TProcedure);
 
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:43  root
-  Initial revision
+  Revision 1.2  1998-03-25 23:39:17  florian
+    * complete Object Pascal support moved to objpas unit
+
+  Revision 1.1.1.1  1998/03/25 11:18:43  root
+  * Restored version
 
   Revision 1.22  1998/03/24 15:50:25  peter
     + dword,longword=cardinal (for > 0.9.2 unlike Florian did with longword)