My Project
UNKNOWN_GIT_VERSION
Singular
dyn_modules
python
ring_wrap.cc
Go to the documentation of this file.
1
#include "
kernel/mod2.h
"
2
#ifdef HAVE_PYTHON_MOD
3
#include <boost/python.hpp>
4
#include "
Singular/ipshell.h
"
5
#include "
ring_wrap.h
"
6
#include "
poly_wrap.h
"
7
static
boost::python::object Ring_as_str(
const
Ring
& r)
8
{
9
using
boost::python::str;
10
StringSetS
(
""
);
11
rWrite
(r.
pimpl
.get());
12
char
* out=
StringEndS
();
13
return
boost::python::str(out,strlen(out));
14
}
15
void
ring_set(
Ring
&
R
)
16
{
17
ring r=
R
.pimpl.get();
18
idhdl
h
=
rFindHdl
(r,
NULL
);
19
if
(
h
==
NULL
)
20
{
21
char
name_buffer[100];
22
static
int
ending=0;
23
ending++;
24
sprintf(name_buffer,
"PYTHON_RING_VAR%d"
,ending);
25
h
=
enterid
(name_buffer,0,
RING_CMD
,&
IDROOT
);
26
IDRING
(
h
)=r;
27
r->ref++;
28
}
29
rSetHdl
(
h
);
30
for
(
int
i
=
myynest
;
i
>=0;
i
--)
iiLocalRing
[
i
]=r;
31
}
32
void
export_ring
()
33
{
34
boost::python::class_<Ring>(
"Ring"
,
"reference to a Singular ring"
)
35
.def(
"__str__"
, Ring_as_str)
36
.def(
"set"
, ring_set,
"equivalent to the singular command setring, which is not mapped as it is a command"
)
37
.def(boost::python::init <>());
38
}
39
#endif
Ring
Definition:
ring_wrap.h:21
ring_wrap.h
enterid
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition:
ipid.cc:267
iiLocalRing
ring * iiLocalRing
Definition:
iplib.cc:454
StringEndS
char * StringEndS()
Definition:
reporter.cc:151
RING_CMD
@ RING_CMD
Definition:
grammar.cc:281
i
int i
Definition:
cfEzgcd.cc:125
IDROOT
#define IDROOT
Definition:
ipid.h:18
h
static Poly * h
Definition:
janet.cc:972
mod2.h
myynest
int myynest
Definition:
febase.cc:41
IDRING
#define IDRING(a)
Definition:
ipid.h:122
poly_wrap.h
rFindHdl
idhdl rFindHdl(ring r, idhdl n)
Definition:
ipshell.cc:1612
idrec
Definition:
idrec.h:35
Ring::pimpl
intrusive_ptr< ip_sring > pimpl
Definition:
ring_wrap.h:23
rWrite
void rWrite(ring r, BOOLEAN details)
Definition:
ring.cc:227
StringSetS
void StringSetS(const char *st)
Definition:
reporter.cc:128
NULL
#define NULL
Definition:
omList.c:10
R
#define R
Definition:
sirandom.c:26
export_ring
void export_ring()
ipshell.h
rSetHdl
void rSetHdl(idhdl h)
Definition:
ipshell.cc:5081
Generated on Thu Dec 17 2020 00:00:00 for My Project by
doxygen 1.8.20
for
Singular UNKNOWN_GIT_VERSION