2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 16:32:16 +00:00

Compare commits

..

14 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
0d6b042c4c Windows2000 mods.
[SVN r10727]
2001-07-31 07:01:27 +00:00
Ralf W. Grosse-Kunstleve
55a7884912 Small doc update.
[SVN r10726]
2001-07-31 06:27:06 +00:00
Ralf W. Grosse-Kunstleve
2566e1dd3a Trivial fixes for Python 2.2a1. (One real problem remains...)
[SVN r10664]
2001-07-19 00:23:06 +00:00
Ralf W. Grosse-Kunstleve
9bca6982a4 doctest tests test_richcmp?.py, make test updated.
[SVN r10662]
2001-07-18 21:33:47 +00:00
Ralf W. Grosse-Kunstleve
c7e12ecf3d richcmp3.cpp significantly simplified.
[SVN r10660]
2001-07-18 15:24:41 +00:00
Ralf W. Grosse-Kunstleve
5031479fa2 test_richcmp1.py now works with vc60.
[SVN r10657]
2001-07-18 13:16:51 +00:00
Ralf W. Grosse-Kunstleve
fc9a6ac369 New: richcmp.html, richcmp1.cpp, richcmp2.cpp, richcmp3.cpp.
Still needs more testing. richcmp1.cpp does not compile under windows.


[SVN r10656]
2001-07-18 03:14:48 +00:00
Ralf W. Grosse-Kunstleve
905074542e VC60 workaround, to suppress bogus warning.
[SVN r10629]
2001-07-16 00:10:27 +00:00
Ralf W. Grosse-Kunstleve
b7957da50a gen_*.py updated
[SVN r10625]
2001-07-15 10:48:51 +00:00
Ralf W. Grosse-Kunstleve
1b1620b62a Tested with Python 1.5.2 and Python 2.1.1c1
[SVN r10624]
2001-07-15 10:36:49 +00:00
Ralf W. Grosse-Kunstleve
0ed5af25a7 Tested: all compilers & python 1.5.2, all unix & python 2.1
[SVN r10623]
2001-07-15 09:41:09 +00:00
nobody
1dbcf12502 This commit was manufactured by cvs2svn to create branch
'boost_python_richcmp'.

[SVN r10595]
2001-07-12 15:31:16 +00:00
nobody
10c2fbd63a This commit was manufactured by cvs2svn to create branch
'iter-adaptor-and-categories'.

[SVN r10453]
2001-06-27 22:12:20 +00:00
Dave Abrahams
9b602d16b4 initial import
[SVN r8327]
2000-11-26 15:49:26 +00:00
17 changed files with 46 additions and 315 deletions

View File

