~ubuntu-branches/ubuntu/quantal/swig2.0/quantal

« back to all changes in this revision

Viewing changes to .pc/r12814.patch/Examples/test-suite/funcptr_cpp.i

  • Committer: Package Import Robot
  • Author(s): Stefano Rivera
  • Date: 2012-06-01 17:05:17 UTC
  • mfrom: (1.1.6) (10.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20120601170517-q0ik32ij61i4r6f0
Tags: 2.0.7-2ubuntu1
* Merge from Debian unstable (LP: #1006387). Remaining changes:
  - Drop libchicken-dev from the build-depends (in universe).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%module funcptr_cpp
2
 
 
3
 
%{
4
 
#if defined(__SUNPRO_CC)
5
 
#pragma error_messages (off, badargtype2w) /* Formal argument ... is being passed extern "C" ... */
6
 
#endif
7
 
%}
8
 
 
9
 
%inline %{
10
 
 
11
 
int addByValue(const int &a, int b) { return a+b; }
12
 
int * addByPointer(const int &a, int b) { static int val; val = a+b; return &val; }
13
 
int & addByReference(const int &a, int b) { static int val; val = a+b; return val; }
14
 
 
15
 
int call1(int (*d)(const int &, int), int a, int b) { return d(a, b); }
16
 
int call2(int * (*d)(const int &, int), int a, int b) { return *d(a, b); }
17
 
int call3(int & (*d)(const int &, int), int a, int b) { return d(a, b); }
18
 
%}
19
 
 
20
 
%constant int (*ADD_BY_VALUE)(const int &, int) = addByValue;
21
 
%constant int * (*ADD_BY_POINTER)(const int &, int) = addByPointer;
22
 
%constant int & (*ADD_BY_REFERENCE)(const int &, int) = addByReference;