summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjordi.saludes <jordi.saludes@upc.edu>2010-07-22 14:21:19 +0000
committerjordi.saludes <jordi.saludes@upc.edu>2010-07-22 14:21:19 +0000
commit888f6b5ca958498cbb854ce39ba72075605a88b4 (patch)
treee67e195ec95481089cfca28697f1dae3e6543028
parent63a4c97e18a6eda261e451098d2360a9570b89a7 (diff)
Code cleaning in py-bindings.
-rw-r--r--contrib/py-bindings/gfmodule.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/contrib/py-bindings/gfmodule.c b/contrib/py-bindings/gfmodule.c
index fd6c003d9..cde3bdd71 100644
--- a/contrib/py-bindings/gfmodule.c
+++ b/contrib/py-bindings/gfmodule.c
@@ -12,9 +12,9 @@ int
checkType(void* obj, PyTypeObject* tp)
{
int isRight = PyObject_TypeCheck((PyObject*)obj, tp);
- if (!isRight)
- PyErr_Format(PyExc_TypeError, "Expected a %s", tp->tp_doc);
- return isRight;
+ if (!isRight)
+ PyErr_Format(PyExc_TypeError, "Expecting a %s.", tp->tp_doc);
+ return isRight;
}
@@ -88,17 +88,6 @@ categories(PGFModule* self)
inline static PyObject*
languages(PGFModule* self)
{
- /* PyObject *langs = PyList_New(0);
- PyGF **p = gf_languages(self);
- // PyGF *q = p;
- while (*p) {
- printf("sp: %x\n", (*p)->sp);
- //Lang* l = (Lang*)LangType.tp_new(&LangType,NULL,NULL);
- //l->obj = (p++)->sp;
- PyList_Append(langs, (PyObject*)(*(p++)));
- // Py_DECREF(*(p++)); //??
- }
- // gf_freeArray(q); */
return gf_languages(self);
}
@@ -180,23 +169,6 @@ parse(PyObject *self, PyObject *args, PyObject *kws)
} else {
cat = (PyObject*)startCategory(self,NULL);
}
- /* pgf = ((PGFModule*)self)->obj;
- lang = ((Lang*)lang_pyob)->obj;
- PyObject *parsed = PyList_New(0);
- GF_Tree *p = gf_parse(pgf,lang,cat,lexed);
- if (*p) {
- do {
- Tree* expr; //Expr
- expr = (Tree*)TreeType.tp_new(&TreeType,NULL,NULL); // Expr* -> Tree*
- expr->obj = *(p++);
- PyList_Append(parsed, (PyObject*)expr);
- Py_DECREF(expr); //??
- // char *str = gf_showExpr(exp);
- //puts(str);
- //free(str);
- } while (*p);
- }
- return parsed; */
return gf_parse(self, lang, cat, lexed);
}