@@ -1,245 +0,0 @@
# (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears
# in all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
#
# Boost.Python build and test Jamfile
#
# Declares the following targets:
# 1. libboost_python, a static link library to be linked with all
# Boost.Python modules
#
# 2. pairs of test targets of the form <name>.test and <name>.run
# <name>.test runs the test when it is out-of-date, and the "all" target
# depends on it so that it it is built by default. <name>.run runs
# a test unconditionally, and can be used to force a test to run.. Each
# test target builds one or more Boost.Python modules and runs a Python
# script to test them. The test names are:
#
# from ../test
#
# comprehensive - a comprehensive test of Boost.Python features
#
# from ../example:
# abstract -
# getting_started1 -
# getting_started2 -
# simple_vector -
# do_it_yourself_convts -
# pickle1 -
# pickle2 -
# pickle3 -
#
# dvect1 -
# dvect2 -
# ivect1 -
# ivect2 -
# noncopyable -
#
# subproject-specific environment/command-line variables:
#
# PYTHON_TEST_ARGS - specifies arguments to be passed to test scripts on
# the command line. "-v" can be useful if you want to
# see the output of successful tests.
#
# PYTHON_VECT_ITERATIONS - specifies the number of test iterations to use for
# the dvect and ivect tests above.
# declare the location of this subproject relative to the root
subproject libs/python/build ;
# Do some OS-specific setup
if $(NT)
{
PYTHON_ROOT ?= c:/tools/python ;
PYTHON_INCLUDES ?= <include>$(PYTHON_ROOT)/include <gcc><*><include>/usr/include/python2.1 ;
PYTHON_LIBS ?= c:/cygnus/lib/python2.1/config/libpython2.1.dll.a ;
PYTHON_LIB_PATH = $(PYTHON_ROOT)/libs ;
# common properties required for compiling any Python module.
PYTHON_PROPERTIES ?=
<gcc><*><define>SIZEOF_LONG=4
<gcc><*><define>USE_DL_IMPORT
<runtime-link>dynamic
;
SHELL_SET ?= "set " ;
SHELL_EXPORT ?= ; # shell variables are exported by default
}
else if $(UNIX)
{
PYTHON_INCLUDES ?= <include>/usr/include/python1.5 ;
PYTHON_LIBS ?= /usr/lib/python1.5/config/libpython1.5.a ;
SHELL_SET ?= "" ;
SHELL_EXPORT ?= "export " ;
}
#######################
#
# Declare the boost python static link library
#
# standard include requirements for anything using Boost.Python
BOOST_PYTHON_INCLUDES = <include>$(BOOST_ROOT) $(PYTHON_INCLUDES) ;
# Base names of the source files for libboost_python
CPP_SOURCES =
classes conversions extension_class functions
init_function module_builder objects types cross_module ;
lib libboost_python : ../src/$(CPP_SOURCES).cpp
# requirements
: $(BOOST_PYTHON_INCLUDES)
<shared-linkable>true
$(PYTHON_PROPERTIES) ;
#######################
# boost-python name : sources : requirements : default-BUILD
#
# Declare a boost python module. Return a list of the DLL files generated.
rule boost-python
{
# declare a DLL; add the boost python library to sources
dll $(<) : <lib>libboost_python $(>)
# Requirements
: $(3) # caller-specified requirements
# standard requirements
$(BOOST_PYTHON_INCLUDES)
<msvc><*><library-path>$(PYTHON_LIB_PATH)
<gcc><*><library-file>$(PYTHON_LIBS)
$(PYTHON_PROPERTIES)
: $(4) ; # pass on the default-BUILD, if any
}
#######################
# boost-python-test target : python-script sources : requirements : local-build : args
#
# declare two python module tests: $(<).test which builds when out-of-date, and
# $(<).run which builds unconditionally.
rule boost-python-test
{
# tell Jam that the python script is relative to this directory
SEARCH on $(>[1]) = $(SEARCH_SOURCE) ;
# required command-line args can be specified in argument 5
# The user can add additional arguments in PYTHON_TEST_ARGS.
local gPYTHON_TEST_ARGS = $(5) $(PYTHON_TEST_ARGS) ;
# declare the two subsidiary tests.
declare-local-target $(<:S=.test) : $(>) : $(PYTHON_PROPERTIES) : $(4) : PYTHON_TEST ;
declare-local-target $(<:S=.run) : $(>) : $(PYTHON_PROPERTIES) : $(4) : PYTHON_RUNTEST ;
}
# how do we invoke python?
PYTHON ?= python ;
# special rules for two new target types: PYTHON_TEST and PYTHON_RUNTEST.
# These are identical except that PYTHON_TEST runs the test when out-of-date, and
# PYTHON_RUNTEST runs the test unconditionally. These are used by boost-python-test.
SUFPYTHON_TEST = .test ;
gGENERATOR_FUNCTION(PYTHON_TEST) = python-test-target ;
rule python-test-target # test-target : sources :
{
python-test-aux $(<) : $(>) ;
Clean clean : $(<) ; # remove the test-target as part of any clean operation
type-DEPENDS test : $(<) ;
MakeLocate $(<) : $(LOCATE_TARGET) ;
}
actions python-test-target
{
$(SHELL_SET)PYTHONPATH=$(PYTHONPATH)
$(SHELL_EXPORT)PYTHONPATH
$(PYTHON) "$(>)" $(ARGS) > "$(<)"
}
SUFPYTHON_RUNTEST = .run ;
gGENERATOR_FUNCTION(PYTHON_RUNTEST) = python-runtest-target ;
rule python-runtest-target # test-target : sources :
{
python-test-aux $(<) : $(>) ;
NOTFILE $(<) ;
ALWAYS $(<) ;
}
actions python-runtest-target
{
$(SHELL_SET)PYTHONPATH=$(PYTHONPATH)
$(SHELL_EXPORT)PYTHONPATH
$(PYTHON) "$(>)" $(ARGS)
}
rule python-test-aux # target : sources
{
DEPENDS $(<) : $(>) ;
ARGS on $(<) += $(gPYTHON_TEST_ARGS) ;
# Some tests need an extra command-line arg if built with
# msvc. Checking the target grist is a cheap way to
# find out.
switch $(<)
{
case <*\\\\msvc\\\\*>* : ARGS on $(<) += --broken-auto-ptr ;
}
# compute the PYTHONPATH environment variable that will allow the test to
# find all of the modules on which it depends.
PYTHONPATH on $(<) = [ join
$(gLOCATE($(>[1]))) # location of python test file
$(gRUN_PATH($(<))) # location of module dependencies
[ join-path $(TOP) libs python test ] # location of doctest
$(PYTHONPATH) # base PYTHONPATH from environment
: $(SPLITPATH) ] ; # platform path separator
}
############# comprehensive module and test ###########
boost-python boost_python_test : ../test/comprehensive.cpp ;
boost-python-test comprehensive : [ join-path $(DOTDOT) test comprehensive.py ] <lib>boost_python_test ;
############# simple tests from ../example ############
rule boost-python-example-test
{
boost-python $(<) : ../example/$(<).cpp ;
boost-python-test $(<) : [ join-path $(DOTDOT) example test_$(<).py ] <lib>$(<) ;
}
boost-python-example-test abstract ;
boost-python-example-test getting_started1 ;
boost-python-example-test getting_started2 ;
boost-python-example-test simple_vector ;
boost-python-example-test do_it_yourself_convts ;
boost-python-example-test pickle1 ;
boost-python-example-test pickle2 ;
boost-python-example-test pickle3 ;
boost-python ivect : ../example/ivect.cpp ;
boost-python dvect : ../example/dvect.cpp ;
boost-python noncopyable_export : ../example/noncopyable_export.cpp ;
boost-python noncopyable_import : ../example/noncopyable_import.cpp ;
############## cross-module tests from ../example ##########
# A simple rule to build a test which depends on multiple modules in the PYTHONPATH
rule boost-python-multi-example-test # test-name : python-file libs
{
boost-python-test $(<) : ../example/tst_$(<).py <lib>$(>) : : : $(PYTHON_VECT_ITERATIONS) ;
}
PYTHON_VECT_ITERATIONS ?= 10 ;
boost-python-multi-example-test dvect1 : ivect dvect ;
boost-python-multi-example-test dvect2 : ivect dvect ;
boost-python-multi-example-test ivect1 : ivect dvect ;
boost-python-multi-example-test ivect2 : ivect dvect ;
boost-python-multi-example-test noncopyable : noncopyable_import noncopyable_export ;

