diff --git a/hurricane/src/isobar/PyCell.cpp b/hurricane/src/isobar/PyCell.cpp index 37c237f4..be8fcfaa 100644 --- a/hurricane/src/isobar/PyCell.cpp +++ b/hurricane/src/isobar/PyCell.cpp @@ -1,40 +1,3 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag -// =================================================================== -// -// $Id: PyCell.cpp,v 1.34 2008/02/07 17:09:41 xtof Exp $ -// // x-----------------------------------------------------------------x // | | // | C O R I O L I S | @@ -51,7 +14,6 @@ #include "hurricane/isobar/PyCell.h" #include "hurricane/isobar/PyBox.h" -#include "hurricane/isobar/PyName.h" #include "hurricane/isobar/PyLibrary.h" #include "hurricane/isobar/PyInstance.h" #include "hurricane/isobar/PyOccurrence.h" @@ -120,17 +82,13 @@ extern "C" { static PyObject* PyCell_getName(PyCell *self) { trace << "PyCell_getName ()" << endl; - - METHOD_HEAD ( "Cell.getName()" ) - - PyName* pyName = PyObject_NEW ( PyName, &PyTypeName ); - if ( pyName == NULL ) { return NULL; } HTRY - pyName->_object = new Name ( cell->getName() ); + METHOD_HEAD ( "Cell.getName()" ) + return PyString_FromString(getString(cell->getName()).c_str()); HCATCH - - return (PyObject*)pyName; + + return NULL; } @@ -139,20 +97,21 @@ extern "C" { static PyObject* PyCell_getInstance ( PyCell *self, PyObject* args ) { trace << "PyCell_getInstance ()" << endl; + METHOD_HEAD("Cell.getInstance()") Instance* instance = NULL; HTRY - METHOD_HEAD ( "Cell.getInstance()" ) - - PyName* arg0; - if ( ! ParseOneArg ( "Cell.getInstance", args, NAME_ARG, (PyObject**)&arg0 ) ) + char* name; + if (PyArg_ParseTuple(args,"s:Cell.getInstance", &name)) { + instance = cell->getInstance(Name(name)); + } else { + PyErr_SetString(ConstructorError, "invalid number of parameters for Cell.getInstance." ); return NULL; - - instance = cell->getInstance ( *PYNAME_O(arg0) ); + } HCATCH - return PyInstance_Link ( instance ); + return PyInstance_Link(instance); } @@ -397,22 +356,23 @@ extern "C" { // --------------------------------------------------------------- // Attribute Method : "PyCell_getNet ()" - static PyObject* PyCell_getNet ( PyCell *self, PyObject* args ) { - trace << "PyCell_getNet ()" << endl; + static PyObject* PyCell_getNet(PyCell *self, PyObject* args) { + trace << "PyCell_getNet ()" << endl; + METHOD_HEAD ( "Cell.getNet()" ) - Net* net = NULL; + Net* net = NULL; - HTRY - METHOD_HEAD ( "Cell.getNet()" ) - - PyName* arg0; - if ( ! ParseOneArg ( "Cell.getNet", args, NAME_ARG, (PyObject**)&arg0 ) ) - return NULL; - - net = cell->getNet ( *PYNAME_O(arg0) ); - HCATCH - - return PyNet_Link ( net ); + 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." ); + return NULL; + } + HCATCH + + return PyNet_Link(net); } @@ -585,17 +545,18 @@ extern "C" { // --------------------------------------------------------------- // Attribute Method : "PyCell_setName ()" - static PyObject* PyCell_setName ( PyCell *self, PyObject* args ) - { + static PyObject* PyCell_setName ( PyCell *self, PyObject* args ) { trace << "Cell.setName()" << endl; HTRY - METHOD_HEAD ( "Cell.setName()" ) - - PyName* name; - if ( ! ParseOneArg ( "Cell.setName", args, NAME_ARG, (PyObject**)&name ) ) + METHOD_HEAD("Cell.setName()") + char* name = NULL; + if (PyArg_ParseTuple(args,"s:Cell.setName", &name)) { + cell->setName(Name(name)); + } else { + PyErr_SetString(ConstructorError, "invalid number of parameters for Cell.setName."); return NULL; - cell->setName ( *PYNAME_O(name) ); + } HCATCH Py_RETURN_NONE; @@ -689,18 +650,17 @@ extern "C" { static PyObject* PyCell_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { trace << "PyCell_new()" << endl; - PyObject* arg0; - PyObject* arg1; - string lib_name_arg = ":library:name"; - if (!ParseTwoArg("Cell.init", args, lib_name_arg, &arg0, &arg1)) { - PyErr_SetString ( ConstructorError, "invalid number of parameters for Cell constructor."); - return NULL; - } - + char* name = NULL; + PyLibrary* pyLibrary = NULL; Cell* cell = NULL; HTRY - cell = Cell::create(PYLIBRARY_O(arg0), getString(*PYNAME_O(arg1))); + if (PyArg_ParseTuple(args,"O!s:Cell.new", &PyTypeLibrary, &pyLibrary, &name)) { + cell = Cell::create(PYLIBRARY_O(pyLibrary), Name(name)); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Cell constructor."); + return NULL; + } HCATCH return PyCell_Link(cell); diff --git a/hurricane/src/isobar/PyLibrary.cpp b/hurricane/src/isobar/PyLibrary.cpp index bf0471bf..d926cfc0 100644 --- a/hurricane/src/isobar/PyLibrary.cpp +++ b/hurricane/src/isobar/PyLibrary.cpp @@ -1,40 +1,3 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag -// =================================================================== -// -// $Id: PyLibrary.cpp,v 1.17 2006/09/22 11:27:31 tsunami Exp $ -// // x-----------------------------------------------------------------x // | | // | C O R I O L I S | @@ -53,7 +16,6 @@ #include "hurricane/isobar/PyDataBase.h" -#include "hurricane/isobar/PyName.h" #include "hurricane/isobar/PyLibrary.h" #include "hurricane/isobar/PyCell.h" #include "hurricane/isobar/PyCellCollection.h" @@ -87,17 +49,14 @@ extern "C" { static PyObject* PyLibrary_getName ( PyLibrary *self ) { trace << "PyLibrary_getName ()" << endl; + METHOD_HEAD ( "Library.getName()" ) - - PyName* pyName = PyObject_NEW ( PyName, &PyTypeName ); - if ( pyName == NULL ) { return NULL; } - - HTRY - pyName->_object = new Name ( lib->getName() ); - HCATCH - return ( (PyObject*)pyName ); - + HTRY + return PyString_FromString(getString(lib->getName()).c_str()); + HCATCH + + return NULL; } @@ -105,23 +64,22 @@ extern "C" { // Attribute Method : "PyLibrary_getCell ()" PyObject* PyLibrary_getCell ( PyLibrary* self, PyObject* args ) { - trace << "PyLibrary_getCell ()" << endl; - - Cell* cell = NULL; + trace << "PyLibrary_getCell ()" << endl; + + Cell* cell = NULL; - HTRY - METHOD_HEAD("Library.getCell()") + HTRY + METHOD_HEAD("Library.getCell()") + char* name = NULL; + if (PyArg_ParseTuple(args,"s:Library.getCell", &name)) { + cell = lib->getCell (Name(name)); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for getCell." ); + return NULL; + } + HCATCH - char* name = NULL; - if (PyArg_ParseTuple(args,"s:Library.getCell", &name)) { - cell = lib->getCell (Name(name)); - } else { - PyErr_SetString ( ConstructorError, "invalid number of parameters for Library constructor." ); - return NULL; - } - HCATCH - - return PyCell_Link ( cell ); + return PyCell_Link(cell); } diff --git a/hurricane/src/isobar/PyNet.cpp b/hurricane/src/isobar/PyNet.cpp index 0c100d13..a4c45fcb 100644 --- a/hurricane/src/isobar/PyNet.cpp +++ b/hurricane/src/isobar/PyNet.cpp @@ -1,40 +1,3 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag -// =================================================================== -// -// $Id: PyNet.cpp,v 1.27 2008/02/07 17:09:41 xtof Exp $ -// // x-----------------------------------------------------------------x // | | // | C O R I O L I S | @@ -53,7 +16,6 @@ #include "hurricane/isobar/PyNet.h" -#include "hurricane/isobar/PyName.h" #include "hurricane/isobar/PyCell.h" #include "hurricane/isobar/PyPoint.h" #include "hurricane/isobar/PyPlugCollection.h" @@ -186,23 +148,13 @@ extern "C" { static PyObject* PyNet_getName ( PyNet *self ) { trace << "PyNet_getName ()" << endl; - - METHOD_HEAD ( "Net.getName()" ) - - PyName* pyName = PyObject_NEW ( PyName, &PyTypeName ); - if ( pyName == NULL ) { return NULL; } - - trace_in (); - trace << "new PyName [" << hex << pyName << "]" << endl; - trace_out (); HTRY - - pyName->_object = new Name ( net->getName() ); - + METHOD_HEAD("Net.getName()") + return PyString_FromString(getString(net->getName()).c_str()); HCATCH - - return ( (PyObject*)pyName ); + + return NULL; } @@ -343,14 +295,14 @@ extern "C" { trace << "PyNet_setName()" << endl; HTRY - - METHOD_HEAD ( "Net.setName()" ) - - PyObject* arg0; - if ( ! ParseOneArg ( "Net.setName", args, NET_ARG, (PyObject**)&arg0 ) ) return ( NULL ); - - net->setName ( *PYNAME_O(arg0) ); - + METHOD_HEAD("Net.setName()") + char* name = NULL; + if (PyArg_ParseTuple(args,"s:Net.setName", &name)) { + net->setName(Name(name)); + } else { + PyErr_SetString(ConstructorError, "invalid number of parameters for Net.setName."); + return NULL; + } HCATCH Py_RETURN_NONE; @@ -548,20 +500,20 @@ extern "C" { static PyObject* PyNet_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { trace << "PyNet_new()" << endl; - Net* net = NULL; - PyObject* arg0; - PyObject* arg1; + char* name = NULL; + PyCell* pyCell = NULL; + Net* net = NULL; - if (!ParseTwoArg("Net.new", args, CELL_NAME_ARG, &arg0, &arg1)) { + 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; } - - HTRY - net = Net::create ( PYCELL_O(arg0), *PYNAME_O(arg1) ); HCATCH - return PyNet_Link ( net ); + return PyNet_Link(net); } DBoDeleteMethod(Net) diff --git a/hurricane/src/isobar/PyTechnology.cpp b/hurricane/src/isobar/PyTechnology.cpp index 353f57cb..b3c05eff 100644 --- a/hurricane/src/isobar/PyTechnology.cpp +++ b/hurricane/src/isobar/PyTechnology.cpp @@ -1,40 +1,3 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag -// =================================================================== -// -// $Id: PyTechnology.cpp,v 1.11 2006/09/22 11:27:32 tsunami Exp $ -// // x-----------------------------------------------------------------x // | | // | C O R I O L I S | @@ -49,11 +12,7 @@ // | | // x-----------------------------------------------------------------x - - - #include "hurricane/isobar/PyDataBase.h" -#include "hurricane/isobar/PyName.h" #include "hurricane/isobar/PyLayer.h" #include "hurricane/isobar/PyTechnology.h" @@ -85,36 +44,33 @@ extern "C" { // --------------------------------------------------------------- // Attribute Method : "PyTechnology_getName ()" - static PyObject* PyTechnology_getName ( PyTechnology *self ) - { + static PyObject* PyTechnology_getName(PyTechnology *self) { trace << "PyTechnology_getName ()" << endl; - - METHOD_HEAD ( "Technology.getName()" ) - PyName* pyName = PyObject_NEW ( PyName, &PyTypeName ); - if ( pyName == NULL ) { return NULL; } - HTRY - pyName->_object = new Name ( techno->getName() ); + METHOD_HEAD("Technology.getName()") + return PyString_FromString(getString(techno->getName()).c_str()); HCATCH - - return ( (PyObject*)pyName ); + + return NULL; } // --------------------------------------------------------------- // Attribute Method : "PyTechnology_setName ()" - static PyObject* PyTechnology_setName ( PyTechnology *self, PyObject* args ) { + static PyObject* PyTechnology_setName(PyTechnology *self, PyObject* args) { trace << "Technology.setName()" << endl; - METHOD_HEAD ( "Technology.setName()" ) HTRY - - PyName* name; - if ( ! ParseOneArg ( "Technology.setName", args, NAME_ARG, (PyObject**)&name ) ) return ( NULL ); - - techno->setName ( *PYNAME_O(name) ); + METHOD_HEAD ( "Technology.setName()" ) + char* name = NULL; + if (PyArg_ParseTuple(args,"s:Technology.setName", &name)) { + techno->setName(Name(name)); + } else { + PyErr_SetString(ConstructorError, "invalid number of parameters for Technology.setName."); + return NULL; + } HCATCH Py_RETURN_NONE; @@ -125,21 +81,23 @@ extern "C" { // --------------------------------------------------------------- // Attribute Method : "PyTechnology_getLayer ()" - static PyObject* PyTechnology_getLayer ( PyTechnology *self, PyObject* args ) - { + static PyObject* PyTechnology_getLayer ( PyTechnology *self, PyObject* args ) { trace << "Technology.getLayer()" << endl; - METHOD_HEAD ( "Technology.getLayer()" ) + METHOD_HEAD("Technology.getLayer()") Layer* layer = NULL; HTRY - PyName* name; - if ( ! ParseOneArg ( "Technology.getLayer", args,NAME_ARG, (PyObject**)&name ) ) return ( NULL ); - - layer = techno->getLayer ( *PYNAME_O(name) ); + char* name = NULL; + if (PyArg_ParseTuple(args,"s:Technology.getLayer", &name)) { + layer = techno->getLayer(Name(name)); + } else { + PyErr_SetString(ConstructorError, "invalid number of parameters for getLayer."); + return NULL; + } HCATCH - - return PyLayer_Link ( layer ); + + return PyLayer_Link(layer); }