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/dbbase.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/dbbase.c')
-rw-r--r-- | src/dbbase.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/dbbase.c b/src/dbbase.c new file mode 100644 index 0000000..c617326 --- /dev/null +++ b/src/dbbase.c @@ -0,0 +1,32 @@ +#include "config.h" +#include "dbbase.h" +#include "interpreter.h" +#include <Python.h> + +struct DbBase +{ + PyObject *object; +}; + +DbBase* createDbBase(const char *paths[], unsigned int pathCount, Config *c, int ignore, int quiet, int ignore_init_read_errors) +{ + PyObject *pypaths = PyList_New(pathCount); + for (unsigned int i = 0; i < pathCount; i++) + { + PyObject *path = PyBytes_FromString(paths[i]); + PyList_Insert(pypaths, i, path); + } + + PyObject *cfg = _object(c); + + PyObject *obj = executeFunction("layman.dbbase", "DbBase", "OOIII", pypaths, cfg, ignore, quiet, ignore_init_read_errors); + Py_DECREF(pypaths); + + if (!obj) + return NULL; + + DbBase *ret = malloc(sizeof(DbBase)); + ret->object = obj; + + return ret; +} |