From: Matthias Clasen Date: Sat, 1 Dec 2007 01:53:00 +0000 (+0000) Subject: Templates for enum registration X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=ff0acf0af644fe7edc3050a2fb0d508566da553f;p=dana%2Fcg-glib.git Templates for enum registration 2007-11-30 Matthias Clasen * gioenumtypes.[hc].template: Templates for enum registration * Makefile.am: Generate gioenumtypes.[hc] * gio.h: Include gioenumtypes.h * gappinfo.h: * gfile.h: Add some explicit nicks. * gio.symbols: Add new symbols * pltcheck.sh: Adjust svn path=/trunk/; revision=6002 --- diff --git a/gio/ChangeLog b/gio/ChangeLog index eab92992..ede30d0d 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,17 @@ +2007-11-30 Matthias Clasen + + * gioenumtypes.[hc].template: Templates for enum registration + + * Makefile.am: Generate gioenumtypes.[hc] + + * gio.h: Include gioenumtypes.h + * gappinfo.h: + * gfile.h: Add some explicit nicks. + + * gio.symbols: Add new symbols + + * pltcheck.sh: Adjust + 2007-11-30 Matthias Clasen * *.c: Explain etags and link to the explanation diff --git a/gio/Makefile.am b/gio/Makefile.am index a1cfe171..2e92df5e 100644 --- a/gio/Makefile.am +++ b/gio/Makefile.am @@ -165,6 +165,8 @@ libgio_2_0_la_SOURCES = \ gvolume.c \ gvolumemonitor.c \ gvolumeprivate.h \ + gioenumtypes.h \ + gioenumtypes.c \ $(appinfo_sources) \ $(unix_sources) \ $(local_sources) \ @@ -189,8 +191,7 @@ endif libgio_2_0_la_LDFLAGS= -export-dynamic $(no_undefined) -export-symbols-regex '^g_.*' -gioincludedir=$(includedir)/glib-2.0/gio/ -gioinclude_HEADERS = \ +gio_headers = \ gappinfo.h \ gasyncresult.h \ gbufferedinputstream.h \ @@ -231,15 +232,35 @@ gioinclude_HEADERS = \ gvolumemonitor.h \ $(NULL) +gioincludedir=$(includedir)/glib-2.0/gio/ +gioinclude_HEADERS = \ + $(gio_headers) \ + gioenumtypes.h # these sources (also mentioned above) are generated. -BUILT_SOURCES = gio-marshal.h gio-marshal.c gioalias.h gioaliasdef.c +BUILT_SOURCES = \ + gio-marshal.h \ + gio-marshal.c \ + gioalias.h \ + gioaliasdef.c \ + gioenumtypes.h \ + gioenumtypes.c \ + $(NULL) EXTRA_DIST = \ gio-marshal.list \ gio.symbols \ + gioenumtypes.h.template \ + gioenumtypes.c.template \ $(NULL) CLEANFILES = \ $(marshal_sources) \ $(NULL) + +gioenumtypes.h: $(gio_headers) + ( cd $(srcdir) && $(top_builddir)/gobject/glib-mkenums --template gioenumtypes.h.template $(gio_headers) ) > gioenumtypes.h + +gioenumtypes.c: $(gio_headers) + ( cd $(srcdir) && $(top_builddir)/gobject/glib-mkenums --template gioenumtypes.c.template $(gio_headers) ) > gioenumtypes.c + diff --git a/gio/gappinfo.h b/gio/gappinfo.h index 4e42685f..758a378f 100644 --- a/gio/gappinfo.h +++ b/gio/gappinfo.h @@ -48,8 +48,8 @@ G_BEGIN_DECLS * Flags used when creating a #GAppInfo. */ typedef enum { - G_APP_INFO_CREATE_FLAGS_NONE = 0, - G_APP_INFO_CREATE_NEEDS_TERMINAL = (1<<0) + G_APP_INFO_CREATE_FLAGS_NONE = 0, /*< nick=none >*/ + G_APP_INFO_CREATE_NEEDS_TERMINAL = (1<<0) /*< nick=needs-terminal >*/ } GAppInfoCreateFlags; typedef struct _GAppLaunchContext GAppLaunchContext; diff --git a/gio/gfile.h b/gio/gfile.h index 035f9530..d5ebcf47 100644 --- a/gio/gfile.h +++ b/gio/gfile.h @@ -44,7 +44,7 @@ G_BEGIN_DECLS * Flags used when querying a #GFileInfo. */ typedef enum { - G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS = (1<<0) + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS = (1<<0) /*< nick=nofollow-symlinks >*/ } GFileQueryInfoFlags; /** @@ -71,7 +71,7 @@ typedef enum { * Flags used when copying or moving files. */ typedef enum { - G_FILE_COPY_FLAGS_NONE = 0, + G_FILE_COPY_FLAGS_NONE = 0, /*< nick=none >*/ G_FILE_COPY_OVERWRITE = (1<<0), G_FILE_COPY_BACKUP = (1<<1), G_FILE_COPY_NOFOLLOW_SYMLINKS = (1<<2), diff --git a/gio/gio.h b/gio/gio.h index 30ff70a8..5f4e7060 100644 --- a/gio/gio.h +++ b/gio/gio.h @@ -47,5 +47,6 @@ #include #include #include +#include #endif /* __G_IO_H__ */ diff --git a/gio/gio.symbols b/gio/gio.symbols index 0bc2966a..d51eaf45 100644 --- a/gio/gio.symbols +++ b/gio/gio.symbols @@ -714,3 +714,24 @@ g_local_file_monitor_get_type G_GNUC_CONST g_local_directory_monitor_get_type G_GNUC_CONST #endif #endif + +#if IN_HEADER(__GIO_ENUM_TYPES_H__) +#if IN_FILE(__GIO_ENUM_TYPES_C__) +g_app_info_create_flags_get_type G_GNUC_CONST +g_data_stream_byte_order_get_type G_GNUC_CONST +g_data_stream_newline_type_get_type G_GNUC_CONST +g_file_attribute_flags_get_type G_GNUC_CONST +g_file_attribute_status_get_type G_GNUC_CONST +g_file_attribute_type_get_type G_GNUC_CONST +g_file_copy_flags_get_type G_GNUC_CONST +g_file_create_flags_get_type G_GNUC_CONST +g_file_monitor_event_get_type G_GNUC_CONST +g_file_monitor_flags_get_type G_GNUC_CONST +g_file_query_info_flags_get_type G_GNUC_CONST +g_file_type_get_type G_GNUC_CONST +g_io_error_enum_get_type G_GNUC_CONST +g_output_stream_splice_flags_get_type G_GNUC_CONST +g_password_flags_get_type G_GNUC_CONST +g_password_save_get_type G_GNUC_CONST +#endif +#endif diff --git a/gio/gioenumtypes.c.template b/gio/gioenumtypes.c.template new file mode 100644 index 00000000..106922df --- /dev/null +++ b/gio/gioenumtypes.c.template @@ -0,0 +1,38 @@ +/*** BEGIN file-header ***/ +#include +#include "gioalias.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 ***/ +#define __GIO_ENUM_TYPES_C__ +#include "gioaliasdef.c" +/*** END file-tail ***/ diff --git a/gio/gioenumtypes.h.template b/gio/gioenumtypes.h.template new file mode 100644 index 00000000..74600566 --- /dev/null +++ b/gio/gioenumtypes.h.template @@ -0,0 +1,24 @@ +/*** BEGIN file-header ***/ +#ifndef __GIO_ENUM_TYPES_H__ +#define __GIO_ENUM_TYPES_H__ + +#include + +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 G_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) +/*** END value-header ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __GIO_ENUM_TYPES_H__ */ +/*** END file-tail ***/ diff --git a/gio/pltcheck.sh b/gio/pltcheck.sh index 68585274..9ac48ef5 100755 --- a/gio/pltcheck.sh +++ b/gio/pltcheck.sh @@ -9,7 +9,7 @@ if ! which readelf 2>/dev/null >/dev/null; then exit 0 fi -SKIP='\