File:  [CENS] / python / pyGiNaC / wrappers4 / wildcard.cpp
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Nov 27 18:42:10 2001 UTC (15 years, 11 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
Implemented wildcard.

/*
  This file is part of the PyGiNaC package.
  http://cens.ioc.ee/projects/pyginac/

  $Revision: 1.1 $
  $Id: wildcard.cpp,v 1.1 2001-11-27 18:42:10 pearu Exp $
 
  Copyright 2001 Pearu Peterson all rights reserved,
  Pearu Peterson <pearu@cens.ioc.ee>
  Permission to use, modify, and distribute this software is given under the
  terms of the LGPL.  See http://www.fsf.org
 
  NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
*/

#ifndef PYGINAC_WILDCARD_CPP
#define PYGINAC_WILDCARD_CPP
/* prototypes */

GiNaC::ex wildcard(unsigned label);

BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE

GiNaC::wildcard & from_python(PyObject* o, py::type<GiNaC::wildcard &>);
const GiNaC::wildcard & from_python (PyObject* o, py::type<const GiNaC::wildcard &>);

BOOST_PYTHON_END_CONVERSION_NAMESPACE

#else
#ifndef PYGINAC_WILDCARD_CPP_1
#define PYGINAC_WILDCARD_CPP_1
/* definitions */

this_module.def(wildcard, "wildcard");
ex_class.def(&GiNaC::wildcard::get_label, "wildcard_get_label");

#else
/* implementation */

GiNaC::ex wildcard(unsigned label) {
  return GiNaC::wildcard(label);
}

BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE

GiNaC::wildcard & from_python(PyObject* o, py::type<GiNaC::wildcard &>) {
  if (PYOBJ_IS_EX(o)) {
    GiNaC::ex & e = pyobj_get_ex_nonconst(o);
    if (GiNaC::is_a<GiNaC::wildcard>(e))
      return GiNaC::ex_to_nonconst<GiNaC::wildcard>(e);
  }
  PyErr_SetString(PyExc_TypeError,(std::string("from_python(obj, wildcard) expected wildcard but got ")+PyString_AsString(PyObject_Repr(PyObject_Type(o)))).c_str());
  throw py::error_already_set();
}

const GiNaC::wildcard & from_python (PyObject* o, py::type<const GiNaC::wildcard &>) {
  return from_python(o, py::type<GiNaC::wildcard &>());
}

BOOST_PYTHON_END_CONVERSION_NAMESPACE

#endif
#endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>