diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e6b83cfe1..9ed0011e6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -109,7 +109,6 @@ set (ERESSEA_SRC items.c json.c jsonconf.c - keyword.c laws.c lighthouse.c magic.c @@ -224,7 +223,6 @@ set(TESTS_SRC guard.test.c json.test.c jsonconf.test.c - keyword.test.c laws.test.c lighthouse.test.c magic.test.c diff --git a/src/automate.c b/src/automate.c index 6af40d649..530b9ee39 100644 --- a/src/automate.c +++ b/src/automate.c @@ -6,10 +6,10 @@ #include "kernel/region.h" #include "kernel/unit.h" +#include "util/keyword.h" #include "util/log.h" #include "automate.h" -#include "keyword.h" #include "laws.h" #include "study.h" diff --git a/src/battle.test.c b/src/battle.test.c index 8cfbb0d2a..a2ea561d4 100644 --- a/src/battle.test.c +++ b/src/battle.test.c @@ -3,7 +3,6 @@ #include "battle.h" #include "guard.h" -#include "keyword.h" #include "reports.h" #include "skill.h" @@ -22,6 +21,7 @@ #include #include +#include "util/keyword.h" #include #include #include diff --git a/src/bind_process.c b/src/bind_process.c index 58f90076f..f9f99284e 100755 --- a/src/bind_process.c +++ b/src/bind_process.c @@ -4,20 +4,22 @@ #include "bind_process.h" +#include "battle.h" +#include "economy.h" +#include "laws.h" +#include "magic.h" +#include "market.h" +#include "move.h" +#include "study.h" + #include #include #include #include #include #include -#include "battle.h" -#include "economy.h" -#include "keyword.h" -#include "laws.h" -#include "magic.h" -#include "market.h" -#include "move.h" -#include "study.h" + +#include "util/keyword.h" #define PROC_LAND_REGION 0x0001 #define PROC_LONG_ORDER 0x0002 diff --git a/src/creport.test.c b/src/creport.test.c index bacf8def0..6bd5bfba8 100644 --- a/src/creport.test.c +++ b/src/creport.test.c @@ -3,7 +3,6 @@ #include "move.h" #include "spy.h" #include "travelthru.h" -#include "keyword.h" #include #include @@ -17,6 +16,7 @@ #include #include +#include "util/keyword.h" #include #include #include diff --git a/src/items.c b/src/items.c index 665220e8f..72bd6d713 100644 --- a/src/items.c +++ b/src/items.c @@ -5,7 +5,6 @@ #include "alchemy.h" #include "skill.h" -#include "keyword.h" #include "direction.h" #include "study.h" #include "economy.h" @@ -35,6 +34,7 @@ #include #include +#include #include #include #include diff --git a/src/jsonconf.c b/src/jsonconf.c index dc11ee563..ff442f990 100644 --- a/src/jsonconf.c +++ b/src/jsonconf.c @@ -32,6 +32,7 @@ without prior permission by the authors of Eressea. #include "kernel/attrib.h" #include "util/crmessage.h" #include "util/functions.h" +#include "util/keyword.h" #include "util/language.h" #include "util/log.h" #include "util/message.h" @@ -42,7 +43,6 @@ without prior permission by the authors of Eressea. /* game modules */ #include "direction.h" -#include "keyword.h" #include "move.h" #include "prefix.h" #include "skill.h" diff --git a/src/jsonconf.test.c b/src/jsonconf.test.c index 9e0e8f6b6..1fc27d3e6 100644 --- a/src/jsonconf.test.c +++ b/src/jsonconf.test.c @@ -15,11 +15,11 @@ #include "kernel/order.h" #include "kernel/terrain.h" +#include "util/keyword.h" #include "util/language.h" #include "kernel/calendar.h" #include "direction.h" -#include "keyword.h" #include "move.h" #include "prefix.h" diff --git a/src/kernel/config.c b/src/kernel/config.c index e31564b8d..842324fe8 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -33,7 +33,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "faction.h" #include "group.h" #include "item.h" -#include "keyword.h" #include "messages.h" #include "move.h" #include "objtypes.h" @@ -51,9 +50,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* util includes */ #include +#include + #include #include -#include +#include #include #include #include diff --git a/src/kernel/order.c b/src/kernel/order.c index e30ea6097..6015b823d 100644 --- a/src/kernel/order.c +++ b/src/kernel/order.c @@ -15,9 +15,9 @@ #include "order.h" #include "skill.h" -#include "keyword.h" #include +#include "util/keyword.h" #include #include #include diff --git a/src/kernel/order.h b/src/kernel/order.h index c5406b39e..ca57d0179 100644 --- a/src/kernel/order.h +++ b/src/kernel/order.h @@ -13,7 +13,8 @@ #ifndef KRNL_ORDER_H #define KRNL_ORDER_H -#include "keyword.h" +#include + #include #include diff --git a/src/laws.c b/src/laws.c index 67e4567a9..8cec1e51b 100644 --- a/src/laws.c +++ b/src/laws.c @@ -29,7 +29,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "automate.h" #include "battle.h" #include "economy.h" -#include "keyword.h" #include "market.h" #include "morale.h" #include "monsters.h" @@ -75,6 +74,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include "util/keyword.h" #include #include #include diff --git a/src/monsters.c b/src/monsters.c index 505c6c272..867d601c6 100644 --- a/src/monsters.c +++ b/src/monsters.c @@ -27,17 +27,18 @@ #include "give.h" #include "guard.h" #include "laws.h" -#include "keyword.h" #include "study.h" #include "move.h" /* kernel includes */ +#include "kernel/attrib.h" #include "kernel/build.h" #include "kernel/building.h" #include "kernel/calendar.h" #include "kernel/config.h" #include "kernel/curse.h" #include "kernel/equipment.h" +#include "kernel/event.h" #include "kernel/faction.h" #include "kernel/item.h" #include "kernel/messages.h" @@ -52,10 +53,9 @@ #include "kernel/unit.h" /* util includes */ -#include #include -#include -#include +#include "util/keyword.h" +#include "util/language.h" #include #include #include diff --git a/src/piracy.c b/src/piracy.c index 86b9b4904..b7307c070 100644 --- a/src/piracy.c +++ b/src/piracy.c @@ -2,10 +2,10 @@ #include "piracy.h" #include "direction.h" -#include "keyword.h" #include "move.h" #include +#include #include #include #include @@ -15,9 +15,9 @@ #include #include -#include #include #include +#include "util/keyword.h" #include #include #include diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 4258a5edc..61e2cf745 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -10,11 +10,13 @@ base36.test.c # filereader.test.c functions.test.c # goodies.test.c +keyword.test.c language.test.c # lists.test.c # log.test.c message.test.c # nrmessage.test.c +# order_parser.test.c parser.test.c password.test.c # rand.test.c @@ -37,12 +39,14 @@ dice.c filereader.c functions.c goodies.c +keyword.c language.c lists.c log.c message.c mt19937ar.c nrmessage.c +order_parser.c parser.c password.c path.c diff --git a/src/keyword.c b/src/util/keyword.c similarity index 100% rename from src/keyword.c rename to src/util/keyword.c diff --git a/src/keyword.h b/src/util/keyword.h similarity index 100% rename from src/keyword.h rename to src/util/keyword.h diff --git a/src/keyword.test.c b/src/util/keyword.test.c similarity index 100% rename from src/keyword.test.c rename to src/util/keyword.test.c diff --git a/src/util/order_parser.c b/src/util/order_parser.c new file mode 100644 index 000000000..691686276 --- /dev/null +++ b/src/util/order_parser.c @@ -0,0 +1,33 @@ +#ifdef _MSC_VER +#include +#endif + +#include "order_parser.h" + +#include + +struct OrderParserStruct { + void *m_userData; + char *m_buffer; + char *m_bufferPtr; + const char *m_bufferEnd; + OP_FactionHandler m_factionHandler; + OP_UnitHandler m_unitHandler; + OP_OrderHandler m_orderHandler; + enum CR_Error m_errorCode; + int m_lineNumber; +}; + +OP_Parser OP_ParserCreate(void) +{ + return NULL; +} + +void OP_ParserFree(OP_Parser op) { + free(op); +} + +enum OP_Status OP_Parse(OP_Parser op, const char *s, int len, int isFinal) +{ + return OP_STATUS_OK; +} diff --git a/src/util/order_parser.h b/src/util/order_parser.h new file mode 100644 index 000000000..ee98b72a6 --- /dev/null +++ b/src/util/order_parser.h @@ -0,0 +1,34 @@ +#pragma once +/* + * +-------------------+ Christian Schlittchen + * | | Enno Rehling + * | Eressea PBEM host | Katja Zedel + * | (c) 1998 - 2007 | + * | | This program may not be used, modified or distributed + * +-------------------+ without prior permission by the authors of Eressea. + * + */ + +#ifndef UTIL_ORDER_PARSER_H +#define UTIL_ORDER_PARSER_H + +#include +#include + +struct OrderParserStruct; +typedef struct OrderParserStruct *OP_Parser; + +enum OP_Status { + OP_STATUS_ERROR = 0, + OP_STATUS_OK = 1 +}; + +typedef void(*OP_FactionHandler) (void *userData, int no, const char *password); +typedef void(*OP_UnitHandler) (void *userData, int no); +typedef void(*OP_OrderHandler) (void *userData, const char *str, size_t len); + +OP_Parser OP_ParserCreate(void); +void OP_ParserFree(OP_Parser op); +enum OP_Status OP_Parse(OP_Parser op, const char *s, int len, int isFinal); + +#endif diff --git a/src/util/parser.c b/src/util/parser.c index 1ba913c2c..edcb5e3d6 100644 --- a/src/util/parser.c +++ b/src/util/parser.c @@ -1,4 +1,6 @@ +#ifdef _MSC_VER #include +#endif #include "parser.h" #include "unicode.h" #include "base36.h"