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 / HookUtil.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  2.1 KB  |  71 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: HookUtil.mod $
  4.   Description:
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.7 $
  8.       $Author: fjc $
  9.         $Date: 1995/01/26 00:46:19 $
  10.  
  11.   Copyright © 1994, Frank Copeland.
  12.   This file is part of the Oberon-A Library.
  13.   See Oberon-A.doc for conditions of use and distribution.
  14.  
  15. *************************************************************************)
  16.  
  17. <* STANDARD- *> <* INITIALISE+ *> <* MAIN- *>
  18.  
  19. MODULE HookUtil;
  20.  
  21. <*$ CaseChk-  IndexChk- LongVars+ NilChk+  *>
  22. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  23.  
  24. IMPORT SYS := SYSTEM, e := Exec, u := Utility;
  25.  
  26. (*------------------------------------*)
  27. (*
  28.   This procedure is intended to be installed in the entry field of a
  29.   u.Hook record.  Its purpose is to push the parameters passed to it
  30.   onto the stack and call the procedure installed in the subEntry field.
  31.  
  32.   The parameters are:
  33.  
  34.     hook    : u.HookPtr; (* passed in the A0 register *)
  35.     object  : e.APTR;    (* passed in the A2 register *)
  36.     message : e.APTR;    (* passed in the A1 register *)
  37.  
  38.   Stack checking should be turned off (<*$StackChk-*>) in all procedures
  39.   installed in Hooks, as they are likely to be running in a non-Oberon
  40.   context.
  41. *)
  42.  
  43. PROCEDURE HookEntry* () : e.APTR;
  44.  
  45. <*$EntryExitCode-*>
  46. BEGIN (* HookEntry *)
  47.   SYS.INLINE (
  48.     2F08H,                       (* MOVE.L A0, -(A7)      *)
  49.     2F0AH,                       (* MOVE.L A2, -(A7)      *)
  50.     2F09H,                       (* MOVE.L A1, -(A7)      *)
  51.     2068H, 000CH,                (* MOVE.L  000C(A0), A0  *)
  52.     4E90H,                       (* JSR    (A0)           *)
  53.     4E75H )                      (* RTS                   *)
  54.   (*
  55.     No RETURN is required, result is already in D0.
  56.     The procedure in subEntry will clean up the parameters on the stack.
  57.   *)
  58. END HookEntry;
  59.  
  60. (*------------------------------------*)
  61. PROCEDURE InitHook *
  62.   (VAR hook : u.Hook; subEntry : u.HookFunc; data : e.APTR);
  63.  
  64. BEGIN (* InitHook *)
  65.   hook.entry := HookEntry;
  66.   hook.subEntry := subEntry;
  67.   hook.data := data;
  68. END InitHook;
  69.  
  70. END HookUtil.
  71.