Re: [Mono-devel-list] [Patch] AssemblyName changes

2005-06-01 Thread Zoltan Varga
  Hi,

 This is ok to check in.

Zoltan

On 5/30/05, Carlos Alberto Cortez [EMAIL PROTECTED] wrote:
 Hey,
 
 attached is the patch with the changes.
 
 Carlos.
 
 El jue, 26-05-2005 a las 12:04 +0200, Zoltan Varga escribió:
   Hey,
 
   This looks ok, one comment:
  - it would be better to create a helper function in icall.c to avoid the 
  code
duplication.
 
Zoltan
 
 
 
 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] [Patch] AssemblyName changes

2005-05-26 Thread Zoltan Varga
 Hey,

 This looks ok, one comment:
- it would be better to create a helper function in icall.c to avoid the code
  duplication.

  Zoltan

On 5/20/05, Carlos Alberto Cortez [EMAIL PROTECTED] wrote:
 Hey,
 
 
  Does this fix
 
  http://bugzilla.ximian.com/show_bug.cgi?id=59891
 
  -- Ben
 
 
 It is not exactly a patch for that error (I'm not getting that error,
 however), but to correct the problem of always having something like:
 
 AssemblyName aname = new AssemblyName ();
 aname.Name = Something;
 
 and getting in Mono with FullName:
 
 Something, Version=0.0.0.0
 
 but with .Net
 
 Something
 
 By the way, I've rebuilt my tree, and no problems appear.
 
 Can I commit?
 
 Carlos.
 
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] [Patch] AssemblyName changes

2005-05-19 Thread Carlos Alberto Cortez
Hey,


 Does this fix
 
 http://bugzilla.ximian.com/show_bug.cgi?id=59891
 
 -- Ben
 

It is not exactly a patch for that error (I'm not getting that error,
however), but to correct the problem of always having something like:

AssemblyName aname = new AssemblyName ();
aname.Name = Something;

and getting in Mono with FullName:

Something, Version=0.0.0.0

but with .Net

Something

By the way, I've rebuilt my tree, and no problems appear.

Can I commit?

Carlos.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-devel-list] [Patch] AssemblyName changes

2005-05-18 Thread Carlos Alberto Cortez
Hey there,

I made some changes to at icall.c and AssemblyName.cs to correct some
incorrect behavior of AssemblyName class. With these changes, all the
tests at AssemblyNameTest.cs run ok, and I even could make a bootstrap.

Any comment?

Carlos.
Index: icall.c
===
--- icall.c	(revisin: 44715)
+++ icall.c	(copia de trabajo)
@@ -3477,11 +3477,14 @@
 ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAssembly *assembly) 
 {
 	static MonoClass *System_Reflection_AssemblyName;
+	static MonoClass *System_Version;
 	MonoArray *result;
 	MonoDomain *domain = mono_object_domain (assembly);
 	int i, count = 0;
 	static MonoMethod *create_culture = NULL;
+	static MonoMethod *create_version = NULL;
 	MonoTableInfo *t;
+	gpointer args [4];
 
 	MONO_ARCH_SAVE_REGS;
 
@@ -3489,6 +3492,12 @@
 		System_Reflection_AssemblyName = mono_class_from_name (
 			mono_defaults.corlib, System.Reflection, AssemblyName);
 
+	if (!System_Version) {
+		System_Version = mono_class_from_name (
+mono_defaults.corlib, System, Version);
+		g_assert (System_Version);
+	}
+
 	t = assembly-assembly-image-tables [MONO_TABLE_ASSEMBLYREF];
 	count = t-rows;
 
@@ -3502,6 +3511,13 @@
 		mono_method_desc_free (desc);
 	}
 
