|
From: David B. <dav...@us...> - 2004-11-22 07:20:07
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31386 Modified Files: Tag: sidewinder-branch langpython.c Log Message: got rid of namestacktoaddress -- not needed anymore Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.2 retrieving revision 1.2.4.3 diff -C2 -d -r1.2.4.2 -r1.2.4.3 *** langpython.c 22 Nov 2004 05:37:03 -0000 1.2.4.2 --- langpython.c 22 Nov 2004 07:19:49 -0000 1.2.4.3 *************** *** 432,455 **** } - static char * - namestacktoaddress(PyObject *nameStack) { - int len = PyList_GET_SIZE(nameStack); - int addressLen = 0; - for (int i = 0; i < len; i++) - addressLen += PyString_GET_SIZE(PyList_GET_ITEM(nameStack, i)); - addressLen += len * 5; - - char *s = (char *)malloc(addressLen + 1); - *s = 0; - for (int i = 0; i < len; i++) { - strcat(s, "[\""); - strcat(s, PyString_AsString(PyList_GET_ITEM(nameStack, i))); - strcat(s, "\"]."); - } - s[--addressLen] = 0; - - return s; - } - /* the python library side */ --- 432,435 ---- *************** *** 544,562 **** } - static PyObject * - nameStackToAddress(PyObject *self, PyObject *args) { - PyObject *nameStack; - if (!PyArg_ParseTuple(args, "O:nameStackToAddress", &nameStack)) - return NULL; - - char *s = namestacktoaddress(nameStack); - - PyObject *result = PyString_FromString(s); - - free(s); - - return result; - } - static PyMethodDef embMethods[] = { {"fetch", fetch, METH_VARARGS, --- 524,527 ---- *************** *** 564,569 **** {"evaluate", evaluateString, METH_VARARGS, "Compile and execute the string as UserTalk code."}, - {"nameStackToAddress", nameStackToAddress, METH_VARARGS, - "turn a name stack into a frontier address specifier"}, {NULL, NULL, 0, NULL} }; --- 529,532 ---- *************** *** 1253,1256 **** } - #endif --- 1216,1218 ---- |