2009-04-25 Mike Kestner <mkestner@novell.com>

* parser/gapi-fixup.cs: add remove-attr and change-node-type
	fixup rules.  [Fixes #494194]

svn path=/trunk/gtk-sharp/; revision=132676
This commit is contained in:
Mike Kestner 2009-04-26 03:08:54 +00:00
parent a2715073d1
commit 9d5b3e97be
2 changed files with 47 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2009-04-25 Mike Kestner <mkestner@novell.com>
* parser/gapi-fixup.cs: add remove-attr and change-node-type
fixup rules. [Fixes #494194]
2009-04-25 Mike Kestner <mkestner@novell.com> 2009-04-25 Mike Kestner <mkestner@novell.com>
* generator/OpaqueGen.cs: support declaring managed ifaces. * generator/OpaqueGen.cs: support declaring managed ifaces.

View file

@ -121,6 +121,30 @@ namespace GtkSharp.Parsing {
Console.WriteLine ("Warning: <add-node path=\"{0}\"/> matched no nodes", path); Console.WriteLine ("Warning: <add-node path=\"{0}\"/> matched no nodes", path);
} }
XPathNodeIterator change_node_type_iter = meta_nav.Select ("/metadata/change-node-type");
while (change_node_type_iter.MoveNext ()) {
string path = change_node_type_iter.Current.GetAttribute ("path", "");
XPathNodeIterator api_iter = api_nav.Select (path);
bool matched = false;
while (api_iter.MoveNext ()) {
XmlElement node = ( (IHasXmlNode) api_iter.Current).GetNode () as XmlElement;
XmlElement parent = node.ParentNode as XmlElement;
XmlElement new_node = api_doc.CreateElement (change_node_type_iter.Current.Value);
foreach (XmlNode child in node.ChildNodes)
new_node.AppendChild (child.Clone ());
foreach (XmlAttribute attribute in node.Attributes)
new_node.Attributes.Append ( (XmlAttribute) attribute.Clone ());
parent.ReplaceChild (new_node, node);
matched = true;
}
if (!matched)
Console.WriteLine ("Warning: <change-node-type path=\"{0}\"/> matched no nodes", path);
}
XPathNodeIterator attr_iter = meta_nav.Select ("/metadata/attr"); XPathNodeIterator attr_iter = meta_nav.Select ("/metadata/attr");
while (attr_iter.MoveNext ()) { while (attr_iter.MoveNext ()) {
string path = attr_iter.Current.GetAttribute ("path", ""); string path = attr_iter.Current.GetAttribute ("path", "");
@ -157,6 +181,24 @@ namespace GtkSharp.Parsing {
Console.WriteLine ("Warning: <move-node path=\"{0}\"/> matched no nodes", path); Console.WriteLine ("Warning: <move-node path=\"{0}\"/> matched no nodes", path);
} }
XPathNodeIterator remove_attr_iter = meta_nav.Select ("/metadata/remove-attr");
while (remove_attr_iter.MoveNext ()) {
string path = remove_attr_iter.Current.GetAttribute ("path", "");
string name = remove_attr_iter.Current.GetAttribute ("name", "");
XPathNodeIterator api_iter = api_nav.Select (path);
bool matched = false;
while (api_iter.MoveNext ()) {
XmlElement node = ( (IHasXmlNode) api_iter.Current).GetNode () as XmlElement;
node.RemoveAttribute (name);
matched = true;
}
if (!matched)
Console.WriteLine ("Warning: <remove-attr path=\"{0}\"/> matched no nodes", path);
}
if (symbol_doc != null) { if (symbol_doc != null) {
XPathNavigator symbol_nav = symbol_doc.CreateNavigator (); XPathNavigator symbol_nav = symbol_doc.CreateNavigator ();
XPathNodeIterator iter = symbol_nav.Select ("/api/*"); XPathNodeIterator iter = symbol_nav.Select ("/api/*");