From 0ad3996104dd213fbb5bc56a37cd718a3eb93b4d Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sun, 31 Jul 2011 10:50:52 -0400 Subject: [PATCH] Fix for issue #2, standardized naming on EXCLIB_ scheme; moved EXC_STATUS_LIST to EXCLIB_EXCEPTION; added some new demos and gave old demos more sensible names. Various other small improvements. --- demo/catchgroup.c | 13 +++++++++++++ demo/deepuncaught.c | 14 ++++++++++++++ demo/default.c | 12 ++++++++++++ demo/finally.c | 12 ++++++++++++ demo/helpers.c | 14 ++++++++++++++ demo/{threelevel.c => throwoutside.c} | 0 6 files changed, 65 insertions(+) create mode 100644 demo/catchgroup.c create mode 100644 demo/deepuncaught.c create mode 100644 demo/default.c create mode 100644 demo/finally.c create mode 100644 demo/helpers.c rename demo/{threelevel.c => throwoutside.c} (100%) 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