2003-02-26 Mike Kestner <mkestner@ximian.com>

* scan-deprecations.cs : little xpath tool to inspect deprecates.

svn path=/trunk/gtk-sharp/; revision=23499
This commit is contained in:
Mike Kestner 2004-02-26 19:32:04 +00:00
parent 3b14029b6e
commit 0c3d27b0c1
2 changed files with 75 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2003-02-26 Mike Kestner <mkestner@ximian.com>
* scan-deprecations.cs : little xpath tool to inspect deprecates.
2003-02-26 Mike Kestner <mkestner@ximian.com>
* Vte/Gnome/Gtk : add some new doc files.

71
doc/scan-deprecations.cs Normal file
View file

@ -0,0 +1,71 @@
namespace GtkSharp.Docs {
using System;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.XPath;
public class ScanDeprecations {
public static int Main (string[] args)
{
string api_filename = "";
XmlDocument api_doc = new XmlDocument ();
foreach (string arg in args) {
try {
Stream stream = File.OpenRead (arg);
api_doc.Load (stream);
stream.Close ();
} catch (XmlException e) {
Console.WriteLine (e);
return 1;
}
string ignores = "";
string kills = "";
string nonstubs = "";
ArrayList kill_elems = new ArrayList ();
XPathNavigator api_nav = api_doc.CreateNavigator ();
XPathNodeIterator iter = api_nav.Select ("/Type/Members/Member[@Deprecated='true']");
while (iter.MoveNext ()) {
XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement;
string member_type = elem["MemberType"].InnerText;
switch (member_type) {
case "Field":
string summary = elem["Docs"]["summary"].InnerText;
string remarks = elem["Docs"]["remarks"].InnerText;
if (summary == "To be added" && remarks == "To be added") {
kills += " " + elem.GetAttribute ("MemberName") + "(" + member_type + ")";
kill_elems.Add (elem);
} else
nonstubs += " " + elem.GetAttribute ("MemberName") + "(" + member_type + ")";
break;
default:
ignores += " " + elem.GetAttribute ("MemberName") + "(" + member_type + ")";
break;
}
}
foreach (XmlNode node in kill_elems)
node.ParentNode.RemoveChild (node);
api_doc.Save (arg);
if (ignores != "" || kills != "" || nonstubs != "") {
Console.WriteLine (arg + ":");
if (ignores != "")
Console.WriteLine (" Ignored:" + ignores);
if (kills != "")
Console.WriteLine (" Killed:" + kills);
if (nonstubs != "")
Console.WriteLine (" Non-stubbed deprecates:" + nonstubs);
}
}
return 0;
}
}
}