new argument parsing
This commit is contained in:
parent
9bd457393e
commit
69a2f10906
|
@ -112,10 +112,13 @@ extern "C" {
|
||||||
HTRY
|
HTRY
|
||||||
METHOD_HEAD("Library.getCell()")
|
METHOD_HEAD("Library.getCell()")
|
||||||
|
|
||||||
PyObject* arg0;
|
char* name = NULL;
|
||||||
if ( ! ParseOneArg ( "Library.getCell", args, NAME_ARG, &arg0 ) ) return ( NULL );
|
if (PyArg_ParseTuple(args,"s:Library.getCell", &name)) {
|
||||||
|
cell = lib->getCell (Name(name));
|
||||||
cell = lib->getCell ( *PYNAME_O(arg0) );
|
} else {
|
||||||
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Library constructor." );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
HCATCH
|
HCATCH
|
||||||
|
|
||||||
return PyCell_Link ( cell );
|
return PyCell_Link ( cell );
|
||||||
|
@ -176,22 +179,19 @@ extern "C" {
|
||||||
static PyObject* PyLibrary_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
|
static PyObject* PyLibrary_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
|
||||||
trace << "PyLibrary_new()" << endl;
|
trace << "PyLibrary_new()" << endl;
|
||||||
|
|
||||||
PyObject* arg0;
|
char* name = NULL;
|
||||||
PyObject* arg1;
|
PyDataBase* pyDataBase = NULL;
|
||||||
|
PyLibrary* pyRootLibrary = NULL;
|
||||||
|
|
||||||
Library* library = NULL;
|
Library* library = NULL;
|
||||||
|
|
||||||
HTRY
|
HTRY
|
||||||
__cs.init ("Library.new");
|
if (PyArg_ParseTuple(args,"O!s:Library.new", &PyTypeDataBase, &pyDataBase, &name)) {
|
||||||
if (!PyArg_ParseTuple(args,"O&O&:Library.new", Converter, &arg0, Converter, &arg1)) {
|
DataBase* db = PYDATABASE_O(pyDataBase);
|
||||||
PyErr_SetString ( ConstructorError, "invalid number of parameters for Library constructor." );
|
library = Library::create(db, Name(name));
|
||||||
return NULL;
|
} else if (PyArg_ParseTuple(args,"O!s:Library.new", &PyTypeLibrary, &pyRootLibrary, &name)) {
|
||||||
}
|
Library* rootLibrary = PYLIBRARY_O(pyRootLibrary);
|
||||||
if (__cs.getObjectIds() == ":db:name") {
|
library = Library::create(rootLibrary, Name(name));
|
||||||
DataBase* db = PYDATABASE_O(arg0);
|
|
||||||
library = Library::create(db, *PYNAME_O(arg1));
|
|
||||||
} else if (__cs.getObjectIds() == ":library:name") {
|
|
||||||
Library* masterLibrary = PYLIBRARY_O(arg0);
|
|
||||||
library = Library::create(masterLibrary, *PYNAME_O(arg1));
|
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString ( ConstructorError, "invalid number of parameters for Library constructor." );
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Library constructor." );
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue