diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2011-11-22 10:54:20 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:18 +0100 |
commit | 0e9ed6e5fed70c873c597b91a9b844df44f9ffc0 (patch) | |
tree | 6be98925ae1fce8ba5f93cda33f8b846602fc446 /build-aux | |
parent | ade484826ccd5c93937d18563b478b75641c4ee7 (diff) |
libmm-common: include Enums and Flags type information
The code to handle the Enums and Flags type information is automatically built
with `glib-mkenums' and the new templates kept under `build-aux'.
Note: We currently skip the type information of `MMModemBand'. GFlagsValue
can hold only 32-bit types, and we're working with a 64-bit flag here.
See: https://bugzilla.gnome.org/show_bug.cgi?id=663054
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/Makefile.am | 4 | ||||
-rw-r--r-- | build-aux/mm-enums-types.c.template | 40 | ||||
-rw-r--r-- | build-aux/mm-enums-types.h.template | 24 |
3 files changed, 67 insertions, 1 deletions
diff --git a/build-aux/Makefile.am b/build-aux/Makefile.am index 86c7f890..652e9325 100644 --- a/build-aux/Makefile.am +++ b/build-aux/Makefile.am @@ -1,4 +1,6 @@ EXTRA_DIST = \ header-generator.xsl \ - header-generator-new.xsl + header-generator-new.xsl \ + mm-enums-types.h.template \ + mm-enums-types.c.template diff --git a/build-aux/mm-enums-types.c.template b/build-aux/mm-enums-types.c.template new file mode 100644 index 00000000..680a3264 --- /dev/null +++ b/build-aux/mm-enums-types.c.template @@ -0,0 +1,40 @@ +/*** BEGIN file-header ***/ +#include "ModemManager-enums.h" +#include "mm-enums-types.h" + +/*** 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 ***/ + +/*** BEGIN file-tail ***/ +/*** END file-tail ***/ diff --git a/build-aux/mm-enums-types.h.template b/build-aux/mm-enums-types.h.template new file mode 100644 index 00000000..0f016630 --- /dev/null +++ b/build-aux/mm-enums-types.h.template @@ -0,0 +1,24 @@ +/*** BEGIN file-header ***/ +#ifndef __MM_ENUMS_TYPES_H__ +#define __MM_ENUMS_TYPES_H__ + +#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 /* __MM_ENUMS_TYPES_H__ */ +/*** END file-tail ***/ |