~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Examples/test-suite/catches.i

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2009-11-15 14:00:28 UTC
  • mfrom: (1.2.9 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091115140028-me7amr2rie8zz1xn
Tags: 1.3.40-2ubuntu1
* Merge from Debian testing (LP: #356529), remaining changes:
  - Drop libchicken-dev from the build-depends (it's in universe)
  - Remove Pike from package description and from configure flags
  - drop "--without-mzscheme", we don't have it in our build-depends
  - use php-config5
  - Clean Runtime/ as well.
  - debian/rules (clean): Remove Lib/ocaml/swigp4.ml.
* debian/rules: Remove hardcoded python version.
* Remove upper limit for python from Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%module catches
 
2
 
 
3
%{
 
4
#if defined(_MSC_VER)
 
5
  #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
 
6
#endif
 
7
%}
 
8
 
 
9
%include <exception.i> // for throws(...) typemap
 
10
 
 
11
%catches(int, const char *, const ThreeException&) test_catches(int i);
 
12
%catches(int, ...) test_exception_specification(int i); // override the exception specification
 
13
%catches(...) test_catches_all(int i);
 
14
 
 
15
%inline %{
 
16
struct ThreeException {};
 
17
void test_catches(int i) {
 
18
  if (i == 1) {
 
19
    throw int(1);
 
20
  } else if (i == 2) {
 
21
    throw (const char *)"two";
 
22
  } else if (i == 3) {
 
23
    throw ThreeException();
 
24
  }
 
25
}
 
26
void test_exception_specification(int i) throw(int, const char *, const ThreeException&) {
 
27
  test_catches(i);
 
28
}
 
29
void test_catches_all(int i) {
 
30
  test_catches(i);
 
31
}
 
32
%}
 
33