chiark / gitweb /
Initial revision
[ssr] / StraySrc / Libraries / Sapphire / csapph / h / except
1 /*
2  * except.h
3  *
4  * [Generated from except, 25 September 1996]
5  */
6
7 #if !defined(__CC_NORCROFT) || !defined(__arm)
8   #error You must use the Norcroft ARM Compiler for Sapphire programs
9 #endif
10
11 #pragma include_only_once
12 #pragma force_top_level
13
14 #ifndef __except_h
15 #define __except_h
16
17 #ifndef __sapphire_h
18   #include "sapphire.h"
19 #endif
20
21 /*----- Overview ----------------------------------------------------------*
22  *
23  * Functions provided:
24  *
25  *  except_init
26  *  except_fatal
27  *  except_atExit
28  *  except_returnPt
29  */
30
31 /* --- except_init --- *
32  *
33  * On entry:    --
34  *
35  * On exit:     --
36  *
37  * Use:         Initialises the exception handler.
38  */
39
40 extern routine except_init;
41
42 /* --- except_fatal --- *
43  *
44  * On entry:    R0 == pointer to an error block
45  *
46  * On exit:     Doesn't
47  *
48  * Use:         Reports an error to our /caller's/ error handler.  We quit
49  *              and die at this point.  Don't use unless you have absolutely
50  *              no choice in the matter.
51  */
52
53 extern routine except_fatal;
54
55 /* --- except_atExit --- *
56  *
57  * On entry:    R0 == pointer to routine to call on exit
58  *              R1 == R12 value to call with
59  *
60  * On exit:     --
61  *
62  * Use:         Registers a routine to get called when the application quits.
63  *              Later-registered routines are called earlier than earlier-
64  *              registered routines, so everything closes down in a nice
65  *              manner.
66  */
67
68 extern routine except_atExit;
69
70 /* --- except_returnPt --- *
71  *
72  * On entry:    R0 == pointer to exception handler routine
73  *              R1 == R12 value to enter routine with
74  *              R2 == R13 value to enter routine with
75  *
76  * On exit:     --
77  *
78  * Use:         Sets up a routine to be called whenever there's an error.
79  *              The idea is that it should ask the user whether to quit,
80  *              and if not, resume to some known (safe?) state.
81  *
82  *              The routine is called with R0 == pointer to error block, and
83  *              R12 and R13 being the values set up here(*).  It should
84  *              return with R0 == pointer to a routine to resume at, and R1
85  *              being the value to pass to the resume routine in R12.  If
86  *              you decide to quit, just call OS_Exit -- this should tidy
87  *              everything up.
88  *
89  *              Note that the error is held in the scratchpad buffer, so
90  *              you can't use the first 256 bytes of that until you've
91  *              finished with the error message.
92  *
93  *              (*) Actually, R13 is 4 bytes lower because it's assumed that
94  *              it points to a full descending stack that we can use.  This
95  *              shouldn't make any difference as long as you're using R13
96  *              as a full descending stack pointer.
97  */
98
99 extern routine except_returnPt;
100
101 /*----- That's all, folks -------------------------------------------------*/
102
103 #endif