X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=status%2Fcompare-assembly.cs;h=87028889922f24969ea17362a79ceaa8637c981d;hb=4347c57e9783cf9348af2e0ec773024ab6d9b9fc;hp=263bcb163f38a4304234fff8c65e50da2752ed45;hpb=97ddf06aca623a9370172a648f473bc924f46801;p=mono.git
diff --git a/status/compare-assembly.cs b/status/compare-assembly.cs
index 263bcb163f3..87028889922 100755
--- a/status/compare-assembly.cs
+++ b/status/compare-assembly.cs
@@ -35,29 +35,26 @@ Tool #2:
Per Percent status.
*/
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Xml;
+
namespace Mapper
{
- using System;
- using System.Collections;
- using System.Reflection;
-
- ///
- /// Summary description for Class1.
- ///
- public class Mapper
- {
- Assembly a;
- Hashtable nshash = new Hashtable();
- int indent = 0;
-
- public Mapper(string name)
- {
- a = Assembly.LoadFrom (name);
- }
+ public class Mapper
+ {
+ Assembly ms, mono;
+ XmlDocument annotations, output;
- void o (string s)
+ public Mapper(string ms_lib, string mono_lib, string annotation)
{
- Console.WriteLine (s.PadLeft (s.Length + indent, ' '));
+ Assembly ms = Assembly.LoadFrom (ms_lib);
+ Assembly mono = Assembly.LoadFrom (mono_lib);
+ annotations = new XmlDocument ();
+ annotations.Load (annotation);
+ output = new XmlDocument ();
}
void DumpMember (MemberInfo mi)
@@ -66,7 +63,7 @@ namespace Mapper
string more="";
switch (mi.MemberType)
- {
+ {
case MemberTypes.Field:
kind = "field";
break;
@@ -86,9 +83,7 @@ namespace Mapper
default:
kind = "***UNKOWN***";
break;
- }
-
- o ("<" + kind + " name='" + mi.Name + "'" + more + "/>");
+ }
}
void DumpType (Type t)
@@ -115,117 +110,55 @@ namespace Mapper
attrs += "comobject='true'";
}
- o ("<" + kind + " name='" + name + (attrs == "" ? "'" : "' ") + attrs + ">");
-
- indent += 4;
-
- /*o ("");
- o ("");*/
-
- foreach (Type type in t.GetNestedTypes ())
- {
- DumpType(type);
+ foreach (Type type in t.GetNestedTypes ()) {
+ DumpType (type);
}
- foreach (FieldInfo field in t.GetFields ())
- {
- DumpMember (field);
+ foreach (FieldInfo field in t.GetFields ()) {
+ DumpMember (field);
}
- foreach (MethodInfo method in t.GetMethods ())
- {
+ foreach (MethodInfo method in t.GetMethods ()) {
DumpMember (method);
}
- indent -= 4;
-
- o ("" + kind + ">");
}
void LoadTypeList (Type [] types)
{
- foreach (Type t in types)
- {
- ArrayList list = (ArrayList) nshash [t.Namespace];
- if (list == null)
- {
- list = new ArrayList ();
- nshash.Add (t.Namespace, list);
- }
- list.Add (t);
+ foreach (Type t in types) {
}
}
- void DumpTypeList (Type [] types)
- {
- LoadTypeList (types);
-
- foreach (string ns in nshash.Keys)
- {
- o ("");
-
- indent += 4;
-
- foreach (Type t in (ArrayList) nshash [ns])
- {
- DumpType (t);
- }
-
- indent -= 4;
-
- o ("");
- }
- }
-
public void Map ()
{
- string name;
Type [] types;
Module [] modules;
+ string name;
- name = a.GetName ().Name;
- types = a.GetExportedTypes ();
- modules = a.GetModules ();
-
- o ("");
-
- indent += 4;
-
- /*o ("");
- o ("");*/
+ name = ms.GetName ().Name;
+ types = ms.GetExportedTypes ();
+ modules = ms.GetModules ();
DumpTypeList (types);
-
- indent -= 4;
-
- o ("");
- }
+ }
public static int Main(string[] args)
- {
+ {
Mapper m;
string basedir = "c:\\WINDOWS\\Microsoft.NET\\Framework\\v1.0.2914\\";
- if (args.Length > 0) {
- foreach (string s in args){
- try {
- m = new Mapper (basedir + s);
- m.Map ();
- } catch (Exception e) {
- Console.WriteLine("Error: "+e.ToString());
- }
- }
- } else {
- try {
- m = new Mapper (basedir + "mscorlib.dll");
+ if (args.Length != 3) {
+ Console.WriteLine ("usage: compare ms_lib.dll mono_lib.dll annotations.xml");
+ }
+ try {
+ m = new Mapper (args[0], args[1], args[2]);
m.Map ();
- } catch (Exception e) {
- Console.WriteLine("Error: "+e.ToString());
- }
- }
-
- return 0;
- }
- }
+ } catch (Exception e) {
+ Console.WriteLine("Error: " + e.ToString ());
+ }
+ return 0;
+ }
+ }
}