From afeaaf4bfec662201050fac5a5e74c819b9861ff Mon Sep 17 00:00:00 2001 From: Kevin Glynn Date: Wed, 12 Jan 2011 13:44:36 +0100 Subject: [PATCH] add -debug-template-extraction flag --- CSharpTranslator/antlr3/src/cs2j/CLR/CS2JSettings.cs | 4 +++- CSharpTranslator/antlr3/src/cs2j/CLR/cs2j.cs | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CSharpTranslator/antlr3/src/cs2j/CLR/CS2JSettings.cs b/CSharpTranslator/antlr3/src/cs2j/CLR/CS2JSettings.cs index a64cfb0..2202ad4 100644 --- a/CSharpTranslator/antlr3/src/cs2j/CLR/CS2JSettings.cs +++ b/CSharpTranslator/antlr3/src/cs2j/CLR/CS2JSettings.cs @@ -28,6 +28,7 @@ namespace RusticiSoftware.Translator.CSharp public string EnumDir { get; set; } public int Verbosity { get; set; } + public bool DebugTemplateExtraction { get; set; } public int DebugLevel { get; set; } public bool Warnings { get; set; } @@ -64,7 +65,8 @@ namespace RusticiSoftware.Translator.CSharp MacroDefines = new List(); XmlDir = Path.Combine(Directory.GetCurrentDirectory(), "tmpXMLs"); EnumDir = Path.Combine(Directory.GetCurrentDirectory(), "enums"); - Verbosity = 0; + Verbosity = 0; + DebugTemplateExtraction = true; DebugLevel = 0; Warnings = false; diff --git a/CSharpTranslator/antlr3/src/cs2j/CLR/cs2j.cs b/CSharpTranslator/antlr3/src/cs2j/CLR/cs2j.cs index 74867aa..ff6af93 100644 --- a/CSharpTranslator/antlr3/src/cs2j/CLR/cs2j.cs +++ b/CSharpTranslator/antlr3/src/cs2j/CLR/cs2j.cs @@ -51,6 +51,9 @@ namespace RusticiSoftware.Translator.CSharp Console.Out.WriteLine(" [-exappdir +] (can be multiple directories/files, separated by semi-colons)"); Console.Out.WriteLine(" [-exclude +] (can be multiple directories/files, separated by semi-colons)"); Console.Out.WriteLine(" [-translator-keep-parens ] (keep parens from source, default true)"); + Console.Out.WriteLine(" [-debug ] (set debug level, default 0)"); + Console.Out.WriteLine(" [-debug-template-extraction ] (show debug messages during template extraction, default true)"); + Console.Out.WriteLine(" [-warnings ] (show warnings, default true)"); Console.Out.WriteLine(" "); Environment.Exit(0); } @@ -80,7 +83,8 @@ namespace RusticiSoftware.Translator.CSharp OptionSet p = new OptionSet () .Add ("v", v => cfg.Verbosity++) .Add ("debug=", v => cfg.DebugLevel = Int32.Parse(v)) - .Add ("warnings", v => cfg.Warnings = true) + .Add ("debug-template-extraction=", v => cfg.DebugTemplateExtraction = Boolean.Parse(v)) + .Add ("warnings=", v => cfg.Warnings = Boolean.Parse(v)) .Add ("version", v => showVersion()) .Add ("help|h|?", v => showUsage()) .Add ("dumpcsharp", v => cfg.DumpCSharp = true) @@ -253,6 +257,11 @@ namespace RusticiSoftware.Translator.CSharp public static void addAppSigTranslation(string fullName) { + int saveDebugLevel = cfg.DebugLevel; + if (!cfg.DebugTemplateExtraction) + { + cfg.DebugLevel = 0; + } if (cfg.DebugLevel > 3) Console.Out.WriteLine("Extracting type info from file {0}", fullName); ITreeNodeStream csTree = parseFile(fullName); if (csTree != null) @@ -267,6 +276,7 @@ namespace RusticiSoftware.Translator.CSharp templateWalker.compilation_unit(); } + cfg.DebugLevel = saveDebugLevel; } // Here's where we do the real work...