FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/riviera/support/exception.h @ 270:d1388095ab27
doc/RVTMUX write-up
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Thu, 06 Feb 2014 09:54:02 +0000 |
parents | afceeeb2cba1 |
children |
rev | line source |
---|---|
118
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 ****************************** |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * Initialial version: Laurent Deniau, Laurent.Deniau@cern.ch |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * For more information, please see the paper: |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 * http://cern.ch/Laurent.Deniau/html/oopc/exception.html |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 * |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 * ----------------------------------------------------------- |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 * |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 * Strong rework and adaption to riviera by Christophe Favergeon |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 * |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 ****************************** |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 */ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 #ifndef RVF_EXCEPTION_H |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 #define RVF_EXCEPTION_H |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 |
119
dd56546ad9e0
starting to compile RVF
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
118
diff
changeset
|
20 #include "../rvf/rvf_api.h" |
dd56546ad9e0
starting to compile RVF
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
118
diff
changeset
|
21 #include "../rvf/rvf_target.h" |
118
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 #include <string.h> |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 //#ifndef __STDC__ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 //# error "exception.h needs ISO C compiler to work properly" |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 //#endif |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 #include <setjmp.h> |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 typedef enum K_RVF_EXCEPTIONS { E_invalid=1, E_not_enough_memory,E_unknown } T_RVF_EXCEPTIONS; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 typedef void (*T_RVF_RELEASE_PROTECTED_POINTER)(void *p); |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 /* |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 choose context savings |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 */ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 #define rvf_save_context_buffer_(context) setjmp(context) |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 #define rvf_restore_context_buffer_(context, val) longjmp(context, val) |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 /* |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 some hidden types used to handle exceptions |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 */ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 /* type of stack of protected pointer */ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 struct _protectedPtr_ { |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 struct _protectedPtr_ *next; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 struct _protectedPtr_ *previous; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 void *ptr; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 T_RVF_RELEASE_PROTECTED_POINTER func; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 }; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 /* type of stack of exception */ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 struct _exceptionContext_ { |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 struct _exceptionContext_ *next; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 struct _protectedPtr_ *stack; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 jmp_buf context; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 }; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 extern struct _exceptionContext_ *const _returnExceptionContext_[MAX_RVF_TASKS]; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 extern struct _exceptionContext_ *_currentExceptionContext_[MAX_RVF_TASKS]; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 /* exception keywords */ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 #define try \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 do { \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 struct _exceptionContext_ _localExceptionContext_ ;\ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 memset(&_localExceptionContext_,0,sizeof(struct _exceptionContext_));\ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 _localExceptionContext_.next=_currentExceptionContext_[rvf_get_taskid()];\ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 _currentExceptionContext_[rvf_get_taskid()] = &_localExceptionContext_; \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 do { \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 int const exception = \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 rvf_save_context_buffer_(_currentExceptionContext_[rvf_get_taskid()]->context); \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 if (!exception) { |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 #define catch(except) \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 } else if ((int)(except) == exception) { \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 _currentExceptionContext_[rvf_get_taskid()] = _currentExceptionContext_[rvf_get_taskid()]->next; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 #define catch_any \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 } else { \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 _currentExceptionContext_[rvf_get_taskid()] = _currentExceptionContext_[rvf_get_taskid()]->next; |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 #define endtry \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 } \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 } while(0); \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 if (_currentExceptionContext_[rvf_get_taskid()] == &_localExceptionContext_) { \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 rvf_forget_protected_ptr();\ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 _currentExceptionContext_[rvf_get_taskid()] = _currentExceptionContext_[rvf_get_taskid()]->next; \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 } \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 } while(0) |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 #define rethrow throw(exception) |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 #define break_try break |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 /* |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 #define return_try(...) \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 do { \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 _currentExceptionContext_ = _returnExceptionContext_; \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 return __VA_ARGS__; \ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 } while(0) |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 */ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 #define throw(except) _exceptionThrow_((int)(except)) |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 /* |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 extern declarations |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 */ |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 extern void _exceptionThrow_(int except); |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 extern void rvf_forget_protected_ptr(); |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 extern void rvf_protect_pointer(T_RVF_MB_ID mb_id,void *p,T_RVF_RELEASE_PROTECTED_POINTER func); |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 #define RVF_PROTECT(bank,p) rvf_protect_pointer(bank,p,(T_RVF_RELEASE_PROTECTED_POINTER)rvf_free_buf) |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 #define THROW_IF_ERROR(err) if (err!=0) throw(E_unknown) |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 #define THROW_IF_NULL(p) if (p==NULL) throw(E_not_enough_memory) |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 #define THROW_IF_YELLOW(b,p) if ((p==NULL) || (rvf_get_mb_status(b)==RVF_YELLOW)) throw(E_not_enough_memory) |
21de8d8e6ea7
checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 #endif |