annotate src/opaque.c @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents 8eaf7971accc
children 557eaa0339bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Opaque Lisp objects.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994, 1995 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995, 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* Written by Ben Wing, October 1993. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 /* "Opaque" is used internally to hold keep track of allocated memory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 so it gets GC'd properly, and to store arbitrary data in places
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 where a Lisp_Object is required and which may get GC'd. (e.g. as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 the argument to record_unwind_protect()). Once created in C,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 opaque objects cannot be resized.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 OPAQUE OBJECTS SHOULD NEVER ESCAPE TO THE LISP LEVEL. Some code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 depends on this. As such, opaque objects are a generalization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 of the Qunbound marker.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 "Opaque lists" are used to keep track of lots of opaque objects
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 of a particular size so that they can be efficiently "freed" and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 re-used again without actually entering the Lisp allocation system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (and consequently doing a malloc()).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #include "opaque.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 Lisp_Object Qopaquep;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 static int in_opaque_list_marking;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 /* Holds freed opaque objects created with make_opaque_ptr().
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 We do this quite often so it's a noticeable win if we don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 create GC junk. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 Lisp_Object Vopaque_ptr_free_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 static Lisp_Object mark_opaque (Lisp_Object, void (*) (Lisp_Object));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 static unsigned int sizeof_opaque (CONST void *header);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 static void print_opaque (Lisp_Object obj, Lisp_Object printcharfun,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 int escapeflag);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("opaque", opaque,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 mark_opaque, print_opaque, 0, 0, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 sizeof_opaque, struct Lisp_Opaque);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 mark_opaque (Lisp_Object obj, void (*markobj) (Lisp_Object))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 #ifdef ERROR_CHECK_GC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 if (!in_opaque_list_marking)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 /* size is non-int for objects on an opaque free list. We sure
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 as hell better not be marking any of these objects unless
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 we're marking an opaque list. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 assert (INTP (XOPAQUE (obj)->size_or_chain));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 /* marking an opaque on the free list doesn't do any recursive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 markings, so we better not have non-freed opaques on a free
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 list. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 assert (!INTP (XOPAQUE (obj)->size_or_chain));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 if (INTP (XOPAQUE (obj)->size_or_chain) && XOPAQUE_MARKFUN (obj))
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 0
diff changeset
79 return XOPAQUE_MARKFUN (obj) (obj, markobj);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 return XOPAQUE (obj)->size_or_chain;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 /* Should never, ever be called. (except by an external debugger) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 print_opaque (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 char buf[200];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 if (INTP (XOPAQUE (obj)->size_or_chain))
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 0
diff changeset
90 sprintf (buf, "#<INTERNAL EMACS BUG (opaque, size=%ld) 0x%p>",
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 0
diff changeset
91 (long) XOPAQUE_SIZE (obj), (void *) XPNTR (obj));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 else
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 0
diff changeset
93 sprintf (buf, "#<INTERNAL EMACS BUG (opaque, freed) 0x%p>",
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 0
diff changeset
94 (void *) XPNTR (obj));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 static unsigned int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 sizeof_opaque (CONST void *header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 CONST struct Lisp_Opaque *p = (CONST struct Lisp_Opaque *) header;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 if (!INTP (p->size_or_chain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 return sizeof (*p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 return sizeof (*p) + XINT (p->size_or_chain) - sizeof (int);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 make_opaque (int size, CONST void *data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
110 struct Lisp_Opaque *p = (struct Lisp_Opaque *)
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
111 alloc_lcrecord (sizeof (*p) + size - sizeof (int), lrecord_opaque);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 Lisp_Object val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 p->markfun = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 p->size_or_chain = make_int (size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 if (data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 memcpy (p->data, data, size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 memset (p->data, 0, size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 XSETOPAQUE (val, p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 static Lisp_Object mark_opaque_list (Lisp_Object, void (*) (Lisp_Object));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 DEFINE_LRECORD_IMPLEMENTATION ("opaque-list", opaque_list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 mark_opaque_list, internal_object_printer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 0, 0, 0, struct Lisp_Opaque_List);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 mark_opaque_list (Lisp_Object obj, void (*markobj) (Lisp_Object))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 in_opaque_list_marking++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (markobj) (XOPAQUE_LIST (obj)->free);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 in_opaque_list_marking--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 make_opaque_list (int size,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 Lisp_Object (*markfun) (Lisp_Object obj,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 void (*markobj) (Lisp_Object)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 Lisp_Object val = Qnil;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
144 struct Lisp_Opaque_List *p =
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
145 alloc_lcrecord_type (struct Lisp_Opaque_List, lrecord_opaque_list);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 p->markfun = markfun;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 p->size = size;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 p->free = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 XSETOPAQUE_LIST (val, p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 allocate_managed_opaque (Lisp_Object opaque_list, CONST void *data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 struct Lisp_Opaque_List *li = XOPAQUE_LIST (opaque_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 Lisp_Object val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 if (!NILP (li->free))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 val = li->free;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 li->free = XOPAQUE (val)->size_or_chain;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 #ifdef ERROR_CHECK_GC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 assert (NILP (li->free) || OPAQUEP (li->free));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 XOPAQUE (val)->size_or_chain = make_int (li->size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 if (data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 memcpy (XOPAQUE (val)->data, data, li->size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 memset (XOPAQUE (val)->data, 0, li->size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 val = make_opaque (li->size, data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 XOPAQUE (val)->markfun = li->markfun;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 free_managed_opaque (Lisp_Object opaque_list, Lisp_Object opaque)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 struct Lisp_Opaque_List *li = XOPAQUE_LIST (opaque_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 #ifdef ERROR_CHECK_GC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 assert (INTP (XOPAQUE (opaque)->size_or_chain));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 XOPAQUE (opaque)->size_or_chain = li->free;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 li->free = opaque;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 /* stuff to handle opaque pointers */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 make_opaque_ptr (CONST void *val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 return allocate_managed_opaque (Vopaque_ptr_free_list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (CONST void *) &val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 /* Be wery wery careful with this. Same admonitions as with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 free_cons() apply. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 free_opaque_ptr (Lisp_Object ptr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 free_managed_opaque (Vopaque_ptr_free_list, ptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 make_opaque_long (long val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 return make_opaque (sizeof (val), (void *) &val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 init_opaque_once_early (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 Vopaque_ptr_free_list = make_opaque_list (sizeof (void *), 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 staticpro (&Vopaque_ptr_free_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 }