change the %catchs name to %catches
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8357 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a9769137ed
commit
bc39db5341
5 changed files with 31 additions and 18 deletions
|
|
@ -1,5 +1,17 @@
|
||||||
Version 1.3.28 (unreleased).
|
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
|
01/10/2006: cfisavage
|
||||||
Updated Ruby Exception handling. Classes that are specified in throws clauses,
|
Updated Ruby Exception handling. Classes that are specified in throws clauses,
|
||||||
or are marked as %exceptionclass, are now inherited from rb_eRuntimeError.
|
or are marked as %exceptionclass, are now inherited from rb_eRuntimeError.
|
||||||
|
|
@ -10,7 +22,7 @@ Version 1.3.28 (unreleased).
|
||||||
|
|
||||||
01/10/2006: mmatus
|
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
|
directive in a more automatic way. For example, if you have
|
||||||
|
|
||||||
int foo() throw(E1);
|
int foo() throw(E1);
|
||||||
|
|
@ -39,7 +51,7 @@ Version 1.3.28 (unreleased).
|
||||||
} catch(E2) { ... }
|
} 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:
|
the list of exception to catch, and from swig:
|
||||||
|
|
||||||
%catch(E1,E2) barfoo(int i);
|
%catch(E1,E2) barfoo(int i);
|
||||||
|
|
@ -49,7 +61,7 @@ Version 1.3.28 (unreleased).
|
||||||
|
|
||||||
int barfoo(int i) throw(E1,E2);
|
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
|
correspond to the C++ 'throw' list. For example, if you
|
||||||
have:
|
have:
|
||||||
|
|
||||||
|
|
@ -61,7 +73,7 @@ Version 1.3.28 (unreleased).
|
||||||
|
|
||||||
you can define
|
you can define
|
||||||
|
|
||||||
%catchs(E) barfoo(int i);
|
%catches(E) barfoo(int i);
|
||||||
|
|
||||||
and swig will generate an action code equivalent to
|
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
|
Also, you can now specify that you want to catch the
|
||||||
unknown exception '...', for example:
|
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.
|
'rethrowing' code using the 'throw' typemap.
|
||||||
|
|
||||||
For the same, for the '...' case to work, you need to
|
For the same, for the '...' case to work, you need to
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,10 @@
|
||||||
/* The EmpytError doesn't appear in a throw declaration, and hence
|
/* The EmpytError doesn't appear in a throw declaration, and hence
|
||||||
we need to tell SWIG that the dequeue method throws it. This can
|
we need to tell SWIG that the dequeue method throws it. This can
|
||||||
now be done via the %catchs feature. */
|
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;
|
%exceptionclass EmptyError;
|
||||||
|
|
||||||
|
|
@ -28,11 +28,12 @@
|
||||||
try {
|
try {
|
||||||
$action
|
$action
|
||||||
} catch(EmptyError& e) {
|
} catch(EmptyError& e) {
|
||||||
// Create a new instance of the EmptyError, wrap it as a Ruby object that Ruby owns,
|
// 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
|
// 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
|
// 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.
|
// 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);
|
%raise(SWIG_NewPointerObj(new EmptyError(e),SWIGTYPE_p_EmptyError, SWIG_POINTER_OWN),
|
||||||
|
"EmptyError", SWIGTYPE_p_EmptyError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -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 %{
|
%inline %{
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,10 @@
|
||||||
#define %clearexception %feature("except","")
|
#define %clearexception %feature("except","")
|
||||||
|
|
||||||
|
|
||||||
/* the %catchs directive */
|
/* the %catches directive */
|
||||||
|
|
||||||
#define %catchs(tlist...) %feature("catchs","("`tlist`")")
|
#define %catches(tlist...) %feature("catches","("`tlist`")")
|
||||||
#define %clearcatchs %feature("catchs","")
|
#define %clearcatches %feature("catches","")
|
||||||
|
|
||||||
/* the %exceptionclass directive */
|
/* the %exceptionclass directive */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -467,7 +467,7 @@ class Allocate : public Dispatcher {
|
||||||
void mark_exception_classes(Node *n) {
|
void mark_exception_classes(Node *n) {
|
||||||
ParmList *throws = 0;
|
ParmList *throws = 0;
|
||||||
/* the "catchs" feature take precedence over the original throw list */
|
/* the "catchs" feature take precedence over the original throw list */
|
||||||
String *sthrows = Getattr(n,"feature:catchs");
|
String *sthrows = Getattr(n,"feature:catches");
|
||||||
if (sthrows) {
|
if (sthrows) {
|
||||||
throws = Swig_cparse_parms(sthrows);
|
throws = Swig_cparse_parms(sthrows);
|
||||||
if (throws) {
|
if (throws) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue