annotate src/opaque.c @ 158:558dfa75ffb3

Added tag r20-3b5 for changeset 6b37e6ddd302
author cvs
date Mon, 13 Aug 2007 09:40:48 +0200
parents 376386a54a3c
children 8eaf7971accc
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))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 return (XOPAQUE_MARKFUN (obj)) (obj, markobj);
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))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 sprintf (buf, "#<INTERNAL EMACS BUG (opaque, size=%d) 0x%x>",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (EMACS_INT) XOPAQUE_SIZE (obj),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (EMACS_INT) XPNTR (obj));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 sprintf (buf, "#<INTERNAL EMACS BUG (opaque, freed) 0x%x>",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (EMACS_INT) XPNTR (obj));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 static unsigned int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 sizeof_opaque (CONST void *header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 CONST struct Lisp_Opaque *p = (CONST struct Lisp_Opaque *) header;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 if (!INTP (p->size_or_chain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 return sizeof (*p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 return sizeof (*p) + XINT (p->size_or_chain) - sizeof (int);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 make_opaque (int size, CONST void *data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 struct Lisp_Opaque *p = alloc_lcrecord (sizeof (*p) + size - sizeof (int),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 lrecord_opaque);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 Lisp_Object val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 p->markfun = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 p->size_or_chain = make_int (size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 if (data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 memcpy (p->data, data, size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 memset (p->data, 0, size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 XSETOPAQUE (val, p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 static Lisp_Object mark_opaque_list (Lisp_Object, void (*) (Lisp_Object));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 DEFINE_LRECORD_IMPLEMENTATION ("opaque-list", opaque_list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 mark_opaque_list, internal_object_printer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 0, 0, 0, struct Lisp_Opaque_List);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 mark_opaque_list (Lisp_Object obj, void (*markobj) (Lisp_Object))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 in_opaque_list_marking++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (markobj) (XOPAQUE_LIST (obj)->free);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 in_opaque_list_marking--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 make_opaque_list (int size,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 Lisp_Object (*markfun) (Lisp_Object obj,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 void (*markobj) (Lisp_Object)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 struct Lisp_Opaque_List *p = alloc_lcrecord (sizeof (*p),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 lrecord_opaque_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 Lisp_Object val = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 p->markfun = markfun;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 p->size = size;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 p->free = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 XSETOPAQUE_LIST (val, p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 allocate_managed_opaque (Lisp_Object opaque_list, CONST void *data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 struct Lisp_Opaque_List *li = XOPAQUE_LIST (opaque_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 Lisp_Object val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 if (!NILP (li->free))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 val = li->free;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 li->free = XOPAQUE (val)->size_or_chain;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 #ifdef ERROR_CHECK_GC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 assert (NILP (li->free) || OPAQUEP (li->free));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 XOPAQUE (val)->size_or_chain = make_int (li->size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 if (data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 memcpy (XOPAQUE (val)->data, data, li->size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 memset (XOPAQUE (val)->data, 0, li->size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 val = make_opaque (li->size, data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 XOPAQUE (val)->markfun = li->markfun;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 free_managed_opaque (Lisp_Object opaque_list, Lisp_Object opaque)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 struct Lisp_Opaque_List *li = XOPAQUE_LIST (opaque_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 #ifdef ERROR_CHECK_GC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 assert (INTP (XOPAQUE (opaque)->size_or_chain));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 XOPAQUE (opaque)->size_or_chain = li->free;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 li->free = opaque;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 /* stuff to handle opaque pointers */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 make_opaque_ptr (CONST void *val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 return allocate_managed_opaque (Vopaque_ptr_free_list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (CONST void *) &val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 /* Be wery wery careful with this. Same admonitions as with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 free_cons() apply. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 free_opaque_ptr (Lisp_Object ptr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 free_managed_opaque (Vopaque_ptr_free_list, ptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 make_opaque_long (long val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 return make_opaque (sizeof (val), (void *) &val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 init_opaque_once_early (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 Vopaque_ptr_free_list = make_opaque_list (sizeof (void *), 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 staticpro (&Vopaque_ptr_free_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 }