gjavah.c (decode_signature_piece): Emit "::" in JArray<>.
authorTom Tromey <tromey@cygnus.com>
Thu, 2 Sep 1999 23:44:04 +0000 (23:44 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Thu, 2 Sep 1999 23:44:04 +0000 (23:44 +0000)
* gjavah.c (decode_signature_piece): Emit "::" in JArray<>.
Handle nested arrays, like `[[I'.

From-SVN: r29067

gcc/java/ChangeLog
gcc/java/gjavah.c

index fbb67731f32f4249fbdfb69e04662978faa86315..c49c91931d4b813998bdd0dfcb51a3393998bd8e 100644 (file)
@@ -1,3 +1,8 @@
+1999-09-02  Tom Tromey  <tromey@cygnus.com>
+
+       * gjavah.c (decode_signature_piece): Emit "::" in JArray<>.
+       Handle nested arrays, like `[[I'.
+
 1999-09-02  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * class.c (finish_class): Remove unused parameter, all callers
index 0859e3d4b1e68f17cb62429d4f91ecc96c720245..1fd8493188095fc4fe7086c2875b7ca22d250a4d 100644 (file)
@@ -695,10 +695,13 @@ decode_signature_piece (stream, signature, limit, need_space)
      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 @@ decode_signature_piece (stream, signature, limit, need_space)
        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);
@@ -781,6 +788,9 @@ decode_signature_piece (stream, signature, limit, need_space)
       break;
     }
 
+  while (array_depth-- > 0)
+    fputs ("> *", stream);
+
   return signature;
 }