home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Basic / MAXONB32.DMS / in.adf / Includes.lha / BH / BLib / BOOPSISupport.bas < prev    next >
Encoding:
BASIC Source File  |  1994-03-16  |  1.2 KB  |  54 lines

  1. ''
  2. '' $Id: BOOPSISupport.bas,v 1.2 1994/03/07 17:26:09 alex Rel $
  3. ''
  4. '' BASIC BOOPSI Amiga.lib support functions (plus some macros)
  5. ''
  6. '' (c) Copyright 1994 HiSoft
  7. ''
  8.  
  9. 'REM $INCLUDE Utility.bh    ' note the library _is_ required for CallHookPkt()
  10. 'REM $INCLUDE Intuition.bc
  11.  
  12. '
  13. ' add offset for instance data to an object handle
  14. '
  15. FUNCTION INST_DATA&(BYVAL cl&, BYVAL o&)
  16.     INST_DATA& = o& + PEEKW(cl& + cl_InstOffset%)
  17. END FUNCTION
  18.  
  19. '
  20. ' sizeof the instance data for a given class
  21. '
  22. FUNCTION SIZEOF_INSTANCE&(BYVAL cl&)
  23.     SIZEOF_INSTANCE& = PEEKW(cl& + cl_InstOffset%) + PEEKW(cl& + cl_InstSize%) + _
  24.       (MinNode_sizeof% + 4%)
  25. END FUNCTION
  26.  
  27. '
  28. ' get class pointer from an object handle
  29. '
  30. FUNCTION OCLASS&(BYVAL o&)
  31.     OCLASS& = PEEKL(o& - (MinNode_sizeof% + 4%) + o_Class%)
  32. END FUNCTION
  33.  
  34. '
  35. ' Perform method on coerced object.
  36. '
  37. FUNCTION CoerceMethodA&(cl&, o&, msg&)
  38.     CoerceMethodA& = CallHookPkt&(cl& + cl_Dispatcher%, o&, msg&)
  39. END FUNCTION
  40.  
  41. '
  42. ' Perform method on object
  43. '
  44. FUNCTION DoMethodA&(o&, msg&)
  45.     DoMethodA& = CoerceMethodA&(OCLASS&(o&), o&, msg&)
  46. END FUNCTION
  47.  
  48. '
  49. ' Perform method on object coerced to superclass
  50. '
  51. FUNCTION DoSuperMethodA&(BYVAL cl&, BYVAL o&, BYVAL msg&)
  52.     DoSuperMethodA& = CoerceMethodA&(PEEKL(cl& + cl_Super%), o&, msg&)
  53. END FUNCTION
  54.