home *** CD-ROM | disk | FTP | other *** search
- Error
-
- Legal stuff...
-
- The Error module is in the Public Domain, and may be freely copied and
- distributed on the following conditions:
-
- 1. It is supplied complete with this documentation, and neither is altered
- in any way, shape or form.
- 2. The program remains the exclusive property of Armen Software.
- 3. We get a mention in the credits of any program that uses it.
-
- I don't mind if it gets used in commercial programs.
-
- Overview
-
- When writing WIMP applications, safeguarding the user's data
- must be a priority. Therefore, when an error such as a machine
- exception occurs, the task must not quit instantly without the user's
- permission. The problem is, though, that these fatal errors
- instantly cause BASIC programs to end. What the Error module is
- designed for is changing these fatal errors into normal manageable
- errors before BASIC gets to hear about it and quits the task.
-
- Technical information
-
- Error can be in one of two states: Error_Fatal and
- Error_Severe. If in the Error_Fatal state, all fatal errors
- behave normally, allowing applications to perform their error-
- trapping in the manner it was originally written. In the
- Error_Severe state, however, if a fatal error (which is
- signified by an error number higher than &80000000) is discovered,
- the error number is stored in Error's workspace, and the error
- number is then changed to the value &804700, which is a perfectly
- acceptable everyday error number. If the task is interested, the 'real'
- error number (the original one) may be discovered by a call to SWI
- Error_LastError.
-
- The current state of the Error module is determined by a counter in
- Error's workspace. If the count is zero, the Error_Fatal state is
- adopted, if non-zero, the Error_Severe state is used (this is to
- allow correct nesting of calls to the module to change the state).
- Error should be left in the Error_Fatal state during calls to
- Wimp_Poll, to allow other tasks to perform their own trapping of
- 'fatal' errors. Therefore, a possible example code fragment is as
- follows:
-
- SYS "Error_Severe"
- REPEAT
- SYS "Error_Fatal"
- SYS "Wimp_Poll" TO reason%
- SYS "Error_Severe"
- PROCaction(reason%)
- UNTIL quit%
- SYS "Wimp_CloseDown"
- SYS "Error_Fatal"
- END
-
- SWI calls
-
- Error_Fatal
- (SWI &427C0)
-
- Switches Error into the Error_Fatal state.
-
- On entry -
- On exit All registers preserved.
- Interrupts Interrupt status is undefined.
- Processor mode Processor is in SVC mode.
- Re-entrancy Re-entrancy is undefined.
- Use This call decrements Error's internal count, which will
- normally switch the module into the Error_Fatal state. If
- the count is already zero, then an error is returned.
- Related SWIs Error_Severe (SWI &427C1).
- Related vectors None.
-
- Error_Severe
- (SWI &427C1)
-
- Puts Error into the Error_Severe state.
-
- On entry -
- On exit All registers preserved.
- Interrupts Interrupt status is undefined.
- Processor mode Processor is in SVC mode.
- Re-entrancy Re-entrancy is undefined.
- Use This call increases Error's internal count, which will place
- it in Error_Severe mode. In order to cancel a call to
- Error_Severe, it is necessary to call Error_Fatal as many
- times as Error_Severe has been called (see the example
- given in the Technical information above).
- Related SWIs Error_Fatal (SWI &427C0).
- Related vectors None.
-
- Error_LastError
- (SWI &427C2)
-
- Returns the number of the last 'fatal' error trapped by Error.
-
- On entry -
- On exit R0 = error number.
- Interrupts Interrupt status is undefined.
- Processor mode Processor is in SVC mode.
- Re-entrancy Re-entrancy is not defined.
- Use This SWI enables you to find out exactly which error the
- module has trapped without tedious comparison of strings.
- Related SWIs None.
- Related vectors None.
-