Permalink
Browse files

[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.
  • Loading branch information...
1 parent d68c31a commit bd920a15f291598a367b227a492d3b280d4bd9be @thefiddler thefiddler committed Mar 31, 2014
Showing with 22 additions and 16 deletions.
  1. +12 −11 Source/Bind/CSharpSpecWriter.cs
  2. +7 −2 Source/Bind/DocProcessor.cs
  3. +3 −3 Source/Bind/Settings.cs
@@ -297,16 +297,16 @@ void WriteDocumentation(BindStreamWriter sw, Function f)
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("/// </summary>");
- }
- else
- {
- sw.WriteLine(WriteOptions.NoIndent, "</summary>");
- }
+ }
+ if (!String.IsNullOrEmpty(docs.Summary))
+ {
+ sw.WriteLine();
+ sw.WriteLine("/// {0}", docs.Summary);
+ sw.WriteLine("/// </summary>");
+ }
+ else
+ {
+ sw.WriteLine(WriteOptions.NoIndent, "</summary>");
}
// Write function parameters
@@ -332,7 +332,8 @@ void WriteDocumentation(BindStreamWriter sw, Function f)
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}'",
@@ -41,9 +41,14 @@ public DocProcessor(IBind generator)
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);
+ }
}
}
@@ -23,7 +23,7 @@ public Settings()
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,15 +34,15 @@ public Settings()
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<Legacy> compatibility;
public string InputPath { get { return inputPath ?? DefaultInputPath; } set { inputPath = value; } }
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; } }

0 comments on commit bd920a1

Please sign in to comment.