More and more cleaning in Isobar

This commit is contained in:
Christophe Alexandre 2008-12-12 18:49:17 +00:00
parent 8845533c25
commit 38807d7985
5 changed files with 82 additions and 88 deletions

View File

@ -138,14 +138,15 @@ extern "C" {
METHOD_HEAD("Cell.getInstancesUnder()")
PyBox* arg0;
if (!ParseOneArg("Cell.getInstancesUnder", args, BOX_ARG, (PyObject**)&arg0))
return NULL;
PyBox* pyBox;
if (!PyArg_ParseTuple(args,"O!:Cell.getInstancesUnder", &PyTypeBox, &pyBox)) {
return NULL;
}
PyInstanceCollection* pyInstanceCollection = NULL;
HTRY
Instances* instances = new Instances(cell->getInstancesUnder(*PYBOX_O(arg0)));
Instances* instances = new Instances(cell->getInstancesUnder(*PYBOX_O(pyBox)));
pyInstanceCollection = PyObject_NEW(PyInstanceCollection, &PyTypeInstanceCollection);
if (pyInstanceCollection == NULL) {
@ -218,14 +219,14 @@ extern "C" {
METHOD_HEAD("Cell.getOccurrencesUnder()")
PyBox* arg0;
if (!ParseOneArg("Cell.getOccurrencesUnder", args, BOX_ARG, (PyObject**)&arg0))
PyBox* pyBox;
if (!PyArg_ParseTuple(args,"O!:Cell.getInstancesUnder", &PyTypeBox, &pyBox)) {
return NULL;
}
PyOccurrenceCollection* pyOccurrenceCollection = NULL;
HTRY
Occurrences* occurrences = new Occurrences(cell->getOccurrencesUnder(*PYBOX_O(arg0)));
Occurrences* occurrences = new Occurrences(cell->getOccurrencesUnder(*PYBOX_O(pyBox)));
pyOccurrenceCollection = PyObject_NEW(PyOccurrenceCollection, &PyTypeOccurrenceCollection);
if (pyOccurrenceCollection == NULL) {
@ -272,14 +273,15 @@ extern "C" {
METHOD_HEAD ( "Cell.getLeafInstanceOccurrencesUnder()" )
PyBox* arg0;
if (!ParseOneArg("Cell.getLeafInstanceOccurencesUnder", args, BOX_ARG, (PyObject**)&arg0))
return NULL;
PyBox* pyBox;
if (!PyArg_ParseTuple(args,"O!:Cell.getInstancesUnder", &PyTypeBox, &pyBox)) {
return NULL;
}
PyOccurrenceCollection* pyOccurrenceCollection = NULL;
HTRY
Occurrences* occurrences = new Occurrences(cell->getLeafInstanceOccurrencesUnder(*PYBOX_O(arg0)));
Occurrences* occurrences = new Occurrences(cell->getLeafInstanceOccurrencesUnder(*PYBOX_O(pyBox)));
pyOccurrenceCollection = PyObject_NEW(PyOccurrenceCollection, &PyTypeOccurrenceCollection);
if (pyOccurrenceCollection == NULL) {
@ -354,12 +356,10 @@ extern "C" {
HTRY
char* name = NULL;
if (PyArg_ParseTuple(args,"s:Cell.getNet", &name)) {
net = cell->getNet(Name(name));
} else {
PyErr_SetString(ConstructorError, "invalid number of parameters for getNet." );
if (!PyArg_ParseTuple(args,"s:Cell.getNet", &name)) {
return NULL;
}
}
net = cell->getNet(Name(name));
HCATCH
return PyNet_Link(net);
@ -546,10 +546,11 @@ extern "C" {
HTRY
METHOD_HEAD ( "Cell.setAbutmentBox()" )
PyBox* abutmentBox;
if ( ! ParseOneArg ( "Cell.setAbutmentBox", args, BOX_ARG, (PyObject**)&abutmentBox ) )
PyBox* pyBox;
if (!PyArg_ParseTuple(args,"O!:Cell.getInstancesUnder", &PyTypeBox, &pyBox)) {
return NULL;
cell->setAbutmentBox ( *PYBOX_O(abutmentBox) );
}
cell->setAbutmentBox ( *PYBOX_O(pyBox) );
HCATCH
Py_RETURN_NONE;
@ -564,13 +565,12 @@ extern "C" {
HTRY
METHOD_HEAD ( "Cell.setTerminal()" )
PyObject* arg0;
if ( ! ParseOneArg ( "Cell.setTerminal", args, INT_ARG, (PyObject**)&arg0 ) )
return NULL;
cell->setTerminal ( PyInt_AsLong(arg0) != 0 );
if (!PyArg_ParseTuple(args,"O:Cell.setTerminal", &arg0) && PyBool_Check(arg0)) {
return NULL;
}
(arg0 == Py_True)?cell->setTerminal(true):cell->setTerminal(false);
HCATCH
Py_RETURN_NONE;
}

View File

@ -376,7 +376,6 @@ extern "C" {
trace << "PyInstance_new ()" << endl;
Instance* instance = NULL;
#if 0 //FIXME
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
@ -394,22 +393,25 @@ extern "C" {
return NULL;
}
if ( __cs.getObjectIds() == :ent:string:ent ) { instance = Instance::create ( PYCELL_O(arg0)
, *PYNAME_O(arg1)
, PYCELL_O(arg2) ); }
else if ( __cs.getObjectIds() == CELL_NAME_CELL_TRANS_ARG ) { instance = Instance::create ( PYCELL_O(arg0)
, *PYNAME_O(arg1)
, PYCELL_O(arg2)
, *PYTRANSFORMATION_O(arg3)
, Instance::PlacementStatus::PLACED); } else {
cerr << __cs.getObjectIds() << endl;
if ( __cs.getObjectIds() == ":ent:string:ent") {
instance = Instance::create(
PYCELL_O(arg0),
Name(PyString_AsString(arg1)),
PYCELL_O(arg2) );
} else if ( __cs.getObjectIds() == ":ent:string:ent:transfo") {
instance = Instance::create(
PYCELL_O(arg0),
Name(PyString_AsString(arg1)),
PYCELL_O(arg2),
*PYTRANSFORMATION_O(arg3),
Instance::PlacementStatus::PLACED);
} else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Instance constructor." );
return ( NULL );
return NULL;
}
HCATCH
#endif
return PyInstance_Link ( instance );
return PyInstance_Link ( instance );
}
DBoDeleteMethod(Instance)

View File

@ -122,9 +122,6 @@ extern "C" {
HTRY
trace << "PyPin_new()" << endl;
#if 0
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
@ -151,46 +148,48 @@ extern "C" {
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";
string pin_arg3 = ":ent:name:int:int:layer:int:int";
if ( __cs.getObjectIds() == pin_arg1 ) { pin = Pin::create ( PYNET_O ( arg0 )
, *PYNAME_O ( arg1 )
, PyInt_AsAccessDirection ( arg2 )
, PyInt_AsPlacementStatus ( arg3 )
, PYLAYER_O ( arg4 )
, PyInt_AsLong ( arg5 )
, PyInt_AsLong ( arg6 )
, PyInt_AsLong ( arg7 )
, PyInt_AsLong ( arg8 ) ); }
else if ( __cs.getObjectIds() == pin_arg2 ) { pin = Pin::create ( PYNET_O ( arg0 )
, *PYNAME_O ( arg1 )
, PyInt_AsAccessDirection ( arg2 )
, PyInt_AsPlacementStatus ( arg3 )
, PYLAYER_O ( arg4 )
, PyInt_AsLong ( arg5 )
, PyInt_AsLong ( arg6 )
, PyInt_AsLong ( arg7 ) ); }
else if ( __cs.getObjectIds() == pin_arg3 ) { pin = Pin::create ( PYNET_O ( arg0 )
, *PYNAME_O ( arg1 )
, PyInt_AsAccessDirection ( arg2 )
, PyInt_AsPlacementStatus ( arg3 )
, PYLAYER_O ( arg4 )
, PyInt_AsLong ( arg5 )
, PyInt_AsLong ( arg6 ) ); }
else {
string pin_arg1 = ":ent:string:int:int:layer:int:int:int:int";
string pin_arg2 = ":ent:string:int:int:layer:int:int:int";
string pin_arg3 = ":ent:string:int:int:layer:int:int";
if ( __cs.getObjectIds() == pin_arg1 ) {
pin = Pin::create(
PYNET_O ( arg0 ),
Name(PyString_AsString(arg1)),
PyInt_AsAccessDirection ( arg2 ),
PyInt_AsPlacementStatus ( arg3 ),
PYLAYER_O ( arg4 ),
PyInt_AsLong ( arg5 ),
PyInt_AsLong ( arg6 ),
PyInt_AsLong ( arg7 ),
PyInt_AsLong ( arg8 ) );
} else if ( __cs.getObjectIds() == pin_arg2 ) {
pin = Pin::create (
PYNET_O ( arg0 ),
Name(PyString_AsString(arg1)),
PyInt_AsAccessDirection ( arg2 ),
PyInt_AsPlacementStatus ( arg3 ),
PYLAYER_O ( arg4 ),
PyInt_AsLong ( arg5 ),
PyInt_AsLong ( arg6 ),
PyInt_AsLong ( arg7 ) );
} else if ( __cs.getObjectIds() == pin_arg3 ) {
pin = Pin::create ( PYNET_O ( arg0 ),
Name(PyString_AsString(arg1)),
PyInt_AsAccessDirection ( arg2 ),
PyInt_AsPlacementStatus ( arg3 ),
PYLAYER_O ( arg4 ),
PyInt_AsLong ( arg5 ),
PyInt_AsLong ( arg6 ) );
} else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Pin constructor." );
return NULL;
}
#endif
HCATCH
return PyPin_Link ( pin );
}
DBoDeleteMethod(Pin)
PyTypeObjectLinkPyType(Pin)
PyTypeObjectConstructor(Pin)

View File

@ -127,8 +127,6 @@ extern "C" {
trace << "PyReference_new()" << endl;
Reference* reference = NULL;
#if 0
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
@ -147,14 +145,14 @@ extern "C" {
return NULL;
}
if ( __cs.getObjectIds() == CELL_NAME_INTS2_ARG )
if ( __cs.getObjectIds() == ":ent:string:int:int" )
reference = Reference::create ( PYCELL_O(arg0)
, *PYNAME_O(arg1)
, Name(PyString_AsString(arg1))
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) );
else if ( __cs.getObjectIds() == CELL_NAME_POINT_ARG )
else if ( __cs.getObjectIds() == ":ent:name:point" )
reference = Reference::create ( PYCELL_O(arg0)
, *PYNAME_O(arg1)
, Name(PyString_AsString(arg1))
, *PYPOINT_O(arg2) );
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Reference constructor." );
@ -162,8 +160,6 @@ extern "C" {
}
HCATCH
#endif
return PyReference_Link ( reference );
}

View File

@ -133,14 +133,12 @@ extern "C" {
#define INTS2_FUNCTION_ARG ":int:int:function"
#define FLOAT_ARG ":float"
#define BOOL_ARG ":bool"
#define NAME_ARG ":name"
#define INSTANCE_ARG ":ent"
#define HOOK_ARG ":hook"
#define TRANS_ARG ":transfo"
#define STRING_ARG ":string"
#define STRING_CELL_ARG ":string:ent"
#define NET_ARG ":ent"
#define NET_NAME_ARG ":ent:name"
#define NET_LAYER_INT_ARG ":ent:layer:int"
#define NET_LAYER_INTS2_ARG ":ent:layer:int:int"
#define NET_LAYER_INTS3_ARG ":ent:layer:int:int:int"
@ -154,11 +152,6 @@ extern "C" {
#define COMPS2_LAYER_INTS4_ARG ":comp:comp:layer:int:int:int:int"
#define CELL_BOX_ARG ":ent:box"
#define CELL_INT_ARG ":ent:int"
#define CELL_NAME_ARG ":ent:name"
#define CELL_NAME_CELL_ARG ":ent:name:ent"
#define CELL_NAME_CELL_TRANS_ARG ":ent:name:ent:transfo"
#define CELL_NAME_INTS2_ARG ":ent:name:int:int"
#define CELL_NAME_POINT_ARG ":ent:name:point"
#define INST_ARG ":ent"
#define INST_PATH_ARG ":ent:path"
#define PATH_INST_ARG ":path:ent"
@ -224,7 +217,11 @@ extern "C" {
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
{ \
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetBoolAttribute()") \
return ( Py_BuildValue ("i",cobject->FUNC_NAME()) ); \
if (cobject->FUNC_NAME()) { \
Py_RETURN_TRUE; \
} else { \
Py_RETURN_FALSE; \
} \
}