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.

This commit is contained in:
2011-07-31 10:50:52 -04:00
parent 1c280a8cde
commit 0ad3996104
6 changed files with 65 additions and 0 deletions

13
demo/catchgroup.c Normal file
View File

@@ -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;
}

14
demo/deepuncaught.c Normal file
View File

@@ -0,0 +1,14 @@
#include "exclib.h"
int main(void)
{
TRY {
TRY {
TRY {
THROW(3, NULL);
} ETRY;
} ETRY;
} ETRY;
return 0;
}

12
demo/default.c Normal file
View File

@@ -0,0 +1,12 @@
#include "exclib.h"
#include <stdio.h>
int main(void)
{
TRY {
THROW(2, NULL);
} DEFAULT {
EXCLIB_TRACE("Inside of DEFAULT - I catch everything!");
} ETRY;
return 0;
}

12
demo/finally.c Normal file
View File

@@ -0,0 +1,12 @@
#include "exclib.h"
#include <stdio.h>
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;
}

14
demo/helpers.c Normal file
View File

@@ -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;
}