home *** CD-ROM | disk | FTP | other *** search
- (*************************************************************************
-
- $RCSfile: Classface.mod $
- Description: BOOPSI support routines.
- Requires: ClassFace.obj must be explicitly linked with the program.
-
- Created by: fjc (Frank Copeland)
- $Revision: 3.3 $
- $Author: fjc $
- $Date: 1995/06/04 23:13:14 $
-
- Copyright © 1994-1995, Frank Copeland.
- This file is part of the Oberon-A Library.
- See Oberon-A.doc for conditions of use and distribution.
-
- *************************************************************************)
-
- <* STANDARD- *> <*$ StackChk- NilChk- *>
-
- MODULE [4] Classface ["Classface.o"];
-
- IMPORT SYS := SYSTEM, e := Exec, u := Utility, i := Intuition;
-
- (*
- ** These procedures *should* be in Intuition.mod.
- *)
-
- (*------------------------------------*)
- PROCEDURE [0] InstData* (cl : i.IClassPtr; o : i.ObjectPtr) : e.APTR;
- BEGIN
- RETURN SYS.VAL (e.APTR, (SYS.VAL(LONGINT,o) + LONG(cl.instOffset)));
- END InstData;
-
- (*------------------------------------*)
- PROCEDURE [0] SizeOfInstance* (cl : i.IClassPtr) : LONGINT;
- BEGIN
- RETURN cl.instOffset + cl.instSize + SIZE(i.Object);
- END SizeOfInstance;
-
- (*------------------------------------*)
- PROCEDURE [0] OClass* (o : i.ObjectPtr) : i.IClassPtr;
- BEGIN
- o := SYS.VAL (i.ObjectPtr, SYS.VAL (LONGINT, o) - SIZE (i.Object));
- RETURN o.class
- END OClass;
-
- (*
- ** The following declarations are interfaces to procedures in
- ** ClassFace.obj, created by assembling ClassFace.asm. ClassFace.obj
- ** must be explicitly linked with the program in order to call these
- ** procedures. See the "Foreign Code" section in OC.doc.
- **
- ** These procedures are replacements for those in Commodore's
- ** amiga.lib and small.lib.
- **
- ** Thanks to Albert Weinert for providing the assembly source code.
- *)
-
- (*
- ** DoMethod( o, method_id, param1, param2, ... )
- ** Invoke upon an object the method function defined by an object's class.
- ** This function is the only one that you should use unless you are
- ** implementing a class.
- *)
-
- PROCEDURE DoMethodA * ["_a_DoMethodA"]
- ( obj [10] : i.ObjectPtr;
- VAR msg [9] : i.MsgBase )
- : e.APTR;
-
- PROCEDURE DomethodA * ["_a_DoMethodA"]
- ( obj [10] : i.ObjectPtr;
- VAR msg [9] : i.MsgBase );
-
- PROCEDURE DoMethod * ["_a_DoMethodA"]
- ( obj [10] : i.ObjectPtr;
- msg [9]..: SYS.LONGWORD )
- : e.APTR;
-
- PROCEDURE Domethod * ["_a_DoMethodA"]
- ( obj [10] : i.ObjectPtr;
- msg [9]..: SYS.LONGWORD );
-
- (*
- ** DoSuperMethod( cl, o, method_id, param1, param2, ... )
- ** Invoke upon an object the method defined for the superclass
- ** of the class specified. In a class implementation, you
- ** are passed a pointer to the class you are implementing, which
- ** you pass to this function to send a message to the object
- ** considered as a member of your superclass.
- *)
-
- PROCEDURE DoSuperMethodA * ["_a_DoSuperMethodA"]
- ( cl [8] : i.IClassPtr;
- obj [10] : i.ObjectPtr;
- VAR msg [9] : i.MsgBase )
- : e.APTR;
-
- PROCEDURE DoSupermethodA * ["_a_DoSuperMethodA"]
- ( cl [8] : i.IClassPtr;
- obj [10] : i.ObjectPtr;
- VAR msg [9] : i.MsgBase );
-
- PROCEDURE DoSuperMethod * ["_a_DoSuperMethodA"]
- ( cl [8] : i.IClassPtr;
- obj [10] : i.ObjectPtr;
- msg [9]..: SYS.LONGWORD )
- : e.APTR;
-
- PROCEDURE DoSupermethod * ["_a_DoSuperMethodA"]
- ( cl [8] : i.IClassPtr;
- obj [10] : i.ObjectPtr;
- msg [9]..: SYS.LONGWORD );
-
- (*
- ** CoerceMethod( cl, o, method_id, param1, param2, ... );
- ** Invoke upon the given object a method function for whatever
- ** specified class. This is sort of the primitive basis behind
- ** DoMethod and DoSuperMethod.
- *)
-
- PROCEDURE CoerceMethodA * ["_a_CoerceMethodA"]
- ( cl [8] : i.IClassPtr;
- obj [10] : i.ObjectPtr;
- VAR msg [9] : i.MsgBase )
- : e.APTR;
-
- PROCEDURE CoercemethodA * ["_a_CoerceMethodA"]
- ( cl [8] : i.IClassPtr;
- obj [10] : i.ObjectPtr;
- VAR msg [9] : i.MsgBase );
-
- PROCEDURE CoerceMethod * ["_a_CoerceMethodA"]
- ( cl [8] : i.IClassPtr;
- obj [10] : i.ObjectPtr;
- msg [9]..: SYS.LONGWORD )
- : e.APTR;
-
- PROCEDURE Coercemethod * ["_a_CoerceMethodA"]
- ( cl [8] : i.IClassPtr;
- obj [10] : i.ObjectPtr;
- msg [9]..: SYS.LONGWORD );
-
- (*
- ** SetSuperAttrs( cl, o, tag1, data1, ..., TAG_END );
- ** A useful varargs conversion to the proper OM_SET method.
- *)
-
- PROCEDURE SetSuperAttrsA * ["_a_SetSuperAttrs"]
- ( cl [8] : i.IClassPtr;
- obj [10] : i.ObjectPtr;
- tags [9] : ARRAY OF u.TagItem )
- : e.APTR;
-
- PROCEDURE SetSuperAttrs * ["_a_SetSuperAttrs"]
- ( cl [8] : i.IClassPtr;
- obj [10] : i.ObjectPtr;
- tags [9]..: u.Tag )
- : e.APTR;
-
- END Classface.
-
-