summaryrefslogtreecommitdiff
path: root/src/print.c
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2015-02-11 02:15:14 +0100
committerAurélien Aptel <aurelien.aptel@gmail.com>2015-02-11 02:15:14 +0100
commitc59f2deaae99ca85b0a4fcdd53a3d8ed41d995cd (patch)
tree455db9967d881b610b400ea53c70f87b08eba496 /src/print.c
parent9dc8a56a4dc27a752186185743c4fc16c8fced45 (diff)
downloademacs-feature/aptel/dynamic-modules-rc3.tar.gz
add new Lisp_Module type (misc subtype)feature/aptel/dynamic-modules-rc3
Lisp_Module is a new subtype of Misc objects. As other Misc types, it re-uses the marker free list. A module must have a custom destructor, which is automatically called by the GC. Previous module object using the Save_Value type still work and they still have to be free explicitely from Lisp. Their use is now discouraged in modules. A simple module example + tests are available in modules/memtest.
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/print.c b/src/print.c
index 1a0aebbeba7..db41adc8add 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2045,6 +2045,23 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
PRINTCHAR ('>');
break;
+#ifdef HAVE_LTDL
+ case Lisp_Misc_Module:
+ strout ("#<module id = ", -1, -1, printcharfun);
+ {
+ int len = sprintf (buf, "%u", XMODULE (obj)->id);
+ strout (buf, len, len, printcharfun);
+ strout (", dtor = ", -1, -1, printcharfun);
+ len = sprintf (buf, "%p", XMODULE (obj)->dtor);
+ strout (buf, len, len, printcharfun);
+ strout (", p = ", -1, -1, printcharfun);
+ len = sprintf (buf, "%p", XMODULE (obj)->p);
+ strout (buf, len, len, printcharfun);
+ strout (">", -1, -1, printcharfun);
+ }
+ break;
+#endif
+
/* Remaining cases shouldn't happen in normal usage, but let's
print them anyway for the benefit of the debugger. */