From 3680a39323f443354caff845733b70d0b4149b43 Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sun, 10 May 2015 17:16:00 +0200 Subject: [PATCH 1/6] build: Bump mono dependency to 3.2.8 Mono 3.2.8 was released way back in February 2014, and is now available in most current distros. With mono, we now only use the "mcs" unified compiler. This also allows us to build on systems where the compatibility script "gmcs" is not available. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 301db4c8c..4a407a2f1 100644 --- a/configure.ac +++ b/configure.ac @@ -104,7 +104,7 @@ AC_CHECK_SIZEOF(off_t) OFF_T_FLAGS="-define:OFF_T_$ac_cv_sizeof_off_t" 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) AC_PATH_PROG(GACUTIL, gacutil, no) @@ -133,7 +133,7 @@ if test "x$RUNTIME" != "no" ; then RUNTIME="mono$RUNTIME_DEBUG_FLAGS" fi -AC_PATH_PROG(CSC, gmcs, no) +AC_PATH_PROG(CSC, mcs, no) if test `uname -s` = "Darwin"; then LIB_PREFIX= LIB_SUFFIX=.dylib From b06ff4fd157885085f3d9764de2da55b9e46854c Mon Sep 17 00:00:00 2001 From: Antonius Riha Date: Wed, 17 Sep 2014 06:33:32 +0200 Subject: [PATCH 2/6] gio: Improve the Run method API in GLib.Application We don't need an argc parameter, but the program name is required. Signed-off-by: Bertrand Lorentz --- gio/Application.cs | 67 ++++++++++++++++++++++++++++++++++++++++++++++ gio/Gio.metadata | 1 + gio/GioGlobal.cs | 29 ++++++++++++++++++++ gio/Makefile.am | 2 ++ gio/gio.csproj | 2 ++ 5 files changed, 101 insertions(+) create mode 100644 gio/Application.cs create mode 100644 gio/GioGlobal.cs diff --git a/gio/Application.cs b/gio/Application.cs new file mode 100644 index 000000000..b84122747 --- /dev/null +++ b/gio/Application.cs @@ -0,0 +1,67 @@ +// +// Application.cs +// +// Author(s): +// Antonius Riha +// +// 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); + } + } +} diff --git a/gio/Gio.metadata b/gio/Gio.metadata index 6c134cace..22bff54f0 100644 --- a/gio/Gio.metadata +++ b/gio/Gio.metadata @@ -106,6 +106,7 @@ GDBusServerFlags GIOStream GUnixFDList + 1 Activated Opened AuthenticatedPeerAuthorized diff --git a/gio/GioGlobal.cs b/gio/GioGlobal.cs new file mode 100644 index 000000000..c01489ce0 --- /dev/null +++ b/gio/GioGlobal.cs @@ -0,0 +1,29 @@ +// +// Global.cs +// +// Author(s): +// Antonius Riha +// +// 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"; + } +} diff --git a/gio/Makefile.am b/gio/Makefile.am index 86e5be4a9..da2040689 100644 --- a/gio/Makefile.am +++ b/gio/Makefile.am @@ -12,10 +12,12 @@ glue_includes = gio/gio.h POLICY_VERSIONS= sources = \ + Application.cs \ AppInfoAdapter.cs \ FileAdapter.cs \ FileEnumerator.cs \ FileFactory.cs \ + GioGlobal.cs \ GioStream.cs \ IFile.cs diff --git a/gio/gio.csproj b/gio/gio.csproj index a997dd4e6..7495e21c6 100644 --- a/gio/gio.csproj +++ b/gio/gio.csproj @@ -368,6 +368,8 @@ + + From a3db272fee017518779344293fb802cc8d1f813b Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sun, 10 May 2015 17:50:23 +0200 Subject: [PATCH 3/6] gio: Use the GioNativeDll in all custom gio code The previous commit added the GioNativeDll constant for DllImport statements, so we might as well use it. --- gio/AppInfoAdapter.cs | 2 +- gio/FileAdapter.cs | 2 +- gio/FileFactory.cs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gio/AppInfoAdapter.cs b/gio/AppInfoAdapter.cs index 13d57b6b8..e36b6d01c 100644 --- a/gio/AppInfoAdapter.cs +++ b/gio/AppInfoAdapter.cs @@ -23,7 +23,7 @@ namespace GLib { using System.Runtime.InteropServices; 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(); public static GLib.IAppInfo[] GetAll () { diff --git a/gio/FileAdapter.cs b/gio/FileAdapter.cs index 3efec2234..d1b4cdc10 100644 --- a/gio/FileAdapter.cs +++ b/gio/FileAdapter.cs @@ -37,7 +37,7 @@ namespace GLib { 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); public System.Uri Uri { diff --git a/gio/FileFactory.cs b/gio/FileFactory.cs index bc0bb2127..c3d8c9b28 100644 --- a/gio/FileFactory.cs +++ b/gio/FileFactory.cs @@ -27,7 +27,7 @@ namespace GLib { 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); 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; } - [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); 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; } - [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); public static IFile NewFromCommandlineArg (string arg) From 5422daaabcd16211cb36318c60271f1d865503bd Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Mon, 25 May 2015 16:57:08 +0200 Subject: [PATCH 4/6] Convert some source files to Unix line endings No real code change in this commit. --- audit/extract-missing.cs | 144 +++++------ doc/add-since.cs | 154 ++++++------ doc/gen-handlerargs-docs.cs | 394 ++++++++++++++--------------- doc/gen-vm-docs.cs | 228 ++++++++--------- doc/scan-deprecations.cs | 216 ++++++++-------- generator/gapi-fixup.cs | 484 ++++++++++++++++++------------------ parser/gapi-parser.cs | 340 ++++++++++++------------- 7 files changed, 980 insertions(+), 980 deletions(-) diff --git a/audit/extract-missing.cs b/audit/extract-missing.cs index 407896ae0..164dffea2 100644 --- a/audit/extract-missing.cs +++ b/audit/extract-missing.cs @@ -1,72 +1,72 @@ -// extract-missing.cs - grab missing api elements from api-diff files. -// -// Author: Mike Kestner -// -// Copyright (c) 2005 Mike Kestner -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the 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 -// General Public License for more details. -// -// You should have received a copy of the GNU 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 GtkSharp.Auditing { - - using System; - using System.IO; - using System.Xml; - using System.Xml.XPath; - - public class ExtractMissing { - - public static int Main (string[] args) - { - if (args.Length != 1 || !File.Exists (args [0])) { - Console.WriteLine ("Usage: extract-missing "); - return 0; - } - - XmlDocument doc = new XmlDocument (); - - try { - Stream stream = File.OpenRead (args [0]); - doc.Load (stream); - stream.Close (); - } catch (XmlException e) { - Console.WriteLine ("Invalid apidiff file."); - Console.WriteLine (e); - return 1; - } - - XPathNavigator nav = doc.CreateNavigator (); - - XPathNodeIterator iter = nav.Select ("//*[@presence='missing']"); - while (iter.MoveNext ()) { - XmlElement node = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; - if (node.Name == "class") - Console.WriteLine ("Missing type: " + node.GetAttribute ("name")); - else if (node.ParentNode.ParentNode.Name == "class") - Console.WriteLine ("Missing " + node.Name + " " + (node.ParentNode.ParentNode as XmlElement).GetAttribute ("name") + "." + node.GetAttribute ("name")); - else if (node.Name == "attribute") { - if (node.ParentNode.ParentNode.Name == "class") - 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") - 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 - Console.WriteLine ("oopsie: " + node.Name + " " + node.ParentNode.ParentNode.Name); - } else - Console.WriteLine ("oopsie: " + node.Name + " " + node.ParentNode.ParentNode.Name); - } - - return 0; - } - } -} +// extract-missing.cs - grab missing api elements from api-diff files. +// +// Author: Mike Kestner +// +// Copyright (c) 2005 Mike Kestner +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the 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 +// General Public License for more details. +// +// You should have received a copy of the GNU 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 GtkSharp.Auditing { + + using System; + using System.IO; + using System.Xml; + using System.Xml.XPath; + + public class ExtractMissing { + + public static int Main (string[] args) + { + if (args.Length != 1 || !File.Exists (args [0])) { + Console.WriteLine ("Usage: extract-missing "); + return 0; + } + + XmlDocument doc = new XmlDocument (); + + try { + Stream stream = File.OpenRead (args [0]); + doc.Load (stream); + stream.Close (); + } catch (XmlException e) { + Console.WriteLine ("Invalid apidiff file."); + Console.WriteLine (e); + return 1; + } + + XPathNavigator nav = doc.CreateNavigator (); + + XPathNodeIterator iter = nav.Select ("//*[@presence='missing']"); + while (iter.MoveNext ()) { + XmlElement node = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; + if (node.Name == "class") + Console.WriteLine ("Missing type: " + node.GetAttribute ("name")); + else if (node.ParentNode.ParentNode.Name == "class") + Console.WriteLine ("Missing " + node.Name + " " + (node.ParentNode.ParentNode as XmlElement).GetAttribute ("name") + "." + node.GetAttribute ("name")); + else if (node.Name == "attribute") { + if (node.ParentNode.ParentNode.Name == "class") + 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") + 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 + Console.WriteLine ("oopsie: " + node.Name + " " + node.ParentNode.ParentNode.Name); + } else + Console.WriteLine ("oopsie: " + node.Name + " " + node.ParentNode.ParentNode.Name); + } + + return 0; + } + } +} diff --git a/doc/add-since.cs b/doc/add-since.cs index b82f3a10a..00162bf16 100644 --- a/doc/add-since.cs +++ b/doc/add-since.cs @@ -1,77 +1,77 @@ -// add-since.cs - Adds a since element to a Type document. -// -// Author: Mike Kestner -// -// Copyright (c) 2007 Novell, Inc. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the 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 -// General Public License for more details. -// -// You should have received a copy of the GNU 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 GtkSharp.Docs { - - using System; - using System.Collections; - using System.IO; - using System.Reflection; - using System.Xml; - using System.Xml.XPath; - - public class GenHandlerArgsDocs { - - public static int Main (string[] args) - { - string version = null; - ArrayList files = new ArrayList (); - - foreach (string arg in args) { - if (arg.StartsWith ("--version=")) { - version = arg.Substring (10); - } else { - files.Add (arg); - } - } - - if (version == null) { - Console.WriteLine ("Usage: add-since --version= "); - return 1; - } - - Console.WriteLine ("version: " + version); - XmlDocument api_doc = new XmlDocument (); - - foreach (string file in files) { - Console.WriteLine ("file: " + file); - try { - Stream stream = File.OpenRead (file); - api_doc.Load (stream); - stream.Close (); - } catch (XmlException e) { - Console.WriteLine (e); - return 1; - } - - XPathNavigator api_nav = api_doc.CreateNavigator (); - XPathNodeIterator iter = api_nav.Select ("/Type/Docs"); - if (iter.MoveNext ()) { - XmlElement docs = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; - XmlElement since = api_doc.CreateElement ("since"); - since.SetAttribute ("version", version); - docs.AppendChild (since); - api_doc.Save (file); - } - } - return 0; - } - } -} +// add-since.cs - Adds a since element to a Type document. +// +// Author: Mike Kestner +// +// Copyright (c) 2007 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the 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 +// General Public License for more details. +// +// You should have received a copy of the GNU 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 GtkSharp.Docs { + + using System; + using System.Collections; + using System.IO; + using System.Reflection; + using System.Xml; + using System.Xml.XPath; + + public class GenHandlerArgsDocs { + + public static int Main (string[] args) + { + string version = null; + ArrayList files = new ArrayList (); + + foreach (string arg in args) { + if (arg.StartsWith ("--version=")) { + version = arg.Substring (10); + } else { + files.Add (arg); + } + } + + if (version == null) { + Console.WriteLine ("Usage: add-since --version= "); + return 1; + } + + Console.WriteLine ("version: " + version); + XmlDocument api_doc = new XmlDocument (); + + foreach (string file in files) { + Console.WriteLine ("file: " + file); + try { + Stream stream = File.OpenRead (file); + api_doc.Load (stream); + stream.Close (); + } catch (XmlException e) { + Console.WriteLine (e); + return 1; + } + + XPathNavigator api_nav = api_doc.CreateNavigator (); + XPathNodeIterator iter = api_nav.Select ("/Type/Docs"); + if (iter.MoveNext ()) { + XmlElement docs = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; + XmlElement since = api_doc.CreateElement ("since"); + since.SetAttribute ("version", version); + docs.AppendChild (since); + api_doc.Save (file); + } + } + return 0; + } + } +} diff --git a/doc/gen-handlerargs-docs.cs b/doc/gen-handlerargs-docs.cs index 49f252e17..ffe37122e 100644 --- a/doc/gen-handlerargs-docs.cs +++ b/doc/gen-handlerargs-docs.cs @@ -1,197 +1,197 @@ -// gen-handlerargs-docs.cs - Generate documentation for event handlers/args -// -// Author: Mike Kestner -// -// Copyright (c) 2004 Novell, Inc. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the 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 -// General Public License for more details. -// -// You should have received a copy of the GNU 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 GtkSharp.Docs { - - using System; - using System.Collections; - using System.IO; - using System.Reflection; - using System.Xml; - using System.Xml.XPath; - - public class GenHandlerArgsDocs { - - public static int Main (string[] args) - { - Hashtable hndlrs = new Hashtable (); - XmlDocument api_doc = new XmlDocument (); - - BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly; - - foreach (string arg in args) { - - Assembly assembly; - try { - assembly = Assembly.LoadFile (arg); - } catch (XmlException e) { - Console.WriteLine (e); - return 1; - } - - foreach (Type t in assembly.GetTypes ()) { - - if (!t.IsSubclassOf (typeof (GLib.Object))) - continue; - - foreach (EventInfo ei in t.GetEvents (flags)) { - foreach (Attribute attr in ei.GetCustomAttributes (false)) { - if (attr.ToString () == "GLib.SignalAttribute") { - if (ei.EventHandlerType.ToString() == "System.EventHandler") - break; - ArrayList sigs; - if (hndlrs.Contains (ei.EventHandlerType)) - sigs = hndlrs [ei.EventHandlerType] as ArrayList; - else { - sigs = new ArrayList (); - hndlrs [ei.EventHandlerType] = sigs; - } - - sigs.Add (t + "." + ei.Name); - break; - } - } - } - } - } - - if (hndlrs.Count == 0) - return 0; - - foreach (Type hndlr in hndlrs.Keys) { - - string filename = "en/" + hndlr.Namespace + "/" + hndlr.Name + ".xml"; - - try { - Stream stream = File.OpenRead (filename); - api_doc.Load (stream); - stream.Close (); - } catch (XmlException e) { - Console.WriteLine (e); - return 1; - } - - Type arg_type = hndlr.GetMethod ("Invoke").GetParameters ()[1].ParameterType; - - XPathNavigator api_nav = api_doc.CreateNavigator (); - XPathNodeIterator iter = api_nav.Select ("/Type/Docs"); - if (iter.MoveNext ()) { - XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; - XmlElement summ = elem ["summary"]; - XmlElement rem = elem ["remarks"]; - string summary = summ.InnerXml; - string remarks = rem.InnerXml; - if (summary == "To be added." && remarks == "To be added.") { - Console.WriteLine (filename + ": Documenting summary and remarks"); - summ.InnerXml = "Event handler."; - ArrayList sigs = hndlrs[hndlr] as ArrayList; - string rems; - if (sigs.Count > 1) { - rems = "The following events utilize this delegate:"; - foreach (string ev in sigs) - rems += ""; - rems += ""; - } else - rems = "The event utilizes this delegate:"; - rems += "Event data is passed via the parameter.To attach a 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."; - rem.InnerXml = rems; - } - XPathNavigator param_nav = api_doc.CreateNavigator (); - XPathNodeIterator param_iter = param_nav.Select ("/Type/Docs/param"); - while (param_iter.MoveNext ()) { - XmlElement param = ((IHasXmlNode)param_iter.Current).GetNode () as XmlElement; - if (param.InnerXml == "To be added.") { - string param_name = param.GetAttribute ("name"); - switch (param_name) { - case "o": - param.InnerXml = "Event sender."; - break; - case "args": - param.InnerXml = "Event arguments."; - break; - default: - Console.WriteLine (filename + ": Unexpected param " + param.GetAttribute ("name")); - break; - } - Console.WriteLine (filename + ": Documenting param " + param.GetAttribute ("name")); - } - } - } - api_doc.Save (filename); - - filename = "en/" + arg_type.Namespace + "/" + arg_type.Name + ".xml"; - - try { - Stream stream = File.OpenRead (filename); - api_doc.Load (stream); - stream.Close (); - } catch (XmlException e) { - Console.WriteLine (e); - return 1; - } - - api_nav = api_doc.CreateNavigator (); - iter = api_nav.Select ("/Type/Docs"); - if (iter.MoveNext ()) { - XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; - XmlElement summ = elem ["summary"]; - XmlElement rem = elem ["remarks"]; - string summary = summ.InnerXml; - string remarks = rem.InnerXml; - if (summary == "To be added." && remarks == "To be added.") { - Console.WriteLine (filename + ": Documenting summary and remarks"); - summ.InnerXml = "Event data."; - ArrayList sigs = hndlrs[hndlr] as ArrayList; - string rems; - if (sigs.Count > 1) { - rems = "The following events invoke delegates which pass event data via this class:"; - foreach (string ev in sigs) - rems += ""; - rems += ""; - } else - rems = "The event invokes delegates which pass event data via this class."; - rem.InnerXml = rems; - } - } - - api_nav = api_doc.CreateNavigator (); - iter = api_nav.Select ("/Type/Members/Member[@MemberName='.ctor']"); - if (iter.MoveNext ()) { - XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; - XmlElement summ = elem ["Docs"] ["summary"]; - XmlElement rem = elem ["Docs"] ["remarks"]; - XmlElement ret = elem ["Docs"] ["returns"]; - string summary = summ.InnerXml; - string remarks = rem.InnerXml; - if (summary == "To be added." && remarks == "To be added.") { - Console.WriteLine (filename + ": Documenting constructor"); - summ.InnerXml = "Public Constructor."; - if (ret != null) - ret.InnerXml = "A new ."; - rem.InnerXml = "Create a new instance with this constructor if you need to invoke a delegate."; - } - } - api_doc.Save (filename); - - } - return 0; - } - } -} +// gen-handlerargs-docs.cs - Generate documentation for event handlers/args +// +// Author: Mike Kestner +// +// Copyright (c) 2004 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the 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 +// General Public License for more details. +// +// You should have received a copy of the GNU 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 GtkSharp.Docs { + + using System; + using System.Collections; + using System.IO; + using System.Reflection; + using System.Xml; + using System.Xml.XPath; + + public class GenHandlerArgsDocs { + + public static int Main (string[] args) + { + Hashtable hndlrs = new Hashtable (); + XmlDocument api_doc = new XmlDocument (); + + BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly; + + foreach (string arg in args) { + + Assembly assembly; + try { + assembly = Assembly.LoadFile (arg); + } catch (XmlException e) { + Console.WriteLine (e); + return 1; + } + + foreach (Type t in assembly.GetTypes ()) { + + if (!t.IsSubclassOf (typeof (GLib.Object))) + continue; + + foreach (EventInfo ei in t.GetEvents (flags)) { + foreach (Attribute attr in ei.GetCustomAttributes (false)) { + if (attr.ToString () == "GLib.SignalAttribute") { + if (ei.EventHandlerType.ToString() == "System.EventHandler") + break; + ArrayList sigs; + if (hndlrs.Contains (ei.EventHandlerType)) + sigs = hndlrs [ei.EventHandlerType] as ArrayList; + else { + sigs = new ArrayList (); + hndlrs [ei.EventHandlerType] = sigs; + } + + sigs.Add (t + "." + ei.Name); + break; + } + } + } + } + } + + if (hndlrs.Count == 0) + return 0; + + foreach (Type hndlr in hndlrs.Keys) { + + string filename = "en/" + hndlr.Namespace + "/" + hndlr.Name + ".xml"; + + try { + Stream stream = File.OpenRead (filename); + api_doc.Load (stream); + stream.Close (); + } catch (XmlException e) { + Console.WriteLine (e); + return 1; + } + + Type arg_type = hndlr.GetMethod ("Invoke").GetParameters ()[1].ParameterType; + + XPathNavigator api_nav = api_doc.CreateNavigator (); + XPathNodeIterator iter = api_nav.Select ("/Type/Docs"); + if (iter.MoveNext ()) { + XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; + XmlElement summ = elem ["summary"]; + XmlElement rem = elem ["remarks"]; + string summary = summ.InnerXml; + string remarks = rem.InnerXml; + if (summary == "To be added." && remarks == "To be added.") { + Console.WriteLine (filename + ": Documenting summary and remarks"); + summ.InnerXml = "Event handler."; + ArrayList sigs = hndlrs[hndlr] as ArrayList; + string rems; + if (sigs.Count > 1) { + rems = "The following events utilize this delegate:"; + foreach (string ev in sigs) + rems += ""; + rems += ""; + } else + rems = "The event utilizes this delegate:"; + rems += "Event data is passed via the parameter.To attach a 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."; + rem.InnerXml = rems; + } + XPathNavigator param_nav = api_doc.CreateNavigator (); + XPathNodeIterator param_iter = param_nav.Select ("/Type/Docs/param"); + while (param_iter.MoveNext ()) { + XmlElement param = ((IHasXmlNode)param_iter.Current).GetNode () as XmlElement; + if (param.InnerXml == "To be added.") { + string param_name = param.GetAttribute ("name"); + switch (param_name) { + case "o": + param.InnerXml = "Event sender."; + break; + case "args": + param.InnerXml = "Event arguments."; + break; + default: + Console.WriteLine (filename + ": Unexpected param " + param.GetAttribute ("name")); + break; + } + Console.WriteLine (filename + ": Documenting param " + param.GetAttribute ("name")); + } + } + } + api_doc.Save (filename); + + filename = "en/" + arg_type.Namespace + "/" + arg_type.Name + ".xml"; + + try { + Stream stream = File.OpenRead (filename); + api_doc.Load (stream); + stream.Close (); + } catch (XmlException e) { + Console.WriteLine (e); + return 1; + } + + api_nav = api_doc.CreateNavigator (); + iter = api_nav.Select ("/Type/Docs"); + if (iter.MoveNext ()) { + XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; + XmlElement summ = elem ["summary"]; + XmlElement rem = elem ["remarks"]; + string summary = summ.InnerXml; + string remarks = rem.InnerXml; + if (summary == "To be added." && remarks == "To be added.") { + Console.WriteLine (filename + ": Documenting summary and remarks"); + summ.InnerXml = "Event data."; + ArrayList sigs = hndlrs[hndlr] as ArrayList; + string rems; + if (sigs.Count > 1) { + rems = "The following events invoke delegates which pass event data via this class:"; + foreach (string ev in sigs) + rems += ""; + rems += ""; + } else + rems = "The event invokes delegates which pass event data via this class."; + rem.InnerXml = rems; + } + } + + api_nav = api_doc.CreateNavigator (); + iter = api_nav.Select ("/Type/Members/Member[@MemberName='.ctor']"); + if (iter.MoveNext ()) { + XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; + XmlElement summ = elem ["Docs"] ["summary"]; + XmlElement rem = elem ["Docs"] ["remarks"]; + XmlElement ret = elem ["Docs"] ["returns"]; + string summary = summ.InnerXml; + string remarks = rem.InnerXml; + if (summary == "To be added." && remarks == "To be added.") { + Console.WriteLine (filename + ": Documenting constructor"); + summ.InnerXml = "Public Constructor."; + if (ret != null) + ret.InnerXml = "A new ."; + rem.InnerXml = "Create a new instance with this constructor if you need to invoke a delegate."; + } + } + api_doc.Save (filename); + + } + return 0; + } + } +} diff --git a/doc/gen-vm-docs.cs b/doc/gen-vm-docs.cs index dd04e9f4e..cb73728bd 100644 --- a/doc/gen-vm-docs.cs +++ b/doc/gen-vm-docs.cs @@ -1,114 +1,114 @@ -// gen-vm-docs.cs - Generate documentation for virtual methods. -// -// Author: Mike Kestner -// -// Copyright (c) 2004 Novell, Inc. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the 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 -// General Public License for more details. -// -// You should have received a copy of the GNU 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 GtkSharp.Docs { - - using System; - using System.Collections; - using System.IO; - using System.Reflection; - using System.Xml; - using System.Xml.XPath; - - public class GenVMDocs { - - public static int Main (string[] args) - { - XmlDocument api_doc = new XmlDocument (); - - BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly; - foreach (string arg in args) { - - Assembly assembly; - try { - assembly = Assembly.LoadFile (arg); - } catch (XmlException e) { - Console.WriteLine (e); - return 1; - } - - foreach (Type t in assembly.GetTypes ()) { - if (!t.IsSubclassOf (typeof (GLib.Object))) - continue; - - Hashtable sigs = new Hashtable (); - - foreach (EventInfo ei in t.GetEvents (flags)) - foreach (GLib.SignalAttribute attr in ei.GetCustomAttributes (typeof (GLib.SignalAttribute), false)) - sigs [attr.CName] = ei.Name; - - - if (sigs.Count == 0) continue; - - Hashtable vms = new Hashtable (); - - foreach (MethodInfo mi in t.GetMethods (flags)) { - foreach (GLib.DefaultSignalHandlerAttribute attr in mi.GetCustomAttributes (typeof (GLib.DefaultSignalHandlerAttribute), false)) { - string conn_name = attr.ConnectionMethod; - if (sigs.ContainsValue (conn_name.Substring (8))) - vms [mi.Name] = conn_name.Substring (8); - } - } - - if (vms.Count == 0) continue; - - string filename = "en/" + t.Namespace + "/" + t.Name + ".xml"; - - try { - Stream stream = File.OpenRead (filename); - api_doc.Load (stream); - stream.Close (); - Console.WriteLine ("opened:" + filename); - } catch (XmlException e) { - Console.WriteLine (e); - return 1; - } - - XPathNavigator api_nav = api_doc.CreateNavigator (); - - bool dirty = false; - foreach (string vm in vms.Keys) { - - XPathNodeIterator iter = api_nav.Select ("/Type/Members/Member[@MemberName='" + vm + "']"); - if (iter.MoveNext ()) { - XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; - XmlElement summ = elem ["Docs"] ["summary"]; - XmlElement rem = elem ["Docs"] ["remarks"]; - string summary = summ.InnerXml; - string remarks = rem.InnerXml; - if (summary == "To be added." && remarks == "To be added.") { - summ.InnerXml = "Default handler for the event."; - rem.InnerXml = "Override this method in a subclass to provide a default handler for the event."; - dirty = true; - } else - Console.WriteLine ("Member had docs:" + vm); - } else { - Console.WriteLine ("Member not found:" + vm); - } - - if (dirty) - api_doc.Save (filename); - } - } - } - return 0; - } - } -} +// gen-vm-docs.cs - Generate documentation for virtual methods. +// +// Author: Mike Kestner +// +// Copyright (c) 2004 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the 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 +// General Public License for more details. +// +// You should have received a copy of the GNU 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 GtkSharp.Docs { + + using System; + using System.Collections; + using System.IO; + using System.Reflection; + using System.Xml; + using System.Xml.XPath; + + public class GenVMDocs { + + public static int Main (string[] args) + { + XmlDocument api_doc = new XmlDocument (); + + BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly; + foreach (string arg in args) { + + Assembly assembly; + try { + assembly = Assembly.LoadFile (arg); + } catch (XmlException e) { + Console.WriteLine (e); + return 1; + } + + foreach (Type t in assembly.GetTypes ()) { + if (!t.IsSubclassOf (typeof (GLib.Object))) + continue; + + Hashtable sigs = new Hashtable (); + + foreach (EventInfo ei in t.GetEvents (flags)) + foreach (GLib.SignalAttribute attr in ei.GetCustomAttributes (typeof (GLib.SignalAttribute), false)) + sigs [attr.CName] = ei.Name; + + + if (sigs.Count == 0) continue; + + Hashtable vms = new Hashtable (); + + foreach (MethodInfo mi in t.GetMethods (flags)) { + foreach (GLib.DefaultSignalHandlerAttribute attr in mi.GetCustomAttributes (typeof (GLib.DefaultSignalHandlerAttribute), false)) { + string conn_name = attr.ConnectionMethod; + if (sigs.ContainsValue (conn_name.Substring (8))) + vms [mi.Name] = conn_name.Substring (8); + } + } + + if (vms.Count == 0) continue; + + string filename = "en/" + t.Namespace + "/" + t.Name + ".xml"; + + try { + Stream stream = File.OpenRead (filename); + api_doc.Load (stream); + stream.Close (); + Console.WriteLine ("opened:" + filename); + } catch (XmlException e) { + Console.WriteLine (e); + return 1; + } + + XPathNavigator api_nav = api_doc.CreateNavigator (); + + bool dirty = false; + foreach (string vm in vms.Keys) { + + XPathNodeIterator iter = api_nav.Select ("/Type/Members/Member[@MemberName='" + vm + "']"); + if (iter.MoveNext ()) { + XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; + XmlElement summ = elem ["Docs"] ["summary"]; + XmlElement rem = elem ["Docs"] ["remarks"]; + string summary = summ.InnerXml; + string remarks = rem.InnerXml; + if (summary == "To be added." && remarks == "To be added.") { + summ.InnerXml = "Default handler for the event."; + rem.InnerXml = "Override this method in a subclass to provide a default handler for the event."; + dirty = true; + } else + Console.WriteLine ("Member had docs:" + vm); + } else { + Console.WriteLine ("Member not found:" + vm); + } + + if (dirty) + api_doc.Save (filename); + } + } + } + return 0; + } + } +} diff --git a/doc/scan-deprecations.cs b/doc/scan-deprecations.cs index 9e1547494..c3d46541a 100644 --- a/doc/scan-deprecations.cs +++ b/doc/scan-deprecations.cs @@ -1,108 +1,108 @@ -// scan-deprecations.cs - scans docs for deprecated nodes, cleans up and nags. -// -// Author: Mike Kestner -// -// Copyright (c) 2004 Novell, Inc. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the 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 -// General Public License for more details. -// -// You should have received a copy of the GNU 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 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 "Method": - case "Property": - case "Constructor": - 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; - } - } - - iter = api_nav.Select ("/Type/Base/BaseTypeName"); - if (iter.MoveNext ()) { - XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; - if (elem.InnerText == "System.Enum") { - iter = api_nav.Select ("/Type/Members/Member[@MemberName='value__']"); - if (iter.MoveNext ()) { - elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; - elem ["Docs"] ["summary"].InnerXml = "Internal field."; - elem ["Docs"] ["remarks"].InnerXml = "Do not use."; - } - } - } - - 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; - } - } -} +// scan-deprecations.cs - scans docs for deprecated nodes, cleans up and nags. +// +// Author: Mike Kestner +// +// Copyright (c) 2004 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the 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 +// General Public License for more details. +// +// You should have received a copy of the GNU 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 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 "Method": + case "Property": + case "Constructor": + 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; + } + } + + iter = api_nav.Select ("/Type/Base/BaseTypeName"); + if (iter.MoveNext ()) { + XmlElement elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; + if (elem.InnerText == "System.Enum") { + iter = api_nav.Select ("/Type/Members/Member[@MemberName='value__']"); + if (iter.MoveNext ()) { + elem = ((IHasXmlNode)iter.Current).GetNode () as XmlElement; + elem ["Docs"] ["summary"].InnerXml = "Internal field."; + elem ["Docs"] ["remarks"].InnerXml = "Do not use."; + } + } + } + + 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; + } + } +} diff --git a/generator/gapi-fixup.cs b/generator/gapi-fixup.cs index 9203fb30a..a5e151ad1 100644 --- a/generator/gapi-fixup.cs +++ b/generator/gapi-fixup.cs @@ -1,242 +1,242 @@ -// gapi-fixup.cs - xml alteration engine. -// -// Authors: -// Mike Kestner -// Stephan Sundermann -// -// Copyright (c) 2003 Mike Kestner -// Copyright (c) 2013 Stephan Sundermann -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the 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 -// General Public License for more details. -// -// You should have received a copy of the GNU 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 GtkSharp.Parsing { - - using System; - using System.IO; - using System.Xml; - using System.Xml.XPath; - - public class Fixup { - - public static int Main (string[] args) - { - if (args.Length < 2) { - Console.WriteLine ("Usage: gapi-fixup --metadata= --api= --symbols="); - return 0; - } - - string api_filename = ""; - XmlDocument api_doc = new XmlDocument (); - XmlDocument meta_doc = new XmlDocument (); - XmlDocument symbol_doc = new XmlDocument (); - - foreach (string arg in args) { - - if (arg.StartsWith("--metadata=")) { - - string meta_filename = arg.Substring (11); - - try { - Stream stream = File.OpenRead (meta_filename); - meta_doc.Load (stream); - stream.Close (); - } catch (XmlException e) { - Console.WriteLine ("Invalid meta file."); - Console.WriteLine (e); - return 1; - } - - } else if (arg.StartsWith ("--api=")) { - - api_filename = arg.Substring (6); - - try { - Stream stream = File.OpenRead (api_filename); - api_doc.Load (stream); - stream.Close (); - } catch (XmlException e) { - Console.WriteLine ("Invalid api file."); - Console.WriteLine (e); - return 1; - } - - } else if (arg.StartsWith ("--symbols=")) { - - string symbol_filename = arg.Substring (10); - - try { - Stream stream = File.OpenRead (symbol_filename); - symbol_doc.Load (stream); - stream.Close (); - } catch (XmlException e) { - Console.WriteLine ("Invalid api file."); - Console.WriteLine (e); - return 1; - } - - } else { - Console.WriteLine ("Usage: gapi-fixup --metadata= --api="); - return 1; - } - } - - XPathNavigator meta_nav = meta_doc.CreateNavigator (); - XPathNavigator api_nav = api_doc.CreateNavigator (); - - XPathNodeIterator copy_iter = meta_nav.Select ("/metadata/copy-node"); - while (copy_iter.MoveNext ()) { - string path = copy_iter.Current.GetAttribute ("path", String.Empty); - XPathExpression expr = api_nav.Compile (path); - string parent = copy_iter.Current.Value; - XPathNodeIterator parent_iter = api_nav.Select (parent); - bool matched = false; - while (parent_iter.MoveNext ()) { - XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode (); - XPathNodeIterator path_iter = parent_iter.Current.Clone ().Select (expr); - while (path_iter.MoveNext ()) { - XmlNode node = ((IHasXmlNode)path_iter.Current).GetNode (); - parent_node.AppendChild (node.Clone ()); - } - matched = true; - } - if (!matched) - Console.WriteLine ("Warning: matched no nodes", path); - } - - XPathNodeIterator rmv_iter = meta_nav.Select ("/metadata/remove-node"); - while (rmv_iter.MoveNext ()) { - string path = rmv_iter.Current.GetAttribute ("path", ""); - XPathNodeIterator api_iter = api_nav.Select (path); - bool matched = false; - while (api_iter.MoveNext ()) { - XmlElement api_node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement; - api_node.ParentNode.RemoveChild (api_node); - matched = true; - } - if (!matched) - Console.WriteLine ("Warning: matched no nodes", path); - } - - XPathNodeIterator add_iter = meta_nav.Select ("/metadata/add-node"); - while (add_iter.MoveNext ()) { - string path = add_iter.Current.GetAttribute ("path", ""); - XPathNodeIterator api_iter = api_nav.Select (path); - bool matched = false; - while (api_iter.MoveNext ()) { - XmlElement api_node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement; - foreach (XmlNode child in ((IHasXmlNode)add_iter.Current).GetNode().ChildNodes) - api_node.AppendChild (api_doc.ImportNode (child, true)); - matched = true; - } - if (!matched) - Console.WriteLine ("Warning: 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: matched no nodes", path); - } - - - XPathNodeIterator attr_iter = meta_nav.Select ("/metadata/attr"); - while (attr_iter.MoveNext ()) { - string path = attr_iter.Current.GetAttribute ("path", ""); - string attr_name = 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.SetAttribute (attr_name, attr_iter.Current.Value); - matched = true; - } - if (!matched) - Console.WriteLine ("Warning: matched no nodes", path); - } - - XPathNodeIterator move_iter = meta_nav.Select ("/metadata/move-node"); - while (move_iter.MoveNext ()) { - string path = move_iter.Current.GetAttribute ("path", ""); - XPathExpression expr = api_nav.Compile (path); - string parent = move_iter.Current.Value; - XPathNodeIterator parent_iter = api_nav.Select (parent); - bool matched = false; - while (parent_iter.MoveNext ()) { - XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode (); - XPathNodeIterator path_iter = parent_iter.Current.Clone ().Select (expr); - while (path_iter.MoveNext ()) { - XmlNode node = ((IHasXmlNode)path_iter.Current).GetNode (); - parent_node.AppendChild (node.Clone ()); - node.ParentNode.RemoveChild (node); - } - matched = true; - } - if (!matched) - Console.WriteLine ("Warning: 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: matched no nodes", path); - } - - if (symbol_doc != null) { - XPathNavigator symbol_nav = symbol_doc.CreateNavigator (); - XPathNodeIterator iter = symbol_nav.Select ("/api/*"); - while (iter.MoveNext ()) { - XmlNode sym_node = ((IHasXmlNode)iter.Current).GetNode (); - XPathNodeIterator parent_iter = api_nav.Select ("/api"); - if (parent_iter.MoveNext ()) { - XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode (); - parent_node.AppendChild (api_doc.ImportNode (sym_node, true)); - } - } - } - - api_doc.Save (api_filename); - return 0; - } - } -} +// gapi-fixup.cs - xml alteration engine. +// +// Authors: +// Mike Kestner +// Stephan Sundermann +// +// Copyright (c) 2003 Mike Kestner +// Copyright (c) 2013 Stephan Sundermann +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the 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 +// General Public License for more details. +// +// You should have received a copy of the GNU 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 GtkSharp.Parsing { + + using System; + using System.IO; + using System.Xml; + using System.Xml.XPath; + + public class Fixup { + + public static int Main (string[] args) + { + if (args.Length < 2) { + Console.WriteLine ("Usage: gapi-fixup --metadata= --api= --symbols="); + return 0; + } + + string api_filename = ""; + XmlDocument api_doc = new XmlDocument (); + XmlDocument meta_doc = new XmlDocument (); + XmlDocument symbol_doc = new XmlDocument (); + + foreach (string arg in args) { + + if (arg.StartsWith("--metadata=")) { + + string meta_filename = arg.Substring (11); + + try { + Stream stream = File.OpenRead (meta_filename); + meta_doc.Load (stream); + stream.Close (); + } catch (XmlException e) { + Console.WriteLine ("Invalid meta file."); + Console.WriteLine (e); + return 1; + } + + } else if (arg.StartsWith ("--api=")) { + + api_filename = arg.Substring (6); + + try { + Stream stream = File.OpenRead (api_filename); + api_doc.Load (stream); + stream.Close (); + } catch (XmlException e) { + Console.WriteLine ("Invalid api file."); + Console.WriteLine (e); + return 1; + } + + } else if (arg.StartsWith ("--symbols=")) { + + string symbol_filename = arg.Substring (10); + + try { + Stream stream = File.OpenRead (symbol_filename); + symbol_doc.Load (stream); + stream.Close (); + } catch (XmlException e) { + Console.WriteLine ("Invalid api file."); + Console.WriteLine (e); + return 1; + } + + } else { + Console.WriteLine ("Usage: gapi-fixup --metadata= --api="); + return 1; + } + } + + XPathNavigator meta_nav = meta_doc.CreateNavigator (); + XPathNavigator api_nav = api_doc.CreateNavigator (); + + XPathNodeIterator copy_iter = meta_nav.Select ("/metadata/copy-node"); + while (copy_iter.MoveNext ()) { + string path = copy_iter.Current.GetAttribute ("path", String.Empty); + XPathExpression expr = api_nav.Compile (path); + string parent = copy_iter.Current.Value; + XPathNodeIterator parent_iter = api_nav.Select (parent); + bool matched = false; + while (parent_iter.MoveNext ()) { + XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode (); + XPathNodeIterator path_iter = parent_iter.Current.Clone ().Select (expr); + while (path_iter.MoveNext ()) { + XmlNode node = ((IHasXmlNode)path_iter.Current).GetNode (); + parent_node.AppendChild (node.Clone ()); + } + matched = true; + } + if (!matched) + Console.WriteLine ("Warning: matched no nodes", path); + } + + XPathNodeIterator rmv_iter = meta_nav.Select ("/metadata/remove-node"); + while (rmv_iter.MoveNext ()) { + string path = rmv_iter.Current.GetAttribute ("path", ""); + XPathNodeIterator api_iter = api_nav.Select (path); + bool matched = false; + while (api_iter.MoveNext ()) { + XmlElement api_node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement; + api_node.ParentNode.RemoveChild (api_node); + matched = true; + } + if (!matched) + Console.WriteLine ("Warning: matched no nodes", path); + } + + XPathNodeIterator add_iter = meta_nav.Select ("/metadata/add-node"); + while (add_iter.MoveNext ()) { + string path = add_iter.Current.GetAttribute ("path", ""); + XPathNodeIterator api_iter = api_nav.Select (path); + bool matched = false; + while (api_iter.MoveNext ()) { + XmlElement api_node = ((IHasXmlNode)api_iter.Current).GetNode () as XmlElement; + foreach (XmlNode child in ((IHasXmlNode)add_iter.Current).GetNode().ChildNodes) + api_node.AppendChild (api_doc.ImportNode (child, true)); + matched = true; + } + if (!matched) + Console.WriteLine ("Warning: 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: matched no nodes", path); + } + + + XPathNodeIterator attr_iter = meta_nav.Select ("/metadata/attr"); + while (attr_iter.MoveNext ()) { + string path = attr_iter.Current.GetAttribute ("path", ""); + string attr_name = 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.SetAttribute (attr_name, attr_iter.Current.Value); + matched = true; + } + if (!matched) + Console.WriteLine ("Warning: matched no nodes", path); + } + + XPathNodeIterator move_iter = meta_nav.Select ("/metadata/move-node"); + while (move_iter.MoveNext ()) { + string path = move_iter.Current.GetAttribute ("path", ""); + XPathExpression expr = api_nav.Compile (path); + string parent = move_iter.Current.Value; + XPathNodeIterator parent_iter = api_nav.Select (parent); + bool matched = false; + while (parent_iter.MoveNext ()) { + XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode (); + XPathNodeIterator path_iter = parent_iter.Current.Clone ().Select (expr); + while (path_iter.MoveNext ()) { + XmlNode node = ((IHasXmlNode)path_iter.Current).GetNode (); + parent_node.AppendChild (node.Clone ()); + node.ParentNode.RemoveChild (node); + } + matched = true; + } + if (!matched) + Console.WriteLine ("Warning: 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: matched no nodes", path); + } + + if (symbol_doc != null) { + XPathNavigator symbol_nav = symbol_doc.CreateNavigator (); + XPathNodeIterator iter = symbol_nav.Select ("/api/*"); + while (iter.MoveNext ()) { + XmlNode sym_node = ((IHasXmlNode)iter.Current).GetNode (); + XPathNodeIterator parent_iter = api_nav.Select ("/api"); + if (parent_iter.MoveNext ()) { + XmlNode parent_node = ((IHasXmlNode)parent_iter.Current).GetNode (); + parent_node.AppendChild (api_doc.ImportNode (sym_node, true)); + } + } + } + + api_doc.Save (api_filename); + return 0; + } + } +} diff --git a/parser/gapi-parser.cs b/parser/gapi-parser.cs index 56ba5c503..395e827c2 100644 --- a/parser/gapi-parser.cs +++ b/parser/gapi-parser.cs @@ -1,170 +1,170 @@ -// gapi-parser.cs - parsing driver application. -// -// Author: Mike Kestner -// -// Copyright (c) 2005 Novell, Inc. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the 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 -// General Public License for more details. -// -// You should have received a copy of the GNU 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 GtkSharp.Parsing { - - using System; - using System.Collections; - using System.IO; - using System.Runtime.InteropServices; - using System.Xml; - - public class Parser { - - [DllImport ("libc")] - static extern int system (string command); - - public static int Main (string[] args) - { - if (args.Length != 1) { - Console.WriteLine ("Usage: gapi2-parser "); - return 0; - } - - XmlDocument src_doc = new XmlDocument (); - - try { - using (Stream stream = File.OpenRead (args [0])) - src_doc.Load (stream); - } catch (XmlException e) { - Console.WriteLine ("Couldn't open source file."); - Console.WriteLine (e); - return 1; - } - - XmlNode root = src_doc.DocumentElement; - if (root.Name != "gapi-parser-input") { - Console.WriteLine ("Improperly formatted input file: " + args [0]); - return 1; - } - - foreach (XmlNode apinode in root.ChildNodes) { - if (apinode.Name != "api") - continue; - - string outfile = (apinode as XmlElement).GetAttribute ("filename"); - string prefile = outfile + ".pre"; - - if (File.Exists (prefile)) - File.Delete (prefile); - - foreach (XmlNode libnode in apinode.ChildNodes) { - if (libnode.Name != "library") - continue; - - string lib = (libnode as XmlElement).GetAttribute ("name"); - - foreach (XmlNode nsnode in libnode.ChildNodes) { - if (nsnode.Name != "namespace") - continue; - - string ns = (nsnode as XmlElement).GetAttribute ("name"); - - ArrayList files = new ArrayList (); - Hashtable excludes = new Hashtable (); - - foreach (XmlNode srcnode in nsnode.ChildNodes) { - if (!(srcnode is XmlElement)) - continue; - - XmlElement elem = srcnode as XmlElement; - - switch (srcnode.Name) { - case "dir": - string dir = elem.InnerXml; - Console.Write (" ", dir); - DirectoryInfo di = new DirectoryInfo (dir); - foreach (FileInfo file in di.GetFiles ("*.c")) - files.Add (dir + Path.DirectorySeparatorChar + file.Name); - foreach (FileInfo file in di.GetFiles ("*.h")) - files.Add (dir + Path.DirectorySeparatorChar + file.Name); - break; - case "file": - string incfile = elem.InnerXml; - Console.Write (" ", incfile); - files.Add (incfile); - break; - case "exclude": - string excfile = elem.InnerXml; - Console.Write (" ", excfile); - excludes [excfile] = 1; - break; - case "directory": - string dir_path = elem.GetAttribute ("path"); - Console.Write (" "); - break; - default: - Console.WriteLine ("Invalid source: " + srcnode.Name); - break; - } - } - - Console.WriteLine (); - - if (files.Count == 0) - continue; - - ArrayList realfiles = new ArrayList (); - foreach (string file in files) { - string trimfile = file.TrimEnd (); - if (excludes.Contains (trimfile)) - continue; - - realfiles.Add (trimfile); - } - - string[] filenames = (string[]) realfiles.ToArray (typeof (string)); - string pp_args = String.Join (" ", filenames); - system ("gapi_pp.pl " + pp_args + " | gapi2xml.pl " + ns + " " + prefile + " " + lib); - } - } - - XmlDocument final = new XmlDocument (); - final.Load (prefile); - XmlTextWriter writer = new XmlTextWriter (outfile, null); - writer.Formatting = Formatting.Indented; - final.Save (writer); - File.Delete (prefile); - } - - return 0; - } - } -} +// gapi-parser.cs - parsing driver application. +// +// Author: Mike Kestner +// +// Copyright (c) 2005 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the 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 +// General Public License for more details. +// +// You should have received a copy of the GNU 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 GtkSharp.Parsing { + + using System; + using System.Collections; + using System.IO; + using System.Runtime.InteropServices; + using System.Xml; + + public class Parser { + + [DllImport ("libc")] + static extern int system (string command); + + public static int Main (string[] args) + { + if (args.Length != 1) { + Console.WriteLine ("Usage: gapi2-parser "); + return 0; + } + + XmlDocument src_doc = new XmlDocument (); + + try { + using (Stream stream = File.OpenRead (args [0])) + src_doc.Load (stream); + } catch (XmlException e) { + Console.WriteLine ("Couldn't open source file."); + Console.WriteLine (e); + return 1; + } + + XmlNode root = src_doc.DocumentElement; + if (root.Name != "gapi-parser-input") { + Console.WriteLine ("Improperly formatted input file: " + args [0]); + return 1; + } + + foreach (XmlNode apinode in root.ChildNodes) { + if (apinode.Name != "api") + continue; + + string outfile = (apinode as XmlElement).GetAttribute ("filename"); + string prefile = outfile + ".pre"; + + if (File.Exists (prefile)) + File.Delete (prefile); + + foreach (XmlNode libnode in apinode.ChildNodes) { + if (libnode.Name != "library") + continue; + + string lib = (libnode as XmlElement).GetAttribute ("name"); + + foreach (XmlNode nsnode in libnode.ChildNodes) { + if (nsnode.Name != "namespace") + continue; + + string ns = (nsnode as XmlElement).GetAttribute ("name"); + + ArrayList files = new ArrayList (); + Hashtable excludes = new Hashtable (); + + foreach (XmlNode srcnode in nsnode.ChildNodes) { + if (!(srcnode is XmlElement)) + continue; + + XmlElement elem = srcnode as XmlElement; + + switch (srcnode.Name) { + case "dir": + string dir = elem.InnerXml; + Console.Write (" ", dir); + DirectoryInfo di = new DirectoryInfo (dir); + foreach (FileInfo file in di.GetFiles ("*.c")) + files.Add (dir + Path.DirectorySeparatorChar + file.Name); + foreach (FileInfo file in di.GetFiles ("*.h")) + files.Add (dir + Path.DirectorySeparatorChar + file.Name); + break; + case "file": + string incfile = elem.InnerXml; + Console.Write (" ", incfile); + files.Add (incfile); + break; + case "exclude": + string excfile = elem.InnerXml; + Console.Write (" ", excfile); + excludes [excfile] = 1; + break; + case "directory": + string dir_path = elem.GetAttribute ("path"); + Console.Write (" "); + break; + default: + Console.WriteLine ("Invalid source: " + srcnode.Name); + break; + } + } + + Console.WriteLine (); + + if (files.Count == 0) + continue; + + ArrayList realfiles = new ArrayList (); + foreach (string file in files) { + string trimfile = file.TrimEnd (); + if (excludes.Contains (trimfile)) + continue; + + realfiles.Add (trimfile); + } + + string[] filenames = (string[]) realfiles.ToArray (typeof (string)); + string pp_args = String.Join (" ", filenames); + system ("gapi_pp.pl " + pp_args + " | gapi2xml.pl " + ns + " " + prefile + " " + lib); + } + } + + XmlDocument final = new XmlDocument (); + final.Load (prefile); + XmlTextWriter writer = new XmlTextWriter (outfile, null); + writer.Formatting = Formatting.Indented; + final.Save (writer); + File.Delete (prefile); + } + + return 0; + } + } +} From 1dd10af29058600401b6cc491343cf483dcfc148 Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Mon, 25 May 2015 17:03:31 +0200 Subject: [PATCH 5/6] Add a .gitattributes file to have git keep CRLF endings in *.sln files --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..19dde7c96 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Declare files that will always have CRLF line endings on checkout. +*.sln text eol=crlf From 89b2dae6d82bfb22ee8641e5bbd6d42dcbab8c17 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Wed, 14 Jan 2015 15:41:45 +0100 Subject: [PATCH 6/6] sample: Fix compilation of opaque and val tests on osx Using regular expressions for targets is not supported, that's why now a generated-stamp is used to determine whether the files have been generated. This bug might not be related to osx but newer automake versions at least >= 1.14.1 --- sample/opaquetest/Makefile.am | 13 ++++++++----- sample/valtest/Makefile.am | 9 ++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sample/opaquetest/Makefile.am b/sample/opaquetest/Makefile.am index f1065acbd..5f8a40a4c 100644 --- a/sample/opaquetest/Makefile.am +++ b/sample/opaquetest/Makefile.am @@ -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 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) libopaque_la_SOURCES = \ @@ -17,11 +17,13 @@ libopaque_la_LIBADD = $(GTK_LIBS) 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 \ - --include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \ - --outdir=generated --assembly-name=opaque-sharp \ - --schema=$(top_srcdir)/gapi.xsd + --include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \ + --outdir=generated --assembly-name=opaque-sharp \ + --schema=$(top_srcdir)/gapi.xsd \ + && touch generated-stamp api: PATH=../../parser:$(PATH) $(RUNTIME) ../../parser/gapi-parser.exe opaque-sources.xml @@ -32,6 +34,7 @@ install: CLEANFILES = \ opaquetest.exe \ opaquetest.exe.mdb \ + generated-stamp \ $(GENERATED_SOURCES_FILES) EXTRA_DIST = \ diff --git a/sample/valtest/Makefile.am b/sample/valtest/Makefile.am index 48399eeda..e910f46f2 100644 --- a/sample/valtest/Makefile.am +++ b/sample/valtest/Makefile.am @@ -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 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) libvalobj_la_SOURCES = \ @@ -17,11 +17,13 @@ libvalobj_la_LIBADD = $(GTK_LIBS) 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 \ --include=../../gtk/gtk-api.xml --include=../../gdk/gdk-api.xml \ --outdir=generated --assembly-name=valobj-sharp \ - --schema=$(top_srcdir)/gapi.xsd + --schema=$(top_srcdir)/gapi.xsd && \ + touch generated-stamp api: PATH=../../parser:$(PATH) $(RUNTIME) ../../parser/gapi-parser.exe valobj-sources.xml @@ -31,6 +33,7 @@ install: CLEANFILES = \ valtest.exe \ valtest.exe.mdb \ + generated-stamp \ $(GENERATED_SOURCES_FILES) EXTRA_DIST = \