
Module: ppl/ppl Branch: pip Commit: ecaf06e49be98a0cb52058c67c8b81741c481269 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=ecaf06e49be98...
Author: Abramo Bagnara abramo.bagnara@gmail.com Date: Thu Jun 18 10:54:46 2009 +0200
Added proof of concept for Python interface.
---
interfaces/Python/ppl_py.cc | 44 +++++++++++++++++++++++++++++++++++++++++++ interfaces/Python/ppl_py.py | 6 +++++ 2 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/interfaces/Python/ppl_py.cc b/interfaces/Python/ppl_py.cc new file mode 100644 index 0000000..9a7a68b --- /dev/null +++ b/interfaces/Python/ppl_py.cc @@ -0,0 +1,44 @@ +// -*- compile-command: "g++ -c -fPIC -I/usr/include/python2.6 -W -Wall ppl_py.cc -lboost_python -lpython2.6 ; g++ -shared -o ppl.so ppl_py.o -lboost_python -lppl" -*- + +/* Proof of concept for a Python interface. + Copyright (C) 2001-2009 Roberto Bagnara bagnara@cs.unipr.it + +This file is part of the Parma Polyhedra Library (PPL). + +The PPL is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The PPL is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. + +For the most up-to-date information see the Parma Polyhedra Library +site: http://www.cs.unipr.it/ppl/ . */ + +#include <boost/python.hpp> +using namespace boost::python; + +#include <ppl.hh> +using namespace Parma_Polyhedra_Library; + +namespace Parma_Polyhedra_Library { +using IO_Operators::operator<<; + +} + +BOOST_PYTHON_MODULE(ppl) +{ + class_<Variable>("Variable", init<dimension_type>()) + .def("id", &Variable::id) + .def(self_ns::str(self)) + ; +} + + diff --git a/interfaces/Python/ppl_py.py b/interfaces/Python/ppl_py.py new file mode 100755 index 0000000..a969406 --- /dev/null +++ b/interfaces/Python/ppl_py.py @@ -0,0 +1,6 @@ +#!/usr/bin/python + +import ppl + +var = ppl.Variable(4) +print var