From cd1c194268ddf3227b19cfb9ea5223416c62d6cd Mon Sep 17 00:00:00 2001 From: The Coriolis Project Date: Tue, 14 Oct 2008 18:44:20 +0000 Subject: [PATCH] cleaning in error message if bad arguments net collections in progress --- hurricane/src/isobar/PyBox.cpp | 2 +- hurricane/src/isobar/PyCell.cpp | 142 +++++++++--------- hurricane/src/isobar/PyContact.cpp | 5 +- hurricane/src/isobar/PyHorizontal.cpp | 8 +- hurricane/src/isobar/PyHurricane.cpp | 24 +-- hurricane/src/isobar/PyHyperNet.cpp | 5 +- hurricane/src/isobar/PyInstance.cpp | 5 +- hurricane/src/isobar/PyLibrary.cpp | 1 + hurricane/src/isobar/PyName.cpp | 7 +- hurricane/src/isobar/PyNet.cpp | 15 +- hurricane/src/isobar/PyNetCollection.cpp | 8 +- hurricane/src/isobar/PyOccurrence.cpp | 5 +- hurricane/src/isobar/PyPath.cpp | 5 +- hurricane/src/isobar/PyPin.cpp | 9 +- hurricane/src/isobar/PyPoint.cpp | 7 +- hurricane/src/isobar/PyReference.cpp | 9 +- hurricane/src/isobar/PyTransformation.cpp | 11 +- hurricane/src/isobar/PyVertical.cpp | 8 +- .../src/isobar/hurricane/isobar/PyHurricane.h | 8 +- .../isobar/hurricane/isobar/PyNetCollection.h | 2 +- 20 files changed, 158 insertions(+), 128 deletions(-) diff --git a/hurricane/src/isobar/PyBox.cpp b/hurricane/src/isobar/PyBox.cpp index 720a8c3b..8852c694 100644 --- a/hurricane/src/isobar/PyBox.cpp +++ b/hurricane/src/isobar/PyBox.cpp @@ -447,7 +447,7 @@ extern "C" { , PyInt_AsLong(arg2) , PyInt_AsLong(arg3) ); } else { - PyErr_SetString ( ConstructorError, "invalid number of parameters for Box constructor." ); + PyErr_SetString(ConstructorError, "invalid number of parameters for Box constructor." ); return ( NULL ); } diff --git a/hurricane/src/isobar/PyCell.cpp b/hurricane/src/isobar/PyCell.cpp index b001e0e8..d53c8a60 100644 --- a/hurricane/src/isobar/PyCell.cpp +++ b/hurricane/src/isobar/PyCell.cpp @@ -57,7 +57,6 @@ #include "hurricane/isobar/PyOccurrence.h" #include "hurricane/isobar/ProxyProperty.h" #include "hurricane/isobar/PyNet.h" -#include "hurricane/isobar/PyNetLocator.h" #include "hurricane/isobar/PyNetCollection.h" #include "hurricane/isobar/PyReferenceLocator.h" #include "hurricane/isobar/PyInstanceLocator.h" @@ -383,139 +382,147 @@ extern "C" { static PyObject* PyCell_getNets ( PyCell *self ) { trace << "PyCell_getNets()" << endl; - METHOD_HEAD ( "Cell.getNets()" ) + METHOD_HEAD("Cell.getNets()") PyNetCollection* pyNetCollection = NULL; HTRY - Nets nets = cell->getNets (); + Nets* nets = new Nets(cell->getNets()); - pyNetCollection = PyObject_NEW ( PyNetCollection, &PyTypeNetCollection); - if (pyNetCollection == NULL) { return NULL; } + pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection); + if (pyNetCollection == NULL) { + return NULL; + } pyNetCollection->_object = nets; HCATCH - + return ( (PyObject*)pyNetCollection); } // --------------------------------------------------------------- - // Attribute Method : "PyCell_getExternalNetsLocator ()" + // Attribute Method : "PyCell_getExternalNets()" - static PyObject* PyCell_getExternalNetsLocator ( PyCell *self ) { - trace << "PyCell_getExternalNetsLocator ()" << endl; + static PyObject* PyCell_getExternalNets(PyCell *self) { + trace << "PyCell_getExternalNets()" << endl; - METHOD_HEAD ( "Cell.getExternalNetsLocator()" ) + METHOD_HEAD("Cell.getExternalNets()") - PyNetLocator* pyNetLocator = NULL; + PyNetCollection* pyNetCollection = NULL; HTRY - Nets nets = cell->getExternalNets (); + Nets* nets = new Nets(cell->getExternalNets()); - pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator ); - if (pyNetLocator == NULL) { return NULL; } + pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection); + if (pyNetCollection == NULL) { + return NULL; + } + pyNetCollection->_object = nets; - pyNetLocator->_object = nets.getLocator (); HCATCH - return ( (PyObject*)pyNetLocator ); + return ((PyObject*)pyNetCollection); } // --------------------------------------------------------------- - // Attribute Method : "PyCell_getClockNetsLocator ()" + // Attribute Method : "PyCell_getClockNets()" - static PyObject* PyCell_getClockNetsLocator ( PyCell *self ) { - trace << "PyCell_getClockNetsLocator ()" << endl; + static PyObject* PyCell_getClockNets(PyCell *self) { + trace << "PyCell_getClockNets()" << endl; - METHOD_HEAD ( "Cell.getClockNetsLocator()" ) + METHOD_HEAD("Cell.getClockNets") - PyNetLocator* pyNetLocator = NULL; + PyNetCollection* pyNetCollection = NULL; HTRY - Nets nets = cell->getClockNets (); + Nets* nets = new Nets(cell->getClockNets()); - pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator ); - if (pyNetLocator == NULL) { return NULL; } + pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection); + if (pyNetCollection == NULL) { + return NULL; + } + pyNetCollection->_object = nets; - pyNetLocator->_object = nets.getLocator (); HCATCH - return ( (PyObject*)pyNetLocator ); + return ((PyObject*)pyNetCollection); } - - // --------------------------------------------------------------- - // Attribute Method : "PyCell_getSupplyNetsLocator ()" + // Attribute Method : "PyCell_getSupplyNets()" - static PyObject* PyCell_getSupplyNetsLocator ( PyCell *self ) { - trace << "PyCell_getSupplyNetsLocator ()" << endl; + static PyObject* PyCell_getSupplyNets(PyCell *self) { + trace << "PyCell_getSupplyNets()" << endl; - METHOD_HEAD ( "Cell.getSupplyNetsLocator()" ) + METHOD_HEAD ( "Cell.getSupplyNets()" ) - PyNetLocator* pyNetLocator = NULL; + PyNetCollection* pyNetCollection = NULL; HTRY - Nets nets = cell->getSupplyNets (); + Nets* nets = new Nets(cell->getSupplyNets()); - pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator ); - if (pyNetLocator == NULL) { return NULL; } + pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection); + if (pyNetCollection == NULL) { + return NULL; + } + pyNetCollection->_object = nets; - pyNetLocator->_object = nets.getLocator (); HCATCH - return ( (PyObject*)pyNetLocator ); + return ((PyObject*)pyNetCollection); } // --------------------------------------------------------------- - // Attribute Method : "PyCell_getPowerNetsLocator ()" + // Attribute Method : "PyCell_getPowerNets()" - static PyObject* PyCell_getPowerNetsLocator ( PyCell *self ) - { - trace << "PyCell_getPowerNetsLocator ()" << endl; + static PyObject* PyCell_getPowerNets(PyCell *self) { + trace << "PyCell_getPowerNets()" << endl; - METHOD_HEAD ( "Cell.getPowerNetsLocator()" ) + METHOD_HEAD ( "Cell.getPowerNets()" ) - PyNetLocator* pyNetLocator = NULL; + PyNetCollection* pyNetCollection = NULL; HTRY - Nets nets = cell->getPowerNets (); + Nets* nets = new Nets(cell->getPowerNets()); - pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator ); - if (pyNetLocator == NULL) { return NULL; } + pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection); + if (pyNetCollection == NULL) { + return NULL; + } + pyNetCollection->_object = nets; - pyNetLocator->_object = nets.getLocator (); HCATCH - return ( (PyObject*)pyNetLocator ); + return ((PyObject*)pyNetCollection); } // --------------------------------------------------------------- - // Attribute Method : "PyCell_getGroundNetsLocator ()" + // Attribute Method : "PyCell_getGroundNets()" - static PyObject* PyCell_getGroundNetsLocator ( PyCell *self ) { - trace << "PyCell_getGroundNetsLocator ()" << endl; + static PyObject* PyCell_getGroundNets(PyCell *self) { + trace << "PyCell_getGroundNets()" << endl; - METHOD_HEAD ( "Cell.getGroundNetsLocator()" ) + METHOD_HEAD ( "Cell.getGroundNets()" ) - PyNetLocator* pyNetLocator = NULL; + PyNetCollection* pyNetCollection = NULL; HTRY - Nets nets = cell->getGroundNets (); + Nets* nets = new Nets(cell->getGroundNets()); - pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator ); - if (pyNetLocator == NULL) { return NULL; } + pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection); + if (pyNetCollection == NULL) { + return NULL; + } + pyNetCollection->_object = nets; - pyNetLocator->_object = nets.getLocator (); HCATCH - return ( (PyObject*)pyNetLocator ); + return ((PyObject*)pyNetCollection); } - // --------------------------------------------------------------- // Attribute Method : "PyCell_getAbutmentBox ()" @@ -614,11 +621,11 @@ extern "C" { , { "getHyperNetsLocator" , (PyCFunction)PyCell_getHyperNetsLocator , METH_VARARGS, "Returns the collection of all hyperNets belonging to the cell." } , { "getNet" , (PyCFunction)PyCell_getNet , METH_VARARGS, "Returns the net of name if it exists, else NULL." } , { "getNets" , (PyCFunction)PyCell_getNets , METH_NOARGS , "Returns the collection of all nets of the cell." } - , { "getExternalNetsLocator", (PyCFunction)PyCell_getExternalNetsLocator, METH_NOARGS , "Returns the collection of all external nets of the cell." } - , { "getClockNetsLocator" , (PyCFunction)PyCell_getClockNetsLocator , METH_NOARGS , "Returns the collection of all clock nets of the cell." } - , { "getSupplyNetsLocator", (PyCFunction)PyCell_getSupplyNetsLocator, METH_NOARGS , "Returns the collection of all supply nets of the cell." } - , { "getPowerNetsLocator" , (PyCFunction)PyCell_getPowerNetsLocator , METH_NOARGS , "Returns the collection of all power nets of the cell." } - , { "getGroundNetsLocator", (PyCFunction)PyCell_getGroundNetsLocator, METH_NOARGS , "Returns the collection of all ground nets of the cell." } + , { "getExternalNets", (PyCFunction)PyCell_getExternalNets, METH_NOARGS , "Returns the collection of all external nets of the cell." } + , { "getClockNets" , (PyCFunction)PyCell_getClockNets, METH_NOARGS , "Returns the collection of all clock nets of the cell." } + , { "getSupplyNets", (PyCFunction)PyCell_getSupplyNets, METH_NOARGS , "Returns the collection of all supply nets of the cell." } + , { "getPowerNets" , (PyCFunction)PyCell_getPowerNets, METH_NOARGS , "Returns the collection of all power nets of the cell." } + , { "getGroundNets", (PyCFunction)PyCell_getGroundNets, METH_NOARGS , "Returns the collection of all ground nets of the cell." } , { "getAbutmentBox" , (PyCFunction)PyCell_getAbutmentBox , METH_NOARGS , "Returns the abutment box of the cell(which is defined by the designer unlike the bounding box which is managed dynamically)" } , { "isTerminal" , (PyCFunction)PyCell_isTerminal , METH_NOARGS , "Returns true if the cell is marked as terminal, else false." } , { "isLeaf" , (PyCFunction)PyCell_isLeaf , METH_NOARGS , "Returns true if the cell is a leaf of the hierarchy, else false." } @@ -643,9 +650,8 @@ extern "C" { PyObject* arg1; string lib_name_arg = ":library:name"; if (!ParseTwoArg("Cell.init", args, lib_name_arg, &arg0, &arg1)) { - cerr << "argument error" << endl; - PyErr_SetString ( ConstructorError, "invalid number of parameters for Cell constructor." ); - return(NULL); + PyErr_SetString ( ConstructorError, "invalid number of parameters for Cell constructor."); + return NULL; } Cell* cell = NULL; diff --git a/hurricane/src/isobar/PyContact.cpp b/hurricane/src/isobar/PyContact.cpp index 9c45b375..544dd340 100644 --- a/hurricane/src/isobar/PyContact.cpp +++ b/hurricane/src/isobar/PyContact.cpp @@ -147,7 +147,10 @@ extern "C" { ,Converter,&arg3 ,Converter,&arg4 ,Converter,&arg5 - ) ) return ( NULL ); + )) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Contact constructor." ); + return ( NULL ); + } //cerr << "Format := " << __cs.getObjectIds() << endl; diff --git a/hurricane/src/isobar/PyHorizontal.cpp b/hurricane/src/isobar/PyHorizontal.cpp index ea43b013..2d382103 100644 --- a/hurricane/src/isobar/PyHorizontal.cpp +++ b/hurricane/src/isobar/PyHorizontal.cpp @@ -131,7 +131,10 @@ extern "C" { ,Converter,&arg4 ,Converter,&arg5 ,Converter,&arg6 - ) ) return ( NULL ); + )) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Horizontal constructor." ); + return NULL; + } if ( __cs.getObjectIds() == NET_LAYER_INT_ARG ) horizontal = Horizontal::create ( PYNET_O(arg0) @@ -182,9 +185,8 @@ extern "C" { , PyInt_AsLong(arg5) , PyInt_AsLong(arg6) ); else { - cerr << __cs.getObjectIds() << endl; PyErr_SetString ( ConstructorError, "invalid number of parameters for Horizontal constructor." ); - return ( NULL ); + return NULL; } HCATCH diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index 0c9bb46b..d6c93032 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -369,11 +369,6 @@ using namespace Hurricane; string firstArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 0 ); string firstArgTypeExp = ConverterState::getObjectType ( format , 0 ); if ( firstArgType != firstArgTypeExp ) { - message << "First argument of call to " << __cs.getFunction() - << "() is of unexpected type " << (*arg)->ob_type->tp_name - << ", must be of type " << __cs.getObjectName( firstArgTypeExp ); - - PyErr_SetString ( ProxyError, message.str().c_str() ); return ( false ); } @@ -388,26 +383,17 @@ using namespace Hurricane; bool ParseTwoArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1 ) { ostringstream message; - __cs.Init ( function ); if ( ! PyArg_ParseTuple(args,"O&O&",Converter,arg0,Converter,arg1) ) return ( false ); string firstArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 0 ); string firstArgTypeExp = ConverterState::getObjectType ( format , 0 ); if ( firstArgType != firstArgTypeExp ) { - message << "First argument of call to " << __cs.getFunction() - << "() is of unexpected type " << (*arg0)->ob_type->tp_name - << ", must be of type " << __cs.getObjectName( firstArgTypeExp ); - PyErr_SetString ( ProxyError, message.str().c_str() ); return ( false ); } string secondArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 1 ); string secondArgTypeExp = ConverterState::getObjectType ( format , 1 ); if ( secondArgType != secondArgTypeExp ) { - message << "Second argument of call to " << __cs.getFunction() - << "() is of unexpected type " << (*arg1)->ob_type->tp_name - << ", must be of type " << __cs.getObjectName( secondArgTypeExp ); - PyErr_SetString ( ProxyError, message.str().c_str() ); return ( false ); } @@ -423,6 +409,7 @@ using namespace Hurricane; bool ParseThreeArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1, PyObject** arg2 ) { ostringstream message; + cerr << "akecoucou2" << endl; __cs.Init ( function ); if ( ! PyArg_ParseTuple(args,"O&O&O&",Converter,arg0,Converter,arg1,Converter,arg2) ) return ( false ); @@ -430,18 +417,11 @@ using namespace Hurricane; string firstArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 0 ); string firstArgTypeExp = ConverterState::getObjectType ( format , 0 ); if ( firstArgType != firstArgTypeExp ) { - message << "First argument of call to " << __cs.getFunction() - << "() is of unexpected type " << (*arg0)->ob_type->tp_name - << ", must be of type " << __cs.getObjectName( firstArgTypeExp ); - PyErr_SetString ( ProxyError, message.str().c_str() ); return ( false ); } string secondArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 1 ); string secondArgTypeExp = ConverterState::getObjectType ( format , 1 ); if ( secondArgType != secondArgTypeExp ) { - message << "Second argument of call to " << __cs.getFunction() - << "() is of unexpected type " << (*arg1)->ob_type->tp_name - << ", must be of type " << __cs.getObjectName( secondArgTypeExp ); PyErr_SetString ( ProxyError, message.str().c_str() ); return ( false ); } @@ -717,6 +697,8 @@ extern "C" { NetLoadConstants ( dictionnary ); InstanceLoadConstants ( dictionnary ); PinLoadConstants ( dictionnary ); + + trace_on(); } diff --git a/hurricane/src/isobar/PyHyperNet.cpp b/hurricane/src/isobar/PyHyperNet.cpp index a3a7d982..850fa96d 100644 --- a/hurricane/src/isobar/PyHyperNet.cpp +++ b/hurricane/src/isobar/PyHyperNet.cpp @@ -172,7 +172,10 @@ extern "C" { HyperNet* hyperNet = NULL; PyObject* arg0; - if ( ! ParseOneArg ( "HyperNet.new()", args, ":occur", &arg0 ) ) return ( NULL ); + if (! ParseOneArg ( "HyperNet.new()", args, ":occur", &arg0 )) { + PyErr_SetString(ConstructorError, "invalid number of parameters for HyperNet constructor." ); + return ( NULL ); + } hyperNet = new HyperNet ( *PYOCCURRENCE_O(arg0) ); diff --git a/hurricane/src/isobar/PyInstance.cpp b/hurricane/src/isobar/PyInstance.cpp index 2efaa364..dad95216 100644 --- a/hurricane/src/isobar/PyInstance.cpp +++ b/hurricane/src/isobar/PyInstance.cpp @@ -453,7 +453,10 @@ extern "C" { ,Converter,&arg1 ,Converter,&arg2 ,Converter,&arg3 - ) ) return ( NULL ); + )) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Instance constructor." ); + return NULL; + } if ( __cs.getObjectIds() == CELL_NAME_CELL_ARG ) { instance = Instance::create ( PYCELL_O(arg0) , *PYNAME_O(arg1) diff --git a/hurricane/src/isobar/PyLibrary.cpp b/hurricane/src/isobar/PyLibrary.cpp index b91d3a60..42dbd8c3 100644 --- a/hurricane/src/isobar/PyLibrary.cpp +++ b/hurricane/src/isobar/PyLibrary.cpp @@ -186,6 +186,7 @@ extern "C" { library = Library::create(masterLibrary, *PYNAME_O(arg1)); HCATCH } else { + PyErr_SetString(ConstructorError, "wrong arguments"); return NULL; } diff --git a/hurricane/src/isobar/PyName.cpp b/hurricane/src/isobar/PyName.cpp index 5eb8b21a..fc09cda5 100644 --- a/hurricane/src/isobar/PyName.cpp +++ b/hurricane/src/isobar/PyName.cpp @@ -109,14 +109,17 @@ extern "C" { PyObject* arg0; __cs.Init ("Name.new"); - if (!PyArg_ParseTuple(args,"|O&:Name.new",Converter,&arg0) ) return ( NULL ); + if (!PyArg_ParseTuple(args,"|O&:Name.new",Converter,&arg0)) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Name constructor." ); + return NULL; + } HTRY if (__cs.getObjectIds() == NO_ARG ) { name = new Name (); } else if (__cs.getObjectIds() == STRING_ARG ) { name = new Name ( PyString_AsString(arg0) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Name constructor." ); - return(NULL); + return NULL; } HCATCH diff --git a/hurricane/src/isobar/PyNet.cpp b/hurricane/src/isobar/PyNet.cpp index 95776ed1..fae5b50b 100644 --- a/hurricane/src/isobar/PyNet.cpp +++ b/hurricane/src/isobar/PyNet.cpp @@ -99,8 +99,7 @@ extern "C" { // --------------------------------------------------------------- // Local Function : "PyInt_AsType ()" - static Net::Type PyInt_AsType ( PyObject* object ) - { + static Net::Type PyInt_AsType ( PyObject* object ) { switch ( PyInt_AsLong(object) ) { case Net::Type::UNDEFINED : return ( Net::Type(Net::Type::UNDEFINED) ); case Net::Type::LOGICAL : return ( Net::Type(Net::Type::LOGICAL) ); @@ -428,9 +427,12 @@ extern "C" { METHOD_HEAD ( "Net.setType()" ) PyObject* arg0; - if ( ! ParseOneArg ( "Net.setType", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL ); + if (!ParseOneArg("Net.setType", args, INT_ARG, (PyObject**)&arg0)) { + PyErr_SetString(ConstructorError, "wrong parameter for NetType."); + return NULL; + } - net->setType ( PyInt_AsType(arg0) ); + net->setType(PyInt_AsType(arg0)); HCATCH @@ -562,7 +564,10 @@ extern "C" { PyObject* arg0; PyObject* arg1; - if ( ! ParseTwoArg ( "Net.new", args, CELL_NAME_ARG, &arg0, &arg1 ) ) return ( NULL ); + if (!ParseTwoArg("Net.new", args, CELL_NAME_ARG, &arg0, &arg1)) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Net constructor." ); + return NULL; + } HTRY net = Net::create ( PYCELL_O(arg0), *PYNAME_O(arg1) ); diff --git a/hurricane/src/isobar/PyNetCollection.cpp b/hurricane/src/isobar/PyNetCollection.cpp index 23411278..ed3474c9 100644 --- a/hurricane/src/isobar/PyNetCollection.cpp +++ b/hurricane/src/isobar/PyNetCollection.cpp @@ -66,15 +66,16 @@ extern "C" { #endif + DirectDeleteMethod(PyNetCollection_DeAlloc, PyNetCollection) + DirectDeleteMethod(PyNetCollectionLocator_DeAlloc, PyNetCollectionLocator) static PyObject* GetNetLocator(PyNetCollection *collection) { PyNetCollectionLocator* nl = PyObject_New(PyNetCollectionLocator, &PyTypeNetCollectionLocator); if (nl == NULL) { return NULL; } - Py_INCREF(nl); - nl->_object = collection->_object.getLocator(); + nl->_object = collection->_object->getLocator(); return (PyObject *)nl; } @@ -95,8 +96,11 @@ extern "C" { extern void PyNetCollection_LinkPyType () { trace << "PyNetCollection_LinkType()" << endl; PyTypeNetCollection.tp_iter = (getiterfunc)GetNetLocator; /* tp_iter */ + PyTypeNetCollection.tp_dealloc = (destructor)PyNetCollection_DeAlloc; + PyTypeNetCollectionLocator.tp_dealloc = (destructor)PyNetCollectionLocator_DeAlloc; PyTypeNetCollectionLocator.tp_iter = PyObject_SelfIter; PyTypeNetCollectionLocator.tp_iternext = (iternextfunc)NetLocatorNext; + PyTypeNetCollection.tp_dealloc = (destructor)PyNetCollection_DeAlloc; } diff --git a/hurricane/src/isobar/PyOccurrence.cpp b/hurricane/src/isobar/PyOccurrence.cpp index 88b2c8d0..f7bfcf29 100644 --- a/hurricane/src/isobar/PyOccurrence.cpp +++ b/hurricane/src/isobar/PyOccurrence.cpp @@ -254,7 +254,10 @@ extern "C" { if ( ! PyArg_ParseTuple(args,"|O&O&:Occurrence.new" ,Converter,&arg0 ,Converter,&arg1 - ) ) return ( NULL ); + )) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Occurrence constructor. " ); + return NULL; + } if ( __cs.getObjectIds() == NO_ARG ) { occurrence = new Occurrence (); } else if ( __cs.getObjectIds() == ENT_ARG ) { occurrence = new Occurrence ( PYENTITY_O(arg0) ); } diff --git a/hurricane/src/isobar/PyPath.cpp b/hurricane/src/isobar/PyPath.cpp index aaa9bf43..57564d6d 100644 --- a/hurricane/src/isobar/PyPath.cpp +++ b/hurricane/src/isobar/PyPath.cpp @@ -322,7 +322,10 @@ extern "C" { if ( ! PyArg_ParseTuple(args,"|O&O&:Path.new" ,Converter,&arg0 ,Converter,&arg1 - ) ) return ( NULL ); + )) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Path constructor." ); + return NULL; + } HTRY diff --git a/hurricane/src/isobar/PyPin.cpp b/hurricane/src/isobar/PyPin.cpp index a1579fb0..c26ee310 100644 --- a/hurricane/src/isobar/PyPin.cpp +++ b/hurricane/src/isobar/PyPin.cpp @@ -172,7 +172,7 @@ extern "C" { PyObject* arg8; __cs.Init ("Pin.new"); - if ( ! PyArg_ParseTuple(args,"O&O&O&O&O&O&O&|O&O&:Pin.new" + if (!PyArg_ParseTuple(args,"O&O&O&O&O&O&O&|O&O&:Pin.new" , Converter, &arg0 , Converter, &arg1 , Converter, &arg2 @@ -182,7 +182,10 @@ extern "C" { , Converter, &arg6 , Converter, &arg7 , Converter, &arg8 - ) ) return ( NULL ); + )) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Pin constructor." ); + return NULL; + } string pin_arg1 = ":ent:name:int:int:layer:int:int:int:int"; string pin_arg2 = ":ent:name:int:int:layer:int:int:int"; @@ -213,7 +216,7 @@ extern "C" { , PyInt_AsLong ( arg6 ) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Pin constructor." ); - return ( NULL ); + return NULL; } HCATCH diff --git a/hurricane/src/isobar/PyPoint.cpp b/hurricane/src/isobar/PyPoint.cpp index 1f84e589..fd071877 100644 --- a/hurricane/src/isobar/PyPoint.cpp +++ b/hurricane/src/isobar/PyPoint.cpp @@ -147,7 +147,10 @@ extern "C" { if ( ! PyArg_ParseTuple(args,"|O&O&:Point.create" ,Converter,&arg0 ,Converter,&arg1 - ) ) return ( NULL ); + )) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Point constructor." ); + return NULL; + } if ( __cs.getObjectIds() == NO_ARG ) { point = new Point (); } else if ( __cs.getObjectIds() == POINT_ARG ) { point = new Point ( *PYPOINT_O(arg0) ); } @@ -155,7 +158,7 @@ extern "C" { , PyInt_AsLong(arg1) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Point constructor." ); - return ( NULL ); + return NULL; } PyPoint* pyPoint = PyObject_NEW(PyPoint, &PyTypePoint); diff --git a/hurricane/src/isobar/PyReference.cpp b/hurricane/src/isobar/PyReference.cpp index 9718207b..a63e6488 100644 --- a/hurricane/src/isobar/PyReference.cpp +++ b/hurricane/src/isobar/PyReference.cpp @@ -201,7 +201,10 @@ extern "C" { ,Converter,&arg1 ,Converter,&arg2 ,Converter,&arg3 - ) ) return ( NULL ); + )) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Reference constructor." ); + return NULL; + } if ( __cs.getObjectIds() == CELL_NAME_INTS2_ARG ) reference = Reference::create ( PYCELL_O(arg0) @@ -214,11 +217,9 @@ extern "C" { , *PYPOINT_O(arg2) ); else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Reference constructor." ); - return ( NULL ); + return NULL; } - if (reference == NULL) { printf("error of creation of reference \n"); return (NULL) ; } - HCATCH return PyReference_Link ( reference ); diff --git a/hurricane/src/isobar/PyTransformation.cpp b/hurricane/src/isobar/PyTransformation.cpp index a4b52dfd..8720692d 100644 --- a/hurricane/src/isobar/PyTransformation.cpp +++ b/hurricane/src/isobar/PyTransformation.cpp @@ -556,7 +556,10 @@ extern "C" { ,Converter,&arg0 ,Converter,&arg1 ,Converter,&arg2 - ) ) return ( NULL ); + )) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Transformation constructor." ); + return NULL; + } if ( __cs.getObjectIds() == NO_ARG ) { transf = new Transformation (); } else if ( __cs.getObjectIds() == POINT_ARG ) { transf = new Transformation ( *PYPOINT_O(arg0) ); } @@ -570,11 +573,11 @@ extern "C" { , PyInt_AsOrientation(arg2) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Transformation constructor." ); - return ( NULL ); + return NULL; } PyTransformation* pyTransformation = PyObject_NEW(PyTransformation, &PyTypeTransformation); - if (pyTransformation == NULL) { ; return NULL; } + if (pyTransformation == NULL) { return NULL; } trace_in (); trace << "new PyTransformation [" << hex << pyTransformation << "]" << endl; @@ -586,7 +589,7 @@ extern "C" { HCATCH - return ( (PyObject*)pyTransformation ); + return (PyObject*)pyTransformation; } DirectDeleteMethod(PyTransformation_DeAlloc,PyTransformation) diff --git a/hurricane/src/isobar/PyVertical.cpp b/hurricane/src/isobar/PyVertical.cpp index d8af0196..0fccb3f1 100644 --- a/hurricane/src/isobar/PyVertical.cpp +++ b/hurricane/src/isobar/PyVertical.cpp @@ -126,10 +126,12 @@ extern "C" { ,Converter,&arg4 ,Converter,&arg5 ,Converter,&arg6 - ) ) return ( NULL ); + )) { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Vertical constructor." ); + return NULL; + } - //cerr << "Format := " << __cs.getObjectIds() << endl; if ( __cs.getObjectIds() == NET_LAYER_INT_ARG ) vertical = Vertical::create ( PYNET_O(arg0) , PYLAYER_O(arg1) @@ -180,7 +182,7 @@ extern "C" { , PyInt_AsLong(arg6) ); else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Vertical constructor." ); - return ( NULL ); + return NULL; } HCATCH diff --git a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h index 810dcf81..103ca925 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h @@ -327,10 +327,10 @@ extern "C" { // ------------------------------------------------------------------- // Attribute Method For Deletion. -# define DirectDeleteMethod(PY_FUNC_NAME,PY_SELF_TYPE) \ +#define DirectDeleteMethod(PY_FUNC_NAME, PY_SELF_TYPE) \ static void PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ { \ - trace << "PyHObject_DeAlloc(" << hex << self << ") " \ + trace << #PY_SELF_TYPE"_DeAlloc(" << hex << self << ") " \ << self->ACCESS_OBJECT << endl; \ \ if ( self->ACCESS_OBJECT ) delete self->ACCESS_OBJECT; \ @@ -342,7 +342,7 @@ extern "C" { // ------------------------------------------------------------------- // Attribute Method For Deletion. -# define PlugDeleteMethod(PY_FUNC_NAME,PY_SELF_TYPE) \ +#define PlugDeleteMethod(PY_FUNC_NAME,PY_SELF_TYPE) \ static void PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ { \ trace << "PyHObject_DeAlloc(" << hex << self << ") " \ @@ -697,7 +697,7 @@ extern "C" { PyTypeObject PyType##SELF_TYPE = \ { PyObject_HEAD_INIT(NULL) \ 0 /* ob_size. */ \ - , "Hurricane.##SELF_TYPE" /* tp_name. */ \ + , "Hurricane."#SELF_TYPE /* tp_name. */ \ , sizeof(Py##SELF_TYPE) /* tp_basicsize. */ \ , 0 /* tp_itemsize. */ \ /* methods. */ \ diff --git a/hurricane/src/isobar/hurricane/isobar/PyNetCollection.h b/hurricane/src/isobar/hurricane/isobar/PyNetCollection.h index eab5eab4..061db23d 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyNetCollection.h +++ b/hurricane/src/isobar/hurricane/isobar/PyNetCollection.h @@ -19,7 +19,7 @@ extern "C" { typedef struct { PyObject_HEAD - Hurricane::Nets _object; + Hurricane::Nets* _object; } PyNetCollection; typedef struct {