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