annotate src/lrecord.h @ 5936:574f0cded429 cygwin

try to replace all nnnL or nnnUL constants with EMACS_[U]INT
author Henry Thompson <ht@markup.co.uk>
date Sun, 13 Dec 2015 13:22:58 +0000
parents 58b38d5b32d0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* The "lrecord" structure (header of a compound lisp object).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
5125
Ben Wing <ben@xemacs.org>
parents: 5124 4967
diff changeset
3 Copyright (C) 1996, 2001, 2002, 2004, 2005, 2009, 2010 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5255
diff changeset
7 XEmacs is free software: you can redistribute it and/or modify it
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5255
diff changeset
9 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5255
diff changeset
10 option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5255
diff changeset
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
22 /* This file has been Mule-ized, Ben Wing, 10-13-04. */
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
23
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
24 #ifndef INCLUDED_lrecord_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
25 #define INCLUDED_lrecord_h_
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
27 /* All objects other than char and int are implemented as structures and
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
28 passed by reference. Such objects are called "record objects" ("record"
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
29 is another term for "structure"). The "wrapped" value of such an object
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
30 (i.e. when stored in a variable of type Lisp_Object) is simply the raw
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
31 pointer coerced to an integral type the same size as the pointer
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
32 (usually `long').
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
33
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
34 Under old-GC (i.e. when NEW_GC is not defined), there are two kinds of
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
35 record objects: normal objects (those allocated on their own with
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
36 xmalloc()) and frob-block objects (those allocated as pieces of large,
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
37 usually 2K, chunks of memory known as "frob blocks"). Under NEW_GC,
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
38 there is only one type of record object. Stuff below that applies to
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
39 frob-block objects is assumed to apply to the same type of object as
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
40 normal objects under NEW_GC.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
41
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
42 Record objects have a header at the beginning of their structure, which
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
43 is used internally to identify the type of the object (so that an
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
44 object's type can be recovered from its pointer); in addition, it holds
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
45 a few flags and a "UID", which for most objects is shown when it is
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
46 printed, and is primarily useful for debugging purposes. The header of
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
47 a normal object is declared as NORMAL_LISP_OBJECT_HEADER and that of a
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
48 frob-block object FROB_BLOCK_LISP_OBJECT_HEADER.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
49
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
50 FROB_BLOCK_LISP_OBJECT_HEADER boils down to a `struct lrecord_header'.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
51 This is a 32-bit value made up of bit fields, where 8 bits are used to
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
52 hold the type, 2 or 3 bits are used for flags associated with the
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
53 garbage collector, and the remaining 21 or 22 bits hold the UID.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
54
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
55 Under NEW_GC, NORMAL_LISP_OBJECT_HEADER also resolves to `struct
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
56 lrecord_header'. Under old-GC, however, NORMAL_LISP_OBJECT_HEADER
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
57 resolves to a `struct old_lcrecord_header' (note the `c'), which is a
5142
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
58 larger structure -- on 32-bit machines it occupies 2 machine words
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
59 instead of 1. Such an object is known internally as an "lcrecord". The
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
60 first word of `struct old_lcrecord_header' is an embedded `struct
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
61 lrecord_header' with the same information as for frob-block objects;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
62 that way, all objects can be cast to a `struct lrecord_header' to
5142
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
63 determine their type or other info. The other word is a pointer, used
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
64 to thread all lcrecords together in one big linked list.
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
65
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
66 Under old-GC, normal objects (i.e. lcrecords) are allocated in
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
67 individual chunks using the underlying allocator (i.e. xmalloc(), which
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
68 is a thin wrapper around malloc()). Frob-block objects are more
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
69 efficient than normal objects, as they have a smaller header and don't
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
70 have the additional memory overhead associated with malloc() -- instead,
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
71 as mentioned above, they are carved out of 2K chunks of memory called
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
72 "frob blocks"). However, it is slightly more tricky to create such
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
73 objects, as they require special routines in alloc.c to create an object
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
74 of each such type and to sweep them during garbage collection. In
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
75 addition, there is currently no mechanism for handling variable-sized
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
76 frob-block objects (e.g. vectors), whereas variable-sized normal objects
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
77 are not a problem. Frob-block objects are typically used for basic
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
78 objects that exist in large numbers, such as `cons' or `string'.
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
79
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
80 Note that strings are an apparent exception to the statement above that
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
81 variable-sized objects can't be handled. Under old-GC strings work as
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
82 follows. A string consists of two parts -- a fixed-size "string header"
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
83 that is allocated as a standard frob-block object, and a "string-chars"
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
84 structure that is allocated out of special 8K-sized frob blocks that
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
85 have a dedicated garbage-collection handler that compacts the blocks
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
86 during the sweep stage, relocating the string-chars data (but not the
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
87 string headers) to eliminate gaps. Strings larger than 8K are not
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
88 placed in frob blocks, but instead are stored as individually malloc()ed
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
89 blocks of memory. Strings larger than 8K are called "big strings" and
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
90 those smaller than 8K are called "small strings".
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
91
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
92 Under new-GC, there is no difference between big and small strings,
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
93 just as there is no difference between normal and frob-block objects.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
94 There is only one allocation method, which is capable of handling
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
95 variable-sized objects. This apparently allocates all objects in
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
96 frob blocks according to the size of the object.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
97
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
98 To create a new normal Lisp object, see the toolbar-button example
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
99 below. To create a new frob-block Lisp object, follow the lead of
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
100 one of the existing frob-block objects, such as extents or events.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
101 Note that you do not need to supply all the methods (see below);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
102 reasonable defaults are provided for many of them. Alternatively, if
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
103 you're just looking for a way of encapsulating data (which possibly
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
104 could contain Lisp_Objects in it), you may well be able to use the
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
105 opaque type.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
106 */
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
107
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
108 /*
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
109 How to declare a Lisp object:
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
110
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
111 NORMAL_LISP_OBJECT_HEADER:
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
112 Header for normal objects
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
113
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
114 FROB_BLOCK_LISP_OBJECT_HEADER:
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
115 Header for frob-block objects
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
117 How to allocate a Lisp object:
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
118
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
119 - For normal objects of a fixed size, simply call
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
120 ALLOC_NORMAL_LISP_OBJECT (type), where TYPE is the name of the type
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
121 (e.g. toolbar_button). Such objects can be freed manually using
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
122 free_normal_lisp_object.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
123
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
124 - For normal objects whose size can vary (and hence which have a
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
125 size_in_bytes_method rather than a static_size), call
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
126 ALLOC_SIZED_LISP_OBJECT (size, type), where TYPE is the
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
127 name of the type. NOTE: You cannot call free_normal_lisp_object() on such
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
128 on object! (At least when not NEW_GC)
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
129
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
130 - For frob-block objects, use
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
131 ALLOC_FROB_BLOCK_LISP_OBJECT (type, lisp_type, var, lrec_ptr).
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
132 But these objects need special handling; if you don't understand this,
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
133 just ignore it.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
135 - Some lrecords, which are used totally internally, use the
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
136 noseeum-* functions for debugging reasons.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
137
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
138 Other operations:
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
139
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
140 - copy_lisp_object (dst, src)
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
141
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
142 - zero_nonsized_lisp_object (obj), zero_sized_lisp_object (obj, size):
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
143 BUT NOTE, it is not necessary to zero out newly allocated Lisp objects.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
144 This happens automatically.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
145
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
146 - lisp_object_size (obj): Return the size of a Lisp object. NOTE: This
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
147 requires that the object is properly initialized.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
148
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
149 - lisp_object_storage_size (obj, stats): Return the storage size of a
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
150 Lisp objcet, including malloc or frob-block overhead; also, if STATS
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
151 is non-NULL, accumulate info about the size and overhead into STATS.
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
152 */
4930
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
153
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
154 #ifdef NEW_GC
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
155 /*
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
156 There are some limitations under New-GC that lead to the creation of a
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
157 large number of new internal object types. I'm not completely sure what
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
158 all of them are, but they are at least partially related to limitations
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
159 on finalizers. Something else must be going on as well, because
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
160 non-dumpable, non-finalizable objects like devices and frames also have
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
161 their window-system-specific substructures converted into Lisp objects.
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
162 It must have something to do with the fact that these substructures
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
163 contain pointers to Lisp objects, but it's not completely clear why --
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
164 object descriptions exist to indicate the size of these structures and
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
165 the Lisp object pointers within them.
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
166
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
167 At least one definite issue is that under New-GC dumpable objects cannot
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
168 contain any finalizers (see pdump_register_object()). This means that
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
169 any substructures in dumpable objects that are allocated separately and
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
170 normally freed in a finalizer need instead to be made into actual Lisp
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
171 objects. If those structures are Dynarrs, they need to be made into
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
172 Dynarr Lisp objects (e.g. face-cachel-dynarr or glyph-cachel-dynarr),
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
173 which are created using Dynarr_lisp_new() or Dynarr_new_new2().
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
174 Furthermore, the objects contained in the Dynarr also need to be Lisp
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
175 objects (e.g. face-cachel or glyph-cachel).
4930
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
176
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
177 --ben
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
178 */
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
179 #endif
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
180
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
181 #ifdef NEW_GC
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
182 #define ALLOC_NORMAL_LISP_OBJECT(type) alloc_lrecord (&lrecord_##type)
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
183 #define ALLOC_SIZED_LISP_OBJECT(size, type) \
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
184 alloc_sized_lrecord (size, &lrecord_##type)
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
185 #define NORMAL_LISP_OBJECT_HEADER struct lrecord_header
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
186 #define FROB_BLOCK_LISP_OBJECT_HEADER struct lrecord_header
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
187 #define LISP_OBJECT_FROB_BLOCK_P(obj) 0
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
188 #define IF_NEW_GC(x) x
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
189 #define IF_OLD_GC(x) 0
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
190 #else /* not NEW_GC */
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
191 #define ALLOC_NORMAL_LISP_OBJECT(type) alloc_automanaged_lcrecord (&lrecord_##type)
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
192 #define ALLOC_SIZED_LISP_OBJECT(size, type) \
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
193 old_alloc_sized_lcrecord (size, &lrecord_##type)
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
194 #define NORMAL_LISP_OBJECT_HEADER struct old_lcrecord_header
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
195 #define FROB_BLOCK_LISP_OBJECT_HEADER struct lrecord_header
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
196 #define LISP_OBJECT_FROB_BLOCK_P(obj) (XRECORD_LHEADER_IMPLEMENTATION(obj)->frob_block_p)
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
197 #define IF_NEW_GC(x) 0
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
198 #define IF_OLD_GC(x) x
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
199 #endif /* not NEW_GC */
3024
b7f26b2f78bd [xemacs-hg @ 2005-10-25 08:32:40 by ben]
ben
parents: 3017
diff changeset
200
5146
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
201 #define LISP_OBJECT_UID(obj) (XRECORD_LHEADER (obj)->uid)
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
202
1743
543769b89fed [xemacs-hg @ 2003-10-14 05:02:57 by james]
james
parents: 1688
diff changeset
203 BEGIN_C_DECLS
1650
34abfb24e891 [xemacs-hg @ 2003-08-28 15:44:04 by james]
james
parents: 1638
diff changeset
204
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 struct lrecord_header
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
207 /* Index into lrecord_implementations_table[]. Objects that have been
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
208 explicitly freed using e.g. free_cons() have lrecord_type_free in this
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
209 field. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
210 unsigned int type :8;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
211
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
212 #ifdef NEW_GC
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
213 /* 1 if the object is readonly from lisp */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
214 unsigned int lisp_readonly :1;
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
215
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
216 /* The `free' field is a flag that indicates whether this lrecord
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
217 is currently free or not. This is used for error checking and
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
218 debugging. */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
219 unsigned int free :1;
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
220
3063
d30cd499e445 [xemacs-hg @ 2005-11-13 10:48:01 by ben]
ben
parents: 3029
diff changeset
221 /* The `uid' field is just for debugging/printing convenience. Having
d30cd499e445 [xemacs-hg @ 2005-11-13 10:48:01 by ben]
ben
parents: 3029
diff changeset
222 this slot doesn't hurt us spacewise, since the bits are unused
d30cd499e445 [xemacs-hg @ 2005-11-13 10:48:01 by ben]
ben
parents: 3029
diff changeset
223 anyway. (The bits are used for strings, though.) */
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
224 unsigned int uid :22;
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
225
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
226 #else /* not NEW_GC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
227 /* If `mark' is 0 after the GC mark phase, the object will be freed
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
228 during the GC sweep phase. There are 2 ways that `mark' can be 1:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
229 - by being referenced from other objects during the GC mark phase
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
230 - because it is permanently on, for c_readonly objects */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
231 unsigned int mark :1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
232
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
233 /* 1 if the object resides in logically read-only space, and does not
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
234 reference other non-c_readonly objects.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
235 Invariant: if (c_readonly == 1), then (mark == 1 && lisp_readonly == 1) */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
236 unsigned int c_readonly :1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
237
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 /* 1 if the object is readonly from lisp */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
239 unsigned int lisp_readonly :1;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
240
5142
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
241 /* The `free' field is currently used only for lcrecords under old-GC.
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
242 It is a flag that indicates whether this lcrecord is on a "free list".
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
243 Free lists are used to minimize the number of calls to malloc() when
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
244 we're repeatedly allocating and freeing a number of the same sort of
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
245 lcrecord. Lcrecords on a free list always get marked in a different
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
246 fashion, so we can use this flag as a sanity check to make sure that
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
247 free lists only have freed lcrecords and there are no freed lcrecords
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
248 elsewhere. */
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
249 unsigned int free :1;
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
250
3063
d30cd499e445 [xemacs-hg @ 2005-11-13 10:48:01 by ben]
ben
parents: 3029
diff changeset
251 /* The `uid' field is just for debugging/printing convenience. Having
d30cd499e445 [xemacs-hg @ 2005-11-13 10:48:01 by ben]
ben
parents: 3029
diff changeset
252 this slot doesn't hurt us spacewise, since the bits are unused
d30cd499e445 [xemacs-hg @ 2005-11-13 10:48:01 by ben]
ben
parents: 3029
diff changeset
253 anyway. (The bits are used for strings, though.) */
5142
f965e31a35f0 reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents: 5128
diff changeset
254 unsigned int uid :20;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
255
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
256 #endif /* not NEW_GC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 struct lrecord_implementation;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
260 int lrecord_type_index (const struct lrecord_implementation *implementation);
5146
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
261 extern int lrecord_uid_counter[];
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
263 #ifdef NEW_GC
5146
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
264 #define set_lheader_implementation(header,imp) do { \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
265 struct lrecord_header* SLI_header = (header); \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
266 SLI_header->type = (imp)->lrecord_type_index; \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
267 SLI_header->lisp_readonly = 0; \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
268 SLI_header->free = 0; \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
269 SLI_header->uid = lrecord_uid_counter[(imp)->lrecord_type_index]++; \
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
270 } while (0)
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
271 #else /* not NEW_GC */
5146
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
272 #define set_lheader_implementation(header,imp) do { \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
273 struct lrecord_header* SLI_header = (header); \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
274 SLI_header->type = (imp)->lrecord_type_index; \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
275 SLI_header->mark = 0; \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
276 SLI_header->c_readonly = 0; \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
277 SLI_header->lisp_readonly = 0; \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
278 SLI_header->free = 0; \
88bd4f3ef8e4 make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents: 5142
diff changeset
279 SLI_header->uid = lrecord_uid_counter[(imp)->lrecord_type_index]++; \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 } while (0)
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
281 #endif /* not NEW_GC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
283 #ifndef NEW_GC
3024
b7f26b2f78bd [xemacs-hg @ 2005-10-25 08:32:40 by ben]
ben
parents: 3017
diff changeset
284 struct old_lcrecord_header
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 struct lrecord_header lheader;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
288 /* The `next' field is normally used to chain all lcrecords together
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 so that the GC can find (and free) all of them.
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
290 `old_alloc_sized_lcrecord' threads lcrecords together.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 The `next' field may be used for other purposes as long as some
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 other mechanism is provided for letting the GC do its work.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 For example, the event and marker object types allocate members
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 out of memory chunks, and are able to find all unmarked members
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 by sweeping through the elements of the list of chunks. */
3024
b7f26b2f78bd [xemacs-hg @ 2005-10-25 08:32:40 by ben]
ben
parents: 3017
diff changeset
298 struct old_lcrecord_header *next;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 /* Used for lcrecords in an lcrecord-list. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 struct free_lcrecord_header
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 {
3024
b7f26b2f78bd [xemacs-hg @ 2005-10-25 08:32:40 by ben]
ben
parents: 3017
diff changeset
304 struct old_lcrecord_header lcheader;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 Lisp_Object chain;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 };
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
307 #endif /* not NEW_GC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308
3931
fd1f0c73d4df [xemacs-hg @ 2007-04-30 16:46:29 by stephent]
stephent
parents: 3263
diff changeset
309 /* DON'T FORGET to update .gdbinit.in if you change this list. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
310 enum lrecord_type
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
311 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
312 /* Symbol value magic types come first to make SYMBOL_VALUE_MAGIC_P fast.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
313 #### This should be replaced by a symbol_value_magic_p flag
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
314 in the Lisp_Symbol lrecord_header. */
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
315 /* Don't assign any type to 0, so in case we come across zeroed memory
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
316 it will be more obvious when printed */
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
317 lrecord_type_symbol_value_forward = 1,
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
318 lrecord_type_symbol_value_varalias,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
319 lrecord_type_symbol_value_lisp_magic,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
320 lrecord_type_symbol_value_buffer_local,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
321 lrecord_type_max_symbol_value_magic = lrecord_type_symbol_value_buffer_local,
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
322 lrecord_type_symbol,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
323 lrecord_type_subr,
4677
8f1ee2d15784 Support full Common Lisp multiple values in C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3931
diff changeset
324 lrecord_type_multiple_value,
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
325 lrecord_type_cons,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
326 lrecord_type_vector,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
327 lrecord_type_string,
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
328 #ifndef NEW_GC
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
329 lrecord_type_lcrecord_list,
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
330 #endif /* not NEW_GC */
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
331 lrecord_type_compiled_function,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
332 lrecord_type_weak_list,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
333 lrecord_type_bit_vector,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
334 lrecord_type_float,
5191
71ee43b8a74d Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents: 5180
diff changeset
335 lrecord_type_hash_table_test,
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
336 lrecord_type_hash_table,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
337 lrecord_type_lstream,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
338 lrecord_type_process,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
339 lrecord_type_charset,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
340 lrecord_type_coding_system,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
341 lrecord_type_char_table,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
342 lrecord_type_char_table_entry,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
343 lrecord_type_range_table,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
344 lrecord_type_opaque,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
345 lrecord_type_opaque_ptr,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
346 lrecord_type_buffer,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
347 lrecord_type_extent,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
348 lrecord_type_extent_info,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
349 lrecord_type_extent_auxiliary,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
350 lrecord_type_marker,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
351 lrecord_type_event,
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
352 #ifdef EVENT_DATA_AS_OBJECTS /* not defined */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
353 lrecord_type_key_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
354 lrecord_type_button_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
355 lrecord_type_motion_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
356 lrecord_type_process_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
357 lrecord_type_timeout_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
358 lrecord_type_eval_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
359 lrecord_type_misc_user_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
360 lrecord_type_magic_eval_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
361 lrecord_type_magic_data,
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
362 #endif /* EVENT_DATA_AS_OBJECTS */
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
363 lrecord_type_keymap,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
364 lrecord_type_command_builder,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
365 lrecord_type_timeout,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
366 lrecord_type_specifier,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
367 lrecord_type_console,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
368 lrecord_type_device,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
369 lrecord_type_frame,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
370 lrecord_type_window,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
371 lrecord_type_window_mirror,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
372 lrecord_type_gui_item,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
373 lrecord_type_toolbar_button,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
374 lrecord_type_scrollbar_instance,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
375 lrecord_type_color_instance,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
376 lrecord_type_font_instance,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
377 lrecord_type_image_instance,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
378 lrecord_type_glyph,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
379 lrecord_type_face,
3931
fd1f0c73d4df [xemacs-hg @ 2007-04-30 16:46:29 by stephent]
stephent
parents: 3263
diff changeset
380 lrecord_type_fc_config,
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3092
diff changeset
381 lrecord_type_fc_pattern,
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
382 lrecord_type_database,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
383 lrecord_type_tooltalk_message,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
384 lrecord_type_tooltalk_pattern,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
385 lrecord_type_ldap,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
386 lrecord_type_pgconn,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
387 lrecord_type_pgresult,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
388 lrecord_type_devmode,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
389 lrecord_type_mswindows_dialog_id,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
390 lrecord_type_case_table,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
391 lrecord_type_emacs_ffi,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
392 lrecord_type_emacs_gtk_object,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
393 lrecord_type_emacs_gtk_boxed,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
394 lrecord_type_weak_box,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
395 lrecord_type_ephemeron,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
396 lrecord_type_bignum,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
397 lrecord_type_ratio,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
398 lrecord_type_bigfloat,
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
399 #ifndef NEW_GC
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 446
diff changeset
400 lrecord_type_free, /* only used for "free" lrecords */
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 446
diff changeset
401 lrecord_type_undefined, /* only used for debugging */
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
402 #endif /* not NEW_GC */
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
403 #ifdef NEW_GC
4930
9f04877ce07e fix up comments about finalizers and NEWGC internal objects
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
404 /* See comment up top explaining why these extra object types must exist. */
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
405 lrecord_type_string_indirect_data,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
406 lrecord_type_string_direct_data,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
407 lrecord_type_hash_table_entry,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
408 lrecord_type_syntax_cache,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
409 lrecord_type_buffer_text,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
410 lrecord_type_compiled_function_args,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
411 lrecord_type_tty_console,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
412 lrecord_type_stream_console,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
413 lrecord_type_dynarr,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
414 lrecord_type_face_cachel,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
415 lrecord_type_face_cachel_dynarr,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
416 lrecord_type_glyph_cachel,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
417 lrecord_type_glyph_cachel_dynarr,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
418 lrecord_type_x_device,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
419 lrecord_type_gtk_device,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
420 lrecord_type_tty_device,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
421 lrecord_type_mswindows_device,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
422 lrecord_type_msprinter_device,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
423 lrecord_type_x_frame,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
424 lrecord_type_gtk_frame,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
425 lrecord_type_mswindows_frame,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
426 lrecord_type_gap_array_marker,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
427 lrecord_type_gap_array,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
428 lrecord_type_extent_list_marker,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
429 lrecord_type_extent_list,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
430 lrecord_type_stack_of_extents,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
431 lrecord_type_tty_color_instance_data,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
432 lrecord_type_tty_font_instance_data,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
433 lrecord_type_specifier_caching,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
434 lrecord_type_expose_ignore,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
435 #endif /* NEW_GC */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
436 lrecord_type_last_built_in_type /* must be last */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
437 };
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
438
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1429
diff changeset
439 extern MODULE_API int lrecord_type_count;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 struct lrecord_implementation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
443 const Ascbyte *name;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
444
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
445 /* information for the dumper: is the object dumpable and should it
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
446 be dumped. */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
447 unsigned int dumpable :1;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
448
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
449 /* `marker' is called at GC time, to make sure that all Lisp_Objects
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 pointed to by this object get properly marked. It should call
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 the mark_object function on all Lisp_Objects in the object. If
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 the return value is non-nil, it should be a Lisp_Object to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 marked (don't call the mark_object function explicitly on it,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 because the GC routines will do this). Doing it this way reduces
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 recursion, so the object returned should preferably be the one
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 with the deepest level of Lisp_Object pointers. This function
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
457 can be NULL, meaning no GC marking is necessary.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
458
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
459 NOTE NOTE NOTE: This is not used by KKCC (which uses the data
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
460 description below instead), unless the data description is missing.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
461 Yes, this currently means there is logic duplication. Eventually the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
462 mark methods will be removed. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 Lisp_Object (*marker) (Lisp_Object);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
464
5124
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
465 /* `printer' converts the object to a printed representation. `printer'
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
466 should never be NULL (if so, you will get an assertion failure when
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
467 trying to print such an object). Either supply a specific printing
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
468 method, or use the default methods internal_object_printer() (for
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
469 internal objects that should not be visible at Lisp level) or
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
470 external_object_printer() (for objects visible at Lisp level). */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 void (*printer) (Lisp_Object, Lisp_Object printcharfun, int escapeflag);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
472
5124
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
473 /* `finalizer' is called at GC time when the object is about to be freed.
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
474 It should perform any necessary cleanup, such as freeing malloc()ed
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
475 memory or releasing pointers or handles to objects created in external
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
476 libraries, such as window-system windows or file handles. This can be
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
477 NULL, meaning no special finalization is necessary. */
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
478 void (*finalizer) (Lisp_Object obj);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
479
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 /* This can be NULL, meaning compare objects with EQ(). */
4906
6ef8256a020a implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
481 int (*equal) (Lisp_Object obj1, Lisp_Object obj2, int depth,
6ef8256a020a implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents: 4844
diff changeset
482 int foldcase);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
483
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
484 /* `hash' generates hash values for use with hash tables that have
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
485 `equal' as their test function. This can be NULL, meaning use
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
486 the Lisp_Object itself as the hash. But, you must still satisfy
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
487 the constraint that if two objects are `equal', then they *must*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
488 hash to the same value in order for hash tables to work properly.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
489 This means that `hash' can be NULL only if the `equal' method is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
490 also NULL. */
5191
71ee43b8a74d Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents: 5180
diff changeset
491 Hashcode (*hash) (Lisp_Object, int, Boolint);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
493 /* Data layout description for your object. See long comment below. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
494 const struct memory_description *description;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
496 /* Only one of `static_size' and `size_in_bytes_method' is non-0. If
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
497 `static_size' is 0, this type is not instantiable by
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
498 ALLOC_NORMAL_LISP_OBJECT(). If both are 0 (this should never happen),
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
499 this object cannot be instantiated; you will get an abort() if you
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
500 try.*/
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
501 Bytecount static_size;
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
502 Bytecount (*size_in_bytes_method) (Lisp_Object);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
503
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
504 /* The (constant) index into lrecord_implementations_table */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
505 enum lrecord_type lrecord_type_index;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
506
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
507 #ifndef NEW_GC
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
508 /* A "frob-block" lrecord is any lrecord that's not an lcrecord, i.e.
3024
b7f26b2f78bd [xemacs-hg @ 2005-10-25 08:32:40 by ben]
ben
parents: 3017
diff changeset
509 one that does not have an old_lcrecord_header at the front and which
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
510 is (usually) allocated in frob blocks. */
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
511 unsigned int frob_block_p :1;
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
512 #endif /* not NEW_GC */
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
513
5560
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
514 /* The next two methods are for objects that may be recursive;
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
515 print_preprocess descends OBJ, adding any encountered subobjects to
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
516 NUMBER_TABLE if it's not already there. This is used by #'print when
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
517 print-circle or relatedly print-gensym are non-nil. */
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
518 void (*print_preprocess) (Lisp_Object obj, Lisp_Object number_table,
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
519 Elemcount *seen_object_count);
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
520
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
521 /* */
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
522 void (*nsubst_structures_descend) (Lisp_Object new_, Lisp_Object old,
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
523 Lisp_Object object,
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
524 Lisp_Object number_table,
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
525 Boolint test_not_unboundp);
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
526
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
527 /**********************************************************************/
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
528 /* Remaining stuff is not assignable statically using
5170
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
529 DEFINE_*_LISP_OBJECT, but must be assigned with OBJECT_HAS_METHOD,
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
530 OBJECT_HAS_PROPERTY or the like. */
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
531
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
532 /* These functions allow any object type to have builtin property
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
533 lists that can be manipulated from the lisp level with
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
534 `get', `put', `remprop', and `object-plist'. */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
535 Lisp_Object (*getprop) (Lisp_Object obj, Lisp_Object prop);
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
536 int (*putprop) (Lisp_Object obj, Lisp_Object prop, Lisp_Object val);
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
537 int (*remprop) (Lisp_Object obj, Lisp_Object prop);
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
538 Lisp_Object (*plist) (Lisp_Object obj);
5255
b5611afbcc76 Support process plists, for greater GNU compatibility.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5191
diff changeset
539 Lisp_Object (*setplist) (Lisp_Object obj, Lisp_Object newplist);
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
540
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
541 /* `disksave' is called at dump time. It is used for objects that
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
542 contain pointers or handles to objects created in external libraries,
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
543 such as window-system windows or file handles. Such external objects
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
544 cannot be dumped, so it is necessary to release them at dump time and
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
545 arrange somehow or other for them to be resurrected if necessary later
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
546 on.
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
547
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
548 It seems that even non-dumpable objects may be around at dump time,
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
549 and a disksave may be provided. (In fact, the only object currently
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
550 with a disksave, lstream, is non-dumpable.)
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
551
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
552 Objects rarely need to provide this method; most of the time it will
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
553 be NULL. */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
554 void (*disksave) (Lisp_Object);
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
555
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
556 #ifdef MEMORY_USAGE_STATS
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
557 /* Return memory-usage information about the object in question, stored
5170
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
558 into STATS.
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
559
5170
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
560 Two types of information are stored: storage (including overhead) for
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
561 ancillary non-Lisp structures attached to the object, and storage
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
562 (including overhead) for ancillary Lisp objects attached to the
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
563 object. The third type of memory-usage information (storage for the
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
564 object itself) is not noted here, because it's computed automatically
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
565 by the calling function. Also, the computed storage for ancillary
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
566 Lisp objects is the sum of all three source of memory associated with
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
567 the Lisp object: the object itself, ancillary non-Lisp structures and
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
568 ancillary Lisp objects. Note also that the `struct usage_stats u' at
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
569 the beginning of the STATS structure is for ancillary non-Lisp usage
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
570 *ONLY*; do not store any memory into it related to ancillary Lisp
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
571 objects.
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
572
5170
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
573 Note that it may be subjective which Lisp objects are considered
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
574 "attached" to the object. Some guidelines:
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
575
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
576 -- Lisp objects which are "internal" to the main object and not
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
577 accessible except through the main object should be included
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
578 -- Objects linked by a weak reference should *NOT* be included
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
579 */
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
580 void (*memory_usage) (Lisp_Object obj, struct generic_usage_stats *stats);
5158
9e0b43d3095c more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents: 5157
diff changeset
581
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
582 /* List of tags to be given to the extra statistics, one per statistic.
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
583 Qnil or Qt can be present to separate off different slices. Qnil
5170
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
584 separates different slices within the same group of statistics.
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
585 These represent different ways of partitioning the same memory space.
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
586 Qt separates different groups; these represent different spaces of
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
587 memory.
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
588
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
589 If Qt is not present, all slices describe extra non-Lisp-Object memory
5170
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
590 associated with a Lisp object. If Qt is present, slices before Qt
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
591 describe non-Lisp-Object memory, as before, and slices after Qt
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
592 describe ancillary Lisp-Object memory logically associated with the
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
593 object. For example, if the object is a table, then ancillary
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
594 Lisp-Object memory might be the entries in the table. This info is
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
595 only advisory since it will duplicate memory described elsewhere and
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
596 since it may not be possible to be completely accurate, e.g. it may
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
597 not be clear what to count in "ancillary objects", and the value may
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
598 be too high if the same object occurs multiple times in the table. */
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
599 Lisp_Object memusage_stats_list;
5170
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
600
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
601 /* --------------------------------------------------------------------- */
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
602
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
603 /* The following are automatically computed based on the value in
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
604 `memusage_stats_list' (see compute_memusage_stats_length()). */
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
605
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
606 /* Total number of additional type-specific statistics related to memory
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
607 usage. */
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
608 Elemcount num_extra_memusage_stats;
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
609
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
610 /* Number of additional type-specific statistics belonging to the first
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
611 slice of the group describing non-Lisp-Object memory usage for this
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
612 object. These stats occur starting at offset 0. */
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
613 Elemcount num_extra_nonlisp_memusage_stats;
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
614
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
615 /* The offset into the extra statistics at which the Lisp-Object
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
616 memory-usage statistics begin. */
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
617 Elemcount offset_lisp_ancillary_memusage_stats;
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
618
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
619 /* Number of additional type-specific statistics belonging to the first
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
620 slice of the group describing Lisp-Object memory usage for this
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
621 object. These stats occur starting at offset
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
622 `offset_lisp_ancillary_memusage_stats'. */
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
623 Elemcount num_extra_lisp_ancillary_memusage_stats;
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
624
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
625 #endif /* MEMORY_USAGE_STATS */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 462
diff changeset
628 /* All the built-in lisp object types are enumerated in `enum lrecord_type'.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
629 Additional ones may be defined by a module (none yet). We leave some
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
630 room in `lrecord_implementations_table' for such new lisp object types. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
631 #define MODULE_DEFINABLE_TYPE_COUNT 32
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
632
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
633 extern MODULE_API struct lrecord_implementation *
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1429
diff changeset
634 lrecord_implementations_table[lrecord_type_last_built_in_type + MODULE_DEFINABLE_TYPE_COUNT];
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
636 /* Given a Lisp object, return its implementation
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
637 (struct lrecord_implementation) */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 #define XRECORD_LHEADER_IMPLEMENTATION(obj) \
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
639 LHEADER_IMPLEMENTATION (XRECORD_LHEADER (obj))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
640 #define LHEADER_IMPLEMENTATION(lh) lrecord_implementations_table[(lh)->type]
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
642 #include "gc.h"
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
643
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
644 #ifdef NEW_GC
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
645 #include "vdb.h"
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
646 #endif /* NEW_GC */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
647
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 extern int gc_in_progress;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
650 #ifdef NEW_GC
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
651 #include "mc-alloc.h"
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
652
2994
ec5f23ea6d2e [xemacs-hg @ 2005-10-14 01:21:57 by ben]
ben
parents: 2775
diff changeset
653 #ifdef ALLOC_TYPE_STATS
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
654 void init_lrecord_stats (void);
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
655 void inc_lrecord_stats (Bytecount size, const struct lrecord_header *h);
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
656 void dec_lrecord_stats (Bytecount size_including_overhead,
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
657 const struct lrecord_header *h);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
658 int lrecord_stats_heap_size (void);
2994
ec5f23ea6d2e [xemacs-hg @ 2005-10-14 01:21:57 by ben]
ben
parents: 2775
diff changeset
659 #endif /* ALLOC_TYPE_STATS */
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
660
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
661 /* Tell mc-alloc how to call a finalizer. */
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
662 #define MC_ALLOC_CALL_FINALIZER(ptr) \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
663 { \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
664 Lisp_Object MCACF_obj = wrap_pointer_1 (ptr); \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
665 struct lrecord_header *MCACF_lheader = XRECORD_LHEADER (MCACF_obj); \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
666 if (XRECORD_LHEADER (MCACF_obj) && LRECORDP (MCACF_obj) \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
667 && !LRECORD_FREE_P (MCACF_lheader) ) \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
668 { \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
669 const struct lrecord_implementation *MCACF_implementation \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
670 = LHEADER_IMPLEMENTATION (MCACF_lheader); \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
671 if (MCACF_implementation && MCACF_implementation->finalizer) \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
672 { \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
673 GC_STAT_FINALIZED; \
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
674 MCACF_implementation->finalizer (MCACF_obj); \
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
675 } \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
676 } \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
677 } while (0)
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
678
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
679 /* Tell mc-alloc how to call a finalizer for disksave. */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
680 #define MC_ALLOC_CALL_FINALIZER_FOR_DISKSAVE(ptr) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
681 { \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
682 Lisp_Object MCACF_obj = wrap_pointer_1 (ptr); \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
683 struct lrecord_header *MCACF_lheader = XRECORD_LHEADER (MCACF_obj); \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
684 if (XRECORD_LHEADER (MCACF_obj) && LRECORDP (MCACF_obj) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
685 && !LRECORD_FREE_P (MCACF_lheader) ) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
686 { \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
687 const struct lrecord_implementation *MCACF_implementation \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
688 = LHEADER_IMPLEMENTATION (MCACF_lheader); \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
689 if (MCACF_implementation && MCACF_implementation->disksave) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
690 MCACF_implementation->disksave (MCACF_obj); \
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
691 } \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
692 } while (0)
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
693
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
694 #define LRECORD_FREE_P(ptr) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
695 (((struct lrecord_header *) ptr)->free)
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
696
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
697 #define MARK_LRECORD_AS_FREE(ptr) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
698 ((void) (((struct lrecord_header *) ptr)->free = 1))
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
699
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
700 #define MARK_LRECORD_AS_NOT_FREE(ptr) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
701 ((void) (((struct lrecord_header *) ptr)->free = 0))
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
702
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
703 #define MARKED_RECORD_P(obj) MARKED_P (obj)
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
704 #define MARKED_RECORD_HEADER_P(lheader) MARKED_P (lheader)
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
705 #define MARK_RECORD_HEADER(lheader) MARK (lheader)
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
706 #define UNMARK_RECORD_HEADER(lheader) UNMARK (lheader)
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
707
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
708 #define LISP_READONLY_RECORD_HEADER_P(lheader) ((lheader)->lisp_readonly)
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
709 #define SET_LISP_READONLY_RECORD_HEADER(lheader) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
710 ((void) ((lheader)->lisp_readonly = 1))
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
711 #define MARK_LRECORD_AS_LISP_READONLY(ptr) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
712 ((void) (((struct lrecord_header *) ptr)->lisp_readonly = 1))
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
713
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
714 #else /* not NEW_GC */
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
715
5059
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
716 enum lrecord_alloc_status
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
717 {
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
718 ALLOC_IN_USE,
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
719 ALLOC_FREE,
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
720 ALLOC_ON_FREE_LIST
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
721 };
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
722
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
723 void tick_lrecord_stats (const struct lrecord_header *h,
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
724 enum lrecord_alloc_status status);
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
725
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
726 #define LRECORD_FREE_P(ptr) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
727 (((struct lrecord_header *) ptr)->type == lrecord_type_free)
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
728
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
729 #define MARK_LRECORD_AS_FREE(ptr) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
730 ((void) (((struct lrecord_header *) ptr)->type = lrecord_type_free))
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
731
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
732 #define MARKED_RECORD_P(obj) (XRECORD_LHEADER (obj)->mark)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 #define MARKED_RECORD_HEADER_P(lheader) ((lheader)->mark)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 #define MARK_RECORD_HEADER(lheader) ((void) ((lheader)->mark = 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 #define UNMARK_RECORD_HEADER(lheader) ((void) ((lheader)->mark = 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 #define C_READONLY_RECORD_HEADER_P(lheader) ((lheader)->c_readonly)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 #define LISP_READONLY_RECORD_HEADER_P(lheader) ((lheader)->lisp_readonly)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
739 #define SET_C_READONLY_RECORD_HEADER(lheader) do { \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
740 struct lrecord_header *SCRRH_lheader = (lheader); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
741 SCRRH_lheader->c_readonly = 1; \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
742 SCRRH_lheader->lisp_readonly = 1; \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
743 SCRRH_lheader->mark = 1; \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
744 } while (0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 #define SET_LISP_READONLY_RECORD_HEADER(lheader) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 ((void) ((lheader)->lisp_readonly = 1))
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
747 #endif /* not NEW_GC */
1676
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
748
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
749 #ifdef USE_KKCC
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
750 #define RECORD_DESCRIPTION(lheader) lrecord_memory_descriptions[(lheader)->type]
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
751 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
752 #define RECORD_MARKER(lheader) lrecord_markers[(lheader)->type]
1676
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
753 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
755 #define RECORD_DUMPABLE(lheader) (lrecord_implementations_table[(lheader)->type])->dumpable
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
756
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
757 /* Data description stuff
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
758
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
759 Data layout descriptions describe blocks of memory (in particular, Lisp
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
760 objects and other objects on the heap, and global objects with pointers
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
761 to such heap objects), including their size and a list of the elements
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
762 that need relocating, marking or other special handling. They are
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
763 currently used in two places: by pdump [the new, portable dumper] and
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
764 KKCC [the new garbage collector]. The two subsystems use the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
765 descriptions in different ways, and as a result some of the descriptions
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
766 are appropriate only for one or the other, when it is known that only
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
767 that subsystem will use the description. (This is particularly the case
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
768 with objects that can't be dumped, because pdump needs more info than
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
769 KKCC.) However, properly written descriptions are appropriate for both,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
770 and you should strive to write your descriptions that way, since the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
771 dumpable status of an object may change and new uses for the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
772 descriptions may be created. (An example that comes to mind is a
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
773 facility for determining the memory usage of XEmacs data structures --
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
774 like `buffer-memory-usage', `window-memory-usage', etc. but more
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
775 general.)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
776
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
777 More specifically:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
779 Pdump (the portable dumper) needs to write out all objects in heap
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
780 space, and later on (in another invocation of XEmacs) load them back
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
781 into the heap, relocating all pointers to the heap objects in the global
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
782 data space. ("Heap" means anything malloc()ed, including all Lisp
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
783 objects, and "global data" means anything declared globally or
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
784 `static'.) Pdump, then, needs to be told about the location of all
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
785 global pointers to heap objects, all the description of all such
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
786 objects, including their size and any pointers to other heap (aka
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
787 "relocatable") objects. (Pdump assumes that the heap may occur in
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
788 different places in different invocations -- therefore, it is not enough
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
789 simply to write out the entire heap and later reload it at the same
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
790 location -- but that global data is always in the same place, and hence
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
791 pointers to it do not need to be relocated. This assumption holds true
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
792 in general for modern operating systems, but would be broken, for
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
793 example, in a system without virtual memory, or when dealing with shared
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
794 libraries. Also, unlike unexec, pdump does not usually write out or
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
795 restore objects in the global data space, and thus they need to be
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
796 initialized every time XEmacs is loaded. This is the purpose of the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
797 reinit_*() functions throughout XEmacs. [It's possible, however, to make
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
798 pdump restore global data. This must be done, of course, for heap
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
799 pointers, but is also done for other values that are not easy to
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
800 recompute -- in particular, values established by the Lisp code loaded
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
801 at dump time.]) Note that the data type `Lisp_Object' is basically just
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
802 a relocatable pointer disguised as a long, and in general pdump treats
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
803 the Lisp_Object values and pointers to Lisp objects (e.g. Lisp_Object
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
804 vs. `struct frame *') identically. (NOTE: This equivalence depends
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
805 crucially on the current "minimal tagbits" implementation of Lisp_Object
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
806 pointers.)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
808 Descriptions are used by pdump in three places: (a) descriptions of Lisp
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
809 objects, referenced in the DEFINE_*LRECORD_*IMPLEMENTATION*() call; (b)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
810 descriptions of global objects to be dumped, registered by
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
811 dump_add_root_block(); (c) descriptions of global pointers to
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
812 non-Lisp_Object heap objects, registered by dump_add_root_block_ptr().
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
813 The descriptions need to tell pdump which elements of your structure are
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
814 Lisp_Objects or structure pointers, plus the descriptions in turn of the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
815 non-Lisp_Object structures pointed to. If these structures are you own
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
816 private ones, you will have to write these recursive descriptions
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
817 yourself; otherwise, you are reusing a structure already in existence
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
818 elsewhere and there is probably already a description for it.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
819
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
820 Pdump does not care about Lisp objects that cannot be dumped (the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
821 dumpable flag to DEFINE_*LRECORD_*IMPLEMENTATION*() is 0).
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
822
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
823 KKCC also uses data layout descriptions, but differently. It cares
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
824 about all objects, dumpable or not, but specifically only wants to know
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
825 about Lisp_Objects in your object and in structures pointed to. Thus,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
826 it doesn't care about things like pointers to structures ot other blocks
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
827 of memory with no Lisp Objects in them, which pdump would care a lot
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
828 about.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
829
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
830 Technically, then, you could write your description differently
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
831 depending on whether your object is dumpable -- the full pdump
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
832 description if so, the abbreviated KKCC description if not. In fact,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
833 some descriptions are written this way. This is dangerous, though,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
834 because another use might come along for the data descriptions, that
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
835 doesn't care about the dumper flag and makes use of some of the stuff
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
836 normally omitted from the "abbreviated" description -- see above.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
837
5094
ebee7d1e58bd fix outdated comment
Ben Wing <ben@xemacs.org>
parents: 5059
diff changeset
838 A memory_description is an array of values. The first value of each
ebee7d1e58bd fix outdated comment
Ben Wing <ben@xemacs.org>
parents: 5059
diff changeset
839 line is a type, the second the offset in the lrecord structure. The
ebee7d1e58bd fix outdated comment
Ben Wing <ben@xemacs.org>
parents: 5059
diff changeset
840 third and following elements are parameters; their presence, type and
ebee7d1e58bd fix outdated comment
Ben Wing <ben@xemacs.org>
parents: 5059
diff changeset
841 number is type-dependent.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
842
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
843 The description ends with an "XD_END" record.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
844
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
845 The top-level description of an lrecord or lcrecord does not need
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
846 to describe every element, just the ones that need to be relocated,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
847 since the size of the lrecord is known. (The same goes for nested
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
848 structures, whenever the structure size is given, rather than being
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
849 defaulted by specifying 0 for the size.)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
850
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
851 A sized_memory_description is a memory_description plus the size of the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
852 block of memory. The size field in a sized_memory_description can be
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
853 given as zero, i.e. unspecified, meaning that the last element in the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
854 structure is described in the description and the size of the block can
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
855 therefore be computed from it. (This is useful for stretchy arrays.)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
856
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
857 memory_descriptions are used to describe lrecords (the size of the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
858 lrecord is elsewhere in its description, attached to its methods, so it
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
859 does not need to be given here) and global objects, where the size is an
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
860 argument to the call to dump_add_root_block().
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
861 sized_memory_descriptions are used for pointers and arrays in
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
862 memory_descriptions and for calls to dump_add_root_block_ptr(). (####
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
863 It is not obvious why this is so in the latter case. Probably, calls to
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
864 dump_add_root_block_ptr() should use plain memory_descriptions and have
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
865 the size be an argument to the call.)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
866
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
867 NOTE: Anywhere that a sized_memory_description occurs inside of a plain
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
868 memory_description, a "description map" can be substituted. Rather than
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
869 being an actual description, this describes how to find the description
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
870 by looking inside of the object being described. This is a convenient
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
871 way to describe Lisp objects with subtypes and corresponding
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
872 type-specific data.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 Some example descriptions :
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
875
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
876 struct Lisp_String
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
877 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
878 struct lrecord_header lheader;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
879 Bytecount size;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 858
diff changeset
880 Ibyte *data;
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
881 Lisp_Object plist;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
882 };
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
883
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
884 static const struct memory_description cons_description[] = {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
885 { XD_LISP_OBJECT, offsetof (Lisp_Cons, car) },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
886 { XD_LISP_OBJECT, offsetof (Lisp_Cons, cdr) },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 { XD_END }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
890 Which means "two lisp objects starting at the 'car' and 'cdr' elements"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
892 static const struct memory_description string_description[] = {
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
893 { XD_BYTECOUNT, offsetof (Lisp_String, size) },
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
894 { XD_OPAQUE_DATA_PTR, offsetof (Lisp_String, data), XD_INDIRECT (0, 1) },
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
895 { XD_LISP_OBJECT, offsetof (Lisp_String, plist) },
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
896 { XD_END }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
897 };
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
898
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
899 "A pointer to string data at 'data', the size of the pointed array being
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
900 the value of the size variable plus 1, and one lisp object at 'plist'"
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
901
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
902 If your object has a pointer to an array of Lisp_Objects in it, something
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
903 like this:
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
904
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
905 struct Lisp_Foo
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
906 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
907 ...;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
908 int count;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
909 Lisp_Object *objects;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
910 ...;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
911 }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
912
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
913 You'd use XD_BLOCK_PTR, something like:
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
914
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
915 static const struct memory_description foo_description[] = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
916 ...
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
917 { XD_INT, offsetof (Lisp_Foo, count) },
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
918 { XD_BLOCK_PTR, offsetof (Lisp_Foo, objects),
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
919 XD_INDIRECT (0, 0), { &lisp_object_description } },
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
920 ...
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
921 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
922
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 4937
diff changeset
923 lisp_object_description is declared in gc.c, like this:
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
924
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
925 static const struct memory_description lisp_object_description_1[] = {
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
926 { XD_LISP_OBJECT, 0 },
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
927 { XD_END }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
928 };
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
929
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
930 const struct sized_memory_description lisp_object_description = {
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
931 sizeof (Lisp_Object),
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
932 lisp_object_description_1
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
933 };
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
934
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
935 Another example of XD_BLOCK_PTR:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
937 typedef struct htentry
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
938 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
939 Lisp_Object key;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
940 Lisp_Object value;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
941 } htentry;
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
942
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
943 struct Lisp_Hash_Table
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
944 {
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
945 NORMAL_LISP_OBJECT_HEADER header;
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
946 Elemcount size;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
947 Elemcount count;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
948 Elemcount rehash_count;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
949 double rehash_size;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
950 double rehash_threshold;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
951 Elemcount golden_ratio;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
952 hash_table_hash_function_t hash_function;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
953 hash_table_test_function_t test_function;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
954 htentry *hentries;
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
955 enum hash_table_weakness weakness;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
956 Lisp_Object next_weak; // Used to chain together all of the weak
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
957 // hash tables. Don't mark through this.
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
958 };
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
959
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
960 static const struct memory_description htentry_description_1[] = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
961 { XD_LISP_OBJECT, offsetof (htentry, key) },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
962 { XD_LISP_OBJECT, offsetof (htentry, value) },
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
963 { XD_END }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
964 };
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
965
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
966 static const struct sized_memory_description htentry_description = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
967 sizeof (htentry),
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
968 htentry_description_1
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
969 };
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
970
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
971 const struct memory_description hash_table_description[] = {
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
972 { XD_ELEMCOUNT, offsetof (Lisp_Hash_Table, size) },
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
973 { XD_BLOCK_PTR, offsetof (Lisp_Hash_Table, hentries), XD_INDIRECT (0, 1),
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
974 { &htentry_description } },
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
975 { XD_LO_LINK, offsetof (Lisp_Hash_Table, next_weak) },
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
976 { XD_END }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
977 };
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
978
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
979 Note that we don't need to declare all the elements in the structure, just
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
980 the ones that need to be relocated (Lisp_Objects and structures) or that
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
981 need to be referenced as counts for relocated objects.
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
982
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
983 A description map looks like this:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
984
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
985 static const struct sized_memory_description specifier_extra_description_map [] = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
986 { offsetof (Lisp_Specifier, methods) },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
987 { offsetof (struct specifier_methods, extra_description) },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
988 { -1 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
989 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
990
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
991 const struct memory_description specifier_description[] = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
992 ...
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
993 { XD_BLOCK_ARRAY, offset (Lisp_Specifier, data), 1,
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
994 { specifier_extra_description_map } },
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
995 ...
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
996 { XD_END }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
997 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
998
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
999 This would be appropriate for an object that looks like this:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1000
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1001 struct specifier_methods
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1002 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1003 ...
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1004 const struct sized_memory_description *extra_description;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1005 ...
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1006 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1007
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1008 struct Lisp_Specifier
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1009 {
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1010 NORMAL_LISP_OBJECT_HEADER header;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1011 struct specifier_methods *methods;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1012
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1013 ...
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1014 // type-specific extra data attached to a specifier
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1015 max_align_t data[1];
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1016 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1017
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1018 The description map means "retrieve a pointer into the object at offset
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1019 `offsetof (Lisp_Specifier, methods)' , then in turn retrieve a pointer
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1020 into that object at offset `offsetof (struct specifier_methods,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1021 extra_description)', and that is the sized_memory_description to use."
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1022 There can be any number of indirections, which can be either into
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1023 straight pointers or Lisp_Objects. The way that description maps are
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1024 distinguished from normal sized_memory_descriptions is that in the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1025 former, the memory_description pointer is NULL.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1026
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1027 --ben
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1028
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
1029
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
1030 The existing types :
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
1031
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 800
diff changeset
1032
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 XD_LISP_OBJECT
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1034
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1035 A Lisp_Object. This is also the type to use for pointers to other lrecords
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1036 (e.g. struct frame *).
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
1038 XD_LISP_OBJECT_ARRAY
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1039
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1040 An array of Lisp_Objects or (equivalently) pointers to lrecords.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1041 The parameter (i.e. third element) is the count. This would be declared
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1042 as Lisp_Object foo[666]. For something declared as Lisp_Object *foo,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1043 use XD_BLOCK_PTR, whose description parameter is a sized_memory_description
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1044 consisting of only XD_LISP_OBJECT and XD_END.
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
1045
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1046 XD_INLINE_LISP_OBJECT_BLOCK_PTR
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1047
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1048 An pointer to a contiguous block of inline Lisp objects -- i.e., the Lisp
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1049 object itself rather than a Lisp_Object pointer is stored in the block.
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1050 This is used only under NEW_GC and is useful for increased efficiency when
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1051 an array of the same kind of object is needed. Examples of the use of this
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1052 type are Lisp dynarrs, where the array elements are inline Lisp objects
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1053 rather than non-Lisp structures, as is normally the case; and hash tables,
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1054 where the key/value pairs are encapsulated as hash-table-entry objects and
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1055 an array of inline hash-table-entry objects is stored.
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1056
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 XD_LO_LINK
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1058
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1059 Weak link in a linked list of objects of the same type. This is a
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1060 link that does NOT generate a GC reference. Thus the pdumper will
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1061 not automatically add the referenced object to the table of all
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1062 objects to be dumped, and when storing and loading the dumped data
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1063 will automatically prune unreferenced objects in the chain and link
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1064 each referenced object to the next referenced object, even if it's
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1065 many links away. We also need to special handling of a similar
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1066 nature for the root of the chain, which will be a staticpro()ed
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1067 object.
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 430
diff changeset
1068
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 XD_OPAQUE_PTR
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1070
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 Pointer to undumpable data. Must be NULL when dumping.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1073 XD_OPAQUE_PTR_CONVERTIBLE
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1074
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1075 Pointer to data which is not directly dumpable but can be converted
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1076 to a dumpable, opaque external representation. The parameter is
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1077 a pointer to an opaque_convert_functions struct.
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1078
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1079 XD_OPAQUE_DATA_CONVERTIBLE
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1080
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1081 Data which is not directly dumpable but can be converted to a
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1082 dumpable, opaque external representation. The parameter is a
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1083 pointer to an opaque_convert_functions struct.
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1084
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1085 XD_BLOCK_PTR
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1086
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1087 Pointer to block of described memory. (This is misnamed: It is NOT
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1088 necessarily a pointer to a struct foo.) Parameters are number of
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1089 contiguous blocks and sized_memory_description.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1090
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1091 XD_BLOCK_ARRAY
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1092
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1093 Array of blocks of described memory. Parameters are number of
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1094 structures and sized_memory_description. This differs from XD_BLOCK_PTR
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1095 in that the parameter is declared as struct foo[666] instead of
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1096 struct *foo. In other words, the block of memory holding the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1097 structures is within the containing structure, rather than being
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1098 elsewhere, with a pointer in the containing structure.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1100 NOTE NOTE NOTE: Be sure that you understand the difference between
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1101 XD_BLOCK_PTR and XD_BLOCK_ARRAY:
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1102 - struct foo bar[666], i.e. 666 inline struct foos
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1103 --> XD_BLOCK_ARRAY, argument 666, pointing to a description of
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1104 struct foo
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1105 - struct foo *bar, i.e. pointer to a block of 666 struct foos
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1106 --> XD_BLOCK_PTR, argument 666, pointing to a description of
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1107 struct foo
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1108 - struct foo *bar[666], i.e. 666 pointers to separate blocks of struct foos
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1109 --> XD_BLOCK_ARRAY, argument 666, pointing to a description of
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1110 a single pointer to struct foo; the description is a single
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1111 XD_BLOCK_PTR, argument 1, which in turn points to a description
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1112 of struct foo.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1113
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1114 NOTE also that an XD_BLOCK_PTR of 666 foos is equivalent to an
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1115 XD_BLOCK_PTR of 1 bar, where the description of `bar' is an
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1116 XD_BLOCK_ARRAY of 666 foos.
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1117
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 XD_OPAQUE_DATA_PTR
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1119
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 Pointer to dumpable opaque data. Parameter is the size of the data.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 Pointed data must be relocatable without changes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1123 XD_UNION
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1124
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1125 Union of two or more different types of data. Parameters are a constant
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1126 which determines which type the data is (this is usually an XD_INDIRECT,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1127 referring to one of the fields in the structure), and a "sizing lobby" (a
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1128 sized_memory_description, which points to a memory_description and
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1129 indicates its size). The size field in the sizing lobby describes the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1130 size of the union field in the object, and the memory_description in it
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1131 is referred to as a "union map" and has a special interpretation: The
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1132 offset field is replaced by a constant, which is compared to the first
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1133 parameter of the XD_UNION descriptor to determine if this description
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1134 applies to the union data, and XD_INDIRECT references refer to the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1135 containing object and description. Note that the description applies
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1136 "inline" to the union data, like XD_BLOCK_ARRAY and not XD_BLOCK_PTR.
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1137 If the union data is a pointer to different types of structures, each
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1138 element in the memory_description should be an XD_BLOCK_PTR. See
5176
8b2f75cecb89 rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents: 4967
diff changeset
1139 unicode.c, redisplay.c and fontcolor.c for examples of XD_UNION.
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1140
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1141 XD_UNION_DYNAMIC_SIZE
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1142
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1143 Same as XD_UNION except that this is used for objects where the size of
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1144 the object containing the union varies depending on the particular value
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1145 of the union constant. That is, an object with plain XD_UNION typically
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1146 has the union declared as `union foo' or as `void *', where an object
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1147 with XD_UNION_DYNAMIC_SIZE typically has the union as the last element,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1148 and declared as something like Rawbyte foo[1]. With plain XD_UNION, the
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1149 object is (usually) of fixed size and always contains enough space for
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1150 the data associated with all possible union constants, and thus the union
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1151 constant can potentially change during the lifetime of the object. With
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1152 XD_UNION_DYNAMIC_SIZE, however, the union constant is fixed at the time
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1153 of creation of the object, and the size of the object is computed
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1154 dynamically at creation time based on the size of the data associated
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1155 with the union constant. Currently, the only difference between XD_UNION
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1156 and XD_UNION_DYNAMIC_SIZE is how the size of the union data is
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1157 calculated, when (a) the structure containing the union has no size
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1158 given; (b) the union occurs as the last element in the structure; and (c)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1159 the union has no size given (in the first-level sized_memory_description
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1160 pointed to). In this circumstance, the size of XD_UNION comes from the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1161 max size of the data associated with all possible union constants,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1162 whereas the size of XD_UNION_DYNAMIC_SIZE comes from the size of the data
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1163 associated with the currently specified (and unchangeable) union
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1164 constant.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1165
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1166 XD_ASCII_STRING
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1167
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1168 Pointer to a C string, purely ASCII.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 XD_DOC_STRING
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1171
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1172 Pointer to a doc string (C string in pure ASCII if positive,
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1173 opaque value if negative)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 XD_INT_RESET
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1176
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 An integer which will be reset to a given value in the dump file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1179 XD_ELEMCOUNT
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1180
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
1181 Elemcount value. Used for counts.
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
1182
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
1183 XD_BYTECOUNT
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1184
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
1185 Bytecount value. Used for counts.
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
1186
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
1187 XD_HASHCODE
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1188
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
1189 Hashcode value. Used for the results of hashing functions.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 XD_INT
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1192
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 int value. Used for counts.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 XD_LONG
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1196
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 long value. Used for counts.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1199 XD_BYTECOUNT
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1200
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1201 bytecount value. Used for counts.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1202
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203 XD_END
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1204
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 Special type indicating the end of the array.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 Special macros:
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1209
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1210 XD_INDIRECT (line, delta)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1211 Usable where a count, size, offset or union constant is requested. Gives
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1212 the value of the element which is at line number 'line' in the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1213 description (count starts at zero) and adds delta to it, which must
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1214 (currently) be positive.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1217 enum memory_description_type
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
1218 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
1219 XD_LISP_OBJECT_ARRAY,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 XD_LISP_OBJECT,
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
1221 #ifdef NEW_GC
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1222 XD_INLINE_LISP_OBJECT_BLOCK_PTR,
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
1223 #endif /* NEW_GC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224 XD_LO_LINK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 XD_OPAQUE_PTR,
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1226 XD_OPAQUE_PTR_CONVERTIBLE,
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1227 XD_OPAQUE_DATA_CONVERTIBLE,
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1228 XD_OPAQUE_DATA_PTR,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1229 XD_BLOCK_PTR,
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1230 XD_BLOCK_ARRAY,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1231 XD_UNION,
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1232 XD_UNION_DYNAMIC_SIZE,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1233 XD_ASCII_STRING,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234 XD_DOC_STRING,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235 XD_INT_RESET,
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
1236 XD_BYTECOUNT,
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
1237 XD_ELEMCOUNT,
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
1238 XD_HASHCODE,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1239 XD_INT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1240 XD_LONG,
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1241 XD_END
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1244 enum data_description_entry_flags
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
1245 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1246 /* If set, KKCC does not process this entry.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1247
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1248 (1) One obvious use is with things that pdump saves but which do not get
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1249 marked normally -- for example the next and prev fields in a marker. The
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1250 marker chain is weak, with its entries removed when they are finalized.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1251
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1252 (2) This can be set on structures not containing any Lisp objects, or (more
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1253 usefully) on structures that contain Lisp objects but where the objects
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1254 always occur in another structure as well. For example, the extent lists
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1255 kept by a buffer keep the extents in two lists, one sorted by the start
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1256 of the extent and the other by the end. There's no point in marking
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1257 both, since each contains the same objects as the other; but when dumping
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1258 (if we were to dump such a structure), when computing memory size, etc.,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1259 it's crucial to tag both sides.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1260 */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1261 XD_FLAG_NO_KKCC = 1,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1262 /* If set, pdump does not process this entry. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1263 XD_FLAG_NO_PDUMP = 2,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1264 /* Indicates that this is a "default" entry in a union map. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1265 XD_FLAG_UNION_DEFAULT_ENTRY = 4,
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
1266 #ifndef NEW_GC
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1267 /* Indicates that this is a free Lisp object we're marking.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1268 Only relevant for ERROR_CHECK_GC. This occurs when we're marking
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1269 lcrecord-lists, where the objects have had their type changed to
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1270 lrecord_type_free and also have had their free bit set, but we mark
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1271 them as normal. */
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1272 XD_FLAG_FREE_LISP_OBJECT = 8,
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
1273 #endif /* not NEW_GC */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1274 #if 0
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1275 /* Suggestions for other possible flags: */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1276
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1277 /* Eliminate XD_UNION_DYNAMIC_SIZE and replace it with a flag, like this. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1278 XD_FLAG_UNION_DYNAMIC_SIZE = 16,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1279 /* Require that everyone who uses a description map has to flag it, so
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1280 that it's easy to tell, when looking through the code, where the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1281 description maps are and who's using them. This might also become
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1282 necessary if for some reason the format of the description map is
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1283 expanded and we need to stick a pointer in the second slot (although
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1284 we could still ensure that the second slot in the first entry was NULL
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1285 or <0). */
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1286 XD_FLAG_DESCRIPTION_MAP = 32,
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1287 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1290 union memory_contents_description
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1291 {
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1292 /* The first element is used by static initializers only. We always read
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1293 from one of the other two pointers. */
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1294 const void *write_only;
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1295 const struct sized_memory_description *descr;
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1296 const struct opaque_convert_functions *funcs;
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1297 };
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1298
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1299 struct memory_description
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1300 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1301 enum memory_description_type type;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1302 Bytecount offset;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1303 EMACS_INT data1;
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1304 union memory_contents_description data2;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1305 /* Indicates which subsystems process this entry, plus (potentially) other
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1306 flags that apply to this entry. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1307 int flags;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1308 };
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1309
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1310 struct sized_memory_description
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1311 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1312 Bytecount size;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1313 const struct memory_description *description;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1314 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1315
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1316
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1317 struct opaque_convert_functions
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1318 {
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1319 /* Used by XD_OPAQUE_PTR_CONVERTIBLE and
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1320 XD_OPAQUE_DATA_CONVERTIBLE */
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1321
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1322 /* Converter to external representation, for those objects from
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1323 external libraries that can't be directly dumped as opaque data
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1324 because they contain pointers. This is called at dump time to
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1325 convert to an opaque, pointer-less representation.
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1326
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1327 This function must put a pointer to the opaque result in *data
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1328 and its size in *size. */
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1329 void (*convert) (const void *object, void **data, Bytecount *size);
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1330
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1331 /* Post-conversion cleanup. Optional (null if not provided).
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1332
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1333 When provided it will be called post-dumping to free any storage
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1334 allocated for the conversion results. */
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1335 void (*convert_free) (const void *object, void *data, Bytecount size);
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1336
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1337 /* De-conversion.
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1338
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1339 At reload time, rebuilds the object from the converted form.
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1340 "object" is 0 for the PTR case, return is ignored in the DATA
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1341 case. */
5169
6c6d78781d59 cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents: 5160
diff changeset
1342 void *(*deconvert) (void *object, void *data, Bytecount size);
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1343
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1344 };
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
1345
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1346 extern const struct sized_memory_description lisp_object_description;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1347
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1348 #define XD_INDIRECT(val, delta) (-1 - (Bytecount) ((val) | ((delta) << 8)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1350 #define XD_IS_INDIRECT(code) ((code) < 0)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1351 #define XD_INDIRECT_VAL(code) ((-1 - (code)) & 255)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1352 #define XD_INDIRECT_DELTA(code) ((-1 - (code)) >> 8)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1353
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1354 /* DEFINE_*_LISP_OBJECT is for objects with constant size. (Either
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1355 DEFINE_DUMPABLE_LISP_OBJECT for objects that can be saved in a dumped
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1356 executable, or DEFINE_NODUMP_LISP_OBJECT for objects that cannot be
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1357 saved -- e.g. that contain pointers to non-persistent external objects
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1358 such as window-system windows.)
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1359
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1360 DEFINE_*_SIZABLE_LISP_OBJECT is for objects whose size varies.
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1361
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1362 DEFINE_*_FROB_BLOCK_LISP_OBJECT is for objects that are allocated in
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1363 large blocks ("frob blocks"), which are parceled up individually. Such
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1364 objects need special handling in alloc.c. This does not apply to
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1365 NEW_GC, because it does this automatically.
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1366
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1367 DEFINE_*_INTERNAL_LISP_OBJECT is for "internal" objects that should
5124
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
1368 never be visible on the Lisp level. This is a shorthand for the most
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
1369 common type of internal objects, which have no equal or hash method
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
1370 (since they generally won't appear in hash tables), no finalizer and
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
1371 internal_object_printer() as their print method (which prints that the
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
1372 object is internal and shouldn't be visible externally). For internal
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
1373 objects needing a finalizer, equal or hash method, or wanting to
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
1374 customize the print method, use the normal DEFINE_*_LISP_OBJECT
623d57b7fbe8 separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents: 5120
diff changeset
1375 mechanism for defining these objects.
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1376
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1377 DEFINE_MODULE_* is for objects defined in an external module.
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1378
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1379 MAKE_LISP_OBJECT and MAKE_MODULE_LISP_OBJECT are what underlies all of
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1380 these; they define a structure containing pointers to object methods
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1381 and other info such as the size of the structure containing the object.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1384 /* #### FIXME What's going on here? */
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1385 #if defined (ERROR_CHECK_TYPES)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1386 # define DECLARE_ERROR_CHECK_TYPES(c_name, structtype)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387 #else
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1388 # define DECLARE_ERROR_CHECK_TYPES(c_name, structtype)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1390
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1391 /********* The dumpable versions *********** */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1392
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1393 #define DEFINE_DUMPABLE_LISP_OBJECT(name,c_name,marker,printer,nuker,equal,hash,desc,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1394 MAKE_LISP_OBJECT(name,c_name,1 /*dumpable*/,marker,printer,nuker,equal,hash,desc,sizeof (structtype),0,0,structtype)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1395
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1396 #define DEFINE_DUMPABLE_SIZABLE_LISP_OBJECT(name,c_name,marker,printer,nuker,equal,hash,desc,sizer,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1397 MAKE_LISP_OBJECT(name,c_name,1 /*dumpable*/,marker,printer,nuker,equal,hash,desc,0,sizer,0,structtype)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1398
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1399 #define DEFINE_DUMPABLE_FROB_BLOCK_LISP_OBJECT(name,c_name,marker,printer,nuker,equal,hash,desc,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1400 MAKE_LISP_OBJECT(name,c_name,1 /*dumpable*/,marker,printer,nuker,equal,hash,desc,sizeof(structtype),0,1,structtype)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1401
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1402 #define DEFINE_DUMPABLE_FROB_BLOCK_SIZABLE_LISP_OBJECT(name,c_name,marker,printer,nuker,equal,hash,desc,sizer,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1403 MAKE_LISP_OBJECT(name,c_name,1 /*dumpable*/,marker,printer,nuker,equal,hash,desc,0,sizer,1,structtype)
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1404
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1405 #define DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT(name,c_name,marker,desc,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1406 DEFINE_DUMPABLE_LISP_OBJECT(name,c_name,marker,internal_object_printer,0,0,0,desc,structtype)
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1407
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1408 #define DEFINE_DUMPABLE_SIZABLE_INTERNAL_LISP_OBJECT(name,c_name,marker,desc,sizer,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1409 DEFINE_DUMPABLE_SIZABLE_LISP_OBJECT(name,c_name,marker,internal_object_printer,0,0,0,desc,sizer,structtype)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1410
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1411 /********* The non-dumpable versions *********** */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1412
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1413 #define DEFINE_NODUMP_LISP_OBJECT(name,c_name,marker,printer,nuker,equal,hash,desc,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1414 MAKE_LISP_OBJECT(name,c_name,0 /*non-dumpable*/,marker,printer,nuker,equal,hash,desc,sizeof (structtype),0,0,structtype)
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1415
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1416 #define DEFINE_NODUMP_SIZABLE_LISP_OBJECT(name,c_name,marker,printer,nuker,equal,hash,desc,sizer,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1417 MAKE_LISP_OBJECT(name,c_name,0 /*non-dumpable*/,marker,printer,nuker,equal,hash,desc,0,sizer,0,structtype)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1418
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1419 #define DEFINE_NODUMP_FROB_BLOCK_LISP_OBJECT(name,c_name,marker,printer,nuker,equal,hash,desc,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1420 MAKE_LISP_OBJECT(name,c_name,0 /*non-dumpable*/,marker,printer,nuker,equal,hash,desc,sizeof(structtype),0,1,structtype)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1421
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1422 #define DEFINE_NODUMP_FROB_BLOCK_SIZABLE_LISP_OBJECT(name,c_name,marker,printer,nuker,equal,hash,desc,sizer,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1423 MAKE_LISP_OBJECT(name,c_name,0 /*non-dumpable*/,marker,printer,nuker,equal,hash,desc,0,sizer,1,structtype)
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1424
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1425 #define DEFINE_NODUMP_INTERNAL_LISP_OBJECT(name,c_name,marker,desc,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1426 DEFINE_NODUMP_LISP_OBJECT(name,c_name,marker,internal_object_printer,0,0,0,desc,structtype)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1427
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1428 #define DEFINE_NODUMP_SIZABLE_INTERNAL_LISP_OBJECT(name,c_name,marker,desc,sizer,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1429 DEFINE_NODUMP_SIZABLE_LISP_OBJECT(name,c_name,marker,internal_object_printer,0,0,0,desc,sizer,structtype)
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1430
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1431 /********* MAKE_LISP_OBJECT, the underlying macro *********** */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1432
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
1433 #ifdef NEW_GC
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1434 #define MAKE_LISP_OBJECT(name,c_name,dumpable,marker,printer,nuker, \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1435 equal,hash,desc,size,sizer,frob_block_p,structtype) \
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
1436 DECLARE_ERROR_CHECK_TYPES(c_name, structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1437 struct lrecord_implementation lrecord_##c_name = \
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
1438 { name, dumpable, marker, printer, nuker, equal, hash, desc, \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1439 size, sizer, lrecord_type_##c_name }
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
1440 #else /* not NEW_GC */
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1441 #define MAKE_LISP_OBJECT(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,size,sizer,frob_block_p,structtype) \
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1442 DECLARE_ERROR_CHECK_TYPES(c_name, structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1443 struct lrecord_implementation lrecord_##c_name = \
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1444 { name, dumpable, marker, printer, nuker, equal, hash, desc, \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1445 size, sizer, lrecord_type_##c_name, frob_block_p }
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
1446 #endif /* not NEW_GC */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1447
5560
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1448 #ifdef NEW_GC
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1449 #define MAKE_RECURSIVE_LISP_OBJECT(name,c_name,dumpable,marker,printer, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1450 nuker,equal,hash,desc,size,sizer, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1451 frob_block_p,structtype, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1452 print_preprocess, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1453 nsubst_structures_descend) \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1454 DECLARE_ERROR_CHECK_TYPES(c_name, structtype) \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1455 struct lrecord_implementation lrecord_##c_name = \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1456 { name, dumpable, marker, printer, nuker, equal, hash, desc, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1457 size, sizer, lrecord_type_##c_name, print_preprocess, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1458 nsubst_structures_descend }
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1459 #else /* not NEW_GC */
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1460 #define MAKE_RECURSIVE_LISP_OBJECT(name,c_name,dumpable,marker,printer, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1461 nuker,equal,hash,desc,size,sizer, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1462 frob_block_p,structtype, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1463 print_preprocess, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1464 nsubst_structures_descend) \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1465 DECLARE_ERROR_CHECK_TYPES(c_name, structtype) \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1466 struct lrecord_implementation lrecord_##c_name = \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1467 { name, dumpable, marker, printer, nuker, equal, hash, desc, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1468 size, sizer, lrecord_type_##c_name, frob_block_p, print_preprocess, \
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1469 nsubst_structures_descend }
58b38d5b32d0 Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1470 #endif /* not NEW_GC */
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1471
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1472 /********* The module dumpable versions *********** */
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1473
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1474 #define DEFINE_DUMPABLE_MODULE_LISP_OBJECT(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1475 MAKE_MODULE_LISP_OBJECT(name,c_name,1 /*dumpable*/,marker,printer,nuker,equal,hash,desc,sizeof (structtype),0,0,structtype)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1476
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1477 #define DEFINE_DUMPABLE_MODULE_SIZABLE_LISP_OBJECT(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,sizer,structtype) \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1478 MAKE_MODULE_LISP_OBJECT(name,c_name,1 /*dumpable*/,marker,printer,nuker,equal,hash,desc,0,sizer,0,structtype)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1479
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1480 /********* The module non-dumpable versions *********** */
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1481
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1482 #define DEFINE_NODUMP_MODULE_LISP_OBJECT(name,c_name,dumpable,marker, \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1483 printer,nuker,equal,hash,desc,structtype) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1484 MAKE_MODULE_LISP_OBJECT(name,c_name,0 /*non-dumpable*/,marker,printer, \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1485 nuker,equal,hash,desc,sizeof (structtype),0,0,structtype)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1486
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1487 #define DEFINE_NODUMP_MODULE_SIZABLE_LISP_OBJECT(name,c_name,dumpable, \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1488 marker,printer,nuker,equal,hash,desc,sizer,structtype) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1489 MAKE_MODULE_LISP_OBJECT(name,c_name,0 /*non-dumpable*/,marker,printer, \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1490 nuker,equal,hash,desc,0,sizer,0,structtype)
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1491
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1492 /********* MAKE_MODULE_LISP_OBJECT, the underlying macro *********** */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1493
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
1494 #ifdef NEW_GC
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1495 #define MAKE_MODULE_LISP_OBJECT(name,c_name,dumpable,marker,printer, \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1496 nuker,equal,hash,desc,size,sizer,frob_block_p,structtype) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1497 DECLARE_ERROR_CHECK_TYPES(c_name, structtype) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1498 int lrecord_type_##c_name; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1499 struct lrecord_implementation lrecord_##c_name = \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1500 { name, dumpable, marker, printer, nuker, equal, hash, desc, \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1501 size, sizer, lrecord_type_last_built_in_type }
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1502 #else /* not NEW_GC */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1503 #define MAKE_MODULE_LISP_OBJECT(name,c_name,dumpable,marker,printer, \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1504 nuker,equal,hash,desc,size,sizer,frob_block_p,structtype) \
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
1505 DECLARE_ERROR_CHECK_TYPES(c_name, structtype) \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
1506 int lrecord_type_##c_name; \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
1507 struct lrecord_implementation lrecord_##c_name = \
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
1508 { name, dumpable, marker, printer, nuker, equal, hash, desc, \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1509 size, sizer, lrecord_type_last_built_in_type, frob_block_p }
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
1510 #endif /* not NEW_GC */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 888
diff changeset
1511
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1512 #ifdef MEMORY_USAGE_STATS
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1513 #define INIT_MEMORY_USAGE_STATS(type) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1514 do \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1515 { \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1516 lrecord_implementations_table[lrecord_type_##type]-> \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1517 memusage_stats_list = Qnil; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1518 lrecord_implementations_table[lrecord_type_##type]-> \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1519 num_extra_memusage_stats = -1; \
5158
9e0b43d3095c more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents: 5157
diff changeset
1520 lrecord_implementations_table[lrecord_type_##type]-> \
9e0b43d3095c more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents: 5157
diff changeset
1521 num_extra_nonlisp_memusage_stats = -1; \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1522 staticpro (&lrecord_implementations_table[lrecord_type_##type]-> \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1523 memusage_stats_list); \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1524 } while (0)
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1525 #else
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1526 #define INIT_MEMORY_USAGE_STATS(type) DO_NOTHING
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1527 #endif /* (not) MEMORY_USAGE_STATS */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1528
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1529 #define INIT_LISP_OBJECT_BEGINNING(type) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1530 do \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1531 { \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1532 lrecord_implementations_table[lrecord_type_##type] = &lrecord_##type; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1533 INIT_MEMORY_USAGE_STATS (type); \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1534 } while (0)
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1535
1676
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1536 #ifdef USE_KKCC
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1537 extern MODULE_API const struct memory_description *lrecord_memory_descriptions[];
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1538
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1539 #define INIT_LISP_OBJECT(type) do { \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1540 INIT_LISP_OBJECT_BEGINNING (type); \
1676
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1541 lrecord_memory_descriptions[lrecord_type_##type] = \
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1542 lrecord_implementations_table[lrecord_type_##type]->description; \
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1543 } while (0)
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1544 #else /* not USE_KKCC */
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1429
diff changeset
1545 extern MODULE_API Lisp_Object (*lrecord_markers[]) (Lisp_Object);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1546
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1547 #define INIT_LISP_OBJECT(type) do { \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1548 INIT_LISP_OBJECT_BEGINNING (type); \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1549 lrecord_markers[lrecord_type_##type] = \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1550 lrecord_implementations_table[lrecord_type_##type]->marker; \
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1551 } while (0)
1676
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1552 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1554 #define INIT_MODULE_LISP_OBJECT(type) do { \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1555 lrecord_type_##type = lrecord_type_count++; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1556 lrecord_##type.lrecord_type_index = lrecord_type_##type; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1557 INIT_LISP_OBJECT (type); \
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1558 } while (0)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1559
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1560 #ifdef HAVE_SHLIB
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1561 /* Allow undefining types in order to support module unloading. */
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1562
1676
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1563 #ifdef USE_KKCC
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1564 #define UNDEF_LISP_OBJECT(type) do { \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1565 lrecord_implementations_table[lrecord_type_##type] = NULL; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1566 lrecord_memory_descriptions[lrecord_type_##type] = NULL; \
1676
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1567 } while (0)
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1568 #else /* not USE_KKCC */
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1569 #define UNDEF_LISP_OBJECT(type) do { \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1570 lrecord_implementations_table[lrecord_type_##type] = NULL; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1571 lrecord_markers[lrecord_type_##type] = NULL; \
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1572 } while (0)
1676
a72f7bf813c9 [xemacs-hg @ 2003-09-11 09:11:07 by crestani]
crestani
parents: 1650
diff changeset
1573 #endif /* not USE_KKCC */
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1574
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1575 #define UNDEF_MODULE_LISP_OBJECT(type) do { \
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1576 if (lrecord_##type.lrecord_type_index == lrecord_type_count - 1) { \
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1577 /* This is the most recently defined type. Clean up nicely. */ \
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1578 lrecord_type_##type = lrecord_type_count--; \
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1579 } /* Else we can't help leaving a hole with this implementation. */ \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1580 UNDEF_LISP_OBJECT(type); \
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1581 } while (0)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1582
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1583 #endif /* HAVE_SHLIB */
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 934
diff changeset
1584
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1585 /*************** Macros for declaring that a Lisp object has a
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1586 particular method, or for calling such a method. ********/
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1587
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1588 /* Declare that object-type TYPE has method M; used in
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1589 initialization routines */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1590 #define OBJECT_HAS_METHOD(type, m) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1591 (lrecord_##type.m = type##_##m)
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1592 /* Same but the method name come before the type */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1593 #define OBJECT_HAS_PREMETHOD(type, m) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1594 (lrecord_##type.m = m##_##type)
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1595 /* Same but the name of the method is explicitly given */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1596 #define OBJECT_HAS_NAMED_METHOD(type, m, func) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1597 (lrecord_##type.m = (func))
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1598 /* Object type has a property with the given value. */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1599 #define OBJECT_HAS_PROPERTY(type, prop, val) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1600 (lrecord_##type.prop = (val))
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1601
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1602 /* Does the given object method exist? */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1603 #define HAS_OBJECT_METH_P(obj, m) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1604 (!!(XRECORD_LHEADER_IMPLEMENTATION (obj)->m))
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1605 /* Call an object method. */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1606 #define OBJECT_METH(obj, m, args) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1607 ((XRECORD_LHEADER_IMPLEMENTATION (obj)->m) args)
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1608
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1609 /* Call an object method, if it exists. */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1610 #define MAYBE_OBJECT_METH(obj, m, args) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1611 do \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1612 { \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1613 const struct lrecord_implementation *_mom_imp = \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1614 XRECORD_LHEADER_IMPLEMENTATION (obj); \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1615 if (_mom_imp->m) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1616 ((_mom_imp->m) args); \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1617 } while (0)
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1618
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1619 /* Call an object method, if it exists, or return GIVEN. NOTE:
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1620 Multiply-evaluates OBJ. */
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1621 #define OBJECT_METH_OR_GIVEN(obj, m, args, given) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1622 (HAS_OBJECT_METH_P (obj, m) ? OBJECT_METH (obj, m, args) : (given))
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1623
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1624 #define OBJECT_PROPERTY(obj, prop) (XRECORD_LHEADER_IMPLEMENTATION (obj)->prop)
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1625
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1626 /************** Other stuff **************/
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1627
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1628 #define LRECORDP(a) (XTYPE (a) == Lisp_Type_Record)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1629 #define XRECORD_LHEADER(a) ((struct lrecord_header *) XPNTR (a))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1631 #define RECORD_TYPEP(x, ty) \
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
1632 (LRECORDP (x) && (XRECORD_LHEADER (x)->type == (unsigned int) (ty)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1633
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1634 /* Steps to create a new object:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1635
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1636 1. Declare the struct for your object in a header file somewhere.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1637 Remember that it must begin with
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1638
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1639 NORMAL_LISP_OBJECT_HEADER header;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1640
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1641 2. Put the "standard junk" (DECLARE_LISP_OBJECT()/XFOO/etc.) below the
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 462
diff changeset
1642 struct definition -- see below.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1643
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1644 3. Add this header file to inline.c.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1645
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1646 4. Create the methods for your object. Note that technically you don't
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1647 need any, but you will almost always want at least a mark method.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1648
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1649 4. Create the data layout description for your object. See
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1650 toolbar_button_description below; the comment above in `struct lrecord',
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1651 describing the purpose of the descriptions; and comments elsewhere in
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1652 this file describing the exact syntax of the description structures.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1653
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1654 6. Define your object with DEFINE_*_LISP_OBJECT() or some
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1655 variant. At the minimum, you need to decide whether your object can
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1656 be dumped. Objects that are created as part of the loadup process and
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1657 need to be persistent across dumping should be created dumpable.
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1658 Nondumpable objects are generally those associated with display,
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1659 particularly those containing a pointer to an external library object
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1660 (e.g. a window-system window).
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1661
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1662 7. Include the header file in the .c file where you defined the object.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1663
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
1664 8. Put a call to INIT_LISP_OBJECT() for the object in the
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1665 .c file's syms_of_foo() function.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1666
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1667 9. Add a type enum for the object to enum lrecord_type, earlier in this
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1668 file.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1669
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1670 --ben
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1671
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1672 An example:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1673
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1674 ------------------------------ in toolbar.h -----------------------------
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1675
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1676 struct toolbar_button
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1677 {
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1678 NORMAL_LISP_OBJECT_HEADER header;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1679
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1680 Lisp_Object next;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1681 Lisp_Object frame;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1682
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1683 Lisp_Object up_glyph;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1684 Lisp_Object down_glyph;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1685 Lisp_Object disabled_glyph;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1686
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1687 Lisp_Object cap_up_glyph;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1688 Lisp_Object cap_down_glyph;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1689 Lisp_Object cap_disabled_glyph;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1690
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1691 Lisp_Object callback;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1692 Lisp_Object enabled_p;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1693 Lisp_Object help_string;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1694
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1695 char enabled;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1696 char down;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1697 char pushright;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1698 char blank;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1699
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1700 int x, y;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1701 int width, height;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1702 int dirty;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1703 int vertical;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1704 int border_width;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1705 };
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1706
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1707 [[ the standard junk: ]]
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1708
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1709 DECLARE_LISP_OBJECT (toolbar_button, struct toolbar_button);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1710 #define XTOOLBAR_BUTTON(x) XRECORD (x, toolbar_button, struct toolbar_button)
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1711 #define wrap_toolbar_button(p) wrap_record (p, toolbar_button)
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1712 #define TOOLBAR_BUTTONP(x) RECORDP (x, toolbar_button)
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1713 #define CHECK_TOOLBAR_BUTTON(x) CHECK_RECORD (x, toolbar_button)
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1714 #define CONCHECK_TOOLBAR_BUTTON(x) CONCHECK_RECORD (x, toolbar_button)
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1715
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1716 ------------------------------ in toolbar.c -----------------------------
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1717
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1718 #include "toolbar.h"
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1719
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1720 ...
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1721
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1722 static const struct memory_description toolbar_button_description [] = {
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1723 { XD_LISP_OBJECT, offsetof (struct toolbar_button, next) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1724 { XD_LISP_OBJECT, offsetof (struct toolbar_button, frame) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1725 { XD_LISP_OBJECT, offsetof (struct toolbar_button, up_glyph) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1726 { XD_LISP_OBJECT, offsetof (struct toolbar_button, down_glyph) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1727 { XD_LISP_OBJECT, offsetof (struct toolbar_button, disabled_glyph) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1728 { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_up_glyph) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1729 { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_down_glyph) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1730 { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_disabled_glyph) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1731 { XD_LISP_OBJECT, offsetof (struct toolbar_button, callback) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1732 { XD_LISP_OBJECT, offsetof (struct toolbar_button, enabled_p) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1733 { XD_LISP_OBJECT, offsetof (struct toolbar_button, help_string) },
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1734 { XD_END }
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1735 };
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1736
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1737 static Lisp_Object
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1738 allocate_toolbar_button (struct frame *f, int pushright)
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1739 {
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1740 struct toolbar_button *tb;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1741
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1742 tb = XTOOLBAR_BUTTON (ALLOC_NORMAL_LISP_OBJECT (toolbar_button));
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1743 tb->next = Qnil;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1744 tb->frame = wrap_frame (f);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1745 tb->up_glyph = Qnil;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1746 tb->down_glyph = Qnil;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1747 tb->disabled_glyph = Qnil;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1748 tb->cap_up_glyph = Qnil;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1749 tb->cap_down_glyph = Qnil;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1750 tb->cap_disabled_glyph = Qnil;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1751 tb->callback = Qnil;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1752 tb->enabled_p = Qnil;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1753 tb->help_string = Qnil;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1754
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1755 tb->pushright = pushright;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1756 tb->x = tb->y = tb->width = tb->height = -1;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1757 tb->dirty = 1;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1758
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1759 return wrap_toolbar_button (tb);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1760 }
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1761
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1762 static Lisp_Object
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1763 mark_toolbar_button (Lisp_Object obj)
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1764 {
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1765 struct toolbar_button *data = XTOOLBAR_BUTTON (obj);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1766 mark_object (data->next);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1767 mark_object (data->frame);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1768 mark_object (data->up_glyph);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1769 mark_object (data->down_glyph);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1770 mark_object (data->disabled_glyph);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1771 mark_object (data->cap_up_glyph);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1772 mark_object (data->cap_down_glyph);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1773 mark_object (data->cap_disabled_glyph);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1774 mark_object (data->callback);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1775 mark_object (data->enabled_p);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1776 return data->help_string;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1777 }
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1778
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1779 DEFINE_NODUMP_LISP_OBJECT ("toolbar-button", toolbar_button,
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1780 mark_toolbar_button,
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1781 external_object_printer, 0, 0, 0,
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1782 toolbar_button_description,
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1783 struct toolbar_button);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1784
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1785 ...
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1786
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1787 void
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1788 syms_of_toolbar (void)
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1789 {
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1790 INIT_LISP_OBJECT (toolbar_button);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1791
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1792 ...;
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1793 }
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1794
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1795 ------------------------------ in inline.c -----------------------------
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1796
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1797 #ifdef HAVE_TOOLBARS
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1798 #include "toolbar.h"
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1799 #endif
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1800
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1801 ------------------------------ in lrecord.h -----------------------------
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1802
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1803 enum lrecord_type
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1804 {
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1805 ...
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1806 lrecord_type_toolbar_button,
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1807 ...
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1808 };
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1809
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1810 ------------------------------ in .gdbinit.in.in -----------------------------
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1811
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1812 ...
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1813 else
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1814 if $lrecord_type == lrecord_type_toolbar_button
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1815 pstructtype toolbar_button
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1816 ...
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1817 ...
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1818 ...
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1819 end
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1820
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1821 --ben
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1822
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1823 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1824
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1825 /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1826
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1827 Note: Object types defined in external dynamically-loaded modules (not
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1828 part of the XEmacs main source code) should use DECLARE_*_MODULE_LISP_OBJECT
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1829 and DEFINE_*_MODULE_LISP_OBJECT rather than DECLARE_*_LISP_OBJECT
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1830 and DEFINE_*_LISP_OBJECT. The MODULE versions declare and
3029
986cd22006a9 [xemacs-hg @ 2005-10-26 13:01:37 by stephent]
stephent
parents: 3024
diff changeset
1831 allocate an enumerator for the type being defined.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1832
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1833 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1834
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1835
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1836 #ifdef ERROR_CHECK_TYPES
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1837
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1838 # define DECLARE_LISP_OBJECT(c_name, structtype) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1839 extern struct lrecord_implementation lrecord_##c_name; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1840 DECLARE_INLINE_HEADER ( \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1841 structtype * \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1842 error_check_##c_name (Lisp_Object obj, const Ascbyte *file, int line) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1843 ) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1844 { \
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1845 assert_at_line (RECORD_TYPEP (obj, lrecord_type_##c_name), file, line); \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1846 return (structtype *) XPNTR (obj); \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1847 } \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848 extern Lisp_Object Q##c_name##p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1849
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1850 # define DECLARE_MODULE_API_LISP_OBJECT(c_name, structtype) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1851 extern MODULE_API struct lrecord_implementation lrecord_##c_name; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1852 DECLARE_INLINE_HEADER ( \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1853 structtype * \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1854 error_check_##c_name (Lisp_Object obj, const Ascbyte *file, int line) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1855 ) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1856 { \
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1429
diff changeset
1857 assert_at_line (RECORD_TYPEP (obj, lrecord_type_##c_name), file, line); \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1858 return (structtype *) XPNTR (obj); \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1859 } \
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1429
diff changeset
1860 extern MODULE_API Lisp_Object Q##c_name##p
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1429
diff changeset
1861
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1862 # define DECLARE_MODULE_LISP_OBJECT(c_name, structtype) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1863 extern int lrecord_type_##c_name; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1864 extern struct lrecord_implementation lrecord_##c_name; \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1865 DECLARE_INLINE_HEADER ( \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1866 structtype * \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1867 error_check_##c_name (Lisp_Object obj, const Ascbyte *file, int line) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1868 ) \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1869 { \
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1870 assert_at_line (RECORD_TYPEP (obj, lrecord_type_##c_name), file, line); \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1871 return (structtype *) XPNTR (obj); \
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1872 } \
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1873 extern Lisp_Object Q##c_name##p
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1874
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1875 # define XRECORD(x, c_name, structtype) \
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1876 error_check_##c_name (x, __FILE__, __LINE__)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1877
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 814
diff changeset
1878 DECLARE_INLINE_HEADER (
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 814
diff changeset
1879 Lisp_Object
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
1880 wrap_record_1 (const void *ptr, enum lrecord_type ty, const Ascbyte *file,
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1881 int line)
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 814
diff changeset
1882 )
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 462
diff changeset
1883 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1884 Lisp_Object obj = wrap_pointer_1 (ptr);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
1885
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1886 assert_at_line (RECORD_TYPEP (obj, ty), file, line);
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 462
diff changeset
1887 return obj;
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 462
diff changeset
1888 }
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 462
diff changeset
1889
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1890 #define wrap_record(ptr, ty) \
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1891 wrap_record_1 (ptr, lrecord_type_##ty, __FILE__, __LINE__)
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 462
diff changeset
1892
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1893 #else /* not ERROR_CHECK_TYPES */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1894
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1895 # define DECLARE_LISP_OBJECT(c_name, structtype) \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1896 extern Lisp_Object Q##c_name##p; \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1897 extern struct lrecord_implementation lrecord_##c_name
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1898 # define DECLARE_MODULE_API_LISP_OBJECT(c_name, structtype) \
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1899 extern MODULE_API Lisp_Object Q##c_name##p; \
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
1900 extern MODULE_API struct lrecord_implementation lrecord_##c_name
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
1901 # define DECLARE_MODULE_LISP_OBJECT(c_name, structtype) \
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1902 extern Lisp_Object Q##c_name##p; \
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 617
diff changeset
1903 extern int lrecord_type_##c_name; \
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1904 extern struct lrecord_implementation lrecord_##c_name
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 # define XRECORD(x, c_name, structtype) ((structtype *) XPNTR (x))
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 462
diff changeset
1906 /* wrap_pointer_1 is so named as a suggestion not to use it unless you
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 462
diff changeset
1907 know what you're doing. */
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 462
diff changeset
1908 #define wrap_record(ptr, ty) wrap_pointer_1 (ptr)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1910 #endif /* not ERROR_CHECK_TYPES */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1912 #define RECORDP(x, c_name) RECORD_TYPEP (x, lrecord_type_##c_name)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1913
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1914 /* Note: we now have two different kinds of type-checking macros.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1915 The "old" kind has now been renamed CONCHECK_foo. The reason for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1916 this is that the CONCHECK_foo macros signal a continuable error,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1917 allowing the user (through debug-on-error) to substitute a different
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1918 value and return from the signal, which causes the lvalue argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1919 to get changed. Quite a lot of code would crash if that happened,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1920 because it did things like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1921
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1922 foo = XCAR (list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923 CHECK_STRING (foo);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 and later on did XSTRING (XCAR (list)), assuming that the type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1926 is correct (when it might be wrong, if the user substituted a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1927 correct value in the debugger).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929 To get around this, I made all the CHECK_foo macros signal a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 non-continuable error. Places where a continuable error is OK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1931 (generally only when called directly on the argument of a Lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1932 primitive) should be changed to use CONCHECK().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1933
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1934 FSF Emacs does not have this problem because RMS took the cheesy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 way out and disabled returning from a signal entirely. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937 #define CONCHECK_RECORD(x, c_name) do { \
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1938 if (!RECORD_TYPEP (x, lrecord_type_##c_name)) \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1939 x = wrong_type_argument (Q##c_name##p, x); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 #define CONCHECK_NONRECORD(x, lisp_enum, predicate) do {\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942 if (XTYPE (x) != lisp_enum) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1943 x = wrong_type_argument (predicate, x); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1944 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1945 #define CHECK_RECORD(x, c_name) do { \
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1946 if (!RECORD_TYPEP (x, lrecord_type_##c_name)) \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1947 dead_wrong_type_argument (Q##c_name##p, x); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1948 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1949 #define CHECK_NONRECORD(x, lisp_enum, predicate) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1950 if (XTYPE (x) != lisp_enum) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1951 dead_wrong_type_argument (predicate, x); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1952 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1953
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
1954 #ifndef NEW_GC
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1955 /*-------------------------- lcrecord-list -----------------------------*/
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1956
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1957 struct lcrecord_list
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1958 {
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1959 NORMAL_LISP_OBJECT_HEADER header;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1960 Lisp_Object free;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1961 Elemcount size;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1962 const struct lrecord_implementation *implementation;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1963 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1964
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
1965 DECLARE_LISP_OBJECT (lcrecord_list, struct lcrecord_list);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1966 #define XLCRECORD_LIST(x) XRECORD (x, lcrecord_list, struct lcrecord_list)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1967 #define wrap_lcrecord_list(p) wrap_record (p, lcrecord_list)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1968 #define LCRECORD_LISTP(x) RECORDP (x, lcrecord_list)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1969 /* #define CHECK_LCRECORD_LIST(x) CHECK_RECORD (x, lcrecord_list)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1970 Lcrecord lists should never escape to the Lisp level, so
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1971 functions should not be doing this. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1972
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 814
diff changeset
1973 /* Various ways of allocating lcrecords. All bytes (except lcrecord
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1974 header) are zeroed in returned structure.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1975
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1976 See above for a discussion of the difference between plain lrecords and
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1977 lrecords. lcrecords themselves are divided into three types: (1)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1978 auto-managed, (2) hand-managed, and (3) unmanaged. "Managed" refers to
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1979 using a special object called an lcrecord-list to keep track of freed
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1980 lcrecords, which can freed with free_normal_lisp_object() or the like
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1981 and later be recycled when a new lcrecord is required, rather than
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1982 requiring new malloc(). Thus, allocation of lcrecords can be very
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1983 cheap. (Technically, the lcrecord-list manager could divide up large
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1984 chunks of memory and allocate out of that, mimicking what happens with
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1985 lrecords. At that point, however, we'd want to rethink the whole
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1986 division between lrecords and lcrecords.)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1987
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1988 NOTE: There is a fundamental limitation of lcrecord-lists, which is that
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1989 they only handle blocks of a particular, fixed size. Thus, objects that
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1990 can be of varying sizes need to do various tricks. These considerations
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1991 in particular dictate the various types of management:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1992
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1993 -- "Auto-managed" means that you just go ahead and allocate the lcrecord
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1994 whenever you want, using ALLOC_NORMAL_LISP_OBJECT(), and the appropriate
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1995 lcrecord-list manager is automatically created. To free, you just call
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
1996 "free_normal_lisp_object()" and the appropriate lcrecord-list manager is
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1997 automatically located and called. The limitation here of course is that
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1998 all your objects are of the same size. (#### Eventually we should have a
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
1999 more sophisticated system that tracks the sizes seen and creates one
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2000 lcrecord list per size, indexed in a hash table. Usually there are only
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2001 a limited number of sizes, so this works well.)
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 814
diff changeset
2002
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2003 -- "Hand-managed" exists because we haven't yet written the more
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2004 sophisticated scheme for auto-handling different-sized lcrecords, as
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2005 described in the end of the last paragraph. In this model, you go ahead
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2006 and create the lcrecord-list objects yourself for the sizes you will
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2007 need, using make_lcrecord_list(). Then, create lcrecords using
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2008 alloc_managed_lcrecord(), passing in the lcrecord-list you created, and
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2009 free them with free_managed_lcrecord().
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2010
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2011 -- "Unmanaged" means you simply allocate lcrecords, period. No
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2012 lcrecord-lists, no way to free them. This may be suitable when the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2013 lcrecords are variable-sized and (a) you're too lazy to write the code
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2014 to hand-manage them, or (b) the objects you create are always or almost
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2015 always Lisp-visible, and thus there's no point in freeing them (and it
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2016 wouldn't be safe to do so). You just create them with
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2017 ALLOC_SIZED_LISP_OBJECT(), and that's it.
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2018
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2019 --ben
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2020
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2021 Here is an in-depth look at the steps required to create a allocate an
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2022 lcrecord using the hand-managed style. Since this is the most
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2023 complicated, you will learn a lot about the other styles as well. In
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2024 addition, there is useful general information about what freeing an
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2025 lcrecord really entails, and what are the precautions:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2026
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2027 1) Create an lcrecord-list object using make_lcrecord_list(). This is
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2028 often done at initialization. Remember to staticpro_nodump() this
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2029 object! The arguments to make_lcrecord_list() are the same as would be
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2030 passed to ALLOC_SIZED_LISP_OBJECT().
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2031
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2032 2) Instead of calling ALLOC_SIZED_LISP_OBJECT(), call
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2033 alloc_managed_lcrecord() and pass the lcrecord-list earlier created.
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2034
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2035 3) When done with the lcrecord, call free_managed_lcrecord(). The
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2036 standard freeing caveats apply: ** make sure there are no pointers to
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2037 the object anywhere! **
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2038
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2039 4) Calling free_managed_lcrecord() is just like kissing the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2040 lcrecord goodbye as if it were garbage-collected. This means:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2041 -- the contents of the freed lcrecord are undefined, and the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2042 contents of something produced by alloc_managed_lcrecord()
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2043 are undefined, just like for ALLOC_SIZED_LISP_OBJECT().
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2044 -- the mark method for the lcrecord's type will *NEVER* be called
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2045 on freed lcrecords.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2046 -- the finalize method for the lcrecord's type will be called
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2047 at the time that free_managed_lcrecord() is called.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2048 */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2049
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2050 /* UNMANAGED MODEL: */
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2051 Lisp_Object old_alloc_lcrecord (const struct lrecord_implementation *);
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2052 Lisp_Object old_alloc_sized_lcrecord (Bytecount size,
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2053 const struct lrecord_implementation *);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2054
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2055 /* HAND-MANAGED MODEL: */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2056 Lisp_Object make_lcrecord_list (Elemcount size,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2057 const struct lrecord_implementation
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2058 *implementation);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2059 Lisp_Object alloc_managed_lcrecord (Lisp_Object lcrecord_list);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2060 void free_managed_lcrecord (Lisp_Object lcrecord_list, Lisp_Object lcrecord);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2061
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2062 /* AUTO-MANAGED MODEL: */
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2063 MODULE_API Lisp_Object
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
2064 alloc_automanaged_sized_lcrecord (Bytecount size,
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
2065 const struct lrecord_implementation *imp);
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
2066 MODULE_API Lisp_Object
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
2067 alloc_automanaged_lcrecord (const struct lrecord_implementation *imp);
3017
1e7cc382eb16 [xemacs-hg @ 2005-10-24 10:07:26 by ben]
ben
parents: 2994
diff changeset
2068
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2069 #define old_alloc_lcrecord_type(type, imp) \
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2070 ((type *) XPNTR (alloc_automanaged_lcrecord (sizeof (type), imp)))
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
2071
3024
b7f26b2f78bd [xemacs-hg @ 2005-10-25 08:32:40 by ben]
ben
parents: 3017
diff changeset
2072 void old_free_lcrecord (Lisp_Object rec);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2073
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
2074 #else /* NEW_GC */
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
2075
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
2076 MODULE_API Lisp_Object alloc_sized_lrecord (Bytecount size,
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
2077 const struct lrecord_implementation *imp);
5117
3742ea8250b5 Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents: 3063
diff changeset
2078 Lisp_Object noseeum_alloc_sized_lrecord (Bytecount size,
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
2079 const struct lrecord_implementation *imp);
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
2080 MODULE_API Lisp_Object alloc_lrecord (const struct lrecord_implementation *imp);
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
2081 Lisp_Object noseeum_alloc_lrecord (const struct lrecord_implementation *imp);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3063
diff changeset
2082
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
2083 MODULE_API Lisp_Object alloc_lrecord_array (int elemcount,
5118
e0db3c197671 merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents: 5117 4677
diff changeset
2084 const struct lrecord_implementation *imp);
5120
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
2085 MODULE_API Lisp_Object alloc_sized_lrecord_array (Bytecount size,
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
2086 int elemcount,
d1247f3cc363 latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents: 5118
diff changeset
2087 const struct lrecord_implementation *imp);
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
2088
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
2089 #endif /* NEW_GC */
3017
1e7cc382eb16 [xemacs-hg @ 2005-10-24 10:07:26 by ben]
ben
parents: 2994
diff changeset
2090
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2091 DECLARE_INLINE_HEADER (
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2092 Bytecount
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2093 detagged_lisp_object_size (const struct lrecord_header *h)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2094 )
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2095 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2096 const struct lrecord_implementation *imp = LHEADER_IMPLEMENTATION (h);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2097
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2098 return (imp->size_in_bytes_method ?
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
2099 imp->size_in_bytes_method (wrap_pointer_1 (h)) :
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2100 imp->static_size);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2101 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2102
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2103 DECLARE_INLINE_HEADER (
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2104 Bytecount
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2105 lisp_object_size (Lisp_Object o)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2106 )
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2107 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2108 return detagged_lisp_object_size (XRECORD_LHEADER (o));
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2109 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2110
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
2111 struct usage_stats;
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
2112
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
2113 MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
2114 MODULE_API void zero_sized_lisp_object (Lisp_Object obj, Bytecount size);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
2115 MODULE_API void zero_nonsized_lisp_object (Lisp_Object obj);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
2116 Bytecount lisp_object_storage_size (Lisp_Object obj,
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 5146
diff changeset
2117 struct usage_stats *ustats);
5170
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
2118 Bytecount lisp_object_memory_usage_full (Lisp_Object object,
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
2119 Bytecount *storage_size,
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
2120 Bytecount *extra_nonlisp_storage,
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
2121 Bytecount *extra_lisp_storage,
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
2122 struct generic_usage_stats *stats);
5ddbab03b0e6 various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents: 5169
diff changeset
2123 Bytecount lisp_object_memory_usage (Lisp_Object object);
5179
14fda1dbdb26 add memory usage info for specifiers
Ben Wing <ben@xemacs.org>
parents: 5170
diff changeset
2124 Bytecount tree_memory_usage (Lisp_Object arg, int vectorp);
5127
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
2125 void free_normal_lisp_object (Lisp_Object obj);
a9c41067dd88 more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents: 5126
diff changeset
2126
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2127
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2128 /************************************************************************/
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2129 /* Dumping */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2130 /************************************************************************/
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2131
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2132 /* dump_add_root_block_ptr (&var, &desc) dumps the structure pointed to by
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2133 `var'. This is for a single relocatable pointer located in the data
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2134 segment (i.e. the block pointed to is in the heap).
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2135
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2136 If the structure pointed to is not a `struct' but an array, you should
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2137 set the size field of the sized_memory_description to 0, and use
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2138 XD_BLOCK_ARRAY in the inner memory_description.
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2139
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2140 NOTE that a "root struct pointer" could also be described using
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2141 dump_add_root_block(), with SIZE == sizeof (void *), and a description
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2142 containing a single XD_BLOCK_PTR entry, offset 0, size 1, with a
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2143 structure description the same as the value passed to
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2144 dump_add_root_block_ptr(). That would require an extra level of
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2145 description, though, as compared to using dump_add_root_block_ptr(),
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2146 and thus this function is generally more convenient.
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2147 */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2148 #ifdef PDUMP
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2149 void dump_add_root_block_ptr (void *, const struct sized_memory_description *);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2150 #else
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2151 #define dump_add_root_block_ptr(varaddr, descaddr) DO_NOTHING
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2152 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2153
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2154 /* dump_add_opaque (&var, size) dumps the opaque static structure `var'.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2155 This is for a static block of memory (in the data segment, not the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2156 heap), with no relocatable pointers in it. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2157 #ifdef PDUMP
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2158 #define dump_add_opaque(varaddr,size) dump_add_root_block (varaddr, size, NULL)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2159 #else
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2160 #define dump_add_opaque(varaddr,size) DO_NOTHING
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2161 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2162
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2163 /* dump_add_root_block (ptr, size, desc) dumps the static structure
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2164 located at `var' of size SIZE and described by DESC. This is for a
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2165 static block of memory (in the data segment, not the heap), with
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2166 relocatable pointers in it. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2167 #ifdef PDUMP
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2168 void dump_add_root_block (const void *ptraddress, Bytecount size,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2169 const struct memory_description *desc);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2170 #else
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2171 #define dump_add_root_block(ptraddress, size, desc) DO_NOTHING
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2172 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2173
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2174 /* Call dump_add_opaque_int (&int_var) to dump `int_var', of type `int'. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2175 #ifdef PDUMP
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2176 #define dump_add_opaque_int(int_varaddr) do { \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2177 int *dao_ = (int_varaddr); /* type check */ \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2178 dump_add_opaque (dao_, sizeof (*dao_)); \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2179 } while (0)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2180 #else
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2181 #define dump_add_opaque_int(int_varaddr) DO_NOTHING
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2182 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2183
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2184 /* Call dump_add_opaque_fixnum (&fixnum_var) to dump `fixnum_var', of type
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2185 `Fixnum'. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2186 #ifdef PDUMP
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2187 #define dump_add_opaque_fixnum(fixnum_varaddr) do { \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2188 Fixnum *dao_ = (fixnum_varaddr); /* type check */ \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2189 dump_add_opaque (dao_, sizeof (*dao_)); \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2190 } while (0)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2191 #else
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2192 #define dump_add_opaque_fixnum(fixnum_varaddr) DO_NOTHING
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2193 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2194
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2195 /* Call dump_add_root_lisp_object (&var) to ensure that var is properly
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2196 updated after pdump. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2197 #ifdef PDUMP
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2198 void dump_add_root_lisp_object (Lisp_Object *);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2199 #else
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2200 #define dump_add_root_lisp_object(varaddr) DO_NOTHING
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2201 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2202
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2203 /* Call dump_add_weak_lisp_object (&var) to ensure that var is properly
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2204 updated after pdump. var must point to a linked list of objects out of
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2205 which some may not be dumped */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2206 #ifdef PDUMP
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2207 void dump_add_weak_object_chain (Lisp_Object *);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2208 #else
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2209 #define dump_add_weak_object_chain(varaddr) DO_NOTHING
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2210 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2211
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2212 /* Nonzero means Emacs has already been initialized.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2213 Used during startup to detect startup of dumped Emacs. */
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1429
diff changeset
2214 extern MODULE_API int initialized;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2215
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2216 #ifdef PDUMP
1688
034a2ddf5b6b [xemacs-hg @ 2003-09-16 03:57:54 by james]
james
parents: 1676
diff changeset
2217 #include "dumper.h"
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
2218 #ifdef NEW_GC
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2551
diff changeset
2219 #define DUMPEDP(adr) 0
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
2220 #else /* not NEW_GC */
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2221 #define DUMPEDP(adr) ((((Rawbyte *) (adr)) < pdump_end) && \
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2222 (((Rawbyte *) (adr)) >= pdump_start))
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3100
diff changeset
2223 #endif /* not NEW_GC */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2224 #else
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2225 #define DUMPEDP(adr) 0
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2226 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2227
1330
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 1204
diff changeset
2228 #define OBJECT_DUMPED_P(obj) DUMPEDP (XPNTR (obj))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 1204
diff changeset
2229
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2230 /***********************************************************************/
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2231 /* data descriptions */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2232 /***********************************************************************/
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2233
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2234
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2235 #if defined (USE_KKCC) || defined (PDUMP)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2236
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2237 extern int in_pdump;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2238
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2239 EMACS_INT lispdesc_indirect_count_1 (EMACS_INT code,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2240 const struct memory_description *idesc,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2241 const void *idata);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2242 const struct sized_memory_description *lispdesc_indirect_description_1
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2243 (const void *obj, const struct sized_memory_description *sdesc);
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2244 Bytecount lispdesc_block_size_1 (const void *obj, Bytecount size,
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2245 const struct memory_description *desc);
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2246
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2247 DECLARE_INLINE_HEADER (
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2248 Bytecount lispdesc_block_size (const void *obj,
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2249 const struct sized_memory_description *sdesc))
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2250 {
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2251 return lispdesc_block_size_1 (obj, sdesc->size, sdesc->description);
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1983
diff changeset
2252 }
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2253
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2254 DECLARE_INLINE_HEADER (
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2255 EMACS_INT
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2256 lispdesc_indirect_count (EMACS_INT code,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2257 const struct memory_description *idesc,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2258 const void *idata)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2259 )
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2260 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2261 if (XD_IS_INDIRECT (code))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2262 code = lispdesc_indirect_count_1 (code, idesc, idata);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2263 return code;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2264 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2265
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2266 DECLARE_INLINE_HEADER (
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2267 const struct sized_memory_description *
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2268 lispdesc_indirect_description (const void *obj,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2269 const struct sized_memory_description *sdesc)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2270 )
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2271 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2272 if (sdesc->description)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2273 return sdesc;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2274 else
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2275 return lispdesc_indirect_description_1 (obj, sdesc);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2276 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2277
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2278
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2279 /* Do standard XD_UNION processing. DESC1 is an entry in DESC, which
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2280 describes the entire data structure. Returns NULL (do nothing, nothing
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2281 matched), or a new value for DESC1. In the latter case, assign to DESC1
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2282 in your function and goto union_switcheroo. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2283
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2284 DECLARE_INLINE_HEADER (
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2285 const struct memory_description *
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2286 lispdesc_process_xd_union (const struct memory_description *desc1,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2287 const struct memory_description *desc,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2288 const void *data)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2289 )
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2290 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2291 int count = 0;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2292 EMACS_INT variant = lispdesc_indirect_count (desc1->data1, desc,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2293 data);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2294 desc1 =
2551
9f70af3ac939 [xemacs-hg @ 2005-02-03 16:14:02 by james]
james
parents: 2515
diff changeset
2295 lispdesc_indirect_description (data, desc1->data2.descr)->description;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2296
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2297 for (count = 0; desc1[count].type != XD_END; count++)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2298 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2299 if ((desc1[count].flags & XD_FLAG_UNION_DEFAULT_ENTRY) ||
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2300 desc1[count].offset == variant)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2301 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2302 return &desc1[count];
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2303 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2304 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2305
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2306 return NULL;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2307 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2308
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 996
diff changeset
2309 #endif /* defined (USE_KKCC) || defined (PDUMP) */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2310
1743
543769b89fed [xemacs-hg @ 2003-10-14 05:02:57 by james]
james
parents: 1688
diff changeset
2311 END_C_DECLS
1650
34abfb24e891 [xemacs-hg @ 2003-08-28 15:44:04 by james]
james
parents: 1638
diff changeset
2312
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
2313 #endif /* INCLUDED_lrecord_h_ */