chiark / gitweb /
Commit as 2.1.0.
[mLib] / exctest.c
CommitLineData
0875b58f 1#include <stdio.h>
2#include "exc.h"
3
4void func(void)
5{
6 printf("cabbage\n");
7 TRY {
8 printf("dibble\n");
9 THROW(EXC_FAIL, "excession");
10 printf("can't see me\n");
11 } CATCH switch (exc_type) {
12 case 1:
13 printf("exc type 1 (not possible)\n");
14 break;
15 case EXC_FAIL:
16 printf("exc type 2 (%s)\n", exc_s);
17 break;
18 default:
19 RETHROW;
20 } END_TRY;
21
22 printf("fennel\n");
23 THROW(EXC_ERRNO, 53);
24}
25
26int main(void)
27{
28 printf("apple\n");
29 TRY {
30 printf("banana\n");
31 func();
32 printf("can't see me\n");
33 } CATCH switch (exc_type) {
34 default:
35 printf("%lu exception (val = %i)\n", exc_type, exc_i);
36 break;
37 } END_TRY;
38 printf("hello! __exc_list = %p\n", __exc_list);
39
40 return (0);
41}