annotate src/lisp-union.h @ 213:78f53ef88e17 r20-4b5

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