2
0
mirror of https://github.com/boostorg/python.git synced 2026-02-09 11:22:21 +00:00

Toons of changes to improve error handling.

Added attributes function.__name__, function.__signature__, and
the dir(function) feature


[SVN r8313]
This commit is contained in:
Ullrich Köthe
2000-11-23 23:03:24 +00:00
parent f7ad50166d
commit e3fe2d02ee
19 changed files with 1423 additions and 1721 deletions

View File

@@ -31,6 +31,7 @@ body_sections = (
# include <boost/config.hpp>
# include "signatures.h"
# include "none.h"
# include "objects.h"
namespace python {
@@ -56,9 +57,25 @@ struct caller<void>
''',
'''};
}
namespace detail
{
// create signature tuples
inline''',
'''
// member functions
''',
'''
// const member functions
''',
'''
// free functions
''',
'''} // namespace detail
#endif
} // namespace python
#endif // CALLER_DWA05090_H_
''')
#'
@@ -87,6 +104,34 @@ free_function = '''%{ template <%(class A%n%:, %)>
'''
function_signature = '''%{template <%}%(class A%n%:, %)%{>%}
PyObject* function_signature(%(type<A%n>%:, %)) {
%( static const bool is_plain_A%n = BOOST_PYTHON_IS_PLAIN(A%n);
%) tuple result(%x);
%( result.set_item(%N, python_type_name_selector<is_plain_A%n>::get(type<A%n>()));
%)
return result.reference().release();
}
'''
member_function_signature = '''template <class R, class T%(, class A%n%)>
inline PyObject* function_signature(R (T::*pmf)(%(A%n%:, %))%1) {
return function_signature(
python::type<T>()%(,
python::type<A%n>()%));
}
'''
free_function_signature = '''template <class R%(, class A%n%)>
inline PyObject* function_signature(R (*f)(%(A%n%:, %))) {
return function_signature(%(
python::type<A%n>()%:,%));
}
'''
def gen_caller(member_function_args, free_function_args = None):
if free_function_args is None:
free_function_args = member_function_args + 1
@@ -118,6 +163,16 @@ def gen_caller(member_function_args, free_function_args = None):
+ gen_functions(free_function, free_function_args,
'void', '', return_none)
+ body_sections[6]
# create lists describing the function signatures
+ gen_functions(function_signature, free_function_args)
+ body_sections[7]
+ gen_functions(member_function_signature, member_function_args, '')
+ body_sections[8]
+ gen_functions(member_function_signature, member_function_args, ' const')
+ body_sections[9]
+ gen_functions(free_function_signature, free_function_args)
+ body_sections[10]
)
if __name__ == '__main__':