simplifications and improvments in Isobar

This commit is contained in:
Christophe Alexandre 2008-10-12 13:37:33 +00:00
parent 48b0e4c3c6
commit 5faaf81b59
37 changed files with 133 additions and 243 deletions

View File

@ -4,6 +4,11 @@
include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane
${HURRICANE_SOURCE_DIR}/src/hviewer ) ${HURRICANE_SOURCE_DIR}/src/hviewer )
set ( hierarchy_viewer_cpps hierarchy/HierarchyScene.cpp
hierarchy/HierarchyItem.cpp
hierarchy/Arrow.cpp
)
set ( mocincludes hurricane/viewer/HPaletteEntry.h set ( mocincludes hurricane/viewer/HPaletteEntry.h
hurricane/viewer/LayerPaletteEntry.h hurricane/viewer/LayerPaletteEntry.h
hurricane/viewer/HExtensionPaletteEntry.h hurricane/viewer/HExtensionPaletteEntry.h
@ -82,6 +87,7 @@
HNetlistModel.cpp HNetlistModel.cpp
HNetlist.cpp HNetlist.cpp
HDisplayFilter.cpp HDisplayFilter.cpp
${hierarchy_viewer_cpps}
) )
qt4_wrap_cpp ( MOC_SRCS ${mocincludes} ) qt4_wrap_cpp ( MOC_SRCS ${mocincludes} )

View File

@ -98,7 +98,7 @@ namespace {
// x-----------------------------------------------------------------x // x-----------------------------------------------------------------x
Name ProxyProperty::_name = "::ProxyProperty"; Name ProxyProperty::_name = "Isobar::ProxyProperty";
int ProxyProperty::_offset = -1; int ProxyProperty::_offset = -1;
@ -124,8 +124,7 @@ ProxyProperty::ProxyProperty ( void* shadow )
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Constructor : "ProxyProperty::create ()". // Constructor : "ProxyProperty::create ()".
ProxyProperty* ProxyProperty::create ( void* shadow ) ProxyProperty* ProxyProperty::create ( void* shadow ) {
{
ProxyProperty* property = new ProxyProperty ( shadow ); ProxyProperty* property = new ProxyProperty ( shadow );
if ( property == NULL ) if ( property == NULL )

View File

@ -494,7 +494,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyBox Object Definitions. // PyBox Object Definitions.
PyTypeRootObjectDefinitions(Box) PyTypeObjectDefinitions(Box)
# endif // End of Shared Library Code Part. # endif // End of Shared Library Code Part.

View File

@ -656,26 +656,7 @@ extern "C" {
return PyCell_Link(cell); return PyCell_Link(cell);
} }
static void PyCell_DeAlloc ( PyCell *self ) { DBoDeleteMethod(Cell)
trace << "PyDbObject_DeAlloc(" << hex << self << ") "
<< self->ACCESS_OBJECT << endl;
if ( self->ACCESS_OBJECT != NULL ) {
ProxyProperty* proxy = dynamic_cast<ProxyProperty*>
( 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 );
}
PyTypeObjectLinkPyType(Cell) PyTypeObjectLinkPyType(Cell)
PyTypeObjectConstructor(Cell) PyTypeObjectConstructor(Cell)
@ -688,12 +669,12 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyCell_Link,PyCell,PyTypeCell,Cell) DBoLinkCreateMethod(Cell)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyCell Object Definitions. // PyCell Object Definitions.
PyTypeInheritedObjectDefinitions(Cell, Entity) PyTypeObjectDefinitions(Cell)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -134,7 +134,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyCellLocator Object Definitions. // PyCellLocator Object Definitions.
PyTypeRootObjectDefinitions(CellLocator) PyTypeObjectDefinitions(CellLocator)
# endif // End of Shared Library Code Part. # endif // End of Shared Library Code Part.

View File

@ -207,7 +207,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyComponent Object Definitions. // PyComponent Object Definitions.
PyTypeInheritedObjectDefinitions(Component, Entity) PyTypeObjectDefinitions(Component)
# endif // End of Shared Library Code Part. # endif // End of Shared Library Code Part.

View File

@ -127,7 +127,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyComponentLocator Object Definitions. // PyComponentLocator Object Definitions.
PyTypeRootObjectDefinitions(ComponentLocator) PyTypeObjectDefinitions(ComponentLocator)
# endif // End of Shared Library Code Part. # endif // End of Shared Library Code Part.

View File

@ -222,14 +222,14 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyContact_Link,PyContact,PyTypeContact,Contact) DBoLinkCreateMethod(Contact)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyContact Object Definitions. // PyContact Object Definitions.
PyTypeInheritedObjectDefinitions(Contact, Component) PyTypeObjectDefinitions(Contact)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -43,7 +43,7 @@
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Module : "./PyCataBase.cpp" | // | C++ Module : "./PyDataBase.cpp" |
// | *************************************************************** | // | *************************************************************** |
// | U p d a t e s | // | U p d a t e s |
// | | // | |
@ -63,25 +63,25 @@ using namespace Hurricane;
extern "C" { extern "C" {
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DataBase,db,function) #define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DataBase,db,function)
// x=================================================================x // x=================================================================x
// | "PyDataBase" Python Module Code Part | // | "PyDataBase" Python Module Code Part |
// x=================================================================x // x=================================================================x
# if defined(__PYTHON_MODULE__) #if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x // x-------------------------------------------------------------x
// | "PyDataBase" Attribute Methods | // | "PyDataBase" Attribute Methods |
// x-------------------------------------------------------------x // x-------------------------------------------------------------x
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Attribute Method : "PyDataBase_getDataBase ()" // Attribute Method : "PyDataBase_getDataBase ()"
PyObject* PyDataBase_getDataBase ( PyObject* module ) { PyObject* PyDataBase_getDataBase ( PyObject* module ) {
trace << "PyDataBase_getDataBase()" << endl; trace << "PyDataBase_getDataBase()" << endl;
@ -166,19 +166,19 @@ extern "C" {
// x=================================================================x // x=================================================================x
// | "PyCell" Shared Library Code Part | // | "PyDataBase" Shared Library Code Part |
// x=================================================================x // x=================================================================x
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyDataBase_Link,PyDataBase,PyTypeDataBase,DataBase) DBoLinkCreateMethod(DataBase)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyDataBase Object Definitions. // PyDataBase Object Definitions.
PyTypeRootObjectDefinitions(DataBase) PyTypeObjectDefinitions(DataBase)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -181,7 +181,7 @@ extern "C" {
} }
PyTypeRootObjectDefinitions(Entity) PyTypeObjectDefinitions(Entity)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyEntity Object Definitions. // PyEntity Object Definitions.

View File

@ -211,15 +211,13 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyHorizontal_Link,PyHorizontal,PyTypeHorizontal,Horizontal) DBoLinkCreateMethod(Horizontal)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyHorizontal Object Definitions. // PyHorizontal Object Definitions.
PyTypeInheritedObjectDefinitions(Horizontal, Segment) PyTypeObjectDefinitions(Horizontal)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -135,10 +135,6 @@ using namespace Hurricane;
= "comp"; = "comp";
ConverterState __cs = ConverterState (); ConverterState __cs = ConverterState ();
int __objectOffset = offsetof ( PyPoint, _object ); int __objectOffset = offsetof ( PyPoint, _object );
map <void*,PyObject*> H2PMap;
// x-----------------------------------------------------------------x // x-----------------------------------------------------------------x
// | "PyHurricane" C++ Functions | // | "PyHurricane" C++ Functions |

View File

@ -206,7 +206,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyHyperNet Object Definitions. // PyHyperNet Object Definitions.
PyTypeRootObjectDefinitions(HyperNet) PyTypeObjectDefinitions(HyperNet)
# endif // End of Shared Library Code Part. # endif // End of Shared Library Code Part.

View File

@ -489,18 +489,16 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyInstance_Link,PyInstance,PyTypeInstance,Instance) DBoLinkCreateMethod(Instance)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyInstance Object Definitions. // 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". } // End of extern "C".
@ -509,5 +507,3 @@ extern "C" {
} // End of Isobar namespace. } // End of Isobar namespace.

View File

@ -133,7 +133,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyInstanceLocator Object Definitions. // PyInstanceLocator Object Definitions.
PyTypeRootObjectDefinitions(InstanceLocator) PyTypeObjectDefinitions(InstanceLocator)

View File

@ -179,7 +179,7 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyLayer_Link,PyLayer,PyTypeLayer,Layer) DBoLinkCreateMethod(Layer)
@ -187,7 +187,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyLayer Object Definitions. // PyLayer Object Definitions.
PyTypeRootObjectDefinitions(Layer) PyTypeObjectDefinitions(Layer)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -206,7 +206,7 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyLibrary_Link,PyLibrary,PyTypeLibrary,Library) DBoLinkCreateMethod(Library)
@ -214,7 +214,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyLibrary Object Definitions. // PyLibrary Object Definitions.
PyTypeRootObjectDefinitions(Library) PyTypeObjectDefinitions(Library)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -148,7 +148,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyName Object Definitions. // PyName Object Definitions.
PyTypeRootObjectDefinitions(Name) PyTypeObjectDefinitions(Name)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -587,7 +587,7 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyNet_Link,PyNet,PyTypeNet,Net) DBoLinkCreateMethod(Net)
@ -595,7 +595,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyNet Object Definitions. // PyNet Object Definitions.
PyTypeInheritedObjectDefinitions(Net, Entity) PyTypeObjectDefinitions(Net)
# endif // End of Shared Library Code Part. # endif // End of Shared Library Code Part.

