Mercurial > hg > xemacs-beta
comparison src/print.c @ 16:0293115a14e9 r19-15b91
Import from CVS: tag r19-15b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:49:20 +0200 |
parents | ac2d302a0011 |
children | 859a2309aef8 |
comparison
equal
deleted
inserted
replaced
15:ad457d5f7d04 | 16:0293115a14e9 |
---|---|
148 GCPRO2 (function, reloc); | 148 GCPRO2 (function, reloc); |
149 | 149 |
150 fixup_internal_substring (newnonreloc, reloc, offset, &len); | 150 fixup_internal_substring (newnonreloc, reloc, offset, &len); |
151 | 151 |
152 if (STRINGP (reloc)) | 152 if (STRINGP (reloc)) |
153 newnonreloc = string_data (XSTRING (reloc)); | 153 newnonreloc = XSTRING_DATA (reloc); |
154 | 154 |
155 ccoff = bytecount_to_charcount (newnonreloc, offset); | 155 ccoff = bytecount_to_charcount (newnonreloc, offset); |
156 cclen = bytecount_to_charcount (newnonreloc + offset, len); | 156 cclen = bytecount_to_charcount (newnonreloc + offset, len); |
157 | 157 |
158 if (LSTREAMP (function)) | 158 if (LSTREAMP (function)) |
207 } | 207 } |
208 #endif /* not standalone */ | 208 #endif /* not standalone */ |
209 else if (EQ (function, Qt) || EQ (function, Qnil)) | 209 else if (EQ (function, Qt) || EQ (function, Qnil)) |
210 { | 210 { |
211 write_string_to_stdio_stream (stdout, 0, newnonreloc, offset, len, | 211 write_string_to_stdio_stream (stdout, 0, newnonreloc, offset, len, |
212 FORMAT_DISPLAY); | 212 FORMAT_TERMINAL); |
213 } | 213 } |
214 else | 214 else |
215 { | 215 { |
216 Charcount iii; | 216 Charcount iii; |
217 | 217 |
218 for (iii = ccoff; iii < cclen + ccoff; iii++) | 218 for (iii = ccoff; iii < cclen + ccoff; iii++) |
219 { | 219 { |
220 call1 (function, | 220 call1 (function, |
221 make_char (charptr_emchar_n (newnonreloc, iii))); | 221 make_char (charptr_emchar_n (newnonreloc, iii))); |
222 if (STRINGP (reloc)) | 222 if (STRINGP (reloc)) |
223 newnonreloc = string_data (XSTRING (reloc)); | 223 newnonreloc = XSTRING_DATA (reloc); |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
227 UNGCPRO; | 227 UNGCPRO; |
228 } | 228 } |
279 struct print_stream *ps = get_print_stream (stream); | 279 struct print_stream *ps = get_print_stream (stream); |
280 | 280 |
281 if (ps->file) | 281 if (ps->file) |
282 { | 282 { |
283 write_string_to_stdio_stream (ps->file, 0, data, 0, size, | 283 write_string_to_stdio_stream (ps->file, 0, data, 0, size, |
284 FORMAT_DISPLAY); | 284 FORMAT_TERMINAL); |
285 /* Make sure it really gets written now. */ | 285 /* Make sure it really gets written now. */ |
286 if (print_unbuffered) | 286 if (print_unbuffered) |
287 fflush (ps->file); | 287 fflush (ps->file); |
288 } | 288 } |
289 else | 289 else |
468 GCPRO1 (args); | 468 GCPRO1 (args); |
469 name = Feval (Fcar (args)); | 469 name = Feval (Fcar (args)); |
470 UNGCPRO; | 470 UNGCPRO; |
471 | 471 |
472 CHECK_STRING (name); | 472 CHECK_STRING (name); |
473 temp_output_buffer_setup ((char *) string_data (XSTRING (name))); | 473 temp_output_buffer_setup ((char *) XSTRING_DATA (name)); |
474 buf = Vstandard_output; | 474 buf = Vstandard_output; |
475 | 475 |
476 val = Fprogn (Fcdr (args)); | 476 val = Fprogn (Fcdr (args)); |
477 | 477 |
478 temp_output_buffer_show (buf, Qnil); | 478 temp_output_buffer_show (buf, Qnil); |
629 else /* oink oink */ | 629 else /* oink oink */ |
630 { | 630 { |
631 /* Check that the spec we have is fully valid. | 631 /* Check that the spec we have is fully valid. |
632 This means not only valid for printf, | 632 This means not only valid for printf, |
633 but meant for floats, and reasonable. */ | 633 but meant for floats, and reasonable. */ |
634 cp = string_data (XSTRING (Vfloat_output_format)); | 634 cp = XSTRING_DATA (Vfloat_output_format); |
635 | 635 |
636 if (cp[0] != '%') | 636 if (cp[0] != '%') |
637 goto lose; | 637 goto lose; |
638 if (cp[1] != '.') | 638 if (cp[1] != '.') |
639 goto lose; | 639 goto lose; |
652 goto lose; | 652 goto lose; |
653 | 653 |
654 if (cp[1] != 0) | 654 if (cp[1] != 0) |
655 goto lose; | 655 goto lose; |
656 | 656 |
657 sprintf (buf, (char *) string_data (XSTRING (Vfloat_output_format)), | 657 sprintf (buf, (char *) XSTRING_DATA (Vfloat_output_format), |
658 data); | 658 data); |
659 } | 659 } |
660 | 660 |
661 /* added by jwz: don't allow "1.0" to print as "1"; that destroys | 661 /* added by jwz: don't allow "1.0" to print as "1"; that destroys |
662 the read-equivalence of lisp objects. (* x 1) and (* x 1.0) do | 662 the read-equivalence of lisp objects. (* x 1) and (* x 1.0) do |
786 break; | 786 break; |
787 } | 787 } |
788 | 788 |
789 case Lisp_String: | 789 case Lisp_String: |
790 { | 790 { |
791 Bytecount size = string_length (XSTRING (obj)); | 791 Bytecount size = XSTRING_LENGTH (obj); |
792 struct gcpro gcpro1, gcpro2; | 792 struct gcpro gcpro1, gcpro2; |
793 int max = size; | 793 int max = size; |
794 GCPRO2 (obj, printcharfun); | 794 GCPRO2 (obj, printcharfun); |
795 | 795 |
796 if (INTP (Vprint_string_length) && | 796 if (INTP (Vprint_string_length) && |
1008 /* COMPILED_BYTECODE = 1 */ | 1008 /* COMPILED_BYTECODE = 1 */ |
1009 write_char_internal (" ", printcharfun); | 1009 write_char_internal (" ", printcharfun); |
1010 /* we don't really want to see that junk in the bytecode instructions. */ | 1010 /* we don't really want to see that junk in the bytecode instructions. */ |
1011 if (STRINGP (b->bytecodes) && !print_readably) | 1011 if (STRINGP (b->bytecodes) && !print_readably) |
1012 { | 1012 { |
1013 sprintf (buf, "\"...(%ld)\"", | 1013 sprintf (buf, "\"...(%ld)\"", (long) XSTRING_LENGTH (b->bytecodes)); |
1014 (long) string_length (XSTRING (b->bytecodes))); | |
1015 write_c_string (buf, printcharfun); | 1014 write_c_string (buf, printcharfun); |
1016 } | 1015 } |
1017 else | 1016 else |
1018 print_internal (b->bytecodes, printcharfun, escapeflag); | 1017 print_internal (b->bytecodes, printcharfun, escapeflag); |
1019 /* COMPILED_CONSTANTS = 2 */ | 1018 /* COMPILED_CONSTANTS = 2 */ |
1177 int extlen; | 1176 int extlen; |
1178 CONST Extbyte *extptr; | 1177 CONST Extbyte *extptr; |
1179 | 1178 |
1180 CHECK_CHAR_COERCE_INT (character); | 1179 CHECK_CHAR_COERCE_INT (character); |
1181 len = set_charptr_emchar (str, XCHAR (character)); | 1180 len = set_charptr_emchar (str, XCHAR (character)); |
1182 GET_CHARPTR_EXT_DATA_ALLOCA (str, len, FORMAT_DISPLAY, extptr, extlen); | 1181 GET_CHARPTR_EXT_DATA_ALLOCA (str, len, FORMAT_TERMINAL, extptr, extlen); |
1183 memcpy (alternate_do_string + alternate_do_pointer, extptr, extlen); | 1182 memcpy (alternate_do_string + alternate_do_pointer, extptr, extlen); |
1184 alternate_do_pointer += extlen; | 1183 alternate_do_pointer += extlen; |
1185 alternate_do_string[alternate_do_pointer] = 0; | 1184 alternate_do_string[alternate_do_pointer] = 0; |
1186 return character; | 1185 return character; |
1187 } | 1186 } |
1224 file = CONSOLE_STREAM_DATA (con)->errfd; | 1223 file = CONSOLE_STREAM_DATA (con)->errfd; |
1225 } | 1224 } |
1226 | 1225 |
1227 if (STRINGP (char_or_string)) | 1226 if (STRINGP (char_or_string)) |
1228 write_string_to_stdio_stream (file, con, | 1227 write_string_to_stdio_stream (file, con, |
1229 string_data (XSTRING (char_or_string)), | 1228 XSTRING_DATA (char_or_string), |
1230 0, string_length (XSTRING (char_or_string)), | 1229 0, XSTRING_LENGTH (char_or_string), |
1231 FORMAT_DISPLAY); | 1230 FORMAT_TERMINAL); |
1232 else | 1231 else |
1233 { | 1232 { |
1234 Bufbyte str[MAX_EMCHAR_LEN]; | 1233 Bufbyte str[MAX_EMCHAR_LEN]; |
1235 Bytecount len; | 1234 Bytecount len; |
1236 | 1235 |
1237 CHECK_CHAR_COERCE_INT (char_or_string); | 1236 CHECK_CHAR_COERCE_INT (char_or_string); |
1238 len = set_charptr_emchar (str, XCHAR (char_or_string)); | 1237 len = set_charptr_emchar (str, XCHAR (char_or_string)); |
1239 write_string_to_stdio_stream (file, con, str, 0, len, FORMAT_DISPLAY); | 1238 write_string_to_stdio_stream (file, con, str, 0, len, FORMAT_TERMINAL); |
1240 } | 1239 } |
1241 | 1240 |
1242 return char_or_string; | 1241 return char_or_string; |
1243 } | 1242 } |
1244 | 1243 |
1256 termscript = 0; | 1255 termscript = 0; |
1257 | 1256 |
1258 if (! NILP (file)) | 1257 if (! NILP (file)) |
1259 { | 1258 { |
1260 file = Fexpand_file_name (file, Qnil); | 1259 file = Fexpand_file_name (file, Qnil); |
1261 termscript = fopen ((char *) string_data (XSTRING (file)), "w"); | 1260 termscript = fopen ((char *) XSTRING_DATA (file), "w"); |
1262 if (termscript == 0) | 1261 if (termscript == 0) |
1263 report_file_error ("Opening termscript", Fcons (file, Qnil)); | 1262 report_file_error ("Opening termscript", Fcons (file, Qnil)); |
1264 } | 1263 } |
1265 return Qnil; | 1264 return Qnil; |
1266 } | 1265 } |