Author: mhabersack
Date: 2007-12-14 20:46:04 -0500 (Fri, 14 Dec 2007)
New Revision: 91337

Added:
   trunk/mcs/class/System/System.CodeDom.Compiler/CompilerProviderOption.cs
   
trunk/mcs/class/System/System.CodeDom.Compiler/CompilerProviderOptionsCollection.cs
Modified:
   trunk/mcs/class/System/ChangeLog
   trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
   trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
   trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeProvider.cs
   trunk/mcs/class/System/Microsoft.CSharp/ChangeLog
   trunk/mcs/class/System/System.CodeDom.Compiler/ChangeLog
   trunk/mcs/class/System/System.CodeDom.Compiler/Compiler.cs
   trunk/mcs/class/System/System.CodeDom.Compiler/CompilerCollection.cs
   trunk/mcs/class/System/System.CodeDom.Compiler/CompilerInfo.cs
   trunk/mcs/class/System/System.dll.sources
Log:
2007-12-15  Marek Habersack  <[EMAIL PROTECTED]>

        * System.dll.sources: added
        System.CodeDom.Compiler/CompilerProviderOption.cs and
        System.CodeDom.Compiler/CompilerProviderOptionsCollection.cs
2007-12-15  Marek Habersack  <[EMAIL PROTECTED]>

        * CSharpCodeProvider.cs: added support for the 2.0sp1 constructor
        which takes a Dictionary <string, string> parameter with compiler
        provider options. If any options are present, the
        generator/compiler are created using appropriate constructor
        overload.

        * CSharpCodeGenerator.cs: added support for the 2.0sp1 constructor
        which takes a Dictionary <string, string> parameter with compiler
        provider options.

        * CSharpCodeCompiler.cs: added support for the 2.0sp1 constructor
        which takes a Dictionary <string, string> parameter with compiler
        provider options. The "CompilerVersion" option is supported, with
        possible values "2.0" (currently maps to -langversion:Default) and
        "3.5" (currently maps to -langversion:linq).
2007-12-15  Marek Habersack  <[EMAIL PROTECTED]>

        * Compiler.cs: added support for the default collection of
        <providerOption> child elements and corresponding public
        properties (ProviderOptions and ProviderOptionsDictionary).

        * CompilerInfo.cs: added ProviderOptions dictionary, to hold
        values from the <providerOption> collection of the
        system.codeDom/compilers/compiler/ element.
        CodeDomProviderType throws an exception if the provider type
        cannot be found, as per MSDN.
        CreateProvider uses the new provider constructor which takes
        provider options dictionary as its parameter, if found in the
        provider type.

        * CompilerCollection.cs: compiler defaults are initialized using
        the provider options dictionary, with one option present -
        "CompilerVersion" set to "2.0".
        Two dictionaries to map languages and extensions to compiler
        information objects added.

        * CompilerProviderOption.cs: added - implements the
        <providerOption> element.

        * CompilerProviderOptionsCollection.cs: added - implements
        collection for the 2.0sp1 <providerOption> child element of the
        system.codeDom/compilers/compiler element.



Modified: trunk/mcs/class/System/ChangeLog
===================================================================
--- trunk/mcs/class/System/ChangeLog    2007-12-15 01:34:53 UTC (rev 91336)
+++ trunk/mcs/class/System/ChangeLog    2007-12-15 01:46:04 UTC (rev 91337)
@@ -1,3 +1,9 @@
+2007-12-15  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * System.dll.sources: added
+       System.CodeDom.Compiler/CompilerProviderOption.cs and
+       System.CodeDom.Compiler/CompilerProviderOptionsCollection.cs
+
 2007-12-04  Gert Driesen  <[EMAIL PROTECTED]>
 
        * System_test.dll.sources: Added Win32ExceptionTest.cs.

Modified: trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
===================================================================
--- trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs       
2007-12-15 01:34:53 UTC (rev 91336)
+++ trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs       
2007-12-15 01:46:04 UTC (rev 91337)
@@ -42,6 +42,10 @@
        using System.Diagnostics;
        using System.Text.RegularExpressions;
 
