Author: jonpryor
Date: 2007-06-19 14:57:31 -0400 (Tue, 19 Jun 2007)
New Revision: 80229

Modified:
   trunk/monodoc/tools/ChangeLog
   trunk/monodoc/tools/DocTest/en.expected.importslashdoc/index.xml
   trunk/monodoc/tools/DocTest/en.expected.since/index.xml
   trunk/monodoc/tools/DocTest/en.expected/index.xml
   trunk/monodoc/tools/monodocer.cs
Log:
        * monodocer.cs: Sort <Namespace/> and <Type/> elements by their Name
          attribute.  This helps keep diff's smaller, as the generated order 
won't
          be dependent upon Reflection order.
        * DocTest/en.expected/index.xml, DocTest/en.expected.since/index.xml,
          DocTest/en.expected.importslashdoc/index.xml: Flush (sort namespaces 
and
          types alphabetically).


Modified: trunk/monodoc/tools/ChangeLog
===================================================================
--- trunk/monodoc/tools/ChangeLog       2007-06-19 18:50:20 UTC (rev 80228)
+++ trunk/monodoc/tools/ChangeLog       2007-06-19 18:57:31 UTC (rev 80229)
@@ -1,5 +1,14 @@
 2007-06-19  Jonathan Pryor  <[EMAIL PROTECTED]>
 
+       * monodocer.cs: Sort <Namespace/> and <Type/> elements by their Name
+         attribute.  This helps keep diff's smaller, as the generated order 
won't
+         be dependent upon Reflection order.
+       * DocTest/en.expected/index.xml, DocTest/en.expected.since/index.xml,
+         DocTest/en.expected.importslashdoc/index.xml: Flush (sort namespaces 
and
+         types alphabetically).
+
+2007-06-19  Jonathan Pryor  <[EMAIL PROTECTED]>
+
        * monodocer.cs: Cleanup Console output.
          - Use Console.Error for error messages, not status messages.
          - Error should be prefixed by "monodocer" (follows Unix conventions).

Modified: trunk/monodoc/tools/DocTest/en.expected/index.xml
===================================================================
--- trunk/monodoc/tools/DocTest/en.expected/index.xml   2007-06-19 18:50:20 UTC 
(rev 80228)
+++ trunk/monodoc/tools/DocTest/en.expected/index.xml   2007-06-19 18:57:31 UTC 
(rev 80229)
@@ -11,31 +11,31 @@
   <Remarks>To be added.</Remarks>
   <Copyright>To be added.</Copyright>
   <Types>
-    <Namespace Name="System">
-      <Type Name="Array" />
-      <Type Name="Environment" />
-      <Type Name="Environment+SpecialFolder" />
-    </Namespace>
     <Namespace Name="Mono.DocTest">
+      <Type Name="Color" />
       <Type Name="DocAttribute" />
-      <Type Name="Color" />
+      <Type Name="DocValueType" />
       <Type Name="IProcess" />
-      <Type Name="DocValueType" />
+      <Type Name="UseLists" />
       <Type Name="Widget" />
+      <Type Name="Widget+Del" />
+      <Type Name="Widget+Direction" />
+      <Type Name="Widget+IMenuItem" />
       <Type Name="Widget+NestedClass" />
       <Type Name="Widget+NestedClass`1" 
DisplayName="Widget+NestedClass&lt;T&gt;" />
-      <Type Name="Widget+IMenuItem" />
-      <Type Name="Widget+Direction" />
-      <Type Name="UseLists" />
-      <Type Name="Widget+Del" />
     </Namespace>
     <Namespace Name="Mono.DocTest.Generic">
       <Type Name="GenericBase`1" DisplayName="GenericBase&lt;U&gt;" />
+      <Type Name="IFoo`1" DisplayName="IFoo&lt;T&gt;" />
       <Type Name="MyList`1" DisplayName="MyList&lt;T&gt;" />
       <Type Name="MyList`1+Helper`2" 
DisplayName="MyList&lt;T&gt;+Helper&lt;U,V&gt;" />
-      <Type Name="IFoo`1" DisplayName="IFoo&lt;T&gt;" />
       <Type Name="MyList`2" DisplayName="MyList&lt;A,B&gt;" />
     </Namespace>
