# HG changeset patch # User Richard M. Stallman # Date 813103340 0 # Node ID bd9ff4ee6cd428334aa604b64febdd721f5490ce # Parent 6182d95acd141d1c3ad7e06422b8ad83c1c4cd3c (print): Handle chartables and boolvectors. (print_boolvector): New function. diff -r 6182d95acd14 -r bd9ff4ee6cd4 src/print.c --- a/src/print.c Sat Oct 07 22:01:39 1995 +0000 +++ b/src/print.c Sat Oct 07 22:02:20 1995 +0000 @@ -294,7 +294,8 @@ } /* Print the contents of a string STRING using PRINTCHARFUN. - It isn't safe to use strout, because printing one char can relocate. */ + It isn't safe to use strout in many cases, + because printing one char can relocate. */ print_string (string, printcharfun) Lisp_Object string; @@ -926,6 +927,47 @@ else print_string (XPROCESS (obj)->name, printcharfun); } + else if (BOOL_VECTOR_P (obj)) + { + register int i; + register unsigned char c; + struct gcpro gcpro1; + int bits_per_char = INTBITS / sizeof (int); + int size_in_chars + = (XBOOL_VECTOR (obj)->size + bits_per_char) / bits_per_char; + + GCPRO1 (obj); + + PRINTCHAR ('#'); + PRINTCHAR ('&'); + sprintf (buf, "%d", XBOOL_VECTOR (obj)->size); + strout (buf, -1, printcharfun); + PRINTCHAR ('\"'); + for (i = 0; i < size_in_chars; i++) + { + QUIT; + c = XBOOL_VECTOR (obj)->data[i]; + if (c == '\n' && print_escape_newlines) + { + PRINTCHAR ('\\'); + PRINTCHAR ('n'); + } + else if (c == '\f' && print_escape_newlines) + { + PRINTCHAR ('\\'); + PRINTCHAR ('f'); + } + else + { + if (c == '\"' || c == '\\') + PRINTCHAR ('\\'); + PRINTCHAR (c); + } + } + PRINTCHAR ('\"'); + + UNGCPRO; + } else if (SUBRP (obj)) { strout ("#