move keyword.[hc] to util

This commit is contained in:
Enno Rehling 2018-09-29 18:13:32 +02:00
parent 991fe8fd8d
commit bc5f2ea6d1
21 changed files with 102 additions and 27 deletions

View file

@ -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

View file

@ -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"

View file

@ -3,7 +3,6 @@
#include "battle.h"
#include "guard.h"
#include "keyword.h"
#include "reports.h"
#include "skill.h"
@ -22,6 +21,7 @@
#include <util/base36.h>
#include <util/functions.h>
#include "util/keyword.h"
#include <util/language.h>
#include <util/message.h>
#include <util/rand.h>

View file

@ -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 <kernel/alliance.h>
#include <kernel/config.h>
#include <kernel/order.h>
#include <kernel/region.h>
#include <kernel/terrain.h>
#include <kernel/unit.h>
#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

View file

@ -3,7 +3,6 @@
#include "move.h"
#include "spy.h"
#include "travelthru.h"
#include "keyword.h"
#include <kernel/ally.h>
#include <kernel/building.h>
@ -17,6 +16,7 @@
#include <kernel/spell.h>
#include <kernel/spellbook.h>
#include "util/keyword.h"
#include <util/language.h>
#include <util/lists.h>
#include <util/message.h>

View file

@ -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 <kernel/attrib.h>
#include <kernel/event.h>
#include <util/keyword.h>
#include <util/macros.h>
#include <util/parser.h>
#include <util/rand.h>

View file

@ -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"

View file

@ -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"

View file

@ -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 <kernel/attrib.h>
#include <kernel/event.h>
#include <util/base36.h>
#include <util/crmessage.h>
#include <kernel/event.h>
#include <util/keyword.h>
#include <util/language.h>
#include <util/functions.h>
#include <util/log.h>

View file

@ -15,9 +15,9 @@
#include "order.h"
#include "skill.h"
#include "keyword.h"
#include <util/base36.h>
#include "util/keyword.h"
#include <util/language.h>
#include <util/log.h>
#include <util/parser.h>

View file

@ -13,7 +13,8 @@
#ifndef KRNL_ORDER_H
#define KRNL_ORDER_H
#include "keyword.h"
#include <util/keyword.h>
#include <stddef.h>
#include <stdbool.h>

View file

@ -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 <util/base36.h>
#include <kernel/event.h>
#include <util/goodies.h>
#include "util/keyword.h"
#include <util/language.h>
#include <util/lists.h>
#include <util/log.h>

View file

@ -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 <kernel/attrib.h>
#include <util/base36.h>
#include <kernel/event.h>
#include <util/language.h>
#include "util/keyword.h"
#include "util/language.h"
#include <util/lists.h>
#include <util/log.h>
#include <util/rand.h>

View file

@ -2,10 +2,10 @@
#include "piracy.h"
#include "direction.h"
#include "keyword.h"
#include "move.h"
#include <kernel/ally.h>
#include <kernel/attrib.h>
#include <kernel/faction.h>
#include <kernel/messages.h>
#include <kernel/order.h>
@ -15,9 +15,9 @@
#include <kernel/terrain.h>
#include <kernel/unit.h>
#include <kernel/attrib.h>
#include <util/base36.h>
#include <util/goodies.h>
#include "util/keyword.h"
#include <util/language.h>
#include <util/parser.h>
#include <util/rng.h>

View file

@ -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

33
src/util/order_parser.c Normal file
View file

@ -0,0 +1,33 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "order_parser.h"
#include <stdlib.h>
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;
}

34
src/util/order_parser.h Normal file
View file

@ -0,0 +1,34 @@
#pragma once
/*
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
* | | Enno Rehling <enno@eressea.de>
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
* | (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 <stddef.h>
#include <stdbool.h>
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

View file

@ -1,4 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "parser.h"
#include "unicode.h"
#include "base36.h"