From a79f31c34e23d7c9a8666ed5857f7ea0bd978e16 Mon Sep 17 00:00:00 2001 From: Detlev Casanova Date: Sat, 17 Jul 2010 14:03:18 +0200 Subject: Hide internal functions and update run-test.sh --- run-test.sh | 2 +- src/config.c | 2 +- src/config.h | 3 --- src/dict.c | 1 + src/dict.h | 3 --- src/internal.h | 21 +++++++++++++++++++++ src/interpreter.c | 1 + src/interpreter.h | 3 --- src/laymanapi.c | 2 +- src/message.c | 2 +- src/message.h | 8 ++------ src/stringlist.c | 4 +++- src/stringlist.h | 6 ++---- src/tester.c | 1 + 14 files changed, 35 insertions(+), 24 deletions(-) create mode 100644 src/internal.h 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 #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 - #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 #include +#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 - 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 +#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 #include #include +#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 - 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 -#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 #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 +#include #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 +#include #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 +#include 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 #include "interpreter.h" #include "config.h" #include "laymanapi.h" -- cgit v1.2.3-1-g7c22