+#if NET_2_0
+       using System.Collections.Generic;
+#endif
+       
        internal class CSharpCodeCompiler : CSharpCodeGenerator, ICodeCompiler
        {
                static string windowsMcsPath;
@@ -102,6 +106,13 @@
                {
                }
 
+#if NET_2_0
+               public CSharpCodeCompiler (Dictionary <string, string> 
providerOptions) :
+                       base (providerOptions)
+               {
+               }
+#endif
+               
                //
                // Methods
                //
@@ -175,15 +186,21 @@
                        // FIXME: these lines had better be platform 
independent.
                        if (Path.DirectorySeparatorChar == '\\') {
                                mcs.StartInfo.FileName = windowsMonoPath;
-                               mcs.StartInfo.Arguments = "\"" + windowsMcsPath 
+ "\" " + BuildArgs (options, fileNames);
+                               mcs.StartInfo.Arguments = "\"" + windowsMcsPath 
+ "\" " +
+#if NET_2_0
+                                       BuildArgs (options, fileNames, 
ProviderOptions);
+#else
+                                       BuildArgs (options, fileNames);
+#endif
                        } else {
 #if NET_2_0
                                // FIXME: This is a temporary hack to make code 
genaration work in 2.0
                                mcs.StartInfo.FileName="gmcs";
+                               mcs.StartInfo.Arguments=BuildArgs(options, 
fileNames, ProviderOptions);
 #else
                                mcs.StartInfo.FileName="mcs";
+                               mcs.StartInfo.Arguments=BuildArgs(options, 
fileNames);
 #endif
-                               
mcs.StartInfo.Arguments=BuildArgs(options,fileNames);
                        }
                        mcs.StartInfo.CreateNoWindow=true;
                        mcs.StartInfo.UseShellExecute=false;
@@ -234,7 +251,11 @@
                        return results;
                }
 
