home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 10 / Fresh_Fish_10_2352.bin / new / dev / obero / oberon-a / source / obsolete / boopsiutil.mod < prev    next >
Text File  |  1995-06-29  |  4KB  |  135 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.8 $
  9.       $Author: fjc $
  10.         $Date: 1995/06/29 19:06:56 $
  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- *>
  19.  
  20. MODULE [4] BoopsiUtil ["Classface.obj"];
  21.  
  22. IMPORT SYS := SYSTEM, e := Exec, u := Utility, i := Intuition;
  23.  
  24. (*
  25. ** These procedures are duplicates of the ones found in Module Intuition.
  26. ** They are repeated here so that this module can be used in place of
  27. ** AmigaOberon's Classface.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.Msg )
  71.   : e.APTR;
  72.  
  73. PROCEDURE DoMethod * ["_a_DoMethodA"]
  74.   ( obj [10]  : i.ObjectPtr;
  75.     msg  [9]..: SYS.LONGWORD )
  76.   : e.APTR;
  77.  
  78. (*
  79. ** DoSuperMethod( cl, o, method_id, param1, param2, ... )
  80. ** Invoke upon an object the method defined for the superclass
  81. ** of the class specified.  In a class implementation, you
  82. ** are passed a pointer to the class you are implementing, which
  83. ** you pass to this function to send a message to the object
  84. ** considered as a member of your superclass.
  85. *)
  86.  
  87. PROCEDURE DoSuperMethodA * ["_a_DoSuperMethodA"]
  88.   ( cl      [8] : i.IClassPtr;
  89.     obj    [10] : i.ObjectPtr;
  90.     VAR msg [9] : i.Msg )
  91.   : e.APTR;
  92.  
  93. PROCEDURE DoSuperMethod * ["_a_DoSuperMethodA"]
  94.   ( cl   [8]  : i.IClassPtr;
  95.     obj [10]  : i.ObjectPtr;
  96.     msg  [9]..: SYS.LONGWORD )
  97.   : e.APTR;
  98.  
  99. (*
  100. ** CoerceMethod( cl, o, method_id, param1, param2, ... );
  101. ** Invoke upon the given object a method function for whatever
  102. ** specified class.  This is sort of the primitive basis behind
  103. ** DoMethod and DoSuperMethod.
  104. *)
  105.  
  106. PROCEDURE CoerceMethodA * ["_a_CoerceMethodA"]
  107.   ( cl      [8] : i.IClassPtr;
  108.     obj    [10] : i.ObjectPtr;
  109.     VAR msg [9] : i.Msg );
  110.  
  111. PROCEDURE CoerceMethod * ["_a_CoerceMethodA"]
  112.   ( cl   [8]  : i.IClassPtr;
  113.     obj [10]  : i.ObjectPtr;
  114.     msg  [9]..: SYS.LONGWORD );
  115.  
  116. (*
  117. ** SetSuperAttrs( cl, o, tag1, data1, ..., TAG_END );
  118. ** A useful varargs conversion to the proper OM_SET method.
  119. *)
  120.  
  121. PROCEDURE SetSuperAttrsA * ["_a_SetSuperAttrs"]
  122.   ( cl   [8] : i.IClassPtr;
  123.     obj [10] : i.ObjectPtr;
  124.     tags [9] : ARRAY OF u.TagItem )
  125.   : e.APTR;
  126.  
  127. PROCEDURE SetSuperAttrs * ["_a_SetSuperAttrs"]
  128.   ( cl   [8]  : i.IClassPtr;
  129.     obj [10]  : i.ObjectPtr;
  130.     tags [9]..: u.Tag )
  131.   : e.APTR;
  132.  
  133. END BoopsiUtil.
  134.  
  135.