annotate src/lisp-union.h @ 22:8fc7fe29b841 r19-15b94

Import from CVS: tag r19-15b94
author cvs
date Mon, 13 Aug 2007 08:50:29 +0200
parents 376386a54a3c
children 3d6bfa290dbd
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 /* Fundamental definitions for XEmacs Lisp interpreter -- union objects.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Free Software Foundation, Inc.
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: FSF 19.30. Split out from lisp.h. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #if (!!defined (WORDS_BIGENDIAN) != !!defined (LOWTAGS))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 /* Big-endian lowtags, little-endian hightags */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 typedef
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 union Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 struct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 unsigned EMACS_INT type_mark: GCTYPEBITS + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 signed EMACS_INT val: VALBITS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 } s;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 struct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #ifdef __GNUC__ /* Non-ANSI extension */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 enum Lisp_Type type: GCTYPEBITS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 unsigned EMACS_INT type: GCTYPEBITS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #endif /* __GNUC__ */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 /* The markbit is not really part of the value of a Lisp_Object,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 and is always zero except during garbage collection. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 unsigned EMACS_INT markbit: 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 unsigned EMACS_INT val: VALBITS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 } gu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 EMACS_INT i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 /* GCC bites yet again. I fart in the general direction of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 the GCC authors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 This was formerly declared 'void *v' etc. but that causes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 GCC to accept any (yes, any) pointer as the argument of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 a function declared to accept a Lisp_Object. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 struct __nosuchstruct__ *v;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 CONST struct __nosuchstruct__ *cv; /* C wanks */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 Lisp_Object;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 #else /* If WORDS_BIGENDIAN, or little-endian hightags */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 /* Big-endian hightags, little-endian lowtags */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 typedef
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 union Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 struct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 signed EMACS_INT val: VALBITS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 unsigned EMACS_INT mark_type: GCTYPEBITS + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 } s;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 struct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 unsigned EMACS_INT val: VALBITS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 #ifdef __GNUC__ /* Non-ANSI extension */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 enum Lisp_Type type: GCTYPEBITS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 unsigned EMACS_INT type: GCTYPEBITS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 #endif /* __GNUC__ */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 /* The markbit is not really part of the value of a Lisp_Object,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 and is always zero except during garbage collection. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 unsigned EMACS_INT markbit: 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 } gu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 EMACS_INT i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 struct __nosuchstruct__ *v;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 CONST struct __nosuchstruct__ *cv; /* C sucks */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 Lisp_Object;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 #endif /* BIG/LITTLE_ENDIAN vs HIGH/LOWTAGS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 #ifndef XMAKE_LISP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 #if (__GNUC__ > 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 /* Use GCC's struct initializers feature */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 #define XMAKE_LISP(vartype,ptr) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ((union Lisp_Object) { gu: { markbit: 0, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 type: (vartype), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 val: ((unsigned EMACS_INT) ptr) } })
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 #endif /* __GNUC__ */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 #endif /* !XMAKE_LISP */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 #ifdef XMAKE_LISP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 #define Qzero (XMAKE_LISP (Lisp_Int, 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 #define make_int(a) (XMAKE_LISP (Lisp_Int, (a)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 extern Lisp_Object Qzero;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 #define EQ(x,y) ((x).v == (y).v)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 #define GC_EQ(x,y) ((x).gu.val == (y).gu.val && (x).gu.type == (y).gu.type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 #define XTYPE(a) ((enum Lisp_Type) (a).gu.type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 #define XSETTYPE(a,b) ((a).gu.type = (b))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 #define XGCTYPE(a) XTYPE (a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 /* This was commented out a long time ago. I uncommented it, but it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 makes the Alpha crash, and that's the only system that would use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 this, so it stays commented out. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 #if 0 /* EXPLICIT_SIGN_EXTEND */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 /* Make sure we sign-extend; compilers have been known to fail to do so. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 #define XREALINT(a) (((a).i << ((LONGBITS) - (VALBITS))) >> ((LONGBITS) - (VALBITS)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 #define XREALINT(a) ((a).s.val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 #endif /* EXPLICIT_SIGN_EXTEND */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 /* XFASTINT is error-prone and saves a few instructions at best,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 so there's really no point to it. Just use XINT() or make_int()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 instead. --ben */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 /* The + 0 is to prevent XFASTINT being used on the LHS of an assignment */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 #define XFASTINT(a) ((a).gu.val + 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 #define XUINT(a) ((a).gu.val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 #ifdef HAVE_SHM
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 /* In this representation, data is found in two widely separated segments. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 extern int pure_size;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 # define XPNTR(a) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ((void *)(((a).gu.val) | ((a).gu.val > pure_size ? DATA_SEG_BITS : PURE_SEG_BITS)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 #else /* not HAVE_SHM */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 # ifdef DATA_SEG_BITS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 /* This case is used for the rt-pc and hp-pa.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 In the diffs I was given, it checked for ptr = 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 and did not adjust it in that case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 But I don't think that zero should ever be found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 in a Lisp object whose data type says it points to something.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 # define XPNTR(a) ((void *)(((a).gu.val) | DATA_SEG_BITS))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 # else /* not DATA_SEG_BITS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 # define XPNTR(a) ((void *) ((a).gu.val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 # endif /* not DATA_SEG_BITS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 #endif /* not HAVE_SHM */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 #define XSETINT(a, b) do { ((a) = make_int (b)); } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 #define XSETUINT(a, b) XSETINT (a, b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 #define XSETPNTR(a, b) XSETINT (a, b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 #define XSETCHAR(a, b) do { ((a) = make_char (b)); } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 /* XSETOBJ was formerly named XSET. The name change was made to catch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 C code that attempts to use this macro. You should always use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 individual settor macros (XSETCONS, XSETBUFFER, etc.) instead. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 #ifdef XMAKE_LISP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 #define XSETOBJ(var,vartype,ptr) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 do { ((var) = XMAKE_LISP (vartype, ptr)); } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 /* This is haired up to avoid evaluating var twice...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 This is necessary only in the "union" version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 The "int" version has never done double evaluation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 /* XEmacs change: put the assignment to val first; otherwise you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 can trip up the error_check_*() stuff */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 #define XSETOBJ(var, vartype, ptr) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 Lisp_Object *tmp_xset_var = &(var); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (*tmp_xset_var).s.val = ((EMACS_INT) (ptr)); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (*tmp_xset_var).gu.markbit = 0; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (*tmp_xset_var).gu.type = (vartype); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 #endif /* undefined XMAKE_LISP */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 /* During garbage collection, XGCTYPE must be used for extracting types
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 so that the mark bit is ignored. XMARKBIT access the markbit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 Markbits are used only in particular slots of particular structure types.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 Other markbits are always zero.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 Outside of garbage collection, all mark bits are always zero. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 #define XMARKBIT(a) ((a).gu.markbit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 #define XSETMARKBIT(a,b) do { (XMARKBIT (a) = (b)); } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 #define XMARK(a) do { XMARKBIT (a) = 1; } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 /* no 'do {} while' because this is used in a mondo macro in lrecord.h */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 #define XUNMARK(a) (XMARKBIT (a) = 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 /* Use this for turning a (void *) into a Lisp_Object, as when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 Lisp_Object is passed into a toolkit callback function */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 #define VOID_TO_LISP(larg,varg) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 do { ((larg).v = (struct __nosuchstruct__ *) (varg)); } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 #define CVOID_TO_LISP(larg,varg) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 do { ((larg).cv = (CONST struct __nosuchstruct__ *) (varg)); } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 /* Use this for turning a Lisp_Object into a (void *), as when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 Lisp_Object is passed into a toolkit callback function */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 #define LISP_TO_VOID(larg) ((void *) ((larg).v))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 #define LISP_TO_CVOID(larg) ((CONST void *) ((larg).cv))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 /* Convert a Lisp_Object into something that can't be used as an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 lvalue. Useful for type-checking. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 #if (__GNUC__ > 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 #define NON_LVALUE(larg) ({ (larg); })
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 /* Well, you can't really do it without using a function call, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 there's no real point in that; no-union-type is the rule, and that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 will catch errors. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 #define NON_LVALUE(larg) (larg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218