mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-25 05:05:28 +00:00
* CppSpecWriter.cs: Added constructor declaration.
This commit is contained in:
parent
b3649572ea
commit
4a5313ad47
|
@ -58,9 +58,10 @@ namespace Bind
|
||||||
|
|
||||||
Settings.DefaultOutputNamespace = "OpenTK";
|
Settings.DefaultOutputNamespace = "OpenTK";
|
||||||
|
|
||||||
string temp_core_file = Path.GetTempFileName();
|
string temp_header_file = Path.GetTempFileName();
|
||||||
|
string temp_cpp_file = Path.GetTempFileName();
|
||||||
|
|
||||||
using (BindStreamWriter sw = new BindStreamWriter(temp_core_file))
|
using (BindStreamWriter sw = new BindStreamWriter(temp_header_file))
|
||||||
{
|
{
|
||||||
WriteLicense(sw);
|
WriteLicense(sw);
|
||||||
|
|
||||||
|
@ -75,10 +76,54 @@ namespace Bind
|
||||||
sw.WriteLine("}");
|
sw.WriteLine("}");
|
||||||
}
|
}
|
||||||
|
|
||||||
string output_core = Path.Combine(Settings.OutputPath, "gl.h");
|
using (BindStreamWriter sw = new BindStreamWriter(temp_cpp_file))
|
||||||
if (File.Exists(output_core))
|
{
|
||||||
File.Delete(output_core);
|
WriteLicense(sw);
|
||||||
File.Move(temp_core_file, output_core);
|
|
||||||
|
sw.WriteLine("namespace {0}", Settings.OutputNamespace);
|
||||||
|
sw.WriteLine("{");
|
||||||
|
sw.Indent();
|
||||||
|
|
||||||
|
WriteLoader(sw, wrappers, Type.CSTypes);
|
||||||
|
|
||||||
|
sw.Unindent();
|
||||||
|
sw.WriteLine("}");
|
||||||
|
}
|
||||||
|
|
||||||
|
string output_header = Path.Combine(Settings.OutputPath, "gl++.h");
|
||||||
|
string output_cpp = Path.Combine(Settings.OutputPath, "gl++.cpp");
|
||||||
|
if (File.Exists(output_header))
|
||||||
|
File.Delete(output_header);
|
||||||
|
File.Move(temp_header_file, output_header);
|
||||||
|
if (File.Exists(output_cpp))
|
||||||
|
File.Delete(output_cpp);
|
||||||
|
File.Move(temp_cpp_file, output_cpp);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region WriteLoader
|
||||||
|
|
||||||
|
void WriteLoader(BindStreamWriter sw, FunctionCollection wrappers,
|
||||||
|
Dictionary<string, string> CSTypes)
|
||||||
|
{
|
||||||
|
foreach (var ext in wrappers.Keys)
|
||||||
|
{
|
||||||
|
if (ext == "Core")
|
||||||
|
sw.WriteLine("{0}::{0}()", Settings.GLClass);
|
||||||
|
else
|
||||||
|
sw.WriteLine("{0}::{1}::{1}()", Settings.GLClass, ext);
|
||||||
|
sw.WriteLine("{");
|
||||||
|
sw.Indent();
|
||||||
|
|
||||||
|
foreach (var function in wrappers[ext])
|
||||||
|
{
|
||||||
|
sw.WriteLine("{0} = GetAddress(\"{1}\");", function.TrimmedName, function.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
sw.Unindent();
|
||||||
|
sw.WriteLine("}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -87,12 +132,7 @@ namespace Bind
|
||||||
|
|
||||||
public void WriteDelegates(BindStreamWriter sw, DelegateCollection delegates)
|
public void WriteDelegates(BindStreamWriter sw, DelegateCollection delegates)
|
||||||
{
|
{
|
||||||
Trace.WriteLine(String.Format("Writing delegates to:\t{0}", Settings.OutputNamespace));
|
throw new NotImplementedException();
|
||||||
|
|
||||||
foreach (Delegate d in delegates.Values)
|
|
||||||
{
|
|
||||||
sw.WriteLine("extern {0} {1}({2});", d.ReturnType, d.Name, d.Parameters);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -101,6 +141,7 @@ namespace Bind
|
||||||
|
|
||||||
public void WriteImports(BindStreamWriter sw, DelegateCollection delegates)
|
public void WriteImports(BindStreamWriter sw, DelegateCollection delegates)
|
||||||
{
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue