diff --git a/src/libpython/base.h b/src/libpython/base.h index 2e129947..91f4de9a 100644 --- a/src/libpython/base.h +++ b/src/libpython/base.h @@ -26,9 +26,12 @@ #pragma warning(disable : 4267) // 'return' : conversion from 'size_t' to 'long', possible loss of data #endif -#define BP_STRUCT(Name, Init) \ +#define BP_STRUCT_DECL(Name, Init) \ bp::class_ Name ##_struct(#Name, Init); \ - bp::register_ptr_to_python(); \ + bp::register_ptr_to_python(); + +#define BP_STRUCT(Name, Init) \ + BP_STRUCT_DECL(Name, Init) \ Name ##_struct #define BP_SUBSTRUCT(Name, Base, Init) \ @@ -36,9 +39,12 @@ bp::register_ptr_to_python(); \ Name ##_struct -#define BP_CLASS(Name, Base, Init) \ +#define BP_CLASS_DECL(Name, Base, Init) \ bp::class_, bp::bases, boost::noncopyable> Name ##_class(#Name, Init); \ - bp::register_ptr_to_python(); \ + bp::register_ptr_to_python(); + +#define BP_CLASS(Name, Base, Init) \ + BP_CLASS_DECL(Name, Base, Init) \ Name ##_class #define BP_WRAPPED_CLASS(Name, Wrapper, Base, Init) \ diff --git a/src/libpython/core.cpp b/src/libpython/core.cpp index cb1c5c0f..e56752be 100644 --- a/src/libpython/core.cpp +++ b/src/libpython/core.cpp @@ -663,7 +663,7 @@ void export_core() { .def("getReceivedBytes", &SocketStream::getReceivedBytes) .def("getSentBytes", &SocketStream::getSentBytes); - BP_CLASS(ConsoleStream, Stream, bp::init<>()); + BP_CLASS_DECL(ConsoleStream, Stream, bp::init<>()); BP_CLASS(SSHStream, Stream, (bp::init())) .def(bp::init()) @@ -1389,14 +1389,14 @@ void export_core() { .def("serialize", &BSphere::serialize) .def("__repr__", &BSphere::toString); - BP_STRUCT(AABB1, bp::init<>()); + BP_STRUCT_DECL(AABB1, bp::init<>()); BP_IMPLEMENT_AABB_OPS(AABB1, Point1); - BP_STRUCT(AABB2, bp::init<>()); + BP_STRUCT_DECL(AABB2, bp::init<>()); BP_IMPLEMENT_AABB_OPS(AABB2, Point2); typedef TAABB AABB3; - BP_STRUCT(AABB3, bp::init<>()); + BP_STRUCT_DECL(AABB3, bp::init<>()); BP_IMPLEMENT_AABB_OPS(AABB3, Point3); BP_SUBSTRUCT(AABB, AABB3, bp::init<>()) @@ -1409,7 +1409,7 @@ void export_core() { .def("rayIntersect", &aabb_rayIntersect2) .def("getBSphere", &AABB::getBSphere, BP_RETURN_VALUE); - BP_STRUCT(AABB4, bp::init<>()); + BP_STRUCT_DECL(AABB4, bp::init<>()); BP_IMPLEMENT_AABB_OPS(AABB4, Point4); bp::class_("Frame", bp::init<>())