From 20b3829c0a9f3dfbf70c007bce2cbdb96558b37a Mon Sep 17 00:00:00 2001 From: Maarten Bosmans Date: Fri, 5 Jun 2009 21:09:40 +0200 Subject: [PATCH] Fix gapi2xml.pl to accept nested namespaces The perl script should accept nested namespaces, like N1.N2, for outputting xml. Making a Global class for static methods didn't work for functions like n1_n2_function. Another change is that N1 is stripped from the cname for the element name. Partially fixes bug #584744. --- gstreamer-sharp/Gstreamer.metadata | 45 ------------------- gstreamer-sharp/gstreamer-api.raw | 88 +++++++++++++++++++------------------- parser/gapi2xml.pl | 27 +++++++----- 3 files changed, 60 insertions(+), 100 deletions(-) diff --git a/gstreamer-sharp/Gstreamer.metadata b/gstreamer-sharp/Gstreamer.metadata index b510533..42ab744 100644 --- a/gstreamer-sharp/Gstreamer.metadata +++ b/gstreamer-sharp/Gstreamer.metadata @@ -979,16 +979,13 @@ 1 - BaseSrcFlags Gst.ElementFlags.Last << 0 Gst.ElementFlags.Last << 2 Last - TypeFindHelperGetRangeFunction out true - Adapter 1 1 1 @@ -996,24 +993,20 @@ Take true - BaseSink true true out out out - BaseSrc true true out - BaseTransform true true out - PushSrc true out @@ -1055,13 +1048,10 @@ - InterpolateMode - LFOWaveform 1 1 1 - Controller 1 1 true @@ -1080,7 +1070,6 @@ 1 1 - ControlSource @@ -1098,35 +1087,23 @@ ref - InterpolationControlSource ref 1 1 - LFOControlSource 1 1 - CddaBaseSrcMode - - CddaBaseSrc true true protected true - CddaBaseSrcTrack 4 - ColorBalanceType - MixerFlags - MixerMessageType - MixerTrackFlags - MixerType - NavigationCommand @@ -1138,41 +1115,25 @@ - NavigationEventType - NavigationMessageType - NavigationQueryType - TunerChannelFlags - ColorBalance GstColorBalanceChannel GstColorBalanceChannel EmitValueChanged - ColorBalanceChannel - Mixer 1 GstMixerTrack GstMixerTrack - MixerType - - MixerFlags - - MixerMessageType - - MixerTrack 1 - MixerOptions 1 1 gchar* gchar* /api/namespace/interface[@cname='GstMixer'] - Navigation true 1 1 @@ -1196,9 +1157,6 @@ 1 - PropertyProbe - - Tuner @@ -1212,14 +1170,11 @@ EmitFrequencyChanged EmitSignalChanged - TunerChannel /api/namespace/interface[@cname='GstTuner'] - TunerNorm 1 /api/namespace/interface[@cname='GstTuner'] - VideoOrientation out out out diff --git a/gstreamer-sharp/gstreamer-api.raw b/gstreamer-sharp/gstreamer-api.raw index 984fe05..a33dc2c 100644 --- a/gstreamer-sharp/gstreamer-api.raw +++ b/gstreamer-sharp/gstreamer-api.raw @@ -6175,11 +6175,11 @@ - + - + @@ -6188,7 +6188,7 @@ - + @@ -6253,7 +6253,7 @@ - + @@ -6486,7 +6486,7 @@ - + @@ -6676,7 +6676,7 @@ - + @@ -6855,7 +6855,7 @@ - + @@ -6874,7 +6874,7 @@ - + @@ -6882,21 +6882,21 @@ - + - + - + @@ -6904,7 +6904,7 @@ - + @@ -6912,7 +6912,7 @@ - + @@ -7067,7 +7067,7 @@ - + @@ -7101,7 +7101,7 @@ - + @@ -7148,7 +7148,7 @@ - + @@ -7166,11 +7166,11 @@ - + - + @@ -7178,11 +7178,11 @@ - + - + @@ -7251,7 +7251,7 @@ - + @@ -7262,17 +7262,17 @@ - + - + - + @@ -7281,7 +7281,7 @@ - + @@ -7292,11 +7292,11 @@ - + - + @@ -7313,7 +7313,7 @@ - + @@ -7322,24 +7322,24 @@ - + - + - + - + @@ -7400,7 +7400,7 @@ - + @@ -7623,7 +7623,7 @@ - + @@ -7805,7 +7805,7 @@ - + @@ -7907,7 +7907,7 @@ - + @@ -8071,7 +8071,7 @@ - + @@ -8184,7 +8184,7 @@ - + @@ -8236,7 +8236,7 @@ - + @@ -8255,7 +8255,7 @@ - + @@ -8288,7 +8288,7 @@ - + @@ -8330,7 +8330,7 @@ - + @@ -8367,7 +8367,7 @@ - + @@ -8386,4 +8386,4 @@ - + \ No newline at end of file diff --git a/parser/gapi2xml.pl b/parser/gapi2xml.pl index b5d4cc0..303af1f 100755 --- a/parser/gapi2xml.pl +++ b/parser/gapi2xml.pl @@ -32,6 +32,9 @@ if (!$ARGV[2]) { } $ns = $ARGV[0]; +$ns_main = $ns; +$ns_main =~ s/\..*//g; + $libname = $ARGV[2]; # Used by name mangling sub @@ -231,7 +234,7 @@ foreach $cname (sort(keys(%edefs))) { $def = $edefs{$cname}; $cname = $etypes{$cname} if (exists($etypes{$cname})); $enums{lc($cname)} = $cname; - $enum_elem = addNameElem($ns_elem, 'enum', $cname, $ns); + $enum_elem = addNameElem($ns_elem, 'enum', $cname, $ns_main); if ($def =~ /^deprecated/) { $enum_elem->setAttribute("deprecated", "1"); $def =~ s/deprecated//g; @@ -296,7 +299,7 @@ foreach $cbname (sort(keys(%fpdefs))) { next if ($cbname =~ /^_/); $cbcnt++; $fdef = $cb = $fpdefs{$cbname}; - $cb_elem = addNameElem($ns_elem, 'callback', $cbname, $ns); + $cb_elem = addNameElem($ns_elem, 'callback', $cbname, $ns_main); $cb =~ /typedef\s+(.*)\(.*\).*\((.*)\);/; $ret = $1; $params = $2; addReturnElem($cb_elem, $ret); @@ -318,7 +321,7 @@ foreach $type (sort(keys(%ifaces))) { delete $types{$inst}; $ifacecnt++; - $iface_el = addNameElem($ns_elem, 'interface', $inst, $ns); + $iface_el = addNameElem($ns_elem, 'interface', $inst, $ns_main); $elem_table{lc($inst)} = $iface_el; @@ -355,7 +358,7 @@ foreach $type (sort(keys(%objects))) { warn "Strange Class $inst\n" if (!$instdef && $debug); $classcnt++; - $obj_el = addNameElem($ns_elem, 'object', $inst, $ns); + $obj_el = addNameElem($ns_elem, 'object', $inst, $ns_main); $elem_table{lc($inst)} = $obj_el; @@ -424,7 +427,7 @@ foreach $key (sort (keys (%types))) { } elsif ($types{$type} =~ /struct/ && $type =~ /^$ns/) { $def = $types{$type}; } else { - $elem = addNameElem($ns_elem, 'alias', $key, $ns); + $elem = addNameElem($ns_elem, 'alias', $key, $ns_main); $elem->setAttribute('type', $lasttype); warn "alias $key to $lasttype\n" if $debug; next; @@ -432,11 +435,11 @@ foreach $key (sort (keys (%types))) { # fixme: hack if ($key eq "GdkBitmap") { - $struct_el = addNameElem($ns_elem, 'object', $key, $ns); + $struct_el = addNameElem($ns_elem, 'object', $key, $ns_main); } elsif (exists($boxdefs{$key})) { - $struct_el = addNameElem($ns_elem, 'boxed', $key, $ns); + $struct_el = addNameElem($ns_elem, 'boxed', $key, $ns_main); } else { - $struct_el = addNameElem($ns_elem, 'struct', $key, $ns); + $struct_el = addNameElem($ns_elem, 'struct', $key, $ns_main); } if ($def =~ /^deprecated/) { @@ -459,7 +462,7 @@ foreach $key (sort (keys (%types))) { foreach $key (sort (keys (%ptrs))) { next if $ptrs{$key} !~ /struct\s+(\w+)/; $type = $1; - $struct_el = addNameElem ($ns_elem, 'struct', $key, $ns); + $struct_el = addNameElem ($ns_elem, 'struct', $key, $ns_main); $struct_el->setAttribute('opaque', 'true'); $elem_table{lc($key)} = $struct_el; } @@ -761,6 +764,8 @@ sub addStaticFuncElems $ns_prefix = ""; $global_el = ""; + $ns_clean = lc($ns); + $ns_clean =~ s/\.//g; for ($i = 0; $i < $mcount; $i++) { $mname = $mnames[$i]; @@ -770,7 +775,7 @@ sub addStaticFuncElems if ($ns_prefix eq "") { my (@toks) = split(/_/, $prefix); for ($j = 0; $j < @toks; $j++) { - if (join ("", @toks[0 .. $j]) eq lc($ns)) { + if (join ("", @toks[0 .. $j]) eq $ns_clean) { $ns_prefix = join ("_", @toks[0 .. $j]); last; } @@ -885,7 +890,7 @@ sub addParamsElem if ($parm =~ /(.*)\(\s*\**\s*(\w+)\)\s+\((.*)\)/) { my $ret = $1; my $cbn = $2; my $params = $3; my $type = $parent->getAttribute('name') . StudlyCaps($cbn); - $cb_elem = addNameElem($ns_elem, 'callback', $type, $ns); + $cb_elem = addNameElem($ns_elem, 'callback', $type, $ns_main); addReturnElem($cb_elem, $ret); if ($params && ($params ne "void")) { addParamsElem($cb_elem, split(/,/, $params)); -- 2.7.4