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

View File

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

View File

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

View File

@ -127,8 +127,6 @@ extern "C" {
trace << "PyReference_new()" << endl; trace << "PyReference_new()" << endl;
Reference* reference = NULL; Reference* reference = NULL;
#if 0
PyObject* arg0; PyObject* arg0;
PyObject* arg1; PyObject* arg1;
PyObject* arg2; PyObject* arg2;
@ -147,14 +145,14 @@ extern "C" {
return NULL; return NULL;
} }
if ( __cs.getObjectIds() == CELL_NAME_INTS2_ARG ) if ( __cs.getObjectIds() == ":ent:string:int:int" )
reference = Reference::create ( PYCELL_O(arg0) reference = Reference::create ( PYCELL_O(arg0)
, *PYNAME_O(arg1) , Name(PyString_AsString(arg1))
, PyInt_AsLong(arg2) , PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) ); , PyInt_AsLong(arg3) );
else if ( __cs.getObjectIds() == CELL_NAME_POINT_ARG ) else if ( __cs.getObjectIds() == ":ent:name:point" )
reference = Reference::create ( PYCELL_O(arg0) reference = Reference::create ( PYCELL_O(arg0)
, *PYNAME_O(arg1) , Name(PyString_AsString(arg1))
, *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." );
@ -162,8 +160,6 @@ extern "C" {
} }
HCATCH HCATCH
#endif
return PyReference_Link ( reference ); return PyReference_Link ( reference );
} }

View File

@ -133,14 +133,12 @@ extern "C" {
#define INTS2_FUNCTION_ARG ":int:int:function" #define INTS2_FUNCTION_ARG ":int:int:function"
#define FLOAT_ARG ":float" #define FLOAT_ARG ":float"
#define BOOL_ARG ":bool" #define BOOL_ARG ":bool"
#define NAME_ARG ":name"
#define INSTANCE_ARG ":ent" #define INSTANCE_ARG ":ent"
#define HOOK_ARG ":hook" #define HOOK_ARG ":hook"
#define TRANS_ARG ":transfo" #define TRANS_ARG ":transfo"
#define STRING_ARG ":string" #define STRING_ARG ":string"
#define STRING_CELL_ARG ":string:ent" #define STRING_CELL_ARG ":string:ent"
#define NET_ARG ":ent" #define NET_ARG ":ent"
#define NET_NAME_ARG ":ent:name"
#define NET_LAYER_INT_ARG ":ent:layer:int" #define NET_LAYER_INT_ARG ":ent:layer:int"
#define NET_LAYER_INTS2_ARG ":ent:layer:int:int" #define NET_LAYER_INTS2_ARG ":ent:layer:int:int"
#define NET_LAYER_INTS3_ARG ":ent:layer:int: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 COMPS2_LAYER_INTS4_ARG ":comp:comp:layer:int:int:int:int"
#define CELL_BOX_ARG ":ent:box" #define CELL_BOX_ARG ":ent:box"
#define CELL_INT_ARG ":ent:int" #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_ARG ":ent"
#define INST_PATH_ARG ":ent:path" #define INST_PATH_ARG ":ent:path"
#define PATH_INST_ARG ":path:ent" #define PATH_INST_ARG ":path:ent"
@ -224,7 +217,11 @@ extern "C" {
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
{ \ { \
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetBoolAttribute()") \ 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; \
} \
} }