428
|
1 /* Fundamental definitions for XEmacs Lisp interpreter.
|
|
2 Copyright (C) 1985-1987, 1992-1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1993-1996 Richard Mlynarik.
|
771
|
4 Copyright (C) 1995, 1996, 2000, 2001, 2002 Ben Wing.
|
428
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: FSF 19.30. */
|
|
24
|
440
|
25 #ifndef INCLUDED_lisp_h_
|
|
26 #define INCLUDED_lisp_h_
|
428
|
27
|
|
28 /************************************************************************/
|
|
29 /* general definitions */
|
|
30 /************************************************************************/
|
|
31
|
442
|
32 /* ------------------------ include files ------------------- */
|
|
33
|
428
|
34 /* We include the following generally useful header files so that you
|
|
35 don't have to worry about prototypes when using the standard C
|
|
36 library functions and macros. These files shouldn't be excessively
|
|
37 large so they shouldn't cause that much of a slowdown. */
|
|
38
|
|
39 #include <stdlib.h>
|
|
40 #include <string.h> /* primarily for memcpy, etc. */
|
|
41 #include <stdio.h> /* NULL, etc. */
|
|
42 #include <ctype.h>
|
|
43 #include <stdarg.h>
|
|
44 #include <stddef.h> /* offsetof */
|
|
45 #include <sys/types.h>
|
442
|
46 #include <limits.h>
|
|
47
|
647
|
48 /* ------------------------ definition of EMACS_INT ------------------- */
|
|
49
|
|
50 /* EMACS_INT is the underlying integral type into which a Lisp_Object must fit.
|
|
51 In particular, it must be large enough to contain a pointer.
|
|
52 config.h can override this, e.g. to use `long long' for bigger lisp ints.
|
|
53
|
|
54 #### In point of fact, it would NOT be a good idea for config.h to mess
|
|
55 with EMACS_INT. A lot of code makes the basic assumption that EMACS_INT
|
|
56 is the size of a pointer. */
|
|
57
|
|
58 #ifndef SIZEOF_EMACS_INT
|
|
59 # define SIZEOF_EMACS_INT SIZEOF_VOID_P
|
|
60 #endif
|
|
61
|
|
62 #ifndef EMACS_INT
|
|
63 # if SIZEOF_EMACS_INT == SIZEOF_LONG
|
|
64 # define EMACS_INT long
|
|
65 # elif SIZEOF_EMACS_INT == SIZEOF_INT
|
|
66 # define EMACS_INT int
|
|
67 # elif SIZEOF_EMACS_INT == SIZEOF_LONG_LONG
|
|
68 # define EMACS_INT long long
|
|
69 # else
|
|
70 # error Unable to determine suitable type for EMACS_INT
|
|
71 # endif
|
|
72 #endif
|
|
73
|
|
74 #ifndef EMACS_UINT
|
|
75 # define EMACS_UINT unsigned EMACS_INT
|
|
76 #endif
|
|
77
|
|
78 #define BITS_PER_EMACS_INT (SIZEOF_EMACS_INT * BITS_PER_CHAR)
|
|
79
|
826
|
80 #if SIZEOF_SHORT == 2
|
|
81 #define INT_16_BIT short
|
|
82 #define UINT_16_BIT unsigned short
|
|
83 #elif SIZEOF_INT == 2
|
|
84 /* Bwa ha ha. As if XEmacs could actually support such systems. */
|
|
85 #define INT_16_BIT int
|
|
86 #define UINT_16_BIT unsigned int
|
|
87 #else
|
|
88 #error Unable to find a 16-bit integral type
|
|
89 #endif
|
|
90
|
|
91 #if SIZEOF_INT == 4
|
|
92 #define INT_32_BIT int
|
|
93 #define UINT_32_BIT unsigned int
|
|
94 #define MAKE_32_BIT_UNSIGNED_CONSTANT(num) num##U
|
|
95 #elif SIZEOF_LONG == 4
|
|
96 /* Bwa ha ha again. */
|
|
97 #define INT_32_BIT long
|
|
98 #define UINT_32_BIT unsigned long
|
|
99 #define MAKE_32_BIT_UNSIGNED_CONSTANT(num) num##UL
|
|
100 #elif SIZEOF_SHORT == 4
|
|
101 /* And again. */
|
|
102 #define INT_32_BIT short
|
|
103 #define UINT_32_BIT unsigned short
|
|
104 #define MAKE_32_BIT_UNSIGNED_CONSTANT(num) num##U
|
|
105 #elif /* Unable to find a 32-bit integral type! */
|
|
106 #error What kind of strange-ass system are you running on?
|
|
107 #endif
|
|
108
|
|
109 #if SIZEOF_LONG == 8
|
|
110 #define INT_64_BIT long
|
|
111 #define UINT_64_BIT unsigned long
|
|
112 #define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##UL
|
|
113 #elif SIZEOF_LONG_LONG == 8
|
|
114 #define INT_64_BIT long long
|
|
115 #define UINT_64_BIT unsigned long long
|
|
116 #define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##ULL
|
|
117 /* No error otherwise; just leave undefined */
|
|
118 #endif
|
|
119
|
|
120 #if SIZEOF_LONG_LONG == 16
|
|
121 #define INT_128_BIT long long
|
|
122 #define UINT_128_BIT unsigned long long
|
|
123 #define MAKE_128_BIT_UNSIGNED_CONSTANT(num) num##ULL
|
|
124 /* No error otherwise; just leave undefined */
|
|
125 #endif
|
|
126
|
|
127 /* #### Fill this in for other systems */
|
|
128 #if defined (INT_64_BIT) && !(defined (i386) || defined (__i386__))
|
|
129 #define EFFICIENT_INT_64_BIT INT_64_BIT
|
|
130 #define EFFICIENT_UINT_64_BIT UINT_64_BIT
|
|
131 #endif
|
|
132
|
|
133 #if defined (INT_128_BIT)
|
|
134 #define EFFICIENT_INT_128_BIT INT_128_BIT
|
|
135 #define EFFICIENT_UINT_128_BIT UINT_128_BIT
|
|
136 #endif
|
|
137
|
647
|
138 /* ------------------------ basic char/int typedefs ------------------- */
|
|
139
|
|
140 /* The definitions we put here use typedefs to attribute specific meaning
|
|
141 to types that by themselves are pretty general. Stuff pointed to by a
|
|
142 char * or unsigned char * will nearly always be one of four types:
|
|
143 a) pointer to internally-formatted text; b) pointer to text in some
|
|
144 external format, which can be defined as all formats other than the
|
|
145 internal one; c) pure ASCII text; d) binary data that is not meant to
|
|
146 be interpreted as text. [A fifth possible type "e) a general pointer
|
|
147 to memory" should be replaced with void *.] Using these more specific
|
|
148 types rather than the general ones helps avoid the confusions that
|
|
149 occur when the semantics of a char * argument being studied are unclear.
|
|
150
|
|
151 Note that these typedefs are purely for documentation purposes; from
|
|
152 the C code's perspective, they are exactly equivalent to `char *',
|
|
153 `unsigned char *', etc., so you can freely use them with library
|
|
154 functions declared as such. */
|
|
155
|
|
156 /* The data representing the text in a buffer is logically a set
|
665
|
157 of Intbytes, declared as follows. */
|
|
158
|
|
159 typedef unsigned char Intbyte;
|
647
|
160
|
|
161 /* The following should be used when you are working with internal data
|
|
162 but for whatever reason need to have it declared a "char *". Examples
|
|
163 are function arguments whose values are most commonly literal strings,
|
|
164 or where you have to apply a stdlib string function to internal data.
|
|
165
|
665
|
166 In general, you should avoid this where possible and use Intbyte instead,
|
647
|
167 for consistency. For example, the new Mule workspace contains
|
665
|
168 Intbyte versions of the stdlib string functions. */
|
|
169
|
|
170 typedef char CIntbyte;
|
647
|
171
|
|
172 /* The data representing a string in "external" format (binary or any
|
|
173 external encoding) is logically a set of Extbytes, declared as
|
|
174 follows. Extbyte is guaranteed to be just a char, so for example
|
|
175 strlen (Extbyte *) is OK. Extbyte is only a documentation device
|
|
176 for referring to external text. */
|
|
177
|
|
178 typedef char Extbyte;
|
771
|
179 typedef unsigned char UExtbyte;
|
647
|
180
|
|
181 /* A byte in a string in binary format: */
|
|
182 typedef char Char_Binary;
|
|
183 typedef signed char SChar_Binary;
|
|
184 typedef unsigned char UChar_Binary;
|
|
185
|
|
186 /* A byte in a string in entirely US-ASCII format: (Nothing outside
|
|
187 the range 00 - 7F) */
|
|
188
|
|
189 typedef char Char_ASCII;
|
|
190 typedef unsigned char UChar_ASCII;
|
|
191
|
826
|
192 /* To the user, a buffer is made up of characters. In the non-Mule world,
|
|
193 characters and Intbytes are equivalent, restricted to the range 0 - 255.
|
|
194 In the Mule world, many more characters are possible (19 bits worth,
|
|
195 more or less), and a character requires (typically) 1 to 4 Intbytes for
|
|
196 its representation in a buffer or string. Note that the representation
|
|
197 of a character by itself, in a variable, is very different from its
|
|
198 representation in a string of text (in a buffer or Lisp string).
|
|
199
|
|
200 Under Mule, text can be represented in more than one way. The "default"
|
|
201 format is variable-width (1 to 4 bytes) and compatible with ASCII --
|
|
202 ASCII chars are stored in one byte, as themselves, and all other chars
|
|
203 use only high bytes. The default format is currently the only format
|
|
204 used for text stored anywhere but in a buffer. In a buffer, other
|
|
205 formats -- fixed-width formats (1, 2, or 4 bytes) -- are possible, for
|
|
206 speed.
|
|
207
|
|
208 See text.c/text.h for a detailed discussion of all of this. */
|
|
209
|
|
210 /* A character, as represented on its own. */
|
647
|
211
|
|
212 typedef int Emchar;
|
|
213
|
826
|
214 /* The "raw value" of a character as stored in the buffer. In the default
|
|
215 format, this is just the same as the character. In fixed-width formats,
|
|
216 this is the actual value in the buffer, which will be limited to the
|
|
217 range as established by the format. This is used when searching for a
|
|
218 character in a buffer -- it's faster to convert the character to the raw
|
|
219 value and look for that, than repeatedly convert each raw value in the
|
|
220 buffer into a character. */
|
|
221
|
|
222 typedef int Raw_Emchar;
|
|
223
|
|
224
|
|
225 #if !defined (__cplusplus) || !defined (CPLUSPLUS_INTEGRAL_CLASSES_NOT_YET)
|
|
226
|
|
227 /* Counts of bytes or chars */
|
|
228
|
|
229 typedef EMACS_INT Bytecount;
|
|
230 typedef EMACS_INT Charcount;
|
|
231
|
647
|
232 /* Different ways of referring to a position in a buffer. We use
|
|
233 the typedefs in preference to 'EMACS_INT' to make it clearer what
|
826
|
234 sort of position is being used. See text.c for a description
|
|
235 of the different positions.
|
|
236
|
|
237 Note that buffer positions are 1-based, and there's a gap in the middle
|
|
238 of a buffer; that's why we have separate typedefs. For Lisp strings and
|
|
239 other strings of text, we just use Bytecount and Charcount. */
|
800
|
240
|
665
|
241 typedef EMACS_INT Charbpos;
|
|
242 typedef EMACS_INT Bytebpos;
|
|
243 typedef EMACS_INT Membpos;
|
647
|
244
|
826
|
245 /* Different ways of referring to a position that can be either in a buffer
|
|
246 or string; used when passing around an object that can be either a
|
|
247 buffer or string, and an associated position. Conceptually, they
|
|
248 resolve as follows:
|
|
249
|
|
250 Typedef Buffer String
|
|
251 ------------------------------------------------------
|
|
252 Charxpos Charbpos Charcount
|
|
253 Bytexpos Bytebpos Bytecount
|
|
254 Memxpos Membpos Bytecount
|
|
255
|
|
256 */
|
|
257
|
814
|
258 typedef EMACS_INT Charxpos;
|
|
259 typedef EMACS_INT Bytexpos;
|
|
260 typedef EMACS_INT Memxpos;
|
|
261
|
|
262 #else /* __cplusplus */
|
|
263
|
|
264 /* Implement strong type-checking of the above integral types by declaring
|
|
265 them to be classes and using operator overloading. Unfortunately this
|
|
266 is a huge pain in the ass because C++ doesn't strongly distinguish
|
|
267 "bool" and "size_t" from int. The problem is especially bad with "bool"
|
|
268 -- if you want to be able to say 'if (len--)' where len is e.g. a
|
|
269 Bytecount, you need to declare a conversion operator to bool(); and
|
|
270 since bool is just an alias for int, you suddenly get tons and tons of
|
|
271 ambiguities, which need to be resolved by lots of laborious declarations
|
|
272 for every single possible type combination. Hence the multitude of
|
|
273 declarations in DECLARE_INTCLASS_ARITH_COMPARE(). The bool/int
|
|
274 equivalence also means that we have to forcibly block the combinations
|
|
275 we don't want by creating overloaded versions of them and declaring them
|
|
276 private. */
|
|
277
|
|
278 #undef class
|
|
279 #undef this
|
|
280
|
|
281 class Bytecount;
|
|
282 class Bytebpos;
|
|
283 class Bytexpos;
|
|
284 class Charcount;
|
|
285 class Charbpos;
|
|
286 class Charxpos;
|
|
287 class Membpos;
|
|
288 class Memxpos;
|
|
289
|
|
290 /* Declare the arithmetic and comparison operations for an integral class,
|
|
291 i.e. one of the above classes. If this is a "position" class, where the
|
|
292 difference between two positions is a different class (a "count" class),
|
|
293 then use POSCL for the position class and COUNTCL for the count class.
|
|
294 If this is a simple class, where all operations yield the same class,
|
|
295 substitute the same class for POSCL and COUNTCL. */
|
|
296
|
|
297 #define DECLARE_INTCLASS_ARITH_COMPARE(poscl, countcl) \
|
|
298 poscl operator += (const countcl& l) { data += l.data; return *this; } \
|
|
299 poscl operator -= (const countcl& l) { data -= l.data; return *this; } \
|
|
300 poscl operator + (const countcl& l) const { return poscl (data + l.data); } \
|
|
301 poscl operator - (const countcl& l) const { return poscl (data - l.data); } \
|
|
302 poscl operator += (const int& l) { data += l; return *this; } \
|
|
303 poscl operator -= (const int& l) { data -= l; return *this; } \
|
|
304 poscl operator + (const int& l) const { return poscl (data + l); } \
|
|
305 poscl operator - (const int& l) const { return poscl (data - l); } \
|
|
306 poscl operator += (const unsigned int& l) { data += l; return *this; } \
|
|
307 poscl operator -= (const unsigned int& l) { data -= l; return *this; } \
|
|
308 poscl operator + (const unsigned int& l) const \
|
|
309 { return poscl (data + l); } \
|
|
310 poscl operator - (const unsigned int& l) const \
|
|
311 { return poscl (data - l); } \
|
|
312 poscl operator += (const long& l) { data += l; return *this; } \
|
|
313 poscl operator -= (const long& l) { data -= l; return *this; } \
|
|
314 poscl operator + (const long& l) const { return poscl (data + l); } \
|
|
315 poscl operator - (const long& l) const { return poscl (data - l); } \
|
|
316 poscl operator += (const unsigned long& l) { data += l; return *this; } \
|
|
317 poscl operator -= (const unsigned long& l) { data -= l; return *this; } \
|
|
318 poscl operator + (const unsigned long& l) const \
|
|
319 { return poscl (data + l); } \
|
|
320 poscl operator - (const unsigned long& l) const \
|
|
321 { return poscl (data - l); } \
|
|
322 poscl operator += (const short& l) { data += l; return *this; } \
|
|
323 poscl operator -= (const short& l) { data -= l; return *this; } \
|
|
324 poscl operator + (const short& l) const { return poscl (data + l); } \
|
|
325 poscl operator - (const short& l) const { return poscl (data - l); } \
|
|
326 poscl operator += (const unsigned short& l) { data += l; return *this; } \
|
|
327 poscl operator -= (const unsigned short& l) { data -= l; return *this; } \
|
|
328 poscl operator + (const unsigned short& l) const \
|
|
329 { return poscl (data + l); } \
|
|
330 poscl operator - (const unsigned short& l) const \
|
|
331 { return poscl (data - l); } \
|
|
332 \
|
|
333 poscl operator *= (const countcl& l) { data *= l.data; return *this; } \
|
|
334 poscl operator /= (const countcl& l) { data /= l.data; return *this; } \
|
|
335 poscl operator * (const countcl& l) const { return poscl (data * l.data); } \
|
|
336 poscl operator / (const countcl& l) const { return poscl (data / l.data); } \
|
|
337 poscl operator *= (const int& l) { data *= l; return *this; } \
|
|
338 poscl operator /= (const int& l) { data /= l; return *this; } \
|
|
339 poscl operator * (const int& l) const { return poscl (data * l); } \
|
|
340 poscl operator / (const int& l) const { return poscl (data / l); } \
|
|
341 poscl operator *= (const unsigned int& l) { data *= l; return *this; } \
|
|
342 poscl operator /= (const unsigned int& l) { data /= l; return *this; } \
|
|
343 poscl operator * (const unsigned int& l) const { return poscl (data * l); } \
|
|
344 poscl operator / (const unsigned int& l) const { return poscl (data / l); } \
|
|
345 poscl operator *= (const long& l) { data *= l; return *this; } \
|
|
346 poscl operator /= (const long& l) { data /= l; return *this; } \
|
|
347 poscl operator * (const long& l) const { return poscl (data * l); } \
|
|
348 poscl operator / (const long& l) const { return poscl (data / l); } \
|
|
349 poscl operator *= (const unsigned long& l) { data *= l; return *this; } \
|
|
350 poscl operator /= (const unsigned long& l) { data /= l; return *this; } \
|
|
351 poscl operator * (const unsigned long& l) const \
|
|
352 { return poscl (data * l); } \
|
|
353 poscl operator / (const unsigned long& l) const \
|
|
354 { return poscl (data / l); } \
|
|
355 poscl operator *= (const short& l) { data *= l; return *this; } \
|
|
356 poscl operator /= (const short& l) { data /= l; return *this; } \
|
|
357 poscl operator * (const short& l) const { return poscl (data * l); } \
|
|
358 poscl operator / (const short& l) const { return poscl (data / l); } \
|
|
359 poscl operator *= (const unsigned short& l) { data *= l; return *this; } \
|
|
360 poscl operator /= (const unsigned short& l) { data /= l; return *this; } \
|
|
361 poscl operator * (const unsigned short& l) const \
|
|
362 { return poscl (data * l); } \
|
|
363 poscl operator / (const unsigned short& l) const \
|
|
364 { return poscl (data / l); } \
|
|
365 \
|
|
366 poscl operator &= (const countcl& l) { data &= l.data; return *this; } \
|
|
367 poscl operator |= (const countcl& l) { data |= l.data; return *this; } \
|
|
368 poscl operator & (const countcl& l) const { return poscl (data & l.data); } \
|
|
369 poscl operator | (const countcl& l) const { return poscl (data | l.data); } \
|
|
370 poscl operator &= (const int& l) { data &= l; return *this; } \
|
|
371 poscl operator |= (const int& l) { data |= l; return *this; } \
|
|
372 poscl operator & (const int& l) const { return poscl (data & l); } \
|
|
373 poscl operator | (const int& l) const { return poscl (data | l); } \
|
|
374 poscl operator &= (const unsigned int& l) { data &= l; return *this; } \
|
|
375 poscl operator |= (const unsigned int& l) { data |= l; return *this; } \
|
|
376 poscl operator & (const unsigned int& l) const { return poscl (data & l); } \
|
|
377 poscl operator | (const unsigned int& l) const { return poscl (data | l); } \
|
|
378 poscl operator &= (const long& l) { data &= l; return *this; } \
|
|
379 poscl operator |= (const long& l) { data |= l; return *this; } \
|
|
380 poscl operator & (const long& l) const { return poscl (data & l); } \
|
|
381 poscl operator | (const long& l) const { return poscl (data | l); } \
|
|
382 poscl operator &= (const unsigned long& l) { data &= l; return *this; } \
|
|
383 poscl operator |= (const unsigned long& l) { data |= l; return *this; } \
|
|
384 poscl operator & (const unsigned long& l) const \
|
|
385 { return poscl (data & l); } \
|
|
386 poscl operator | (const unsigned long& l) const \
|
|
387 { return poscl (data | l); } \
|
|
388 poscl operator &= (const short& l) { data &= l; return *this; } \
|
|
389 poscl operator |= (const short& l) { data |= l; return *this; } \
|
|
390 poscl operator & (const short& l) const { return poscl (data & l); } \
|
|
391 poscl operator | (const short& l) const { return poscl (data | l); } \
|
|
392 poscl operator &= (const unsigned short& l) { data &= l; return *this; } \
|
|
393 poscl operator |= (const unsigned short& l) { data |= l; return *this; } \
|
|
394 poscl operator & (const unsigned short& l) const \
|
|
395 { return poscl (data & l); } \
|
|
396 poscl operator | (const unsigned short& l) const \
|
|
397 { return poscl (data | l); } \
|
|
398 \
|
|
399 poscl operator - () { return poscl (-data); } \
|
|
400 poscl operator-- () { data--; return *this; } \
|
|
401 poscl operator-- (int) { data--; return poscl (data + 1); } \
|
|
402 poscl operator++ () { data++; return *this; } \
|
|
403 poscl operator++ (int) { data++; return poscl (data - 1); } \
|
|
404 \
|
|
405 bool operator < (const poscl& l) const { return data < l.data; } \
|
|
406 bool operator <= (const poscl& l) const { return data <= l.data; } \
|
|
407 bool operator > (const poscl& l) const { return data > l.data; } \
|
|
408 bool operator >= (const poscl& l) const { return data >= l.data; } \
|
|
409 bool operator == (const poscl& l) const { return data == l.data; } \
|
|
410 bool operator != (const poscl& l) const { return data != l.data; } \
|
|
411 bool operator < (const int& l) const { return data < (EMACS_INT) l; } \
|
|
412 bool operator <= (const int& l) const { return data <= (EMACS_INT) l; } \
|
|
413 bool operator > (const int& l) const { return data > (EMACS_INT) l; } \
|
|
414 bool operator >= (const int& l) const { return data >= (EMACS_INT) l; } \
|
|
415 bool operator == (const int& l) const { return data == (EMACS_INT) l; } \
|
|
416 bool operator != (const int& l) const { return data != (EMACS_INT) l; } \
|
|
417 bool operator < (const unsigned int& l) const \
|
|
418 { return data < (EMACS_INT) l; } \
|
|
419 bool operator <= (const unsigned int& l) const \
|
|
420 { return data <= (EMACS_INT) l; } \
|
|
421 bool operator > (const unsigned int& l) const \
|
|
422 { return data > (EMACS_INT) l; } \
|
|
423 bool operator >= (const unsigned int& l) const \
|
|
424 { return data >= (EMACS_INT) l; } \
|
|
425 bool operator == (const unsigned int& l) const \
|
|
426 { return data == (EMACS_INT) l; } \
|
|
427 bool operator != (const unsigned int& l) const \
|
|
428 { return data != (EMACS_INT) l; } \
|
|
429 bool operator < (const long& l) const { return data < (EMACS_INT) l; } \
|
|
430 bool operator <= (const long& l) const { return data <= (EMACS_INT) l; } \
|
|
431 bool operator > (const long& l) const { return data > (EMACS_INT) l; } \
|
|
432 bool operator >= (const long& l) const { return data >= (EMACS_INT) l; } \
|
|
433 bool operator == (const long& l) const { return data == (EMACS_INT) l; } \
|
|
434 bool operator != (const long& l) const { return data != (EMACS_INT) l; } \
|
|
435 bool operator < (const unsigned long& l) const \
|
|
436 { return data < (EMACS_INT) l; } \
|
|
437 bool operator <= (const unsigned long& l) const \
|
|
438 { return data <= (EMACS_INT) l; } \
|
|
439 bool operator > (const unsigned long& l) const \
|
|
440 { return data > (EMACS_INT) l; } \
|
|
441 bool operator >= (const unsigned long& l) const \
|
|
442 { return data >= (EMACS_INT) l; } \
|
|
443 bool operator == (const unsigned long& l) const \
|
|
444 { return data == (EMACS_INT) l; } \
|
|
445 bool operator != (const unsigned long& l) const \
|
|
446 { return data != (EMACS_INT) l; } \
|
|
447 bool operator < (const short& l) const { return data < (EMACS_INT) l; } \
|
|
448 bool operator <= (const short& l) const { return data <= (EMACS_INT) l; } \
|
|
449 bool operator > (const short& l) const { return data > (EMACS_INT) l; } \
|
|
450 bool operator >= (const short& l) const { return data >= (EMACS_INT) l; } \
|
|
451 bool operator == (const short& l) const { return data == (EMACS_INT) l; } \
|
|
452 bool operator != (const short& l) const { return data != (EMACS_INT) l; } \
|
|
453 bool operator < (const unsigned short& l) const \
|
|
454 { return data < (EMACS_INT) l; } \
|
|
455 bool operator <= (const unsigned short& l) const \
|
|
456 { return data <= (EMACS_INT) l; } \
|
|
457 bool operator > (const unsigned short& l) const \
|
|
458 { return data > (EMACS_INT) l; } \
|
|
459 bool operator >= (const unsigned short& l) const \
|
|
460 { return data >= (EMACS_INT) l; } \
|
|
461 bool operator == (const unsigned short& l) const \
|
|
462 { return data == (EMACS_INT) l; } \
|
|
463 bool operator != (const unsigned short& l) const \
|
|
464 { return data != (EMACS_INT) l; } \
|
|
465 bool operator ! () const { return !data; }
|
|
466
|
|
467 /* Declare the "bad" or disallowed arithmetic and comparion operations
|
|
468 between class GOOD and class BAD. Meant to go inside the private
|
|
469 section of class GOOD. */
|
|
470
|
|
471 #define DECLARE_BAD_INTCLASS_ARITH_COMPARE(good, bad) \
|
|
472 good operator += (const bad& l) { return badret; } \
|
|
473 good operator -= (const bad& l) { return badret; } \
|
|
474 good operator *= (const bad& l) { return badret; } \
|
|
475 good operator /= (const bad& l) { return badret; } \
|
|
476 good operator + (const bad& l) { return badret; } \
|
|
477 good operator - (const bad& l) { return badret; } \
|
|
478 good operator * (const bad& l) { return badret; } \
|
|
479 good operator / (const bad& l) { return badret; } \
|
|
480 \
|
|
481 bool operator < (const bad& l) { return 0; } \
|
|
482 bool operator <= (const bad& l) { return 0; } \
|
|
483 bool operator > (const bad& l) { return 0; } \
|
|
484 bool operator >= (const bad& l) { return 0; } \
|
|
485 bool operator == (const bad& l) { return 0; } \
|
|
486 bool operator != (const bad& l) { return 0; }
|
|
487
|
|
488 /* Declare the "bad" or disallowed arithmetic operations between class GOOD
|
|
489 and another of the same class, for a position class. Meant to go inside
|
|
490 the private section of class GOOD. */
|
|
491
|
|
492 #define DECLARE_BAD_POS_CLASS_ARITH(good) \
|
|
493 good operator += (const good& l) { return badret; } \
|
|
494 good operator -= (const good& l) { return badret; } \
|
|
495 good operator *= (const good& l) { return badret; } \
|
|
496 good operator /= (const good& l) { return badret; } \
|
|
497 good operator + (const good& l) { return badret; } \
|
|
498 good operator * (const good& l) { return badret; } \
|
|
499 good operator / (const good& l) { return badret; }
|
|
500
|
|
501 /* Basic declaration at the top of all integral classes. Don't call
|
|
502 directly, use one of the more specific versions below. */
|
|
503
|
|
504 #define DECLARE_INTCLASS(cl) \
|
|
505 public: \
|
|
506 EMACS_INT data; \
|
|
507 cl () { data = 0xCDCDCDCD; } \
|
|
508 cl (int i) { data = i; } \
|
|
509 cl (unsigned int i) { data = i; } \
|
|
510 cl (long i) { data = i; } \
|
|
511 cl (unsigned long i) { data = i; } \
|
|
512 cl (short i) { data = i; } \
|
|
513 cl (unsigned short i) { data = i; } \
|
|
514 operator EMACS_INT () const { return data; }
|
|
515
|
|
516 /* Basic declaration at the top of all count classes. */
|
|
517
|
|
518 #define DECLARE_COUNT_CLASS(cl) \
|
|
519 DECLARE_INTCLASS (cl) \
|
|
520 DECLARE_INTCLASS_ARITH_COMPARE (cl, cl) \
|
|
521 private: \
|
|
522 static cl badret;
|
|
523
|
|
524 /* Basic declaration at the bottom of the prelude of all position classes.
|
|
525 Don't call directly. */
|
|
526
|
|
527 #define DECLARE_POS_CLASS_SECOND_HALF(cl, countcl) \
|
|
528 DECLARE_INTCLASS_ARITH_COMPARE (cl, countcl) \
|
|
529 countcl operator - (const cl& l) const { return countcl (data - l.data); } \
|
|
530 private: \
|
|
531 static cl badret; \
|
|
532 DECLARE_BAD_POS_INTCLASS_ARITH (cl)
|
|
533
|
|
534 /* Basic declaration at the top of all buffer position classes. */
|
|
535
|
|
536 #define DECLARE_BPOS_CLASS(cl, countcl) \
|
|
537 DECLARE_INTCLASS (cl) \
|
|
538 DECLARE_POS_CLASS_SECOND_HALF (cl, countcl)
|
|
539
|
|
540 /* Basic declaration at the top of all X-position classes (that can refer
|
|
541 to buffers or strings). CL1 and CL2 are the equivalent more specific
|
|
542 classes referring only to buffers or strings, respefitvely. */
|
|
543
|
|
544 #define DECLARE_XPOS_CLASS(cl, countcl, cl1, cl2) \
|
|
545 DECLARE_INTCLASS (cl) \
|
|
546 cl (const cl1& x) { data = x.data; } \
|
|
547 cl (const cl2& x) { data = x.data; } \
|
|
548 operator cl1 () const { return cl1 (data); } \
|
|
549 operator cl2 () const { return cl2 (data); } \
|
|
550 DECLARE_POS_CLASS_SECOND_HALF (cl, countcl)
|
|
551
|
|
552 /* Declare the "bad" or disallowed arithmetic and comparion operations
|
|
553 between class CHARCL (a character class) and various non-character
|
|
554 classes. Meant to go inside the private section of class GOOD. */
|
|
555
|
|
556 #define DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE(charcl) \
|
|
557 DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Bytecount) \
|
|
558 DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Bytebpos) \
|
|
559 DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Bytexpos) \
|
|
560 DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Membpos) \
|
|
561 DECLARE_BAD_INTCLASS_ARITH_COMPARE (charcl, Memxpos)
|
|
562
|
|
563 /* Declare the "bad" or disallowed arithmetic and comparion operations
|
|
564 between class BYTECL (a byte class) and various non-byte classes.
|
|
565 Meant to go inside the private section of class GOOD. */
|
|
566
|
|
567 #define DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE(bytecl) \
|
|
568 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charcount) \
|
|
569 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charbpos) \
|
|
570 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charxpos) \
|
|
571 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Membpos) \
|
|
572 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Memxpos)
|
|
573
|
|
574 /* Declare the "bad" or disallowed arithmetic and comparion operations
|
|
575 between class BYTECL (a mem class) and various non-mem classes.
|
|
576 Meant to go inside the private section of class GOOD. */
|
|
577
|
|
578 #define DECLARE_BAD_MEM_INTCLASS_ARITH_COMPARE(bytecl) \
|
|
579 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charcount) \
|
|
580 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charbpos) \
|
|
581 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Charxpos) \
|
|
582 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Bytebpos) \
|
|
583 DECLARE_BAD_INTCLASS_ARITH_COMPARE (bytecl, Bytexpos)
|
|
584
|
|
585 class Charcount
|
|
586 {
|
|
587 DECLARE_COUNT_CLASS (Charcount)
|
|
588 DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE (Charcount)
|
|
589 };
|
|
590
|
|
591 class Charbpos
|
|
592 {
|
|
593 DECLARE_BPOS_CLASS (Charbpos, Charcount)
|
|
594 DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE (Charbpos)
|
|
595 };
|
|
596
|
|
597 class Charxpos
|
|
598 {
|
|
599 DECLARE_XPOS_CLASS (Charxpos, Charcount, Charbpos, Charcount)
|
|
600 DECLARE_BAD_CHAR_INTCLASS_ARITH_COMPARE (Charxpos)
|
|
601 };
|
|
602
|
|
603 class Bytecount
|
|
604 {
|
|
605 DECLARE_COUNT_CLASS (Bytecount)
|
|
606 DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE (Bytecount)
|
|
607 };
|
|
608
|
|
609 class Bytebpos
|
|
610 {
|
|
611 DECLARE_BPOS_CLASS (Bytebpos, Bytecount)
|
|
612 DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE (Bytebpos)
|
|
613 };
|
|
614
|
|
615 class Bytexpos
|
|
616 {
|
|
617 DECLARE_XPOS_CLASS (Bytexpos, Bytecount, Bytebpos, Bytecount)
|
|
618 DECLARE_BAD_BYTE_INTCLASS_ARITH_COMPARE (Bytexpos)
|
|
619 };
|
|
620
|
|
621 class Membpos
|
|
622 {
|
|
623 DECLARE_BPOS_CLASS (Membpos, Bytecount)
|
|
624 DECLARE_BAD_MEM_INTCLASS_ARITH_COMPARE (Membpos)
|
|
625 };
|
|
626
|
|
627 class Memxpos
|
|
628 {
|
|
629 DECLARE_XPOS_CLASS (Memxpos, Bytecount, Membpos, Bytecount)
|
|
630 DECLARE_BAD_MEM_INTCLASS_ARITH_COMPARE (Memxpos)
|
|
631 };
|
|
632
|
826
|
633 #define DECLARE_POINTER_TYPE_ARITH_COUNT(pointer, countcl) \
|
|
634 inline pointer operator += (const pointer & x, const countcl& y) \
|
|
635 { x += y.data; return x; } \
|
|
636 inline pointer operator -= (const pointer & x, const countcl& y) \
|
|
637 { x -= y.data; return x; } \
|
|
638 inline pointer operator + (const pointer x, const countcl& y) \
|
|
639 { return x + y.data; } \
|
|
640 inline pointer operator - (const pointer x, const countcl& y) \
|
814
|
641 { return x - y.data; }
|
|
642
|
|
643 #define DECLARE_INTEGRAL_TYPE_ARITH_COUNT(integral, countcl) \
|
|
644 inline integral operator += (integral & x, const countcl& y) \
|
|
645 { x += y.data; return x; } \
|
|
646 inline integral operator -= (integral & x, const countcl& y) \
|
|
647 { x -= y.data; return x; } \
|
|
648 inline countcl operator + (integral x, const countcl& y) \
|
|
649 { return countcl (x + y.data); } \
|
|
650 inline countcl operator - (integral x, const countcl& y) \
|
|
651 { return countcl (x - y.data); }
|
|
652
|
|
653 #define DECLARE_INTEGRAL_TYPE_COMPARE(integral, cl) \
|
|
654 inline bool operator < (integral x, const cl& y) \
|
|
655 { return (EMACS_INT) x < y.data; } \
|
|
656 inline bool operator <= (integral x, const cl& y) \
|
|
657 { return (EMACS_INT) x <= y.data; } \
|
|
658 inline bool operator > (integral x, const cl& y) \
|
|
659 { return (EMACS_INT) x > y.data; } \
|
|
660 inline bool operator >= (integral x, const cl& y) \
|
|
661 { return (EMACS_INT) x >= y.data; } \
|
|
662 inline bool operator == (integral x, const cl& y) \
|
|
663 { return (EMACS_INT) x == y.data; } \
|
|
664 inline bool operator != (integral x, const cl& y) \
|
|
665 { return (EMACS_INT) x != y.data; }
|
|
666
|
|
667 #if 0
|
|
668 /* Unfortunately C++ doesn't let you overload the ?: operator, so we have
|
|
669 to manually deal with ambiguities using casting */
|
|
670 #define DECLARE_INTEGRAL_TYPE_TRISTATE(integral, cl) \
|
|
671 inline cl operator ?: (bool b, integral x, const cl& y) \
|
|
672 { return b ? cl (x) : y; } \
|
|
673 inline cl operator ?: (bool b, const cl& x, integral y) \
|
|
674 { return b ? x : cl (y); }
|
|
675 #endif /* 0 */
|
|
676
|
826
|
677 /* DECLARE_POINTER_TYPE_ARITH_COUNT (const Intbyte *, Bytecount);
|
|
678 DECLARE_POINTER_TYPE_ARITH_COUNT (const Extbyte *, Bytecount); */
|
814
|
679 DECLARE_POINTER_TYPE_ARITH_COUNT (Intbyte *, Bytecount);
|
|
680 DECLARE_POINTER_TYPE_ARITH_COUNT (Extbyte *, Bytecount);
|
|
681
|
|
682 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (int, Bytecount);
|
|
683 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (int, Charcount);
|
|
684 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned int, Bytecount);
|
|
685 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned int, Charcount);
|
|
686 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (long, Bytecount);
|
|
687 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (long, Charcount);
|
|
688 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned long, Bytecount);
|
|
689 DECLARE_INTEGRAL_TYPE_ARITH_COUNT (unsigned long, Charcount);
|
|
690
|
|
691 DECLARE_INTEGRAL_TYPE_COMPARE (int, Bytecount);
|
|
692 DECLARE_INTEGRAL_TYPE_COMPARE (int, Charcount);
|
|
693 DECLARE_INTEGRAL_TYPE_COMPARE (unsigned int, Bytecount);
|
|
694 DECLARE_INTEGRAL_TYPE_COMPARE (unsigned int, Charcount);
|
|
695 DECLARE_INTEGRAL_TYPE_COMPARE (long, Bytecount);
|
|
696 DECLARE_INTEGRAL_TYPE_COMPARE (long, Charcount);
|
|
697 DECLARE_INTEGRAL_TYPE_COMPARE (unsigned long, Bytecount);
|
|
698 DECLARE_INTEGRAL_TYPE_COMPARE (unsigned long, Charcount);
|
|
699
|
|
700 #if 0 /* doesn't work */
|
|
701 inline Bytecount operator - (const Intbyte *x, const Intbyte *y) \
|
|
702 { return Bytecount (x - y); }
|
|
703 #endif
|
|
704
|
|
705 #define class c_class
|
|
706 #define this c_this
|
|
707
|
|
708 #endif /* __cplusplus */
|
|
709
|
665
|
710 /* Counts of elements */
|
|
711 typedef EMACS_INT Elemcount;
|
|
712 /* Hash codes */
|
|
713 typedef unsigned long Hashcode;
|
647
|
714
|
771
|
715 #ifdef HAVE_INTTYPES_H
|
|
716 #include <inttypes.h>
|
|
717 #elif SIZEOF_VOID_P == SIZEOF_INT
|
|
718 typedef int intptr_t;
|
|
719 typedef unsigned int uintptr_t;
|
|
720 #elif SIZEOF_VOID_P == SIZEOF_LONG
|
|
721 typedef long intptr_t;
|
|
722 typedef unsigned long uintptr_t;
|
|
723 #elif defined(SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG
|
|
724 typedef long long intptr_t;
|
|
725 typedef unsigned long long uintptr_t;
|
|
726 #else
|
|
727 /* Just pray. May break, may not. */
|
|
728 typedef long intptr_t;
|
|
729 typedef unsigned long uintptr_t;
|
|
730 #endif
|
|
731
|
793
|
732 /* ------------------------ basic compiler defines ------------------- */
|
428
|
733
|
|
734 /* Also define min() and max(). (Some compilers put them in strange
|
|
735 places that won't be referenced by the above include files, such
|
|
736 as 'macros.h' under Solaris.) */
|
|
737
|
|
738 #ifndef min
|
|
739 #define min(a,b) (((a) <= (b)) ? (a) : (b))
|
|
740 #endif
|
|
741 #ifndef max
|
|
742 #define max(a,b) (((a) > (b)) ? (a) : (b))
|
|
743 #endif
|
|
744
|
|
745 #ifndef PRINTF_ARGS
|
|
746 # if defined (__GNUC__) && (__GNUC__ >= 2)
|
|
747 # define PRINTF_ARGS(string_index,first_to_check) \
|
|
748 __attribute__ ((format (printf, string_index, first_to_check)))
|
|
749 # else
|
|
750 # define PRINTF_ARGS(string_index,first_to_check)
|
|
751 # endif /* GNUC */
|
|
752 #endif
|
|
753
|
|
754 #ifndef DOESNT_RETURN
|
|
755 # if defined __GNUC__
|
|
756 # if ((__GNUC__ > 2) || (__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))
|
801
|
757 # define RETURN_NOT_REACHED(value)
|
442
|
758 # define DOESNT_RETURN void
|
428
|
759 # define DECLARE_DOESNT_RETURN(decl) \
|
442
|
760 extern void decl __attribute__ ((noreturn))
|
428
|
761 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
|
|
762 /* Should be able to state multiple independent __attribute__s, but \
|
|
763 the losing syntax doesn't work that way, and screws losing cpp */ \
|
442
|
764 extern void decl \
|
428
|
765 __attribute__ ((noreturn, format (printf, str, idx)))
|
|
766 # else
|
|
767 # define DOESNT_RETURN void volatile
|
|
768 # define DECLARE_DOESNT_RETURN(decl) extern void volatile decl
|
|
769 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
|
|
770 extern void volatile decl PRINTF_ARGS(str,idx)
|
|
771 # endif /* GNUC 2.5 */
|
|
772 # else
|
|
773 # define DOESNT_RETURN void
|
|
774 # define DECLARE_DOESNT_RETURN(decl) extern void decl
|
|
775 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
|
|
776 extern void decl PRINTF_ARGS(str,idx)
|
|
777 # endif /* GNUC */
|
|
778 #endif
|
|
779
|
771
|
780 /* Another try to fix SunPro C compiler warnings */
|
|
781 /* "end-of-loop code not reached" */
|
|
782 /* "statement not reached */
|
|
783 #if defined __SUNPRO_C || defined __USLC__
|
|
784 #define RETURN_SANS_WARNINGS if (1) return
|
|
785 #define RETURN_NOT_REACHED(value)
|
801
|
786 #endif
|
|
787
|
|
788 #ifndef RETURN_NOT_REACHED
|
|
789 #define RETURN_NOT_REACHED(value) return value;
|
|
790 #endif
|
|
791
|
|
792 #ifndef RETURN_SANS_WARNINGS
|
771
|
793 #define RETURN_SANS_WARNINGS return
|
|
794 #endif
|
|
795
|
793
|
796 #ifndef DO_NOTHING
|
|
797 #define DO_NOTHING do {} while (0)
|
|
798 #endif
|
|
799
|
|
800 #ifndef DECLARE_NOTHING
|
|
801 #define DECLARE_NOTHING struct nosuchstruct
|
|
802 #endif
|
|
803
|
|
804 /*#ifdef DEBUG_XEMACS*/
|
|
805 #define REGISTER
|
|
806 #define register
|
|
807 /*#else*/
|
|
808 /*#define REGISTER register*/
|
|
809 /*#endif*/
|
|
810
|
|
811 /* ------------------------ alignment definitions ------------------- */
|
|
812
|
454
|
813 /* No type has a greater alignment requirement than max_align_t.
|
|
814 (except perhaps for types we don't use, like long double) */
|
|
815 typedef union
|
|
816 {
|
|
817 struct { long l; } l;
|
|
818 struct { void *p; } p;
|
|
819 struct { void (*f)(void); } f;
|
|
820 struct { double d; } d;
|
|
821 } max_align_t;
|
|
822
|
771
|
823 /* ALIGNOF returns the required alignment of a type -- i.e. a value such
|
|
824 that data of this type must begin at a memory address which is a
|
|
825 multiple of that value. For simple types, this is often the same size
|
|
826 as the type itself. */
|
|
827
|
428
|
828 #ifndef ALIGNOF
|
|
829 # if defined (__GNUC__) && (__GNUC__ >= 2)
|
454
|
830 /* gcc has an extension that gives us exactly what we want. */
|
|
831 # define ALIGNOF(type) __alignof__ (type)
|
|
832 # elif ! defined (__cplusplus)
|
|
833 /* The following is mostly portable, except that:
|
|
834 - it doesn't work for inside out declarations like void (*) (void).
|
|
835 (so just call ALIGNOF with a typedef'ed name)
|
|
836 - it doesn't work with C++. The C++ committee has decided,
|
|
837 in its infinite wisdom, that:
|
|
838 "Types must be declared in declarations, not in expressions." */
|
|
839 # define ALIGNOF(type) offsetof (struct { char c; type member; }, member)
|
428
|
840 # else
|
456
|
841 /* C++ is annoying, but it has a big bag of tricks.
|
|
842 The following doesn't have the "inside out" declaration bug C does. */
|
458
|
843 template<typename T> struct alignment_trick { char c; T member; };
|
456
|
844 # define ALIGNOF(type) offsetof (alignment_trick<type>, member)
|
428
|
845 # endif
|
454
|
846 #endif /* ALIGNOF */
|
428
|
847
|
771
|
848 /* ALIGN_SIZE returns the smallest size greater than or equal to LEN which
|
|
849 is a multiple of UNIT. This can be used to assure that data that
|
|
850 follows a block of the returned size is of correct alignment for a type
|
|
851 whose alignment (as returned by ALIGNOF) is UNIT (provided that the
|
|
852 block itself is correctly aligned for this type; memory returned by
|
|
853 malloc() is guaranteed to be correctly aligned for all types). */
|
|
854
|
428
|
855 #define ALIGN_SIZE(len, unit) \
|
|
856 ((((len) + (unit) - 1) / (unit)) * (unit))
|
|
857
|
826
|
858 /* ALIGN_FOR_TYPE returns the smallest size greater than or equal to LEN
|
|
859 which is aligned for the given type. This can be used to assure that
|
|
860 data that follows a block of the returned size is of correct alignment
|
|
861 for the type (provided that the block itself is correctly aligned for
|
|
862 this type; memory returned by malloc() is guaranteed to be correctly
|
|
863 aligned for all types). */
|
|
864
|
|
865 #define ALIGN_FOR_TYPE(len, type) ALIGN_SIZE (len, ALIGNOF (type))
|
|
866
|
771
|
867 /* MAX_ALIGN_SIZE returns the smallest size greater than or equal to LEN
|
|
868 which guarantees that data following a block of such size is correctly
|
|
869 aligned for all types (provided that the block itself is so aligned,
|
|
870 which is the case for memory returned by malloc()). */
|
|
871
|
826
|
872 #define MAX_ALIGN_SIZE(len) ALIGN_FOR_TYPE (len, max_align_t)
|
|
873
|
|
874 /* ALIGN_PTR returns the smallest pointer >= PTR which is aligned for
|
|
875 data of TYPE. */
|
|
876 #define ALIGN_PTR(ptr, type) ((void *) ALIGN_FOR_TYPE ((size_t) (ptr), type))
|
428
|
877
|
793
|
878 /* ------------------------ assertions ------------------- */
|
428
|
879
|
|
880 /* We define assert iff USE_ASSERTIONS or DEBUG_XEMACS is defined.
|
|
881 Otherwise we define it to be empty. Quantify has shown that the
|
|
882 time the assert checks take is measurable so let's not include them
|
771
|
883 in production binaries.
|
|
884
|
788
|
885 If ASSERTIONS_DONT_ABORT defined, we will continue after assertion
|
|
886 failures.
|
|
887
|
|
888 assert_at_line() is used for asserts inside of inline functions called
|
|
889 from error-checking macros. If we're not tricky, we just get the file
|
|
890 and line of the inline function, which is not very useful. */
|
428
|
891
|
|
892 #ifdef USE_ASSERTIONS
|
|
893 /* Highly dubious kludge */
|
|
894 /* (thanks, Jamie, I feel better now -- ben) */
|
442
|
895 void assert_failed (const char *, int, const char *);
|
428
|
896 # define abort() (assert_failed (__FILE__, __LINE__, "abort()"))
|
|
897 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
|
788
|
898 # define assert_at_line(x, file, line) \
|
|
899 ((x) ? (void) 0 : assert_failed (file, line, #x))
|
428
|
900 #else
|
|
901 # ifdef DEBUG_XEMACS
|
|
902 # define assert(x) ((x) ? (void) 0 : (void) abort ())
|
788
|
903 # define assert_at_line(x, file, line) assert (x)
|
428
|
904 # else
|
771
|
905 # define assert(x) ((void) 0)
|
788
|
906 # define assert_at_line(x, file, line) assert (x)
|
428
|
907 # endif
|
|
908 #endif
|
|
909
|
771
|
910 #if 0
|
|
911 #ifdef USE_ASSERTIONS
|
|
912 /* Highly dubious kludge */
|
|
913 /* (thanks, Jamie, I feel better now -- ben) */
|
|
914 void assert_failed (const char *, int, const char *);
|
|
915 # define abort() (assert_failed (__FILE__, __LINE__, "abort()"))
|
|
916 # define assert(x) ((x) ? 1 : (assert_failed (__FILE__, __LINE__, #x), 0))
|
|
917 #else
|
|
918 # ifdef DEBUG_XEMACS
|
|
919 # define assert(x) ((x) ? 1 : ((void) abort (), 0))
|
|
920 # else
|
|
921 # define assert(x) (1)
|
|
922 # endif
|
|
923 #endif
|
|
924 #endif /* 0 */
|
|
925
|
793
|
926 /* ------------------------ simple memory allocation ------------------- */
|
|
927
|
|
928 /* Memory allocation */
|
|
929 void malloc_warning (const char *);
|
|
930 void *xmalloc (Bytecount size);
|
|
931 void *xmalloc_and_zero (Bytecount size);
|
|
932 void *xrealloc (void *, Bytecount size);
|
|
933 char *xstrdup (const char *);
|
|
934 /* generally useful */
|
|
935 #define countof(x) ((int) (sizeof(x)/sizeof((x)[0])))
|
|
936 #define xnew(type) ((type *) xmalloc (sizeof (type)))
|
|
937 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type)))
|
|
938 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type)))
|
|
939 #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue)))
|
|
940 #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type)))
|
|
941 #define XREALLOC_ARRAY(ptr, type, len) ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type))))
|
|
942 #define alloca_new(type) ((type *) alloca (sizeof (type)))
|
|
943 #define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type)))
|
|
944
|
|
945 /* also generally useful if you want to avoid arbitrary size limits
|
|
946 but don't need a full dynamic array. Assumes that BASEVAR points
|
|
947 to a malloced array of TYPE objects (or possibly a NULL pointer,
|
|
948 if SIZEVAR is 0), with the total size stored in SIZEVAR. This
|
|
949 macro will realloc BASEVAR as necessary so that it can hold at
|
|
950 least NEEDED_SIZE objects. The reallocing is done by doubling,
|
|
951 which ensures constant amortized time per element. */
|
|
952 #define DO_REALLOC(basevar, sizevar, needed_size, type) do { \
|
|
953 Bytecount do_realloc_needed_size = (needed_size); \
|
|
954 if ((sizevar) < do_realloc_needed_size) \
|
|
955 { \
|
|
956 if ((sizevar) < 32) \
|
|
957 (sizevar) = 32; \
|
|
958 while ((sizevar) < do_realloc_needed_size) \
|
|
959 (sizevar) *= 2; \
|
|
960 XREALLOC_ARRAY (basevar, type, (sizevar)); \
|
|
961 } \
|
|
962 } while (0)
|
|
963
|
|
964 #ifdef ERROR_CHECK_MALLOC
|
|
965 void xfree_1 (void *);
|
|
966 #define xfree(lvalue) do \
|
|
967 { \
|
|
968 void **xfree_ptr = (void **) &(lvalue); \
|
|
969 xfree_1 (*xfree_ptr); \
|
|
970 *xfree_ptr = (void *) 0xDEADBEEF; \
|
|
971 } while (0)
|
|
972 #else
|
|
973 void xfree (void *);
|
|
974 #endif /* ERROR_CHECK_MALLOC */
|
|
975
|
|
976 /* ------------------------ dynamic arrays ------------------- */
|
|
977
|
|
978 #define Dynarr_declare(type) \
|
|
979 type *base; \
|
|
980 int elsize; \
|
|
981 int cur; \
|
|
982 int largest; \
|
|
983 int max
|
|
984
|
|
985 typedef struct dynarr
|
|
986 {
|
|
987 Dynarr_declare (void);
|
|
988 } Dynarr;
|
|
989
|
|
990 void *Dynarr_newf (int elsize);
|
|
991 void Dynarr_resize (void *dy, int size);
|
|
992 void Dynarr_insert_many (void *d, const void *el, int len, int start);
|
|
993 void Dynarr_delete_many (void *d, int start, int len);
|
|
994 void Dynarr_free (void *d);
|
|
995
|
|
996 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type)))
|
|
997 #define Dynarr_new2(dynarr_type, type) \
|
|
998 ((dynarr_type *) Dynarr_newf (sizeof (type)))
|
|
999 #define Dynarr_at(d, pos) ((d)->base[pos])
|
|
1000 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos))
|
|
1001 #define Dynarr_begin(d) Dynarr_atp (d, 0)
|
819
|
1002 #define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d) - 1)
|
793
|
1003 #define Dynarr_sizeof(d) ((d)->cur * (d)->elsize)
|
|
1004
|
800
|
1005 #ifdef ERROR_CHECK_STRUCTURES
|
793
|
1006 DECLARE_INLINE_HEADER (
|
|
1007 Dynarr *
|
|
1008 Dynarr_verify_1 (void *d, const char *file, int line)
|
|
1009 )
|
|
1010 {
|
|
1011 Dynarr *dy = (Dynarr *) d;
|
|
1012 assert_at_line (dy->cur >= 0 && dy->cur <= dy->largest &&
|
|
1013 dy->largest <= dy->max, file, line);
|
|
1014 return dy;
|
|
1015 }
|
|
1016
|
|
1017 #define Dynarr_verify(d) Dynarr_verify_1 (d, __FILE__, __LINE__)
|
|
1018 #else
|
|
1019 #define Dynarr_verify(d) (d)
|
800
|
1020 #endif /* ERROR_CHECK_STRUCTURES */
|
793
|
1021
|
|
1022 #define Dynarr_length(d) (Dynarr_verify (d)->cur)
|
|
1023 #define Dynarr_largest(d) (Dynarr_verify (d)->largest)
|
|
1024 #define Dynarr_reset(d) (Dynarr_verify (d)->cur = 0)
|
|
1025 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur)
|
|
1026 #define Dynarr_insert_many_at_start(d, el, len) \
|
|
1027 Dynarr_insert_many (d, el, len, 0)
|
|
1028 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1)
|
|
1029 #define Dynarr_add_lisp_string(d, s, codesys) \
|
|
1030 do { \
|
|
1031 Lisp_Object dyna_ls_s = (s); \
|
|
1032 Lisp_Object dyna_ls_cs = (codesys); \
|
|
1033 Extbyte *dyna_ls_eb; \
|
|
1034 Bytecount dyna_ls_bc; \
|
|
1035 \
|
|
1036 TO_EXTERNAL_FORMAT (LISP_STRING, dyna_ls_s, \
|
|
1037 ALLOCA, (dyna_ls_eb, dyna_ls_bc), \
|
|
1038 dyna_ls_cs); \
|
|
1039 Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \
|
|
1040 } while (0)
|
|
1041
|
|
1042 #define Dynarr_add(d, el) ( \
|
|
1043 Dynarr_verify (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : \
|
|
1044 (void) 0, \
|
|
1045 ((d)->base)[(d)->cur++] = (el), \
|
|
1046 (d)->cur > (d)->largest ? (d)->largest = (d)->cur : (int) 0)
|
|
1047
|
|
1048 /* The following defines will get you into real trouble if you aren't
|
|
1049 careful. But they can save a lot of execution time when used wisely. */
|
|
1050 #define Dynarr_increment(d) ((d)->cur++)
|
|
1051 #define Dynarr_set_size(d, n) ((d)->cur = n)
|
|
1052
|
|
1053 #define Dynarr_pop(d) \
|
|
1054 (assert ((d)->cur > 0), (d)->cur--, Dynarr_at (d, (d)->cur))
|
|
1055 #define Dynarr_delete(d, i) Dynarr_delete_many (d, i, len)
|
|
1056 #define Dynarr_delete_by_pointer(d, p) \
|
|
1057 Dynarr_delete_many (d, (p) - ((d)->base), 1)
|
|
1058
|
|
1059 #ifdef MEMORY_USAGE_STATS
|
|
1060 struct overhead_stats;
|
|
1061 Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats);
|
|
1062 #endif
|
428
|
1063
|
|
1064
|
|
1065 /************************************************************************/
|
|
1066 /* typedefs */
|
|
1067 /************************************************************************/
|
|
1068
|
647
|
1069 /* Note that the simplest typedefs are near the top of this file. */
|
|
1070
|
428
|
1071 /* We put typedefs here so that prototype declarations don't choke.
|
|
1072 Note that we don't actually declare the structures here (except
|
|
1073 maybe for simple structures like Dynarrs); that keeps them private
|
|
1074 to the routines that actually use them. */
|
|
1075
|
771
|
1076 /* ------------------------------- */
|
|
1077 /* Error_Behavior typedefs */
|
|
1078 /* ------------------------------- */
|
|
1079
|
800
|
1080 #ifndef ERROR_CHECK_TYPES
|
771
|
1081
|
|
1082 typedef enum error_behavior
|
428
|
1083 {
|
771
|
1084 ERROR_ME,
|
|
1085 ERROR_ME_NOT,
|
793
|
1086 ERROR_ME_WARN,
|
|
1087 ERROR_ME_DEBUG_WARN
|
771
|
1088 } Error_Behavior;
|
|
1089
|
|
1090 #define ERRB_EQ(a, b) ((a) == (b))
|
|
1091
|
|
1092 #else
|
|
1093
|
|
1094 /* By defining it like this, we provide strict type-checking
|
|
1095 for code that lazily uses ints. */
|
|
1096
|
|
1097 typedef struct _error_behavior_struct_
|
428
|
1098 {
|
771
|
1099 int really_unlikely_name_to_have_accidentally_in_a_non_errb_structure;
|
|
1100 } Error_Behavior;
|
|
1101
|
|
1102 extern Error_Behavior ERROR_ME;
|
|
1103 extern Error_Behavior ERROR_ME_NOT;
|
|
1104 extern Error_Behavior ERROR_ME_WARN;
|
793
|
1105 extern Error_Behavior ERROR_ME_DEBUG_WARN;
|
771
|
1106
|
|
1107 #define ERRB_EQ(a, b) \
|
|
1108 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \
|
|
1109 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure)
|
|
1110
|
|
1111 #endif
|
|
1112
|
|
1113 /* ------------------------------- */
|
|
1114 /* Empty structures and typedefs */
|
|
1115 /* ------------------------------- */
|
428
|
1116
|
|
1117 struct buffer; /* "buffer.h" */
|
|
1118 struct console; /* "console.h" */
|
|
1119 struct device; /* "device.h" */
|
|
1120 struct extent_fragment;
|
|
1121 struct extent;
|
|
1122 struct frame; /* "frame.h" */
|
|
1123 struct window; /* "window.h" */
|
|
1124 struct stat; /* <sys/stat.h> */
|
771
|
1125 struct utimbuf; /* "systime.h" or <utime.h> */
|
428
|
1126 struct display_line;
|
|
1127 struct display_glyph_area;
|
|
1128 struct display_box;
|
|
1129 struct redisplay_info;
|
|
1130 struct window_mirror;
|
|
1131 struct scrollbar_instance;
|
|
1132 struct font_metric_info;
|
|
1133 struct face_cachel;
|
|
1134 struct console_type_entry;
|
|
1135
|
771
|
1136 /* This is shared by process.h, events.h and others in future.
|
|
1137 See events.h for description */
|
|
1138 typedef unsigned int USID;
|
|
1139 typedef int face_index;
|
|
1140 typedef int glyph_index;
|
|
1141 typedef struct lstream Lstream;
|
|
1142 typedef struct extent *EXTENT;
|
|
1143 typedef struct Lisp_Event Lisp_Event; /* "events.h" */
|
|
1144 typedef struct Lisp_Face Lisp_Face; /* "faces.h" */
|
|
1145 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */
|
|
1146 typedef struct Lisp_Color_Instance Lisp_Color_Instance;
|
|
1147 typedef struct Lisp_Font_Instance Lisp_Font_Instance;
|
|
1148 typedef struct Lisp_Image_Instance Lisp_Image_Instance;
|
|
1149 typedef struct Lisp_Gui_Item Lisp_Gui_Item;
|
|
1150
|
|
1151 /* ------------------------------- */
|
|
1152 /* Dynarr typedefs */
|
|
1153 /* ------------------------------- */
|
|
1154
|
|
1155 /* Dynarr typedefs -- basic types first */
|
|
1156
|
428
|
1157 typedef struct
|
|
1158 {
|
665
|
1159 Dynarr_declare (Intbyte);
|
|
1160 } Intbyte_dynarr;
|
428
|
1161
|
|
1162 typedef struct
|
|
1163 {
|
|
1164 Dynarr_declare (Extbyte);
|
|
1165 } Extbyte_dynarr;
|
|
1166
|
|
1167 typedef struct
|
|
1168 {
|
|
1169 Dynarr_declare (Emchar);
|
|
1170 } Emchar_dynarr;
|
|
1171
|
|
1172 typedef struct
|
|
1173 {
|
|
1174 Dynarr_declare (char);
|
|
1175 } char_dynarr;
|
|
1176
|
771
|
1177 typedef struct
|
|
1178 {
|
|
1179 Dynarr_declare (char *);
|
|
1180 } char_ptr_dynarr;
|
|
1181
|
428
|
1182 typedef unsigned char unsigned_char;
|
|
1183 typedef struct
|
|
1184 {
|
|
1185 Dynarr_declare (unsigned char);
|
|
1186 } unsigned_char_dynarr;
|
|
1187
|
|
1188 typedef unsigned long unsigned_long;
|
|
1189 typedef struct
|
|
1190 {
|
|
1191 Dynarr_declare (unsigned long);
|
|
1192 } unsigned_long_dynarr;
|
|
1193
|
|
1194 typedef struct
|
|
1195 {
|
|
1196 Dynarr_declare (int);
|
|
1197 } int_dynarr;
|
|
1198
|
|
1199 typedef struct
|
|
1200 {
|
665
|
1201 Dynarr_declare (Charbpos);
|
|
1202 } Charbpos_dynarr;
|
428
|
1203
|
|
1204 typedef struct
|
|
1205 {
|
665
|
1206 Dynarr_declare (Bytebpos);
|
|
1207 } Bytebpos_dynarr;
|
428
|
1208
|
|
1209 typedef struct
|
|
1210 {
|
|
1211 Dynarr_declare (Charcount);
|
|
1212 } Charcount_dynarr;
|
|
1213
|
|
1214 typedef struct
|
|
1215 {
|
|
1216 Dynarr_declare (Bytecount);
|
|
1217 } Bytecount_dynarr;
|
|
1218
|
771
|
1219 /* Dynarr typedefs -- more complex types */
|
|
1220
|
|
1221 typedef struct
|
|
1222 {
|
|
1223 Dynarr_declare (struct face_cachel);
|
|
1224 } face_cachel_dynarr;
|
|
1225
|
|
1226 typedef struct
|
|
1227 {
|
|
1228 Dynarr_declare (struct glyph_cachel);
|
|
1229 } glyph_cachel_dynarr;
|
|
1230
|
428
|
1231 typedef struct
|
|
1232 {
|
|
1233 Dynarr_declare (struct console_type_entry);
|
|
1234 } console_type_entry_dynarr;
|
|
1235
|
771
|
1236 /* ------------------------------- */
|
|
1237 /* enum typedefs */
|
|
1238 /* ------------------------------- */
|
|
1239
|
428
|
1240 enum run_hooks_condition
|
|
1241 {
|
|
1242 RUN_HOOKS_TO_COMPLETION,
|
|
1243 RUN_HOOKS_UNTIL_SUCCESS,
|
|
1244 RUN_HOOKS_UNTIL_FAILURE
|
|
1245 };
|
|
1246
|
|
1247 #ifdef HAVE_TOOLBARS
|
|
1248 enum toolbar_pos
|
|
1249 {
|
|
1250 TOP_TOOLBAR,
|
|
1251 BOTTOM_TOOLBAR,
|
|
1252 LEFT_TOOLBAR,
|
|
1253 RIGHT_TOOLBAR
|
|
1254 };
|
|
1255 #endif
|
|
1256
|
|
1257 enum edge_style
|
|
1258 {
|
|
1259 EDGE_ETCHED_IN,
|
|
1260 EDGE_ETCHED_OUT,
|
|
1261 EDGE_BEVEL_IN,
|
|
1262 EDGE_BEVEL_OUT
|
|
1263 };
|
|
1264
|
|
1265 enum munge_me_out_the_door
|
|
1266 {
|
|
1267 MUNGE_ME_FUNCTION_KEY,
|
|
1268 MUNGE_ME_KEY_TRANSLATION
|
|
1269 };
|
|
1270
|
771
|
1271 /* ------------------------------- */
|
|
1272 /* misc */
|
|
1273 /* ------------------------------- */
|
|
1274
|
|
1275 #ifdef MEMORY_USAGE_STATS
|
|
1276
|
|
1277 /* This structure is used to keep statistics on the amount of memory
|
|
1278 in use.
|
|
1279
|
|
1280 WAS_REQUESTED stores the actual amount of memory that was requested
|
|
1281 of the allocation function. The *_OVERHEAD fields store the
|
|
1282 additional amount of memory that was grabbed by the functions to
|
|
1283 facilitate allocation, reallocation, etc. MALLOC_OVERHEAD is for
|
|
1284 memory allocated with malloc(); DYNARR_OVERHEAD is for dynamic
|
|
1285 arrays; GAP_OVERHEAD is for gap arrays. Note that for (e.g.)
|
|
1286 dynamic arrays, there is both MALLOC_OVERHEAD and DYNARR_OVERHEAD
|
|
1287 memory: The dynamic array allocates memory above and beyond what
|
|
1288 was asked of it, and when it in turns allocates memory using
|
|
1289 malloc(), malloc() allocates memory beyond what it was asked
|
|
1290 to allocate.
|
|
1291
|
|
1292 Functions that accept a structure of this sort do not initialize
|
|
1293 the fields to 0, and add any existing values to whatever was there
|
|
1294 before; this way, you can get a cumulative effect. */
|
|
1295
|
|
1296 struct overhead_stats
|
|
1297 {
|
|
1298 int was_requested;
|
|
1299 int malloc_overhead;
|
|
1300 int dynarr_overhead;
|
|
1301 int gap_overhead;
|
|
1302 };
|
|
1303
|
|
1304 #endif /* MEMORY_USAGE_STATS */
|
|
1305
|
428
|
1306
|
|
1307 /************************************************************************/
|
|
1308 /* Definition of Lisp_Object data type */
|
|
1309 /************************************************************************/
|
|
1310
|
|
1311 /* Define the fundamental Lisp data structures */
|
|
1312
|
|
1313 /* This is the set of Lisp data types */
|
|
1314
|
|
1315 enum Lisp_Type
|
|
1316 {
|
|
1317 Lisp_Type_Record,
|
|
1318 Lisp_Type_Int_Even,
|
|
1319 Lisp_Type_Char,
|
|
1320 Lisp_Type_Int_Odd
|
|
1321 };
|
|
1322
|
|
1323 #define POINTER_TYPE_P(type) ((type) == Lisp_Type_Record)
|
|
1324
|
|
1325 /* Overridden by m/next.h */
|
|
1326 #ifndef ASSERT_VALID_POINTER
|
|
1327 # define ASSERT_VALID_POINTER(pnt) (assert ((((EMACS_UINT) pnt) & 3) == 0))
|
|
1328 #endif
|
|
1329
|
|
1330 #define GCMARKBITS 0
|
|
1331 #define GCTYPEBITS 2
|
|
1332 #define GCBITS 2
|
|
1333 #define INT_GCBITS 1
|
|
1334
|
|
1335 #define INT_VALBITS (BITS_PER_EMACS_INT - INT_GCBITS)
|
|
1336 #define VALBITS (BITS_PER_EMACS_INT - GCBITS)
|
542
|
1337 #define EMACS_INT_MAX ((EMACS_INT) ((1UL << (INT_VALBITS - 1)) -1UL))
|
442
|
1338 #define EMACS_INT_MIN (-(EMACS_INT_MAX) - 1)
|
802
|
1339 /* WARNING: evaluates its arg twice. */
|
|
1340 #define NUMBER_FITS_IN_AN_EMACS_INT(num) \
|
|
1341 ((num) <= EMACS_INT_MAX && (num) >= EMACS_INT_MIN)
|
428
|
1342
|
|
1343 #ifdef USE_UNION_TYPE
|
|
1344 # include "lisp-union.h"
|
|
1345 #else /* !USE_UNION_TYPE */
|
|
1346 # include "lisp-disunion.h"
|
|
1347 #endif /* !USE_UNION_TYPE */
|
|
1348
|
|
1349 #define XPNTR(x) ((void *) XPNTRVAL(x))
|
|
1350
|
|
1351 /* WARNING WARNING WARNING. You must ensure on your own that proper
|
|
1352 GC protection is provided for the elements in this array. */
|
|
1353 typedef struct
|
|
1354 {
|
|
1355 Dynarr_declare (Lisp_Object);
|
|
1356 } Lisp_Object_dynarr;
|
|
1357
|
452
|
1358 typedef struct
|
|
1359 {
|
|
1360 Dynarr_declare (Lisp_Object *);
|
|
1361 } Lisp_Object_ptr_dynarr;
|
|
1362
|
428
|
1363 /* Close your eyes now lest you vomit or spontaneously combust ... */
|
|
1364
|
|
1365 #define HACKEQ_UNSAFE(obj1, obj2) \
|
|
1366 (EQ (obj1, obj2) || (!POINTER_TYPE_P (XTYPE (obj1)) \
|
|
1367 && !POINTER_TYPE_P (XTYPE (obj2)) \
|
|
1368 && XCHAR_OR_INT (obj1) == XCHAR_OR_INT (obj2)))
|
|
1369
|
|
1370 #ifdef DEBUG_XEMACS
|
|
1371 extern int debug_issue_ebola_notices;
|
|
1372 int eq_with_ebola_notice (Lisp_Object, Lisp_Object);
|
|
1373 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) \
|
|
1374 (debug_issue_ebola_notices ? eq_with_ebola_notice (obj1, obj2) \
|
|
1375 : EQ (obj1, obj2))
|
|
1376 #else
|
|
1377 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) EQ (obj1, obj2)
|
|
1378 #endif
|
|
1379
|
|
1380 /* OK, you can open them again */
|
|
1381
|
|
1382
|
|
1383 /************************************************************************/
|
442
|
1384 /** Definitions of basic Lisp objects **/
|
428
|
1385 /************************************************************************/
|
|
1386
|
|
1387 #include "lrecord.h"
|
|
1388
|
442
|
1389 /*------------------------------ unbound -------------------------------*/
|
428
|
1390
|
|
1391 /* Qunbound is a special Lisp_Object (actually of type
|
|
1392 symbol-value-forward), that can never be visible to
|
|
1393 the Lisp caller and thus can be used in the C code
|
|
1394 to mean "no such value". */
|
|
1395
|
|
1396 #define UNBOUNDP(val) EQ (val, Qunbound)
|
|
1397
|
771
|
1398 /* Evaluate expr, return it if it's not Qunbound. */
|
|
1399 #define RETURN_IF_NOT_UNBOUND(expr) do \
|
|
1400 { \
|
|
1401 Lisp_Object ret_nunb_val = (expr); \
|
|
1402 if (!UNBOUNDP (ret_nunb_val)) \
|
|
1403 RETURN_SANS_WARNINGS ret_nunb_val; \
|
|
1404 } while (0)
|
|
1405
|
442
|
1406 /*------------------------------- cons ---------------------------------*/
|
428
|
1407
|
|
1408 /* In a cons, the markbit of the car is the gc mark bit */
|
|
1409
|
|
1410 struct Lisp_Cons
|
|
1411 {
|
|
1412 struct lrecord_header lheader;
|
|
1413 Lisp_Object car, cdr;
|
|
1414 };
|
|
1415 typedef struct Lisp_Cons Lisp_Cons;
|
|
1416
|
|
1417 #if 0 /* FSFmacs */
|
|
1418 /* Like a cons, but records info on where the text lives that it was read from */
|
|
1419 /* This is not really in use now */
|
|
1420
|
|
1421 struct Lisp_Buffer_Cons
|
|
1422 {
|
|
1423 Lisp_Object car, cdr;
|
|
1424 struct buffer *buffer;
|
665
|
1425 int charbpos;
|
428
|
1426 };
|
|
1427 #endif
|
|
1428
|
|
1429 DECLARE_LRECORD (cons, Lisp_Cons);
|
|
1430 #define XCONS(x) XRECORD (x, cons, Lisp_Cons)
|
617
|
1431 #define wrap_cons(p) wrap_record (p, cons)
|
428
|
1432 #define CONSP(x) RECORDP (x, cons)
|
|
1433 #define CHECK_CONS(x) CHECK_RECORD (x, cons)
|
|
1434 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons)
|
|
1435
|
|
1436 #define CONS_MARKED_P(c) MARKED_RECORD_HEADER_P(&((c)->lheader))
|
|
1437 #define MARK_CONS(c) MARK_RECORD_HEADER (&((c)->lheader))
|
|
1438
|
|
1439 extern Lisp_Object Qnil;
|
|
1440
|
|
1441 #define NILP(x) EQ (x, Qnil)
|
|
1442 #define XCAR(a) (XCONS (a)->car)
|
|
1443 #define XCDR(a) (XCONS (a)->cdr)
|
|
1444 #define LISTP(x) (CONSP(x) || NILP(x))
|
|
1445
|
|
1446 #define CHECK_LIST(x) do { \
|
|
1447 if (!LISTP (x)) \
|
|
1448 dead_wrong_type_argument (Qlistp, x); \
|
|
1449 } while (0)
|
|
1450
|
|
1451 #define CONCHECK_LIST(x) do { \
|
|
1452 if (!LISTP (x)) \
|
|
1453 x = wrong_type_argument (Qlistp, x); \
|
|
1454 } while (0)
|
|
1455
|
442
|
1456 /*---------------------- list traversal macros -------------------------*/
|
|
1457
|
|
1458 /* Note: These macros are for traversing through a list in some format,
|
|
1459 and executing code that you specify on each member of the list.
|
|
1460
|
|
1461 There are two kinds of macros, those requiring surrounding braces, and
|
|
1462 those not requiring this. Which type of macro will be indicated.
|
|
1463 The general format for using a brace-requiring macro is
|
|
1464
|
|
1465 {
|
|
1466 LIST_LOOP_3 (elt, list, tail)
|
|
1467 execute_code_here;
|
|
1468 }
|
|
1469
|
|
1470 or
|
|
1471
|
|
1472 {
|
|
1473 LIST_LOOP_3 (elt, list, tail)
|
|
1474 {
|
|
1475 execute_code_here;
|
|
1476 }
|
|
1477 }
|
|
1478
|
|
1479 You can put variable declarations between the brace and beginning of
|
|
1480 macro, but NOTHING ELSE.
|
|
1481
|
|
1482 The brace-requiring macros typically declare themselves any arguments
|
|
1483 that are initialized and iterated by the macros. If for some reason
|
|
1484 you need to declare these arguments yourself (e.g. to do something on
|
|
1485 them before the iteration starts, use the _NO_DECLARE versions of the
|
|
1486 macros.)
|
|
1487 */
|
|
1488
|
|
1489 /* There are two basic kinds of macros: those that handle "internal" lists
|
|
1490 that are known to be correctly structured (i.e. first element is a cons
|
|
1491 or nil, and the car of each cons is also a cons or nil, and there are
|
|
1492 no circularities), and those that handle "external" lists, where the
|
|
1493 list may have any sort of invalid formation. This is reflected in
|
|
1494 the names: those with "EXTERNAL_" work with external lists, and those
|
|
1495 without this prefix work with internal lists. The internal-list
|
|
1496 macros will hit an assertion failure if the structure is ill-formed;
|
|
1497 the external-list macros will signal an error in this case, either a
|
|
1498 malformed-list error or a circular-list error.
|
|
1499
|
|
1500 Note also that the simplest external list iterator, EXTERNAL_LIST_LOOP,
|
|
1501 does *NOT* check for circularities. Therefore, make sure you call
|
|
1502 QUIT each iteration or so. However, it's probably easier just to use
|
|
1503 EXTERNAL_LIST_LOOP_2, which is easier to use in any case.
|
|
1504 */
|
|
1505
|
|
1506 /* LIST_LOOP and EXTERNAL_LIST_LOOP are the simplest macros. They don't
|
|
1507 require brace surrounding, and iterate through a list, which may or may
|
|
1508 not known to be syntactically correct. EXTERNAL_LIST_LOOP is for those
|
|
1509 not known to be correct, and it detects and signals a malformed list
|
|
1510 error when encountering a problem. Circularities, however, are not
|
|
1511 handled, and cause looping forever, so make sure to include a QUIT.
|
|
1512 These functions also accept two args, TAIL (set progressively to each
|
|
1513 cons starting with the first), and LIST, the list to iterate over.
|
|
1514 TAIL needs to be defined by the program.
|
|
1515
|
|
1516 In each iteration, you can retrieve the current list item using XCAR
|
|
1517 (tail), or destructively modify the list using XSETCAR (tail,
|
|
1518 ...). */
|
|
1519
|
428
|
1520 #define LIST_LOOP(tail, list) \
|
|
1521 for (tail = list; \
|
|
1522 !NILP (tail); \
|
|
1523 tail = XCDR (tail))
|
|
1524
|
|
1525 #define EXTERNAL_LIST_LOOP(tail, list) \
|
|
1526 for (tail = list; !NILP (tail); tail = XCDR (tail)) \
|
|
1527 if (!CONSP (tail)) \
|
|
1528 signal_malformed_list_error (list); \
|
|
1529 else
|
|
1530
|
442
|
1531 /* The following macros are the "core" macros for list traversal.
|
|
1532
|
|
1533 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
|
|
1534
|
|
1535 LIST_LOOP_2 and EXTERNAL_LIST_LOOP_2 are the standard, most-often used
|
|
1536 macros. They take two arguments, an element variable ELT and the list
|
|
1537 LIST. ELT is automatically declared, and set to each element in turn
|
|
1538 from LIST.
|
|
1539
|
|
1540 LIST_LOOP_3 and EXTERNAL_LIST_LOOP_3 are the same, but they have a third
|
|
1541 argument TAIL, another automatically-declared variable. At each iteration,
|
|
1542 this one points to the cons cell for which ELT is the car.
|
|
1543
|
|
1544 EXTERNAL_LIST_LOOP_4 is like EXTERNAL_LIST_LOOP_3 but takes an additional
|
|
1545 LEN argument, again automatically declared, which counts the number of
|
|
1546 iterations gone by. It is 0 during the first iteration.
|
|
1547
|
|
1548 EXTERNAL_LIST_LOOP_4_NO_DECLARE is like EXTERNAL_LIST_LOOP_4 but none
|
|
1549 of the variables are automatically declared, and so you need to declare
|
|
1550 them yourself. (ELT and TAIL are Lisp_Objects, and LEN is an EMACS_INT.)
|
|
1551 */
|
|
1552
|
|
1553 #define LIST_LOOP_2(elt, list) \
|
|
1554 LIST_LOOP_3(elt, list, unused_tail_##elt)
|
|
1555
|
|
1556 #define LIST_LOOP_3(elt, list, tail) \
|
|
1557 Lisp_Object elt, tail; \
|
|
1558 for (tail = list; \
|
|
1559 NILP (tail) ? \
|
|
1560 0 : (elt = XCAR (tail), 1); \
|
|
1561 tail = XCDR (tail))
|
428
|
1562
|
|
1563 /* The following macros are for traversing lisp lists.
|
|
1564 Signal an error if LIST is not properly acyclic and nil-terminated.
|
|
1565
|
|
1566 Use tortoise/hare algorithm to check for cycles, but only if it
|
|
1567 looks like the list is getting too long. Not only is the hare
|
|
1568 faster than the tortoise; it even gets a head start! */
|
|
1569
|
|
1570 /* Optimized and safe macros for looping over external lists. */
|
|
1571 #define CIRCULAR_LIST_SUSPICION_LENGTH 1024
|
|
1572
|
|
1573 #define EXTERNAL_LIST_LOOP_1(list) \
|
|
1574 Lisp_Object ELL1_elt, ELL1_hare, ELL1_tortoise; \
|
442
|
1575 EMACS_INT ELL1_len; \
|
|
1576 PRIVATE_EXTERNAL_LIST_LOOP_6 (ELL1_elt, list, ELL1_len, ELL1_hare, \
|
428
|
1577 ELL1_tortoise, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1578
|
|
1579 #define EXTERNAL_LIST_LOOP_2(elt, list) \
|
442
|
1580 Lisp_Object elt, hare_##elt, tortoise_##elt; \
|
|
1581 EMACS_INT len_##elt; \
|
|
1582 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, hare_##elt, \
|
428
|
1583 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1584
|
|
1585 #define EXTERNAL_LIST_LOOP_3(elt, list, tail) \
|
442
|
1586 Lisp_Object elt, tail, tortoise_##elt; \
|
|
1587 EMACS_INT len_##elt; \
|
|
1588 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, tail, \
|
|
1589 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1590
|
|
1591 #define EXTERNAL_LIST_LOOP_4_NO_DECLARE(elt, list, tail, len) \
|
428
|
1592 Lisp_Object tortoise_##elt; \
|
442
|
1593 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
|
428
|
1594 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1595
|
|
1596 #define EXTERNAL_LIST_LOOP_4(elt, list, tail, len) \
|
442
|
1597 Lisp_Object elt, tail, tortoise_##elt; \
|
|
1598 EMACS_INT len; \
|
|
1599 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
|
428
|
1600 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1601
|
|
1602
|
444
|
1603 #define PRIVATE_EXTERNAL_LIST_LOOP_6(elt, list, len, hare, \
|
|
1604 tortoise, suspicion_length) \
|
|
1605 for (tortoise = hare = list, len = 0; \
|
|
1606 \
|
|
1607 (CONSP (hare) ? ((elt = XCAR (hare)), 1) : \
|
|
1608 (NILP (hare) ? 0 : \
|
|
1609 (signal_malformed_list_error (list), 0))); \
|
|
1610 \
|
|
1611 hare = XCDR (hare), \
|
|
1612 (void) \
|
|
1613 ((++len > suspicion_length) \
|
|
1614 && \
|
|
1615 ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \
|
|
1616 (EQ (hare, tortoise) && (signal_circular_list_error (list), 0)))))
|
428
|
1617
|
442
|
1618 /* GET_LIST_LENGTH and GET_EXTERNAL_LIST_LENGTH:
|
|
1619
|
|
1620 These two macros return the length of LIST (either an internal or external
|
|
1621 list, according to which macro is used), stored into LEN (which must
|
|
1622 be declared by the caller). Circularities are trapped in external lists
|
|
1623 (and cause errors). Neither macro need be declared inside brackets. */
|
|
1624
|
|
1625 #define GET_LIST_LENGTH(list, len) do { \
|
|
1626 Lisp_Object GLL_tail; \
|
|
1627 for (GLL_tail = list, len = 0; \
|
|
1628 !NILP (GLL_tail); \
|
|
1629 GLL_tail = XCDR (GLL_tail), ++len) \
|
|
1630 DO_NOTHING; \
|
|
1631 } while (0)
|
|
1632
|
|
1633 #define GET_EXTERNAL_LIST_LENGTH(list, len) \
|
|
1634 do { \
|
|
1635 Lisp_Object GELL_elt, GELL_tail; \
|
|
1636 EXTERNAL_LIST_LOOP_4_NO_DECLARE (GELL_elt, list, GELL_tail, len) \
|
|
1637 ; \
|
|
1638 } while (0)
|
|
1639
|
|
1640 /* For a list that's known to be in valid list format, where we may
|
|
1641 be deleting the current element out of the list --
|
|
1642 will abort() if the list is not in valid format */
|
|
1643 #define LIST_LOOP_DELETING(consvar, nextconsvar, list) \
|
|
1644 for (consvar = list; \
|
|
1645 !NILP (consvar) ? (nextconsvar = XCDR (consvar), 1) :0; \
|
|
1646 consvar = nextconsvar)
|
|
1647
|
|
1648 /* LIST_LOOP_DELETE_IF and EXTERNAL_LIST_LOOP_DELETE_IF:
|
|
1649
|
|
1650 These two macros delete all elements of LIST (either an internal or
|
|
1651 external list, according to which macro is used) satisfying
|
|
1652 CONDITION, a C expression referring to variable ELT. ELT is
|
|
1653 automatically declared. Circularities are trapped in external
|
|
1654 lists (and cause errors). Neither macro need be declared inside
|
|
1655 brackets. */
|
|
1656
|
|
1657 #define LIST_LOOP_DELETE_IF(elt, list, condition) do { \
|
|
1658 /* Do not use ##list when creating new variables because \
|
|
1659 that may not be just a variable name. */ \
|
|
1660 Lisp_Object prev_tail_##elt = Qnil; \
|
|
1661 LIST_LOOP_3 (elt, list, tail_##elt) \
|
|
1662 { \
|
|
1663 if (condition) \
|
|
1664 { \
|
|
1665 if (NILP (prev_tail_##elt)) \
|
|
1666 list = XCDR (tail_##elt); \
|
|
1667 else \
|
|
1668 XCDR (prev_tail_##elt) = XCDR (tail_##elt); \
|
|
1669 } \
|
|
1670 else \
|
|
1671 prev_tail_##elt = tail_##elt; \
|
|
1672 } \
|
|
1673 } while (0)
|
|
1674
|
|
1675 #define EXTERNAL_LIST_LOOP_DELETE_IF(elt, list, condition) do { \
|
|
1676 Lisp_Object prev_tail_##elt = Qnil; \
|
|
1677 EXTERNAL_LIST_LOOP_4 (elt, list, tail_##elt, len_##elt) \
|
|
1678 { \
|
|
1679 if (condition) \
|
|
1680 { \
|
|
1681 if (NILP (prev_tail_##elt)) \
|
|
1682 list = XCDR (tail_##elt); \
|
|
1683 else \
|
|
1684 XCDR (prev_tail_##elt) = XCDR (tail_##elt); \
|
|
1685 /* Keep tortoise from ever passing hare. */ \
|
|
1686 len_##elt = 0; \
|
|
1687 } \
|
|
1688 else \
|
|
1689 prev_tail_##elt = tail_##elt; \
|
|
1690 } \
|
|
1691 } while (0)
|
|
1692
|
|
1693
|
|
1694 /* Macros for looping over external alists.
|
|
1695
|
|
1696 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
|
|
1697
|
|
1698 EXTERNAL_ALIST_LOOP_4 is similar to EXTERNAL_LIST_LOOP_2, but it
|
|
1699 assumes the elements are aconses (the elements in an alist) and
|
|
1700 sets two additional argument variables ELT_CAR and ELT_CDR to the
|
|
1701 car and cdr of the acons. All of the variables ELT, ELT_CAR and
|
|
1702 ELT_CDR are automatically declared.
|
|
1703
|
|
1704 EXTERNAL_ALIST_LOOP_5 adds a TAIL argument to EXTERNAL_ALIST_LOOP_4,
|
|
1705 just like EXTERNAL_LIST_LOOP_3 does, and again TAIL is automatically
|
|
1706 declared.
|
|
1707
|
|
1708 EXTERNAL_ALIST_LOOP_6 adds a LEN argument to EXTERNAL_ALIST_LOOP_5,
|
|
1709 just like EXTERNAL_LIST_LOOP_4 does, and again LEN is automatically
|
|
1710 declared.
|
|
1711
|
|
1712 EXTERNAL_ALIST_LOOP_6_NO_DECLARE does not declare any of its arguments,
|
|
1713 just like EXTERNAL_LIST_LOOP_4_NO_DECLARE, and so these must be declared
|
|
1714 manually.
|
|
1715 */
|
428
|
1716
|
|
1717 /* Optimized and safe macros for looping over external alists. */
|
|
1718 #define EXTERNAL_ALIST_LOOP_4(elt, elt_car, elt_cdr, list) \
|
442
|
1719 Lisp_Object elt, elt_car, elt_cdr; \
|
428
|
1720 Lisp_Object hare_##elt, tortoise_##elt; \
|
|
1721 EMACS_INT len_##elt; \
|
442
|
1722 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
|
428
|
1723 len_##elt, hare_##elt, tortoise_##elt, \
|
|
1724 CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1725
|
|
1726 #define EXTERNAL_ALIST_LOOP_5(elt, elt_car, elt_cdr, list, tail) \
|
442
|
1727 Lisp_Object elt, elt_car, elt_cdr, tail; \
|
428
|
1728 Lisp_Object tortoise_##elt; \
|
|
1729 EMACS_INT len_##elt; \
|
442
|
1730 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
|
428
|
1731 len_##elt, tail, tortoise_##elt, \
|
|
1732 CIRCULAR_LIST_SUSPICION_LENGTH) \
|
|
1733
|
|
1734 #define EXTERNAL_ALIST_LOOP_6(elt, elt_car, elt_cdr, list, tail, len) \
|
442
|
1735 Lisp_Object elt, elt_car, elt_cdr, tail; \
|
|
1736 EMACS_INT len; \
|
428
|
1737 Lisp_Object tortoise_##elt; \
|
442
|
1738 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
|
428
|
1739 len, tail, tortoise_##elt, \
|
|
1740 CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1741
|
442
|
1742 #define EXTERNAL_ALIST_LOOP_6_NO_DECLARE(elt, elt_car, elt_cdr, list, \
|
|
1743 tail, len) \
|
|
1744 Lisp_Object tortoise_##elt; \
|
|
1745 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
|
|
1746 len, tail, tortoise_##elt, \
|
|
1747 CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1748
|
|
1749
|
|
1750 #define PRIVATE_EXTERNAL_ALIST_LOOP_8(elt, elt_car, elt_cdr, list, len, \
|
|
1751 hare, tortoise, suspicion_length) \
|
|
1752 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, hare, tortoise, \
|
|
1753 suspicion_length) \
|
428
|
1754 if (CONSP (elt) ? (elt_car = XCAR (elt), elt_cdr = XCDR (elt), 0) :1) \
|
|
1755 continue; \
|
|
1756 else
|
|
1757
|
442
|
1758 /* Macros for looping over external property lists.
|
|
1759
|
|
1760 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
|
|
1761
|
|
1762 EXTERNAL_PROPERTY_LIST_LOOP_3 maps over an external list assumed to
|
|
1763 be a property list, consisting of alternating pairs of keys
|
|
1764 (typically symbols or keywords) and values. Each iteration
|
|
1765 processes one such pair out of LIST, assigning the two elements to
|
|
1766 KEY and VALUE respectively. Malformed lists and circularities are
|
|
1767 trapped as usual, and in addition, property lists with an odd number
|
|
1768 of elements also signal an error.
|
|
1769
|
|
1770 EXTERNAL_PROPERTY_LIST_LOOP_4 adds a TAIL argument to
|
|
1771 EXTERNAL_PROPERTY_LIST_LOOP_3, just like EXTERNAL_LIST_LOOP_3 does,
|
|
1772 and again TAIL is automatically declared.
|
|
1773
|
|
1774 EXTERNAL_PROPERTY_LIST_LOOP_5 adds a LEN argument to
|
|
1775 EXTERNAL_PROPERTY_LIST_LOOP_4, just like EXTERNAL_LIST_LOOP_4 does,
|
|
1776 and again LEN is automatically declared. Note that in this case,
|
|
1777 LEN counts the iterations, NOT the total number of list elements
|
|
1778 processed, which is 2 * LEN.
|
|
1779
|
|
1780 EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE does not declare any of its
|
|
1781 arguments, just like EXTERNAL_LIST_LOOP_4_NO_DECLARE, and so these
|
|
1782 must be declared manually. */
|
428
|
1783
|
|
1784 /* Optimized and safe macros for looping over external property lists. */
|
|
1785 #define EXTERNAL_PROPERTY_LIST_LOOP_3(key, value, list) \
|
|
1786 Lisp_Object key, value, hare_##key, tortoise_##key; \
|
442
|
1787 EMACS_INT len_##key; \
|
428
|
1788 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len_##key, hare_##key, \
|
|
1789 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1790
|
|
1791 #define EXTERNAL_PROPERTY_LIST_LOOP_4(key, value, list, tail) \
|
|
1792 Lisp_Object key, value, tail, tortoise_##key; \
|
442
|
1793 EMACS_INT len_##key; \
|
428
|
1794 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len_##key, tail, \
|
|
1795 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1796
|
|
1797 #define EXTERNAL_PROPERTY_LIST_LOOP_5(key, value, list, tail, len) \
|
|
1798 Lisp_Object key, value, tail, tortoise_##key; \
|
|
1799 EMACS_INT len; \
|
|
1800 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \
|
|
1801 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1802
|
442
|
1803 #define EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE(key, value, list, \
|
|
1804 tail, len) \
|
|
1805 Lisp_Object tortoise_##key; \
|
|
1806 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \
|
|
1807 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1808
|
428
|
1809
|
|
1810 #define EXTERNAL_PROPERTY_LIST_LOOP_7(key, value, list, len, hare, \
|
|
1811 tortoise, suspicion_length) \
|
|
1812 for (tortoise = hare = list, len = 0; \
|
|
1813 \
|
|
1814 ((CONSP (hare) && \
|
|
1815 (key = XCAR (hare), \
|
|
1816 hare = XCDR (hare), \
|
442
|
1817 (CONSP (hare) ? 1 : \
|
|
1818 (signal_malformed_property_list_error (list), 0)))) ? \
|
428
|
1819 (value = XCAR (hare), 1) : \
|
|
1820 (NILP (hare) ? 0 : \
|
|
1821 (signal_malformed_property_list_error (list), 0))); \
|
|
1822 \
|
|
1823 hare = XCDR (hare), \
|
|
1824 ((++len < suspicion_length) ? \
|
|
1825 ((void) 0) : \
|
|
1826 (((len & 1) ? \
|
|
1827 ((void) (tortoise = XCDR (XCDR (tortoise)))) : \
|
|
1828 ((void) 0)) \
|
|
1829 , \
|
|
1830 (EQ (hare, tortoise) ? \
|
|
1831 ((void) signal_circular_property_list_error (list)) : \
|
|
1832 ((void) 0)))))
|
|
1833
|
|
1834 /* For a property list (alternating keywords/values) that may not be
|
|
1835 in valid list format -- will signal an error if the list is not in
|
|
1836 valid format. CONSVAR is used to keep track of the iterations
|
|
1837 without modifying PLIST.
|
|
1838
|
|
1839 We have to be tricky to still keep the same C format.*/
|
|
1840 #define EXTERNAL_PROPERTY_LIST_LOOP(tail, key, value, plist) \
|
|
1841 for (tail = plist; \
|
|
1842 (CONSP (tail) && CONSP (XCDR (tail)) ? \
|
|
1843 (key = XCAR (tail), value = XCAR (XCDR (tail))) : \
|
|
1844 (key = Qunbound, value = Qunbound)), \
|
|
1845 !NILP (tail); \
|
|
1846 tail = XCDR (XCDR (tail))) \
|
|
1847 if (UNBOUNDP (key)) \
|
|
1848 Fsignal (Qmalformed_property_list, list1 (plist)); \
|
|
1849 else
|
|
1850
|
|
1851 #define PROPERTY_LIST_LOOP(tail, key, value, plist) \
|
|
1852 for (tail = plist; \
|
|
1853 NILP (tail) ? 0 : \
|
|
1854 (key = XCAR (tail), tail = XCDR (tail), \
|
|
1855 value = XCAR (tail), tail = XCDR (tail), 1); \
|
|
1856 )
|
|
1857
|
|
1858 /* Return 1 if LIST is properly acyclic and nil-terminated, else 0. */
|
826
|
1859 DECLARE_INLINE_HEADER (
|
|
1860 int
|
428
|
1861 TRUE_LIST_P (Lisp_Object object)
|
826
|
1862 )
|
428
|
1863 {
|
|
1864 Lisp_Object hare, tortoise;
|
|
1865 EMACS_INT len;
|
|
1866
|
|
1867 for (hare = tortoise = object, len = 0;
|
|
1868 CONSP (hare);
|
|
1869 hare = XCDR (hare), len++)
|
|
1870 {
|
|
1871 if (len < CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1872 continue;
|
|
1873
|
|
1874 if (len & 1)
|
|
1875 tortoise = XCDR (tortoise);
|
|
1876 else if (EQ (hare, tortoise))
|
|
1877 return 0;
|
|
1878 }
|
|
1879
|
|
1880 return NILP (hare);
|
|
1881 }
|
|
1882
|
|
1883 /* Signal an error if LIST is not properly acyclic and nil-terminated. */
|
|
1884 #define CHECK_TRUE_LIST(list) do { \
|
|
1885 Lisp_Object CTL_list = (list); \
|
|
1886 Lisp_Object CTL_hare, CTL_tortoise; \
|
436
|
1887 EMACS_INT CTL_len; \
|
428
|
1888 \
|
|
1889 for (CTL_hare = CTL_tortoise = CTL_list, CTL_len = 0; \
|
|
1890 CONSP (CTL_hare); \
|
|
1891 CTL_hare = XCDR (CTL_hare), CTL_len++) \
|
|
1892 { \
|
|
1893 if (CTL_len < CIRCULAR_LIST_SUSPICION_LENGTH) \
|
|
1894 continue; \
|
|
1895 \
|
|
1896 if (CTL_len & 1) \
|
|
1897 CTL_tortoise = XCDR (CTL_tortoise); \
|
|
1898 else if (EQ (CTL_hare, CTL_tortoise)) \
|
|
1899 Fsignal (Qcircular_list, list1 (CTL_list)); \
|
|
1900 } \
|
|
1901 \
|
|
1902 if (! NILP (CTL_hare)) \
|
|
1903 signal_malformed_list_error (CTL_list); \
|
|
1904 } while (0)
|
|
1905
|
442
|
1906 /*------------------------------ string --------------------------------*/
|
428
|
1907
|
|
1908 struct Lisp_String
|
|
1909 {
|
771
|
1910 union
|
|
1911 {
|
|
1912 struct lrecord_header lheader;
|
|
1913 struct
|
|
1914 {
|
|
1915 /* WARNING: Everything before ascii_begin must agree exactly with
|
|
1916 struct lrecord_header */
|
|
1917 unsigned int type :8;
|
|
1918 unsigned int mark :1;
|
|
1919 unsigned int c_readonly :1;
|
|
1920 unsigned int lisp_readonly :1;
|
|
1921 /* Number of chars at beginning of string that are one byte in length
|
826
|
1922 (byte_ascii_p) */
|
771
|
1923 unsigned int ascii_begin :21;
|
|
1924 } v;
|
|
1925 } u;
|
793
|
1926 Bytecount size_;
|
|
1927 Intbyte *data_;
|
428
|
1928 Lisp_Object plist;
|
|
1929 };
|
|
1930 typedef struct Lisp_String Lisp_String;
|
|
1931
|
771
|
1932 #define MAX_STRING_ASCII_BEGIN ((2 << 21) - 1)
|
|
1933
|
428
|
1934 DECLARE_LRECORD (string, Lisp_String);
|
|
1935 #define XSTRING(x) XRECORD (x, string, Lisp_String)
|
617
|
1936 #define wrap_string(p) wrap_record (p, string)
|
428
|
1937 #define STRINGP(x) RECORDP (x, string)
|
|
1938 #define CHECK_STRING(x) CHECK_RECORD (x, string)
|
|
1939 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string)
|
|
1940
|
826
|
1941 /* Most basic macros for strings -- basically just accessing or setting
|
|
1942 fields -- are here. Everything else is in text.h, since they depend on
|
|
1943 stuff there. */
|
428
|
1944
|
793
|
1945 /* Operations on Lisp_String *'s; only ones left */
|
826
|
1946 #define set_lispstringp_length(s, len) ((void) ((s)->size_ = (len)))
|
|
1947 #define set_lispstringp_data(s, ptr) ((void) ((s)->data_ = (ptr)))
|
|
1948
|
|
1949 /* Operations on strings as Lisp_Objects. Don't manipulate Lisp_String *'s
|
|
1950 in any new code. */
|
793
|
1951 #define XSTRING_LENGTH(s) (XSTRING (s)->size_)
|
|
1952 #define XSTRING_PLIST(s) (XSTRING (s)->plist)
|
|
1953 #define XSTRING_DATA(s) (XSTRING (s)->data_ + 0)
|
|
1954 #define XSTRING_ASCII_BEGIN(s) (XSTRING (s)->u.v.ascii_begin + 0)
|
826
|
1955 #define XSET_STRING_LENGTH(s, ptr) set_lispstringp_length (XSTRING (s), ptr)
|
|
1956 #define XSET_STRING_DATA(s, ptr) set_lispstringp_data (XSTRING (s), ptr)
|
771
|
1957 /* WARNING: If you modify an existing string, you must call
|
|
1958 bump_string_modiff() afterwards. */
|
793
|
1959 #define XSET_STRING_ASCII_BEGIN(s, val) \
|
|
1960 ((void) (XSTRING (s)->u.v.ascii_begin = (val)))
|
826
|
1961 #define XSTRING_FORMAT(s) FORMAT_DEFAULT
|
428
|
1962
|
456
|
1963 /* Return the true aligned size of a struct whose last member is a
|
|
1964 variable-length array field. (this is known as the "struct hack") */
|
|
1965 /* Implementation: in practice, structtype and fieldtype usually have
|
|
1966 the same alignment, but we can't be sure. We need to use
|
|
1967 ALIGN_SIZE to be absolutely sure of getting the correct alignment.
|
|
1968 To help the compiler's optimizer, we use a ternary expression that
|
|
1969 only a very stupid compiler would fail to correctly simplify. */
|
|
1970 #define FLEXIBLE_ARRAY_STRUCT_SIZEOF(structtype, \
|
|
1971 fieldtype, \
|
|
1972 fieldname, \
|
|
1973 array_length) \
|
|
1974 (ALIGNOF (structtype) == ALIGNOF (fieldtype) \
|
|
1975 ? (offsetof (structtype, fieldname) + \
|
|
1976 (offsetof (structtype, fieldname[1]) - \
|
|
1977 offsetof (structtype, fieldname[0])) * \
|
|
1978 (array_length)) \
|
826
|
1979 : (ALIGN_FOR_TYPE \
|
456
|
1980 ((offsetof (structtype, fieldname) + \
|
|
1981 (offsetof (structtype, fieldname[1]) - \
|
|
1982 offsetof (structtype, fieldname[0])) * \
|
|
1983 (array_length)), \
|
826
|
1984 structtype)))
|
442
|
1985
|
|
1986 /*------------------------------ vector --------------------------------*/
|
428
|
1987
|
|
1988 struct Lisp_Vector
|
|
1989 {
|
|
1990 struct lcrecord_header header;
|
|
1991 long size;
|
|
1992 /* next is now chained through v->contents[size], terminated by Qzero.
|
|
1993 This means that pure vectors don't need a "next" */
|
|
1994 /* struct Lisp_Vector *next; */
|
|
1995 Lisp_Object contents[1];
|
|
1996 };
|
|
1997 typedef struct Lisp_Vector Lisp_Vector;
|
|
1998
|
|
1999 DECLARE_LRECORD (vector, Lisp_Vector);
|
|
2000 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector)
|
617
|
2001 #define wrap_vector(p) wrap_record (p, vector)
|
428
|
2002 #define VECTORP(x) RECORDP (x, vector)
|
|
2003 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector)
|
|
2004 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector)
|
|
2005
|
|
2006 #define vector_length(v) ((v)->size)
|
|
2007 #define XVECTOR_LENGTH(s) vector_length (XVECTOR (s))
|
|
2008 #define vector_data(v) ((v)->contents)
|
|
2009 #define XVECTOR_DATA(s) vector_data (XVECTOR (s))
|
|
2010
|
442
|
2011 /*---------------------------- bit vectors -----------------------------*/
|
428
|
2012
|
|
2013 #if (LONGBITS < 16)
|
|
2014 #error What the hell?!
|
|
2015 #elif (LONGBITS < 32)
|
|
2016 # define LONGBITS_LOG2 4
|
|
2017 # define LONGBITS_POWER_OF_2 16
|
|
2018 #elif (LONGBITS < 64)
|
|
2019 # define LONGBITS_LOG2 5
|
|
2020 # define LONGBITS_POWER_OF_2 32
|
|
2021 #elif (LONGBITS < 128)
|
|
2022 # define LONGBITS_LOG2 6
|
|
2023 # define LONGBITS_POWER_OF_2 64
|
|
2024 #else
|
|
2025 #error You really have 128-bit integers?!
|
|
2026 #endif
|
|
2027
|
|
2028 struct Lisp_Bit_Vector
|
|
2029 {
|
|
2030 struct lrecord_header lheader;
|
|
2031 Lisp_Object next;
|
665
|
2032 Elemcount size;
|
428
|
2033 unsigned long bits[1];
|
|
2034 };
|
|
2035 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector;
|
|
2036
|
|
2037 DECLARE_LRECORD (bit_vector, Lisp_Bit_Vector);
|
|
2038 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector)
|
617
|
2039 #define wrap_bit_vector(p) wrap_record (p, bit_vector)
|
428
|
2040 #define BIT_VECTORP(x) RECORDP (x, bit_vector)
|
|
2041 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector)
|
|
2042 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector)
|
|
2043
|
|
2044 #define BITP(x) (INTP (x) && (XINT (x) == 0 || XINT (x) == 1))
|
|
2045
|
|
2046 #define CHECK_BIT(x) do { \
|
|
2047 if (!BITP (x)) \
|
|
2048 dead_wrong_type_argument (Qbitp, x);\
|
|
2049 } while (0)
|
|
2050
|
|
2051 #define CONCHECK_BIT(x) do { \
|
|
2052 if (!BITP (x)) \
|
|
2053 x = wrong_type_argument (Qbitp, x); \
|
|
2054 } while (0)
|
|
2055
|
|
2056 #define bit_vector_length(v) ((v)->size)
|
|
2057 #define bit_vector_next(v) ((v)->next)
|
|
2058
|
826
|
2059 DECLARE_INLINE_HEADER (
|
|
2060 int
|
665
|
2061 bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n)
|
826
|
2062 )
|
428
|
2063 {
|
|
2064 return ((v->bits[n >> LONGBITS_LOG2] >> (n & (LONGBITS_POWER_OF_2 - 1)))
|
|
2065 & 1);
|
|
2066 }
|
|
2067
|
826
|
2068 DECLARE_INLINE_HEADER (
|
|
2069 void
|
665
|
2070 set_bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n, int value)
|
826
|
2071 )
|
428
|
2072 {
|
|
2073 if (value)
|
|
2074 v->bits[n >> LONGBITS_LOG2] |= (1UL << (n & (LONGBITS_POWER_OF_2 - 1)));
|
|
2075 else
|
|
2076 v->bits[n >> LONGBITS_LOG2] &= ~(1UL << (n & (LONGBITS_POWER_OF_2 - 1)));
|
|
2077 }
|
|
2078
|
|
2079 /* Number of longs required to hold LEN bits */
|
|
2080 #define BIT_VECTOR_LONG_STORAGE(len) \
|
|
2081 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2)
|
|
2082
|
442
|
2083 /*------------------------------ symbol --------------------------------*/
|
428
|
2084
|
440
|
2085 typedef struct Lisp_Symbol Lisp_Symbol;
|
428
|
2086 struct Lisp_Symbol
|
|
2087 {
|
|
2088 struct lrecord_header lheader;
|
|
2089 /* next symbol in this obarray bucket */
|
440
|
2090 Lisp_Symbol *next;
|
793
|
2091 Lisp_Object name;
|
428
|
2092 Lisp_Object value;
|
|
2093 Lisp_Object function;
|
|
2094 Lisp_Object plist;
|
|
2095 };
|
|
2096
|
|
2097 #define SYMBOL_IS_KEYWORD(sym) \
|
826
|
2098 ((string_byte (symbol_name (XSYMBOL (sym)), 0) == ':') \
|
428
|
2099 && EQ (sym, oblookup (Vobarray, \
|
793
|
2100 XSTRING_DATA (symbol_name (XSYMBOL (sym))), \
|
|
2101 XSTRING_LENGTH (symbol_name (XSYMBOL (sym))))))
|
428
|
2102 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj))
|
|
2103
|
|
2104 DECLARE_LRECORD (symbol, Lisp_Symbol);
|
|
2105 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol)
|
617
|
2106 #define wrap_symbol(p) wrap_record (p, symbol)
|
428
|
2107 #define SYMBOLP(x) RECORDP (x, symbol)
|
|
2108 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol)
|
|
2109 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol)
|
|
2110
|
|
2111 #define symbol_next(s) ((s)->next)
|
|
2112 #define symbol_name(s) ((s)->name)
|
|
2113 #define symbol_value(s) ((s)->value)
|
|
2114 #define symbol_function(s) ((s)->function)
|
|
2115 #define symbol_plist(s) ((s)->plist)
|
|
2116
|
793
|
2117 #define XSYMBOL_NEXT(s) (XSYMBOL (s)->next)
|
|
2118 #define XSYMBOL_NAME(s) (XSYMBOL (s)->name)
|
|
2119 #define XSYMBOL_VALUE(s) (XSYMBOL (s)->value)
|
|
2120 #define XSYMBOL_FUNCTION(s) (XSYMBOL (s)->function)
|
|
2121 #define XSYMBOL_PLIST(s) (XSYMBOL (s)->plist)
|
|
2122
|
|
2123
|
442
|
2124 /*------------------------------- subr ---------------------------------*/
|
428
|
2125
|
|
2126 typedef Lisp_Object (*lisp_fn_t) (void);
|
|
2127
|
|
2128 struct Lisp_Subr
|
|
2129 {
|
|
2130 struct lrecord_header lheader;
|
442
|
2131 short min_args;
|
|
2132 short max_args;
|
|
2133 const char *prompt;
|
|
2134 const char *doc;
|
|
2135 const char *name;
|
428
|
2136 lisp_fn_t subr_fn;
|
|
2137 };
|
|
2138 typedef struct Lisp_Subr Lisp_Subr;
|
|
2139
|
|
2140 DECLARE_LRECORD (subr, Lisp_Subr);
|
|
2141 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr)
|
617
|
2142 #define wrap_subr(p) wrap_record (p, subr)
|
428
|
2143 #define SUBRP(x) RECORDP (x, subr)
|
|
2144 #define CHECK_SUBR(x) CHECK_RECORD (x, subr)
|
|
2145 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr)
|
|
2146
|
436
|
2147 #define subr_function(subr) ((subr)->subr_fn)
|
|
2148 #define SUBR_FUNCTION(subr,max_args) \
|
|
2149 ((Lisp_Object (*) (EXFUN_##max_args)) (subr)->subr_fn)
|
|
2150 #define subr_name(subr) ((subr)->name)
|
428
|
2151
|
442
|
2152 /*------------------------------ marker --------------------------------*/
|
|
2153
|
428
|
2154
|
440
|
2155 typedef struct Lisp_Marker Lisp_Marker;
|
428
|
2156 struct Lisp_Marker
|
|
2157 {
|
|
2158 struct lrecord_header lheader;
|
440
|
2159 Lisp_Marker *next;
|
|
2160 Lisp_Marker *prev;
|
428
|
2161 struct buffer *buffer;
|
665
|
2162 Membpos membpos;
|
428
|
2163 char insertion_type;
|
|
2164 };
|
|
2165
|
|
2166 DECLARE_LRECORD (marker, Lisp_Marker);
|
|
2167 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker)
|
617
|
2168 #define wrap_marker(p) wrap_record (p, marker)
|
428
|
2169 #define MARKERP(x) RECORDP (x, marker)
|
|
2170 #define CHECK_MARKER(x) CHECK_RECORD (x, marker)
|
|
2171 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker)
|
|
2172
|
|
2173 /* The second check was looking for GCed markers still in use */
|
|
2174 /* if (INTP (XMARKER (x)->lheader.next.v)) abort (); */
|
|
2175
|
|
2176 #define marker_next(m) ((m)->next)
|
|
2177 #define marker_prev(m) ((m)->prev)
|
|
2178
|
442
|
2179 /*------------------------------- char ---------------------------------*/
|
428
|
2180
|
|
2181 #define CHARP(x) (XTYPE (x) == Lisp_Type_Char)
|
|
2182
|
800
|
2183 #ifdef ERROR_CHECK_TYPES
|
428
|
2184
|
826
|
2185 DECLARE_INLINE_HEADER (
|
|
2186 Emchar
|
788
|
2187 XCHAR_1 (Lisp_Object obj, const char *file, int line)
|
826
|
2188 )
|
428
|
2189 {
|
788
|
2190 assert_at_line (CHARP (obj), file, line);
|
428
|
2191 return XCHARVAL (obj);
|
|
2192 }
|
|
2193
|
788
|
2194 #define XCHAR(x) XCHAR_1 (x, __FILE__, __LINE__)
|
|
2195
|
|
2196 #else /* no error checking */
|
|
2197
|
|
2198 #define XCHAR(x) ((Emchar) XCHARVAL (x))
|
|
2199
|
|
2200 #endif /* no error checking */
|
428
|
2201
|
|
2202 #define CHECK_CHAR(x) CHECK_NONRECORD (x, Lisp_Type_Char, Qcharacterp)
|
|
2203 #define CONCHECK_CHAR(x) CONCHECK_NONRECORD (x, Lisp_Type_Char, Qcharacterp)
|
|
2204
|
|
2205
|
442
|
2206 /*------------------------------ float ---------------------------------*/
|
428
|
2207
|
|
2208 #ifdef LISP_FLOAT_TYPE
|
|
2209
|
|
2210 /* Note: the 'unused_next_' field exists only to ensure that the
|
|
2211 `next' pointer fits within the structure, for the purposes of the
|
|
2212 free list. This makes a difference in the unlikely case of
|
|
2213 sizeof(double) being smaller than sizeof(void *). */
|
|
2214
|
|
2215 struct Lisp_Float
|
|
2216 {
|
|
2217 struct lrecord_header lheader;
|
|
2218 union { double d; struct Lisp_Float *unused_next_; } data;
|
|
2219 };
|
|
2220 typedef struct Lisp_Float Lisp_Float;
|
|
2221
|
|
2222 DECLARE_LRECORD (float, Lisp_Float);
|
|
2223 #define XFLOAT(x) XRECORD (x, float, Lisp_Float)
|
617
|
2224 #define wrap_float(p) wrap_record (p, float)
|
428
|
2225 #define FLOATP(x) RECORDP (x, float)
|
|
2226 #define CHECK_FLOAT(x) CHECK_RECORD (x, float)
|
|
2227 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float)
|
|
2228
|
|
2229 #define float_data(f) ((f)->data.d)
|
|
2230 #define XFLOAT_DATA(x) float_data (XFLOAT (x))
|
|
2231
|
|
2232 #define XFLOATINT(n) extract_float (n)
|
|
2233
|
|
2234 #define CHECK_INT_OR_FLOAT(x) do { \
|
|
2235 if (!INT_OR_FLOATP (x)) \
|
|
2236 dead_wrong_type_argument (Qnumberp, x); \
|
|
2237 } while (0)
|
|
2238
|
|
2239 #define CONCHECK_INT_OR_FLOAT(x) do { \
|
|
2240 if (!INT_OR_FLOATP (x)) \
|
|
2241 x = wrong_type_argument (Qnumberp, x); \
|
|
2242 } while (0)
|
|
2243
|
|
2244 # define INT_OR_FLOATP(x) (INTP (x) || FLOATP (x))
|
|
2245
|
|
2246 #else /* not LISP_FLOAT_TYPE */
|
|
2247
|
|
2248 #define XFLOAT(x) --- error! No float support. ---
|
|
2249 #define FLOATP(x) 0
|
|
2250 #define CHECK_FLOAT(x) --- error! No float support. ---
|
|
2251 #define CONCHECK_FLOAT(x) --- error! No float support. ---
|
|
2252
|
|
2253 #define XFLOATINT(n) XINT(n)
|
|
2254 #define CHECK_INT_OR_FLOAT CHECK_INT
|
|
2255 #define CONCHECK_INT_OR_FLOAT CONCHECK_INT
|
|
2256 #define INT_OR_FLOATP(x) INTP (x)
|
|
2257
|
|
2258 #endif /* not LISP_FLOAT_TYPE */
|
|
2259
|
442
|
2260 /*-------------------------------- int ---------------------------------*/
|
428
|
2261
|
|
2262 #define ZEROP(x) EQ (x, Qzero)
|
|
2263
|
800
|
2264 #ifdef ERROR_CHECK_TYPES
|
428
|
2265
|
788
|
2266 #define XCHAR_OR_INT(x) XCHAR_OR_INT_1 (x, __FILE__, __LINE__)
|
|
2267 #define XINT(x) XINT_1 (x, __FILE__, __LINE__)
|
|
2268
|
826
|
2269 DECLARE_INLINE_HEADER (
|
|
2270 EMACS_INT
|
788
|
2271 XINT_1 (Lisp_Object obj, const char *file, int line)
|
826
|
2272 )
|
428
|
2273 {
|
788
|
2274 assert_at_line (INTP (obj), file, line);
|
428
|
2275 return XREALINT (obj);
|
|
2276 }
|
|
2277
|
826
|
2278 DECLARE_INLINE_HEADER (
|
|
2279 EMACS_INT
|
788
|
2280 XCHAR_OR_INT_1 (Lisp_Object obj, const char *file, int line)
|
826
|
2281 )
|
428
|
2282 {
|
788
|
2283 assert_at_line (INTP (obj) || CHARP (obj), file, line);
|
428
|
2284 return CHARP (obj) ? XCHAR (obj) : XINT (obj);
|
|
2285 }
|
|
2286
|
|
2287 #else /* no error checking */
|
|
2288
|
|
2289 #define XINT(obj) XREALINT (obj)
|
|
2290 #define XCHAR_OR_INT(obj) (CHARP (obj) ? XCHAR (obj) : XINT (obj))
|
|
2291
|
|
2292 #endif /* no error checking */
|
|
2293
|
|
2294 #define CHECK_INT(x) do { \
|
|
2295 if (!INTP (x)) \
|
|
2296 dead_wrong_type_argument (Qintegerp, x); \
|
|
2297 } while (0)
|
|
2298
|
|
2299 #define CONCHECK_INT(x) do { \
|
|
2300 if (!INTP (x)) \
|
|
2301 x = wrong_type_argument (Qintegerp, x); \
|
|
2302 } while (0)
|
|
2303
|
|
2304 #define NATNUMP(x) (INTP (x) && XINT (x) >= 0)
|
|
2305
|
|
2306 #define CHECK_NATNUM(x) do { \
|
|
2307 if (!NATNUMP (x)) \
|
|
2308 dead_wrong_type_argument (Qnatnump, x); \
|
|
2309 } while (0)
|
|
2310
|
|
2311 #define CONCHECK_NATNUM(x) do { \
|
|
2312 if (!NATNUMP (x)) \
|
|
2313 x = wrong_type_argument (Qnatnump, x); \
|
|
2314 } while (0)
|
|
2315
|
|
2316 /* next three always continuable because they coerce their arguments. */
|
|
2317 #define CHECK_INT_COERCE_CHAR(x) do { \
|
|
2318 if (INTP (x)) \
|
|
2319 ; \
|
|
2320 else if (CHARP (x)) \
|
|
2321 x = make_int (XCHAR (x)); \
|
|
2322 else \
|
|
2323 x = wrong_type_argument (Qinteger_or_char_p, x); \
|
|
2324 } while (0)
|
|
2325
|
|
2326 #define CHECK_INT_COERCE_MARKER(x) do { \
|
|
2327 if (INTP (x)) \
|
|
2328 ; \
|
|
2329 else if (MARKERP (x)) \
|
|
2330 x = make_int (marker_position (x)); \
|
|
2331 else \
|
|
2332 x = wrong_type_argument (Qinteger_or_marker_p, x); \
|
|
2333 } while (0)
|
|
2334
|
|
2335 #define CHECK_INT_COERCE_CHAR_OR_MARKER(x) do { \
|
|
2336 if (INTP (x)) \
|
|
2337 ; \
|
|
2338 else if (CHARP (x)) \
|
|
2339 x = make_int (XCHAR (x)); \
|
|
2340 else if (MARKERP (x)) \
|
|
2341 x = make_int (marker_position (x)); \
|
|
2342 else \
|
|
2343 x = wrong_type_argument (Qinteger_char_or_marker_p, x); \
|
|
2344 } while (0)
|
|
2345
|
|
2346
|
442
|
2347 /*--------------------------- readonly objects -------------------------*/
|
440
|
2348
|
428
|
2349 #define CHECK_C_WRITEABLE(obj) \
|
|
2350 do { if (c_readonly (obj)) c_write_error (obj); } while (0)
|
|
2351
|
|
2352 #define CHECK_LISP_WRITEABLE(obj) \
|
|
2353 do { if (lisp_readonly (obj)) lisp_write_error (obj); } while (0)
|
|
2354
|
|
2355 #define C_READONLY(obj) (C_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
|
|
2356 #define LISP_READONLY(obj) (LISP_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
|
|
2357
|
442
|
2358 /*----------------------------- structrures ----------------------------*/
|
428
|
2359
|
|
2360 typedef struct structure_keyword_entry structure_keyword_entry;
|
|
2361 struct structure_keyword_entry
|
|
2362 {
|
|
2363 Lisp_Object keyword;
|
|
2364 int (*validate) (Lisp_Object keyword, Lisp_Object value,
|
578
|
2365 Error_Behavior errb);
|
428
|
2366 };
|
|
2367
|
|
2368 typedef struct
|
|
2369 {
|
|
2370 Dynarr_declare (structure_keyword_entry);
|
|
2371 } structure_keyword_entry_dynarr;
|
|
2372
|
|
2373 typedef struct structure_type structure_type;
|
|
2374 struct structure_type
|
|
2375 {
|
|
2376 Lisp_Object type;
|
|
2377 structure_keyword_entry_dynarr *keywords;
|
578
|
2378 int (*validate) (Lisp_Object data, Error_Behavior errb);
|
428
|
2379 Lisp_Object (*instantiate) (Lisp_Object data);
|
|
2380 };
|
|
2381
|
|
2382 typedef struct
|
|
2383 {
|
|
2384 Dynarr_declare (structure_type);
|
|
2385 } structure_type_dynarr;
|
|
2386
|
|
2387 struct structure_type *define_structure_type (Lisp_Object type,
|
|
2388 int (*validate)
|
|
2389 (Lisp_Object data,
|
578
|
2390 Error_Behavior errb),
|
428
|
2391 Lisp_Object (*instantiate)
|
|
2392 (Lisp_Object data));
|
|
2393 void define_structure_type_keyword (struct structure_type *st,
|
|
2394 Lisp_Object keyword,
|
|
2395 int (*validate) (Lisp_Object keyword,
|
|
2396 Lisp_Object value,
|
578
|
2397 Error_Behavior errb));
|
428
|
2398
|
442
|
2399 /*---------------------------- weak lists ------------------------------*/
|
428
|
2400
|
|
2401 enum weak_list_type
|
|
2402 {
|
|
2403 /* element disappears if it's unmarked. */
|
|
2404 WEAK_LIST_SIMPLE,
|
|
2405 /* element disappears if it's a cons and either its car or
|
|
2406 cdr is unmarked. */
|
|
2407 WEAK_LIST_ASSOC,
|
|
2408 /* element disappears if it's a cons and its car is unmarked. */
|
|
2409 WEAK_LIST_KEY_ASSOC,
|
|
2410 /* element disappears if it's a cons and its cdr is unmarked. */
|
442
|
2411 WEAK_LIST_VALUE_ASSOC,
|
|
2412 /* element disappears if it's a cons and neither its car nor
|
|
2413 its cdr is marked. */
|
|
2414 WEAK_LIST_FULL_ASSOC
|
428
|
2415 };
|
|
2416
|
|
2417 struct weak_list
|
|
2418 {
|
|
2419 struct lcrecord_header header;
|
|
2420 Lisp_Object list; /* don't mark through this! */
|
|
2421 enum weak_list_type type;
|
|
2422 Lisp_Object next_weak; /* don't mark through this! */
|
|
2423 };
|
|
2424
|
|
2425 DECLARE_LRECORD (weak_list, struct weak_list);
|
|
2426 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list)
|
617
|
2427 #define wrap_weak_list(p) wrap_record (p, weak_list)
|
428
|
2428 #define WEAK_LISTP(x) RECORDP (x, weak_list)
|
|
2429 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list)
|
|
2430 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list)
|
|
2431
|
|
2432 #define weak_list_list(w) ((w)->list)
|
|
2433 #define XWEAK_LIST_LIST(w) (XWEAK_LIST (w)->list)
|
|
2434
|
|
2435 Lisp_Object make_weak_list (enum weak_list_type type);
|
|
2436 /* The following two are only called by the garbage collector */
|
|
2437 int finish_marking_weak_lists (void);
|
|
2438 void prune_weak_lists (void);
|
|
2439
|
442
|
2440 /*-------------------------- lcrecord-list -----------------------------*/
|
428
|
2441
|
|
2442 struct lcrecord_list
|
|
2443 {
|
|
2444 struct lcrecord_header header;
|
|
2445 Lisp_Object free;
|
665
|
2446 Elemcount size;
|
442
|
2447 const struct lrecord_implementation *implementation;
|
428
|
2448 };
|
|
2449
|
|
2450 DECLARE_LRECORD (lcrecord_list, struct lcrecord_list);
|
|
2451 #define XLCRECORD_LIST(x) XRECORD (x, lcrecord_list, struct lcrecord_list)
|
617
|
2452 #define wrap_lcrecord_list(p) wrap_record (p, lcrecord_list)
|
428
|
2453 #define LCRECORD_LISTP(x) RECORDP (x, lcrecord_list)
|
|
2454 /* #define CHECK_LCRECORD_LIST(x) CHECK_RECORD (x, lcrecord_list)
|
|
2455 Lcrecord lists should never escape to the Lisp level, so
|
|
2456 functions should not be doing this. */
|
|
2457
|
665
|
2458 Lisp_Object make_lcrecord_list (Elemcount size,
|
442
|
2459 const struct lrecord_implementation
|
428
|
2460 *implementation);
|
|
2461 Lisp_Object allocate_managed_lcrecord (Lisp_Object lcrecord_list);
|
|
2462 void free_managed_lcrecord (Lisp_Object lcrecord_list, Lisp_Object lcrecord);
|
|
2463
|
|
2464
|
|
2465 /************************************************************************/
|
771
|
2466 /* Definitions related to the format of text and of characters */
|
|
2467 /************************************************************************/
|
|
2468
|
|
2469 /* Note:
|
|
2470
|
|
2471 "internally formatted text" and the term "internal format" in
|
|
2472 general are likely to refer to the format of text in buffers and
|
|
2473 strings; "externally formatted text" and the term "external format"
|
|
2474 refer to any text format used in the O.S. or elsewhere outside of
|
|
2475 XEmacs. The format of text and of a character are related and
|
|
2476 there must be a one-to-one relationship (hopefully through a
|
|
2477 relatively simple algorithmic means of conversion) between a string
|
|
2478 of text and an equivalent array of characters, but the conversion
|
|
2479 between the two is NOT necessarily trivial.
|
|
2480
|
|
2481 In a non-Mule XEmacs, allowed characters are numbered 0 through
|
|
2482 255, where no fixed meaning is assigned to them, but (when
|
|
2483 representing text, rather than bytes in a binary file) in practice
|
|
2484 the lower half represents ASCII and the upper half some other 8-bit
|
|
2485 character set (chosen by setting the font, case tables, syntax
|
|
2486 tables, etc. appropriately for the character set through ad-hoc
|
|
2487 means such as the `iso-8859-1' file and the
|
|
2488 `standard-display-european' function).
|
|
2489
|
|
2490 #### Finish this.
|
|
2491
|
|
2492 */
|
|
2493 #include "text.h"
|
|
2494
|
|
2495
|
|
2496 /************************************************************************/
|
428
|
2497 /* Definitions of primitive Lisp functions and variables */
|
|
2498 /************************************************************************/
|
|
2499
|
|
2500
|
|
2501 /* DEFUN - Define a built-in Lisp-visible C function or `subr'.
|
|
2502 `lname' should be the name to give the function in Lisp,
|
|
2503 as a null-terminated C string.
|
|
2504 `Fname' should be the C equivalent of `lname', using only characters
|
|
2505 valid in a C identifier, with an "F" prepended.
|
|
2506 The name of the C constant structure that records information
|
|
2507 on this function for internal use is "S" concatenated with Fname.
|
|
2508 `min_args' should be a number, the minimum number of arguments allowed.
|
|
2509 `max_args' should be a number, the maximum number of arguments allowed,
|
|
2510 or else MANY or UNEVALLED.
|
|
2511 MANY means pass a vector of evaluated arguments,
|
|
2512 in the form of an integer number-of-arguments
|
|
2513 followed by the address of a vector of Lisp_Objects
|
|
2514 which contains the argument values.
|
|
2515 UNEVALLED means pass the list of unevaluated arguments.
|
|
2516 `prompt' says how to read arguments for an interactive call.
|
|
2517 See the doc string for `interactive'.
|
|
2518 A null string means call interactively with no arguments.
|
|
2519 `arglist' are the comma-separated arguments (always Lisp_Objects) for
|
|
2520 the function.
|
|
2521 The docstring for the function is placed as a "C" comment between
|
|
2522 the prompt and the `args' argument. make-docfile reads the
|
|
2523 comment and creates the DOC file from it.
|
|
2524 */
|
|
2525
|
|
2526 #define EXFUN_0 void
|
|
2527 #define EXFUN_1 Lisp_Object
|
|
2528 #define EXFUN_2 Lisp_Object,Lisp_Object
|
|
2529 #define EXFUN_3 Lisp_Object,Lisp_Object,Lisp_Object
|
|
2530 #define EXFUN_4 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object
|
|
2531 #define EXFUN_5 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object
|
|
2532 #define EXFUN_6 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
|
|
2533 Lisp_Object
|
|
2534 #define EXFUN_7 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
|
|
2535 Lisp_Object,Lisp_Object
|
|
2536 #define EXFUN_8 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
|
|
2537 Lisp_Object,Lisp_Object,Lisp_Object
|
|
2538 #define EXFUN_MANY int, Lisp_Object*
|
|
2539 #define EXFUN_UNEVALLED Lisp_Object
|
|
2540 #define EXFUN(sym, max_args) Lisp_Object sym (EXFUN_##max_args)
|
|
2541
|
|
2542 #define SUBR_MAX_ARGS 8
|
|
2543 #define MANY -2
|
|
2544 #define UNEVALLED -1
|
|
2545
|
|
2546 /* Can't be const, because then subr->doc is read-only and
|
|
2547 Snarf_documentation chokes */
|
|
2548
|
|
2549 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \
|
|
2550 Lisp_Object Fname (EXFUN_##max_args); \
|
442
|
2551 static struct Lisp_Subr S##Fname = \
|
|
2552 { \
|
|
2553 { /* struct lrecord_header */ \
|
|
2554 lrecord_type_subr, /* lrecord_type_index */ \
|
|
2555 1, /* mark bit */ \
|
|
2556 1, /* c_readonly bit */ \
|
|
2557 1 /* lisp_readonly bit */ \
|
|
2558 }, \
|
|
2559 min_args, \
|
|
2560 max_args, \
|
|
2561 prompt, \
|
|
2562 0, /* doc string */ \
|
|
2563 lname, \
|
|
2564 (lisp_fn_t) Fname \
|
|
2565 }; \
|
428
|
2566 Lisp_Object Fname (DEFUN_##max_args arglist)
|
|
2567
|
|
2568 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a
|
|
2569 prototype that matches max_args, and add the obligatory
|
|
2570 `Lisp_Object' type declaration to the formal C arguments. */
|
|
2571
|
|
2572 #define DEFUN_MANY(named_int, named_Lisp_Object) named_int, named_Lisp_Object
|
|
2573 #define DEFUN_UNEVALLED(args) Lisp_Object args
|
|
2574 #define DEFUN_0() void
|
|
2575 #define DEFUN_1(a) Lisp_Object a
|
|
2576 #define DEFUN_2(a,b) DEFUN_1(a), Lisp_Object b
|
|
2577 #define DEFUN_3(a,b,c) DEFUN_2(a,b), Lisp_Object c
|
|
2578 #define DEFUN_4(a,b,c,d) DEFUN_3(a,b,c), Lisp_Object d
|
|
2579 #define DEFUN_5(a,b,c,d,e) DEFUN_4(a,b,c,d), Lisp_Object e
|
|
2580 #define DEFUN_6(a,b,c,d,e,f) DEFUN_5(a,b,c,d,e), Lisp_Object f
|
|
2581 #define DEFUN_7(a,b,c,d,e,f,g) DEFUN_6(a,b,c,d,e,f), Lisp_Object g
|
|
2582 #define DEFUN_8(a,b,c,d,e,f,g,h) DEFUN_7(a,b,c,d,e,f,g),Lisp_Object h
|
|
2583
|
|
2584 /* WARNING: If you add defines here for higher values of max_args,
|
|
2585 make sure to also fix the clauses in PRIMITIVE_FUNCALL(),
|
|
2586 and change the define of SUBR_MAX_ARGS above. */
|
|
2587
|
|
2588 #include "symeval.h"
|
|
2589
|
|
2590 /* `specpdl' is the special binding/unwind-protect stack.
|
|
2591
|
|
2592 Knuth says (see the Jargon File):
|
|
2593 At MIT, `pdl' [abbreviation for `Push Down List'] used to
|
|
2594 be a more common synonym for `stack'.
|
|
2595 Everywhere else `stack' seems to be the preferred term.
|
|
2596
|
|
2597 specpdl_depth is the current depth of `specpdl'.
|
771
|
2598 Save this for use later as arg to `unbind_to_1'. */
|
428
|
2599 extern int specpdl_depth_counter;
|
|
2600 #define specpdl_depth() specpdl_depth_counter
|
|
2601
|
442
|
2602
|
|
2603 #define CHECK_FUNCTION(fun) do { \
|
|
2604 while (NILP (Ffunctionp (fun))) \
|
|
2605 signal_invalid_function_error (fun); \
|
|
2606 } while (0)
|
|
2607
|
428
|
2608
|
|
2609 /************************************************************************/
|
|
2610 /* Checking for QUIT */
|
|
2611 /************************************************************************/
|
|
2612
|
|
2613 /* Asynchronous events set something_happened, and then are processed
|
|
2614 within the QUIT macro. At this point, we are guaranteed to not be in
|
|
2615 any sensitive code. */
|
|
2616
|
|
2617 extern volatile int something_happened;
|
771
|
2618 extern int dont_check_for_quit;
|
428
|
2619 int check_what_happened (void);
|
|
2620
|
|
2621 extern volatile int quit_check_signal_happened;
|
|
2622 extern volatile int quit_check_signal_tick_count;
|
|
2623 int check_quit (void);
|
|
2624
|
|
2625 void signal_quit (void);
|
|
2626
|
771
|
2627 #define QUIT_FLAG_SAYS_SHOULD_QUIT \
|
|
2628 (!NILP (Vquit_flag) && \
|
|
2629 (NILP (Vinhibit_quit) \
|
|
2630 || (EQ (Vquit_flag, Qcritical) && !dont_check_for_quit)))
|
|
2631
|
428
|
2632 /* Nonzero if ought to quit now. */
|
|
2633 #define QUITP \
|
|
2634 ((quit_check_signal_happened ? check_quit () : 0), \
|
771
|
2635 QUIT_FLAG_SAYS_SHOULD_QUIT)
|
428
|
2636
|
|
2637 /* QUIT used to call QUITP, but there are some places where QUITP
|
|
2638 is called directly, and check_what_happened() should only be called
|
|
2639 when Emacs is actually ready to quit because it could do things
|
|
2640 like switch threads. */
|
|
2641 #define INTERNAL_QUITP \
|
|
2642 ((something_happened ? check_what_happened () : 0), \
|
771
|
2643 QUIT_FLAG_SAYS_SHOULD_QUIT)
|
428
|
2644
|
|
2645 #define INTERNAL_REALLY_QUITP \
|
|
2646 (check_what_happened (), \
|
771
|
2647 QUIT_FLAG_SAYS_SHOULD_QUIT)
|
428
|
2648
|
|
2649 /* Check quit-flag and quit if it is non-nil. Also do any other things
|
|
2650 that might have gotten queued until it was safe. */
|
|
2651 #define QUIT do { if (INTERNAL_QUITP) signal_quit (); } while (0)
|
|
2652
|
|
2653 #define REALLY_QUIT do { if (INTERNAL_REALLY_QUITP) signal_quit (); } while (0)
|
|
2654
|
|
2655
|
|
2656 /************************************************************************/
|
|
2657 /* hashing */
|
|
2658 /************************************************************************/
|
|
2659
|
|
2660 /* #### for a 64-bit machine, we should substitute a prime just over 2^32 */
|
|
2661 #define GOOD_HASH 65599 /* prime number just over 2^16; Dragon book, p. 435 */
|
|
2662 #define HASH2(a,b) (GOOD_HASH * (a) + (b))
|
|
2663 #define HASH3(a,b,c) (GOOD_HASH * HASH2 (a,b) + (c))
|
|
2664 #define HASH4(a,b,c,d) (GOOD_HASH * HASH3 (a,b,c) + (d))
|
|
2665 #define HASH5(a,b,c,d,e) (GOOD_HASH * HASH4 (a,b,c,d) + (e))
|
|
2666 #define HASH6(a,b,c,d,e,f) (GOOD_HASH * HASH5 (a,b,c,d,e) + (f))
|
|
2667 #define HASH7(a,b,c,d,e,f,g) (GOOD_HASH * HASH6 (a,b,c,d,e,f) + (g))
|
|
2668 #define HASH8(a,b,c,d,e,f,g,h) (GOOD_HASH * HASH7 (a,b,c,d,e,f,g) + (h))
|
|
2669 #define HASH9(a,b,c,d,e,f,g,h,i) (GOOD_HASH * HASH8 (a,b,c,d,e,f,g,h) + (i))
|
|
2670
|
|
2671 #define LISP_HASH(obj) ((unsigned long) LISP_TO_VOID (obj))
|
442
|
2672 unsigned long string_hash (const char *xv);
|
665
|
2673 unsigned long memory_hash (const void *xv, Bytecount size);
|
428
|
2674 unsigned long internal_hash (Lisp_Object obj, int depth);
|
|
2675 unsigned long internal_array_hash (Lisp_Object *arr, int size, int depth);
|
|
2676
|
|
2677
|
|
2678 /************************************************************************/
|
|
2679 /* String translation */
|
|
2680 /************************************************************************/
|
|
2681
|
771
|
2682 /* When support for message translation exists, GETTEXT() translates a
|
|
2683 string from English into the language defined by
|
|
2684 `current-language-environment'. This is done by looking the string
|
|
2685 up in a large predefined table; if no translation is found, the
|
|
2686 original string is returned, and the failure is possibly logged so
|
|
2687 that the translation can later be entered into the table.
|
|
2688
|
|
2689 In addition to this, there is a mechanism to snarf message strings
|
|
2690 out of the source code so that they can be entered into the tables.
|
|
2691 This is what make-msgfile.lex does.
|
|
2692
|
|
2693 Handling `format' strings is more difficult: The format string
|
|
2694 should get translated, but not under all circumstances. When the
|
|
2695 format string is a Lisp string, what should happen is that
|
|
2696 Fformat() should format the untranslated args[0] and return that,
|
|
2697 and also call Fgettext() on args[0] and, if that is different,
|
|
2698 format it and store it in the `string-translatable' property of the
|
|
2699 returned string. See Fgettext().
|
|
2700
|
|
2701 CGETTEXT() is the same as GETTEXT() but works with char * strings
|
|
2702 instead of Intbyte * strings.
|
|
2703
|
|
2704 build_msg_string() is a shorthand for build_string (GETTEXT (x)).
|
|
2705 build_msg_intstring() is a shorthand for build_intstring (GETTEXT (x)).
|
|
2706 */
|
|
2707
|
|
2708 #define GETTEXT(x) (x)
|
|
2709 #define CGETTEXT(x) (x)
|
|
2710 #define LISP_GETTEXT(x) (x)
|
428
|
2711
|
|
2712 /* DEFER_GETTEXT is used to identify strings which are translated when
|
|
2713 they are referenced instead of when they are defined.
|
|
2714 These include Qerror_messages and initialized arrays of strings.
|
|
2715 */
|
|
2716 #define DEFER_GETTEXT(x) (x)
|
|
2717
|
|
2718
|
|
2719 /************************************************************************/
|
|
2720 /* Garbage collection / GC-protection */
|
|
2721 /************************************************************************/
|
|
2722
|
|
2723 /* Structure for recording stack slots that need marking */
|
|
2724
|
|
2725 /* This is a chain of structures, each of which points at a Lisp_Object
|
|
2726 variable whose value should be marked in garbage collection.
|
|
2727 Normally every link of the chain is an automatic variable of a function,
|
|
2728 and its `val' points to some argument or local variable of the function.
|
|
2729 On exit to the function, the chain is set back to the value it had on
|
|
2730 entry. This way, no link remains in the chain when the stack frame
|
|
2731 containing the link disappears.
|
|
2732
|
|
2733 Every function that can call Feval must protect in this fashion all
|
|
2734 Lisp_Object variables whose contents will be used again. */
|
|
2735
|
|
2736 extern struct gcpro *gcprolist;
|
|
2737
|
|
2738 struct gcpro
|
|
2739 {
|
|
2740 struct gcpro *next;
|
771
|
2741 const Lisp_Object *var; /* Address of first protected variable */
|
428
|
2742 int nvars; /* Number of consecutive protected variables */
|
|
2743 };
|
|
2744
|
|
2745 /* Normally, you declare variables gcpro1, gcpro2, ... and use the
|
|
2746 GCPROn() macros. However, if you need to have nested gcpro's,
|
|
2747 declare ngcpro1, ngcpro2, ... and use NGCPROn(). If you need
|
|
2748 to nest another level, use nngcpro1, nngcpro2, ... and use
|
|
2749 NNGCPROn(). If you need to nest yet another level, create
|
|
2750 the appropriate macros. */
|
|
2751
|
|
2752 #ifdef DEBUG_GCPRO
|
|
2753
|
|
2754 void debug_gcpro1 (char *, int, struct gcpro *, Lisp_Object *);
|
|
2755 void debug_gcpro2 (char *, int, struct gcpro *, struct gcpro *,
|
|
2756 Lisp_Object *, Lisp_Object *);
|
|
2757 void debug_gcpro3 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
|
|
2758 Lisp_Object *, Lisp_Object *, Lisp_Object *);
|
|
2759 void debug_gcpro4 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
|
|
2760 struct gcpro *, Lisp_Object *, Lisp_Object *, Lisp_Object *,
|
|
2761 Lisp_Object *);
|
|
2762 void debug_gcpro5 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
|
|
2763 struct gcpro *, struct gcpro *, Lisp_Object *, Lisp_Object *,
|
|
2764 Lisp_Object *, Lisp_Object *, Lisp_Object *);
|
|
2765 void debug_ungcpro(char *, int, struct gcpro *);
|
|
2766
|
|
2767 #define GCPRO1(v) \
|
|
2768 debug_gcpro1 (__FILE__, __LINE__,&gcpro1,&v)
|
|
2769 #define GCPRO2(v1,v2) \
|
|
2770 debug_gcpro2 (__FILE__, __LINE__,&gcpro1,&gcpro2,&v1,&v2)
|
|
2771 #define GCPRO3(v1,v2,v3) \
|
|
2772 debug_gcpro3 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&v1,&v2,&v3)
|
|
2773 #define GCPRO4(v1,v2,v3,v4) \
|
|
2774 debug_gcpro4 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,\
|
|
2775 &v1,&v2,&v3,&v4)
|
|
2776 #define GCPRO5(v1,v2,v3,v4,v5) \
|
|
2777 debug_gcpro5 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,&gcpro5,\
|
|
2778 &v1,&v2,&v3,&v4,&v5)
|
|
2779 #define UNGCPRO \
|
|
2780 debug_ungcpro(__FILE__, __LINE__,&gcpro1)
|
|
2781
|
|
2782 #define NGCPRO1(v) \
|
|
2783 debug_gcpro1 (__FILE__, __LINE__,&ngcpro1,&v)
|
|
2784 #define NGCPRO2(v1,v2) \
|
|
2785 debug_gcpro2 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&v1,&v2)
|
|
2786 #define NGCPRO3(v1,v2,v3) \
|
|
2787 debug_gcpro3 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&v1,&v2,&v3)
|
|
2788 #define NGCPRO4(v1,v2,v3,v4) \
|
|
2789 debug_gcpro4 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,\
|
|
2790 &v1,&v2,&v3,&v4)
|
|
2791 #define NGCPRO5(v1,v2,v3,v4,v5) \
|
|
2792 debug_gcpro5 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,\
|
|
2793 &ngcpro5,&v1,&v2,&v3,&v4,&v5)
|
|
2794 #define NUNGCPRO \
|
|
2795 debug_ungcpro(__FILE__, __LINE__,&ngcpro1)
|
|
2796
|
|
2797 #define NNGCPRO1(v) \
|
|
2798 debug_gcpro1 (__FILE__, __LINE__,&nngcpro1,&v)
|
|
2799 #define NNGCPRO2(v1,v2) \
|
|
2800 debug_gcpro2 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&v1,&v2)
|
|
2801 #define NNGCPRO3(v1,v2,v3) \
|
|
2802 debug_gcpro3 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&v1,&v2,&v3)
|
|
2803 #define NNGCPRO4(v1,v2,v3,v4) \
|
|
2804 debug_gcpro4 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,\
|
|
2805 &v1,&v2,&v3,&v4)
|
|
2806 #define NNGCPRO5(v1,v2,v3,v4,v5) \
|
|
2807 debug_gcpro5 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,\
|
|
2808 &nngcpro5,&v1,&v2,&v3,&v4,&v5)
|
|
2809 #define NNUNGCPRO \
|
|
2810 debug_ungcpro(__FILE__, __LINE__,&nngcpro1)
|
|
2811
|
|
2812 #else /* ! DEBUG_GCPRO */
|
|
2813
|
|
2814 #define GCPRO1(var1) ((void) ( \
|
|
2815 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
|
|
2816 gcprolist = &gcpro1 ))
|
|
2817
|
|
2818 #define GCPRO2(var1, var2) ((void) ( \
|
|
2819 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
|
|
2820 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
|
|
2821 gcprolist = &gcpro2 ))
|
|
2822
|
|
2823 #define GCPRO3(var1, var2, var3) ((void) ( \
|
|
2824 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
|
|
2825 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
|
|
2826 gcpro3.next = &gcpro2, gcpro3.var = &var3, gcpro3.nvars = 1, \
|
|
2827 gcprolist = &gcpro3 ))
|
|
2828
|
|
2829 #define GCPRO4(var1, var2, var3, var4) ((void) ( \
|
|
2830 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
|
|
2831 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
|
|
2832 gcpro3.next = &gcpro2, gcpro3.var = &var3, gcpro3.nvars = 1, \
|
|
2833 gcpro4.next = &gcpro3, gcpro4.var = &var4, gcpro4.nvars = 1, \
|
|
2834 gcprolist = &gcpro4 ))
|
|
2835
|
|
2836 #define GCPRO5(var1, var2, var3, var4, var5) ((void) ( \
|
|
2837 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
|
|
2838 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
|
|
2839 gcpro3.next = &gcpro2, gcpro3.var = &var3, gcpro3.nvars = 1, \
|
|
2840 gcpro4.next = &gcpro3, gcpro4.var = &var4, gcpro4.nvars = 1, \
|
|
2841 gcpro5.next = &gcpro4, gcpro5.var = &var5, gcpro5.nvars = 1, \
|
|
2842 gcprolist = &gcpro5 ))
|
|
2843
|
|
2844 #define UNGCPRO ((void) (gcprolist = gcpro1.next))
|
|
2845
|
|
2846 #define NGCPRO1(var1) ((void) ( \
|
|
2847 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
|
|
2848 gcprolist = &ngcpro1 ))
|
|
2849
|
|
2850 #define NGCPRO2(var1, var2) ((void) ( \
|
|
2851 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
|
|
2852 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
|
|
2853 gcprolist = &ngcpro2 ))
|
|
2854
|
|
2855 #define NGCPRO3(var1, var2, var3) ((void) ( \
|
|
2856 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
|
|
2857 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
|
|
2858 ngcpro3.next = &ngcpro2, ngcpro3.var = &var3, ngcpro3.nvars = 1, \
|
|
2859 gcprolist = &ngcpro3 ))
|
|
2860
|
|
2861 #define NGCPRO4(var1, var2, var3, var4) ((void) ( \
|
|
2862 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
|
|
2863 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
|
|
2864 ngcpro3.next = &ngcpro2, ngcpro3.var = &var3, ngcpro3.nvars = 1, \
|
|
2865 ngcpro4.next = &ngcpro3, ngcpro4.var = &var4, ngcpro4.nvars = 1, \
|
|
2866 gcprolist = &ngcpro4 ))
|
|
2867
|
|
2868 #define NGCPRO5(var1, var2, var3, var4, var5) ((void) ( \
|
|
2869 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
|
|
2870 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
|
|
2871 ngcpro3.next = &ngcpro2, ngcpro3.var = &var3, ngcpro3.nvars = 1, \
|
|
2872 ngcpro4.next = &ngcpro3, ngcpro4.var = &var4, ngcpro4.nvars = 1, \
|
|
2873 ngcpro5.next = &ngcpro4, ngcpro5.var = &var5, ngcpro5.nvars = 1, \
|
|
2874 gcprolist = &ngcpro5 ))
|
|
2875
|
|
2876 #define NUNGCPRO ((void) (gcprolist = ngcpro1.next))
|
|
2877
|
|
2878 #define NNGCPRO1(var1) ((void) ( \
|
|
2879 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
|
|
2880 gcprolist = &nngcpro1 ))
|
|
2881
|
|
2882 #define NNGCPRO2(var1, var2) ((void) ( \
|
|
2883 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
|
|
2884 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
|
|
2885 gcprolist = &nngcpro2 ))
|
|
2886
|
|
2887 #define NNGCPRO3(var1, var2, var3) ((void) ( \
|
|
2888 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
|
|
2889 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
|
|
2890 nngcpro3.next = &nngcpro2, nngcpro3.var = &var3, nngcpro3.nvars = 1, \
|
|
2891 gcprolist = &nngcpro3 ))
|
|
2892
|
|
2893 #define NNGCPRO4(var1, var2, var3, var4) ((void) ( \
|
|
2894 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
|
|
2895 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
|
|
2896 nngcpro3.next = &nngcpro2, nngcpro3.var = &var3, nngcpro3.nvars = 1, \
|
|
2897 nngcpro4.next = &nngcpro3, nngcpro4.var = &var4, nngcpro4.nvars = 1, \
|
|
2898 gcprolist = &nngcpro4 ))
|
|
2899
|
|
2900 #define NNGCPRO5(var1, var2, var3, var4, var5) ((void) ( \
|
|
2901 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
|
|
2902 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
|
|
2903 nngcpro3.next = &nngcpro2, nngcpro3.var = &var3, nngcpro3.nvars = 1, \
|
|
2904 nngcpro4.next = &nngcpro3, nngcpro4.var = &var4, nngcpro4.nvars = 1, \
|
|
2905 nngcpro5.next = &nngcpro4, nngcpro5.var = &var5, nngcpro5.nvars = 1, \
|
|
2906 gcprolist = &nngcpro5 ))
|
|
2907
|
|
2908 #define NNUNGCPRO ((void) (gcprolist = nngcpro1.next))
|
|
2909
|
|
2910 #endif /* ! DEBUG_GCPRO */
|
|
2911
|
|
2912 /* Evaluate expr, UNGCPRO, and then return the value of expr. */
|
|
2913 #define RETURN_UNGCPRO(expr) do \
|
|
2914 { \
|
|
2915 Lisp_Object ret_ungc_val = (expr); \
|
|
2916 UNGCPRO; \
|
|
2917 RETURN_SANS_WARNINGS ret_ungc_val; \
|
|
2918 } while (0)
|
|
2919
|
|
2920 /* Evaluate expr, NUNGCPRO, UNGCPRO, and then return the value of expr. */
|
|
2921 #define RETURN_NUNGCPRO(expr) do \
|
|
2922 { \
|
|
2923 Lisp_Object ret_ungc_val = (expr); \
|
|
2924 NUNGCPRO; \
|
|
2925 UNGCPRO; \
|
|
2926 RETURN_SANS_WARNINGS ret_ungc_val; \
|
|
2927 } while (0)
|
|
2928
|
|
2929 /* Evaluate expr, NNUNGCPRO, NUNGCPRO, UNGCPRO, and then return the
|
|
2930 value of expr. */
|
|
2931 #define RETURN_NNUNGCPRO(expr) do \
|
|
2932 { \
|
|
2933 Lisp_Object ret_ungc_val = (expr); \
|
|
2934 NNUNGCPRO; \
|
|
2935 NUNGCPRO; \
|
|
2936 UNGCPRO; \
|
|
2937 RETURN_SANS_WARNINGS ret_ungc_val; \
|
|
2938 } while (0)
|
|
2939
|
452
|
2940 extern Lisp_Object_ptr_dynarr *staticpros;
|
|
2941
|
771
|
2942 #ifdef DEBUG_XEMACS
|
|
2943
|
|
2944 /* Help debug crashes gc-marking a staticpro'ed object. */
|
|
2945
|
|
2946 void staticpro_1 (Lisp_Object *, char *);
|
|
2947 void staticpro_nodump_1 (Lisp_Object *, char *);
|
|
2948 #define staticpro(ptr) staticpro_1 (ptr, #ptr)
|
|
2949 #define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, #ptr)
|
|
2950
|
|
2951 #else
|
611
|
2952
|
428
|
2953 /* Call staticpro (&var) to protect static variable `var'. */
|
|
2954 void staticpro (Lisp_Object *);
|
|
2955
|
|
2956 /* Call staticpro_nodump (&var) to protect static variable `var'. */
|
|
2957 /* var will not be saved at dump time */
|
|
2958 void staticpro_nodump (Lisp_Object *);
|
|
2959
|
771
|
2960 #endif
|
|
2961
|
|
2962 void register_post_gc_action (void (*fun) (void *), void *arg);
|
|
2963 int begin_gc_forbidden (void);
|
|
2964 void end_gc_forbidden (int count);
|
|
2965
|
|
2966
|
|
2967 /************************************************************************/
|
|
2968 /* Dumping */
|
|
2969 /************************************************************************/
|
|
2970
|
|
2971 /* dump_add_root_struct_ptr (&var, &desc) dumps the structure pointed to by
|
|
2972 `var'. This is for a single relocatable pointer located in the data
|
|
2973 segment (i.e. the block pointed to is in the heap). */
|
452
|
2974 #ifdef PDUMP
|
|
2975 void dump_add_root_struct_ptr (void *, const struct struct_description *);
|
|
2976 #else
|
|
2977 #define dump_add_root_struct_ptr(varaddr,descaddr) DO_NOTHING
|
|
2978 #endif
|
|
2979
|
771
|
2980 /* dump_add_opaque (&var, size) dumps the opaque static structure `var'.
|
|
2981 This is for a static block of memory (in the data segment, not the
|
|
2982 heap), with no relocatable pointers in it. */
|
452
|
2983 #ifdef PDUMP
|
665
|
2984 void dump_add_opaque (const void *, Bytecount);
|
452
|
2985 #else
|
|
2986 #define dump_add_opaque(varaddr,size) DO_NOTHING
|
|
2987 #endif
|
|
2988
|
771
|
2989 /* dump_add_root_block (&var, &desc) dumps the static structure located at
|
|
2990 `var' and described by DESC. This is for a static block of memory (in
|
|
2991 the data segment, not the heap), with relocatable pointers in it, as
|
|
2992 described by DESC. (#### Not yet implemented) */
|
|
2993 #ifdef PDUMP
|
|
2994 void dump_add_root_block (void *ptraddress,
|
|
2995 const struct lrecord_description *desc);
|
|
2996 #else
|
|
2997 #define dump_add_root_block(ptraddress,desc) DO_NOTHING
|
|
2998 #endif
|
|
2999
|
458
|
3000 /* Call dump_add_opaque_int (&int_var) to dump `int_var', of type `int'. */
|
|
3001 #ifdef PDUMP
|
|
3002 #define dump_add_opaque_int(int_varaddr) do { \
|
|
3003 int *dao_ = (int_varaddr); /* type check */ \
|
|
3004 dump_add_opaque (dao_, sizeof (*dao_)); \
|
|
3005 } while (0)
|
|
3006 #else
|
|
3007 #define dump_add_opaque_int(int_varaddr) DO_NOTHING
|
|
3008 #endif
|
|
3009
|
|
3010 /* Call dump_add_opaque_fixnum (&fixnum_var) to dump `fixnum_var', of type `Fixnum'. */
|
|
3011 #ifdef PDUMP
|
|
3012 #define dump_add_opaque_fixnum(fixnum_varaddr) do { \
|
|
3013 Fixnum *dao_ = (fixnum_varaddr); /* type check */ \
|
|
3014 dump_add_opaque (dao_, sizeof (*dao_)); \
|
|
3015 } while (0)
|
|
3016 #else
|
|
3017 #define dump_add_opaque_fixnum(fixnum_varaddr) DO_NOTHING
|
|
3018 #endif
|
|
3019
|
452
|
3020 /* Call dump_add_root_object (&var) to ensure that var is properly updated after pdump. */
|
|
3021 #ifdef PDUMP
|
|
3022 void dump_add_root_object (Lisp_Object *);
|
|
3023 #else
|
|
3024 #define dump_add_root_object(varaddr) DO_NOTHING
|
|
3025 #endif
|
|
3026
|
|
3027 /* Call dump_add_root_object (&var) to ensure that var is properly updated after
|
|
3028 pdump. var must point to a linked list of objects out of which
|
428
|
3029 some may not be dumped */
|
452
|
3030 #ifdef PDUMP
|
|
3031 void dump_add_weak_object_chain (Lisp_Object *);
|
|
3032 #else
|
|
3033 #define dump_add_weak_object_chain(varaddr) DO_NOTHING
|
|
3034 #endif
|
428
|
3035
|
|
3036 /* Nonzero means Emacs has already been initialized.
|
|
3037 Used during startup to detect startup of dumped Emacs. */
|
|
3038 extern int initialized;
|
|
3039
|
771
|
3040
|
|
3041
|
|
3042 /************************************************************************/
|
|
3043 /* Misc definitions */
|
|
3044 /************************************************************************/
|
442
|
3045
|
|
3046 /************************************************************************/
|
|
3047 /* prototypes */
|
|
3048 /************************************************************************/
|
|
3049
|
|
3050 /* NOTE: Prototypes should go HERE, not in various header files, unless
|
|
3051 they specifically reference a type that's not defined in lisp.h.
|
|
3052 (And even then, you might consider adding the type to lisp.h.)
|
|
3053
|
|
3054 The idea is that header files typically contain the innards of objects,
|
|
3055 and we want to minimize the number of "dependencies" of one file on
|
|
3056 the specifics of such objects. Putting prototypes here minimizes the
|
|
3057 number of header files that need to be included -- good for a number
|
|
3058 of reasons. --ben */
|
|
3059
|
|
3060 /*--------------- prototypes for various public c functions ------------*/
|
|
3061
|
|
3062 /* Prototypes for all init/syms_of/vars_of initialization functions. */
|
|
3063 #include "symsinit.h"
|
|
3064
|
826
|
3065 /* Defined in abbrev.c */
|
|
3066 EXFUN (Fexpand_abbrev, 0);
|
|
3067
|
428
|
3068 /* Defined in alloc.c */
|
826
|
3069 EXFUN (Fcons, 2);
|
|
3070 EXFUN (Flist, MANY);
|
|
3071 EXFUN (Fmake_byte_code, MANY);
|
|
3072 EXFUN (Fmake_list, 2);
|
|
3073 EXFUN (Fmake_string, 2);
|
|
3074 EXFUN (Fmake_symbol, 1);
|
|
3075 EXFUN (Fmake_vector, 2);
|
|
3076 EXFUN (Fvector, MANY);
|
|
3077
|
428
|
3078 void release_breathing_space (void);
|
|
3079 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object);
|
665
|
3080 Lisp_Object make_vector (Elemcount, Lisp_Object);
|
428
|
3081 Lisp_Object vector1 (Lisp_Object);
|
|
3082 Lisp_Object vector2 (Lisp_Object, Lisp_Object);
|
|
3083 Lisp_Object vector3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
665
|
3084 Lisp_Object make_bit_vector (Elemcount, Lisp_Object);
|
|
3085 Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, Elemcount);
|
428
|
3086 Lisp_Object noseeum_make_marker (void);
|
|
3087 void garbage_collect_1 (void);
|
|
3088 Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3089 Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3090 Lisp_Object list1 (Lisp_Object);
|
|
3091 Lisp_Object list2 (Lisp_Object, Lisp_Object);
|
|
3092 Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3093 Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3094 Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
3095 Lisp_Object);
|
|
3096 Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
3097 Lisp_Object, Lisp_Object);
|
|
3098 DECLARE_DOESNT_RETURN (memory_full (void));
|
|
3099 void disksave_object_finalization (void);
|
|
3100 extern int purify_flag;
|
|
3101 extern int gc_currently_forbidden;
|
|
3102 extern EMACS_INT gc_generation_number[1];
|
|
3103 int c_readonly (Lisp_Object);
|
|
3104 int lisp_readonly (Lisp_Object);
|
771
|
3105 Lisp_Object build_intstring (const Intbyte *);
|
665
|
3106 Lisp_Object build_string (const CIntbyte *);
|
609
|
3107 Lisp_Object build_ext_string (const Extbyte *, Lisp_Object);
|
771
|
3108 Lisp_Object build_msg_intstring (const Intbyte *);
|
|
3109 Lisp_Object build_msg_string (const CIntbyte *);
|
665
|
3110 Lisp_Object make_string (const Intbyte *, Bytecount);
|
442
|
3111 Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object);
|
771
|
3112 void init_string_ascii_begin (Lisp_Object string);
|
428
|
3113 Lisp_Object make_uninit_string (Bytecount);
|
|
3114 Lisp_Object make_float (double);
|
665
|
3115 Lisp_Object make_string_nocopy (const Intbyte *, Bytecount);
|
428
|
3116 void free_cons (Lisp_Cons *);
|
|
3117 void free_list (Lisp_Object);
|
|
3118 void free_alist (Lisp_Object);
|
|
3119 void mark_conses_in_list (Lisp_Object);
|
|
3120 void free_marker (Lisp_Marker *);
|
|
3121 int object_dead_p (Lisp_Object);
|
|
3122 void mark_object (Lisp_Object obj);
|
|
3123 int marked_p (Lisp_Object obj);
|
814
|
3124 extern int need_to_garbage_collect;
|
428
|
3125
|
|
3126 #ifdef MEMORY_USAGE_STATS
|
665
|
3127 Bytecount malloced_storage_size (void *, Bytecount, struct overhead_stats *);
|
|
3128 Bytecount fixed_type_block_overhead (Bytecount);
|
428
|
3129 #endif
|
|
3130 #ifdef PDUMP
|
|
3131 void pdump (void);
|
442
|
3132 int pdump_load (const char *);
|
428
|
3133
|
|
3134 extern char *pdump_start, *pdump_end;
|
|
3135 #define DUMPEDP(adr) ((((char *)(adr)) < pdump_end) && (((char *)(adr)) >= pdump_start))
|
|
3136 #else
|
|
3137 #define DUMPEDP(adr) 0
|
|
3138 #endif
|
|
3139
|
|
3140 /* Defined in buffer.c */
|
|
3141 Lisp_Object get_truename_buffer (Lisp_Object);
|
|
3142 void switch_to_buffer (Lisp_Object, Lisp_Object);
|
|
3143 extern int find_file_compare_truenames;
|
|
3144 extern int find_file_use_truenames;
|
771
|
3145 Intbyte *get_initial_directory (Intbyte *pathname, Bytecount size);
|
|
3146 extern Lisp_Object Vbuffer_alist;
|
|
3147 void set_buffer_internal (struct buffer *b);
|
|
3148 struct buffer *decode_buffer (Lisp_Object buffer, int allow_string);
|
|
3149
|
|
3150 void record_buffer (Lisp_Object buf);
|
|
3151 Lisp_Object get_buffer (Lisp_Object name,
|
|
3152 int error_if_deleted_or_does_not_exist);
|
|
3153 int map_over_sharing_buffers (struct buffer *buf,
|
|
3154 int (*mapfun) (struct buffer *buf,
|
|
3155 void *closure),
|
|
3156 void *closure);
|
|
3157
|
|
3158 extern struct buffer *current_buffer;
|
|
3159
|
|
3160 extern void init_initial_directory (void); /* initialize initial_directory */
|
|
3161
|
|
3162 EXFUN (Fbuffer_disable_undo, 1);
|
|
3163 EXFUN (Fbuffer_modified_p, 1);
|
|
3164 EXFUN (Fbuffer_name, 1);
|
|
3165 EXFUN (Fcurrent_buffer, 0);
|
|
3166 EXFUN (Ferase_buffer, 1);
|
|
3167 EXFUN (Fget_buffer, 1);
|
|
3168 EXFUN (Fget_buffer_create, 1);
|
|
3169 EXFUN (Fget_file_buffer, 1);
|
|
3170 EXFUN (Fkill_buffer, 1);
|
|
3171 EXFUN (Fother_buffer, 3);
|
|
3172 EXFUN (Frecord_buffer, 1);
|
|
3173 EXFUN (Fset_buffer, 1);
|
|
3174 EXFUN (Fset_buffer_modified_p, 2);
|
|
3175
|
|
3176 extern Lisp_Object QSscratch, Qafter_change_function, Qafter_change_functions;
|
|
3177 extern Lisp_Object Qbefore_change_function, Qbefore_change_functions;
|
|
3178 extern Lisp_Object Qbuffer_or_string_p, Qdefault_directory, Qfirst_change_hook;
|
|
3179 extern Lisp_Object Qpermanent_local, Vafter_change_function;
|
|
3180 extern Lisp_Object Vafter_change_functions, Vbefore_change_function;
|
|
3181 extern Lisp_Object Vbefore_change_functions, Vbuffer_alist, Vbuffer_defaults;
|
|
3182 extern Lisp_Object Vinhibit_read_only, Vtransient_mark_mode;
|
428
|
3183
|
563
|
3184 /* Defined in bytecode.c */
|
826
|
3185 EXFUN (Fbyte_code, 3);
|
|
3186
|
593
|
3187 DECLARE_DOESNT_RETURN (invalid_byte_code
|
665
|
3188 (const CIntbyte *reason, Lisp_Object frob));
|
563
|
3189
|
428
|
3190 /* Defined in callproc.c */
|
771
|
3191 Intbyte *egetenv (const CIntbyte *var);
|
|
3192 void eputenv (const CIntbyte *var, const CIntbyte *value);
|
|
3193 extern int env_initted;
|
428
|
3194
|
826
|
3195 /* Defined in callint.c */
|
|
3196 EXFUN (Fcall_interactively, 3);
|
|
3197 EXFUN (Fprefix_numeric_value, 1);
|
|
3198
|
|
3199 /* Defined in casefiddle.c */
|
|
3200 EXFUN (Fdowncase, 2);
|
|
3201 EXFUN (Fupcase, 2);
|
|
3202 EXFUN (Fupcase_initials, 2);
|
|
3203 EXFUN (Fupcase_initials_region, 3);
|
|
3204 EXFUN (Fupcase_region, 3);
|
|
3205
|
|
3206 /* Defined in casetab.c */
|
|
3207 EXFUN (Fset_standard_case_table, 1);
|
|
3208
|
|
3209 /* Defined in chartab.c */
|
|
3210 EXFUN (Freset_char_table, 1);
|
|
3211
|
|
3212 /* Defined in cmds.c */
|
|
3213 EXFUN (Fbeginning_of_line, 2);
|
|
3214 EXFUN (Fend_of_line, 2);
|
|
3215 EXFUN (Fforward_char, 2);
|
|
3216 EXFUN (Fforward_line, 2);
|
|
3217
|
428
|
3218 /* Defined in console.c */
|
|
3219 void stuff_buffered_input (Lisp_Object);
|
|
3220
|
442
|
3221 /* Defined in console-msw.c */
|
|
3222 EXFUN (Fmswindows_message_box, 3);
|
|
3223 extern int mswindows_message_outputted;
|
771
|
3224 void mswindows_hide_console (void);
|
|
3225 int mswindows_output_console_string (const Intbyte *ptr, Bytecount len);
|
|
3226 void write_string_to_mswindows_debugging_output (Intbyte *str, Bytecount len);
|
442
|
3227
|
428
|
3228 /* Defined in data.c */
|
826
|
3229 EXFUN (Fadd1, 1);
|
|
3230 EXFUN (Faref, 2);
|
|
3231 EXFUN (Faset, 3);
|
|
3232 EXFUN (Fcar, 1);
|
|
3233 EXFUN (Fcar_safe, 1);
|
|
3234 EXFUN (Fcdr, 1);
|
|
3235 EXFUN (Fgeq, MANY);
|
|
3236 EXFUN (Fgtr, MANY);
|
|
3237 EXFUN (Findirect_function, 1);
|
|
3238 EXFUN (Fleq, MANY);
|
|
3239 EXFUN (Flistp, 1);
|
|
3240 EXFUN (Flss, MANY);
|
|
3241 EXFUN (Fmax, MANY);
|
|
3242 EXFUN (Fmin, MANY);
|
|
3243 EXFUN (Fminus, MANY);
|
|
3244 EXFUN (Fnumber_to_string, 1);
|
|
3245 EXFUN (Fplus, MANY);
|
|
3246 EXFUN (Fquo, MANY);
|
|
3247 EXFUN (Frem, 2);
|
|
3248 EXFUN (Fsetcar, 2);
|
|
3249 EXFUN (Fsetcdr, 2);
|
|
3250 EXFUN (Fsub1, 1);
|
|
3251 EXFUN (Fsubr_max_args, 1);
|
|
3252 EXFUN (Fsubr_min_args, 1);
|
|
3253 EXFUN (Ftimes, MANY);
|
|
3254
|
428
|
3255 DECLARE_DOESNT_RETURN (c_write_error (Lisp_Object));
|
|
3256 DECLARE_DOESNT_RETURN (lisp_write_error (Lisp_Object));
|
|
3257 DECLARE_DOESNT_RETURN (args_out_of_range (Lisp_Object, Lisp_Object));
|
|
3258 DECLARE_DOESNT_RETURN (args_out_of_range_3 (Lisp_Object, Lisp_Object,
|
|
3259 Lisp_Object));
|
|
3260 Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
|
|
3261 DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object));
|
|
3262 void check_int_range (EMACS_INT, EMACS_INT, EMACS_INT);
|
|
3263
|
771
|
3264 EXFUN (Fint_to_char, 1);
|
|
3265 EXFUN (Fchar_to_int, 1);
|
|
3266
|
428
|
3267 enum arith_comparison {
|
|
3268 arith_equal,
|
|
3269 arith_notequal,
|
|
3270 arith_less,
|
|
3271 arith_grtr,
|
|
3272 arith_less_or_equal,
|
|
3273 arith_grtr_or_equal };
|
|
3274 Lisp_Object arithcompare (Lisp_Object, Lisp_Object, enum arith_comparison);
|
|
3275
|
707
|
3276 /* Do NOT use word_to_lisp or wasteful_word_to_lisp to decode time_t's
|
|
3277 unless you KNOW arg is non-negative. They cannot return negative
|
|
3278 values! Use make_time. */
|
428
|
3279 Lisp_Object word_to_lisp (unsigned int);
|
|
3280 unsigned int lisp_to_word (Lisp_Object);
|
|
3281
|
|
3282 /* Defined in dired.c */
|
771
|
3283 Lisp_Object make_directory_hash_table (const Intbyte *);
|
428
|
3284 Lisp_Object wasteful_word_to_lisp (unsigned int);
|
|
3285
|
|
3286 /* Defined in doc.c */
|
826
|
3287 EXFUN (Fsubstitute_command_keys, 1);
|
|
3288
|
814
|
3289 Lisp_Object unparesseuxify_doc_string (int fd, EMACS_INT position,
|
|
3290 Intbyte *name_nonreloc,
|
|
3291 Lisp_Object name_reloc,
|
|
3292 int standard_doc_file);
|
428
|
3293 Lisp_Object read_doc_string (Lisp_Object);
|
|
3294
|
|
3295 /* Defined in doprnt.c */
|
771
|
3296 Bytecount emacs_doprnt_va (Lisp_Object stream, const Intbyte *format_nonreloc,
|
|
3297 Bytecount format_length, Lisp_Object format_reloc,
|
|
3298 va_list vargs);
|
|
3299 Bytecount emacs_doprnt (Lisp_Object stream, const Intbyte *format_nonreloc,
|
|
3300 Bytecount format_length, Lisp_Object format_reloc,
|
|
3301 int nargs, const Lisp_Object *largs, ...);
|
|
3302 Lisp_Object emacs_vsprintf_string_lisp (const CIntbyte *format_nonreloc,
|
|
3303 Lisp_Object format_reloc, int nargs,
|
|
3304 const Lisp_Object *largs);
|
|
3305 Lisp_Object emacs_sprintf_string_lisp (const CIntbyte *format_nonreloc,
|
|
3306 Lisp_Object format_reloc, int nargs, ...);
|
|
3307 Intbyte *emacs_vsprintf_malloc_lisp (const CIntbyte *format_nonreloc,
|
|
3308 Lisp_Object format_reloc, int nargs,
|
|
3309 const Lisp_Object *largs,
|
|
3310 Bytecount *len_out);
|
|
3311 Intbyte *emacs_sprintf_malloc_lisp (Bytecount *len_out,
|
|
3312 const CIntbyte *format_nonreloc,
|
|
3313 Lisp_Object format_reloc, int nargs, ...);
|
|
3314 Lisp_Object emacs_vsprintf_string (const CIntbyte *format, va_list vargs);
|
|
3315 Lisp_Object emacs_sprintf_string (const CIntbyte *format, ...)
|
|
3316 PRINTF_ARGS (1, 2);
|
|
3317 Intbyte *emacs_vsprintf_malloc (const CIntbyte *format, va_list vargs,
|
|
3318 Bytecount *len_out);
|
|
3319 Intbyte *emacs_sprintf_malloc (Bytecount *len_out, const CIntbyte *format, ...)
|
|
3320 PRINTF_ARGS (2, 3);
|
|
3321 Bytecount emacs_vsprintf (Intbyte *output, const CIntbyte *format,
|
|
3322 va_list vargs);
|
|
3323 Bytecount emacs_sprintf (Intbyte *output, const CIntbyte *format, ...)
|
|
3324 PRINTF_ARGS (2, 3);
|
|
3325
|
428
|
3326
|
|
3327 /* Defined in editfns.c */
|
826
|
3328 EXFUN (Fbobp, 1);
|
|
3329 EXFUN (Fbolp, 1);
|
|
3330 EXFUN (Fbuffer_substring, 3);
|
|
3331 EXFUN (Fchar_after, 2);
|
|
3332 EXFUN (Fchar_to_string, 1);
|
|
3333 EXFUN (Fdelete_region, 3);
|
|
3334 EXFUN (Feobp, 1);
|
|
3335 EXFUN (Feolp, 1);
|
|
3336 EXFUN (Ffollowing_char, 1);
|
|
3337 EXFUN (Fformat, MANY);
|
|
3338 EXFUN (Fgoto_char, 2);
|
|
3339 EXFUN (Finsert, MANY);
|
|
3340 EXFUN (Finsert_buffer_substring, 3);
|
|
3341 EXFUN (Finsert_char, 4);
|
|
3342 EXFUN (Fnarrow_to_region, 3);
|
|
3343 EXFUN (Fpoint, 1);
|
|
3344 EXFUN (Fpoint_marker, 2);
|
|
3345 EXFUN (Fpoint_max, 1);
|
|
3346 EXFUN (Fpoint_min, 1);
|
|
3347 EXFUN (Fpreceding_char, 1);
|
|
3348 EXFUN (Fsystem_name, 0);
|
|
3349 EXFUN (Fuser_home_directory, 0);
|
|
3350 EXFUN (Fuser_login_name, 1);
|
|
3351 EXFUN (Fwiden, 1);
|
|
3352
|
428
|
3353 void uncache_home_directory (void);
|
771
|
3354 Intbyte *get_home_directory (void);
|
|
3355 Intbyte *user_login_name (uid_t *);
|
428
|
3356 void buffer_insert1 (struct buffer *, Lisp_Object);
|
665
|
3357 Lisp_Object make_string_from_buffer (struct buffer *, Charbpos, Charcount);
|
|
3358 Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Charbpos, Charcount);
|
707
|
3359 Lisp_Object make_time (time_t);
|
428
|
3360 Lisp_Object save_excursion_save (void);
|
|
3361 Lisp_Object save_restriction_save (void);
|
|
3362 Lisp_Object save_excursion_restore (Lisp_Object);
|
|
3363 Lisp_Object save_restriction_restore (Lisp_Object);
|
771
|
3364 void widen_buffer (struct buffer *b, int no_clip);
|
|
3365 int beginning_of_line_p (struct buffer *b, Charbpos pt);
|
428
|
3366
|
|
3367 /* Defined in emacsfns.c */
|
|
3368 Lisp_Object save_current_buffer_restore (Lisp_Object);
|
|
3369
|
|
3370 /* Defined in emacs.c */
|
826
|
3371 EXFUN (Fkill_emacs, 1);
|
|
3372 EXFUN (Frunning_temacs_p, 0);
|
|
3373
|
428
|
3374 SIGTYPE fatal_error_signal (int);
|
442
|
3375 Lisp_Object make_arg_list (int, Extbyte **);
|
|
3376 void make_argc_argv (Lisp_Object, int *, Extbyte ***);
|
|
3377 void free_argc_argv (Extbyte **);
|
771
|
3378 Lisp_Object split_external_path (const Extbyte *path);
|
|
3379 Lisp_Object split_env_path (const CIntbyte *evarname, const Intbyte *default_);
|
|
3380
|
428
|
3381 /* Nonzero means don't do interactive redisplay and don't change tty modes */
|
442
|
3382 extern int noninteractive, noninteractive1;
|
771
|
3383 extern int inhibit_non_essential_printing_operations;
|
428
|
3384 extern int preparing_for_armageddon;
|
458
|
3385 extern Fixnum emacs_priority;
|
428
|
3386 extern int running_asynch_code;
|
|
3387 extern int suppress_early_error_handler_backtrace;
|
771
|
3388 void debug_break (void);
|
|
3389 int debug_can_access_memory (void *ptr, Bytecount len);
|
|
3390 void really_abort (void);
|
776
|
3391 void zero_out_command_line_status_vars (void);
|
428
|
3392
|
826
|
3393 /* Defined in emodules.c */
|
|
3394 EXFUN (Flist_modules, 0);
|
|
3395 EXFUN (Fload_module, 3);
|
|
3396
|
|
3397
|
428
|
3398 /* Defined in eval.c */
|
826
|
3399 EXFUN (Fapply, MANY);
|
|
3400 EXFUN (Fbacktrace, 2);
|
|
3401 EXFUN (Fcommand_execute, 3);
|
|
3402 EXFUN (Fcommandp, 1);
|
|
3403 EXFUN (Feval, 1);
|
|
3404 EXFUN (Ffuncall, MANY);
|
|
3405 EXFUN (Ffunctionp, 1);
|
|
3406 EXFUN (Finteractive_p, 0);
|
|
3407 EXFUN (Fprogn, UNEVALLED);
|
|
3408 EXFUN (Fsignal, 2);
|
|
3409 EXFUN (Fthrow, 2);
|
|
3410
|
563
|
3411 DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object));
|
|
3412 void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object,
|
578
|
3413 Error_Behavior);
|
563
|
3414 Lisp_Object maybe_signal_continuable_error_1 (Lisp_Object, Lisp_Object,
|
578
|
3415 Lisp_Object, Error_Behavior);
|
609
|
3416 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (signal_ferror
|
|
3417 (Lisp_Object,
|
665
|
3418 const CIntbyte *,
|
609
|
3419 ...), 2, 3);
|
578
|
3420 void maybe_signal_ferror (Lisp_Object, Lisp_Object, Error_Behavior,
|
665
|
3421 const CIntbyte *, ...) PRINTF_ARGS (4, 5);
|
|
3422 Lisp_Object signal_continuable_ferror (Lisp_Object, const CIntbyte *, ...)
|
442
|
3423 PRINTF_ARGS (2, 3);
|
563
|
3424 Lisp_Object maybe_signal_continuable_ferror (Lisp_Object, Lisp_Object,
|
578
|
3425 Error_Behavior,
|
665
|
3426 const CIntbyte *, ...)
|
442
|
3427 PRINTF_ARGS (4, 5);
|
563
|
3428
|
665
|
3429 Lisp_Object build_error_data (const CIntbyte *reason, Lisp_Object frob);
|
|
3430 DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, const CIntbyte *,
|
563
|
3431 Lisp_Object));
|
665
|
3432 void maybe_signal_error (Lisp_Object, const CIntbyte *, Lisp_Object,
|
578
|
3433 Lisp_Object, Error_Behavior);
|
665
|
3434 Lisp_Object signal_continuable_error (Lisp_Object, const CIntbyte *,
|
563
|
3435 Lisp_Object);
|
665
|
3436 Lisp_Object maybe_signal_continuable_error (Lisp_Object, const CIntbyte *,
|
563
|
3437 Lisp_Object,
|
578
|
3438 Lisp_Object, Error_Behavior);
|
563
|
3439 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (signal_ferror_with_frob
|
442
|
3440 (Lisp_Object, Lisp_Object,
|
665
|
3441 const CIntbyte *,
|
442
|
3442 ...), 3, 4);
|
563
|
3443 void maybe_signal_ferror_with_frob (Lisp_Object, Lisp_Object, Lisp_Object,
|
578
|
3444 Error_Behavior,
|
665
|
3445 const CIntbyte *, ...) PRINTF_ARGS (5, 6);
|
563
|
3446 Lisp_Object signal_continuable_ferror_with_frob (Lisp_Object, Lisp_Object,
|
665
|
3447 const CIntbyte *,
|
563
|
3448 ...) PRINTF_ARGS (3, 4);
|
|
3449 Lisp_Object maybe_signal_continuable_ferror_with_frob (Lisp_Object,
|
|
3450 Lisp_Object,
|
|
3451 Lisp_Object,
|
578
|
3452 Error_Behavior,
|
665
|
3453 const CIntbyte *, ...)
|
442
|
3454 PRINTF_ARGS (5, 6);
|
665
|
3455 DECLARE_DOESNT_RETURN (signal_error_2 (Lisp_Object, const CIntbyte *,
|
563
|
3456 Lisp_Object, Lisp_Object));
|
665
|
3457 void maybe_signal_error_2 (Lisp_Object, const CIntbyte *, Lisp_Object,
|
578
|
3458 Lisp_Object, Lisp_Object, Error_Behavior);
|
665
|
3459 Lisp_Object signal_continuable_error_2 (Lisp_Object, const CIntbyte *,
|
563
|
3460 Lisp_Object, Lisp_Object);
|
665
|
3461 Lisp_Object maybe_signal_continuable_error_2 (Lisp_Object, const CIntbyte *,
|
563
|
3462 Lisp_Object, Lisp_Object,
|
|
3463 Lisp_Object,
|
578
|
3464 Error_Behavior);
|
563
|
3465
|
|
3466
|
436
|
3467 DECLARE_DOESNT_RETURN (signal_malformed_list_error (Lisp_Object));
|
|
3468 DECLARE_DOESNT_RETURN (signal_malformed_property_list_error (Lisp_Object));
|
|
3469 DECLARE_DOESNT_RETURN (signal_circular_list_error (Lisp_Object));
|
|
3470 DECLARE_DOESNT_RETURN (signal_circular_property_list_error (Lisp_Object));
|
|
3471
|
665
|
3472 DECLARE_DOESNT_RETURN (syntax_error (const CIntbyte *reason,
|
609
|
3473 Lisp_Object frob));
|
665
|
3474 DECLARE_DOESNT_RETURN (syntax_error_2 (const CIntbyte *reason,
|
609
|
3475 Lisp_Object frob1,
|
442
|
3476 Lisp_Object frob2));
|
665
|
3477 void maybe_syntax_error (const CIntbyte *, Lisp_Object, Lisp_Object,
|
578
|
3478 Error_Behavior);
|
665
|
3479 DECLARE_DOESNT_RETURN (sferror (const CIntbyte *reason, Lisp_Object frob));
|
|
3480 DECLARE_DOESNT_RETURN (sferror_2 (const CIntbyte *reason, Lisp_Object frob1,
|
563
|
3481 Lisp_Object frob2));
|
665
|
3482 void maybe_sferror (const CIntbyte *, Lisp_Object, Lisp_Object,
|
578
|
3483 Error_Behavior);
|
665
|
3484 DECLARE_DOESNT_RETURN (invalid_argument (const CIntbyte *reason,
|
442
|
3485 Lisp_Object frob));
|
665
|
3486 DECLARE_DOESNT_RETURN (invalid_argument_2 (const CIntbyte *reason,
|
442
|
3487 Lisp_Object frob1,
|
|
3488 Lisp_Object frob2));
|
665
|
3489 void maybe_invalid_argument (const CIntbyte *, Lisp_Object, Lisp_Object,
|
578
|
3490 Error_Behavior);
|
665
|
3491 DECLARE_DOESNT_RETURN (invalid_operation (const CIntbyte *reason,
|
563
|
3492 Lisp_Object frob));
|
665
|
3493 DECLARE_DOESNT_RETURN (invalid_operation_2 (const CIntbyte *reason,
|
563
|
3494 Lisp_Object frob1,
|
|
3495 Lisp_Object frob2));
|
665
|
3496 void maybe_invalid_operation (const CIntbyte *, Lisp_Object, Lisp_Object,
|
578
|
3497 Error_Behavior);
|
665
|
3498 DECLARE_DOESNT_RETURN (invalid_state (const CIntbyte *reason,
|
563
|
3499 Lisp_Object frob));
|
665
|
3500 DECLARE_DOESNT_RETURN (invalid_state_2 (const CIntbyte *reason,
|
563
|
3501 Lisp_Object frob1,
|
|
3502 Lisp_Object frob2));
|
665
|
3503 void maybe_invalid_state (const CIntbyte *, Lisp_Object, Lisp_Object,
|
609
|
3504 Error_Behavior);
|
665
|
3505 DECLARE_DOESNT_RETURN (invalid_change (const CIntbyte *reason,
|
563
|
3506 Lisp_Object frob));
|
665
|
3507 DECLARE_DOESNT_RETURN (invalid_change_2 (const CIntbyte *reason,
|
563
|
3508 Lisp_Object frob1,
|
|
3509 Lisp_Object frob2));
|
665
|
3510 void maybe_invalid_change (const CIntbyte *, Lisp_Object, Lisp_Object,
|
609
|
3511 Error_Behavior);
|
665
|
3512 DECLARE_DOESNT_RETURN (invalid_constant (const CIntbyte *reason,
|
563
|
3513 Lisp_Object frob));
|
665
|
3514 DECLARE_DOESNT_RETURN (invalid_constant_2 (const CIntbyte *reason,
|
563
|
3515 Lisp_Object frob1,
|
|
3516 Lisp_Object frob2));
|
665
|
3517 void maybe_invalid_constant (const CIntbyte *, Lisp_Object, Lisp_Object,
|
578
|
3518 Error_Behavior);
|
665
|
3519 DECLARE_DOESNT_RETURN (wtaerror (const CIntbyte *reason, Lisp_Object frob));
|
|
3520 DECLARE_DOESNT_RETURN (out_of_memory (const CIntbyte *reason,
|
563
|
3521 Lisp_Object frob));
|
665
|
3522 DECLARE_DOESNT_RETURN (stack_overflow (const CIntbyte *reason,
|
442
|
3523 Lisp_Object frob));
|
563
|
3524 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (printing_unreadable_object
|
665
|
3525 (const CIntbyte *,
|
563
|
3526 ...), 1, 2);
|
442
|
3527
|
436
|
3528 Lisp_Object signal_void_function_error (Lisp_Object);
|
|
3529 Lisp_Object signal_invalid_function_error (Lisp_Object);
|
|
3530 Lisp_Object signal_wrong_number_of_arguments_error (Lisp_Object, int);
|
|
3531
|
428
|
3532 Lisp_Object run_hook_with_args_in_buffer (struct buffer *, int, Lisp_Object *,
|
|
3533 enum run_hooks_condition);
|
|
3534 Lisp_Object run_hook_with_args (int, Lisp_Object *, enum run_hooks_condition);
|
|
3535 void va_run_hook_with_args (Lisp_Object, int, ...);
|
|
3536 void va_run_hook_with_args_in_buffer (struct buffer *, Lisp_Object, int, ...);
|
|
3537 Lisp_Object run_hook (Lisp_Object);
|
|
3538 Lisp_Object apply1 (Lisp_Object, Lisp_Object);
|
|
3539 Lisp_Object call0 (Lisp_Object);
|
|
3540 Lisp_Object call1 (Lisp_Object, Lisp_Object);
|
|
3541 Lisp_Object call2 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3542 Lisp_Object call3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3543 Lisp_Object call4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
3544 Lisp_Object);
|
|
3545 Lisp_Object call5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
3546 Lisp_Object, Lisp_Object);
|
|
3547 Lisp_Object call6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
3548 Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3549 Lisp_Object call7 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
3550 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3551 Lisp_Object call8 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
3552 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
3553 Lisp_Object);
|
|
3554 Lisp_Object call0_in_buffer (struct buffer *, Lisp_Object);
|
|
3555 Lisp_Object call1_in_buffer (struct buffer *, Lisp_Object, Lisp_Object);
|
|
3556 Lisp_Object call2_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
|
|
3557 Lisp_Object);
|
|
3558 Lisp_Object call3_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
|
|
3559 Lisp_Object, Lisp_Object);
|
|
3560 Lisp_Object call4_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
|
|
3561 Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3562 Lisp_Object call5_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
|
|
3563 Lisp_Object, Lisp_Object, Lisp_Object,
|
|
3564 Lisp_Object);
|
|
3565 Lisp_Object call6_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
|
|
3566 Lisp_Object, Lisp_Object, Lisp_Object,
|
|
3567 Lisp_Object, Lisp_Object);
|
|
3568 Lisp_Object eval_in_buffer (struct buffer *, Lisp_Object);
|
|
3569 Lisp_Object call0_with_handler (Lisp_Object, Lisp_Object);
|
|
3570 Lisp_Object call1_with_handler (Lisp_Object, Lisp_Object, Lisp_Object);
|
665
|
3571 Lisp_Object eval_in_buffer_trapping_errors (const CIntbyte *, struct buffer *,
|
428
|
3572 Lisp_Object);
|
665
|
3573 Lisp_Object run_hook_trapping_errors (const CIntbyte *, Lisp_Object);
|
|
3574 Lisp_Object safe_run_hook_trapping_errors (const CIntbyte *, Lisp_Object, int);
|
|
3575 Lisp_Object call0_trapping_errors (const CIntbyte *, Lisp_Object);
|
|
3576 Lisp_Object call1_trapping_errors (const CIntbyte *, Lisp_Object, Lisp_Object);
|
|
3577 Lisp_Object call2_trapping_errors (const CIntbyte *,
|
428
|
3578 Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3579 Lisp_Object call_with_suspended_errors (lisp_fn_t, volatile Lisp_Object, Lisp_Object,
|
578
|
3580 Error_Behavior, int, ...);
|
428
|
3581 /* C Code should be using internal_catch, record_unwind_p, condition_case_1 */
|
|
3582 Lisp_Object internal_catch (Lisp_Object, Lisp_Object (*) (Lisp_Object),
|
|
3583 Lisp_Object, int * volatile);
|
|
3584 Lisp_Object condition_case_1 (Lisp_Object,
|
|
3585 Lisp_Object (*) (Lisp_Object),
|
|
3586 Lisp_Object,
|
|
3587 Lisp_Object (*) (Lisp_Object, Lisp_Object),
|
|
3588 Lisp_Object);
|
|
3589 Lisp_Object condition_case_3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
771
|
3590 Lisp_Object unbind_to_1 (int, Lisp_Object);
|
|
3591 #define unbind_to(obj) unbind_to_1 (obj, Qnil)
|
428
|
3592 void specbind (Lisp_Object, Lisp_Object);
|
771
|
3593 int record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
|
|
3594 int record_unwind_protect_freeing (void *ptr);
|
|
3595 int record_unwind_protect_freeing_dynarr (void *ptr);
|
802
|
3596 int internal_bind_int (int *addr, int newval);
|
|
3597 int internal_bind_lisp_object (Lisp_Object *addr, Lisp_Object newval);
|
428
|
3598 void do_autoload (Lisp_Object, Lisp_Object);
|
|
3599 Lisp_Object un_autoload (Lisp_Object);
|
|
3600 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);
|
665
|
3601 void warn_when_safe (Lisp_Object, Lisp_Object, const CIntbyte *,
|
428
|
3602 ...) PRINTF_ARGS (3, 4);
|
|
3603
|
|
3604
|
|
3605 /* Defined in event-stream.c */
|
826
|
3606 EXFUN (Faccept_process_output, 3);
|
|
3607 EXFUN (Fadd_timeout, 4);
|
|
3608 EXFUN (Fdisable_timeout, 1);
|
|
3609 EXFUN (Fdiscard_input, 0);
|
|
3610 EXFUN (Fdispatch_event, 1);
|
|
3611 EXFUN (Fenqueue_eval_event, 2);
|
|
3612 EXFUN (Fnext_event, 2);
|
|
3613 EXFUN (Fread_key_sequence, 3);
|
|
3614 EXFUN (Fsit_for, 2);
|
|
3615 EXFUN (Fsleep_for, 1);
|
|
3616
|
428
|
3617 void wait_delaying_user_input (int (*) (void *), void *);
|
|
3618 int detect_input_pending (void);
|
|
3619 void reset_this_command_keys (Lisp_Object, int);
|
|
3620 Lisp_Object enqueue_misc_user_event (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3621 Lisp_Object enqueue_misc_user_event_pos (Lisp_Object, Lisp_Object,
|
|
3622 Lisp_Object, int, int, int, int);
|
442
|
3623 extern int modifier_keys_are_sticky;
|
428
|
3624
|
|
3625 /* Defined in event-Xt.c */
|
442
|
3626 void enqueue_Xt_dispatch_event (Lisp_Object event);
|
428
|
3627 void signal_special_Xt_user_event (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3628
|
|
3629
|
|
3630 /* Defined in events.c */
|
826
|
3631 EXFUN (Fcopy_event, 2);
|
|
3632 EXFUN (Fevent_to_character, 4);
|
|
3633
|
428
|
3634 void clear_event_resource (void);
|
|
3635 Lisp_Object allocate_event (void);
|
|
3636
|
771
|
3637 EXFUN (Fevent_x_pixel, 1);
|
|
3638 EXFUN (Fevent_y_pixel, 1);
|
|
3639
|
|
3640
|
826
|
3641 /* Defined in extents.c */
|
|
3642 EXFUN (Fextent_at, 5);
|
|
3643 EXFUN (Fextent_property, 3);
|
|
3644 EXFUN (Fput_text_property, 5);
|
|
3645
|
|
3646 EXFUN (Fdetach_extent, 1);
|
|
3647 EXFUN (Fextent_end_position, 1);
|
|
3648 EXFUN (Fextent_object, 1);
|
|
3649 EXFUN (Fextent_properties, 1);
|
|
3650 EXFUN (Fextent_start_position, 1);
|
|
3651 EXFUN (Fget_char_property, 4);
|
|
3652 EXFUN (Fmake_extent, 3);
|
|
3653 EXFUN (Fnext_extent_change, 2);
|
|
3654 EXFUN (Fprevious_extent_change, 2);
|
|
3655 EXFUN (Fprevious_single_property_change, 4);
|
|
3656 EXFUN (Fset_extent_endpoints, 4);
|
|
3657 EXFUN (Fset_extent_parent, 2);
|
|
3658 EXFUN (Fset_extent_property, 3);
|
|
3659
|
|
3660 enum extent_at_flag
|
|
3661 {
|
|
3662 EXTENT_AT_DEFAULT = 0,
|
|
3663 EXTENT_AT_AFTER = 0,
|
|
3664 EXTENT_AT_BEFORE,
|
|
3665 EXTENT_AT_AT
|
|
3666 };
|
|
3667
|
|
3668 Bytexpos extent_endpoint_byte (EXTENT extent, int endp);
|
|
3669 Charxpos extent_endpoint_char (EXTENT extent, int endp);
|
|
3670 Bytexpos next_single_property_change (Bytexpos pos, Lisp_Object prop,
|
|
3671 Lisp_Object object, Bytexpos limit);
|
|
3672 Bytexpos previous_single_property_change (Bytexpos pos, Lisp_Object prop,
|
|
3673 Lisp_Object object, Bytexpos limit);
|
|
3674 Lisp_Object get_char_property (Bytexpos position, Lisp_Object prop,
|
|
3675 Lisp_Object object, enum extent_at_flag fl,
|
|
3676 int text_props_only);
|
|
3677 void adjust_extents (Lisp_Object object, Memxpos from,
|
|
3678 Memxpos to, int amount);
|
|
3679 void adjust_extents_for_deletion (Lisp_Object object, Bytexpos from,
|
|
3680 Bytexpos to, int gapsize,
|
|
3681 int numdel, int movegapsize);
|
|
3682 void verify_extent_modification (Lisp_Object object, Bytexpos from,
|
|
3683 Bytexpos to,
|
|
3684 Lisp_Object inhibit_read_only_value);
|
|
3685 void process_extents_for_insertion (Lisp_Object object,
|
|
3686 Bytexpos opoint, Bytecount length);
|
|
3687 void process_extents_for_deletion (Lisp_Object object, Bytexpos from,
|
|
3688 Bytexpos to, int destroy_them);
|
|
3689 /* Note the following function is in Charbpos's */
|
|
3690 void report_extent_modification (Lisp_Object buffer, Charbpos start,
|
|
3691 Charbpos end, int afterp);
|
|
3692 void add_string_extents (Lisp_Object string, struct buffer *buf,
|
|
3693 Bytexpos opoint, Bytecount length);
|
|
3694 void splice_in_string_extents (Lisp_Object string, struct buffer *buf,
|
|
3695 Bytexpos opoint, Bytecount length,
|
|
3696 Bytecount pos);
|
|
3697 void copy_string_extents (Lisp_Object new_string,
|
|
3698 Lisp_Object old_string,
|
|
3699 Bytecount new_pos, Bytecount old_pos,
|
|
3700 Bytecount length);
|
|
3701 void detach_all_extents (Lisp_Object object);
|
|
3702 Lisp_Object extent_at (Bytexpos position, Lisp_Object object,
|
|
3703 Lisp_Object property, EXTENT before,
|
|
3704 enum extent_at_flag at_flag, int all_extents);
|
|
3705
|
771
|
3706 /* Defined in file-coding.c */
|
|
3707 EXFUN (Fcoding_category_list, 0);
|
|
3708 EXFUN (Fcoding_category_system, 1);
|
|
3709 EXFUN (Fcoding_priority_list, 0);
|
|
3710 EXFUN (Fcoding_system_description, 1);
|
|
3711 EXFUN (Fcoding_system_documentation, 1);
|
|
3712 EXFUN (Fcoding_system_list, 1);
|
|
3713 EXFUN (Fcoding_system_name, 1);
|
|
3714 EXFUN (Fcoding_system_p, 1);
|
|
3715 EXFUN (Fcoding_system_property, 2);
|
|
3716 EXFUN (Fcoding_system_type, 1);
|
|
3717 EXFUN (Fcopy_coding_system, 2);
|
|
3718 EXFUN (Fdecode_big5_char, 1);
|
|
3719 EXFUN (Fdecode_coding_region, 4);
|
|
3720 EXFUN (Fdecode_shift_jis_char, 1);
|
|
3721 EXFUN (Fdefine_coding_system_alias, 2);
|
|
3722 EXFUN (Fdetect_coding_region, 3);
|
|
3723 EXFUN (Fdefault_encoding_detection_enabled_p, 0);
|
|
3724 EXFUN (Fencode_big5_char, 1);
|
|
3725 EXFUN (Fencode_coding_region, 4);
|
|
3726 EXFUN (Fencode_shift_jis_char, 1);
|
|
3727 EXFUN (Ffind_coding_system, 1);
|
|
3728 EXFUN (Fget_coding_system, 1);
|
|
3729 EXFUN (Fmake_coding_system, 4);
|
|
3730 EXFUN (Fset_coding_category_system, 2);
|
|
3731 EXFUN (Fset_coding_priority_list, 1);
|
|
3732 EXFUN (Fsubsidiary_coding_system, 2);
|
|
3733
|
|
3734 extern Lisp_Object Qshift_jis, Qiso2022, Qbig5, Qccl;
|
|
3735 extern Lisp_Object Qcharset_g0;
|
|
3736 extern Lisp_Object Qcharset_g1, Qcharset_g2, Qcharset_g3, Qcoding_system_error;
|
|
3737 extern Lisp_Object Qcoding_systemp, Qcr, Qcrlf, Qdecode, Qencode;
|
|
3738 extern Lisp_Object Qeol_cr, Qeol_crlf, Qeol_lf, Qeol_type, Qescape_quoted;
|
|
3739 extern Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output;
|
|
3740 extern Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output;
|
|
3741 extern Lisp_Object Qinput_charset_conversion, Qlf, Qlock_shift;
|
|
3742 extern Lisp_Object Qmnemonic, Qno_ascii_cntl, Qno_ascii_eol;
|
|
3743 extern Lisp_Object Qno_conversion, Qraw_text;
|
|
3744 extern Lisp_Object Qno_iso6429, Qoutput_charset_conversion;
|
|
3745 extern Lisp_Object Qpost_read_conversion, Qpre_write_conversion, Qseven;
|
|
3746 extern Lisp_Object Qshort, Vcoding_system_for_read;
|
|
3747 extern Lisp_Object Vcoding_system_for_write;
|
|
3748 extern Lisp_Object Vfile_name_coding_system, Vkeyboard_coding_system;
|
|
3749 extern Lisp_Object Vterminal_coding_system;
|
|
3750 extern Lisp_Object Qcanonicalize_after_coding;
|
|
3751 void init_charset_unicode_tables (Lisp_Object charset);
|
|
3752 void free_charset_unicode_tables (Lisp_Object charset);
|
|
3753 void recalculate_unicode_precedence (void);
|
|
3754 int coding_system_is_for_text_file (Lisp_Object coding_system);
|
|
3755 Lisp_Object find_coding_system_for_text_file (Lisp_Object name, int eol_wrap);
|
|
3756 Lisp_Object get_coding_system_for_text_file (Lisp_Object name, int eol_wrap);
|
|
3757 int coding_system_is_binary (Lisp_Object coding_system);
|
|
3758
|
|
3759
|
428
|
3760 /* Defined in fileio.c */
|
826
|
3761 EXFUN (Fdirectory_file_name, 1);
|
|
3762 EXFUN (Fdo_auto_save, 2);
|
|
3763 EXFUN (Fexpand_file_name, 2);
|
|
3764 EXFUN (Ffile_accessible_directory_p, 1);
|
|
3765 EXFUN (Ffile_directory_p, 1);
|
|
3766 EXFUN (Ffile_executable_p, 1);
|
|
3767 EXFUN (Ffile_exists_p, 1);
|
|
3768 EXFUN (Ffile_name_absolute_p, 1);
|
|
3769 EXFUN (Ffile_name_as_directory, 1);
|
|
3770 EXFUN (Ffile_name_directory, 1);
|
|
3771 EXFUN (Ffile_name_nondirectory, 1);
|
|
3772 EXFUN (Ffile_readable_p, 1);
|
|
3773 EXFUN (Ffile_symlink_p, 1);
|
|
3774 EXFUN (Ffile_truename, 2);
|
|
3775 EXFUN (Ffind_file_name_handler, 2);
|
|
3776 EXFUN (Finsert_file_contents_internal, 7);
|
|
3777 EXFUN (Fmake_temp_name, 1);
|
|
3778 EXFUN (Fsubstitute_in_file_name, 1);
|
|
3779 EXFUN (Funhandled_file_name_directory, 1);
|
|
3780 EXFUN (Fverify_visited_file_modtime, 1);
|
|
3781
|
428
|
3782 void record_auto_save (void);
|
|
3783 void force_auto_save_soon (void);
|
563
|
3784 DECLARE_DOESNT_RETURN (report_error_with_errno (Lisp_Object errtype,
|
665
|
3785 const CIntbyte *string,
|
563
|
3786 Lisp_Object data));
|
|
3787 DECLARE_DOESNT_RETURN (report_file_type_error (Lisp_Object errtype,
|
|
3788 Lisp_Object oserrmess,
|
665
|
3789 const CIntbyte *string,
|
563
|
3790 Lisp_Object data));
|
665
|
3791 DECLARE_DOESNT_RETURN (report_file_error (const CIntbyte *, Lisp_Object));
|
428
|
3792 Lisp_Object lisp_strerror (int);
|
|
3793 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
|
|
3794 int internal_delete_file (Lisp_Object);
|
|
3795
|
|
3796 /* Defined in filelock.c */
|
826
|
3797 EXFUN (Funlock_buffer, 0);
|
|
3798
|
428
|
3799 void lock_file (Lisp_Object);
|
|
3800 void unlock_file (Lisp_Object);
|
|
3801 void unlock_all_files (void);
|
|
3802 void unlock_buffer (struct buffer *);
|
|
3803
|
|
3804 /* Defined in filemode.c */
|
|
3805 void filemodestring (struct stat *, char *);
|
|
3806
|
|
3807 /* Defined in floatfns.c */
|
826
|
3808 EXFUN (Ftruncate, 1);
|
|
3809
|
428
|
3810 double extract_float (Lisp_Object);
|
|
3811
|
|
3812 /* Defined in fns.c */
|
826
|
3813 EXFUN (Fappend, MANY);
|
|
3814 EXFUN (Fassoc, 2);
|
|
3815 EXFUN (Fassq, 2);
|
|
3816 EXFUN (Fcanonicalize_lax_plist, 2);
|
|
3817 EXFUN (Fcanonicalize_plist, 2);
|
|
3818 EXFUN (Fcheck_valid_plist, 1);
|
|
3819 EXFUN (Fconcat, MANY);
|
|
3820 EXFUN (Fcopy_alist, 1);
|
|
3821 EXFUN (Fcopy_list, 1);
|
|
3822 EXFUN (Fcopy_sequence, 1);
|
|
3823 EXFUN (Fcopy_tree, 2);
|
|
3824 EXFUN (Fdelete, 2);
|
|
3825 EXFUN (Fdelq, 2);
|
|
3826 EXFUN (Fdestructive_alist_to_plist, 1);
|
|
3827 EXFUN (Felt, 2);
|
|
3828 EXFUN (Fequal, 2);
|
|
3829 EXFUN (Fget, 3);
|
|
3830 EXFUN (Flast, 2);
|
|
3831 EXFUN (Flax_plist_get, 3);
|
|
3832 EXFUN (Flax_plist_remprop, 2);
|
|
3833 EXFUN (Flength, 1);
|
|
3834 EXFUN (Fmapcar, 2);
|
|
3835 EXFUN (Fmember, 2);
|
|
3836 EXFUN (Fmemq, 2);
|
|
3837 EXFUN (Fnconc, MANY);
|
|
3838 EXFUN (Fnreverse, 1);
|
|
3839 EXFUN (Fnthcdr, 2);
|
|
3840 EXFUN (Fold_assq, 2);
|
|
3841 EXFUN (Fold_equal, 2);
|
|
3842 EXFUN (Fold_member, 2);
|
|
3843 EXFUN (Fold_memq, 2);
|
|
3844 EXFUN (Fplist_get, 3);
|
|
3845 EXFUN (Fplist_member, 2);
|
|
3846 EXFUN (Fplist_put, 3);
|
|
3847 EXFUN (Fprovide, 1);
|
|
3848 EXFUN (Fput, 3);
|
|
3849 EXFUN (Frassq, 2);
|
|
3850 EXFUN (Fremassq, 2);
|
|
3851 EXFUN (Freplace_list, 2);
|
|
3852 EXFUN (Fsort, 2);
|
|
3853 EXFUN (Fstring_equal, 2);
|
|
3854 EXFUN (Fstring_lessp, 2);
|
|
3855 EXFUN (Fsubstring, 3);
|
|
3856 EXFUN (Fvalid_plist_p, 1);
|
|
3857
|
428
|
3858 Lisp_Object list_sort (Lisp_Object, Lisp_Object,
|
|
3859 int (*) (Lisp_Object, Lisp_Object, Lisp_Object));
|
|
3860 Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3861
|
|
3862 void bump_string_modiff (Lisp_Object);
|
|
3863 Lisp_Object memq_no_quit (Lisp_Object, Lisp_Object);
|
|
3864 Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object);
|
|
3865 Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object);
|
|
3866 Lisp_Object rassq_no_quit (Lisp_Object, Lisp_Object);
|
|
3867 Lisp_Object delq_no_quit (Lisp_Object, Lisp_Object);
|
|
3868 Lisp_Object delq_no_quit_and_free_cons (Lisp_Object, Lisp_Object);
|
|
3869 Lisp_Object remassoc_no_quit (Lisp_Object, Lisp_Object);
|
|
3870 Lisp_Object remassq_no_quit (Lisp_Object, Lisp_Object);
|
|
3871 Lisp_Object remrassq_no_quit (Lisp_Object, Lisp_Object);
|
|
3872
|
|
3873 int plists_differ (Lisp_Object, Lisp_Object, int, int, int);
|
|
3874 Lisp_Object internal_plist_get (Lisp_Object, Lisp_Object);
|
|
3875 void internal_plist_put (Lisp_Object *, Lisp_Object, Lisp_Object);
|
|
3876 int internal_remprop (Lisp_Object *, Lisp_Object);
|
|
3877 Lisp_Object external_plist_get (Lisp_Object *, Lisp_Object,
|
578
|
3878 int, Error_Behavior);
|
428
|
3879 void external_plist_put (Lisp_Object *, Lisp_Object,
|
578
|
3880 Lisp_Object, int, Error_Behavior);
|
|
3881 int external_remprop (Lisp_Object *, Lisp_Object, int, Error_Behavior);
|
428
|
3882 int internal_equal (Lisp_Object, Lisp_Object, int);
|
801
|
3883 int internal_equalp (Lisp_Object obj1, Lisp_Object obj2, int depth);
|
428
|
3884 Lisp_Object concat2 (Lisp_Object, Lisp_Object);
|
|
3885 Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3886 Lisp_Object vconcat2 (Lisp_Object, Lisp_Object);
|
|
3887 Lisp_Object vconcat3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
3888 Lisp_Object nconc2 (Lisp_Object, Lisp_Object);
|
|
3889 Lisp_Object bytecode_nconc2 (Lisp_Object *);
|
442
|
3890 void check_losing_bytecode (const char *, Lisp_Object);
|
428
|
3891
|
771
|
3892 Lisp_Object add_suffix_to_symbol (Lisp_Object symbol,
|
|
3893 const Char_ASCII *ascii_string);
|
|
3894 Lisp_Object add_prefix_to_symbol (const Char_ASCII *ascii_string,
|
|
3895 Lisp_Object symbol);
|
|
3896
|
826
|
3897 /* Defined in frame.c */
|
|
3898 EXFUN (Fselected_frame, 1);
|
|
3899
|
|
3900 /* Defined in free-hook.c */
|
|
3901 EXFUN (Freally_free, 1);
|
|
3902
|
428
|
3903 /* Defined in glyphs.c */
|
826
|
3904 EXFUN (Fmake_glyph_internal, 1);
|
|
3905
|
578
|
3906 Error_Behavior decode_error_behavior_flag (Lisp_Object);
|
|
3907 Lisp_Object encode_error_behavior_flag (Error_Behavior);
|
428
|
3908
|
563
|
3909 /* Defined in glyphs-shared.c */
|
|
3910 void shared_resource_validate (Lisp_Object instantiator);
|
|
3911 Lisp_Object shared_resource_normalize (Lisp_Object inst,
|
|
3912 Lisp_Object console_type,
|
|
3913 Lisp_Object dest_mask,
|
|
3914 Lisp_Object tag);
|
|
3915 extern Lisp_Object Q_resource_type, Q_resource_id;
|
|
3916
|
|
3917 /* Defined in gui.c */
|
|
3918 DECLARE_DOESNT_RETURN (gui_error (const char *reason,
|
|
3919 Lisp_Object frob));
|
569
|
3920 DECLARE_DOESNT_RETURN (gui_error_2 (const char *reason,
|
|
3921 Lisp_Object frob0, Lisp_Object frob1));
|
428
|
3922 /* Defined in indent.c */
|
826
|
3923 EXFUN (Findent_to, 3);
|
|
3924 EXFUN (Fvertical_motion, 3);
|
|
3925
|
|
3926 int byte_spaces_at_point (struct buffer *, Bytebpos);
|
665
|
3927 int column_at_point (struct buffer *, Charbpos, int);
|
793
|
3928 int string_column_at_point (Lisp_Object, Charbpos, int);
|
428
|
3929 int current_column (struct buffer *);
|
|
3930 void invalidate_current_column (void);
|
665
|
3931 Charbpos vmotion (struct window *, Charbpos, int, int *);
|
|
3932 Charbpos vmotion_pixels (Lisp_Object, Charbpos, int, int, int *);
|
428
|
3933
|
771
|
3934 /* Defined in insdel.c */
|
|
3935 void set_buffer_point (struct buffer *buf, Charbpos pos, Bytebpos bipos);
|
|
3936
|
826
|
3937 /* Defined in intl.c */
|
|
3938 EXFUN (Fgettext, 1);
|
|
3939
|
|
3940
|
771
|
3941 /* Defined in intl-win32.c */
|
|
3942 EXFUN (Fmswindows_set_current_locale, 1);
|
|
3943 EXFUN (Fmswindows_current_locale, 0);
|
|
3944 EXFUN (Fmswindows_user_default_locale, 0);
|
|
3945 EXFUN (Fmswindows_system_default_locale, 0);
|
|
3946 EXFUN (Fmswindows_locale_code_page, 1);
|
|
3947 EXFUN (Fmswindows_supported_locales, 0);
|
|
3948 EXFUN (Fmswindows_charset_code_page, 1);
|
|
3949 EXFUN (Fmswindows_set_charset_code_page, 2);
|
|
3950
|
|
3951 extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode;
|
|
3952 extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode;
|
|
3953
|
428
|
3954 /* Defined in keymap.c */
|
826
|
3955 EXFUN (Fdefine_key, 3);
|
|
3956 EXFUN (Fkey_description, 1);
|
|
3957 EXFUN (Flookup_key, 3);
|
|
3958 EXFUN (Fmake_sparse_keymap, 1);
|
|
3959
|
793
|
3960 void where_is_to_char (Lisp_Object, Eistring *);
|
428
|
3961
|
|
3962 /* Defined in lread.c */
|
826
|
3963 EXFUN (Fread, 1);
|
|
3964
|
428
|
3965 void ebolify_bytecode_constants (Lisp_Object);
|
|
3966 void close_load_descs (void);
|
|
3967 int locate_file (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int);
|
|
3968 EXFUN (Flocate_file_clear_hashing, 1);
|
442
|
3969 int isfloat_string (const char *);
|
428
|
3970
|
|
3971 /* Well, I've decided to enable this. -- ben */
|
|
3972 /* And I've decided to make it work right. -- sb */
|
|
3973 #define LOADHIST
|
|
3974 /* Define the following symbol to enable load history of dumped files */
|
|
3975 #define LOADHIST_DUMPED
|
|
3976 /* Define the following symbol to enable load history of C source */
|
|
3977 #define LOADHIST_BUILTIN
|
|
3978
|
|
3979 #ifdef LOADHIST /* this is just a stupid idea */
|
|
3980 #define LOADHIST_ATTACH(x) \
|
|
3981 do { if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); } \
|
|
3982 while (0)
|
|
3983 #else /*! LOADHIST */
|
|
3984 # define LOADHIST_ATTACH(x)
|
|
3985 #endif /*! LOADHIST */
|
|
3986
|
826
|
3987 /* Defined in macros.c */
|
|
3988 EXFUN (Fexecute_kbd_macro, 2);
|
|
3989
|
428
|
3990 /* Defined in marker.c */
|
826
|
3991 EXFUN (Fcopy_marker, 2);
|
|
3992 EXFUN (Fmake_marker, 0);
|
|
3993 EXFUN (Fmarker_buffer, 1);
|
|
3994 EXFUN (Fmarker_position, 1);
|
|
3995 EXFUN (Fset_marker, 3);
|
|
3996 EXFUN (Fset_marker_insertion_type, 2);
|
|
3997
|
|
3998 Bytebpos byte_marker_position (Lisp_Object);
|
665
|
3999 Charbpos marker_position (Lisp_Object);
|
826
|
4000 void set_byte_marker_position (Lisp_Object, Bytebpos);
|
665
|
4001 void set_marker_position (Lisp_Object, Charbpos);
|
428
|
4002 void unchain_marker (Lisp_Object);
|
|
4003 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object);
|
|
4004 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
4005 #ifdef MEMORY_USAGE_STATS
|
|
4006 int compute_buffer_marker_usage (struct buffer *, struct overhead_stats *);
|
|
4007 #endif
|
771
|
4008 void init_buffer_markers (struct buffer *b);
|
|
4009 void uninit_buffer_markers (struct buffer *b);
|
428
|
4010
|
|
4011 /* Defined in menubar.c */
|
|
4012 extern int popup_menu_up_p;
|
|
4013 extern int menubar_show_keybindings;
|
|
4014 extern int popup_menu_titles;
|
|
4015
|
|
4016 /* Defined in minibuf.c */
|
|
4017 extern int minibuf_level;
|
665
|
4018 Charcount scmp_1 (const Intbyte *, const Intbyte *, Charcount, int);
|
428
|
4019 #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case)
|
|
4020 extern int completion_ignore_case;
|
665
|
4021 int regexp_ignore_completion_p (const Intbyte *, Lisp_Object,
|
428
|
4022 Bytecount, Bytecount);
|
|
4023 Lisp_Object clear_echo_area (struct frame *, Lisp_Object, int);
|
|
4024 Lisp_Object clear_echo_area_from_print (struct frame *, Lisp_Object, int);
|
665
|
4025 void echo_area_append (struct frame *, const Intbyte *, Lisp_Object,
|
428
|
4026 Bytecount, Bytecount, Lisp_Object);
|
665
|
4027 void echo_area_message (struct frame *, const Intbyte *, Lisp_Object,
|
428
|
4028 Bytecount, Bytecount, Lisp_Object);
|
|
4029 Lisp_Object echo_area_status (struct frame *);
|
|
4030 int echo_area_active (struct frame *);
|
|
4031 Lisp_Object echo_area_contents (struct frame *);
|
665
|
4032 void message_internal (const Intbyte *, Lisp_Object, Bytecount, Bytecount);
|
|
4033 void message_append_internal (const Intbyte *, Lisp_Object,
|
428
|
4034 Bytecount, Bytecount);
|
442
|
4035 void message (const char *, ...) PRINTF_ARGS (1, 2);
|
|
4036 void message_append (const char *, ...) PRINTF_ARGS (1, 2);
|
|
4037 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2);
|
428
|
4038 void clear_message (void);
|
|
4039
|
771
|
4040 /* Defined in mule-charset.c */
|
826
|
4041 EXFUN (Fmake_charset, 3);
|
|
4042
|
771
|
4043 extern Lisp_Object Ql2r, Qr2l;
|
|
4044
|
428
|
4045 /* Defined in print.c */
|
826
|
4046 EXFUN (Fdisplay_error, 2);
|
|
4047 EXFUN (Ferror_message_string, 1);
|
|
4048 EXFUN (Fprin1, 2);
|
|
4049 EXFUN (Fprin1_to_string, 2);
|
|
4050 EXFUN (Fprinc, 2);
|
|
4051 EXFUN (Fprint, 2);
|
|
4052
|
771
|
4053
|
|
4054 /* Lower-level ways to output data: */
|
|
4055 void print_internal (Lisp_Object, Lisp_Object, int);
|
428
|
4056 void debug_print (Lisp_Object);
|
|
4057 /* NOTE: Do not call this with the data of a Lisp_String. Use princ.
|
|
4058 * Note: stream should be defaulted before calling
|
|
4059 * (eg Qnil means stdout, not Vstandard_output, etc) */
|
826
|
4060 void write_c_string (Lisp_Object stream, const CIntbyte *str);
|
771
|
4061 /* Same goes for this function. */
|
826
|
4062 void write_string (Lisp_Object stream, const Intbyte *str);
|
428
|
4063 /* Same goes for this function. */
|
826
|
4064 void write_string_1 (Lisp_Object stream, const Intbyte *str, Bytecount size);
|
|
4065 void write_eistring (Lisp_Object stream, const Eistring *ei);
|
771
|
4066
|
|
4067 /* Higher-level (printf-style) ways to output data: */
|
|
4068 void write_fmt_string (Lisp_Object stream, const CIntbyte *fmt, ...);
|
|
4069 void write_fmt_string_lisp (Lisp_Object stream, const CIntbyte *fmt,
|
|
4070 int nargs, ...);
|
|
4071 void stderr_out (const CIntbyte *, ...) PRINTF_ARGS (1, 2);
|
|
4072 void stderr_out_lisp (const CIntbyte *, int nargs, ...);
|
|
4073 void stdout_out (const CIntbyte *, ...) PRINTF_ARGS (1, 2);
|
|
4074 void debug_out (const CIntbyte *, ...) PRINTF_ARGS (1, 2);
|
|
4075 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (fatal (const CIntbyte *,
|
|
4076 ...), 1, 2);
|
|
4077
|
|
4078 /* Internal functions: */
|
|
4079 void temp_output_buffer_setup (Lisp_Object);
|
|
4080 void temp_output_buffer_show (Lisp_Object, Lisp_Object);
|
428
|
4081 void print_cons (Lisp_Object, Lisp_Object, int);
|
|
4082 void print_vector (Lisp_Object, Lisp_Object, int);
|
|
4083 void print_string (Lisp_Object, Lisp_Object, int);
|
771
|
4084 void print_symbol (Lisp_Object, Lisp_Object, int);
|
|
4085 void print_float (Lisp_Object, Lisp_Object, int);
|
603
|
4086 /* The number of bytes required to store the decimal printed
|
|
4087 representation of an integral type. Add a few bytes for truncation,
|
|
4088 optional sign prefix, and null byte terminator.
|
614
|
4089 2.40824 == log (256) / log (10).
|
|
4090
|
|
4091 We don't use floating point since Sun cc (buggily?) cannot use
|
|
4092 floating point computations to define a compile-time integral
|
|
4093 constant. */
|
603
|
4094 #define DECIMAL_PRINT_SIZE(integral_type) \
|
614
|
4095 (((2410824 * sizeof (integral_type)) / 1000000) + 3)
|
577
|
4096 void long_to_string (char *, long);
|
428
|
4097 extern int print_escape_newlines;
|
|
4098 extern int print_readably;
|
|
4099 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object,
|
|
4100 Lisp_Object (*) (Lisp_Object),
|
|
4101 Lisp_Object, Lisp_Object);
|
|
4102 void float_to_string (char *, double);
|
|
4103 void internal_object_printer (Lisp_Object, Lisp_Object, int);
|
771
|
4104 void debug_short_backtrace (int);
|
|
4105 void debug_backtrace (void);
|
428
|
4106
|
563
|
4107 /* Defined in process.c */
|
826
|
4108 EXFUN (Fdelete_process, 1);
|
|
4109 EXFUN (Fget_buffer_process, 1);
|
|
4110 EXFUN (Fget_process, 1);
|
|
4111 EXFUN (Fprocess_status, 1);
|
|
4112
|
563
|
4113 DECLARE_DOESNT_RETURN (report_process_error (const char *, Lisp_Object));
|
|
4114 DECLARE_DOESNT_RETURN (report_network_error (const char *, Lisp_Object));
|
814
|
4115 extern Lisp_Object Vlisp_EXEC_SUFFIXES;
|
563
|
4116
|
428
|
4117 /* Defined in profile.c */
|
|
4118 void mark_profiling_info (void);
|
|
4119 void profile_increase_call_count (Lisp_Object);
|
|
4120 extern int profiling_active;
|
|
4121 extern int profiling_redisplay_flag;
|
|
4122
|
|
4123 /* Defined in rangetab.c */
|
826
|
4124 EXFUN (Fclear_range_table, 1);
|
|
4125 EXFUN (Fget_range_table, 3);
|
|
4126 EXFUN (Fmake_range_table, 0);
|
|
4127 EXFUN (Fput_range_table, 4);
|
|
4128
|
428
|
4129 void put_range_table (Lisp_Object, EMACS_INT, EMACS_INT, Lisp_Object);
|
|
4130 int unified_range_table_bytes_needed (Lisp_Object);
|
|
4131 int unified_range_table_bytes_used (void *);
|
|
4132 void unified_range_table_copy_data (Lisp_Object, void *);
|
|
4133 Lisp_Object unified_range_table_lookup (void *, EMACS_INT, Lisp_Object);
|
|
4134 int unified_range_table_nentries (void *);
|
|
4135 void unified_range_table_get_range (void *, int, EMACS_INT *, EMACS_INT *,
|
|
4136 Lisp_Object *);
|
|
4137
|
|
4138 /* Defined in search.c */
|
826
|
4139 EXFUN (Fmatch_beginning, 1);
|
|
4140 EXFUN (Fmatch_end, 1);
|
|
4141 EXFUN (Fskip_chars_backward, 3);
|
|
4142 EXFUN (Fskip_chars_forward, 3);
|
|
4143 EXFUN (Fstring_match, 4);
|
|
4144
|
428
|
4145 struct re_pattern_buffer;
|
|
4146 struct re_registers;
|
826
|
4147 Charbpos scan_buffer (struct buffer *, Emchar, Charbpos, Charbpos, EMACS_INT,
|
|
4148 EMACS_INT *, int);
|
665
|
4149 Charbpos find_next_newline (struct buffer *, Charbpos, int);
|
|
4150 Charbpos find_next_newline_no_quit (struct buffer *, Charbpos, int);
|
826
|
4151 Bytebpos byte_find_next_newline_no_quit (struct buffer *, Bytebpos, int);
|
|
4152 Bytecount byte_find_next_emchar_in_string (Lisp_Object, Emchar, Bytecount,
|
|
4153 EMACS_INT);
|
665
|
4154 Charbpos find_before_next_newline (struct buffer *, Charbpos, Charbpos, int);
|
826
|
4155 struct re_pattern_buffer *compile_pattern (Lisp_Object pattern,
|
|
4156 struct re_registers *regp,
|
|
4157 Lisp_Object translate,
|
|
4158 Lisp_Object searchobj,
|
|
4159 struct buffer *searchbuf,
|
|
4160 int posix, Error_Behavior errb);
|
|
4161 Bytecount fast_string_match (Lisp_Object, const Intbyte *,
|
428
|
4162 Lisp_Object, Bytecount,
|
578
|
4163 Bytecount, int, Error_Behavior, int);
|
428
|
4164 Bytecount fast_lisp_string_match (Lisp_Object, Lisp_Object);
|
|
4165 void restore_match_data (void);
|
507
|
4166 extern Fixnum warn_about_possibly_incompatible_back_references;
|
502
|
4167
|
428
|
4168
|
|
4169 /* Defined in signal.c */
|
|
4170 void init_interrupts_late (void);
|
771
|
4171 int begin_dont_check_for_quit (void);
|
428
|
4172
|
|
4173 /* Defined in sound.c */
|
826
|
4174 EXFUN (Fding, 3);
|
|
4175
|
428
|
4176 void init_device_sound (struct device *);
|
563
|
4177 DECLARE_DOESNT_RETURN (report_sound_error (const Char_ASCII *, Lisp_Object));
|
428
|
4178
|
|
4179 /* Defined in specifier.c */
|
826
|
4180 EXFUN (Fadd_spec_to_specifier, 5);
|
|
4181 EXFUN (Fspecifier_spec_list, 4);
|
|
4182
|
428
|
4183 Lisp_Object specifier_instance (Lisp_Object, Lisp_Object, Lisp_Object,
|
578
|
4184 Error_Behavior, int, int, Lisp_Object);
|
428
|
4185 Lisp_Object specifier_instance_no_quit (Lisp_Object, Lisp_Object, Lisp_Object,
|
578
|
4186 Error_Behavior, int, Lisp_Object);
|
428
|
4187
|
|
4188 /* Defined in symbols.c */
|
826
|
4189 EXFUN (Fboundp, 1);
|
|
4190 EXFUN (Fbuilt_in_variable_type, 1);
|
|
4191 EXFUN (Fdefault_boundp, 1);
|
|
4192 EXFUN (Fdefault_value, 1);
|
|
4193 EXFUN (Ffboundp, 1);
|
|
4194 EXFUN (Ffset, 2);
|
|
4195 EXFUN (Fintern, 2);
|
|
4196 EXFUN (Fintern_soft, 2);
|
|
4197 EXFUN (Fkill_local_variable, 1);
|
|
4198 EXFUN (Fset, 2);
|
|
4199 EXFUN (Fset_default, 2);
|
|
4200 EXFUN (Fsymbol_function, 1);
|
|
4201 EXFUN (Fsymbol_name, 1);
|
|
4202 EXFUN (Fsymbol_plist, 1);
|
|
4203 EXFUN (Fsymbol_value, 1);
|
|
4204
|
665
|
4205 unsigned int hash_string (const Intbyte *, Bytecount);
|
771
|
4206 Lisp_Object intern_int (const Intbyte *str);
|
|
4207 Lisp_Object intern (const CIntbyte *str);
|
814
|
4208 Lisp_Object intern_converting_underscores_to_dashes (const CIntbyte *str);
|
665
|
4209 Lisp_Object oblookup (Lisp_Object, const Intbyte *, Bytecount);
|
428
|
4210 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *);
|
|
4211 Lisp_Object indirect_function (Lisp_Object, int);
|
|
4212 Lisp_Object symbol_value_in_buffer (Lisp_Object, Lisp_Object);
|
|
4213 void kill_buffer_local_variables (struct buffer *);
|
|
4214 int symbol_value_buffer_local_info (Lisp_Object, struct buffer *);
|
|
4215 Lisp_Object find_symbol_value (Lisp_Object);
|
|
4216 Lisp_Object find_symbol_value_quickly (Lisp_Object, int);
|
|
4217 Lisp_Object top_level_value (Lisp_Object);
|
|
4218 void reject_constant_symbols (Lisp_Object sym, Lisp_Object newval,
|
|
4219 int function_p,
|
|
4220 Lisp_Object follow_past_lisp_magic);
|
|
4221
|
|
4222 /* Defined in syntax.c */
|
665
|
4223 Charbpos scan_words (struct buffer *, Charbpos, int);
|
826
|
4224 EXFUN (Fchar_syntax, 2);
|
|
4225 EXFUN (Fforward_word, 2);
|
|
4226 extern Lisp_Object Vstandard_syntax_table;
|
|
4227 void signal_syntax_table_extent_changed (EXTENT extent);
|
|
4228 void signal_syntax_table_extent_adjust (struct buffer *buf);
|
|
4229 void init_buffer_syntax_cache (struct buffer *buf);
|
|
4230 void mark_buffer_syntax_cache (struct buffer *buf);
|
|
4231 void uninit_buffer_syntax_cache (struct buffer *buf);
|
|
4232 extern Lisp_Object Qsyntax_table;
|
428
|
4233
|
771
|
4234 /* Defined in sysdep.c */
|
|
4235 long get_random (void);
|
|
4236 void seed_random (long arg);
|
|
4237
|
|
4238 /* Defined in text.c */
|
|
4239 void find_charsets_in_intbyte_string (unsigned char *charsets,
|
|
4240 const Intbyte *str,
|
|
4241 Bytecount len);
|
|
4242 void find_charsets_in_emchar_string (unsigned char *charsets,
|
|
4243 const Emchar *str,
|
|
4244 Charcount len);
|
|
4245 int intbyte_string_displayed_columns (const Intbyte *str, Bytecount len);
|
|
4246 int emchar_string_displayed_columns (const Emchar *str, Charcount len);
|
|
4247 Charcount intbyte_string_nonascii_chars (const Intbyte *str, Bytecount len);
|
|
4248 void convert_intbyte_string_into_emchar_dynarr (const Intbyte *str,
|
|
4249 Bytecount len,
|
|
4250 Emchar_dynarr *dyn);
|
|
4251 Charcount convert_intbyte_string_into_emchar_string (const Intbyte *str,
|
|
4252 Bytecount len,
|
|
4253 Emchar *arr);
|
|
4254 void convert_emchar_string_into_intbyte_dynarr (Emchar *arr, int nels,
|
|
4255 Intbyte_dynarr *dyn);
|
|
4256 Intbyte *convert_emchar_string_into_malloced_string (Emchar *arr, int nels,
|
|
4257 Bytecount *len_out);
|
826
|
4258 Bytecount copy_text_between_formats (const Intbyte *src, Bytecount srclen,
|
|
4259 Internal_Format srcfmt,
|
|
4260 Lisp_Object srcobj,
|
|
4261 Intbyte *dst, Bytecount dstlen,
|
|
4262 Internal_Format dstfmt,
|
|
4263 Lisp_Object dstobj,
|
|
4264 Bytecount *src_used);
|
|
4265 Bytecount copy_buffer_text_out (struct buffer *buf, Bytebpos pos,
|
|
4266 Bytecount len, Intbyte *dst, Bytecount dstlen,
|
|
4267 Internal_Format dstfmt, Lisp_Object dstobj,
|
|
4268 Bytecount *src_used);
|
771
|
4269
|
|
4270 /* flags for get_buffer_pos_char(), get_buffer_range_char(), etc. */
|
|
4271 /* At most one of GB_COERCE_RANGE and GB_NO_ERROR_IF_BAD should be
|
|
4272 specified. At most one of GB_NEGATIVE_FROM_END and GB_NO_ERROR_IF_BAD
|
|
4273 should be specified. */
|
|
4274
|
|
4275 #define GB_ALLOW_PAST_ACCESSIBLE (1 << 0)
|
|
4276 #define GB_ALLOW_NIL (1 << 1)
|
|
4277 #define GB_CHECK_ORDER (1 << 2)
|
|
4278 #define GB_COERCE_RANGE (1 << 3)
|
|
4279 #define GB_NO_ERROR_IF_BAD (1 << 4)
|
|
4280 #define GB_NEGATIVE_FROM_END (1 << 5)
|
|
4281 #define GB_HISTORICAL_STRING_BEHAVIOR (GB_NEGATIVE_FROM_END | GB_ALLOW_NIL)
|
|
4282
|
|
4283 Charbpos get_buffer_pos_char (struct buffer *b, Lisp_Object pos,
|
|
4284 unsigned int flags);
|
|
4285 Bytebpos get_buffer_pos_byte (struct buffer *b, Lisp_Object pos,
|
|
4286 unsigned int flags);
|
|
4287 void get_buffer_range_char (struct buffer *b, Lisp_Object from, Lisp_Object to,
|
|
4288 Charbpos *from_out, Charbpos *to_out,
|
|
4289 unsigned int flags);
|
|
4290 void get_buffer_range_byte (struct buffer *b, Lisp_Object from, Lisp_Object to,
|
|
4291 Bytebpos *from_out, Bytebpos *to_out,
|
|
4292 unsigned int flags);
|
|
4293 Charcount get_string_pos_char (Lisp_Object string, Lisp_Object pos,
|
|
4294 unsigned int flags);
|
|
4295 Bytecount get_string_pos_byte (Lisp_Object string, Lisp_Object pos,
|
|
4296 unsigned int flags);
|
|
4297 void get_string_range_char (Lisp_Object string, Lisp_Object from,
|
|
4298 Lisp_Object to, Charcount *from_out,
|
|
4299 Charcount *to_out, unsigned int flags);
|
|
4300 void get_string_range_byte (Lisp_Object string, Lisp_Object from,
|
|
4301 Lisp_Object to, Bytecount *from_out,
|
|
4302 Bytecount *to_out, unsigned int flags);
|
826
|
4303 Charxpos get_buffer_or_string_pos_char (Lisp_Object object, Lisp_Object pos,
|
|
4304 unsigned int flags);
|
|
4305 Bytexpos get_buffer_or_string_pos_byte (Lisp_Object object, Lisp_Object pos,
|
|
4306 unsigned int flags);
|
771
|
4307 void get_buffer_or_string_range_char (Lisp_Object object, Lisp_Object from,
|
826
|
4308 Lisp_Object to, Charxpos *from_out,
|
|
4309 Charxpos *to_out, unsigned int flags);
|
771
|
4310 void get_buffer_or_string_range_byte (Lisp_Object object, Lisp_Object from,
|
826
|
4311 Lisp_Object to, Bytexpos *from_out,
|
|
4312 Bytexpos *to_out, unsigned int flags);
|
|
4313 Charxpos buffer_or_string_accessible_begin_char (Lisp_Object object);
|
|
4314 Charxpos buffer_or_string_accessible_end_char (Lisp_Object object);
|
|
4315 Bytexpos buffer_or_string_accessible_begin_byte (Lisp_Object object);
|
|
4316 Bytexpos buffer_or_string_accessible_end_byte (Lisp_Object object);
|
|
4317 Charxpos buffer_or_string_absolute_begin_char (Lisp_Object object);
|
|
4318 Charxpos buffer_or_string_absolute_end_char (Lisp_Object object);
|
|
4319 Bytexpos buffer_or_string_absolute_begin_byte (Lisp_Object object);
|
|
4320 Bytexpos buffer_or_string_absolute_end_byte (Lisp_Object object);
|
|
4321 Charbpos charbpos_clip_to_bounds (Charbpos lower, Charbpos num,
|
|
4322 Charbpos upper);
|
|
4323 Bytebpos bytebpos_clip_to_bounds (Bytebpos lower, Bytebpos num,
|
|
4324 Bytebpos upper);
|
|
4325 Charxpos charxpos_clip_to_bounds (Charxpos lower, Charxpos num,
|
|
4326 Charxpos upper);
|
|
4327 Bytexpos bytexpos_clip_to_bounds (Bytexpos lower, Bytexpos num,
|
|
4328 Bytexpos upper);
|
|
4329 Charxpos buffer_or_string_clip_to_accessible_char (Lisp_Object object,
|
|
4330 Charxpos pos);
|
|
4331 Bytexpos buffer_or_string_clip_to_accessible_byte (Lisp_Object object,
|
|
4332 Bytexpos pos);
|
|
4333 Charxpos buffer_or_string_clip_to_absolute_char (Lisp_Object object,
|
|
4334 Charxpos pos);
|
|
4335 Bytexpos buffer_or_string_clip_to_absolute_byte (Lisp_Object object,
|
|
4336 Bytexpos pos);
|
|
4337
|
771
|
4338
|
|
4339 #ifdef ENABLE_COMPOSITE_CHARS
|
|
4340
|
|
4341 Emchar lookup_composite_char (Intbyte *str, int len);
|
|
4342 Lisp_Object composite_char_string (Emchar ch);
|
|
4343 #endif /* ENABLE_COMPOSITE_CHARS */
|
|
4344
|
|
4345 EXFUN (Ffind_charset, 1);
|
|
4346 EXFUN (Fget_charset, 1);
|
|
4347 EXFUN (Fcharset_list, 0);
|
|
4348
|
|
4349 extern Lisp_Object Vcharset_ascii;
|
|
4350 extern Lisp_Object Vcharset_control_1;
|
|
4351 extern Lisp_Object Vcharset_latin_iso8859_1;
|
|
4352 extern Lisp_Object Vcharset_latin_iso8859_2;
|
|
4353 extern Lisp_Object Vcharset_latin_iso8859_3;
|
|
4354 extern Lisp_Object Vcharset_latin_iso8859_4;
|
|
4355 extern Lisp_Object Vcharset_thai_tis620;
|
|
4356 extern Lisp_Object Vcharset_greek_iso8859_7;
|
|
4357 extern Lisp_Object Vcharset_arabic_iso8859_6;
|
|
4358 extern Lisp_Object Vcharset_hebrew_iso8859_8;
|
|
4359 extern Lisp_Object Vcharset_katakana_jisx0201;
|
|
4360 extern Lisp_Object Vcharset_latin_jisx0201;
|
|
4361 extern Lisp_Object Vcharset_cyrillic_iso8859_5;
|
|
4362 extern Lisp_Object Vcharset_latin_iso8859_9;
|
|
4363 extern Lisp_Object Vcharset_japanese_jisx0208_1978;
|
|
4364 extern Lisp_Object Vcharset_chinese_gb2312;
|
|
4365 extern Lisp_Object Vcharset_japanese_jisx0208;
|
|
4366 extern Lisp_Object Vcharset_korean_ksc5601;
|
|
4367 extern Lisp_Object Vcharset_japanese_jisx0212;
|
|
4368 extern Lisp_Object Vcharset_chinese_cns11643_1;
|
|
4369 extern Lisp_Object Vcharset_chinese_cns11643_2;
|
|
4370 extern Lisp_Object Vcharset_chinese_big5_1;
|
|
4371 extern Lisp_Object Vcharset_chinese_big5_2;
|
|
4372 extern Lisp_Object Vcharset_composite;
|
|
4373
|
|
4374 Emchar Lstream_get_emchar_1 (Lstream *stream, int first_char);
|
|
4375 int Lstream_fput_emchar (Lstream *stream, Emchar ch);
|
|
4376 void Lstream_funget_emchar (Lstream *stream, Emchar ch);
|
|
4377
|
|
4378 DECLARE_INLINE_HEADER (Intbyte *qxestrdup (const Intbyte *s))
|
|
4379 {
|
|
4380 return (Intbyte *) xstrdup ((const char *) s);
|
|
4381 }
|
|
4382
|
|
4383 DECLARE_INLINE_HEADER (Bytecount qxestrlen (const Intbyte *s))
|
|
4384 {
|
|
4385 return strlen ((const char *) s);
|
|
4386 }
|
|
4387
|
|
4388 DECLARE_INLINE_HEADER (Charcount qxestrcharlen (const Intbyte *s))
|
|
4389 {
|
|
4390 return bytecount_to_charcount (s, qxestrlen (s));
|
|
4391 }
|
|
4392
|
|
4393 DECLARE_INLINE_HEADER (int qxestrcmp (const Intbyte *s1,
|
|
4394 const Intbyte *s2))
|
|
4395 {
|
|
4396 return strcmp ((const char *) s1, (const char *) s2);
|
|
4397 }
|
|
4398
|
|
4399 DECLARE_INLINE_HEADER (int qxestrcmp_c (const Intbyte *s1,
|
|
4400 const char *s2))
|
|
4401 {
|
|
4402 return strcmp ((const char *) s1, s2);
|
|
4403 }
|
|
4404
|
|
4405 DECLARE_INLINE_HEADER (int qxestrncmp (const Intbyte *string1,
|
|
4406 const Intbyte *string2,
|
|
4407 Bytecount count))
|
|
4408 {
|
|
4409 return strncmp ((const char *) string1, (const char *) string2,
|
|
4410 (size_t) count);
|
|
4411 }
|
|
4412
|
|
4413 DECLARE_INLINE_HEADER (int qxestrncmp_c (const Intbyte *string1,
|
|
4414 const char *string2,
|
|
4415 Bytecount count))
|
|
4416 {
|
|
4417 return strncmp ((const char *) string1, string2, (size_t) count);
|
|
4418 }
|
|
4419
|
|
4420 DECLARE_INLINE_HEADER (Intbyte *qxestrcpy (Intbyte *strDest,
|
|
4421 const Intbyte *strSource))
|
|
4422 {
|
|
4423 return (Intbyte *) strcpy ((char *) strDest, (const char *) strSource);
|
|
4424 }
|
|
4425
|
|
4426 DECLARE_INLINE_HEADER (Intbyte *qxestrcpy_c (Intbyte *strDest,
|
|
4427 const char *strSource))
|
|
4428 {
|
|
4429 return (Intbyte *) strcpy ((char *) strDest, strSource);
|
|
4430 }
|
|
4431
|
|
4432 DECLARE_INLINE_HEADER (Intbyte *qxestrncpy (Intbyte *strDest,
|
|
4433 const Intbyte *strSource,
|
|
4434 Bytecount count))
|
|
4435 {
|
|
4436 return (Intbyte *) strncpy ((char *) strDest, (const char *) strSource,
|
|
4437 (size_t) count);
|
|
4438 }
|
|
4439
|
|
4440 DECLARE_INLINE_HEADER (Intbyte *qxestrncpy_c (Intbyte *strDest,
|
|
4441 const char *strSource,
|
|
4442 Bytecount count))
|
|
4443 {
|
|
4444 return (Intbyte *) strncpy ((char *) strDest, strSource, (size_t) count);
|
|
4445 }
|
|
4446
|
|
4447 DECLARE_INLINE_HEADER (Intbyte *qxestrcat (Intbyte *strDest,
|
|
4448 const Intbyte *strSource))
|
|
4449 {
|
|
4450 return (Intbyte *) strcat ((char *) strDest, (const char *) strSource);
|
|
4451 }
|
|
4452
|
|
4453 DECLARE_INLINE_HEADER (Intbyte *qxestrcat_c (Intbyte *strDest,
|
|
4454 const char *strSource))
|
|
4455 {
|
|
4456 return (Intbyte *) strcat ((char *) strDest, strSource);
|
|
4457 }
|
|
4458
|
|
4459 DECLARE_INLINE_HEADER (Intbyte *qxestrncat (Intbyte *strDest,
|
|
4460 const Intbyte *strSource,
|
|
4461 Bytecount count))
|
|
4462 {
|
|
4463 return (Intbyte *) strncat ((char *) strDest, (const char *) strSource,
|
|
4464 (size_t) count);
|
|
4465 }
|
|
4466
|
|
4467 DECLARE_INLINE_HEADER (Intbyte *qxestrncat_c (Intbyte *strDest,
|
|
4468 const char *strSource,
|
|
4469 Bytecount count))
|
|
4470 {
|
|
4471 return (Intbyte *) strncat ((char *) strDest, strSource, (size_t) count);
|
|
4472 }
|
|
4473
|
|
4474 DECLARE_INLINE_HEADER (Intbyte *qxestrchr (const Intbyte *s, Emchar c))
|
|
4475 {
|
|
4476 assert (c >= 0 && c <= 255);
|
|
4477 return (Intbyte *) strchr ((const char *) s, c);
|
|
4478 }
|
|
4479
|
|
4480 DECLARE_INLINE_HEADER (Intbyte *qxestrrchr (const Intbyte *s, Emchar c))
|
|
4481 {
|
|
4482 assert (c >= 0 && c <= 255);
|
|
4483 return (Intbyte *) strrchr ((const char *) s, c);
|
|
4484 }
|
|
4485
|
|
4486 DECLARE_INLINE_HEADER (Intbyte *qxestrstr (const Intbyte *string1,
|
|
4487 const Intbyte *string2))
|
|
4488 {
|
|
4489 return (Intbyte *) strstr ((const char *) string1, (const char *) string2);
|
|
4490 }
|
|
4491
|
|
4492 DECLARE_INLINE_HEADER (Bytecount qxestrcspn (const Intbyte *string,
|
|
4493 const CIntbyte *strCharSet))
|
|
4494 {
|
|
4495 return (Bytecount) strcspn ((const char *) string, strCharSet);
|
|
4496 }
|
|
4497
|
|
4498 DECLARE_INLINE_HEADER (Bytecount qxestrspn (const Intbyte *string,
|
|
4499 const CIntbyte *strCharSet))
|
|
4500 {
|
|
4501 return (Bytecount) strspn ((const char *) string, strCharSet);
|
|
4502 }
|
|
4503
|
|
4504 DECLARE_INLINE_HEADER (Intbyte *qxestrpbrk (const Intbyte *string,
|
|
4505 const CIntbyte *strCharSet))
|
|
4506 {
|
|
4507 return (Intbyte *) strpbrk ((const char *) string, strCharSet);
|
|
4508 }
|
|
4509
|
|
4510 DECLARE_INLINE_HEADER (Intbyte *qxestrtok (Intbyte *strToken,
|
|
4511 const CIntbyte *strDelimit))
|
|
4512 {
|
|
4513 return (Intbyte *) strtok ((char *) strToken, strDelimit);
|
|
4514 }
|
|
4515
|
|
4516 DECLARE_INLINE_HEADER (double qxestrtod (const Intbyte *nptr,
|
|
4517 Intbyte **endptr))
|
|
4518 {
|
|
4519 return strtod ((const char *) nptr, (char **) endptr);
|
|
4520 }
|
|
4521
|
|
4522 DECLARE_INLINE_HEADER (long qxestrtol (const Intbyte *nptr, Intbyte **endptr,
|
|
4523 int base))
|
|
4524 {
|
|
4525 return strtol ((const char *) nptr, (char **) endptr, base);
|
|
4526 }
|
|
4527
|
|
4528 DECLARE_INLINE_HEADER (unsigned long qxestrtoul (const Intbyte *nptr,
|
|
4529 Intbyte **endptr,
|
|
4530 int base))
|
|
4531 {
|
|
4532 return strtoul ((const char *) nptr, (char **) endptr, base);
|
|
4533 }
|
|
4534
|
|
4535 DECLARE_INLINE_HEADER (int qxeatoi (const Intbyte *string))
|
|
4536 {
|
|
4537 return atoi ((const char *) string);
|
|
4538 }
|
|
4539
|
|
4540 int qxesprintf (Intbyte *buffer, const CIntbyte *format, ...)
|
|
4541 PRINTF_ARGS (2, 3);
|
|
4542
|
|
4543 /* Do not use POSIX locale routines. Not Mule-correct. */
|
|
4544 #define qxestrcoll DO NOT USE.
|
|
4545 #define qxestrxfrm DO NOT USE.
|
|
4546
|
|
4547 int qxestrcasecmp (const Intbyte *s1, const Intbyte *s2);
|
|
4548 int qxestrcasecmp_c (const Intbyte *s1, const Char_ASCII *s2);
|
|
4549 int qxestrcasecmp_i18n (const Intbyte *s1, const Intbyte *s2);
|
|
4550 int ascii_strcasecmp (const Char_ASCII *s1, const Char_ASCII *s2);
|
|
4551 int lisp_strcasecmp (Lisp_Object s1, Lisp_Object s2);
|
|
4552 int lisp_strcasecmp_i18n (Lisp_Object s1, Lisp_Object s2);
|
|
4553 int qxestrncasecmp (const Intbyte *s1, const Intbyte *s2, Bytecount len);
|
|
4554 int qxestrncasecmp_c (const Intbyte *s1, const Char_ASCII *s2, Bytecount len);
|
|
4555 int qxestrncasecmp_i18n (const Intbyte *s1, const Intbyte *s2, Bytecount len);
|
|
4556 int ascii_strncasecmp (const Char_ASCII *s1, const Char_ASCII *s2,
|
|
4557 Bytecount len);
|
|
4558 int qxememcmp (const Intbyte *s1, const Intbyte *s2, Bytecount len);
|
801
|
4559 int qxememcmp4 (const Intbyte *s1, Bytecount len1,
|
|
4560 const Intbyte *s2, Bytecount len2);
|
771
|
4561 int qxememcasecmp (const Intbyte *s1, const Intbyte *s2, Bytecount len);
|
801
|
4562 int qxememcasecmp4 (const Intbyte *s1, Bytecount len1,
|
|
4563 const Intbyte *s2, Bytecount len2);
|
|
4564 int qxetextcmp (const Intbyte *s1, Bytecount len1,
|
|
4565 const Intbyte *s2, Bytecount len2);
|
|
4566 int qxetextcmp_matching (const Intbyte *s1, Bytecount len1,
|
|
4567 const Intbyte *s2, Bytecount len2,
|
|
4568 Charcount *matching);
|
|
4569 int qxetextcasecmp (const Intbyte *s1, Bytecount len1,
|
|
4570 const Intbyte *s2, Bytecount len2);
|
|
4571 int qxetextcasecmp_matching (const Intbyte *s1, Bytecount len1,
|
|
4572 const Intbyte *s2, Bytecount len2,
|
|
4573 Charcount *matching);
|
771
|
4574
|
|
4575 void buffer_mule_signal_inserted_region (struct buffer *buf, Charbpos start,
|
|
4576 Bytecount bytelength,
|
|
4577 Charcount charlength);
|
|
4578 void buffer_mule_signal_deleted_region (struct buffer *buf, Charbpos start,
|
826
|
4579 Charbpos end, Bytebpos byte_start,
|
|
4580 Bytebpos byte_end);
|
771
|
4581
|
|
4582 /* Defined in unicode.c */
|
|
4583 extern const struct struct_description to_unicode_description[];
|
|
4584 extern const struct struct_description from_unicode_description[];
|
|
4585 void init_charset_unicode_tables (Lisp_Object charset);
|
|
4586 void free_charset_unicode_tables (Lisp_Object charset);
|
|
4587 void recalculate_unicode_precedence (void);
|
|
4588 extern Lisp_Object Qunicode;
|
|
4589 extern Lisp_Object Qutf_16, Qutf_8, Qucs_4, Qutf_7;
|
|
4590 #ifdef MEMORY_USAGE_STATS
|
|
4591 Bytecount compute_from_unicode_table_size (Lisp_Object charset,
|
|
4592 struct overhead_stats *stats);
|
|
4593 Bytecount compute_to_unicode_table_size (Lisp_Object charset,
|
|
4594 struct overhead_stats *stats);
|
|
4595 #endif /* MEMORY_USAGE_STATS */
|
|
4596
|
428
|
4597 /* Defined in undo.c */
|
826
|
4598 EXFUN (Fundo_boundary, 0);
|
|
4599
|
428
|
4600 Lisp_Object truncate_undo_list (Lisp_Object, int, int);
|
|
4601 void record_extent (Lisp_Object, int);
|
665
|
4602 void record_insert (struct buffer *, Charbpos, Charcount);
|
|
4603 void record_delete (struct buffer *, Charbpos, Charcount);
|
|
4604 void record_change (struct buffer *, Charbpos, Charcount);
|
428
|
4605
|
|
4606 /* Defined in unex*.c */
|
814
|
4607 #ifdef WIN32_NATIVE
|
|
4608 int unexec (Intbyte *, Intbyte *, uintptr_t, uintptr_t, uintptr_t);
|
|
4609 #else
|
|
4610 int unexec (Extbyte *, Extbyte *, uintptr_t, uintptr_t, uintptr_t);
|
|
4611 #endif
|
428
|
4612 #ifdef RUN_TIME_REMAP
|
|
4613 int run_time_remap (char *);
|
|
4614 #endif
|
|
4615
|
|
4616 /* Defined in vm-limit.c */
|
442
|
4617 void memory_warnings (void *, void (*) (const char *));
|
428
|
4618
|
|
4619 /* Defined in window.c */
|
826
|
4620 EXFUN (Fcurrent_window_configuration, 1);
|
|
4621
|
428
|
4622 Lisp_Object save_window_excursion_unwind (Lisp_Object);
|
|
4623 Lisp_Object display_buffer (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
4624
|
442
|
4625 /*--------------- prototypes for constant symbols ------------*/
|
|
4626
|
826
|
4627 /* #### We should get rid of this and put the prototypes back up there in
|
|
4628 #### the per-file stuff, where they belong. */
|
|
4629
|
771
|
4630 /* Use the following when you have to add a bunch of symbols. */
|
|
4631
|
|
4632 /*
|
|
4633
|
|
4634 (defun redo-symbols (beg end)
|
|
4635 "Snarf any symbols out of the region and print them into a temporary buffer,
|
|
4636 which is displayed when the function finishes. The symbols are laid out with
|
|
4637 `extern Lisp_Object ' before each one, with as many as can fit on one line
|
|
4638 \(the maximum line width is controlled by the constant `max-line-length' in the
|
|
4639 code)."
|
|
4640 (interactive "r")
|
|
4641 (save-excursion
|
|
4642 (goto-char beg)
|
|
4643 (let (syms)
|
|
4644 (while (re-search-forward "\\s-\\(Q[A-Za-z_0-9]+\\)" end t)
|
|
4645 (push (match-string 1) syms))
|
|
4646 (setq syms (sort syms #'string-lessp))
|
|
4647 (with-output-to-temp-buffer "*Symbols*"
|
|
4648 (let* ((col 0)
|
|
4649 (start "extern Lisp_Object ")
|
|
4650 (startlen (length start))
|
|
4651 ;; with a default-width frame of 80 chars, you can only fit
|
|
4652 ;; 79 before wrapping. you can see this to a lower value if
|
|
4653 ;; you don't want it right up against the right margin.
|
|
4654 (max-line-length 79))
|
|
4655 (dolist (sym syms)
|
|
4656 (cond (;; if something already on line (this will always be the
|
|
4657 ;; case except the very first iteration), see what
|
|
4658 ;; space we've got. (need to take into account 2
|
|
4659 ;; for the comma+space, 1 for the semicolon at the
|
|
4660 ;; end.) if enough space, do it.
|
|
4661 (and (> col 0) (< (+ col (length sym) 2)
|
|
4662 (1- max-line-length)))
|
|
4663 (princ ", ")
|
|
4664 (princ sym)
|
|
4665 (incf col 2)
|
|
4666 (incf col (length sym)))
|
|
4667 (t
|
|
4668 ;; either we're first iteration or we ran out of space.
|
|
4669 ;; if the latter, terminate the previous line. this
|
|
4670 ;; loop is written on purpose so that it always prints
|
|
4671 ;; at least one item, even if that would go over.
|
|
4672 (when (> col 0)
|
|
4673 (princ ";\n")
|
|
4674 (setq col 0))
|
|
4675 (princ start)
|
|
4676 (incf col startlen)
|
|
4677 (princ sym)
|
|
4678 (incf col (length sym)))))
|
|
4679 ;; finally terminate the last line.
|
|
4680 (princ ";\n"))))))
|
|
4681
|
|
4682 */
|
|
4683
|
814
|
4684 extern Lisp_Object Qactivate_menubar_hook, Qand_optional, Qand_rest;
|
|
4685 extern Lisp_Object Qarith_error, Qarrayp, Qautoload, Qbackground;
|
|
4686 extern Lisp_Object Qbackground_pixmap, Qbeginning_of_buffer, Qbitp, Qblinking;
|
|
4687 extern Lisp_Object Qbuffer_glyph_p, Qbuffer_live_p, Qbuffer_read_only;
|
|
4688 extern Lisp_Object Qbyte_code, Qcall_interactively, Qcategory_designator_p;
|
|
4689 extern Lisp_Object Qcategory_table_value_p, Qcdr, Qchar_or_string_p;
|
|
4690 extern Lisp_Object Qcharacterp, Qcircular_list, Qcircular_property_list;
|
|
4691 extern Lisp_Object Qcolor_pixmap_image_instance_p, Qcommandp;
|
|
4692 extern Lisp_Object Qcompletion_ignore_case, Qconsole_live_p, Qconst_specifier;
|
|
4693 extern Lisp_Object Qconversion_error, Qcurrent_menubar;
|
771
|
4694 extern Lisp_Object Qcyclic_variable_indirection, Qdefun, Qdevice_live_p, Qdim;
|
|
4695 extern Lisp_Object Qdirection, Qdisabled, Qdisabled_command_hook;
|
|
4696 extern Lisp_Object Qdisplay_table, Qdomain_error, Qediting_error;
|
|
4697 extern Lisp_Object Qend_of_buffer, Qend_of_file, Qend_open, Qerror;
|
|
4698 extern Lisp_Object Qerror_conditions, Qerror_lacks_explanatory_string;
|
|
4699 extern Lisp_Object Qerror_message, Qevent_live_p, Qexit, Qextent_live_p;
|
|
4700 extern Lisp_Object Qexternal_debugging_output, Qfeaturep, Qfile_error, Qfinal;
|
|
4701 extern Lisp_Object Qforeground, Qformat, Qframe_live_p, Qgraphic, Qgtk;
|
|
4702 extern Lisp_Object Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit;
|
|
4703 extern Lisp_Object Qinhibit_read_only, Qinteger_char_or_marker_p;
|
|
4704 extern Lisp_Object Qinteger_or_char_p, Qinteger_or_marker_p, Qintegerp;
|
|
4705 extern Lisp_Object Qinteractive, Qinternal_error, Qinvalid_argument;
|
|
4706 extern Lisp_Object Qinvalid_byte_code, Qinvalid_change, Qinvalid_constant;
|
|
4707 extern Lisp_Object Qinvalid_function, Qinvalid_operation;
|
|
4708 extern Lisp_Object Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlambda;
|
|
4709 extern Lisp_Object Qlayout, Qlist_formation_error, Qlistp, Qload, Qlock_shift;
|
|
4710 extern Lisp_Object Qlong_name, Qmacro, Qmakunbound, Qmalformed_list;
|
|
4711 extern Lisp_Object Qmalformed_property_list, Qmark;
|
|
4712 extern Lisp_Object Qmono_pixmap_image_instance_p, Qmouse_leave_buffer_hook;
|
|
4713 extern Lisp_Object Qnative_layout, Qnatnump, Qnetwork_error, Qno_catch;
|
|
4714 extern Lisp_Object Qnothing_image_instance_p, Qnumber_char_or_marker_p;
|
|
4715 extern Lisp_Object Qnumberp, Qout_of_memory, Qoutput_charset_conversion;
|
442
|
4716 extern Lisp_Object Qoverflow_error, Qpoint, Qpointer_glyph_p;
|
771
|
4717 extern Lisp_Object Qpointer_image_instance_p, Qprint_length;
|
563
|
4718 extern Lisp_Object Qprint_string_length, Qprinting_unreadable_object;
|
771
|
4719 extern Lisp_Object Qprocess_error, Qprogn, Qquit, Qquote, Qrange_error;
|
|
4720 extern Lisp_Object Qread_char, Qread_from_minibuffer;
|
|
4721 extern Lisp_Object Qreally_early_error_handler, Qregion_beginning;
|
|
4722 extern Lisp_Object Qregion_end, Qregistry, Qreverse_direction_charset;
|
|
4723 extern Lisp_Object Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs;
|
|
4724 extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo, Qsequencep;
|
|
4725 extern Lisp_Object Qset, Qsetting_constant, Qshort_name, Qsingularity_error;
|
|
4726 extern Lisp_Object Qsound_error, Qstack_overflow, Qstandard_input;
|
|
4727 extern Lisp_Object Qstandard_output, Qstart_open, Qstring_lessp;
|
|
4728 extern Lisp_Object Qstructure_formation_error, Qsubwindow;
|
|
4729 extern Lisp_Object Qsubwindow_image_instance_p, Qsyntax_error, Qt;
|
|
4730 extern Lisp_Object Qtext_conversion_error, Qtext_image_instance_p, Qtop_level;
|
|
4731 extern Lisp_Object Qtrue_list_p, Qunbound, Qunderflow_error, Qunderline;
|
|
4732 extern Lisp_Object Quser_files_and_directories, Qvalues;
|
|
4733 extern Lisp_Object Qvariable_documentation, Qvariable_domain, Qvoid_function;
|
|
4734 extern Lisp_Object Qvoid_variable, Qwindow_live_p, Qwrong_number_of_arguments;
|
442
|
4735 extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p;
|
|
4736
|
|
4737 #define SYMBOL(fou) extern Lisp_Object fou
|
|
4738 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
|
|
4739 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
|
|
4740 extern Lisp_Object tout_le_monde
|
|
4741
|
|
4742 #include "general-slots.h"
|
|
4743
|
|
4744 #undef SYMBOL
|
|
4745 #undef SYMBOL_KEYWORD
|
|
4746 #undef SYMBOL_GENERAL
|
|
4747
|
|
4748 /*--------------- prototypes for variables of type Lisp_Object ------------*/
|
|
4749
|
826
|
4750 /* #### We should get rid of this and put the prototypes back up there in
|
|
4751 #### the per-file stuff, where they belong. */
|
|
4752
|
446
|
4753 extern Lisp_Object Vactivate_menubar_hook;
|
|
4754 extern Lisp_Object Vautoload_queue, Vblank_menubar;
|
771
|
4755 extern Lisp_Object Vcommand_history;
|
428
|
4756 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory;
|
|
4757 extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory;
|
|
4758 extern Lisp_Object Vconsole_list, Vcontrolling_terminal;
|
|
4759 extern Lisp_Object Vcurrent_compiled_function_annotation, Vcurrent_load_list;
|
|
4760 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory;
|
434
|
4761 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook;
|
|
4762 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name;
|
428
|
4763 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version;
|
|
4764 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path;
|
|
4765 extern Lisp_Object Vexecuting_macro, Vfeatures, Vfile_domain;
|
771
|
4766 extern Lisp_Object Vinhibit_quit, Vinvocation_directory, Vinvocation_name;
|
|
4767 extern Lisp_Object Vlast_command, Vlast_command_char;
|
428
|
4768 extern Lisp_Object Vlast_command_event, Vlast_input_event;
|
|
4769 extern Lisp_Object Vload_file_name_internal;
|
|
4770 extern Lisp_Object Vload_file_name_internal_the_purecopy, Vload_history;
|
|
4771 extern Lisp_Object Vload_path, Vmark_even_if_inactive, Vmenubar_configuration;
|
|
4772 extern Lisp_Object Vminibuf_preprompt, Vminibuf_prompt, Vminibuffer_zero;
|
|
4773 extern Lisp_Object Vmodule_directory, Vmswindows_downcase_file_names;
|
|
4774 extern Lisp_Object Vmswindows_get_true_file_attributes, Vobarray;
|
|
4775 extern Lisp_Object Vprint_length, Vprint_level, Vprocess_environment;
|
|
4776 extern Lisp_Object Vquit_flag;
|
|
4777 extern Lisp_Object Vrecent_keys_ring, Vshell_file_name, Vsite_directory;
|
|
4778 extern Lisp_Object Vsite_module_directory;
|
|
4779 extern Lisp_Object Vstandard_input, Vstandard_output, Vstdio_str;
|
771
|
4780 extern Lisp_Object Vsynchronous_sounds, Vsystem_name;
|
428
|
4781 extern Lisp_Object Vthis_command_keys, Vunread_command_event;
|
|
4782 extern Lisp_Object Vx_initial_argv_list;
|
|
4783
|
440
|
4784 #endif /* INCLUDED_lisp_h_ */
|