Added option to control namespace output. Added help.

This commit is contained in:
the_fiddler 2007-11-04 15:26:54 +00:00
parent a5d5449007
commit 4446a1d4df

View file

@ -58,7 +58,7 @@ namespace Bind
{ {
case "?": case "?":
case "help": case "help":
Console.WriteLine("Help not implemented yet."); ShowHelp();
return; return;
case "in": case "in":
case "input": case "input":
@ -78,9 +78,7 @@ namespace Bind
arg == "glu" ? GeneratorMode.Glu : arg == "glu" ? GeneratorMode.Glu :
arg == "glx" ? GeneratorMode.Glx : GeneratorMode.Unknown; arg == "glx" ? GeneratorMode.Glx : GeneratorMode.Unknown;
if (mode == GeneratorMode.Unknown) if (mode == GeneratorMode.Unknown)
{
throw new ArgumentException(String.Format("Mode {0} unknown.", arg)); throw new ArgumentException(String.Format("Mode {0} unknown.", arg));
}
break; break;
case "namespace": case "namespace":
case "ns": case "ns":
@ -93,14 +91,14 @@ namespace Bind
Settings.GLClass = b[1]; Settings.GLClass = b[1];
break; break;
case "legacy": case "legacy":
case "o":
case "option":
Settings.Compatibility |= b[1].ToLower().Contains("tao") ? Settings.Legacy.Tao : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("tao") ? Settings.Legacy.Tao : Settings.Legacy.None;
Settings.Compatibility |= b[1].ToLower().Contains("enums") ? Settings.Legacy.NoAdvancedEnumProcessing : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("enums") ? Settings.Legacy.NoAdvancedEnumProcessing : Settings.Legacy.None;
Settings.Compatibility |= b[1].ToLower().Contains("safe") ? Settings.Legacy.NoPublicUnsafeFunctions : Settings.Legacy.None; Settings.Compatibility |= b[1].ToLower().Contains("safe") ? Settings.Legacy.NoPublicUnsafeFunctions : Settings.Legacy.None;
//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;
break; Settings.Compatibility |= b[1].ToLower().Contains("enums_in_class") ? Settings.Legacy.NestedEnums : Settings.Legacy.None;
case "enum":
Settings.NestedEnumsClass = b[1];
break; break;
default: default:
throw new ArgumentException( throw new ArgumentException(
@ -112,12 +110,12 @@ namespace Bind
} }
catch (NullReferenceException e) catch (NullReferenceException e)
{ {
Console.WriteLine("Argument error ({0}). Please use the '/?' switch for help.", e.ToString()); Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString());
return; return;
} }
catch (ArgumentException e) catch (ArgumentException e)
{ {
Console.WriteLine("Argument error ({0}). Please use the '/?' switch for help.", e.ToString()); Console.WriteLine("Argument error ({0}). Please use the '-?' switch for help.", e.ToString());
return; return;
} }
@ -160,7 +158,7 @@ namespace Bind
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0); Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0);
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("Press any key to continue..."); //Console.WriteLine("Press any key to continue...");
Console.ReadKey(true); Console.ReadKey(true);
} }
catch (SecurityException e) catch (SecurityException e)
@ -174,5 +172,29 @@ namespace Bind
Console.WriteLine("The requested functionality is not implemented yet."); Console.WriteLine("The requested functionality is not implemented yet.");
} }
} }
private static void ShowHelp()
{
Console.WriteLine(
@"Usage: bind -mode:[gl/gl2/gl3/glu/wgl/glx] [switches]
Available switches:
-in: Input directory (e.g. -in:../specs/)
-out: Output directory (e.g. -out:out)
-ns: Output namespace (e.g. -ns:OpenTK.OpenGL).
Default: OpenTK.OpenGL
-namespace: Same as -ns
-class: Output class (e.g. -class:GL3).
Default: GL/Wgl/Glu/Glx (depends on -mode)
-o/-option: Set advanced option. Available options:
-o:tao Tao compatibility mode.
-o:enums Follow OpenGL instead .Net naming conventions.
-o:safe Do not generate public unsafe functions.
-o:permutations
Generate all possible parameter permutations.
-o:enums_in_class
Place enums in a nested class (i.e. GL.Enums)
instead of a namespace (i.e. OpenTK.OpenGL.Enums)
");
}
} }
} }