cleaning in error message if bad arguments

net collections in progress
This commit is contained in:
The Coriolis Project 2008-10-14 18:44:20 +00:00
parent 0f46cfdb7f
commit cd1c194268
20 changed files with 158 additions and 128 deletions

View File

@ -57,7 +57,6 @@
#include "hurricane/isobar/PyOccurrence.h" #include "hurricane/isobar/PyOccurrence.h"
#include "hurricane/isobar/ProxyProperty.h" #include "hurricane/isobar/ProxyProperty.h"
#include "hurricane/isobar/PyNet.h" #include "hurricane/isobar/PyNet.h"
#include "hurricane/isobar/PyNetLocator.h"
#include "hurricane/isobar/PyNetCollection.h" #include "hurricane/isobar/PyNetCollection.h"
#include "hurricane/isobar/PyReferenceLocator.h" #include "hurricane/isobar/PyReferenceLocator.h"
#include "hurricane/isobar/PyInstanceLocator.h" #include "hurricane/isobar/PyInstanceLocator.h"
@ -388,10 +387,12 @@ extern "C" {
PyNetCollection* pyNetCollection = NULL; PyNetCollection* pyNetCollection = NULL;
HTRY HTRY
Nets nets = cell->getNets (); Nets* nets = new Nets(cell->getNets());
pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection); pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection);
if (pyNetCollection == NULL) { return NULL; } if (pyNetCollection == NULL) {
return NULL;
}
pyNetCollection->_object = nets; pyNetCollection->_object = nets;
HCATCH HCATCH
@ -401,121 +402,127 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Attribute Method : "PyCell_getExternalNetsLocator ()" // Attribute Method : "PyCell_getExternalNets()"
static PyObject* PyCell_getExternalNetsLocator ( PyCell *self ) { static PyObject* PyCell_getExternalNets(PyCell *self) {
trace << "PyCell_getExternalNetsLocator ()" << endl; trace << "PyCell_getExternalNets()" << endl;
METHOD_HEAD ( "Cell.getExternalNetsLocator()" ) METHOD_HEAD("Cell.getExternalNets()")
PyNetLocator* pyNetLocator = NULL; PyNetCollection* pyNetCollection = NULL;
HTRY HTRY
Nets nets = cell->getExternalNets (); Nets* nets = new Nets(cell->getExternalNets());
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator ); pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection);
if (pyNetLocator == NULL) { return NULL; } if (pyNetCollection == NULL) {
return NULL;
}
pyNetCollection->_object = nets;
pyNetLocator->_object = nets.getLocator ();
HCATCH HCATCH
return ( (PyObject*)pyNetLocator ); return ((PyObject*)pyNetCollection);
} }
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Attribute Method : "PyCell_getClockNetsLocator ()" // Attribute Method : "PyCell_getClockNets()"
static PyObject* PyCell_getClockNetsLocator ( PyCell *self ) { static PyObject* PyCell_getClockNets(PyCell *self) {
trace << "PyCell_getClockNetsLocator ()" << endl; trace << "PyCell_getClockNets()" << endl;
METHOD_HEAD ( "Cell.getClockNetsLocator()" ) METHOD_HEAD("Cell.getClockNets")
PyNetLocator* pyNetLocator = NULL; PyNetCollection* pyNetCollection = NULL;
HTRY HTRY
Nets nets = cell->getClockNets (); Nets* nets = new Nets(cell->getClockNets());
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator ); pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection);
if (pyNetLocator == NULL) { return NULL; } if (pyNetCollection == NULL) {
return NULL;
}
pyNetCollection->_object = nets;
pyNetLocator->_object = nets.getLocator ();
HCATCH HCATCH
return ( (PyObject*)pyNetLocator ); return ((PyObject*)pyNetCollection);
} }
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Attribute Method : "PyCell_getSupplyNetsLocator ()" // Attribute Method : "PyCell_getSupplyNets()"
static PyObject* PyCell_getSupplyNetsLocator ( PyCell *self ) { static PyObject* PyCell_getSupplyNets(PyCell *self) {
trace << "PyCell_getSupplyNetsLocator ()" << endl; trace << "PyCell_getSupplyNets()" << endl;
METHOD_HEAD ( "Cell.getSupplyNetsLocator()" ) METHOD_HEAD ( "Cell.getSupplyNets()" )
PyNetLocator* pyNetLocator = NULL; PyNetCollection* pyNetCollection = NULL;
HTRY HTRY
Nets nets = cell->getSupplyNets (); Nets* nets = new Nets(cell->getSupplyNets());
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator ); pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection);
if (pyNetLocator == NULL) { return NULL; } if (pyNetCollection == NULL) {
return NULL;
}
pyNetCollection->_object = nets;
pyNetLocator->_object = nets.getLocator ();
HCATCH HCATCH
return ( (PyObject*)pyNetLocator ); return ((PyObject*)pyNetCollection);
} }
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Attribute Method : "PyCell_getPowerNetsLocator ()" // Attribute Method : "PyCell_getPowerNets()"
static PyObject* PyCell_getPowerNetsLocator ( PyCell *self ) static PyObject* PyCell_getPowerNets(PyCell *self) {
{ trace << "PyCell_getPowerNets()" << endl;
trace << "PyCell_getPowerNetsLocator ()" << endl;
METHOD_HEAD ( "Cell.getPowerNetsLocator()" ) METHOD_HEAD ( "Cell.getPowerNets()" )
PyNetLocator* pyNetLocator = NULL; PyNetCollection* pyNetCollection = NULL;
HTRY HTRY
Nets nets = cell->getPowerNets (); Nets* nets = new Nets(cell->getPowerNets());
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator ); pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection);
if (pyNetLocator == NULL) { return NULL; } if (pyNetCollection == NULL) {
return NULL;
}
pyNetCollection->_object = nets;
pyNetLocator->_object = nets.getLocator ();
HCATCH HCATCH
return ( (PyObject*)pyNetLocator ); return ((PyObject*)pyNetCollection);
} }
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Attribute Method : "PyCell_getGroundNetsLocator ()" // Attribute Method : "PyCell_getGroundNets()"
static PyObject* PyCell_getGroundNetsLocator ( PyCell *self ) { static PyObject* PyCell_getGroundNets(PyCell *self) {
trace << "PyCell_getGroundNetsLocator ()" << endl; trace << "PyCell_getGroundNets()" << endl;
METHOD_HEAD ( "Cell.getGroundNetsLocator()" ) METHOD_HEAD ( "Cell.getGroundNets()" )
PyNetLocator* pyNetLocator = NULL; PyNetCollection* pyNetCollection = NULL;
HTRY HTRY
Nets nets = cell->getGroundNets (); Nets* nets = new Nets(cell->getGroundNets());
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator ); pyNetCollection = PyObject_NEW(PyNetCollection, &PyTypeNetCollection);
if (pyNetLocator == NULL) { return NULL; } if (pyNetCollection == NULL) {
return NULL;
}
pyNetCollection->_object = nets;
pyNetLocator->_object = nets.getLocator ();
HCATCH HCATCH
return ( (PyObject*)pyNetLocator ); return ((PyObject*)pyNetCollection);
} }
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Attribute Method : "PyCell_getAbutmentBox ()" // 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." } , { "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 <name> if it exists, else NULL." } , { "getNet" , (PyCFunction)PyCell_getNet , METH_VARARGS, "Returns the net of name <name> if it exists, else NULL." }
, { "getNets" , (PyCFunction)PyCell_getNets , METH_NOARGS , "Returns the collection of all nets of the cell." } , { "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." } , { "getExternalNets", (PyCFunction)PyCell_getExternalNets, 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." } , { "getClockNets" , (PyCFunction)PyCell_getClockNets, 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." } , { "getSupplyNets", (PyCFunction)PyCell_getSupplyNets, 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." } , { "getPowerNets" , (PyCFunction)PyCell_getPowerNets, 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." } , { "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)" } , { "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." } , { "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." } , { "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; PyObject* arg1;
string lib_name_arg = ":library:name"; string lib_name_arg = ":library:name";
if (!ParseTwoArg("Cell.init", args, lib_name_arg, &arg0, &arg1)) { if (!ParseTwoArg("Cell.init", args, lib_name_arg, &arg0, &arg1)) {
cerr << "argument error" << endl;
PyErr_SetString ( ConstructorError, "invalid number of parameters for Cell constructor."); PyErr_SetString ( ConstructorError, "invalid number of parameters for Cell constructor.");
return(NULL); return NULL;
} }
Cell* cell = NULL; Cell* cell = NULL;

View File

@ -147,7 +147,10 @@ extern "C" {
,Converter,&arg3 ,Converter,&arg3
,Converter,&arg4 ,Converter,&arg4
,Converter,&arg5 ,Converter,&arg5
) ) return ( NULL ); )) {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Contact constructor." );
return ( NULL );
}
//cerr << "Format := " << __cs.getObjectIds() << endl; //cerr << "Format := " << __cs.getObjectIds() << endl;

