public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
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:55 +0000 (UTC)	[thread overview]
Message-ID: <a3ac6869831b8cce7cd0f738019a0acc2271cbb8.dol-sen@gentoo> (raw)

commit:     a3ac6869831b8cce7cd0f738019a0acc2271cbb8
Author:     Detlev Casanova <detlev.casanova <AT> gmail <DOT> com>
AuthorDate: Mon Jul 19 12:48:51 2010 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jul 19 12:48:51 2010 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=a3ac6869

Add some more comments, rename interpreterInitialize to
laymanInitialize, add layman.h header

---
 Makefile.am       |    2 +-
 Makefile.in       |   11 +++++++----
 src/interpreter.c |   28 +++++++++++++++++++---------
 src/interpreter.h |    4 ++--
 src/layman.h      |   11 +++++++++++
 src/tester.c      |    4 ++--
 6 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 17f3ac5..c12c925 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,7 @@ liblayman_la_SOURCES = src/config.c src/dict.c src/interpreter.c src/laymanapi.c
 liblayman_la_LIBADD = $(PYTHON_LIBS)
 
 layman_includedir = $(includedir)/layman
-layman_include_HEADERS = src/config.h src/dict.h src/interpreter.h src/laymanapi.h src/message.h src/stringlist.h
+layman_include_HEADERS = src/layman.h src/config.h src/dict.h src/interpreter.h src/laymanapi.h src/message.h src/stringlist.h
 
 #bin_PROGRAMS = tester
 

diff --git a/Makefile.in b/Makefile.in
index f21ffe3..0255cef 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -38,8 +38,9 @@ host_triplet = @host@
 subdir = .
 DIST_COMMON = README $(am__configure_deps) $(layman_include_HEADERS) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-	$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
-	config.guess config.sub depcomp install-sh ltmain.sh missing
+	$(top_srcdir)/configure $(top_srcdir)/src/Makefile.in AUTHORS \
+	COPYING ChangeLog INSTALL NEWS config.guess config.sub depcomp \
+	install-sh ltmain.sh missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -47,7 +48,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = src/Makefile
 CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
@@ -229,7 +230,7 @@ liblayman_la_SOURCES = src/config.c src/dict.c src/interpreter.c src/laymanapi.c
 #src/tester.c
 liblayman_la_LIBADD = $(PYTHON_LIBS)
 layman_includedir = $(includedir)/layman
-layman_include_HEADERS = src/config.h src/dict.h src/interpreter.h src/laymanapi.h src/message.h src/stringlist.h
+layman_include_HEADERS = src/layman.h src/config.h src/dict.h src/interpreter.h src/laymanapi.h src/message.h src/stringlist.h
 all: all-am
 
 .SUFFIXES:
@@ -268,6 +269,8 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
 $(am__aclocal_m4_deps):
+src/Makefile: $(top_builddir)/config.status $(top_srcdir)/src/Makefile.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
 	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"

diff --git a/src/interpreter.c b/src/interpreter.c
index 151af2d..a372120 100644
--- a/src/interpreter.c
+++ b/src/interpreter.c
@@ -7,8 +7,9 @@
 #include <string.h>
 #include "interpreter.h"
 
-/*
+/**
  * PyObjectList
+ * Stores modules in a linked list so that they don't have to be reloaded every time.
  */
 typedef struct PyObjectListElem
 {
@@ -90,7 +91,10 @@ struct Interpreter
 	PyObjectList *modules;
 } *in = 0;
 
-void interpreterInit()
+/**
+ * This is the first function that must be called before using the library.
+ */
+void laymanInit()
 {
 	if (in)
 		return;
@@ -102,7 +106,11 @@ void interpreterInit()
 	in->modules = createObjectList();
 }
 
-void interpreterFinalize()
+/**
+ * Call this function when you're done using the library.
+ * It will free memory.
+ */
+void laymanFinalize()
 {
 	if (!in)
 		return;
@@ -113,14 +121,16 @@ void interpreterFinalize()
 		Py_Finalize();
 }
 
-/*
+/**
  * printf() like function that executes a python function
- * @param module name of the python module in which the function is
- * @param funcName the function name to call
- * @param format printf() like list of arguments. See Python documentation
- * @param ... arguments for the function
+ *
+ * \param module name of the python module in which the function is
+ * \param funcName the function name to call
+ * \param format printf() like list of arguments. See Python documentation
+ * \param ... arguments for the function
+ *
+ * \return the result of the execution. Can be NULL if the call failed.
  */
-
 PyObject *executeFunction(const char *module, const char *funcName, const char* format, ...)
 {
 	if (!Py_IsInitialized())

diff --git a/src/interpreter.h b/src/interpreter.h
index 8e04ce0..b280ad2 100644
--- a/src/interpreter.h
+++ b/src/interpreter.h
@@ -1,7 +1,7 @@
 #ifndef INTERPRETER_H
 #define INTERPRETER_H
 
-void 		interpreterInit();
-void 		interpreterFinalize();
+void 		laymanInit();
+void 		laymanFinalize();
 
 #endif

diff --git a/src/layman.h b/src/layman.h
new file mode 100644
index 0000000..9811ba5
--- /dev/null
+++ b/src/layman.h
@@ -0,0 +1,11 @@
+#ifndef LAYMAN_H
+#define LAYMAN_H
+
+#include "laymanapi.h"
+#include "message.h"
+#include "stringlist.h"
+#include "config.h"
+#include "dict.h"
+#include "interpreter.h"
+
+#endif

diff --git a/src/tester.c b/src/tester.c
index 98dc171..de0b6c7 100644
--- a/src/tester.c
+++ b/src/tester.c
@@ -9,7 +9,7 @@ int main(int argc, char *argv[])
 	argc = argc;
 	argv = argv;
 	int ret = 0;
-	interpreterInit();
+	laymanInit();
 	
 	Message *msg = messageCreate("layman", 0, 0, 0);
 	BareConfig *cfg = bareConfigCreate(msg, 0, 0, 0);
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
 	bareConfigFree(cfg);
 	laymanAPIFree(l);
 
-	interpreterFinalize();
+	laymanFinalize();
 
 	return ret;
 }



             reply	other threads:[~2011-10-05 20:59 UTC|newest]

Thread overview: 3+ 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

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=a3ac6869831b8cce7cd0f738019a0acc2271cbb8.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