summaryrefslogtreecommitdiff
path: root/build-aux/templates
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/templates')
l---------build-aux/templates/mm-daemon-enums-types.c.template1
l---------build-aux/templates/mm-daemon-enums-types.h.template1
-rw-r--r--build-aux/templates/mm-enums-types.c.template114
-rw-r--r--build-aux/templates/mm-enums-types.h.template35
-rw-r--r--build-aux/templates/mm-errors-quarks.c.template42
-rw-r--r--build-aux/templates/mm-errors-types.c.template40
-rw-r--r--build-aux/templates/mm-errors-types.h.template23
l---------build-aux/templates/mm-helper-enums-types.c.template1
l---------build-aux/templates/mm-helper-enums-types.h.template1
l---------build-aux/templates/mm-huawei-enums-types.c.template1
l---------build-aux/templates/mm-huawei-enums-types.h.template1
l---------build-aux/templates/mm-port-enums-types.c.template1
l---------build-aux/templates/mm-port-enums-types.h.template1
l---------build-aux/templates/mm-telit-enums-types.c.template1
l---------build-aux/templates/mm-telit-enums-types.h.template1
l---------build-aux/templates/mm-ublox-enums-types.c.template1
l---------build-aux/templates/mm-ublox-enums-types.h.template1
17 files changed, 266 insertions, 0 deletions
diff --git a/build-aux/templates/mm-daemon-enums-types.c.template b/build-aux/templates/mm-daemon-enums-types.c.template
new file mode 120000
index 000000000..471d2931f
--- /dev/null
+++ b/build-aux/templates/mm-daemon-enums-types.c.template
@@ -0,0 +1 @@
+mm-enums-types.c.template \ No newline at end of file
diff --git a/build-aux/templates/mm-daemon-enums-types.h.template b/build-aux/templates/mm-daemon-enums-types.h.template
new file mode 120000
index 000000000..12f144f53
--- /dev/null
+++ b/build-aux/templates/mm-daemon-enums-types.h.template
@@ -0,0 +1 @@
+mm-enums-types.h.template \ No newline at end of file
diff --git a/build-aux/templates/mm-enums-types.c.template b/build-aux/templates/mm-enums-types.c.template
new file mode 100644
index 000000000..2a7f264b1
--- /dev/null
+++ b/build-aux/templates/mm-enums-types.c.template
@@ -0,0 +1,114 @@
+/*** BEGIN file-header ***/
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+static const G@Type@Value @enum_name@_values[] = {
+/*** END value-header ***/
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+};
+
+/* Define type-specific symbols */
+#undef __MM_IS_ENUM__
+#undef __MM_IS_FLAGS__
+#define __MM_IS_@TYPE@__
+
+GType
+@enum_name@_get_type (void)
+{
+ static gsize g_define_type_id_initialized = 0;
+
+ if (g_once_init_enter (&g_define_type_id_initialized)) {
+ GType g_define_type_id =
+ g_@type@_register_static (g_intern_static_string ("@EnumName@"),
+ @enum_name@_values);
+ g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
+ }
+
+ return g_define_type_id_initialized;
+}
+
+/**
+ * @enum_name@_get_string:
+ * @val: a @EnumName@.
+ *
+ * Gets the nickname string for the #@EnumName@ specified at @val.
+ *
+ * Returns: (transfer none): a string with the nickname, or %NULL if not found. Do not free the returned value.
+ */
+#if defined __MM_IS_ENUM__
+const gchar *
+@enum_name@_get_string (@EnumName@ val)
+{
+ guint i;
+
+ for (i = 0; @enum_name@_values[i].value_nick; i++) {
+ if ((gint)val == @enum_name@_values[i].value)
+ return @enum_name@_values[i].value_nick;
+ }
+
+ return NULL;
+}
+#endif /* __MM_IS_ENUM_ */
+
+/**
+ * @enum_name@_build_string_from_mask:
+ * @mask: bitmask of @EnumName@ values.
+ *
+ * Builds a string containing a comma-separated list of nicknames for
+ * each #@EnumName@ in @mask.
+ *
+ * Returns: (transfer full): a string with the list of nicknames, or %NULL if none given. The returned value should be freed with g_free().
+ */
+#if defined __MM_IS_FLAGS__
+gchar *
+@enum_name@_build_string_from_mask (@EnumName@ mask)
+{
+ guint i;
+ gboolean first = TRUE;
+ GString *str = NULL;
+
+ for (i = 0; @enum_name@_values[i].value_nick; i++) {
+ /* We also look for exact matches */
+ if (mask == @enum_name@_values[i].value) {
+ if (str)
+ g_string_free (str, TRUE);
+ return g_strdup (@enum_name@_values[i].value_nick);
+ }
+
+ /* Build list with single-bit masks */
+ if (mask & @enum_name@_values[i].value) {
+ guint c;
+ gulong number = @enum_name@_values[i].value;
+
+ for (c = 0; number; c++)
+ number &= number - 1;
+
+ if (c == 1) {
+ if (!str)
+ str = g_string_new ("");
+ g_string_append_printf (str, "%s%s",
+ first ? "" : ", ",
+ @enum_name@_values[i].value_nick);
+ if (first)
+ first = FALSE;
+ }
+ }
+ }
+
+ return (str ? g_string_free (str, FALSE) : NULL);
+}
+#endif /* __MM_IS_FLAGS__ */
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/*** END file-tail ***/
diff --git a/build-aux/templates/mm-enums-types.h.template b/build-aux/templates/mm-enums-types.h.template
new file mode 100644
index 000000000..24d18a9dc
--- /dev/null
+++ b/build-aux/templates/mm-enums-types.h.template
@@ -0,0 +1,35 @@
+/*** BEGIN file-header ***/
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@basename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+
+/* Define type-specific symbols */
+#undef __MM_IS_ENUM__
+#undef __MM_IS_FLAGS__
+#define __MM_IS_@TYPE@__
+
+#if defined __MM_IS_ENUM__
+const gchar *@enum_name@_get_string (@EnumName@ val);
+#endif
+
+#if defined __MM_IS_FLAGS__
+gchar *@enum_name@_build_string_from_mask (@EnumName@ mask);
+#endif
+
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+/*** END file-tail ***/
diff --git a/build-aux/templates/mm-errors-quarks.c.template b/build-aux/templates/mm-errors-quarks.c.template
new file mode 100644
index 000000000..4386a6014
--- /dev/null
+++ b/build-aux/templates/mm-errors-quarks.c.template
@@ -0,0 +1,42 @@
+/*** BEGIN file-header ***/
+
+#include <gio/gio.h>
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+
+#define ERROR_PREFIX @ENUMNAME@_DBUS_PREFIX
+static const GDBusErrorEntry @enum_name@_entries[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, ERROR_PREFIX ".@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+};
+#undef ERROR_PREFIX
+
+GQuark
+@enum_name@_quark (void)
+{
+ static volatile gsize quark_volatile = 0;
+
+ if (!quark_volatile)
+ g_dbus_error_register_error_domain ("@enum_name@_quark",
+ &quark_volatile,
+ @enum_name@_entries,
+ G_N_ELEMENTS (@enum_name@_entries));
+
+ return (GQuark) quark_volatile;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/*** END file-tail ***/
diff --git a/build-aux/templates/mm-errors-types.c.template b/build-aux/templates/mm-errors-types.c.template
new file mode 100644
index 000000000..8370adf1d
--- /dev/null
+++ b/build-aux/templates/mm-errors-types.c.template
@@ -0,0 +1,40 @@
+/*** BEGIN file-header ***/
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+
+/* @enum_name@_quark() implemented in mm-errors-quarks.c */
+
+GType
+@enum_name@_get_type (void)
+{
+ static gsize g_define_type_id_initialized = 0;
+
+ if (g_once_init_enter (&g_define_type_id_initialized))
+ {
+ 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_initialized, g_define_type_id);
+ }
+
+ return g_define_type_id_initialized;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/*** END file-tail ***/
diff --git a/build-aux/templates/mm-errors-types.h.template b/build-aux/templates/mm-errors-types.h.template
new file mode 100644
index 000000000..5c80bee6d
--- /dev/null
+++ b/build-aux/templates/mm-errors-types.h.template
@@ -0,0 +1,23 @@
+/*** BEGIN file-header ***/
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@basename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GQuark @enum_name@_quark (void); /* implemented in mm-errors-quarks.c */
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define @ENUMNAME@ (@enum_name@_quark ())
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+/*** END file-tail ***/
diff --git a/build-aux/templates/mm-helper-enums-types.c.template b/build-aux/templates/mm-helper-enums-types.c.template
new file mode 120000
index 000000000..471d2931f
--- /dev/null
+++ b/build-aux/templates/mm-helper-enums-types.c.template
@@ -0,0 +1 @@
+mm-enums-types.c.template \ No newline at end of file
diff --git a/build-aux/templates/mm-helper-enums-types.h.template b/build-aux/templates/mm-helper-enums-types.h.template
new file mode 120000
index 000000000..12f144f53
--- /dev/null
+++ b/build-aux/templates/mm-helper-enums-types.h.template
@@ -0,0 +1 @@
+mm-enums-types.h.template \ No newline at end of file
diff --git a/build-aux/templates/mm-huawei-enums-types.c.template b/build-aux/templates/mm-huawei-enums-types.c.template
new file mode 120000
index 000000000..471d2931f
--- /dev/null
+++ b/build-aux/templates/mm-huawei-enums-types.c.template
@@ -0,0 +1 @@
+mm-enums-types.c.template \ No newline at end of file
diff --git a/build-aux/templates/mm-huawei-enums-types.h.template b/build-aux/templates/mm-huawei-enums-types.h.template
new file mode 120000
index 000000000..12f144f53
--- /dev/null
+++ b/build-aux/templates/mm-huawei-enums-types.h.template
@@ -0,0 +1 @@
+mm-enums-types.h.template \ No newline at end of file
diff --git a/build-aux/templates/mm-port-enums-types.c.template b/build-aux/templates/mm-port-enums-types.c.template
new file mode 120000
index 000000000..471d2931f
--- /dev/null
+++ b/build-aux/templates/mm-port-enums-types.c.template
@@ -0,0 +1 @@
+mm-enums-types.c.template \ No newline at end of file
diff --git a/build-aux/templates/mm-port-enums-types.h.template b/build-aux/templates/mm-port-enums-types.h.template
new file mode 120000
index 000000000..12f144f53
--- /dev/null
+++ b/build-aux/templates/mm-port-enums-types.h.template
@@ -0,0 +1 @@
+mm-enums-types.h.template \ No newline at end of file
diff --git a/build-aux/templates/mm-telit-enums-types.c.template b/build-aux/templates/mm-telit-enums-types.c.template
new file mode 120000
index 000000000..471d2931f
--- /dev/null
+++ b/build-aux/templates/mm-telit-enums-types.c.template
@@ -0,0 +1 @@
+mm-enums-types.c.template \ No newline at end of file
diff --git a/build-aux/templates/mm-telit-enums-types.h.template b/build-aux/templates/mm-telit-enums-types.h.template
new file mode 120000
index 000000000..12f144f53
--- /dev/null
+++ b/build-aux/templates/mm-telit-enums-types.h.template
@@ -0,0 +1 @@
+mm-enums-types.h.template \ No newline at end of file
diff --git a/build-aux/templates/mm-ublox-enums-types.c.template b/build-aux/templates/mm-ublox-enums-types.c.template
new file mode 120000
index 000000000..471d2931f
--- /dev/null
+++ b/build-aux/templates/mm-ublox-enums-types.c.template
@@ -0,0 +1 @@
+mm-enums-types.c.template \ No newline at end of file
diff --git a/build-aux/templates/mm-ublox-enums-types.h.template b/build-aux/templates/mm-ublox-enums-types.h.template
new file mode 120000
index 000000000..12f144f53
--- /dev/null
+++ b/build-aux/templates/mm-ublox-enums-types.h.template
@@ -0,0 +1 @@
+mm-enums-types.h.template \ No newline at end of file