290 |
print_unwind (saved_text) |
print_unwind (saved_text) |
291 |
Lisp_Object saved_text; |
Lisp_Object saved_text; |
292 |
{ |
{ |
293 |
bcopy (XSTRING (saved_text)->data, print_buffer, XSTRING (saved_text)->size); |
bcopy (SDATA (saved_text), print_buffer, SCHARS (saved_text)); |
294 |
return Qnil; |
return Qnil; |
295 |
} |
} |
296 |
|
|
461 |
int chars; |
int chars; |
462 |
|
|
463 |
if (STRING_MULTIBYTE (string)) |
if (STRING_MULTIBYTE (string)) |
464 |
chars = XSTRING (string)->size; |
chars = SCHARS (string); |
465 |
else if (EQ (printcharfun, Qt) |
else if (EQ (printcharfun, Qt) |
466 |
? ! NILP (buffer_defaults.enable_multibyte_characters) |
? ! NILP (buffer_defaults.enable_multibyte_characters) |
467 |
: ! NILP (current_buffer->enable_multibyte_characters)) |
: ! NILP (current_buffer->enable_multibyte_characters)) |
472 |
Lisp_Object newstr; |
Lisp_Object newstr; |
473 |
int bytes; |
int bytes; |
474 |
|
|
475 |
chars = STRING_BYTES (XSTRING (string)); |
chars = SBYTES (string); |
476 |
bytes = parse_str_to_multibyte (XSTRING (string)->data, chars); |
bytes = parse_str_to_multibyte (SDATA (string), chars); |
477 |
if (chars < bytes) |
if (chars < bytes) |
478 |
{ |
{ |
479 |
newstr = make_uninit_multibyte_string (chars, bytes); |
newstr = make_uninit_multibyte_string (chars, bytes); |
480 |
bcopy (XSTRING (string)->data, XSTRING (newstr)->data, chars); |
bcopy (SDATA (string), SDATA (newstr), chars); |
481 |
str_to_multibyte (XSTRING (newstr)->data, bytes, chars); |
str_to_multibyte (SDATA (newstr), bytes, chars); |
482 |
string = newstr; |
string = newstr; |
483 |
} |
} |
484 |
} |
} |
485 |
else |
else |
486 |
chars = STRING_BYTES (XSTRING (string)); |
chars = SBYTES (string); |
487 |
|
|
488 |
/* strout is safe for output to a frame (echo area) or to print_buffer. */ |
/* strout is safe for output to a frame (echo area) or to print_buffer. */ |
489 |
strout (XSTRING (string)->data, |
strout (SDATA (string), |
490 |
chars, STRING_BYTES (XSTRING (string)), |
chars, SBYTES (string), |
491 |
printcharfun, STRING_MULTIBYTE (string)); |
printcharfun, STRING_MULTIBYTE (string)); |
492 |
} |
} |
493 |
else |
else |
495 |
/* Otherwise, string may be relocated by printing one char. |
/* Otherwise, string may be relocated by printing one char. |
496 |
So re-fetch the string address for each character. */ |
So re-fetch the string address for each character. */ |
497 |
int i; |
int i; |
498 |
int size = XSTRING (string)->size; |
int size = SCHARS (string); |
499 |
int size_byte = STRING_BYTES (XSTRING (string)); |
int size_byte = SBYTES (string); |
500 |
struct gcpro gcpro1; |
struct gcpro gcpro1; |
501 |
GCPRO1 (string); |
GCPRO1 (string); |
502 |
if (size == size_byte) |
if (size == size_byte) |
503 |
for (i = 0; i < size; i++) |
for (i = 0; i < size; i++) |
504 |
PRINTCHAR (XSTRING (string)->data[i]); |
PRINTCHAR (SREF (string, i)); |
505 |
else |
else |
506 |
for (i = 0; i < size_byte; i++) |
for (i = 0; i < size_byte; i++) |
507 |
{ |
{ |
508 |
/* Here, we must convert each multi-byte form to the |
/* Here, we must convert each multi-byte form to the |
509 |
corresponding character code before handing it to PRINTCHAR. */ |
corresponding character code before handing it to PRINTCHAR. */ |
510 |
int len; |
int len; |
511 |
int ch = STRING_CHAR_AND_LENGTH (XSTRING (string)->data + i, |
int ch = STRING_CHAR_AND_LENGTH (SDATA (string) + i, |
512 |
size_byte - i, len); |
size_byte - i, len); |
513 |
if (!CHAR_VALID_P (ch, 0)) |
if (!CHAR_VALID_P (ch, 0)) |
514 |
{ |
{ |
515 |
ch = XSTRING (string)->data[i]; |
ch = SREF (string, i); |
516 |
len = 1; |
len = 1; |
517 |
} |
} |
518 |
PRINTCHAR (ch); |
PRINTCHAR (ch); |
664 |
GCPRO1(args); |
GCPRO1(args); |
665 |
name = Feval (Fcar (args)); |
name = Feval (Fcar (args)); |
666 |
CHECK_STRING (name); |
CHECK_STRING (name); |
667 |
temp_output_buffer_setup (XSTRING (name)->data); |
temp_output_buffer_setup (SDATA (name)); |
668 |
buf = Vstandard_output; |
buf = Vstandard_output; |
669 |
UNGCPRO; |
UNGCPRO; |
670 |
|
|
1074 |
/* Check that the spec we have is fully valid. |
/* Check that the spec we have is fully valid. |
1075 |
This means not only valid for printf, |
This means not only valid for printf, |
1076 |
but meant for floats, and reasonable. */ |
but meant for floats, and reasonable. */ |
1077 |
cp = XSTRING (Vfloat_output_format)->data; |
cp = SDATA (Vfloat_output_format); |
1078 |
|
|
1079 |
if (cp[0] != '%') |
if (cp[0] != '%') |
1080 |
goto lose; |
goto lose; |
1104 |
if (cp[1] != 0) |
if (cp[1] != 0) |
1105 |
goto lose; |
goto lose; |
1106 |
|
|
1107 |
sprintf (buf, XSTRING (Vfloat_output_format)->data, data); |
sprintf (buf, SDATA (Vfloat_output_format), data); |
1108 |
} |
} |
1109 |
|
|
1110 |
/* Make sure there is a decimal point with digit after, or an |
/* Make sure there is a decimal point with digit after, or an |
1243 |
{ |
{ |
1244 |
case Lisp_String: |
case Lisp_String: |
1245 |
/* A string may have text properties, which can be circular. */ |
/* A string may have text properties, which can be circular. */ |
1246 |
traverse_intervals_noorder (XSTRING (obj)->intervals, |
traverse_intervals_noorder (STRING_INTERVALS (obj), |
1247 |
print_preprocess_string, Qnil); |
print_preprocess_string, Qnil); |
1248 |
break; |
break; |
1249 |
|
|
1379 |
|
|
1380 |
GCPRO1 (obj); |
GCPRO1 (obj); |
1381 |
|
|
1382 |
if (!NULL_INTERVAL_P (XSTRING (obj)->intervals)) |
if (!NULL_INTERVAL_P (STRING_INTERVALS (obj))) |
1383 |
{ |
{ |
1384 |
PRINTCHAR ('#'); |
PRINTCHAR ('#'); |
1385 |
PRINTCHAR ('('); |
PRINTCHAR ('('); |
1386 |
} |
} |
1387 |
|
|
1388 |
PRINTCHAR ('\"'); |
PRINTCHAR ('\"'); |
1389 |
str = XSTRING (obj)->data; |
str = SDATA (obj); |
1390 |
size_byte = STRING_BYTES (XSTRING (obj)); |
size_byte = SBYTES (obj); |
1391 |
|
|
1392 |
for (i = 0, i_byte = 0; i_byte < size_byte;) |
for (i = 0, i_byte = 0; i_byte < size_byte;) |
1393 |
{ |
{ |
1467 |
} |
} |
1468 |
PRINTCHAR ('\"'); |
PRINTCHAR ('\"'); |
1469 |
|
|
1470 |
if (!NULL_INTERVAL_P (XSTRING (obj)->intervals)) |
if (!NULL_INTERVAL_P (STRING_INTERVALS (obj))) |
1471 |
{ |
{ |
1472 |
traverse_intervals (XSTRING (obj)->intervals, |
traverse_intervals (STRING_INTERVALS (obj), |
1473 |
0, print_interval, printcharfun); |
0, print_interval, printcharfun); |
1474 |
PRINTCHAR (')'); |
PRINTCHAR (')'); |
1475 |
} |
} |
1481 |
case Lisp_Symbol: |
case Lisp_Symbol: |
1482 |
{ |
{ |
1483 |
register int confusing; |
register int confusing; |
1484 |
register unsigned char *p = XSTRING (SYMBOL_NAME (obj))->data; |
register unsigned char *p = SDATA (SYMBOL_NAME (obj)); |
1485 |
register unsigned char *end = p + STRING_BYTES (XSTRING (SYMBOL_NAME (obj))); |
register unsigned char *end = p + SBYTES (SYMBOL_NAME (obj)); |
1486 |
register int c; |
register int c; |
1487 |
int i, i_byte, size_byte; |
int i, i_byte, size_byte; |
1488 |
Lisp_Object name; |
Lisp_Object name; |
1517 |
PRINTCHAR (':'); |
PRINTCHAR (':'); |
1518 |
} |
} |
1519 |
|
|
1520 |
size_byte = STRING_BYTES (XSTRING (name)); |
size_byte = SBYTES (name); |
1521 |
|
|
1522 |
for (i = 0, i_byte = 0; i_byte < size_byte;) |
for (i = 0, i_byte = 0; i_byte < size_byte;) |
1523 |
{ |
{ |
1735 |
{ |
{ |
1736 |
PRINTCHAR (' '); |
PRINTCHAR (' '); |
1737 |
PRINTCHAR ('\''); |
PRINTCHAR ('\''); |
1738 |
strout (XSTRING (SYMBOL_NAME (h->test))->data, -1, -1, printcharfun, 0); |
strout (SDATA (SYMBOL_NAME (h->test)), -1, -1, printcharfun, 0); |
1739 |
PRINTCHAR (' '); |
PRINTCHAR (' '); |
1740 |
strout (XSTRING (SYMBOL_NAME (h->weak))->data, -1, -1, printcharfun, 0); |
strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0); |
1741 |
PRINTCHAR (' '); |
PRINTCHAR (' '); |
1742 |
sprintf (buf, "%d/%d", XFASTINT (h->count), |
sprintf (buf, "%d/%d", XFASTINT (h->count), |
1743 |
XVECTOR (h->next)->size); |
XVECTOR (h->next)->size); |