* CppSpecWriter.cs: Mark deprecated functions.

This commit is contained in:
the_fiddler 2010-12-05 08:48:44 +00:00
parent 778ddbe0e8
commit 9feb6a6b7c

View file

@ -122,19 +122,25 @@ namespace Bind
sw.Indent();
}
// Avoid multiple definitions of the same function
Delegate last_delegate = null;
foreach (Function f in wrappers[extension])
// Write forward-compatible functions
foreach (Function f in wrappers[extension].Where(f => !f.Deprecated).Select(f => f))
{
var d = f.WrappedDelegate;
// Avoid multiple definitions of the same function
if (d != last_delegate)
{
last_delegate = d;
sw.WriteLine("static {0} (*p{1})({2});", d.ReturnType, f.TrimmedName, d.Parameters);
sw.WriteLine("extern p{0} {0};", f.TrimmedName);
}
WriteDelegate(sw, f, ref last_delegate);
}
// Write deprecated functions
sw.WriteLine("#ifdef ALLOW_DEPRECATED_GL");
sw.Indent();
foreach (Function f in wrappers[extension].Where(f => !f.Deprecated).Select(f => f))
{
WriteDelegate(sw, f, ref last_delegate);
}
sw.Unindent();
sw.WriteLine("#endif");
if (extension != "Core")
{
sw.Unindent();
@ -146,6 +152,18 @@ namespace Bind
sw.WriteLine("};");
}
private static void WriteDelegate(BindStreamWriter sw, Function f, ref Delegate last_delegate)
{
var d = f.WrappedDelegate;
// Avoid multiple definitions of the same function
if (d != last_delegate)
{
last_delegate = d;
sw.WriteLine("static {0} (*p{1})({2});", d.ReturnType, f.TrimmedName, d.Parameters);
sw.WriteLine("extern p{0} {0};", f.TrimmedName);
}
}
static DocProcessor processor = new DocProcessor(Path.Combine(Settings.DocPath, Settings.DocFile));
static Dictionary<string, string> docfiles;
void WriteDocumentation(BindStreamWriter sw, Function f)