* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / Mono.Posix / Mono.Unix.Native / make-map.cs
index 33fb6ade15c8beea77e64ee20a7bf93aa8c24c10..462c1b5120e1777a000e70436d39890a4b07b94b 100644 (file)
@@ -6,7 +6,7 @@
 //  Jonathan Pryor (jonpryor@vt.edu)
 //
 // (C) 2003 Novell, Inc.
-// (C) 2004 Jonathan Pryor
+// (C) 2004-2005 Jonathan Pryor
 //
 
 //
@@ -247,7 +247,8 @@ abstract class FileGenerator {
                if (t.Namespace.StartsWith ("System"))
                        return "int /* warning: unknown mapping for type: " + t.Name + " */";
                string ts = "struct " +
-                       MakeMap.GetNativeName (t.FullName).Replace ("+", "_").Replace ("&", "*");
+                       MakeMap.GetNativeName (t.FullName).Replace ("+", "_").Replace ("&", "*")
+                               .Replace ("[]", "*");
                return ts;
        }
 }
@@ -482,12 +483,13 @@ class ConvertFileGenerator : FileGenerator {
                                        typeof(ObsoleteAttribute), false);
                string obsolete = "";
                if (oa != null) {
-                       obsolete = "[Obsolete (\"" + oa.Message + "\")]\n\t\t";
+                       obsolete = string.Format ("[Obsolete (\"{0}\", {1})]\n\t\t",
+                                       oa.Message, oa.IsError ? "true" : "false");
                }
-               scs.WriteLine ("\t\t[DllImport (LIB, " + 
+               scs.WriteLine ("\t\t{3}[DllImport (LIB, " + 
                        "EntryPoint=\"{0}_From{1}\")]\n" +
                        "\t\tprivate static extern int From{1} ({1} value, out {2} rval);\n",
-                       ns, t.Name, mtype);
+                       ns, t.Name, mtype, obsolete);
                scs.WriteLine ("\t\t{3}public static bool TryFrom{1} ({1} value, out {2} rval)\n" +
                        "\t\t{{\n" +
                        "\t\t\treturn From{1} (value, out rval) == 0;\n" +
@@ -499,10 +501,10 @@ class ConvertFileGenerator : FileGenerator {
                                "\t\t\t\tThrowArgumentException (value);", t.Name);
                scs.WriteLine ("\t\t\treturn rval;");
                scs.WriteLine ("\t\t}\n");
-               scs.WriteLine ("\t\t[DllImport (LIB, " + 
+               scs.WriteLine ("\t\t{3}[DllImport (LIB, " + 
                        "EntryPoint=\"{0}_To{1}\")]\n" +
                        "\t\tprivate static extern int To{1} ({2} value, out {1} rval);\n",
-                       ns, t.Name, mtype);
+                       ns, t.Name, mtype, obsolete);
                scs.WriteLine ("\t\t{2}public static bool TryTo{1} ({0} value, out {1} rval)\n" +
                        "\t\t{{\n" +
                        "\t\t\treturn To{1} (value, out rval) == 0;\n" +