+    <Namespace Name="System">
+      <Type Name="Array" />
+      <Type Name="Environment" />
+      <Type Name="Environment+SpecialFolder" />
+    </Namespace>
   </Types>
   <Title>DocTest</Title>
 </Overview>

Modified: trunk/monodoc/tools/DocTest/en.expected.importslashdoc/index.xml
===================================================================
--- trunk/monodoc/tools/DocTest/en.expected.importslashdoc/index.xml    
2007-06-19 18:50:20 UTC (rev 80228)
+++ trunk/monodoc/tools/DocTest/en.expected.importslashdoc/index.xml    
2007-06-19 18:57:31 UTC (rev 80229)
@@ -11,31 +11,31 @@
   <Remarks>To be added.</Remarks>
   <Copyright>To be added.</Copyright>
   <Types>
-    <Namespace Name="System">
-      <Type Name="Array" />
-      <Type Name="Environment" />
-      <Type Name="Environment+SpecialFolder" />
-    </Namespace>
     <Namespace Name="Mono.DocTest">
+      <Type Name="Color" />
       <Type Name="DocAttribute" />
-      <Type Name="Color" />
+      <Type Name="DocValueType" />
       <Type Name="IProcess" />
-      <Type Name="DocValueType" />
+      <Type Name="UseLists" />
       <Type Name="Widget" />
+      <Type Name="Widget+Del" />
+      <Type Name="Widget+Direction" />
+      <Type Name="Widget+IMenuItem" />
       <Type Name="Widget+NestedClass" />
       <Type Name="Widget+NestedClass`1" 
DisplayName="Widget+NestedClass&lt;T&gt;" />
-      <Type Name="Widget+IMenuItem" />
-      <Type Name="Widget+Direction" />
-      <Type Name="UseLists" />
-      <Type Name="Widget+Del" />
     </Namespace>
     <Namespace Name="Mono.DocTest.Generic">
       <Type Name="GenericBase`1" DisplayName="GenericBase&lt;U&gt;" />
+      <Type Name="IFoo`1" DisplayName="IFoo&lt;T&gt;" />
       <Type Name="MyList`1" DisplayName="MyList&lt;T&gt;" />
       <Type Name="MyList`1+Helper`2" 
DisplayName="MyList&lt;T&gt;+Helper&lt;U,V&gt;" />
-      <Type Name="IFoo`1" DisplayName="IFoo&lt;T&gt;" />
       <Type Name="MyList`2" DisplayName="MyList&lt;A,B&gt;" />
     </Namespace>
+    <Namespace Name="System">
+      <Type Name="Array" />
+      <Type Name="Environment" />
+      <Type Name="Environment+SpecialFolder" />
+    </Namespace>
   </Types>
   <Title>DocTest</Title>
 </Overview>

Modified: trunk/monodoc/tools/DocTest/en.expected.since/index.xml
===================================================================
--- trunk/monodoc/tools/DocTest/en.expected.since/index.xml     2007-06-19 
18:50:20 UTC (rev 80228)
+++ trunk/monodoc/tools/DocTest/en.expected.since/index.xml     2007-06-19 
18:57:31 UTC (rev 80229)
@@ -11,32 +11,32 @@
   <Remarks>To be added.</Remarks>
   <Copyright>To be added.</Copyright>
   <Types>
-    <Namespace Name="System">
-      <Type Name="Array" />
-      <Type Name="Environment" />
-      <Type Name="Environment+SpecialFolder" />
-    </Namespace>
     <Namespace Name="Mono.DocTest">
+      <Type Name="AddedType" />
+      <Type Name="Color" />
       <Type Name="DocAttribute" />
-      <Type Name="Color" />
+      <Type Name="DocValueType" />
       <Type Name="IProcess" />
-      <Type Name="DocValueType" />
+      <Type Name="UseLists" />
       <Type Name="Widget" />
+      <Type Name="Widget+Del" />
+      <Type Name="Widget+Direction" />
+      <Type Name="Widget+IMenuItem" />
       <Type Name="Widget+NestedClass" />
       <Type Name="Widget+NestedClass`1" 
DisplayName="Widget+NestedClass&lt;T&gt;" />
-      <Type Name="Widget+IMenuItem" />
-      <Type Name="Widget+Direction" />
-      <Type Name="UseLists" />
-      <Type Name="Widget+Del" />
-      <Type Name="AddedType" />
     </Namespace>
     <Namespace Name="Mono.DocTest.Generic">
       <Type Name="GenericBase`1" DisplayName="GenericBase&lt;U&gt;" />