View File

@ -131,7 +131,10 @@ extern "C" {
,Converter,&arg4 ,Converter,&arg4
,Converter,&arg5 ,Converter,&arg5
,Converter,&arg6 ,Converter,&arg6
) ) return ( NULL ); )) {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Horizontal constructor." );
return NULL;
}
if ( __cs.getObjectIds() == NET_LAYER_INT_ARG ) if ( __cs.getObjectIds() == NET_LAYER_INT_ARG )
horizontal = Horizontal::create ( PYNET_O(arg0) horizontal = Horizontal::create ( PYNET_O(arg0)
@ -182,9 +185,8 @@ extern "C" {
, PyInt_AsLong(arg5) , PyInt_AsLong(arg5)
, PyInt_AsLong(arg6) ); , PyInt_AsLong(arg6) );
else { else {
cerr << __cs.getObjectIds() << endl;
PyErr_SetString ( ConstructorError, "invalid number of parameters for Horizontal constructor." ); PyErr_SetString ( ConstructorError, "invalid number of parameters for Horizontal constructor." );
return ( NULL ); return NULL;
} }
HCATCH HCATCH

View File

@ -369,11 +369,6 @@ using namespace Hurricane;
string firstArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 0 ); string firstArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 0 );
string firstArgTypeExp = ConverterState::getObjectType ( format , 0 ); string firstArgTypeExp = ConverterState::getObjectType ( format , 0 );
if ( firstArgType != firstArgTypeExp ) { 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 ); return ( false );
} }
@ -388,26 +383,17 @@ using namespace Hurricane;
bool ParseTwoArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1 ) { bool ParseTwoArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1 ) {
ostringstream message; ostringstream message;
__cs.Init ( function ); __cs.Init ( function );
if ( ! PyArg_ParseTuple(args,"O&O&",Converter,arg0,Converter,arg1) ) return ( false ); if ( ! PyArg_ParseTuple(args,"O&O&",Converter,arg0,Converter,arg1) ) return ( false );
string firstArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 0 ); string firstArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 0 );
string firstArgTypeExp = ConverterState::getObjectType ( format , 0 ); string firstArgTypeExp = ConverterState::getObjectType ( format , 0 );
if ( firstArgType != firstArgTypeExp ) { 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 ); return ( false );
} }
string secondArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 1 ); string secondArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 1 );
string secondArgTypeExp = ConverterState::getObjectType ( format , 1 ); string secondArgTypeExp = ConverterState::getObjectType ( format , 1 );
if ( secondArgType != secondArgTypeExp ) { 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 ); return ( false );
} }
@ -423,6 +409,7 @@ using namespace Hurricane;
bool ParseThreeArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1, PyObject** arg2 ) { bool ParseThreeArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1, PyObject** arg2 ) {
ostringstream message; ostringstream message;
cerr << "akecoucou2" << endl;
__cs.Init ( function ); __cs.Init ( function );
if ( ! PyArg_ParseTuple(args,"O&O&O&",Converter,arg0,Converter,arg1,Converter,arg2) ) return ( false ); 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 firstArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 0 );
string firstArgTypeExp = ConverterState::getObjectType ( format , 0 ); string firstArgTypeExp = ConverterState::getObjectType ( format , 0 );
if ( firstArgType != firstArgTypeExp ) { 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 ); return ( false );
} }
string secondArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 1 ); string secondArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 1 );
string secondArgTypeExp = ConverterState::getObjectType ( format , 1 ); string secondArgTypeExp = ConverterState::getObjectType ( format , 1 );
if ( secondArgType != secondArgTypeExp ) { 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() ); PyErr_SetString ( ProxyError, message.str().c_str() );
return ( false ); return ( false );
} }
@ -717,6 +697,8 @@ extern "C" {
NetLoadConstants ( dictionnary ); NetLoadConstants ( dictionnary );
InstanceLoadConstants ( dictionnary ); InstanceLoadConstants ( dictionnary );
PinLoadConstants ( dictionnary ); PinLoadConstants ( dictionnary );
trace_on();
} }

View File

@ -172,7 +172,10 @@ extern "C" {
HyperNet* hyperNet = NULL; HyperNet* hyperNet = NULL;
PyObject* arg0; 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) ); hyperNet = new HyperNet ( *PYOCCURRENCE_O(arg0) );

View File

@ -453,7 +453,10 @@ extern "C" {
,Converter,&arg1 ,Converter,&arg1
,Converter,&arg2 ,Converter,&arg2
,Converter,&arg3 ,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) if ( __cs.getObjectIds() == CELL_NAME_CELL_ARG ) { instance = Instance::create ( PYCELL_O(arg0)
, *PYNAME_O(arg1) , *PYNAME_O(arg1)

View File

@ -186,6 +186,7 @@ extern "C" {
library = Library::create(masterLibrary, *PYNAME_O(arg1)); library = Library::create(masterLibrary, *PYNAME_O(arg1));
HCATCH HCATCH
} else { } else {
PyErr_SetString(ConstructorError, "wrong arguments");
return NULL; return NULL;
} }

View File

@ -109,14 +109,17 @@ extern "C" {
PyObject* arg0; PyObject* arg0;
__cs.Init ("Name.new"); __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 HTRY
if (__cs.getObjectIds() == NO_ARG ) { name = new Name (); } if (__cs.getObjectIds() == NO_ARG ) { name = new Name (); }
else if (__cs.getObjectIds() == STRING_ARG ) { name = new Name ( PyString_AsString(arg0) ); } else if (__cs.getObjectIds() == STRING_ARG ) { name = new Name ( PyString_AsString(arg0) ); }
else { else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Name constructor." ); PyErr_SetString ( ConstructorError, "invalid number of parameters for Name constructor." );
return(NULL); return NULL;
} }
HCATCH HCATCH

View File

@ -99,8 +99,7 @@ extern "C" {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Local Function : "PyInt_AsType ()" // Local Function : "PyInt_AsType ()"
static Net::Type PyInt_AsType ( PyObject* object ) static Net::Type PyInt_AsType ( PyObject* object ) {
{
switch ( PyInt_AsLong(object) ) { switch ( PyInt_AsLong(object) ) {
case Net::Type::UNDEFINED : return ( Net::Type(Net::Type::UNDEFINED) ); case Net::Type::UNDEFINED : return ( Net::Type(Net::Type::UNDEFINED) );
case Net::Type::LOGICAL : return ( Net::Type(Net::Type::LOGICAL) ); case Net::Type::LOGICAL : return ( Net::Type(Net::Type::LOGICAL) );
@ -428,7 +427,10 @@ extern "C" {
METHOD_HEAD ( "Net.setType()" ) METHOD_HEAD ( "Net.setType()" )
PyObject* arg0; 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));
@ -562,7 +564,10 @@ extern "C" {
PyObject* arg0; PyObject* arg0;
PyObject* arg1; 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 HTRY
net = Net::create ( PYCELL_O(arg0), *PYNAME_O(arg1) ); net = Net::create ( PYCELL_O(arg0), *PYNAME_O(arg1) );

View File

@ -66,15 +66,16 @@ extern "C" {
#endif #endif
DirectDeleteMethod(PyNetCollection_DeAlloc, PyNetCollection)
DirectDeleteMethod(PyNetCollectionLocator_DeAlloc, PyNetCollectionLocator)
static PyObject* GetNetLocator(PyNetCollection *collection) { static PyObject* GetNetLocator(PyNetCollection *collection) {
PyNetCollectionLocator* nl = PyObject_New(PyNetCollectionLocator, &PyTypeNetCollectionLocator); PyNetCollectionLocator* nl = PyObject_New(PyNetCollectionLocator, &PyTypeNetCollectionLocator);
if (nl == NULL) { if (nl == NULL) {
return NULL; return NULL;
} }
Py_INCREF(nl);
nl->_object = collection->_object.getLocator(); nl->_object = collection->_object->getLocator();
return (PyObject *)nl; return (PyObject *)nl;
} }
@ -95,8 +96,11 @@ extern "C" {
extern void PyNetCollection_LinkPyType () { extern void PyNetCollection_LinkPyType () {
trace << "PyNetCollection_LinkType()" << endl; trace << "PyNetCollection_LinkType()" << endl;
PyTypeNetCollection.tp_iter = (getiterfunc)GetNetLocator; /* tp_iter */ 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_iter = PyObject_SelfIter;
PyTypeNetCollectionLocator.tp_iternext = (iternextfunc)NetLocatorNext; PyTypeNetCollectionLocator.tp_iternext = (iternextfunc)NetLocatorNext;
PyTypeNetCollection.tp_dealloc = (destructor)PyNetCollection_DeAlloc;
} }

View File

@ -254,7 +254,10 @@ extern "C" {
if ( ! PyArg_ParseTuple(args,"|O&O&:Occurrence.new" if ( ! PyArg_ParseTuple(args,"|O&O&:Occurrence.new"
,Converter,&arg0 ,Converter,&arg0
,Converter,&arg1 ,Converter,&arg1
) ) return ( NULL ); )) {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Occurrence constructor. " );
return NULL;
}
if ( __cs.getObjectIds() == NO_ARG ) { occurrence = new Occurrence (); } if ( __cs.getObjectIds() == NO_ARG ) { occurrence = new Occurrence (); }
else if ( __cs.getObjectIds() == ENT_ARG ) { occurrence = new Occurrence ( PYENTITY_O(arg0) ); } else if ( __cs.getObjectIds() == ENT_ARG ) { occurrence = new Occurrence ( PYENTITY_O(arg0) ); }

View File

@ -322,7 +322,10 @@ extern "C" {
if ( ! PyArg_ParseTuple(args,"|O&O&:Path.new" if ( ! PyArg_ParseTuple(args,"|O&O&:Path.new"
,Converter,&arg0 ,Converter,&arg0
,Converter,&arg1 ,Converter,&arg1
) ) return ( NULL ); )) {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Path constructor." );
return NULL;
}
HTRY HTRY

View File

@ -182,7 +182,10 @@ extern "C" {
, Converter, &arg6 , Converter, &arg6
, Converter, &arg7 , Converter, &arg7
, Converter, &arg8 , 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_arg1 = ":ent:name:int:int:layer:int:int:int:int";
string pin_arg2 = ":ent:name:int:int:layer:int:int:int"; string pin_arg2 = ":ent:name:int:int:layer:int:int:int";
@ -213,7 +216,7 @@ extern "C" {
, PyInt_AsLong ( arg6 ) ); } , PyInt_AsLong ( arg6 ) ); }
else { else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Pin constructor." ); PyErr_SetString ( ConstructorError, "invalid number of parameters for Pin constructor." );
return ( NULL ); return NULL;
} }
HCATCH HCATCH

View File

@ -147,7 +147,10 @@ extern "C" {
if ( ! PyArg_ParseTuple(args,"|O&O&:Point.create" if ( ! PyArg_ParseTuple(args,"|O&O&:Point.create"
,Converter,&arg0 ,Converter,&arg0
,Converter,&arg1 ,Converter,&arg1
) ) return ( NULL ); )) {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Point constructor." );
return NULL;
}
if ( __cs.getObjectIds() == NO_ARG ) { point = new Point (); } if ( __cs.getObjectIds() == NO_ARG ) { point = new Point (); }
else if ( __cs.getObjectIds() == POINT_ARG ) { point = new Point ( *PYPOINT_O(arg0) ); } else if ( __cs.getObjectIds() == POINT_ARG ) { point = new Point ( *PYPOINT_O(arg0) ); }
@ -155,7 +158,7 @@ extern "C" {
, PyInt_AsLong(arg1) ); } , PyInt_AsLong(arg1) ); }
else { else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Point constructor." ); PyErr_SetString ( ConstructorError, "invalid number of parameters for Point constructor." );
return ( NULL ); return NULL;
} }
PyPoint* pyPoint = PyObject_NEW(PyPoint, &PyTypePoint); PyPoint* pyPoint = PyObject_NEW(PyPoint, &PyTypePoint);

View File

@ -201,7 +201,10 @@ extern "C" {
,Converter,&arg1 ,Converter,&arg1
,Converter,&arg2 ,Converter,&arg2
,Converter,&arg3 ,Converter,&arg3
) ) return ( NULL ); )) {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Reference constructor." );
return NULL;
}
if ( __cs.getObjectIds() == CELL_NAME_INTS2_ARG ) if ( __cs.getObjectIds() == CELL_NAME_INTS2_ARG )
reference = Reference::create ( PYCELL_O(arg0) reference = Reference::create ( PYCELL_O(arg0)
@ -214,11 +217,9 @@ extern "C" {
, *PYPOINT_O(arg2) ); , *PYPOINT_O(arg2) );
else { else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Reference constructor." ); 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 HCATCH
return PyReference_Link ( reference ); return PyReference_Link ( reference );

View File

@ -556,7 +556,10 @@ extern "C" {
,Converter,&arg0 ,Converter,&arg0
,Converter,&arg1 ,Converter,&arg1
,Converter,&arg2 ,Converter,&arg2
) ) return ( NULL ); )) {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Transformation constructor." );
return NULL;
}
if ( __cs.getObjectIds() == NO_ARG ) { transf = new Transformation (); } if ( __cs.getObjectIds() == NO_ARG ) { transf = new Transformation (); }
else if ( __cs.getObjectIds() == POINT_ARG ) { transf = new Transformation ( *PYPOINT_O(arg0) ); } else if ( __cs.getObjectIds() == POINT_ARG ) { transf = new Transformation ( *PYPOINT_O(arg0) ); }
@ -570,11 +573,11 @@ extern "C" {
, PyInt_AsOrientation(arg2) ); } , PyInt_AsOrientation(arg2) ); }
else { else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Transformation constructor." ); PyErr_SetString ( ConstructorError, "invalid number of parameters for Transformation constructor." );
return ( NULL ); return NULL;
} }
PyTransformation* pyTransformation = PyObject_NEW(PyTransformation, &PyTypeTransformation); PyTransformation* pyTransformation = PyObject_NEW(PyTransformation, &PyTypeTransformation);
if (pyTransformation == NULL) { ; return NULL; } if (pyTransformation == NULL) { return NULL; }
trace_in (); trace_in ();
trace << "new PyTransformation [" << hex << pyTransformation << "]" << endl; trace << "new PyTransformation [" << hex << pyTransformation << "]" << endl;
@ -586,7 +589,7 @@ extern "C" {
HCATCH HCATCH
return ( (PyObject*)pyTransformation ); return (PyObject*)pyTransformation;
} }
DirectDeleteMethod(PyTransformation_DeAlloc,PyTransformation) DirectDeleteMethod(PyTransformation_DeAlloc,PyTransformation)

