Applied Jonathan's patch for output directories.

This commit is contained in:
the_fiddler 2009-08-25 15:46:22 +00:00
parent 6dcfb9ed3b
commit ccc4f5291b
2 changed files with 26 additions and 22 deletions

View file

@ -11,19 +11,21 @@ namespace Bind.ES
{
class ESGenerator : Generator
{
public ESGenerator(string name)
public ESGenerator(string nsName, string dirName)
{
if (String.IsNullOrEmpty(name))
throw new ArgumentNullException("name");
if (String.IsNullOrEmpty(nsName))
throw new ArgumentNullException("nsName");
if (dirName == null)
dirName = nsName;
glTypemap = "GL2/gl.tm";
csTypemap = "csharp.tm";
enumSpec = name + "/signatures.xml";
enumSpec = dirName + "/signatures.xml";
enumSpecExt = String.Empty;
glSpec = name + "/signatures.xml";
glSpec = dirName + "/signatures.xml";
glSpecExt = String.Empty;
functionOverridesFile = name + "/overrides.xml";
functionOverridesFile = dirName + "/overrides.xml";
importsFile = "Core.cs";
delegatesFile = "Delegates.cs";
@ -33,8 +35,8 @@ namespace Bind.ES
Settings.DelegatesClass = "Delegates";
Settings.OutputClass = "ES";
Settings.OutputNamespace = "OpenTK.Graphics." + name;
Settings.OutputPath = Path.Combine(Directory.GetParent(Settings.OutputPath).FullName, name);
Settings.OutputNamespace = "OpenTK.Graphics." + nsName;
Settings.OutputPath = Path.Combine(Settings.OutputPath, dirName);
}
public override DelegateCollection ReadDelegates(StreamReader specFile)
@ -42,7 +44,7 @@ namespace Bind.ES
DelegateCollection delegates = new DelegateCollection();
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
XPathNavigator nav = new XPathDocument(specFile).CreateNavigator().SelectSingleNode("/signatures");
foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))

View file

@ -6,6 +6,8 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Security;
using Bind.CL;
@ -49,6 +51,8 @@ namespace Bind
//Console.WriteLine(" - the OpenTK team ;-)");
Console.WriteLine();
string dirName = null;
try
{
foreach (string a in arguments)
@ -64,11 +68,11 @@ namespace Bind
return;
case "in":
case "input":
Settings.InputPath = b[1];
Settings.InputPath = string.Join(Path.DirectorySeparatorChar.ToString(), b.Skip(1).ToArray());
break;
case "out":
case "output":
Settings.OutputPath = b[1];
Settings.OutputPath = string.Join(Path.DirectorySeparatorChar.ToString(), b.Skip(1).ToArray());
break;
case "mode":
string arg = b[1].ToLower();
@ -84,6 +88,8 @@ namespace Bind
mode = GeneratorMode.CL10;
else
throw new NotImplementedException();
if (b.Length > 1)
dirName = b[2];
break;
case "namespace":
case "ns":
@ -104,6 +110,7 @@ namespace Bind
//Settings.Compatibility |= b[1].ToLower().Contains("novoid") ? Settings.Legacy.TurnVoidPointersToIntPtr : Settings.Legacy.None;
Settings.Compatibility |= b[1].ToLower().Contains("permutations") ? Settings.Legacy.GenerateAllPermutations : Settings.Legacy.None;
Settings.Compatibility |= b[1].ToLower().Contains("enums_in_class") ? Settings.Legacy.NestedEnums : Settings.Legacy.None;
Settings.Compatibility |= b[1].ToLower().Contains("nodocs") ? Settings.Legacy.NoDocumentation : Settings.Legacy.None;
break;
default:
throw new ArgumentException(
@ -135,15 +142,15 @@ namespace Bind
break;
case GeneratorMode.ES10:
Generator = new ESGenerator("ES10");
Generator = new ESGenerator("ES10", dirName);
break;
case GeneratorMode.ES11:
Generator = new ESGenerator("ES11");
Generator = new ESGenerator("ES11", dirName);
break;
case GeneratorMode.ES20:
Generator = new ESGenerator("ES20");
Generator = new ESGenerator("ES20", dirName);
break;
case GeneratorMode.CL10:
@ -164,12 +171,12 @@ namespace Bind
case GeneratorMode.GL3:
throw new NotImplementedException(String.Format("Mode {0} not implemented.", mode));
case GeneratorMode.Unknown:
default:
Console.WriteLine("Please specify a generator mode (use '-mode:gl2/gl3/glu/wgl/glx])'");
return;
}
Generator.Process();
@ -190,11 +197,6 @@ namespace Bind
Console.WriteLine(e.Message);
Console.WriteLine("The requested functionality is not implemented yet.");
}
finally
{
Console.WriteLine("Press any key to continue...");
Console.ReadKey(true);
}
}
private static void ShowHelp()