+      <Type Name="IFoo`1" DisplayName="IFoo&lt;T&gt;" />
       <Type Name="MyList`1" DisplayName="MyList&lt;T&gt;" />
       <Type Name="MyList`1+Helper`2" 
DisplayName="MyList&lt;T&gt;+Helper&lt;U,V&gt;" />
-      <Type Name="IFoo`1" DisplayName="IFoo&lt;T&gt;" />
       <Type Name="MyList`2" DisplayName="MyList&lt;A,B&gt;" />
     </Namespace>
+    <Namespace Name="System">
+      <Type Name="Array" />
+      <Type Name="Environment" />
+      <Type Name="Environment+SpecialFolder" />
+    </Namespace>
   </Types>
   <Title>DocTest</Title>
 </Overview>

Modified: trunk/monodoc/tools/monodocer.cs
===================================================================
--- trunk/monodoc/tools/monodocer.cs    2007-06-19 18:50:20 UTC (rev 80228)
+++ trunk/monodoc/tools/monodocer.cs    2007-06-19 18:57:31 UTC (rev 80229)
@@ -20,12 +20,13 @@
 using DocsNodeEnumerable   = System.Collections.IEnumerable;
 using DocsTypeEnumerable   = System.Collections.IEnumerable;
 using MemberInfoEnumerable = System.Collections.IEnumerable;
+using MyXmlNodeList        = System.Collections.ArrayList;
 using StringList           = System.Collections.ArrayList;
-using TypeEnumerable       = System.Collections.IEnumerable;
 #else
 using DocsNodeEnumerable   = 
System.Collections.Generic.IEnumerable<Stub.DocsNodeInfo>;
 using DocsTypeEnumerable   = 
System.Collections.Generic.IEnumerable<Stub.DocsTypeInfo>;
 using MemberInfoEnumerable = 
System.Collections.Generic.IEnumerable<System.Reflection.MemberInfo>;
+using MyXmlNodeList        = 
System.Collections.Generic.List<System.Xml.XmlNode>;
 using StringList           = System.Collections.Generic.List<string>;
 #endif
 
@@ -543,6 +544,8 @@
                        AddIndexAssembly (assm, index_assemblies);
                        DoUpdateAssembly (assm, index_types, source, dest, 
goodfiles);
                }
+
+               SortIndexEntries (index_types);
                
                CleanupFiles (dest, goodfiles);
                CleanupIndexTypes (index_types, goodfiles);
@@ -632,6 +635,46 @@
                }
        }
 
+       private static void SortIndexEntries (XmlElement indexTypes)
+       {
+               XmlNodeList namespaces = indexTypes.SelectNodes ("Namespace");
+               SortXmlNodesByName (indexTypes, namespaces);
+
+               for (int i = 0; i < namespaces.Count; ++i)
+                       SortXmlNodesByName (namespaces [i], namespaces 
[i].SelectNodes ("Type"));
+       }
+
+       private static void SortXmlNodesByName (XmlNode parent, XmlNodeList 
children)
+       {
+               MyXmlNodeList l = new MyXmlNodeList (children.Count);
+               for (int i = 0; i < children.Count; ++i)
+                       l.Add (children [i]);
+               l.Sort (new AttributeNameComparer ());
+               for (int i = l.Count - 1; i > 0; --i) {
+                       parent.InsertBefore (parent.RemoveChild ((XmlNode) l 
[i-1]), (XmlNode) l [i]);
+               }
+       }
+
+       abstract class XmlNodeComparer : IComparer 
+#if !NET_1_0
+               , IComparer<XmlNode>
+#endif
+       {
+               public abstract int Compare (XmlNode x, XmlNode y);
+
+               public int Compare (object x, object y)
+               {
+                       return Compare ((XmlNode) x, (XmlNode) y);
+               }
+       }
+
+       class AttributeNameComparer : XmlNodeComparer {
+               public override int Compare (XmlNode x, XmlNode y)
+               {
+                       return x.Attributes ["Name"].Value.CompareTo 
(y.Attributes ["Name"].Value);
+               }
+       }
+
        private static bool IsPublic (Type type)
        {
                Type decl = type;

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

Reply via email to