]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gjavah.c (jni_print_char): New function.
authorTom Tromey <tromey@cygnus.com>
Tue, 15 Feb 2000 22:17:55 +0000 (22:17 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Tue, 15 Feb 2000 22:17:55 +0000 (22:17 +0000)
* gjavah.c (jni_print_char): New function.
(print_full_cxx_name): Use it.
(decode_signature_piece): Likewise.
(print_cxx_classname): Likewise.

From-SVN: r31989

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

index 315cf0b9182bca0bc78ec62232ba9ced0e9d5ce2..895a14cc36c82fab055fb5a4cef6731c1f202025 100644 (file)
@@ -1,3 +1,10 @@
+2000-02-15  Tom Tromey  <tromey@cygnus.com>
+
+       * gjavah.c (jni_print_char): New function.
+       (print_full_cxx_name): Use it.
+       (decode_signature_piece): Likewise.
+       (print_cxx_classname): Likewise.
+
 2000-02-15  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Makefile.in (jv-scan, jcf-dump, gcjh): Depend on and link with
index c679491dc099dabbc88265e6f482852b89b06f51..a8b9c36fbfae7391156826fcaf4071b8961a5b5e 100644 (file)
@@ -248,6 +248,38 @@ DEFUN(print_name, (stream, jcf, name_index),
                    JPOOL_UTF_LENGTH (jcf, name_index));
 }
 
+/* Print a character, appropriately mangled for JNI.  */
+
+static void
+jni_print_char (stream, ch)
+     FILE *stream;
+     int ch;
+{
+  if (! flag_jni)
+    jcf_print_char (stream, ch);
+  else if (ch == '(' || ch == ')')
+    {
+      /* Ignore.  */
+    }
+  else if (ch == '_')
+    fputs ("_1", stream);
+  else if (ch == ';')
+    fputs ("_2", stream);
+  else if (ch == '[')
+    fputs ("_3", stream);
+  else if (ch == '/')
+    fputs ("_", stream);
+  else if ((ch >= '0' && ch <= '9')
+          || (ch >= 'a' && ch <= 'z')
+          || (ch >= 'A' && ch <= 'Z'))
+    fputc (ch, stream);
+  else
+    {
+      /* "Unicode" character.  */
+      fprintf (stream, "_0%04x", ch);
+    }
+}
+
 /* Print base name of class.  The base name is everything after the
    final separator.  */
 
@@ -888,7 +920,7 @@ decode_signature_piece (stream, signature, limit, need_space)
       break;
     default:
       *need_space = 1;
-      jcf_print_char (stream, *signature++);
+      jni_print_char (stream, *signature++);
       break;
     printit:
       signature++;
@@ -1006,33 +1038,12 @@ DEFUN(print_full_cxx_name, (stream, jcf, name_index, signature_index,
          while (signature < limit)
            {
              int ch = UTF8_GET (signature, limit);
-             if (ch == '(')
-               {
-                 /* Ignore.  */
-               }
-             else if (ch == ')')
+             jni_print_char (stream, ch);
+             if (ch == ')')
                {
                  /* Done.  */
                  break;
                }
-             else if (ch == '_')
-               fputs ("_1", stream);
-             else if (ch == ';')
-               fputs ("_2", stream);
-             else if (ch == '[')
-               fputs ("_3", stream);
-             else if (ch == '/')
-               fputs ("_", stream);
-             else if ((ch >= '0' && ch <= '9')
-                      || (ch >= 'a' && ch <= 'z')
-                      || (ch >= 'A' && ch <= 'Z'))
-               fputc (ch, stream);
-             else
-               {
-                 /* "Unicode" character.  FIXME: upper or lower case
-                    letters?  */
-                 fprintf (stream, "_0%04x", ch);
-               }
            }
        }
     }
@@ -1223,7 +1234,7 @@ print_cxx_classname (stream, prefix, jcf, index)
       if (c == '/')
        fputs (flag_jni ? "_" : "::", stream);
       else
-       jcf_print_char (stream, c);
+       jni_print_char (stream, c);
     }
 
   return 1;