View File

@@ -23,7 +23,7 @@ bpl_exa + "/abstract.cpp",
bpl_exa + "/getting_started1.cpp",
bpl_exa + "/getting_started2.cpp",
bpl_exa + "/simple_vector.cpp",
bpl_exa + "/do_it_yourself_convts.cpp",
bpl_exa + "/do_it_yourself_converters.cpp",
bpl_exa + "/pickle1.cpp",
bpl_exa + "/pickle2.cpp",
bpl_exa + "/pickle3.cpp",
@@ -31,7 +31,7 @@ bpl_exa + "/test_abstract.py",
bpl_exa + "/test_getting_started1.py",
bpl_exa + "/test_getting_started2.py",
bpl_exa + "/test_simple_vector.py",
bpl_exa + "/test_do_it_yourself_convts.py",
bpl_exa + "/test_do_it_yourself_converters.py",
bpl_exa + "/test_pickle1.py",
bpl_exa + "/test_pickle2.py",
bpl_exa + "/test_pickle3.py",
@@ -67,7 +67,7 @@ defs = (
"getting_started1",
"getting_started2",
"simple_vector",
"do_it_yourself_convts",
"do_it_yourself_converters",
"pickle1",
"pickle2",
"pickle3",

View File

@@ -43,7 +43,7 @@ DEPOBJ=$(OBJ) \
abstract.o \
getting_started1.o getting_started2.o \
simple_vector.o \
do_it_yourself_convts.o \
do_it_yourself_converters.o \
pickle1.o pickle2.o pickle3.o \
noncopyable_export.o noncopyable_import.o \
ivect.o dvect.o \
@@ -56,7 +56,7 @@ all: libboost_python.a \
abstract.so \
getting_started1.so getting_started2.so \
simple_vector.so \
do_it_yourself_convts.so \
do_it_yourself_converters.so \
pickle1.so pickle2.so pickle3.so \
noncopyable_export.so noncopyable_import.so \
ivect.so dvect.so \
@@ -81,8 +81,8 @@ getting_started2.so: $(OBJ) getting_started2.o
simple_vector.so: $(OBJ) simple_vector.o
$(LD) $(LDOPTS) $(OBJ) simple_vector.o -o simple_vector.so
do_it_yourself_convts.so: $(OBJ) do_it_yourself_convts.o
$(LD) $(LDOPTS) $(OBJ) do_it_yourself_convts.o -o do_it_yourself_convts.so
do_it_yourself_converters.so: $(OBJ) do_it_yourself_converters.o
$(LD) $(LDOPTS) $(OBJ) do_it_yourself_converters.o -o do_it_yourself_converters.so
pickle1.so: $(OBJ) pickle1.o
$(LD) $(LDOPTS) $(OBJ) pickle1.o -o pickle1.so
@@ -125,7 +125,7 @@ test:
$(PYEXE) test_getting_started1.py
$(PYEXE) test_getting_started2.py
$(PYEXE) test_simple_vector.py
$(PYEXE) test_do_it_yourself_convts.py
$(PYEXE) test_do_it_yourself_converters.py
$(PYEXE) test_pickle1.py
$(PYEXE) test_pickle2.py
$(PYEXE) test_pickle3.py
@@ -141,7 +141,7 @@ clean:
rm -f getting_started1.o getting_started1.so
rm -f getting_started2.o getting_started2.so
rm -f simple_vector.o simple_vector.so
rm -f do_it_yourself_convts.o do_it_yourself_convts.so
rm -f do_it_yourself_converters.o do_it_yourself_converters.so
rm -f pickle1.o pickle1.so
rm -f pickle2.o pickle2.so
rm -f pickle3.o pickle3.so

View File

@@ -44,7 +44,7 @@ DEPOBJ=$(OBJ) \
abstract.o \
getting_started1.o getting_started2.o \
simple_vector.o \
do_it_yourself_convts.o \
do_it_yourself_converters.o \
pickle1.o pickle2.o pickle3.o \
noncopyable_export.o noncopyable_import.o \
ivect.o dvect.o \
@@ -57,7 +57,7 @@ all: libboost_python.a \
abstract.so \
getting_started1.so getting_started2.so \
simple_vector.so \
do_it_yourself_convts.so \
do_it_yourself_converters.so \
pickle1.so pickle2.so pickle3.so \
noncopyable_export.so noncopyable_import.so \
ivect.so dvect.so \
@@ -82,8 +82,8 @@ getting_started2.so: $(OBJ) getting_started2.o
simple_vector.so: $(OBJ) simple_vector.o
$(LD) $(LDOPTS) $(OBJ) simple_vector.o -o simple_vector.so
do_it_yourself_convts.so: $(OBJ) do_it_yourself_convts.o
$(LD) $(LDOPTS) $(OBJ) do_it_yourself_convts.o -o do_it_yourself_convts.so
do_it_yourself_converters.so: $(OBJ) do_it_yourself_converters.o
$(LD) $(LDOPTS) $(OBJ) do_it_yourself_converters.o -o do_it_yourself_converters.so
pickle1.so: $(OBJ) pickle1.o
$(LD) $(LDOPTS) $(OBJ) pickle1.o -o pickle1.so
@@ -126,7 +126,7 @@ test:
$(PYEXE) test_getting_started1.py
$(PYEXE) test_getting_started2.py
$(PYEXE) test_simple_vector.py
$(PYEXE) test_do_it_yourself_convts.py
$(PYEXE) test_do_it_yourself_converters.py
$(PYEXE) test_pickle1.py
$(PYEXE) test_pickle2.py
$(PYEXE) test_pickle3.py
@@ -142,7 +142,7 @@ clean:
rm -f getting_started1.o getting_started1.so
rm -f getting_started2.o getting_started2.so
rm -f simple_vector.o simple_vector.so
rm -f do_it_yourself_convts.o do_it_yourself_convts.so
rm -f do_it_yourself_converters.o do_it_yourself_converters.so
rm -f pickle1.o pickle1.so
rm -f pickle2.o pickle2.so
rm -f pickle3.o pickle3.so

View File

@@ -59,7 +59,7 @@ all: libboost_python.a \
abstract.pyd \
getting_started1.pyd getting_started2.pyd \
simple_vector.pyd \
do_it_yourself_convts.pyd \
do_it_yourself_converters.pyd \
pickle1.pyd pickle2.pyd pickle3.pyd \
noncopyable_export.pyd noncopyable_import.pyd \
ivect.pyd dvect.pyd \
@@ -102,11 +102,11 @@ simple_vector.pyd: $(OBJ) simple_vector.o
--def simple_vector.def \
$(OBJ) simple_vector.o $(PYLIB)
do_it_yourself_convts.pyd: $(OBJ) do_it_yourself_convts.o
do_it_yourself_converters.pyd: $(OBJ) do_it_yourself_converters.o
dllwrap $(DLLWRAPOPTS) \
--dllname do_it_yourself_convts.pyd \
--def do_it_yourself_convts.def \
$(OBJ) do_it_yourself_convts.o $(PYLIB)
--dllname do_it_yourself_converters.pyd \
--def do_it_yourself_converters.def \
$(OBJ) do_it_yourself_converters.o $(PYLIB)
pickle1.pyd: $(OBJ) pickle1.o
dllwrap $(DLLWRAPOPTS) \
@@ -177,7 +177,7 @@ test:
$(PYEXE) test_getting_started1.py
$(PYEXE) test_getting_started2.py
$(PYEXE) test_simple_vector.py
$(PYEXE) test_do_it_yourself_convts.py
$(PYEXE) test_do_it_yourself_converters.py
$(PYEXE) test_pickle1.py
$(PYEXE) test_pickle2.py
$(PYEXE) test_pickle3.py

View File

@@ -54,7 +54,7 @@ DEPOBJ=$(OBJ) \
abstract.o \
getting_started1.o getting_started2.o \
simple_vector.o \
do_it_yourself_convts.o \
do_it_yourself_converters.o \
pickle1.o pickle2.o pickle3.o \
noncopyable_export.o noncopyable_import.o \
ivect.o dvect.o \
@@ -67,7 +67,7 @@ all: libboost_python.a \
abstract.so \
getting_started1.so getting_started2.so \
simple_vector.so \
do_it_yourself_convts.so \
do_it_yourself_converters.so \
pickle1.so pickle2.so pickle3.so \
noncopyable_export.so noncopyable_import.so \
ivect.so dvect.so \
@@ -96,8 +96,8 @@ getting_started2.so: $(OBJ) getting_started2.o
simple_vector.so: $(OBJ) simple_vector.o
$(LD) $(LDOPTS) $(OBJ) simple_vector.o -o simple_vector.so
do_it_yourself_convts.so: $(OBJ) do_it_yourself_convts.o
$(LD) $(LDOPTS) $(OBJ) do_it_yourself_convts.o -o do_it_yourself_convts.so
do_it_yourself_converters.so: $(OBJ) do_it_yourself_converters.o
$(LD) $(LDOPTS) $(OBJ) do_it_yourself_converters.o -o do_it_yourself_converters.so
pickle1.so: $(OBJ) pickle1.o
$(LD) $(LDOPTS) $(OBJ) pickle1.o -o pickle1.so
@@ -140,7 +140,7 @@ test:
$(PYEXE) test_getting_started1.py
$(PYEXE) test_getting_started2.py
$(PYEXE) test_simple_vector.py
$(PYEXE) test_do_it_yourself_convts.py
$(PYEXE) test_do_it_yourself_converters.py
$(PYEXE) test_pickle1.py
$(PYEXE) test_pickle2.py
$(PYEXE) test_pickle3.py
@@ -156,7 +156,7 @@ clean:
rm -f getting_started1.o getting_started1.so
rm -f getting_started2.o getting_started2.so
rm -f simple_vector.o simple_vector.so
rm -f do_it_yourself_convts.o do_it_yourself_convts.so
rm -f do_it_yourself_converters.o do_it_yourself_converters.so
rm -f pickle1.o pickle1.so
rm -f pickle2.o pickle2.so
rm -f pickle3.o pickle3.so

View File

@@ -43,7 +43,7 @@ all: boost_python.lib \
abstract.pyd \
getting_started1.pyd getting_started2.pyd \
simple_vector.pyd \
do_it_yourself_convts.pyd \
do_it_yourself_converters.pyd \
pickle1.pyd pickle2.pyd pickle3.pyd \
noncopyable_export.pyd noncopyable_import.pyd \
ivect.pyd dvect.pyd \
@@ -67,8 +67,8 @@ getting_started2.pyd: $(OBJ) getting_started2.obj
simple_vector.pyd: $(OBJ) simple_vector.obj
$(LD) $(LDOPTS) $(OBJ) simple_vector.obj $(PYLIB) /export:initsimple_vector /out:"simple_vector.pyd"
do_it_yourself_convts.pyd: $(OBJ) do_it_yourself_convts.obj
$(LD) $(LDOPTS) $(OBJ) do_it_yourself_convts.obj $(PYLIB) /export:initdo_it_yourself_convts /out:"do_it_yourself_convts.pyd"
do_it_yourself_converters.pyd: $(OBJ) do_it_yourself_converters.obj
$(LD) $(LDOPTS) $(OBJ) do_it_yourself_converters.obj $(PYLIB) /export:initdo_it_yourself_converters /out:"do_it_yourself_converters.pyd"
pickle1.pyd: $(OBJ) pickle1.obj
$(LD) $(LDOPTS) $(OBJ) pickle1.obj $(PYLIB) /export:initpickle1 /out:"pickle1.pyd"
@@ -109,7 +109,7 @@ test:
$(PYEXE) test_getting_started1.py
$(PYEXE) test_getting_started2.py
$(PYEXE) test_simple_vector.py
$(PYEXE) test_do_it_yourself_convts.py
$(PYEXE) test_do_it_yourself_converters.py
$(PYEXE) test_pickle1.py
$(PYEXE) test_pickle2.py
$(PYEXE) test_pickle3.py

View File

@@ -35,7 +35,8 @@
"example1.html#world_class"><code>extension_class&lt;T&gt;</code></a>
template defines a whole raft of these conversions (for <code>T, T*,
T&amp;, std::auto_ptr&lt;T&gt;</code>, etc.), using the same inline
friend function technique employed by <a href="../../utility/operators.htm">the boost operators
friend function technique employed by <a href=
"file:///c:/boost/site/libs/utility/operators.htm">the boost operators
library</a>.
<p>
Because the <code>to_python</code> and <code>from_python</code> functions

View File

@@ -10,7 +10,7 @@ See also: libs/python/doc/pickle.html
Other advanced concepts are introduced by:
abstract.cpp
simple_vector.cpp
do_it_yourself_convts.cpp
do_it_yourself_converters.cpp
Examples for the cross-module support are provided by:
noncopyable_export.cpp

View File

@@ -105,12 +105,12 @@ BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE
BOOST_PYTHON_END_CONVERSION_NAMESPACE
BOOST_PYTHON_MODULE_INIT(do_it_yourself_convts)
BOOST_PYTHON_MODULE_INIT(do_it_yourself_converters)
{
try
{
// Create an object representing this extension module.
python::module_builder this_module("do_it_yourself_convts");
python::module_builder this_module("do_it_yourself_converters");
// Create the Python type object for our extension class.
python::class_builder<IndexingSet> ixset_class(this_module, "IndexingSet");

View File

@@ -9,7 +9,7 @@ namespace vects {
struct dvect : public std::vector<double>
{
dvect() : std::vector<double>() {}
dvect(std::size_t n) : std::vector<double>(n) {}
dvect(size_t n) : std::vector<double>(n) {}
dvect(boost::python::tuple tuple) : std::vector<double>(tuple.size())
{
std::vector<double>::iterator v_it = begin();

View File

@@ -9,7 +9,7 @@ namespace vects {
struct ivect : public std::vector<int>
{
ivect() : std::vector<int>() {}
ivect(std::size_t n) : std::vector<int>(n) {}
ivect(size_t n) : std::vector<int>(n) {}
ivect(boost::python::tuple tuple) : std::vector<int>(tuple.size())
{
std::vector<int>::iterator v_it = begin();

View File

@@ -1,5 +1,5 @@
r'''>>> import do_it_yourself_convts
>>> ixset = do_it_yourself_convts.IndexingSet()
r'''>>> import do_it_yourself_converters
>>> ixset = do_it_yourself_converters.IndexingSet()
>>> ixset.add((1,2,3))
>>> ixset.add((4,5,6))
>>> ixset.add((7,8,9))
@@ -15,8 +15,8 @@ def run(args = None):
if args is not None:
import sys
sys.argv = args
import doctest, test_do_it_yourself_convts
return doctest.testmod(test_do_it_yourself_convts)
import doctest, test_do_it_yourself_converters
return doctest.testmod(test_do_it_yourself_converters)
if __name__ == '__main__':
import sys

View File

@@ -7,7 +7,6 @@
// producing this work.
//
// Revision History:
// 31 Jul 01 convert int/double to complex (Peter Bienstman)
// 04 Mar 01 Fixed std::complex<> stuff to work with MSVC (David Abrahams)
// 03 Mar 01 added: converters for [plain] char and std::complex
// (Ralf W. Grosse-Kunstleve)
@@ -94,10 +93,6 @@ namespace detail {
template <class T>
std::complex<T> complex_from_python(PyObject* p, boost::python::type<T>)
{
if (PyInt_Check(p)) return std::complex<T>(PyInt_AS_LONG(p));
if (PyLong_Check(p)) return std::complex<T>(PyLong_AsDouble(p));
if (PyFloat_Check(p)) return std::complex<T>(PyFloat_AS_DOUBLE(p));
expect_complex(p);
return std::complex<T>(

View File

@@ -51,7 +51,7 @@ inline PyObject* as_object(PyTypeObject* p) { return reinterpret_cast<PyObject*>
// If I didn't have to support stupid MSVC6 we could just use a simple template function:
// template <class T> T* downcast(PyObject*).
template <class T>
struct downcast
struct downcast : boost::dereferenceable<downcast<T>, T*>
{
downcast(PyObject* p)
: m_p(detail::downcast_traits<T>::cast(detail::as_base_object((T*)0, p)))
@@ -70,11 +70,6 @@ struct downcast
{}
operator T*() const { return m_p; }
// MSVC doesn't like boost::dereferencable unless T has a default
// constructor, so operator-> must be defined by hand :(
T* operator->() const { return &**this; }
T* get() const { return m_p; }
T& operator*() const { return *m_p; }
private:

View File

@@ -20,7 +20,7 @@
BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE
template <class T, class Value, class Base = boost::detail::empty_base>
template <class T, class Value, class Base>
struct py_ptr_conversions : Base
{
inline friend T from_python(PyObject* x, boost::python::type<const T&>)
@@ -42,7 +42,8 @@ BOOST_PYTHON_IMPORT_CONVERSION(py_ptr_conversions);
template <class T>
class reference
: public py_ptr_conversions<reference<T>, T>
: public py_ptr_conversions<reference<T>, T,
boost::dereferenceable<reference<T>, T*> > // supplies op->
{
public:
typedef T value_type;
@@ -116,10 +117,6 @@ public:
T& operator*() const { return *m_p; }
// MSVC doesn't like boost::dereferencable unless T has a default
// constructor, so operator-> must be defined by hand :(
T* operator->() const { return &**this; }
T* get() const { return m_p; }
T* release()

View File

@@ -1175,18 +1175,6 @@ test methodologies for wrapping functions that return a pointer
'2.94'
>>> '%.3g' % (dreal(c))
'6.35'
>>> '%.3g' % (dreal(3))
'3'
>>> '%.3g' % (dreal(3L))
'3'
>>> '%.3g' % (dreal(3.))
'3'
>>> '%.3g' % (freal(3))
'3'
>>> '%.3g' % (freal(3L))
'3'
>>> '%.3g' % (freal(3.))
'3'
'''
#'