From 5faaf81b597777ddb416a481d7f0edcd2a8d3233 Mon Sep 17 00:00:00 2001 From: Christophe Alexandre Date: Sun, 12 Oct 2008 13:37:33 +0000 Subject: [PATCH] simplifications and improvments in Isobar --- hurricane/src/hviewer/CMakeLists.txt | 6 + hurricane/src/isobar/ProxyProperty.cpp | 5 +- hurricane/src/isobar/PyBox.cpp | 2 +- hurricane/src/isobar/PyCell.cpp | 25 +-- hurricane/src/isobar/PyCellLocator.cpp | 2 +- hurricane/src/isobar/PyComponent.cpp | 2 +- hurricane/src/isobar/PyComponentLocator.cpp | 2 +- hurricane/src/isobar/PyContact.cpp | 4 +- hurricane/src/isobar/PyDataBase.cpp | 24 +-- hurricane/src/isobar/PyEntity.cpp | 2 +- hurricane/src/isobar/PyHorizontal.cpp | 6 +- hurricane/src/isobar/PyHurricane.cpp | 4 - hurricane/src/isobar/PyHyperNet.cpp | 2 +- hurricane/src/isobar/PyInstance.cpp | 10 +- hurricane/src/isobar/PyInstanceLocator.cpp | 2 +- hurricane/src/isobar/PyLayer.cpp | 4 +- hurricane/src/isobar/PyLibrary.cpp | 4 +- hurricane/src/isobar/PyName.cpp | 2 +- hurricane/src/isobar/PyNet.cpp | 4 +- hurricane/src/isobar/PyNetLocator.cpp | 2 +- hurricane/src/isobar/PyOccurrence.cpp | 2 +- hurricane/src/isobar/PyOccurrenceLocator.cpp | 2 +- hurricane/src/isobar/PyPath.cpp | 4 +- hurricane/src/isobar/PyPin.cpp | 4 +- hurricane/src/isobar/PyPinLocator.cpp | 4 +- hurricane/src/isobar/PyPlug.cpp | 6 +- hurricane/src/isobar/PyPlugLocator.cpp | 2 +- hurricane/src/isobar/PyPoint.cpp | 2 +- hurricane/src/isobar/PyReference.cpp | 7 +- hurricane/src/isobar/PyReferenceLocator.cpp | 2 +- hurricane/src/isobar/PySegment.cpp | 2 +- hurricane/src/isobar/PySegmentLocator.cpp | 4 +- hurricane/src/isobar/PyTechnology.cpp | 4 +- hurricane/src/isobar/PyTransformation.cpp | 2 +- hurricane/src/isobar/PyVertical.cpp | 11 +- .../isobar/hurricane/isobar/ProxyProperty.h | 6 +- .../src/isobar/hurricane/isobar/PyHurricane.h | 198 +++++------------- 37 files changed, 133 insertions(+), 243 deletions(-) diff --git a/hurricane/src/hviewer/CMakeLists.txt b/hurricane/src/hviewer/CMakeLists.txt index fcad0097..debc7de6 100644 --- a/hurricane/src/hviewer/CMakeLists.txt +++ b/hurricane/src/hviewer/CMakeLists.txt @@ -4,6 +4,11 @@ include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane ${HURRICANE_SOURCE_DIR}/src/hviewer ) + set ( hierarchy_viewer_cpps hierarchy/HierarchyScene.cpp + hierarchy/HierarchyItem.cpp + hierarchy/Arrow.cpp + ) + set ( mocincludes hurricane/viewer/HPaletteEntry.h hurricane/viewer/LayerPaletteEntry.h hurricane/viewer/HExtensionPaletteEntry.h @@ -82,6 +87,7 @@ HNetlistModel.cpp HNetlist.cpp HDisplayFilter.cpp + ${hierarchy_viewer_cpps} ) qt4_wrap_cpp ( MOC_SRCS ${mocincludes} ) diff --git a/hurricane/src/isobar/ProxyProperty.cpp b/hurricane/src/isobar/ProxyProperty.cpp index 7b070d8e..ee549b97 100644 --- a/hurricane/src/isobar/ProxyProperty.cpp +++ b/hurricane/src/isobar/ProxyProperty.cpp @@ -98,7 +98,7 @@ namespace { // x-----------------------------------------------------------------x - Name ProxyProperty::_name = "::ProxyProperty"; + Name ProxyProperty::_name = "Isobar::ProxyProperty"; int ProxyProperty::_offset = -1; @@ -124,8 +124,7 @@ ProxyProperty::ProxyProperty ( void* shadow ) // ------------------------------------------------------------------- // Constructor : "ProxyProperty::create ()". -ProxyProperty* ProxyProperty::create ( void* shadow ) -{ +ProxyProperty* ProxyProperty::create ( void* shadow ) { ProxyProperty* property = new ProxyProperty ( shadow ); if ( property == NULL ) diff --git a/hurricane/src/isobar/PyBox.cpp b/hurricane/src/isobar/PyBox.cpp index 93f3467f..720a8c3b 100644 --- a/hurricane/src/isobar/PyBox.cpp +++ b/hurricane/src/isobar/PyBox.cpp @@ -494,7 +494,7 @@ extern "C" { // --------------------------------------------------------------- // PyBox Object Definitions. - PyTypeRootObjectDefinitions(Box) + PyTypeObjectDefinitions(Box) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyCell.cpp b/hurricane/src/isobar/PyCell.cpp index 166c8ed3..c6e2245c 100644 --- a/hurricane/src/isobar/PyCell.cpp +++ b/hurricane/src/isobar/PyCell.cpp @@ -656,26 +656,7 @@ extern "C" { return PyCell_Link(cell); } - static void PyCell_DeAlloc ( PyCell *self ) { - trace << "PyDbObject_DeAlloc(" << hex << self << ") " - << self->ACCESS_OBJECT << endl; - - if ( self->ACCESS_OBJECT != NULL ) { - ProxyProperty* proxy = dynamic_cast - ( self->ACCESS_OBJECT->getProperty ( ProxyProperty::getPropertyName() ) ); \ - if (proxy == NULL) { - ostringstream message; - message << "deleting a Python object with no Proxy attached "; - cerr << "yes man" << endl; - PyErr_SetString ( ProxyError, message.str().c_str() ); - } - self->ACCESS_OBJECT->remove ( proxy ); - } else { - cerr << "ACCESS_OBJECT is NULL" << endl; - } - PyObject_DEL ( self ); - } - + DBoDeleteMethod(Cell) PyTypeObjectLinkPyType(Cell) PyTypeObjectConstructor(Cell) @@ -688,12 +669,12 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyCell_Link,PyCell,PyTypeCell,Cell) + DBoLinkCreateMethod(Cell) // --------------------------------------------------------------- // PyCell Object Definitions. - PyTypeInheritedObjectDefinitions(Cell, Entity) + PyTypeObjectDefinitions(Cell) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyCellLocator.cpp b/hurricane/src/isobar/PyCellLocator.cpp index 8c379293..215fd110 100644 --- a/hurricane/src/isobar/PyCellLocator.cpp +++ b/hurricane/src/isobar/PyCellLocator.cpp @@ -134,7 +134,7 @@ extern "C" { // --------------------------------------------------------------- // PyCellLocator Object Definitions. - PyTypeRootObjectDefinitions(CellLocator) + PyTypeObjectDefinitions(CellLocator) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyComponent.cpp b/hurricane/src/isobar/PyComponent.cpp index 6f02cf80..a6f76c68 100644 --- a/hurricane/src/isobar/PyComponent.cpp +++ b/hurricane/src/isobar/PyComponent.cpp @@ -207,7 +207,7 @@ extern "C" { // --------------------------------------------------------------- // PyComponent Object Definitions. - PyTypeInheritedObjectDefinitions(Component, Entity) + PyTypeObjectDefinitions(Component) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyComponentLocator.cpp b/hurricane/src/isobar/PyComponentLocator.cpp index af9fa0bb..ea0b21b1 100644 --- a/hurricane/src/isobar/PyComponentLocator.cpp +++ b/hurricane/src/isobar/PyComponentLocator.cpp @@ -127,7 +127,7 @@ extern "C" { // --------------------------------------------------------------- // PyComponentLocator Object Definitions. - PyTypeRootObjectDefinitions(ComponentLocator) + PyTypeObjectDefinitions(ComponentLocator) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyContact.cpp b/hurricane/src/isobar/PyContact.cpp index 1350a51c..9c45b375 100644 --- a/hurricane/src/isobar/PyContact.cpp +++ b/hurricane/src/isobar/PyContact.cpp @@ -222,14 +222,14 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyContact_Link,PyContact,PyTypeContact,Contact) + DBoLinkCreateMethod(Contact) // --------------------------------------------------------------- // PyContact Object Definitions. - PyTypeInheritedObjectDefinitions(Contact, Component) + PyTypeObjectDefinitions(Contact) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyDataBase.cpp b/hurricane/src/isobar/PyDataBase.cpp index 4872b47c..028917ef 100644 --- a/hurricane/src/isobar/PyDataBase.cpp +++ b/hurricane/src/isobar/PyDataBase.cpp @@ -43,7 +43,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./PyCataBase.cpp" | +// | C++ Module : "./PyDataBase.cpp" | // | *************************************************************** | // | U p d a t e s | // | | @@ -63,25 +63,25 @@ using namespace Hurricane; extern "C" { -# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DataBase,db,function) +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DataBase,db,function) // x=================================================================x // | "PyDataBase" Python Module Code Part | // x=================================================================x -# if defined(__PYTHON_MODULE__) +#if defined(__PYTHON_MODULE__) - // x-------------------------------------------------------------x - // | "PyDataBase" Attribute Methods | - // x-------------------------------------------------------------x +// x-------------------------------------------------------------x +// | "PyDataBase" Attribute Methods | +// x-------------------------------------------------------------x - // --------------------------------------------------------------- - // Attribute Method : "PyDataBase_getDataBase ()" +// --------------------------------------------------------------- +// Attribute Method : "PyDataBase_getDataBase ()" PyObject* PyDataBase_getDataBase ( PyObject* module ) { trace << "PyDataBase_getDataBase()" << endl; @@ -132,7 +132,7 @@ extern "C" { PyMethodDef PyDataBase_Methods[] = { { "getTechnology", (PyCFunction)PyDataBase_getTechnology, METH_NOARGS, "Return the Technology" } - , { "destroy" , (PyCFunction)PyDataBase_destroy , METH_NOARGS + , { "destroy" , (PyCFunction)PyDataBase_destroy , METH_NOARGS , "Destroy associated hurricane object The python object remains." } , {NULL, NULL, 0, NULL} /* sentinel */ }; @@ -166,19 +166,19 @@ extern "C" { // x=================================================================x -// | "PyCell" Shared Library Code Part | +// | "PyDataBase" Shared Library Code Part | // x=================================================================x // Link/Creation Method. - DBoLinkCreateMethod(PyDataBase_Link,PyDataBase,PyTypeDataBase,DataBase) + DBoLinkCreateMethod(DataBase) // --------------------------------------------------------------- // PyDataBase Object Definitions. - PyTypeRootObjectDefinitions(DataBase) + PyTypeObjectDefinitions(DataBase) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyEntity.cpp b/hurricane/src/isobar/PyEntity.cpp index 9e74710d..5a607b35 100644 --- a/hurricane/src/isobar/PyEntity.cpp +++ b/hurricane/src/isobar/PyEntity.cpp @@ -181,7 +181,7 @@ extern "C" { } - PyTypeRootObjectDefinitions(Entity) + PyTypeObjectDefinitions(Entity) // --------------------------------------------------------------- // PyEntity Object Definitions. diff --git a/hurricane/src/isobar/PyHorizontal.cpp b/hurricane/src/isobar/PyHorizontal.cpp index 4ef48a5a..ea43b013 100644 --- a/hurricane/src/isobar/PyHorizontal.cpp +++ b/hurricane/src/isobar/PyHorizontal.cpp @@ -211,15 +211,13 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyHorizontal_Link,PyHorizontal,PyTypeHorizontal,Horizontal) - - + DBoLinkCreateMethod(Horizontal) // --------------------------------------------------------------- // PyHorizontal Object Definitions. - PyTypeInheritedObjectDefinitions(Horizontal, Segment) + PyTypeObjectDefinitions(Horizontal) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index 15503216..9a2b511e 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -135,10 +135,6 @@ using namespace Hurricane; = "comp"; ConverterState __cs = ConverterState (); int __objectOffset = offsetof ( PyPoint, _object ); - map H2PMap; - - - // x-----------------------------------------------------------------x // | "PyHurricane" C++ Functions | diff --git a/hurricane/src/isobar/PyHyperNet.cpp b/hurricane/src/isobar/PyHyperNet.cpp index 1342cf74..a3a7d982 100644 --- a/hurricane/src/isobar/PyHyperNet.cpp +++ b/hurricane/src/isobar/PyHyperNet.cpp @@ -206,7 +206,7 @@ extern "C" { // --------------------------------------------------------------- // PyHyperNet Object Definitions. - PyTypeRootObjectDefinitions(HyperNet) + PyTypeObjectDefinitions(HyperNet) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyInstance.cpp b/hurricane/src/isobar/PyInstance.cpp index 0970b446..2efaa364 100644 --- a/hurricane/src/isobar/PyInstance.cpp +++ b/hurricane/src/isobar/PyInstance.cpp @@ -489,18 +489,16 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyInstance_Link,PyInstance,PyTypeInstance,Instance) - - + DBoLinkCreateMethod(Instance) // --------------------------------------------------------------- // PyInstance Object Definitions. - PyTypeInheritedObjectDefinitions(Instance, Entity) + PyTypeObjectDefinitions(Instance) -# endif // End of Shared Library Code Part. +#endif // End of Shared Library Code Part. } // End of extern "C". @@ -509,5 +507,3 @@ extern "C" { } // End of Isobar namespace. - - diff --git a/hurricane/src/isobar/PyInstanceLocator.cpp b/hurricane/src/isobar/PyInstanceLocator.cpp index 5b880509..0048fd13 100644 --- a/hurricane/src/isobar/PyInstanceLocator.cpp +++ b/hurricane/src/isobar/PyInstanceLocator.cpp @@ -133,7 +133,7 @@ extern "C" { // --------------------------------------------------------------- // PyInstanceLocator Object Definitions. - PyTypeRootObjectDefinitions(InstanceLocator) + PyTypeObjectDefinitions(InstanceLocator) diff --git a/hurricane/src/isobar/PyLayer.cpp b/hurricane/src/isobar/PyLayer.cpp index e30d2586..17c28f76 100644 --- a/hurricane/src/isobar/PyLayer.cpp +++ b/hurricane/src/isobar/PyLayer.cpp @@ -179,7 +179,7 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyLayer_Link,PyLayer,PyTypeLayer,Layer) + DBoLinkCreateMethod(Layer) @@ -187,7 +187,7 @@ extern "C" { // --------------------------------------------------------------- // PyLayer Object Definitions. - PyTypeRootObjectDefinitions(Layer) + PyTypeObjectDefinitions(Layer) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyLibrary.cpp b/hurricane/src/isobar/PyLibrary.cpp index 0bbcb1c2..b91d3a60 100644 --- a/hurricane/src/isobar/PyLibrary.cpp +++ b/hurricane/src/isobar/PyLibrary.cpp @@ -206,7 +206,7 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyLibrary_Link,PyLibrary,PyTypeLibrary,Library) + DBoLinkCreateMethod(Library) @@ -214,7 +214,7 @@ extern "C" { // --------------------------------------------------------------- // PyLibrary Object Definitions. - PyTypeRootObjectDefinitions(Library) + PyTypeObjectDefinitions(Library) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyName.cpp b/hurricane/src/isobar/PyName.cpp index 06fd107d..5eb8b21a 100644 --- a/hurricane/src/isobar/PyName.cpp +++ b/hurricane/src/isobar/PyName.cpp @@ -148,7 +148,7 @@ extern "C" { // --------------------------------------------------------------- // PyName Object Definitions. - PyTypeRootObjectDefinitions(Name) + PyTypeObjectDefinitions(Name) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyNet.cpp b/hurricane/src/isobar/PyNet.cpp index 38338e3b..95776ed1 100644 --- a/hurricane/src/isobar/PyNet.cpp +++ b/hurricane/src/isobar/PyNet.cpp @@ -587,7 +587,7 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyNet_Link,PyNet,PyTypeNet,Net) + DBoLinkCreateMethod(Net) @@ -595,7 +595,7 @@ extern "C" { // --------------------------------------------------------------- // PyNet Object Definitions. - PyTypeInheritedObjectDefinitions(Net, Entity) + PyTypeObjectDefinitions(Net) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyNetLocator.cpp b/hurricane/src/isobar/PyNetLocator.cpp index 9ca5e3f4..7d754e36 100644 --- a/hurricane/src/isobar/PyNetLocator.cpp +++ b/hurricane/src/isobar/PyNetLocator.cpp @@ -128,7 +128,7 @@ extern "C" { // --------------------------------------------------------------- // PyNetLocator Object Definitions. - PyTypeRootObjectDefinitions(NetLocator) + PyTypeObjectDefinitions(NetLocator) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyOccurrence.cpp b/hurricane/src/isobar/PyOccurrence.cpp index e567f830..88b2c8d0 100644 --- a/hurricane/src/isobar/PyOccurrence.cpp +++ b/hurricane/src/isobar/PyOccurrence.cpp @@ -298,7 +298,7 @@ extern "C" { // --------------------------------------------------------------- // PyOccurrence Object Definitions. - PyTypeRootObjectDefinitions(Occurrence) + PyTypeObjectDefinitions(Occurrence) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyOccurrenceLocator.cpp b/hurricane/src/isobar/PyOccurrenceLocator.cpp index f28ca975..b6152037 100644 --- a/hurricane/src/isobar/PyOccurrenceLocator.cpp +++ b/hurricane/src/isobar/PyOccurrenceLocator.cpp @@ -178,7 +178,7 @@ extern "C" { // --------------------------------------------------------------- // PyOccurrenceLocator Object Definitions. - PyTypeRootObjectDefinitions(OccurrenceLocator) + PyTypeObjectDefinitions(OccurrenceLocator) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyPath.cpp b/hurricane/src/isobar/PyPath.cpp index a79ccde2..aaa9bf43 100644 --- a/hurricane/src/isobar/PyPath.cpp +++ b/hurricane/src/isobar/PyPath.cpp @@ -367,10 +367,10 @@ extern "C" { // --------------------------------------------------------------- // PyPath Object Definitions. - PyTypeRootObjectDefinitions(Path) + PyTypeObjectDefinitions(Path) -# endif // End of Shared Library Code Part. +#endif // End of Shared Library Code Part. } // End of extern "C". diff --git a/hurricane/src/isobar/PyPin.cpp b/hurricane/src/isobar/PyPin.cpp index b928d0c5..a1579fb0 100644 --- a/hurricane/src/isobar/PyPin.cpp +++ b/hurricane/src/isobar/PyPin.cpp @@ -238,7 +238,7 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyPin_Link,PyPin,PyTypePin,Pin) + DBoLinkCreateMethod(Pin) @@ -246,7 +246,7 @@ extern "C" { // --------------------------------------------------------------- // PyPin Object Definitions. - PyTypeInheritedObjectDefinitions(Pin, Contact) + PyTypeObjectDefinitions(Pin) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyPinLocator.cpp b/hurricane/src/isobar/PyPinLocator.cpp index 309287ec..b8601859 100644 --- a/hurricane/src/isobar/PyPinLocator.cpp +++ b/hurricane/src/isobar/PyPinLocator.cpp @@ -135,9 +135,9 @@ extern "C" { // PyPinLocator Object Definitions. - PyTypeRootObjectDefinitions(PinLocator) + PyTypeObjectDefinitions(PinLocator) -# endif // End of Shared Library Code Part. +#endif // End of Shared Library Code Part. } // End of extern "C". diff --git a/hurricane/src/isobar/PyPlug.cpp b/hurricane/src/isobar/PyPlug.cpp index 396de3a9..9aaa6776 100644 --- a/hurricane/src/isobar/PyPlug.cpp +++ b/hurricane/src/isobar/PyPlug.cpp @@ -202,16 +202,16 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyPlug_Link,PyPlug,PyTypePlug,Plug) + DBoLinkCreateMethod(Plug) // --------------------------------------------------------------- // PyPlug Object Definitions. - PyTypeInheritedObjectDefinitions(Plug, Component) + PyTypeObjectDefinitions(Plug) -# endif // End of Shared Library Code Part. +#endif // End of Shared Library Code Part. } // End of extern "C". diff --git a/hurricane/src/isobar/PyPlugLocator.cpp b/hurricane/src/isobar/PyPlugLocator.cpp index b6440eff..45942c97 100644 --- a/hurricane/src/isobar/PyPlugLocator.cpp +++ b/hurricane/src/isobar/PyPlugLocator.cpp @@ -128,7 +128,7 @@ extern "C" { // --------------------------------------------------------------- // PyPlugLocator Object Definitions. - PyTypeRootObjectDefinitions(PlugLocator) + PyTypeObjectDefinitions(PlugLocator) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyPoint.cpp b/hurricane/src/isobar/PyPoint.cpp index 24b57972..1f84e589 100644 --- a/hurricane/src/isobar/PyPoint.cpp +++ b/hurricane/src/isobar/PyPoint.cpp @@ -184,7 +184,7 @@ extern "C" { // --------------------------------------------------------------- // PyPoint Object Definitions. - PyTypeRootObjectDefinitions(Point) + PyTypeObjectDefinitions(Point) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyReference.cpp b/hurricane/src/isobar/PyReference.cpp index e69ee9d3..9718207b 100644 --- a/hurricane/src/isobar/PyReference.cpp +++ b/hurricane/src/isobar/PyReference.cpp @@ -242,16 +242,15 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyReference_Link,PyReference,PyTypeReference,Reference) - + DBoLinkCreateMethod(Reference) // --------------------------------------------------------------- // PyReference Object Definitions. - PyTypeInheritedObjectDefinitions(Reference, Entity) + PyTypeObjectDefinitions(Reference) -# endif // End of Shared Library Code Part. +#endif // End of Shared Library Code Part. } // End of extern "C". diff --git a/hurricane/src/isobar/PyReferenceLocator.cpp b/hurricane/src/isobar/PyReferenceLocator.cpp index 49d822d9..ca1ce125 100644 --- a/hurricane/src/isobar/PyReferenceLocator.cpp +++ b/hurricane/src/isobar/PyReferenceLocator.cpp @@ -128,7 +128,7 @@ extern "C" { // --------------------------------------------------------------- // PyReferenceLocator Object Definitions. - PyTypeRootObjectDefinitions(ReferenceLocator) + PyTypeObjectDefinitions(ReferenceLocator) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PySegment.cpp b/hurricane/src/isobar/PySegment.cpp index 0005e10d..0552e3f4 100644 --- a/hurricane/src/isobar/PySegment.cpp +++ b/hurricane/src/isobar/PySegment.cpp @@ -175,7 +175,7 @@ extern "C" { // PySegment Object Definitions. - PyTypeInheritedObjectDefinitions(Segment, Component) + PyTypeObjectDefinitions(Segment) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PySegmentLocator.cpp b/hurricane/src/isobar/PySegmentLocator.cpp index 98d9d603..cf3e265e 100644 --- a/hurricane/src/isobar/PySegmentLocator.cpp +++ b/hurricane/src/isobar/PySegmentLocator.cpp @@ -135,10 +135,10 @@ extern "C" { // --------------------------------------------------------------- // PySegmentLocator Object Definitions. - PyTypeRootObjectDefinitions(SegmentLocator) + PyTypeObjectDefinitions(SegmentLocator) -# endif // End of Shared Library Code Part. +#endif // End of Shared Library Code Part. } // End of extern "C". diff --git a/hurricane/src/isobar/PyTechnology.cpp b/hurricane/src/isobar/PyTechnology.cpp index aefdaef7..353f57cb 100644 --- a/hurricane/src/isobar/PyTechnology.cpp +++ b/hurricane/src/isobar/PyTechnology.cpp @@ -185,11 +185,11 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyTechnology_Link,PyTechnology,PyTypeTechnology,Technology) + DBoLinkCreateMethod(Technology) // --------------------------------------------------------------- // PyTechnology Object Definitions. - PyTypeRootObjectDefinitions(Technology) + PyTypeObjectDefinitions(Technology) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyTransformation.cpp b/hurricane/src/isobar/PyTransformation.cpp index 190e0301..a4b52dfd 100644 --- a/hurricane/src/isobar/PyTransformation.cpp +++ b/hurricane/src/isobar/PyTransformation.cpp @@ -608,7 +608,7 @@ extern "C" { // --------------------------------------------------------------- // PyTransformation Object Definitions. - PyTypeRootObjectDefinitions(Transformation) + PyTypeObjectDefinitions(Transformation) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyVertical.cpp b/hurricane/src/isobar/PyVertical.cpp index aa343ed9..d8af0196 100644 --- a/hurricane/src/isobar/PyVertical.cpp +++ b/hurricane/src/isobar/PyVertical.cpp @@ -185,7 +185,7 @@ extern "C" { HCATCH - return PyVertical_Link ( vertical ); + return PyVertical_Link(vertical); } DBoDeleteMethod(Vertical) @@ -203,17 +203,14 @@ extern "C" { // Link/Creation Method. - DBoLinkCreateMethod(PyVertical_Link,PyVertical,PyTypeVertical,Vertical) - - - + DBoLinkCreateMethod(Vertical) // --------------------------------------------------------------- // PyVertical Object Definitions. - PyTypeInheritedObjectDefinitions(Vertical, Segment) + PyTypeObjectDefinitions(Vertical) -# endif // End of Shared Library Code Part. +#endif // End of Shared Library Code Part. } // End of extern "C". diff --git a/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h b/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h index ec756c74..c7be318f 100644 --- a/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h +++ b/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h @@ -64,7 +64,7 @@ namespace Isobar { -using namespace Hurricane; +using namespace Hurricane; @@ -72,9 +72,9 @@ using namespace Hurricane; // ------------------------------------------------------------------- // Miscellaneous. -#define F_PY_OWNED ( 1 << 0 ) +#define F_PY_OWNED ( 1 << 0 ) -#define CHECK_OFFSET(PY_STRUCT) \ +#define CHECK_OFFSET(PY_STRUCT) \ if ( ProxyProperty::getOffset() < 0 ) \ ProxyProperty::SetOffset ( (unsigned long)(&(PY_STRUCT->ACCESS_OBJECT)) \ - (unsigned long)PY_STRUCT ); diff --git a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h index 5462434b..810dcf81 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h @@ -72,11 +72,6 @@ namespace Isobar { -#if PY_VERSION_HEX < 0x02040000 - #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None -#endif - - using namespace std; @@ -212,19 +207,16 @@ extern "C" { // Miscellaneous. -# define DEFERRED_ADDRESS(ADDR) 0 - - // This macro must be redefined in derived classes. // Example : _baseOject._object -# define ACCESS_OBJECT _object -# define ACCESS_CLASS(_pyObject) _pyObject +#define ACCESS_OBJECT _object +#define ACCESS_CLASS(_pyObject) _pyObject -# define LOAD_CONSTANT(CONSTANT_VALUE,CONSTANT_NAME) \ - constant = PyInt_FromLong ( (long)CONSTANT_VALUE ); \ - PyDict_SetItemString ( dictionnary, CONSTANT_NAME, constant ); \ - Py_DECREF ( constant ); +#define LOAD_CONSTANT(CONSTANT_VALUE,CONSTANT_NAME) \ + constant = PyInt_FromLong ( (long)CONSTANT_VALUE ); \ + PyDict_SetItemString ( dictionnary, CONSTANT_NAME, constant ); \ + Py_DECREF ( constant ); @@ -232,15 +224,15 @@ extern "C" { // ------------------------------------------------------------------- // Generic Method Header. -# define GENERIC_METHOD_HEAD(SELF_TYPE,SELF_OBJECT,function) \ - if ( self->ACCESS_OBJECT == NULL ) { \ +#define GENERIC_METHOD_HEAD(SELF_TYPE,SELF_OBJECT,function) \ + if ( self->ACCESS_OBJECT == NULL ) { \ PyErr_SetString ( ProxyError, "Attempt to call " function " on an unbound hurricane object" ); \ - return ( NULL ); \ - } \ - SELF_TYPE* SELF_OBJECT = dynamic_cast(self->ACCESS_OBJECT); \ - if ( self->ACCESS_OBJECT == NULL ) { \ + return ( NULL ); \ + } \ + SELF_TYPE* SELF_OBJECT = dynamic_cast(self->ACCESS_OBJECT);\ + if ( self->ACCESS_OBJECT == NULL ) { \ PyErr_SetString ( ProxyError, "Invalid dynamic_cast while calling " function "" ); \ - return ( NULL ); \ + return ( NULL ); \ } @@ -249,13 +241,13 @@ extern "C" { // ------------------------------------------------------------------- // Attribute Method Macro For Checking Bound. -# define GetBoundStateAttribute(PY_FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ - static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ - { \ - long result = 1; \ - if ( self->ACCESS_OBJECT == NULL ) result = 0; \ - \ - return ( Py_BuildValue ("i",result) ); \ +#define GetBoundStateAttribute(PY_FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ + { \ + long result = 1; \ + if ( self->ACCESS_OBJECT == NULL ) result = 0; \ + \ + return ( Py_BuildValue ("i",result) ); \ } @@ -365,7 +357,7 @@ extern "C" { // ------------------------------------------------------------------- // Attribute Method For getting Attributes. -# define DirectGetAttrMethod(PY_FUNC_NAME,PY_OBJECT_METHODS) \ +#define DirectGetAttrMethod(PY_FUNC_NAME,PY_OBJECT_METHODS) \ static PyObject* PY_FUNC_NAME ( PyObject* self, char* name ) \ { \ return ( Py_FindMethod(PY_OBJECT_METHODS,self,name) ); \ @@ -389,7 +381,7 @@ extern "C" { // ------------------------------------------------------------------- // Locator Attribute Method For Progress. -# define LocatorProgressAttribute(SELF_TYPE) \ +#define LocatorProgressAttribute(SELF_TYPE) \ static PyObject* Py##SELF_TYPE##Locator_progress ( Py##SELF_TYPE##Locator *self ) \ { \ trace << #SELF_TYPE "Locator.progress()" << endl; \ @@ -553,7 +545,7 @@ extern "C" { PyErr_SetString ( ProxyError, message.str().c_str() ); \ return ( NULL ); \ } \ - ProxyProperty* proxy = dynamic_cast \ + ProxyProperty* proxy = static_cast \ ( self->ACCESS_OBJECT->getProperty ( ProxyProperty::getPropertyName() ) ); \ if (proxy == NULL) { \ ostringstream message; \ @@ -569,31 +561,31 @@ extern "C" { // ------------------------------------------------------------------- // Attribute Macro For BDo Link/Creation. -# define DBoLinkCreateMethod(PY_FUNC_NAME,PY_SELF_TYPE,PY_SELF_CLASS,SELF_TYPE) \ - PyObject* PY_FUNC_NAME ( SELF_TYPE* object ) \ - { \ - if ( object == NULL ) \ - Py_RETURN_NONE; \ - PY_SELF_TYPE* pyObject = NULL; \ - HTRY \ - ProxyProperty* proxy = dynamic_cast \ - ( object->getProperty ( ProxyProperty::getPropertyName() ) ); \ - if ( proxy == NULL ) { \ - pyObject = PyObject_NEW(PY_SELF_TYPE, &PY_SELF_CLASS); \ - if (pyObject == NULL) { return NULL; } \ - \ - proxy = ProxyProperty::create ( (void*)pyObject ); \ - CHECK_OFFSET ( pyObject ) \ - \ - pyObject->ACCESS_OBJECT = object; \ - object->put ( proxy ); \ - } else { \ - pyObject = (PY_SELF_TYPE*)proxy->getShadow (); \ - Py_INCREF ( ACCESS_CLASS(pyObject) ); \ - } \ - HCATCH \ - \ - return ( (PyObject*)pyObject ); \ +#define DBoLinkCreateMethod(SELF_TYPE) \ + PyObject* Py##SELF_TYPE##_Link ( SELF_TYPE* object ) { \ + if ( object == NULL ) { \ + Py_RETURN_NONE; \ + } \ + Py##SELF_TYPE* pyObject = NULL; \ + HTRY \ + ProxyProperty* proxy = static_cast \ + ( object->getProperty ( ProxyProperty::getPropertyName() ) ); \ + if ( proxy == NULL ) { \ + pyObject = PyObject_NEW(Py##SELF_TYPE, &PyType##SELF_TYPE); \ + if (pyObject == NULL) { return NULL; } \ + \ + proxy = ProxyProperty::create ( (void*)pyObject ); \ + CHECK_OFFSET ( pyObject ) \ + \ + pyObject->ACCESS_OBJECT = object; \ + object->put ( proxy ); \ + } else { \ + pyObject = (Py##SELF_TYPE*)proxy->getShadow (); \ + Py_INCREF ( ACCESS_CLASS(pyObject) ); \ + } \ + HCATCH \ + \ + return ( (PyObject*)pyObject ); \ } // ------------------------------------------------------------------- @@ -606,7 +598,7 @@ extern "C" { << self->ACCESS_OBJECT << endl; \ \ if ( self->ACCESS_OBJECT != NULL ) { \ - ProxyProperty* proxy = dynamic_cast \ + ProxyProperty* proxy = static_cast \ ( self->ACCESS_OBJECT->getProperty ( ProxyProperty::getPropertyName() ) ); \ if (proxy == NULL) { \ ostringstream message; \ @@ -692,7 +684,7 @@ extern "C" { HTRY \ if (!ParseOneArg("get" #CENGINE, args, CELL_ARG, &arg0 ) ) return ( NULL ); \ Cell* cell = PYCELL_O(arg0); \ - cengine = dynamic_cast(getCEngine(cell, Name(#CENGINE))); \ + cengine = static_cast(getCEngine(cell, Name(#CENGINE))); \ if (!cengine) { \ cengine = CENGINE::create (cell); \ } \ @@ -700,16 +692,13 @@ extern "C" { return Py##CENGINE##_Link( cengine ); \ } -// ------------------------------------------------------------------- -// Object Definitions for inherited types -// root of the inheritance tree -# define PyTypeRootObjectDefinitions(SELF_TYPE) \ +#define PyTypeObjectDefinitions(SELF_TYPE) \ PyTypeObject PyType##SELF_TYPE = \ - { PyObject_HEAD_INIT(&PyType_Type) \ - 0 /* ob_size. */ \ - , #SELF_TYPE /* tp_name. */ \ - , sizeof(Py##SELF_TYPE) /* tp_basicsize. */ \ + { PyObject_HEAD_INIT(NULL) \ + 0 /* ob_size. */ \ + , "Hurricane.##SELF_TYPE" /* tp_name. */ \ + , sizeof(Py##SELF_TYPE) /* tp_basicsize. */ \ , 0 /* tp_itemsize. */ \ /* methods. */ \ , 0 /* tp_dealloc. */ \ @@ -729,84 +718,13 @@ extern "C" { , 0 /* tp_as_buffer. */ \ , Py_TPFLAGS_DEFAULT \ | Py_TPFLAGS_BASETYPE /* tp_flags. */ \ - , 0 /* tp_doc. */ \ - , 0 /* tp_traverse. */ \ - , 0 /* tp_clear. */ \ - , 0 /* tp_richcompare. */ \ - , 0 /* tp_weaklistoffset.*/ \ - , 0 /* tp_iter. */ \ - , 0 /* tp_iternext. */ \ - , 0 /* tp_methods. */ \ - , 0 /* tp_members. */ \ - , 0 /* tp_getset. */ \ - , 0 /* tp_base. */ \ - , 0 /* tp_dict. */ \ - , 0 /* tp_descr_get. */ \ - , 0 /* tp_descr_set. */ \ - , 0 /* tp_dictoffset. */ \ - , 0 /* tp_init. */ \ - , 0 /* tp_alloc. */ \ - , 0 /* tp_new. */ \ - , 0 /* tp_free. */ \ - , 0 /* tp_is_gc. */ \ - }; - - -// ------------------------------------------------------------------- -// Object Definitions for types with inheritance (from Inherited or Root) - -# define PyTypeInheritedObjectDefinitions(SELF_TYPE, INHERITED_TYPE) \ - PyTypeObject PyType##SELF_TYPE = \ - { PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType##INHERITED_TYPE)) \ - 0 /* ob_size. */ \ - , #SELF_TYPE /* tp_name. */ \ - , sizeof(Py##SELF_TYPE) /* tp_basicsize. */ \ - , 0 /* tp_itemsize. */ \ - /* methods. */ \ - , 0 /* tp_dealloc. */ \ - , 0 /* tp_print. */ \ - , 0 /* tp_getattr. */ \ - , 0 /* tp_setattr. */ \ - , 0 /* tp_compare. */ \ - , 0 /* tp_repr. */ \ - , 0 /* tp_as_number. */ \ - , 0 /* tp_as_sequence. */ \ - , 0 /* tp_as_mapping. */ \ - , 0 /* tp_hash. */ \ - , 0 /* tp_call. */ \ - , 0 /* tp_str */ \ - , 0 /* tp_getattro. */ \ - , 0 /* tp_setattro. */ \ - , 0 /* tp_as_buffer. */ \ - , Py_TPFLAGS_DEFAULT \ - | Py_TPFLAGS_BASETYPE /* tp_flags. */ \ - , 0 /* tp_doc. */ \ - , 0 /* tp_traverse. */ \ - , 0 /* tp_clear. */ \ - , 0 /* tp_richcompare. */ \ - , 0 /* tp_weaklistoffset.*/ \ - , 0 /* tp_iter. */ \ - , 0 /* tp_iternext. */ \ - , 0 /* tp_methods. */ \ - , 0 /* tp_members. */ \ - , 0 /* tp_getset. */ \ - , DEFERRED_ADDRESS(&PyType##INHERITED_TYPE) \ - /* tp_base. */ \ - , 0 /* tp_dict. */ \ - , 0 /* tp_descr_get. */ \ - , 0 /* tp_descr_set. */ \ - , 0 /* tp_dictoffset. */ \ - , 0 /* tp_init. */ \ - , 0 /* tp_alloc. */ \ - , 0 /* tp_new. */ \ - , 0 /* tp_free. */ \ - , 0 /* tp_is_gc. */ \ + , "#SELF_TYPE objects" /* tp_doc. */ \ }; // ------------------------------------------------------------------- //PyType_Ready Methods -# define PYTYPE_READY(TYPE) \ +#define PYTYPE_READY(TYPE) \ if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \ cerr << "[ERROR]\n" \ << " Failed to initialize ." << endl; \ @@ -814,7 +732,7 @@ extern "C" { } -# define PYTYPE_READY_SUB(TYPE, TYPE_BASE) \ +#define PYTYPE_READY_SUB(TYPE, TYPE_BASE) \ PyType##TYPE.tp_base = &PyType##TYPE_BASE; \ if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \ cerr << "[ERROR]\n" \