aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDetlev Casanova <detlev.casanova@gmail.com>2010-07-17 14:03:18 +0200
committerDetlev Casanova <detlev.casanova@gmail.com>2010-07-17 14:03:18 +0200
commita79f31c34e23d7c9a8666ed5857f7ea0bd978e16 (patch)
tree5fcafb011c844435994c8f7bd90e8a65eefffe74
parentAdd missing files. (diff)
downloadlayman-a79f31c34e23d7c9a8666ed5857f7ea0bd978e16.tar.gz
layman-a79f31c34e23d7c9a8666ed5857f7ea0bd978e16.tar.bz2
layman-a79f31c34e23d7c9a8666ed5857f7ea0bd978e16.zip
Hide internal functions and update run-test.sh
-rwxr-xr-xrun-test.sh2
-rw-r--r--src/config.c2
-rw-r--r--src/config.h3
-rw-r--r--src/dict.c1
-rw-r--r--src/dict.h3
-rw-r--r--src/internal.h21
-rw-r--r--src/interpreter.c1
-rw-r--r--src/interpreter.h3
-rw-r--r--src/laymanapi.c2
-rw-r--r--src/message.c2
-rw-r--r--src/message.h8
-rw-r--r--src/stringlist.c4
-rw-r--r--src/stringlist.h6
-rw-r--r--src/tester.c1
14 files changed, 35 insertions, 24 deletions
diff --git a/run-test.sh b/run-test.sh
index c20d7eb..31c4167 100755
--- a/run-test.sh
+++ b/run-test.sh
@@ -3,7 +3,7 @@ echo Compile lib :
make
echo Compile tester:
-gcc src/tester.c -llayman -g -W -Wall -I/usr/include/python2.6/ -Isrc/ -L.libs/ --std=c99 -o tester
+gcc src/tester.c -llayman -g -W -Wall -Isrc/ -L.libs/ --std=c99 -o tester
echo Run :
LD_LIBRARY_PATH=.libs/ ./tester
diff --git a/src/config.c b/src/config.c
index 12490f7..c0b5b79 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1,7 +1,7 @@
#include <Python.h>
#include "config.h"
-#include "interpreter.h"
+#include "internal.h"
struct BareConfig
{
diff --git a/src/config.h b/src/config.h
index a89883b..cb3c726 100644
--- a/src/config.h
+++ b/src/config.h
@@ -1,8 +1,6 @@
#ifndef CONFIG_H
#define CONFIG_H
-#include <Python.h>
-
#include "stringlist.h"
#include "message.h"
@@ -17,7 +15,6 @@ BareConfig* bareConfigCreate(Message* m, FILE* outFd, FILE* inFd, FILE* errFd);
const char* bareConfigGetDefaultValue(BareConfig* cfg, const char*);
const char* bareConfigGetOptionValue(BareConfig* cfg, const char* opt);
int bareConfigSetOptionValue(BareConfig* cfg, const char*, const char*);
-PyObject* _bareConfigObject(BareConfig*);
void bareConfigFree(BareConfig*);
#endif
diff --git a/src/dict.c b/src/dict.c
index 0deebe9..29c1dea 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
+#include "internal.h"
#include "dict.h"
/*
diff --git a/src/dict.h b/src/dict.h
index 47dd957..86cbbb3 100644
--- a/src/dict.h
+++ b/src/dict.h
@@ -1,8 +1,6 @@
#ifndef DICT_H
#define DICT_H
-#include <Python.h>
-
typedef struct Dict Dict;
Dict* dictCreate();
@@ -10,5 +8,4 @@ Dict* dictCreate();
void dictFree(Dict *t);
void dictInsert(Dict* list, const char* key, const char* value);
unsigned int dictCount(Dict *table);
-PyObject* dictToPyDict(Dict *dict);
#endif
diff --git a/src/internal.h b/src/internal.h
new file mode 100644
index 0000000..5d05d09
--- /dev/null
+++ b/src/internal.h
@@ -0,0 +1,21 @@
+#ifndef INTERNAL_H
+#define INTERNAL_H
+
+#include <Python.h>
+#include "stringlist.h"
+#include "dict.h"
+#include "config.h"
+#include "message.h"
+
+PyObject* executeFunction(const char *module, const char *funcName, const char* format, ...);
+
+PyObject* _bareConfigObject(BareConfig*);
+
+PyObject* _messageObject(Message* m);
+
+StringList* listToCList(PyObject* list);
+PyObject* cListToPyList(StringList*);
+
+PyObject* dictToPyDict(Dict *dict);
+
+#endif
diff --git a/src/interpreter.c b/src/interpreter.c
index 2430bce..151af2d 100644
--- a/src/interpreter.c
+++ b/src/interpreter.c
@@ -5,6 +5,7 @@
#include <Python.h>
#include <stdio.h>
#include <string.h>
+#include "interpreter.h"
/*
* PyObjectList
diff --git a/src/interpreter.h b/src/interpreter.h
index d21ad44..8e04ce0 100644
--- a/src/interpreter.h
+++ b/src/interpreter.h
@@ -1,10 +1,7 @@
#ifndef INTERPRETER_H
#define INTERPRETER_H
-#include <Python.h>
-
void interpreterInit();
void interpreterFinalize();
-PyObject* executeFunction(const char *module, const char *funcName, const char* format, ...);
#endif
diff --git a/src/laymanapi.c b/src/laymanapi.c
index fc79d68..848a096 100644
--- a/src/laymanapi.c
+++ b/src/laymanapi.c
@@ -1,5 +1,5 @@
#include <Python.h>
-#include "interpreter.h"
+#include "internal.h"
#include "laymanapi.h"
int _laymanAPIGetAllInfos(LaymanAPI* l, StringList* overlays, OverlayInfo *results, const char *overlay);
diff --git a/src/message.c b/src/message.c
index 181171e..b7ebb7d 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1,6 +1,6 @@
#include <Python.h>
#include "message.h"
-#include "interpreter.h"
+#include "internal.h"
struct Message
{
diff --git a/src/message.h b/src/message.h
index 7def442..7fe8668 100644
--- a/src/message.h
+++ b/src/message.h
@@ -1,16 +1,12 @@
#ifndef MESSAGE_H
#define MESSAGE_H
-#include <Python.h>
+#include <stdio.h>
#include "stringlist.h"
typedef struct Message Message;
-/*
- * arguments : module (String), stdout (fd), stderr (fd), stderr (fd), debug_level, debug_verbosity, info_level, warn_level, ?, ?, ?, ?
- */
-Message *messageCreate(const char* module, FILE* out, FILE* err, FILE* dbg);
-PyObject* _messageObject(Message* m);
+Message* messageCreate(const char* module, FILE* out, FILE* err, FILE* dbg);
void messageFree(Message *m);
#endif
diff --git a/src/stringlist.c b/src/stringlist.c
index 82cd5a8..259eabb 100644
--- a/src/stringlist.c
+++ b/src/stringlist.c
@@ -1,3 +1,5 @@
+#include <Python.h>
+#include <stdlib.h>
#include "stringlist.h"
struct StringList
@@ -15,7 +17,7 @@ StringList* stringListCreate(size_t len)
return ret;
}
-int stringListInsertAt(StringList *l, unsigned int pos, const char *str)
+int stringListInsertAt(StringList *l, unsigned int pos, char *str)
{
if(!l || !l->list || l->count < pos)
return 0;
diff --git a/src/stringlist.h b/src/stringlist.h
index 8c2722e..60800f0 100644
--- a/src/stringlist.h
+++ b/src/stringlist.h
@@ -1,16 +1,14 @@
#ifndef STRINGLIST_H
#define STRINGLIST_H
-#include <Python.h>
+#include <sys/types.h>
typedef struct StringList StringList;
StringList* stringListCreate(size_t);
unsigned int stringListCount(StringList*);
-int stringListInsertAt(StringList*, unsigned int, const char*);
+int stringListInsertAt(StringList*, unsigned int, char*);
char* stringListGetAt(StringList*, unsigned int);
-StringList* listToCList(PyObject* list);
-PyObject* cListToPyList(StringList*);
void stringListPrint(StringList*);
void stringListFree(StringList*);
diff --git a/src/tester.c b/src/tester.c
index 3268f66..f7c7701 100644
--- a/src/tester.c
+++ b/src/tester.c
@@ -1,3 +1,4 @@
+#include <stdlib.h>
#include "interpreter.h"
#include "config.h"
#include "laymanapi.h"