comparison src/print.c @ 4952:19a72041c5ed

Mule-izing, various fixes related to char * arguments -------------------- ChangeLog entries follow: -------------------- modules/ChangeLog addition: 2010-01-26 Ben Wing <ben@xemacs.org> * postgresql/postgresql.c: * postgresql/postgresql.c (CHECK_LIVE_CONNECTION): * postgresql/postgresql.c (print_pgresult): * postgresql/postgresql.c (Fpq_conn_defaults): * postgresql/postgresql.c (Fpq_connectdb): * postgresql/postgresql.c (Fpq_connect_start): * postgresql/postgresql.c (Fpq_result_status): * postgresql/postgresql.c (Fpq_res_status): Mule-ize large parts of it. 2010-01-26 Ben Wing <ben@xemacs.org> * ldap/eldap.c (print_ldap): * ldap/eldap.c (allocate_ldap): Use write_ascstring(). src/ChangeLog addition: 2010-01-26 Ben Wing <ben@xemacs.org> * alloc.c: * alloc.c (build_ascstring): * alloc.c (build_msg_cistring): * alloc.c (staticpro_1): * alloc.c (staticpro_name): * alloc.c (staticpro_nodump_1): * alloc.c (staticpro_nodump_name): * alloc.c (unstaticpro_nodump_1): * alloc.c (mcpro_1): * alloc.c (mcpro_name): * alloc.c (object_memory_usage_stats): * alloc.c (common_init_alloc_early): * alloc.c (init_alloc_once_early): * buffer.c (print_buffer): * buffer.c (vars_of_buffer): * buffer.c (common_init_complex_vars_of_buffer): * buffer.c (init_initial_directory): * bytecode.c (invalid_byte_code): * bytecode.c (print_compiled_function): * bytecode.c (mark_compiled_function): * chartab.c (print_table_entry): * chartab.c (print_char_table): * config.h.in: * console-gtk.c: * console-gtk.c (gtk_device_to_console_connection): * console-gtk.c (gtk_semi_canonicalize_console_connection): * console-gtk.c (gtk_canonicalize_console_connection): * console-gtk.c (gtk_semi_canonicalize_device_connection): * console-gtk.c (gtk_canonicalize_device_connection): * console-stream.c (stream_init_frame_1): * console-stream.c (vars_of_console_stream): * console-stream.c (init_console_stream): * console-x.c (x_semi_canonicalize_console_connection): * console-x.c (x_semi_canonicalize_device_connection): * console-x.c (x_canonicalize_device_connection): * console-x.h: * data.c (eq_with_ebola_notice): * data.c (Fsubr_interactive): * data.c (Fnumber_to_string): * data.c (digit_to_number): * device-gtk.c (gtk_init_device): * device-msw.c (print_devmode): * device-x.c (x_event_name): * dialog-msw.c (handle_directory_dialog_box): * dialog-msw.c (handle_file_dialog_box): * dialog-msw.c (vars_of_dialog_mswindows): * doc.c (weird_doc): * doc.c (Fsnarf_documentation): * doc.c (vars_of_doc): * dumper.c (pdump): * dynarr.c: * dynarr.c (Dynarr_realloc): * editfns.c (Fuser_real_login_name): * editfns.c (get_home_directory): * elhash.c (print_hash_table_data): * elhash.c (print_hash_table): * emacs.c (main_1): * emacs.c (vars_of_emacs): * emodules.c: * emodules.c (_emodules_list): * emodules.c (Fload_module): * emodules.c (Funload_module): * emodules.c (Flist_modules): * emodules.c (find_make_module): * emodules.c (attempt_module_delete): * emodules.c (emodules_load): * emodules.c (emodules_doc_subr): * emodules.c (emodules_doc_sym): * emodules.c (syms_of_module): * emodules.c (vars_of_module): * emodules.h: * eval.c (print_subr): * eval.c (signal_call_debugger): * eval.c (build_error_data): * eval.c (signal_error): * eval.c (maybe_signal_error): * eval.c (signal_continuable_error): * eval.c (maybe_signal_continuable_error): * eval.c (signal_error_2): * eval.c (maybe_signal_error_2): * eval.c (signal_continuable_error_2): * eval.c (maybe_signal_continuable_error_2): * eval.c (signal_ferror): * eval.c (maybe_signal_ferror): * eval.c (signal_continuable_ferror): * eval.c (maybe_signal_continuable_ferror): * eval.c (signal_ferror_with_frob): * eval.c (maybe_signal_ferror_with_frob): * eval.c (signal_continuable_ferror_with_frob): * eval.c (maybe_signal_continuable_ferror_with_frob): * eval.c (syntax_error): * eval.c (syntax_error_2): * eval.c (maybe_syntax_error): * eval.c (sferror): * eval.c (sferror_2): * eval.c (maybe_sferror): * eval.c (invalid_argument): * eval.c (invalid_argument_2): * eval.c (maybe_invalid_argument): * eval.c (invalid_constant): * eval.c (invalid_constant_2): * eval.c (maybe_invalid_constant): * eval.c (invalid_operation): * eval.c (invalid_operation_2): * eval.c (maybe_invalid_operation): * eval.c (invalid_change): * eval.c (invalid_change_2): * eval.c (maybe_invalid_change): * eval.c (invalid_state): * eval.c (invalid_state_2): * eval.c (maybe_invalid_state): * eval.c (wtaerror): * eval.c (stack_overflow): * eval.c (out_of_memory): * eval.c (print_multiple_value): * eval.c (issue_call_trapping_problems_warning): * eval.c (backtrace_specials): * eval.c (backtrace_unevalled_args): * eval.c (Fbacktrace): * eval.c (warn_when_safe): * event-Xt.c (modwarn): * event-Xt.c (modbarf): * event-Xt.c (check_modifier): * event-Xt.c (store_modifier): * event-Xt.c (emacs_Xt_format_magic_event): * event-Xt.c (describe_event): * event-gtk.c (dragndrop_data_received): * event-gtk.c (store_modifier): * event-gtk.c (gtk_reset_modifier_mapping): * event-msw.c (dde_eval_string): * event-msw.c (Fdde_alloc_advise_item): * event-msw.c (mswindows_dde_callback): * event-msw.c (FROB): * event-msw.c (emacs_mswindows_format_magic_event): * event-stream.c (external_debugging_print_event): * event-stream.c (execute_help_form): * event-stream.c (vars_of_event_stream): * events.c (print_event_1): * events.c (print_event): * events.c (event_equal): * extents.c (print_extent_1): * extents.c (print_extent): * extents.c (vars_of_extents): * faces.c (print_face): * faces.c (complex_vars_of_faces): * file-coding.c: * file-coding.c (print_coding_system): * file-coding.c (print_coding_system_in_print_method): * file-coding.c (default_query_method): * file-coding.c (find_coding_system): * file-coding.c (make_coding_system_1): * file-coding.c (chain_print): * file-coding.c (undecided_print): * file-coding.c (gzip_print): * file-coding.c (vars_of_file_coding): * file-coding.c (complex_vars_of_file_coding): * fileio.c: * fileio.c (report_file_type_error): * fileio.c (report_error_with_errno): * fileio.c (report_file_error): * fileio.c (barf_or_query_if_file_exists): * fileio.c (vars_of_fileio): * floatfns.c (matherr): * fns.c (print_bit_vector): * fns.c (Fmapconcat): * fns.c (add_suffix_to_symbol): * fns.c (add_prefix_to_symbol): * frame-gtk.c: * frame-gtk.c (Fgtk_window_id): * frame-x.c (def): * frame-x.c (x_cde_transfer_callback): * frame.c: * frame.c (Fmake_frame): * gc.c (show_gc_cursor_and_message): * gc.c (vars_of_gc): * glyphs-eimage.c (png_instantiate): * glyphs-eimage.c (tiff_instantiate): * glyphs-gtk.c (gtk_print_image_instance): * glyphs-msw.c (mswindows_print_image_instance): * glyphs-x.c (x_print_image_instance): * glyphs-x.c (update_widget_face): * glyphs.c (make_string_from_file): * glyphs.c (print_image_instance): * glyphs.c (signal_image_error): * glyphs.c (signal_image_error_2): * glyphs.c (signal_double_image_error): * glyphs.c (signal_double_image_error_2): * glyphs.c (xbm_mask_file_munging): * glyphs.c (pixmap_to_lisp_data): * glyphs.h: * gui.c (gui_item_display_flush_left): * hpplay.c (player_error_internal): * hpplay.c (myHandler): * intl-win32.c: * intl-win32.c (langcode_to_lang): * intl-win32.c (sublangcode_to_lang): * intl-win32.c (Fmswindows_get_locale_info): * intl-win32.c (lcid_to_locale_mule_or_no): * intl-win32.c (mswindows_multibyte_to_unicode_print): * intl-win32.c (complex_vars_of_intl_win32): * keymap.c: * keymap.c (print_keymap): * keymap.c (ensure_meta_prefix_char_keymapp): * keymap.c (Fkey_description): * keymap.c (Ftext_char_description): * lisp.h: * lisp.h (struct): * lisp.h (DECLARE_INLINE_HEADER): * lread.c (Fload_internal): * lread.c (locate_file): * lread.c (read_escape): * lread.c (read_raw_string): * lread.c (read1): * lread.c (read_list): * lread.c (read_compiled_function): * lread.c (init_lread): * lrecord.h: * marker.c (print_marker): * marker.c (marker_equal): * menubar-msw.c (displayable_menu_item): * menubar-x.c (command_builder_operate_menu_accelerator): * menubar.c (vars_of_menubar): * minibuf.c (reinit_complex_vars_of_minibuf): * minibuf.c (complex_vars_of_minibuf): * mule-charset.c (Fmake_charset): * mule-charset.c (complex_vars_of_mule_charset): * mule-coding.c (iso2022_print): * mule-coding.c (fixed_width_query): * number.c (bignum_print): * number.c (ratio_print): * number.c (bigfloat_print): * number.c (bigfloat_finalize): * objects-msw.c: * objects-msw.c (mswindows_color_to_string): * objects-msw.c (mswindows_color_list): * objects-tty.c: * objects-tty.c (tty_font_list): * objects-tty.c (tty_find_charset_font): * objects-xlike-inc.c (xft_find_charset_font): * objects-xlike-inc.c (endif): * print.c: * print.c (write_istring): * print.c (write_ascstring): * print.c (Fterpri): * print.c (Fprint): * print.c (print_error_message): * print.c (print_vector_internal): * print.c (print_cons): * print.c (print_string): * print.c (printing_unreadable_object): * print.c (print_internal): * print.c (print_float): * print.c (print_symbol): * process-nt.c (mswindows_report_winsock_error): * process-nt.c (nt_canonicalize_host_name): * process-unix.c (unix_canonicalize_host_name): * process.c (print_process): * process.c (report_process_error): * process.c (report_network_error): * process.c (make_process_internal): * process.c (Fstart_process_internal): * process.c (status_message): * process.c (putenv_internal): * process.c (vars_of_process): * process.h: * profile.c (vars_of_profile): * rangetab.c (print_range_table): * realpath.c (vars_of_realpath): * redisplay.c (vars_of_redisplay): * search.c (wordify): * search.c (Freplace_match): * sheap.c (sheap_adjust_h): * sound.c (report_sound_error): * sound.c (Fplay_sound_file): * specifier.c (print_specifier): * symbols.c (Fsubr_name): * symbols.c (do_symval_forwarding): * symbols.c (set_default_buffer_slot_variable): * symbols.c (set_default_console_slot_variable): * symbols.c (store_symval_forwarding): * symbols.c (default_value): * symbols.c (defsymbol_massage_name_1): * symbols.c (defsymbol_massage_name_nodump): * symbols.c (defsymbol_massage_name): * symbols.c (defsymbol_massage_multiword_predicate_nodump): * symbols.c (defsymbol_massage_multiword_predicate): * symbols.c (defsymbol_nodump): * symbols.c (defsymbol): * symbols.c (defkeyword): * symbols.c (defkeyword_massage_name): * symbols.c (check_module_subr): * symbols.c (deferror_1): * symbols.c (deferror): * symbols.c (deferror_massage_name): * symbols.c (deferror_massage_name_and_message): * symbols.c (defvar_magic): * symeval.h: * symeval.h (DEFVAR_SYMVAL_FWD): * sysdep.c: * sysdep.c (init_system_name): * sysdll.c: * sysdll.c (MAYBE_PREPEND_UNDERSCORE): * sysdll.c (dll_function): * sysdll.c (dll_variable): * sysdll.c (dll_error): * sysdll.c (dll_open): * sysdll.c (dll_close): * sysdll.c (image_for_address): * sysdll.c (my_find_image): * sysdll.c (search_linked_libs): * sysdll.h: * sysfile.h: * sysfile.h (DEFAULT_DIRECTORY_FALLBACK): * syswindows.h: * tests.c (DFC_CHECK_LENGTH): * tests.c (DFC_CHECK_CONTENT): * tests.c (Ftest_hash_tables): * text.c (vars_of_text): * text.h: * tooltalk.c (tt_opnum_string): * tooltalk.c (tt_message_arg_ival_string): * tooltalk.c (Ftooltalk_default_procid): * tooltalk.c (Ftooltalk_default_session): * tooltalk.c (init_tooltalk): * tooltalk.c (vars_of_tooltalk): * ui-gtk.c (Fdll_load): * ui-gtk.c (type_to_marshaller_type): * ui-gtk.c (Fgtk_import_function_internal): * ui-gtk.c (emacs_gtk_object_printer): * ui-gtk.c (emacs_gtk_boxed_printer): * unicode.c (unicode_to_ichar): * unicode.c (unicode_print): * unicode.c (unicode_query): * unicode.c (vars_of_unicode): * unicode.c (complex_vars_of_unicode): * win32.c: * win32.c (mswindows_report_process_error): * window.c (print_window): * xemacs.def.in.in: BASIC IDEA: Further fixing up uses of char * and CIbyte * to reflect their actual semantics; Mule-izing some code; redoing of the not-yet-working code to handle message translation. Clean up code to handle message-translation (not yet working). Create separate versions of build_msg_string() for working with Ibyte *, CIbyte *, and Ascbyte * arguments. Assert that Ascbyte * arguments are pure-ASCII. Make build_msg_string() be the same as build_msg_ascstring(). Create same three versions of GETTEXT() and DEFER_GETTEXT(). Also create build_defer_string() and variants for the equivalent of DEFER_GETTEXT() when building a string. Remove old CGETTEXT(). Clean up code where GETTEXT(), DEFER_GETTEXT(), build_msg_string(), etc. was being called and introduce some new calls to build_msg_string(), etc. Remove GETTEXT() from calls to weird_doc() -- we assume that the message snarfer knows about weird_doc(). Remove uses of DEFER_GETTEXT() from error messages in sysdep.c and instead use special comments /* @@@begin-snarf@@@ */ and /* @@@end-snarf@@@ */ that the message snarfer presumably knows about. Create build_ascstring() and use it in many instances in place of build_string(). The purpose of having Ascbyte * variants is to make the code more self-documenting in terms of what sort of semantics is expected for char * strings. In fact in the process of looking for uses of build_string(), much improperly Mule-ized was discovered. Mule-ize a lot of code as described in previous paragraph, e.g. in sysdep.c. Make the error functions take Ascbyte * strings and fix up a couple of places where non-pure-ASCII strings were being passed in (file-coding.c, mule-coding.c, unicode.c). (It's debatable whether we really need to make the error functions work this way. It helps catch places where code is written in a way that message translation won't work, but we may well never implement message translation.) Make staticpro() and friends take Ascbyte * strings instead of raw char * strings. Create a const_Ascbyte_ptr dynarr type to describe what's held by staticpro_names[] and friends, create pdump descriptions for const_Ascbyte_ptr dynarrs, and use them in place of specially-crafted staticpro descriptions. Mule-ize certain other functions (e.g. x_event_name) by correcting raw use of char * to Ascbyte *, Rawbyte * or another such type, and raw use of char[] buffers to another type (usually Ascbyte[]). Change many uses of write_c_string() to write_msg_string(), write_ascstring(), etc. Mule-ize emodules.c, emodules.h, sysdll.h. Fix some un-Mule-ized code in intl-win32.c. A comment in event-Xt.c and the limitations of the message snarfer (make-msgfile or whatever) is presumably incorrect -- it should be smart enough to handle function calls spread over more than one line. Clean up code in event-Xt.c that was written awkwardly for this reason. In config.h.in, instead of NEED_ERROR_CHECK_TYPES_INLINES, create a more general XEMACS_DEFS_NEEDS_INLINE_DECLS to indicate when inlined functions need to be declared in xemacs.defs.in.in, and make use of it in xemacs.defs.in.in. We need to do this because postgresql.c now calls qxestrdup(), which is an inline function. Make nconc2() and other such functions MODULE_API and put them in xemacs.defs.in.in since postgresql.c now uses them. Clean up indentation in lread.c and a few other places. In text.h, document ASSERT_ASCTEXT_ASCII() and ASSERT_ASCTEXT_ASCII_LEN(), group together the stand-in encodings and add some more for DLL symbols, function and variable names, etc.
author Ben Wing <ben@xemacs.org>
date Tue, 26 Jan 2010 23:22:30 -0600
parents ae81a2c00f4f
children 304aebb79cd3
comparison
equal deleted inserted replaced
4951:de60897044f4 4952:19a72041c5ed
653 #endif 653 #endif
654 output_string (stream, str, Qnil, 0, size); 654 output_string (stream, str, Qnil, 0, size);
655 } 655 }
656 656
657 void 657 void
658 write_string (Lisp_Object stream, const Ibyte *str) 658 write_istring (Lisp_Object stream, const Ibyte *str)
659 { 659 {
660 /* This function can GC */ 660 /* This function can GC */
661 write_string_1 (stream, str, qxestrlen (str)); 661 write_string_1 (stream, str, qxestrlen (str));
662 } 662 }
663 663
664 void 664 void
665 write_c_string (Lisp_Object stream, const CIbyte *str) 665 write_c_string (Lisp_Object stream, const CIbyte *str)
666 { 666 {
667 /* This function can GC */ 667 /* This function can GC */
668 write_string_1 (stream, (const Ibyte *) str, strlen (str)); 668 write_istring (stream, (const Ibyte *) str);
669 }
670
671 void
672 write_ascstring (Lisp_Object stream, const Ascbyte *str)
673 {
674 /* This function can GC */
675 ASSERT_ASCTEXT_ASCII (str);
676 write_istring (stream, (const Ibyte *) str);
677 }
678
679 void
680 write_msg_istring (Lisp_Object stream, const Ibyte *str)
681 {
682 /* This function can GC */
683 return write_istring (stream, IGETTEXT (str));
684 }
685
686 void
687 write_msg_cistring (Lisp_Object stream, const CIbyte *str)
688 {
689 /* This function can GC */
690 return write_msg_istring (stream, (const Ibyte *) str);
691 }
692
693 void
694 write_msg_ascstring (Lisp_Object stream, const Ascbyte *str)
695 {
696 /* This function can GC */
697 ASSERT_ASCTEXT_ASCII (str);
698 return write_msg_istring (stream, (const Ibyte *) str);
669 } 699 }
670 700
671 void 701 void
672 write_eistring (Lisp_Object stream, const Eistring *ei) 702 write_eistring (Lisp_Object stream, const Eistring *ei)
673 { 703 {
846 If STREAM is omitted or nil, the value of `standard-output' is used. 876 If STREAM is omitted or nil, the value of `standard-output' is used.
847 */ 877 */
848 (stream)) 878 (stream))
849 { 879 {
850 /* This function can GC */ 880 /* This function can GC */
851 write_c_string (canonicalize_printcharfun (stream), "\n"); 881 write_ascstring (canonicalize_printcharfun (stream), "\n");
852 return Qt; 882 return Qt;
853 } 883 }
854 884
855 DEFUN ("prin1", Fprin1, 1, 2, 0, /* 885 DEFUN ("prin1", Fprin1, 1, 2, 0, /*
856 Output the printed representation of OBJECT, any Lisp object. 886 Output the printed representation of OBJECT, any Lisp object.
943 Lisp_Object frame = Qnil; 973 Lisp_Object frame = Qnil;
944 struct gcpro gcpro1, gcpro2; 974 struct gcpro gcpro1, gcpro2;
945 975
946 GCPRO2 (object, stream); 976 GCPRO2 (object, stream);
947 stream = print_prepare (stream, &frame); 977 stream = print_prepare (stream, &frame);
948 write_c_string (stream, "\n"); 978 write_ascstring (stream, "\n");
949 print_internal (object, stream, 1); 979 print_internal (object, stream, 1);
950 write_c_string (stream, "\n"); 980 write_ascstring (stream, "\n");
951 print_finish (stream, frame); 981 print_finish (stream, frame);
952 UNGCPRO; 982 UNGCPRO;
953 return object; 983 return object;
954 } 984 }
955 985
1021 else 1051 else
1022 print_internal (LISP_GETTEXT (errmsg), stream, 0); 1052 print_internal (LISP_GETTEXT (errmsg), stream, 0);
1023 } 1053 }
1024 while (!NILP (tail)) 1054 while (!NILP (tail))
1025 { 1055 {
1026 write_c_string (stream, first ? ": " : ", "); 1056 write_ascstring (stream, first ? ": " : ", ");
1027 /* Most errors have an explanatory string as their first argument, 1057 /* Most errors have an explanatory string as their first argument,
1028 and it looks better not to put the quotes around it. */ 1058 and it looks better not to put the quotes around it. */
1029 print_internal (Fcar (tail), stream, 1059 print_internal (Fcar (tail), stream,
1030 !(first && STRINGP (Fcar (tail))) || 1060 !(first && STRINGP (Fcar (tail))) ||
1031 !NILP (Fget (type, Qerror_lacks_explanatory_string, 1061 !NILP (Fget (type, Qerror_lacks_explanatory_string,
1041 } 1071 }
1042 1072
1043 error_throw: 1073 error_throw:
1044 if (NILP (method)) 1074 if (NILP (method))
1045 { 1075 {
1046 write_c_string (stream, GETTEXT ("Peculiar error ")); 1076 write_ascstring (stream, GETTEXT ("Peculiar error "));
1047 print_internal (error_object, stream, 1); 1077 print_internal (error_object, stream, 1);
1048 return; 1078 return;
1049 } 1079 }
1050 else 1080 else
1051 { 1081 {
1329 1359
1330 write_c_string (printcharfun, start); 1360 write_c_string (printcharfun, start);
1331 for (i = 0; i < last; i++) 1361 for (i = 0; i < last; i++)
1332 { 1362 {
1333 Lisp_Object elt = XVECTOR_DATA (obj)[i]; 1363 Lisp_Object elt = XVECTOR_DATA (obj)[i];
1334 if (i != 0) write_c_string (printcharfun, " "); 1364 if (i != 0) write_ascstring (printcharfun, " ");
1335 print_internal (elt, printcharfun, escapeflag); 1365 print_internal (elt, printcharfun, escapeflag);
1336 } 1366 }
1337 UNGCPRO; 1367 UNGCPRO;
1338 if (last != len) 1368 if (last != len)
1339 write_c_string (printcharfun, " ..."); 1369 write_ascstring (printcharfun, " ...");
1340 write_c_string (printcharfun, end); 1370 write_c_string (printcharfun, end);
1341 } 1371 }
1342 1372
1343 void 1373 void
1344 print_cons (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) 1374 print_cons (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
1356 CONSP (XCDR (obj)) && 1386 CONSP (XCDR (obj)) &&
1357 NILP (XCDR (XCDR (obj)))) 1387 NILP (XCDR (XCDR (obj))))
1358 { 1388 {
1359 obj = XCAR (XCDR (obj)); 1389 obj = XCAR (XCDR (obj));
1360 GCPRO2 (obj, printcharfun); 1390 GCPRO2 (obj, printcharfun);
1361 write_c_string (printcharfun, "\'"); 1391 write_ascstring (printcharfun, "\'");
1362 UNGCPRO; 1392 UNGCPRO;
1363 print_internal (obj, printcharfun, escapeflag); 1393 print_internal (obj, printcharfun, escapeflag);
1364 return; 1394 return;
1365 } 1395 }
1366 1396
1367 GCPRO2 (obj, printcharfun); 1397 GCPRO2 (obj, printcharfun);
1368 write_c_string (printcharfun, "("); 1398 write_ascstring (printcharfun, "(");
1369 1399
1370 { 1400 {
1371 int len; 1401 int len;
1372 int max = INTP (Vprint_length) ? XINT (Vprint_length) : INT_MAX; 1402 int max = INTP (Vprint_length) ? XINT (Vprint_length) : INT_MAX;
1373 Lisp_Object tortoise; 1403 Lisp_Object tortoise;
1376 for (tortoise = obj, len = 0; 1406 for (tortoise = obj, len = 0;
1377 CONSP (obj); 1407 CONSP (obj);
1378 obj = XCDR (obj), len++) 1408 obj = XCDR (obj), len++)
1379 { 1409 {
1380 if (len > 0) 1410 if (len > 0)
1381 write_c_string (printcharfun, " "); 1411 write_ascstring (printcharfun, " ");
1382 if (EQ (obj, tortoise) && len > 0) 1412 if (EQ (obj, tortoise) && len > 0)
1383 { 1413 {
1384 if (print_readably) 1414 if (print_readably)
1385 printing_unreadable_object ("circular list"); 1415 printing_unreadable_object ("circular list");
1386 else 1416 else
1387 write_c_string (printcharfun, "... <circular list>"); 1417 write_ascstring (printcharfun, "... <circular list>");
1388 break; 1418 break;
1389 } 1419 }
1390 if (len & 1) 1420 if (len & 1)
1391 tortoise = XCDR (tortoise); 1421 tortoise = XCDR (tortoise);
1392 if (len > max) 1422 if (len > max)
1393 { 1423 {
1394 write_c_string (printcharfun, "..."); 1424 write_ascstring (printcharfun, "...");
1395 break; 1425 break;
1396 } 1426 }
1397 print_internal (XCAR (obj), printcharfun, escapeflag); 1427 print_internal (XCAR (obj), printcharfun, escapeflag);
1398 } 1428 }
1399 } 1429 }
1400 if (!LISTP (obj)) 1430 if (!LISTP (obj))
1401 { 1431 {
1402 write_c_string (printcharfun, " . "); 1432 write_ascstring (printcharfun, " . ");
1403 print_internal (obj, printcharfun, escapeflag); 1433 print_internal (obj, printcharfun, escapeflag);
1404 } 1434 }
1405 UNGCPRO; 1435 UNGCPRO;
1406 1436
1407 write_c_string (printcharfun, ")"); 1437 write_ascstring (printcharfun, ")");
1408 return; 1438 return;
1409 } 1439 }
1410 1440
1411 void 1441 void
1412 print_vector (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) 1442 print_vector (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
1440 if (!escapeflag) 1470 if (!escapeflag)
1441 { 1471 {
1442 /* This deals with GC-relocation and Mule. */ 1472 /* This deals with GC-relocation and Mule. */
1443 output_string (printcharfun, 0, obj, 0, bcmax); 1473 output_string (printcharfun, 0, obj, 0, bcmax);
1444 if (max < size) 1474 if (max < size)
1445 write_c_string (printcharfun, " ..."); 1475 write_ascstring (printcharfun, " ...");
1446 } 1476 }
1447 else 1477 else
1448 { 1478 {
1449 Bytecount i, last = 0; 1479 Bytecount i, last = 0;
1450 1480
1451 write_c_string (printcharfun, "\""); 1481 write_ascstring (printcharfun, "\"");
1452 for (i = 0; i < bcmax; i++) 1482 for (i = 0; i < bcmax; i++)
1453 { 1483 {
1454 Ibyte ch = string_byte (obj, i); 1484 Ibyte ch = string_byte (obj, i);
1455 if (ch == '\"' || ch == '\\' 1485 if (ch == '\"' || ch == '\\'
1456 || (ch == '\n' && print_escape_newlines)) 1486 || (ch == '\n' && print_escape_newlines))
1460 output_string (printcharfun, 0, obj, last, 1490 output_string (printcharfun, 0, obj, last,
1461 i - last); 1491 i - last);
1462 } 1492 }
1463 if (ch == '\n') 1493 if (ch == '\n')
1464 { 1494 {
1465 write_c_string (printcharfun, "\\n"); 1495 write_ascstring (printcharfun, "\\n");
1466 } 1496 }
1467 else 1497 else
1468 { 1498 {
1469 Ibyte temp[2]; 1499 Ibyte temp[2];
1470 write_c_string (printcharfun, "\\"); 1500 write_ascstring (printcharfun, "\\");
1471 /* This is correct for Mule because the 1501 /* This is correct for Mule because the
1472 character is either \ or " */ 1502 character is either \ or " */
1473 temp[0] = string_byte (obj, i); 1503 temp[0] = string_byte (obj, i);
1474 temp[1] = '\0'; 1504 temp[1] = '\0';
1475 write_string (printcharfun, temp); 1505 write_istring (printcharfun, temp);
1476 } 1506 }
1477 last = i + 1; 1507 last = i + 1;
1478 } 1508 }
1479 } 1509 }
1480 if (bcmax > last) 1510 if (bcmax > last)
1481 { 1511 {
1482 output_string (printcharfun, 0, obj, last, 1512 output_string (printcharfun, 0, obj, last,
1483 bcmax - last); 1513 bcmax - last);
1484 } 1514 }
1485 if (max < size) 1515 if (max < size)
1486 write_c_string (printcharfun, " ..."); 1516 write_ascstring (printcharfun, " ...");
1487 write_c_string (printcharfun, "\""); 1517 write_ascstring (printcharfun, "\"");
1488 } 1518 }
1489 UNGCPRO; 1519 UNGCPRO;
1490 } 1520 }
1491 1521
1492 DOESNT_RETURN 1522 DOESNT_RETURN
1493 printing_unreadable_object (const CIbyte *fmt, ...) 1523 printing_unreadable_object (const Ascbyte *fmt, ...)
1494 { 1524 {
1495 Lisp_Object obj; 1525 Lisp_Object obj;
1496 va_list args; 1526 va_list args;
1497 1527
1498 va_start (args, fmt); 1528 va_start (args, fmt);
1499 obj = emacs_vsprintf_string (CGETTEXT (fmt), args); 1529 obj = emacs_vsprintf_string (GETTEXT (fmt), args);
1500 va_end (args); 1530 va_end (args);
1501 1531
1502 /* Fsignal GC-protects its args */ 1532 /* Fsignal GC-protects its args */
1503 signal_error (Qprinting_unreadable_object, 0, obj); 1533 signal_error (Qprinting_unreadable_object, 0, obj);
1504 } 1534 }
1676 switch (XTYPE (obj)) 1706 switch (XTYPE (obj))
1677 { 1707 {
1678 case Lisp_Type_Int_Even: 1708 case Lisp_Type_Int_Even:
1679 case Lisp_Type_Int_Odd: 1709 case Lisp_Type_Int_Odd:
1680 { 1710 {
1681 char buf[DECIMAL_PRINT_SIZE (EMACS_INT)]; 1711 Ascbyte buf[DECIMAL_PRINT_SIZE (EMACS_INT)];
1682 long_to_string (buf, XINT (obj)); 1712 long_to_string (buf, XINT (obj));
1683 write_c_string (printcharfun, buf); 1713 write_ascstring (printcharfun, buf);
1684 break; 1714 break;
1685 } 1715 }
1686 1716
1687 case Lisp_Type_Char: 1717 case Lisp_Type_Char:
1688 { 1718 {
1882 if (EQ (obj, being_printed[i])) 1912 if (EQ (obj, being_printed[i]))
1883 { 1913 {
1884 Ascbyte buf[DECIMAL_PRINT_SIZE (long) + 1]; 1914 Ascbyte buf[DECIMAL_PRINT_SIZE (long) + 1];
1885 *buf = '#'; 1915 *buf = '#';
1886 long_to_string (buf + 1, i); 1916 long_to_string (buf + 1, i);
1887 write_c_string (printcharfun, buf); 1917 write_ascstring (printcharfun, buf);
1888 break; 1918 break;
1889 } 1919 }
1890 if (i < print_depth - 1) /* Did we print something? */ 1920 if (i < print_depth - 1) /* Did we print something? */
1891 break; 1921 break;
1892 } 1922 }
1895 { 1925 {
1896 /* If deeper than spec'd depth, print placeholder. */ 1926 /* If deeper than spec'd depth, print placeholder. */
1897 if (INTP (Vprint_level) 1927 if (INTP (Vprint_level)
1898 && print_depth > XINT (Vprint_level)) 1928 && print_depth > XINT (Vprint_level))
1899 { 1929 {
1900 write_c_string (printcharfun, "..."); 1930 write_ascstring (printcharfun, "...");
1901 break; 1931 break;
1902 } 1932 }
1903 } 1933 }
1904 1934
1905 if (LHEADER_IMPLEMENTATION (lheader)->printer) 1935 if (LHEADER_IMPLEMENTATION (lheader)->printer)
1927 1957
1928 void 1958 void
1929 print_float (Lisp_Object obj, Lisp_Object printcharfun, 1959 print_float (Lisp_Object obj, Lisp_Object printcharfun,
1930 int UNUSED (escapeflag)) 1960 int UNUSED (escapeflag))
1931 { 1961 {
1932 char pigbuf[350]; /* see comments in float_to_string */ 1962 Ascbyte pigbuf[350]; /* see comments in float_to_string */
1933 1963
1934 float_to_string (pigbuf, XFLOAT_DATA (obj)); 1964 float_to_string (pigbuf, XFLOAT_DATA (obj));
1935 write_c_string (printcharfun, pigbuf); 1965 write_ascstring (printcharfun, pigbuf);
1936 } 1966 }
1937 1967
1938 void 1968 void
1939 print_symbol (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) 1969 print_symbol (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
1940 { 1970 {
1966 if (print_depth > 1) 1996 if (print_depth > 1)
1967 { 1997 {
1968 Lisp_Object tem = Fassq (obj, Vprint_gensym_alist); 1998 Lisp_Object tem = Fassq (obj, Vprint_gensym_alist);
1969 if (CONSP (tem)) 1999 if (CONSP (tem))
1970 { 2000 {
1971 write_c_string (printcharfun, "#"); 2001 write_ascstring (printcharfun, "#");
1972 print_internal (XCDR (tem), printcharfun, escapeflag); 2002 print_internal (XCDR (tem), printcharfun, escapeflag);
1973 write_c_string (printcharfun, "#"); 2003 write_ascstring (printcharfun, "#");
1974 UNGCPRO; 2004 UNGCPRO;
1975 return; 2005 return;
1976 } 2006 }
1977 else 2007 else
1978 { 2008 {
1986 } 2016 }
1987 else 2017 else
1988 tem = make_int (1); 2018 tem = make_int (1);
1989 Vprint_gensym_alist = Fcons (Fcons (obj, tem), Vprint_gensym_alist); 2019 Vprint_gensym_alist = Fcons (Fcons (obj, tem), Vprint_gensym_alist);
1990 2020
1991 write_c_string (printcharfun, "#"); 2021 write_ascstring (printcharfun, "#");
1992 print_internal (tem, printcharfun, escapeflag); 2022 print_internal (tem, printcharfun, escapeflag);
1993 write_c_string (printcharfun, "="); 2023 write_ascstring (printcharfun, "=");
1994 } 2024 }
1995 } 2025 }
1996 write_c_string (printcharfun, "#:"); 2026 write_ascstring (printcharfun, "#:");
1997 } 2027 }
1998 2028
1999 /* Does it look like an integer or a float? */ 2029 /* Does it look like an integer or a float? */
2000 { 2030 {
2001 Ibyte *data = XSTRING_DATA (name); 2031 Ibyte *data = XSTRING_DATA (name);
2026 /* #### Ugh, this is needlessly complex and slow for what we 2056 /* #### Ugh, this is needlessly complex and slow for what we
2027 need here. It might be a good idea to copy equivalent code 2057 need here. It might be a good idea to copy equivalent code
2028 from FSF. --hniksic */ 2058 from FSF. --hniksic */
2029 confusing = isfloat_string ((char *) data); 2059 confusing = isfloat_string ((char *) data);
2030 if (confusing) 2060 if (confusing)
2031 write_c_string (printcharfun, "\\"); 2061 write_ascstring (printcharfun, "\\");
2032 } 2062 }
2033 2063
2034 { 2064 {
2035 Bytecount i; 2065 Bytecount i;
2036 Bytecount last = 0; 2066 Bytecount last = 0;
2051 case ';': case '#' : case '(' : case ')': 2081 case ';': case '#' : case '(' : case ')':
2052 case ',': case '.' : case '`' : 2082 case ',': case '.' : case '`' :
2053 case '[': case ']' : case '?' : 2083 case '[': case ']' : case '?' :
2054 if (i > last) 2084 if (i > last)
2055 output_string (printcharfun, 0, name, last, i - last); 2085 output_string (printcharfun, 0, name, last, i - last);
2056 write_c_string (printcharfun, "\\"); 2086 write_ascstring (printcharfun, "\\");
2057 last = i; 2087 last = i;
2058 } 2088 }
2059 } 2089 }
2060 output_string (printcharfun, 0, name, last, size - last); 2090 output_string (printcharfun, 0, name, last, size - last);
2061 } 2091 }