Enforced use of explicit private modifiers.

This commit is contained in:
Jarl Gullberg 2017-07-07 17:40:24 +02:00
parent f1362eef2b
commit 5f2d3144c4
No known key found for this signature in database
GPG key ID: 750FF6F6BDA72D23
232 changed files with 39413 additions and 39317 deletions

View file

@ -31,20 +31,20 @@ using Enum=Bind.Structures.Enum;
namespace Bind
{
enum WriteOptions
internal enum WriteOptions
{
Default = 0,
NoIndent = 1
}
class BindStreamWriter : IDisposable
internal class BindStreamWriter : IDisposable
{
static readonly string[] SplitStrings = new string[] { System.Environment.NewLine };
readonly StreamWriter sw;
private static readonly string[] SplitStrings = new string[] { System.Environment.NewLine };
private readonly StreamWriter sw;
public readonly string File;
bool newline = true;
int indent_level = 0;
private bool newline = true;
private int indent_level = 0;
public BindStreamWriter(string file)
{
@ -139,7 +139,7 @@ namespace Bind
sw.Close();
}
void WriteIndentations(WriteOptions options)
private void WriteIndentations(WriteOptions options)
{
if (options != WriteOptions.NoIndent)
{

View file

@ -9,7 +9,7 @@ using Enum=Bind.Structures.Enum;
namespace Bind.CL
{
class CLGenerator : ES.ESGenerator
internal class CLGenerator : ES.ESGenerator
{
public CLGenerator(Settings settings)
: base(settings)

View file

@ -37,10 +37,10 @@ namespace Bind
using Enum = Bind.Structures.Enum;
using Type = Bind.Structures.Type;
sealed class CSharpSpecWriter
internal sealed class CSharpSpecWriter
{
IBind Generator { get; set; }
Settings Settings { get { return Generator.Settings; } }
private IBind Generator { get; set; }
private Settings Settings { get { return Generator.Settings; } }
public void WriteBindings(IBind generator)
{
@ -59,7 +59,7 @@ namespace Bind
Console.SetCursorPosition(left, top);
}
void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
private void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
{
Console.WriteLine("Writing bindings to {0}", Settings.OutputPath);
if (!Directory.Exists(Settings.OutputPath))
@ -133,7 +133,7 @@ namespace Bind
File.Move(temp_wrappers_file, output_wrappers);
}
void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers,
private void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers,
DelegateCollection delegates, EnumCollection enums,
IDictionary<string, string> CSTypes)
{
@ -244,7 +244,7 @@ namespace Bind
Console.WriteLine("Wrote {0} wrappers for {1} signatures", current_wrapper, current_signature);
}
void WriteWrapper(BindStreamWriter sw, Function f, EnumCollection enums)
private void WriteWrapper(BindStreamWriter sw, Function f, EnumCollection enums)
{
if ((Settings.Compatibility & Settings.Legacy.NoDocumentation) == 0)
{
@ -276,7 +276,7 @@ namespace Bind
sw.WriteLine("public static {0} {{ throw new NotImplementedException(); }}", GetDeclarationString(f, Settings.Compatibility));
}
void WriteDocumentation(BindStreamWriter sw, Function f)
private void WriteDocumentation(BindStreamWriter sw, Function f)
{
var docs = f.Documentation;
@ -393,7 +393,7 @@ namespace Bind
}
}
void WriteConstants(BindStreamWriter sw, IEnumerable<Constant> constants)
private void WriteConstants(BindStreamWriter sw, IEnumerable<Constant> constants)
{
// Make sure everything is sorted. This will avoid random changes between
// consecutive runs of the program.
@ -417,7 +417,7 @@ namespace Bind
}
}
void WriteEnums(BindStreamWriter sw, EnumCollection enums, FunctionCollection wrappers)
private void WriteEnums(BindStreamWriter sw, EnumCollection enums, FunctionCollection wrappers)
{
//sw.WriteLine("#pragma warning disable 3019"); // CLSCompliant attribute
//sw.WriteLine("#pragma warning disable 1591"); // Missing doc comments
@ -530,15 +530,16 @@ namespace Bind
// For example, if parameter foo has indirection level = 1, then it
// is consumed as 'foo*' in the fixed_statements and the call string.
readonly static string[] pointer_levels = new string[] { "", "*", "**", "***", "****" };
readonly static string[] array_levels = new string[] { "", "[]", "[,]", "[,,]", "[,,,]" };
private readonly static string[] pointer_levels = new string[] { "", "*", "**", "***", "****" };
static bool IsEnum(string s, EnumCollection enums)
private readonly static string[] array_levels = new string[] { "", "[]", "[,]", "[,,]", "[,,,]" };
private static bool IsEnum(string s, EnumCollection enums)
{
return enums.ContainsKey(s);
}
string GetDeclarationString(Constant c)
private string GetDeclarationString(Constant c)
{
if (String.IsNullOrEmpty(c.Name))
{
@ -554,7 +555,7 @@ namespace Bind
c.Value);
}
string GetDeclarationString(Delegate d, bool is_delegate)
private string GetDeclarationString(Delegate d, bool is_delegate)
{
StringBuilder sb = new StringBuilder();
@ -570,7 +571,7 @@ namespace Bind
return sb.ToString();
}
string GetDeclarationString(Enum e)
private string GetDeclarationString(Enum e)
{
StringBuilder sb = new StringBuilder();
List<Constant> constants = new List<Constant>(e.ConstantCollection.Values);
@ -603,7 +604,7 @@ namespace Bind
return sb.ToString();
}
string GetDeclarationString(Function f, Settings.Legacy settings)
private string GetDeclarationString(Function f, Settings.Legacy settings)
{
StringBuilder sb = new StringBuilder();
@ -646,7 +647,7 @@ namespace Bind
return sb.ToString();
}
string GetDeclarationString(Parameter p, bool override_unsafe_setting, Settings.Legacy settings)
private string GetDeclarationString(Parameter p, bool override_unsafe_setting, Settings.Legacy settings)
{
StringBuilder sb = new StringBuilder();
@ -687,7 +688,7 @@ namespace Bind
return sb.ToString();
}
string GetDeclarationString(ParameterCollection parameters, Settings.Legacy settings)
private string GetDeclarationString(ParameterCollection parameters, Settings.Legacy settings)
{
StringBuilder sb = new StringBuilder();
@ -709,7 +710,7 @@ namespace Bind
return sb.ToString();
}
string GetDeclarationString(Type type, Settings.Legacy settings)
private string GetDeclarationString(Type type, Settings.Legacy settings)
{
var t = type.QualifiedType;
if ((settings & Settings.Legacy.ConstIntEnums) != 0)

View file

@ -13,27 +13,31 @@ using Bind.Structures;
namespace Bind
{
class DocProcessor
internal class DocProcessor
{
static readonly char[] numbers = "0123456789".ToCharArray();
static readonly Regex remove_mathml = new Regex(
private static readonly char[] numbers = "0123456789".ToCharArray();
private static readonly Regex remove_mathml = new Regex(
@"<(mml:math|inlineequation)[^>]*?>(?:.|\n)*?</\s*\1\s*>",
RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
static readonly Regex remove_doctype = new Regex(
private static readonly Regex remove_doctype = new Regex(
@"<!DOCTYPE[^>\[]*(\[.*\])?>", RegexOptions.Compiled | RegexOptions.Multiline);
static readonly Regex remove_xmlns = new Regex(
private static readonly Regex remove_xmlns = new Regex(
"xmlns=\".+\"", RegexOptions.Compiled);
readonly Dictionary<string, string> DocumentationFiles =
private readonly Dictionary<string, string> DocumentationFiles =
new Dictionary<string, string>();
readonly Dictionary<string, Documentation> DocumentationCache =
private readonly Dictionary<string, Documentation> DocumentationCache =
new Dictionary<string, Documentation>();
Documentation Cached;
string LastFile;
private Documentation Cached;
private string LastFile;
IBind Generator { get; set; }
Settings Settings { get { return Generator.Settings; } }
private IBind Generator { get; set; }
private Settings Settings { get { return Generator.Settings; } }
public DocProcessor(IBind generator)
{
@ -87,7 +91,7 @@ namespace Bind
// found in the <!-- eqn: :--> comments in the docs.
// Todo: Some simple MathML tags do not include comments, find a solution.
// Todo: Some files include more than 1 function - find a way to map these extra functions.
Documentation ProcessFile(string file, EnumProcessor processor)
private Documentation ProcessFile(string file, EnumProcessor processor)
{
string text;
@ -148,7 +152,7 @@ namespace Bind
}
}
Documentation ToInlineDocs(XDocument doc, EnumProcessor enum_processor)
private Documentation ToInlineDocs(XDocument doc, EnumProcessor enum_processor)
{
if (doc == null || enum_processor == null)
throw new ArgumentNullException();
@ -190,8 +194,9 @@ namespace Bind
return inline;
}
static readonly char[] newline = new char[] { '\n' };
static string Cleanup(string text)
private static readonly char[] newline = new char[] { '\n' };
private static string Cleanup(string text)
{
return
String.Join(" ", text

View file

@ -10,7 +10,7 @@ using Enum=Bind.Structures.Enum;
namespace Bind.ES
{
// Generation implementation for OpenGL ES 2.0 and 3.0
class ES2Generator : Generator
internal class ES2Generator : Generator
{
public ES2Generator(Settings settings)
: base(settings)

View file

@ -10,7 +10,7 @@ using Enum=Bind.Structures.Enum;
namespace Bind.ES
{
// Generation implementation for OpenGL ES 3.1
class ES31Generator : Generator
internal class ES31Generator : Generator
{
public ES31Generator(Settings settings)
: base(settings)

View file

@ -10,7 +10,7 @@ using Enum=Bind.Structures.Enum;
namespace Bind.ES
{
// Generation implementation for OpenGL ES 3.0
class ES3Generator : Generator
internal class ES3Generator : Generator
{
public ES3Generator(Settings settings)
: base(settings)

View file

@ -10,7 +10,7 @@ using Enum=Bind.Structures.Enum;
namespace Bind.ES
{
// Generator implementation for OpenGL ES 1.0 and 1.1
class ESGenerator : Generator
internal class ESGenerator : Generator
{
public ESGenerator(Settings settings)
: base(settings)

View file

@ -35,12 +35,12 @@ using Enum = Bind.Structures.Enum;
namespace Bind
{
class EnumProcessor
internal class EnumProcessor
{
readonly IEnumerable<string> Overrides;
private readonly IEnumerable<string> Overrides;
IBind Generator { get; set; }
Settings Settings { get { return Generator.Settings; } }
private IBind Generator { get; set; }
private Settings Settings { get { return Generator.Settings; } }
public EnumProcessor(IBind generator, IEnumerable<string> overrides)
{
@ -85,7 +85,7 @@ namespace Bind
return path.ToString();
}
EnumCollection ProcessNames(EnumCollection enums, XPathNavigator nav, string apiname)
private EnumCollection ProcessNames(EnumCollection enums, XPathNavigator nav, string apiname)
{
EnumCollection processed_enums = new EnumCollection();
foreach (var e in enums.Values)
@ -121,7 +121,7 @@ namespace Bind
return processed_enums;
}
static string ReplaceName(XPathNavigator nav, string apiname, string name)
private static string ReplaceName(XPathNavigator nav, string apiname, string name)
{
var enum_override = nav.SelectSingleNode(GetOverridesPath(apiname, name));
if (enum_override != null)
@ -135,7 +135,7 @@ namespace Bind
return name;
}
static bool IsAlreadyProcessed(string name)
private static bool IsAlreadyProcessed(string name)
{
string extension = Utilities.GetExtension(name, true);
bool unprocessed = false;
@ -225,7 +225,7 @@ namespace Bind
return name;
}
EnumCollection ProcessConstants(EnumCollection enums, XPathNavigator nav, string apiname)
private EnumCollection ProcessConstants(EnumCollection enums, XPathNavigator nav, string apiname)
{
foreach (var e in enums.Values)
{
@ -258,7 +258,7 @@ namespace Bind
return enums;
}
static void ReplaceConstant(XPathNavigator enum_override, Constant c)
private static void ReplaceConstant(XPathNavigator enum_override, Constant c)
{
if (enum_override != null)
{
@ -362,7 +362,7 @@ namespace Bind
// (e.g. FOG_COORD_ARRAY_TYPE = GL_FOG_COORDINATE_ARRAY_TYPE)
// In this case try searching all enums for the correct constant to alias (stupid opengl specs).
// This turns every bare alias into a normal alias that is processed afterwards.
static void ResolveBareAlias(Constant c, EnumCollection enums)
private static void ResolveBareAlias(Constant c, EnumCollection enums)
{
// Constants are considered bare aliases when they don't have a reference and
// their values are non-numeric.
@ -383,7 +383,7 @@ namespace Bind
// Resolve 'use' tokens by searching and replacing the correct
// value from the enum collection.
// Tokens that can't be resolved are removed.
static void ResolveAliases(Enum e, EnumCollection enums)
private static void ResolveAliases(Enum e, EnumCollection enums)
{
// Note that we have the removal must be a separate step, since
// we cannot modify a collection while iterating with foreach.
@ -397,7 +397,7 @@ namespace Bind
}
}
static bool IsValue(string test)
private static bool IsValue(string test)
{
// Check if the result is a number.
long number;

View file

@ -39,23 +39,25 @@ namespace Bind
using Enum = Bind.Structures.Enum;
using Type = Bind.Structures.Type;
class FuncProcessor
internal class FuncProcessor
{
static readonly Regex Endings = new Regex(
private static readonly Regex Endings = new Regex(
@"([fd]v?|u?[isb](64)?v?|v|i_v|fi)$",
RegexOptions.Compiled);
static readonly Regex EndingsNotToTrim = new Regex(
private static readonly Regex EndingsNotToTrim = new Regex(
"(sh|ib|[tdrey]s|[eE]n[vd]|bled" +
"|Attrib|Access|Boolean|Coord|Depth|Feedbacks|Finish|Flag" +
"|Groups|IDs|Indexed|Instanced|Pixels|Queries|Status|Tess|Through" +
"|Uniforms|Varyings|Weight|Width)$",
RegexOptions.Compiled);
static readonly Regex EndingsAddV = new Regex("^0", RegexOptions.Compiled);
readonly IEnumerable<string> Overrides;
private static readonly Regex EndingsAddV = new Regex("^0", RegexOptions.Compiled);
IBind Generator { get; set; }
Settings Settings { get { return Generator.Settings; } }
private readonly IEnumerable<string> Overrides;
private IBind Generator { get; set; }
private Settings Settings { get { return Generator.Settings; } }
public FuncProcessor(IBind generator, IEnumerable<string> overrides)
{
@ -139,7 +141,7 @@ namespace Bind
return wrappers;
}
void GenerateDocumentation(FunctionCollection wrappers,
private void GenerateDocumentation(FunctionCollection wrappers,
EnumProcessor enum_processor, DocProcessor doc_processor)
{
foreach (var list in wrappers)
@ -152,7 +154,7 @@ namespace Bind
}
}
void GenerateAddressTable(DelegateCollection delegates)
private void GenerateAddressTable(DelegateCollection delegates)
{
// We allocate one slot per entry point. Rules:
// - All extensions get a slot
@ -191,7 +193,7 @@ namespace Bind
// the overloaded ones. This allows us to reduce the amount
// of delegates we need to generate (1 per entry point instead
// of 1 per overload), which improves loading times.
static void RemoveOverloadedDelegates(DelegateCollection delegates, FunctionCollection wrappers)
private static void RemoveOverloadedDelegates(DelegateCollection delegates, FunctionCollection wrappers)
{
foreach (var w in wrappers.Values.SelectMany(w => w))
{
@ -200,7 +202,7 @@ namespace Bind
}
}
static string GetPath(string apipath, string apiname, string apiversion, string function, string extension)
private static string GetPath(string apipath, string apiname, string apiversion, string function, string extension)
{
var path = new StringBuilder();
path.Append("/signatures/");
@ -246,17 +248,17 @@ namespace Bind
return path.ToString();
}
static string GetOverloadsPath(string apiname, string apiversion, string function, string extension)
private static string GetOverloadsPath(string apiname, string apiversion, string function, string extension)
{
return GetPath("overload", apiname, apiversion, function, extension);
}
static string GetOverridesPath(string apiname, string apiversion, string function, string extension)
private static string GetOverridesPath(string apiname, string apiversion, string function, string extension)
{
return GetPath("replace", apiname, apiversion, function, extension);
}
void TranslateType(Bind.Structures.Type type,
private void TranslateType(Bind.Structures.Type type,
XPathNavigator function_override, XPathNavigator overrides,
EnumProcessor enum_processor, EnumCollection enums,
string category, string apiname)
@ -375,7 +377,7 @@ namespace Bind
}
}
static string TranslateExtension(string extension)
private static string TranslateExtension(string extension)
{
extension = extension.ToUpper();
if (extension.Length > 2)
@ -385,12 +387,12 @@ namespace Bind
return extension;
}
void TranslateExtension(Delegate d)
private void TranslateExtension(Delegate d)
{
d.Extension = TranslateExtension(d.Extension);
}
static string GetTrimmedExtension(string name, string extension)
private static string GetTrimmedExtension(string name, string extension)
{
// Extensions are always uppercase
int index = name.LastIndexOf(extension.ToUpper());
@ -402,7 +404,7 @@ namespace Bind
}
// Trims unecessary suffices from the specified OpenGL function name.
static string GetTrimmedName(Delegate d)
private static string GetTrimmedName(Delegate d)
{
string name = d.Name;
string extension = d.Extension;
@ -441,7 +443,7 @@ namespace Bind
return trimmed_name;
}
static XPathNodeIterator GetFuncOverload(XPathNavigator nav, Delegate d, string apiname, string apiversion)
private static XPathNodeIterator GetFuncOverload(XPathNavigator nav, Delegate d, string apiname, string apiversion)
{
// Try a few different extension variations that appear in the overrides xml file
string[] extensions = { d.Extension, TranslateExtension(d.Extension), d.Extension.ToUpper() };
@ -464,7 +466,7 @@ namespace Bind
return function_overload;
}
static XPathNavigator GetFuncOverride(XPathNavigator nav, Delegate d, string apiname, string apiversion)
private static XPathNavigator GetFuncOverride(XPathNavigator nav, Delegate d, string apiname, string apiversion)
{
// Try a few different extension variations that appear in the overrides xml file
string[] extensions = { d.Extension, TranslateExtension(d.Extension), d.Extension.ToUpper() };
@ -487,12 +489,12 @@ namespace Bind
return function_override;
}
void TrimName(Function f)
private void TrimName(Function f)
{
f.TrimmedName = GetTrimmedName(f);
}
static void ApplyParameterReplacement(Delegate d, XPathNavigator function_override)
private static void ApplyParameterReplacement(Delegate d, XPathNavigator function_override)
{
if (function_override != null)
{
@ -529,7 +531,7 @@ namespace Bind
}
}
static void ApplyReturnTypeReplacement(Delegate d, XPathNavigator function_override)
private static void ApplyReturnTypeReplacement(Delegate d, XPathNavigator function_override)
{
if (function_override != null)
{
@ -550,7 +552,7 @@ namespace Bind
// 3) A generic object or void* (translates to IntPtr)
// 4) A GLenum (translates to int on Legacy.Tao or GL.Enums.GLenum otherwise).
// Return types must always be CLS-compliant, because .Net does not support overloading on return types.
void TranslateReturnType(Delegate d,
private void TranslateReturnType(Delegate d,
XPathNavigator function_override, XPathNavigator nav,
EnumProcessor enum_processor, EnumCollection enums,
string apiname, string apiversion)
@ -596,7 +598,7 @@ namespace Bind
d.ReturnType.CurrentType = GetCLSCompliantType(d.ReturnType);
}
Delegate GetCLSCompliantDelegate(Delegate d)
private Delegate GetCLSCompliantDelegate(Delegate d)
{
Delegate f = new Delegate(d);
@ -610,7 +612,7 @@ namespace Bind
return f;
}
void TranslateParameters(Delegate d,
private void TranslateParameters(Delegate d,
XPathNavigator function_override, XPathNavigator nav,
EnumProcessor enum_processor, EnumCollection enums,
string apiname, string apiversion)
@ -625,7 +627,7 @@ namespace Bind
}
}
void TranslateParameter(Parameter p,
private void TranslateParameter(Parameter p,
XPathNavigator function_override, XPathNavigator overrides,
EnumProcessor enum_processor, EnumCollection enums,
string category, string apiname)
@ -698,7 +700,7 @@ namespace Bind
// WrapperType = WrapperTypes.BoolParameter;
}
void TranslateAttributes(Delegate d,
private void TranslateAttributes(Delegate d,
XPathNavigator function_override, XPathNavigator nav,
string apiname, string apiversion)
{
@ -730,7 +732,7 @@ namespace Bind
}
}
FunctionCollection CreateWrappers(DelegateCollection delegates, EnumCollection enums)
private FunctionCollection CreateWrappers(DelegateCollection delegates, EnumCollection enums)
{
var wrappers = new FunctionCollection();
foreach (var d in delegates.Values.SelectMany(v => v))
@ -765,7 +767,7 @@ namespace Bind
return wrappers;
}
FunctionCollection CreateCLSCompliantWrappers(FunctionCollection functions, EnumCollection enums)
private FunctionCollection CreateCLSCompliantWrappers(FunctionCollection functions, EnumCollection enums)
{
// If the function is not CLS-compliant (e.g. it contains unsigned parameters)
// we need to create a CLS-Compliant overload. However, we should only do this
@ -806,7 +808,7 @@ namespace Bind
return wrappers;
}
static FunctionCollection MarkCLSCompliance(FunctionCollection collection)
private static FunctionCollection MarkCLSCompliance(FunctionCollection collection)
{
//foreach (var w in
// (from list in collection
@ -872,7 +874,7 @@ namespace Bind
return collection;
}
string GetCLSCompliantType(Type type)
private string GetCLSCompliantType(Type type)
{
if (!type.CLSCompliant)
{
@ -901,7 +903,7 @@ namespace Bind
return type.CurrentType;
}
IEnumerable<Function> CreateNormalWrappers(Delegate d, EnumCollection enums)
private IEnumerable<Function> CreateNormalWrappers(Delegate d, EnumCollection enums)
{
Function f = new Function(d);
TrimName(f);
@ -913,7 +915,7 @@ namespace Bind
}
}
IEnumerable<Function> CreateConvenienceOverloads(FunctionCollection wrappers)
private IEnumerable<Function> CreateConvenienceOverloads(FunctionCollection wrappers)
{
var convenience_wrappers = new List<Function>();
foreach (var d in wrappers.Values.SelectMany(w => w))
@ -984,7 +986,7 @@ namespace Bind
return convenience_wrappers;
}
static Function CreateReturnTypeConvenienceWrapper(Function d)
private static Function CreateReturnTypeConvenienceWrapper(Function d)
{
var f = new Function(d);
f.ReturnType = new Type(f.Parameters.Last());
@ -1004,7 +1006,7 @@ namespace Bind
return f;
}
static Function CreateArrayReturnTypeConvenienceWrapper(Function d)
private static Function CreateArrayReturnTypeConvenienceWrapper(Function d)
{
var f = new Function(d);
var p_array = f.Parameters.Last();
@ -1021,7 +1023,7 @@ namespace Bind
return f;
}
List<Function> GetWrapper(IDictionary<WrapperTypes, List<Function>> dictionary, WrapperTypes key, Function raw)
private List<Function> GetWrapper(IDictionary<WrapperTypes, List<Function>> dictionary, WrapperTypes key, Function raw)
{
if (!dictionary.ContainsKey(key))
{
@ -1226,7 +1228,7 @@ namespace Bind
}
}
static void WrapReturnType(Function func)
private static void WrapReturnType(Function func)
{
if ((func.ReturnType.WrapperType & WrapperTypes.StringReturnType) != 0)
{

View file

@ -30,8 +30,7 @@ using System.IO;
namespace Bind.GL2
{
class GL2Generator : Generator
internal class GL2Generator : Generator
{
public GL2Generator(Settings settings)
: base(settings)

View file

@ -31,7 +31,7 @@ using System.Text;
namespace Bind.GL2
{
class GL4Generator : Generator
internal class GL4Generator : Generator
{
public GL4Generator(Settings settings)
: base(settings)

View file

@ -16,7 +16,7 @@ using Type=Bind.Structures.Type;
namespace Bind.GL2
{
abstract class Generator : IBind
internal abstract class Generator : IBind
{
protected string glTypemap = "GL2/gl.tm";
protected string csTypemap = "csharp.tm";
@ -78,7 +78,7 @@ namespace Bind.GL2
SpecReader = new XmlSpecReader(Settings);
}
IEnumerable<string> GetFiles(string path)
private IEnumerable<string> GetFiles(string path)
{
path = Path.Combine(Settings.InputPath, path);
if ((File.GetAttributes(path) & FileAttributes.Directory) != 0)

View file

@ -7,7 +7,7 @@ using System.Collections.Generic;
namespace Bind
{
interface IBind
internal interface IBind
{
DelegateCollection Delegates { get; }
EnumCollection Enums { get; }

View file

@ -8,7 +8,7 @@ using Bind.Structures;
namespace Bind
{
interface ISpecReader
internal interface ISpecReader
{
void ReadDelegates(string file, DelegateCollection delegates, string apiname, string apiversion);
void ReadEnums(string file, EnumCollection enums, string apiname, string apiversion);

View file

@ -16,7 +16,7 @@ using Bind.GL2;
namespace Bind
{
enum GeneratorMode
internal enum GeneratorMode
{
All = 0,
Default = All,
@ -31,13 +31,13 @@ namespace Bind
CL10,
}
static class MainClass
internal static class MainClass
{
static GeneratorMode mode = GeneratorMode.Default;
private static GeneratorMode mode = GeneratorMode.Default;
static internal List<IBind> Generators = new List<IBind>();
static Settings Settings = new Settings();
private static Settings Settings = new Settings();
static void Main(string[] arguments)
private static void Main(string[] arguments)
{
Debug.Listeners.Clear();
Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));

View file

@ -11,7 +11,7 @@ using System.Runtime.Serialization.Formatters.Binary;
namespace Bind
{
[Serializable]
class Settings
internal class Settings
{
public Settings()
{
@ -32,10 +32,11 @@ namespace Bind
public string DefaultWrappersFile = "GL.cs";
public Legacy DefaultCompatibility = Legacy.NoDropMultipleTokens;
string inputPath, outputPath, outputNamespace, docPath, fallbackDocPath, licenseFile,
private string inputPath, outputPath, outputNamespace, docPath, fallbackDocPath, licenseFile,
languageTypeMapFile, keywordEscapeCharacter, importsFile, delegatesFile, enumsFile,
wrappersFile;
Nullable<Legacy> compatibility;
private 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; } }

View file

@ -15,12 +15,12 @@ namespace Bind.Structures
/// can be retrieved or set. The value can be either a number, another constant
/// or an alias to a constant
/// </summary>
class Constant : IComparable<Constant>
internal class Constant : IComparable<Constant>
{
// Gets the name prior to translation.
public string OriginalName { get; private set; }
string _name;
private string _name;
/// <summary>
/// Gets or sets the name of the opengl constant (eg. GL_LINES).
@ -41,7 +41,7 @@ namespace Bind.Structures
}
}
string _value;
private string _value;
/// <summary>
/// Gets or sets the value of the opengl constant (eg. 0x00000001).

View file

@ -17,11 +17,11 @@ namespace Bind.Structures
/// Represents an opengl function.
/// The return value, function name, function parameters and opengl version can be retrieved or set.
/// </summary>
class Delegate : IComparable<Delegate>, IEquatable<Delegate>
internal class Delegate : IComparable<Delegate>, IEquatable<Delegate>
{
//internal static DelegateCollection Delegates;
bool? cls_compliance_overriden;
private bool? cls_compliance_overriden;
protected static Regex endings = new Regex(@"((((d|f|fi)|u?[isb])_?v?)|v)", RegexOptions.Compiled | RegexOptions.RightToLeft);
protected static Regex endingsNotToTrim = new Regex("(ib|[tdrey]s|[eE]n[vd]|bled|Flag|Tess|Status|Pixels|Instanced|Indexed|Varyings|Boolean|IDs)", RegexOptions.Compiled | RegexOptions.RightToLeft);
@ -140,7 +140,7 @@ namespace Bind.Structures
/// </summary>
public Type ReturnType { get; set; } = new Type();
string _name;
private string _name;
/// <summary>
/// Gets or sets the name of the opengl function.
/// </summary>
@ -213,9 +213,9 @@ namespace Bind.Structures
}
}
class DelegateCollection : IDictionary<string, List<Delegate>>
internal class DelegateCollection : IDictionary<string, List<Delegate>>
{
readonly SortedDictionary<string, List<Delegate>> Delegates =
private readonly SortedDictionary<string, List<Delegate>> Delegates =
new SortedDictionary<string, List<Delegate>>();
public void Add(Delegate d)

View file

@ -30,13 +30,13 @@ using System.Collections.Generic;
namespace Bind.Structures
{
class Documentation
internal class Documentation
{
public string Summary { get; set; }
public List<DocumentationParameter> Parameters { get; set; }
}
class DocumentationParameter
internal class DocumentationParameter
{
public string Name { get; set; }
public string Documentation { get; set; }

View file

@ -11,9 +11,9 @@ using System.Xml.XPath;
namespace Bind.Structures
{
class Enum
internal class Enum
{
string _name, _type;
private string _name, _type;
public Enum()
{
@ -39,7 +39,7 @@ namespace Bind.Structures
set { _type = value; }
}
SortedDictionary<string, Constant> _constant_collection = new SortedDictionary<string, Constant>();
private SortedDictionary<string, Constant> _constant_collection = new SortedDictionary<string, Constant>();
public IDictionary<string, Constant> ConstantCollection
{
@ -77,12 +77,12 @@ namespace Bind.Structures
public bool CLSCompliant { get; set; }
}
class EnumCollection : IDictionary<string, Enum>
internal class EnumCollection : IDictionary<string, Enum>
{
SortedDictionary<string, Enum> Enumerations = new SortedDictionary<string, Enum>();
private SortedDictionary<string, Enum> Enumerations = new SortedDictionary<string, Enum>();
// Return -1 for ext1, 1 for ext2 or 0 if no preference.
int OrderOfPreference(string ext1, string ext2)
private int OrderOfPreference(string ext1, string ext2)
{
// If one is empty and the other not, prefer the empty one (empty == core)
// Otherwise check for Arb and Ext. To reuse the logic for the
@ -101,7 +101,7 @@ namespace Bind.Structures
}
// Prefer the empty string over the non-empty.
int PreferEmpty(string ext1, string ext2)
private int PreferEmpty(string ext1, string ext2)
{
if (String.IsNullOrEmpty(ext1) && !String.IsNullOrEmpty(ext2))
return -1;

View file

@ -10,7 +10,7 @@ using System.Text.RegularExpressions;
namespace Bind.Structures
{
class Function : Delegate, IEquatable<Function>, IComparable<Function>
internal class Function : Delegate, IEquatable<Function>, IComparable<Function>
{
public Function(Delegate d)
: base(d)
@ -148,11 +148,11 @@ namespace Bind.Structures
}
}
class FunctionCollection : SortedDictionary<string, List<Function>>
internal class FunctionCollection : SortedDictionary<string, List<Function>>
{
Regex unsignedFunctions = new Regex(@".+(u[dfisb]v?)", RegexOptions.Compiled);
private Regex unsignedFunctions = new Regex(@".+(u[dfisb]v?)", RegexOptions.Compiled);
void Add(Function f)
private void Add(Function f)
{
if (!ContainsKey(f.Extension))
{

View file

@ -13,9 +13,9 @@ namespace Bind.Structures
/// <summary>
/// Represents a single parameter of an opengl function.
/// </summary>
class Parameter : Type, IComparable<Parameter>, IEquatable<Parameter>
internal class Parameter : Type, IComparable<Parameter>, IEquatable<Parameter>
{
string cache;
private string cache;
/// <summary>
/// Creates a new Parameter without type and name.
@ -78,7 +78,7 @@ namespace Bind.Structures
}
}
UnmanagedType _unmanaged_type;
private UnmanagedType _unmanaged_type;
/// <summary>
/// Gets or sets the name of the parameter.
/// </summary>
@ -94,7 +94,7 @@ namespace Bind.Structures
}
}
FlowDirection _flow;
private FlowDirection _flow;
/// <summary>
/// Gets or sets the flow of the parameter.
@ -191,17 +191,17 @@ namespace Bind.Structures
/// <summary>
/// Holds the parameter list of an opengl function.
/// </summary>
class ParameterCollection : IList<Parameter>, IComparable<ParameterCollection>, IEquatable<ParameterCollection>
internal class ParameterCollection : IList<Parameter>, IComparable<ParameterCollection>, IEquatable<ParameterCollection>
{
readonly List<Parameter> Parameters = new List<Parameter>();
private readonly List<Parameter> Parameters = new List<Parameter>();
bool hasPointerParameters;
bool hasReferenceParameters;
bool hasUnsignedParameters;
bool hasGenericParameters;
private bool hasPointerParameters;
private bool hasReferenceParameters;
private bool hasUnsignedParameters;
private bool hasGenericParameters;
public bool Rebuild { get; set; }
Settings Settings { get; set; }
private Settings Settings { get; set; }
public ParameterCollection()
{
@ -221,7 +221,7 @@ namespace Bind.Structures
Add(new Parameter(p));
}
void BuildCache()
private void BuildCache()
{
BuildReferenceAndPointerParametersCache();
Rebuild = false;
@ -280,7 +280,7 @@ namespace Bind.Structures
}
void BuildReferenceAndPointerParametersCache()
private void BuildReferenceAndPointerParametersCache()
{
foreach (Parameter p in this)
{

View file

@ -10,9 +10,9 @@ using System.Xml.XPath;
namespace Bind.Structures
{
class Type : IComparable<Type>, IEquatable<Type>
internal class Type : IComparable<Type>, IEquatable<Type>
{
string current_qualifier = String.Empty;
private string current_qualifier = String.Empty;
public Type()
{
@ -34,7 +34,7 @@ namespace Bind.Structures
}
}
string CurrentQualifier
private string CurrentQualifier
{
get { return current_qualifier; }
set { PreviousQualifier = CurrentQualifier; current_qualifier = value; }
@ -70,7 +70,7 @@ namespace Bind.Structures
}
}
string type;
private string type;
/// <summary>
/// Gets the type of the parameter.
/// </summary>
@ -102,7 +102,7 @@ namespace Bind.Structures
public bool Reference { get; set; }
int array;
private int array;
public int Array
{
@ -110,7 +110,7 @@ namespace Bind.Structures
set { array = value > 0 ? value : 0; }
}
int element_count;
private int element_count;
// If the type is an array and ElementCount > 0, then ElemenCount defines the expected array length.
public int ElementCount
@ -119,7 +119,7 @@ namespace Bind.Structures
set { element_count = value > 0 ? value : 0; }
}
int pointer;
private int pointer;
public int Pointer
{
@ -194,7 +194,7 @@ namespace Bind.Structures
public WrapperTypes WrapperType { get; set; } = WrapperTypes.None;
static readonly string[] PointerLevels =
private static readonly string[] PointerLevels =
{
"",
"*",
@ -203,7 +203,7 @@ namespace Bind.Structures
"****"
};
static readonly string[] ArrayLevels =
private static readonly string[] ArrayLevels =
{
"",
"[]",

View file

@ -92,7 +92,7 @@ namespace Bind
SizeParameter = 1 << 14,
}
static class Utilities
internal static class Utilities
{
public static readonly char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' };
public static Regex Extensions { get; private set; }
@ -103,7 +103,7 @@ namespace Bind
// Note: REMOVING THESE WILL BREAK BINARY-COMPATIBILITY WITH OPENTK 1.0,
// WRT THE ES 1.1 API.
// You have been warned.
static List<string> extension_names = new List<string>
private static List<string> extension_names = new List<string>
{
"SGI", "SGIS", "SGIX", "IBM", "AMD", "INTEL",
};

View file

@ -37,9 +37,9 @@ namespace Bind
using Delegate = Bind.Structures.Delegate;
using Enum = Bind.Structures.Enum;
class XmlSpecReader : ISpecReader
internal class XmlSpecReader : ISpecReader
{
Settings Settings { get; set; }
private Settings Settings { get; set; }
public XmlSpecReader(Settings settings)
{
@ -206,7 +206,7 @@ namespace Bind
}
}
static void GetSignaturePaths(string apiname, string apiversion, out string xpath_add, out string xpath_delete)
private static void GetSignaturePaths(string apiname, string apiversion, out string xpath_add, out string xpath_delete)
{
xpath_add = "/signatures/add";
xpath_delete = "/signatures/delete";
@ -229,7 +229,7 @@ namespace Bind
}
}
string GetSpecVersion(XPathDocument specs)
private string GetSpecVersion(XPathDocument specs)
{
var version =
specs.CreateNavigator().SelectSingleNode("/signatures")
@ -241,7 +241,7 @@ namespace Bind
return version;
}
DelegateCollection ReadDelegates(XPathNavigator specs, string apiversion)
private DelegateCollection ReadDelegates(XPathNavigator specs, string apiversion)
{
DelegateCollection delegates = new DelegateCollection();
var extensions = new List<string>();
@ -323,7 +323,7 @@ namespace Bind
return delegates;
}
EnumCollection ReadEnums(XPathNavigator nav)
private EnumCollection ReadEnums(XPathNavigator nav)
{
EnumCollection enums = new EnumCollection();
Enum all = new Enum() { Name = Settings.CompleteEnumName };

View file

@ -32,7 +32,7 @@ using System.Xml.Linq;
namespace OpenTK.Convert
{
static class Extension
internal static class Extension
{
public static string ValueOrDefault(this XAttribute a)
{
@ -40,9 +40,9 @@ namespace OpenTK.Convert
}
}
class GLXmlParser : XmlParser
internal class GLXmlParser : XmlParser
{
static readonly Regex ExtensionRegex = new Regex(
private static readonly Regex ExtensionRegex = new Regex(
@"3DFX|(?!(?<=[1-4])D)[A-Z]{2,}$",
RegexOptions.Compiled);
@ -69,7 +69,7 @@ namespace OpenTK.Convert
return elements.Values;
}
static string[] GetApiNames(XElement feature)
private static string[] GetApiNames(XElement feature)
{
string[] apinames = null;
switch (feature.Name.LocalName)
@ -107,7 +107,7 @@ namespace OpenTK.Convert
return apinames;
}
IEnumerable<XElement> ParseEnums(XDocument input)
private IEnumerable<XElement> ParseEnums(XDocument input)
{
var features = input.Root.Elements("feature");
var extensions = input.Root.Elements("extensions").Elements("extension");
@ -224,7 +224,7 @@ namespace OpenTK.Convert
return APIs.Values;
}
IEnumerable<XElement> ParseFunctions(XDocument input)
private IEnumerable<XElement> ParseFunctions(XDocument input)
{
// Go through the list of commands and build OpenTK functions out of those.
// Every function has a number of attributes that define which API version and
@ -404,12 +404,12 @@ namespace OpenTK.Convert
return function;
}
string FunctionName(XElement e)
private string FunctionName(XElement e)
{
return TrimName(e.Element("proto").Element("name").Value);
}
string FunctionParameterType(XElement e)
private string FunctionParameterType(XElement e)
{
// Parse the C-like <proto> element. Possible instances:
// Return types:
@ -444,7 +444,7 @@ namespace OpenTK.Convert
return ret;
}
static string Join(string left, string right)
private static string Join(string left, string right)
{
if (!String.IsNullOrEmpty(left) && !String.IsNullOrEmpty(right))
return left + "|" + right;
@ -456,7 +456,7 @@ namespace OpenTK.Convert
return String.Empty;
}
static XAttribute Lookup(IDictionary<string, XElement> categories, string cmd_name, string attribute)
private static XAttribute Lookup(IDictionary<string, XElement> categories, string cmd_name, string attribute)
{
if (categories.ContainsKey(cmd_name))
{

View file

@ -32,7 +32,7 @@ using CommandLine;
namespace OpenTK.Convert
{
class EnumTokenComparer : IEqualityComparer<XNode>
internal class EnumTokenComparer : IEqualityComparer<XNode>
{
public bool Equals(XNode a, XNode b)
{
@ -60,11 +60,11 @@ namespace OpenTK.Convert
}
}
class EntryPoint
internal class EntryPoint
{
static Options CLIOptions;
private static Options CLIOptions;
static void Main(string[] args)
private static void Main(string[] args)
{
Parser.Default.ParseArguments<Options>(args)
.WithParsed(result => CLIOptions = result)

View file

@ -29,7 +29,7 @@ using System.Xml.Linq;
namespace OpenTK.Convert
{
// The base class for a parser.
abstract class XmlParser
internal abstract class XmlParser
{
// Defines a prefix that should be removed from methods and tokens in the XML files, e.g. "gl", "cl", etc.
public string Prefix { get; set; }

View file

@ -27,9 +27,9 @@ namespace OpenTK.Rewrite
{
// Replaces OpenTK.InteropHelper method instances
// with the s IL instructions.
class Program
internal class Program
{
static void Main(string[] args)
private static void Main(string[] args)
{
if (args.Length == 0)
{
@ -48,19 +48,20 @@ namespace OpenTK.Rewrite
}
// mscorlib types
static AssemblyDefinition mscorlib;
static TypeDefinition TypeMarshal;
static TypeDefinition TypeStringBuilder;
static TypeDefinition TypeVoid;
static TypeDefinition TypeIntPtr;
static TypeDefinition TypeInt32;
private static AssemblyDefinition mscorlib;
private static TypeDefinition TypeMarshal;
private static TypeDefinition TypeStringBuilder;
private static TypeDefinition TypeVoid;
private static TypeDefinition TypeIntPtr;
private static TypeDefinition TypeInt32;
// OpenTK.BindingsBase
static TypeDefinition TypeBindingsBase;
private static TypeDefinition TypeBindingsBase;
static bool dllimport;
private static bool dllimport;
void Rewrite(string file, string keyfile, IEnumerable<string> options)
private void Rewrite(string file, string keyfile, IEnumerable<string> options)
{
IEnumerable<string> optionsEnumerated = options as IList<string> ?? options.ToList();
dllimport = optionsEnumerated.Contains("-dllimport");
@ -152,7 +153,7 @@ namespace OpenTK.Rewrite
}
}
void Rewrite(TypeDefinition type, IEnumerable<string> options)
private void Rewrite(TypeDefinition type, IEnumerable<string> options)
{
var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints");
if (entry_points != null)
@ -177,7 +178,7 @@ namespace OpenTK.Rewrite
}
}
static int GetSlot(MethodDefinition signature)
private static int GetSlot(MethodDefinition signature)
{
// Pretend there is no slots if we want to force everything to work through DllImport (Android & iOS)
if (dllimport)
@ -193,7 +194,7 @@ namespace OpenTK.Rewrite
return slot;
}
void Rewrite(TypeDefinition type, FieldDefinition entry_points,
private void Rewrite(TypeDefinition type, FieldDefinition entry_points,
List<MethodDefinition> entry_signatures, IEnumerable<string> options)
{
// Rewrite all wrapper methods
@ -228,7 +229,7 @@ namespace OpenTK.Rewrite
}
}
static void RemoveNativeSignatures(TypeDefinition type, IEnumerable<MethodDefinition> methods)
private static void RemoveNativeSignatures(TypeDefinition type, IEnumerable<MethodDefinition> methods)
{
// Remove all DllImports for functions called through calli, since
// their signatures are embedded directly into the calli callsite.
@ -239,7 +240,7 @@ namespace OpenTK.Rewrite
}
}
static void RemoveSupportingAttributes(TypeDefinition type)
private static void RemoveSupportingAttributes(TypeDefinition type)
{
foreach (var method in type.Methods)
{
@ -256,7 +257,7 @@ namespace OpenTK.Rewrite
}
// Create body for method
static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot,
private static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot,
FieldDefinition entry_points, IEnumerable<string> options)
{
var body = wrapper.Body;
@ -324,7 +325,7 @@ namespace OpenTK.Rewrite
body.OptimizeMacros();
}
class DebugVariables
private class DebugVariables
{
public TypeDefinition ErrorHelperType;
public VariableDefinition ErrorHelperLocal;
@ -333,7 +334,7 @@ namespace OpenTK.Rewrite
public Instruction BeginTry;
}
static DebugVariables EmitDebugPrologue(MethodDefinition wrapper, ILProcessor il)
private static DebugVariables EmitDebugPrologue(MethodDefinition wrapper, ILProcessor il)
{
DebugVariables vars = null;
@ -417,7 +418,7 @@ namespace OpenTK.Rewrite
return vars;
}
static void EmitDebugEpilogue(MethodDefinition wrapper, ILProcessor il, DebugVariables vars)
private static void EmitDebugEpilogue(MethodDefinition wrapper, ILProcessor il, DebugVariables vars)
{
if (vars != null)
{
@ -525,7 +526,7 @@ namespace OpenTK.Rewrite
}
}
static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il,
private static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il,
List<GeneratedVariableIdentifier> generatedVariables)
{
foreach (var p in wrapper.Parameters)
@ -554,13 +555,13 @@ namespace OpenTK.Rewrite
/// <param name="name"></param>
/// <param name="body"></param>
/// <returns></returns>
static GeneratedVariableIdentifier GetGeneratedVariable(IEnumerable<GeneratedVariableIdentifier> variableIdentifiers, string name, MethodBody body)
private static GeneratedVariableIdentifier GetGeneratedVariable(IEnumerable<GeneratedVariableIdentifier> variableIdentifiers, string name, MethodBody body)
{
return variableIdentifiers.FirstOrDefault(v => v.Name == name && v.Body == body &&
body.Variables.Contains(v.Definition));
}
static GeneratedVariableIdentifier EmitStringBuilderParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il)
private static GeneratedVariableIdentifier EmitStringBuilderParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il)
{
var p = parameter.ParameterType;
@ -597,7 +598,7 @@ namespace OpenTK.Rewrite
return stringBuilderPtrVar;
}
static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native,
private static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native,
ParameterDefinition parameter, MethodBody body, ILProcessor il, GeneratedVariableIdentifier generatedPtrVar)
{
if (generatedPtrVar == null)
@ -639,7 +640,7 @@ namespace OpenTK.Rewrite
}
}
static GeneratedVariableIdentifier EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
private static GeneratedVariableIdentifier EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il)
{
var p = parameter.ParameterType;
@ -666,7 +667,7 @@ namespace OpenTK.Rewrite
return stringPtrVar;
}
static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
private static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il, GeneratedVariableIdentifier generatedPtrVar)
{
var p = parameter.ParameterType;
@ -677,7 +678,7 @@ namespace OpenTK.Rewrite
il.Emit(OpCodes.Call, free);
}
static GeneratedVariableIdentifier EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
private static GeneratedVariableIdentifier EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il)
{
var p = parameter.ParameterType;
@ -705,7 +706,7 @@ namespace OpenTK.Rewrite
return stringArrayPtrVar;
}
static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
private static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il, GeneratedVariableIdentifier generatedPtrVar)
{
if (generatedPtrVar == null)
@ -732,7 +733,7 @@ namespace OpenTK.Rewrite
il.Emit(OpCodes.Call, free);
}
static List<GeneratedVariableIdentifier> EmitConvenienceWrapper(MethodDefinition wrapper,
private static List<GeneratedVariableIdentifier> EmitConvenienceWrapper(MethodDefinition wrapper,
MethodDefinition native, int difference, MethodBody body, ILProcessor il)
{
if (wrapper.Parameters.Count > 2)
@ -800,7 +801,7 @@ namespace OpenTK.Rewrite
return generatedVariables;
}
static List<GeneratedVariableIdentifier> EmitParameters(MethodDefinition method, MethodDefinition native, MethodBody body, ILProcessor il)
private static List<GeneratedVariableIdentifier> EmitParameters(MethodDefinition method, MethodDefinition native, MethodBody body, ILProcessor il)
{
List<GeneratedVariableIdentifier> generatedVariables = new List<GeneratedVariableIdentifier>();
for (int i = 0; i < method.Parameters.Count; i++)
@ -931,14 +932,14 @@ namespace OpenTK.Rewrite
return generatedVariables;
}
static void EmitEntryPoint(FieldDefinition entry_points, ILProcessor il, int slot)
private static void EmitEntryPoint(FieldDefinition entry_points, ILProcessor il, int slot)
{
il.Emit(OpCodes.Ldsfld, entry_points);
il.Emit(OpCodes.Ldc_I4, slot);
il.Emit(OpCodes.Ldelem_I);
}
static void EmitCalli(ILProcessor il, MethodReference reference)
private static void EmitCalli(ILProcessor il, MethodReference reference)
{
var signature = new CallSite(reference.ReturnType)
{
@ -955,7 +956,7 @@ namespace OpenTK.Rewrite
il.Emit(OpCodes.Calli, signature);
}
static void EmitCall(ILProcessor il, MethodReference reference)
private static void EmitCall(ILProcessor il, MethodReference reference)
{
il.Emit(OpCodes.Call, reference);
}

View file

@ -54,15 +54,14 @@ namespace OpenTK.Platform.MacOS
using GLenum = UInt32;
unsafe static partial class Agl
internal unsafe static partial class Agl
{
const string agl = "/System/Library/Frameworks/AGL.framework/Versions/Current/AGL";
private const string agl = "/System/Library/Frameworks/AGL.framework/Versions/Current/AGL";
/*
** AGL API version.
*/
const int AGL_VERSION_2_0 = 1;
private const int AGL_VERSION_2_0 = 1;
/************************************************************************/
@ -321,29 +320,36 @@ namespace OpenTK.Platform.MacOS
/*
** Renderer information functions
*/
[DllImport(agl)] static extern AGLRendererInfo aglQueryRendererInfo(AGLDevice[] gdevs, int ndev);
[DllImport(agl)] static extern void aglDestroyRendererInfo(AGLRendererInfo rend);
[DllImport(agl)] static extern AGLRendererInfo aglNextRendererInfo(AGLRendererInfo rend);
[DllImport(agl)] static extern byte aglDescribeRenderer(AGLRendererInfo rend, int prop, out int value);
[DllImport(agl)]
private static extern AGLRendererInfo aglQueryRendererInfo(AGLDevice[] gdevs, int ndev);
[DllImport(agl)]
private static extern void aglDestroyRendererInfo(AGLRendererInfo rend);
[DllImport(agl)]
private static extern AGLRendererInfo aglNextRendererInfo(AGLRendererInfo rend);
[DllImport(agl)]
private static extern byte aglDescribeRenderer(AGLRendererInfo rend, int prop, out int value);
/*
** Context functions
*/
[DllImport(agl)] internal static extern AGLContext aglCreateContext(AGLPixelFormat pix, AGLContext share);
[DllImport(agl,EntryPoint="aglDestroyContext")] static extern byte _aglDestroyContext(AGLContext ctx);
[DllImport(agl,EntryPoint="aglDestroyContext")]
private static extern byte _aglDestroyContext(AGLContext ctx);
internal static bool aglDestroyContext(AGLContext context)
{
return (_aglDestroyContext(context) != 0) ? true : false;
}
[DllImport(agl)] static extern byte aglCopyContext(AGLContext src, AGLContext dst, uint mask);
[DllImport(agl)]
private static extern byte aglCopyContext(AGLContext src, AGLContext dst, uint mask);
[DllImport(agl)] internal static extern byte aglUpdateContext(AGLContext ctx);
/*
** Current state functions
*/
[DllImport(agl,EntryPoint="aglSetCurrentContext")] static extern byte _aglSetCurrentContext(AGLContext ctx);
[DllImport(agl,EntryPoint="aglSetCurrentContext")]
private static extern byte _aglSetCurrentContext(AGLContext ctx);
internal static bool aglSetCurrentContext(IntPtr context)
{
byte retval = _aglSetCurrentContext(context);
@ -361,7 +367,7 @@ namespace OpenTK.Platform.MacOS
** Drawable Functions
*/
[DllImport(agl,EntryPoint="aglSetDrawable")]
static extern byte _aglSetDrawable(AGLContext ctx, AGLDrawable draw);
private static extern byte _aglSetDrawable(AGLContext ctx, AGLDrawable draw);
internal static void aglSetDrawable(AGLContext ctx, AGLDrawable draw)
{
@ -373,11 +379,13 @@ namespace OpenTK.Platform.MacOS
throw new Exception(ErrorString(err));
}
}
[DllImport(agl)] static extern byte aglSetOffScreen(AGLContext ctx, int width, int height, int rowbytes, IntPtr baseaddr);
[DllImport(agl)] static extern AGLDrawable aglGetDrawable(AGLContext ctx);
[DllImport(agl)]
private static extern byte aglSetOffScreen(AGLContext ctx, int width, int height, int rowbytes, IntPtr baseaddr);
[DllImport(agl)]
private static extern AGLDrawable aglGetDrawable(AGLContext ctx);
[DllImport(agl, EntryPoint = "aglSetFullScreen")]
static extern byte _aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device);
private static extern byte _aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device);
internal static void aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device)
{
byte retval = _aglSetFullScreen(ctx, width, height, freq, device);
@ -396,18 +404,22 @@ namespace OpenTK.Platform.MacOS
/*
** Virtual screen functions
*/
[DllImport(agl)] static extern byte aglSetVirtualScreen(AGLContext ctx, int screen);
[DllImport(agl)] static extern int aglGetVirtualScreen(AGLContext ctx);
[DllImport(agl)]
private static extern byte aglSetVirtualScreen(AGLContext ctx, int screen);
[DllImport(agl)]
private static extern int aglGetVirtualScreen(AGLContext ctx);
/*
** Obtain version numbers
*/
[DllImport(agl)] static extern void aglGetVersion(int *major, int *minor);
[DllImport(agl)]
private static extern void aglGetVersion(int *major, int *minor);
/*
** Global library options
*/
[DllImport(agl)] static extern byte aglConfigure(GLenum pname, uint param);
[DllImport(agl)]
private static extern byte aglConfigure(GLenum pname, uint param);
/*
** Swap functions
@ -422,7 +434,7 @@ namespace OpenTK.Platform.MacOS
[DllImport(agl)]
internal static extern bool aglDisable(AGLContext ctx, ParameterNames pname);
[DllImport(agl)]
static extern bool aglIsEnabled(AGLContext ctx, GLenum pname);
private static extern bool aglIsEnabled(AGLContext ctx, GLenum pname);
[DllImport(agl)]
internal static extern bool aglSetInteger(AGLContext ctx, ParameterNames pname, ref int param);
[DllImport(agl)]
@ -436,13 +448,15 @@ namespace OpenTK.Platform.MacOS
** Font function
*/
// TODO: face parameter should be of type StyleParameter in QuickDraw.
[DllImport(agl)] static extern byte aglUseFont(AGLContext ctx, int fontID, int face, int size, int first, int count, int @base);
[DllImport(agl)]
private static extern byte aglUseFont(AGLContext ctx, int fontID, int face, int size, int first, int count, int @base);
/*
** Error functions
*/
[DllImport(agl,EntryPoint="aglGetError")] internal static extern AglError GetError();
[DllImport(agl,EntryPoint="aglErrorString")] static extern IntPtr _aglErrorString(AglError code);
[DllImport(agl,EntryPoint="aglErrorString")]
private static extern IntPtr _aglErrorString(AglError code);
internal static string ErrorString(AglError code)
{
return Marshal.PtrToStringAnsi(_aglErrorString(code));
@ -451,32 +465,42 @@ namespace OpenTK.Platform.MacOS
/*
** Soft reset function
*/
[DllImport(agl)] static extern void aglResetLibrary();
[DllImport(agl)]
private static extern void aglResetLibrary();
/*
** Surface texture function
*/
[DllImport(agl)] static extern void aglSurfaceTexture (AGLContext context, GLenum target, GLenum internalformat, AGLContext surfacecontext) ;
[DllImport(agl)]
private static extern void aglSurfaceTexture (AGLContext context, GLenum target, GLenum internalformat, AGLContext surfacecontext) ;
/*
** PBuffer functions
*/
[DllImport(agl)] static extern byte aglCreatePBuffer (int width, int height, GLenum target, GLenum internalFormat, long max_level, AGLPbuffer *pbuffer);
[DllImport(agl)] static extern byte aglDestroyPBuffer (AGLPbuffer pbuffer);
[DllImport(agl)] static extern byte aglDescribePBuffer (AGLPbuffer pbuffer, int *width, int *height, GLenum *target, GLenum *internalFormat, int *max_level);
[DllImport(agl)] static extern byte aglTexImagePBuffer (AGLContext ctx, AGLPbuffer pbuffer, int source);
[DllImport(agl)]
private static extern byte aglCreatePBuffer (int width, int height, GLenum target, GLenum internalFormat, long max_level, AGLPbuffer *pbuffer);
[DllImport(agl)]
private static extern byte aglDestroyPBuffer (AGLPbuffer pbuffer);
[DllImport(agl)]
private static extern byte aglDescribePBuffer (AGLPbuffer pbuffer, int *width, int *height, GLenum *target, GLenum *internalFormat, int *max_level);
[DllImport(agl)]
private static extern byte aglTexImagePBuffer (AGLContext ctx, AGLPbuffer pbuffer, int source);
/*
** Pbuffer Drawable Functions
*/
[DllImport(agl)] static extern byte aglSetPBuffer (AGLContext ctx, AGLPbuffer pbuffer, int face, int level, int screen) ;
[DllImport(agl)] static extern byte aglGetPBuffer (AGLContext ctx, AGLPbuffer *pbuffer, int *face, int *level, int *screen) ;
[DllImport(agl)]
private static extern byte aglSetPBuffer (AGLContext ctx, AGLPbuffer pbuffer, int face, int level, int screen) ;
[DllImport(agl)]
private static extern byte aglGetPBuffer (AGLContext ctx, AGLPbuffer *pbuffer, int *face, int *level, int *screen) ;
/*
** CGL functions
*/
[DllImport(agl)] static extern byte aglGetCGLContext(AGLContext ctx, void **cgl_ctx) ;
[DllImport(agl)] static extern byte aglGetCGLPixelFormat(AGLPixelFormat pix, void **cgl_pix);
[DllImport(agl)]
private static extern byte aglGetCGLContext(AGLContext ctx, void **cgl_ctx) ;
[DllImport(agl)]
private static extern byte aglGetCGLPixelFormat(AGLPixelFormat pix, void **cgl_pix);
#pragma warning restore 0169
}

View file

@ -43,13 +43,13 @@ namespace OpenTK.Platform.MacOS
/// <summary>
/// AGL context implementation for WinForms compatibility.
/// </summary>
class AglContext : IGraphicsContext, IGraphicsContextInternal
internal class AglContext : IGraphicsContext, IGraphicsContextInternal
{
IWindowInfo carbonWindow;
IGraphicsContext dummyContext; // for extension loading
private IWindowInfo carbonWindow;
private IGraphicsContext dummyContext; // for extension loading
readonly GetInt XOffset;
readonly GetInt YOffset;
private readonly GetInt XOffset;
private readonly GetInt YOffset;
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext,
GetInt xoffset, GetInt yoffset)
@ -96,7 +96,7 @@ namespace OpenTK.Platform.MacOS
aglAttributes.Add(value);
}
void CreateContext(GraphicsMode mode, IWindowInfo carbonWindow, IntPtr shareContextRef, bool fullscreen)
private void CreateContext(GraphicsMode mode, IWindowInfo carbonWindow, IntPtr shareContextRef, bool fullscreen)
{
Debug.Print("AGL pixel format attributes:");
@ -134,7 +134,7 @@ namespace OpenTK.Platform.MacOS
});
}
void SetBufferRect(IWindowInfo carbonWindow)
private void SetBufferRect(IWindowInfo carbonWindow)
{
Rect rect = API.GetControlBounds(carbonWindow.Handle);
@ -160,7 +160,7 @@ namespace OpenTK.Platform.MacOS
MyAGLReportError("aglEnable");
}
void SetDrawable(IWindowInfo carbonWindow)
private void SetDrawable(IWindowInfo carbonWindow)
{
IntPtr windowPort = GetWindowPortForWindowInfo(carbonWindow);
//Debug.Print("Setting drawable for context {0} to window port: {1}", Handle.Handle, windowPort);
@ -185,7 +185,7 @@ namespace OpenTK.Platform.MacOS
Agl.aglUpdateContext(Context.Handle);
}
void MyAGLReportError(string function)
private void MyAGLReportError(string function)
{
Agl.AglError err = Agl.GetError();
@ -195,7 +195,7 @@ namespace OpenTK.Platform.MacOS
function, err, Agl.ErrorString(err)));
}
bool firstSwap = true;
private bool firstSwap = true;
public void SwapBuffers()
{
// this is part of the hack to avoid dropping the first frame when
@ -286,7 +286,7 @@ namespace OpenTK.Platform.MacOS
Dispose(true);
}
void Dispose(bool disposing)
private void Dispose(bool disposing)
{
if (IsDisposed || Context.Handle == IntPtr.Zero)
return;

View file

@ -31,7 +31,7 @@ using OpenTK.Graphics;
namespace OpenTK.Platform.MacOS
{
class AglGraphicsMode
internal class AglGraphicsMode
{
public GraphicsMode SelectGraphicsMode(ColorFormat color, int depth, int stencil,
int samples, ColorFormat accum, int buffers, bool stereo, out IntPtr pixelformat)
@ -56,7 +56,7 @@ namespace OpenTK.Platform.MacOS
return GetGraphicsModeFromPixelFormat(pixelformat);
}
static bool RelaxGraphicsMode(ref ColorFormat color, ref int depth, ref int stencil, ref int samples, ref ColorFormat accum, ref int buffers, ref bool stereo)
private static bool RelaxGraphicsMode(ref ColorFormat color, ref int depth, ref int stencil, ref int samples, ref ColorFormat accum, ref int buffers, ref bool stereo)
{
// Parameters are relaxed in order of importance.
// - Accumulator buffers are way outdated as a concept,
@ -124,7 +124,7 @@ namespace OpenTK.Platform.MacOS
return false;
}
GraphicsMode GetGraphicsModeFromPixelFormat(IntPtr pixelformat)
private GraphicsMode GetGraphicsModeFromPixelFormat(IntPtr pixelformat)
{
int r, g, b, a;
Agl.aglDescribePixelFormat(pixelformat, Agl.PixelFormatAttribute.AGL_RED_SIZE, out r);
@ -147,7 +147,7 @@ namespace OpenTK.Platform.MacOS
depth, stencil, samples, new ColorFormat(ar, ag, ab, aa), buffers + 1, stereo != 0);
}
IntPtr SelectPixelFormat(ColorFormat color, int depth, int stencil, int samples,
private IntPtr SelectPixelFormat(ColorFormat color, int depth, int stencil, int samples,
ColorFormat accum, int buffers, bool stereo)
{
List<int> attribs = new List<int>();

View file

@ -68,10 +68,10 @@ namespace OpenTK.Platform.MacOS.Carbon
[StructLayout(LayoutKind.Sequential)]
internal struct Rect
{
short top;
short left;
short bottom;
short right;
private short top;
private short left;
private short bottom;
private short right;
internal Rect(int left, int top, int width, int height)
: this((short)left, (short)top, (short)width, (short)height)
@ -132,16 +132,16 @@ namespace OpenTK.Platform.MacOS.Carbon
}
}
class API
internal class API
{
const string carbon = "/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon";
private const string carbon = "/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon";
[DllImport(carbon)]
internal unsafe static extern OSStatus DMGetGDeviceByDisplayID(
IntPtr displayID, out IntPtr displayDevice, Boolean failToMain);
[DllImport(carbon)]
static extern IntPtr GetControlBounds(IntPtr control, out Rect bounds);
private static extern IntPtr GetControlBounds(IntPtr control, out Rect bounds);
internal static Rect GetControlBounds(IntPtr control)
{

View file

@ -34,10 +34,10 @@ using OpenTK.Platform.MacOS;
namespace OpenTK
{
class CarbonGLControl : IGLControl
internal class CarbonGLControl : IGLControl
{
GraphicsMode mode;
Control control;
private GraphicsMode mode;
private Control control;
internal CarbonGLControl(GraphicsMode mode, Control owner)
{
@ -71,7 +71,7 @@ namespace OpenTK
}
// TODO: Fix this
bool lastIsIdle = false;
private bool lastIsIdle = false;
public bool IsIdle
{
get

View file

@ -29,7 +29,7 @@ using OpenTK.Platform;
namespace OpenTK
{
class DummyGLControl : IGLControl
internal class DummyGLControl : IGLControl
{
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{
@ -46,11 +46,11 @@ namespace OpenTK
get { return Utilities.CreateDummyWindowInfo(); }
}
class DummyContext : IGraphicsContext, IGraphicsContextInternal
private class DummyContext : IGraphicsContext, IGraphicsContextInternal
{
static int instance_count;
private static int instance_count;
IWindowInfo current_window;
private IWindowInfo current_window;
public void SwapBuffers()
{

View file

@ -46,21 +46,22 @@ namespace OpenTK
/// </summary>
public partial class GLControl : UserControl
{
IGraphicsContext context;
IGLControl implementation;
GraphicsMode format;
int major, minor;
GraphicsContextFlags flags;
bool? initial_vsync_value;
private IGraphicsContext context;
private IGLControl implementation;
private GraphicsMode format;
private int major, minor;
private GraphicsContextFlags flags;
private bool? initial_vsync_value;
// Indicates that OnResize was called before OnHandleCreated.
// To avoid issues with missing OpenGL contexts, we suppress
// the premature Resize event and raise it as soon as the handle
// is ready.
bool resize_event_suppressed;
private bool resize_event_suppressed;
// Indicates whether the control is in design mode. Due to issues
// wiith the DesignMode property and nested controls,we need to
// evaluate this in the constructor.
readonly bool design_mode;
private readonly bool design_mode;
/// <summary>
/// Constructs a new instance.
@ -121,7 +122,7 @@ namespace OpenTK
InitializeComponent();
}
IGLControl Implementation
private IGLControl Implementation
{
get
{
@ -132,7 +133,7 @@ namespace OpenTK
}
[Conditional("DEBUG")]
void ValidateContext(string message)
private void ValidateContext(string message)
{
if (!Context.IsCurrent)
{
@ -140,7 +141,7 @@ namespace OpenTK
}
}
void ValidateState()
private void ValidateState()
{
if (IsDisposed)
throw new ObjectDisposedException(GetType().Name);

View file

@ -32,7 +32,7 @@ using OpenTK.Graphics;
namespace OpenTK
{
// Constructs GLControls.
class GLControlFactory
internal class GLControlFactory
{
public IGLControl CreateGLControl(GraphicsMode mode, Control control)
{

View file

@ -32,18 +32,18 @@ namespace OpenTK.Platform.MacOS
{
internal class NS
{
const string Library = "libdl.dylib";
private const string Library = "libdl.dylib";
[DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")]
static extern bool NSIsSymbolNameDefined(string s);
private static extern bool NSIsSymbolNameDefined(string s);
[DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")]
static extern bool NSIsSymbolNameDefined(IntPtr s);
private static extern bool NSIsSymbolNameDefined(IntPtr s);
[DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")]
static extern IntPtr NSLookupAndBindSymbol(string s);
private static extern IntPtr NSLookupAndBindSymbol(string s);
[DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")]
static extern IntPtr NSLookupAndBindSymbol(IntPtr s);
private static extern IntPtr NSLookupAndBindSymbol(IntPtr s);
[DllImport(Library, EntryPoint = "NSAddressOfSymbol")]
static extern IntPtr NSAddressOfSymbol(IntPtr symbol);
private static extern IntPtr NSAddressOfSymbol(IntPtr symbol);
[DllImport(Library)]
private static extern IntPtr dlopen(String fileName, int flags);
[DllImport(Library)]

View file

@ -33,9 +33,9 @@ using OpenTK.Platform;
namespace OpenTK
{
class Sdl2GLControl : IGLControl
internal class Sdl2GLControl : IGLControl
{
GraphicsMode mode;
private GraphicsMode mode;
public Sdl2GLControl(GraphicsMode mode, Control control)
{
@ -59,7 +59,7 @@ namespace OpenTK
public Platform.IWindowInfo WindowInfo { get; }
static class NativeMethods
private static class NativeMethods
{
[DllImport("SDL2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool SDL_HasEvents(int minType, int maxType);

View file

@ -33,9 +33,9 @@ using OpenTK.Platform;
namespace OpenTK
{
class WinGLControl : IGLControl
internal class WinGLControl : IGLControl
{
struct MSG
private struct MSG
{
public IntPtr HWnd;
public uint Message;
@ -51,7 +51,7 @@ namespace OpenTK
}
}
struct POINT
private struct POINT
{
public int X;
public int Y;
@ -75,10 +75,10 @@ namespace OpenTK
[System.Security.SuppressUnmanagedCodeSecurity]
[System.Runtime.InteropServices.DllImport("User32.dll")]
static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, int flags);
private static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, int flags);
MSG msg = new MSG();
GraphicsMode mode;
private MSG msg = new MSG();
private GraphicsMode mode;
public WinGLControl(GraphicsMode mode, Control control)
{

View file

@ -15,24 +15,24 @@ using OpenTK.Platform;
namespace OpenTK
{
class X11GLControl : IGLControl
internal class X11GLControl : IGLControl
{
[DllImport("libX11")]
static extern IntPtr XCreateColormap(IntPtr display, IntPtr window, IntPtr visual, int alloc);
private static extern IntPtr XCreateColormap(IntPtr display, IntPtr window, IntPtr visual, int alloc);
[DllImport("libX11", EntryPoint = "XGetVisualInfo")]
static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr vinfo_mask, ref XVisualInfo template, out int nitems);
private static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr vinfo_mask, ref XVisualInfo template, out int nitems);
static IntPtr XGetVisualInfo(IntPtr display, int vinfo_mask, ref XVisualInfo template, out int nitems)
private static IntPtr XGetVisualInfo(IntPtr display, int vinfo_mask, ref XVisualInfo template, out int nitems)
{
return XGetVisualInfoInternal(display, (IntPtr)vinfo_mask, ref template, out nitems);
}
[DllImport("libX11")]
extern static int XPending(IntPtr diplay);
private extern static int XPending(IntPtr diplay);
[StructLayout(LayoutKind.Sequential)]
struct XVisualInfo
private struct XVisualInfo
{
public IntPtr Visual;
public IntPtr VisualID;
@ -52,12 +52,12 @@ namespace OpenTK
}
}
GraphicsMode mode;
IntPtr display;
IntPtr rootWindow;
private GraphicsMode mode;
private IntPtr display;
private IntPtr rootWindow;
// Use reflection to retrieve the necessary values from Mono's Windows.Forms implementation.
Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
private Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
internal X11GLControl(GraphicsMode mode, Control control)
{
@ -122,13 +122,13 @@ namespace OpenTK
public IWindowInfo WindowInfo { get; }
static object GetStaticFieldValue(Type type, string fieldName)
private static object GetStaticFieldValue(Type type, string fieldName)
{
return type.GetField(fieldName,
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
}
static void SetStaticFieldValue(Type type, string fieldName, object value)
private static void SetStaticFieldValue(Type type, string fieldName, object value)
{
type.GetField(fieldName,
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(null, value);

View file

@ -12,7 +12,7 @@ namespace OpenTK.OSX
public static class OSXWindowInfoInitializer
{
#if GTK3
const string OSXLibGdkName = "libgdk-3.dylib";
private const string OSXLibGdkName = "libgdk-3.dylib";
#else
const string OSXLibGdkName = "libgdk-quartz-2.0.0.dylib";
#endif

View file

@ -33,7 +33,7 @@ namespace OpenTK.Win
#if GTK3
[SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_win32_window_get_handle(IntPtr w);
private static extern IntPtr gdk_win32_window_get_handle(IntPtr w);
#else
[SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d);

View file

@ -15,7 +15,7 @@ namespace OpenTK.X11
{
#if GTK3
const string UnixLibGdkName = "libgdk-3.so.0";
private const string UnixLibGdkName = "libgdk-3.so.0";
#else
const string UnixLibGdkName = "libgdk-x11-2.0.so.0";
#endif

View file

@ -40,7 +40,7 @@ namespace OpenTK.Audio
public sealed class AudioCapture : IDisposable
{
// This must stay private info so the end-user cannot call any Alc commands for the recording device.
IntPtr Handle;
private IntPtr Handle;
// Alc.CaptureStop should be called prior to device shutdown, this keeps track of Alc.CaptureStart/Stop calls.
@ -238,7 +238,7 @@ namespace OpenTK.Audio
// Retrieves the sample size in bytes for various ALFormats.
// Compressed formats always return 1.
static int GetSampleSize(ALFormat format)
private static int GetSampleSize(ALFormat format)
{
switch (format)
{
@ -272,7 +272,7 @@ namespace OpenTK.Audio
}
// Converts an error code to an error string with additional information.
string ErrorMessage(string devicename, int frequency, ALFormat bufferformat, int buffersize)
private string ErrorMessage(string devicename, int frequency, ALFormat bufferformat, int buffersize)
{
string alcerrmsg;
AlcError alcerrcode = CurrentError;

View file

@ -39,14 +39,14 @@ namespace OpenTK.Audio
/// </summary>
public sealed class AudioContext : IDisposable
{
bool disposed;
bool is_processing, is_synchronized;
ContextHandle context_handle;
bool context_exists;
private bool disposed;
private bool is_processing, is_synchronized;
private ContextHandle context_handle;
private bool context_exists;
string device_name;
static object audio_context_lock = new object();
static Dictionary<ContextHandle, AudioContext> available_contexts = new Dictionary<ContextHandle, AudioContext>();
private string device_name;
private static object audio_context_lock = new object();
private static Dictionary<ContextHandle, AudioContext> available_contexts = new Dictionary<ContextHandle, AudioContext>();
/// \internal
/// <summary>
@ -202,7 +202,7 @@ namespace OpenTK.Audio
/// Values higher than supported will be clamped by the driver.
/// </para>
/// </remarks>
void CreateContext(string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxAuxiliarySends)
private void CreateContext(string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxAuxiliarySends)
{
if (!AudioDeviceEnumerator.IsOpenALSupported)
throw new DllNotFoundException("openal32.dll");
@ -315,7 +315,7 @@ namespace OpenTK.Audio
/// <exception cref="AudioContextException">
/// Occurs when the AudioContext could not be made current.
/// </exception>
static void MakeCurrent(AudioContext context)
private static void MakeCurrent(AudioContext context)
{
lock (audio_context_lock)
{
@ -580,7 +580,7 @@ namespace OpenTK.Audio
GC.SuppressFinalize(this);
}
void Dispose(bool manual)
private void Dispose(bool manual)
{
if (!disposed)
{

View file

@ -31,10 +31,10 @@ using OpenTK.Audio.OpenAL;
namespace OpenTK.Audio
{
struct AudioDeviceErrorChecker : IDisposable
internal struct AudioDeviceErrorChecker : IDisposable
{
readonly IntPtr Device;
static readonly string ErrorString = "Device {0} reported {1}.";
private readonly IntPtr Device;
private static readonly string ErrorString = "Device {0} reported {1}.";
public AudioDeviceErrorChecker(IntPtr device)
{

View file

@ -75,7 +75,7 @@ namespace OpenTK.Audio.OpenAL
private const CallingConvention Style = CallingConvention.Cdecl;
[DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity]
unsafe static extern IntPtr sys_CreateContext([In] IntPtr device, [In] int* attrlist);
private unsafe static extern IntPtr sys_CreateContext([In] IntPtr device, [In] int* attrlist);
/// <summary>This function creates a context using a specified device.</summary>
/// <param name="device">a pointer to a device</param>
@ -106,7 +106,7 @@ namespace OpenTK.Audio.OpenAL
}
[DllImport(Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern bool MakeContextCurrent(IntPtr context);
private static extern bool MakeContextCurrent(IntPtr context);
/// <summary>This function makes a specified context the current context.</summary>
/// <param name="context">A pointer to the new context.</param>
@ -118,7 +118,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcProcessContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern void ProcessContext(IntPtr context);
private static extern void ProcessContext(IntPtr context);
/// <summary>This function tells a context to begin processing. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. alcSuspendContext can be used to suspend a context, and then all the OpenAL state changes can be applied at once, followed by a call to alcProcessContext to apply all the state changes immediately. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary>
/// <param name="context">a pointer to the new context</param>
@ -129,7 +129,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcSuspendContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern void SuspendContext(IntPtr context);
private static extern void SuspendContext(IntPtr context);
/// <summary>This function suspends processing on a specified context. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. A typical use of alcSuspendContext would be to suspend a context, apply all the OpenAL state changes at once, and then call alcProcessContext to apply all the state changes at once. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary>
/// <param name="context">a pointer to the context to be suspended.</param>
@ -140,7 +140,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcDestroyContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern void DestroyContext(IntPtr context);
private static extern void DestroyContext(IntPtr context);
/// <summary>This function destroys a context.</summary>
/// <param name="context">a pointer to the new context.</param>
@ -162,7 +162,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
[DllImport(Alc.Lib, EntryPoint = "alcGetContextsDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern IntPtr GetContextsDevice(IntPtr context);
private static extern IntPtr GetContextsDevice(IntPtr context);
/// <summary>This function retrieves a context's device pointer.</summary>
/// <param name="context">a pointer to a context.</param>
@ -307,7 +307,7 @@ namespace OpenTK.Audio.OpenAL
}
[DllImport(Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
unsafe static extern void GetInteger(IntPtr device, AlcGetInteger param, int size, int* data);
private unsafe static extern void GetInteger(IntPtr device, AlcGetInteger param, int size, int* data);
// ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer );
/// <summary>This function returns integers related to the context.</summary>

View file

@ -41,7 +41,7 @@ namespace OpenTK
/// </remarks>
public static class BlittableValueType<T>
{
static readonly Type Type;
private static readonly Type Type;
static BlittableValueType()
{
@ -87,7 +87,7 @@ namespace OpenTK
// Checks whether the parameter is a primitive type or consists of primitive types recursively.
// Throws a NotSupportedException if it is not.
static bool CheckType(Type type)
private static bool CheckType(Type type)
{
//Debug.Print("Checking type {0} (size: {1} bytes).", type.Name, Marshal.SizeOf(type));
if (type.IsPrimitive)
@ -110,7 +110,7 @@ namespace OpenTK
// Checks whether the specified struct defines [StructLayout(LayoutKind.Sequential, Pack=1)]
// or [StructLayout(LayoutKind.Explicit)]
static bool CheckStructLayoutAttribute(Type type)
private static bool CheckStructLayoutAttribute(Type type)
{
StructLayoutAttribute[] attr = (StructLayoutAttribute[])
type.GetCustomAttributes(typeof(StructLayoutAttribute), true);

View file

@ -40,11 +40,11 @@ namespace OpenTK
/// </summary>
public sealed class Configuration
{
static bool runningOnUnix, runningOnMacOS, runningOnLinux;
volatile static bool initialized;
readonly static object InitLock = new object();
private static bool runningOnUnix, runningOnMacOS, runningOnLinux;
private volatile static bool initialized;
private readonly static object InitLock = new object();
Configuration() { }
private Configuration() { }
/// <summary>Gets a System.Boolean indicating whether OpenTK is running on a Windows platform.</summary>
public static bool RunningOnWindows { get; private set; }
@ -113,7 +113,7 @@ namespace OpenTK
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct utsname
private struct utsname
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string sysname;
@ -161,7 +161,7 @@ namespace OpenTK
[DllImport("libc")]
private static extern void uname(out utsname uname_struct);
static bool DetectMono()
private static bool DetectMono()
{
// Detect the Mono runtime (code taken from http://mono.wikia.com/wiki/Detecting_if_program_is_running_in_Mono).
Type t = Type.GetType("Mono.Runtime");
@ -169,7 +169,7 @@ namespace OpenTK
}
#if SDL2
static bool DetectSdl2()
private static bool DetectSdl2()
{
bool supported = false;
@ -227,7 +227,7 @@ namespace OpenTK
}
#endif
static void DetectUnix(out bool unix, out bool linux, out bool macos)
private static void DetectUnix(out bool unix, out bool linux, out bool macos)
{
unix = linux = macos = false;
@ -253,7 +253,7 @@ namespace OpenTK
}
}
static bool DetectWindows()
private static bool DetectWindows()
{
return
System.Environment.OSVersion.Platform == PlatformID.Win32NT ||
@ -262,7 +262,7 @@ namespace OpenTK
System.Environment.OSVersion.Platform == PlatformID.WinCE;
}
static bool DetectX11()
private static bool DetectX11()
{
#if X11
// Detect whether X is present.

View file

@ -15,7 +15,7 @@ namespace OpenTK
/// </summary>
public struct ContextHandle : IComparable<ContextHandle>, IEquatable<ContextHandle>
{
IntPtr handle;
private IntPtr handle;
/// <summary>
/// Gets a System.IntPtr that represents the handle of this ContextHandle.

View file

@ -41,18 +41,18 @@ namespace OpenTK
// TODO: Add properties that describe the 'usable' size of the Display, i.e. the maximized size without the taskbar etc.
// TODO: Does not detect changes to primary device.
bool primary;
Rectangle bounds;
DisplayResolution current_resolution = new DisplayResolution();
List<DisplayResolution> available_resolutions = new List<DisplayResolution>();
IList<DisplayResolution> available_resolutions_readonly;
private bool primary;
private Rectangle bounds;
private DisplayResolution current_resolution = new DisplayResolution();
private List<DisplayResolution> available_resolutions = new List<DisplayResolution>();
private IList<DisplayResolution> available_resolutions_readonly;
internal object Id; // A platform-specific id for this monitor
static readonly object display_lock = new object();
static DisplayDevice primary_display;
private static readonly object display_lock = new object();
private static DisplayDevice primary_display;
static Platform.IDisplayDeviceDriver implementation;
private static Platform.IDisplayDeviceDriver implementation;
static DisplayDevice()
{
@ -267,7 +267,7 @@ namespace OpenTK
return null;
}
DisplayResolution FindResolution(int width, int height, int bitsPerPixel, float refreshRate)
private DisplayResolution FindResolution(int width, int height, int bitsPerPixel, float refreshRate)
{
return available_resolutions.Find(delegate(DisplayResolution test)
{

View file

@ -17,7 +17,7 @@ namespace OpenTK
/// <summary>Contains information regarding a monitor's display resolution.</summary>
public class DisplayResolution
{
Rectangle bounds;
private Rectangle bounds;
internal DisplayResolution() { }

View file

@ -34,7 +34,7 @@ namespace OpenTK
/// </summary>
public class FrameEventArgs : EventArgs
{
double elapsed;
private double elapsed;
/// <summary>
/// Constructs a new FrameEventArgs instance.

View file

@ -71,29 +71,29 @@ namespace OpenTK
/// </remarks>
public class GameWindow : NativeWindow, IGameWindow, IDisposable
{
const double MaxFrequency = 500.0; // Frequency cap for Update/RenderFrame events
private const double MaxFrequency = 500.0; // Frequency cap for Update/RenderFrame events
readonly Stopwatch watch = new Stopwatch();
private readonly Stopwatch watch = new Stopwatch();
IGraphicsContext glContext;
private IGraphicsContext glContext;
bool isExiting = false;
private bool isExiting = false;
double update_period, render_period;
double target_update_period, target_render_period;
private double update_period, render_period;
private double target_update_period, target_render_period;
double update_time; // length of last UpdateFrame event
double render_time; // length of last RenderFrame event
private double update_time; // length of last UpdateFrame event
private double render_time; // length of last RenderFrame event
double update_timestamp; // timestamp of last UpdateFrame event
double render_timestamp; // timestamp of last RenderFrame event
private double update_timestamp; // timestamp of last UpdateFrame event
private double render_timestamp; // timestamp of last RenderFrame event
double update_epsilon; // quantization error for UpdateFrame events
private double update_epsilon; // quantization error for UpdateFrame events
bool is_running_slowly; // true, when UpdatePeriod cannot reach TargetUpdatePeriod
private bool is_running_slowly; // true, when UpdatePeriod cannot reach TargetUpdatePeriod
FrameEventArgs update_args = new FrameEventArgs();
FrameEventArgs render_args = new FrameEventArgs();
private FrameEventArgs update_args = new FrameEventArgs();
private FrameEventArgs render_args = new FrameEventArgs();
/// <summary>Constructs a new GameWindow with sensible default attributes.</summary>
public GameWindow()
@ -361,12 +361,12 @@ namespace OpenTK
}
}
double ClampElapsed(double elapsed)
private double ClampElapsed(double elapsed)
{
return MathHelper.Clamp(elapsed, 0.0, 1.0);
}
void DispatchUpdateAndRenderFrame(object sender, EventArgs e)
private void DispatchUpdateAndRenderFrame(object sender, EventArgs e)
{
int is_running_slowly_retries = 4;
double timestamp = watch.Elapsed.TotalSeconds;
@ -410,7 +410,7 @@ namespace OpenTK
}
}
void RaiseUpdateFrame(double elapsed, ref double timestamp)
private void RaiseUpdateFrame(double elapsed, ref double timestamp)
{
// Raise UpdateFrame event
update_args.Time = elapsed;
@ -426,7 +426,7 @@ namespace OpenTK
}
void RaiseRenderFrame(double elapsed, ref double timestamp)
private void RaiseRenderFrame(double elapsed, ref double timestamp)
{
// Raise RenderFrame event
render_args.Time = elapsed;

View file

@ -36,7 +36,7 @@ namespace OpenTK.Graphics
/// </remarks>
public struct ColorFormat : IComparable<ColorFormat>, IEquatable<ColorFormat>
{
byte red, green, blue, alpha;
private byte red, green, blue, alpha;
/// <summary>
/// Constructs a new ColorFormat with the specified aggregate bits per pixel.

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.ES10
//
// Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion!
struct ErrorHelper : IDisposable
internal struct ErrorHelper : IDisposable
{
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly object SyncRoot = new object();
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context)
{

View file

@ -9,6 +9,6 @@ namespace OpenTK.Graphics.ES10
/// </summary>
public sealed partial class GL
{
const string Library = "libGLES.dll";
private const string Library = "libGLES.dll";
}
}

File diff suppressed because it is too large Load diff

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.ES11
//
// Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion!
struct ErrorHelper : IDisposable
internal struct ErrorHelper : IDisposable
{
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly object SyncRoot = new object();
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context)
{

View file

@ -15,13 +15,13 @@ namespace OpenTK.Graphics.ES11
#if IPHONE
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
#else
const string Library = "GLESv1_CM";
private const string Library = "GLESv1_CM";
#endif
static readonly object sync_root = new object();
private static readonly object sync_root = new object();
static IntPtr[] EntryPoints;
static byte[] EntryPointNames;
static int[] EntryPointNameOffsets;
private static IntPtr[] EntryPoints;
private static byte[] EntryPointNames;
private static int[] EntryPointNameOffsets;
/// <summary>
/// Constructs a new instance.

File diff suppressed because it is too large Load diff

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.ES20
//
// Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion!
struct ErrorHelper : IDisposable
internal struct ErrorHelper : IDisposable
{
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly object SyncRoot = new object();
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context)
{

View file

@ -41,13 +41,13 @@ namespace OpenTK.Graphics.ES20
#if IPHONE
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
#else
const string Library = "libGLESv2.dll";
private const string Library = "libGLESv2.dll";
#endif
static readonly object sync_root = new object();
private static readonly object sync_root = new object();
static IntPtr[] EntryPoints;
static byte[] EntryPointNames;
static int[] EntryPointNameOffsets;
private static IntPtr[] EntryPoints;
private static byte[] EntryPointNames;
private static int[] EntryPointNameOffsets;
/// <summary>
/// Constructs a new instance.

File diff suppressed because it is too large Load diff

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.ES30
//
// Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion!
struct ErrorHelper : IDisposable
internal struct ErrorHelper : IDisposable
{
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly object SyncRoot = new object();
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context)
{

View file

@ -41,13 +41,13 @@ namespace OpenTK.Graphics.ES30
#if IPHONE
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
#else
const string Library = "libGLESv2.dll";
private const string Library = "libGLESv2.dll";
#endif
static readonly object sync_root = new object();
private static readonly object sync_root = new object();
static IntPtr[] EntryPoints;
static byte[] EntryPointNames;
static int[] EntryPointNameOffsets;
private static IntPtr[] EntryPoints;
private static byte[] EntryPointNames;
private static int[] EntryPointNameOffsets;
/// <summary>
/// Constructs a new instance.

View file

@ -50,8 +50,8 @@ namespace OpenTK.Graphics
/// <returns>The current OpenGL context, or <c>IntPtr.Zero</c> if no context is on the calling thread.</returns>
public delegate ContextHandle GetCurrentContextDelegate();
IGraphicsContext implementation; // The actual render context implementation for the underlying platform.
bool disposed;
private IGraphicsContext implementation; // The actual render context implementation for the underlying platform.
private bool disposed;
// Cache for the context handle. We need this for RemoveContext()
// in case the user does not call Dispose(). When this happens,
@ -59,11 +59,11 @@ namespace OpenTK.Graphics
// the IGraphicsContext implementation may already be null
// (hence we cannot call implementation.Context to retrieve
// the handle.)
ContextHandle handle_cached;
private ContextHandle handle_cached;
readonly static object SyncRoot = new object();
private readonly static object SyncRoot = new object();
// Maps OS-specific context handles to GraphicsContext instances.
readonly static Dictionary<ContextHandle, IGraphicsContext> available_contexts =
private readonly static Dictionary<ContextHandle, IGraphicsContext> available_contexts =
new Dictionary<ContextHandle, IGraphicsContext>();
/// <summary>
@ -294,7 +294,7 @@ namespace OpenTK.Graphics
(this as IGraphicsContextInternal).Context == (obj as IGraphicsContextInternal).Context;
}
static void AddContext(IGraphicsContextInternal context)
private static void AddContext(IGraphicsContextInternal context)
{
ContextHandle ctx = context.Context;
if (!available_contexts.ContainsKey(ctx))
@ -309,7 +309,7 @@ namespace OpenTK.Graphics
}
}
static void RemoveContext(IGraphicsContextInternal context)
private static void RemoveContext(IGraphicsContextInternal context)
{
ContextHandle ctx = context.Context;
if (available_contexts.ContainsKey(ctx))
@ -322,7 +322,7 @@ namespace OpenTK.Graphics
}
}
static IGraphicsContext FindSharedContext()
private static IGraphicsContext FindSharedContext()
{
if (GraphicsContext.ShareContexts)
{
@ -562,7 +562,7 @@ namespace OpenTK.Graphics
GC.SuppressFinalize(this);
}
void Dispose(bool manual)
private void Dispose(bool manual)
{
if (!IsDisposed)
{

View file

@ -34,7 +34,7 @@ using OpenTK.Platform;
namespace OpenTK.Graphics
{
// Provides the foundation for all IGraphicsContext implementations.
abstract class GraphicsContextBase : IGraphicsContext, IGraphicsContextInternal, IEquatable<IGraphicsContextInternal>
internal abstract class GraphicsContextBase : IGraphicsContext, IGraphicsContextInternal, IEquatable<IGraphicsContextInternal>
{
protected ContextHandle Handle;
protected GraphicsMode Mode;

View file

@ -14,10 +14,10 @@ namespace OpenTK.Graphics
/// <summary>Defines the format for graphics operations.</summary>
public class GraphicsMode : IEquatable<GraphicsMode>
{
int samples;
private int samples;
static GraphicsMode defaultMode;
static readonly object SyncRoot = new object();
private static GraphicsMode defaultMode;
private static readonly object SyncRoot = new object();
// Disable BeforeFieldInit
static GraphicsMode() { }

View file

@ -29,7 +29,7 @@ using System.Text;
namespace OpenTK.Graphics
{
sealed class GraphicsModeComparer : IComparer<GraphicsMode>
internal sealed class GraphicsModeComparer : IComparer<GraphicsMode>
{
public int Compare(GraphicsMode x, GraphicsMode y)
{

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.OpenGL
//
// Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion!
struct ErrorHelper : IDisposable
internal struct ErrorHelper : IDisposable
{
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly object SyncRoot = new object();
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context)
{

File diff suppressed because it is too large Load diff

View file

@ -67,11 +67,11 @@ namespace OpenTK.Graphics.OpenGL
{
internal const string Library = "opengl32.dll";
static readonly object sync_root = new object();
private static readonly object sync_root = new object();
static IntPtr[] EntryPoints;
static byte[] EntryPointNames;
static int[] EntryPointNameOffsets;
private static IntPtr[] EntryPoints;
private static byte[] EntryPointNames;
private static int[] EntryPointNameOffsets;
/// <summary>
/// Constructs a new instance.

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.OpenGL4
//
// Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion!
struct ErrorHelper : IDisposable
internal struct ErrorHelper : IDisposable
{
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly object SyncRoot = new object();
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context)
{

File diff suppressed because it is too large Load diff

View file

@ -38,12 +38,12 @@ namespace OpenTK.Graphics.OpenGL4
/// </summary>
public sealed partial class GL : GraphicsBindingsBase
{
const string Library = "opengl32.dll";
static readonly object sync_root = new object();
private const string Library = "opengl32.dll";
private static readonly object sync_root = new object();
static IntPtr[] EntryPoints;
static byte[] EntryPointNames;
static int[] EntryPointNameOffsets;
private static IntPtr[] EntryPoints;
private static byte[] EntryPointNames;
private static int[] EntryPointNameOffsets;
/// <summary>
/// Constructs a new instance.

View file

@ -29,7 +29,7 @@ using System;
namespace OpenTK.Input
{
enum ConfigurationType
internal enum ConfigurationType
{
Unmapped = 0,
Axis,

View file

@ -7,7 +7,7 @@ namespace OpenTK.Input
/// </summary>
public class FileDropEventArgs : EventArgs
{
string fileName;
private string fileName;
/// <summary>
/// Gets the name of the file.

View file

@ -45,7 +45,7 @@ namespace OpenTK.Input
internal const int MaxAxisCount = 10;
internal const int MaxDPadCount = 2;
static readonly IGamePadDriver driver =
private static readonly IGamePadDriver driver =
Platform.Factory.Default.CreateGamePadDriver();
private GamePad() { }

View file

@ -34,7 +34,7 @@ namespace OpenTK.Input
/// </summary>
public struct GamePadButtons : IEquatable<GamePadButtons>
{
Buttons buttons;
private Buttons buttons;
/// <summary>
/// Initializes a new instance of the <see cref="OpenTK.Input.GamePadButtons"/> structure.
@ -232,7 +232,7 @@ namespace OpenTK.Input
return buttons == other.buttons;
}
ButtonState GetButton(Buttons b)
private ButtonState GetButton(Buttons b)
{
return (buttons & b) != 0 ? ButtonState.Pressed : ButtonState.Released;
}

View file

@ -34,9 +34,9 @@ namespace OpenTK.Input
/// </summary>
public struct GamePadCapabilities : IEquatable<GamePadCapabilities>
{
Buttons buttons;
GamePadAxes axes;
byte gamepad_type;
private Buttons buttons;
private GamePadAxes axes;
private byte gamepad_type;
internal GamePadCapabilities(GamePadType type, GamePadAxes axes, Buttons buttons, bool is_connected, bool is_mapped)
: this()

View file

@ -30,11 +30,11 @@ using System.Collections.Generic;
namespace OpenTK.Input
{
sealed class GamePadConfiguration
internal sealed class GamePadConfiguration
{
static readonly char[] ConfigurationSeparator = new char[] { ',' };
private static readonly char[] ConfigurationSeparator = new char[] { ',' };
readonly List<GamePadConfigurationItem> configuration_items =
private readonly List<GamePadConfigurationItem> configuration_items =
new List<GamePadConfigurationItem>();
public Guid Guid { get; private set; }
@ -55,10 +55,10 @@ namespace OpenTK.Input
/// Parses a GamePad configuration string.
/// This string must follow the rules for SDL2
/// GameController outlined here:
/// http://wiki.libsdl.org/SDL_GameControllerAddMapping
/// http://wiki.libsdl.org/SDL_GameControllerAddMapping
/// </summary>
/// <param name="configuration"></param>
void ParseConfiguration(string configuration)
private void ParseConfiguration(string configuration)
{
if (String.IsNullOrEmpty(configuration))
{
@ -93,7 +93,7 @@ namespace OpenTK.Input
/// </summary>
/// <param name="target">The string to parse</param>
/// <returns>The configuration target (Button index, axis index etc.)</returns>
static GamePadConfigurationTarget ParseTarget(string target)
private static GamePadConfigurationTarget ParseTarget(string target)
{
switch (target)
{
@ -157,7 +157,7 @@ namespace OpenTK.Input
/// </summary>
/// <param name="item">The string to parse</param>
/// <returns>The new gamepad configuration source</returns>
static GamePadConfigurationSource ParseSource(string item)
private static GamePadConfigurationSource ParseSource(string item)
{
if (String.IsNullOrEmpty(item))
{
@ -190,7 +190,7 @@ namespace OpenTK.Input
/// </summary>
/// <param name="item">The string to parse</param>
/// <returns>The index of the axis or button</returns>
static int ParseIndex(string item)
private static int ParseIndex(string item)
{
// item is in the format "a#" where # a zero-based integer number
return Int32.Parse(item.Substring(1)); ;
@ -204,7 +204,7 @@ namespace OpenTK.Input
/// <param name="item">The string to parse</param>
/// <param name="position">The hat position assigned via 'out'</param>
/// <returns>The new joystick hat</returns>
static JoystickHat ParseHat(string item, out HatPosition position)
private static JoystickHat ParseHat(string item, out HatPosition position)
{
JoystickHat hat = JoystickHat.Hat0;
int id = Int32.Parse(item.Substring(1, 1));

View file

@ -30,11 +30,11 @@ using System.Collections.Generic;
namespace OpenTK.Input
{
class GamePadConfigurationDatabase
internal class GamePadConfigurationDatabase
{
internal const string UnmappedName = "Unmapped Controller";
readonly Dictionary<Guid, string> Configurations = new Dictionary<Guid, string>();
private readonly Dictionary<Guid, string> Configurations = new Dictionary<Guid, string>();
internal GamePadConfigurationDatabase()
{

View file

@ -29,7 +29,7 @@ using System;
namespace OpenTK.Input
{
class GamePadConfigurationItem
internal class GamePadConfigurationItem
{
public GamePadConfigurationItem(GamePadConfigurationSource source, GamePadConfigurationTarget target)
{

View file

@ -27,12 +27,12 @@
namespace OpenTK.Input
{
struct GamePadConfigurationSource
internal struct GamePadConfigurationSource
{
int? map_button;
int? map_axis;
JoystickHat? map_hat;
HatPosition? map_hat_position;
private int? map_button;
private int? map_axis;
private JoystickHat? map_hat;
private HatPosition? map_hat_position;
/// <summary>
/// Creates a new gamepad configuration source from an axis or a button

View file

@ -29,10 +29,10 @@ using System;
namespace OpenTK.Input
{
struct GamePadConfigurationTarget
internal struct GamePadConfigurationTarget
{
Nullable<Buttons> map_button;
Nullable<GamePadAxes> map_axis;
private Nullable<Buttons> map_button;
private Nullable<GamePadAxes> map_axis;
public GamePadConfigurationTarget(Buttons button)
: this()

View file

@ -35,7 +35,7 @@ namespace OpenTK.Input
public struct GamePadDPad : IEquatable<GamePadDPad>
{
[Flags]
enum DPadButtons : byte
private enum DPadButtons : byte
{
Up = Buttons.DPadUp,
Down = Buttons.DPadDown,
@ -43,7 +43,7 @@ namespace OpenTK.Input
Right = Buttons.DPadRight
}
DPadButtons buttons;
private DPadButtons buttons;
internal GamePadDPad(Buttons state)
{
@ -179,7 +179,7 @@ namespace OpenTK.Input
Equals((GamePadDPad)obj);
}
void SetButton(DPadButtons button, bool value)
private void SetButton(DPadButtons button, bool value)
{
if (value)
{

View file

@ -32,15 +32,15 @@ namespace OpenTK.Input
/// </summary>
public struct GamePadState : IEquatable<GamePadState>
{
const float RangeMultiplier = 1.0f / (short.MaxValue + 1);
private const float RangeMultiplier = 1.0f / (short.MaxValue + 1);
Buttons buttons;
short left_stick_x;
short left_stick_y;
short right_stick_x;
short right_stick_y;
byte left_trigger;
byte right_trigger;
private Buttons buttons;
private short left_stick_x;
private short left_stick_y;
private short right_stick_x;
private short right_stick_y;
private byte left_trigger;
private byte right_trigger;
/// <summary>
/// Gets a <see cref="GamePadThumbSticks"/> structure describing the
@ -205,13 +205,13 @@ namespace OpenTK.Input
PacketNumber = number;
}
bool IsAxisValid(GamePadAxes axis)
private bool IsAxisValid(GamePadAxes axis)
{
int index = (int)axis;
return index >= 0 && index < GamePad.MaxAxisCount;
}
bool IsDPadValid(int index)
private bool IsDPadValid(int index)
{
return index >= 0 && index < GamePad.MaxDPadCount;
}

View file

@ -34,9 +34,9 @@ namespace OpenTK.Input
/// </summary>
public struct GamePadThumbSticks : IEquatable<GamePadThumbSticks>
{
const float ConversionFactor = 1.0f / short.MaxValue;
short left_x, left_y;
short right_x, right_y;
private const float ConversionFactor = 1.0f / short.MaxValue;
private short left_x, left_y;
private short right_x, right_y;
internal GamePadThumbSticks(
short left_x, short left_y,

View file

@ -35,9 +35,9 @@ namespace OpenTK.Input
/// </summary>
public struct GamePadTriggers : IEquatable<GamePadTriggers>
{
const float ConversionFactor = 1.0f / byte.MaxValue;
byte left;
byte right;
private const float ConversionFactor = 1.0f / byte.MaxValue;
private byte left;
private byte right;
internal GamePadTriggers(byte left, byte right)
{

View file

@ -4,7 +4,7 @@ using System.Text;
namespace OpenTK.Input
{
interface IGamePadDriver
internal interface IGamePadDriver
{
GamePadState GetState(int index);

View file

@ -30,7 +30,7 @@ using System.Text;
namespace OpenTK.Input
{
// Defines the interface for a 2nd generation input driver.
interface IInputDriver2 : IDisposable
internal interface IInputDriver2 : IDisposable
{
IMouseDriver2 MouseDriver { get; }
IKeyboardDriver2 KeyboardDriver { get; }

View file

@ -31,7 +31,7 @@ using System.Text;
namespace OpenTK.Input
{
interface IJoystickDriver2
internal interface IJoystickDriver2
{
JoystickState GetState(int index);
JoystickCapabilities GetCapabilities(int index);

View file

@ -4,7 +4,7 @@ using System.Text;
namespace OpenTK.Input
{
interface IKeyboardDriver2
internal interface IKeyboardDriver2
{
/// <summary>
/// Retrieves the combined <see cref="OpenTK.Input.KeyboardState"/> for all keyboard devices.

View file

@ -29,7 +29,7 @@ using System.Text;
namespace OpenTK.Input
{
interface IMouseDriver2
internal interface IMouseDriver2
{
MouseState GetState();
MouseState GetState(int index);

View file

@ -41,7 +41,7 @@ namespace OpenTK.Input
/// <seealso cref="GamePad"/>
public sealed class Joystick
{
static readonly IJoystickDriver2 implementation =
private static readonly IJoystickDriver2 implementation =
Platform.Factory.Default.CreateJoystickDriver();
private Joystick() { }

View file

@ -37,9 +37,9 @@ namespace OpenTK.Input
/// </summary>
public struct JoystickCapabilities : IEquatable<JoystickCapabilities>
{
byte axis_count;
byte button_count;
byte hat_count;
private byte axis_count;
private byte button_count;
private byte hat_count;
internal JoystickCapabilities(int axis_count, int button_count, int hat_count, bool is_connected)
{

View file

@ -33,8 +33,8 @@ namespace OpenTK.Input
/// </summary>
public abstract class JoystickDevice : IInputDevice
{
JoystickMoveEventArgs move_args = new JoystickMoveEventArgs(0, 0, 0);
JoystickButtonEventArgs button_args = new JoystickButtonEventArgs(0, false);
private JoystickMoveEventArgs move_args = new JoystickMoveEventArgs(0, 0, 0);
private JoystickButtonEventArgs button_args = new JoystickButtonEventArgs(0, false);
internal JoystickDevice(int id, int axes, int buttons)
{
@ -206,7 +206,7 @@ namespace OpenTK.Input
/// </summary>
public sealed class JoystickButtonCollection
{
bool[] button_state;
private bool[] button_state;
internal JoystickButtonCollection(int numButtons)
{
@ -241,7 +241,7 @@ namespace OpenTK.Input
/// </summary>
public sealed class JoystickAxisCollection
{
float[] axis_state;
private float[] axis_state;
internal JoystickAxisCollection(int numAxes)
{

Some files were not shown because too many files have changed in this diff Show more