+	if (count  0  !create_version) {
+		MonoMethodDesc *desc = mono_method_desc_new (:.ctor(int,int,int,int), FALSE);
+		create_version = mono_method_desc_search_in_class (desc, System_Version);
+		g_assert (create_version);
+		mono_method_desc_free (desc);
+	}
+
 	for (i = 0; i  count; i++) {
 		MonoAssembly *assem;
 		MonoReflectionAssemblyName *aname;
@@ -3530,6 +3546,13 @@
 		aname-flags = assem-aname.flags;
 		aname-versioncompat = 1; /* SameMachine (default) */
 
+		args [0] = assem-aname.major;
+		args [1] = assem-aname.minor;
+		args [2] = assem-aname.build;
+		args [3] = assem-aname.revision;
+		aname-version = mono_object_new (domain, System_Version);
+		mono_runtime_invoke (create_version, aname-version, args, NULL);
+
 		if (create_culture) {
 			gpointer args [1];
 			args [0] = mono_string_new (domain, assem-aname.culture);
@@ -3929,8 +3952,11 @@
 static void
 fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *aname, MonoAssemblyName *name, const char *absolute)
 {
+	static MonoClass *System_Version = NULL;
 	static MonoMethod *create_culture = NULL;
+	static MonoMethod *create_version = NULL;
 	gpointer args [1];
+	gpointer vargs [4];
 	guint32 pkey_len;
 	const char *pkey_ptr;
 	gchar *codebase;
@@ -3944,6 +3970,25 @@
 	aname-revision = name-revision;
 	aname-hashalg = name-hash_alg;
 
+	if (!System_Version) {
+		System_Version = mono_class_from_name (mono_defaults.corlib, System, Version);
+		g_assert (System_Version);
+	}
+	
+	if (!create_version) {
+		MonoMethodDesc *desc = mono_method_desc_new (:.ctor(int,int,int,int), FALSE);
+		create_version = mono_method_desc_search_in_class (desc, System_Version);
+		g_assert (create_version);
+		mono_method_desc_free (desc);
+	}
+
+	vargs [0] = aname-major;
+	vargs [1] = aname-minor;
+	vargs [2] = aname-build;
+	vargs [3] = aname-revision;
+	aname-version = mono_object_new (domain, System_Version);
+	mono_runtime_invoke (create_version, aname-version, vargs, NULL);
+	
 	codebase = g_filename_to_uri (absolute, NULL, NULL);
 	if (codebase) {
 		aname-codebase = mono_string_new (domain, codebase);
Index: AssemblyName.cs
===
--- AssemblyName.cs	(revisin: 44717)
+++ AssemblyName.cs	(copia de trabajo)
@@ -123,7 +123,7 @@
 	return null;
 StringBuilder fname = new StringBuilder ();
 fname.Append (name);
-if (Version.ToString () != 0.0.0.0) {
+if (Version != null) {
 	fname.Append (, Version=);
 	fname.Append (Version.ToString ());
 }
@@ -160,27 +160,19 @@
 
 		public Version Version {
 			get {
-if (version != null) return version;
-
-if (name == null)
-	return null;
-if (build == -1)
-	version = new Version (major, minor);
-else
-	if (revision == -1)
-		version = new Version (major, minor, build);
-else
-	version = new Version (major, minor, build, revision);
-
 return version;
 			}
 
 			set {
-major = value.Major;
-minor = value.Minor;
-build = value.Build;
-revision = value.Revision;
 version = value;
+if (value == null)
+	major = minor = build = revision = 0;
+else {
+	major = value.Major;
+	minor = value.Minor;
+	build = value.Build;
+	revision = value.Revision;
+}
 			}
 		}
 
@@ -272,6 +264,7 @@
 			an.minor = minor;
 			an.build = build;
 			an.revision = revision;
+			an.version = version != null ? (Version) version.Clone () : null;
 			an.cultureinfo = cultureinfo;
 			an.flags = flags;
 			an.hashalg = hashalg;
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com

Re: [Mono-devel-list] [Patch] AssemblyName changes

2005-05-18 Thread Ben Maurer
On Wed, 2005-05-18 at 17:25 -0500, Carlos Alberto Cortez wrote:
 Hey there,
 
 I made some changes to at icall.c and AssemblyName.cs to correct some
 incorrect behavior of AssemblyName class. With these changes, all the
 tests at AssemblyNameTest.cs run ok, and I even could make a bootstrap.
 
 Any comment?



 +  an.version = version != null ? (Version) version.Clone () : null;

version is a readonly class (modifications can not be made to an
existing Version. So the clone thing is totally unneeded.

Does this fix

http://bugzilla.ximian.com/show_bug.cgi?id=59891

-- Ben

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] [Patch] AssemblyName changes

2005-05-18 Thread Carlos Alberto Cortez
Hey, 

I noticed this too, but in the MS impl, a new Version instance is
created. We could however, use the same.

Carlos.

El mi, 18-05-2005 a las 18:25 -0400, Ben Maurer escribi:
 On Wed, 2005-05-18 at 17:25 -0500, Carlos Alberto Cortez wrote:
  Hey there,
  
  I made some changes to at icall.c and AssemblyName.cs to correct some
  incorrect behavior of AssemblyName class. With these changes, all the
  tests at AssemblyNameTest.cs run ok, and I even could make a bootstrap.
  
  Any comment?
 
 
 
  +  an.version = version != null ? (Version) version.Clone () : null;
 
 version is a readonly class (modifications can not be made to an
 existing Version. So the clone thing is totally unneeded.
 
 Does this fix
 
 http://bugzilla.ximian.com/show_bug.cgi?id=59891
 
 -- Ben
 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list