From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/layman:master commit in: src/
Date: Wed, 5 Oct 2011 20:56:51 +0000 (UTC) [thread overview]
Message-ID: <593766766d7d892b469acda29bdb8d848a68dd3b.dol-sen@gentoo> (raw)
commit: 593766766d7d892b469acda29bdb8d848a68dd3b
Author: Detlev Casanova <detlev.casanova <AT> gmail <DOT> com>
AuthorDate: Fri Jul 9 12:45:37 2010 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jul 9 12:45:37 2010 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=59376676
Add basic Config and DbBase implemntation (not tested)
---
src/config.c | 33 +++++++++++++++++++++++++++++++++
src/config.h | 12 ++++++++++++
src/dbbase.c | 32 ++++++++++++++++++++++++++++++++
src/dbbase.h | 10 ++++++++++
4 files changed, 87 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;
+}
diff --git a/src/config.h b/src/config.h
new file mode 100644
index 0000000..e977cdc
--- /dev/null
+++ b/src/config.h
@@ -0,0 +1,12 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include <Python.h>
+
+typedef struct Config Config;
+
+Config *createConfig(const char *argv[], int argc);
+
+PyObject *_object(Config*);
+
+#endif
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;
+}
diff --git a/src/dbbase.h b/src/dbbase.h
new file mode 100644
index 0000000..12065af
--- /dev/null
+++ b/src/dbbase.h
@@ -0,0 +1,10 @@
+#ifndef DB_BASE_H
+#define DB_BASE_H
+
+#include "config.h"
+
+typedef struct DbBase DbBase;
+
+DbBase* createDbBase(const char *paths[], unsigned int path_count, Config *c, int ignore, int quiet, int ignore_init_read_errors);
+
+#endif
next reply other threads:[~2011-10-05 20:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-05 20:56 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-10-05 20:56 [gentoo-commits] proj/layman:master commit in: src/ Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
2011-10-05 20:56 Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=593766766d7d892b469acda29bdb8d848a68dd3b.dol-sen@gentoo \
--to=brian.dolbec@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox