Changeset 080559 in git


Ignore:
Timestamp:
Feb 23, 2017, 10:44:56 AM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
9e343ee0eaae866f167529dde1705e4a1b39580f
Parents:
79d8c073c7a618421d9dc77e8ce8462140fd581b
Message:
dyn_modules:python: first version
Files:
5 added
4 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/python/CF_wrap.cc

    r79d8c07 r080559  
    22#include <boost/python.hpp>
    33#include <kernel/mod2.h>
    4 #include "factory.h"
     4#include "factory/factory.h"
    55
    66using boost::python::self;
  • Singular/dyn_modules/python/Makefile

    r79d8c07 r080559  
    1 #/*
    2 # * This was automatically generated by modgen
    3 # * version 0.2
    4 # * module python
    5 # * Don't edit this file
    6 # */
    7 #
    8 #
    91CC      = gcc
    102CXX     = 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}
     3PYTHON_VERSION=2.7
     4SINGULAR_BASE=../../..
     5CFLAGS  = -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
    166LDFLAGS= -lboost_python -lpython${PYTHON_VERSION}
    177#LD     =
     
    2212INSTALL_DATA    = ${INSTALL} -m 644
    2313SRCS    = python.cc poly_wrap.cc vector_wrap.cc CF_wrap.cc\
    24              Å†umber_wrap.cc playground.cc
     14             Å†umber_wrap.cc
    2515OBJS    = 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
    3117
    32 all:    python_module.so python_module_g.so
     18all:    python_module.so
    3319
    3420%.o: %.cc Makefile
    3521        ${CXX} ${CFLAGS} -c -fPIC -DPIC $< -o $*.o
    36 
    37 %.og: %.cc Makefile
    38         ${CXX} ${DCFLAGS} -c -fPIC -DPIC $< -o $*.og
    3922
    4023python_module.so: ${OBJS}
     
    4427        ln -s python_module.so.1.2.0 python_module.so
    4528
    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.so
    50         ln -s python_module_g.so.1.2.0 python_module_g.so
    51 
    5229clean:
    53         rm -f *.o *.og *.lo *.so* *.sl *.la *~ core
     30        rm -f *.o *.lo *.so* *.sl *.la *~ core
    5431
    5532distclean: clean
    56         rm -f python.cc python.h Makefile *.bin *.pl
     33        rm -f Makefile *.pl
    5734
    5835install:
     
    6037        ${MKINSTALLDIRS} ${instdir}/MOD
    6138        ${INSTALL_PROGRAM} python_module.so ${instdir}/MOD/python_module.so
    62         ${INSTALL_PROGRAM} python_module.bin ${instdir}/MOD/python_module.bin
    6339
    6440
  • Singular/dyn_modules/python/intvec_wrap.h

    r79d8c07 r080559  
    33#include <vector>
    44#include <kernel/mod2.h>
    5 #include "intvec.h"
     5#include "misc/intvec.h"
    66#include "IIntvec.h"
    77void export_intvec();
  • Singular/dyn_modules/python/number_wrap.cc

    r79d8c07 r080559  
    1010  StringSetS("");
    1111  n.write();
    12   char* out=StringAppendS("");
     12  char* out=StringEndS();
    1313  return boost::python::str(out,strlen(out));
    1414}
  • Singular/dyn_modules/python/playground.cc

    r79d8c07 r080559  
    99using boost::python::object;
    1010using boost::python::list;
    11 object foo(){
     11object foo()
     12{
    1213  list l;
    13   for(int j=0;j<2;j++){
     14  for(int j=0;j<2;j++)
     15  {
    1416    list row;
    15     for(int i=0;i<10;i++){
     17    for(int i=0;i<10;i++)
     18    {
    1619      Poly ip(i*(j+1),currRing);
    1720      row.append(ip);
     
    2124    l.append(row);
    2225  }
    23   array::set_module_and_type("Numeric",
     26  boost::python::numeric::array::set_module_and_type("Numeric",
    2427                             "ArrayType"
    2528                             );
    26   array a(l);
     29  boost::python::numeric::array a(l);
    2730  return a;
    28 
    29 
    30 
    31 
    3231}
    33 boost::python::object foo2(array f){
     32object foo2(array f)
     33{
    3434  using boost::python::extract;
    3535  object o=f.attr("shape");
     
    4848  return boost::python::str("suc");
    4949}
    50 void export_playground(){
     50void export_playground()
     51{
    5152  def("foo",foo);
    5253  def("foo2",foo2);
  • Singular/dyn_modules/python/python.cc

    r79d8c07 r080559  
    1414
    1515#include <locals.h>
    16 #include <omalloc.h>
     16#include <omalloc/omalloc.h>
    1717#include "python.h"
    1818
     
    2424#include "wrapper.h"
    2525
    26 extern "C" {
    2726//int mod_init(
    2827//  int (*iiAddCproc)(char *libname, char *procname, BOOLEAN pstatic,
    2928//              BOOLEAN(*func)(leftv res, leftv v))
    3029//  )
    31   int mod_init( SModulFunctions* psModulFunctions)
     30extern "C" int mod_init( SModulFunctions* psModulFunctions)
    3231{
    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);
    3632  Py_Initialize();
    3733  PyRun_SimpleString("from sys import path\n\
     
    4440}
    4541
    46 BOOLEAN mod_python(leftv __res, leftv __h)
     42extern "C" BOOLEAN mod_python(leftv __res, leftv __h)
    4743{
    4844  leftv __v = __h, __v_save;
  • Singular/dyn_modules/python/python.h

    r79d8c07 r080559  
    1 BOOLEAN mod_python(leftv res, leftv h);
     1extern "C" BOOLEAN mod_python(leftv res, leftv h);
  • Singular/dyn_modules/python/ring_wrap.h

    r79d8c07 r080559  
    11#ifndef RING_WRAP_HEADER
    22#define RING_WRAP_HEADER
    3 #include "ring.h"
     3#include "polys/monomials/ring.h"
    44#include "grammar.h"
    55#include "subexpr.h"
  • Singular/dyn_modules/python/wrapper.h

    r79d8c07 r080559  
    88
    99#include "structs.h"
    10 #include "numbers.h"
     10#include "coeffs/numbers.h"
    1111
    12 #include "febase.h"
     12//#include "febase.h"
    1313#include "ipid.h"
    1414#include "ipshell.h"
     
    1919#include "Ideal.h"
    2020#include "ideal_wrap.h"
    21 #include <factory.h>
     21#include <factory/factory.h>
    2222#include "poly_wrap.h"
    2323#include "vector_wrap.h"
    2424#include "CF_wrap.h"
    2525#include "number_wrap.h"
    26 #include "playground.h"
     26//#include "playground.h"
    2727#include "interpreter_support.h"
    2828#include "ring_wrap.h"
     
    5858  export_number();
    5959  export_vector();
    60   export_playground();
     60  //export_playground();
    6161  export_ideal();
    6262  export_module();
Note: See TracChangeset for help on using the changeset viewer.