annotate src/lisp-union.h @ 259:11cf20601dec r20-5b28

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