- switch (c)
- {
- case '\\':
- case '\'':
- fprintf_filtered (stream, "\\%c", c);
- break;
- case '\b':
- fputs_filtered ("\\b", stream);
- break;
- case '\t':
- fputs_filtered ("\\t", stream);
- break;
- case '\n':
- fputs_filtered ("\\n", stream);
- break;
- case '\f':
- fputs_filtered ("\\f", stream);
- break;
- case '\r':
- fputs_filtered ("\\r", stream);
- break;
- default:
- if (isprint (c))
- fputc_filtered (c, stream);
- else
- fprintf_filtered (stream, "\\u%.4x", (unsigned int) c);
- break;
- }
+ const char *encoding = java_get_encoding (type);
+
+ generic_emit_char (c, type, stream, quoter, encoding);
+}
+
+/* Implementation of la_printchar method. */
+
+static void
+java_printchar (int c, struct type *type, struct ui_file *stream)
+{
+ fputs_filtered ("'", stream);
+ LA_EMIT_CHAR (c, type, stream, '\'');
+ fputs_filtered ("'", stream);
+}
+
+/* Implementation of la_printstr method. */
+
+static void
+java_printstr (struct ui_file *stream, struct type *type,
+ const gdb_byte *string,
+ unsigned int length, const char *encoding, int force_ellipses,
+ const struct value_print_options *options)
+{
+ const char *type_encoding = java_get_encoding (type);
+
+ if (!encoding || !*encoding)
+ encoding = type_encoding;
+
+ generic_printstr (stream, type, string, length, encoding,
+ force_ellipses, '"', 0, options);