OSSP CVS Repository

ossp - Check-in [1649]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1649
Date: 2002-Jan-26 23:42:46 (local)
2002-Jan-26 22:42:46 (UTC)
User:rse
Branch:
Comment: - rename ex_shielded to ex_shielding - do not provide namespace mapping for ex_shielding - add ex_catching for testing whether someone is trying to catch exceptions
Tickets:
Inspections:
Files:
ossp-pkg/ex/ex.h      1.6 -> 1.7     6 inserted, 4 deleted
ossp-pkg/ex/ex.pod      1.5 -> 1.6     19 inserted, 12 deleted
ossp-pkg/ex/ex_test.c      1.4 -> 1.5     6 inserted, 6 deleted

ossp-pkg/ex/ex.h 1.6 -> 1.7

--- ex.h 2002/01/26 22:35:02     1.6
+++ ex.h 2002/01/26 22:42:46     1.7
@@ -190,8 +190,12 @@
     for (__ex_ctx->ctx_disabled = 1; \
          __ex_ctx->ctx_disabled == 1; \
          __ex_ctx->ctx_disabled = 0)
-#define ex_shielded \
-        (__ex_ctx->ctx_disabled)
+
+/* exception handling tests */
+#define ex_catching \
+    (__ex_ctx->ctx_mctx != NULL)
+#define ex_shielding \
+    (__ex_ctx->ctx_disabled)
 
 /* optional namespace mapping */
 #if defined(__EX_NS_USE_UCCXX__)
@@ -200,14 +204,12 @@
 #define Throw    ex_throw
 #define Rethrow  ex_rethrow
 #define Shield   ex_shield
-#define Shielded ex_shielded
 #elif defined(__EX_NS_USE_CXX__) || (!defined(__cplusplus) && !defined(__EX_NS_USE_CUSTOM__))
 #define try      ex_try
 #define catch    ex_catch
 #define throw    ex_throw
 #define rethrow  ex_rethrow
 #define shield   ex_shield
-#define shielded ex_shielded
 #endif
 
 #endif /* __EX_H__ */


ossp-pkg/ex/ex.pod 1.5 -> 1.6

--- ex.pod       2002/01/26 22:35:02     1.5
+++ ex.pod       2002/01/26 22:42:46     1.6
@@ -44,7 +44,9 @@
 
 B<ex_shield> { ... };
 
-if (B<ex_shielded>) ...
+if (B<ex_catching>) ...
+
+if (B<ex_shielding>) ...
 
 =head1 DESCRIPTION
 
@@ -186,10 +188,16 @@
 of exceptions, i.e., in the dynamic scope of B<ex_shield> any
 B<ex_throw> operation is ignored. 
 
-=item B<ex_shielded>
+=item B<ex_catching>
+
+This is a flag which can be tested inside a block to test whether the
+current scope is exception catching (by B<ex_catch> somewhere in the
+dynamic scope) or not.
+
+=item B<ex_shielding>
 
 This is a flag which can be tested inside a block to test whether the
-current scope is exception shielded (by B<ex_shield> somewhere in the
+current scope is exception shielding (by B<ex_shield> somewhere in the
 dynamic scope) or not.
 
 =back
@@ -293,18 +301,17 @@
 B<OSSP ex> implementation consistently uses the B<ex_>, B<__ex_>
 and B<__EX_> prefixes for namespace protection. But at least the
 B<ex_> prefix for the API macros B<ex_try>, B<ex_catch>, B<ex_throw>,
-B<ex_rethrow>, B<ex_shield> and B<ex_shielded> sometimes have a
-unpleasant optical appearance. Especially because B<OSSP rc> is modeled
-after the exception facility in ISO C++ where there is no such prefix on
-the directives.
+B<ex_rethrow> and B<ex_shield> sometimes have a unpleasant optical
+appearance. Especially because B<OSSP rc> is modeled after the exception
+facility in ISO C++ where there is no such prefix on the directives.
 
 For this B<OSSP ex> optionally provides the ability to provide
 additional namespace mappings for those API macros. By default (define
 C<__EX_NS_USE_CXX__> o or as long as C<__EX_CTX_USE_CUSTOM__> and
-C<__cplusplus> is not defined) you can additional C++ style macros
-named B<catch>, B<throw>, B<rethrow>, B<shield> and B<shielded>. As an
-alternative you can define C<__EX_NS_USE_UCCXX__> to get the same but
-with an (more namespace safe) upper case first letter.
+C<__cplusplus> is not defined) you can additional C++ style macros named
+B<catch>, B<throw>, B<rethrow> and B<shield>. As an alternative you
+can define C<__EX_NS_USE_UCCXX__> to get the same but with an (more
+namespace safe) upper case first letter.
 
 =head1 MULTITHREADING ENVIRONMENTS
 
@@ -539,7 +546,7 @@
 
  #ifdef WITH_EX
  #define FOO_ERR(ctx,err) \
-     ((   ex_shielded \
+     ((   ex_shielding \
        || !foo_ex_use \
        || ((ctx) != NULL && !(ctx)->ex_use)) 
       ? FOO_ERR_##err \


ossp-pkg/ex/ex_test.c 1.4 -> 1.5

--- ex_test.c    2002/01/26 22:35:02     1.4
+++ ex_test.c    2002/01/26 22:42:46     1.5
@@ -116,16 +116,16 @@
     ex_t ex;
 
     ts_test_check(TS_CTX, "exception shielding");
-    if (ex_shielded)
-        ts_test_fail(TS_CTX, "unexpected shielded scope");
+    if (ex_shielding)
+        ts_test_fail(TS_CTX, "unexpected shielding scope");
     ex_try {
         ex_shield {
-            if (!ex_shielded)
-                ts_test_fail(TS_CTX, "unexpected non-shielded scope");
+            if (!ex_shielding)
+                ts_test_fail(TS_CTX, "unexpected non-shielding scope");
             ex_throw(0, 0, 0);
         }
-        if (ex_shielded)
-            ts_test_fail(TS_CTX, "unexpected shielded scope");
+        if (ex_shielding)
+            ts_test_fail(TS_CTX, "unexpected shielding scope");
     }
     ex_catch (ex) {
         ts_test_fail(TS_CTX, "unexpected exception catched");

CVSTrac 2.0.1