From bd920a15f291598a367b227a492d3b280d4bd9be Mon Sep 17 00:00:00 2001 From: thefiddler Date: Mon, 31 Mar 2014 17:40:15 +0200 Subject: [PATCH] [Bind] Corrected CSharpSpecWriter output and warning messages CSharpSpecWriter now correctly outputs doc summaries on ARB_imaging functions that do not have a version/deprecation string. Additionally, it no longer warns about documentation parameter mismatches for parameters matching C# keywords. --- Source/Bind/CSharpSpecWriter.cs | 23 ++++++++++++----------- Source/Bind/DocProcessor.cs | 9 +++++++-- Source/Bind/Settings.cs | 6 +++--- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Source/Bind/CSharpSpecWriter.cs b/Source/Bind/CSharpSpecWriter.cs index 9dce2ec2..86273a83 100644 --- a/Source/Bind/CSharpSpecWriter.cs +++ b/Source/Bind/CSharpSpecWriter.cs @@ -297,16 +297,16 @@ namespace Bind if (!String.IsNullOrEmpty(category) || !String.IsNullOrEmpty(warning)) { sw.Write(WriteOptions.NoIndent, "{0}{1}", category, warning); - if (!String.IsNullOrEmpty(docs.Summary)) - { - sw.WriteLine(); - sw.WriteLine("/// {0}", docs.Summary); - sw.WriteLine("/// "); - } - else - { - sw.WriteLine(WriteOptions.NoIndent, ""); - } + } + if (!String.IsNullOrEmpty(docs.Summary)) + { + sw.WriteLine(); + sw.WriteLine("/// {0}", docs.Summary); + sw.WriteLine("/// "); + } + else + { + sw.WriteLine(WriteOptions.NoIndent, ""); } // Write function parameters @@ -332,7 +332,8 @@ namespace Bind if (docparam != null) { - if (docparam.Name != param.RawName) + if (docparam.Name != param.RawName && + docparam.Name != param.RawName.Substring(1)) // '@ref' -> 'ref' etc { Console.Error.WriteLine( "[Warning] Parameter '{0}' in function '{1}' has incorrect doc name '{2}'", diff --git a/Source/Bind/DocProcessor.cs b/Source/Bind/DocProcessor.cs index 3e926d2b..c8d76eef 100644 --- a/Source/Bind/DocProcessor.cs +++ b/Source/Bind/DocProcessor.cs @@ -41,9 +41,14 @@ namespace Bind throw new ArgumentNullException(); Generator = generator; - foreach (string file in Directory.GetFiles(Settings.DocPath)) + foreach (string file in Directory.GetFiles(Settings.DocPath).Concat( + Directory.GetFiles(Settings.FallbackDocPath))) { - DocumentationFiles.Add(Path.GetFileName(file), file); + var name = Path.GetFileName(file); + if (!DocumentationFiles.ContainsKey(name)) + { + DocumentationFiles.Add(name, file); + } } } diff --git a/Source/Bind/Settings.cs b/Source/Bind/Settings.cs index c6fbd1cf..38c1bcf7 100644 --- a/Source/Bind/Settings.cs +++ b/Source/Bind/Settings.cs @@ -23,7 +23,7 @@ namespace Bind public string DefaultOutputPath = "../../../Source/OpenTK/Graphics/OpenGL"; public string DefaultOutputNamespace = "OpenTK.Graphics.OpenGL"; public string DefaultDocPath = "../../../Source/Bind/Specifications/Docs"; - public string DefaultDocFile = "ToInlineDocs.xslt"; + public string DefaultFallbackDocPath = "../../../Source/Bind/Specifications/Docs/GL"; public string DefaultLicenseFile = "License.txt"; public string DefaultOverridesFile = "GL2/gloverrides.xml"; public string DefaultLanguageTypeMapFile = "csharp.tm"; @@ -34,7 +34,7 @@ namespace Bind public string DefaultWrappersFile = "GL.cs"; public Legacy DefaultCompatibility = Legacy.NoDropMultipleTokens; - string inputPath, outputPath, outputNamespace, docPath, docFile, licenseFile, overridesFile, + string inputPath, outputPath, outputNamespace, docPath, fallbackDocPath, licenseFile, overridesFile, languageTypeMapFile, keywordEscapeCharacter, importsFile, delegatesFile, enumsFile, wrappersFile; Nullable compatibility; @@ -42,7 +42,7 @@ namespace Bind public string OutputPath { get { return outputPath ?? DefaultOutputPath; } set { outputPath = value; } } public string OutputNamespace { get { return outputNamespace ?? DefaultOutputNamespace; } set { outputNamespace = value; } } public string DocPath { get { return docPath ?? DefaultDocPath; } set { docPath = value; } } - public string DocFile { get { return docFile ?? DefaultDocFile; } set { docFile = value; } } + public string FallbackDocPath { get { return fallbackDocPath ?? DefaultFallbackDocPath; } set { fallbackDocPath = value; } } public string LicenseFile { get { return licenseFile ?? DefaultLicenseFile; } set { licenseFile = value; } } public string OverridesFile { get { return overridesFile ?? DefaultOverridesFile; } set { overridesFile = value; } } public string LanguageTypeMapFile { get { return languageTypeMapFile ?? DefaultLanguageTypeMapFile; } set { languageTypeMapFile = value; } }