diff --git a/configure.ac b/configure.ac index c30c4f6..7fb3d84 100644 --- a/configure.ac +++ b/configure.ac @@ -51,4 +51,6 @@ if test "$libcurl_protocol_SMTP" != "yes"; then exit 1 fi +AM_PATH_GLIB_2_0 + AC_OUTPUT(Makefile wmud/Makefile docs/reference/wmud/Makefile create-world.sh drop-world.sh) diff --git a/wmud/Makefile.am b/wmud/Makefile.am index 068d9b6..7824b97 100644 --- a/wmud/Makefile.am +++ b/wmud/Makefile.am @@ -1,5 +1,48 @@ bin_PROGRAMS = wmud AM_CPPFLAGS = -DWMUD_STATEDIR=\""$(localstatedir)"\" -DWMUD_CONFDIR=\""$(sysconfdir)"\" $(MEMCACHED_CFLAGS) $(GLIB_CFLAGS) $(GIO_CFLAGS) $(GTHREAD_CFLAGS) $(SQLITE3_CFLAGS) $(CURL_CFLAGS) -wmud_SOURCES = main.c game-networking.c interpreter.c db.c players.c maintenance.c game.c configuration.c world.c menu.c texts.c wmudclient.c wmudplayer.c wmudclientstate.c +wmud_SOURCES = \ + main.c \ + main.h \ + game-networking.c \ + game-networking.h \ + interpreter.c \ + interpreter.h \ + db.c \ + db.h \ + players.c \ + players.h \ + maintenance.c \ + maintenance.h \ + game.c \ + game.h \ + configuration.c \ + configuration.h \ + world.c \ + world.h \ + menu.c \ + menu.h \ + texts.c \ + texts.h \ + wmudclient.c \ + wmudclient.h \ + wmudplayer.c \ + wmudplayer.h \ + wmudclientstate.h \ + enumtypes.h \ + enumtypes.c + wmud_LDADD = $(MEMCACHED_LIBS) $(GLIB_LIBS) $(GIO_LIBS) $(GTHREAD_LIBS) $(SQLITE3_LIBS) $(CURL_LIBS) + +enum_headers = wmudclientstate.h + +enumtypes.h: $(enum_headers) enumtypes.h.template + $(AM_V_GEN) ( top_builddir=`cd $(top_builddir) && pwd`; \ + cd $(srcdir) && $(GLIB_MKENUMS) --template enumtypes.h.template $(enum_headers) ) > \ + enumtypes.h.tmp && mv enumtypes.h.tmp enumtypes.h + +enumtypes.c: $(enum_headers) enumtypes.h enumtypes.c.template + $(AM_V_GEN) ( top_builddir=`cd $(top_builddir) && pwd`; \ + cd $(srcdir) && $(GLIB_MKENUMS) --template enumtypes.c.template $(enum_headers) ) > \ + enumtypes.c.tmp && mv enumtypes.c.tmp enumtypes.c + diff --git a/wmud/enumtypes.c b/wmud/enumtypes.c new file mode 100644 index 0000000..54cdad4 --- /dev/null +++ b/wmud/enumtypes.c @@ -0,0 +1,35 @@ + +/* Generated data (by glib-mkenums) */ + +#include "enumtypes.h" +#include "wmudclientstate.h" + +/* enumerations from "wmudclientstate.h" */ +GType +wmud_client_state_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter(&g_define_type_id__volatile)) { + static const GEnumValue values[] = { + { WMUD_CLIENT_STATE_FRESH, "WMUD_CLIENT_STATE_FRESH", "fresh" }, + { WMUD_CLIENT_STATE_PASSWAIT, "WMUD_CLIENT_STATE_PASSWAIT", "passwait" }, + { WMUD_CLIENT_STATE_MENU, "WMUD_CLIENT_STATE_MENU", "menu" }, + { WMUD_CLIENT_STATE_INGAME, "WMUD_CLIENT_STATE_INGAME", "ingame" }, + { WMUD_CLIENT_STATE_YESNO, "WMUD_CLIENT_STATE_YESNO", "yesno" }, + { WMUD_CLIENT_STATE_REGISTERING, "WMUD_CLIENT_STATE_REGISTERING", "registering" }, + { WMUD_CLIENT_STATE_REGEMAIL_CONFIRM, "WMUD_CLIENT_STATE_REGEMAIL_CONFIRM", "regemail-confirm" }, + { 0, NULL, NULL } + }; + + GType g_define_type_id = g_enum_register_static(g_intern_static_string("WmudClientState"), values); + + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} + + +/* Generated data ends here */ + diff --git a/wmud/enumtypes.c.template b/wmud/enumtypes.c.template new file mode 100644 index 0000000..bd443fd --- /dev/null +++ b/wmud/enumtypes.c.template @@ -0,0 +1,38 @@ +/*** BEGIN file-header ***/ +#include "enumtypes.h" +#include "@filename@" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter(&g_define_type_id__volatile)) { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + + GType g_define_type_id = g_@type@_register_static(g_intern_static_string("@EnumName@"), values); + + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} + +/*** END value-tail ***/ + diff --git a/wmud/enumtypes.h b/wmud/enumtypes.h new file mode 100644 index 0000000..089855a --- /dev/null +++ b/wmud/enumtypes.h @@ -0,0 +1,17 @@ + +/* Generated data (by glib-mkenums) */ + +#ifndef __WMUD_ENUM_TYPES_H__ +#define __WMUD_ENUM_TYPES_H__ + +#include + + +/* enumerations from "wmudclientstate.h" */ +GType wmud_client_state_get_type(void); +#define WMUD_TYPE_CLIENT_STATE (wmud_client_state_get_type()) + +#endif /* __WMUD_ENUM_TYPES_H__ */ + +/* Generated data ends here */ + diff --git a/wmud/enumtypes.h.template b/wmud/enumtypes.h.template new file mode 100644 index 0000000..23420ed --- /dev/null +++ b/wmud/enumtypes.h.template @@ -0,0 +1,22 @@ +/*** BEGIN file-header ***/ +#ifndef __WMUD_ENUM_TYPES_H__ +#define __WMUD_ENUM_TYPES_H__ + +#include + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type(void); +#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) +/*** END value-header ***/ + +/*** BEGIN file-tail ***/ + +#endif /* __WMUD_ENUM_TYPES_H__ */ +/*** END file-tail ***/ diff --git a/wmud/wmudclient.c b/wmud/wmudclient.c index 8601f6e..e372e18 100644 --- a/wmud/wmudclient.c +++ b/wmud/wmudclient.c @@ -19,6 +19,7 @@ #include "wmudclient.h" #include "wmudclientstate.h" +#include "enumtypes.h" #include "players.h" /** diff --git a/wmud/wmudclientstate.c b/wmud/wmudclientstate.c deleted file mode 100644 index 595dc07..0000000 --- a/wmud/wmudclientstate.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "wmudclientstate.h" - -GType -wmud_client_state_get_type (void) -{ - static volatile gsize g_define_type_id__volatile = 0; - - if (g_once_init_enter(&g_define_type_id__volatile)) { - static const GEnumValue values[] = { - { WMUD_CLIENT_STATE_FRESH, "WMUD_CLIENT_STATE_FRESH", "fresh" }, - { WMUD_CLIENT_STATE_PASSWAIT, "WMUD_CLIENT_STATE_PASSWAIT", "passwait" }, - { WMUD_CLIENT_STATE_MENU, "WMUD_CLIENT_STATE_MENU", "menu" }, - { WMUD_CLIENT_STATE_INGAME, "WMUD_CLIENT_STATE_INGAME", "ingame" }, - { WMUD_CLIENT_STATE_YESNO, "WMUD_CLIENT_STATE_YESNO", "yesno" }, - { WMUD_CLIENT_STATE_REGISTERING, "WMUD_CLIENT_STATE_REGISTERING", "registering" }, - { WMUD_CLIENT_STATE_REGEMAIL_CONFIRM, "WMUD_CLIENT_STATE_REGEMAIL_CONFIRM", "regemail-confirm" }, - { 0, NULL, NULL } - }; - GType g_define_type_id = g_enum_register_static(g_intern_static_string("WmudClientState"), values); - g_once_init_leave(&g_define_type_id__volatile, g_define_type_id); - } - - return g_define_type_id__volatile; -} - diff --git a/wmud/wmudclientstate.h b/wmud/wmudclientstate.h index 1d3a804..0d73066 100644 --- a/wmud/wmudclientstate.h +++ b/wmud/wmudclientstate.h @@ -36,9 +36,5 @@ typedef enum { WMUD_CLIENT_STATE_REGEMAIL_CONFIRM } WmudClientState; - -GType wmud_client_state_get_type (void) G_GNUC_CONST; -#define WMUD_TYPE_CLIENT_STATE (wmud_client_state_get_type()) - #endif /* __WMUD_CLIENT_STATE_H__ */