mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-07 07:23:18 +02:00
generator: new --gapidir flag to search for xml files
This commit is contained in:
parent
f958b2247b
commit
5eea00f705
@ -34,6 +34,7 @@ namespace GtkSharp.Generation {
|
||||
bool show_help = false;
|
||||
string dir = "";
|
||||
string assembly_name = "";
|
||||
string gapidir = "";
|
||||
string glue_filename = "";
|
||||
string glue_includes = "";
|
||||
string gluelib_name = "";
|
||||
@ -54,6 +55,8 @@ namespace GtkSharp.Generation {
|
||||
(string v) => { dir = v; } },
|
||||
{ "assembly-name=", "Name of the assembly for which the code is generated.",
|
||||
(string v) => { assembly_name = v; } },
|
||||
{ "gapidir=", "GAPI xml data folder.",
|
||||
(string v) => { gapidir = v; } },
|
||||
{ "glue-filename=", "Filename for the generated C glue code.",
|
||||
(string v) => { glue_filename = v; } },
|
||||
{ "glue-includes=", "Content of #include directive to add in the generated C glue code.",
|
||||
@ -101,12 +104,12 @@ namespace GtkSharp.Generation {
|
||||
|
||||
Parser p = new Parser ();
|
||||
foreach (string include in includes) {
|
||||
IGeneratable[] curr_gens = p.Parse (include, schema_name);
|
||||
IGeneratable[] curr_gens = p.Parse (include, schema_name, gapidir);
|
||||
table.AddTypes (curr_gens);
|
||||
}
|
||||
|
||||
foreach (string filename in filenames) {
|
||||
IGeneratable[] curr_gens = p.Parse (filename, schema_name);
|
||||
IGeneratable[] curr_gens = p.Parse (filename, schema_name, gapidir);
|
||||
table.AddTypes (curr_gens);
|
||||
gens.AddRange (curr_gens);
|
||||
}
|
||||
|
@ -77,6 +77,11 @@ namespace GtkSharp.Generation {
|
||||
}
|
||||
|
||||
public IGeneratable[] Parse (string filename, string schema_file)
|
||||
{
|
||||
return Parse (filename, schema_file, String.Empty);
|
||||
}
|
||||
|
||||
public IGeneratable[] Parse (string filename, string schema_file, string gapidir)
|
||||
{
|
||||
XmlDocument doc = Load (filename, schema_file);
|
||||
if (doc == null)
|
||||
@ -112,7 +117,18 @@ namespace GtkSharp.Generation {
|
||||
|
||||
switch (child.Name) {
|
||||
case "include":
|
||||
IGeneratable[] curr_gens = Parse (elem.GetAttribute ("xml"));
|
||||
string xmlpath;
|
||||
|
||||
if (File.Exists (Path.Combine (gapidir, elem.GetAttribute ("xml"))))
|
||||
xmlpath = Path.Combine (gapidir, elem.GetAttribute ("xml"));
|
||||
else if (File.Exists (elem.GetAttribute ("xml")))
|
||||
xmlpath = elem.GetAttribute ("xml");
|
||||
else {
|
||||
Console.WriteLine ("Parser: Could not find include " + elem.GetAttribute ("xml"));
|
||||
break;
|
||||
}
|
||||
|
||||
IGeneratable[] curr_gens = Parse (xmlpath);
|
||||
SymbolTable.Table.AddTypes (curr_gens);
|
||||
break;
|
||||
case "namespace":
|
||||
|
Loading…
Reference in New Issue
Block a user