+#if NET_2_0
+               private static string BuildArgs(CompilerParameters 
options,string[] fileNames, Dictionary <string, string> providerOptions)
+#else
                private static string BuildArgs(CompilerParameters 
options,string[] fileNames)
+#endif
                {
                        StringBuilder args=new StringBuilder();
                        if (options.GenerateExecutable)
@@ -284,6 +305,28 @@
                        foreach (string linkedResource in 
options.LinkedResources) {
                                args.AppendFormat("/linkresource:\"{0}\" ", 
linkedResource);
                        }
+                       
+                       if (providerOptions != null && providerOptions.Count > 
0) {
+                               string langver;
+
+                               if (!providerOptions.TryGetValue 
("CompilerVersion", out langver))
+                                       langver = "2.0";
+
+                               if (langver.Length >= 1 && langver [0] == 'v')
+                                       langver = langver.Substring (1);
+
+                               // NOTE: when -langversion:linq becomes 
obsolete/default, the code
+                               // below must be changed!
+                               switch (langver) {
+                                       case "2.0":
+                                               // current default, omit the 
switch
+                                               break;
+
+                                       case "3.5":
+                                               args.Append 
("/langversion:linq");
+                                               break;
+                               }
+                       }
 #endif
 
                        args.Append (" -- ");

Modified: trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
===================================================================
--- trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs      
2007-12-15 01:34:53 UTC (rev 91336)
+++ trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs      
2007-12-15 01:46:04 UTC (rev 91337)
@@ -40,9 +40,17 @@
        using System.Collections;
        using System.Text;
 
+#if NET_2_0
+       using System.Collections.Generic;
+#endif
+       
        internal class CSharpCodeGenerator
                : CodeGenerator
        {
+#if NET_2_0
+               Dictionary <string, string> providerOptions;
+#endif
+               
                // It is used for beautiful "for" syntax
                bool dont_write_semicolon;
 
@@ -54,6 +62,17 @@
                        dont_write_semicolon = false;
                }
 
+#if NET_2_0
+               public CSharpCodeGenerator (Dictionary <string, string> 
providerOptions)
+               {
+                       this.providerOptions = providerOptions;
+               }
+
+               protected Dictionary <string, string> ProviderOptions {
+                       get { return providerOptions; }
+               }
+#endif
+               
                //
                // Properties
                //

Modified: trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeProvider.cs
===================================================================
--- trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeProvider.cs       
2007-12-15 01:34:53 UTC (rev 91336)
+++ trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeProvider.cs       
2007-12-15 01:46:04 UTC (rev 91337)
@@ -34,12 +34,19 @@
 using System.IO;
 using System.Security.Permissions;
 
+#if NET_2_0
+using System.Collections.Generic;
+#endif
+
 namespace Microsoft.CSharp {
 
        [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
        [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
        public class CSharpCodeProvider : CodeDomProvider {
-
+#if NET_2_0
+               Dictionary <string, string> providerOptions;
+#endif
+               
                //
                // Constructors
                //
@@ -47,6 +54,12 @@
                {
                }
 
+#if NET_2_0
+               public CSharpCodeProvider (Dictionary <string, string> 
providerOptions)
+               {
+                       this.providerOptions = providerOptions;
+               }
+#endif
                //
                // Properties
                //
@@ -64,6 +77,10 @@
 #endif
                public override ICodeCompiler CreateCompiler()
                {
+#if NET_2_0
+                       if (providerOptions != null && providerOptions.Count > 
0)
+                               return new Mono.CSharp.CSharpCodeCompiler 
(providerOptions);
+#endif
                        return new Mono.CSharp.CSharpCodeCompiler();
                }
 
@@ -72,6 +89,10 @@
 #endif
                public override ICodeGenerator CreateGenerator()
                {
+#if NET_2_0
+                       if (providerOptions != null && providerOptions.Count > 
0)
+                               return new Mono.CSharp.CSharpCodeGenerator 
(providerOptions);
+#endif
                        return new Mono.CSharp.CSharpCodeGenerator();
                }
                

Modified: trunk/mcs/class/System/Microsoft.CSharp/ChangeLog
===================================================================
--- trunk/mcs/class/System/Microsoft.CSharp/ChangeLog   2007-12-15 01:34:53 UTC 
(rev 91336)
+++ trunk/mcs/class/System/Microsoft.CSharp/ChangeLog   2007-12-15 01:46:04 UTC 
(rev 91337)
@@ -1,3 +1,21 @@
+2007-12-15  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * CSharpCodeProvider.cs: added support for the 2.0sp1 constructor
+       which takes a Dictionary <string, string> parameter with compiler
+       provider options. If any options are present, the
+       generator/compiler are created using appropriate constructor
+       overload.
+
+       * CSharpCodeGenerator.cs: added support for the 2.0sp1 constructor
+       which takes a Dictionary <string, string> parameter with compiler
+       provider options.
+
+       * CSharpCodeCompiler.cs: added support for the 2.0sp1 constructor
+       which takes a Dictionary <string, string> parameter with compiler
+       provider options. The "CompilerVersion" option is supported, with
+       possible values "2.0" (currently maps to -langversion:Default) and
+       "3.5" (currently maps to -langversion:linq).
+
 2007-10-26  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * CSharpCodeGenerator.cs : property name was not escaped.

Modified: trunk/mcs/class/System/System.CodeDom.Compiler/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.CodeDom.Compiler/ChangeLog    2007-12-15 
01:34:53 UTC (rev 91336)
+++ trunk/mcs/class/System/System.CodeDom.Compiler/ChangeLog    2007-12-15 
01:46:04 UTC (rev 91337)
@@ -1,3 +1,31 @@
+2007-12-15  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * Compiler.cs: added support for the default collection of
+       <providerOption> child elements and corresponding public
+       properties (ProviderOptions and ProviderOptionsDictionary).
+
+       * CompilerInfo.cs: added ProviderOptions dictionary, to hold
+       values from the <providerOption> collection of the
+       system.codeDom/compilers/compiler/ element.
+       CodeDomProviderType throws an exception if the provider type
+       cannot be found, as per MSDN.
+       CreateProvider uses the new provider constructor which takes
+       provider options dictionary as its parameter, if found in the
+       provider type.
+
+       * CompilerCollection.cs: compiler defaults are initialized using
+       the provider options dictionary, with one option present -
+       "CompilerVersion" set to "2.0".
+       Two dictionaries to map languages and extensions to compiler
+       information objects added.
+
+       * CompilerProviderOption.cs: added - implements the
+       <providerOption> element.
+
+       * CompilerProviderOptionsCollection.cs: added - implements
+       collection for the 2.0sp1 <providerOption> child element of the
+       system.codeDom/compilers/compiler element.
+
 2007-03-05  Peter Dettman <[EMAIL PROTECTED]>
 
        * Codegenerator.cs: I noticed an `unreachable code' warning while

Modified: trunk/mcs/class/System/System.CodeDom.Compiler/Compiler.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom.Compiler/Compiler.cs  2007-12-15 
01:34:53 UTC (rev 91336)
+++ trunk/mcs/class/System/System.CodeDom.Compiler/Compiler.cs  2007-12-15 
01:46:04 UTC (rev 91337)
@@ -33,6 +33,7 @@
 using TypeDescriptor = PrebuiltSystem.System.ComponentModel.TypeDescriptor;
 
 using System;
+using System.Collections.Generic;
 using System.ComponentModel;
 using System.Configuration;
 
@@ -45,7 +46,8 @@
                static ConfigurationProperty languageProp;
                static ConfigurationProperty typeProp;
                static ConfigurationProperty warningLevelProp;
-
+               static ConfigurationProperty providerOptionsProp;
+               
                static ConfigurationPropertyCollection properties;
 
                static Compiler ()
@@ -58,13 +60,16 @@
                                                                     
TypeDescriptor.GetConverter (typeof (int)),
                                                                     new 
IntegerValidator (0, 4),
                                                                     
ConfigurationPropertyOptions.None);
-
+                       providerOptionsProp = new ConfigurationProperty ("", 
typeof (CompilerProviderOptionsCollection), null, null, null,
+                                                                        
ConfigurationPropertyOptions.IsDefaultCollection);
+                       
                        properties = new ConfigurationPropertyCollection ();
                        properties.Add (compilerOptionsProp);
                        properties.Add (extensionProp);
                        properties.Add (languageProp);
                        properties.Add (typeProp);
                        properties.Add (warningLevelProp);
+                       properties.Add (providerOptionsProp);
                }
 
                internal Compiler ()
@@ -111,6 +116,16 @@
                        internal set { base[warningLevelProp] = value; }
                }
 
+               [ConfigurationProperty ("", Options = 
ConfigurationPropertyOptions.IsDefaultCollection)]
+               public CompilerProviderOptionsCollection ProviderOptions {
+                       get { return (CompilerProviderOptionsCollection) base 
[providerOptionsProp]; }
+                       internal set { base [providerOptionsProp] = value; }
+               }
+
+               public Dictionary <string, string> ProviderOptionsDictionary {
+                       get { return ProviderOptions.ProviderOptions; }
+               }
+               
                protected override ConfigurationPropertyCollection Properties {
                        get { return properties; }
                }

Modified: trunk/mcs/class/System/System.CodeDom.Compiler/CompilerCollection.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom.Compiler/CompilerCollection.cs        
2007-12-15 01:34:53 UTC (rev 91336)
+++ trunk/mcs/class/System/System.CodeDom.Compiler/CompilerCollection.cs        
2007-12-15 01:46:04 UTC (rev 91337)
@@ -40,41 +40,55 @@
        internal sealed class CompilerCollection : 
ConfigurationElementCollection
        {
                static ConfigurationPropertyCollection properties;
-               static List<CompilerInfo> compiler_infos;
+               static List <CompilerInfo> compiler_infos;
+               static Dictionary <string, CompilerInfo> compiler_languages;
+               static Dictionary <string, CompilerInfo> compiler_extensions;
                
                static CompilerCollection ()
                {
                        properties = new ConfigurationPropertyCollection ();
                        compiler_infos = new List <CompilerInfo> ();
-                       
+                       compiler_languages = new Dictionary <string, 
CompilerInfo> (16, StringComparer.OrdinalIgnoreCase);
+                       compiler_extensions = new Dictionary <string, 
CompilerInfo> (6, StringComparer.OrdinalIgnoreCase);
+                               
                        CompilerInfo compiler = new CompilerInfo ();
                         compiler.Languages = "c#;cs;csharp";
                         compiler.Extensions = ".cs";
                         compiler.TypeName = 
"Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089";
+                       compiler.ProviderOptions = new Dictionary <string, 
string> (1);
+                       compiler.ProviderOptions ["CompilerVersion"] = "2.0";
                        AddCompilerInfo (compiler);
 
                        compiler = new CompilerInfo ();
                        compiler.Languages = "vb;vbs;visualbasic;vbscript";
                         compiler.Extensions = ".vb";
                         compiler.TypeName = 
"Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=b77a5c561934e089";
+                       compiler.ProviderOptions = new Dictionary <string, 
string> (1);
+                       compiler.ProviderOptions ["CompilerVersion"] = "2.0";
                        AddCompilerInfo (compiler);
 
                        compiler = new CompilerInfo ();
                         compiler.Languages = "js;jscript;javascript";
                         compiler.Extensions = ".js";
                         compiler.TypeName = 
"Microsoft.JScript.JScriptCodeProvider, Microsoft.JScript, Version=8.0.1100.0, 
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+                       compiler.ProviderOptions = new Dictionary <string, 
string> (1);
+                       compiler.ProviderOptions ["CompilerVersion"] = "2.0";
                        AddCompilerInfo (compiler);
 
                        compiler = new CompilerInfo ();
                         compiler.Languages = "vj#;vjs;vjsharp";
                         compiler.Extensions = ".jsl;.java";
                         compiler.TypeName = 
"Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+                       compiler.ProviderOptions = new Dictionary <string, 
string> (1);
+                       compiler.ProviderOptions ["CompilerVersion"] = "2.0";
                        AddCompilerInfo (compiler);
 
                        compiler = new CompilerInfo ();
                         compiler.Languages = "c++;mc;cpp";
                         compiler.Extensions = ".h";
                         compiler.TypeName = 
"Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=8.0.0.0, 
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+                       compiler.ProviderOptions = new Dictionary <string, 
string> (1);
+                       compiler.ProviderOptions ["CompilerVersion"] = "2.0";
                        AddCompilerInfo (compiler);
                }
 
@@ -86,6 +100,16 @@
                {
                        ci.Init ();
                        compiler_infos.Add (ci);
+
+                       string[] languages = ci.GetLanguages ();
+                       if (languages != null)
+                               foreach (string language in languages)
+                                       compiler_languages [language] = ci;
+                       
+                       string[] extensions = ci.GetExtensions ();
+                       if (extensions != null)
+                               foreach (string extension in extensions)
+                                       compiler_extensions [extension] = ci;
                }
 
                static void AddCompilerInfo (Compiler compiler)
@@ -94,6 +118,7 @@
                        ci.Languages = compiler.Language;
                        ci.Extensions = compiler.Extension;
                        ci.TypeName = compiler.Type;
+                       ci.ProviderOptions = compiler.ProviderOptionsDictionary;
                        AddCompilerInfo (ci);
                }
                
@@ -116,17 +141,25 @@
 
                public CompilerInfo GetCompilerInfoForLanguage (string language)
                {
-                       foreach (CompilerInfo ci in compiler_infos)
-                               if (ci.Languages.IndexOf (language, 
StringComparison.InvariantCultureIgnoreCase) != -1)
-                                       return ci;
+                       if (compiler_languages.Count == 0)
+                               return null;
+                       
+                       CompilerInfo ci;
+                       if (compiler_languages.TryGetValue (language, out ci))
+                               return ci;
+                       
                        return null;
                }
 
                public CompilerInfo GetCompilerInfoForExtension (string 
extension)
                {
-                       foreach (CompilerInfo ci in compiler_infos)
-                               if (ci.Extensions.IndexOf (extension, 
StringComparison.InvariantCultureIgnoreCase) != -1)
-                                       return ci;
+                       if (compiler_extensions.Count == 0)
+                               return null;
+                       
+                       CompilerInfo ci;
+                       if (compiler_extensions.TryGetValue (extension, out ci))
+                               return ci;
+                       
                        return null;
                }
 
@@ -135,9 +168,9 @@
                        CompilerInfo ci = GetCompilerInfoForExtension 
(extension);
                        if (ci == null)
                                return null;
-                       string[] languages = ci.Languages.Split (';');
+                       string[] languages = ci.GetLanguages ();
                        if (languages != null && languages.Length > 0)
-                               return languages[0];
+                               return languages [0];
                        return null;
                }
                

Modified: trunk/mcs/class/System/System.CodeDom.Compiler/CompilerInfo.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom.Compiler/CompilerInfo.cs      
2007-12-15 01:34:53 UTC (rev 91336)
+++ trunk/mcs/class/System/System.CodeDom.Compiler/CompilerInfo.cs      
2007-12-15 01:46:04 UTC (rev 91337)
@@ -31,18 +31,23 @@
 
 #if NET_2_0
 
+using System.Configuration;
+using System.Collections.Generic;
+using System.Reflection;
 using System.Security.Permissions;
 
 namespace System.CodeDom.Compiler {
 
        [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
-       public sealed class CompilerInfo {
-
+       public sealed class CompilerInfo
+       {
                internal string Languages;
                internal string Extensions;
                internal string TypeName;
                internal int WarningLevel;
                internal string CompilerOptions;
+               internal Dictionary <string, string> ProviderOptions;
+               
                bool inited;
                Type type;
 
@@ -65,9 +70,18 @@
                }
 
                public Type CodeDomProviderType {
-                       get { return type; }
+                       get {
+                               if (type == null) {
+                                       type = Type.GetType (TypeName, false);
+                                       if (type == null)
+                                               throw new 
ConfigurationErrorsException ("Unable to locate compiler type '" + TypeName + 
"'");
+                               }
+                               
+                               return type;
+                       }
                }
 
+               
                public bool IsCodeDomProviderTypeValid {
                        get { return type != null; }
                }
@@ -86,7 +100,14 @@
 
                public CodeDomProvider CreateProvider ()
                {
-                       return (CodeDomProvider) Activator.CreateInstance 
(type);
+                       Type providerType = CodeDomProviderType;
+                       if (ProviderOptions != null && ProviderOptions.Count > 
0) {
+                               ConstructorInfo ctor = 
providerType.GetConstructor (new Type[] {typeof (Dictionary <string, string>)});
+                               if (ctor != null)
+                                       return (CodeDomProvider) ctor.Invoke 
(new object[] {ProviderOptions});
+                       }
+                       
+                       return (CodeDomProvider) Activator.CreateInstance 
(providerType);
                }
 
                public override bool Equals (object o)

Added: trunk/mcs/class/System/System.CodeDom.Compiler/CompilerProviderOption.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom.Compiler/CompilerProviderOption.cs    
2007-12-15 01:34:53 UTC (rev 91336)
+++ trunk/mcs/class/System/System.CodeDom.Compiler/CompilerProviderOption.cs    
2007-12-15 01:46:04 UTC (rev 91337)
@@ -0,0 +1,71 @@
+// System.Web.Configuration.CompilerProviderOptionsCollection.cs
+//
+// Authors:
+//     Marek Habersack ([EMAIL PROTECTED])
+//
+// (C) 2007 Novell, Inc (http://www.novell.com)
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0 && CONFIGURATION_DEP
+using System;
+using System.Configuration;
+
+namespace System.CodeDom.Compiler
+{
+       internal sealed class CompilerProviderOption : ConfigurationElement
+       {
+               static ConfigurationProperty nameProp;
+               static ConfigurationProperty valueProp;
+               static ConfigurationPropertyCollection properties;
+               
+               static CompilerProviderOption ()
+               {
+                       nameProp = new ConfigurationProperty ("name", typeof 
(string), "",
+                                                             
ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
+                       valueProp = new ConfigurationProperty ("value", typeof 
(string), "",
+                                                              
ConfigurationPropertyOptions.IsRequired);
+
+                       properties = new ConfigurationPropertyCollection ();
+                       properties.Add (nameProp);
+                       properties.Add (valueProp);
+               }
+
+               [ConfigurationProperty ("name", DefaultValue = "", Options = 
ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
+               public string Name {
+                       get { return (string) base [nameProp]; }
+                       set { base [nameProp] = value; }
+               }
+
+               [ConfigurationProperty ("value", DefaultValue = "", Options = 
ConfigurationPropertyOptions.IsRequired)]
+               public string Value {
+                       get { return (string) base [valueProp]; }
+                       set { base [valueProp] = value; }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get { return properties; }
+               }
+       }
+}
+#endif
\ No newline at end of file


Property changes on: 
trunk/mcs/class/System/System.CodeDom.Compiler/CompilerProviderOption.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
trunk/mcs/class/System/System.CodeDom.Compiler/CompilerProviderOptionsCollection.cs
===================================================================
--- 
trunk/mcs/class/System/System.CodeDom.Compiler/CompilerProviderOptionsCollection.cs
 2007-12-15 01:34:53 UTC (rev 91336)
+++ 
trunk/mcs/class/System/System.CodeDom.Compiler/CompilerProviderOptionsCollection.cs
 2007-12-15 01:46:04 UTC (rev 91337)
@@ -0,0 +1,131 @@
+//
+// System.Web.Configuration.CompilerProviderOptionsCollection.cs
+//
+// Authors:
+//     Marek Habersack ([EMAIL PROTECTED])
+//
+// (C) 2007 Novell, Inc (http://www.novell.com)
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0 && CONFIGURATION_DEP
+using System;
+using System.Configuration;
+using System.Collections.Generic;
+
+namespace System.CodeDom.Compiler
+{
+       [ConfigurationCollection (typeof (CompilerProviderOption), 
CollectionType = ConfigurationElementCollectionType.BasicMap, AddItemName = 
"providerOption")]
+       internal sealed class CompilerProviderOptionsCollection : 
ConfigurationElementCollection
+       {
+               static ConfigurationPropertyCollection properties;
+
+               static CompilerProviderOptionsCollection ()
+               {
+                       properties = new ConfigurationPropertyCollection ();
+               }
+
+               public CompilerProviderOptionsCollection ()
+               {
+               }
+
+               protected override ConfigurationElement CreateNewElement ()
+               {
+                       return new CompilerProviderOption ();
+               }
+
+               public CompilerProviderOption Get (int index)
+               {
+                       return (CompilerProviderOption) BaseGet (index);
+               }
+
+               public CompilerProviderOption Get (string name)
+               {
+                       return (CompilerProviderOption) BaseGet (name);
+               }
+
+               protected override object GetElementKey (ConfigurationElement 
element)
+               {
+                       return ((CompilerProviderOption) element).Name;
+               }
+
+               public string GetKey (int index)
+               {
+                       return (string) BaseGetKey (index);
+               }
+
+               public string[] AllKeys {
+                       get {
+                               int count = Count;
+                               string[] keys = new string [count];
+                               for (int i = 0; i < count; i++)
+                                       keys [i] = this [i].Name;
+
+                               return keys;
+                       }
+               }
+
+               protected override string ElementName {
+                       get { return "providerOption"; }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get { return properties; }
+               }
+
+               public Dictionary <string, string> ProviderOptions {
+                       get {
+                               int count = Count;
+
+                               if (count == 0)
+                                       return null;
+
+                               Dictionary <string, string> ret = new 
Dictionary <string, string> (count);
+                               CompilerProviderOption opt;
+                               
+                               for (int i = 0; i < count; i++) {
+                                       opt = this [i];
+                                       ret.Add (opt.Name, opt.Value);
+                               }
+
+                               return ret;
+                       }
+               }
+               
+               public CompilerProviderOption this [int index] {
+                       get { return (CompilerProviderOption) BaseGet (index); }
+               }
+
+               public new CompilerProviderOption this [string name] {
+                       get {
+                               foreach (CompilerProviderOption c in this) {
+                                       if (c.Name == name)
+                                               return c;
+                               }
+
+                               return null;
+                       }
+               }
+       }
+}
+#endif
\ No newline at end of file


Property changes on: 
trunk/mcs/class/System/System.CodeDom.Compiler/CompilerProviderOptionsCollection.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/mcs/class/System/System.dll.sources
===================================================================
--- trunk/mcs/class/System/System.dll.sources   2007-12-15 01:34:53 UTC (rev 
91336)
+++ trunk/mcs/class/System/System.dll.sources   2007-12-15 01:46:04 UTC (rev 
91337)
@@ -124,6 +124,8 @@
 System.CodeDom.Compiler/CompilerError.cs
 System.CodeDom.Compiler/CompilerInfo.cs
 System.CodeDom.Compiler/CompilerParameters.cs
+System.CodeDom.Compiler/CompilerProviderOption.cs
+System.CodeDom.Compiler/CompilerProviderOptionsCollection.cs
 System.CodeDom.Compiler/CompilerResults.cs
 System.CodeDom.Compiler/Executor.cs
 System.CodeDom.Compiler/GeneratedCodeAttribute.cs

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

Reply via email to