Bind more CFCHierarchy methods to Python.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/39fb007f Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/39fb007f Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/39fb007f Branch: refs/heads/master Commit: 39fb007f9c2c9ee42b75386728a0f9819c3084b7 Parents: cd9eec3 Author: Marvin Humphrey <[email protected]> Authored: Mon Dec 15 20:57:03 2014 -0800 Committer: Marvin Humphrey <[email protected]> Committed: Wed Jan 6 18:43:27 2016 -0800 ---------------------------------------------------------------------- compiler/python/clownfish/_cfc.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/39fb007f/compiler/python/clownfish/_cfc.c ---------------------------------------------------------------------- diff --git a/compiler/python/clownfish/_cfc.c b/compiler/python/clownfish/_cfc.c index 253f23c..f1486ef 100644 --- a/compiler/python/clownfish/_cfc.c +++ b/compiler/python/clownfish/_cfc.c @@ -22,8 +22,10 @@ typedef struct { void *cfc_obj; } CFCPyWrapper; +/***************************** CFCHierarchy *****************************/ + static CFCHierarchy* -S_extract_hierarchy(PyObject *wrapper) { +S_to_Hierarchy(PyObject *wrapper) { return (CFCHierarchy*)((CFCPyWrapper*)wrapper)->cfc_obj; } @@ -55,13 +57,33 @@ S_CFCHierarchy_dealloc(CFCPyWrapper *wrapper) { } static PyObject* +S_CFCHierarchy_build(PyObject *wrapper, PyObject *unused) { + CHY_UNUSED_VAR(unused); + CFCHierarchy_build(S_to_Hierarchy(wrapper)); + Py_RETURN_NONE; +} + +static PyObject* S_CFCHierarchy_add_include_dir(PyObject *wrapper, PyObject *dir) { - CFCHierarchy *wrapped = S_extract_hierarchy(wrapper); - CFCHierarchy_add_include_dir(S_extract_hierarchy(wrapper), + CFCHierarchy_add_include_dir(S_to_Hierarchy(wrapper), PyUnicode_AsUTF8(dir)); Py_RETURN_NONE; } +static PyObject* +S_CFCHierarchy_add_source_dir(PyObject *wrapper, PyObject *dir) { + CFCHierarchy_add_source_dir(S_to_Hierarchy(wrapper), + PyUnicode_AsUTF8(dir)); + Py_RETURN_NONE; +} + +static PyObject* +S_CFCHierarchy_write_log(PyObject *wrapper, PyObject *unused) { + CHY_UNUSED_VAR(unused); + CFCHierarchy_write_log(S_to_Hierarchy(wrapper)); + Py_RETURN_NONE; +} + static PyModuleDef cfc_module_def = { PyModuleDef_HEAD_INIT, "clownfish.cfc", @@ -79,8 +101,10 @@ static PyModuleDef cfc_model_module_def = { }; static PyMethodDef hierarchy_methods[] = { - {"add_include_dir", (PyCFunction)S_CFCHierarchy_add_include_dir, METH_O, - NULL}, + {"add_include_dir", (PyCFunction)S_CFCHierarchy_add_include_dir, METH_O, NULL}, + {"add_source_dir", (PyCFunction)S_CFCHierarchy_add_source_dir, METH_O, NULL}, + {"build", (PyCFunction)S_CFCHierarchy_build, METH_NOARGS, NULL}, + {"write_log", (PyCFunction)S_CFCHierarchy_write_log, METH_NOARGS, NULL}, {NULL} };
