1 | //$Id$ |
---|
2 | #ifndef PYTHON_SINGULAR_WRAPPER_HEADER |
---|
3 | #define PYTHON_SINGULAR_WRAPPER_HEADER |
---|
4 | #include <Python.h> |
---|
5 | #include <boost/python.hpp> |
---|
6 | #include <sstream> |
---|
7 | #include <kernel/mod2.h> |
---|
8 | |
---|
9 | |
---|
10 | #include "structs.h" |
---|
11 | #include "numbers.h" |
---|
12 | |
---|
13 | #include "febase.h" |
---|
14 | #include "ipid.h" |
---|
15 | #include "ipshell.h" |
---|
16 | //#include "util.h" |
---|
17 | #include "Number.h" |
---|
18 | #include "Poly.h" |
---|
19 | #include "PowerSeries.h" |
---|
20 | #include "Ideal.h" |
---|
21 | #include "ideal_wrap.h" |
---|
22 | #include <factory.h> |
---|
23 | #include "poly_wrap.h" |
---|
24 | #include "vector_wrap.h" |
---|
25 | #include "CF_wrap.h" |
---|
26 | #include "number_wrap.h" |
---|
27 | #include "playground.h" |
---|
28 | #include "interpreter_support.h" |
---|
29 | #include "ring_wrap.h" |
---|
30 | #include "intvec_wrap.h" |
---|
31 | using boost::python::numeric::array; |
---|
32 | using boost::python::extract; |
---|
33 | |
---|
34 | using namespace boost::python; |
---|
35 | |
---|
36 | Vector unitVector0(int i){ |
---|
37 | return unitVector(i,currRing); |
---|
38 | } |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | //typedef void * idhdl; |
---|
47 | void different_ring_translator(DifferentDomainException const& x) { |
---|
48 | PrintS("hoho"); |
---|
49 | PyErr_SetString(PyExc_UserWarning, "Objects didn't have the same ring"); |
---|
50 | } |
---|
51 | BOOST_PYTHON_MODULE(Singular){ |
---|
52 | //Print("ref count after add: %d", currRing->ref); |
---|
53 | register_exception_translator< |
---|
54 | DifferentDomainException>(different_ring_translator); |
---|
55 | export_poly(); |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | export_number(); |
---|
60 | export_vector(); |
---|
61 | export_playground(); |
---|
62 | export_ideal(); |
---|
63 | export_module(); |
---|
64 | //export_interpreter(); |
---|
65 | export_ring(); |
---|
66 | export_intvec(); |
---|
67 | boost::python::class_<PowerSeries>("power_series") |
---|
68 | .def(boost::python::init <const PowerSeries::numerator_type &,const PowerSeries::denominator_type&>()) |
---|
69 | .def("__iter__", boost::python::iterator<PowerSeries>()); |
---|
70 | boost::python::class_<VectorPowerSeries>("vector_power_series") |
---|
71 | .def(boost::python::init <const VectorPowerSeries::numerator_type&,const VectorPowerSeries::denominator_type &>()) |
---|
72 | .def("__iter__", boost::python::iterator<VectorPowerSeries>()); |
---|
73 | def("gen",unitVector0); |
---|
74 | |
---|
75 | |
---|
76 | // .def(self+=self) |
---|
77 | |
---|
78 | // .def(self+self) |
---|
79 | //.def(self*=Number()) |
---|
80 | //.def(Number() * self); |
---|
81 | |
---|
82 | } |
---|
83 | BOOST_PYTHON_MODULE(factory){ |
---|
84 | boost::python::class_<Variable>("variable") |
---|
85 | .def(boost::python::init <const int, char>()) |
---|
86 | .def(boost::python::init <char>()) |
---|
87 | |
---|
88 | .def(boost::python::init <const int>()); |
---|
89 | export_CF(); |
---|
90 | } |
---|
91 | BOOST_PYTHON_MODULE(_Singular){ |
---|
92 | export_interpreter(); |
---|
93 | |
---|
94 | } |
---|
95 | #endif |
---|