diff options
author | Detlev Casanova <detlev.casanova@gmail.com> | 2010-07-09 14:45:37 +0200 |
---|---|---|
committer | Detlev Casanova <detlev.casanova@gmail.com> | 2010-07-09 14:45:37 +0200 |
commit | 593766766d7d892b469acda29bdb8d848a68dd3b (patch) | |
tree | 5a66e0cc44bdfd9905d62a991d14f8ed130036d8 /src/config.c | |
parent | 69567b830f119ff74706bbdb6f58164201890623 (diff) | |
download | layman-593766766d7d892b469acda29bdb8d848a68dd3b.tar.gz layman-593766766d7d892b469acda29bdb8d848a68dd3b.tar.bz2 layman-593766766d7d892b469acda29bdb8d848a68dd3b.zip |
Add basic Config and DbBase implemntation (not tested)
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c new file mode 100644 index 0000000..db632f2 --- /dev/null +++ b/src/config.c @@ -0,0 +1,33 @@ +#include "config.h" +#include "interpreter.h" +#include <Python.h> + +struct Config +{ + PyObject *object; +}; + +PyObject *_object(Config *c) +{ + return c ? c->object : NULL; +} + +Config *createConfig(const char *argv[], int argc) +{ + PyObject *pyargs = PyList_New(argc); + for (int i = 0; i < argc; i++) + { + PyObject *arg = PyBytes_FromString(argv[i]); + PyList_Insert(pyargs, i, arg); + } + + PyObject *obj = executeFunction("layman.config", "Config", "O", pyargs); + Py_DECREF(pyargs); + if (!obj) + return NULL; + + Config *ret = malloc(sizeof(Config)); + ret->object = obj; + + return ret; +} |