mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-07 19:50:51 +00:00
Take api version into account
XmlSpecReader will now respect version attributes and will avoid inserting foreign tokens into the generated bindings.
This commit is contained in:
parent
08823f5d5b
commit
922fb935a1
|
@ -56,7 +56,7 @@ namespace Bind
|
||||||
|
|
||||||
#region ISpecReader Members
|
#region ISpecReader Members
|
||||||
|
|
||||||
public void ReadDelegates(string file, DelegateCollection delegates, string apiname, string apiversion)
|
public void ReadDelegates(string file, DelegateCollection delegates, string apiname, string apiversions)
|
||||||
{
|
{
|
||||||
var specs = new XPathDocument(file);
|
var specs = new XPathDocument(file);
|
||||||
|
|
||||||
|
@ -71,6 +71,8 @@ namespace Bind
|
||||||
apiname = null;
|
apiname = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var apiversion in apiversions.Split('|'))
|
||||||
|
{
|
||||||
string xpath_add, xpath_delete;
|
string xpath_add, xpath_delete;
|
||||||
GetSignaturePaths(apiname, apiversion, out xpath_add, out xpath_delete);
|
GetSignaturePaths(apiname, apiversion, out xpath_add, out xpath_delete);
|
||||||
|
|
||||||
|
@ -84,8 +86,9 @@ namespace Bind
|
||||||
Utilities.Merge(delegates, ReadDelegates(nav, apiversion));
|
Utilities.Merge(delegates, ReadDelegates(nav, apiversion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ReadEnums(string file, EnumCollection enums, string apiname, string apiversion)
|
public void ReadEnums(string file, EnumCollection enums, string apiname, string apiversions)
|
||||||
{
|
{
|
||||||
var specs = new XPathDocument(file);
|
var specs = new XPathDocument(file);
|
||||||
|
|
||||||
|
@ -100,6 +103,8 @@ namespace Bind
|
||||||
apiname = null;
|
apiname = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var apiversion in apiversions.Split('|'))
|
||||||
|
{
|
||||||
string xpath_add, xpath_delete;
|
string xpath_add, xpath_delete;
|
||||||
GetSignaturePaths(apiname, apiversion, out xpath_add, out xpath_delete);
|
GetSignaturePaths(apiname, apiversion, out xpath_add, out xpath_delete);
|
||||||
|
|
||||||
|
@ -115,6 +120,7 @@ namespace Bind
|
||||||
Utilities.Merge(enums, ReadEnums(nav));
|
Utilities.Merge(enums, ReadEnums(nav));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Dictionary<string, string> ReadTypeMap(string file)
|
public Dictionary<string, string> ReadTypeMap(string file)
|
||||||
{
|
{
|
||||||
|
@ -217,10 +223,21 @@ namespace Bind
|
||||||
xpath_add = "/signatures/add";
|
xpath_add = "/signatures/add";
|
||||||
xpath_delete = "/signatures/delete";
|
xpath_delete = "/signatures/delete";
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(apiname))
|
if (!String.IsNullOrEmpty(apiname) && !String.IsNullOrEmpty(apiversion))
|
||||||
{
|
{
|
||||||
xpath_add += String.Format("[contains(concat('|', @name, '|'), '|{0}|')]", apiname);
|
var match = String.Format(
|
||||||
xpath_delete += String.Format("[contains(concat('|', @name, '|'), '|{0}|')]", apiname);
|
"[contains(concat('|', @name, '|'), '|{0}|') and " +
|
||||||
|
"(contains(concat('|', @version, '|'), '|{1}|') or not(boolean(@version)))]",
|
||||||
|
apiname,
|
||||||
|
apiversion);
|
||||||
|
xpath_add += match;
|
||||||
|
xpath_delete += match;
|
||||||
|
}
|
||||||
|
else if (!String.IsNullOrEmpty(apiname))
|
||||||
|
{
|
||||||
|
var match = String.Format("[contains(concat('|', @name, '|'), '|{0}|')]", apiname);
|
||||||
|
xpath_add += match;
|
||||||
|
xpath_delete += match;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue