summaryrefslogtreecommitdiff
path: root/gcc/java/gjavah.c
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-15 22:17:55 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-15 22:17:55 +0000
commit21a0db19a4d64ceac59f07b41ad9179dc80c71d0 (patch)
treeb81bddf1dfd334fc9498faba875e52aec59bc13f /gcc/java/gjavah.c
parentdf2831126049a902620b50ebb989e05e7ffed4b4 (diff)
downloadgcc-21a0db19a4d64ceac59f07b41ad9179dc80c71d0.tar.gz
* gjavah.c (jni_print_char): New function.
(print_full_cxx_name): Use it. (decode_signature_piece): Likewise. (print_cxx_classname): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31989 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/gjavah.c')
-rw-r--r--gcc/java/gjavah.c61
1 files changed, 36 insertions, 25 deletions
diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c
index c679491dc09..a8b9c36fbfa 100644
--- a/gcc/java/gjavah.c
+++ b/gcc/java/gjavah.c
@@ -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;