[csdoc-patches] CVS: csdoc/src/csdoc codegen.cs,1.1,1.2 driver.cs,1.8,1.9 ChangeLog,1.20,1.21
Status: Planning
Brought to you by:
mastergaurav
|
From: Gaurav V. <mas...@us...> - 2003-04-08 06:16:28
|
Update of /cvsroot/csdoc/csdoc/src/csdoc
In directory sc8-pr-cvs1:/tmp/cvs-serv10407
Modified Files:
codegen.cs driver.cs ChangeLog
Log Message:
2003-04-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net>
* codegen.cs : No need for file name while
creating dynamic assembly and module.
* driver.cs : Playing with various members.
Trying to figure out how to find is
a class is an attribute or an exception.
Index: codegen.cs
===================================================================
RCS file: /cvsroot/csdoc/csdoc/src/csdoc/codegen.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- codegen.cs 19 Feb 2003 05:50:12 -0000 1.1
+++ codegen.cs 8 Apr 2003 06:16:22 -0000 1.2
@@ -92,7 +92,7 @@
current_domain = AppDomain.CurrentDomain;
AssemblyBuilder = current_domain.DefineDynamicAssembly (
- an, AssemblyBuilderAccess.RunAndSave, Dirname (name));
+ an, AssemblyBuilderAccess.RunAndSave/*, Dirname (name)*/);
//
// Pass a path-less name to DefineDynamicModule. Wonder how
@@ -103,7 +103,7 @@
// load the default symbol writer.
//
ModuleBuilder = AssemblyBuilder.DefineDynamicModule (
- Basename (name), Basename (output), want_debugging_support);
+ Basename (name), /*Basename (output),*/ want_debugging_support);
if (want_debugging_support)
InitializeSymbolWriter ();
Index: driver.cs
===================================================================
RCS file: /cvsroot/csdoc/csdoc/src/csdoc/driver.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- driver.cs 25 Feb 2003 12:26:35 -0000 1.8
+++ driver.cs 8 Apr 2003 06:16:22 -0000 1.9
@@ -787,9 +787,10 @@
references.Insert (0, "mscorlib");
if (load_default_config)
- DefineDefaultConfig ();
+ DefineDefaultConfig();
- if (Report.Errors > 0){
+ if (Report.Errors > 0)
+ {
return false;
}
@@ -798,14 +799,15 @@
//
first_time = last_time = DateTime.Now;
- ShowTime ("Loading references");
+ //ShowTime("Loading references");
link_paths.Add(GetSystemDir());
LoadReferences();
- ShowTime(" References loaded");
+ //ShowTime(" References loaded");
- if (Report.Errors > 0){
+ if(Report.Errors > 0)
+ {
return false;
}
@@ -814,9 +816,8 @@
//
// Unfortunately, I'll need to keep this. :-((
output_file = "MCSDoc.dll";
- //*/
- CodeGen.Init(output_file, output_file, want_debugging_support);
+ CodeGen.Init(output_file, null, want_debugging_support);
TypeManager.AddModule(CodeGen.ModuleBuilder);
@@ -836,9 +837,9 @@
// types emitted from the user defined types
// or from the system ones.
//
- ShowTime("Initializing Core Types");
+ //ShowTime("Initializing Core Types");
- if (!RootContext.StdLib)
+ if(!RootContext.StdLib)
{
RootContext.ResolveCore();
if(Report.Errors > 0)
@@ -847,30 +848,38 @@
TypeManager.InitCoreTypes();
- ShowTime(" Core Types done");
+ //ShowTime(" Core Types done");
//
// The second pass of the compiler
//
- ShowTime("Resolving tree");
+ //ShowTime("Resolving tree");
RootContext.ResolveTree();
- ShowTime("Populate tree");
+ //ShowTime("Populate tree");
if (!RootContext.StdLib)
- RootContext.BootCorlib_PopulateCoreTypes ();
+ RootContext.BootCorlib_PopulateCoreTypes();
RootContext.PopulateTypes();
RootContext.DefineTypes();
- TypeManager.InitCodeHelpers ();
+ TypeManager.InitCodeHelpers();
- if (Report.Errors > 0)
+ if(Report.Errors > 0)
{
System.Console.WriteLine("Exiting after initializing code helpers...");
return false;
}
+ TypeContainer root = RootContext.Tree.Types;
+ Console.WriteLine("Root type: " + root.GetType());
+
+ ManageTypeContainer(root);
+
+ Console.WriteLine();
+
+ return Report.Errors == 0;
//
// The code generator
//
@@ -985,8 +994,149 @@
Console.WriteLine ("Size of strings held: " + DeclSpace.length);
Console.WriteLine ("Size of strings short: " + DeclSpace.small);
#endif
- return (Report.Errors == 0);
+ //return (Report.Errors == 0);
}
+ public static void ManageTypeContainer(TypeContainer tc)
+ {
+ //ManageTypeContainer("", tc);
+ ListAllMembers(tc);
+ }
+
+ public static void ListAllMembers(TypeContainer root)
+ {
+ if(root.Namespace != null)
+ {
+ Console.WriteLine("Root Namespace: " + root.Namespace.Name);
+ Console.WriteLine();
+ }
+ ListTCs("", root);
+ }
+
+ public static void ListEnums(string tab, ArrayList enums)
+ {
+ if(enums != null && enums.Count > 0)
+ {
+ foreach(Mono.CSharp.Enum e in enums)
+ {
+ Console.WriteLine("Enum: " + /* tab + */ e.Name);
+ }
+ }
+ }
+
+ public static void ListInterfaces(string tab, ArrayList interfaces)
+ {
+ if(interfaces != null && interfaces.Count > 0)
+ {
+ foreach(Interface i in interfaces)
+ {
+ Console.WriteLine("Iface: " + /* tab + */ i.Name);
+ }
+ }
+ }
+
+ public static void ListDelegates(string tab, ArrayList delegs)
+ {
+ if(delegs != null && delegs.Count > 0)
+ {
+ foreach(Delegate d in delegs)
+ {
+ Console.WriteLine("Deleg: " + /* tab + */ d.Name);
+ }
+ }
+ }
+
+ public static bool IsException(TypeContainer tc)
+ {
+ Type baseType = tc.BaseType;
+ while(baseType != null)
+ {
+ //Console.WriteLine("Base: " + baseType.ToString());
+ if(baseType.IsSubclassOf(TypeManager.exception_type))
+ {
+ return true;
+ }
+ baseType = baseType.BaseType;
+ }
+ return false;
+ }
+
+ public static bool IsAttribute(TypeContainer tc)
+ {
+ Type baseType = tc.BaseType;
+ while(baseType != null)
+ {
+ //Console.WriteLine("Base: " + baseType.ToString());
+ if(baseType.IsSubclassOf(TypeManager.attribute_type))
+ {
+ return true;
+ }
+ baseType = baseType.BaseType;
+ }
+ return false;
+ }
+
+ public static void ListTCs(string tab, TypeContainer tc)
+ {
+ if(tc.Types != null && tc.Types.Count > 0)
+ {
+ foreach(TypeContainer objs in tc.Types)
+ {
+ string type = "Struct: ";
+ if(objs is Class)
+ type = "Class: ";
+ Console.WriteLine(type + /*tab + */ objs.Name);
+ //Console.WriteLine("\t\t" + objs.BaseType.BaseType);
+ if(IsException(objs))
+ {
+ Console.WriteLine("\t\t" + objs.Name + " is Exception");
+ } else if(IsAttribute(objs))
+ {
+ Console.WriteLine("\t\t" + objs.Name + " is Attribute");
+ }
+ ListTCs(tab + "\t", objs);
+ }
+ }
+ ListEnums(tab, tc.Enums);
+ ListInterfaces(tab, tc.Interfaces);
+ ListDelegates(tab, tc.Delegates);
+ }
+
+ public static void ManageTypeContainer(string tab, TypeContainer tc)
+ {
+ foreach(object current in tc.Types)
+ {
+ DeclSpace ds = (DeclSpace)current;
+ //Console.Write("\t" + ds.Namespace.Name);
+ //Console.WriteLine("" + ds.Documentation);
+ Console.WriteLine(tab + "::" + ds.Name);
+ if(tc.Parent != null)
+ {
+ Console.WriteLine("TypeContainer of : \"" + ds.Name + "\" = \"" + tc.Parent.Name + "\"");
+ }
+ if(ds is TypeContainer)
+ {
+ //Console.WriteLine();
+ /*
+ if(ds is Class)
+ {
+ Class c = (Class)ds;
+ ArrayList b = c.Bases;
+ if(b != null && b.Count > 0)
+ {
+ foreach(object currentBase in b)
+ {
+ //System.Console.WriteLine("Base of {0}: {1}\tTYPE: {3}",
+ // ds.Name, currentBase.ToString(),
+ // currentBase.GetType());
+ System.Console.WriteLine("Base of " + ds.Name + ": " + currentBase.ToString()
+ + "\tTYPE: " + currentBase.GetType());
+ }
+ }
+ }*/
+ ManageTypeContainer(tab + "\t", (TypeContainer)ds);
+ }
+ }
+ }
}
}
Index: ChangeLog
===================================================================
RCS file: /cvsroot/csdoc/csdoc/src/csdoc/ChangeLog,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ChangeLog 28 Mar 2003 18:10:42 -0000 1.20
+++ ChangeLog 8 Apr 2003 06:16:22 -0000 1.21
@@ -1,4 +1,12 @@
+2003-04-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net>
+
+ * codegen.cs : No need for file name while
+ creating dynamic assembly and module.
+ * driver.cs : Playing with various members.
+ Trying to figure out how to find is
+ a class is an attribute or an exception.
+
2003-03-28 Gaurav Vaish <mastergaurav AT users DOT sf DOT net>
* cs-parser.jay : Attributes cannot be applied
|