diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | tests/tools/expected-gtypes-gtk-doc.h | 144 | ||||
-rw-r--r-- | tests/tools/expected-gtypes.h | 133 | ||||
-rw-r--r-- | tests/tools/test-glib-gtypes-generator.sh | 1 | ||||
-rw-r--r-- | tools/glib-gtypes-generator.py | 97 |
5 files changed, 200 insertions, 180 deletions
@@ -74,7 +74,8 @@ tags tests/dbus/dbus-1/session.conf tests/dbus/test-* tests/test-* -tests/tools/actual.h -tests/tools/actual-body.h +/tests/tools/actual.h +/tests/tools/actual-body.h +/tests/tools/actual-gtk-doc.h tools/telepathy-glib-env /valgrind.log diff --git a/tests/tools/expected-gtypes-gtk-doc.h b/tests/tools/expected-gtypes-gtk-doc.h new file mode 100644 index 00000000..95b60293 --- /dev/null +++ b/tests/tools/expected-gtypes-gtk-doc.h @@ -0,0 +1,144 @@ +/* Auto-generated, do not edit. + * + * This file may be distributed under the same terms + * as the specification from which it was generated. + */ + +/** + * THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP: + * + * (Undocumented) + * + * This macro expands to a call to a function + * that returns the #GType of a #GHashTable + * appropriate for representing a D-Bus + * dictionary of signature + * <literal>a{sv}</literal>. + * + * Keys (D-Bus type <literal>s</literal>, + * named <literal>Key</literal>): + * (Undocumented) + * + * Values (D-Bus type <literal>v</literal>, + * named <literal>Value</literal>): + * (Undocumented) + * + */ +/** + * THE_PREFIX_ARRAY_TYPE_STRING_VARIANT_MAP_LIST: + + * Expands to a call to a function + * that returns the #GType of a #GPtrArray + * of #THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP. + */ + +/** + * THE_PREFIX_HASH_TYPE_STRING_STRING_MAP: + * + * (Undocumented) + * + * This macro expands to a call to a function + * that returns the #GType of a #GHashTable + * appropriate for representing a D-Bus + * dictionary of signature + * <literal>a{ss}</literal>. + * + * Keys (D-Bus type <literal>s</literal>, + * named <literal>Key</literal>): + * (Undocumented) + * + * Values (D-Bus type <literal>s</literal>, + * named <literal>Value</literal>): + * (Undocumented) + * + */ +/** + * THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP_MAP: + * + * (Undocumented) + * + * This macro expands to a call to a function + * that returns the #GType of a #GHashTable + * appropriate for representing a D-Bus + * dictionary of signature + * <literal>a{sa{sv}}</literal>. + * + * Keys (D-Bus type <literal>s</literal>, + * named <literal>Key</literal>): + * (Undocumented) + * + * Values (D-Bus type <literal>a{sv}</literal>, + * type <literal>String_Variant_Map</literal>, + * named <literal>Value</literal>): + * (Undocumented) + * + */ +/** + * THE_PREFIX_ARRAY_TYPE_STRING_VARIANT_MAP_MAP_LIST: + + * Expands to a call to a function + * that returns the #GType of a #GPtrArray + * of #THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP_MAP. + */ + +/** + * THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP_LIST_MAP: + * + * (Undocumented) + * + * This macro expands to a call to a function + * that returns the #GType of a #GHashTable + * appropriate for representing a D-Bus + * dictionary of signature + * <literal>a{saa{sv}}</literal>. + * + * Keys (D-Bus type <literal>s</literal>, + * named <literal>Key</literal>): + * (Undocumented) + * + * Values (D-Bus type <literal>aa{sv}</literal>, + * type <literal>String_Variant_Map[]</literal>, + * named <literal>Value</literal>): + * (Undocumented) + * + */ +/** + * THE_PREFIX_ARRAY_TYPE_STRING_VARIANT_MAP_LIST_MAP_LIST: + + * Expands to a call to a function + * that returns the #GType of a #GPtrArray + * of #THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP_LIST_MAP. + */ + +/** + * THE_PREFIX_STRUCT_TYPE_STRUCT: + + * (Undocumented) + * + * This macro expands to a call to a function + * that returns the #GType of a #GValueArray + * appropriate for representing a D-Bus struct + * with signature <literal>(isu)</literal>. + * + * Member 0 (D-Bus type <literal>i</literal>, + * named <literal>Int</literal>): + * (Undocumented) + * + * Member 1 (D-Bus type <literal>s</literal>, + * named <literal>String</literal>): + * (Undocumented) + * + * Member 2 (D-Bus type <literal>u</literal>, + * named <literal>UInt</literal>): + * (Undocumented) + * + */ + +/** + * THE_PREFIX_ARRAY_TYPE_STRUCT_LIST: + + * Expands to a call to a function + * that returns the #GType of a #GPtrArray + * of #THE_PREFIX_STRUCT_TYPE_STRUCT. + */ + diff --git a/tests/tools/expected-gtypes.h b/tests/tools/expected-gtypes.h index d4993921..2fc94e26 100644 --- a/tests/tools/expected-gtypes.h +++ b/tests/tools/expected-gtypes.h @@ -4,121 +4,18 @@ * as the specification from which it was generated. */ -/** - * THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP: - * - * (Undocumented) - * - * This macro expands to a call to a function - * that returns the #GType of a #GHashTable - * appropriate for representing a D-Bus - * dictionary of signature - * <literal>a{sv}</literal>. - * - * Keys (D-Bus type <literal>s</literal>, - * named <literal>Key</literal>): - * (Undocumented) - * - * Values (D-Bus type <literal>v</literal>, - * named <literal>Value</literal>): - * (Undocumented) - * - */ #define THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP (the_prefix_type_dbus_hash_sv ()) -/** - * THE_PREFIX_ARRAY_TYPE_STRING_VARIANT_MAP_LIST: - - * Expands to a call to a function - * that returns the #GType of a #GPtrArray - * of #THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP. - */ #define THE_PREFIX_ARRAY_TYPE_STRING_VARIANT_MAP_LIST (the_prefix_type_dbus_array_of_a_7bsv_7d ()) -/** - * THE_PREFIX_HASH_TYPE_STRING_STRING_MAP: - * - * (Undocumented) - * - * This macro expands to a call to a function - * that returns the #GType of a #GHashTable - * appropriate for representing a D-Bus - * dictionary of signature - * <literal>a{ss}</literal>. - * - * Keys (D-Bus type <literal>s</literal>, - * named <literal>Key</literal>): - * (Undocumented) - * - * Values (D-Bus type <literal>s</literal>, - * named <literal>Value</literal>): - * (Undocumented) - * - */ #define THE_PREFIX_HASH_TYPE_STRING_STRING_MAP (the_prefix_type_dbus_hash_ss ()) -/** - * THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP_MAP: - * - * (Undocumented) - * - * This macro expands to a call to a function - * that returns the #GType of a #GHashTable - * appropriate for representing a D-Bus - * dictionary of signature - * <literal>a{sa{sv}}</literal>. - * - * Keys (D-Bus type <literal>s</literal>, - * named <literal>Key</literal>): - * (Undocumented) - * - * Values (D-Bus type <literal>a{sv}</literal>, - * type <literal>String_Variant_Map</literal>, - * named <literal>Value</literal>): - * (Undocumented) - * - */ #define THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP_MAP (the_prefix_type_dbus_hash_sa_7bsv_7d ()) -/** - * THE_PREFIX_ARRAY_TYPE_STRING_VARIANT_MAP_MAP_LIST: - - * Expands to a call to a function - * that returns the #GType of a #GPtrArray - * of #THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP_MAP. - */ #define THE_PREFIX_ARRAY_TYPE_STRING_VARIANT_MAP_MAP_LIST (the_prefix_type_dbus_array_of_a_7bsa_7bsv_7d_7d ()) -/** - * THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP_LIST_MAP: - * - * (Undocumented) - * - * This macro expands to a call to a function - * that returns the #GType of a #GHashTable - * appropriate for representing a D-Bus - * dictionary of signature - * <literal>a{saa{sv}}</literal>. - * - * Keys (D-Bus type <literal>s</literal>, - * named <literal>Key</literal>): - * (Undocumented) - * - * Values (D-Bus type <literal>aa{sv}</literal>, - * type <literal>String_Variant_Map[]</literal>, - * named <literal>Value</literal>): - * (Undocumented) - * - */ #define THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP_LIST_MAP (the_prefix_type_dbus_hash_saa_7bsv_7d ()) -/** - * THE_PREFIX_ARRAY_TYPE_STRING_VARIANT_MAP_LIST_MAP_LIST: - - * Expands to a call to a function - * that returns the #GType of a #GPtrArray - * of #THE_PREFIX_HASH_TYPE_STRING_VARIANT_MAP_LIST_MAP. - */ #define THE_PREFIX_ARRAY_TYPE_STRING_VARIANT_MAP_LIST_MAP_LIST (the_prefix_type_dbus_array_of_a_7bsaa_7bsv_7d_7d ()) GType the_prefix_type_dbus_hash_ss (void); @@ -129,38 +26,8 @@ GType the_prefix_type_dbus_hash_sv (void); GType the_prefix_type_dbus_hash_saa_7bsv_7d (void); -/** - * THE_PREFIX_STRUCT_TYPE_STRUCT: - - * (Undocumented) - * - * This macro expands to a call to a function - * that returns the #GType of a #GValueArray - * appropriate for representing a D-Bus struct - * with signature <literal>(isu)</literal>. - * - * Member 0 (D-Bus type <literal>i</literal>, - * named <literal>Int</literal>): - * (Undocumented) - * - * Member 1 (D-Bus type <literal>s</literal>, - * named <literal>String</literal>): - * (Undocumented) - * - * Member 2 (D-Bus type <literal>u</literal>, - * named <literal>UInt</literal>): - * (Undocumented) - * - */ #define THE_PREFIX_STRUCT_TYPE_STRUCT (the_prefix_type_dbus_struct_isu ()) -/** - * THE_PREFIX_ARRAY_TYPE_STRUCT_LIST: - - * Expands to a call to a function - * that returns the #GType of a #GPtrArray - * of #THE_PREFIX_STRUCT_TYPE_STRUCT. - */ #define THE_PREFIX_ARRAY_TYPE_STRUCT_LIST (the_prefix_type_dbus_array_isu ()) GType the_prefix_type_dbus_struct_isu (void); diff --git a/tests/tools/test-glib-gtypes-generator.sh b/tests/tools/test-glib-gtypes-generator.sh index 95f302d4..0230cd1a 100644 --- a/tests/tools/test-glib-gtypes-generator.sh +++ b/tests/tools/test-glib-gtypes-generator.sh @@ -9,6 +9,7 @@ ${PYTHON} ${top_srcdir}/tools/glib-gtypes-generator.py \ e=0 # We assume POSIX diff, until someone complains diff -b -c ${srcdir}/expected-gtypes.h actual.h || e=$? +diff -b -c ${srcdir}/expected-gtypes-gtk-doc.h actual-gtk-doc.h || e=$? diff -b -c ${srcdir}/expected-gtypes-body.h actual-body.h || e=$? exit $e diff --git a/tools/glib-gtypes-generator.py b/tools/glib-gtypes-generator.py index ebc2ad4c..a49c36e7 100644 --- a/tools/glib-gtypes-generator.py +++ b/tools/glib-gtypes-generator.py @@ -44,8 +44,9 @@ class GTypesGenerator(object): self.header = open(output + '.h', 'w') self.body = open(output + '-body.h', 'w') + self.docs = open(output + '-gtk-doc.h', 'w') - for f in (self.header, self.body): + for f in (self.header, self.body, self.docs): f.write('/* Auto-generated, do not edit.\n *\n' ' * This file may be distributed under the same terms\n' ' * as the specification from which it was generated.\n' @@ -70,6 +71,9 @@ class GTypesGenerator(object): def c(self, code): self.body.write(code.encode("utf-8")) + def d(self, code): + self.docs.write(code.encode('utf-8')) + def do_mapping_header(self, mapping): members = mapping.getElementsByTagNameNS(NS_TP, 'member') assert len(members) == 2 @@ -85,41 +89,41 @@ class GTypesGenerator(object): docstring = get_docstring(mapping) or '(Undocumented)' - self.h('/**\n * %s:\n *\n' % name) - self.h(' * %s\n' % xml_escape(docstring)) - self.h(' *\n') - self.h(' * This macro expands to a call to a function\n') - self.h(' * that returns the #GType of a #GHashTable\n') - self.h(' * appropriate for representing a D-Bus\n') - self.h(' * dictionary of signature\n') - self.h(' * <literal>a{%s}</literal>.\n' % impl_sig) - self.h(' *\n') + self.d('/**\n * %s:\n *\n' % name) + self.d(' * %s\n' % xml_escape(docstring)) + self.d(' *\n') + self.d(' * This macro expands to a call to a function\n') + self.d(' * that returns the #GType of a #GHashTable\n') + self.d(' * appropriate for representing a D-Bus\n') + self.d(' * dictionary of signature\n') + self.d(' * <literal>a{%s}</literal>.\n' % impl_sig) + self.d(' *\n') key, value = members - self.h(' * Keys (D-Bus type <literal>%s</literal>,\n' + self.d(' * Keys (D-Bus type <literal>%s</literal>,\n' % key.getAttribute('type')) tp_type = key.getAttributeNS(NS_TP, 'type') if tp_type: - self.h(' * type <literal>%s</literal>,\n' % tp_type) - self.h(' * named <literal>%s</literal>):\n' + self.d(' * type <literal>%s</literal>,\n' % tp_type) + self.d(' * named <literal>%s</literal>):\n' % key.getAttribute('name')) docstring = get_docstring(key) or '(Undocumented)' - self.h(' * %s\n' % xml_escape(docstring)) - self.h(' *\n') + self.d(' * %s\n' % xml_escape(docstring)) + self.d(' *\n') - self.h(' * Values (D-Bus type <literal>%s</literal>,\n' + self.d(' * Values (D-Bus type <literal>%s</literal>,\n' % value.getAttribute('type')) tp_type = value.getAttributeNS(NS_TP, 'type') if tp_type: - self.h(' * type <literal>%s</literal>,\n' % tp_type) - self.h(' * named <literal>%s</literal>):\n' + self.d(' * type <literal>%s</literal>,\n' % tp_type) + self.d(' * named <literal>%s</literal>):\n' % value.getAttribute('name')) docstring = get_docstring(value) or '(Undocumented)' - self.h(' * %s\n' % xml_escape(docstring)) - self.h(' *\n') + self.d(' * %s\n' % xml_escape(docstring)) + self.d(' *\n') - self.h(' */\n') + self.d(' */\n') self.h('#define %s (%s ())\n\n' % (name, impl)) self.need_mappings[impl_sig] = esc_impl_sig @@ -130,11 +134,12 @@ class GTypesGenerator(object): contents_sig = 'a{' + impl_sig + '}' esc_contents_sig = escape_as_identifier(contents_sig) impl = self.prefix_ + 'type_dbus_array_of_' + esc_contents_sig - self.h('/**\n * %s:\n\n' % gtype_name) - self.h(' * Expands to a call to a function\n') - self.h(' * that returns the #GType of a #GPtrArray\n') - self.h(' * of #%s.\n' % name) - self.h(' */\n') + self.d('/**\n * %s:\n\n' % gtype_name) + self.d(' * Expands to a call to a function\n') + self.d(' * that returns the #GType of a #GPtrArray\n') + self.d(' * of #%s.\n' % name) + self.d(' */\n\n') + self.h('#define %s (%s ())\n\n' % (gtype_name, impl)) self.need_other_arrays[contents_sig] = esc_contents_sig @@ -157,41 +162,43 @@ class GTypesGenerator(object): docstring = '(Undocumented)' else: docstring = '(Undocumented)' - self.h('/**\n * %s:\n\n' % name) - self.h(' * %s\n' % xml_escape(docstring)) - self.h(' *\n') - self.h(' * This macro expands to a call to a function\n') - self.h(' * that returns the #GType of a #GValueArray\n') - self.h(' * appropriate for representing a D-Bus struct\n') - self.h(' * with signature <literal>(%s)</literal>.\n' + self.d('/**\n * %s:\n\n' % name) + self.d(' * %s\n' % xml_escape(docstring)) + self.d(' *\n') + self.d(' * This macro expands to a call to a function\n') + self.d(' * that returns the #GType of a #GValueArray\n') + self.d(' * appropriate for representing a D-Bus struct\n') + self.d(' * with signature <literal>(%s)</literal>.\n' % impl_sig) - self.h(' *\n') + self.d(' *\n') for i, member in enumerate(members): - self.h(' * Member %d (D-Bus type ' + self.d(' * Member %d (D-Bus type ' '<literal>%s</literal>,\n' % (i, member.getAttribute('type'))) tp_type = member.getAttributeNS(NS_TP, 'type') if tp_type: - self.h(' * type <literal>%s</literal>,\n' % tp_type) - self.h(' * named <literal>%s</literal>):\n' + self.d(' * type <literal>%s</literal>,\n' % tp_type) + self.d(' * named <literal>%s</literal>):\n' % member.getAttribute('name')) docstring = get_docstring(member) or '(Undocumented)' - self.h(' * %s\n' % xml_escape(docstring)) - self.h(' *\n') + self.d(' * %s\n' % xml_escape(docstring)) + self.d(' *\n') + + self.d(' */\n\n') - self.h(' */\n') self.h('#define %s (%s ())\n\n' % (name, impl)) array_name = struct.getAttribute('array-name') if array_name != '': array_name = (self.PREFIX_ + 'ARRAY_TYPE_' + array_name.upper()) impl = self.prefix_ + 'type_dbus_array_' + esc_impl_sig - self.h('/**\n * %s:\n\n' % array_name) - self.h(' * Expands to a call to a function\n') - self.h(' * that returns the #GType of a #GPtrArray\n') - self.h(' * of #%s.\n' % name) - self.h(' */\n') + self.d('/**\n * %s:\n\n' % array_name) + self.d(' * Expands to a call to a function\n') + self.d(' * that returns the #GType of a #GPtrArray\n') + self.d(' * of #%s.\n' % name) + self.d(' */\n\n') + self.h('#define %s (%s ())\n\n' % (array_name, impl)) self.need_struct_arrays[impl_sig] = esc_impl_sig |