modifying build system not to rely on the -I path to find the input files avoiding warning 125: merge .i files that are common between python and the main version
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10954 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b266e1f68c
commit
3041db155d
9 changed files with 15 additions and 424 deletions
|
|
@ -47,8 +47,15 @@ namespace std
|
||||||
%template(pairiiAc) pair<int,const pair<int, A*> >;
|
%template(pairiiAc) pair<int,const pair<int, A*> >;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef SWIGRUBY
|
||||||
%template() pair< swig::LANGUAGE_OBJ, swig::LANGUAGE_OBJ >;
|
%template() pair< swig::LANGUAGE_OBJ, swig::LANGUAGE_OBJ >;
|
||||||
%template(LanguageMap) map< swig::LANGUAGE_OBJ, swig::LANGUAGE_OBJ >;
|
%template(LanguageMap) map< swig::LANGUAGE_OBJ, swig::LANGUAGE_OBJ >;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SWIGPYTHON
|
||||||
|
%template() pair<swig::PyObject_ptr, swig::PyObject_ptr>;
|
||||||
|
%template(pymap) map<swig::PyObject_ptr, swig::PyObject_ptr>;
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,4 +31,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(SWIGRUBY)
|
||||||
%template(LanguageSet) std::set<swig::LANGUAGE_OBJ>;
|
%template(LanguageSet) std::set<swig::LANGUAGE_OBJ>;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(SWIGPYTHON)
|
||||||
|
%template(pyset) std::set<swig::PyObject_ptr>;
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%module li_std_vector
|
%module li_std_vector_extra
|
||||||
|
|
||||||
%warnfilter(509) overloaded1;
|
%warnfilter(509) overloaded1;
|
||||||
%warnfilter(509) overloaded2;
|
%warnfilter(509) overloaded2;
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
%module("templatereduce") li_std_map
|
|
||||||
|
|
||||||
%include std_pair.i
|
|
||||||
%include std_map.i
|
|
||||||
%include std_multimap.i
|
|
||||||
|
|
||||||
%inline %{
|
|
||||||
struct A{
|
|
||||||
int val;
|
|
||||||
|
|
||||||
A(int v = 0): val(v)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
%}
|
|
||||||
|
|
||||||
namespace std
|
|
||||||
{
|
|
||||||
%template(pairii) pair<int, int>;
|
|
||||||
%template(pairAA) pair<int, A>;
|
|
||||||
%template(pairA) pair<int, A*>;
|
|
||||||
%template(mapA) map<int, A*>;
|
|
||||||
%template(mmapA) multimap<int, A*>;
|
|
||||||
|
|
||||||
%template(paircA1) pair<const int, A*>;
|
|
||||||
%template(paircA2) pair<const int, const A*>;
|
|
||||||
%template(pairiiA) pair<int,pair<int, A*> >;
|
|
||||||
%template(pairiiAc) pair<int,const pair<int, A*> >;
|
|
||||||
|
|
||||||
|
|
||||||
%template() pair<swig::PyObject_ptr, swig::PyObject_ptr>;
|
|
||||||
%template(pymap) map<swig::PyObject_ptr, swig::PyObject_ptr>;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%inline
|
|
||||||
{
|
|
||||||
std::pair<int, A*>
|
|
||||||
p_identa(std::pair<int, A*> p) {
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<int,A*> m_identa(const std::map<int,A*>& v)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace std
|
|
||||||
{
|
|
||||||
%template(mapii) map<int,int>;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
%module li_std_set
|
|
||||||
|
|
||||||
%include <std_string.i>
|
|
||||||
%include <std_set.i>
|
|
||||||
%include <std_multiset.i>
|
|
||||||
%include <std_vector.i>
|
|
||||||
|
|
||||||
%template(set_string) std::set<std::string>;
|
|
||||||
%template(set_int) std::multiset<int>;
|
|
||||||
|
|
||||||
|
|
||||||
%template(v_int) std::vector<int>;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%template(pyset) std::set<swig::PyObject_ptr>;
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
%module li_std_stream
|
|
||||||
|
|
||||||
%inline %{
|
|
||||||
struct A;
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include <std_iostream.i>
|
|
||||||
%include <std_sstream.i>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%callback(1) A::bar;
|
|
||||||
|
|
||||||
%inline %{
|
|
||||||
|
|
||||||
struct B {
|
|
||||||
virtual ~B()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct A : B
|
|
||||||
{
|
|
||||||
void __add__(int a)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void __add__(double a)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static int bar(int a){
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int foo(int a, int (*pf)(int a))
|
|
||||||
{
|
|
||||||
return pf(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::ostream& __rlshift__(std::ostream& out)
|
|
||||||
{
|
|
||||||
out << "A class";
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
%}
|
|
||||||
|
|
||||||
%extend std::basic_ostream<char>{
|
|
||||||
std::basic_ostream<char>&
|
|
||||||
operator<<(const A& a)
|
|
||||||
{
|
|
||||||
*self << "A class";
|
|
||||||
return *self;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from li_std_vector import *
|
from li_std_vector_extra import *
|
||||||
|
|
||||||
iv = IntVector(4)
|
iv = IntVector(4)
|
||||||
for i in range(0,4):
|
for i in range(0,4):
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
%module li_std_wstring
|
|
||||||
%include <std_basic_string.i>
|
|
||||||
%include <std_wstring.i>
|
|
||||||
|
|
||||||
|
|
||||||
%inline %{
|
|
||||||
|
|
||||||
struct A : std::wstring
|
|
||||||
{
|
|
||||||
A(const std::wstring& s) : std::wstring(s)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct B
|
|
||||||
{
|
|
||||||
B(const std::wstring& s) : cname(0), name(s), a(s)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
char *cname;
|
|
||||||
std::wstring name;
|
|
||||||
A a;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
wchar_t test_wcvalue(wchar_t x) {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wchar_t* test_ccvalue(const wchar_t* x) {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
wchar_t* test_cvalue(wchar_t* x) {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring test_value(std::wstring x) {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::wstring& test_const_reference(const std::wstring &x) {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_pointer(std::wstring *x) {
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring *test_pointer_out() {
|
|
||||||
static std::wstring x = L"x";
|
|
||||||
return &x;
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_const_pointer(const std::wstring *x) {
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::wstring *test_const_pointer_out() {
|
|
||||||
static std::wstring x = L"x";
|
|
||||||
return &x;
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_reference(std::wstring &x) {
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring& test_reference_out() {
|
|
||||||
static std::wstring x = L"x";
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void test_throw() throw(std::wstring){
|
|
||||||
static std::wstring x = L"x";
|
|
||||||
|
|
||||||
throw x;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
%}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,199 +0,0 @@
|
||||||
%module std_containers
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include <set>
|
|
||||||
%}
|
|
||||||
%include std_vector.i
|
|
||||||
%include std_string.i
|
|
||||||
%include std_deque.i
|
|
||||||
%include std_list.i
|
|
||||||
%include std_set.i
|
|
||||||
%include std_multiset.i
|
|
||||||
%include std_pair.i
|
|
||||||
%include std_map.i
|
|
||||||
%include std_multimap.i
|
|
||||||
%include std_complex.i
|
|
||||||
|
|
||||||
%template() std::vector<double>;
|
|
||||||
%template() std::pair<std::string, int>;
|
|
||||||
%template() std::pair<int,double>;
|
|
||||||
|
|
||||||
%template() std::vector< std::vector<double > > ;
|
|
||||||
%template(ccube) std::vector< std::vector< std::vector<double > > >;
|
|
||||||
|
|
||||||
%inline
|
|
||||||
{
|
|
||||||
typedef
|
|
||||||
std::vector<std::vector<std::vector<double > > >
|
|
||||||
ccube;
|
|
||||||
|
|
||||||
ccube cident(const ccube& c)
|
|
||||||
{
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct C
|
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
%template(map_si) std::map<std::string, int>;
|
|
||||||
%template(pair_iC) std::pair<int, C*>;
|
|
||||||
%template(map_iC) std::map<int, C*>;
|
|
||||||
%template(mmap_si) std::multimap<std::string, int>;
|
|
||||||
%template(set_i) std::set<int>;
|
|
||||||
%template(multiset_i) std::multiset<int>;
|
|
||||||
%template(list_i) std::list<int>;
|
|
||||||
%template(deque_i) std::deque<int>;
|
|
||||||
|
|
||||||
%template(vector_b) std::vector<bool>;
|
|
||||||
%template(vector_i) std::vector<int>;
|
|
||||||
%template(vector_c) std::vector<std::complex<double> >;
|
|
||||||
%template(vector_ui) std::vector<unsigned int>;
|
|
||||||
|
|
||||||
%template(bmatrix) std::vector<std::vector<bool> >;
|
|
||||||
%template(imatrix) std::vector<std::vector<int> >;
|
|
||||||
%template(cmatrix) std::vector<std::vector<std::complex<double> > >;
|
|
||||||
|
|
||||||
%apply std::vector<int> *INOUT {std::vector<int> *INOUT2};
|
|
||||||
|
|
||||||
%inline
|
|
||||||
{
|
|
||||||
typedef std::vector<std::vector<int> > imatrix;
|
|
||||||
imatrix midenti(const imatrix& v)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef std::vector<std::vector<bool> > bmatrix;
|
|
||||||
bmatrix midentb(const bmatrix& v)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<int,C*> mapidentc(const std::map<int,C*>& v)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<int,int> mapidenti(const std::map<int,int>& v)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<std::string,int> mapident(const std::map<std::string,int>& v)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::multimap<std::string,int> mapident(const std::multimap<std::string,int>& v)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<int> vident(const std::vector<int>& v)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::set<int> sident(const std::set<int>& v)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<unsigned int> videntu(const std::vector<unsigned int>& v)
|
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_elem(const std::vector<int>& v, int index)
|
|
||||||
{
|
|
||||||
return v[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<int,double> pident(const std::pair<int,double>& p)
|
|
||||||
{
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
v_inout(std::vector<int> *INOUT) {
|
|
||||||
*INOUT = *INOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
v_inout2(std::vector<int> *INOUT, std::vector<int> *INOUT2) {
|
|
||||||
std::swap(*INOUT, *INOUT2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
%{
|
|
||||||
|
|
||||||
template <class C> struct Param
|
|
||||||
{
|
|
||||||
};
|
|
||||||
%}
|
|
||||||
|
|
||||||
|
|
||||||
template <class C> struct Param
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
%template(Param_c) Param<std::complex<double> >;
|
|
||||||
%inline
|
|
||||||
{
|
|
||||||
int hello(Param<std::complex<double> > c)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%inline
|
|
||||||
{
|
|
||||||
struct A
|
|
||||||
{
|
|
||||||
A(int aa = 0) : a(aa)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
int a;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
%template() std::pair<A,int>;
|
|
||||||
%template(pair_iA) std::pair<int,A>;
|
|
||||||
%template(vector_piA) std::vector<std::pair<int,A> >;
|
|
||||||
|
|
||||||
|
|
||||||
%inline {
|
|
||||||
std::pair<A,int> ident(std::pair<int,A> a, const std::pair<int,int>& b)
|
|
||||||
{
|
|
||||||
return std::pair<A,int>();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::pair<int,A> > pia_vident(std::vector<std::pair<int,A> > a )
|
|
||||||
{
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Foo
|
|
||||||
{
|
|
||||||
Foo(int i) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
%std_nodefconst_type(Foo);
|
|
||||||
|
|
||||||
%template(vector_Foo) std::vector<Foo>;
|
|
||||||
%template(deque_Foo) std::deque<Foo>;
|
|
||||||
%template(list_Foo) std::list<Foo>;
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue