diff --git a/caller.h b/caller.h index 43da3d91..2be78d25 100644 --- a/caller.h +++ b/caller.h @@ -543,260 +543,225 @@ struct caller namespace detail { -// create signature tuples -inline -PyObject* function_signature() { - tuple result(0); - - return result.reference().release(); -} - -template -PyObject* function_signature(type) { - static const bool is_plain_A1 = BOOST_PYTHON_IS_PLAIN(A1); - tuple result(1); - result.set_item(0, python_type_name_selector::get(type())); - - return result.reference().release(); -} - -template -PyObject* function_signature(type, type) { - static const bool is_plain_A1 = BOOST_PYTHON_IS_PLAIN(A1); - static const bool is_plain_A2 = BOOST_PYTHON_IS_PLAIN(A2); - tuple result(2); - result.set_item(0, python_type_name_selector::get(type())); - result.set_item(1, python_type_name_selector::get(type())); - - return result.reference().release(); -} - -template -PyObject* function_signature(type, type, type) { - static const bool is_plain_A1 = BOOST_PYTHON_IS_PLAIN(A1); - static const bool is_plain_A2 = BOOST_PYTHON_IS_PLAIN(A2); - static const bool is_plain_A3 = BOOST_PYTHON_IS_PLAIN(A3); - tuple result(3); - result.set_item(0, python_type_name_selector::get(type())); - result.set_item(1, python_type_name_selector::get(type())); - result.set_item(2, python_type_name_selector::get(type())); - - return result.reference().release(); -} - -template -PyObject* function_signature(type, type, type, type) { - static const bool is_plain_A1 = BOOST_PYTHON_IS_PLAIN(A1); - static const bool is_plain_A2 = BOOST_PYTHON_IS_PLAIN(A2); - static const bool is_plain_A3 = BOOST_PYTHON_IS_PLAIN(A3); - static const bool is_plain_A4 = BOOST_PYTHON_IS_PLAIN(A4); - tuple result(4); - result.set_item(0, python_type_name_selector::get(type())); - result.set_item(1, python_type_name_selector::get(type())); - result.set_item(2, python_type_name_selector::get(type())); - result.set_item(3, python_type_name_selector::get(type())); - - return result.reference().release(); -} - -template -PyObject* function_signature(type, type, type, type, type) { - static const bool is_plain_A1 = BOOST_PYTHON_IS_PLAIN(A1); - static const bool is_plain_A2 = BOOST_PYTHON_IS_PLAIN(A2); - static const bool is_plain_A3 = BOOST_PYTHON_IS_PLAIN(A3); - static const bool is_plain_A4 = BOOST_PYTHON_IS_PLAIN(A4); - static const bool is_plain_A5 = BOOST_PYTHON_IS_PLAIN(A5); - tuple result(5); - result.set_item(0, python_type_name_selector::get(type())); - result.set_item(1, python_type_name_selector::get(type())); - result.set_item(2, python_type_name_selector::get(type())); - result.set_item(3, python_type_name_selector::get(type())); - result.set_item(4, python_type_name_selector::get(type())); - - return result.reference().release(); -} - -template -PyObject* function_signature(type, type, type, type, type, type) { - static const bool is_plain_A1 = BOOST_PYTHON_IS_PLAIN(A1); - static const bool is_plain_A2 = BOOST_PYTHON_IS_PLAIN(A2); - static const bool is_plain_A3 = BOOST_PYTHON_IS_PLAIN(A3); - static const bool is_plain_A4 = BOOST_PYTHON_IS_PLAIN(A4); - static const bool is_plain_A5 = BOOST_PYTHON_IS_PLAIN(A5); - static const bool is_plain_A6 = BOOST_PYTHON_IS_PLAIN(A6); - tuple result(6); - result.set_item(0, python_type_name_selector::get(type())); - result.set_item(1, python_type_name_selector::get(type())); - result.set_item(2, python_type_name_selector::get(type())); - result.set_item(3, python_type_name_selector::get(type())); - result.set_item(4, python_type_name_selector::get(type())); - result.set_item(5, python_type_name_selector::get(type())); - - return result.reference().release(); -} - // member functions template -inline PyObject* function_signature(R (T::*pmf)()) { - return function_signature( - python::type()); +PyObject* function_signature(R (T::*pmf)()) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + + return result; } template -inline PyObject* function_signature(R (T::*pmf)(A1)) { - return function_signature( - python::type(), - python::type()); +PyObject* function_signature(R (T::*pmf)(A1)) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (T::*pmf)(A1, A2)) { - return function_signature( - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (T::*pmf)(A1, A2)) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (T::*pmf)(A1, A2, A3)) { - return function_signature( - python::type(), - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (T::*pmf)(A1, A2, A3)) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (T::*pmf)(A1, A2, A3, A4)) { - return function_signature( - python::type(), - python::type(), - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (T::*pmf)(A1, A2, A3, A4)) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (T::*pmf)(A1, A2, A3, A4, A5)) { - return function_signature( - python::type(), - python::type(), - python::type(), - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (T::*pmf)(A1, A2, A3, A4, A5)) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } // const member functions template -inline PyObject* function_signature(R (T::*pmf)() const) { - return function_signature( - python::type()); +PyObject* function_signature(R (T::*pmf)() const) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + + return result; } template -inline PyObject* function_signature(R (T::*pmf)(A1) const) { - return function_signature( - python::type(), - python::type()); +PyObject* function_signature(R (T::*pmf)(A1) const) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (T::*pmf)(A1, A2) const) { - return function_signature( - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (T::*pmf)(A1, A2) const) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (T::*pmf)(A1, A2, A3) const) { - return function_signature( - python::type(), - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (T::*pmf)(A1, A2, A3) const) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (T::*pmf)(A1, A2, A3, A4) const) { - return function_signature( - python::type(), - python::type(), - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (T::*pmf)(A1, A2, A3, A4) const) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (T::*pmf)(A1, A2, A3, A4, A5) const) { - return function_signature( - python::type(), - python::type(), - python::type(), - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (T::*pmf)(A1, A2, A3, A4, A5) const) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } // free functions template -inline PyObject* function_signature(R (*f)()) { - return function_signature(); +PyObject* function_signature(R (*f)()) { + tuple s(0); + PyObject * result = s.reference().release(); + + return result; } template -inline PyObject* function_signature(R (*f)(A1)) { - return function_signature( - python::type()); +PyObject* function_signature(R (*f)(A1)) { + tuple s(0); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (*f)(A1, A2)) { - return function_signature( - python::type(), - python::type()); +PyObject* function_signature(R (*f)(A1, A2)) { + tuple s(0); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (*f)(A1, A2, A3)) { - return function_signature( - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (*f)(A1, A2, A3)) { + tuple s(0); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (*f)(A1, A2, A3, A4)) { - return function_signature( - python::type(), - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (*f)(A1, A2, A3, A4)) { + tuple s(0); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (*f)(A1, A2, A3, A4, A5)) { - return function_signature( - python::type(), - python::type(), - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (*f)(A1, A2, A3, A4, A5)) { + tuple s(0); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } template -inline PyObject* function_signature(R (*f)(A1, A2, A3, A4, A5, A6)) { - return function_signature( - python::type(), - python::type(), - python::type(), - python::type(), - python::type(), - python::type()); +PyObject* function_signature(R (*f)(A1, A2, A3, A4, A5, A6)) { + tuple s(0); + PyObject * result = s.reference().release(); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + result = function_signature_append(result, get_python_type_name(type())); + + return result; } } // namespace detail diff --git a/extclass.h b/extclass.h index bb59eb39..bb311add 100644 --- a/extclass.h +++ b/extclass.h @@ -134,27 +134,25 @@ class class_registry }; template -no_t* is_plain_aux(type >); +inline is_not_plain_t* is_plain_aux(type >) { return 0; } template -string forward_python_type_name(python::type >) +inline is_not_plain_t* is_plain_aux(type >) { return 0; } + +template +inline string get_python_type_name(python::type >, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } template -no_t* is_plain_aux(type >); - -template -string forward_python_type_name(python::type >) +inline string get_python_type_name(python::type >, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } template -string python_type_name(type) +string get_python_type_name(type, is_plain_t*) { if(class_registry::class_object() == 0) { diff --git a/gen_caller.py b/gen_caller.py index 7aaac5cf..d83dd743 100644 --- a/gen_caller.py +++ b/gen_caller.py @@ -60,8 +60,7 @@ struct caller namespace detail { -// create signature tuples -inline''', +''', ''' // member functions ''', @@ -106,9 +105,8 @@ free_function = '''%{ template <%(class A%n%:, %)> function_signature = '''%{template <%}%(class A%n%:, %)%{>%} PyObject* function_signature(%(type%:, %)) { -%( static const bool is_plain_A%n = BOOST_PYTHON_IS_PLAIN(A%n); -%) tuple result(%x); -%( result.set_item(%N, python_type_name_selector::get(type())); + tuple result(%x); +%( result.set_item(%N, get_python_type_name(type())); %) return result.reference().release(); } @@ -116,18 +114,24 @@ PyObject* function_signature(%(type%:, %)) { ''' member_function_signature = '''template -inline PyObject* function_signature(R (T::*pmf)(%(A%n%:, %))%1) { - return function_signature( - python::type()%(, - python::type()%)); +PyObject* function_signature(R (T::*pmf)(%(A%n%:, %))%1) { + tuple s(1); + s.set_item(0, get_python_type_name(type())); + PyObject * result = s.reference().release(); +%( result = function_signature_append(result, get_python_type_name(type())); +%) + return result; } ''' free_function_signature = '''template -inline PyObject* function_signature(R (*f)(%(A%n%:, %))) { - return function_signature(%( - python::type()%:,%)); +PyObject* function_signature(R (*f)(%(A%n%:, %))) { + tuple s(0); + PyObject * result = s.reference().release(); +%( result = function_signature_append(result, get_python_type_name(type())); +%) + return result; } ''' @@ -165,7 +169,7 @@ def gen_caller(member_function_args, free_function_args = None): + body_sections[6] # create lists describing the function signatures - + gen_functions(function_signature, free_function_args) +# + gen_functions(function_signature, free_function_args) + body_sections[7] + gen_functions(member_function_signature, member_function_args, '') + body_sections[8] diff --git a/gen_extclass.py b/gen_extclass.py index 380d7d91..e83c1341 100644 --- a/gen_extclass.py +++ b/gen_extclass.py @@ -139,27 +139,25 @@ class class_registry }; template -no_t* is_plain_aux(type >); +inline is_not_plain_t* is_plain_aux(type >) { return 0; } template -string forward_python_type_name(python::type >) +inline is_not_plain_t* is_plain_aux(type >) { return 0; } + +template +inline string get_python_type_name(python::type >, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } template -no_t* is_plain_aux(type >); - -template -string forward_python_type_name(python::type >) +inline string get_python_type_name(python::type >, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } template -string python_type_name(type) +string get_python_type_name(type, is_plain_t*) { if(class_registry::class_object() == 0) { diff --git a/gen_init_function.py b/gen_init_function.py index ab6e3422..fbd9c532 100644 --- a/gen_init_function.py +++ b/gen_init_function.py @@ -150,14 +150,13 @@ struct init%x : init PyObject* description() const { - return function_signature(python::type()%(, - python::type()%)); + return function_signature(get_python_type_name(python::type())%(, + get_python_type_name(python::type())%)); } string function_name() const { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - string result(python_type_name_selector::get(python::type())); + string result(get_python_type_name(python::type())); result += ".__init__"; return result; } diff --git a/init_function.h b/init_function.h index dfc2fea0..93e9e630 100644 --- a/init_function.h +++ b/init_function.h @@ -183,13 +183,12 @@ struct init0 : init PyObject* description() const { - return function_signature(python::type()); + return function_signature(get_python_type_name(python::type())); } string function_name() const { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - string result(python_type_name_selector::get(python::type())); + string result(get_python_type_name(python::type())); result += ".__init__"; return result; } @@ -210,14 +209,13 @@ struct init1 : init PyObject* description() const { - return function_signature(python::type(), - python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type())); } string function_name() const { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - string result(python_type_name_selector::get(python::type())); + string result(get_python_type_name(python::type())); result += ".__init__"; return result; } @@ -240,15 +238,14 @@ struct init2 : init PyObject* description() const { - return function_signature(python::type(), - python::type(), - python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type()), + get_python_type_name(python::type())); } string function_name() const { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - string result(python_type_name_selector::get(python::type())); + string result(get_python_type_name(python::type())); result += ".__init__"; return result; } @@ -273,16 +270,15 @@ struct init3 : init PyObject* description() const { - return function_signature(python::type(), - python::type(), - python::type(), - python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type()), + get_python_type_name(python::type()), + get_python_type_name(python::type())); } string function_name() const { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - string result(python_type_name_selector::get(python::type())); + string result(get_python_type_name(python::type())); result += ".__init__"; return result; } @@ -309,17 +305,16 @@ struct init4 : init PyObject* description() const { - return function_signature(python::type(), - python::type(), - python::type(), - python::type(), - python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type()), + get_python_type_name(python::type()), + get_python_type_name(python::type()), + get_python_type_name(python::type())); } string function_name() const { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - string result(python_type_name_selector::get(python::type())); + string result(get_python_type_name(python::type())); result += ".__init__"; return result; } @@ -348,18 +343,17 @@ struct init5 : init PyObject* description() const { - return function_signature(python::type(), - python::type(), - python::type(), - python::type(), - python::type(), - python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type()), + get_python_type_name(python::type()), + get_python_type_name(python::type()), + get_python_type_name(python::type()), + get_python_type_name(python::type())); } string function_name() const { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - string result(python_type_name_selector::get(python::type())); + string result(get_python_type_name(python::type())); result += ".__init__"; return result; } diff --git a/objects.cpp b/objects.cpp index bf4dc46e..4258fe32 100644 --- a/objects.cpp +++ b/objects.cpp @@ -482,4 +482,67 @@ list::slice_proxy::slice_proxy(const ref& list, int low, int high) { } +namespace detail +{ + +PyObject* function_signature_append(PyObject * sig, string type_name) +{ + ref rsig(sig); + tuple old_signature(rsig); + tuple new_signature(old_signature.size()+1); + + int i; + for(i=0; i) \ + inline string get_python_type_name(python::type, is_plain_t *) \ + { return string(#name); } \ + inline string get_python_type_name(python::type, is_not_plain_t *) \ { return string(#name); } #if 0 @@ -343,100 +348,90 @@ namespace detail BOOST_PYTHON_OVERLOAD_TYPENAME_FUNCTION(dictionary, dictionary); BOOST_PYTHON_OVERLOAD_TYPENAME_FUNCTION(string, string); - typedef char no_t[1]; - typedef char yes_t[2]; - - yes_t* is_plain_aux(...); + inline is_plain_t* is_plain_aux(...) { return 0; } template - no_t* is_plain_aux(type); + inline is_not_plain_t* is_plain_aux(type) { return 0; } template - no_t* is_plain_aux(type); + inline is_not_plain_t* is_plain_aux(type) { return 0; } template - no_t* is_plain_aux(type); + inline is_not_plain_t* is_plain_aux(type) { return 0; } template - no_t* is_plain_aux(type); + inline is_not_plain_t* is_plain_aux(type) { return 0; } template - no_t* is_plain_aux(type >); + inline is_not_plain_t* is_plain_aux(type >) { return 0; } template - no_t* is_plain_aux(type >); + inline is_not_plain_t* is_plain_aux(type >) { return 0; } template - no_t* is_plain_aux(type >); + inline is_not_plain_t* is_plain_aux(type >) { return 0; } -#define BOOST_PYTHON_IS_PLAIN(T) \ - (sizeof(*python::detail::is_plain_aux(python::type())) == \ - sizeof(python::detail::yes_t)) - - template - struct python_type_name_selector + template + inline string get_python_type_name(type t) { - template - static string get(python::type t) - { return python_type_name(t); } - }; + return get_python_type_name(t, is_plain_aux(t)); + } template - string forward_python_type_name(python::type) + inline string get_python_type_name(python::type, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } template - string forward_python_type_name(python::type) + inline string get_python_type_name(python::type, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } template - string forward_python_type_name(python::type) + inline string get_python_type_name(python::type, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } template - string forward_python_type_name(python::type) + inline string get_python_type_name(python::type, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } template - string forward_python_type_name(python::type >) + inline string get_python_type_name(python::type >, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } template - string forward_python_type_name(python::type >) + inline string get_python_type_name(python::type >, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } template - string forward_python_type_name(python::type >) + inline string get_python_type_name(python::type >, is_not_plain_t*) { - static const bool is_plain = BOOST_PYTHON_IS_PLAIN(T); - return python_type_name_selector::get(python::type()); + return get_python_type_name(python::type()); } - template <> - struct python_type_name_selector - { - template - static string get(python::type t) - { return forward_python_type_name(t); } - }; + PyObject* function_signature_append(PyObject * sig, string type_name); + + PyObject* function_signature(string arg0, + string arg1 = string(""), + string arg2 = string(""), + string arg3 = string(""), + string arg4 = string(""), + string arg5 = string(""), + string arg6 = string(""), + string arg7 = string(""), + string arg8 = string(""), + string arg9 = string("")); + } // namespace detail } // namespace python diff --git a/operators.h b/operators.h index 1c07f346..abd8b683 100644 --- a/operators.h +++ b/operators.h @@ -225,7 +225,8 @@ namespace detail \ PyObject* description() const \ { \ - return function_signature(python::type(), python::type()); \ + return function_signature(get_python_type_name(python::type()), \ + get_python_type_name(python::type())); \ } \ }; \ \ @@ -246,7 +247,8 @@ namespace detail \ PyObject* description() const \ { \ - return function_signature(python::type(), python::type()); \ + return function_signature(get_python_type_name(python::type()), \ + get_python_type_name(python::type())); \ } \ \ }; \ @@ -271,11 +273,11 @@ namespace detail } \ \ string function_name() const \ - { return string(name()); } \ + { return string(name()); } \ \ PyObject* description() const \ { \ - return function_signature(python::type()); \ + return function_signature(get_python_type_name(python::type())); \ } \ }; \ \ @@ -336,7 +338,8 @@ namespace detail PyObject* description() const { - return function_signature(python::type(), python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type())); } }; @@ -364,7 +367,8 @@ namespace detail PyObject* description() const { - return function_signature(python::type(), python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type())); } }; @@ -403,7 +407,8 @@ namespace detail PyObject* description() const { - return function_signature(python::type(), python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type())); } }; @@ -433,7 +438,8 @@ namespace detail PyObject* description() const { - return function_signature(python::type(), python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type())); } }; @@ -468,7 +474,8 @@ namespace detail PyObject* description() const { - return function_signature(python::type(), python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type())); } }; @@ -495,7 +502,8 @@ namespace detail PyObject* description() const { - return function_signature(python::type(), python::type()); + return function_signature(get_python_type_name(python::type()), + get_python_type_name(python::type())); } }; @@ -536,7 +544,7 @@ namespace detail PyObject* description() const { - return function_signature(python::type()); + return function_signature(get_python_type_name(python::type())); } };