home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / dev / e / amigae / src / tools / trapguru / gurutest.e next >
Text File  |  1992-09-02  |  470b  |  21 lines

  1. /* shows ho to catch processor exceptions from own programs
  2.    I don't guarantee what the module trapguru.m does is 100% ok
  3.    for all CPU's    */
  4.  
  5. MODULE 'tools/trapguru'
  6.  
  7. PROC main()
  8.   DEF a
  9.   trapguru()                       -> install trap handler
  10.   FOR a:=1 TO 10 DO bla(a)
  11. ENDPROC
  12.  
  13. PROC bla(x) HANDLE
  14.   DEF a=0
  15.   a:=a/a             -> cause processor exception
  16. EXCEPT
  17.   IF exception="GURU"
  18.     WriteF('guru \d occured: $\z\h[8]\n',x,exceptioninfo)
  19.   ENDIF
  20. ENDPROC
  21.