Author: rafael
Date: 2005-05-07 01:22:00 -0400 (Sat, 07 May 2005)
New Revision: 44190

Modified:
   trunk/mcs/class/Mono.GetOptions/ChangeLog
   
trunk/mcs/class/Mono.GetOptions/Mono.GetOptions.Useful/CommonCompilerOptions.cs
   trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/OptionDetails.cs
   trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/Options.cs
   trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/OptionsParsingMode.cs
Log:
2005-05-07  Rafael Teixeira  <[EMAIL PROTECTED]>
        * Mono.GetOptions/Options.cs: new constructor adds possibility to not 
break parameter values at commas
        * Mono.GetOptions/OptionDetail.cs: check Options.DontSplitOnCommas when 
parsing values. 
        * Mono.GetOptions.Useful/CommonCompilerOptions.cs ask base class to 
leave alone commas.



Modified: trunk/mcs/class/Mono.GetOptions/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.GetOptions/ChangeLog   2005-05-07 04:05:48 UTC (rev 
44189)
+++ trunk/mcs/class/Mono.GetOptions/ChangeLog   2005-05-07 05:22:00 UTC (rev 
44190)
@@ -1,3 +1,8 @@
+2005-05-07  Rafael Teixeira  <[EMAIL PROTECTED]>
+       * Mono.GetOptions/Options.cs: new constructor adds possibility to not 
break parameter values at commas
+       * Mono.GetOptions/OptionDetail.cs: check Options.DontSplitOnCommas when 
parsing values. 
+       * Mono.GetOptions.Useful/CommonCompilerOptions.cs ask base class to 
leave alone commas.
+
 2005-05-06:3  Rafael Teixeira  <[EMAIL PROTECTED]>
        * Adding Mono.GetOptions.Useful directory for new namespace
        * Added Mono.GetOptions.Useful/CommonCompilerOptions.cs with useful 
option processing 

Modified: trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/OptionDetails.cs
===================================================================
--- trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/OptionDetails.cs    
2005-05-07 04:05:48 UTC (rev 44189)
+++ trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/OptionDetails.cs    
2005-05-07 05:22:00 UTC (rev 44190)
@@ -87,15 +87,17 @@
 
                public string ParamName { get { return paramName; } }
                                
-               private bool verboseParsing { get { return 
this.OptionBundle.VerboseParsingOfOptions; } }
+               private bool verboseParsing { get { return 
OptionBundle.VerboseParsingOfOptions; } }
 
-               private OptionsParsingMode parsingMode { get { return 
this.OptionBundle.ParsingMode; } } 
+               private OptionsParsingMode parsingMode { get { return 
OptionBundle.ParsingMode; } } 
                
-               private bool UseGNUFormat { get { return (parsingMode & 
OptionsParsingMode.GNU_DoubleDash) == OptionsParsingMode.GNU_DoubleDash; } } 
+               private bool useGNUFormat { get { return (parsingMode & 
OptionsParsingMode.GNU_DoubleDash) == OptionsParsingMode.GNU_DoubleDash; } } 
+               
+               private bool dontSplitOnCommas { get { return 
OptionBundle.DontSplitOnCommas; } } 
 
                private string linuxLongPrefix {
                        get { 
-                               return (UseGNUFormat? "--":"-"); 
+                               return (useGNUFormat? "--":"-"); 
                        } 
                }
                
