diff options
author | Fred Fish <fnf@specifix.com> | 1992-11-23 19:57:29 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1992-11-23 19:57:29 +0000 |
commit | 5707ea9fad0ff4b51cc2c913af218c0a0b8278e9 (patch) | |
tree | 56bbdf02b7bfe05c993493734ff173af6175a466 /gdb/c-exp.y | |
parent | f53f0a036d1a9597223ee95a47ecf7a2a019f497 (diff) | |
download | gdb-5707ea9fad0ff4b51cc2c913af218c0a0b8278e9.zip gdb-5707ea9fad0ff4b51cc2c913af218c0a0b8278e9.tar.gz gdb-5707ea9fad0ff4b51cc2c913af218c0a0b8278e9.tar.bz2 |
* language.h (PRINT_LITERAL_FORM): New macro that takes character
and decides if it should be printed in literal form or some other
form, based on it's ASCII value and setting of sevenbit_strings.
* {c-exp.y, m2-exp.y} (emit_char): Use new PRINT_LITERAL_FORM
macro, change indentation style.
**** start-sanitize-chill ****
* ch-exp.y (chill_printchar): Use new PRINT_LITERAL_FORM macro.
* ch-exp.y (chill_printstr): First cut at real function instead
of error stub.
**** end-sanitize-chill ****
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r-- | gdb/c-exp.y | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 2ba3c8c..397931e 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1484,43 +1484,44 @@ emit_char (c, stream, quoter) c &= 0xFF; /* Avoid sign bit follies */ - if ( c < 0x20 || /* Low control chars */ - (c >= 0x7F && c < 0xA0) || /* DEL, High controls */ - (sevenbit_strings && c >= 0x80)) { /* high order bit set */ - 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: - fprintf_filtered (stream, "\\%.3o", (unsigned int) c); - break; - } - } else { - if (c == '\\' || c == quoter) - { - fputs_filtered ("\\", stream); - } - fprintf_filtered (stream, "%c", c); - } + if (PRINT_LITERAL_FORM (c)) + { + if (c == '\\' || c == quoter) + { + fputs_filtered ("\\", stream); + } + fprintf_filtered (stream, "%c", c); + } + else + { + 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: + fprintf_filtered (stream, "\\%.3o", (unsigned int) c); + break; + } + } } static void |