diff --git a/demo/catchgroup.c b/demo/catchgroup.c new file mode 100644 index 0000000..81f8f68 --- /dev/null +++ b/demo/catchgroup.c @@ -0,0 +1,13 @@ +#include "exclib.h" + +int main(void) +{ + TRY { + THROW(2, NULL); + } CATCH_GROUP(1) { + } CATCH_GROUP(2) { + } CATCH_GROUP(3) { + EXCLIB_TRACE("Inside of CATCH_GROUP"); + } ETRY; + return 0; +} diff --git a/demo/deepuncaught.c b/demo/deepuncaught.c new file mode 100644 index 0000000..6caf46e --- /dev/null +++ b/demo/deepuncaught.c @@ -0,0 +1,14 @@ +#include "exclib.h" + +int main(void) +{ + TRY { + TRY { + TRY { + THROW(3, NULL); + } ETRY; + } ETRY; + } ETRY; + + return 0; +} diff --git a/demo/default.c b/demo/default.c new file mode 100644 index 0000000..e209bb3 --- /dev/null +++ b/demo/default.c @@ -0,0 +1,12 @@ +#include "exclib.h" +#include + +int main(void) +{ + TRY { + THROW(2, NULL); + } DEFAULT { + EXCLIB_TRACE("Inside of DEFAULT - I catch everything!"); + } ETRY; + return 0; +} diff --git a/demo/finally.c b/demo/finally.c new file mode 100644 index 0000000..889dbdd --- /dev/null +++ b/demo/finally.c @@ -0,0 +1,12 @@ +#include "exclib.h" +#include + +int main(void) +{ + TRY { + THROW(2, NULL); + } FINALLY { + printf("I am in the finally clause, and I am about to issue an unhandled exception error.\n"); + } ETRY; + return 0; +} diff --git a/demo/helpers.c b/demo/helpers.c new file mode 100644 index 0000000..5c8758a --- /dev/null +++ b/demo/helpers.c @@ -0,0 +1,14 @@ +#include "exclib.h" + +int main(void) +{ + TRY { + THROW_ZERO(NULL, EXC_NULLPOINTER, "I just threw with THROW_ZERO"); + } CATCH ( EXC_NULLPOINTER ) { + THROW_NONZERO(strcmp("not", "equal"), + 3, + "strcmp was nonzero!"); + } ETRY; + + return 0; +} diff --git a/demo/threelevel.c b/demo/throwoutside.c similarity index 100% rename from demo/threelevel.c rename to demo/throwoutside.c