change the %catchs name to %catches

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8357 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-10 23:17:15 +00:00
commit a925249e0b
5 changed files with 31 additions and 18 deletions

View file

@ -1,5 +1,17 @@
Version 1.3.28 (unreleased).
===========================
01/10/2006: mmatus
- Ass the 'utitle' encoder, as an example of how to add
your own encoder. I added the encoder method in misc.c
but you can add another one, the same way, inside any
target language.
Well, 'utitle' is the reverse of 'ctitle', ie:
%rename("%(ctitle)s") camel_case; -> CamelCase;
%rename("%(utitle)s") CamelCase; -> camel_case;
01/10/2006: cfisavage
Updated Ruby Exception handling. Classes that are specified in throws clauses,
or are marked as %exceptionclass, are now inherited from rb_eRuntimeError.
@ -10,7 +22,7 @@ Version 1.3.28 (unreleased).
01/10/2006: mmatus
- Add the %catchs directive, which complements the %exception
- Add the %catches directive, which complements the %exception
directive in a more automatic way. For example, if you have
int foo() throw(E1);
@ -39,7 +51,7 @@ Version 1.3.28 (unreleased).
} catch(E2) { ... }
}
which is very tedious. Well, the %catchs directive defines
which is very tedious. Well, the %catches directive defines
the list of exception to catch, and from swig:
%catch(E1,E2) barfoo(int i);
@ -49,7 +61,7 @@ Version 1.3.28 (unreleased).
int barfoo(int i) throw(E1,E2);
Note, however, that the %catchs list doesn't have to
Note, however, that the %catches list doesn't have to
correspond to the C++ 'throw' list. For example, if you
have:
@ -61,7 +73,7 @@ Version 1.3.28 (unreleased).
you can define
%catchs(E) barfoo(int i);
%catches(E) barfoo(int i);
and swig will generate an action code equivalent to
@ -78,9 +90,9 @@ Version 1.3.28 (unreleased).
Also, you can now specify that you want to catch the
unknown exception '...', for example:
%catchs(E1,E2,...) barfoo(int);
%catches(E1,E2,...) barfoo(int);
In any case, the %catchs directive will emit the
In any case, the %catches directive will emit the
'rethrowing' code using the 'throw' typemap.
For the same, for the '...' case to work, you need to

View file

@ -17,10 +17,10 @@
/* The EmpytError doesn't appear in a throw declaration, and hence
we need to tell SWIG that the dequeue method throws it. This can
now be done via the %catchs feature. */
%catchs(EmptyError) *::dequeue();
%catches(EmptyError) *::dequeue();
/* What the catchs clause is doing under the covers is this:
/* What the catches clause is doing under the covers is this:
%exceptionclass EmptyError;
@ -28,11 +28,12 @@
try {
$action
} catch(EmptyError& e) {
// Create a new instance of the EmptyError, wrap it as a Ruby object that Ruby owns,
// and return it as the exception. For this to work EmtpyError must inherit from
// a standard Ruby exception class such as rb_eRuntimeError. SWIG automatically does
// this when the class is marked as %exceptionclass or is a throws specification.
%raise(SWIG_NewPointerObj(new EmptyError(e), SWIGTYPE_p_EmptyError, SWIG_POINTER_OWN), "EmptyError", SWIGTYPE_p_EmptyError);
// Create a new instance of the EmptyError, wrap it as a Ruby object that Ruby owns,
// and return it as the exception. For this to work EmtpyError must inherit from
// a standard Ruby exception class such as rb_eRuntimeError. SWIG automatically does
// this when the class is marked as %exceptionclass or is a throws specification.
%raise(SWIG_NewPointerObj(new EmptyError(e),SWIGTYPE_p_EmptyError, SWIG_POINTER_OWN),
"EmptyError", SWIGTYPE_p_EmptyError);
}
}
*/

View file

@ -15,7 +15,7 @@
}
}
%catchs(E1,E2*,ET<int>,ET<double>,...) A::barfoo(int i);
%catches(E1,E2*,ET<int>,ET<double>,...) A::barfoo(int i);
%inline %{

View file

@ -88,10 +88,10 @@
#define %clearexception %feature("except","")
/* the %catchs directive */
/* the %catches directive */
#define %catchs(tlist...) %feature("catchs","("`tlist`")")
#define %clearcatchs %feature("catchs","")
#define %catches(tlist...) %feature("catches","("`tlist`")")
#define %clearcatches %feature("catches","")
/* the %exceptionclass directive */

View file

@ -467,7 +467,7 @@ class Allocate : public Dispatcher {
void mark_exception_classes(Node *n) {
ParmList *throws = 0;
/* the "catchs" feature take precedence over the original throw list */
String *sthrows = Getattr(n,"feature:catchs");
String *sthrows = Getattr(n,"feature:catches");
if (sthrows) {
throws = Swig_cparse_parms(sthrows);
if (throws) {