View File

@ -128,7 +128,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyNetLocator Object Definitions. // PyNetLocator Object Definitions.
PyTypeRootObjectDefinitions(NetLocator) PyTypeObjectDefinitions(NetLocator)
# endif // End of Shared Library Code Part. # endif // End of Shared Library Code Part.

View File

@ -298,7 +298,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyOccurrence Object Definitions. // PyOccurrence Object Definitions.
PyTypeRootObjectDefinitions(Occurrence) PyTypeObjectDefinitions(Occurrence)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -178,7 +178,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyOccurrenceLocator Object Definitions. // PyOccurrenceLocator Object Definitions.
PyTypeRootObjectDefinitions(OccurrenceLocator) PyTypeObjectDefinitions(OccurrenceLocator)
# endif // End of Shared Library Code Part. # endif // End of Shared Library Code Part.

View File

@ -367,10 +367,10 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyPath Object Definitions. // 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". } // End of extern "C".

View File

@ -238,7 +238,7 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyPin_Link,PyPin,PyTypePin,Pin) DBoLinkCreateMethod(Pin)
@ -246,7 +246,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyPin Object Definitions. // PyPin Object Definitions.
PyTypeInheritedObjectDefinitions(Pin, Contact) PyTypeObjectDefinitions(Pin)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -135,9 +135,9 @@ extern "C" {
// PyPinLocator Object Definitions. // 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". } // End of extern "C".

View File

@ -202,16 +202,16 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyPlug_Link,PyPlug,PyTypePlug,Plug) DBoLinkCreateMethod(Plug)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyPlug Object Definitions. // 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". } // End of extern "C".

View File

@ -128,7 +128,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyPlugLocator Object Definitions. // PyPlugLocator Object Definitions.
PyTypeRootObjectDefinitions(PlugLocator) PyTypeObjectDefinitions(PlugLocator)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -184,7 +184,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyPoint Object Definitions. // PyPoint Object Definitions.
PyTypeRootObjectDefinitions(Point) PyTypeObjectDefinitions(Point)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -242,16 +242,15 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyReference_Link,PyReference,PyTypeReference,Reference) DBoLinkCreateMethod(Reference)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyReference Object Definitions. // 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". } // End of extern "C".

View File

