Index: ossp-pkg/ex/ex.pod RCS File: /v/ossp/cvs/ossp-pkg/ex/ex.pod,v rcsdiff -q -kk '-r1.10' '-r1.11' -u '/v/ossp/cvs/ossp-pkg/ex/ex.pod,v' 2>/dev/null --- ex.pod 2002/01/30 10:33:36 1.10 +++ ex.pod 2002/01/30 11:11:09 1.11 @@ -36,13 +36,13 @@ B I; -B {...} [B {...}] B (I) {...} +B I [B I] B (I) I B(I, I, I); B; -B {...}; +B I if (B) ... @@ -50,30 +50,31 @@ =head1 DESCRIPTION -B is a small ISO-C++ style exception handling library for use -in the ISO-C language. It allows you to use the paradigm of throwing -and catching exceptions in order to reduce the amount of error handling -code without making your program less robust. This is achieved +B is a small B style exception handling library for +use in the B language. It allows you to use the paradigm of +throwing and catching exceptions in order to reduce the amount of error +handling code without making your program less robust. This is achieved by directly transferring exceptional return codes (and the program -control flow) from the location where it was raised (throw point) to -the location where it is handled (catch point) - usually from a deeply -nested sub-routine to a parent routine. All intermediate routines -no longer have to make sure that the exceptional return codes from -sub-routines are correctly passed back to the parent. +control flow) from the location where the exception is raised (throw +point) to the location where it is handled (catch point) -- usually +from a deeply nested sub-routine to a parent routine. All intermediate +routines no longer have to make sure that the exceptional return codes +from sub-routines are correctly passed back to the parent. =head2 EXCEPTIONS An exception is a triple EI,I,IE where I identifies the class of the exception thrower, I identifies the particular class instance of the exception thrower, and -I is the exceptional return code the thrower wants to send to the -catcher. All three parts are of type C internally, but every -value can be used which can be (automatically) casted to a C. -Exceptions are created on-the-fly by the B command. +I is the exceptional return code value the thrower wants to send +to the catcher. All three parts are of type "C" internally, +but every value can be used which can be (automatically) casted to the +B type "C". Exceptions are created on-the-fly by the +B command. =head2 APPLICATION PROGRAMMER INTERFACE (API) -The B API consists of four different elements: +The B API consists of the following elements: =over 4 @@ -133,38 +134,45 @@ =back -=item B {...} [B {...}] B (I) {...} +=item B I [B I] B (I) I This is the main construct provided by B. It is modeled after -the ISO-C++ C-C construct which in turn is very similar to -an ISO-C C-C construct. It consists of an B block -which forms the dynamic scope of the exception handling (i.e. exceptions -directly thrown there or thrown from subroutines are catched), an -optional B block for performing cleanup sequences and a -B block where the caught exceptions are handled. - -# CONTROL FLOW FIXME! - +the B C-C clause which in turn is very similar to +an B C-C clause. It consists of an B block +I which forms the dynamic scope of the exception handling (i.e. +exceptions directly thrown there or thrown from its sub-routines are +catched), an optional B block I for performing +cleanup operations and an B block I where the caught +exceptions are handled. + +The control flow in case no exception is thrown is simply I, +optionally followed by I. I is skipped. The control flow +in case an exception is thrown is: I (up to the statement where +the exception is thrown), optionally followed by I, followed by +I. + The B, B and B cannot be used seperately, -they work only in combination. In contrast to ISO-C++ there is only -one B block and not multiple ones (all B exceptions -are of the same ISO-C type B). If an exception is caught, it -is stored in I for inspection (or re-throwing) inside the -B block. Although declared outside, the I is only -valid within the B block. But it can be re-used in following -B/B constructs, of course. - -The B block is a regular ISO-C language block, but it is not -allowed to jump into it via C or C(3) or out of it via -C, C or C(3) because there is some hidden setup -and cleanup that needs to be done by B regardless of whether an -exception is caught. Jumping into an B clause would avoid doing -the setup, and jumping out of it would avoid doing the cleanup. In both -cases the result is a broken exception facility. Nevertheless you are -allowed to nest B clauses. - -The B block is a regular ISO-C language block without any -restrictions. +they work only in combination. And in contrast to B there +is only one B block and not multiple ones (all B +exceptions are of the same B type B). If an exception is +caught, it is stored in I for inspection (or re-throwing) +inside the B block. Although declared outside, the I +is only valid within the B block. But it can be re-used in +following B/B constructs, of course. + +The B block is a regular B language block of +statement(s), but it is not allowed to jump into it via C or +C(3) or out of it via C, C or C(3) +because there is some hidden setup and cleanup that needs to be done by +B regardless of whether an exception is caught. Jumping into +an B clause would avoid doing the setup, and jumping out of it +would avoid doing the cleanup. In both cases the result is a broken +exception facility. Nevertheless you are allowed to nest B +clauses. + +The B and B blocks are regular B language +block of statement(s) without any restrictions. You are even allowed to +throw (and in the B block to re-throw) an exception. =item B(I, I, I); @@ -185,11 +193,11 @@ I.ex_value) but with the difference that the C, C and C elements of the thrown exception are kept. -=item B {...} +=item B I -This directive executes its block while shielding against the throwing -of exceptions, i.e., in the dynamic scope of B any -B operation is ignored. +This directive executes I while shielding it against the throwing +of exceptions, i.e., inside the dynamic scope of B all +B operations are ignored. =item B @@ -246,7 +254,7 @@ =back The default implementation (define C<__EX_MCTX_USE_SJLJ__> or as long -C<__EX_MCTX_USE_CUSTOM__> is not defined) uses B jmp_buf(3): +C<__EX_MCTX_USE_CUSTOM__> is not defined) uses B jmp_buf(3): #define __ex_mctx_struct jmp_buf jb; #define __ex_mctx_save(mctx) (setjmp((mctx)->jb) == 0) @@ -295,7 +303,7 @@ B prefix for the API macros B, B, B, B and B sometimes have a unpleasant optical appearance. Especially because B is modeled after the exception -facility in ISO C++ where there is no such prefix on the directives. +facility in B where there is no such prefix on the directives. For this B optionally provides the ability to provide additional namespace mappings for those API macros. By default (define