OSSP CVS Repository

ossp - Difference in ossp-pkg/ex/ex.h versions 1.11 and 1.12
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/ex/ex.h 1.11 -> 1.12

--- ex.h 2002/01/29 20:10:53     1.11
+++ ex.h 2002/01/30 10:33:36     1.12
@@ -96,17 +96,19 @@
     __ex_mctx_t  *ctx_mctx;     /* permanent machine context of enclosing try/catch */
     int           ctx_disabled; /* permanent flag whether exception handling is disabled */
     int           ctx_caught;   /* temporary flag whether exception was caught */
+    int           ctx_cleanup;  /* temporary flag whether cleanup block was present */
     volatile ex_t ctx_ex;       /* temporary exception storage */
 } ex_ctx_t;
 
 /* the static and dynamic initializers for a context structure */
 #define EX_CTX_INITIALIZER \
-    { NULL, 0, 0, { NULL, NULL, NULL, NULL, 0, NULL } }
+    { NULL, 0, 0, 0, { NULL, NULL, NULL, NULL, 0, NULL } }
 #define EX_CTX_INITIALIZE(ctx) \
     do { \
         (ctx)->ctx_mctx         = NULL; \
         (ctx)->ctx_disabled     = 0;    \
         (ctx)->ctx_caught       = 0;    \
+        (ctx)->ctx_cleanup      = 0;    \
         (ctx)->ctx_ex.ex_class  = NULL; \
         (ctx)->ctx_ex.ex_object = NULL; \
         (ctx)->ctx_ex.ex_value  = NULL; \
@@ -133,11 +135,12 @@
         __ex_mctx_t __ex_mctx_me; \
         __ex_mctx_en = __ex_ctx_ptr->ctx_mctx; \
         __ex_ctx_ptr->ctx_mctx = &__ex_mctx_me; \
+        __ex_ctx_ptr->ctx_cleanup = 0; \
         if (__ex_mctx_save(&__ex_mctx_me)) { \
             if (1)
 
-/* the block for catching an exception */
-#define ex_catch(e) \
+/* the optional(!) block for cleanup */
+#define ex_cleanup \
             else { \
             } \
             __ex_ctx_ptr->ctx_caught = 0; \
@@ -147,6 +150,24 @@
             __ex_ctx_ptr->ctx_caught = 1; \
         } \
         __ex_ctx_ptr->ctx_mctx = __ex_mctx_en; \
+        __ex_ctx()->ctx_cleanup = 1; \
+        if (1) { \
+            if (1)
+
+/* the block for catching an exception */
+#define ex_catch(e) \
+            else { \
+            } \
+            if (!(__ex_ctx()->ctx_cleanup)) \
+                __ex_ctx_ptr->ctx_caught = 0; \
+        } \
+        else { \
+            if (!(__ex_ctx()->ctx_cleanup)) { \
+                __ex_mctx_restored(&__ex_mctx_me); \
+                __ex_ctx_ptr->ctx_caught = 1; \
+            } \
+        } \
+        __ex_ctx_ptr->ctx_mctx = __ex_mctx_en; \
     } \
     if (   !(__ex_ctx()->ctx_caught) \
         || ((e) = __ex_ctx()->ctx_ex, 0)) { \

CVSTrac 2.0.1