diff --git a/src/lisp/print.c b/src/lisp/print.c index 8d79486d2f48ba213e3c70168bfa19b13e422898..0e4d7709d29594d156f6d294f9361d193a35e6f6 100644 --- a/src/lisp/print.c +++ b/src/lisp/print.c @@ -212,12 +212,15 @@ static void brief_otherimm(lispobj obj) { int type, c, idx; - char buffer[10]; type = TypeOf(obj); switch (type) { case type_BaseChar: - c = (obj >> 8) & 0xff; + /* + * A base-char should only be 16 bits long now. But + * sometimes it uses all 24. So just grab all the bits. + */ + c = (obj >> 8) & 0xfffff; switch (c) { case '\0': printf("#\\Null"); @@ -228,20 +231,35 @@ brief_otherimm(lispobj obj) case '\b': printf("#\\Backspace"); break; + case '\11': + printf("#\\Tab"); + break; + case '\13': + printf("#\\Vt"); + break; + case '\15': + printf("#\\Return"); + break; + case '\33': + printf("#\\Escape"); + break; + case '\40': + printf("#\\Space"); + break; case '\177': printf("#\\Delete"); break; default: - strcpy(buffer, "#\\"); if (c >= 128) { - strcat(buffer, "m-"); - c -= 128; - } - if (c < 32) { - strcat(buffer, "c-"); - c += '@'; - } - printf("%s%c", buffer, c); + /* Just print out the code value */ + printf("#\\u+%04X", c); + } else if (c < 32) { + /* Print it out as a control character */ + printf("#\\^%c", c + '@'); + } else { + /* Plain ASCII character */ + printf("#\\%c", c); + } break; } break;