Changeset 5139d6 in git for modules/python
- Timestamp:
- Sep 23, 2005, 2:59:51 PM (19 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
- Children:
- f12ddcdde3136bd52030cdeef8ef6bf42ffd45f0
- Parents:
- ed394ae06b197dc56ef19044305263fc7d2b194f
- Location:
- modules/python
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/python/interpreter_support.cc
red394a r5139d6 1 //$Id: interpreter_support.cc,v 1.1 5 2005-09-20 08:39:44bricken Exp $1 //$Id: interpreter_support.cc,v 1.16 2005-09-23 12:59:30 bricken Exp $ 2 2 #include <poly_wrap.h> 3 3 #include <sstream> … … 157 157 internal_append(v); 158 158 } 159 void appendIntvec( better_intvec& iv){159 void appendIntvec(Intvec& iv){ 160 160 leftv v=initArg(); 161 161 v->data=iv.allocate_legacy_intvec_copy(); … … 258 258 } 259 259 } 260 void writeIntvec(const better_intvec& iv){260 void writeIntvec(const Intvec& iv){ 261 261 if(id->typ=INTVEC_CMD){ 262 262 delete id->data.iv; … … 342 342 return object(Ring((ring) v->data)); 343 343 case INTVEC_CMD: 344 return object( better_intvec(*(intvec*) v->data));344 return object(Intvec(*(intvec*) v->data)); 345 345 default: 346 346 … … 379 379 return object(Ring((ring) id.id->data.uring)); 380 380 case INTVEC_CMD: 381 return object( better_intvec(*(intvec*) id.id->data.iv));381 return object(Intvec(*(intvec*) id.id->data.iv)); 382 382 default: 383 383 return object(); -
modules/python/intvec_wrap.cc
red394a r5139d6 1 //$Id: intvec_wrap.cc,v 1. 2 2005-09-20 08:39:44bricken Exp $1 //$Id: intvec_wrap.cc,v 1.3 2005-09-23 12:59:30 bricken Exp $ 2 2 #include <boost/python.hpp> 3 3 #include <boost/python/suite/indexing/vector_indexing_suite.hpp> … … 7 7 8 8 using namespace boost::python; 9 static boost::python::object intvec_as_str(const better_intvec& p)9 static boost::python::object intvec_as_str(const Intvec& p) 10 10 { 11 11 using boost::python::str; … … 28 28 29 29 void export_intvec(){ 30 boost::python::class_< better_intvec>("intvec")30 boost::python::class_<Intvec>("intvec") 31 31 .def("__str__", intvec_as_str) 32 32 .def(boost::python::init <>()) 33 .def(boost::python::vector_indexing_suite< better_intvec>());33 .def(boost::python::vector_indexing_suite<Intvec>()); 34 34 } -
modules/python/intvec_wrap.h
red394a r5139d6 1 //$Id: intvec_wrap.h,v 1. 3 2005-09-21 14:11:20 bricken Exp $1 //$Id: intvec_wrap.h,v 1.4 2005-09-23 12:59:30 bricken Exp $ 2 2 #ifndef INTVEC_WRAP_HEADER 3 3 #define INTVEC_WRAP_HEADER … … 5 5 #include "mod2.h" 6 6 #include "intvec.h" 7 #include "IIntvec.h" 7 8 void export_intvec(); 8 class better_intvec: public std::vector<int>{ 9 public: 10 better_intvec(iterator first, 11 iterator last, 12 const allocator_type& __a = allocator_type()): 13 std::vector<int>(first,last,__a){ 14 } 15 better_intvec(int n=0):std::vector<int>(n){} 16 better_intvec(intvec& iv):std::vector<int>(iv.length()){ 17 int n=iv.length(); 18 for(int i=0;i<n;i++){ 19 (*this)[i]=iv[i]; 20 } 21 } 22 intvec* allocate_legacy_intvec_copy() const{ 23 int s=size(); 24 intvec* iv=new intvec(s); 25 26 for(int i=0;i<s;i++){ 27 (*iv)[i]=(*this)[i]; 28 } 29 return iv; 30 } 31 }; 9 32 10 33 11 #endif -
modules/python/poly_wrap.cc
red394a r5139d6 25 25 // .def(boost::python::init <std::vector<int> >()) 26 26 .def(boost::python::init <Number>()) 27 .def(boost::python::init < better_intvec> ())27 .def(boost::python::init <Intvec> ()) 28 28 .def("__str__", Poly_as_str) 29 29 .def("__iter__", boost::python::iterator<Poly>()) … … 31 31 .def(boost::python::init <const char* >()) 32 32 33 .def("leadCoef",&Poly::leadCoef) 34 .def("leadExp", &Poly::leadExp) 33 35 .def(-self) 34 36 .def(self*=self)
Note: See TracChangeset
for help on using the changeset viewer.