Changeset 080559 in git
- Timestamp:
- Feb 23, 2017, 10:44:56 AM (7 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 9e343ee0eaae866f167529dde1705e4a1b39580f
- Parents:
- 79d8c073c7a618421d9dc77e8ce8462140fd581b
- Files:
-
- 5 added
- 4 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/python/CF_wrap.cc
r79d8c07 r080559 2 2 #include <boost/python.hpp> 3 3 #include <kernel/mod2.h> 4 #include "factory .h"4 #include "factory/factory.h" 5 5 6 6 using boost::python::self; -
Singular/dyn_modules/python/Makefile
r79d8c07 r080559 1 #/*2 # * This was automatically generated by modgen3 # * version 0.24 # * module python5 # * Don't edit this file6 # */7 #8 #9 1 CC = gcc 10 2 CXX = g++ 11 PYTHON_VERSION=2.3 12 SINGULAR_BASE=../.. 13 SING_ARCH=ix86 14 CFLAGS = -DSING_NDEBUG -DBUILD_MODULE -I. -I${SINGULAR_BASE}/kernel -I${SINGULAR_BASE}/Singular -I/home/michael/sing/${SING_ARCH}-Linux/include -I/usr/include/python${PYTHON_VERSION} 15 DCFLAGS = -DBUILD_MODULE -I. -I/home/michael/sing/kernel -I${SINGULAR_BASE}/Singular -I/home/michael/sing/${SING_ARCH}-Linux/include -I/usr/include/python${PYTHON_VERSION} 3 PYTHON_VERSION=2.7 4 SINGULAR_BASE=../../.. 5 CFLAGS = -DSING_NDEBUG -DSING_OMNDEBUG -I. -I${SINGULAR_BASE} -I${SINGULAR_BASE}/kernel -I${SINGULAR_BASE}/Singular -I/usr/include/python${PYTHON_VERSION} -I/tmp2/wawa -I${SINGULAR_BASE}/libpolys -I/tmp2/wawa/libpolys -I${SINGULAR_BASE}/factory/include 16 6 LDFLAGS= -lboost_python -lpython${PYTHON_VERSION} 17 7 #LD = … … 22 12 INSTALL_DATA = ${INSTALL} -m 644 23 13 SRCS = python.cc poly_wrap.cc vector_wrap.cc CF_wrap.cc\ 24 Åumber_wrap.cc playground.cc14 Åumber_wrap.cc 25 15 OBJS = python.o poly_wrap.o vector_wrap.o CF_wrap.o\ 26 number_wrap.o playground.o 27 DOBJS = python.og poly_wrap.og vector_wrap.og CF_wrap.og\ 28 number_wrap.og playground.og 29 default: 30 echo "use scons for building this project" 16 number_wrap.o 31 17 32 all: python_module.so python_module_g.so18 all: python_module.so 33 19 34 20 %.o: %.cc Makefile 35 21 ${CXX} ${CFLAGS} -c -fPIC -DPIC $< -o $*.o 36 37 %.og: %.cc Makefile38 ${CXX} ${DCFLAGS} -c -fPIC -DPIC $< -o $*.og39 22 40 23 python_module.so: ${OBJS} … … 44 27 ln -s python_module.so.1.2.0 python_module.so 45 28 46 python_module_g.so: ${DOBJS}47 ${CXX} ${DCFLAGS} ${LDFLAGS} -shared -Wl,-soname -Wl,python_module_g.so.1 \48 -o python_module_g.so.1.2.0 ${DOBJS}49 rm -f python_module_g.so50 ln -s python_module_g.so.1.2.0 python_module_g.so51 52 29 clean: 53 rm -f *.o *. og *.lo *.so* *.sl *.la *~ core30 rm -f *.o *.lo *.so* *.sl *.la *~ core 54 31 55 32 distclean: clean 56 rm -f python.cc python.h Makefile *.bin*.pl33 rm -f Makefile *.pl 57 34 58 35 install: … … 60 37 ${MKINSTALLDIRS} ${instdir}/MOD 61 38 ${INSTALL_PROGRAM} python_module.so ${instdir}/MOD/python_module.so 62 ${INSTALL_PROGRAM} python_module.bin ${instdir}/MOD/python_module.bin63 39 64 40 -
Singular/dyn_modules/python/intvec_wrap.h
r79d8c07 r080559 3 3 #include <vector> 4 4 #include <kernel/mod2.h> 5 #include " intvec.h"5 #include "misc/intvec.h" 6 6 #include "IIntvec.h" 7 7 void export_intvec(); -
Singular/dyn_modules/python/number_wrap.cc
r79d8c07 r080559 10 10 StringSetS(""); 11 11 n.write(); 12 char* out=String AppendS("");12 char* out=StringEndS(); 13 13 return boost::python::str(out,strlen(out)); 14 14 } -
Singular/dyn_modules/python/playground.cc
r79d8c07 r080559 9 9 using boost::python::object; 10 10 using boost::python::list; 11 object foo(){ 11 object foo() 12 { 12 13 list l; 13 for(int j=0;j<2;j++){ 14 for(int j=0;j<2;j++) 15 { 14 16 list row; 15 for(int i=0;i<10;i++){ 17 for(int i=0;i<10;i++) 18 { 16 19 Poly ip(i*(j+1),currRing); 17 20 row.append(ip); … … 21 24 l.append(row); 22 25 } 23 array::set_module_and_type("Numeric",26 boost::python::numeric::array::set_module_and_type("Numeric", 24 27 "ArrayType" 25 28 ); 26 array a(l);29 boost::python::numeric::array a(l); 27 30 return a; 28 29 30 31 32 31 } 33 boost::python::object foo2(array f){ 32 object foo2(array f) 33 { 34 34 using boost::python::extract; 35 35 object o=f.attr("shape"); … … 48 48 return boost::python::str("suc"); 49 49 } 50 void export_playground(){ 50 void export_playground() 51 { 51 52 def("foo",foo); 52 53 def("foo2",foo2); -
Singular/dyn_modules/python/python.cc
r79d8c07 r080559 14 14 15 15 #include <locals.h> 16 #include <omalloc .h>16 #include <omalloc/omalloc.h> 17 17 #include "python.h" 18 18 … … 24 24 #include "wrapper.h" 25 25 26 extern "C" {27 26 //int mod_init( 28 27 // int (*iiAddCproc)(char *libname, char *procname, BOOLEAN pstatic, 29 28 // BOOLEAN(*func)(leftv res, leftv v)) 30 29 // ) 31 30 extern "C" int mod_init( SModulFunctions* psModulFunctions) 32 31 { 33 enter_id("category","tests", STRING_CMD);34 enter_id("version","$Id$", STRING_CMD);35 enter_id("info","LIBRARY: kernel.lib PROCEDURES OF GENERAL TYPE WRITEN IN C python(input); eval a string in python", STRING_CMD);36 32 Py_Initialize(); 37 33 PyRun_SimpleString("from sys import path\n\ … … 44 40 } 45 41 46 BOOLEAN mod_python(leftv __res, leftv __h)42 extern "C" BOOLEAN mod_python(leftv __res, leftv __h) 47 43 { 48 44 leftv __v = __h, __v_save; -
Singular/dyn_modules/python/python.h
r79d8c07 r080559 1 BOOLEAN mod_python(leftv res, leftv h);1 extern "C" BOOLEAN mod_python(leftv res, leftv h); -
Singular/dyn_modules/python/ring_wrap.h
r79d8c07 r080559 1 1 #ifndef RING_WRAP_HEADER 2 2 #define RING_WRAP_HEADER 3 #include " ring.h"3 #include "polys/monomials/ring.h" 4 4 #include "grammar.h" 5 5 #include "subexpr.h" -
Singular/dyn_modules/python/wrapper.h
r79d8c07 r080559 8 8 9 9 #include "structs.h" 10 #include " numbers.h"10 #include "coeffs/numbers.h" 11 11 12 #include "febase.h"12 //#include "febase.h" 13 13 #include "ipid.h" 14 14 #include "ipshell.h" … … 19 19 #include "Ideal.h" 20 20 #include "ideal_wrap.h" 21 #include <factory .h>21 #include <factory/factory.h> 22 22 #include "poly_wrap.h" 23 23 #include "vector_wrap.h" 24 24 #include "CF_wrap.h" 25 25 #include "number_wrap.h" 26 #include "playground.h"26 //#include "playground.h" 27 27 #include "interpreter_support.h" 28 28 #include "ring_wrap.h" … … 58 58 export_number(); 59 59 export_vector(); 60 export_playground();60 //export_playground(); 61 61 export_ideal(); 62 62 export_module();
Note: See TracChangeset
for help on using the changeset viewer.