@@ -239,7 +241,7 @@
                internal string Key
                {
                        get { 
-                               if (UseGNUFormat) {                             
+                               if (useGNUFormat) {                             
                                        string ShortID = 
this.ShortForm.ToUpper();
                                        if (ShortID == string.Empty)
                                                ShortID = "ZZ";
@@ -289,29 +291,24 @@
 
                private void DoIt(bool setValue)
                {
-                       if (!NeedsParameter)
-                       {
-                               if (AddingOneMoreExceedsMaxOccurs) 
-                                       return;
+                       if (AddingOneMoreExceedsMaxOccurs) 
+                               return;
 
-                               if (verboseParsing)
-                                       Console.WriteLine("<{0}> set to [{1}]", 
this.LongForm, setValue);
+                       if (verboseParsing)
+                               Console.WriteLine("<{0}> set to [{1}]", 
this.LongForm, setValue);
 
-                               if (MemberInfo is FieldInfo)
-                               {
-                                       
((FieldInfo)MemberInfo).SetValue(OptionBundle, setValue);
-                                       return;
-                               }
-                               if (MemberInfo is PropertyInfo)
-                               {
-                                       
((PropertyInfo)MemberInfo).SetValue(OptionBundle, setValue, null);
-                                       return;
-                               }
-                               if 
((WhatToDoNext)((MethodInfo)MemberInfo).Invoke(OptionBundle, null) == 
WhatToDoNext.AbandonProgram)
-                                       System.Environment.Exit(1);
-
+                       if (MemberInfo is FieldInfo)
+                       {
+                               ((FieldInfo)MemberInfo).SetValue(OptionBundle, 
setValue);
                                return;
                        }
+                       if (MemberInfo is PropertyInfo)
+                       {
+                               
((PropertyInfo)MemberInfo).SetValue(OptionBundle, setValue, null);
+                               return;
+                       }
+                       if 
((WhatToDoNext)((MethodInfo)MemberInfo).Invoke(OptionBundle, null) == 
WhatToDoNext.AbandonProgram)
+                               System.Environment.Exit(1);
                }
                
                private void DoIt(string parameterValue)
@@ -319,7 +316,12 @@
                        if (parameterValue == null)
                                parameterValue = "";
 
-                       string[] parameterValues = parameterValue.Split(',');
+                       string[] parameterValues;
+                       
+                       if (dontSplitOnCommas)
+                               parameterValues = new string[] { parameterValue 
};
+                       else
+                               parameterValues = parameterValue.Split(',');
 
                        int waitingToBeProcessed = 
HowManyBeforeExceedingMaxOccurs(parameterValues.Length);
 

Modified: trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/Options.cs
===================================================================
--- trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/Options.cs  2005-05-07 
04:05:48 UTC (rev 44189)
+++ trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/Options.cs  2005-05-07 
05:22:00 UTC (rev 44190)
@@ -36,20 +36,27 @@
                public OptionsParsingMode ParsingMode;
                public bool BreakSingleDashManyLettersIntoManyOptions;
                public bool EndOptionProcessingWithDoubleDash;
+               public bool DontSplitOnCommas;
                
                private OptionList optionParser;
 
-               public Options()
-               {
-                       ParsingMode = OptionsParsingMode.Both;
-                       BreakSingleDashManyLettersIntoManyOptions = false;
-                       EndOptionProcessingWithDoubleDash = true;
-               }
+               public Options() : this(null) {}
+               
+               public Options(string[] args) : this(args, 
OptionsParsingMode.Both, false, true, false) {}
 
-               public Options(string[] args) : this()
+               public Options(string[] args, 
+                                          OptionsParsingMode parsingMode, 
+                                          bool 
breakSingleDashManyLettersIntoManyOptions, 
+                                          bool 
endOptionProcessingWithDoubleDash,
+                                          bool dontSplitOnCommas)
                {
+                       ParsingMode = parsingMode;
+                       BreakSingleDashManyLettersIntoManyOptions = 
breakSingleDashManyLettersIntoManyOptions;
+                       EndOptionProcessingWithDoubleDash = 
endOptionProcessingWithDoubleDash;
+                       DontSplitOnCommas = dontSplitOnCommas;
                        InitializeOtherDefaults();
-                       ProcessArgs(args);
+                       if (args != null)
+                               ProcessArgs(args);
                }
                
                protected virtual void InitializeOtherDefaults() { } // Only 
subclasses may need to implement something here

Modified: trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/OptionsParsingMode.cs
===================================================================
--- trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/OptionsParsingMode.cs       
2005-05-07 04:05:48 UTC (rev 44189)
+++ trunk/mcs/class/Mono.GetOptions/Mono.GetOptions/OptionsParsingMode.cs       
2005-05-07 05:22:00 UTC (rev 44190)
@@ -38,9 +38,9 @@
        [Flags]
        public enum OptionsParsingMode 
        { 
-               Linux                   = 1, 
-               Windows                 = 2,
-               Both                    = 3,
-               GNU_DoubleDash  = 4
+               Linux                           = 1, 
+               Windows                         = 2,
+               Both                            = 3,
+               GNU_DoubleDash          = 4
        }
 }

Modified: 
trunk/mcs/class/Mono.GetOptions/Mono.GetOptions.Useful/CommonCompilerOptions.cs
===================================================================
--- 
trunk/mcs/class/Mono.GetOptions/Mono.GetOptions.Useful/CommonCompilerOptions.cs 
    2005-05-07 04:05:48 UTC (rev 44189)
+++ 
trunk/mcs/class/Mono.GetOptions/Mono.GetOptions.Useful/CommonCompilerOptions.cs 
    2005-05-07 05:22:00 UTC (rev 44190)
@@ -28,7 +28,6 @@
 using System;
 using System.Collections;
 using System.Diagnostics;
-//using System.IO;
 using System.Text;
 
 namespace Mono.GetOptions.Useful
@@ -50,6 +49,11 @@
        }
        
        public class CommonCompilerOptions : Options {
+       
+               public CommonCompilerOptions() : this(null) { }
+
+               public CommonCompilerOptions(string[] args) : base(args, 
OptionsParsingMode.Both, false, true, true) {}
+               
                [Option(-1, "References packages listed. 
{packagelist}=package,...", "pkg")]
                public WhatToDoNext ReferenceSomePackage(string packageName)
                {
@@ -91,7 +95,7 @@
                        return WhatToDoNext.GoAhead;
                }       
                
-               [Option("[Mono] Sets warning {level} (the highest is 4, the 
default)", "wlevel", SecondLevelHelp = true)]
+               [Option("Sets warning {level} (the highest is 4, the default)", 
"wlevel", SecondLevelHelp = true)]
                public int WarningLevel = 4; 
 
                // Output file options
@@ -125,7 +129,7 @@
                }
 
 
-               [Option("Specifies the TargetFileType {type} for the output 
file (exe [default], winexe, library, module)", 't', "TargetFileType")]
+               [Option("Specifies the target {type} for the output file (exe 
[default], winexe, library, module)", 't', "target")]
                public WhatToDoNext SetTarget(string type)
                {
                        switch (type.ToLower()) {
@@ -152,7 +156,7 @@
                        return WhatToDoNext.GoAhead;
                }
 
-               [Option("Specifies the {name} of the Class or Module that 
contains Sub Main or inherits from System.Windows.Forms.Form.\tNeeded to select 
among many entry-points for a program (TargetFileType=exe|winexe)",
+               [Option("Specifies the {name} of the Class or Module that 
contains Sub Main or inherits from System.Windows.Forms.Form.\tNeeded to select 
among many entry-points for a program (target=exe|winexe)",
                        'm', "main")]
                public string MainClassName = null; 
 
@@ -175,7 +179,7 @@
                [Option(-1, "References metadata from the specified 
{assembly}", 'r', "reference")]
                public string AddedReference { set { 
AssembliesToReference.Add(value); } }
                
-               [Option("List of directories to search for metadata 
AssembliesToReference. {path-list}:path,...", "PathsToSearchForLibraries", 
"lib")]
+               [Option("List of directories to search for metadata 
AssembliesToReference. {path-list}:path,...", "libpath", "lib")]
                public string AddedLibPath { set { foreach(string path in 
value.Split(',')) PathsToSearchForLibraries.Add(path); } }
 
                // support for the Compact Framework
@@ -191,7 +195,7 @@
                public ArrayList EmbeddedResources = new ArrayList();
                
                //TODO: support -res:file[,id[,public|private]] what depends on 
changes at Mono.GetOptions
-               [Option(-1, "Adds the specified {file} as an embedded assembly 
resource", "resource", "res")]
+               [Option(-1, "Adds the specified file as an embedded assembly 
resource. {details}:file[,id[,public|private]]", "resource", "res")]
                public string AddedResource { set { 
EmbeddedResources.Add(value); } }
 
                public ArrayList LinkedResources = new ArrayList();
@@ -256,16 +260,16 @@
                        } 
                }
                
-               [Option("[Mono] Don\'t assume the standard library", 
"nostdlib", SecondLevelHelp = true)]
+               [Option("Don\'t assume the standard library", "nostdlib", 
SecondLevelHelp = true)]
                public bool NoStandardLibraries = false;
 
-               [Option("[Mono] Disables implicit AssembliesToReference to 
assemblies", "noconfig", SecondLevelHelp = true)]
+               [Option("Disables implicit references to assemblies", 
"noconfig", SecondLevelHelp = true)]
                public bool NoConfig = false;
                
-               [Option("[Mono] Allows unsafe code", "unsafe", SecondLevelHelp 
= true)]
+               [Option("Allows unsafe code", "unsafe", SecondLevelHelp = true)]
                public bool AllowUnsafeCode = false;
 
-               [Option("[Mono] Debugger {arguments}", "debug-args", 
SecondLevelHelp = true)]
+               [Option("Debugger {arguments}", "debug-args", SecondLevelHelp = 
true)]
                public WhatToDoNext SetDebugArgs(string args)
                {
                        DebugListOfArguments.AddRange(args.Split(','));
@@ -300,7 +304,7 @@
                // Compiler output options      
                
//------------------------------------------------------------------
                
-               [Option("Do not display compiler copyright banner")]
+               [Option("Do not display compiler copyright banner", "nologo")]
                public bool DontShowBanner = false;
                
                //TODO: Correct semantics
@@ -310,11 +314,11 @@
                [Option("Display verbose messages", 'v', "verbose",  
SecondLevelHelp = true)] 
                public bool Verbose = false;
                
-               [Option("[IGNORED] Emit compiler output in UTF8 character 
encoding", SecondLevelHelp = true, VBCStyleBoolean = true)]
-               public bool utf8output;
+               [Option("[IGNORED] Emit compiler output in UTF8 character 
encoding", "utf8output", SecondLevelHelp = true, VBCStyleBoolean = true)]
+               public bool OutputInUTF8;
 
-//             [Option("[NOT IMPLEMENTED YET]Create bug report {file}")]
-               public string bugreport;
+//             [Option("[NOT IMPLEMENTED YET]Create bug report {file}", 
"bugreport")]
+               public string CreateBugReport;
 
                Hashtable sourceFiles = new Hashtable ();
                public override void DefaultArgumentProcessor(string fileName)
@@ -326,6 +330,7 @@
                                SourceFilesToCompile.Add(new 
FileToCompile(fileName, currentEncoding));
                                sourceFiles.Add(fileName, fileName);
                        }
+                       base.DefaultArgumentProcessor(fileName);
                }               
 
                public ArrayList AssembliesToReference = new ArrayList();

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to