#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace Bind
{
static class Settings
{
// Disable BeforeFieldInit.
static Settings() { }
public const string DefaultInputPath = "../../Source/Bind/Specifications";
public const string DefaultOutputPath = "../../Source/OpenTK/Graphics/GL";
public const string DefaultOutputNamespace = "OpenTK.Graphics";
public const string DefaultDocPath = "../../Source/Bind/Specifications/Docs";
public const string DefaultDocFile = "ToInlineDocs.xslt";
public const string DefaultLicenseFile = "License.txt";
public static string InputPath = DefaultInputPath;
public static string OutputPath = DefaultOutputPath;
public static string OutputNamespace = DefaultOutputNamespace;
public static string DocPath = DefaultDocPath;
public static string DocFile = DefaultDocFile;
public static string LicenseFile = DefaultLicenseFile;
public static string GLClass = "GL"; // Needed by Glu for the AuxEnumsClass. Can be set through -gl:"xxx".
public static string OutputClass = "GL"; // The real output class. Can be set through -class:"xxx".
public static string FunctionPrefix = "gl";
public static string ConstantPrefix = "GL_";
public static string EnumPrefix = "";
// TODO: This code is too fragile.
// Old enums code:
public static string normalEnumsClassOverride = null;
public static string NestedEnumsClass = "Enums";
public static string NormalEnumsClass
{
get
{
return
normalEnumsClassOverride == null ?
String.IsNullOrEmpty(NestedEnumsClass) ? OutputClass : OutputClass + "." + NestedEnumsClass :
normalEnumsClassOverride;
}
}
public static string AuxEnumsClass
{
get { return GLClass + "." + NestedEnumsClass; }
}
public static string EnumsOutput
{
get
{
if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None)
return OutputNamespace + "." + OutputClass + "." + NestedEnumsClass;
else
return String.IsNullOrEmpty(EnumsNamespace) ? OutputNamespace : OutputNamespace + "." + EnumsNamespace;
}
}
public static string EnumsAuxOutput
{
get
{
if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None)
return OutputNamespace + "." + GLClass + "." + NestedEnumsClass;
else
return OutputNamespace + "." + EnumsNamespace;
}
}
// New enums namespace (don't use a nested class).
public static string EnumsNamespace = null;// = "Enums";
public static string DelegatesClass = "Delegates";
public static string ImportsClass = "Imports";
public static Legacy Compatibility = Legacy.NoDropMultipleTokens;
///
/// The name of the C# enum which holds every single OpenGL enum (for compatibility purposes).
///
public static string CompleteEnumName = "All";
[Flags]
public enum Legacy
{
/// Default value.
None = 0x00,
/// Leave enums as plain const ints.
ConstIntEnums = 0x01,
/// Leave enums in the default STRANGE_capitalization.ALL_CAPS form.
NoAdvancedEnumProcessing = 0x02,
/// Don't allow unsafe wrappers in the interface.
NoPublicUnsafeFunctions = 0x04,
/// Don't trim the [fdisub]v? endings from functions.
NoTrimFunctionEnding = NoPublicUnsafeFunctions,
/// Don't trim the [gl|wgl|glx|glu] prefixes from functions.
NoTrimFunctionPrefix = 0x08,
///
/// Don't spearate functions in different namespaces, according to their extension category
/// (e.g. GL.Arb, GL.Ext etc).
///
NoSeparateFunctionNamespaces = 0x10,
///
/// No public void* parameters (should always be enabled. Disable at your own risk. Disabling
/// means that BitmapData.Scan0 and other .Net properties/functions must be cast to (void*)
/// explicitly, to avoid the 'object' overload from being called.)
///
TurnVoidPointersToIntPtr = 0x20,
/// Generate all possible permutations for ref/array/pointer parameters.
GenerateAllPermutations = 0x40,
/// Nest enums inside the GL class.
NestedEnums = 0x80,
/// Turn GLboolean to int (Boolean enum), not bool.
NoBoolParameters = 0x100,
/// Keep all enum tokens, even if same value (e.g. FooARB, FooEXT and FooSGI).
NoDropMultipleTokens = 0x200,
/// Do not emit inline documentation.
NoDocumentation = 0x400,
/// Disables ErrorHelper generation.
NoDebugHelpers = 0x800,
Tao = ConstIntEnums |
NoAdvancedEnumProcessing |
NoPublicUnsafeFunctions |
NoTrimFunctionEnding |
NoTrimFunctionPrefix |
NoSeparateFunctionNamespaces |
TurnVoidPointersToIntPtr |
NestedEnums |
NoBoolParameters |
NoDropMultipleTokens |
NoDocumentation |
NoDebugHelpers
/*GenerateAllPermutations,*/
}
/// True if multiple tokens should be dropped (e.g. FooARB, FooEXT and FooSGI).
public static bool DropMultipleTokens
{
get { return (Settings.Compatibility & Legacy.NoDropMultipleTokens) == Legacy.None; }
set { if (value) Settings.Compatibility |= Legacy.NoDropMultipleTokens; else Settings.Compatibility &= ~Legacy.NoDropMultipleTokens; }
}
public static string WindowsGDI = "OpenTK.Platform.Windows.API";
}
}