home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source1.lha / source / amiga / Classface.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  4.6 KB  |  165 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: Classface.mod $
  4.   Description: BOOPSI support routines.
  5.      Requires: ClassFace.obj must be explicitly linked with the program.
  6.  
  7.    Created by: fjc (Frank Copeland)
  8.     $Revision: 3.2 $
  9.       $Author: fjc $
  10.         $Date: 1995/01/26 02:39:55 $
  11.  
  12.   Copyright © 1994-1995, Frank Copeland.
  13.   This file is part of the Oberon-A Library.
  14.   See Oberon-A.doc for conditions of use and distribution.
  15.  
  16. *************************************************************************)
  17.  
  18. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  19. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  20. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  21.  
  22. MODULE [4] Classface ["Classface.o"];
  23.  
  24. IMPORT SYS := SYSTEM, e := Exec, u := Utility, i := Intuition;
  25.  
  26. (*
  27. ** These procedures *should* be in Intuition.mod.
  28. *)
  29.  
  30. (*------------------------------------*)
  31. PROCEDURE [0] InstData* (cl : i.IClassPtr; o : i.ObjectPtr) : e.APTR;
  32. BEGIN
  33.   RETURN SYS.VAL (e.APTR, (SYS.VAL(LONGINT,o) + LONG(cl.instOffset)));
  34. END InstData;
  35.  
  36. (*------------------------------------*)
  37. PROCEDURE [0] SizeOfInstance* (cl : i.IClassPtr) : LONGINT;
  38. BEGIN
  39.   RETURN cl.instOffset + cl.instSize + SIZE(i.Object);
  40. END SizeOfInstance;
  41.  
  42. (*------------------------------------*)
  43. PROCEDURE [0] OClass* (o : i.ObjectPtr) : i.IClassPtr;
  44. BEGIN
  45.   o := SYS.VAL (i.ObjectPtr, SYS.VAL (LONGINT, o) - SIZE (i.Object));
  46.   RETURN o.class
  47. END OClass;
  48.  
  49. (*
  50. ** The following declarations are interfaces to procedures in
  51. ** ClassFace.obj, created by assembling ClassFace.asm. ClassFace.obj
  52. ** must be explicitly linked with the program in order to call these
  53. ** procedures. See the "Foreign Code" section in OC.doc.
  54. **
  55. ** These procedures are replacements for those in Commodore's
  56. ** amiga.lib and small.lib.
  57. **
  58. ** Thanks to Albert Weinert for providing the assembly source code.
  59. *)
  60.  
  61. (*
  62. ** DoMethod( o, method_id, param1, param2, ... )
  63. ** Invoke upon an object the method function defined by an object's class.
  64. ** This function is the only one that you should use unless you are
  65. ** implementing a class.
  66. *)
  67.  
  68. PROCEDURE DoMethodA * ["_a_DoMethodA"]
  69.   ( obj    [10] : i.ObjectPtr;
  70.     VAR msg [9] : i.MsgBase )
  71.   : e.APTR;
  72.  
  73. PROCEDURE DomethodA * ["_a_DoMethodA"]
  74.   ( obj    [10] : i.ObjectPtr;
  75.     VAR msg [9] : i.MsgBase );
  76.  
  77. PROCEDURE DoMethod * ["_a_DoMethodA"]
  78.   ( obj [10]  : i.ObjectPtr;
  79.     msg  [9]..: SYS.LONGWORD )
  80.   : e.APTR;
  81.  
  82. PROCEDURE Domethod * ["_a_DoMethodA"]
  83.   ( obj [10]  : i.ObjectPtr;
  84.     msg  [9]..: SYS.LONGWORD );
  85.  
  86. (*
  87. ** DoSuperMethod( cl, o, method_id, param1, param2, ... )
  88. ** Invoke upon an object the method defined for the superclass
  89. ** of the class specified.  In a class implementation, you
  90. ** are passed a pointer to the class you are implementing, which
  91. ** you pass to this function to send a message to the object
  92. ** considered as a member of your superclass.
  93. *)
  94.  
  95. PROCEDURE DoSuperMethodA * ["_a_DoSuperMethodA"]
  96.   ( cl      [8] : i.IClassPtr;
  97.     obj    [10] : i.ObjectPtr;
  98.     VAR msg [9] : i.MsgBase )
  99.   : e.APTR;
  100.  
  101. PROCEDURE DoSupermethodA * ["_a_DoSuperMethodA"]
  102.   ( cl      [8] : i.IClassPtr;
  103.     obj    [10] : i.ObjectPtr;
  104.     VAR msg [9] : i.MsgBase );
  105.  
  106. PROCEDURE DoSuperMethod * ["_a_DoSuperMethodA"]
  107.   ( cl   [8]  : i.IClassPtr;
  108.     obj [10]  : i.ObjectPtr;
  109.     msg  [9]..: SYS.LONGWORD )
  110.   : e.APTR;
  111.  
  112. PROCEDURE DoSupermethod * ["_a_DoSuperMethodA"]
  113.   ( cl   [8]  : i.IClassPtr;
  114.     obj [10]  : i.ObjectPtr;
  115.     msg  [9]..: SYS.LONGWORD );
  116.  
  117. (*
  118. ** CoerceMethod( cl, o, method_id, param1, param2, ... );
  119. ** Invoke upon the given object a method function for whatever
  120. ** specified class.  This is sort of the primitive basis behind
  121. ** DoMethod and DoSuperMethod.
  122. *)
  123.  
  124. PROCEDURE CoerceMethodA * ["_a_CoerceMethodA"]
  125.   ( cl      [8] : i.IClassPtr;
  126.     obj    [10] : i.ObjectPtr;
  127.     VAR msg [9] : i.MsgBase )
  128.   : e.APTR;
  129.  
  130. PROCEDURE CoercemethodA * ["_a_CoerceMethodA"]
  131.   ( cl      [8] : i.IClassPtr;
  132.     obj    [10] : i.ObjectPtr;
  133.     VAR msg [9] : i.MsgBase );
  134.  
  135. PROCEDURE CoerceMethod * ["_a_CoerceMethodA"]
  136.   ( cl   [8]  : i.IClassPtr;
  137.     obj [10]  : i.ObjectPtr;
  138.     msg  [9]..: SYS.LONGWORD )
  139.   : e.APTR;
  140.  
  141. PROCEDURE Coercemethod * ["_a_CoerceMethodA"]
  142.   ( cl   [8]  : i.IClassPtr;
  143.     obj [10]  : i.ObjectPtr;
  144.     msg  [9]..: SYS.LONGWORD );
  145.  
  146. (*
  147. ** SetSuperAttrs( cl, o, tag1, data1, ..., TAG_END );
  148. ** A useful varargs conversion to the proper OM_SET method.
  149. *)
  150.  
  151. PROCEDURE SetSuperAttrsA * ["_a_SetSuperAttrs"]
  152.   ( cl   [8] : i.IClassPtr;
  153.     obj [10] : i.ObjectPtr;
  154.     tags [9] : ARRAY OF u.TagItem )
  155.   : e.APTR;
  156.  
  157. PROCEDURE SetSuperAttrs * ["_a_SetSuperAttrs"]
  158.   ( cl   [8]  : i.IClassPtr;
  159.     obj [10]  : i.ObjectPtr;
  160.     tags [9]..: u.Tag )
  161.   : e.APTR;
  162.  
  163. END Classface.
  164.  
  165.