Merge pull request #623 from Nihlus/enable-xml-doc-output

Enable XML documentation output for supporting projects
This commit is contained in:
Jarl Gullberg 2017-08-14 19:11:07 +02:00 committed by GitHub
commit df9cd1d2f1
9 changed files with 76 additions and 12 deletions

View file

@ -49,6 +49,7 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE;</DefineConstants> <DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>bin\Debug\Bind.xml</DocumentationFile>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize> <Optimize>False</Optimize>
@ -63,6 +64,7 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants> <DefineConstants>TRACE;</DefineConstants>
<DocumentationFile>bin\Release\Bind.xml</DocumentationFile>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>

View file

@ -108,7 +108,6 @@ namespace Bind.Structures
/// </summary> /// </summary>
/// <param name="c">The Constant to translate</param> /// <param name="c">The Constant to translate</param>
/// <param name="enums">The list of enums to check.</param> /// <param name="enums">The list of enums to check.</param>
/// <param name="auxEnums">The list of auxilliary enums to check.</param>
/// <returns>True if the reference was found; false otherwise.</returns> /// <returns>True if the reference was found; false otherwise.</returns>
public static bool TranslateConstantWithReference(Constant c, EnumCollection enums) public static bool TranslateConstantWithReference(Constant c, EnumCollection enums)
{ {

View file

@ -25,14 +25,25 @@
namespace Bind.Structures namespace Bind.Structures
{ {
/// <summary>
/// Enumarates the possible flows of a parameter (ie. is this parameter
/// used as input or as output?)
/// </summary>
public enum FlowDirection
{
/// <summary> /// <summary>
/// Enumarates the possible flows of a parameter (ie. is this parameter /// No defined flow.
/// used as input or as output?)
/// </summary> /// </summary>
public enum FlowDirection Undefined = 0,
{
Undefined = 0, /// <summary>
In, /// Input parameter.
Out /// </summary>
} In,
/// <summary>
/// Output parameter, typically decorated with the out keyword.
/// </summary>
Out
}
} }

View file

@ -92,12 +92,23 @@ namespace Bind.Structures
} }
} }
/// <summary>
/// The <see cref="FunctionBody"/> class acts as a wrapper around a block of source code that makes up the body
/// of a function.
/// </summary>
public class FunctionBody : List<string> public class FunctionBody : List<string>
{ {
/// <summary>
/// Initializes an empty <see cref="FunctionBody"/>.
/// </summary>
public FunctionBody() public FunctionBody()
{ {
} }
/// <summary>
/// Initializes a <see cref="FunctionBody"/> from an existing FunctionBody.
/// </summary>
/// <param name="fb">The body to copy from.</param>
public FunctionBody(FunctionBody fb) public FunctionBody(FunctionBody fb)
{ {
foreach (string s in fb) foreach (string s in fb)
@ -108,11 +119,17 @@ namespace Bind.Structures
private string indent = ""; private string indent = "";
/// <summary>
/// Indents this <see cref="FunctionBody"/> another level.
/// </summary>
public void Indent() public void Indent()
{ {
indent += " "; indent += " ";
} }
/// <summary>
/// Removes a level of indentation from this <see cref="FunctionBody"/>.
/// </summary>
public void Unindent() public void Unindent()
{ {
if (indent.Length > 4) if (indent.Length > 4)
@ -125,11 +142,19 @@ namespace Bind.Structures
} }
} }
/// <summary>
/// Adds a line of source code to the body at the current indentation level.
/// </summary>
/// <param name="s">The line to add.</param>
new public void Add(string s) new public void Add(string s)
{ {
base.Add(indent + s.TrimEnd('\r', '\n')); base.Add(indent + s.TrimEnd('\r', '\n'));
} }
/// <summary>
/// Adds a range of source code lines to the body at the current indentation level.
/// </summary>
/// <param name="collection"></param>
new public void AddRange(IEnumerable<string> collection) new public void AddRange(IEnumerable<string> collection)
{ {
foreach (string t in collection) foreach (string t in collection)
@ -138,6 +163,10 @@ namespace Bind.Structures
} }
} }
/// <summary>
/// Builds the contents of the function body into a string and encloses it with braces.
/// </summary>
/// <returns>The body, enclosed in braces.</returns>
public override string ToString() public override string ToString()
{ {
if (Count == 0) if (Count == 0)

View file

@ -13,6 +13,10 @@ using Enum=Bind.Structures.Enum;
namespace Bind namespace Bind
{ {
/// <summary>
/// Defines different types of parameter wrapper identifiers, which are used for hinting at how the method
/// signatures should be generated.
/// </summary>
[Flags] [Flags]
public enum WrapperTypes public enum WrapperTypes
{ {

View file

@ -48,6 +48,7 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE;</DefineConstants> <DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>bin\Debug\Convert.xml</DocumentationFile>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize> <Optimize>False</Optimize>
@ -63,6 +64,7 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants> <DefineConstants>TRACE;</DefineConstants>
<DocumentationFile>bin\Release\Convert.xml</DocumentationFile>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>

View file

@ -4,23 +4,38 @@ using CommandLine.Text;
namespace OpenTK.Convert namespace OpenTK.Convert
{ {
/// <summary>
/// A container class used by <see cref="CommandLine.Parser"/> to parse command line arguments.
/// </summary>
public class Options public class Options
{ {
/// <summary>
/// Gets or sets the prefix to remove from parsed functions and constants.
/// </summary>
[Option('p', "prefix", [Option('p', "prefix",
HelpText = "The prefix to remove from parsed functions and constants.", HelpText = "The prefix to remove from parsed functions and constants.",
Required = true, Required = true,
Default = "gl")] Default = "gl")]
public string Prefix { get; set; } public string Prefix { get; set; }
/// <summary>
/// Gets or sets the path to the output file. Defaults to stdout if no path is provided.
/// </summary>
[Option('o', "output-file", [Option('o', "output-file",
HelpText = "The path to the output file. Defaults to stdout if no path is provided.")] HelpText = "The path to the output file. Defaults to stdout if no path is provided.")]
public string OutputFile { get; set; } public string OutputFile { get; set; }
/// <summary>
/// Gets or sets a list of the Khronos XML files to parse into OpenTK XML. Remote resources in the form of URLs are supported.
/// </summary>
[Option('i', "input-files", [Option('i', "input-files",
HelpText = "A list of the Khronos XML files to parse into OpenTK XML. Remote resources in the form of URLs are supported.", HelpText = "A list of the Khronos XML files to parse into OpenTK XML. Remote resources in the form of URLs are supported.",
Required = true)] Required = true)]
public IEnumerable<string> InputFiles { get; set; } public IEnumerable<string> InputFiles { get; set; }
/// <summary>
/// Gets a set of usage examples which can be shown to the user.
/// </summary>
[Usage(ApplicationAlias = "Convert.exe")] [Usage(ApplicationAlias = "Convert.exe")]
public static IEnumerable<Example> Examples public static IEnumerable<Example> Examples
{ {

View file

@ -4,7 +4,7 @@ using Mono.Cecil.Cil;
namespace OpenTK.Rewrite namespace OpenTK.Rewrite
{ {
/// <summary> /// <summary>
/// Acts as a unique identifier for a generated named variable that can be passed between methods. Replaces uses of /// Acts as a unique identifier for a generated named variable that can be passed between methods. Replaces uses of
/// variable names from Mono.Cecil. /// variable names from Mono.Cecil.
/// </summary> /// </summary>
internal sealed class GeneratedVariableIdentifier internal sealed class GeneratedVariableIdentifier
@ -13,7 +13,7 @@ namespace OpenTK.Rewrite
/// The <see cref="MethodBody"/> which the variable is in. /// The <see cref="MethodBody"/> which the variable is in.
/// </summary> /// </summary>
public MethodBody Body { get; } public MethodBody Body { get; }
/// <summary> /// <summary>
/// The <see cref="VariableDefinition"/> which the variable idetifier maps to. /// The <see cref="VariableDefinition"/> which the variable idetifier maps to.
/// </summary> /// </summary>
@ -28,8 +28,8 @@ namespace OpenTK.Rewrite
/// Initializes a new instance of the <see cref="GeneratedVariableIdentifier"/> class. /// Initializes a new instance of the <see cref="GeneratedVariableIdentifier"/> class.
/// </summary> /// </summary>
/// <param name="body">The method body which the variable is in.</param> /// <param name="body">The method body which the variable is in.</param>
/// <param name="definition">The definition of the generated variable.</param>
/// <param name="name">The name of the generated variable.</param> /// <param name="name">The name of the generated variable.</param>
/// <param name="index">The index of the generated variable in its method.</param>
/// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentException"></exception>
public GeneratedVariableIdentifier(MethodBody body, VariableDefinition definition, string name) public GeneratedVariableIdentifier(MethodBody body, VariableDefinition definition, string name)
{ {

View file

@ -24,6 +24,7 @@
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\Rewrite.xml</DocumentationFile>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Commandlineparameters>../../OpenTK/Debug/OpenTK.dll ../../../OpenTK.snk -debug</Commandlineparameters> <Commandlineparameters>../../OpenTK/Debug/OpenTK.dll ../../../OpenTK.snk -debug</Commandlineparameters>
@ -34,6 +35,7 @@
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<DocumentationFile>bin\Release\Rewrite.xml</DocumentationFile>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Commandlineparameters>../../OpenTK/Release/OpenTK.dll ../../../OpenTK.snk</Commandlineparameters> <Commandlineparameters>../../OpenTK/Release/OpenTK.dll ../../../OpenTK.snk</Commandlineparameters>