home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / amigae / e_v3.2a / rkrmsrc / utility / hooks1.e < prev    next >
Text File  |  1977-12-31  |  986b  |  40 lines

  1. -> hooks1.e
  2.  
  3. ->>> Header (globals)
  4. MODULE 'utility',
  5.        'utility/hooks',
  6.        'tools/installhook'
  7.  
  8. ENUM ERR_NONE, ERR_LIB
  9.  
  10. RAISE ERR_LIB IF OpenLibrary()=NIL
  11. ->>>
  12.  
  13. ->>> PROC myFunction(h:PTR TO hook, o, msg)
  14. -> This function only prints out a message indicating that we are inside the
  15. -> callback function.
  16. PROC myFunction(h:PTR TO hook, o, msg)
  17.   -> E-Note: installhook has set-up access to data segment
  18.   WriteF('Inside myFunction()\n')
  19. ENDPROC 1
  20. ->>>
  21.  
  22. ->>> PROC main()
  23. PROC main() HANDLE
  24.   DEF h:hook
  25.   -> Open the utility library
  26.   utilitybase:=OpenLibrary('utility.library', 36)
  27.   -> Initialise the callback hook
  28.   -> E-Note: use installhook to do the main stuff (so h.data cannot be used)
  29.   installhook(h, {myFunction})
  30.   -> Use the utility library function to invoke the hook
  31.   CallHookPkt(h, NIL, NIL)
  32. EXCEPT DO
  33.   IF utilitybase THEN CloseLibrary(utilitybase)
  34.   SELECT exception
  35.   CASE ERR_LIB;  WriteF('Error: could not open utility library\n')
  36.   ENDSELECT
  37. ENDPROC
  38. ->>>
  39.  
  40.