Raymond Toy pushed to branch master at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/lisp/print.c
    ... ... @@ -212,12 +212,15 @@ static void
    212 212
     brief_otherimm(lispobj obj)
    
    213 213
     {
    
    214 214
         int type, c, idx;
    
    215
    -    char buffer[10];
    
    216 215
     
    
    217 216
         type = TypeOf(obj);
    
    218 217
         switch (type) {
    
    219 218
           case type_BaseChar:
    
    220
    -	  c = (obj >> 8) & 0xff;
    
    219
    +          /*
    
    220
    +           * A base-char should only be 16 bits long now.  But
    
    221
    +           * sometimes it uses all 24.  So just grab all the bits.
    
    222
    +           */
    
    223
    +	  c = (obj >> 8) & 0xfffff;
    
    221 224
     	  switch (c) {
    
    222 225
     	    case '\0':
    
    223 226
     		printf("#\\Null");
    
    ... ... @@ -228,20 +231,35 @@ brief_otherimm(lispobj obj)
    228 231
     	    case '\b':
    
    229 232
     		printf("#\\Backspace");
    
    230 233
     		break;
    
    234
    +            case '\11':
    
    235
    +                printf("#\\Tab");
    
    236
    +                break;
    
    237
    +            case '\13':
    
    238
    +                printf("#\\Vt");
    
    239
    +                break;
    
    240
    +            case '\15':
    
    241
    +                printf("#\\Return");
    
    242
    +                break;
    
    243
    +            case '\33':
    
    244
    +                printf("#\\Escape");
    
    245
    +                break;
    
    246
    +            case '\40':
    
    247
    +                printf("#\\Space");
    
    248
    +                break;
    
    231 249
     	    case '\177':
    
    232 250
     		printf("#\\Delete");
    
    233 251
     		break;
    
    234 252
     	    default:
    
    235
    -		strcpy(buffer, "#\\");
    
    236 253
     		if (c >= 128) {
    
    237
    -		    strcat(buffer, "m-");
    
    238
    -		    c -= 128;
    
    239
    -		}
    
    240
    -		if (c < 32) {
    
    241
    -		    strcat(buffer, "c-");
    
    242
    -		    c += '@';
    
    243
    -		}
    
    244
    -		printf("%s%c", buffer, c);
    
    254
    +                    /* Just print out the code value */
    
    255
    +		    printf("#\\u+%04X", c);
    
    256
    +		} else if (c < 32) {
    
    257
    +                    /* Print it out as a control character */
    
    258
    +                    printf("#\\^%c", c + '@');
    
    259
    +		} else {
    
    260
    +                    /* Plain ASCII character */
    
    261
    +                    printf("#\\%c", c);
    
    262
    +                }
    
    245 263
     		break;
    
    246 264
     	  }
    
    247 265
     	  break;