Applied Jonathan's patch for output directories.

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

View file

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

View file

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