Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
|
|
|
// This file is part of the Coriolis Software.
|
2016-01-20 17:41:19 -06:00
|
|
|
// Copyright (c) UPMC 2006-2016, All Rights Reserved
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
//
|
|
|
|
// +-----------------------------------------------------------------+
|
|
|
|
// | C O R I O L I S |
|
|
|
|
// | I s o b a r - Hurricane / Python Interface |
|
|
|
|
// | |
|
|
|
|
// | Author : Jean-Paul CHAPUT |
|
|
|
|
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
|
|
|
// | =============================================================== |
|
|
|
|
// | C++ Module : "./PyPad.cpp" |
|
|
|
|
// +-----------------------------------------------------------------+
|
|
|
|
|
|
|
|
|
2008-11-20 04:56:11 -06:00
|
|
|
#include "hurricane/isobar/PyNet.h"
|
|
|
|
#include "hurricane/isobar/PyLayer.h"
|
|
|
|
#include "hurricane/isobar/PyBox.h"
|
|
|
|
#include "hurricane/isobar/PyPad.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Isobar {
|
|
|
|
|
|
|
|
using namespace Hurricane;
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
|
|
|
|
#undef ACCESS_OBJECT
|
|
|
|
#undef ACCESS_CLASS
|
|
|
|
#define ACCESS_OBJECT _baseObject._baseObject._object
|
|
|
|
#define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject._baseObject)
|
|
|
|
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Pad,pad,function)
|
|
|
|
|
|
|
|
|
|
|
|
// x=================================================================x
|
|
|
|
// | "PyPad" Python Module Code Part |
|
|
|
|
// x=================================================================x
|
|
|
|
|
|
|
|
#if defined(__PYTHON_MODULE__)
|
|
|
|
|
|
|
|
|
|
|
|
// x-------------------------------------------------------------x
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
// | "PyPad" Attribute Methods |
|
2008-11-20 04:56:11 -06:00
|
|
|
// x-------------------------------------------------------------x
|
|
|
|
|
|
|
|
|
|
|
|
// Standard Accessors (Attributes).
|
|
|
|
DirectGetLongAttribute(PyPad_getX, getX, PyPad, Pad)
|
|
|
|
DirectGetLongAttribute(PyPad_getY, getY, PyPad, Pad)
|
|
|
|
|
|
|
|
// Standard Destroy (Attribute).
|
|
|
|
DBoDestroyAttribute(PyPad_destroy, PyPad)
|
|
|
|
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
// ---------------------------------------------------------------
|
|
|
|
// Attribute Method : "PyPad_create ()"
|
|
|
|
|
|
|
|
static PyObject* PyPad_create ( PyObject*, PyObject *args ) {
|
2016-06-11 14:56:12 -05:00
|
|
|
cdebug_log(20,0) << "PyPad_create()" << endl;
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
|
|
|
|
PyObject* arg0;
|
|
|
|
PyObject* arg1;
|
|
|
|
PyObject* arg2;
|
|
|
|
Pad* pad = NULL;
|
|
|
|
|
|
|
|
HTRY
|
|
|
|
__cs.init ("Pad.create");
|
|
|
|
if (!PyArg_ParseTuple(args,"O&O&O&:Pad.create"
|
|
|
|
,Converter,&arg0
|
|
|
|
,Converter,&arg1
|
|
|
|
,Converter,&arg2
|
|
|
|
)) {
|
|
|
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Pad constructor." );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( __cs.getObjectIds() == ":ent:layer:box") {
|
|
|
|
pad = Pad::create(PYNET_O(arg0), PYLAYER_O(arg1), *PYBOX_O(arg2));
|
|
|
|
} else {
|
|
|
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Pad constructor." );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HCATCH
|
|
|
|
|
|
|
|
return PyPad_Link(pad);
|
|
|
|
}
|
|
|
|
|
2008-11-20 04:56:11 -06:00
|
|
|
// ---------------------------------------------------------------
|
2010-04-27 07:25:56 -05:00
|
|
|
// Attribute Method : "PyPad_getBoundingBox ()"
|
2008-11-20 04:56:11 -06:00
|
|
|
|
|
|
|
static PyObject* PyPad_getBoundingBox( PyPad *self ) {
|
2016-06-11 14:56:12 -05:00
|
|
|
cdebug_log(20,0) << "PyPad_getBoundingBox()" << endl;
|
2008-11-20 04:56:11 -06:00
|
|
|
|
|
|
|
METHOD_HEAD ( "Pad.BoundingBox()" )
|
|
|
|
|
|
|
|
PyBox* pyBox = PyObject_NEW ( PyBox, &PyTypeBox );
|
|
|
|
if (pyBox == NULL) { return NULL; }
|
|
|
|
|
|
|
|
HTRY
|
|
|
|
pyBox->_object = new Box ( pad->getBoundingBox() );
|
|
|
|
HCATCH
|
|
|
|
|
|
|
|
return ( (PyObject*)pyBox );
|
|
|
|
}
|
|
|
|
|
2008-11-20 08:26:42 -06:00
|
|
|
// ---------------------------------------------------------------
|
|
|
|
// Attribute Method : "PyPad_setBoudingBox()"
|
|
|
|
|
|
|
|
static PyObject* PyPad_setBoundingBox(PyPad *self, PyObject* args) {
|
2016-06-11 14:56:12 -05:00
|
|
|
cdebug_log(20,0) << "Pad.setBoudingBox()" << endl;
|
2008-11-20 08:26:42 -06:00
|
|
|
|
|
|
|
HTRY
|
|
|
|
METHOD_HEAD ( "Pad.setBoudingBox()" )
|
|
|
|
|
|
|
|
PyBox* box;
|
|
|
|
if (!ParseOneArg("Pad.setBoundingBox", args, BOX_ARG, (PyObject**)&box)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
pad->setBoundingBox(*PYBOX_O(box));
|
|
|
|
HCATCH
|
|
|
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
}
|
|
|
|
|
2009-11-26 06:18:12 -06:00
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
|
|
|
// Attribute Method : "PyPad_translate ()"
|
|
|
|
|
|
|
|
static PyObject* PyPad_translate ( PyPad *self, PyObject* args ) {
|
2016-06-11 14:56:12 -05:00
|
|
|
cdebug_log(20,0) << "PyPad_translate ()" << endl;
|
2009-11-26 06:18:12 -06:00
|
|
|
|
|
|
|
HTRY
|
|
|
|
METHOD_HEAD ( "Pad.translate()" )
|
2016-11-30 14:50:25 -06:00
|
|
|
PyObject* arg0 = NULL;
|
|
|
|
PyObject* arg1 = NULL;
|
|
|
|
__cs.init ("Pad.translate");
|
|
|
|
if (PyArg_ParseTuple(args,"O&O&:Pad.translate", Converter, &arg0, Converter, &arg1)) {
|
|
|
|
if (__cs.getObjectIds() == INTS2_ARG) pad->translate( PyAny_AsLong(arg0), PyAny_AsLong(arg1) );
|
|
|
|
else {
|
|
|
|
PyErr_SetString ( ConstructorError, "Pad.translate(): Invalid type for parameter(s)." );
|
|
|
|
return NULL;
|
|
|
|
}
|
2009-11-26 06:18:12 -06:00
|
|
|
} else {
|
2016-11-30 14:50:25 -06:00
|
|
|
PyErr_SetString ( ConstructorError, "Pad.translate(): Invalid number of parameters." );
|
2009-11-26 06:18:12 -06:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
HCATCH
|
|
|
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-20 04:56:11 -06:00
|
|
|
// ---------------------------------------------------------------
|
|
|
|
// PyPad Attribute Method table.
|
|
|
|
|
|
|
|
PyMethodDef PyPad_Methods[] =
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
{ { "create" , (PyCFunction)PyPad_create , METH_VARARGS|METH_STATIC
|
|
|
|
, "Create a new Pad." }
|
|
|
|
, { "getX" , (PyCFunction)PyPad_getX , METH_NOARGS, "Return the Pad X value." }
|
|
|
|
, { "getY" , (PyCFunction)PyPad_getY , METH_NOARGS, "Return the Pad Y value." }
|
|
|
|
, { "getBoundingBox", (PyCFunction)PyPad_getBoundingBox, METH_NOARGS, "Return the Pad Bounding Box." }
|
|
|
|
, { "setBoundingBox", (PyCFunction)PyPad_setBoundingBox, METH_VARARGS, "Sets the Pad Bounding Box." }
|
|
|
|
, { "translate" , (PyCFunction)PyPad_translate , METH_VARARGS, "Translates the Pad of dx and dy." }
|
|
|
|
, { "destroy" , (PyCFunction)PyPad_destroy , METH_NOARGS
|
|
|
|
, "Destroy associated hurricane object, the python object remains." }
|
|
|
|
, {NULL, NULL, 0, NULL} /* sentinel */
|
2008-11-20 04:56:11 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// x-------------------------------------------------------------x
|
|
|
|
// | "PyPad" Object Methods |
|
|
|
|
// x-------------------------------------------------------------x
|
|
|
|
|
2009-09-30 10:11:49 -05:00
|
|
|
|
|
|
|
DBoDeleteMethod(Pad)
|
|
|
|
PyTypeObjectLinkPyType(Pad)
|
|
|
|
|
|
|
|
|
|
|
|
#else // End of Python Module Code Part.
|
|
|
|
|
|
|
|
|
|
|
|
// x=================================================================x
|
|
|
|
// | "PyPad" Shared Library Code Part |
|
|
|
|
// x=================================================================x
|
|
|
|
|
2008-11-20 04:56:11 -06:00
|
|
|
|
|
|
|
// Link/Creation Method.
|
|
|
|
DBoLinkCreateMethod(Pad)
|
2009-09-30 10:11:49 -05:00
|
|
|
PyTypeInheritedObjectDefinitions(Pad, Component)
|
2008-11-20 04:56:11 -06:00
|
|
|
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
#endif // Shared Library Code Part.
|
2008-11-20 04:56:11 -06:00
|
|
|
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
} // extern "C".
|
2008-11-20 04:56:11 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // End of Isobar namespace.
|