mirror of
https://github.com/boostorg/python.git
synced 2026-01-19 16:32:16 +00:00
* Made Cygwin archiving reliable, even when the user supplies a path with backslashes ---------------------------------------------------------------------- Modified Files: tools/build/gcc-tools.jam tools/build/new/boost-build.jam boost/python/detail/config.hpp libs/python/build/Jamfile libs/python/example/do_it_yourself_convts.cpp libs/python/example/dvect.cpp libs/python/example/example1.cpp libs/python/example/getting_started1.cpp libs/python/example/getting_started2.cpp libs/python/example/ivect.cpp libs/python/example/nested.cpp libs/python/example/noncopyable_export.cpp libs/python/example/noncopyable_import.cpp libs/python/example/pickle1.cpp libs/python/example/pickle2.cpp libs/python/example/pickle3.cpp libs/python/example/richcmp1.cpp libs/python/example/richcmp2.cpp libs/python/example/richcmp3.cpp libs/python/example/rwgk1.cpp libs/python/example/simple_vector.cpp libs/python/test/comprehensive.cpp Added Files: libs/python/example/rwgk2.cpp libs/python/example/rwgk3.cpp ---------------------------------------------------------------------- [SVN r11705]
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
// Example by Ralf W. Grosse-Kunstleve
|
|
// See root/libs/python/doc/cross_module.html for an introduction.
|
|
|
|
#include "dvect.h"
|
|
#include "ivect.h"
|
|
#include <boost/python/cross_module.hpp>
|
|
namespace python = boost::python;
|
|
|
|
namespace {
|
|
|
|
# include "dvect_conversions.cpp"
|
|
# include "ivect_conversions.cpp"
|
|
|
|
vects::ivect dvect_as_ivect(const vects::dvect& dv)
|
|
{
|
|
vects::ivect iv(dv.size());
|
|
vects::ivect::iterator iviter = iv.begin();
|
|
for (int i = 0; i < dv.size(); i++) iviter[i] = static_cast<int>(dv[i]);
|
|
return iv;
|
|
}
|
|
}
|
|
|
|
# ifdef BOOST_MSVC // fixes for JIT debugging
|
|
# include <windows.h>
|
|
extern "C" void structured_exception_translator(unsigned int, EXCEPTION_POINTERS*)
|
|
{
|
|
throw;
|
|
}
|
|
extern "C" void (*old_translator)(unsigned int, EXCEPTION_POINTERS*)
|
|
= _set_se_translator(structured_exception_translator);
|
|
# endif
|
|
|
|
BOOST_PYTHON_MODULE_INIT(dvect)
|
|
{
|
|
python::module_builder this_module("dvect");
|
|
|
|
python::class_builder<vects::dvect> dvect_class(this_module, "dvect");
|
|
python::export_converters(dvect_class);
|
|
|
|
python::import_converters<vects::ivect> ivect_converters("ivect", "ivect");
|
|
|
|
dvect_class.def(python::constructor<python::tuple>());
|
|
dvect_class.def(&vects::dvect::as_tuple, "as_tuple");
|
|
dvect_class.def(dvect_as_ivect, "as_ivect");
|
|
|
|
# include "dvect_defs.cpp"
|
|
# include "ivect_defs.cpp"
|
|
}
|