Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Mikkel Kruse Johnsen 2015-07-24 07:42:55 +02:00
commit 120b3ce9cd
19 changed files with 1104 additions and 995 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

View File

@ -1,72 +1,72 @@
// extract-missing.cs - grab missing api elements from api-diff files. // extract-missing.cs - grab missing api elements from api-diff files.
// //
// Author: Mike Kestner <mkestner@novell.com> // Author: Mike Kestner <mkestner@novell.com>
// //
// Copyright (c) 2005 Mike Kestner // Copyright (c) 2005 Mike Kestner
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public // modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation. // License as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// //
// You should have received a copy of the GNU General Public // You should have received a copy of the GNU General Public
// License along with this program; if not, write to the // License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA. // Boston, MA 02111-1307, USA.
namespace GtkSharp.Auditing { namespace GtkSharp.Auditing {
using System; using System;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
public class ExtractMissing { public class ExtractMissing {
public static int Main (string[] args) public static int Main (string[] args)
{ {
if (args.Length != 1 || !File.Exists (args [0])) { if (args.Length != 1 || !File.Exists (args [0])) {
Console.WriteLine ("Usage: extract-missing <filename>"); Console.WriteLine ("Usage: extract-missing <filename>");
return 0; return 0;
} }
XmlDocument doc = new XmlDocument (); XmlDocument doc = new XmlDocument ();
try { try {
Stream stream = File.OpenRead (args [0]); Stream stream = File.OpenRead (args [0]);
doc.Load (stream); doc.Load (stream);
stream.Close (); stream.Close ();
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine ("Invalid apidiff file."); Console.WriteLine ("Invalid apidiff file.");
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
XPathNavigator nav = doc.CreateNavigator (); XPathNavigator nav = doc.CreateNavigator ();
XPathNodeIterator iter = nav.Select ("//*[@presence='missing']"); XPathNodeIterator iter = nav.Select ("//*[@presence='missing']");
while (iter.MoveNext ()) { while (iter.MoveNext ()) {
XmlElement node = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; XmlElement node = ((IHasXmlNode)iter.Current).GetNode () as XmlElement;
if (node.Name == "class") if (node.Name == "class")
Console.WriteLine ("Missing type: " + node.GetAttribute ("name")); Console.WriteLine ("Missing type: " + node.GetAttribute ("name"));
else if (node.ParentNode.ParentNode.Name == "class") else if (node.ParentNode.ParentNode.Name == "class")
Console.WriteLine ("Missing " + node.Name + " " + (node.ParentNode.ParentNode as XmlElement).GetAttribute ("name") + "." + node.GetAttribute ("name")); Console.WriteLine ("Missing " + node.Name + " " + (node.ParentNode.ParentNode as XmlElement).GetAttribute ("name") + "." + node.GetAttribute ("name"));
else if (node.Name == "attribute") { else if (node.Name == "attribute") {
if (node.ParentNode.ParentNode.Name == "class") if (node.ParentNode.ParentNode.Name == "class")
Console.WriteLine ("Missing attribute (" + (node as XmlElement).GetAttribute ("name") + ") on type: " + (node.ParentNode.ParentNode as XmlElement).GetAttribute ("name")); Console.WriteLine ("Missing attribute (" + (node as XmlElement).GetAttribute ("name") + ") on type: " + (node.ParentNode.ParentNode as XmlElement).GetAttribute ("name"));
else if (node.ParentNode.ParentNode.ParentNode.ParentNode.Name == "class") else if (node.ParentNode.ParentNode.ParentNode.ParentNode.Name == "class")
Console.WriteLine ("Missing attribute (" + (node as XmlElement).GetAttribute ("name") + ") on " + (node.ParentNode.ParentNode.ParentNode.ParentNode as XmlElement).GetAttribute ("name") + "." + (node.ParentNode.ParentNode as XmlElement).GetAttribute ("name")); Console.WriteLine ("Missing attribute (" + (node as XmlElement).GetAttribute ("name") + ") on " + (node.ParentNode.ParentNode.ParentNode.ParentNode as XmlElement).GetAttribute ("name") + "." + (node.ParentNode.ParentNode as XmlElement).GetAttribute ("name"));
else else
Console.WriteLine ("oopsie: " + node.Name + " " + node.ParentNode.ParentNode.Name); Console.WriteLine ("oopsie: " + node.Name + " " + node.ParentNode.ParentNode.Name);
} else } else
Console.WriteLine ("oopsie: " + node.Name + " " + node.ParentNode.ParentNode.Name); Console.WriteLine ("oopsie: " + node.Name + " " + node.ParentNode.ParentNode.Name);
} }
return 0; return 0;
} }
} }
} }

View File

@ -107,7 +107,7 @@ AC_CHECK_SIZEOF(off_t)
OFF_T_FLAGS="-define:OFF_T_$ac_cv_sizeof_off_t" OFF_T_FLAGS="-define:OFF_T_$ac_cv_sizeof_off_t"
AC_SUBST(OFF_T_FLAGS) AC_SUBST(OFF_T_FLAGS)
MONO_REQUIRED_VERSION=2.8 MONO_REQUIRED_VERSION=3.2.8
PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false) PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)
AC_PATH_PROG(GACUTIL, gacutil, no) AC_PATH_PROG(GACUTIL, gacutil, no)
@ -136,7 +136,7 @@ if test "x$RUNTIME" != "no" ; then
RUNTIME="mono$RUNTIME_DEBUG_FLAGS" RUNTIME="mono$RUNTIME_DEBUG_FLAGS"
fi fi
AC_PATH_PROG(CSC, gmcs, no) AC_PATH_PROG(CSC, mcs, no)
if test `uname -s` = "Darwin"; then if test `uname -s` = "Darwin"; then
LIB_PREFIX= LIB_PREFIX=
LIB_SUFFIX=.dylib LIB_SUFFIX=.dylib

View File

