[csdoc-patches] CVS: csdoc/src/csdoc .cvsignore,1.3,1.4 ChangeLog,1.12,1.13 driver.cs,1.6,1.7
Status: Planning
Brought to you by:
mastergaurav
From: Gaurav V. <mas...@us...> - 2003-02-25 06:35:44
|
Update of /cvsroot/csdoc/csdoc/src/csdoc In directory sc8-pr-cvs1:/tmp/cvs-serv21355 Modified Files: .cvsignore ChangeLog driver.cs Log Message: 2003-02-25 * driver.cs : Oh! I have to populate the items. * .cvsignore : Ignore only MCSDoc.exe * MCSDoc : Created new directory. Index: .cvsignore =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/csdoc/.cvsignore,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- .cvsignore 25 Feb 2003 05:10:46 -0000 1.3 +++ .cvsignore 25 Feb 2003 06:35:41 -0000 1.4 @@ -10,4 +10,4 @@ cs-parser.cs y.output *.pdb -mcsdoc \ No newline at end of file +mcsdoc.exe \ No newline at end of file Index: ChangeLog =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/csdoc/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ChangeLog 25 Feb 2003 05:10:46 -0000 1.12 +++ ChangeLog 25 Feb 2003 06:35:41 -0000 1.13 @@ -1,6 +1,12 @@ 2003-02-25 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * driver.cs : Oh! I have to populate the items. + * .cvsignore : Ignore only MCSDoc.exe + * MCSDoc : Created new directory. + +2003-02-25 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * .cvsignore : Ignore also xml, diff 2003-02-24 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> Index: driver.cs =================================================================== RCS file: /cvsroot/csdoc/csdoc/src/csdoc/driver.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- driver.cs 21 Feb 2003 11:29:56 -0000 1.6 +++ driver.cs 25 Feb 2003 06:35:41 -0000 1.7 @@ -52,6 +52,10 @@ static bool using_default_encoder = true; //static string xmlFileName = ""; + static ArrayList references = new ArrayList(); + static ArrayList soft_references = new ArrayList(); + static ArrayList link_paths = new ArrayList(); + static ArrayList defines; public static void ShowTime (string msg) { @@ -220,7 +224,7 @@ // // Returns the directory where the system assemblies are installed // - static string GetSystemDir () + static string GetSystemDir() { Assembly [] assemblies = AppDomain.CurrentDomain.GetAssemblies (); @@ -416,6 +420,103 @@ return false; } + static void SetupDefaultDefines() + { + defines = new ArrayList(); + defines.Add("__MonoCS__"); + defines.Add("__MCSDoc__"); + } + + public static void LoadReferences() + { + foreach(string r in references) + LoadAssembly(r, false); + foreach(string s in soft_references) + LoadAssembly(s, true); + } + + static void LoadAssembly(string assembly, bool isSoft) + { + Assembly a; + string total_log = ""; + + try + { + char[] path_chars = { '/', '\\', '.' }; + if(assembly.IndexOfAny(path_chars) != -1) + { + a = Assembly.LoadFrom(assembly); + } else + { + a = Assembly.Load(assembly); + } + TypeManager.AddAssembly(a); + } catch(FileNotFoundException) + { + foreach(string dir in link_paths) + { + string full_path = Path.Combine(dir, assembly); + if (!assembly.EndsWith(".dll")) + full_path += ".dll"; + + try + { + a = Assembly.LoadFrom(full_path); + TypeManager.AddAssembly(a); + return; + } catch (FileNotFoundException ff) + { + total_log += ff.FusionLog; + continue; + } + } + if(!isSoft) + { + Report.Error(6, "Cannot find assembly `" + assembly + "'" ); + Console.WriteLine("Log: \n" + total_log); + } + } catch(BadImageFormatException f) + { + Report.Error(6, "Cannot load assembly (bad file format)" + f.FusionLog); + } catch(FileLoadException f) + { + Report.Error(6, "Cannot load assembly " + f.FusionLog); + } catch(ArgumentNullException) + { + Report.Error(6, "Cannot load assembly (null argument)"); + } + } + + static void DefineDefaultConfig() + { + string [] default_config = { + "System", + "System.Xml", + "Accessibility", + "System.Configuration.Install", + "System.Data", + "System.Design", + "System.DirectoryServices", + "System.Drawing.Design", + "System.Drawing", + "System.EnterpriseServices", + "System.Management", + "System.Messaging", + "System.Runtime.Remoting", + "System.Runtime.Serialization.Formatters.Soap", + "System.Security", + "System.ServiceProcess", + "System.Web", + "System.Web.RegularExpressions", + "System.Web.Services", + "System.Windows.Forms" + }; + + int p = 0; + foreach (string def in default_config) + soft_references.Insert (p++, def); + } + /// <summary> /// Parses the arguments, and drives the compilation /// process. @@ -438,6 +539,8 @@ encoding = Encoding.GetEncoding (1252); } + SetupDefaultDefines(); + int argc = args.Length; for (i = 0; i < argc; i++){ string arg = args [i]; @@ -505,6 +608,43 @@ return false; } + if(Report.Errors > 0) + return false; + + if(RootContext.StdLib) + { + references.Insert(0, "mscorlib"); + } + + DefineDefaultConfig(); + + if(Report.Errors > 0) + return false; + + link_paths.Add(GetSystemDir()); + LoadReferences(); + + if(Report.Errors > 0) + return false; + + if(!RootContext.StdLib) + { + RootContext.ResolveCore(); + if(Report.Errors > 0) + return false; + } + + //TypeManager.InitCoreTypes(); + //RootContext.ResolveTree(); + if(!RootContext.StdLib) + RootContext.BootCorlib_PopulateCoreTypes(); + + RootContext.PopulateTypes (); + RootContext.DefineTypes (); + + if(Report.Errors > 0) + return false; + TypeContainer tc = RootContext.Tree.Types; ArrayList tree = tc.Types; foreach(object current in tree) @@ -535,7 +675,7 @@ return (Report.Errors == 0); } - + static string DisplayClass(Class klass) { string retVal = ": "; |