annotate src/lisp-disunion.h @ 207:e45d5e7c476e r20-4b2

Import from CVS: tag r20-4b2
author cvs
date Mon, 13 Aug 2007 10:03:52 +0200
parents eb5470882647
children 78f53ef88e17
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 -- non-union objects.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Synched up with: FSF 19.30. Split out from lisp.h. */
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
22 /* This file has diverged greatly from FSF Emacs. Syncing is no
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
23 longer desired or possible */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
25 /*
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
26 * Format of a non-union-type Lisp Object
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
27 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
28 * For the USE_MINIMAL_TAGBITS implementation:
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
29 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
30 * 3 2 1 0
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
31 * bit 10987654321098765432109876543210
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
32 * --------------------------------
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
33 * VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTT
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
34 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
35 * For the non-USE_MINIMAL_TAGBITS implementation:
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
36 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
37 * 3 2 1 0
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
38 * bit 10987654321098765432109876543210
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
39 * --------------------------------
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
40 * TTTMVVVVVVVVVVVVVVVVVVVVVVVVVVVV
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
41 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
42 * V = value bits
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
43 * T = type bits
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
44 * M = mark bits
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
45 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
46 * For integral Lisp types, i.e. integers and characters, the value
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
47 * bits are the Lisp object.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
48 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
49 * The object is obtained by masking off the type and mark
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
50 * bits. In the USE_MINIMAL_TAGBITS implementation, bit 1 is
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
51 * used as a value bit by splitting the Lisp integer type into
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
52 * two subtypes, Lisp_Type_Int_Even and Lisp_Type_Int_Odd. By
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
53 * this trickery we get 31 bits for integers instead of 30.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
54 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
55 * In the non-USE_MINIMAL_TAGBITS world, Lisp integers are 28
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
56 * bits, or more properly (LONGBITS - GCTYPEBITS - 1) bits.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
57 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
58 * For non-integral types, the value bits of Lisp_Object contain a
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
59 * pointer to structure containing the object. The pointer is
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
60 * obtained by masking off the type and mark bits.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
61 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
62 * In the USE_MINIMAL_TAGBITS implementation, all
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
63 * pointer-based types are coalesced under a single type called
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
64 * Lisp_Type_Record. The type bits for this type are required
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
65 * by the implementation to be 00, just like the least
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
66 * significant bits of word-aligned struct pointers on 32-bit
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
67 * hardware. Because of this, Lisp_Object pointers don't have
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
68 * to be masked and are full-sized.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
69 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
70 * In the non-USE_MINIMAL_TAGBITS implementation, the type and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
71 * mark bits must be masked off and pointers are limited to 28
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
72 * bits (really LONGBITS - GCTYPEBITS - 1 bits).
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
73 */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
75 #ifdef USE_MINIMAL_TAGBITS
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
76 # define Qzero Lisp_Type_Int_Even
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
77 # define VALMASK (((1L << (VALBITS)) - 1L) << (GCTYPEBITS))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
78 #else
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
79 # define Qzero Lisp_Type_Int
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
80 # define VALMASK ((1L << (VALBITS)) - 1L)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
81 # define GCTYPEMASK ((1L << (GCTYPEBITS)) - 1L)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
82 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 typedef EMACS_INT Lisp_Object;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
86 #define Qnull_pointer 0
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
88 /*
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
89 * There are no mark bits in the USE_MINIMAL_TAGBITS implementation.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
90 * Integers and characters don't need to be marked. All other types
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
91 * are lrecord-based, which means they get marked by incrementing
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
92 * their ->implementation pointer.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
93 */
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
94 #if GCMARKBITS > 0
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
95 /*
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
96 * XMARKBIT accesses the markbit. Markbits are used only in particular
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
97 * slots of particular structure types. Other markbits are always
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
98 * zero. Outside of garbage collection, all mark bits are always zero.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
99 */
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
100 # define MARKBIT (1UL << (VALBITS))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
101 # define XMARKBIT(a) ((a) & (MARKBIT))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
102
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
103 # define XMARK(a) ((void) ((a) |= (MARKBIT)))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
104 # define XUNMARK(a) ((void) ((a) &= (~(MARKBIT))))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
105 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
107 /*
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
108 * Extract the type bits from a Lisp_Object. If using USE_MINIMAL_TAGBITS,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
109 * the least significant two bits are the type bits. Otherwise the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
110 * most significant GCTYPEBITS bits are the type bits.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
111 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
112 * In the non-USE_MINIMAL_TAGBITS case, one needs to override this
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
113 * if there must be high bits set in data space. Masking the bits
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
114 * (doing the result of the below & ((1 << (GCTYPEBITS)) - 1) would
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
115 * work on all machines, but would penalize machines which don't
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
116 * need it)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
117 */
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
118 #ifdef USE_MINIMAL_TAGBITS
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
119 # define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT)(a)) & ~(VALMASK)))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
120 #else
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
121 # define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT)(a)) >> ((VALBITS) + 1)))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
122 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
124 /*
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
125 * This applies only to the non-USE_MINIMAL_TAGBITS Lisp_Object.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
126 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
127 * In the past, during garbage collection, XGCTYPE needed to be used
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
128 * for extracting types so that the mark bit was ignored. XGCTYPE
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
129 * did and exatr & operation to remove the mark bit. But the mark
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
130 * bit has been since moved so that the type bits could be extracted
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
131 * with a single shift operation, making XGCTYPE no more expensive
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
132 * than XTYPE, so the two operations are now equivalent.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
133 */
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
134 #ifndef XGCTYPE
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
135 # define XGCTYPE(a) XTYPE(a)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
136 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 #define EQ(x,y) ((x) == (y))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
140 #ifdef USE_MINIMAL_TAGBITS
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
141 # define GC_EQ(x,y) EQ(x,y)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
142 #else
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
143 # define GC_EQ(x,y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
146 /*
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
147 * Extract the value of a Lisp_Object as a signed integer.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
148 *
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
149 * The right shifts below are non-portable because >> is allowed to
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
150 * sign extend or not signed extend signed integers depending on the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
151 * compiler implementors preference. But this right-shifting of
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
152 * signed ints has been here forever, so the apparently reality is
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
153 * that all compilers of any consequence do sign extension, which is
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
154 * what is needed here.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
155 */
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
156 #ifndef XREALINT /* Some machines need to do this differently. */
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
157 # ifdef USE_MINIMAL_TAGBITS
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
158 # define XREALINT(a) ((a) >> (LONGBITS-VALBITS-1))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
159 # else
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
160 # define XREALINT(a) (((a) << (LONGBITS-VALBITS)) >> (LONGBITS-VALBITS))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
161 # endif
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
162 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
164 /*
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
165 * Extract the pointer value bits of a pointer based type.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
166 */
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
167 #ifdef USE_MINIMAL_TAGBITS
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
168 # define XPNTRVAL(a) (a) /* This depends on Lisp_Type_Record == 0 */
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
169 # define XCHARVAL(a) ((a) >> (LONGBITS-VALBITS))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
170 #else
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
171 # define XPNTRVAL(a) ((a) & VALMASK)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
172 # define XCHARVAL(a) XPNTRVAL(a)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
173 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 0
diff changeset
175 #ifdef HAVE_SHM
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 /* In this representation, data is found in two widely separated segments. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 extern int pure_size;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 # define XPNTR(a) \
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
179 (XPNTRVAL (a) | (XPNTRVAL (a) > pure_size ? DATA_SEG_BITS : PURE_SEG_BITS))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 # else /* not HAVE_SHM */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 # ifdef DATA_SEG_BITS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 /* This case is used for the rt-pc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 In the diffs I was given, it checked for ptr = 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 and did not adjust it in that case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 But I don't think that zero should ever be found
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 0
diff changeset
186 in a Lisp object whose data type says it points to something. */
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
187 # define XPNTR(a) (XPNTRVAL (a) | DATA_SEG_BITS)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 # else
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
189 # define XPNTR(a) XPNTRVAL (a)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 # endif
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 0
diff changeset
191 #endif /* not HAVE_SHM */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
193 #ifdef USE_MINIMAL_TAGBITS
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
195 /* XSETINT depends on Lisp_Type_Int_Even == 1 and Lisp_Type_Int_Odd == 3 */
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
196 # define XSETINT(var, value) \
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
197 ((void) ((var) = ((value) << (LONGBITS-VALBITS-1)) + 1))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
198 # define XSETCHAR(var, value) \
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
199 ((void) ((var) = ((value) << (LONGBITS-VALBITS)) + Lisp_Type_Char))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
200 # define XSETOBJ(var, type_tag, value) \
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
201 ((void) ((var) = ((EMACS_UINT) (value))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
203 #else
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
205 # define XSETINT(a, b) XSETOBJ (a, Lisp_Type_Int, b)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
206 # define XSETCHAR(var, value) XSETOBJ (var, Lisp_Type_Char, value)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
207 # define XSETOBJ(var, type_tag, value) \
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
208 ((void) ((var) = (((EMACS_UINT) (type_tag) << ((VALBITS) + 1)) \
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
209 + ((EMACS_INT) (value) & VALMASK))))
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 201
diff changeset
210 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 /* Use this for turning a (void *) into a Lisp_Object, as when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 Lisp_Object is passed into a toolkit callback function */
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 0
diff changeset
214 #define VOID_TO_LISP(larg,varg) ((void) ((larg) = ((Lisp_Object) (varg))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 #define CVOID_TO_LISP VOID_TO_LISP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 0
diff changeset
217 /* Use this for turning a Lisp_Object into a (void *), as when the
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 Lisp_Object is passed into a toolkit callback function */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 #define LISP_TO_VOID(larg) ((void *) (larg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 #define LISP_TO_CVOID(varg) ((CONST void *) (larg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 /* Convert a Lisp_Object into something that can't be used as an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 lvalue. Useful for type-checking. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 #define NON_LVALUE(larg) ((larg) + 0)