mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-03 01:01:07 +00:00
* CppSpecWriter.cs: Do not allow namespaces that start with a digit.
This commit is contained in:
parent
b74d3339a3
commit
c09a6dc34b
|
@ -43,6 +43,7 @@ namespace Bind
|
||||||
{
|
{
|
||||||
readonly char[] numbers = "0123456789".ToCharArray();
|
readonly char[] numbers = "0123456789".ToCharArray();
|
||||||
const string AllowDeprecated = "ALLOW_DEPRECATED_GL";
|
const string AllowDeprecated = "ALLOW_DEPRECATED_GL";
|
||||||
|
const string DigitPrefix = "T"; // Prefix for identifiers that start with a digit
|
||||||
|
|
||||||
#region WriteBindings
|
#region WriteBindings
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ namespace Bind
|
||||||
{
|
{
|
||||||
var three_dee_fx = wrappers["3dfx"];
|
var three_dee_fx = wrappers["3dfx"];
|
||||||
wrappers.Remove("3dfx");
|
wrappers.Remove("3dfx");
|
||||||
wrappers.Add("T3dfx", three_dee_fx);
|
wrappers.Add(DigitPrefix + "3dfx", three_dee_fx);
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings.DefaultOutputNamespace = "OpenTK";
|
Settings.DefaultOutputNamespace = "OpenTK";
|
||||||
|
@ -128,6 +129,8 @@ namespace Bind
|
||||||
void WriteLoader(BindStreamWriter sw, FunctionCollection wrappers,
|
void WriteLoader(BindStreamWriter sw, FunctionCollection wrappers,
|
||||||
Dictionary<string, string> CSTypes)
|
Dictionary<string, string> CSTypes)
|
||||||
{
|
{
|
||||||
|
sw.WriteLine("using namespace Internals;");
|
||||||
|
|
||||||
// Used to avoid multiple declarations of the same function
|
// Used to avoid multiple declarations of the same function
|
||||||
Delegate last_delegate = null;
|
Delegate last_delegate = null;
|
||||||
|
|
||||||
|
@ -152,11 +155,8 @@ namespace Bind
|
||||||
continue;
|
continue;
|
||||||
last_delegate = function.WrappedDelegate;
|
last_delegate = function.WrappedDelegate;
|
||||||
|
|
||||||
if (ext == "Core")
|
string path = GetNamespace(ext);
|
||||||
sw.WriteLine("{0}::Delegates::p{1} {0}::Delegates::{1} = 0;", Settings.GLClass, function.Name);
|
sw.WriteLine("{0}::Delegates::p{1} {0}::Delegates::{1} = 0;", path, function.Name);
|
||||||
else
|
|
||||||
sw.WriteLine("{0}::{1}::Delegates::p{2} {0}::{1}::Delegates::{2} = 0;", Settings.GLClass,
|
|
||||||
function.Extension, function.Name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current == deprecated)
|
if (current == deprecated)
|
||||||
|
@ -171,11 +171,8 @@ namespace Bind
|
||||||
// Add Init() methods
|
// Add Init() methods
|
||||||
foreach (var ext in wrappers.Keys)
|
foreach (var ext in wrappers.Keys)
|
||||||
{
|
{
|
||||||
string path = null;
|
string path = GetNamespace(ext);
|
||||||
if (ext == "Core")
|
|
||||||
path = Settings.GLClass;
|
|
||||||
else
|
|
||||||
path = String.Format("{0}::{1}", Settings.GLClass, ext);
|
|
||||||
sw.WriteLine("void {0}::Init()", path);
|
sw.WriteLine("void {0}::Init()", path);
|
||||||
sw.WriteLine("{");
|
sw.WriteLine("{");
|
||||||
sw.Indent();
|
sw.Indent();
|
||||||
|
@ -213,6 +210,14 @@ namespace Bind
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string GetNamespace(string ext)
|
||||||
|
{
|
||||||
|
if (ext == "Core")
|
||||||
|
return Settings.GLClass;
|
||||||
|
else
|
||||||
|
return String.Format("{0}::{1}", Settings.GLClass, Char.IsDigit(ext[0]) ? DigitPrefix + ext : ext);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region WriteDelegates
|
#region WriteDelegates
|
||||||
|
|
Loading…
Reference in a new issue