View File

@ -126,10 +126,12 @@ extern "C" {
,Converter,&arg4 ,Converter,&arg4
,Converter,&arg5 ,Converter,&arg5
,Converter,&arg6 ,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 ) if ( __cs.getObjectIds() == NET_LAYER_INT_ARG )
vertical = Vertical::create ( PYNET_O(arg0) vertical = Vertical::create ( PYNET_O(arg0)
, PYLAYER_O(arg1) , PYLAYER_O(arg1)
@ -180,7 +182,7 @@ extern "C" {
, PyInt_AsLong(arg6) ); , PyInt_AsLong(arg6) );
else { else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Vertical constructor." ); PyErr_SetString ( ConstructorError, "invalid number of parameters for Vertical constructor." );
return ( NULL ); return NULL;
} }
HCATCH HCATCH

View File

@ -330,7 +330,7 @@ extern "C" {
#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 ) \ 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; \ << self->ACCESS_OBJECT << endl; \
\ \
if ( self->ACCESS_OBJECT ) delete self->ACCESS_OBJECT; \ if ( self->ACCESS_OBJECT ) delete self->ACCESS_OBJECT; \
@ -697,7 +697,7 @@ extern "C" {
PyTypeObject PyType##SELF_TYPE = \ PyTypeObject PyType##SELF_TYPE = \
{ PyObject_HEAD_INIT(NULL) \ { PyObject_HEAD_INIT(NULL) \
0 /* ob_size. */ \ 0 /* ob_size. */ \
, "Hurricane.##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. */ \

View File

@ -19,7 +19,7 @@ extern "C" {
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
Hurricane::Nets _object; Hurricane::Nets* _object;
} PyNetCollection; } PyNetCollection;
typedef struct { typedef struct {