🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #5707

Re: Modula Floating Point Trapping

#5707
From: Thomas M. Breeden
Date: Tue, 09 Oct 1990 12:50
39 lines
2584 bytes
In article <49138@seismo.CSS.GOV> black@beno.CSS.GOV (Mike Black) writes:
>Has anyone got an example of how to install trap handlers in Modula?
>Specifically, divide-by-zero errors would be REAL nice to handle
>yourself.  Any help would be REALLY APPRECIATED!!
>Mike...
>--
>-------------------------------------------------------------------------------
>: usenet: black@beno.CSS.GOV   :  land line: 407-494-5853  : I want a computer:
>: real home: Melbourne, FL     :  home line: 407-242-8619  : that does it all!:
>-------------------------------------------------------------------------------

Please post if you get some good mail on this.

Replacing the .tcTrap field in the task structure is the first thing to do.
Note that you must replace the previous value back into it (at least if
you are running under the CLI).

Recovery in the context of your running M2 program is something that really
should be a vendor-supplied feature, since that relies on compiler code
generation and run-time architecture decisions.

For the Benchmark Amiga M2 compiler, a module RunTimeErrors is supplied
that allows you to install a type of trap handling (which also needs to
be removed before program end). This trap handler will display a small
window with some info on the trap and give the user the option of exiting
the program or continuing anyway, or invoking the previous trap handler.

Some of the original ETH M2 compilers included a module "Exceptions" that
supported a controlled exception recovery in the form of a proc call format
such that the PROC would return either when finished or when an exception
occurred. (Does anyone know whether the M2 standards activity has touched
on that at all?). Anyway, for Benchmark, if you want to pursue this further,
I can give you a copy of an Exceptions module that "works" on their
current compiler (ie, "works" = "not heavily tested, not guarenteed, not
a good solution without vendor support, but I use it").

Tom Breeden
tmb@virginia.edu  -->> Internet
tmb@virginia      -->> BITNET
Technical Details
Message-ID: <1990Oct9.125017.27560@murdoch.acc.Virginia.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mcnc!uvaarpa!murdoch!davinci.acc.Virginia.EDU!tmb
References: <49138@seismo.CSS.GOV>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mcnc!uvaarpa!murdoch!davinci.acc.Virginia.EDU!tmb
From: tmb@davinci.acc.Virginia.EDU (Thomas M. Breeden)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Modula Floating Point Trapping
Keywords: Modula
Message-ID: <1990Oct9.125017.27560@murdoch.acc.Virginia.EDU>
Date: 9 Oct 90 12:50:17 GMT
References: <49138@seismo.CSS.GOV>
Sender: news@murdoch.acc.Virginia.EDU
Distribution: usa
Organization: University of Virginia
Lines: 39
Ireallyam: tmb