comparison src/print.c @ 2367:ecf1ebac70d8

[xemacs-hg @ 2004-11-04 23:05:23 by ben] commit mega-patch configure.in: Turn off -Winline and -Wchar-subscripts. Use the right set of cflags when compiling modules. Rewrite ldap configuration to separate the inclusion of lber (needed in recent Cygwin) from the basic checks for the needed libraries. add a function for MAKE_JUNK_C; initially code was added to generate xemacs.def using this, but it will need to be rewritten. add an rm -f for junk.c to avoid weird Cygwin bug with cp -f onto an existing file. Sort list of auto-detected functions and eliminate unused checks for stpcpy, setlocale and getwd. Add autodetection of Cygwin scanf problems BETA: Rewrite section on configure to indicate what flags are important and what not. digest-doc.c, make-dump-id.c, profile.c, sorted-doc.c: Add proper decls for main(). make-msgfile.c: Document that this is old junk. Move proposal to text.c. make-msgfile.lex: Move proposal to text.c. make-mswin-unicode.pl: Convert error-generating code so that the entire message will be seen as a single unrecognized token. mule/mule-ccl.el: Update docs. lispref/mule.texi: Update CCL docs. ldap/eldap.c: Mule-ize. Use EXTERNAL_LIST_LOOP_2 instead of deleted EXTERNAL_LIST_LOOP. * XEmacs 21.5.18 "chestnut" is released. --------------------------------------------------------------- MULE-RELATED WORK: --------------------------------------------------------------- --------------------------- byte-char conversion --------------------------- buffer.c, buffer.h, insdel.c, text.c: Port FSF algorithm for byte-char conversion, replacing broken previous version. Track the char position of the gap. Add functions to do char-byte conversion downwards as well as upwards. Move comments about algorithm workings to internals manual. --------------------------- work on types --------------------------- alloc.c, console-x-impl.h, dump-data.c, dump-data.h, dumper.c, dialog-msw.c, dired-msw.c, doc.c, editfns.c, esd.c, event-gtk.h, event-msw.c, events.c, file-coding.c, file-coding.h, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-x.c, glyphs.c, glyphs.h, gui.c, hpplay.c, imgproc.c, intl-win32.c, lrecord.h, lstream.c, keymap.c, lisp.h, libsst.c, linuxplay.c, miscplay.c, miscplay.h, mule-coding.c, nas.c, nt.c, ntheap.c, ntplay.c, objects-msw.c, objects-tty.c, objects-x.c, print.c, process-nt.c, process.c, redisplay.h, select-common.h, select-gtk.c, select-x.c, sgiplay.c, sound.c, sound.h, sunplay.c, sysfile.h, sysdep.c, syswindows.h, text.c, unexnt.c, win32.c, xgccache.c: Further work on types. This creates a full set of types for all the basic semantics of `char' that I have so far identified, so that its semantics can always be identified for the purposes of proper Mule-safe code, and the raw use of `char' always avoided. (1) More type renaming, for consistency of naming. Char_ASCII -> Ascbyte UChar_ASCII -> UAscbyte Char_Binary -> CBinbyte UChar_Binary -> Binbyte SChar_Binary -> SBinbyte (2) Introduce Rawbyte, CRawbyte, Boolbyte, Chbyte, UChbyte, and Bitbyte and use them. (3) New types Itext, Wexttext and Textcount for separating out the concepts of bytes and textual units (different under UTF-16 and UTF-32, which are potential internal encodings). (4) qxestr*_c -> qxestr*_ascii. lisp.h: New; goes with other qxe() functions. #### Maybe goes in a different section. lisp.h: Group generic int-type defs together with EMACS_INT defs. lisp.h: * lisp.h (WEXTTEXT_IS_WIDE) New defns. lisp.h: New type to replace places where int occurs as a boolean. It's signed because occasionally people may want to use -1 as an error value, and because unsigned ints are viral -- see comments in the internals manual against using them. dynarr.c: int -> Bytecount. --------------------------- Mule-izing --------------------------- device-x.c: Partially Mule-ize. dumper.c, dumper.h: Mule-ize. Use Rawbyte. Use stderr_out not printf. Use wext_*(). sysdep.c, syswindows.h, text.c: New Wexttext API for manipulation of external text that may be Unicode (e.g. startup code under Windows). emacs.c: Mule-ize. Properly deal with argv in external encoding. Use wext_*() and Wexttext. Use Rawbyte. #if 0 some old junk on SCO that is unlikely to be correct. Rewrite allocation code in run-temacs. emacs.c, symsinit.h, win32.c: Rename win32 init function and call it even earlier, to initialize mswindows_9x_p even earlier, for use in startup code (XEUNICODE_P). process.c: Use _wenviron not environ under Windows, to get Unicode environment variables. event-Xt.c: Mule-ize drag-n-drop related stuff. dragdrop.c, dragdrop.h, frame-x.c: Mule-ize. text.h: Add some more stand-in defines for particular kinds of conversion; use in Mule-ization work in frame-x.c etc. --------------------------- Freshening --------------------------- intl-auto-encap-win32.c, intl-auto-encap-win32.h: Regenerate. --------------------------- Unicode-work --------------------------- intl-win32.c, syswindows.h: Factor out common options to MultiByteToWideChar and WideCharToMultiByte. Add convert_unicode_to_multibyte_malloc() and convert_unicode_to_multibyte_dynarr() and use. Add stuff for alloca() conversion of multibyte/unicode. alloc.c: Use dfc_external_data_len() in case of unicode coding system. alloc.c, mule-charset.c: Don't zero out and reinit charset Unicode tables. This fucks up dump-time loading. Anyway, either we load them at dump time or run time, never both. unicode.c: Dump the blank tables as well. --------------------------------------------------------------- DOCUMENTATION, MOSTLY MULE-RELATED: --------------------------------------------------------------- EmacsFrame.c, emodules.c, event-Xt.c, fileio.c, input-method-xlib.c, mule-wnnfns.c, redisplay-gtk.c, redisplay-tty.c, redisplay-x.c, regex.c, sysdep.c: Add comment about Mule work needed. text.h: Add more documentation describing why DFC routines were not written to return their value. Add some other DFC documentation. console-msw.c, console-msw.h: Add pointer to docs in win32.c. emacs.c: Add comments on sources of doc info. text.c, charset.h, unicode.c, intl-win32.c, intl-encap-win32.c, text.h, file-coding.c, mule-coding.c: Collect background comments and related to text matters and internationalization, and proposals for work to be done, in text.c or Internals manual, stuff related to specific textual API's in text.h, and stuff related to internal implementation of Unicode conversion in unicode.c. Put lots of pointers to the comments to make them easier to find. s/mingw32.h, s/win32-common.h, s/win32-native.h, s/windowsnt.h, win32.c: Add bunches of new documentation on the different kinds of builds and environments under Windows and how they work. Collect this info in win32.c. Add pointers to these docs in the relevant s/* files. emacs.c: Document places with long comments. Remove comment about exiting, move to internals manual, put in pointer. event-stream.c: Move docs about event queues and focus to internals manual, put in pointer. events.h: Move docs about event stream callbacks to internals manual, put in pointer. profile.c, redisplay.c, signal.c: Move documentation to the Internals manual. process-nt.c: Add pointer to comment in win32-native.el. lisp.h: Add comments about some comment conventions. lisp.h: Add comment about the second argument. device-msw.c, redisplay-msw.c: @@#### comments are out-of-date. --------------------------------------------------------------- PDUMP WORK (MOTIVATED BY UNICODE CHANGES) --------------------------------------------------------------- alloc.c, buffer.c, bytecode.c, console-impl.h, console.c, device.c, dumper.c, lrecord.h, elhash.c, emodules.h, events.c, extents.c, frame.c, glyphs.c, glyphs.h, mule-charset.c, mule-coding.c, objects.c, profile.c, rangetab.c, redisplay.c, specifier.c, specifier.h, window.c, lstream.c, file-coding.h, file-coding.c: PDUMP: Properly implement dump_add_root_block(), which never worked before, and is necessary for dumping Unicode tables. Pdump name changes for accuracy: XD_STRUCT_PTR -> XD_BLOCK_PTR. XD_STRUCT_ARRAY -> XD_BLOCK_ARRAY. XD_C_STRING -> XD_ASCII_STRING. *_structure_* -> *_block_*. lrecord.h: some comments added about dump_add_root_block() vs dump_add_root_block_ptr(). extents.c: remove incorrect comment about pdump problems with gap array. --------------------------------------------------------------- ALLOCATION --------------------------------------------------------------- abbrev.c, alloc.c, bytecode.c, casefiddle.c, device-msw.c, device-x.c, dired-msw.c, doc.c, doprnt.c, dragdrop.c, editfns.c, emodules.c, file-coding.c, fileio.c, filelock.c, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, gui-msw.c, gui-x.c, imgproc.c, intl-win32.c, lread.c, menubar-gtk.c, menubar.c, nt.c, objects-msw.c, objects-x.c, print.c, process-nt.c, process-unix.c, process.c, realpath.c, redisplay.c, search.c, select-common.c, symbols.c, sysdep.c, syswindows.h, text.c, text.h, ui-byhand.c: New macros {alloca,xnew}_{itext,{i,ext,raw,bin,asc}bytes} for more convenient allocation of these commonly requested items. Modify functions to use alloca_ibytes, alloca_array, alloca_extbytes, xnew_ibytes, etc. also XREALLOC_ARRAY, xnew. alloc.c: Rewrite the allocation functions to factor out repeated code. Add assertions for freeing dumped data. lisp.h: Moved down and consolidated with other allocation stuff. lisp.h, dynarr.c: New functions for allocation that's very efficient when mostly in LIFO order. lisp.h, text.c, text.h: Factor out some stuff for general use by alloca()-conversion funs. text.h, lisp.h: Fill out convenience routines for allocating various kinds of bytes and put them in lisp.h. Use them in place of xmalloc(), ALLOCA(). text.h: Fill out the convenience functions so the _MALLOC() kinds match the alloca() kinds. --------------------------------------------------------------- ERROR-CHECKING --------------------------------------------------------------- text.h: Create ASSERT_ASCTEXT_ASCII() and ASSERT_ASCTEXT_ASCII_LEN() from similar Eistring checkers and change the Eistring checkers to use them instead. --------------------------------------------------------------- MACROS IN LISP.H --------------------------------------------------------------- lisp.h: Redo GCPRO declarations. Create a "base" set of functions that can be used to generate any kind of gcpro sets -- regular, ngcpro, nngcpro, private ones used in GC_EXTERNAL_LIST_LOOP_2. buffer.c, callint.c, chartab.c, console-msw.c, device-x.c, dialog-msw.c, dired.c, extents.c, ui-gtk.c, rangetab.c, nt.c, mule-coding.c, minibuf.c, menubar-msw.c, menubar.c, menubar-gtk.c, lread.c, lisp.h, gutter.c, glyphs.c, glyphs-widget.c, fns.c, fileio.c, file-coding.c, specifier.c: Eliminate EXTERNAL_LIST_LOOP, which does not check for circularities. Use EXTERNAL_LIST_LOOP_2 instead or EXTERNAL_LIST_LOOP_3 or EXTERNAL_PROPERTY_LIST_LOOP_3 or GC_EXTERNAL_LIST_LOOP_2 (new macro). Removed/redid comments on EXTERNAL_LIST_LOOP. --------------------------------------------------------------- SPACING FIXES --------------------------------------------------------------- callint.c, hftctl.c, number-gmp.c, process-unix.c: Spacing fixes. --------------------------------------------------------------- FIX FOR GEOMETRY PROBLEM IN FIRST FRAME --------------------------------------------------------------- unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by release 1.5.12 of Cygwin]. toolbar.c: bug fix for problem of initial frame being 77 chars wide on Windows. will be overridden by my other ws. --------------------------------------------------------------- FIX FOR LEAKING PROCESS HANDLES: --------------------------------------------------------------- process-nt.c: Fixes for leaking handles. Inspired by work done by Adrian Aichner <adrian@xemacs.org>. --------------------------------------------------------------- FIX FOR CYGWIN BUG (Unicode-related): --------------------------------------------------------------- unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by release 1.5.12 of Cygwin]. --------------------------------------------------------------- WARNING FIXES: --------------------------------------------------------------- console-stream.c: `reinit' is unused. compiler.h, event-msw.c, frame-msw.c, intl-encap-win32.c, text.h: Add stuff to deal with ANSI-aliasing warnings I got. regex.c: Gather includes together to avoid warning. --------------------------------------------------------------- CHANGES TO INITIALIZATION ROUTINES: --------------------------------------------------------------- buffer.c, emacs.c, console.c, debug.c, device-x.c, device.c, dragdrop.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, font-lock.c, frame-msw.c, glyphs-widget.c, glyphs.c, gui-x.c, insdel.c, lread.c, lstream.c, menubar-gtk.c, menubar-x.c, minibuf.c, mule-wnnfns.c, objects-msw.c, objects.c, print.c, scrollbar-x.c, search.c, select-x.c, text.c, undo.c, unicode.c, window.c, symsinit.h: Call reinit_*() functions directly from emacs.c, for clarity. Factor out some redundant init code. Move disallowed stuff that had crept into vars_of_glyphs() into complex_vars_of_glyphs(). Call init_eval_semi_early() from eval.c not in the middle of vars_of_() in emacs.c since there should be no order dependency in the latter calls. --------------------------------------------------------------- ARMAGEDDON: --------------------------------------------------------------- alloc.c, emacs.c, lisp.h, print.c: Rename inhibit_non_essential_printing_operations to inhibit_non_essential_conversion_operations. text.c: Assert on !inhibit_non_essential_conversion_operations. console-msw.c, print.c: Don't do conversion in SetConsoleTitle or FindWindow to avoid problems during armageddon. Put #errors for NON_ASCII_INTERNAL_FORMAT in places where problems would arise. --------------------------------------------------------------- CHANGES TO THE BUILD PROCEDURE: --------------------------------------------------------------- config.h.in, s/cxux.h, s/usg5-4-2.h, m/powerpc.h: Add comment about correct ordering of this file. Rearrange everything to follow this -- put all #undefs together and before the s&m files. Add undefs for HAVE_ALLOCA, C_ALLOCA, BROKEN_ALLOCA_IN_FUNCTION_CALLS, STACK_DIRECTION. Remove unused HAVE_STPCPY, HAVE_GETWD, HAVE_SETLOCALE. m/gec63.h: Deleted; totally broken, not used at all, not in FSF. m/7300.h, m/acorn.h, m/alliant-2800.h, m/alliant.h, m/altos.h, m/amdahl.h, m/apollo.h, m/att3b.h, m/aviion.h, m/celerity.h, m/clipper.h, m/cnvrgnt.h, m/convex.h, m/cydra5.h, m/delta.h, m/delta88k.h, m/dpx2.h, m/elxsi.h, m/ews4800r.h, m/gould.h, m/hp300bsd.h, m/hp800.h, m/hp9000s300.h, m/i860.h, m/ibmps2-aix.h, m/ibmrs6000.h, m/ibmrt-aix.h, m/ibmrt.h, m/intel386.h, m/iris4d.h, m/iris5d.h, m/iris6d.h, m/irist.h, m/isi-ov.h, m/luna88k.h, m/m68k.h, m/masscomp.h, m/mg1.h, m/mips-nec.h, m/mips-siemens.h, m/mips.h, m/news.h, m/nh3000.h, m/nh4000.h, m/ns32000.h, m/orion105.h, m/pfa50.h, m/plexus.h, m/pmax.h, m/powerpc.h, m/pyrmips.h, m/sequent-ptx.h, m/sequent.h, m/sgi-challenge.h, m/symmetry.h, m/tad68k.h, m/tahoe.h, m/targon31.h, m/tekxd88.h, m/template.h, m/tower32.h, m/tower32v3.h, m/ustation.h, m/vax.h, m/wicat.h, m/xps100.h: Delete C_ALLOCA, HAVE_ALLOCA, STACK_DIRECTION, BROKEN_ALLOCA_IN_FUNCTION_CALLS. All of this is auto-detected. When in doubt, I followed recent FSF sources, which also have these things deleted.
author ben
date Thu, 04 Nov 2004 23:08:28 +0000
parents 04bc9d2f42c7
children 3d8143fc88e1
comparison
equal deleted inserted replaced
2366:2a392e0c390a 2367:ecf1ebac70d8
121 121
122 /* To avoid consing in debug_prin1, we package up variables we need to bind 122 /* To avoid consing in debug_prin1, we package up variables we need to bind
123 into an opaque object. */ 123 into an opaque object. */
124 struct debug_bindings 124 struct debug_bindings
125 { 125 {
126 int inhibit_non_essential_printing_operations; 126 int inhibit_non_essential_conversion_operations;
127 int print_depth; 127 int print_depth;
128 int print_readably; 128 int print_readably;
129 int print_unbuffered; 129 int print_unbuffered;
130 int gc_currently_forbidden; 130 int gc_currently_forbidden;
131 Lisp_Object Vprint_length; 131 Lisp_Object Vprint_length;
152 stream ? stream == stdout || stream == stderr : 152 stream ? stream == stdout || stream == stderr :
153 CONSOLE_TTY_DATA (con)->is_stdio; 153 CONSOLE_TTY_DATA (con)->is_stdio;
154 154
155 if (stream || output_is_std_handle) 155 if (stream || output_is_std_handle)
156 { 156 {
157 if (initialized && !inhibit_non_essential_printing_operations) 157 if (initialized && !inhibit_non_essential_conversion_operations)
158 TO_EXTERNAL_FORMAT (DATA, (ptr, len), 158 TO_EXTERNAL_FORMAT (DATA, (ptr, len),
159 ALLOCA, (extptr, extlen), 159 ALLOCA, (extptr, extlen),
160 Qterminal); 160 Qterminal);
161 else 161 else
162 { 162 {
163 #ifdef NON_ASCII_INTERNAL_FORMAT
164 #error Do something here
165 #else
163 extptr = (Extbyte *) ptr; 166 extptr = (Extbyte *) ptr;
164 extlen = (Bytecount) len; 167 extlen = (Bytecount) len;
168 #endif
165 } 169 }
166 } 170 }
167 171
168 if (stream) 172 if (stream)
169 { 173 {
289 int dest) 293 int dest)
290 { 294 {
291 Ibyte kludge[8192]; 295 Ibyte kludge[8192];
292 Bytecount kludgelen; 296 Bytecount kludgelen;
293 297
294 if (initialized && !inhibit_non_essential_printing_operations) 298 if (initialized && !inhibit_non_essential_conversion_operations)
295 fmt = GETTEXT (fmt); 299 fmt = GETTEXT (fmt);
296 vsprintf ((CIbyte *) kludge, fmt, args); 300 vsprintf ((CIbyte *) kludge, fmt, args);
297 kludgelen = qxestrlen (kludge); 301 kludgelen = qxestrlen (kludge);
298 write_string_to_external_output (kludge, kludgelen, dest); 302 write_string_to_external_output (kludge, kludgelen, dest);
299 } 303 }
422 relocating the string. For small strings, we do it by 426 relocating the string. For small strings, we do it by
423 alloc'ing the string and using a copy; for large strings, 427 alloc'ing the string and using a copy; for large strings,
424 we inhibit GC. */ 428 we inhibit GC. */
425 if (len < 65536) 429 if (len < 65536)
426 { 430 {
427 Ibyte *copied = alloca_array (Ibyte, len); 431 Ibyte *copied = alloca_ibytes (len);
428 memcpy (copied, newnonreloc + offset, len); 432 memcpy (copied, newnonreloc + offset, len);
429 Lstream_write (XLSTREAM (function), copied, len); 433 Lstream_write (XLSTREAM (function), copied, len);
430 } 434 }
431 else if (gc_currently_forbidden) 435 else if (gc_currently_forbidden)
432 { 436 {
1471 BADNESS_NO_TYPE 1475 BADNESS_NO_TYPE
1472 }; 1476 };
1473 1477
1474 static void 1478 static void
1475 printing_major_badness (Lisp_Object printcharfun, 1479 printing_major_badness (Lisp_Object printcharfun,
1476 Char_ASCII *badness_string, int type, void *val, 1480 Ascbyte *badness_string, int type, void *val,
1477 enum printing_badness badness) 1481 enum printing_badness badness)
1478 { 1482 {
1479 Ibyte buf[666]; 1483 Ibyte buf[666];
1480 1484
1481 switch (badness) 1485 switch (badness)
1494 break; 1498 break;
1495 } 1499 }
1496 1500
1497 /* Don't abort or signal if called from debug_print() or already 1501 /* Don't abort or signal if called from debug_print() or already
1498 crashing */ 1502 crashing */
1499 if (!inhibit_non_essential_printing_operations) 1503 if (!inhibit_non_essential_conversion_operations)
1500 { 1504 {
1501 #ifdef ERROR_CHECK_TYPES 1505 #ifdef ERROR_CHECK_TYPES
1502 abort (); 1506 abort ();
1503 #else /* not ERROR_CHECK_TYPES */ 1507 #else /* not ERROR_CHECK_TYPES */
1504 if (print_readably) 1508 if (print_readably)
1558 1562
1559 being_printed[print_depth] = obj; 1563 being_printed[print_depth] = obj;
1560 1564
1561 /* Avoid calling internal_bind_int, which conses, when called from 1565 /* Avoid calling internal_bind_int, which conses, when called from
1562 debug_prin1. In that case, we have bound print_depth to 0 anyway. */ 1566 debug_prin1. In that case, we have bound print_depth to 0 anyway. */
1563 if (!inhibit_non_essential_printing_operations) 1567 if (!inhibit_non_essential_conversion_operations)
1564 { 1568 {
1565 specdepth = internal_bind_int (&print_depth, print_depth + 1); 1569 specdepth = internal_bind_int (&print_depth, print_depth + 1);
1566 1570
1567 if (print_depth > PRINT_CIRCLE) 1571 if (print_depth > PRINT_CIRCLE)
1568 signal_error (Qstack_overflow, "Apparently circular structure being printed", Qunbound); 1572 signal_error (Qstack_overflow, "Apparently circular structure being printed", Qunbound);
1651 /* Try to check for various sorts of bogus pointers if we're in a 1655 /* Try to check for various sorts of bogus pointers if we're in a
1652 situation where it may be likely -- i.e. called from 1656 situation where it may be likely -- i.e. called from
1653 debug_print() or we're already crashing. In such cases, 1657 debug_print() or we're already crashing. In such cases,
1654 (further) crashing is counterproductive. */ 1658 (further) crashing is counterproductive. */
1655 1659
1656 if (inhibit_non_essential_printing_operations && 1660 if (inhibit_non_essential_conversion_operations &&
1657 !debug_can_access_memory (lheader, sizeof (*lheader))) 1661 !debug_can_access_memory (lheader, sizeof (*lheader)))
1658 { 1662 {
1659 write_fmt_string (printcharfun, "#<EMACS BUG: BAD MEMORY %p>", 1663 write_fmt_string (printcharfun, "#<EMACS BUG: BAD MEMORY %p>",
1660 lheader); 1664 lheader);
1661 break; 1665 break;
1695 /* Further checks for bad memory in critical situations. We don't 1699 /* Further checks for bad memory in critical situations. We don't
1696 normally do these because they may be expensive or weird 1700 normally do these because they may be expensive or weird
1697 (e.g. under Unix we typically have to set a SIGSEGV handler and 1701 (e.g. under Unix we typically have to set a SIGSEGV handler and
1698 try to trigger a seg fault). */ 1702 try to trigger a seg fault). */
1699 1703
1700 if (inhibit_non_essential_printing_operations) 1704 if (inhibit_non_essential_conversion_operations)
1701 { 1705 {
1702 if (!debug_can_access_memory 1706 if (!debug_can_access_memory
1703 (lheader, detagged_lisp_object_size (lheader))) 1707 (lheader, detagged_lisp_object_size (lheader)))
1704 { 1708 {
1705 write_fmt_string (printcharfun, 1709 write_fmt_string (printcharfun,
1738 LISP_TO_VOID (obj), BADNESS_INTEGER_OBJECT); 1742 LISP_TO_VOID (obj), BADNESS_INTEGER_OBJECT);
1739 break; 1743 break;
1740 } 1744 }
1741 } 1745 }
1742 1746
1743 if (!inhibit_non_essential_printing_operations) 1747 if (!inhibit_non_essential_conversion_operations)
1744 unbind_to (specdepth); 1748 unbind_to (specdepth);
1745 UNGCPRO; 1749 UNGCPRO;
1746 } 1750 }
1747 1751
1748 void 1752 void
1912 write_string_to_alternate_debugging_output (const Ibyte *str, Bytecount len) 1916 write_string_to_alternate_debugging_output (const Ibyte *str, Bytecount len)
1913 { 1917 {
1914 int extlen; 1918 int extlen;
1915 const Extbyte *extptr; 1919 const Extbyte *extptr;
1916 #if 0 /* We want to see the internal representation, don't we? */ 1920 #if 0 /* We want to see the internal representation, don't we? */
1917 if (initialized && !inhibit_non_essential_printing_operations) 1921 if (initialized && !inhibit_non_essential_conversion_operations)
1918 TO_EXTERNAL_FORMAT (DATA, (str, len), 1922 TO_EXTERNAL_FORMAT (DATA, (str, len),
1919 ALLOCA, (extptr, extlen), 1923 ALLOCA, (extptr, extlen),
1920 Qterminal); 1924 Qterminal);
1921 else 1925 else
1922 #endif /* 0 */ 1926 #endif /* 0 */
2060 static Lisp_Object 2064 static Lisp_Object
2061 debug_prin1_exit (Lisp_Object UNUSED (ignored)) 2065 debug_prin1_exit (Lisp_Object UNUSED (ignored))
2062 { 2066 {
2063 struct debug_bindings *bindings = 2067 struct debug_bindings *bindings =
2064 (struct debug_bindings *) XOPAQUE (debug_prin1_bindings)->data; 2068 (struct debug_bindings *) XOPAQUE (debug_prin1_bindings)->data;
2065 inhibit_non_essential_printing_operations = 2069 inhibit_non_essential_conversion_operations =
2066 bindings->inhibit_non_essential_printing_operations; 2070 bindings->inhibit_non_essential_conversion_operations;
2067 print_depth = bindings->print_depth; 2071 print_depth = bindings->print_depth;
2068 print_readably = bindings->print_readably; 2072 print_readably = bindings->print_readably;
2069 print_unbuffered = bindings->print_unbuffered; 2073 print_unbuffered = bindings->print_unbuffered;
2070 gc_currently_forbidden = bindings->gc_currently_forbidden; 2074 gc_currently_forbidden = bindings->gc_currently_forbidden;
2071 Vprint_length = bindings->Vprint_length; 2075 Vprint_length = bindings->Vprint_length;
2087 but might cause crashes into not getting executed. */ 2091 but might cause crashes into not getting executed. */
2088 int specdepth; 2092 int specdepth;
2089 struct debug_bindings *bindings = 2093 struct debug_bindings *bindings =
2090 (struct debug_bindings *) XOPAQUE (debug_prin1_bindings)->data; 2094 (struct debug_bindings *) XOPAQUE (debug_prin1_bindings)->data;
2091 2095
2092 bindings->inhibit_non_essential_printing_operations = 2096 bindings->inhibit_non_essential_conversion_operations =
2093 inhibit_non_essential_printing_operations; 2097 inhibit_non_essential_conversion_operations;
2094 bindings->print_depth = print_depth; 2098 bindings->print_depth = print_depth;
2095 bindings->print_readably = print_readably; 2099 bindings->print_readably = print_readably;
2096 bindings->print_unbuffered = print_unbuffered; 2100 bindings->print_unbuffered = print_unbuffered;
2097 bindings->gc_currently_forbidden = gc_currently_forbidden; 2101 bindings->gc_currently_forbidden = gc_currently_forbidden;
2098 bindings->Vprint_length = Vprint_length; 2102 bindings->Vprint_length = Vprint_length;
2099 bindings->Vprint_level = Vprint_level; 2103 bindings->Vprint_level = Vprint_level;
2100 bindings->Vinhibit_quit = Vinhibit_quit; 2104 bindings->Vinhibit_quit = Vinhibit_quit;
2101 specdepth = record_unwind_protect (debug_prin1_exit, Qnil); 2105 specdepth = record_unwind_protect (debug_prin1_exit, Qnil);
2102 2106
2103 inhibit_non_essential_printing_operations = 1; 2107 inhibit_non_essential_conversion_operations = 1;
2104 print_depth = 0; 2108 print_depth = 0;
2105 print_readably = debug_print_readably != -1 ? debug_print_readably : 0; 2109 print_readably = debug_print_readably != -1 ? debug_print_readably : 0;
2106 print_unbuffered++; 2110 print_unbuffered++;
2107 if (debug_print_length > 0) 2111 if (debug_print_length > 0)
2108 Vprint_length = make_int (debug_print_length); 2112 Vprint_length = make_int (debug_print_length);
2126 } 2130 }
2127 2131
2128 void 2132 void
2129 debug_p4 (Lisp_Object obj) 2133 debug_p4 (Lisp_Object obj)
2130 { 2134 {
2131 inhibit_non_essential_printing_operations = 1; 2135 inhibit_non_essential_conversion_operations = 1;
2132 if (STRINGP (obj)) 2136 if (STRINGP (obj))
2133 debug_out ("\"%s\"", XSTRING_DATA (obj)); 2137 debug_out ("\"%s\"", XSTRING_DATA (obj));
2134 else if (CONSP (obj)) 2138 else if (CONSP (obj))
2135 { 2139 {
2136 int first = 1; 2140 int first = 1;
2193 LHEADER_IMPLEMENTATION (header)->basic_p ? 2197 LHEADER_IMPLEMENTATION (header)->basic_p ?
2194 (EMACS_INT) header : 2198 (EMACS_INT) header :
2195 ((struct lcrecord_header *) header)->uid); 2199 ((struct lcrecord_header *) header)->uid);
2196 } 2200 }
2197 2201
2198 inhibit_non_essential_printing_operations = 0; 2202 inhibit_non_essential_conversion_operations = 0;
2199 } 2203 }
2200 2204
2201 static void 2205 static void
2202 ext_print_begin (int dest) 2206 ext_print_begin (int dest)
2203 { 2207 {
2225 2229
2226 void 2230 void
2227 debug_p3 (Lisp_Object obj) 2231 debug_p3 (Lisp_Object obj)
2228 { 2232 {
2229 debug_p4 (obj); 2233 debug_p4 (obj);
2230 inhibit_non_essential_printing_operations = 1; 2234 inhibit_non_essential_conversion_operations = 1;
2231 debug_out ("\n"); 2235 debug_out ("\n");
2232 inhibit_non_essential_printing_operations = 0; 2236 inhibit_non_essential_conversion_operations = 0;
2233 } 2237 }
2234 2238
2235 void 2239 void
2236 debug_print (Lisp_Object debug_print_obj) 2240 debug_print (Lisp_Object debug_print_obj)
2237 { 2241 {
2264 /* This function can GC */ 2268 /* This function can GC */
2265 2269
2266 /* by doing this, we trick various things that are non-essential 2270 /* by doing this, we trick various things that are non-essential
2267 but might cause crashes into not getting executed. */ 2271 but might cause crashes into not getting executed. */
2268 int specdepth = 2272 int specdepth =
2269 internal_bind_int (&inhibit_non_essential_printing_operations, 1); 2273 internal_bind_int (&inhibit_non_essential_conversion_operations, 1);
2270 2274
2271 internal_bind_int (&print_depth, 0); 2275 internal_bind_int (&print_depth, 0);
2272 internal_bind_int (&print_readably, 0); 2276 internal_bind_int (&print_readably, 0);
2273 internal_bind_int (&print_unbuffered, print_unbuffered + 1); 2277 internal_bind_int (&print_unbuffered, print_unbuffered + 1);
2274 if (debug_print_length > 0) 2278 if (debug_print_length > 0)
2373 } 2377 }
2374 2378
2375 void 2379 void
2376 vars_of_print (void) 2380 vars_of_print (void)
2377 { 2381 {
2378 reinit_vars_of_print ();
2379
2380 DEFVAR_LISP ("standard-output", &Vstandard_output /* 2382 DEFVAR_LISP ("standard-output", &Vstandard_output /*
2381 Output stream `print' uses by default for outputting a character. 2383 Output stream `print' uses by default for outputting a character.
2382 This may be any function of one argument. 2384 This may be any function of one argument.
2383 It may also be a buffer (output is inserted before point) 2385 It may also be a buffer (output is inserted before point)
2384 or a marker (output is inserted and the marker is advanced) 2386 or a marker (output is inserted and the marker is advanced)