comparison src/print.c @ 800:a5954632b187

[xemacs-hg @ 2002-03-31 08:27:14 by ben] more fixes, first crack at finishing behavior implementation TODO.ben-mule-21-5: Update. configure.in: Fix for new error-checking types. make-mswin-unicode.pl: Don't be fucked up by CRLF. Output code to force errors when nonintercepted Windows calls issued. behavior.el, dumped-lisp.el, menubar-items.el: Add support for saving using custom. Load into a dumped XEmacs. Correct :title to :short-doc in accordance with behavior-defs.el. Add a submenu under Options for turning on/off behaviors. cl-macs.el: Properly document `loop'. Fix a minor bug in keymap iteration and add support for bit-vector iteration. lisp-mode.el: Rearrange and add items for macro expanding. menubar-items.el: Document connection between these two functions. window.el: Port stuff from GNU 21.1. config.inc.samp, xemacs.mak: Separate out and add new variable for controlling error-checking. s/windowsnt.h: Use new ERROR_CHECK_ALL; not related to DEBUG_XEMACS. alloc.c, backtrace.h, buffer.c, buffer.h, bytecode.c, callproc.c, casetab.c, charset.h, chartab.c, cmdloop.c, config.h.in, console-msw.c, console-stream.c, console-tty.c, console.c, console.h, data.c, device-msw.c, device.c, device.h, dired-msw.c, dired.c, dumper.c, editfns.c, eldap.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, file-coding.h, fileio.c, frame-msw.c, frame.c, frame.h, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, insdel.c, intl-auto-encap-win32.c, intl-auto-encap-win32.h, intl-encap-win32.c, intl-win32.c, keymap.c, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-x.c, menubar.c, mule-coding.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, opaque.c, print.c, process-nt.c, process-unix.c, process.c, rangetab.c, redisplay-msw.c, redisplay-output.c, redisplay.c, regex.c, scrollbar-msw.c, select-msw.c, signal.c, specifier.c, specifier.h, symbols.c, sysdep.c, syswindows.h, text.c, text.h, toolbar-msw.c, tooltalk.c, ui-gtk.c, unicode.c, window.c: Redo error-checking macros: ERROR_CHECK_TYPECHECK -> ERROR_CHECK_TYPES, ERROR_CHECK_CHARBPOS -> ERROR_CHECK_TEXT, add ERROR_CHECK_DISPLAY, ERROR_CHECK_STRUCTURES. Document these in config.h.in. Fix code to follow docs. Fix *_checking_assert() in accordance with new names. Attempt to fix periodic redisplay crash freeing display line structures. Add first implementation of sledgehammer redisplay check. Redo print_*() to use write_fmt_string(), write_fmt_string_lisp(). Fix bug in md5 handling. Rename character-to-unicode to char-to-unicode; same for unicode-to-char{acter}. Move chartab documentation to `make-char-table'. Some header cleanup. Clean up remaining places where nonintercepted Windows calls are being used. automated/mule-tests.el: Fix for new Unicode support.
author ben
date Sun, 31 Mar 2002 08:30:17 +0000
parents e38acbeb1cae
children 19dfb459d51a
comparison
equal deleted inserted replaced
799:03d9f9084848 800:a5954632b187
36 #include "lisp.h" 36 #include "lisp.h"
37 37
38 #include "backtrace.h" 38 #include "backtrace.h"
39 #include "buffer.h" 39 #include "buffer.h"
40 #include "bytecode.h" 40 #include "bytecode.h"
41 #include "console-tty.h" 41 #include "device.h"
42 #include "console-stream.h"
43 #include "extents.h" 42 #include "extents.h"
44 #include "frame.h" 43 #include "frame.h"
45 #include "insdel.h" 44 #include "insdel.h"
46 #include "lstream.h" 45 #include "lstream.h"
47 #include "opaque.h" 46 #include "opaque.h"
48 #include "sysfile.h" 47
48 #include "console-tty.h"
49 #include "console-stream.h"
49 #ifdef WIN32_NATIVE 50 #ifdef WIN32_NATIVE
50 #include "console-msw.h" 51 #include "console-msw.h"
51 #endif 52 #endif
53
54 #include "sysfile.h"
52 55
53 #include <float.h> 56 #include <float.h>
54 /* Define if not in float.h */ 57 /* Define if not in float.h */
55 #ifndef DBL_DIG 58 #ifndef DBL_DIG
56 #define DBL_DIG 16 59 #define DBL_DIG 16
542 Vstandard_output, etc.) */ 545 Vstandard_output, etc.) */
543 void 546 void
544 write_string_1 (const Intbyte *str, Bytecount size, Lisp_Object stream) 547 write_string_1 (const Intbyte *str, Bytecount size, Lisp_Object stream)
545 { 548 {
546 /* This function can GC */ 549 /* This function can GC */
547 #ifdef ERROR_CHECK_CHARBPOS 550 #ifdef ERROR_CHECK_TEXT
548 assert (size >= 0); 551 assert (size >= 0);
549 #endif 552 #endif
550 output_string (stream, str, Qnil, 0, size); 553 output_string (stream, str, Qnil, 0, size);
551 } 554 }
552 555
1357 default_object_printer (Lisp_Object obj, Lisp_Object printcharfun, 1360 default_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
1358 int escapeflag) 1361 int escapeflag)
1359 { 1362 {
1360 struct lcrecord_header *header = 1363 struct lcrecord_header *header =
1361 (struct lcrecord_header *) XPNTR (obj); 1364 (struct lcrecord_header *) XPNTR (obj);
1362 char buf[200];
1363 1365
1364 if (print_readably) 1366 if (print_readably)
1365 printing_unreadable_object 1367 printing_unreadable_object
1366 ("#<%s 0x%x>", 1368 ("#<%s 0x%x>",
1367 LHEADER_IMPLEMENTATION (&header->lheader)->name, 1369 LHEADER_IMPLEMENTATION (&header->lheader)->name,
1368 header->uid); 1370 header->uid);
1369 1371
1370 sprintf (buf, "#<%s 0x%x>", 1372 write_fmt_string (printcharfun, "#<%s 0x%x>",
1371 LHEADER_IMPLEMENTATION (&header->lheader)->name, 1373 LHEADER_IMPLEMENTATION (&header->lheader)->name,
1372 header->uid); 1374 header->uid);
1373 write_c_string (buf, printcharfun);
1374 } 1375 }
1375 1376
1376 void 1377 void
1377 internal_object_printer (Lisp_Object obj, Lisp_Object printcharfun, 1378 internal_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
1378 int escapeflag) 1379 int escapeflag)
1379 { 1380 {
1380 char buf[200]; 1381 write_fmt_string (printcharfun,
1381 sprintf (buf, "#<INTERNAL OBJECT (XEmacs bug?) (%s) 0x%lx>", 1382 "#<INTERNAL OBJECT (XEmacs bug?) (%s) 0x%lx>",
1382 XRECORD_LHEADER_IMPLEMENTATION (obj)->name, 1383 XRECORD_LHEADER_IMPLEMENTATION (obj)->name,
1383 (unsigned long) XPNTR (obj)); 1384 (unsigned long) XPNTR (obj));
1384 write_c_string (buf, printcharfun);
1385 } 1385 }
1386 1386
1387 void 1387 void
1388 print_internal (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) 1388 print_internal (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
1389 { 1389 {
1404 { 1404 {
1405 struct lrecord_header *lheader = XRECORD_LHEADER (obj); 1405 struct lrecord_header *lheader = XRECORD_LHEADER (obj);
1406 1406
1407 if (!debug_can_access_memory (lheader, sizeof (*lheader))) 1407 if (!debug_can_access_memory (lheader, sizeof (*lheader)))
1408 { 1408 {
1409 char buf[128]; 1409 write_fmt_string (printcharfun, "#<EMACS BUG: BAD MEMORY %p>",
1410 1410 lheader);
1411 sprintf (buf, "#<EMACS BUG: BAD MEMORY %p>", lheader);
1412 write_c_string (buf, printcharfun);
1413 return; 1411 return;
1414 } 1412 }
1415 else 1413 else
1416 { 1414 {
1417 const struct lrecord_implementation *impl; 1415 const struct lrecord_implementation *impl;
1418 1416
1419 if ((int) lheader->type >= lrecord_type_count) 1417 if ((int) lheader->type >= lrecord_type_count)
1420 { 1418 {
1421 char buf[128]; 1419 write_fmt_string (printcharfun,
1422 1420 "#<EMACS BUG: bad type %d BAD MEMORY %p>",
1423 sprintf (buf, "#<EMACS BUG: bad type %d BAD MEMORY %p>", 1421 lheader->type, lheader);
1424 lheader->type, lheader);
1425 write_c_string (buf, printcharfun);
1426 return; 1422 return;
1427 } 1423 }
1428 1424
1429 impl = LHEADER_IMPLEMENTATION (lheader); 1425 impl = LHEADER_IMPLEMENTATION (lheader);
1430 if (!debug_can_access_memory 1426 if (!debug_can_access_memory
1431 (lheader, 1427 (lheader,
1432 (impl->size_in_bytes_method ? 1428 (impl->size_in_bytes_method ?
1433 impl->size_in_bytes_method (lheader) : 1429 impl->size_in_bytes_method (lheader) :
1434 impl->static_size))) 1430 impl->static_size)))
1435 { 1431 {
1436 char buf[128]; 1432 write_fmt_string (printcharfun,
1437 1433 "#<EMACS BUG: type %s BAD MEMORY %p>",
1438 sprintf (buf, "#<EMACS BUG: type %s BAD MEMORY %p>", 1434 impl->name, lheader);
1439 impl->name, lheader);
1440 write_c_string (buf, printcharfun);
1441 return; 1435 return;
1442 } 1436 }
1443 1437
1444 if (STRINGP (obj)) 1438 if (STRINGP (obj))
1445 { 1439 {
1446 Lisp_String *l = (Lisp_String *) lheader; 1440 Lisp_String *l = (Lisp_String *) lheader;
1447 if (!debug_can_access_memory 1441 if (!debug_can_access_memory
1448 (l->data_, l->size_)) 1442 (l->data_, l->size_))
1449 { 1443 {
1450 char buf[128]; 1444 write_fmt_string
1451 1445 (printcharfun,
1452 sprintf (buf, "#<EMACS BUG: %p (BAD STRING DATA %p)>", 1446 "#<EMACS BUG: %p (BAD STRING DATA %p)>",
1453 lheader, l->data_); 1447 lheader, l->data_);
1454 write_c_string (buf, printcharfun);
1455 return; 1448 return;
1456 } 1449 }
1457 } 1450 }
1458 } 1451 }
1459 } 1452 }
1597 break; 1590 break;
1598 } 1591 }
1599 1592
1600 default: 1593 default:
1601 { 1594 {
1602 #ifdef ERROR_CHECK_TYPECHECK 1595 #ifdef ERROR_CHECK_TYPES
1603 abort (); 1596 abort ();
1604 #else /* not ERROR_CHECK_TYPECHECK */ 1597 #else /* not ERROR_CHECK_TYPES */
1605 char buf[128];
1606 /* We're in trouble if this happens! */ 1598 /* We're in trouble if this happens! */
1607 if (print_readably) 1599 if (print_readably)
1608 signal_error (Qinternal_error, "printing illegal data type #o%03o", 1600 signal_error (Qinternal_error, "printing illegal data type #o%03o",
1609 make_int (XTYPE (obj))); 1601 make_int (XTYPE (obj)));
1610 write_c_string ("#<EMACS BUG: ILLEGAL DATATYPE ", 1602 write_c_string ("#<EMACS BUG: ILLEGAL DATATYPE ",
1611 printcharfun); 1603 printcharfun);
1612 sprintf (buf, "(#o%3o)", (int) XTYPE (obj)); 1604 write_fmt_string (printcharfun, "(#o%3o)", (int) XTYPE (obj));
1613 write_c_string (buf, printcharfun);
1614 write_c_string 1605 write_c_string
1615 (" Save your buffers immediately and please report this bug>", 1606 (" Save your buffers immediately and please report this bug>",
1616 printcharfun); 1607 printcharfun);
1617 #endif /* not ERROR_CHECK_TYPECHECK */ 1608 #endif /* not ERROR_CHECK_TYPES */
1618 break; 1609 break;
1619 } 1610 }
1620 } 1611 }
1621 1612
1622 print_depth--; 1613 print_depth--;