@ -128,7 +128,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyReferenceLocator Object Definitions. // PyReferenceLocator Object Definitions.
PyTypeRootObjectDefinitions(ReferenceLocator) PyTypeObjectDefinitions(ReferenceLocator)
# endif // End of Shared Library Code Part. # endif // End of Shared Library Code Part.

View File

@ -175,7 +175,7 @@ extern "C" {
// PySegment Object Definitions. // PySegment Object Definitions.
PyTypeInheritedObjectDefinitions(Segment, Component) PyTypeObjectDefinitions(Segment)
# endif // End of Shared Library Code Part. # endif // End of Shared Library Code Part.

View File

@ -135,10 +135,10 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PySegmentLocator Object Definitions. // 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". } // End of extern "C".

View File

@ -185,11 +185,11 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyTechnology_Link,PyTechnology,PyTypeTechnology,Technology) DBoLinkCreateMethod(Technology)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyTechnology Object Definitions. // PyTechnology Object Definitions.
PyTypeRootObjectDefinitions(Technology) PyTypeObjectDefinitions(Technology)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -608,7 +608,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyTransformation Object Definitions. // PyTransformation Object Definitions.
PyTypeRootObjectDefinitions(Transformation) PyTypeObjectDefinitions(Transformation)
#endif // End of Shared Library Code Part. #endif // End of Shared Library Code Part.

View File

