From 8847a0de5bd2e0df62f85c53c4b8d57d942d49ba Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Wed, 26 Dec 2012 18:10:11 +0400 Subject: [PATCH] * lisp.h (toplevel): Add two notices to the comment about defining a new Lisp data type. --- src/ChangeLog | 5 +++++ src/lisp.h | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 8a228214507..d0e08317fba 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-12-26 Dmitry Antipov + + * lisp.h (toplevel): Add two notices to the comment about + defining a new Lisp data type. + 2012-12-26 Dmitry Antipov * keyboard.c (record_asynch_buffer_change): Initialize an event diff --git a/src/lisp.h b/src/lisp.h index cfdff6cf514..d8d61e4b6d9 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -325,6 +325,10 @@ enum Lisp_Fwd_Type members that are accessible only from C. A Lisp_Misc object is a wrapper for a C struct that can contain anything you like. + Explicit freeing is discouraged for Lisp objects in general. But if + you really need to exploit this, use Lisp_Misc (check free_misc in + alloc.c to see why). There is no way to free a vectorlike object. + To add a new pseudovector type, extend the pvec_type enumeration; to add a new Lisp_Misc, extend the Lisp_Misc_Type enumeration. @@ -334,6 +338,10 @@ enum Lisp_Fwd_Type enumeration and a 1-bit GC markbit) and make sure the overall size of the union is not increased by your addition. + For a new pseudovector, it's highly desirable to limit the size + of your data type by VBLOCK_BYTES_MAX bytes (defined in alloc.c). + Otherwise you will need to change sweep_vectors (also in alloc.c). + Then you will need to add switch branches in print.c (in print_object, to print your object, and possibly also in print_preprocess) and to alloc.c, to mark your object (in -- 2.39.5