This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: gcjh -vs- nested arrays


I'm committing the appended patch.  It changes gcjh to properly handle
multidimensional arrays with signatures like `[[I'.

1999-09-02  Tom Tromey  <tromey@cygnus.com>

	* gjavah.c (decode_signature_piece): Emit "::" in JArray<>.
	Handle nested arrays, like `[[I'.

Tom

Index: gjavah.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/java/gjavah.c,v
retrieving revision 1.33
diff -u -r1.33 gjavah.c
--- gjavah.c	1999/08/28 05:33:02	1.33
+++ gjavah.c	1999/09/02 23:11:56
@@ -695,10 +695,13 @@
      int *need_space;
 {
   const char *ctype;
+  int array_depth = 0;
 
   switch (signature[0])
     {
     case '[':
+      /* More spaghetti.  */
+    array_loop:
       for (signature++; (signature < limit
 			 && *signature >= '0'
 			 && *signature <= '9'); signature++)
@@ -713,13 +716,17 @@
 	case 'S': ctype = "jshortArray";  goto printit;
 	case 'J': ctype = "jlongArray";  goto printit;
 	case 'Z': ctype = "jbooleanArray";  goto printit;
-	case '[': ctype = "jobjectArray"; goto printit;
+	case '[':
+	  /* We have a nested array.  */
+	  ++array_depth;
+	  fputs ("JArray<", stream);
+	  goto array_loop;
+
 	case 'L':
-	  /* We have to generate a reference to JArray here,
-	     so that our output matches what the compiler
-	     does.  */
+	  /* We have to generate a reference to JArray here, so that
+	     our output matches what the compiler does.  */
 	  ++signature;
-	  fputs ("JArray<", stream);
+	  fputs ("JArray<::", stream);
 	  while (signature < limit && *signature != ';')
 	    {
 	      int ch = UTF8_GET (signature, limit);
@@ -780,6 +787,9 @@
       fputs (ctype, stream);
       break;
     }
+
+  while (array_depth-- > 0)
+    fputs ("> *", stream);
 
   return signature;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]