Commit d50c2bcb authored by Colomban Wendling's avatar Colomban Wendling

Add enumeration type generator (based on the one of GTK+).

parent 22b6c62a
......@@ -19,6 +19,7 @@ AC_SUBST(ovccincludedir)
# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
AC_CHECK_PROGS([GLIB_MKENUMS], [glib-mkenums], [NONE])
# check for gtk-doc
GTK_DOC_CHECK(1.11)
......
......@@ -20,6 +20,9 @@ ovcc_tileset_remove
ovcc_tileset_has_tile
ovcc_tileset_is_empty
ovcc_tileset_size
<SUBSECTION Standard>
ovcc_tile_set_error_get_type
OVCC_TYPE_TILE_SET_ERROR
</SECTION>
<SECTION>
......@@ -74,6 +77,9 @@ ovcc_tilesdef_get_tile
ovcc_tilesdef_has_tile
ovcc_tilesdef_is_empty
ovcc_tilesdef_size
<SUBSECTION Standard>
ovcc_tiles_def_error_get_type
OVCC_TYPE_TILES_DEF_ERROR
</SECTION>
<SECTION>
......@@ -137,5 +143,16 @@ ovcc_tile_side_unref
ovcc_tile_side_get_type
ovcc_tile_side_get_relations
ovcc_tile_side_get_attributes
<SUBSECTION Standard>
ovcc_tile_content_type_get_type
ovcc_tile_dump_line_get_type
ovcc_tile_side_attribute_get_type
ovcc_tile_side_position_get_type
ovcc_tile_side_relation_get_type
OVCC_TYPE_TILE_CONTENT_TYPE
OVCC_TYPE_TILE_DUMP_LINE
OVCC_TYPE_TILE_SIDE_ATTRIBUTE
OVCC_TYPE_TILE_SIDE_POSITION
OVCC_TYPE_TILE_SIDE_RELATION
</SECTION>
......@@ -2,7 +2,8 @@ lib_LTLIBRARIES = libovcc.la
noinst_PROGRAMS = test
libovcc_la_CPPFLAGS = -DG_LOG_DOMAIN=\"libovcc\"
libovcc_la_SOURCES = board.c \
libovcc_la_SOURCES = enumtypes.c \
board.c \
pawn.c \
player.c \
stack.c \
......@@ -20,3 +21,15 @@ ovccinclude_HEADERS = ovcc.h \
test_LDADD = libovcc.la -lpthread
test_SOURCES = test.c
enumtypes.h: $(ovccinclude_HEADERS) enumtypes.h.template
$(AM_V_GEN) \
( cd $(srcdir) && $(GLIB_MKENUMS) --template $@.template \
$(ovccinclude_HEADERS) | \
# hack to fix glib-mkenums output \
sed 's/o_vcc_/ovcc_/g' | sed 's/O_TYPE_VCC_/OVCC_TYPE_/g' ) > $@
enumtypes.c: $(ovccinclude_HEADERS) enumtypes.c.template enumtypes.h
$(AM_V_GEN) \
( cd $(srcdir) && $(GLIB_MKENUMS) --template $@.template \
$(ovccinclude_HEADERS) | sed 's/o_vcc_/ovcc_/g' ) > $@
/*** BEGIN file-header ***/
#include "enumtypes.h"
#include <glib-object.h>
#include "board.h"
#include "tile.h"
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type (void)
{
static GType etype = 0;
if (G_UNLIKELY (etype == 0)) {
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
etype = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
}
return etype;
}
/*** END value-tail ***/
/*** BEGIN file-tail ***/
/*** END file-tail ***/
/*** BEGIN file-header ***/
#ifndef H_OVCC_TYPES
#define H_OVCC_TYPES
#include <glib-object.h>
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType @enum_name@_get_type (void) G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* guard */
/*** END file-tail ***/
......@@ -62,7 +62,7 @@ typedef enum
* Flags saying whether a side content is linked over the tile to other side(s).
* A relation of course says that its members are of the same type.
*/
typedef enum
typedef enum /*< flags >*/
{
OVCC_TILE_SIDE_REL_NONE = 0,
OVCC_TILE_SIDE_REL_LEFT = 1 << 0,
......@@ -100,7 +100,7 @@ typedef enum
* Attributes mask. This is used to represent special caracterizations present
* in the different extensions and in the original version.
*/
typedef enum
typedef enum /*< flags >*/
{
OVCC_TILE_SIDE_ATTR_NONE = 0,
OVCC_TILE_SIDE_ATTR_BONUS = 1<<0
......@@ -118,7 +118,7 @@ typedef enum
* Mask saying which line(s) to write from the dump of a tile.
*
*/
typedef enum
typedef enum /*< flags >*/
{
OVCC_TILE_DUMP_TOP = 1<<0,
OVCC_TILE_DUMP_MIDDLE_TOP = 1<<1,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment