#include "c-lang.h"
#include "jv-lang.h"
#include "gdbcore.h"
+#include <ctype.h>
struct type *java_int_type;
struct type *java_byte_type;
error ("not implemented - java_value_string"); /* FIXME */
}
-/* Print the character C on STREAM as part of the contents of a literal
- string whose delimiter is QUOTER. Note that that format for printing
- characters and strings is language specific. */
+static void java_printchar PARAMS ((int c, GDB_FILE *stream));
-void
-java_emit_char (c, stream, quoter)
- register int c;
+static void
+java_printchar (c, stream)
+ int c;
GDB_FILE *stream;
- int quoter;
{
- if (PRINT_LITERAL_FORM (c))
- {
- if (c == '\\' || c == quoter)
- {
- fputs_filtered ("\\", stream);
- }
- fprintf_filtered (stream, "%c", c);
- }
- else
+ fputc_filtered ('\'', stream);
+
+ switch (c)
{
- switch (c)
- {
- case '\n':
- fputs_filtered ("\\n", stream);
- break;
- case '\b':
- fputs_filtered ("\\b", stream);
- break;
- case '\t':
- fputs_filtered ("\\t", stream);
- break;
- case '\f':
- fputs_filtered ("\\f", stream);
- break;
- case '\r':
- fputs_filtered ("\\r", stream);
- break;
- case '\033':
- fputs_filtered ("\\e", stream);
- break;
- case '\007':
- fputs_filtered ("\\a", stream);
- break;
- default:
- if (c < 256)
- fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
- else
- fprintf_filtered (stream, "\\u%.4x", (unsigned int) c);
- break;
- }
+ 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;
}
-}
-void
-java_printchar (c, stream)
- int c;
- GDB_FILE *stream;
-{
- fputs_filtered ("'", stream);
- java_emit_char (c, stream, '\'');
- fputs_filtered ("'", stream);
+ fputc_filtered ('\'', stream);
}
static value_ptr
and the "other representation" is '\141'. The "other representation"
is program language dependent. */
-#define PRINT_LITERAL_FORM(c) \
- ((c)>=0x20 && ((c)<0x7F || (c)>=0xA0) && (!sevenbit_strings || (c)<0x80))
+#define PRINT_LITERAL_FORM(c) \
+ ((c) >= 0x20 \
+ && ((c) < 0x7F || (c) >= 0xA0) \
+ && (!sevenbit_strings || (c) < 0x80))
/* Return a format string for printf that will print a number in one of
the local (language-specific) formats. Result is static and is