Author: jluke
Date: 2005-10-10 21:32:11 -0400 (Mon, 10 Oct 2005)
New Revision: 51540

Modified:
   trunk/mcs/tools/monop/ChangeLog
   trunk/mcs/tools/monop/monop.cs
   trunk/mcs/tools/monop/options.cs
   trunk/mcs/tools/monop/outline.cs
Log:
2005-10-10  John Luke  <[EMAIL PROTECTED]>

        * monop.cs: don't print obsolete types if the
        --filter-obsolete option is passed
        * options.cs: add FilterObsolete option
        * outline.cs: don't print obsolete members if
        the --filter-obsolete option is passed



Modified: trunk/mcs/tools/monop/ChangeLog
===================================================================
--- trunk/mcs/tools/monop/ChangeLog     2005-10-11 00:19:16 UTC (rev 51539)
+++ trunk/mcs/tools/monop/ChangeLog     2005-10-11 01:32:11 UTC (rev 51540)
@@ -1,3 +1,11 @@
+2005-10-10  John Luke  <[EMAIL PROTECTED]>
+
+       * monop.cs: don't print obsolete types if the
+       --filter-obsolete option is passed
+       * options.cs: add FilterObsolete option
+       * outline.cs: don't print obsolete members if
+       the --filter-obsolete option is passed
+
 2005-09-21  John Luke  <[EMAIL PROTECTED]>
 
        * monop.cs: catch exception on Process.Start

Modified: trunk/mcs/tools/monop/monop.cs
===================================================================
--- trunk/mcs/tools/monop/monop.cs      2005-10-11 00:19:16 UTC (rev 51539)
+++ trunk/mcs/tools/monop/monop.cs      2005-10-11 01:32:11 UTC (rev 51540)
@@ -198,7 +198,7 @@
                return GetType (tname, false);
        }
 
-       static void PrintTypes (string assembly, bool show_private)
+       static void PrintTypes (string assembly, bool show_private, bool 
filter_obsolete)
        {
                Assembly a = GetAssembly (assembly, true);
 
@@ -219,10 +219,15 @@
                Type [] types = show_private ? a.GetTypes () : 
a.GetExportedTypes ();
                Array.Sort (types, new TypeSorter ());
 
-               foreach (Type t in types)
-                       Console.WriteLine (t.FullName);
+               int obsolete_count = 0;
+               foreach (Type t in types) {
+                       if (filter_obsolete && t.IsDefined (typeof 
(ObsoleteAttribute), false))
+                               obsolete_count ++;
+                       else
+                               Console.WriteLine (t.FullName);
+               }
 
-               Console.WriteLine ("\nTotal: {0} types.", types.Length);
+               Console.WriteLine ("\nTotal: {0} types.", types.Length - 
obsolete_count);
        }
        
        internal static void Completion (string prefix)
@@ -274,7 +279,7 @@
                        assembly = options.AssemblyReference;
                        
                        if (options.Type == null) {
-                               PrintTypes (assembly, options.ShowPrivate);
+                               PrintTypes (assembly, options.ShowPrivate, 
options.FilterObsolete);
                                return;
                        }
                }

Modified: trunk/mcs/tools/monop/options.cs
===================================================================
--- trunk/mcs/tools/monop/options.cs    2005-10-11 00:19:16 UTC (rev 51539)
+++ trunk/mcs/tools/monop/options.cs    2005-10-11 01:32:11 UTC (rev 51540)
@@ -29,6 +29,7 @@
 public class Options
 {
        public bool DeclaredOnly = false;
+       public bool FilterObsolete = false;
        public bool Search = false;
        public bool ShowPrivate = false;
        public string AssemblyReference = null;
@@ -60,6 +61,10 @@
                                case "--declared-only":
                                        DeclaredOnly = true;
                                        break;
+                               case "--filter-obsolete":
+                               case "-f":
+                                       FilterObsolete = true;
+                                       break;
                                case "-p":
                                case "--private":
                                        ShowPrivate = true;

Modified: trunk/mcs/tools/monop/outline.cs
===================================================================
--- trunk/mcs/tools/monop/outline.cs    2005-10-11 00:19:16 UTC (rev 51539)
+++ trunk/mcs/tools/monop/outline.cs    2005-10-11 01:32:11 UTC (rev 51540)
@@ -805,6 +805,9 @@
                
                if (options.ShowPrivate)
                        return true;
+
+               if (options.FilterObsolete && mi.IsDefined (typeof 
(ObsoleteAttribute), false))
+                       return false;
                
                switch (mi.MemberType) {
                case MemberTypes.Constructor:

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

Reply via email to