ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 6448f7d was
ecfd758,
checked in by Andrew Beach <ajbeach@…>, 4 years ago
|
Major exception update, seperating type-ids from virtual tables. The major interface changes are done. There is a regression of ?Cancelled(T) to Some?Cancelled. There is some bits of code for the new verion of the ?Cancelled(T) interface already there. Not connected yet but I just reached the limit of what I wanted to do in one commit and then spent over a day cleaning up, so it will replace Some?Cancelled in a future commit.
|
-
Property mode set to
100644
|
File size:
859 bytes
|
Rev | Line | |
---|
[6d43cdde] | 1 | // Conditional Catch Test |
---|
| 2 | |
---|
| 3 | // I may fold this back into terminate.cfa and resume.cfa once setting |
---|
| 4 | // up the non-trivial exception is reasonable to do. |
---|
| 5 | |
---|
[e68d092] | 6 | #include <exception.hfa> |
---|
[6d43cdde] | 7 | |
---|
[ecfd758] | 8 | EHM_EXCEPTION(num_error)( |
---|
| 9 | int num; |
---|
[6d43cdde] | 10 | ); |
---|
| 11 | |
---|
[ecfd758] | 12 | EHM_VIRTUAL_TABLE(num_error, num_error_vt); |
---|
[6d43cdde] | 13 | |
---|
| 14 | void caught_num_error(int expect, num_error * actual) { |
---|
| 15 | printf("Caught num_error: expected=%d actual=%d.\n", expect, actual->num); |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | int main(int argc, char * argv[]) { |
---|
[ecfd758] | 19 | num_error exc = {&num_error_vt, 2}; |
---|
[6d43cdde] | 20 | |
---|
| 21 | try { |
---|
[046a890] | 22 | throw exc; |
---|
[ecfd758] | 23 | } catch (num_error * error ; 3 == error->num ) { |
---|
[6d43cdde] | 24 | caught_num_error(3, error); |
---|
[ecfd758] | 25 | } catch (num_error * error ; 2 == error->num ) { |
---|
[6d43cdde] | 26 | caught_num_error(2, error); |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | try { |
---|
[046a890] | 30 | throwResume exc; |
---|
[ecfd758] | 31 | } catchResume (num_error * error ; 3 == error->num ) { |
---|
[6d43cdde] | 32 | caught_num_error(3, error); |
---|
[ecfd758] | 33 | } catchResume (num_error * error ; 2 == error->num ) { |
---|
[6d43cdde] | 34 | caught_num_error(2, error); |
---|
| 35 | } |
---|
| 36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.