Mercurial > hg > xemacs-beta
diff src/data.c @ 5325:47298dcf2e8f
Be more helpful in printing ephemerons, weak lists, and weak boxes.
2011-01-01 Aidan Kehoe <kehoea@parhasard.net>
* data.c (print_ephemeron, print_weak_list, print_weak_box):
Be more helpful in printing these structures; show their contents,
print their UIDs so it's possible to distinguish between them.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 01 Jan 2011 20:08:44 +0000 |
parents | c096d8051f89 |
children | d967d96ca043 89331fa1c819 |
line wrap: on
line diff
--- a/src/data.c Thu Dec 30 13:46:50 2010 +0000 +++ b/src/data.c Sat Jan 01 20:08:44 2011 +0000 @@ -2612,14 +2612,19 @@ static void print_weak_list (Lisp_Object obj, Lisp_Object printcharfun, - int UNUSED (escapeflag)) + int escapeflag) { if (print_readably) - printing_unreadable_lisp_object (obj, 0); - - write_fmt_string_lisp (printcharfun, "#<weak-list %s %S>", 2, - encode_weak_list_type (XWEAK_LIST (obj)->type), - XWEAK_LIST (obj)->list); + { + printing_unreadable_lisp_object (obj, 0); + } + + write_ascstring (printcharfun, "#<weak-list :type "); + print_internal (encode_weak_list_type (XWEAK_LIST (obj)->type), + printcharfun, escapeflag); + write_ascstring (printcharfun, " :list "); + print_internal (XWEAK_LIST (obj)->list, printcharfun, escapeflag); + write_fmt_string (printcharfun, " 0x%x>", LISP_OBJECT_UID (obj)); } static int @@ -3087,12 +3092,16 @@ } static void -print_weak_box (Lisp_Object obj, Lisp_Object printcharfun, - int UNUSED (escapeflag)) +print_weak_box (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) { if (print_readably) - printing_unreadable_lisp_object (obj, 0); - write_fmt_string (printcharfun, "#<weak-box>"); /* #### fix */ + { + printing_unreadable_lisp_object (obj, 0); + } + + write_ascstring (printcharfun, "#<weak-box "); + print_internal (XWEAK_BOX (obj)->value, printcharfun, escapeflag); + write_fmt_string (printcharfun, " 0x%x>", LISP_OBJECT_UID (obj)); } static int @@ -3309,12 +3318,20 @@ } static void -print_ephemeron (Lisp_Object obj, Lisp_Object printcharfun, - int UNUSED (escapeflag)) +print_ephemeron (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) { if (print_readably) - printing_unreadable_lisp_object (obj, 0); - write_fmt_string (printcharfun, "#<ephemeron>"); /* #### fix */ + { + printing_unreadable_lisp_object (obj, 0); + } + + write_ascstring (printcharfun, "#<ephemeron :key "); + print_internal (XEPHEMERON (obj)->key, printcharfun, escapeflag); + write_ascstring (printcharfun, " :value "); + print_internal (XEPHEMERON (obj)->value, printcharfun, escapeflag); + write_ascstring (printcharfun, " :finalizer "); + print_internal (XEPHEMERON_FINALIZER (obj), printcharfun, escapeflag); + write_fmt_string (printcharfun, " 0x%x>", LISP_OBJECT_UID (obj)); } static int