Author: jonpryor
Date: 2006-10-19 08:13:41 -0400 (Thu, 19 Oct 2006)
New Revision: 66817
Modified:
trunk/monodoc/tools/ChangeLog
trunk/monodoc/tools/Makefile.am
trunk/monodoc/tools/monodocer.cs
Log:
* Makefile.am: Change check-monodocer target to add a `monodocer
-namespace'
check, as `-namespace' would use a bad filename generation algorithm.
* monodocer.cs: Don't use Type.Name (or equivalent) to generate
filenames,
but use GetTypeFileName(), so that Foo<T> only tries to open the file
Foo`1, instead of the file Foo<T> which (1) is wrong, we never
generate
filenames like that, and (2) fails horribly on Win32 (as '<' and '>'
are
invalid path characters).
Modified: trunk/monodoc/tools/ChangeLog
===================================================================
--- trunk/monodoc/tools/ChangeLog 2006-10-19 12:05:43 UTC (rev 66816)
+++ trunk/monodoc/tools/ChangeLog 2006-10-19 12:13:41 UTC (rev 66817)
@@ -1,5 +1,15 @@
2006-10-19 Jonathan Pryor <[EMAIL PROTECTED]>
+ * Makefile.am: Change check-monodocer target to add a `monodocer
-namespace'
+ check, as `-namespace' would use a bad filename generation algorithm.
+ * monodocer.cs: Don't use Type.Name (or equivalent) to generate
filenames,
+ but use GetTypeFileName(), so that Foo<T> only tries to open the file
+ Foo`1, instead of the file Foo<T> which (1) is wrong, we never
generate
+ filenames like that, and (2) fails horribly on Win32 (as '<' and '>'
are
+ invalid path characters).
+
+2006-10-19 Jonathan Pryor <[EMAIL PROTECTED]>
+
* monodocer.cs: Sort member ordering so that when the order of members
returned by Type.GetMembers() changes (as it did between 1.1.17 and
1.1.18) the order of the documentation members won't change (leading
to
Modified: trunk/monodoc/tools/Makefile.am
===================================================================
--- trunk/monodoc/tools/Makefile.am 2006-10-19 12:05:43 UTC (rev 66816)
+++ trunk/monodoc/tools/Makefile.am 2006-10-19 12:13:41 UTC (rev 66817)
@@ -57,6 +57,9 @@
mono --debug monodocer.exe \
-assembly:DocTest.dll -path:DocTest/en.actual -pretty
diff --exclude=.svn -rup DocTest/en.expected DocTest/en.actual
+ mono --debug monodocer.exe -namespace:Mono.DocTest.Generic -pretty \
+ -assembly:DocTest.dll -path:DocTest/en.actual
+ diff --exclude=.svn -rup DocTest/en.expected DocTest/en.actual
check-monodocer-since-update: monodocer.exe
find DocTest/en.expected.since -name \*.xml -exec rm "{}" \;
Modified: trunk/monodoc/tools/monodocer.cs
===================================================================
--- trunk/monodoc/tools/monodocer.cs 2006-10-19 12:05:43 UTC (rev 66816)
+++ trunk/monodoc/tools/monodocer.cs 2006-10-19 12:13:41 UTC (rev 66817)
@@ -236,7 +236,7 @@
}
if (type == null) throw new InvalidOperationException("Type not
found: " + typename);
if (type.Namespace == null) throw new
InvalidOperationException("Types in the root namespace cannot be documented: "
+ typename);
- string typename2 = type.FullName.Substring(type.Namespace == ""
? 0 : type.Namespace.Length+1);
+ string typename2 = GetTypeFileName (type);
XmlDocument basefile = new XmlDocument();
if (!pretty) basefile.PreserveWhitespace = true;
@@ -271,7 +271,8 @@
throw new InvalidOperationException("Error
loading " + typefile + ": " + e.Message, e);
}
- string typename =
basefile.SelectSingleNode("Type/@FullName").InnerText;
+ string typename =
+ GetTypeFileName
(basefile.SelectSingleNode("Type/@FullName").InnerText);
Type type = assembly.GetType(typename, false);
if (type == null) {
Console.Error.WriteLine(typename + " is no
longer in the assembly.");
@@ -302,11 +303,43 @@
}
private static string GetTypeFileName(Type type) {
- int start = 0;
- if (type.Namespace != null && type.Namespace != "")
- start = type.Namespace.Length + 1;
- return type.FullName.Substring(start);
+ return GetTypeFileName (GetDocTypeName (type));
}
+
+ public static string GetTypeFileName (string typename)
+ {
+ StringBuilder filename = new StringBuilder (typename.Length);
+ int numArgs = 0;
+ int numLt = 0;
+ bool copy = true;
+ for (int i = 0; i < typename.Length; ++i) {
+ char c = typename [i];
+ switch (c) {
+ case '<':
+ copy = false;
+ ++numLt;
+ break;
+ case '>':
+ --numLt;
+ if (numLt == 0) {
+ filename.Append ('`').Append
((numArgs+1).ToString());
+ numArgs = 0;
+ copy = true;
+ }
+ break;
+ case ',':
+ if (numLt == 1)
+ ++numArgs;
+ break;
+ default:
+ if (copy)
+ filename.Append (c);
+ break;
+ }
+ }
+ return filename.ToString ();
+ }
+
private static void AddIndexAssembly (Assembly assembly, XmlElement
parent)
{
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches