#include "char.h" #include "exception.h" #include "command.h" USE_EXCEPTION(e1); USE_EXCEPTION(e2); USE_EXCEPTION(e3); void f1(); void f2(); void h1(); void h1_raise(); void h2(); main() { printf("main: debut\n"); HANDLE(e3, f1()); if (exception_raised()) printf("main: recuperation de e3\n"); HANDLE(e3, f2()); if (exception_raised()) printf("main: recuperation de e3\n"); HANDLE(any, f2()); if (exception_raised()) printf("main: recuperation par any\n"); printf("main: fin\n"); } void f1() { int i; printf("f1: debut\n"); for ( i = 1 ; ; i++ ) { printf("f1: debut boucle %d\n", i); HANDLE(e1, h1()); if (exception_raised()) printf("f1: recuperation de e1\n"); printf("f1: fin boucle %d\n", i); } printf("f1: fin\n"); } void f2() { int i; printf("f2: debut\n"); for ( i = 1 ; ; i++ ) { printf("f2: debut boucle %d\n", i); HANDLE(e1, h1_raise()); if (exception_raised()) printf("f1: recuperation de e1\n"); printf("f2: fin boucle %d\n", i); } printf("f2: fin\n"); } void h1() { printf("h1: debut\n"); HANDLE(e1, h2()); if (exception_raised()) printf("h1: recuperation de e1\n"); printf("h1: fin\n"); } void h1_raise() { printf("h1_raise: debut\n"); HANDLE(e1, h2()); if (exception_raised()) (printf("h1_raise: recuperation de e1\n"),RAISE(e1)); printf("h1_raise: fin\n"); } void h2() { printf("h2: debut\n"); HANDLE(e2, command()); if (exception_raised()) printf("h2: recuperation de e2\n"); printf("h2: fin\n"); }