From 3b3631082d04b426f450810e8836de94e9c5d60a Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 16 May 2008 14:52:29 +0000 Subject: [PATCH] gstdoc-scangobj: Add a mechanism for adding 'implicitly created' GTypes into the scan, allowing for documenting plugi... Original commit message from CVS: * gstdoc-scangobj: Add a mechanism for adding 'implicitly created' GTypes into the scan, allowing for documenting plugin-private base classes that provide signals or properties for public elements. * gtk-doc-plugins.mak: Use $(builddir) instead of $(top_builddir) in a few places - there's no need to hard code 'docs/plugins' as the only useable path. --- ChangeLog | 11 +++++++++++ gstdoc-scangobj | 46 +++++++++++++++++++++++++++++++--------------- gtk-doc-plugins.mak | 6 +++--- 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed2f2c3..99888c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-05-16 Jan Schmidt + + * gstdoc-scangobj: + Add a mechanism for adding 'implicitly created' GTypes into the + scan, allowing for documenting plugin-private base classes that + provide signals or properties for public elements. + + * gtk-doc-plugins.mak: + Use $(builddir) instead of $(top_builddir) in a few places - there's + no need to hard code 'docs/plugins' as the only useable path. + 2008-05-14 Peter Kjellerstedt * m4/gst-feature.m4: diff --git a/gstdoc-scangobj b/gstdoc-scangobj index 90ba889..1d46dc9 100755 --- a/gstdoc-scangobj +++ b/gstdoc-scangobj @@ -81,8 +81,7 @@ if ($PRINT_HELP) { $OUTPUT_DIR = $OUTPUT_DIR ? $OUTPUT_DIR : "."; -# THOMAS: dynamic types; only use types file for headers - $TYPES_FILE = $TYPES_FILE ? $TYPES_FILE : "$OUTPUT_DIR/$MODULE.types"; +$TYPES_FILE = $TYPES_FILE ? $TYPES_FILE : "$OUTPUT_DIR/$MODULE.types"; open (TYPES, $TYPES_FILE) || die "Cannot open $TYPES_FILE: $!\n"; open (OUTPUT, ">$MODULE-scan.c") || die "Cannot open $MODULE-scan.c: $!\n"; @@ -101,22 +100,27 @@ my $new_args_filename = "$OUTPUT_DIR/$MODULE.args.new"; # write a C program to scan the types $includes = ""; -#@types = (); +@types = (); +@impl_types = (); for () { if (/^#include/) { $includes .= $_; -# } elsif (/^%/) { -# next; -# } elsif (/^\s*$/) { -# next; -# } else { -# chomp; -# push @types, $_; + } elsif (/^%/) { + next; + } elsif (/^\s*$/) { + next; + } elsif (/^type:(.*)$/) { + $t = $1; + chomp $t; + push @impl_types, $t; + } else { + chomp; + push @types, $_; } } -#$ntypes = @types + 1; +$ntypes = @types + @impl_types; print OUTPUT < @@ -125,6 +129,7 @@ print OUTPUT < $includes + #ifdef GTK_IS_WIDGET_CLASS #include #endif @@ -180,7 +185,7 @@ get_object_types (void) g_message ("number of element factories: %d", g_list_length (factories)); /* allocate the object_types array to hold them */ - object_types = g_new0 (GType, g_list_length (factories)+1); + object_types = g_new0 (GType, g_list_length (factories)+$ntypes+1); l = factories; i = 0; @@ -191,15 +196,26 @@ get_object_types (void) factory = GST_ELEMENT_FACTORY (l->data); type = gst_element_factory_get_element_type (factory); g_message ("adding type %p for factory %s", (void *) type, gst_element_factory_get_longname (factory)); - object_types[i] = type; - i++; + object_types[i++] = type; l = g_list_next (l); } - object_types[i] = 0; + EOT +# get_type functions: +for (@types) { + print OUTPUT " object_types[i++] = $_ ();\n"; +} + +# Implicit types retrieved from GLib: +for (@impl_types) { + print OUTPUT " object_types[i++] = g_type_from_name (\"$_\");\n"; +} + print OUTPUT <