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 / source2.lha / Source / Obsolete / BoopsiUtil.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  3.9 KB  |  138 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: BoopsiUtil.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.7 $
  9.       $Author: fjc $
  10.         $Date: 1995/01/26 00:46:19 $
  11.  
  12.   Copyright © 1994, 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.  
  20. MODULE [4] BoopsiUtil ["Classface.obj"];
  21.  
  22. <*$ CaseChk-  IndexChk- LongVars+ NilChk+  *>
  23. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  24.  
  25. IMPORT SYS := SYSTEM, e := Exec, u := Utility, i := Intuition;
  26.  
  27. (*
  28. ** These procedures are duplicates of the ones found in Module Intuition.
  29. ** They are repeated here so that this module can be used in place of
  30. ** AmigaOberon's Classface.mod.
  31. *)
  32.  
  33. (*------------------------------------*)
  34. PROCEDURE [0] InstData* (cl : i.IClassPtr; o : i.ObjectPtr) : e.APTR;
  35. BEGIN
  36.   RETURN SYS.VAL (e.APTR, (SYS.VAL(LONGINT,o) + LONG(cl.instOffset)));
  37. END InstData;
  38.  
  39. (*------------------------------------*)
  40. PROCEDURE [0] SizeOfInstance* (cl : i.IClassPtr) : LONGINT;
  41. BEGIN
  42.   RETURN cl.instOffset + cl.instSize + SIZE(i.Object);
  43. END SizeOfInstance;
  44.  
  45. (*------------------------------------*)
  46. PROCEDURE [0] OClass* (o : i.ObjectPtr) : i.IClassPtr;
  47. BEGIN
  48.   o := SYS.VAL (i.ObjectPtr, SYS.VAL (LONGINT, o) - SIZE (i.Object));
  49.   RETURN o.class
  50. END OClass;
  51.  
  52. (*
  53. ** The following declarations are interfaces to procedures in
  54. ** ClassFace.obj, created by assembling ClassFace.asm. ClassFace.obj
  55. ** must be explicitly linked with the program in order to call these
  56. ** procedures. See the "Foreign Code" section in OC.doc.
  57. **
  58. ** These procedures are replacements for those in Commodore's
  59. ** amiga.lib and small.lib.
  60. **
  61. ** Thanks to Albert Weinert for providing the assembly source code.
  62. *)
  63.  
  64. (*
  65. ** DoMethod( o, method_id, param1, param2, ... )
  66. ** Invoke upon an object the method function defined by an object's class.
  67. ** This function is the only one that you should use unless you are
  68. ** implementing a class.
  69. *)
  70.  
  71. PROCEDURE DoMethodA * ["_a_DoMethodA"]
  72.   ( obj    [10] : i.ObjectPtr;
  73.     VAR msg [9] : i.Msg )
  74.   : e.APTR;
  75.  
  76. PROCEDURE DoMethod * ["_a_DoMethodA"]
  77.   ( obj [10]  : i.ObjectPtr;
  78.     msg  [9]..: SYS.LONGWORD )
  79.   : e.APTR;
  80.  
  81. (*
  82. ** DoSuperMethod( cl, o, method_id, param1, param2, ... )
  83. ** Invoke upon an object the method defined for the superclass
  84. ** of the class specified.  In a class implementation, you
  85. ** are passed a pointer to the class you are implementing, which
  86. ** you pass to this function to send a message to the object
  87. ** considered as a member of your superclass.
  88. *)
  89.  
  90. PROCEDURE DoSuperMethodA * ["_a_DoSuperMethodA"]
  91.   ( cl      [8] : i.IClassPtr;
  92.     obj    [10] : i.ObjectPtr;
  93.     VAR msg [9] : i.Msg )
  94.   : e.APTR;
  95.  
  96. PROCEDURE DoSuperMethod * ["_a_DoSuperMethodA"]
  97.   ( cl   [8]  : i.IClassPtr;
  98.     obj [10]  : i.ObjectPtr;
  99.     msg  [9]..: SYS.LONGWORD )
  100.   : e.APTR;
  101.  
  102. (*
  103. ** CoerceMethod( cl, o, method_id, param1, param2, ... );
  104. ** Invoke upon the given object a method function for whatever
  105. ** specified class.  This is sort of the primitive basis behind
  106. ** DoMethod and DoSuperMethod.
  107. *)
  108.  
  109. PROCEDURE CoerceMethodA * ["_a_CoerceMethodA"]
  110.   ( cl      [8] : i.IClassPtr;
  111.     obj    [10] : i.ObjectPtr;
  112.     VAR msg [9] : i.Msg );
  113.  
  114. PROCEDURE CoerceMethod * ["_a_CoerceMethodA"]
  115.   ( cl   [8]  : i.IClassPtr;
  116.     obj [10]  : i.ObjectPtr;
  117.     msg  [9]..: SYS.LONGWORD );
  118.  
  119. (*
  120. ** SetSuperAttrs( cl, o, tag1, data1, ..., TAG_END );
  121. ** A useful varargs conversion to the proper OM_SET method.
  122. *)
  123.  
  124. PROCEDURE SetSuperAttrsA * ["_a_SetSuperAttrs"]
  125.   ( cl   [8] : i.IClassPtr;
  126.     obj [10] : i.ObjectPtr;
  127.     tags [9] : ARRAY OF u.TagItem )
  128.   : e.APTR;
  129.  
  130. PROCEDURE SetSuperAttrs * ["_a_SetSuperAttrs"]
  131.   ( cl   [8]  : i.IClassPtr;
  132.     obj [10]  : i.ObjectPtr;
  133.     tags [9]..: u.Tag )
  134.   : e.APTR;
  135.  
  136. END BoopsiUtil.
  137.  
  138.