@ -185,7 +185,7 @@ extern "C" {
HCATCH HCATCH
return PyVertical_Link ( vertical ); return PyVertical_Link(vertical);
} }
DBoDeleteMethod(Vertical) DBoDeleteMethod(Vertical)
@ -203,17 +203,14 @@ extern "C" {
// Link/Creation Method. // Link/Creation Method.
DBoLinkCreateMethod(PyVertical_Link,PyVertical,PyTypeVertical,Vertical) DBoLinkCreateMethod(Vertical)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// PyVertical Object Definitions. // 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". } // End of extern "C".

View File

@ -72,11 +72,6 @@
namespace Isobar { namespace Isobar {
#if PY_VERSION_HEX < 0x02040000
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
#endif
using namespace std; using namespace std;
@ -212,16 +207,13 @@ extern "C" {
// Miscellaneous. // Miscellaneous.
# define DEFERRED_ADDRESS(ADDR) 0
// This macro must be redefined in derived classes. // This macro must be redefined in derived classes.
// Example : _baseOject._object // Example : _baseOject._object
# define ACCESS_OBJECT _object #define ACCESS_OBJECT _object
# define ACCESS_CLASS(_pyObject) _pyObject #define ACCESS_CLASS(_pyObject) _pyObject
# define LOAD_CONSTANT(CONSTANT_VALUE,CONSTANT_NAME) \ #define LOAD_CONSTANT(CONSTANT_VALUE,CONSTANT_NAME) \
constant = PyInt_FromLong ( (long)CONSTANT_VALUE ); \ constant = PyInt_FromLong ( (long)CONSTANT_VALUE ); \
PyDict_SetItemString ( dictionnary, CONSTANT_NAME, constant ); \ PyDict_SetItemString ( dictionnary, CONSTANT_NAME, constant ); \
Py_DECREF ( constant ); Py_DECREF ( constant );
@ -232,12 +224,12 @@ extern "C" {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Generic Method Header. // Generic Method Header.
# define GENERIC_METHOD_HEAD(SELF_TYPE,SELF_OBJECT,function) \ #define GENERIC_METHOD_HEAD(SELF_TYPE,SELF_OBJECT,function) \
if ( self->ACCESS_OBJECT == NULL ) { \ if ( self->ACCESS_OBJECT == NULL ) { \
PyErr_SetString ( ProxyError, "Attempt to call " function " on an unbound hurricane object" ); \ PyErr_SetString ( ProxyError, "Attempt to call " function " on an unbound hurricane object" ); \
return ( NULL ); \ return ( NULL ); \
} \ } \
SELF_TYPE* SELF_OBJECT = dynamic_cast<SELF_TYPE*>(self->ACCESS_OBJECT); \ SELF_TYPE* SELF_OBJECT = dynamic_cast<SELF_TYPE*>(self->ACCESS_OBJECT);\
if ( self->ACCESS_OBJECT == NULL ) { \ if ( self->ACCESS_OBJECT == NULL ) { \
PyErr_SetString ( ProxyError, "Invalid dynamic_cast while calling " function "" ); \ PyErr_SetString ( ProxyError, "Invalid dynamic_cast while calling " function "" ); \
return ( NULL ); \ return ( NULL ); \
@ -249,7 +241,7 @@ extern "C" {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Attribute Method Macro For Checking Bound. // Attribute Method Macro For Checking Bound.
# define GetBoundStateAttribute(PY_FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ #define GetBoundStateAttribute(PY_FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \
{ \ { \
long result = 1; \ long result = 1; \
@ -365,7 +357,7 @@ extern "C" {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Attribute Method For getting Attributes. // 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 ) \ static PyObject* PY_FUNC_NAME ( PyObject* self, char* name ) \
{ \ { \
return ( Py_FindMethod(PY_OBJECT_METHODS,self,name) ); \ return ( Py_FindMethod(PY_OBJECT_METHODS,self,name) ); \
@ -389,7 +381,7 @@ extern "C" {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Locator Attribute Method For Progress. // 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 ) \ static PyObject* Py##SELF_TYPE##Locator_progress ( Py##SELF_TYPE##Locator *self ) \
{ \ { \
trace << #SELF_TYPE "Locator.progress()" << endl; \ trace << #SELF_TYPE "Locator.progress()" << endl; \
@ -553,7 +545,7 @@ extern "C" {
PyErr_SetString ( ProxyError, message.str().c_str() ); \ PyErr_SetString ( ProxyError, message.str().c_str() ); \
return ( NULL ); \ return ( NULL ); \
} \ } \
ProxyProperty* proxy = dynamic_cast<ProxyProperty*> \ ProxyProperty* proxy = static_cast<ProxyProperty*> \
( self->ACCESS_OBJECT->getProperty ( ProxyProperty::getPropertyName() ) ); \ ( self->ACCESS_OBJECT->getProperty ( ProxyProperty::getPropertyName() ) ); \
if (proxy == NULL) { \ if (proxy == NULL) { \
ostringstream message; \ ostringstream message; \
@ -569,17 +561,17 @@ extern "C" {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Attribute Macro For BDo Link/Creation. // Attribute Macro For BDo Link/Creation.
# define DBoLinkCreateMethod(PY_FUNC_NAME,PY_SELF_TYPE,PY_SELF_CLASS,SELF_TYPE) \ #define DBoLinkCreateMethod(SELF_TYPE) \
PyObject* PY_FUNC_NAME ( SELF_TYPE* object ) \ PyObject* Py##SELF_TYPE##_Link ( SELF_TYPE* object ) { \
{ \ if ( object == NULL ) { \
if ( object == NULL ) \
Py_RETURN_NONE; \ Py_RETURN_NONE; \
PY_SELF_TYPE* pyObject = NULL; \ } \
Py##SELF_TYPE* pyObject = NULL; \
HTRY \ HTRY \
ProxyProperty* proxy = dynamic_cast<ProxyProperty*> \ ProxyProperty* proxy = static_cast<ProxyProperty*> \
( object->getProperty ( ProxyProperty::getPropertyName() ) ); \ ( object->getProperty ( ProxyProperty::getPropertyName() ) ); \
if ( proxy == NULL ) { \ if ( proxy == NULL ) { \
pyObject = PyObject_NEW(PY_SELF_TYPE, &PY_SELF_CLASS); \ pyObject = PyObject_NEW(Py##SELF_TYPE, &PyType##SELF_TYPE); \
if (pyObject == NULL) { return NULL; } \ if (pyObject == NULL) { return NULL; } \
\ \
proxy = ProxyProperty::create ( (void*)pyObject ); \ proxy = ProxyProperty::create ( (void*)pyObject ); \
@ -588,7 +580,7 @@ extern "C" {
pyObject->ACCESS_OBJECT = object; \ pyObject->ACCESS_OBJECT = object; \
object->put ( proxy ); \ object->put ( proxy ); \
} else { \ } else { \
pyObject = (PY_SELF_TYPE*)proxy->getShadow (); \ pyObject = (Py##SELF_TYPE*)proxy->getShadow (); \
Py_INCREF ( ACCESS_CLASS(pyObject) ); \ Py_INCREF ( ACCESS_CLASS(pyObject) ); \
} \ } \
HCATCH \ HCATCH \
@ -606,7 +598,7 @@ extern "C" {
<< self->ACCESS_OBJECT << endl; \ << self->ACCESS_OBJECT << endl; \
\ \
if ( self->ACCESS_OBJECT != NULL ) { \ if ( self->ACCESS_OBJECT != NULL ) { \
ProxyProperty* proxy = dynamic_cast<ProxyProperty*> \ ProxyProperty* proxy = static_cast<ProxyProperty*> \
( self->ACCESS_OBJECT->getProperty ( ProxyProperty::getPropertyName() ) ); \ ( self->ACCESS_OBJECT->getProperty ( ProxyProperty::getPropertyName() ) ); \
if (proxy == NULL) { \ if (proxy == NULL) { \
ostringstream message; \ ostringstream message; \
@ -692,7 +684,7 @@ extern "C" {
HTRY \ HTRY \
if (!ParseOneArg("get" #CENGINE, args, CELL_ARG, &arg0 ) ) return ( NULL ); \ if (!ParseOneArg("get" #CENGINE, args, CELL_ARG, &arg0 ) ) return ( NULL ); \
Cell* cell = PYCELL_O(arg0); \ Cell* cell = PYCELL_O(arg0); \
cengine = dynamic_cast<CENGINE*>(getCEngine(cell, Name(#CENGINE))); \ cengine = static_cast<CENGINE*>(getCEngine(cell, Name(#CENGINE))); \
if (!cengine) { \ if (!cengine) { \
cengine = CENGINE::create (cell); \ cengine = CENGINE::create (cell); \
} \ } \
@ -700,15 +692,12 @@ extern "C" {
return Py##CENGINE##_Link( cengine ); \ 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 = \ PyTypeObject PyType##SELF_TYPE = \
{ PyObject_HEAD_INIT(&PyType_Type) \ { PyObject_HEAD_INIT(NULL) \
0 /* ob_size. */ \ 0 /* ob_size. */ \
, #SELF_TYPE /* tp_name. */ \ , "Hurricane.##SELF_TYPE" /* tp_name. */ \
, sizeof(Py##SELF_TYPE) /* tp_basicsize. */ \ , sizeof(Py##SELF_TYPE) /* tp_basicsize. */ \
, 0 /* tp_itemsize. */ \ , 0 /* tp_itemsize. */ \
/* methods. */ \ /* methods. */ \
@ -729,84 +718,13 @@ extern "C" {
, 0 /* tp_as_buffer. */ \ , 0 /* tp_as_buffer. */ \
, Py_TPFLAGS_DEFAULT \ , Py_TPFLAGS_DEFAULT \
| Py_TPFLAGS_BASETYPE /* tp_flags. */ \ | Py_TPFLAGS_BASETYPE /* tp_flags. */ \
, 0 /* tp_doc. */ \ , "#SELF_TYPE objects" /* 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. */ \
}; };
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//PyType_Ready Methods //PyType_Ready Methods
# define PYTYPE_READY(TYPE) \ #define PYTYPE_READY(TYPE) \
if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \ if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \
cerr << "[ERROR]\n" \ cerr << "[ERROR]\n" \
<< " Failed to initialize <Py" #TYPE ">." << endl; \ << " Failed to initialize <Py" #TYPE ">." << 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; \ PyType##TYPE.tp_base = &PyType##TYPE_BASE; \
if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \ if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \
cerr << "[ERROR]\n" \ cerr << "[ERROR]\n" \