? file.diff
Index: class.cs
===================================================================
RCS file: /mono/mcs/mcs/class.cs,v
retrieving revision 1.195
diff -u -r1.195 class.cs
--- class.cs	13 Apr 2002 19:57:00 -0000	1.195
+++ class.cs	18 Apr 2002 20:58:49 -0000
@@ -2106,15 +2106,45 @@
 			return type_return_type;
 		}
 
-		void DuplicatEntryPoint (MethodInfo b)
-		{
-			Report.Error (
-				17, Location,
-				"Program `" + CodeGen.FileName +
-				"'  has more than one entry point defined: `" +
-				b.DeclaringType.Name + "." + b.Name + "'");
-		}
-		
+                void DuplicateEntryPoint (MethodInfo b, Location location)
+                {
+                        Report.Error (
+                                17, location,
+                                "Program `" + CodeGen.FileName +
+                                "'  has more than one entry point defined: `" +
+                                TypeManager.CSharpSignature(b) + "'");
+                }
+
+                void Report28 (MethodInfo b)
+                {
+                        Report.Warning (
+                                28, Location,
+                                "`" + TypeManager.CSharpSignature(b) +
+                                "' has the wrong signature to be an entry point");
+                }
+
+                public bool IsEntryPoint (MethodBuilder b, InternalParameters pinfo)
+                {
+                        if (b.ReturnType != TypeManager.void_type &&
+                            b.ReturnType != TypeManager.int32_type)
+                                return false;
+
+                        if (pinfo.Count == 0)
+                                return true;
+
+                        if (pinfo.Count > 1)
+                                return false;
+
+                        Type t = pinfo.ParameterType(0);
+                        if (t.IsArray &&
+                            (t.GetArrayRank() == 1) &&
+                            (t.GetElementType() == TypeManager.string_type) &&
+                            (pinfo.ParameterModifier(0) == Parameter.Modifier.NONE))
+                                return true;
+                        else
+                                return false;
+                }	
+
 		//
 		// Creates the type
 		//
@@ -2347,23 +2377,21 @@
 			//
 			// This is used to track the Entry Point,
 			//
-			// FIXME: Allow pluggable entry point, check arguments, etc.
-			//
 			if (Name == "Main" &&
 			    ((ModFlags & Modifiers.STATIC) != 0) && 
 			    (RootContext.MainClass == null ||
 			     RootContext.MainClass == parent.TypeBuilder.FullName)){
-				if (RootContext.EntryPoint != null){
-					DuplicatEntryPoint (MethodBuilder);
-					DuplicatEntryPoint (RootContext.EntryPoint);
-				} else 
-					RootContext.EntryPoint = MethodBuilder;
-				
-				//
-				// FIXME: Verify that the method signature
-				// is valid for an entry point, and report
-				// error 28 if not.
-				//
+                                if (IsEntryPoint (MethodBuilder, ParameterInfo)) {
+                                        if (RootContext.EntryPoint == null) {
+                                                RootContext.EntryPoint = MethodBuilder;
+                                                RootContext.EntryPointLocation = Location;
+                                        } else {
+                                                DuplicateEntryPoint (RootContext.EntryPoint, RootContext.EntryPointLocation);
+                                                DuplicateEntryPoint (MethodBuilder, Location);
+                                        }
+                                } else {
+                                        Report28(MethodBuilder);
+                                }
 			}
 
 			return true;
Index: rootcontext.cs
===================================================================
RCS file: /mono/mcs/mcs/rootcontext.cs,v
retrieving revision 1.69
diff -u -r1.69 rootcontext.cs
--- rootcontext.cs	12 Apr 2002 18:51:31 -0000	1.69
+++ rootcontext.cs	18 Apr 2002 20:58:49 -0000
@@ -666,6 +666,11 @@
 		//
 		static public MethodInfo EntryPoint;
 
+                //
+                // Track the location of the entry point.
+                //
+                static public Location EntryPointLocation;
+
 		//
 		// These are used to generate unique names on the structs and fields.
 		//
Index: typemanager.cs
===================================================================
RCS file: /mono/mcs/mcs/typemanager.cs,v
retrieving revision 1.101
diff -u -r1.101 typemanager.cs
--- typemanager.cs	12 Apr 2002 18:51:32 -0000	1.101
+++ typemanager.cs	18 Apr 2002 20:58:50 -0000
@@ -369,43 +369,70 @@
 	/// </summary>
 	static public string CSharpName (Type t)
 	{
+                string ar = null;
+
+                if (t.IsArray) {
+                        for (int i = 0; i < t.GetArrayRank(); i++)
+                                ar += "[]";
+                        t = t.GetElementType();
+
+                }
+
 		if (t == int32_type)
-			return "int";
+			return "int" + ar;
 		else if (t == uint32_type)
-			return "uint";
+			return "uint" + ar;
 		else if (t == int64_type)
-			return "long";
+			return "long" + ar;
 		else if (t == uint64_type)
-			return "ulong";
+			return "ulong" + ar;
 		else if (t == float_type)
-			return "float";
+			return "float" + ar;
 		else if (t == double_type)
-			return "double";
+			return "double" + ar;
 		else if (t == char_type)
-			return "char";
+			return "char" + ar;
 		else if (t == short_type)
-			return "short";
+			return "short" + ar;
 		else if (t == decimal_type)
-			return "decimal";
+			return "decimal" + ar;
 		else if (t == bool_type)
-			return "bool";
+			return "bool" + ar;
 		else if (t == sbyte_type)
-			return "sbyte";
+			return "sbyte" + ar;
 		else if (t == byte_type)
-			return "byte";
+			return "byte" + ar;
 		else if (t == short_type)
-			return "short";
+			return "short" + ar;
 		else if (t == ushort_type)
-			return "ushort";
+			return "ushort" + ar;
 		else if (t == string_type)
-			return "string";
+			return "string" + ar;
 		else if (t == object_type)
-			return "object";
+			return "object" + ar;
 		else if (t == void_type)
 			return "void";
 		else
-			return t.FullName;
+			return t.FullName + ar;
 	}
+
+        /// <summary>
+        ///   Returns the signature of the method
+        /// </summary>
+        static public string CSharpSignature (MethodBase mb)
+        {
+                string sig = "(";
+                InternalParameters iparams = LookupParametersByBuilder(mb);
+                for (int i = 0; i < iparams.Count; i++) {
+                        if (i > 0) {
+                                sig += ", ";
+                        }
+                        sig += iparams.ParameterDesc(i);
+                }
+                sig += ")";
+
+                return mb.DeclaringType.Name + "." + mb.Name + sig;
+        }
 
 	/// <summary>
 	///   Looks up a type, and aborts if it is not found.  This is used
