Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/working/exception/impl/test-main.c

    r6a48cc9 r35ba584c  
    289289// Terminate Rethrow:
    290290// I don't have an implementation for this.
     291void reterminate() {
     292        {
     293                void fn_try1() {
     294                        void fn_try2() {
     295                                terminate(1);
     296                        }
     297                        void fn_catch2(int index, exception except) {
     298                                switch (index) {
     299                                case 1:
     300                                        printf("reterminate 2 caught and "
     301                                               "will rethrow exception 1\n");
     302                                        __rethrow_terminate();
     303                                        break;
     304                                default:
     305                                        printf("INVALID INDEX in reterminate 2: %d (%d)\n",
     306                                                index, except);
     307                                }
     308                        }
     309                        int fn_match2(exception except) {
     310                                if (1 == except) {
     311                                        return 1;
     312                                } else {
     313                                        return 0;
     314                                }
     315                        }
     316                        __try_terminate(fn_try2, fn_catch2, fn_match2);
     317                }
     318                void fn_catch1(int index, exception except) {
     319                        switch (index) {
     320                        case 1:
     321                                printf("reterminate 1 caught exception 1\n");
     322                                break;
     323                        default:
     324                                printf("INVALID INDEX in reterminate 1: %d (%d)\n",
     325                                        index, except);
     326                        }
     327                }
     328                int fn_match1(exception except) {
     329                        if (1 == except) {
     330                                return 1;
     331                        } else {
     332                                return 0;
     333                        }
     334                }
     335                __try_terminate(fn_try1, fn_catch1, fn_match1);
     336        }
     337}
    291338
    292339// Resume Rethrow:
     
    428475        terminate_swapped(); printf("\n");
    429476        resume_swapped(); printf("\n");
     477        reterminate(); printf("\n");
    430478        reresume(); printf("\n");
    431479        fee(); printf("\n");
Note: See TracChangeset for help on using the changeset viewer.