Ben suggested to change the semantics of print_internal:
>>>>"BW" == Ben Wing <ben(a)xemacs.org>
writes:
BW> -- since you are creating a lot of new internal objects, i'd
BW> suggest a minor change to the semantics of the object print
BW> method. currently if you set it to 0, if calls
BW> default_object_printer. for internal objects, which should never
BW> escape to Lisp level, we want internal_object_printer instead.
BW> currently, even looking among the modules, there is only one
BW> object (toolbar-button) that relies on the current behavior by
BW> specifying 0 to get default_object_printer, while a number of
BW> others (the event-*-data objects -- granted, not currently used)
BW> also specify 0 but really want internal_object_printer. your new
BW> internal objects do the same. so i'd suggest just changing things
BW> in print_internal() to call internal_object_printer when there is
BW> no print method, and change the print method for toolbar-button to
BW> default_object_printer.
I'll commit tomorrow, if nobody objects.
src/ChangeLog addition:
2005-11-20 Marcus Crestani <crestani(a)xemacs.org>
* lisp.h: Add default_object_printer prototype.
* print.c (default_object_printer): Remove static.
* print.c (print_internal): Use internal_object_printer if a
object has no print method.
* toolbar.c: Use default_object_printer for toolbar-button.
xemacs-21.5 source patch:
Diff command: cvs -q diff -u
Files affected: src/toolbar.c src/print.c src/lisp.h
Index: src/lisp.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/lisp.h,v
retrieving revision 1.133
diff -u -r1.133 lisp.h
--- src/lisp.h 13 Nov 2005 10:48:03 -0000 1.133
+++ src/lisp.h 20 Nov 2005 15:34:36 -0000
@@ -4744,6 +4744,7 @@
/* Lower-level ways to output data: */
+void default_object_printer (Lisp_Object, Lisp_Object, int);
void print_internal (Lisp_Object, Lisp_Object, int);
void debug_print (Lisp_Object);
void debug_p4 (Lisp_Object obj);
Index: src/print.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/print.c,v
retrieving revision 1.57
diff -u -r1.57 print.c
--- src/print.c 13 Nov 2005 10:48:03 -0000 1.57
+++ src/print.c 20 Nov 2005 15:34:38 -0000
@@ -1449,7 +1449,7 @@
UNGCPRO;
}
-static void
+void
default_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
int UNUSED (escapeflag))
{
@@ -1749,7 +1749,7 @@
((LHEADER_IMPLEMENTATION (lheader)->printer)
(obj, printcharfun, escapeflag));
else
- default_object_printer (obj, printcharfun, escapeflag);
+ internal_object_printer (obj, printcharfun, escapeflag);
break;
}
Index: src/toolbar.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/toolbar.c,v
retrieving revision 1.37
diff -u -r1.37 toolbar.c
--- src/toolbar.c 25 Oct 2005 11:16:28 -0000 1.37
+++ src/toolbar.c 20 Nov 2005 15:34:39 -0000
@@ -90,7 +90,9 @@
DEFINE_LRECORD_IMPLEMENTATION ("toolbar-button", toolbar_button,
0, /*dumpable-flag*/
- mark_toolbar_button, 0, 0, 0, 0,
+ mark_toolbar_button,
+ default_object_printer,
+ 0, 0, 0,
toolbar_button_description,
struct toolbar_button);
--
Marcus