From e49bce26d3de1a5c2afbe018a869ff8790294fc5 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Wed, 16 Mar 2011 00:38:02 -0700 Subject: Use makefiles correctly and expand include dirs --- src/char/Makefile | 9 ++- src/char/char.c | 12 ++-- src/char/int_guild.c | 8 +-- src/char/int_party.c | 8 +-- src/char/inter.c | 10 +-- src/common/Makefile | 2 +- src/ladmin/Makefile | 3 +- src/ladmin/ladmin.c | 8 +-- src/ladmin/md5calc.c | 2 +- src/login/Makefile | 9 ++- src/login/login.c | 18 ++--- src/map/Makefile | 29 ++++---- src/map/atcommand.c | 8 +-- src/map/battle.c | 8 +-- src/map/chat.c | 6 +- src/map/chrif.c | 6 +- src/map/clif.c | 12 ++-- src/map/guild.c | 10 +-- src/map/intif.c | 6 +- src/map/itemdb.c | 8 +-- src/map/magic-interpreter-lexer.l | 140 +++++++++++++++++++++++++++++++++++++ src/map/magic-interpreter-parser.y | 2 +- src/map/magic-interpreter.h | 4 +- src/map/magic-interpreter.l | 140 ------------------------------------- src/map/map.c | 14 ++-- src/map/map.h | 2 +- src/map/mob.c | 10 +-- src/map/npc.c | 8 +-- src/map/party.c | 10 +-- src/map/path.c | 2 +- src/map/pc.c | 10 +-- src/map/script.c | 12 ++-- src/map/skill-pools.c | 6 +- src/map/skill.c | 6 +- src/map/tmw.c | 10 +-- src/map/trade.c | 2 +- src/tool/Makefile | 21 +++--- src/tool/adduser.c | 8 +-- src/tool/marriage-info.c | 6 +- src/webserver/Makefile | 19 ++--- 40 files changed, 301 insertions(+), 313 deletions(-) create mode 100644 src/map/magic-interpreter-lexer.l delete mode 100644 src/map/magic-interpreter.l (limited to 'src') diff --git a/src/char/Makefile b/src/char/Makefile index 5eb4b51..6f2e4af 100644 --- a/src/char/Makefile +++ b/src/char/Makefile @@ -1,12 +1,11 @@ include ../../make.defs -all: char-server -txt: char-server +all: txt +txt: char COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/lock.o ../common/malloc.o ../common/mt_rand.o COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/db.h ../common/lock.h ../common/timer.h ../common/malloc.h ../common/mt_rand.h -char-server: char.o inter.o int_party.o int_guild.o int_storage.o $(COMMON_OBJ) - $(CC) $(CFLAGS) -o ../../$@ $^ +char: char.o inter.o int_party.o int_guild.o int_storage.o $(COMMON_OBJ) char.o: char.c char.h inter.h $(COMMON_H) ../common/version.h inter.o: inter.c inter.h int_party.h int_guild.h int_storage.h char.h $(COMMON_H) @@ -15,4 +14,4 @@ int_guild.o: int_guild.c int_guild.h int_storage.h inter.h char.h $(COMMON_H) int_storage.o: int_storage.c int_storage.h int_guild.h inter.h char.h $(COMMON_H) clean: - rm -f *.o ../../char-server + rm -f *.o char diff --git a/src/char/char.c b/src/char/char.c index 07b1fb6..f4a91bd 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -18,12 +18,12 @@ #include #include -#include "core.h" -#include "socket.h" -#include "timer.h" -#include "mmo.h" -#include "version.h" -#include "lock.h" +#include "../common/core.h" +#include "../common/socket.h" +#include "../common/timer.h" +#include "../common/mmo.h" +#include "../common/version.h" +#include "../common/lock.h" #include "char.h" #include "inter.h" diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 5b4fe30..e145b66 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -2,11 +2,11 @@ #include "inter.h" #include "int_guild.h" #include "int_storage.h" -#include "mmo.h" +#include "../common/mmo.h" #include "char.h" -#include "socket.h" -#include "db.h" -#include "lock.h" +#include "../common/socket.h" +#include "../common/db.h" +#include "../common/lock.h" #include #include diff --git a/src/char/int_party.c b/src/char/int_party.c index c501c74..c5ed033 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -1,11 +1,11 @@ // $Id: int_party.c,v 1.1.1.1 2004/09/10 17:26:51 MagicalTux Exp $ #include "inter.h" #include "int_party.h" -#include "mmo.h" +#include "../common/mmo.h" #include "char.h" -#include "socket.h" -#include "db.h" -#include "lock.h" +#include "../common/socket.h" +#include "../common/db.h" +#include "../common/lock.h" #include #include #include diff --git a/src/char/inter.c b/src/char/inter.c index 89a3e39..5bee90f 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -1,9 +1,9 @@ // $Id: inter.c,v 1.1.1.1 2004/09/10 17:26:51 MagicalTux Exp $ -#include "mmo.h" +#include "../common/mmo.h" #include "char.h" -#include "socket.h" -#include "timer.h" -#include "db.h" +#include "../common/socket.h" +#include "../common/timer.h" +#include "../common/db.h" #include #include @@ -11,7 +11,7 @@ #include "int_party.h" #include "int_guild.h" #include "int_storage.h" -#include "lock.h" +#include "../common/lock.h" #define WISDATA_TTL (60*1000) // Existence time of Wisp/page data (60 seconds) // that is the waiting time of answers of all map-servers diff --git a/src/common/Makefile b/src/common/Makefile index 27930bd..48e75d8 100644 --- a/src/common/Makefile +++ b/src/common/Makefile @@ -1,5 +1,5 @@ include ../../make.defs -txt sql all: core.o socket.o timer.o grfio.o db.o lock.o nullpo.o malloc.o mt_rand.o md5calc.o +all txt sql: core.o socket.o timer.o grfio.o db.o lock.o nullpo.o malloc.o mt_rand.o md5calc.o core.o: core.c core.h socket.o: socket.c socket.h mmo.h diff --git a/src/ladmin/Makefile b/src/ladmin/Makefile index 3221901..9199951 100644 --- a/src/ladmin/Makefile +++ b/src/ladmin/Makefile @@ -8,9 +8,8 @@ COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db. COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h ../common/db.h ../common/malloc.h ../common/mt_rand.h ladmin: ladmin.o md5calc.o $(COMMON_OBJ) - $(CC) -o ../../$@ ladmin.o md5calc.o $(COMMON_OBJ) ladmin.o: ladmin.c ladmin.h md5calc.h $(COMMON_H) md5calc.o: md5calc.c md5calc.h clean: - rm -f *.o ../../ladmin + rm -f *.o ladmin diff --git a/src/ladmin/ladmin.c b/src/ladmin/ladmin.c index 5ef9b6c..d7f4f5f 100644 --- a/src/ladmin/ladmin.c +++ b/src/ladmin/ladmin.c @@ -22,11 +22,11 @@ #include // valist #include // tolower -#include "core.h" -#include "socket.h" +#include "../common/core.h" +#include "../common/socket.h" #include "ladmin.h" -#include "version.h" -#include "mmo.h" +#include "../common/version.h" +#include "../common/mmo.h" #ifdef PASSWORDENC #include "md5calc.h" diff --git a/src/ladmin/md5calc.c b/src/ladmin/md5calc.c index cf9d958..ec1d8ec 100644 --- a/src/ladmin/md5calc.c +++ b/src/ladmin/md5calc.c @@ -10,7 +10,7 @@ #include "md5calc.h" #include #include -#include "mt_rand.h" +#include "../common/mt_rand.h" #ifndef UINT_MAX #define UINT_MAX 4294967295U diff --git a/src/login/Makefile b/src/login/Makefile index 32e14d7..185cffb 100644 --- a/src/login/Makefile +++ b/src/login/Makefile @@ -1,14 +1,13 @@ include ../../make.defs -all: login-server -txt: login-server +all: txt +txt: login COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/lock.o ../common/malloc.o ../common/mt_rand.o ../common/md5calc.o COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h ../common/db.h ../common/lock.h ../common/malloc.h ../common/mt_rand.h ../common/md5calc.h -login-server: login.o $(COMMON_OBJ) - $(CC) $(CFLAGS) -o ../../$@ login.o $(COMMON_OBJ) +login: $(COMMON_OBJ) login.o: login.c login.h $(COMMON_H) clean: - rm -f *.o ../../login-server + rm -f *.o login diff --git a/src/login/login.c b/src/login/login.c index 1db85ad..480533e 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -18,17 +18,17 @@ #include #include -#include "core.h" -#include "socket.h" -#include "timer.h" +#include "../common/core.h" +#include "../common/socket.h" +#include "../common/timer.h" #include "login.h" -#include "mmo.h" -#include "version.h" -#include "db.h" -#include "lock.h" -#include "mt_rand.h" +#include "../common/mmo.h" +#include "../common/version.h" +#include "../common/db.h" +#include "../common/lock.h" +#include "../common/mt_rand.h" -#include "md5calc.h" +#include "../common/md5calc.h" #ifdef MEMWATCH #include "memwatch.h" diff --git a/src/map/Makefile b/src/map/Makefile index a1a4381..c7c982e 100644 --- a/src/map/Makefile +++ b/src/map/Makefile @@ -2,27 +2,25 @@ include ../../make.defs all: txt -txt: obj map-server +txt: map obj: mkdir obj COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/grfio.o ../common/db.o ../common/lock.o ../common/nullpo.o ../common/malloc.o ../common/mt_rand.o ../common/md5calc.o -LIBS = -lz -lm +LDLIBS = -lz -lm -map-server: obj/tmw.o obj/magic-interpreter-lexer.o obj/magic-interpreter-parser.o obj/magic-interpreter-base.o obj/magic-expr.o obj/magic-stmt.o obj/magic.o obj/map.o obj/chrif.o obj/clif.o obj/pc.o obj/npc.o obj/chat.o obj/path.o obj/itemdb.o obj/mob.o obj/script.o obj/storage.o obj/skill.o obj/skill-pools.o obj/atcommand.o obj/battle.o obj/intif.o obj/trade.o obj/party.o obj/guild.o $(COMMON_OBJ) - $(CC) -o ../../$@ $^ $(LIBS) +map: obj/tmw.o obj/magic-interpreter-lexer.o obj/magic-interpreter-parser.o obj/magic-interpreter-base.o obj/magic-expr.o obj/magic-stmt.o obj/magic.o obj/map.o obj/chrif.o obj/clif.o obj/pc.o obj/npc.o obj/chat.o obj/path.o obj/itemdb.o obj/mob.o obj/script.o obj/storage.o obj/skill.o obj/skill-pools.o obj/atcommand.o obj/battle.o obj/intif.o obj/trade.o obj/party.o obj/guild.o $(COMMON_OBJ) + ${LINK.c} $^ ${LDLIBS} -o $@ +obj/%.o: %.c | obj + ${COMPILE.c} $< -o $@ -obj/%.o: %.c - $(COMPILE.c) $(OUTPUT_OPTION) $< +magic-interpreter-lexer.c: magic-interpreter-lexer.l +magic-interpreter-parser.c magic-interpreter-parser.h: magic-interpreter-parser.y +#The builtin yacc rule is insufficient, (but yacc can be used in place of bison) + ${YACC} $^ -d -o magic-interpreter-parser.c -magic-interpreter-lexer.c: magic-interpreter.l - $(LEX) -o magic-interpreter-lexer.c magic-interpreter.l - -magic-interpreter-parser.c: magic-interpreter-parser.y - $(BISON) -v -d -o magic-interpreter-parser.c magic-interpreter-parser.y - -obj/magic-interpreter-lexer.o: magic-interpreter-lexer.c magic-interpreter-parser.c magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic-interpreter-lexer.o: magic-interpreter-lexer.c magic-interpreter-parser.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h obj/magic-interpreter-parser.o: magic-interpreter-parser.c magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h obj/magic-interpreter-base.o: magic-interpreter-base.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h obj/magic-expr.o: magic-expr.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h @@ -47,6 +45,9 @@ obj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h batt obj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h ../common/mmo.h obj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.h obj/tmw.o: tmw.c tmw.h map.h clif.h +obj/guild.o: guild.c guild.h storage.h ../common/mmo.h ../common/utils.h \ + ../common/mt_rand.h ../common/timer.h ../common/socket.h \ + ../common/nullpo.h battle.h npc.h pc.h map.h mob.h intif.h clif.h tmw.h clean: - rm -rf *.o ../../map-server obj + rm -rf *.o map obj magic-interpreter-parser.c magic-interpreter-parser.h magic-interpreter-lexer.c diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 681cccf..cb9e93c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -10,9 +10,9 @@ #include #include -#include "socket.h" -#include "timer.h" -#include "nullpo.h" +#include "../common/socket.h" +#include "../common/timer.h" +#include "../common/nullpo.h" #include "atcommand.h" #include "battle.h" @@ -30,7 +30,7 @@ #include "skill.h" #include "trade.h" -#include "core.h" +#include "../common/core.h" #include "tmw.h" #define STATE_BLIND 0x10 diff --git a/src/map/battle.c b/src/map/battle.c index f81aaf0..c9e341d 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6,9 +6,9 @@ #include "battle.h" -#include "timer.h" -#include "nullpo.h" -#include "malloc.h" +#include "../common/timer.h" +#include "../common/nullpo.h" +#include "../common/malloc.h" #include "clif.h" #include "guild.h" @@ -18,7 +18,7 @@ #include "pc.h" #include "skill.h" #include "../common/socket.h" -#include "mt_rand.h" +#include "../common/mt_rand.h" #ifdef MEMWATCH #include "memwatch.h" diff --git a/src/map/chat.c b/src/map/chat.c index 772ac4c..0163eed 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -3,9 +3,9 @@ #include #include -#include "db.h" -#include "nullpo.h" -#include "malloc.h" +#include "../common/db.h" +#include "../common/nullpo.h" +#include "../common/malloc.h" #include "map.h" #include "clif.h" #include "pc.h" diff --git a/src/map/chrif.c b/src/map/chrif.c index 4bcfa45..8bbeb59 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -13,8 +13,8 @@ #include #include -#include "socket.h" -#include "timer.h" +#include "../common/socket.h" +#include "../common/timer.h" #include "map.h" #include "battle.h" #include "chrif.h" @@ -22,7 +22,7 @@ #include "intif.h" #include "npc.h" #include "pc.h" -#include "nullpo.h" +#include "../common/nullpo.h" #include "itemdb.h" #ifdef MEMWATCH diff --git a/src/map/clif.c b/src/map/clif.c index ce79490..d630815 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -18,12 +18,12 @@ #endif #include -#include "socket.h" -#include "timer.h" -#include "malloc.h" -#include "version.h" -#include "nullpo.h" -#include "md5calc.h" +#include "../common/socket.h" +#include "../common/timer.h" +#include "../common/malloc.h" +#include "../common/version.h" +#include "../common/nullpo.h" +#include "../common/md5calc.h" #include "atcommand.h" #include "battle.h" diff --git a/src/map/guild.c b/src/map/guild.c index 1d328ea..4a7552a 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -5,11 +5,11 @@ #include "guild.h" #include "storage.h" -#include "db.h" -#include "timer.h" -#include "socket.h" -#include "nullpo.h" -#include "malloc.h" +#include "../common/db.h" +#include "../common/timer.h" +#include "../common/socket.h" +#include "../common/nullpo.h" +#include "../common/malloc.h" #include "battle.h" #include "npc.h" #include "pc.h" diff --git a/src/map/intif.c b/src/map/intif.c index efde695..629eade 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -18,9 +18,9 @@ #include #include -#include "nullpo.h" -#include "socket.h" -#include "timer.h" +#include "../common/nullpo.h" +#include "../common/socket.h" +#include "../common/timer.h" #include "battle.h" #include "chrif.h" diff --git a/src/map/itemdb.c b/src/map/itemdb.c index d589e35..dfa3d36 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -3,10 +3,10 @@ #include #include -#include "db.h" -#include "grfio.h" -#include "nullpo.h" -#include "malloc.h" +#include "../common/db.h" +#include "../common/grfio.h" +#include "../common/nullpo.h" +#include "../common/malloc.h" #include "map.h" #include "battle.h" #include "itemdb.h" diff --git a/src/map/magic-interpreter-lexer.l b/src/map/magic-interpreter-lexer.l new file mode 100644 index 0000000..2c9792f --- /dev/null +++ b/src/map/magic-interpreter-lexer.l @@ -0,0 +1,140 @@ +%{ +#include "magic-interpreter.h" +#include "magic-interpreter-parser.h" + +#ifdef HEADING +# undef HEADING +#endif + +#define FIXLOC magic_frontend_lloc.first_line = magic_frontend_lineno + +#define HEADING(dir) { magic_frontend_lval.i = dir; FIXLOC; return DIR; } + +%} + +%option yylineno +%option noyywrap +%option prefix="magic_frontend_" +%option nounput +%option noinput +%option bison-bridge bison-locations + +%% + +"S" HEADING(0); +"SW" HEADING(1); +"W" HEADING(2); +"NW" HEADING(3); +"N" HEADING(4); +"NE" HEADING(5); +"E" HEADING(6); +"SE" HEADING(7); +"=" {FIXLOC; return '=';} +"==" {FIXLOC; return EQ;} +"<>" {FIXLOC; return NEQ;} +"!=" {FIXLOC; return NEQ;} +">" {FIXLOC; return '>';} +"<" {FIXLOC; return '<';} +">=" {FIXLOC; return GTE;} +"<=" {FIXLOC; return LTE;} +"(" {FIXLOC; return '(';} +")" {FIXLOC; return ')';} +"+" {FIXLOC; return '+';} +"-" {FIXLOC; return '-';} +"*" {FIXLOC; return '*';} +"/" {FIXLOC; return '/';} +"%" {FIXLOC; return '%';} +"&&" {FIXLOC; return ANDAND;} +"||" {FIXLOC; return OROR;} +";" {FIXLOC; return ';';} +":" {FIXLOC; return ':';} +"," {FIXLOC; return ',';} +"@" {FIXLOC; return '@';} +"|" {FIXLOC; return '|';} +"[" {FIXLOC; return '[';} +"]" {FIXLOC; return ']';} +"&" {FIXLOC; return '&';} +"^" {FIXLOC; return '^';} +"." {FIXLOC; return '.';} +"<<" {FIXLOC; return SHL;} +">>" {FIXLOC; return SHR;} +"PROCEDURE" {FIXLOC; return PROCEDURE;} +"CALL" {FIXLOC; return CALL;} +"OR" {FIXLOC; return OR;} +"TO" {FIXLOC; return TO;} +"TOWARDS" {FIXLOC; return TOWARDS;} +"TELEPORT-ANCHOR" {FIXLOC; return TELEPORT_ANCHOR;} +"SILENT" {FIXLOC; return SILENT;} +"LOCAL" {FIXLOC; return LOCAL;} +"NONMAGIC" {FIXLOC; return NONMAGIC;} +"SPELL" {FIXLOC; return SPELL;} +"LET" {FIXLOC; return LET;} +"IN" {FIXLOC; return IN;} +"END" {FIXLOC; return END;} +"=>" {FIXLOC; return DARROW;} +"STRING" {FIXLOC; return STRING_TY;} +"REQUIRE" {FIXLOC; return REQUIRE;} +"CATALYSTS" {FIXLOC; return CATALYSTS;} +"COMPONENTS" {FIXLOC; return COMPONENTS;} +"MANA" {FIXLOC; return MANA;} +"CASTTIME" {FIXLOC; return CASTTIME;} +"SKIP" {FIXLOC; return SKIP;} +"ABORT" {FIXLOC; return ABORT;} +"BREAK" {FIXLOC; return BREAK;} +"EFFECT" {FIXLOC; return EFFECT;} +"ATEND" {FIXLOC; return ATEND;} +"ATTRIGGER" {FIXLOC; return ATTRIGGER;} +"CONST" {FIXLOC; return CONST;} +"PC" {FIXLOC; return PC_F;} +"NPC" {FIXLOC; return NPC_F;} +"MOB" {FIXLOC; return MOB_F;} +"ENTITY" {FIXLOC; return ENTITY_F;} +"TARGET" {FIXLOC; return TARGET_F;} +"IF" {FIXLOC; return IF;} +"THEN" {FIXLOC; return THEN;} +"ELSE" {FIXLOC; return ELSE;} +"FOREACH" {FIXLOC; return FOREACH;} +"FOR" {FIXLOC; return FOR;} +"DO" {FIXLOC; return DO;} +"WAIT" {FIXLOC; return SLEEP;} + +\{([^\}]|\\.)*\} { char *string = strdup(yytext); + magic_frontend_lval.s = string; + FIXLOC; + return SCRIPT_DATA; + } + +\"([^\"]|\\.)*\" { char *string = strdup(yytext + 1); + char *src = string; + char *dst = string; + while (*src && *src != '"') + if (*src == '\\') { + *dst++ = src[1]; + src += 2; + } else + *dst++ = *src++; + *dst = '\0'; /* terminate */ + magic_frontend_lval.s = string; + FIXLOC; + return STRING; + } + +"-"?[0-9]+ { magic_frontend_lval.i = atoi(yytext); + FIXLOC; + return INT; } + +"0x"[0-9a-fA-F]+ { magic_frontend_lval.i = strtol(yytext + 2, NULL, 16); + FIXLOC; + return INT; } + +[a-zA-Z][-_a-zA-Z0-9?!]* { magic_frontend_lval.s = strdup(yytext); + FIXLOC; + return ID; } + +"#".*$ /* Ignore comments */ +"//".*$ /* Ignore comments */ +[ \n\t\r] /* ignore whitespace */ +. fprintf(stderr, "%s: Unexpected character in line %d\n", MAGIC_CONFIG_FILE, magic_frontend_lineno); + + +%% diff --git a/src/map/magic-interpreter-parser.y b/src/map/magic-interpreter-parser.y index 04d5630..8484902 100644 --- a/src/map/magic-interpreter-parser.y +++ b/src/map/magic-interpreter-parser.y @@ -409,7 +409,7 @@ expr : value arg_list : /* empty */ { $$.args_nr = 0; } | arg_list_ne - { $$ = $1 } + { $$ = $1; } ; diff --git a/src/map/magic-interpreter.h b/src/map/magic-interpreter.h index 7db7d3e..006c8fb 100644 --- a/src/map/magic-interpreter.h +++ b/src/map/magic-interpreter.h @@ -8,8 +8,8 @@ #include #include -#include "malloc.h" -#include "nullpo.h" +#include "../common/malloc.h" +#include "../common/nullpo.h" #include "battle.h" #include "chat.h" diff --git a/src/map/magic-interpreter.l b/src/map/magic-interpreter.l deleted file mode 100644 index 2c9792f..0000000 --- a/src/map/magic-interpreter.l +++ /dev/null @@ -1,140 +0,0 @@ -%{ -#include "magic-interpreter.h" -#include "magic-interpreter-parser.h" - -#ifdef HEADING -# undef HEADING -#endif - -#define FIXLOC magic_frontend_lloc.first_line = magic_frontend_lineno - -#define HEADING(dir) { magic_frontend_lval.i = dir; FIXLOC; return DIR; } - -%} - -%option yylineno -%option noyywrap -%option prefix="magic_frontend_" -%option nounput -%option noinput -%option bison-bridge bison-locations - -%% - -"S" HEADING(0); -"SW" HEADING(1); -"W" HEADING(2); -"NW" HEADING(3); -"N" HEADING(4); -"NE" HEADING(5); -"E" HEADING(6); -"SE" HEADING(7); -"=" {FIXLOC; return '=';} -"==" {FIXLOC; return EQ;} -"<>" {FIXLOC; return NEQ;} -"!=" {FIXLOC; return NEQ;} -">" {FIXLOC; return '>';} -"<" {FIXLOC; return '<';} -">=" {FIXLOC; return GTE;} -"<=" {FIXLOC; return LTE;} -"(" {FIXLOC; return '(';} -")" {FIXLOC; return ')';} -"+" {FIXLOC; return '+';} -"-" {FIXLOC; return '-';} -"*" {FIXLOC; return '*';} -"/" {FIXLOC; return '/';} -"%" {FIXLOC; return '%';} -"&&" {FIXLOC; return ANDAND;} -"||" {FIXLOC; return OROR;} -";" {FIXLOC; return ';';} -":" {FIXLOC; return ':';} -"," {FIXLOC; return ',';} -"@" {FIXLOC; return '@';} -"|" {FIXLOC; return '|';} -"[" {FIXLOC; return '[';} -"]" {FIXLOC; return ']';} -"&" {FIXLOC; return '&';} -"^" {FIXLOC; return '^';} -"." {FIXLOC; return '.';} -"<<" {FIXLOC; return SHL;} -">>" {FIXLOC; return SHR;} -"PROCEDURE" {FIXLOC; return PROCEDURE;} -"CALL" {FIXLOC; return CALL;} -"OR" {FIXLOC; return OR;} -"TO" {FIXLOC; return TO;} -"TOWARDS" {FIXLOC; return TOWARDS;} -"TELEPORT-ANCHOR" {FIXLOC; return TELEPORT_ANCHOR;} -"SILENT" {FIXLOC; return SILENT;} -"LOCAL" {FIXLOC; return LOCAL;} -"NONMAGIC" {FIXLOC; return NONMAGIC;} -"SPELL" {FIXLOC; return SPELL;} -"LET" {FIXLOC; return LET;} -"IN" {FIXLOC; return IN;} -"END" {FIXLOC; return END;} -"=>" {FIXLOC; return DARROW;} -"STRING" {FIXLOC; return STRING_TY;} -"REQUIRE" {FIXLOC; return REQUIRE;} -"CATALYSTS" {FIXLOC; return CATALYSTS;} -"COMPONENTS" {FIXLOC; return COMPONENTS;} -"MANA" {FIXLOC; return MANA;} -"CASTTIME" {FIXLOC; return CASTTIME;} -"SKIP" {FIXLOC; return SKIP;} -"ABORT" {FIXLOC; return ABORT;} -"BREAK" {FIXLOC; return BREAK;} -"EFFECT" {FIXLOC; return EFFECT;} -"ATEND" {FIXLOC; return ATEND;} -"ATTRIGGER" {FIXLOC; return ATTRIGGER;} -"CONST" {FIXLOC; return CONST;} -"PC" {FIXLOC; return PC_F;} -"NPC" {FIXLOC; return NPC_F;} -"MOB" {FIXLOC; return MOB_F;} -"ENTITY" {FIXLOC; return ENTITY_F;} -"TARGET" {FIXLOC; return TARGET_F;} -"IF" {FIXLOC; return IF;} -"THEN" {FIXLOC; return THEN;} -"ELSE" {FIXLOC; return ELSE;} -"FOREACH" {FIXLOC; return FOREACH;} -"FOR" {FIXLOC; return FOR;} -"DO" {FIXLOC; return DO;} -"WAIT" {FIXLOC; return SLEEP;} - -\{([^\}]|\\.)*\} { char *string = strdup(yytext); - magic_frontend_lval.s = string; - FIXLOC; - return SCRIPT_DATA; - } - -\"([^\"]|\\.)*\" { char *string = strdup(yytext + 1); - char *src = string; - char *dst = string; - while (*src && *src != '"') - if (*src == '\\') { - *dst++ = src[1]; - src += 2; - } else - *dst++ = *src++; - *dst = '\0'; /* terminate */ - magic_frontend_lval.s = string; - FIXLOC; - return STRING; - } - -"-"?[0-9]+ { magic_frontend_lval.i = atoi(yytext); - FIXLOC; - return INT; } - -"0x"[0-9a-fA-F]+ { magic_frontend_lval.i = strtol(yytext + 2, NULL, 16); - FIXLOC; - return INT; } - -[a-zA-Z][-_a-zA-Z0-9?!]* { magic_frontend_lval.s = strdup(yytext); - FIXLOC; - return ID; } - -"#".*$ /* Ignore comments */ -"//".*$ /* Ignore comments */ -[ \n\t\r] /* ignore whitespace */ -. fprintf(stderr, "%s: Unexpected character in line %d\n", MAGIC_CONFIG_FILE, magic_frontend_lineno); - - -%% diff --git a/src/map/map.c b/src/map/map.c index 57183d1..e1adcef 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -9,11 +9,11 @@ #include #endif -#include "core.h" -#include "timer.h" -#include "db.h" -#include "grfio.h" -#include "malloc.h" +#include "../common/core.h" +#include "../common/timer.h" +#include "../common/db.h" +#include "../common/grfio.h" +#include "../common/malloc.h" #include "map.h" #include "chrif.h" @@ -32,8 +32,8 @@ #include "script.h" #include "guild.h" #include "atcommand.h" -#include "nullpo.h" -#include "socket.h" +#include "../common/nullpo.h" +#include "../common/socket.h" #include "magic.h" #ifdef MEMWATCH diff --git a/src/map/map.h b/src/map/map.h index 53f6dfc..a558397 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -7,7 +7,7 @@ #include #include #include -#include "mmo.h" +#include "../common/mmo.h" #ifndef MAX # define MAX(x,y) (((x)>(y)) ? (x) : (y)) diff --git a/src/map/mob.c b/src/map/mob.c index 7962114..99d1cc2 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -5,11 +5,11 @@ #include #include -#include "timer.h" -#include "socket.h" -#include "db.h" -#include "nullpo.h" -#include "malloc.h" +#include "../common/timer.h" +#include "../common/socket.h" +#include "../common/db.h" +#include "../common/nullpo.h" +#include "../common/malloc.h" #include "map.h" #include "clif.h" #include "intif.h" diff --git a/src/map/npc.c b/src/map/npc.c index 0335e9c..5fd8291 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -6,13 +6,13 @@ #include #include -#include "malloc.h" -#include "nullpo.h" -#include "timer.h" +#include "../common/malloc.h" +#include "../common/nullpo.h" +#include "../common/timer.h" #include "battle.h" #include "clif.h" -#include "db.h" +#include "../common/db.h" #include "intif.h" #include "itemdb.h" #include "map.h" diff --git a/src/map/party.c b/src/map/party.c index f87d390..4e59fae 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -4,11 +4,11 @@ #include #include "party.h" -#include "db.h" -#include "timer.h" -#include "socket.h" -#include "nullpo.h" -#include "malloc.h" +#include "../common/db.h" +#include "../common/timer.h" +#include "../common/socket.h" +#include "../common/nullpo.h" +#include "../common/malloc.h" #include "pc.h" #include "map.h" #include "battle.h" diff --git a/src/map/path.c b/src/map/path.c index 93ce960..7a864ed 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -5,7 +5,7 @@ #include "map.h" #include "battle.h" -#include "nullpo.h" +#include "../common/nullpo.h" #ifdef MEMWATCH #include "memwatch.h" diff --git a/src/map/pc.c b/src/map/pc.c index fb98bcb..fc2732f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5,12 +5,12 @@ #include #include -#include "socket.h" // [Valaris] -#include "timer.h" -#include "db.h" +#include "../common/socket.h" // [Valaris] +#include "../common/timer.h" +#include "../common/db.h" -#include "malloc.h" -#include "nullpo.h" +#include "../common/malloc.h" +#include "../common/nullpo.h" #include "atcommand.h" #include "battle.h" diff --git a/src/map/script.c b/src/map/script.c index 27567c3..0c01ac0 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -15,21 +15,21 @@ #include #include -#include "socket.h" -#include "timer.h" -#include "malloc.h" -#include "lock.h" +#include "../common/socket.h" +#include "../common/timer.h" +#include "../common/malloc.h" +#include "../common/lock.h" #include "atcommand.h" #include "battle.h" #include "chat.h" #include "chrif.h" #include "clif.h" -#include "db.h" +#include "../common/db.h" #include "guild.h" #include "intif.h" #include "itemdb.h" -#include "lock.h" +#include "../common/lock.h" #include "map.h" #include "mob.h" #include "npc.h" diff --git a/src/map/skill-pools.c b/src/map/skill-pools.c index d533ae3..50dafcb 100644 --- a/src/map/skill-pools.c +++ b/src/map/skill-pools.c @@ -3,9 +3,9 @@ #include #include -#include "timer.h" -#include "nullpo.h" -#include "malloc.h" +#include "../common/timer.h" +#include "../common/nullpo.h" +#include "../common/malloc.h" #include "magic.h" #include "battle.h" diff --git a/src/map/skill.c b/src/map/skill.c index 8a2b6b5..54ff545 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -6,9 +6,9 @@ #include #include -#include "timer.h" -#include "nullpo.h" -#include "malloc.h" +#include "../common/timer.h" +#include "../common/nullpo.h" +#include "../common/malloc.h" #include "magic.h" #include "battle.h" diff --git a/src/map/tmw.c b/src/map/tmw.c index a71c93c..c04c9c8 100644 --- a/src/map/tmw.c +++ b/src/map/tmw.c @@ -6,11 +6,11 @@ #include "tmw.h" -#include "socket.h" -#include "timer.h" -#include "malloc.h" -#include "version.h" -#include "nullpo.h" +#include "../common/socket.h" +#include "../common/timer.h" +#include "../common/malloc.h" +#include "../common/version.h" +#include "../common/nullpo.h" #include "atcommand.h" #include "battle.h" diff --git a/src/map/trade.c b/src/map/trade.c index 664d2fa..ae70f0d 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -9,7 +9,7 @@ #include "npc.h" #include "battle.h" #include "storage.h" -#include "nullpo.h" +#include "../common/nullpo.h" /*========================================== * 取引要請を相手に送る diff --git a/src/tool/Makefile b/src/tool/Makefile index 5d37183..87393fb 100644 --- a/src/tool/Makefile +++ b/src/tool/Makefile @@ -1,16 +1,17 @@ include ../../make.defs -BDIR=.. -COBJS=${BDIR}/common/timer.o ${BDIR}/common/malloc.o ${BDIR}/common/socket.o ${BDIR}/common/lock.o ${BDIR}/common/db.o ${BDIR}/char/int_storage.o ${BDIR}/char/inter.o ${BDIR}/char/int_party.o ${BDIR}/char/int_guild.o -MOBJS=${BDIR}/common/socket.o ${BDIR}/common/timer.o ${BDIR}/common/db.o ${BDIR}/common/lock.o ${BDIR}/common/malloc.o ${BDIR}/char/int_guild.o ${BDIR}/char/int_party.o ${BDIR}/char/int_storage.o ${BDIR}/char/inter.o +COBJS=../common/timer.o ../common/malloc.o ../common/socket.o ../common/lock.o ../common/db.o ../char/int_storage.o ../char/inter.o ../char/int_party.o ../char/int_guild.o +MOBJS=../common/socket.o ../common/timer.o ../common/db.o ../common/lock.o ../common/malloc.o ../char/int_guild.o ../char/int_party.o ../char/int_storage.o ../char/inter.o +all: adduser itemfrob mapfrob marriage-info eathena-monitor +adduser: adduser.o ../common/socket.o -all: ${COBJS} ${MOBJS} - $(CC) $(CFLAGS) -o adduser adduser.c $(BDIR)/common/socket.o - $(CC) $(CFLAGS) -I ${BDIR}/char -I ${BDIR}/common itemfrob.c -o itemfrob ${COBJS} - $(CC) $(CFLAGS) -I ${BDIR}/char -I ${BDIR}/common mapfrob.c -o mapfrob ${COBJS} - $(CC) $(CFLAGS) -I ${BDIR}/char -I ${BDIR}/common -I ${BDIR}/map -I ${BDIR}/login marriage-info.c -o marriage-info ${MOBJS} - $(CC) $(CFLAGS) -o ${BDIR}/../eathena-monitor eathena-monitor.c +itemfrob: itemfrob.o ${COBJS} +mapfrob: mapfrob.o ${COBJS} +marriage-info: marriage-info.o ${MOBJS} +eathena-monitor: eathena-monitor.c + $(CC) $(CFLAGS) -o eathena-monitor eathena-monitor.c clean: - rm -f adduser itemfrob mapfrob marriage-info ${BDIR}/../eathena-monitor + rm -f adduser itemfrob mapfrob marriage-info eathena-monitor rm -f *.exe + rm -f *.o diff --git a/src/tool/adduser.c b/src/tool/adduser.c index 6ebbdf1..1954b66 100644 --- a/src/tool/adduser.c +++ b/src/tool/adduser.c @@ -41,7 +41,7 @@ int main (int argc, char *argv[]) // Check to see if account.txt exists. printf ("Checking if '%s' file exists...\n", account_txt); - FILE *FPaccin = fopen_ (account_txt, "r"); + FILE *FPaccin = fopen (account_txt, "r"); if (FPaccin == NULL) { printf ("'%s' file not found!\n", account_txt); @@ -72,7 +72,7 @@ int main (int argc, char *argv[]) } } } - close (FPaccin); + fclose (FPaccin); printf ("File exists.\n"); printf ("Don't create an account if the login-server is online!!!\n"); @@ -105,11 +105,11 @@ int main (int argc, char *argv[]) scanf ("%s", &sex); } - FILE *FPaccout = fopen_ (account_txt, "r+"); + FILE *FPaccout = fopen (account_txt, "r+"); fseek (FPaccout, 0, SEEK_END); fprintf (FPaccout, "%i %s %s - %s -\r\n", next_id, username, password, sex); - close (FPaccout); + fclose (FPaccout); printf ("Account added.\n"); } diff --git a/src/tool/marriage-info.c b/src/tool/marriage-info.c index cd13843..9b91955 100644 --- a/src/tool/marriage-info.c +++ b/src/tool/marriage-info.c @@ -7,9 +7,9 @@ src/char/int_party.o src/char/int_storage.o src/char/inter.o #include #include -#include "login.h" -#include "mmo.h" -#include "char.c" +#include "../login/login.h" +#include "../common/mmo.h" +#include "../char/char.c" int mode; #define MODE_MARRIED 0 diff --git a/src/webserver/Makefile b/src/webserver/Makefile index 417fa7c..5bfa83f 100644 --- a/src/webserver/Makefile +++ b/src/webserver/Makefile @@ -1,20 +1,9 @@ include ../../make.defs -all: - #Generate framework... - $(CC) $(CFLAGS) -c parse.c - $(CC) $(CFLAGS) -c generate.c - $(CC) $(CFLAGS) -c htmlstyle.c - $(CC) $(CFLAGS) -c logs.c - - #Generate "pages"... - cd pages && $(CC) $(CFLAGS) -c about.c && cd .. - cd pages && $(CC) $(CFLAGS) -c sample.c && cd .. - cd pages && $(CC) $(CFLAGS) -c notdone.c && cd .. - - #Building the server... - $(CC) $(CFLAGS) -o webserver main.c parse.o generate.o htmlstyle.o \ - logs.o pages/about.o pages/sample.o pages/notdone.o +OBJ = main.o parse.o generate.o htmlstyle.o logs.o pages/about.o pages/sample.o pages/notdone.o +all: webserver +webserver: ${OBJ} + ${CC} ${CFLAGS} -o $@ ${OBJ} -- cgit v1.2.3-70-g09d2