diff --git a/hurricane/src/isobar/PyBox.cpp b/hurricane/src/isobar/PyBox.cpp index 27d2d2da..b5494039 100644 --- a/hurricane/src/isobar/PyBox.cpp +++ b/hurricane/src/isobar/PyBox.cpp @@ -379,10 +379,27 @@ extern "C" { , {NULL, NULL, 0, NULL} /* sentinel */ }; + // x-------------------------------------------------------------x + // | "PyBox" Object Methods | + // x-------------------------------------------------------------x + + + DirectDeleteMethod(PyBox_DeAlloc,PyBox) + PyTypeObjectLinkPyType(Box) + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyBox" Shared Library Code Part | +// x=================================================================x + + // --------------------------------------------------------------- - // Attribute Method : "PyBox_new ()" - PyObject* PyBox_new (PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyBox_new()" << endl; + // Attribute Method : "PyBox_create ()" + + PyObject* PyBox_create (PyObject *module, PyObject *args) { + trace << "PyBox_create()" << endl; Box* box = NULL; PyBox* pyBox = NULL; @@ -392,9 +409,9 @@ extern "C" { PyObject* arg1; PyObject* arg2; PyObject* arg3; - __cs.init ("Box.new"); + __cs.init ("Box.create"); - if (! PyArg_ParseTuple(args,"|O&O&O&O&:Box.new", + if (! PyArg_ParseTuple(args,"|O&O&O&O&:Box.create", Converter, &arg0, Converter, &arg1, Converter, &arg2, @@ -423,23 +440,6 @@ extern "C" { return ( (PyObject*)pyBox ); } - // x-------------------------------------------------------------x - // | "PyBox" Object Methods | - // x-------------------------------------------------------------x - - - DirectDeleteMethod(PyBox_DeAlloc,PyBox) - PyTypeObjectLinkPyType(Box) - PyTypeObjectConstructor(Box) - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyBox" Shared Library Code Part | -// x=================================================================x - - diff --git a/hurricane/src/isobar/PyCell.cpp b/hurricane/src/isobar/PyCell.cpp index 976752f8..85a9a6bf 100644 --- a/hurricane/src/isobar/PyCell.cpp +++ b/hurricane/src/isobar/PyCell.cpp @@ -621,15 +621,28 @@ extern "C" { // | "PyCell" Object Methods | // x-------------------------------------------------------------x - static PyObject* PyCell_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyCell_new()" << endl; + DBoDeleteMethod(Cell) + PyTypeObjectLinkPyType(Cell) + + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyCell" Shared Library Code Part | +// x=================================================================x + + // --------------------------------------------------------------- + // Attribute Method : "PyCell_create ()" + PyObject* PyCell_create ( PyObject *module, PyObject *args ) { + trace << "PyCell_create()" << endl; char* name = NULL; PyLibrary* pyLibrary = NULL; Cell* cell = NULL; HTRY - if (PyArg_ParseTuple(args,"O!s:Cell.new", &PyTypeLibrary, &pyLibrary, &name)) { + if (PyArg_ParseTuple(args,"O!s:Cell.create", &PyTypeLibrary, &pyLibrary, &name)) { cell = Cell::create(PYLIBRARY_O(pyLibrary), Name(name)); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Cell constructor."); @@ -640,25 +653,13 @@ extern "C" { return PyCell_Link(cell); } - DBoDeleteMethod(Cell) - PyTypeObjectLinkPyType(Cell) - PyTypeObjectConstructor(Cell) - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyCell" Shared Library Code Part | -// x=================================================================x - - // Link/Creation Method. DBoLinkCreateMethod(Cell) // --------------------------------------------------------------- // PyCell Object Definitions. - PyTypeObjectDefinitions(Cell) + PyTypeInheritedObjectDefinitions(Cell, Entity) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyComponent.cpp b/hurricane/src/isobar/PyComponent.cpp index 78d88b6e..324ef7fb 100644 --- a/hurricane/src/isobar/PyComponent.cpp +++ b/hurricane/src/isobar/PyComponent.cpp @@ -169,7 +169,7 @@ extern "C" { // --------------------------------------------------------------- // PyComponent Object Definitions. - PyTypeObjectDefinitions(Component) + PyTypeInheritedObjectDefinitions(Component, Entity) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyContact.cpp b/hurricane/src/isobar/PyContact.cpp index 2ce0f460..e26c0f00 100644 --- a/hurricane/src/isobar/PyContact.cpp +++ b/hurricane/src/isobar/PyContact.cpp @@ -86,11 +86,24 @@ extern "C" { // | "PyContact" Object Methods | // x-------------------------------------------------------------x - // --------------------------------------------------------------- - // Attribute Method : "PyContact_new ()" - static PyObject* PyContact_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyContact_new()" << endl; + + DBoDeleteMethod(Contact) + PyTypeObjectLinkPyType(Contact) + + +#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; Contact* contact = NULL; @@ -99,11 +112,11 @@ extern "C" { PyLayer* pyLayer = NULL; PyComponent* pyComponent = NULL; DbU::Unit x=0, y=0, width=0, height=0; - if (PyArg_ParseTuple(args, "O!O!ll|ll:Contact.new", + if (PyArg_ParseTuple(args, "O!O!ll|ll:Contact.create", &PyTypeNet, &pyNet, &PyTypeLayer, &pyLayer, &x, &y, &width, &height)) { contact = Contact::create(PYNET_O(pyNet), PYLAYER_O(pyLayer), x, y, width, height); - } else if (PyArg_ParseTuple(args, "O!O!ll|ll:Contact.new", + } else if (PyArg_ParseTuple(args, "O!O!ll|ll:Contact.create", &PyTypeComponent, &pyComponent, &PyTypeLayer, &pyLayer, &x, &y, &width, &height)) { contact = Contact::create(PYCOMPONENT_O(pyComponent), PYLAYER_O(pyLayer), x, y, width, height); @@ -120,20 +133,6 @@ extern "C" { - DBoDeleteMethod(Contact) - PyTypeObjectLinkPyType(Contact) - PyTypeObjectConstructor(Contact) - - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyContact" Shared Library Code Part | -// x=================================================================x - - - // Link/Creation Method. DBoLinkCreateMethod(Contact) @@ -143,7 +142,7 @@ extern "C" { // --------------------------------------------------------------- // PyContact Object Definitions. - PyTypeObjectDefinitions(Contact) + PyTypeInheritedObjectDefinitions(Contact, Component) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyDataBase.cpp b/hurricane/src/isobar/PyDataBase.cpp index 028917ef..2691fe20 100644 --- a/hurricane/src/isobar/PyDataBase.cpp +++ b/hurricane/src/isobar/PyDataBase.cpp @@ -143,11 +143,22 @@ extern "C" { // x-------------------------------------------------------------x // | "PyDataBase" Object Methods | // x-------------------------------------------------------------x - // --------------------------------------------------------------- - // Attribute Method : "PyDataBase_new ()" - static PyObject* PyDataBase_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyDataBase_new()" << endl; + DBoDeleteMethod(DataBase) + PyTypeObjectLinkPyType(DataBase) + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyDataBase" Shared Library Code Part | +// x=================================================================x + + // --------------------------------------------------------------- + // Attribute Method : "PyDataBase_create ()" + + PyObject* PyDataBase_create ( PyObject *module ) { + trace << "PyDataBase_create()" << endl; DataBase* db = NULL; @@ -158,17 +169,6 @@ extern "C" { return PyDataBase_Link(db); } - DBoDeleteMethod(DataBase) - PyTypeObjectLinkPyType(DataBase) - PyTypeObjectConstructor(DataBase) - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyDataBase" Shared Library Code Part | -// x=================================================================x - // Link/Creation Method. diff --git a/hurricane/src/isobar/PyEntity.cpp b/hurricane/src/isobar/PyEntity.cpp index bfc0d07d..ed8dce62 100644 --- a/hurricane/src/isobar/PyEntity.cpp +++ b/hurricane/src/isobar/PyEntity.cpp @@ -150,7 +150,7 @@ extern "C" { } - PyTypeObjectDefinitions(Entity) + PyTypeRootObjectDefinitions(Entity) // --------------------------------------------------------------- // PyEntity Object Definitions. diff --git a/hurricane/src/isobar/PyHorizontal.cpp b/hurricane/src/isobar/PyHorizontal.cpp index ceb12c60..06e68f7e 100644 --- a/hurricane/src/isobar/PyHorizontal.cpp +++ b/hurricane/src/isobar/PyHorizontal.cpp @@ -68,11 +68,23 @@ extern "C" { // | "PyHorizontal" Object Methods | // x-------------------------------------------------------------x - // --------------------------------------------------------------- - // Attribute Method : "PyHorizontal_new ()" - static PyObject* PyHorizontal_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyHorizontal_new()" << endl; + DBoDeleteMethod(Horizontal) + PyTypeObjectLinkPyType(Horizontal) + + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyHorizontal" Shared Library Code Part | +// x=================================================================x + + // --------------------------------------------------------------- + // Attribute Method : "PyHorizontal_create ()" + + PyObject* PyHorizontal_create ( PyObject *module, PyObject *args ) { + trace << "PyHorizontal_create()" << endl; PyObject* arg0; PyObject* arg1; @@ -159,21 +171,6 @@ extern "C" { } - DBoDeleteMethod(Horizontal) - PyTypeObjectLinkPyType(Horizontal) - PyTypeObjectConstructor(Horizontal) - - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyHorizontal" Shared Library Code Part | -// x=================================================================x - - - - // Link/Creation Method. DBoLinkCreateMethod(Horizontal) @@ -182,7 +179,7 @@ extern "C" { // --------------------------------------------------------------- // PyHorizontal Object Definitions. - PyTypeObjectDefinitions(Horizontal) + PyTypeInheritedObjectDefinitions(Horizontal, Segment) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index ca2df8d9..4bf066ee 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -207,8 +207,8 @@ using namespace Hurricane; , const char* idBase ) { for ( unsigned i=0 ; i < _types.size() ; i++ ) { if ( ! strcmp ( _types[i]->_id, id ) ) { - //throw Error ( objectTypeRedefinition ); // 04.09.2009 d2 modification - cerr << objectTypeRedefinition << endl; + //throw Error ( objectTypeRedefinition ); // 04.09.2009 d2 modification so Pharos can run several scripts during one execution + trace << objectTypeRedefinition << endl; return; } } @@ -500,15 +500,31 @@ extern "C" { // x-------------------------------------------------------------x static PyMethodDef PyHurricane_Methods[] = - { { "DbU_db" , PyDbU_db , METH_VARARGS, "Convert an integer to DbU::Unit (no scale factor)." } - , { "DbU_grid" , PyDbU_grid , METH_VARARGS, "Convert a founder grid to DbU::Unit." } - , { "DbU_lambda" , PyDbU_lambda , METH_VARARGS, "Convert a symbolic (lambda) to DbU::Unit." } - , { "DbU_getDb" , PyDbU_getDb , METH_VARARGS, "Convert a DbU::Unit to an integer value (no scale factor)." } - , { "DbU_getGrid" , PyDbU_getGrid , METH_VARARGS, "Convert a DbU::Unit to a to grid founder." } - , { "DbU_getLambda" , PyDbU_getLambda , METH_VARARGS, "Convert a DbU::Unit to a symbolic value (to lambda)." } - , { "getDataBase" , (PyCFunction)PyDataBase_getDataBase , METH_NOARGS , "Get the current DataBase." } - //, { "openUpdateSession" , (PyCFunction)PyUpdateSession_openUpdateSession , METH_NOARGS , "Open an UpdateSession." } - //, { "closeUpdateSession" , (PyCFunction)PyUpdateSession_closeUpdateSession, METH_NOARGS , "Close an UpdateSession." } + { { "DbU_db" , PyDbU_db , METH_VARARGS, "Converts an integer to DbU::Unit (no scale factor)." } + , { "DbU_grid" , PyDbU_grid , METH_VARARGS, "Converts a founder grid to DbU::Unit." } + , { "DbU_lambda" , PyDbU_lambda , METH_VARARGS, "Converts a symbolic (lambda) to DbU::Unit." } + , { "DbU_getDb" , PyDbU_getDb , METH_VARARGS, "Converts a DbU::Unit to an integer value (no scale factor)." } + , { "DbU_getGrid" , PyDbU_getGrid , METH_VARARGS, "Converts a DbU::Unit to a to grid founder." } + , { "DbU_getLambda" , PyDbU_getLambda , METH_VARARGS, "Converts a DbU::Unit to a symbolic value (to lambda)." } + , { "Point" , PyPoint_create , METH_VARARGS, "Creates a new Point." } + , { "Box" , PyBox_create , METH_VARARGS, "Creates a new Box." } + , { "Transformation" , PyTransformation_create , METH_VARARGS, "Creates a new Transformation." } + , { "DataBase" , (PyCFunction)PyDataBase_create , METH_NOARGS , "Creates the DataBase." } + , { "getDataBase" , (PyCFunction)PyDataBase_getDataBase , METH_NOARGS , "Gets the current DataBase." } + , { "Library" , (PyCFunction)PyLibrary_create , METH_VARARGS, "Creates a new Library." } +// , { "getLibrary" , (PyCFunction)PyLibrary_getLibrary , METH_NOARGS , "Gets the current Library." } + , { "Reference" , (PyCFunction)PyReference_create , METH_VARARGS, "Creates a new Reference." } + , { "Cell" , (PyCFunction)PyCell_create , METH_VARARGS, "Creates a new Cell." } + , { "Instance" , (PyCFunction)PyInstance_create , METH_VARARGS, "Creates a new Instance." } + , { "Net" , (PyCFunction)PyNet_create , METH_VARARGS, "Creates a new Net." } + , { "HyperNet" , (PyCFunction)PyHyperNet_create , METH_VARARGS, "Creates a new HyperNet." } + , { "Horizontal" , (PyCFunction)PyHorizontal_create , METH_VARARGS, "Creates a new Horizontal." } + , { "Vertical" , (PyCFunction)PyVertical_create , METH_VARARGS, "Creates a new Vertical." } + , { "Contact" , (PyCFunction)PyContact_create , METH_VARARGS, "Creates a new Contact." } + , { "Pin" , (PyCFunction)PyPin_create , METH_VARARGS, "Creates a new Pin." } + , { "Pad" , (PyCFunction)PyPad_create , METH_VARARGS, "Creates a new Pad." } + , { "Path" , (PyCFunction)PyPath_create , METH_VARARGS, "Creates a new Path." } + , { "Occurrence" , (PyCFunction)PyOccurrence_create , METH_VARARGS, "Creates a new Occurrence." } , { "getExternalComponents" , (PyCFunction)PyNetExternalComponents_getExternalComponents, METH_VARARGS, "Returns the components collection of an external net" } , {NULL, NULL, 0, NULL} /* sentinel */ }; @@ -556,25 +572,6 @@ extern "C" { PyPin_LinkPyType (); PyPlug_LinkPyType (); - //constructors - PyPoint_Constructor(); - PyDataBase_Constructor(); - PyLibrary_Constructor(); - PyBox_Constructor(); - PyTransformation_Constructor(); - PyReference_Constructor(); - PyCell_Constructor(); - PyInstance_Constructor(); - PyNet_Constructor(); - PyHyperNet_Constructor(); - PyHorizontal_Constructor(); - PyVertical_Constructor(); - PyContact_Constructor(); - PyPin_Constructor(); - PyPad_Constructor(); - PyPath_Constructor(); - PyOccurrence_Constructor(); - PYTYPE_READY ( Point ) PYTYPE_READY ( Box ) PYTYPE_READY ( Transformation ) @@ -670,23 +667,6 @@ extern "C" { << " Failed to initialize Hurricane module." << endl; return; } - PyModule_AddObject(module, "Point" , (PyObject*)&PyTypePoint); - PyModule_AddObject(module, "DataBase" , (PyObject*)&PyTypeDataBase); - PyModule_AddObject(module, "Library" , (PyObject*)&PyTypeLibrary); - PyModule_AddObject(module, "Box" , (PyObject*)&PyTypeBox); - PyModule_AddObject(module, "Transformation" , (PyObject*)&PyTypeTransformation); - PyModule_AddObject(module, "Reference" , (PyObject*)&PyTypeReference); - PyModule_AddObject(module, "Cell" , (PyObject*)&PyTypeCell); - PyModule_AddObject(module, "Instance" , (PyObject*)&PyTypeInstance); - PyModule_AddObject(module, "Net" , (PyObject*)&PyTypeNet); - PyModule_AddObject(module, "HyperNet" , (PyObject*)&PyTypeHyperNet); - PyModule_AddObject(module, "Horizontal" , (PyObject*)&PyTypeHorizontal); - PyModule_AddObject(module, "Vertical" , (PyObject*)&PyTypeVertical); - PyModule_AddObject(module, "Pad" , (PyObject*)&PyTypePad); - PyModule_AddObject(module, "Contact" , (PyObject*)&PyTypeContact); - PyModule_AddObject(module, "Pin" , (PyObject*)&PyTypePin); - PyModule_AddObject(module, "Path" , (PyObject*)&PyTypePath); - PyModule_AddObject(module, "Occurrence" , (PyObject*)&PyTypeOccurrence); PyObject* dictionnary = PyModule_GetDict ( module ); diff --git a/hurricane/src/isobar/PyHyperNet.cpp b/hurricane/src/isobar/PyHyperNet.cpp index faedc9ed..0623acaf 100644 --- a/hurricane/src/isobar/PyHyperNet.cpp +++ b/hurricane/src/isobar/PyHyperNet.cpp @@ -161,16 +161,27 @@ extern "C" { // x-------------------------------------------------------------x // | "PyHyperNet" Object Methods | // x-------------------------------------------------------------x + DirectDeleteMethod(PyHyperNet_DeAlloc,PyHyperNet) + PyTypeObjectLinkPyType(HyperNet) + + +# else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyHyperNet" Shared Library Code Part | +// x=================================================================x + // --------------------------------------------------------------- - // Attribute Method : "PyHyperNet_new ()" + // Attribute Method : "PyHyperNet_create ()" - static PyObject* PyHyperNet_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyHyperNet_new()" << endl; + PyObject* PyHyperNet_create ( PyObject *module, PyObject *args ) { + trace << "PyHyperNet_create()" << endl; - HyperNet* hyperNet = NULL; + HyperNet* hyperNet = NULL; PyObject* arg0; - if (! ParseOneArg ( "HyperNet.new()", args, ":occur", &arg0 )) { + if (! ParseOneArg ( "HyperNet.create()", args, ":occur", &arg0 )) { PyErr_SetString(ConstructorError, "invalid number of parameters for HyperNet constructor." ); return ( NULL ); } @@ -188,20 +199,6 @@ extern "C" { return ( (PyObject*)pyHyperNet ); } - DirectDeleteMethod(PyHyperNet_DeAlloc,PyHyperNet) - PyTypeObjectLinkPyType(HyperNet) - PyTypeObjectConstructor(HyperNet) - - -# else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyHyperNet" Shared Library Code Part | -// x=================================================================x - - - // --------------------------------------------------------------- diff --git a/hurricane/src/isobar/PyInstance.cpp b/hurricane/src/isobar/PyInstance.cpp index 91ad8c68..d6e4d1ff 100644 --- a/hurricane/src/isobar/PyInstance.cpp +++ b/hurricane/src/isobar/PyInstance.cpp @@ -369,11 +369,22 @@ extern "C" { // | "PyInstance" Object Methods | // x-------------------------------------------------------------x + DBoDeleteMethod(Instance) + PyTypeObjectLinkPyType(Instance) + + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyInstance" Shared Library Code Part | +// x=================================================================x + // --------------------------------------------------------------- // Attribute Method : "PyInstance_new ()" - static PyObject* PyInstance_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyInstance_new ()" << endl; + PyObject* PyInstance_create ( PyObject *module, PyObject *args ) { + trace << "PyInstance_create ()" << endl; Instance* instance = NULL; PyObject* arg0; @@ -382,7 +393,7 @@ extern "C" { PyObject* arg3; HTRY - __cs.init ("Instance.new"); + __cs.init ("Instance.create"); if ( ! PyArg_ParseTuple(args,"O&O&O&|O&:Instance.new" ,Converter,&arg0 ,Converter,&arg1 @@ -414,18 +425,6 @@ extern "C" { return PyInstance_Link ( instance ); } - DBoDeleteMethod(Instance) - PyTypeObjectLinkPyType(Instance) - PyTypeObjectConstructor(Instance) - - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyInstance" Shared Library Code Part | -// x=================================================================x - // Link/Creation Method. DBoLinkCreateMethod(Instance) @@ -434,7 +433,7 @@ extern "C" { // --------------------------------------------------------------- // PyInstance Object Definitions. - PyTypeObjectDefinitions(Instance) + PyTypeInheritedObjectDefinitions(Instance, Entity) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyLibrary.cpp b/hurricane/src/isobar/PyLibrary.cpp index 072a6f3d..7a04b654 100644 --- a/hurricane/src/isobar/PyLibrary.cpp +++ b/hurricane/src/isobar/PyLibrary.cpp @@ -123,16 +123,30 @@ extern "C" { // | "PyLibrary" Object Methods | // x-------------------------------------------------------------x - static PyObject* PyLibrary_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyLibrary_new()" << endl; + DBoDeleteMethod(Library) + PyTypeObjectLinkPyType(Library) + + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyLibrary" Shared Library Code Part | +// x=================================================================x + + // --------------------------------------------------------------- + // Attribute Method : "PyLibrary_create()" + + PyObject* PyLibrary_create ( PyObject *module, PyObject *args ) { + trace << "PyLibrary_create()" << endl; PyObject* arg0; PyObject* arg1; Library* library = NULL; HTRY - __cs.init ("Library.new"); - if (!PyArg_ParseTuple(args,"O&O&:Library.new", Converter, &arg0, Converter, &arg1)) { + __cs.init ("Library.create"); + if (!PyArg_ParseTuple(args,"O&O&:Library.create", Converter, &arg0, Converter, &arg1)) { PyErr_SetString ( ConstructorError, "invalid number of parameters for Library constructor." ); return NULL; } @@ -151,17 +165,26 @@ extern "C" { return PyLibrary_Link ( library ); } - DBoDeleteMethod(Library) - PyTypeObjectLinkPyType(Library) - PyTypeObjectConstructor(Library) +#if 0 + // --------------------------------------------------------------- + // Attribute Method : "PyLibrary_getLibrary ()" + //needs args, have to check hurricane object code -#else // End of Python Module Code Part. + PyObject* PyLibrary_getLibrary ( PyObject* module ) + { + trace << "PyLibrary_getLibrary()" << endl; + Library* lib = NULL; + HTRY + lib = Library::getLibrary (); + if ( lib == NULL ) + PyErr_SetString ( HurricaneError, "Library has not been created yet" ); + HCATCH -// x=================================================================x -// | "PyLibrary" Shared Library Code Part | -// x=================================================================x + return PyLibrary_Link ( lib ); + } +#endif // Link/Creation Method. diff --git a/hurricane/src/isobar/PyNet.cpp b/hurricane/src/isobar/PyNet.cpp index 80347511..defc0aaf 100644 --- a/hurricane/src/isobar/PyNet.cpp +++ b/hurricane/src/isobar/PyNet.cpp @@ -466,31 +466,8 @@ extern "C" { // | "PyNet" Object Methods | // x-------------------------------------------------------------x - // --------------------------------------------------------------- - // Attribute Method : "PyNet_new ()" - - static PyObject* PyNet_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyNet_new()" << endl; - - char* name = NULL; - PyCell* pyCell = NULL; - Net* net = NULL; - - HTRY - if (PyArg_ParseTuple(args,"O!s:Net.new", &PyTypeCell, &pyCell, &name)) { - net = Net::create(PYCELL_O(pyCell), Name(name)); - } else { - PyErr_SetString ( ConstructorError, "invalid number of parameters for Net constructor." ); - return NULL; - } - HCATCH - - return PyNet_Link(net); - } - DBoDeleteMethod(Net) PyTypeObjectLinkPyType(Net) - PyTypeObjectConstructor(Net) #else // End of Python Module Code Part. @@ -501,6 +478,28 @@ extern "C" { // x=================================================================x + // --------------------------------------------------------------- + // Attribute Method : "PyNet_create ()" + + PyObject* PyNet_create ( PyObject *module, PyObject *args ) { + trace << "PyNet_create()" << endl; + + char* name = NULL; + PyCell* pyCell = NULL; + Net* net = NULL; + + HTRY + if (PyArg_ParseTuple(args,"O!s:Net.create", &PyTypeCell, &pyCell, &name)) { + net = Net::create(PYCELL_O(pyCell), Name(name)); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Net constructor." ); + return NULL; + } + HCATCH + + return PyNet_Link(net); + } + // Link/Creation Method. @@ -512,7 +511,7 @@ extern "C" { // --------------------------------------------------------------- // PyNet Object Definitions. - PyTypeObjectDefinitions(Net) + PyTypeInheritedObjectDefinitions(Net, Entity) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyOccurrence.cpp b/hurricane/src/isobar/PyOccurrence.cpp index db3f4636..9fa88273 100644 --- a/hurricane/src/isobar/PyOccurrence.cpp +++ b/hurricane/src/isobar/PyOccurrence.cpp @@ -188,18 +188,31 @@ extern "C" { // | "PyOccurrence" Object Methods | // x-------------------------------------------------------------x - // --------------------------------------------------------------- - // Attribute Method : "PyOccurrence_new ()" - static PyObject* PyOccurrence_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyOccurrence_new()" << endl; + + DirectDeleteMethod(PyOccurrence_DeAlloc,PyOccurrence) + PyTypeObjectLinkPyType(Occurrence) + + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyOccurrence" Shared Library Code Part | +// x=================================================================x + + // --------------------------------------------------------------- + // Attribute Method : "PyOccurrence_create ()" + + PyObject* PyOccurrence_create ( PyObject *module, PyObject *args ) { + trace << "PyOccurrence_create()" << endl; Occurrence* occurrence; PyObject* arg0; PyObject* arg1; - __cs.init ("Occurrence.new"); - if ( ! PyArg_ParseTuple(args,"|O&O&:Occurrence.new" + __cs.init ("Occurrence.create"); + if ( ! PyArg_ParseTuple(args,"|O&O&:Occurrence.create" ,Converter,&arg0 ,Converter,&arg1 )) { @@ -230,22 +243,6 @@ extern "C" { - DirectDeleteMethod(PyOccurrence_DeAlloc,PyOccurrence) - PyTypeObjectLinkPyType(Occurrence) - PyTypeObjectConstructor(Occurrence) - - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyOccurrence" Shared Library Code Part | -// x=================================================================x - - - - - // --------------------------------------------------------------- // PyOccurrence Object Definitions. diff --git a/hurricane/src/isobar/PyPad.cpp b/hurricane/src/isobar/PyPad.cpp index bd8401e3..f09a4d5f 100644 --- a/hurricane/src/isobar/PyPad.cpp +++ b/hurricane/src/isobar/PyPad.cpp @@ -92,11 +92,23 @@ extern "C" { // | "PyPad" Object Methods | // x-------------------------------------------------------------x + + DBoDeleteMethod(Pad) + PyTypeObjectLinkPyType(Pad) + + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyPad" Shared Library Code Part | +// x=================================================================x + // --------------------------------------------------------------- // Attribute Method : "PyPad_new ()" - static PyObject* PyPad_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyPad_new()" << endl; + PyObject* PyPad_create ( PyObject *module, PyObject *args ) { + trace << "PyPad_create()" << endl; PyObject* arg0; PyObject* arg1; @@ -104,8 +116,8 @@ extern "C" { Pad* pad = NULL; HTRY - __cs.init ("Pad.new"); - if (!PyArg_ParseTuple(args,"O&O&O&:Pad.new" + __cs.init ("Pad.create"); + if (!PyArg_ParseTuple(args,"O&O&O&:Pad.create" ,Converter,&arg0 ,Converter,&arg1 ,Converter,&arg2 @@ -127,19 +139,6 @@ extern "C" { } - DBoDeleteMethod(Pad) - PyTypeObjectLinkPyType(Pad) - PyTypeObjectConstructor(Pad) - - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyPad" Shared Library Code Part | -// x=================================================================x - - // Link/Creation Method. DBoLinkCreateMethod(Pad) @@ -148,7 +147,7 @@ extern "C" { // PyPad Object Definitions. - PyTypeObjectDefinitions(Pad) + PyTypeInheritedObjectDefinitions(Pad, Component) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyPath.cpp b/hurricane/src/isobar/PyPath.cpp index 97a1c5e6..2ac0644d 100644 --- a/hurricane/src/isobar/PyPath.cpp +++ b/hurricane/src/isobar/PyPath.cpp @@ -260,19 +260,30 @@ extern "C" { // | "PyPath" Object Methods | // x-------------------------------------------------------------x - // --------------------------------------------------------------- - // Attribute Method : "PyPath_new ()" + DirectDeleteMethod(PyPath_DeAlloc,PyPath) + PyTypeObjectLinkPyType(Path) - static PyObject* PyPath_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyPath_new()" << endl; + +# else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyPath" Shared Library Code Part | +// x=================================================================x + + // --------------------------------------------------------------- + // Attribute Method : "PyPath_create ()" + + PyObject* PyPath_create ( PyObject *module, PyObject *args ) { + trace << "PyPath_create()" << endl; Path* path = NULL; PyObject* arg0 = NULL; PyObject* arg1 = NULL; PyPath* pyPath = NULL; - __cs.init ("Path.new"); - if ( ! PyArg_ParseTuple(args,"|O&O&:Path.new" + __cs.init ("Path.create"); + if ( ! PyArg_ParseTuple(args,"|O&O&:Path.create" ,Converter,&arg0 ,Converter,&arg1 )) { @@ -305,20 +316,6 @@ extern "C" { return ( (PyObject*)pyPath ); } - DirectDeleteMethod(PyPath_DeAlloc,PyPath) - PyTypeObjectLinkPyType(Path) - PyTypeObjectConstructor(Path) - - -# else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyPath" Shared Library Code Part | -// x=================================================================x - - - // --------------------------------------------------------------- // PyPath Object Definitions. diff --git a/hurricane/src/isobar/PyPin.cpp b/hurricane/src/isobar/PyPin.cpp index 6ae69dc4..c0b8739f 100644 --- a/hurricane/src/isobar/PyPin.cpp +++ b/hurricane/src/isobar/PyPin.cpp @@ -91,6 +91,18 @@ extern "C" { // | "PyPin" Object Methods | // x-------------------------------------------------------------x + + DBoDeleteMethod(Pin) + PyTypeObjectLinkPyType(Pin) + + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyPin" Shared Library Code Part | +// x=================================================================x + static Pin::PlacementStatus PyInt_AsPlacementStatus ( PyObject* object ) { switch ( PyInt_AsLong(object) ) { case Pin::PlacementStatus::UNPLACED : return ( Pin::PlacementStatus(Pin::PlacementStatus::UNPLACED) ); @@ -114,14 +126,14 @@ extern "C" { } // --------------------------------------------------------------- - // Attribute Method : "PyPin_new ()" + // Attribute Method : "PyPin_create ()" - static PyObject* PyPin_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { + PyObject* PyPin_create ( PyObject *module, PyObject *args ) { Pin* pin = NULL; HTRY - trace << "PyPin_new()" << endl; + trace << "PyPin_create()" << endl; PyObject* arg0; PyObject* arg1; PyObject* arg2; @@ -132,8 +144,8 @@ extern "C" { PyObject* arg7; PyObject* arg8; - __cs.init ("Pin.new"); - if (!PyArg_ParseTuple(args,"O&O&O&O&O&O&O&|O&O&:Pin.new" + __cs.init ("Pin.create"); + if (!PyArg_ParseTuple(args,"O&O&O&O&O&O&O&|O&O&:Pin.create" , Converter, &arg0 , Converter, &arg1 , Converter, &arg2 @@ -190,18 +202,6 @@ extern "C" { return PyPin_Link ( pin ); } - DBoDeleteMethod(Pin) - PyTypeObjectLinkPyType(Pin) - PyTypeObjectConstructor(Pin) - - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyPin" Shared Library Code Part | -// x=================================================================x - // Link/Creation Method. @@ -213,7 +213,7 @@ extern "C" { // --------------------------------------------------------------- // PyPin Object Definitions. - PyTypeObjectDefinitions(Pin) + PyTypeInheritedObjectDefinitions(Pin, Contact) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyPlug.cpp b/hurricane/src/isobar/PyPlug.cpp index 9aaa6776..9b1f0bbb 100644 --- a/hurricane/src/isobar/PyPlug.cpp +++ b/hurricane/src/isobar/PyPlug.cpp @@ -208,7 +208,7 @@ extern "C" { // --------------------------------------------------------------- // PyPlug Object Definitions. - PyTypeObjectDefinitions(Plug) + PyTypeInheritedObjectDefinitions(Plug, Component) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyPoint.cpp b/hurricane/src/isobar/PyPoint.cpp index aeac6921..e0beb03e 100644 --- a/hurricane/src/isobar/PyPoint.cpp +++ b/hurricane/src/isobar/PyPoint.cpp @@ -136,8 +136,25 @@ extern "C" { // | "PyPoint" Object Methods | // x-------------------------------------------------------------x - static PyObject* PyPoint_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyPoint_new()" << endl; + + + DirectDeleteMethod(PyPoint_DeAlloc,PyPoint) + PyTypeObjectLinkPyType(Point) + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyPoint" Shared Library Code Part | +// x=================================================================x + + + // --------------------------------------------------------------- + // Attribute Method : "PyPoint_create ()" + + PyObject* PyPoint_create ( PyObject* module, PyObject *args ) + { + trace << "PyPoint_create()" << endl; Point* point; PyObject* arg0; @@ -170,20 +187,6 @@ extern "C" { return ( (PyObject*)pyPoint ); } - - - DirectDeleteMethod(PyPoint_DeAlloc,PyPoint) - PyTypeObjectLinkPyType(Point) - PyTypeObjectConstructor(Point) - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyPoint" Shared Library Code Part | -// x=================================================================x - - // --------------------------------------------------------------- // PyPoint Object Definitions. diff --git a/hurricane/src/isobar/PyReference.cpp b/hurricane/src/isobar/PyReference.cpp index f5b6292d..0e38a03d 100644 --- a/hurricane/src/isobar/PyReference.cpp +++ b/hurricane/src/isobar/PyReference.cpp @@ -120,11 +120,23 @@ extern "C" { // | "PyReference" Object Methods | // x-------------------------------------------------------------x - // --------------------------------------------------------------- - // Attribute Method : "PyReference_new ()" + DBoDeleteMethod(Reference) + PyTypeObjectLinkPyType(Reference) - static PyObject* PyReference_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyReference_new()" << endl; + +# else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyReference" Shared Library Code Part | +// x=================================================================x + + + // --------------------------------------------------------------- + // Attribute Method : "PyReference_create ()" + + PyObject* PyReference_create ( PyObject *module, PyObject *args ) { + trace << "PyReference_create()" << endl; Reference* reference = NULL; PyObject* arg0; @@ -134,8 +146,8 @@ extern "C" { HTRY - __cs.init ("Reference.new"); - if ( ! PyArg_ParseTuple(args,"O&O&O&|O&:Reference.new" + __cs.init ("Reference.create"); + if ( ! PyArg_ParseTuple(args,"O&O&O&|O&:Reference.create" ,Converter,&arg0 ,Converter,&arg1 ,Converter,&arg2 @@ -165,28 +177,13 @@ extern "C" { - DBoDeleteMethod(Reference) - PyTypeObjectLinkPyType(Reference) - PyTypeObjectConstructor(Reference) - - -# else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyReference" Shared Library Code Part | -// x=================================================================x - - - - // Link/Creation Method. DBoLinkCreateMethod(Reference) // --------------------------------------------------------------- // PyReference Object Definitions. - PyTypeObjectDefinitions(Reference) + PyTypeInheritedObjectDefinitions(Reference, Entity) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PySegment.cpp b/hurricane/src/isobar/PySegment.cpp index 58c5e1f7..89157b93 100644 --- a/hurricane/src/isobar/PySegment.cpp +++ b/hurricane/src/isobar/PySegment.cpp @@ -141,7 +141,7 @@ extern "C" { // PySegment Object Definitions. - PyTypeObjectDefinitions(Segment) + PyTypeInheritedObjectDefinitions(Segment, Component) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyTransformation.cpp b/hurricane/src/isobar/PyTransformation.cpp index acd8a671..3e093f9c 100644 --- a/hurricane/src/isobar/PyTransformation.cpp +++ b/hurricane/src/isobar/PyTransformation.cpp @@ -491,6 +491,17 @@ extern "C" { // | "PyTransformation" Object Methods | // x-------------------------------------------------------------x + DirectDeleteMethod(PyTransformation_DeAlloc,PyTransformation) + PyTypeObjectLinkPyType(Transformation) + + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyTransformation" Shared Library Code Part | +// x=================================================================x + static Transformation::Orientation PyInt_AsOrientation ( PyObject* object ) { switch ( PyInt_AsLong(object) ) { case Transformation::Orientation::ID : return ( Transformation::Orientation(Transformation::Orientation::ID) ); @@ -507,18 +518,18 @@ extern "C" { } // --------------------------------------------------------------- - // Attribute Method : "PyTransformation_new ()" + // Attribute Method : "PyTransformation_create ()" - static PyObject* PyTransformation_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyTransformation_new()" << endl; + PyObject* PyTransformation_create (PyObject *module, PyObject *args) { + trace << "PyTransformation_create()" << endl; Transformation* transf; PyObject* arg0; PyObject* arg1; PyObject* arg2; - __cs.init ("Transformation.new"); - if ( ! PyArg_ParseTuple(args,"|O&O&O&:Transformation.new" + __cs.init ("Transformation.create"); + if ( ! PyArg_ParseTuple(args,"|O&O&O&:Transformation.create" ,Converter,&arg0 ,Converter,&arg1 ,Converter,&arg2 @@ -558,18 +569,6 @@ extern "C" { return (PyObject*)pyTransformation; } - DirectDeleteMethod(PyTransformation_DeAlloc,PyTransformation) - PyTypeObjectLinkPyType(Transformation) - PyTypeObjectConstructor(Transformation) - - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyTransformation" Shared Library Code Part | -// x=================================================================x - // x-------------------------------------------------------------x // | "PyTransformation" Local Functions | diff --git a/hurricane/src/isobar/PyVertical.cpp b/hurricane/src/isobar/PyVertical.cpp index a8fd128b..8e196d7d 100644 --- a/hurricane/src/isobar/PyVertical.cpp +++ b/hurricane/src/isobar/PyVertical.cpp @@ -65,11 +65,22 @@ extern "C" { // | "PyVertical" Object Methods | // x-------------------------------------------------------------x - // --------------------------------------------------------------- - // Attribute Method : "PyVertical_new ()" + DBoDeleteMethod(Vertical) + PyTypeObjectLinkPyType(Vertical) - static PyObject* PyVertical_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - trace << "PyVertical_new()" << endl; + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyVertical" Shared Library Code Part | +// x=================================================================x + + // --------------------------------------------------------------- + // Attribute Method : "PyVertical_create ()" + + PyObject* PyVertical_create ( PyObject *module, PyObject *args ) { + trace << "PyVertical_create()" << endl; PyObject* arg0; PyObject* arg1; @@ -81,8 +92,8 @@ extern "C" { Vertical* vertical = NULL; HTRY - __cs.init ("Vertical.new"); - if (!PyArg_ParseTuple(args,"O&O&O&|O&O&O&O&:Vertical.new" + __cs.init ("Vertical.create"); + if (!PyArg_ParseTuple(args,"O&O&O&|O&O&O&O&:Vertical.create" ,Converter,&arg0 ,Converter,&arg1 ,Converter,&arg2 @@ -154,18 +165,6 @@ extern "C" { return PyVertical_Link(vertical); } - DBoDeleteMethod(Vertical) - PyTypeObjectLinkPyType(Vertical) - PyTypeObjectConstructor(Vertical) - - -#else // End of Python Module Code Part. - - -// x=================================================================x -// | "PyVertical" Shared Library Code Part | -// x=================================================================x - // Link/Creation Method. @@ -174,7 +173,7 @@ extern "C" { // --------------------------------------------------------------- // PyVertical Object Definitions. - PyTypeObjectDefinitions(Vertical) + PyTypeInheritedObjectDefinitions(Vertical, Segment) #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/hurricane/isobar/PyBox.h b/hurricane/src/isobar/hurricane/isobar/PyBox.h index 2916c99f..dae9a8be 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyBox.h +++ b/hurricane/src/isobar/hurricane/isobar/PyBox.h @@ -84,8 +84,8 @@ extern "C" { extern PyTypeObject PyTypeBox; extern PyMethodDef PyBox_Methods[]; - extern void PyBox_LinkPyType(); - extern void PyBox_Constructor(); + extern PyObject* PyBox_create ( PyObject* self, PyObject* args ); + extern void PyBox_LinkPyType (); #define IsPyBox(v) ( (v)->ob_type == &PyTypeBox ) diff --git a/hurricane/src/isobar/hurricane/isobar/PyCell.h b/hurricane/src/isobar/hurricane/isobar/PyCell.h index 98f21050..61f3ece1 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyCell.h +++ b/hurricane/src/isobar/hurricane/isobar/PyCell.h @@ -83,9 +83,9 @@ extern "C" { extern PyTypeObject PyTypeCell; extern PyMethodDef PyCell_Methods[]; + extern PyObject* PyCell_create ( PyObject* module, PyObject* args ); extern PyObject* PyCell_Link ( Hurricane::Cell* object ); extern void PyCell_LinkPyType (); - extern void PyCell_Constructor (); #define IsPyCell(v) ((v)->ob_type == &PyTypeCell) diff --git a/hurricane/src/isobar/hurricane/isobar/PyContact.h b/hurricane/src/isobar/hurricane/isobar/PyContact.h index 322fa010..aadee437 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyContact.h +++ b/hurricane/src/isobar/hurricane/isobar/PyContact.h @@ -83,9 +83,9 @@ extern "C" { extern PyTypeObject PyTypeContact; extern PyMethodDef PyContact_Methods[]; - extern PyObject* PyContact_Link(Hurricane::Contact* object); - extern void PyContact_LinkPyType(); - extern void PyContact_Constructor(); + extern PyObject* PyContact_create ( PyObject* module, PyObject* args ); + extern PyObject* PyContact_Link ( Hurricane::Contact* object ); + extern void PyContact_LinkPyType (); diff --git a/hurricane/src/isobar/hurricane/isobar/PyDataBase.h b/hurricane/src/isobar/hurricane/isobar/PyDataBase.h index 0000f2f9..c52525dc 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyDataBase.h +++ b/hurricane/src/isobar/hurricane/isobar/PyDataBase.h @@ -85,10 +85,10 @@ extern "C" { extern PyTypeObject PyTypeDataBase; extern PyMethodDef PyDataBase_Methods[]; + extern PyObject* PyDataBase_create ( PyObject* module ); extern PyObject* PyDataBase_getDataBase ( PyObject* module ); extern PyObject* PyDataBase_Link ( Hurricane::DataBase* db ); extern void PyDataBase_LinkPyType (); - extern void PyDataBase_Constructor (); #define IsPyDataBase(v) ( (v)->ob_type == &PyTypeDataBase ) diff --git a/hurricane/src/isobar/hurricane/isobar/PyHorizontal.h b/hurricane/src/isobar/hurricane/isobar/PyHorizontal.h index ceb1886b..a3646d6b 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHorizontal.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHorizontal.h @@ -84,9 +84,9 @@ extern "C" { extern PyTypeObject PyTypeHorizontal; extern PyMethodDef PyHorizontal_Methods[]; - extern PyObject* PyHorizontal_Link( Hurricane::Horizontal* object ); - extern void PyHorizontal_LinkPyType(); - extern void PyHorizontal_Constructor(); + extern PyObject* PyHorizontal_create ( PyObject* module, PyObject* args ); + extern PyObject* PyHorizontal_Link ( Hurricane::Horizontal* object ); + extern void PyHorizontal_LinkPyType (); diff --git a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h index d854fa55..f888c9b0 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h @@ -162,6 +162,7 @@ extern "C" { // ------------------------------------------------------------------- // Miscellaneous. +#define DEFERRED_ADDRESS(ADDR) 0 // This macro must be redefined in derived classes. @@ -600,16 +601,6 @@ extern "C" { PyType##SELF_TYPE.tp_methods = Py##SELF_TYPE##_Methods; \ } -// ------------------------------------------------------------------- -// Initialisation Function for PyTypeObject Runtime Link. -// Special method to add constructor new function -#define PyTypeObjectConstructor(SELF_TYPE) \ - extern void Py##SELF_TYPE##_Constructor() { \ - trace << "Py" #SELF_TYPE "_Constructor()" << endl; \ - \ - PyType##SELF_TYPE.tp_new = Py##SELF_TYPE##_new; \ - } - // Special Initialisation Function for Locator PyTypeObject Runtime Link. #define LocatorPyTypeObjectLinkPyType(PY_SELF_TYPE, SELF_TYPE) \ @@ -650,11 +641,77 @@ extern "C" { , 0 /* tp_getattro. */ \ , 0 /* tp_setattro. */ \ , 0 /* tp_as_buffer. */ \ + , Py_TPFLAGS_DEFAULT /* tp_flags */ \ + , "#SELF_TYPE objects" /* tp_doc. */ \ + }; + +# define PyTypeRootObjectDefinitions(SELF_TYPE) \ + PyTypeObject PyType##SELF_TYPE = \ + { PyObject_HEAD_INIT(&PyType_Type) \ + 0 /* ob_size. */ \ + , "Hurricane.Py" #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. */ \ , "#SELF_TYPE objects" /* tp_doc. */ \ }; +# define PyTypeInheritedObjectDefinitions(SELF_TYPE, INHERITED_TYPE) \ + PyTypeObject PyType##SELF_TYPE = \ + { PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType##INHERITED_TYPE)) \ + 0 /* ob_size. */ \ + , "Hurricane.Py" #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. */ \ + }; + #define PyTypeCollectionObjectDefinitions(SELF_TYPE) \ PyTypeObject PyType##SELF_TYPE = \ { PyObject_HEAD_INIT(NULL) \ diff --git a/hurricane/src/isobar/hurricane/isobar/PyHyperNet.h b/hurricane/src/isobar/hurricane/isobar/PyHyperNet.h index d679ba8b..8e027c78 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHyperNet.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHyperNet.h @@ -81,8 +81,8 @@ extern "C" { extern PyTypeObject PyTypeHyperNet; extern PyMethodDef PyHyperNet_Methods[]; - extern void PyHyperNet_LinkPyType(); - extern void PyHyperNet_Constructor(); + extern PyObject* PyHyperNet_create ( PyObject* module, PyObject* args ); + extern void PyHyperNet_LinkPyType(); #define IsPyHyperNet(v) ( (v)->ob_type == &PyTypeHyperNet ) diff --git a/hurricane/src/isobar/hurricane/isobar/PyInstance.h b/hurricane/src/isobar/hurricane/isobar/PyInstance.h index a38da11c..8ab47c96 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyInstance.h +++ b/hurricane/src/isobar/hurricane/isobar/PyInstance.h @@ -87,10 +87,10 @@ extern "C" { extern PyTypeObject PyTypeInstance; extern PyMethodDef PyInstance_Methods[]; - extern PyObject* PyInstance_Link(Hurricane::Instance* object); - extern void InstanceLoadConstants(PyObject* dictionnary); - extern void PyInstance_LinkPyType(); - extern void PyInstance_Constructor(); + extern PyObject* PyInstance_create ( PyObject* module, PyObject* args ); + extern PyObject* PyInstance_Link ( Hurricane::Instance* object); + extern void InstanceLoadConstants ( PyObject* dictionnary ); + extern void PyInstance_LinkPyType (); diff --git a/hurricane/src/isobar/hurricane/isobar/PyLibrary.h b/hurricane/src/isobar/hurricane/isobar/PyLibrary.h index 00dfb2e8..11a19632 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyLibrary.h +++ b/hurricane/src/isobar/hurricane/isobar/PyLibrary.h @@ -84,10 +84,10 @@ extern "C" { extern PyTypeObject PyTypeLibrary; extern PyMethodDef PyLibrary_Methods[]; - extern PyObject* PyLibrary_GetLibrary ( PyObject* module ); + extern PyObject* PyLibrary_create ( PyObject* module, PyObject* args ); + extern PyObject* PyLibrary_getLibrary ( PyObject* module ); extern PyObject* PyLibrary_Link ( Hurricane::Library* lib ); extern void PyLibrary_LinkPyType (); - extern void PyLibrary_Constructor(); #define IsPyLibrary(v) ( (v)->ob_type == &PyTypeLibrary ) diff --git a/hurricane/src/isobar/hurricane/isobar/PyNet.h b/hurricane/src/isobar/hurricane/isobar/PyNet.h index c3a1b5a5..a1d64eb3 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyNet.h +++ b/hurricane/src/isobar/hurricane/isobar/PyNet.h @@ -47,10 +47,10 @@ extern "C" { extern PyTypeObject PyTypeNet; extern PyMethodDef PyNet_Methods[]; - extern PyObject* PyNet_Link(Hurricane::Net* object); - extern void NetLoadConstants(PyObject* dictionnary); - extern void PyNet_LinkPyType(); - extern void PyNet_Constructor(); + extern PyObject* PyNet_create ( PyObject* module, PyObject* args ); + extern PyObject* PyNet_Link ( Hurricane::Net* object ); + extern void NetLoadConstants ( PyObject* dictionnary ); + extern void PyNet_LinkPyType (); diff --git a/hurricane/src/isobar/hurricane/isobar/PyOccurrence.h b/hurricane/src/isobar/hurricane/isobar/PyOccurrence.h index 5612d2e4..be5d8d51 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyOccurrence.h +++ b/hurricane/src/isobar/hurricane/isobar/PyOccurrence.h @@ -84,8 +84,8 @@ extern "C" { extern PyTypeObject PyTypeOccurrence; extern PyMethodDef PyOccurrence_Methods[]; - extern void PyOccurrence_LinkPyType(); - extern void PyOccurrence_Constructor(); + extern PyObject* PyOccurrence_create ( PyObject* module, PyObject* args ); + extern void PyOccurrence_LinkPyType (); #define IsPyOccurrence(v) ( (v)->ob_type == &PyTypeOccurrence ) diff --git a/hurricane/src/isobar/hurricane/isobar/PyPad.h b/hurricane/src/isobar/hurricane/isobar/PyPad.h index 1d2d9db9..a17072a4 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPad.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPad.h @@ -29,9 +29,9 @@ extern "C" { extern PyTypeObject PyTypePad; extern PyMethodDef PyPad_Methods[]; + extern PyObject* PyPad_create ( PyObject* module, PyObject* args ); extern PyObject* PyPad_Link ( Hurricane::Pad* object ); extern void PyPad_LinkPyType (); - extern void PyPad_Constructor(); #define IsPyPad(v) ( (v)->ob_type == &PyTypePad ) diff --git a/hurricane/src/isobar/hurricane/isobar/PyPath.h b/hurricane/src/isobar/hurricane/isobar/PyPath.h index a8b5d42e..0327c031 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPath.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPath.h @@ -84,8 +84,8 @@ extern "C" { extern PyTypeObject PyTypePath; extern PyMethodDef PyPath_Methods[]; - extern void PyPath_LinkPyType(); - extern void PyPath_Constructor(); + extern PyObject* PyPath_create ( PyObject* module, PyObject* args ); + extern void PyPath_LinkPyType (); #define IsPyPath(v) ( (v)->ob_type == &PyTypePath ) diff --git a/hurricane/src/isobar/hurricane/isobar/PyPin.h b/hurricane/src/isobar/hurricane/isobar/PyPin.h index 230baf40..ec70838b 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPin.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPin.h @@ -76,10 +76,10 @@ extern "C" { extern PyTypeObject PyTypePin; extern PyMethodDef PyPin_Methods[]; - extern PyObject* PyPin_Link(Hurricane::Pin* object ); - extern void PinLoadConstants( PyObject* dictionnary ); - extern void PyPin_LinkPyType(); - extern void PyPin_Constructor(); + extern PyObject* PyPin_create ( PyObject* module, PyObject* args ); + extern PyObject* PyPin_Link (Hurricane::Pin* object ); + extern void PinLoadConstants ( PyObject* dictionnary ); + extern void PyPin_LinkPyType (); # define IsPyPin(v) ( (v)->ob_type == &PyTypePin ) diff --git a/hurricane/src/isobar/hurricane/isobar/PyPoint.h b/hurricane/src/isobar/hurricane/isobar/PyPoint.h index a750267a..71f5e0dd 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPoint.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPoint.h @@ -85,8 +85,8 @@ extern "C" { extern PyTypeObject PyTypePoint; extern PyMethodDef PyPoint_Methods[]; + extern PyObject* PyPoint_create ( PyObject* self, PyObject* args ); extern void PyPoint_LinkPyType(); - extern void PyPoint_Constructor(); # define IsPyPoint(v) ( (v)->ob_type == &PyTypePoint ) diff --git a/hurricane/src/isobar/hurricane/isobar/PyReference.h b/hurricane/src/isobar/hurricane/isobar/PyReference.h index ef23cd22..47c09079 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyReference.h +++ b/hurricane/src/isobar/hurricane/isobar/PyReference.h @@ -83,9 +83,9 @@ extern "C" { extern PyTypeObject PyTypeReference; extern PyMethodDef PyReference_Methods[]; + extern PyObject* PyReference_create ( PyObject* module, PyObject* args ); extern PyObject* PyReference_Link ( Hurricane::Reference* object ); - extern void PyReference_LinkPyType(); - extern void PyReference_Constructor(); + extern void PyReference_LinkPyType (); diff --git a/hurricane/src/isobar/hurricane/isobar/PyTransformation.h b/hurricane/src/isobar/hurricane/isobar/PyTransformation.h index 6e9cc713..4c1ff05f 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyTransformation.h +++ b/hurricane/src/isobar/hurricane/isobar/PyTransformation.h @@ -85,9 +85,9 @@ extern "C" { extern PyTypeObject PyTypeTransformation; extern PyMethodDef PyTransformation_Methods[]; - extern void TransformationLoadConstants(PyObject* dictionnary); - extern void PyTransformation_LinkPyType(); - extern void PyTransformation_Constructor(); + extern PyObject* PyTransformation_create (PyObject* self, PyObject* args); + extern void TransformationLoadConstants (PyObject* dictionnary); + extern void PyTransformation_LinkPyType (); # define IsPyTransformation(v) ( (v)->ob_type == &PyTypeTransformation ) diff --git a/hurricane/src/isobar/hurricane/isobar/PyVertical.h b/hurricane/src/isobar/hurricane/isobar/PyVertical.h index daaf4be6..0f86d265 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyVertical.h +++ b/hurricane/src/isobar/hurricane/isobar/PyVertical.h @@ -84,9 +84,9 @@ extern "C" { extern PyTypeObject PyTypeVertical; extern PyMethodDef PyVertical_Methods[]; + extern PyObject* PyVertical_create ( PyObject* module, PyObject* args ); extern PyObject* PyVertical_Link ( Hurricane::Vertical* object ); extern void PyVertical_LinkPyType (); - extern void PyVertical_Constructor();