summaryrefslogtreecommitdiff
path: root/fitz/except.h
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-09-11 19:29:42 -0500
committerRobin Watts <robin.watts@artifex.com>2011-09-14 17:44:13 +0100
commit89ae81f651bfa112b8e07317eb6983beaf7cb212 (patch)
tree3f99dad1253b795629e66d45b915c1d72043242b /fitz/except.h
parentcefb81f1886685580a40b17b5e495a8a8a1ebeaf (diff)
downloadmupdf-89ae81f651bfa112b8e07317eb6983beaf7cb212.tar.xz
Initial import of exception handling code
Import exception handling code from WSS, modified to fit into the fitz world. With this code we have 'real' fz_try/fz_catch/fz_rethrow functions, handling a fz_except type. We therefore rename the existing fz_throw/ fz_catch/fz_rethrow to be fz_error_make/fz_error_handle/fz_error_note. We don't actually use fz_try/fz_catch/fz_rethrow yet...
Diffstat (limited to 'fitz/except.h')
-rw-r--r--fitz/except.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/fitz/except.h b/fitz/except.h
new file mode 100644
index 00000000..a964b94e
--- /dev/null
+++ b/fitz/except.h
@@ -0,0 +1,46 @@
+#ifndef EXCEPT_H
+#define EXCEPT_H
+
+#include "fitz.h"
+
+typedef struct fz_except {
+ char mess[256];
+} fz_except;
+
+#include "exceptxxx.h"
+/*
+ Macros for fz_try and fz_catch are defined in exceptxxx.h,
+ but their definitions are best ignored. Just use them as follows:
+
+ fz_var(..);
+ fz_var(..);
+
+ fz_try(ctx)
+ {
+ .
+ .
+ .
+ }
+ fz_catch(ctx)
+ {
+ .
+ .
+ .
+ }
+
+ and don't return from within the try clause.
+*/
+
+void fz_throw(fz_context *, char *, ...);
+
+fz_except *fz_caught(fz_context *);
+
+void fz_rethrow(fz_context *);
+
+#define fz_var(A) fz_var_xxx((void *)&(A))
+
+void fz_var_xxx(void *x);
+
+void fz_except_init(fz_context *);
+
+#endif /* EXCEPT */