* ./hurricane/sr/isobar:
- New: Added Hook support (PyHook). Hook accessors added in PyContact and PySegment.
This commit is contained in:
parent
77f71e68f8
commit
31abc474f1
|
@ -40,6 +40,7 @@
|
|||
PyNetExternalComponents.cpp
|
||||
PyOccurrence.cpp
|
||||
PyOccurrenceCollection.cpp
|
||||
PyHook.cpp
|
||||
PyPad.cpp
|
||||
PyPath.cpp
|
||||
PyPin.cpp
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2008-2013, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
|
@ -7,10 +12,7 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyBox.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
|
@ -29,18 +31,13 @@ extern "C" {
|
|||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Box,box,function)
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
// | "PyBox" Python Module Code Part |
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyBox" Attribute Methods |
|
||||
// x-------------------------------------------------------------x
|
||||
|
||||
|
||||
// Standart Accessors (Attributes).
|
||||
DirectGetLongAttribute(PyBox_getXMin ,getXMin ,PyBox,Box)
|
||||
DirectGetLongAttribute(PyBox_getYMin ,getYMin ,PyBox,Box)
|
||||
|
@ -64,11 +61,6 @@ extern "C" {
|
|||
DirectDestroyAttribute(PyBox_destroy, PyBox)
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyBox_getCenter ()"
|
||||
|
||||
static PyObject* PyBox_getCenter ( PyBox *self ) {
|
||||
trace << "PyBox_getCenter()" << endl;
|
||||
|
||||
|
@ -85,12 +77,6 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyBox_getUnion ()"
|
||||
|
||||
static PyObject* PyBox_getUnion ( PyBox *self, PyObject* args ) {
|
||||
trace << "PyBox_getUnion()" << endl;
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2008-2013, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
|
@ -7,16 +12,12 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyContact.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyNet.h"
|
||||
#include "hurricane/isobar/PyLayer.h"
|
||||
#include "hurricane/isobar/PyHook.h"
|
||||
#include "hurricane/isobar/PyContact.h"
|
||||
#include "hurricane/isobar/PyHorizontal.h"
|
||||
#include "hurricane/isobar/PyVertical.h"
|
||||
|
@ -24,7 +25,6 @@
|
|||
|
||||
namespace Isobar {
|
||||
|
||||
|
||||
using namespace Hurricane;
|
||||
|
||||
|
||||
|
@ -38,17 +38,11 @@ extern "C" {
|
|||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Contact,contact,function)
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyContact" Python Module Code Part |
|
||||
// x=================================================================x
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyContact" Attribute Methods |
|
||||
// x-------------------------------------------------------------x
|
||||
|
||||
// +=================================================================+
|
||||
// | "PyContact" Python Module Code Part |
|
||||
// +=================================================================+
|
||||
|
||||
// Standart Accessors (Attributes).
|
||||
DirectGetLongAttribute(PyContact_getWidth , getWidth , PyContact,Contact)
|
||||
|
@ -63,15 +57,13 @@ extern "C" {
|
|||
DirectSetLongAttribute(PyContact_setY ,setY ,"Contact.setY" ,PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setDx,setDx,"Contact.setDx",PyContact,Contact)
|
||||
DirectSetLongAttribute(PyContact_setDy,setDy,"Contact.setDy",PyContact,Contact)
|
||||
accessorHook(getAnchorHook,PyContact,Contact)
|
||||
|
||||
|
||||
// Standart destroy (Attribute).
|
||||
DBoDestroyAttribute(PyContact_destroy, PyContact)
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyContact_translate ()"
|
||||
|
||||
static PyObject* PyContact_translate ( PyContact *self, PyObject* args ) {
|
||||
trace << "PyContact_translate ()" << endl;
|
||||
|
||||
|
@ -90,12 +82,10 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PyContact Attribute Method table.
|
||||
|
||||
PyMethodDef PyContact_Methods[] =
|
||||
{ { "destroy" , (PyCFunction)PyContact_destroy , METH_NOARGS
|
||||
{ { "destroy" , (PyCFunction)PyContact_destroy , METH_NOARGS
|
||||
, "Destroy associated hurricane object, the python object remains." }
|
||||
, { "getAnchorHook" , (PyCFunction)PyContact_getWidth , METH_NOARGS , "Return the contact anchor hook." }
|
||||
, { "getWidth" , (PyCFunction)PyContact_getWidth , METH_NOARGS , "Return the contact width." }
|
||||
, { "getHalfWidth" , (PyCFunction)PyContact_getHalfWidth , METH_NOARGS , "Return the contact half width." }
|
||||
, { "getHeight" , (PyCFunction)PyContact_getHeight , METH_NOARGS , "Return the contact height." }
|
||||
|
@ -111,14 +101,6 @@ extern "C" {
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyContact" Object Methods |
|
||||
// x-------------------------------------------------------------x
|
||||
|
||||
|
||||
|
||||
DBoDeleteMethod(Contact)
|
||||
PyTypeObjectLinkPyType(Contact)
|
||||
|
||||
|
@ -126,12 +108,10 @@ extern "C" {
|
|||
#else // End of Python Module Code Part.
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
// | "PyContact" Shared Library Code Part |
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyContact_create ()"
|
||||
|
||||
PyObject* PyContact_create ( PyObject *module, PyObject *args ) {
|
||||
trace << "PyContact_create()" << endl;
|
||||
|
@ -166,22 +146,14 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Link/Creation Method.
|
||||
DBoLinkCreateMethod(Contact)
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PyContact Object Definitions.
|
||||
|
||||
PyTypeInheritedObjectDefinitions(Contact, Component)
|
||||
|
||||
#endif // End of Shared Library Code Part.
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
} // extern "C".
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
} // Isobar namespace.
|
||||
|
|
|
@ -1,36 +1,8 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
//
|
||||
// Main contributors :
|
||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
||||
// Christian Masson <Christian.Masson@lip6.fr>
|
||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
||||
//
|
||||
// The Coriolis Project 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 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The Coriolis Project 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 the Coriolis Project; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA
|
||||
//
|
||||
// License-Tag
|
||||
// Authors-Tag
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2008-2013, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
|
@ -43,8 +15,6 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyHurricane.h"
|
||||
#include "hurricane/isobar/PyBreakpoint.h"
|
||||
#include "hurricane/isobar/PyUpdateSession.h"
|
||||
|
@ -80,6 +50,7 @@
|
|||
#include "hurricane/isobar/PyNetCollection.h"
|
||||
#include "hurricane/isobar/PyNetExternalComponents.h"
|
||||
#include "hurricane/isobar/PyHyperNet.h"
|
||||
#include "hurricane/isobar/PyHook.h"
|
||||
#include "hurricane/isobar/PyComponent.h"
|
||||
#include "hurricane/isobar/PyComponentCollection.h"
|
||||
#include "hurricane/isobar/PyPlug.h"
|
||||
|
@ -578,6 +549,7 @@ extern "C" {
|
|||
PyReference_LinkPyType ();
|
||||
PyNet_LinkPyType ();
|
||||
PyHyperNet_LinkPyType ();
|
||||
PyHook_LinkPyType ();
|
||||
PyComponent_LinkPyType ();
|
||||
PySegment_LinkPyType ();
|
||||
PyPad_LinkPyType ();
|
||||
|
@ -600,6 +572,7 @@ extern "C" {
|
|||
PYTYPE_READY ( Technology )
|
||||
PYTYPE_READY ( Library )
|
||||
PYTYPE_READY ( Entity )
|
||||
PYTYPE_READY ( Hook )
|
||||
PYTYPE_READY ( Material )
|
||||
PYTYPE_READY ( Layer )
|
||||
PYTYPE_READY ( LayerMask )
|
||||
|
@ -663,6 +636,7 @@ extern "C" {
|
|||
__cs.addType ( "ent" , &PyTypeEntity , "<Entity>" , false );
|
||||
__cs.addType ( "cell" , &PyTypeCell , "<Cell>" , false, "ent" );
|
||||
__cs.addType ( "cellCol" , &PyTypeCellCollection , "<CellCollection>" , false );
|
||||
__cs.addType ( "hook" , &PyTypeHook , "<Hook>" , false );
|
||||
__cs.addType ( "comp" , &PyTypeComponent , "<Component>" , false, "ent" );
|
||||
__cs.addType ( "compCol" , &PyTypeComponentCollection , "<ComponentCollection>" , false );
|
||||
__cs.addType ( "contact" , &PyTypeContact , "<Contact>" , false, "comp" );
|
||||
|
@ -753,6 +727,8 @@ extern "C" {
|
|||
Py_INCREF ( &PyTypeQuery );
|
||||
PyModule_AddObject ( module, "Query" , (PyObject*)&PyTypeQuery );
|
||||
|
||||
Py_INCREF ( &PyTypeHook );
|
||||
PyModule_AddObject ( module, "Hook" , (PyObject*)&PyTypeHook );
|
||||
Py_INCREF ( &PyTypeRoutingPad );
|
||||
PyModule_AddObject ( module, "RoutingPad" , (PyObject*)&PyTypeRoutingPad );
|
||||
Py_INCREF ( &PyTypeVertical );
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyHook.h"
|
||||
#include "hurricane/isobar/PyNet.h"
|
||||
#include "hurricane/isobar/PyLayer.h"
|
||||
#include "hurricane/isobar/PySegment.h"
|
||||
|
@ -58,11 +59,34 @@ extern "C" {
|
|||
DirectGetLongAttribute(PySegment_getWidth ,getWidth ,PySegment,Segment)
|
||||
DirectSetLongAttribute(PySegment_setWidth ,setWidth ,"Segment.setWidth",PySegment,Segment)
|
||||
DirectVoidMethod(Segment,segment,invert)
|
||||
accessorHook(getSourceHook,PySegment,Segment)
|
||||
accessorHook(getTargetHook,PySegment,Segment)
|
||||
|
||||
// Standard Destroy (Attribute).
|
||||
DBoDestroyAttribute(PySegment_destroy, PySegment)
|
||||
|
||||
|
||||
static PyObject* PySegment_getOppositeHook ( PySegment *self, PyObject* args )
|
||||
{
|
||||
trace << "PySegment_getOppositeHook()" << endl;
|
||||
METHOD_HEAD ( "Segment.getOppositeHook()" )
|
||||
|
||||
PyHook* pyReturnHook = PyObject_NEW( PyHook, &PyTypeHook );
|
||||
if (pyReturnHook == NULL) return NULL;
|
||||
|
||||
PyObject* pyHook = NULL;
|
||||
if (not PyArg_ParseTuple(args,"O:Hook.merge", &pyHook)) return NULL;
|
||||
|
||||
Hook* hook = PYHOOK_O(pyHook);
|
||||
|
||||
HTRY
|
||||
pyReturnHook->_object = segment->getOppositeHook( hook );
|
||||
HCATCH
|
||||
|
||||
return (PyObject*)pyReturnHook;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PySegment_getSource ( PySegment *self )
|
||||
{
|
||||
trace << "PySegment_getSource()" << endl;
|
||||
|
@ -139,7 +163,10 @@ extern "C" {
|
|||
// PySegment Attribute Method table.
|
||||
|
||||
PyMethodDef PySegment_Methods[] =
|
||||
{ { "getSource" , (PyCFunction)PySegment_getSource , METH_NOARGS , "Return the Segment source component (or None)." }
|
||||
{ { "getSourceHook" , (PyCFunction)PySegment_getSourceHook , METH_NOARGS , "Return the nested source Hook." }
|
||||
, { "getTargetHook" , (PyCFunction)PySegment_getTargetHook , METH_NOARGS , "Return the nested target Hook." }
|
||||
, { "getOppositeHook" , (PyCFunction)PySegment_getOppositeHook , METH_VARARGS, "Return the nested Hook opposite of the argument hook." }
|
||||
, { "getSource" , (PyCFunction)PySegment_getSource , METH_NOARGS , "Return the Segment source component (or None)." }
|
||||
, { "getTarget" , (PyCFunction)PySegment_getTarget , METH_NOARGS , "Return the Segment target component (or None)." }
|
||||
, { "getSourceX" , (PyCFunction)PySegment_getSourceX , METH_NOARGS , "Return the Segment source X value." }
|
||||
, { "getSourceY" , (PyCFunction)PySegment_getSourceY , METH_NOARGS , "Return the Segment source Y value." }
|
||||
|
|
|
@ -473,6 +473,23 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
#define accessorHook(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
|
||||
static PyObject* PY_SELF_TYPE##_##FUNC_NAME( PY_SELF_TYPE *self ) \
|
||||
{ \
|
||||
trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \
|
||||
\
|
||||
PyHook* pyHook = PyObject_NEW( PyHook, &PyTypeHook ); \
|
||||
if (pyHook == NULL) return NULL; \
|
||||
\
|
||||
HTRY \
|
||||
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \
|
||||
pyHook->_object = cobject->FUNC_NAME(); \
|
||||
HCATCH \
|
||||
\
|
||||
return (PyObject*)pyHook; \
|
||||
} \
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Attribute Method Macro For Booleans.
|
||||
|
||||
|
|
Loading…
Reference in New Issue