crlcore: Add Python bindings for DEF export
Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
parent
2f1caca812
commit
4884a5d6dc
|
@ -51,6 +51,7 @@
|
||||||
PyLefImport.cpp
|
PyLefImport.cpp
|
||||||
PyDefImport.cpp
|
PyDefImport.cpp
|
||||||
PyLefExport.cpp
|
PyLefExport.cpp
|
||||||
|
PyDefExport.cpp
|
||||||
)
|
)
|
||||||
set( pyIncludes crlcore/PySystem.h
|
set( pyIncludes crlcore/PySystem.h
|
||||||
crlcore/PyBanner.h
|
crlcore/PyBanner.h
|
||||||
|
@ -74,6 +75,7 @@
|
||||||
crlcore/PyLefImport.h
|
crlcore/PyLefImport.h
|
||||||
crlcore/PyDefImport.h
|
crlcore/PyDefImport.h
|
||||||
crlcore/PyLefExport.h
|
crlcore/PyLefExport.h
|
||||||
|
crlcore/PyDefExport.h
|
||||||
)
|
)
|
||||||
# target_link_libraries ( crlcore ${HURRICANE_PYTHON_NEW_LIBRARIES}
|
# target_link_libraries ( crlcore ${HURRICANE_PYTHON_NEW_LIBRARIES}
|
||||||
# ${HURRICANE_PYTHON_LIBRARIES}
|
# ${HURRICANE_PYTHON_LIBRARIES}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "crlcore/PyLefImport.h"
|
#include "crlcore/PyLefImport.h"
|
||||||
#include "crlcore/PyLefExport.h"
|
#include "crlcore/PyLefExport.h"
|
||||||
#include "crlcore/PyDefImport.h"
|
#include "crlcore/PyDefImport.h"
|
||||||
|
#include "crlcore/PyDefExport.h"
|
||||||
#include "crlcore/VhdlEntity.h"
|
#include "crlcore/VhdlEntity.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,6 +149,7 @@ extern "C" {
|
||||||
PyLefImport_LinkPyType ();
|
PyLefImport_LinkPyType ();
|
||||||
PyDefImport_LinkPyType ();
|
PyDefImport_LinkPyType ();
|
||||||
PyLefExport_LinkPyType ();
|
PyLefExport_LinkPyType ();
|
||||||
|
PyDefExport_LinkPyType ();
|
||||||
|
|
||||||
PYTYPE_READY ( System );
|
PYTYPE_READY ( System );
|
||||||
PYTYPE_READY ( Banner );
|
PYTYPE_READY ( Banner );
|
||||||
|
@ -172,6 +174,7 @@ extern "C" {
|
||||||
PYTYPE_READY ( LefImport );
|
PYTYPE_READY ( LefImport );
|
||||||
PYTYPE_READY ( DefImport );
|
PYTYPE_READY ( DefImport );
|
||||||
PYTYPE_READY ( LefExport );
|
PYTYPE_READY ( LefExport );
|
||||||
|
PYTYPE_READY ( DefExport );
|
||||||
|
|
||||||
// Identifier string can take up to 10 characters.
|
// Identifier string can take up to 10 characters.
|
||||||
__cs.addType ( "alcLib" , &PyTypeAllianceLibrary , "<AllianceLibrary>" , false );
|
__cs.addType ( "alcLib" , &PyTypeAllianceLibrary , "<AllianceLibrary>" , false );
|
||||||
|
@ -234,6 +237,8 @@ extern "C" {
|
||||||
PyModule_AddObject ( module, "DefImport", (PyObject*)&PyTypeDefImport );
|
PyModule_AddObject ( module, "DefImport", (PyObject*)&PyTypeDefImport );
|
||||||
Py_INCREF ( &PyTypeLefExport );
|
Py_INCREF ( &PyTypeLefExport );
|
||||||
PyModule_AddObject ( module, "LefExport", (PyObject*)&PyTypeLefExport );
|
PyModule_AddObject ( module, "LefExport", (PyObject*)&PyTypeLefExport );
|
||||||
|
Py_INCREF ( &PyTypeDefExport );
|
||||||
|
PyModule_AddObject ( module, "DefExport", (PyObject*)&PyTypeDefExport );
|
||||||
|
|
||||||
PyCatalog_postModuleInit ();
|
PyCatalog_postModuleInit ();
|
||||||
PyEnvironment_postModuleInit ();
|
PyEnvironment_postModuleInit ();
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
// -*- C++ -*-
|
||||||
|
//
|
||||||
|
// This file is part of the Coriolis Software.
|
||||||
|
// Copyright (c) UPMC 2017-2018, All Rights Reserved
|
||||||
|
//
|
||||||
|
// +-----------------------------------------------------------------+
|
||||||
|
// | C O R I O L I S |
|
||||||
|
// | Alliance / Hurricane Interface |
|
||||||
|
// | |
|
||||||
|
// | Author : Jean-Paul CHAPUT |
|
||||||
|
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||||
|
// | =============================================================== |
|
||||||
|
// | C++ Module : "./PyDefExport.cpp" |
|
||||||
|
// +-----------------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
|
#include "crlcore/PyDefExport.h"
|
||||||
|
#include "hurricane/isobar/PyCell.h"
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
|
namespace CRL {
|
||||||
|
|
||||||
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
|
using std::hex;
|
||||||
|
using std::string;
|
||||||
|
using std::ostringstream;
|
||||||
|
using Hurricane::tab;
|
||||||
|
using Hurricane::Exception;
|
||||||
|
using Hurricane::Bug;
|
||||||
|
using Hurricane::Error;
|
||||||
|
using Hurricane::Warning;
|
||||||
|
using Hurricane::Cell;
|
||||||
|
using Isobar::ProxyProperty;
|
||||||
|
using Isobar::ProxyError;
|
||||||
|
using Isobar::ConstructorError;
|
||||||
|
using Isobar::HurricaneError;
|
||||||
|
using Isobar::HurricaneWarning;
|
||||||
|
using Isobar::getPyHash;
|
||||||
|
using Isobar::ParseOneArg;
|
||||||
|
using Isobar::ParseTwoArg;
|
||||||
|
using Isobar::__cs;
|
||||||
|
using Isobar::PyTypeCell;
|
||||||
|
using Isobar::PyCell;
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__PYTHON_MODULE__)
|
||||||
|
|
||||||
|
// +=================================================================+
|
||||||
|
// | "PyDefExport" Python Module Code Part |
|
||||||
|
// +=================================================================+
|
||||||
|
|
||||||
|
|
||||||
|
static PyObject* PyDefExport_drive ( PyObject*, PyObject* args )
|
||||||
|
{
|
||||||
|
cdebug_log(30,0) << "PyDefExport_drive()" << endl;
|
||||||
|
|
||||||
|
PyCell* pyCell = NULL;
|
||||||
|
|
||||||
|
HTRY
|
||||||
|
unsigned int flags = 0;
|
||||||
|
|
||||||
|
if (PyArg_ParseTuple( args, "O!I:DefExport.drive", &PyTypeCell, &pyCell, &flags)) {
|
||||||
|
DefExport::drive( PYCELL_O(pyCell) , flags );
|
||||||
|
} else {
|
||||||
|
PyErr_SetString ( ConstructorError, "DefExport.drive(): Bad type or bad number of parameters." );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
HCATCH
|
||||||
|
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Standart Destroy (Attribute).
|
||||||
|
|
||||||
|
|
||||||
|
PyMethodDef PyDefExport_Methods[] =
|
||||||
|
{ { "drive" , (PyCFunction)PyDefExport_drive , METH_VARARGS|METH_STATIC
|
||||||
|
, "Save a complete Cadence DEF design." }
|
||||||
|
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
NoObjectDeleteMethod(DefExport)
|
||||||
|
PyTypeObjectLinkPyTypeWithoutObject(DefExport,DefExport)
|
||||||
|
|
||||||
|
|
||||||
|
#else // End of Python Module Code Part.
|
||||||
|
|
||||||
|
|
||||||
|
// +=================================================================+
|
||||||
|
// | "PyDefExport" Shared Library Code Part |
|
||||||
|
// +=================================================================+
|
||||||
|
|
||||||
|
// Type Definition.
|
||||||
|
PyTypeObjectDefinitionsOfModule(CRL,DefExport)
|
||||||
|
|
||||||
|
|
||||||
|
#endif // End of Shared Library Code Part.
|
||||||
|
|
||||||
|
} // extern "C".
|
||||||
|
|
||||||
|
} // CRL namespace.
|
|
@ -0,0 +1,55 @@
|
||||||
|
|
||||||
|
// -*- C++ -*-
|
||||||
|
//
|
||||||
|
// This file is part of the Coriolis Software.
|
||||||
|
// Copyright (c) UPMC 2017-2018, All Rights Reserved
|
||||||
|
//
|
||||||
|
// +-----------------------------------------------------------------+
|
||||||
|
// | C O R I O L I S |
|
||||||
|
// | Alliance / Hurricane Interface |
|
||||||
|
// | |
|
||||||
|
// | Author : Jean-Paul CHAPUT |
|
||||||
|
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||||
|
// | =============================================================== |
|
||||||
|
// | C++ Header : "./crlcore/PyDefExport.h" |
|
||||||
|
// +-----------------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CRL_PY_DEF_EXPORT_H
|
||||||
|
#define CRL_PY_DEF_EXPORT_H
|
||||||
|
|
||||||
|
#include "hurricane/isobar/PyHurricane.h"
|
||||||
|
#include "crlcore/DefExport.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace CRL {
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// Python Object : "PyDefExport".
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
} PyDefExport;
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// Functions & Types exported to "PyCRL.ccp".
|
||||||
|
|
||||||
|
extern PyTypeObject PyTypeDefExport;
|
||||||
|
extern PyMethodDef PyDefExport_Methods[];
|
||||||
|
|
||||||
|
extern void PyDefExport_LinkPyType();
|
||||||
|
|
||||||
|
|
||||||
|
#define IsPyDefExport(v) ( (v)->ob_type == &PyTypeDefExport )
|
||||||
|
#define PY_DEFEXPORT(v) ( (PyDefExport*)(v) )
|
||||||
|
|
||||||
|
|
||||||
|
} // extern "C".
|
||||||
|
|
||||||
|
} // CRL namespace.
|
||||||
|
|
||||||
|
#endif // CRL_PY_DEF_EXPORT_H
|
Loading…
Reference in New Issue