diff options
author | Stu Grossman <grossman@cygnus> | 1998-09-22 02:34:38 +0000 |
---|---|---|
committer | Stu Grossman <grossman@cygnus> | 1998-09-22 02:34:38 +0000 |
commit | 7b46dd00e45d77958ebe874c5dc9487761ce62cc (patch) | |
tree | 9a37a626ec6814b57b1e6d7cbca1d343a8cb0d15 | |
parent | 7f44038a5f130cc199a441a21f44155847cc42ac (diff) | |
download | gdb-7b46dd00e45d77958ebe874c5dc9487761ce62cc.zip gdb-7b46dd00e45d77958ebe874c5dc9487761ce62cc.tar.gz gdb-7b46dd00e45d77958ebe874c5dc9487761ce62cc.tar.bz2 |
* defs.h utils.c (fputc_filtered): New function. Does the obvious...
* jv-lang.c (java_printchar): Fix output of chars > 0xff. Fold
java_emit_char into java_printchar.
* language.h (PRINT_LITERAL_FORM): Reformat for readability.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/jv-lang.c | 89 | ||||
-rw-r--r-- | gdb/language.h | 6 |
3 files changed, 45 insertions, 57 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f0a1275..8e91638 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +Mon Sep 21 19:29:32 1998 Stu Grossman <grossman@babylon-5.cygnus.com> + + * defs.h utils.c (fputc_filtered): New function. Does the obvious... + * jv-lang.c (java_printchar): Fix output of chars > 0xff. Fold + java_emit_char into java_printchar. + * language.h (PRINT_LITERAL_FORM): Reformat for readability. + Mon Sep 21 14:38:03 1998 Catherine Moore <clm@cygnus.com> * config/arm/tm-arm.h (*_BREAKPOINT): Define both little endian diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index d7b0070..603b225 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "c-lang.h" #include "jv-lang.h" #include "gdbcore.h" +#include <ctype.h> struct type *java_int_type; struct type *java_byte_type; @@ -703,67 +704,45 @@ java_value_string (ptr, len) 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 diff --git a/gdb/language.h b/gdb/language.h index 877238d..347160d 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -318,8 +318,10 @@ set_language PARAMS ((enum language)); 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 |