ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 734908c was
ecfd758,
checked in by Andrew Beach <ajbeach@…>, 3 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:
776 bytes
|
Rev | Line | |
---|
[e68d092] | 1 | // Test exceptions that add data but no functionality. |
---|
| 2 | |
---|
| 3 | #include <exception.hfa> |
---|
| 4 | |
---|
[ecfd758] | 5 | EHM_EXCEPTION(paired)( |
---|
[e68d092] | 6 | int first; |
---|
| 7 | int second; |
---|
| 8 | ); |
---|
| 9 | |
---|
[ecfd758] | 10 | EHM_VIRTUAL_TABLE(paired, paired_vt); |
---|
[e68d092] | 11 | |
---|
[ecfd758] | 12 | const char * virtual_msg(paired * this) { |
---|
| 13 | return this->virtual_table->msg(this); |
---|
[e68d092] | 14 | } |
---|
| 15 | |
---|
| 16 | int main(int argc, char * argv[]) { |
---|
[ecfd758] | 17 | paired except = {&paired_vt, 3, 13}; |
---|
[e68d092] | 18 | |
---|
| 19 | try { |
---|
[046a890] | 20 | throw except; |
---|
[e68d092] | 21 | } catch (paired * exc) { |
---|
[ecfd758] | 22 | printf("%s(%d, %d)\n", virtual_msg(exc), exc->first, exc->second); |
---|
[e68d092] | 23 | ++exc->first; |
---|
| 24 | } |
---|
| 25 | |
---|
[ecfd758] | 26 | printf("%s(%d, %d)\n", virtual_msg(&except), except.first, except.second); |
---|
[e68d092] | 27 | |
---|
| 28 | try { |
---|
[046a890] | 29 | throwResume except; |
---|
[e68d092] | 30 | } catchResume (paired * exc) { |
---|
[ecfd758] | 31 | printf("%s(%d, %d)\n", virtual_msg(exc), exc->first, exc->second); |
---|
[e68d092] | 32 | ++exc->first; |
---|
| 33 | } |
---|
| 34 | |
---|
[ecfd758] | 35 | printf("%s(%d, %d)\n", virtual_msg(&except), except.first, except.second); |
---|
[e68d092] | 36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.