home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / useful / dev / obero / oberon-a / examples / libraries / utility / hooks1.mod < prev    next >
Encoding:
Text File  |  1994-08-08  |  2.0 KB  |  89 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: Hooks1.mod $
  4.   Description: Example of a callback hook function.
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 1.4 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 16:59:20 $
  10.  
  11.   Copyright © 1994, Frank Copeland.
  12.   This example program is part of Oberon-A.
  13.   See Oberon-A.doc for conditions of use and distribution.
  14.  
  15.   Log entries are at the end of the file.
  16.  
  17. *************************************************************************)
  18.  
  19. MODULE Hooks1;
  20.  
  21. (*
  22. ** $C= CaseChk       $I= IndexChk  $L= LongAdr   $N= NilChk
  23. ** $P- PortableCode  $R= RangeChk  $S= StackChk  $T= TypeChk
  24. ** $V= OvflChk       $Z= ZeroVars
  25. *)
  26.  
  27. IMPORT
  28.   SYS := SYSTEM,
  29.   E := Exec,
  30.   U := Utility,
  31.   HU := HookUtil,
  32.   IO := StdIO;
  33.  
  34. CONST
  35.   VersionTag = "\0$VER: Hook1 1.0 (9.6.94)\r\n";
  36.   VersionStr = "Hook1 1.0 (9 Jun 1994)\r\n";
  37.   AuthorStr = "Written by Frank Copeland\n";
  38.  
  39. VAR
  40.   myHook : U.Hook;
  41.  
  42. (*------------------------------------*)
  43. PROCEDURE* MyFunction
  44.   ( hook : U.HookPtr; obj : E.APTR; data : E.APTR )
  45.   : E.APTR;
  46.  
  47. BEGIN (* MyFunction *)
  48.   IO.WriteStr ("Inside MyFunction\n\n");
  49.   RETURN SYS.VAL (E.APTR, 1)
  50. END MyFunction;
  51.  
  52. (*------------------------------------*)
  53. PROCEDURE Main ();
  54.  
  55. BEGIN (* Main *)
  56.   U.OpenLib (TRUE);
  57.   HU.InitHook (myHook, MyFunction, NIL);
  58.   IF U.base.CallHookPkt (SYS.ADR (myHook), NIL, NIL) = 1 THEN
  59.     IO.WriteStr ("Hook returned OK\n")
  60.   ELSE
  61.     IO.WriteStr ("Some problem with hook\n")
  62.   END
  63. END Main;
  64.  
  65. BEGIN (* Hooks1 *)
  66.   IO.WriteStr (VersionStr);
  67.   IO.WriteStr (AuthorStr);
  68.   IO.WriteLn ();
  69.   Main ();
  70. END Hooks1.
  71.  
  72. (*************************************************************************
  73.  
  74.   $Log: Hooks1.mod $
  75. # Revision 1.4  1994/08/08  16:59:20  fjc
  76. # Release 1.4
  77. #
  78. # Revision 1.3  1994/07/03  15:15:44  fjc
  79. # - Incorporated changes in 3.1 Interfaces
  80. #
  81. # Revision 1.2  1994/06/14  00:56:29  fjc
  82. # - Updated for release
  83. #
  84. # Revision 1.1  1994/06/09  22:11:44  oberon
  85. # Initial revision
  86. #
  87. *************************************************************************)
  88.  
  89.