Changeset 96b5640 in git


Ignore:
Timestamp:
Aug 19, 2005, 2:49:57 PM (19 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
75a969d43630c43f7a329ae1b448cfe68d0c13a9
Parents:
d116ec8d2a0671141e480634f435e120ecfdb2c9
Message:
*bricken: now requires NOSTRINGIO not to be defined in factory/config.h, further work on factory


git-svn-id: file:///usr/local/Singular/svn/trunk@8538 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/python/wrapper.h

    rd116ec8 r96b5640  
    1 //$Id: wrapper.h,v 1.10 2005-08-17 16:30:46 bricken Exp $
     1//$Id: wrapper.h,v 1.11 2005-08-19 12:49:57 bricken Exp $
    22#ifndef PYTHON_SINGULAR_WRAPPER_HEADER
    33#define PYTHON_SINGULAR_WRAPPER_HEADER
    44#include <Python.h>
    55#include <boost/python.hpp>
     6#include <sstream>
    67#include "mod2.h"
    78#include "numbers.h"
     
    1112#include "Poly.h"
    1213#include "PowerSeries.h"
     14#include <factory.h>
     15
    1316using namespace boost::python;
     17typedef std::basic_stringstream<char>  mysstream;
    1418Vector unitVector0(int i){
    1519  return unitVector(i,currRing);
    1620}
     21
    1722static boost::python::object Number_as_str(Number n)
    1823{
     
    2328  return boost::python::str(out,strlen(out));
    2429}
    25 
     30static boost::python::object CF_as_str(const CanonicalForm& f)
     31{
     32  using boost::python::str;
     33  mysstream s;
     34  s<<f;
     35  return boost::python::str(s.str());
     36}
    2637static boost::python::object Poly_as_str(Poly& p)
    2738{
     
    4253
    4354BOOST_PYTHON_MODULE(Singular){
     55  boost::python::class_<CanonicalForm>("canonical_form")
     56    .def(boost::python::init <const int>())
     57    .def("__str__", CF_as_str)
     58    .def(-self)
     59    .def(self*=self)
     60    .def(self+=self)
     61    .def(self-=self)
     62    .def(self/=self)
     63    .def(self==self)
     64    .def(self+self)
     65    .def(self*self)
     66    .def(self/self)
     67    .def(self-self)
     68    .def(int()==self)
     69    .def(int()+self)
     70    .def(int()*self)
     71    .def(int()/self)
     72    .def(int()-self)
     73    .def(self==int())
     74    .def(self+int())
     75    .def(self*int())
     76    .def(self/int())
     77    .def(self-int())
     78    .def(self*=int())
     79    .def(self+=int())
     80    .def(self-=int())
     81    .def(self/=int());
    4482  boost::python::class_<Number>("number")
    4583    .def(boost::python::init <int>())
     
    79117    .def(boost::python::init <const char* >())
    80118   
    81     //.def("__str__", as_str)
    82     //.def(-self)
     119    .def(-self)
    83120    .def(self*=self)
    84121    .def(self+=self)
     
    94131    .def(self*self);
    95132  boost::python::class_<Vector>("vector")
    96    
    97133    .def(boost::python::init <>())
    98134    .def("__str__", Vector_as_str)
     
    100136    //    .def("__str__", Poly_as_str)
    101137    .def("__iter__", boost::python::iterator<Vector>())
    102    
     138    .def(-self)
    103139    .def(self+=self)
    104140   
Note: See TracChangeset for help on using the changeset viewer.