summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2008-08-22 14:43:41 +0000
committerColin Walters <walters@src.gnome.org>2008-08-22 14:43:41 +0000
commit8672c373d12742b6380fbbdf3bf3cbce71c176fa (patch)
treeaf01c58f7346de8c8471b5f9f39b9ae959615434
parentb9dbb255cacfdcb30abe031d17e9ae0bef8d6248 (diff)
downloadgobject-introspection-8672c373d12742b6380fbbdf3bf3cbce71c176fa.tar.gz
Add g-ir-generate. Support $(DEBUG) Do immediate close tags if no
2008-08-22 Colin Walters <walters@verbum.org> * gobject-introspection-1.0.pc.in: Add g-ir-generate. * tests/Makefile.am: Support $(DEBUG) * tools/generate.c: Do immediate close tags if no sub-elements. svn path=/trunk/; revision=448
-rw-r--r--ChangeLog7
-rw-r--r--gobject-introspection-1.0.pc.in5
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/boxed.gir3
-rw-r--r--tools/generate.c43
5 files changed, 37 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 58d446d0..c9ea6c2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-22 Colin Walters <walters@verbum.org>
+
+ * gobject-introspection-1.0.pc.in: Add g-ir-generate.
+ * tests/Makefile.am: Support $(DEBUG)
+ * tools/generate.c: Do immediate close tags if no
+ sub-elements.
+
2008-08-21 Colin Walters <walters@verbum.org>
* tests/scanner/drawable-expected.gir,
diff --git a/gobject-introspection-1.0.pc.in b/gobject-introspection-1.0.pc.in
index 2f9c1875..6c7b9d34 100644
--- a/gobject-introspection-1.0.pc.in
+++ b/gobject-introspection-1.0.pc.in
@@ -6,12 +6,9 @@ includedir=@includedir@
g_ir_scanner=${bindir}/g-ir-scanner
g_ir_compiler=${bindir}/g-ir-compiler
+g_ir_generate=${bindir}/g-ir-generate
girdir=${prefix}/share/gir
-# FIXME: These needs to be ported to the GIR format first
-# g_idl_generator=${bindir}/g-idl-generator
-# g_idl_compiler=${bindir}/g-idl-compiler
-
Cflags: -I${includedir}/gobject-introspection-1.0
Requires: glib-2.0 gobject-2.0 gmodule-2.0 gthread-2.0
Libs: -L${libdir} -lgirepository
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d08b6a53..d690babd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,8 +25,8 @@ GIRTESTS = \
%.gir.test: %.gir
@echo Testing $<:
- $(top_builddir)/tools/g-ir-compiler --raw $< > $<.1; \
- $(top_builddir)/tools/g-ir-generate --raw $<.1 > $<.2; \
+ $(DEBUG) $(top_builddir)/tools/g-ir-compiler --raw $< > $<.1; \
+ $(DEBUG) $(top_builddir)/tools/g-ir-generate --raw $<.1 > $<.2; \
diff -u $< $<.2; rm $<.1 $<.2
check-local: $(GIRTESTS)
diff --git a/tests/boxed.gir b/tests/boxed.gir
index bf9278cb..0184ec60 100644
--- a/tests/boxed.gir
+++ b/tests/boxed.gir
@@ -60,7 +60,6 @@
</parameter>
</parameters>
</function>
- <glib:boxed glib:name="boxed2" glib:type-name="BoxedType2" glib:get-type="boxed2_get_type" deprecated="1">
- </glib:boxed>
+ <glib:boxed glib:name="boxed2" glib:type-name="BoxedType2" glib:get-type="boxed2_get_type" deprecated="1"/>
</namespace>
</repository>
diff --git a/tools/generate.c b/tools/generate.c
index 3e6a8f82..1f331570 100644
--- a/tools/generate.c
+++ b/tools/generate.c
@@ -422,6 +422,7 @@ write_struct_info (const gchar *namespace,
const gchar *type_init;
gboolean deprecated;
gint i;
+ int n_elts;
name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
@@ -439,26 +440,34 @@ write_struct_info (const gchar *namespace,
if (deprecated)
g_fprintf (file, " deprecated=\"1\"");
- g_fprintf (file, ">\n");
-
- for (i = 0; i < g_struct_info_get_n_fields (info); i++)
+ n_elts = g_struct_info_get_n_fields (info) + g_struct_info_get_n_methods (info);
+ if (n_elts > 0)
{
- GIFieldInfo *field = g_struct_info_get_field (info, i);
- write_field_info (namespace, field, NULL, file);
- g_base_info_unref ((GIBaseInfo *)field);
- }
-
- for (i = 0; i < g_struct_info_get_n_methods (info); i++)
+ g_fprintf (file, ">\n");
+
+ for (i = 0; i < g_struct_info_get_n_fields (info); i++)
+ {
+ GIFieldInfo *field = g_struct_info_get_field (info, i);
+ write_field_info (namespace, field, NULL, file);
+ g_base_info_unref ((GIBaseInfo *)field);
+ }
+
+ for (i = 0; i < g_struct_info_get_n_methods (info); i++)
+ {
+ GIFunctionInfo *function = g_struct_info_get_method (info, i);
+ write_function_info (namespace, function, file, 6);
+ g_base_info_unref ((GIBaseInfo *)function);
+ }
+
+ if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_BOXED)
+ g_fprintf (file, " </glib:boxed>\n");
+ else
+ g_fprintf (file, " </record>\n");
+ }
+ else
{
- GIFunctionInfo *function = g_struct_info_get_method (info, i);
- write_function_info (namespace, function, file, 6);
- g_base_info_unref ((GIBaseInfo *)function);
+ g_fprintf (file, "/>\n");
}
-
- if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_BOXED)
- g_fprintf (file, " </glib:boxed>\n");
- else
- g_fprintf (file, " </record>\n");
}
static void