@ -1,77 +1,77 @@
// add-since.cs - Adds a since element to a Type document. // add-since.cs - Adds a since element to a Type document.
// //
// Author: Mike Kestner <mkestner@novell.com> // Author: Mike Kestner <mkestner@novell.com>
// //
// Copyright (c) 2007 Novell, Inc. // Copyright (c) 2007 Novell, Inc.
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public // modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation. // License as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// //
// You should have received a copy of the GNU General Public // You should have received a copy of the GNU General Public
// License along with this program; if not, write to the // License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA. // Boston, MA 02111-1307, USA.
namespace GtkSharp.Docs { namespace GtkSharp.Docs {
using System; using System;
using System.Collections; using System.Collections;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
public class GenHandlerArgsDocs { public class GenHandlerArgsDocs {
public static int Main (string[] args) public static int Main (string[] args)
{ {
string version = null; string version = null;
ArrayList files = new ArrayList (); ArrayList files = new ArrayList ();
foreach (string arg in args) { foreach (string arg in args) {
if (arg.StartsWith ("--version=")) { if (arg.StartsWith ("--version=")) {
version = arg.Substring (10); version = arg.Substring (10);
} else { } else {
files.Add (arg); files.Add (arg);
} }
} }
if (version == null) { if (version == null) {
Console.WriteLine ("Usage: add-since --version=<version> <paths>"); Console.WriteLine ("Usage: add-since --version=<version> <paths>");
return 1; return 1;
} }
Console.WriteLine ("version: " + version); Console.WriteLine ("version: " + version);
XmlDocument api_doc = new XmlDocument (); XmlDocument api_doc = new XmlDocument ();
foreach (string file in files) { foreach (string file in files) {
Console.WriteLine ("file: " + file); Console.WriteLine ("file: " + file);
try { try {
Stream stream = File.OpenRead (file); Stream stream = File.OpenRead (file);
api_doc.Load (stream); api_doc.Load (stream);
stream.Close (); stream.Close ();
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
XPathNavigator api_nav = api_doc.CreateNavigator (); XPathNavigator api_nav = api_doc.CreateNavigator ();
XPathNodeIterator iter = api_nav.Select ("/Type/Docs"); XPathNodeIterator iter = api_nav.Select ("/Type/Docs");
if (iter.MoveNext ()) { if (iter.MoveNext ()) {
XmlElement docs = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; XmlElement docs = ((IHasXmlNode)iter.Current).GetNode () as XmlElement;
XmlElement since = api_doc.CreateElement ("since"); XmlElement since = api_doc.CreateElement ("since");
since.SetAttribute ("version", version); since.SetAttribute ("version", version);
docs.AppendChild (since); docs.AppendChild (since);
api_doc.Save (file); api_doc.Save (file);
} }
} }
return 0; return 0;
} }
} }
} }

View File

@ -1,197 +1,197 @@
// gen-handlerargs-docs.cs - Generate documentation for event handlers/args // gen-handlerargs-docs.cs - Generate documentation for event handlers/args
// //
// Author: Mike Kestner <mkestner@ximian.com> // Author: Mike Kestner <mkestner@ximian.com>
// //
// Copyright (c) 2004 Novell, Inc. // Copyright (c) 2004 Novell, Inc.
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public // modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation. // License as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// //
// You should have received a copy of the GNU General Public // You should have received a copy of the GNU General Public
// License along with this program; if not, write to the // License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA. // Boston, MA 02111-1307, USA.
namespace GtkSharp.Docs { namespace GtkSharp.Docs {
using System; using System;
using System.Collections; using System.Collections;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
public class GenHandlerArgsDocs { public class GenHandlerArgsDocs {
public static int Main (string[] args) public static int Main (string[] args)
{ {
Hashtable hndlrs = new Hashtable (); Hashtable hndlrs = new Hashtable ();
XmlDocument api_doc = new XmlDocument (); XmlDocument api_doc = new XmlDocument ();
BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly; BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly;
foreach (string arg in args) { foreach (string arg in args) {
Assembly assembly; Assembly assembly;
try { try {
assembly = Assembly.LoadFile (arg); assembly = Assembly.LoadFile (arg);
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
foreach (Type t in assembly.GetTypes ()) { foreach (Type t in assembly.GetTypes ()) {
if (!t.IsSubclassOf (typeof (GLib.Object))) if (!t.IsSubclassOf (typeof (GLib.Object)))
continue; continue;
foreach (EventInfo ei in t.GetEvents (flags)) { foreach (EventInfo ei in t.GetEvents (flags)) {
foreach (Attribute attr in ei.GetCustomAttributes (false)) { foreach (Attribute attr in ei.GetCustomAttributes (false)) {
if (attr.ToString () == "GLib.SignalAttribute") { if (attr.ToString () == "GLib.SignalAttribute") {
if (ei.EventHandlerType.ToString() == "System.EventHandler") if (ei.EventHandlerType.ToString() == "System.EventHandler")
break; break;
ArrayList sigs; ArrayList sigs;
if (hndlrs.Contains (ei.EventHandlerType)) if (hndlrs.Contains (ei.EventHandlerType))
sigs = hndlrs [ei.EventHandlerType] as ArrayList; sigs = hndlrs [ei.EventHandlerType] as ArrayList;
else { else {
sigs = new ArrayList (); sigs = new ArrayList ();
hndlrs [ei.EventHandlerType] = sigs; hndlrs [ei.EventHandlerType] = sigs;
} }
sigs.Add (t + "." + ei.Name); sigs.Add (t + "." + ei.Name);
break; break;
} }
} }
} }
} }
} }
if (hndlrs.Count == 0) if (hndlrs.Count == 0)
return 0; return 0;
foreach (Type hndlr in hndlrs.Keys) { foreach (Type hndlr in hndlrs.Keys) {
string filename = "en/" + hndlr.Namespace + "/" + hndlr.Name + ".xml"; string filename = "en/" + hndlr.Namespace + "/" + hndlr.Name + ".xml";
try { try {
Stream stream = File.OpenRead (filename); Stream stream = File.OpenRead (filename);
api_doc.Load (stream); api_doc.Load (stream);
stream.Close (); stream.Close ();
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
Type arg_type = hndlr.GetMethod ("Invoke").GetParameters ()[1].ParameterType; Type arg_type = hndlr.GetMethod ("Invoke").GetParameters ()[1].ParameterType;
XPathNavigator api_nav = api_doc.CreateNavigator (); XPathNavigator api_nav = api_doc.CreateNavigator ();
XPathNodeIterator iter = api_nav.Select ("/Type/Docs"); XPathNodeIterator iter = api_nav.Select ("/Type/Docs");
if (iter.MoveNext ()) { if (iter.MoveNext ()) {
XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement;
XmlElement summ = elem ["summary"]; XmlElement summ = elem ["summary"];
XmlElement rem = elem ["remarks"]; XmlElement rem = elem ["remarks"];
string summary = summ.InnerXml; string summary = summ.InnerXml;
string remarks = rem.InnerXml; string remarks = rem.InnerXml;
if (summary == "To be added." && remarks == "To be added.") { if (summary == "To be added." && remarks == "To be added.") {
Console.WriteLine (filename + ": Documenting summary and remarks"); Console.WriteLine (filename + ": Documenting summary and remarks");
summ.InnerXml = "Event handler."; summ.InnerXml = "Event handler.";
ArrayList sigs = hndlrs[hndlr] as ArrayList; ArrayList sigs = hndlrs[hndlr] as ArrayList;
string rems; string rems;
if (sigs.Count > 1) { if (sigs.Count > 1) {
rems = "<para>The following events utilize this delegate:</para><para><list type=\"bullet\">"; rems = "<para>The following events utilize this delegate:</para><para><list type=\"bullet\">";
foreach (string ev in sigs) foreach (string ev in sigs)
rems += "<item><term><see cref=\"M:" + ev + "\"/></term></item>"; rems += "<item><term><see cref=\"M:" + ev + "\"/></term></item>";
rems += "</list></para>"; rems += "</list></para>";
} else } else
rems = "<para>The <see cref=\"M:" + sigs[0] + "\"/> event utilizes this delegate:</para>"; rems = "<para>The <see cref=\"M:" + sigs[0] + "\"/> event utilizes this delegate:</para>";
rems += "<para>Event data is passed via the <see cref=\"T:" + arg_type + "\"/> parameter.</para><para>To attach a <see cref=\"T:" + hndlr + "\"/> to an event, add the " + hndlr.Name + " instance to the event. The methods referenced by the " + hndlr.Name + " instance are invoked whenever the event is raised, until the " + hndlr.Name + " is removed from the event.</para>"; rems += "<para>Event data is passed via the <see cref=\"T:" + arg_type + "\"/> parameter.</para><para>To attach a <see cref=\"T:" + hndlr + "\"/> to an event, add the " + hndlr.Name + " instance to the event. The methods referenced by the " + hndlr.Name + " instance are invoked whenever the event is raised, until the " + hndlr.Name + " is removed from the event.</para>";
rem.InnerXml = rems; rem.InnerXml = rems;
} }
XPathNavigator param_nav = api_doc.CreateNavigator (); XPathNavigator param_nav = api_doc.CreateNavigator ();
XPathNodeIterator param_iter = param_nav.Select ("/Type/Docs/param"); XPathNodeIterator param_iter = param_nav.Select ("/Type/Docs/param");
while (param_iter.MoveNext ()) { while (param_iter.MoveNext ()) {
XmlElement param = ((IHasXmlNode)param_iter.Current).GetNode () as XmlElement; XmlElement param = ((IHasXmlNode)param_iter.Current).GetNode () as XmlElement;
if (param.InnerXml == "To be added.") { if (param.InnerXml == "To be added.") {
string param_name = param.GetAttribute ("name"); string param_name = param.GetAttribute ("name");
switch (param_name) { switch (param_name) {
case "o": case "o":
param.InnerXml = "Event sender."; param.InnerXml = "Event sender.";
break; break;
case "args": case "args":
param.InnerXml = "Event arguments."; param.InnerXml = "Event arguments.";
break; break;
default: default:
Console.WriteLine (filename + ": Unexpected param " + param.GetAttribute ("name")); Console.WriteLine (filename + ": Unexpected param " + param.GetAttribute ("name"));
break; break;
} }
Console.WriteLine (filename + ": Documenting param " + param.GetAttribute ("name")); Console.WriteLine (filename + ": Documenting param " + param.GetAttribute ("name"));
} }
} }
} }
api_doc.Save (filename); api_doc.Save (filename);
filename = "en/" + arg_type.Namespace + "/" + arg_type.Name + ".xml"; filename = "en/" + arg_type.Namespace + "/" + arg_type.Name + ".xml";
try { try {
Stream stream = File.OpenRead (filename); Stream stream = File.OpenRead (filename);
api_doc.Load (stream); api_doc.Load (stream);
stream.Close (); stream.Close ();
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
api_nav = api_doc.CreateNavigator (); api_nav = api_doc.CreateNavigator ();
iter = api_nav.Select ("/Type/Docs"); iter = api_nav.Select ("/Type/Docs");
if (iter.MoveNext ()) { if (iter.MoveNext ()) {
XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement;
XmlElement summ = elem ["summary"]; XmlElement summ = elem ["summary"];
XmlElement rem = elem ["remarks"]; XmlElement rem = elem ["remarks"];
string summary = summ.InnerXml; string summary = summ.InnerXml;
string remarks = rem.InnerXml; string remarks = rem.InnerXml;
if (summary == "To be added." && remarks == "To be added.") { if (summary == "To be added." && remarks == "To be added.") {
Console.WriteLine (filename + ": Documenting summary and remarks"); Console.WriteLine (filename + ": Documenting summary and remarks");
summ.InnerXml = "Event data."; summ.InnerXml = "Event data.";
ArrayList sigs = hndlrs[hndlr] as ArrayList; ArrayList sigs = hndlrs[hndlr] as ArrayList;
string rems; string rems;
if (sigs.Count > 1) { if (sigs.Count > 1) {
rems = "<para>The following events invoke <see cref=\"T:" + hndlr + "\"/> delegates which pass event data via this class:</para><para><list type=\"bullet\">"; rems = "<para>The following events invoke <see cref=\"T:" + hndlr + "\"/> delegates which pass event data via this class:</para><para><list type=\"bullet\">";
foreach (string ev in sigs) foreach (string ev in sigs)
rems += "<item><term><see cref=\"M:" + ev + "\"/></term></item>"; rems += "<item><term><see cref=\"M:" + ev + "\"/></term></item>";
rems += "</list></para>"; rems += "</list></para>";
} else } else
rems = "<para>The <see cref=\"M:" + sigs[0] + "\"/> event invokes <see cref=\"T:" + hndlr + "\"/> delegates which pass event data via this class.</para>"; rems = "<para>The <see cref=\"M:" + sigs[0] + "\"/> event invokes <see cref=\"T:" + hndlr + "\"/> delegates which pass event data via this class.</para>";
rem.InnerXml = rems; rem.InnerXml = rems;
} }
} }
api_nav = api_doc.CreateNavigator (); api_nav = api_doc.CreateNavigator ();
iter = api_nav.Select ("/Type/Members/Member[@MemberName='.ctor']"); iter = api_nav.Select ("/Type/Members/Member[@MemberName='.ctor']");
if (iter.MoveNext ()) { if (iter.MoveNext ()) {
XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement;
XmlElement summ = elem ["Docs"] ["summary"]; XmlElement summ = elem ["Docs"] ["summary"];
XmlElement rem = elem ["Docs"] ["remarks"]; XmlElement rem = elem ["Docs"] ["remarks"];
XmlElement ret = elem ["Docs"] ["returns"]; XmlElement ret = elem ["Docs"] ["returns"];
string summary = summ.InnerXml; string summary = summ.InnerXml;
string remarks = rem.InnerXml; string remarks = rem.InnerXml;
if (summary == "To be added." && remarks == "To be added.") { if (summary == "To be added." && remarks == "To be added.") {
Console.WriteLine (filename + ": Documenting constructor"); Console.WriteLine (filename + ": Documenting constructor");
summ.InnerXml = "Public Constructor."; summ.InnerXml = "Public Constructor.";
if (ret != null) if (ret != null)
ret.InnerXml = "A new <see cref=\"T:" + arg_type + "\"/>."; ret.InnerXml = "A new <see cref=\"T:" + arg_type + "\"/>.";
rem.InnerXml = "Create a new <see cref=\"T:" + arg_type + "\"/> instance with this constructor if you need to invoke a <see cref=\"T:" + hndlr + "\"/> delegate."; rem.InnerXml = "Create a new <see cref=\"T:" + arg_type + "\"/> instance with this constructor if you need to invoke a <see cref=\"T:" + hndlr + "\"/> delegate.";
} }
} }
api_doc.Save (filename); api_doc.Save (filename);
} }
return 0; return 0;
} }
} }
} }

View File

@ -1,114 +1,114 @@
// gen-vm-docs.cs - Generate documentation for virtual methods. // gen-vm-docs.cs - Generate documentation for virtual methods.
// //
// Author: Mike Kestner <mkestner@ximian.com> // Author: Mike Kestner <mkestner@ximian.com>
// //
// Copyright (c) 2004 Novell, Inc. // Copyright (c) 2004 Novell, Inc.
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public // modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation. // License as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// //
// You should have received a copy of the GNU General Public // You should have received a copy of the GNU General Public
// License along with this program; if not, write to the // License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA. // Boston, MA 02111-1307, USA.
namespace GtkSharp.Docs { namespace GtkSharp.Docs {
using System; using System;
using System.Collections; using System.Collections;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
public class GenVMDocs { public class GenVMDocs {
public static int Main (string[] args) public static int Main (string[] args)
{ {
XmlDocument api_doc = new XmlDocument (); XmlDocument api_doc = new XmlDocument ();
BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly; BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly;
foreach (string arg in args) { foreach (string arg in args) {
Assembly assembly; Assembly assembly;
try { try {
assembly = Assembly.LoadFile (arg); assembly = Assembly.LoadFile (arg);
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
foreach (Type t in assembly.GetTypes ()) { foreach (Type t in assembly.GetTypes ()) {
if (!t.IsSubclassOf (typeof (GLib.Object))) if (!t.IsSubclassOf (typeof (GLib.Object)))
continue; continue;
Hashtable sigs = new Hashtable (); Hashtable sigs = new Hashtable ();
foreach (EventInfo ei in t.GetEvents (flags)) foreach (EventInfo ei in t.GetEvents (flags))
foreach (GLib.SignalAttribute attr in ei.GetCustomAttributes (typeof (GLib.SignalAttribute), false)) foreach (GLib.SignalAttribute attr in ei.GetCustomAttributes (typeof (GLib.SignalAttribute), false))
sigs [attr.CName] = ei.Name; sigs [attr.CName] = ei.Name;
if (sigs.Count == 0) continue; if (sigs.Count == 0) continue;
Hashtable vms = new Hashtable (); Hashtable vms = new Hashtable ();
foreach (MethodInfo mi in t.GetMethods (flags)) { foreach (MethodInfo mi in t.GetMethods (flags)) {
foreach (GLib.DefaultSignalHandlerAttribute attr in mi.GetCustomAttributes (typeof (GLib.DefaultSignalHandlerAttribute), false)) { foreach (GLib.DefaultSignalHandlerAttribute attr in mi.GetCustomAttributes (typeof (GLib.DefaultSignalHandlerAttribute), false)) {
string conn_name = attr.ConnectionMethod; string conn_name = attr.ConnectionMethod;
if (sigs.ContainsValue (conn_name.Substring (8))) if (sigs.ContainsValue (conn_name.Substring (8)))
vms [mi.Name] = conn_name.Substring (8); vms [mi.Name] = conn_name.Substring (8);
} }
} }
if (vms.Count == 0) continue; if (vms.Count == 0) continue;
string filename = "en/" + t.Namespace + "/" + t.Name + ".xml"; string filename = "en/" + t.Namespace + "/" + t.Name + ".xml";
try { try {
Stream stream = File.OpenRead (filename); Stream stream = File.OpenRead (filename);
api_doc.Load (stream); api_doc.Load (stream);
stream.Close (); stream.Close ();
Console.WriteLine ("opened:" + filename); Console.WriteLine ("opened:" + filename);
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
XPathNavigator api_nav = api_doc.CreateNavigator (); XPathNavigator api_nav = api_doc.CreateNavigator ();
bool dirty = false; bool dirty = false;
foreach (string vm in vms.Keys) { foreach (string vm in vms.Keys) {
XPathNodeIterator iter = api_nav.Select ("/Type/Members/Member[@MemberName='" + vm + "']"); XPathNodeIterator iter = api_nav.Select ("/Type/Members/Member[@MemberName='" + vm + "']");
if (iter.MoveNext ()) { if (iter.MoveNext ()) {
XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement;
XmlElement summ = elem ["Docs"] ["summary"]; XmlElement summ = elem ["Docs"] ["summary"];
XmlElement rem = elem ["Docs"] ["remarks"]; XmlElement rem = elem ["Docs"] ["remarks"];
string summary = summ.InnerXml; string summary = summ.InnerXml;
string remarks = rem.InnerXml; string remarks = rem.InnerXml;
if (summary == "To be added." && remarks == "To be added.") { if (summary == "To be added." && remarks == "To be added.") {
summ.InnerXml = "Default handler for the <see cref=\"M:" + t + "." + vms [vm] + "\" /> event."; summ.InnerXml = "Default handler for the <see cref=\"M:" + t + "." + vms [vm] + "\" /> event.";
rem.InnerXml = "Override this method in a subclass to provide a default handler for the <see cref=\"M:" + t + "." + vms [vm] + "\" /> event."; rem.InnerXml = "Override this method in a subclass to provide a default handler for the <see cref=\"M:" + t + "." + vms [vm] + "\" /> event.";
dirty = true; dirty = true;
} else } else
Console.WriteLine ("Member had docs:" + vm); Console.WriteLine ("Member had docs:" + vm);
} else { } else {
Console.WriteLine ("Member not found:" + vm); Console.WriteLine ("Member not found:" + vm);
} }
if (dirty) if (dirty)
api_doc.Save (filename); api_doc.Save (filename);
} }
} }
} }
return 0; return 0;
} }
} }
} }

View File

@ -1,108 +1,108 @@
// scan-deprecations.cs - scans docs for deprecated nodes, cleans up and nags. // scan-deprecations.cs - scans docs for deprecated nodes, cleans up and nags.
// //
// Author: Mike Kestner <mkestner@ximian.com> // Author: Mike Kestner <mkestner@ximian.com>
// //
// Copyright (c) 2004 Novell, Inc. // Copyright (c) 2004 Novell, Inc.
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public // modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation. // License as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// //
// You should have received a copy of the GNU General Public // You should have received a copy of the GNU General Public
// License along with this program; if not, write to the // License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA. // Boston, MA 02111-1307, USA.
namespace GtkSharp.Docs { namespace GtkSharp.Docs {
using System; using System;
using System.Collections; using System.Collections;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
public class ScanDeprecations { public class ScanDeprecations {
public static int Main (string[] args) public static int Main (string[] args)
{ {
string api_filename = ""; string api_filename = "";
XmlDocument api_doc = new XmlDocument (); XmlDocument api_doc = new XmlDocument ();
foreach (string arg in args) { foreach (string arg in args) {
try { try {
Stream stream = File.OpenRead (arg); Stream stream = File.OpenRead (arg);
api_doc.Load (stream); api_doc.Load (stream);
stream.Close (); stream.Close ();
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
string ignores = ""; string ignores = "";
string kills = ""; string kills = "";
string nonstubs = ""; string nonstubs = "";
ArrayList kill_elems = new ArrayList (); ArrayList kill_elems = new ArrayList ();
XPathNavigator api_nav = api_doc.CreateNavigator (); XPathNavigator api_nav = api_doc.CreateNavigator ();
XPathNodeIterator iter = api_nav.Select ("/Type/Members/Member[@Deprecated='true']"); XPathNodeIterator iter = api_nav.Select ("/Type/Members/Member[@Deprecated='true']");
while (iter.MoveNext ()) { while (iter.MoveNext ()) {
XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement;
string member_type = elem["MemberType"].InnerText; string member_type = elem["MemberType"].InnerText;
switch (member_type) { switch (member_type) {
case "Method": case "Method":
case "Property": case "Property":
case "Constructor": case "Constructor":
case "Field": case "Field":
string summary = elem["Docs"]["summary"].InnerText; string summary = elem["Docs"]["summary"].InnerText;
string remarks = elem["Docs"]["remarks"].InnerText; string remarks = elem["Docs"]["remarks"].InnerText;
if (summary == "To be added" && remarks == "To be added") { if (summary == "To be added" && remarks == "To be added") {
kills += " " + elem.GetAttribute ("MemberName") + "(" + member_type + ")"; kills += " " + elem.GetAttribute ("MemberName") + "(" + member_type + ")";
kill_elems.Add (elem); kill_elems.Add (elem);
} else } else
nonstubs += " " + elem.GetAttribute ("MemberName") + "(" + member_type + ")"; nonstubs += " " + elem.GetAttribute ("MemberName") + "(" + member_type + ")";
break; break;
default: default:
ignores += " " + elem.GetAttribute ("MemberName") + "(" + member_type + ")"; ignores += " " + elem.GetAttribute ("MemberName") + "(" + member_type + ")";
break; break;
} }
} }
iter = api_nav.Select ("/Type/Base/BaseTypeName"); iter = api_nav.Select ("/Type/Base/BaseTypeName");
if (iter.MoveNext ()) { if (iter.MoveNext ()) {
XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement;
if (elem.InnerText == "System.Enum") { if (elem.InnerText == "System.Enum") {
iter = api_nav.Select ("/Type/Members/Member[@MemberName='value__']"); iter = api_nav.Select ("/Type/Members/Member[@MemberName='value__']");
if (iter.MoveNext ()) { if (iter.MoveNext ()) {
elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement;
elem ["Docs"] ["summary"].InnerXml = "Internal field."; elem ["Docs"] ["summary"].InnerXml = "Internal field.";
elem ["Docs"] ["remarks"].InnerXml = "Do not use."; elem ["Docs"] ["remarks"].InnerXml = "Do not use.";
} }
} }
} }
foreach (XmlNode node in kill_elems) foreach (XmlNode node in kill_elems)
node.ParentNode.RemoveChild (node); node.ParentNode.RemoveChild (node);
api_doc.Save (arg); api_doc.Save (arg);
if (ignores != "" || kills != "" || nonstubs != "") { if (ignores != "" || kills != "" || nonstubs != "") {
Console.WriteLine (arg + ":"); Console.WriteLine (arg + ":");
if (ignores != "") if (ignores != "")
Console.WriteLine (" Ignored:" + ignores); Console.WriteLine (" Ignored:" + ignores);
if (kills != "") if (kills != "")
Console.WriteLine (" Killed:" + kills); Console.WriteLine (" Killed:" + kills);
if (nonstubs != "") if (nonstubs != "")
Console.WriteLine (" Non-stubbed deprecates:" + nonstubs); Console.WriteLine (" Non-stubbed deprecates:" + nonstubs);
} }
} }
return 0; return 0;
} }
} }
} }

View File

@ -1,242 +1,242 @@
// gapi-fixup.cs - xml alteration engine. // gapi-fixup.cs - xml alteration engine.
// //
// Authors: // Authors:
// Mike Kestner <mkestner@speakeasy.net> // Mike Kestner <mkestner@speakeasy.net>
// Stephan Sundermann <stephansundermann@gmail.com> // Stephan Sundermann <stephansundermann@gmail.com>
// //
// Copyright (c) 2003 Mike Kestner // Copyright (c) 2003 Mike Kestner
// Copyright (c) 2013 Stephan Sundermann // Copyright (c) 2013 Stephan Sundermann
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public // modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation. // License as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// //
// You should have received a copy of the GNU General Public // You should have received a copy of the GNU General Public
// License along with this program; if not, write to the // License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA. // Boston, MA 02111-1307, USA.
namespace GtkSharp.Parsing { namespace GtkSharp.Parsing {
using System; using System;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
public class Fixup { public class Fixup {
public static int Main (string[] args) public static int Main (string[] args)
{ {
if (args.Length < 2) { if (args.Length < 2) {
Console.WriteLine ("Usage: gapi-fixup --metadata=<filename> --api=<filename> --symbols=<filename>"); Console.WriteLine ("Usage: gapi-fixup --metadata=<filename> --api=<filename> --symbols=<filename>");
return 0; return 0;
} }
string api_filename = ""; string api_filename = "";
XmlDocument api_doc = new XmlDocument (); XmlDocument api_doc = new XmlDocument ();
XmlDocument meta_doc = new XmlDocument (); XmlDocument meta_doc = new XmlDocument ();
XmlDocument symbol_doc = new XmlDocument (); XmlDocument symbol_doc = new XmlDocument ();
foreach (string arg in args) { foreach (string arg in args) {
if (arg.StartsWith("--metadata=")) { if (arg.StartsWith("--metadata=")) {
string meta_filename = arg.Substring (11); string meta_filename = arg.Substring (11);
try { try {
Stream stream = File.OpenRead (meta_filename); Stream stream = File.OpenRead (meta_filename);
meta_doc.Load (stream); meta_doc.Load (stream);
stream.Close (); stream.Close ();
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine ("Invalid meta file."); Console.WriteLine ("Invalid meta file.");
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
} else if (arg.StartsWith ("--api=")) { } else if (arg.StartsWith ("--api=")) {
api_filename = arg.Substring (6); api_filename = arg.Substring (6);
try { try {
Stream stream = File.OpenRead (api_filename); Stream stream = File.OpenRead (api_filename);
api_doc.Load (stream); api_doc.Load (stream);
stream.Close (); stream.Close ();
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine ("Invalid api file."); Console.WriteLine ("Invalid api file.");
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
} else if (arg.StartsWith ("--symbols=")) { } else if (arg.StartsWith ("--symbols=")) {
string symbol_filename = arg.Substring (10); string symbol_filename = arg.Substring (10);
try { try {
Stream stream = File.OpenRead (symbol_filename); Stream stream = File.OpenRead (symbol_filename);
symbol_doc.Load (stream); symbol_doc.Load (stream);
stream.Close (); stream.Close ();
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine ("Invalid api file."); Console.WriteLine ("Invalid api file.");
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
} else { } else {
Console.WriteLine ("Usage: gapi-fixup --metadata=<filename> --api=<filename>"); Console.WriteLine ("Usage: gapi-fixup --metadata=<filename> --api=<filename>");
return 1; return 1;
} }
} }
XPathNavigator meta_nav = meta_doc.CreateNavigator (); XPathNavigator meta_nav = meta_doc.CreateNavigator ();
XPathNavigator api_nav = api_doc.CreateNavigator (); XPathNavigator api_nav = api_doc.CreateNavigator ();
XPathNodeIterator copy_iter = meta_nav.Select ("/metadata/copy-node"); XPathNodeIterator copy_iter = meta_nav.Select ("/metadata/copy-node");
while (copy_iter.MoveNext ()) { while (copy_iter.MoveNext ()) {
string path = copy_iter.Current.GetAttribute ("path", String.Empty); string path = copy_iter.Current.GetAttribute ("path", String.Empty);
XPathExpression expr = api_nav.Compile (path); XPathExpression expr = api_nav.Compile (path);
string parent = copy_iter.Current.Value; string parent = copy_iter.Current.Value;
XPathNodeIterator parent_iter = api_nav.Select (parent); XPathNodeIterator parent_iter = api_nav.Select (parent);
bool matched = false; bool matched = false;
while (parent_iter.MoveNext ()) { while (parent_iter.MoveNext ()) {
XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode (); XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode ();
XPathNodeIterator path_iter = parent_iter.Current.Clone ().Select (expr); XPathNodeIterator path_iter = parent_iter.Current.Clone ().Select (expr);
while (path_iter.MoveNext ()) { while (path_iter.MoveNext ()) {
XmlNode node = ((IHasXmlNode)path_iter.Current).GetNode (); XmlNode node = ((IHasXmlNode)path_iter.Current).GetNode ();
parent_node.AppendChild (node.Clone ()); parent_node.AppendChild (node.Clone ());
} }
matched = true; matched = true;
} }
if (!matched) if (!matched)
Console.WriteLine ("Warning: <copy-node path=\"{0}\"/> matched no nodes", path); Console.WriteLine ("Warning: <copy-node path=\"{0}\"/> matched no nodes", path);
} }
XPathNodeIterator rmv_iter = meta_nav.Select ("/metadata/remove-node"); XPathNodeIterator rmv_iter = meta_nav.Select ("/metadata/remove-node");
while (rmv_iter.MoveNext ()) { while (rmv_iter.MoveNext ()) {
string path = rmv_iter.Current.GetAttribute ("path", ""); string path = rmv_iter.Current.GetAttribute ("path", "");
XPathNodeIterator api_iter = api_nav.Select (path); XPathNodeIterator api_iter = api_nav.Select (path);
bool matched = false; bool matched = false;
while (api_iter.MoveNext ()) { while (api_iter.MoveNext ()) {
XmlElement api_node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement; XmlElement api_node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement;
api_node.ParentNode.RemoveChild (api_node); api_node.ParentNode.RemoveChild (api_node);
matched = true; matched = true;
} }
if (!matched) if (!matched)
Console.WriteLine ("Warning: <remove-node path=\"{0}\"/> matched no nodes", path); Console.WriteLine ("Warning: <remove-node path=\"{0}\"/> matched no nodes", path);
} }
XPathNodeIterator add_iter = meta_nav.Select ("/metadata/add-node"); XPathNodeIterator add_iter = meta_nav.Select ("/metadata/add-node");
while (add_iter.MoveNext ()) { while (add_iter.MoveNext ()) {
string path = add_iter.Current.GetAttribute ("path", ""); string path = add_iter.Current.GetAttribute ("path", "");
XPathNodeIterator api_iter = api_nav.Select (path); XPathNodeIterator api_iter = api_nav.Select (path);
bool matched = false; bool matched = false;
while (api_iter.MoveNext ()) { while (api_iter.MoveNext ()) {
XmlElement api_node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement; XmlElement api_node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement;
foreach (XmlNode child in ((IHasXmlNode)add_iter.Current).GetNode().ChildNodes) foreach (XmlNode child in ((IHasXmlNode)add_iter.Current).GetNode().ChildNodes)
api_node.AppendChild (api_doc.ImportNode (child, true)); api_node.AppendChild (api_doc.ImportNode (child, true));
matched = true; matched = true;
} }
if (!matched) if (!matched)
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"); XPathNodeIterator change_node_type_iter = meta_nav.Select ("/metadata/change-node-type");
while (change_node_type_iter.MoveNext ()) { while (change_node_type_iter.MoveNext ()) {
string path = change_node_type_iter.Current.GetAttribute ("path", ""); string path = change_node_type_iter.Current.GetAttribute ("path", "");
XPathNodeIterator api_iter = api_nav.Select (path); XPathNodeIterator api_iter = api_nav.Select (path);
bool matched = false; bool matched = false;
while (api_iter.MoveNext ()) { while (api_iter.MoveNext ()) {
XmlElement node = ( (IHasXmlNode) api_iter.Current).GetNode () as XmlElement; XmlElement node = ( (IHasXmlNode) api_iter.Current).GetNode () as XmlElement;
XmlElement parent = node.ParentNode as XmlElement; XmlElement parent = node.ParentNode as XmlElement;
XmlElement new_node = api_doc.CreateElement (change_node_type_iter.Current.Value); XmlElement new_node = api_doc.CreateElement (change_node_type_iter.Current.Value);
foreach (XmlNode child in node.ChildNodes) foreach (XmlNode child in node.ChildNodes)
new_node.AppendChild (child.Clone ()); new_node.AppendChild (child.Clone ());
foreach (XmlAttribute attribute in node.Attributes) foreach (XmlAttribute attribute in node.Attributes)
new_node.Attributes.Append ( (XmlAttribute) attribute.Clone ()); new_node.Attributes.Append ( (XmlAttribute) attribute.Clone ());
parent.ReplaceChild (new_node, node); parent.ReplaceChild (new_node, node);
matched = true; matched = true;
} }
if (!matched) if (!matched)
Console.WriteLine ("Warning: <change-node-type path=\"{0}\"/> matched no nodes", path); 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", "");
string attr_name = attr_iter.Current.GetAttribute ("name", ""); string attr_name = attr_iter.Current.GetAttribute ("name", "");
XPathNodeIterator api_iter = api_nav.Select (path); XPathNodeIterator api_iter = api_nav.Select (path);
bool matched = false; bool matched = false;
while (api_iter.MoveNext ()) { while (api_iter.MoveNext ()) {
XmlElement node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement; XmlElement node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement;
node.SetAttribute (attr_name, attr_iter.Current.Value); node.SetAttribute (attr_name, attr_iter.Current.Value);
matched = true; matched = true;
} }
if (!matched) if (!matched)
Console.WriteLine ("Warning: <attr path=\"{0}\"/> matched no nodes", path); Console.WriteLine ("Warning: <attr path=\"{0}\"/> matched no nodes", path);
} }
XPathNodeIterator move_iter = meta_nav.Select ("/metadata/move-node"); XPathNodeIterator move_iter = meta_nav.Select ("/metadata/move-node");
while (move_iter.MoveNext ()) { while (move_iter.MoveNext ()) {
string path = move_iter.Current.GetAttribute ("path", ""); string path = move_iter.Current.GetAttribute ("path", "");
XPathExpression expr = api_nav.Compile (path); XPathExpression expr = api_nav.Compile (path);
string parent = move_iter.Current.Value; string parent = move_iter.Current.Value;
XPathNodeIterator parent_iter = api_nav.Select (parent); XPathNodeIterator parent_iter = api_nav.Select (parent);
bool matched = false; bool matched = false;
while (parent_iter.MoveNext ()) { while (parent_iter.MoveNext ()) {
XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode (); XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode ();
XPathNodeIterator path_iter = parent_iter.Current.Clone ().Select (expr); XPathNodeIterator path_iter = parent_iter.Current.Clone ().Select (expr);
while (path_iter.MoveNext ()) { while (path_iter.MoveNext ()) {
XmlNode node = ((IHasXmlNode)path_iter.Current).GetNode (); XmlNode node = ((IHasXmlNode)path_iter.Current).GetNode ();
parent_node.AppendChild (node.Clone ()); parent_node.AppendChild (node.Clone ());
node.ParentNode.RemoveChild (node); node.ParentNode.RemoveChild (node);
} }
matched = true; matched = true;
} }
if (!matched) if (!matched)
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"); XPathNodeIterator remove_attr_iter = meta_nav.Select ("/metadata/remove-attr");
while (remove_attr_iter.MoveNext ()) { while (remove_attr_iter.MoveNext ()) {
string path = remove_attr_iter.Current.GetAttribute ("path", ""); string path = remove_attr_iter.Current.GetAttribute ("path", "");
string name = remove_attr_iter.Current.GetAttribute ("name", ""); string name = remove_attr_iter.Current.GetAttribute ("name", "");
XPathNodeIterator api_iter = api_nav.Select (path); XPathNodeIterator api_iter = api_nav.Select (path);
bool matched = false; bool matched = false;
while (api_iter.MoveNext ()) { while (api_iter.MoveNext ()) {
XmlElement node = ( (IHasXmlNode) api_iter.Current).GetNode () as XmlElement; XmlElement node = ( (IHasXmlNode) api_iter.Current).GetNode () as XmlElement;
node.RemoveAttribute (name); node.RemoveAttribute (name);
matched = true; matched = true;
} }
if (!matched) if (!matched)
Console.WriteLine ("Warning: <remove-attr path=\"{0}\"/> matched no nodes", path); 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/*");
while (iter.MoveNext ()) { while (iter.MoveNext ()) {
XmlNode sym_node = ((IHasXmlNode)iter.Current).GetNode (); XmlNode sym_node = ((IHasXmlNode)iter.Current).GetNode ();
XPathNodeIterator parent_iter = api_nav.Select ("/api"); XPathNodeIterator parent_iter = api_nav.Select ("/api");
if (parent_iter.MoveNext ()) { if (parent_iter.MoveNext ()) {
XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode (); XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode ();
parent_node.AppendChild (api_doc.ImportNode (sym_node, true)); parent_node.AppendChild (api_doc.ImportNode (sym_node, true));
} }
} }
} }
api_doc.Save (api_filename); api_doc.Save (api_filename);
return 0; return 0;
} }
} }
} }

View File

@ -23,7 +23,7 @@ namespace GLib {
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
public partial class AppInfoAdapter { public partial class AppInfoAdapter {
[DllImport ("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport (GioGlobal.GioNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_app_info_get_all(); static extern IntPtr g_app_info_get_all();
public static GLib.IAppInfo[] GetAll () { public static GLib.IAppInfo[] GetAll () {

67
gio/Application.cs Normal file
View File

@ -0,0 +1,67 @@
//
// Application.cs
//
// Author(s):
// Antonius Riha <antoniusriha@gmail.com>
//
// Copyright (c) 2014 Antonius Riha
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
using System;
using System.Runtime.InteropServices;
namespace GLib
{
public partial class Application
{
public Application () : this (null, ApplicationFlags.None)
{
}
[DllImport (GioGlobal.GioNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern int g_application_run (IntPtr raw, int argc, IntPtr argv);
public int Run ()
{
return Run (null, null);
}
public int Run (string program_name, string[] args)
{
var argc = 0;
var argv = IntPtr.Zero;
if (program_name != null) {
program_name = program_name.Trim ();
if (program_name.Length == 0) {
throw new ArgumentException ("program_name must not be empty.", "program_name");
}
if (args == null) {
throw new ArgumentNullException ("args");
}
var prog_args = new string [args.Length + 1];
prog_args [0] = program_name;
args.CopyTo (prog_args, 1);
argc = prog_args.Length;
argv = new Argv (prog_args).Handle;
}
return g_application_run (Handle, argc, argv);
}
}
}

View File

@ -37,7 +37,7 @@ namespace GLib {
return Delete (null); return Delete (null);
} }
[DllImport ("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport (GioGlobal.GioNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_file_get_uri(IntPtr raw); static extern IntPtr g_file_get_uri(IntPtr raw);
public System.Uri Uri { public System.Uri Uri {

View File

@ -27,7 +27,7 @@ namespace GLib
{ {
public class FileFactory public class FileFactory
{ {
[DllImport ("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport (GioGlobal.GioNativeDll, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr g_file_new_for_uri (string uri); private static extern IntPtr g_file_new_for_uri (string uri);
public static IFile NewForUri (string uri) public static IFile NewForUri (string uri)
@ -40,7 +40,7 @@ namespace GLib
return GLib.FileAdapter.GetObject (g_file_new_for_uri (uri.ToString ()), false) as IFile; return GLib.FileAdapter.GetObject (g_file_new_for_uri (uri.ToString ()), false) as IFile;
} }
[DllImport ("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport (GioGlobal.GioNativeDll, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr g_file_new_for_path (string path); private static extern IntPtr g_file_new_for_path (string path);
public static IFile NewForPath (string path) public static IFile NewForPath (string path)
@ -48,7 +48,7 @@ namespace GLib
return GLib.FileAdapter.GetObject (g_file_new_for_path (path), false) as IFile; return GLib.FileAdapter.GetObject (g_file_new_for_path (path), false) as IFile;
} }
[DllImport ("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport (GioGlobal.GioNativeDll, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr g_file_new_for_commandline_arg (string arg); private static extern IntPtr g_file_new_for_commandline_arg (string arg);
public static IFile NewFromCommandlineArg (string arg) public static IFile NewFromCommandlineArg (string arg)

View File

@ -106,6 +106,7 @@
<attr path="/api/namespace/object/property[@type='GDbusServerFlags']" name="type">GDBusServerFlags</attr> <attr path="/api/namespace/object/property[@type='GDbusServerFlags']" name="type">GDBusServerFlags</attr>
<attr path="/api/namespace/object/property[@type='GIoStream']" name="type">GIOStream</attr> <attr path="/api/namespace/object/property[@type='GIoStream']" name="type">GIOStream</attr>
<attr path="/api/namespace/object/property[@type='GUnixFdList']" name="type">GUnixFDList</attr> <attr path="/api/namespace/object/property[@type='GUnixFdList']" name="type">GUnixFDList</attr>
<attr path="/api/namespace/object[@cname='GApplication']/method[@cname='g_application_run']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GApplication']/signal[@cname='activate']" name="name">Activated</attr> <attr path="/api/namespace/object[@cname='GApplication']/signal[@cname='activate']" name="name">Activated</attr>
<attr path="/api/namespace/object[@cname='GApplication']/signal[@cname='open']" name="name">Opened</attr> <attr path="/api/namespace/object[@cname='GApplication']/signal[@cname='open']" name="name">Opened</attr>
<attr path="/api/namespace/object[@cname='GAppLaunchContext']/signal[@cname='launch-failed']" name="name">LaunchedFailed</attr> <attr path="/api/namespace/object[@cname='GAppLaunchContext']/signal[@cname='launch-failed']" name="name">LaunchedFailed</attr>

29
gio/GioGlobal.cs Normal file
View File

@ -0,0 +1,29 @@
//
// Global.cs
//
// Author(s):
// Antonius Riha <antoniusriha@gmail.com>
//
// Copyright (c) 2014 Antonius Riha
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
namespace GLib
{
public partial class GioGlobal
{
internal const string GioNativeDll = "libgio-2.0-0.dll";
}
}

View File

@ -12,10 +12,12 @@ glue_includes = gio/gio.h
POLICY_VERSIONS= POLICY_VERSIONS=
sources = \ sources = \
Application.cs \
AppInfoAdapter.cs \ AppInfoAdapter.cs \
FileAdapter.cs \ FileAdapter.cs \
FileEnumerator.cs \ FileEnumerator.cs \
FileFactory.cs \ FileFactory.cs \
GioGlobal.cs \
GioStream.cs \ GioStream.cs \
IFile.cs IFile.cs

View File

@ -368,6 +368,8 @@
<Compile Include="generated\GLib\ZlibCompressor.cs" /> <Compile Include="generated\GLib\ZlibCompressor.cs" />
<Compile Include="generated\GLib\ZlibCompressorFormat.cs" /> <Compile Include="generated\GLib\ZlibCompressorFormat.cs" />
<Compile Include="generated\GLib\ZlibDecompressor.cs" /> <Compile Include="generated\GLib\ZlibDecompressor.cs" />
<Compile Include="Application.cs" />
<Compile Include="GioGlobal.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\glib\glib.csproj"> <ProjectReference Include="..\glib\glib.csproj">

View File

@ -1,170 +1,170 @@
// gapi-parser.cs - parsing driver application. // gapi-parser.cs - parsing driver application.
// //
// Author: Mike Kestner <mkestner@novell.com> // Author: Mike Kestner <mkestner@novell.com>
// //
// Copyright (c) 2005 Novell, Inc. // Copyright (c) 2005 Novell, Inc.
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public // modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation. // License as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// //
// You should have received a copy of the GNU General Public // You should have received a copy of the GNU General Public
// License along with this program; if not, write to the // License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA. // Boston, MA 02111-1307, USA.
namespace GtkSharp.Parsing { namespace GtkSharp.Parsing {
using System; using System;
using System.Collections; using System.Collections;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Xml; using System.Xml;
public class Parser { public class Parser {
[DllImport ("libc")] [DllImport ("libc")]
static extern int system (string command); static extern int system (string command);
public static int Main (string[] args) public static int Main (string[] args)
{ {
if (args.Length != 1) { if (args.Length != 1) {
Console.WriteLine ("Usage: gapi2-parser <filename>"); Console.WriteLine ("Usage: gapi2-parser <filename>");
return 0; return 0;
} }
XmlDocument src_doc = new XmlDocument (); XmlDocument src_doc = new XmlDocument ();
try { try {
using (Stream stream = File.OpenRead (args [0])) using (Stream stream = File.OpenRead (args [0]))
src_doc.Load (stream); src_doc.Load (stream);
} catch (XmlException e) { } catch (XmlException e) {
Console.WriteLine ("Couldn't open source file."); Console.WriteLine ("Couldn't open source file.");
Console.WriteLine (e); Console.WriteLine (e);
return 1; return 1;
} }
XmlNode root = src_doc.DocumentElement; XmlNode root = src_doc.DocumentElement;
if (root.Name != "gapi-parser-input") { if (root.Name != "gapi-parser-input") {
Console.WriteLine ("Improperly formatted input file: " + args [0]); Console.WriteLine ("Improperly formatted input file: " + args [0]);
return 1; return 1;
} }
foreach (XmlNode apinode in root.ChildNodes) { foreach (XmlNode apinode in root.ChildNodes) {
if (apinode.Name != "api") if (apinode.Name != "api")
continue; continue;
string outfile = (apinode as XmlElement).GetAttribute ("filename"); string outfile = (apinode as XmlElement).GetAttribute ("filename");
string prefile = outfile + ".pre"; string prefile = outfile + ".pre";
if (File.Exists (prefile)) if (File.Exists (prefile))
File.Delete (prefile); File.Delete (prefile);
foreach (XmlNode libnode in apinode.ChildNodes) { foreach (XmlNode libnode in apinode.ChildNodes) {
if (libnode.Name != "library") if (libnode.Name != "library")
continue; continue;
string lib = (libnode as XmlElement).GetAttribute ("name"); string lib = (libnode as XmlElement).GetAttribute ("name");
foreach (XmlNode nsnode in libnode.ChildNodes) { foreach (XmlNode nsnode in libnode.ChildNodes) {
if (nsnode.Name != "namespace") if (nsnode.Name != "namespace")
continue; continue;
string ns = (nsnode as XmlElement).GetAttribute ("name"); string ns = (nsnode as XmlElement).GetAttribute ("name");
ArrayList files = new ArrayList (); ArrayList files = new ArrayList ();
Hashtable excludes = new Hashtable (); Hashtable excludes = new Hashtable ();
foreach (XmlNode srcnode in nsnode.ChildNodes) { foreach (XmlNode srcnode in nsnode.ChildNodes) {
if (!(srcnode is XmlElement)) if (!(srcnode is XmlElement))
continue; continue;
XmlElement elem = srcnode as XmlElement; XmlElement elem = srcnode as XmlElement;
switch (srcnode.Name) { switch (srcnode.Name) {
case "dir": case "dir":
string dir = elem.InnerXml; string dir = elem.InnerXml;
Console.Write ("<dir {0}> ", dir); Console.Write ("<dir {0}> ", dir);
DirectoryInfo di = new DirectoryInfo (dir); DirectoryInfo di = new DirectoryInfo (dir);
foreach (FileInfo file in di.GetFiles ("*.c")) foreach (FileInfo file in di.GetFiles ("*.c"))
files.Add (dir + Path.DirectorySeparatorChar + file.Name); files.Add (dir + Path.DirectorySeparatorChar + file.Name);
foreach (FileInfo file in di.GetFiles ("*.h")) foreach (FileInfo file in di.GetFiles ("*.h"))
files.Add (dir + Path.DirectorySeparatorChar + file.Name); files.Add (dir + Path.DirectorySeparatorChar + file.Name);
break; break;
case "file": case "file":
string incfile = elem.InnerXml; string incfile = elem.InnerXml;
Console.Write ("<file {0}> ", incfile); Console.Write ("<file {0}> ", incfile);
files.Add (incfile); files.Add (incfile);
break; break;
case "exclude": case "exclude":
string excfile = elem.InnerXml; string excfile = elem.InnerXml;
Console.Write ("<exclude {0}> ", excfile); Console.Write ("<exclude {0}> ", excfile);
excludes [excfile] = 1; excludes [excfile] = 1;
break; break;
case "directory": case "directory":
string dir_path = elem.GetAttribute ("path"); string dir_path = elem.GetAttribute ("path");
Console.Write ("<directory {0}: excluding ", dir_path); Console.Write ("<directory {0}: excluding ", dir_path);
Hashtable excs = new Hashtable (); Hashtable excs = new Hashtable ();
foreach (XmlNode exc_node in srcnode.ChildNodes) { foreach (XmlNode exc_node in srcnode.ChildNodes) {
if (exc_node.Name != "exclude") if (exc_node.Name != "exclude")
continue; continue;
string excfilename = (exc_node as XmlElement).InnerXml; string excfilename = (exc_node as XmlElement).InnerXml;
Console.Write (excfilename + " "); Console.Write (excfilename + " ");
excs [excfilename] = 1; excs [excfilename] = 1;
} }
DirectoryInfo dinfo = new DirectoryInfo (dir_path); DirectoryInfo dinfo = new DirectoryInfo (dir_path);
foreach (FileInfo file in dinfo.GetFiles ("*.c")) { foreach (FileInfo file in dinfo.GetFiles ("*.c")) {
if (excs.Contains (file.Name)) if (excs.Contains (file.Name))
continue; continue;
files.Add (dir_path + Path.DirectorySeparatorChar + file.Name); files.Add (dir_path + Path.DirectorySeparatorChar + file.Name);
} }
foreach (FileInfo file in dinfo.GetFiles ("*.h")) { foreach (FileInfo file in dinfo.GetFiles ("*.h")) {
if (excs.Contains (file.Name)) if (excs.Contains (file.Name))
continue; continue;
files.Add (dir_path + Path.DirectorySeparatorChar + file.Name); files.Add (dir_path + Path.DirectorySeparatorChar + file.Name);
} }
Console.Write ("> "); Console.Write ("> ");
break; break;
default: default:
Console.WriteLine ("Invalid source: " + srcnode.Name); Console.WriteLine ("Invalid source: " + srcnode.Name);
break; break;
} }
} }
Console.WriteLine (); Console.WriteLine ();
if (files.Count == 0) if (files.Count == 0)
continue; continue;
ArrayList realfiles = new ArrayList (); ArrayList realfiles = new ArrayList ();
foreach (string file in files) { foreach (string file in files) {
string trimfile = file.TrimEnd (); string trimfile = file.TrimEnd ();
if (excludes.Contains (trimfile)) if (excludes.Contains (trimfile))
continue; continue;
realfiles.Add (trimfile); realfiles.Add (trimfile);
} }
string[] filenames = (string[]) realfiles.ToArray (typeof (string)); string[] filenames = (string[]) realfiles.ToArray (typeof (string));
string pp_args = String.Join (" ", filenames); string pp_args = String.Join (" ", filenames);
system ("gapi_pp.pl " + pp_args + " | gapi2xml.pl " + ns + " " + prefile + " " + lib); system ("gapi_pp.pl " + pp_args + " | gapi2xml.pl " + ns + " " + prefile + " " + lib);
} }
} }
XmlDocument final = new XmlDocument (); XmlDocument final = new XmlDocument ();
final.Load (prefile); final.Load (prefile);
XmlTextWriter writer = new XmlTextWriter (outfile, null); XmlTextWriter writer = new XmlTextWriter (outfile, null);
writer.Formatting = Formatting.Indented; writer.Formatting = Formatting.Indented;
final.Save (writer); final.Save (writer);
File.Delete (prefile); File.Delete (prefile);
} }
return 0; return 0;
} }
} }
} }

View File

@ -4,7 +4,7 @@ lib_LTLIBRARIES = libopaque.la
assemblies=../../glib/glib-sharp.dll ../../gio/gio-sharp.dll ../../pango/pango-sharp.dll ../../atk/atk-sharp.dll ../../gdk/gdk-sharp.dll ../../gtk/gtk-sharp.dll assemblies=../../glib/glib-sharp.dll ../../gio/gio-sharp.dll ../../pango/pango-sharp.dll ../../atk/atk-sharp.dll ../../gdk/gdk-sharp.dll ../../gtk/gtk-sharp.dll
references=$(addprefix -r:, $(assemblies)) references=$(addprefix -r:, $(assemblies))
opaquetest.exe: OpaqueTest.cs $(GENERATED_SOURCES_FILES) $(assemblies) opaquetest.exe: generated-stamp OpaqueTest.cs $(assemblies)
$(CSC) $(CSFLAGS) -out:opaquetest.exe $(references) $(srcdir)/OpaqueTest.cs $(GENERATED_SOURCES_OPTION) $(CSC) $(CSFLAGS) -out:opaquetest.exe $(references) $(srcdir)/OpaqueTest.cs $(GENERATED_SOURCES_OPTION)
libopaque_la_SOURCES = \ libopaque_la_SOURCES = \
@ -17,11 +17,13 @@ libopaque_la_LIBADD = $(GTK_LIBS)
AM_CPPFLAGS = $(GTK_CFLAGS) AM_CPPFLAGS = $(GTK_CFLAGS)
$(GENERATED_SOURCES_FILES): opaque-api.xml generated-stamp: opaque-api.xml
rm -rf generated/* && \
$(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/opaque-api.xml \ $(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/opaque-api.xml \
--include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \ --include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \
--outdir=generated --assembly-name=opaque-sharp \ --outdir=generated --assembly-name=opaque-sharp \
--schema=$(top_srcdir)/gapi.xsd --schema=$(top_srcdir)/gapi.xsd \
&& touch generated-stamp
api: api:
PATH=../../parser:$(PATH) $(RUNTIME) ../../parser/gapi-parser.exe opaque-sources.xml PATH=../../parser:$(PATH) $(RUNTIME) ../../parser/gapi-parser.exe opaque-sources.xml
@ -32,6 +34,7 @@ install:
CLEANFILES = \ CLEANFILES = \
opaquetest.exe \ opaquetest.exe \
opaquetest.exe.mdb \ opaquetest.exe.mdb \
generated-stamp \
$(GENERATED_SOURCES_FILES) $(GENERATED_SOURCES_FILES)
EXTRA_DIST = \ EXTRA_DIST = \

View File

@ -4,7 +4,7 @@ lib_LTLIBRARIES = libvalobj.la
assemblies=../../glib/glib-sharp.dll ../../gio/gio-sharp.dll ../../cairo/cairo-sharp.dll ../../pango/pango-sharp.dll ../../atk/atk-sharp.dll ../../gdk/gdk-sharp.dll ../../gtk/gtk-sharp.dll assemblies=../../glib/glib-sharp.dll ../../gio/gio-sharp.dll ../../cairo/cairo-sharp.dll ../../pango/pango-sharp.dll ../../atk/atk-sharp.dll ../../gdk/gdk-sharp.dll ../../gtk/gtk-sharp.dll
references=$(addprefix -r:, $(assemblies)) references=$(addprefix -r:, $(assemblies))
valtest.exe: Valtest.cs $(GENERATED_SOURCES_FILES) $(assemblies) valtest.exe: generated-stamp Valtest.cs $(assemblies)
$(CSC) $(CSFLAGS) -out:valtest.exe $(references) $(srcdir)/Valtest.cs $(GENERATED_SOURCES_OPTION) $(CSC) $(CSFLAGS) -out:valtest.exe $(references) $(srcdir)/Valtest.cs $(GENERATED_SOURCES_OPTION)
libvalobj_la_SOURCES = \ libvalobj_la_SOURCES = \
@ -17,11 +17,13 @@ libvalobj_la_LIBADD = $(GTK_LIBS)
AM_CPPFLAGS = $(GTK_CFLAGS) AM_CPPFLAGS = $(GTK_CFLAGS)
$(GENERATED_SOURCES_FILES): valobj-api.xml generated-stamp: valobj-api.xml
rm -rf generated/* && \
$(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/valobj-api.xml \ $(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/valobj-api.xml \
--include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \ --include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \
--outdir=generated --assembly-name=valobj-sharp \ --outdir=generated --assembly-name=valobj-sharp \
--schema=$(top_srcdir)/gapi.xsd --schema=$(top_srcdir)/gapi.xsd && \
touch generated-stamp
api: api:
PATH=../../parser:$(PATH) $(RUNTIME) ../../parser/gapi-parser.exe valobj-sources.xml PATH=../../parser:$(PATH) $(RUNTIME) ../../parser/gapi-parser.exe valobj-sources.xml
@ -31,6 +33,7 @@ install:
CLEANFILES = \ CLEANFILES = \
valtest.exe \ valtest.exe \
valtest.exe.mdb \ valtest.exe.mdb \
generated-stamp \
$(GENERATED_SOURCES_FILES) $(GENERATED_SOURCES_FILES)
EXTRA_DIST = \ EXTRA_DIST = \