home *** CD-ROM | disk | FTP | other *** search
- (*************************************************************************
-
- $RCSfile: Hooks1.mod $
- Description: Example of a callback hook function.
-
- Created by: fjc (Frank Copeland)
- $Revision: 1.7 $
- $Author: fjc $
- $Date: 1995/07/02 17:00:43 $
-
- Copyright © 1994-1995, Frank Copeland.
- This example program is part of Oberon-A.
- See Oberon-A.doc for conditions of use and distribution.
-
- *************************************************************************)
-
- <* STANDARD- *>
-
- MODULE Hooks1;
-
- IMPORT SYS := SYSTEM, e := Exec, u := Utility, d := Dos;
-
- CONST
- VersionTag = "$VER: Hook1 1.4 (4.6.95)\r\n";
- VersionStr = "Hook1 1.4 (4.6.95)\r\n";
- AuthorStr = "Written by Frank Copeland\n";
-
- VAR
- myHook : u.HookPtr;
-
- (*------------------------------------*)
- PROCEDURE* MyFunction
- ( hook : u.HookPtr; obj : e.APTR; data : e.APTR )
- : e.APTR;
-
- <*$StackChk-*>
- BEGIN (* MyFunction *)
- d.PrintF ("Inside MyFunction\n\n", NIL);
- RETURN SYS.VAL (e.APTR, 1)
- END MyFunction;
-
- (*------------------------------------*)
- PROCEDURE Main ();
-
- BEGIN (* Main *)
- ASSERT (u.base # NIL, 100);
- NEW (myHook); u.InitHook (myHook, MyFunction);
- IF u.CallHookPkt (myHook, NIL, NIL) = 1 THEN
- d.PrintF ("Hook returned OK\n", NIL)
- ELSE
- d.PrintF ("Some problem with hook\n", NIL)
- END
- END Main;
-
- BEGIN (* Hooks1 *)
- d.PrintF (VersionStr, NIL);
- d.PrintF (AuthorStr, NIL);
- d.PrintF ("\n", NIL);
- Main ();
- END Hooks1.
-