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.
|
442
|
4 Copyright (C) 1995, 1996, 2000 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
|
|
48 /* ------------------------ dynamic arrays ------------------- */
|
428
|
49
|
|
50 #define Dynarr_declare(type) \
|
|
51 type *base; \
|
|
52 int elsize; \
|
|
53 int cur; \
|
|
54 int largest; \
|
|
55 int max
|
|
56
|
|
57 typedef struct dynarr
|
|
58 {
|
|
59 Dynarr_declare (void);
|
|
60 } Dynarr;
|
|
61
|
|
62 void *Dynarr_newf (int elsize);
|
|
63 void Dynarr_resize (void *dy, int size);
|
442
|
64 void Dynarr_insert_many (void *d, const void *el, int len, int start);
|
428
|
65 void Dynarr_delete_many (void *d, int start, int len);
|
|
66 void Dynarr_free (void *d);
|
|
67
|
440
|
68 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type)))
|
442
|
69 #define Dynarr_new2(dynarr_type, type) \
|
|
70 ((dynarr_type *) Dynarr_newf (sizeof (type)))
|
428
|
71 #define Dynarr_at(d, pos) ((d)->base[pos])
|
|
72 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos))
|
452
|
73 #define Dynarr_begin(d) Dynarr_atp (d, 0)
|
|
74 #define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d))
|
|
75 #define Dynarr_sizeof(d) ((d)->cur * (d)->elsize)
|
428
|
76 #define Dynarr_length(d) ((d)->cur)
|
|
77 #define Dynarr_largest(d) ((d)->largest)
|
|
78 #define Dynarr_reset(d) ((d)->cur = 0)
|
|
79 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur)
|
|
80 #define Dynarr_insert_many_at_start(d, el, len) \
|
|
81 Dynarr_insert_many (d, el, len, 0)
|
440
|
82 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1)
|
428
|
83 #define Dynarr_add_lisp_string(d, s) do { \
|
440
|
84 Lisp_String *dyna_ls_s = XSTRING (s); \
|
428
|
85 Dynarr_add_many (d, (char *) string_data (dyna_ls_s), \
|
|
86 string_length (dyna_ls_s)); \
|
|
87 } while (0)
|
|
88
|
|
89 #define Dynarr_add(d, el) ( \
|
|
90 (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : (void) 0, \
|
|
91 ((d)->base)[(d)->cur++] = (el), \
|
|
92 (d)->cur > (d)->largest ? (d)->largest = (d)->cur : (int) 0)
|
|
93
|
|
94 /* The following defines will get you into real trouble if you aren't
|
|
95 careful. But they can save a lot of execution time when used wisely. */
|
|
96 #define Dynarr_increment(d) ((d)->cur++)
|
|
97 #define Dynarr_set_size(d, n) ((d)->cur = n)
|
|
98
|
|
99 #ifdef MEMORY_USAGE_STATS
|
|
100 struct overhead_stats;
|
|
101 size_t Dynarr_memory_usage (void *d, struct overhead_stats *stats);
|
|
102 #endif
|
|
103
|
|
104 /* Also define min() and max(). (Some compilers put them in strange
|
|
105 places that won't be referenced by the above include files, such
|
|
106 as 'macros.h' under Solaris.) */
|
|
107
|
|
108 #ifndef min
|
|
109 #define min(a,b) (((a) <= (b)) ? (a) : (b))
|
|
110 #endif
|
|
111 #ifndef max
|
|
112 #define max(a,b) (((a) > (b)) ? (a) : (b))
|
|
113 #endif
|
|
114
|
|
115 /* Memory allocation */
|
442
|
116 void malloc_warning (const char *);
|
428
|
117 void *xmalloc (size_t size);
|
|
118 void *xmalloc_and_zero (size_t size);
|
|
119 void *xrealloc (void *, size_t size);
|
442
|
120 char *xstrdup (const char *);
|
428
|
121 /* generally useful */
|
438
|
122 #define countof(x) ((int) (sizeof(x)/sizeof((x)[0])))
|
428
|
123 #define xnew(type) ((type *) xmalloc (sizeof (type)))
|
|
124 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type)))
|
|
125 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type)))
|
438
|
126 #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue)))
|
428
|
127 #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type)))
|
|
128 #define XREALLOC_ARRAY(ptr, type, len) ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type))))
|
|
129 #define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type)))
|
|
130
|
|
131 /* also generally useful if you want to avoid arbitrary size limits
|
|
132 but don't need a full dynamic array. Assumes that BASEVAR points
|
|
133 to a malloced array of TYPE objects (or possibly a NULL pointer,
|
|
134 if SIZEVAR is 0), with the total size stored in SIZEVAR. This
|
|
135 macro will realloc BASEVAR as necessary so that it can hold at
|
|
136 least NEEDED_SIZE objects. The reallocing is done by doubling,
|
|
137 which ensures constant amortized time per element. */
|
430
|
138 #define DO_REALLOC(basevar, sizevar, needed_size, type) do { \
|
428
|
139 size_t do_realloc_needed_size = (needed_size); \
|
430
|
140 if ((sizevar) < do_realloc_needed_size) \
|
|
141 { \
|
|
142 if ((sizevar) < 32) \
|
|
143 (sizevar) = 32; \
|
|
144 while ((sizevar) < do_realloc_needed_size) \
|
|
145 (sizevar) *= 2; \
|
|
146 XREALLOC_ARRAY (basevar, type, (sizevar)); \
|
|
147 } \
|
428
|
148 } while (0)
|
|
149
|
|
150 #ifdef ERROR_CHECK_MALLOC
|
|
151 void xfree_1 (void *);
|
|
152 #define xfree(lvalue) do \
|
|
153 { \
|
|
154 void **xfree_ptr = (void **) &(lvalue); \
|
|
155 xfree_1 (*xfree_ptr); \
|
|
156 *xfree_ptr = (void *) 0xDEADBEEF; \
|
|
157 } while (0)
|
|
158 #else
|
|
159 void xfree (void *);
|
|
160 #endif /* ERROR_CHECK_MALLOC */
|
|
161
|
|
162 #ifndef PRINTF_ARGS
|
|
163 # if defined (__GNUC__) && (__GNUC__ >= 2)
|
|
164 # define PRINTF_ARGS(string_index,first_to_check) \
|
|
165 __attribute__ ((format (printf, string_index, first_to_check)))
|
|
166 # else
|
|
167 # define PRINTF_ARGS(string_index,first_to_check)
|
|
168 # endif /* GNUC */
|
|
169 #endif
|
|
170
|
|
171 #ifndef DOESNT_RETURN
|
|
172 # if defined __GNUC__
|
|
173 # if ((__GNUC__ > 2) || (__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))
|
442
|
174 # define DOESNT_RETURN void
|
428
|
175 # define DECLARE_DOESNT_RETURN(decl) \
|
442
|
176 extern void decl __attribute__ ((noreturn))
|
428
|
177 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
|
|
178 /* Should be able to state multiple independent __attribute__s, but \
|
|
179 the losing syntax doesn't work that way, and screws losing cpp */ \
|
442
|
180 extern void decl \
|
428
|
181 __attribute__ ((noreturn, format (printf, str, idx)))
|
|
182 # else
|
|
183 # define DOESNT_RETURN void volatile
|
|
184 # define DECLARE_DOESNT_RETURN(decl) extern void volatile decl
|
|
185 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
|
|
186 extern void volatile decl PRINTF_ARGS(str,idx)
|
|
187 # endif /* GNUC 2.5 */
|
|
188 # else
|
|
189 # define DOESNT_RETURN void
|
|
190 # define DECLARE_DOESNT_RETURN(decl) extern void decl
|
|
191 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
|
|
192 extern void decl PRINTF_ARGS(str,idx)
|
|
193 # endif /* GNUC */
|
|
194 #endif
|
|
195
|
454
|
196 /* No type has a greater alignment requirement than max_align_t.
|
|
197 (except perhaps for types we don't use, like long double) */
|
|
198 typedef union
|
|
199 {
|
|
200 struct { long l; } l;
|
|
201 struct { void *p; } p;
|
|
202 struct { void (*f)(void); } f;
|
|
203 struct { double d; } d;
|
|
204 } max_align_t;
|
|
205
|
428
|
206 #ifndef ALIGNOF
|
|
207 # if defined (__GNUC__) && (__GNUC__ >= 2)
|
454
|
208 /* gcc has an extension that gives us exactly what we want. */
|
|
209 # define ALIGNOF(type) __alignof__ (type)
|
|
210 # elif ! defined (__cplusplus)
|
|
211 /* The following is mostly portable, except that:
|
|
212 - it doesn't work for inside out declarations like void (*) (void).
|
|
213 (so just call ALIGNOF with a typedef'ed name)
|
|
214 - it doesn't work with C++. The C++ committee has decided,
|
|
215 in its infinite wisdom, that:
|
|
216 "Types must be declared in declarations, not in expressions." */
|
|
217 # define ALIGNOF(type) offsetof (struct { char c; type member; }, member)
|
428
|
218 # else
|
456
|
219 /* C++ is annoying, but it has a big bag of tricks.
|
|
220 The following doesn't have the "inside out" declaration bug C does. */
|
458
|
221 template<typename T> struct alignment_trick { char c; T member; };
|
456
|
222 # define ALIGNOF(type) offsetof (alignment_trick<type>, member)
|
428
|
223 # endif
|
454
|
224 #endif /* ALIGNOF */
|
428
|
225
|
|
226 #define ALIGN_SIZE(len, unit) \
|
|
227 ((((len) + (unit) - 1) / (unit)) * (unit))
|
|
228
|
|
229 /* #### Yuck, this is kind of evil */
|
|
230 #define ALIGN_PTR(ptr, unit) \
|
454
|
231 ((void *) ALIGN_SIZE ((size_t) (ptr), unit))
|
428
|
232
|
|
233 #ifndef DO_NOTHING
|
|
234 #define DO_NOTHING do {} while (0)
|
|
235 #endif
|
|
236
|
|
237 #ifndef DECLARE_NOTHING
|
|
238 #define DECLARE_NOTHING struct nosuchstruct
|
|
239 #endif
|
|
240
|
|
241 /* We define assert iff USE_ASSERTIONS or DEBUG_XEMACS is defined.
|
|
242 Otherwise we define it to be empty. Quantify has shown that the
|
|
243 time the assert checks take is measurable so let's not include them
|
|
244 in production binaries. */
|
|
245
|
|
246 #ifdef USE_ASSERTIONS
|
|
247 /* Highly dubious kludge */
|
|
248 /* (thanks, Jamie, I feel better now -- ben) */
|
442
|
249 void assert_failed (const char *, int, const char *);
|
428
|
250 # define abort() (assert_failed (__FILE__, __LINE__, "abort()"))
|
|
251 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
|
|
252 #else
|
|
253 # ifdef DEBUG_XEMACS
|
|
254 # define assert(x) ((x) ? (void) 0 : (void) abort ())
|
|
255 # else
|
|
256 # define assert(x)
|
|
257 # endif
|
|
258 #endif
|
|
259
|
|
260 /*#ifdef DEBUG_XEMACS*/
|
|
261 #define REGISTER
|
|
262 #define register
|
|
263 /*#else*/
|
|
264 /*#define REGISTER register*/
|
|
265 /*#endif*/
|
|
266
|
|
267
|
|
268 /* EMACS_INT is the underlying integral type into which a Lisp_Object must fit.
|
|
269 In particular, it must be large enough to contain a pointer.
|
462
|
270 config.h can override this, e.g. to use `long long' for bigger lisp ints.
|
|
271
|
|
272 #### In point of fact, it would NOT be a good idea for config.h to mess
|
|
273 with EMACS_INT. A lot of code makes the basic assumption that EMACS_INT
|
|
274 is the size of a pointer. */
|
428
|
275
|
|
276 #ifndef SIZEOF_EMACS_INT
|
|
277 # define SIZEOF_EMACS_INT SIZEOF_VOID_P
|
|
278 #endif
|
|
279
|
|
280 #ifndef EMACS_INT
|
|
281 # if SIZEOF_EMACS_INT == SIZEOF_LONG
|
|
282 # define EMACS_INT long
|
|
283 # elif SIZEOF_EMACS_INT == SIZEOF_INT
|
|
284 # define EMACS_INT int
|
|
285 # elif SIZEOF_EMACS_INT == SIZEOF_LONG_LONG
|
|
286 # define EMACS_INT long long
|
|
287 # else
|
|
288 # error Unable to determine suitable type for EMACS_INT
|
|
289 # endif
|
|
290 #endif
|
|
291
|
|
292 #ifndef EMACS_UINT
|
|
293 # define EMACS_UINT unsigned EMACS_INT
|
|
294 #endif
|
|
295
|
|
296 #define BITS_PER_EMACS_INT (SIZEOF_EMACS_INT * BITS_PER_CHAR)
|
|
297
|
|
298
|
|
299 /************************************************************************/
|
|
300 /* typedefs */
|
|
301 /************************************************************************/
|
|
302
|
|
303 /* We put typedefs here so that prototype declarations don't choke.
|
|
304 Note that we don't actually declare the structures here (except
|
|
305 maybe for simple structures like Dynarrs); that keeps them private
|
|
306 to the routines that actually use them. */
|
|
307
|
442
|
308 /* ------------------------------- */
|
|
309 /* basic char/int typedefs */
|
|
310 /* ------------------------------- */
|
|
311
|
446
|
312 /* The definitions we put here use typedefs to attribute specific meaning
|
|
313 to types that by themselves are pretty general. Stuff pointed to by a
|
442
|
314 char * or unsigned char * will nearly always be one of four types:
|
|
315 a) pointer to internally-formatted text; b) pointer to text in some
|
|
316 external format, which can be defined as all formats other than the
|
|
317 internal one; c) pure ASCII text; d) binary data that is not meant to
|
|
318 be interpreted as text. [A fifth possible type "e) a general pointer
|
446
|
319 to memory" should be replaced with void *.] Using these more specific
|
|
320 types rather than the general ones helps avoid the confusions that
|
|
321 occur when the semantics of a char * argument being studied are unclear. */
|
442
|
322
|
|
323 typedef unsigned char UChar;
|
|
324
|
428
|
325 /* The data representing the text in a buffer is logically a set
|
|
326 of Bufbytes, declared as follows. */
|
|
327
|
442
|
328 typedef UChar Bufbyte;
|
|
329
|
|
330 /* Explicitly signed or unsigned versions: */
|
|
331 typedef UChar UBufbyte;
|
|
332 typedef char SBufbyte;
|
|
333
|
|
334 /* The data representing a string in "external" format (binary or any
|
444
|
335 external encoding) is logically a set of Extbytes, declared as
|
|
336 follows. Extbyte is guaranteed to be just a char, so for example
|
|
337 strlen (Extbyte *) is OK. Extbyte is only a documentation device
|
|
338 for referring to external text. */
|
|
339
|
|
340 typedef char Extbyte;
|
442
|
341
|
|
342 /* A byte in a string in binary format: */
|
|
343 typedef char Char_Binary;
|
|
344 typedef UChar UChar_Binary;
|
|
345
|
|
346 /* A byte in a string in entirely US-ASCII format: (Nothing outside
|
|
347 the range 00 - 7F) */
|
|
348
|
|
349 typedef char Char_ASCII;
|
|
350 typedef UChar UChar_ASCII;
|
|
351
|
428
|
352
|
|
353 /* To the user, a buffer is made up of characters, declared as follows.
|
|
354 In the non-Mule world, characters and Bufbytes are equivalent.
|
|
355 In the Mule world, a character requires (typically) 1 to 4
|
|
356 Bufbytes for its representation in a buffer. */
|
|
357
|
|
358 typedef int Emchar;
|
|
359
|
|
360 /* Different ways of referring to a position in a buffer. We use
|
462
|
361 the typedefs in preference to 'EMACS_INT' to make it clearer what
|
428
|
362 sort of position is being used. See extents.c for a description
|
|
363 of the different positions. We put them here instead of in
|
|
364 buffer.h (where they rightfully belong) to avoid syntax errors
|
|
365 in function prototypes. */
|
|
366
|
|
367 typedef EMACS_INT Bufpos;
|
|
368 typedef EMACS_INT Bytind;
|
|
369 typedef EMACS_INT Memind;
|
|
370
|
|
371 /* Counts of bytes or chars */
|
|
372
|
|
373 typedef EMACS_INT Bytecount;
|
|
374 typedef EMACS_INT Charcount;
|
|
375
|
|
376 /* Length in bytes of a string in external format */
|
|
377 typedef EMACS_INT Extcount;
|
|
378
|
442
|
379 /* ------------------------------- */
|
|
380 /* structure/other typedefs */
|
|
381 /* ------------------------------- */
|
|
382
|
428
|
383 typedef struct lstream Lstream;
|
|
384
|
|
385 typedef unsigned int face_index;
|
|
386
|
|
387 typedef struct
|
|
388 {
|
|
389 Dynarr_declare (struct face_cachel);
|
|
390 } face_cachel_dynarr;
|
|
391
|
|
392 typedef unsigned int glyph_index;
|
|
393
|
|
394 /* This is shared by process.h, events.h and others in future.
|
|
395 See events.h for description */
|
|
396 typedef unsigned int USID;
|
|
397
|
|
398 typedef struct
|
|
399 {
|
|
400 Dynarr_declare (struct glyph_cachel);
|
|
401 } glyph_cachel_dynarr;
|
|
402
|
|
403 struct buffer; /* "buffer.h" */
|
|
404 struct console; /* "console.h" */
|
|
405 struct device; /* "device.h" */
|
|
406 struct extent_fragment;
|
|
407 struct extent;
|
|
408 typedef struct extent *EXTENT;
|
|
409 struct frame; /* "frame.h" */
|
|
410 struct window; /* "window.h" */
|
440
|
411 typedef struct Lisp_Event Lisp_Event; /* "events.h" */
|
|
412 typedef struct Lisp_Face Lisp_Face; /* "faces.h" */
|
|
413 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */
|
428
|
414 struct stat; /* <sys/stat.h> */
|
|
415 typedef struct Lisp_Color_Instance Lisp_Color_Instance;
|
|
416 typedef struct Lisp_Font_Instance Lisp_Font_Instance;
|
|
417 typedef struct Lisp_Image_Instance Lisp_Image_Instance;
|
|
418 typedef struct Lisp_Gui_Item Lisp_Gui_Item;
|
|
419 struct display_line;
|
|
420 struct display_glyph_area;
|
|
421 struct display_box;
|
|
422 struct redisplay_info;
|
|
423 struct window_mirror;
|
|
424 struct scrollbar_instance;
|
|
425 struct font_metric_info;
|
|
426 struct face_cachel;
|
|
427 struct console_type_entry;
|
|
428
|
|
429 typedef struct
|
|
430 {
|
|
431 Dynarr_declare (Bufbyte);
|
|
432 } Bufbyte_dynarr;
|
|
433
|
|
434 typedef struct
|
|
435 {
|
|
436 Dynarr_declare (Extbyte);
|
|
437 } Extbyte_dynarr;
|
|
438
|
|
439 typedef struct
|
|
440 {
|
|
441 Dynarr_declare (Emchar);
|
|
442 } Emchar_dynarr;
|
|
443
|
|
444 typedef struct
|
|
445 {
|
|
446 Dynarr_declare (char);
|
|
447 } char_dynarr;
|
|
448
|
|
449 typedef unsigned char unsigned_char;
|
|
450 typedef struct
|
|
451 {
|
|
452 Dynarr_declare (unsigned char);
|
|
453 } unsigned_char_dynarr;
|
|
454
|
|
455 typedef unsigned long unsigned_long;
|
|
456 typedef struct
|
|
457 {
|
|
458 Dynarr_declare (unsigned long);
|
|
459 } unsigned_long_dynarr;
|
|
460
|
|
461 typedef struct
|
|
462 {
|
|
463 Dynarr_declare (int);
|
|
464 } int_dynarr;
|
|
465
|
|
466 typedef struct
|
|
467 {
|
|
468 Dynarr_declare (Bufpos);
|
|
469 } Bufpos_dynarr;
|
|
470
|
|
471 typedef struct
|
|
472 {
|
|
473 Dynarr_declare (Bytind);
|
|
474 } Bytind_dynarr;
|
|
475
|
|
476 typedef struct
|
|
477 {
|
|
478 Dynarr_declare (Charcount);
|
|
479 } Charcount_dynarr;
|
|
480
|
|
481 typedef struct
|
|
482 {
|
|
483 Dynarr_declare (Bytecount);
|
|
484 } Bytecount_dynarr;
|
|
485
|
|
486 typedef struct
|
|
487 {
|
|
488 Dynarr_declare (struct console_type_entry);
|
|
489 } console_type_entry_dynarr;
|
|
490
|
|
491 enum run_hooks_condition
|
|
492 {
|
|
493 RUN_HOOKS_TO_COMPLETION,
|
|
494 RUN_HOOKS_UNTIL_SUCCESS,
|
|
495 RUN_HOOKS_UNTIL_FAILURE
|
|
496 };
|
|
497
|
|
498 #ifdef HAVE_TOOLBARS
|
|
499 enum toolbar_pos
|
|
500 {
|
|
501 TOP_TOOLBAR,
|
|
502 BOTTOM_TOOLBAR,
|
|
503 LEFT_TOOLBAR,
|
|
504 RIGHT_TOOLBAR
|
|
505 };
|
|
506 #endif
|
|
507
|
|
508 enum edge_style
|
|
509 {
|
|
510 EDGE_ETCHED_IN,
|
|
511 EDGE_ETCHED_OUT,
|
|
512 EDGE_BEVEL_IN,
|
|
513 EDGE_BEVEL_OUT
|
|
514 };
|
|
515
|
|
516 #ifndef ERROR_CHECK_TYPECHECK
|
|
517
|
|
518 typedef enum error_behavior
|
|
519 {
|
|
520 ERROR_ME,
|
|
521 ERROR_ME_NOT,
|
|
522 ERROR_ME_WARN
|
|
523 } Error_behavior;
|
|
524
|
|
525 #define ERRB_EQ(a, b) ((a) == (b))
|
|
526
|
|
527 #else
|
|
528
|
|
529 /* By defining it like this, we provide strict type-checking
|
|
530 for code that lazily uses ints. */
|
|
531
|
|
532 typedef struct _error_behavior_struct_
|
|
533 {
|
|
534 int really_unlikely_name_to_have_accidentally_in_a_non_errb_structure;
|
|
535 } Error_behavior;
|
|
536
|
|
537 extern Error_behavior ERROR_ME;
|
|
538 extern Error_behavior ERROR_ME_NOT;
|
|
539 extern Error_behavior ERROR_ME_WARN;
|
|
540
|
|
541 #define ERRB_EQ(a, b) \
|
|
542 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \
|
|
543 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure)
|
|
544
|
|
545 #endif
|
|
546
|
|
547 enum munge_me_out_the_door
|
|
548 {
|
|
549 MUNGE_ME_FUNCTION_KEY,
|
|
550 MUNGE_ME_KEY_TRANSLATION
|
|
551 };
|
|
552
|
|
553
|
|
554 /************************************************************************/
|
|
555 /* Definition of Lisp_Object data type */
|
|
556 /************************************************************************/
|
|
557
|
|
558 /* Define the fundamental Lisp data structures */
|
|
559
|
|
560 /* This is the set of Lisp data types */
|
|
561
|
|
562 enum Lisp_Type
|
|
563 {
|
|
564 Lisp_Type_Record,
|
|
565 Lisp_Type_Int_Even,
|
|
566 Lisp_Type_Char,
|
|
567 Lisp_Type_Int_Odd
|
|
568 };
|
|
569
|
|
570 #define POINTER_TYPE_P(type) ((type) == Lisp_Type_Record)
|
|
571
|
|
572 /* Overridden by m/next.h */
|
|
573 #ifndef ASSERT_VALID_POINTER
|
|
574 # define ASSERT_VALID_POINTER(pnt) (assert ((((EMACS_UINT) pnt) & 3) == 0))
|
|
575 #endif
|
|
576
|
|
577 #define GCMARKBITS 0
|
|
578 #define GCTYPEBITS 2
|
|
579 #define GCBITS 2
|
|
580 #define INT_GCBITS 1
|
|
581
|
|
582 #define INT_VALBITS (BITS_PER_EMACS_INT - INT_GCBITS)
|
|
583 #define VALBITS (BITS_PER_EMACS_INT - GCBITS)
|
442
|
584 #define EMACS_INT_MAX ((EMACS_INT) ((1UL << INT_VALBITS) -1UL))
|
|
585 #define EMACS_INT_MIN (-(EMACS_INT_MAX) - 1)
|
428
|
586
|
|
587 #ifdef USE_UNION_TYPE
|
|
588 # include "lisp-union.h"
|
|
589 #else /* !USE_UNION_TYPE */
|
|
590 # include "lisp-disunion.h"
|
|
591 #endif /* !USE_UNION_TYPE */
|
|
592
|
|
593 #define XPNTR(x) ((void *) XPNTRVAL(x))
|
|
594
|
|
595 /* WARNING WARNING WARNING. You must ensure on your own that proper
|
|
596 GC protection is provided for the elements in this array. */
|
|
597 typedef struct
|
|
598 {
|
|
599 Dynarr_declare (Lisp_Object);
|
|
600 } Lisp_Object_dynarr;
|
|
601
|
452
|
602 typedef struct
|
|
603 {
|
|
604 Dynarr_declare (Lisp_Object *);
|
|
605 } Lisp_Object_ptr_dynarr;
|
|
606
|
428
|
607 /* Close your eyes now lest you vomit or spontaneously combust ... */
|
|
608
|
|
609 #define HACKEQ_UNSAFE(obj1, obj2) \
|
|
610 (EQ (obj1, obj2) || (!POINTER_TYPE_P (XTYPE (obj1)) \
|
|
611 && !POINTER_TYPE_P (XTYPE (obj2)) \
|
|
612 && XCHAR_OR_INT (obj1) == XCHAR_OR_INT (obj2)))
|
|
613
|
|
614 #ifdef DEBUG_XEMACS
|
|
615 extern int debug_issue_ebola_notices;
|
|
616 int eq_with_ebola_notice (Lisp_Object, Lisp_Object);
|
|
617 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) \
|
|
618 (debug_issue_ebola_notices ? eq_with_ebola_notice (obj1, obj2) \
|
|
619 : EQ (obj1, obj2))
|
|
620 #else
|
|
621 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) EQ (obj1, obj2)
|
|
622 #endif
|
|
623
|
|
624 /* OK, you can open them again */
|
|
625
|
|
626
|
|
627 /************************************************************************/
|
442
|
628 /** Definitions of basic Lisp objects **/
|
428
|
629 /************************************************************************/
|
|
630
|
|
631 #include "lrecord.h"
|
|
632
|
442
|
633 /*------------------------------ unbound -------------------------------*/
|
428
|
634
|
|
635 /* Qunbound is a special Lisp_Object (actually of type
|
|
636 symbol-value-forward), that can never be visible to
|
|
637 the Lisp caller and thus can be used in the C code
|
|
638 to mean "no such value". */
|
|
639
|
|
640 #define UNBOUNDP(val) EQ (val, Qunbound)
|
|
641
|
442
|
642 /*------------------------------- cons ---------------------------------*/
|
428
|
643
|
|
644 /* In a cons, the markbit of the car is the gc mark bit */
|
|
645
|
|
646 struct Lisp_Cons
|
|
647 {
|
|
648 struct lrecord_header lheader;
|
|
649 Lisp_Object car, cdr;
|
|
650 };
|
|
651 typedef struct Lisp_Cons Lisp_Cons;
|
|
652
|
|
653 #if 0 /* FSFmacs */
|
|
654 /* Like a cons, but records info on where the text lives that it was read from */
|
|
655 /* This is not really in use now */
|
|
656
|
|
657 struct Lisp_Buffer_Cons
|
|
658 {
|
|
659 Lisp_Object car, cdr;
|
|
660 struct buffer *buffer;
|
|
661 int bufpos;
|
|
662 };
|
|
663 #endif
|
|
664
|
|
665 DECLARE_LRECORD (cons, Lisp_Cons);
|
|
666 #define XCONS(x) XRECORD (x, cons, Lisp_Cons)
|
|
667 #define XSETCONS(x, p) XSETRECORD (x, p, cons)
|
|
668 #define CONSP(x) RECORDP (x, cons)
|
|
669 #define CHECK_CONS(x) CHECK_RECORD (x, cons)
|
|
670 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons)
|
|
671
|
|
672 #define CONS_MARKED_P(c) MARKED_RECORD_HEADER_P(&((c)->lheader))
|
|
673 #define MARK_CONS(c) MARK_RECORD_HEADER (&((c)->lheader))
|
|
674
|
|
675 extern Lisp_Object Qnil;
|
|
676
|
|
677 #define NILP(x) EQ (x, Qnil)
|
|
678 #define XCAR(a) (XCONS (a)->car)
|
|
679 #define XCDR(a) (XCONS (a)->cdr)
|
|
680 #define LISTP(x) (CONSP(x) || NILP(x))
|
|
681
|
|
682 #define CHECK_LIST(x) do { \
|
|
683 if (!LISTP (x)) \
|
|
684 dead_wrong_type_argument (Qlistp, x); \
|
|
685 } while (0)
|
|
686
|
|
687 #define CONCHECK_LIST(x) do { \
|
|
688 if (!LISTP (x)) \
|
|
689 x = wrong_type_argument (Qlistp, x); \
|
|
690 } while (0)
|
|
691
|
442
|
692 /*---------------------- list traversal macros -------------------------*/
|
|
693
|
|
694 /* Note: These macros are for traversing through a list in some format,
|
|
695 and executing code that you specify on each member of the list.
|
|
696
|
|
697 There are two kinds of macros, those requiring surrounding braces, and
|
|
698 those not requiring this. Which type of macro will be indicated.
|
|
699 The general format for using a brace-requiring macro is
|
|
700
|
|
701 {
|
|
702 LIST_LOOP_3 (elt, list, tail)
|
|
703 execute_code_here;
|
|
704 }
|
|
705
|
|
706 or
|
|
707
|
|
708 {
|
|
709 LIST_LOOP_3 (elt, list, tail)
|
|
710 {
|
|
711 execute_code_here;
|
|
712 }
|
|
713 }
|
|
714
|
|
715 You can put variable declarations between the brace and beginning of
|
|
716 macro, but NOTHING ELSE.
|
|
717
|
|
718 The brace-requiring macros typically declare themselves any arguments
|
|
719 that are initialized and iterated by the macros. If for some reason
|
|
720 you need to declare these arguments yourself (e.g. to do something on
|
|
721 them before the iteration starts, use the _NO_DECLARE versions of the
|
|
722 macros.)
|
|
723 */
|
|
724
|
|
725 /* There are two basic kinds of macros: those that handle "internal" lists
|
|
726 that are known to be correctly structured (i.e. first element is a cons
|
|
727 or nil, and the car of each cons is also a cons or nil, and there are
|
|
728 no circularities), and those that handle "external" lists, where the
|
|
729 list may have any sort of invalid formation. This is reflected in
|
|
730 the names: those with "EXTERNAL_" work with external lists, and those
|
|
731 without this prefix work with internal lists. The internal-list
|
|
732 macros will hit an assertion failure if the structure is ill-formed;
|
|
733 the external-list macros will signal an error in this case, either a
|
|
734 malformed-list error or a circular-list error.
|
|
735
|
|
736 Note also that the simplest external list iterator, EXTERNAL_LIST_LOOP,
|
|
737 does *NOT* check for circularities. Therefore, make sure you call
|
|
738 QUIT each iteration or so. However, it's probably easier just to use
|
|
739 EXTERNAL_LIST_LOOP_2, which is easier to use in any case.
|
|
740 */
|
|
741
|
|
742 /* LIST_LOOP and EXTERNAL_LIST_LOOP are the simplest macros. They don't
|
|
743 require brace surrounding, and iterate through a list, which may or may
|
|
744 not known to be syntactically correct. EXTERNAL_LIST_LOOP is for those
|
|
745 not known to be correct, and it detects and signals a malformed list
|
|
746 error when encountering a problem. Circularities, however, are not
|
|
747 handled, and cause looping forever, so make sure to include a QUIT.
|
|
748 These functions also accept two args, TAIL (set progressively to each
|
|
749 cons starting with the first), and LIST, the list to iterate over.
|
|
750 TAIL needs to be defined by the program.
|
|
751
|
|
752 In each iteration, you can retrieve the current list item using XCAR
|
|
753 (tail), or destructively modify the list using XSETCAR (tail,
|
|
754 ...). */
|
|
755
|
428
|
756 #define LIST_LOOP(tail, list) \
|
|
757 for (tail = list; \
|
|
758 !NILP (tail); \
|
|
759 tail = XCDR (tail))
|
|
760
|
|
761 #define EXTERNAL_LIST_LOOP(tail, list) \
|
|
762 for (tail = list; !NILP (tail); tail = XCDR (tail)) \
|
|
763 if (!CONSP (tail)) \
|
|
764 signal_malformed_list_error (list); \
|
|
765 else
|
|
766
|
442
|
767 /* The following macros are the "core" macros for list traversal.
|
|
768
|
|
769 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
|
|
770
|
|
771 LIST_LOOP_2 and EXTERNAL_LIST_LOOP_2 are the standard, most-often used
|
|
772 macros. They take two arguments, an element variable ELT and the list
|
|
773 LIST. ELT is automatically declared, and set to each element in turn
|
|
774 from LIST.
|
|
775
|
|
776 LIST_LOOP_3 and EXTERNAL_LIST_LOOP_3 are the same, but they have a third
|
|
777 argument TAIL, another automatically-declared variable. At each iteration,
|
|
778 this one points to the cons cell for which ELT is the car.
|
|
779
|
|
780 EXTERNAL_LIST_LOOP_4 is like EXTERNAL_LIST_LOOP_3 but takes an additional
|
|
781 LEN argument, again automatically declared, which counts the number of
|
|
782 iterations gone by. It is 0 during the first iteration.
|
|
783
|
|
784 EXTERNAL_LIST_LOOP_4_NO_DECLARE is like EXTERNAL_LIST_LOOP_4 but none
|
|
785 of the variables are automatically declared, and so you need to declare
|
|
786 them yourself. (ELT and TAIL are Lisp_Objects, and LEN is an EMACS_INT.)
|
|
787 */
|
|
788
|
|
789 #define LIST_LOOP_2(elt, list) \
|
|
790 LIST_LOOP_3(elt, list, unused_tail_##elt)
|
|
791
|
|
792 #define LIST_LOOP_3(elt, list, tail) \
|
|
793 Lisp_Object elt, tail; \
|
|
794 for (tail = list; \
|
|
795 NILP (tail) ? \
|
|
796 0 : (elt = XCAR (tail), 1); \
|
|
797 tail = XCDR (tail))
|
428
|
798
|
|
799 /* The following macros are for traversing lisp lists.
|
|
800 Signal an error if LIST is not properly acyclic and nil-terminated.
|
|
801
|
|
802 Use tortoise/hare algorithm to check for cycles, but only if it
|
|
803 looks like the list is getting too long. Not only is the hare
|
|
804 faster than the tortoise; it even gets a head start! */
|
|
805
|
|
806 /* Optimized and safe macros for looping over external lists. */
|
|
807 #define CIRCULAR_LIST_SUSPICION_LENGTH 1024
|
|
808
|
|
809 #define EXTERNAL_LIST_LOOP_1(list) \
|
|
810 Lisp_Object ELL1_elt, ELL1_hare, ELL1_tortoise; \
|
442
|
811 EMACS_INT ELL1_len; \
|
|
812 PRIVATE_EXTERNAL_LIST_LOOP_6 (ELL1_elt, list, ELL1_len, ELL1_hare, \
|
428
|
813 ELL1_tortoise, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
814
|
|
815 #define EXTERNAL_LIST_LOOP_2(elt, list) \
|
442
|
816 Lisp_Object elt, hare_##elt, tortoise_##elt; \
|
|
817 EMACS_INT len_##elt; \
|
|
818 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, hare_##elt, \
|
428
|
819 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
820
|
|
821 #define EXTERNAL_LIST_LOOP_3(elt, list, tail) \
|
442
|
822 Lisp_Object elt, tail, tortoise_##elt; \
|
|
823 EMACS_INT len_##elt; \
|
|
824 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, tail, \
|
|
825 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
826
|
|
827 #define EXTERNAL_LIST_LOOP_4_NO_DECLARE(elt, list, tail, len) \
|
428
|
828 Lisp_Object tortoise_##elt; \
|
442
|
829 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
|
428
|
830 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
831
|
|
832 #define EXTERNAL_LIST_LOOP_4(elt, list, tail, len) \
|
442
|
833 Lisp_Object elt, tail, tortoise_##elt; \
|
|
834 EMACS_INT len; \
|
|
835 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
|
428
|
836 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
837
|
|
838
|
444
|
839 #define PRIVATE_EXTERNAL_LIST_LOOP_6(elt, list, len, hare, \
|
|
840 tortoise, suspicion_length) \
|
|
841 for (tortoise = hare = list, len = 0; \
|
|
842 \
|
|
843 (CONSP (hare) ? ((elt = XCAR (hare)), 1) : \
|
|
844 (NILP (hare) ? 0 : \
|
|
845 (signal_malformed_list_error (list), 0))); \
|
|
846 \
|
|
847 hare = XCDR (hare), \
|
|
848 (void) \
|
|
849 ((++len > suspicion_length) \
|
|
850 && \
|
|
851 ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \
|
|
852 (EQ (hare, tortoise) && (signal_circular_list_error (list), 0)))))
|
428
|
853
|
442
|
854 /* GET_LIST_LENGTH and GET_EXTERNAL_LIST_LENGTH:
|
|
855
|
|
856 These two macros return the length of LIST (either an internal or external
|
|
857 list, according to which macro is used), stored into LEN (which must
|
|
858 be declared by the caller). Circularities are trapped in external lists
|
|
859 (and cause errors). Neither macro need be declared inside brackets. */
|
|
860
|
|
861 #define GET_LIST_LENGTH(list, len) do { \
|
|
862 Lisp_Object GLL_tail; \
|
|
863 for (GLL_tail = list, len = 0; \
|
|
864 !NILP (GLL_tail); \
|
|
865 GLL_tail = XCDR (GLL_tail), ++len) \
|
|
866 DO_NOTHING; \
|
|
867 } while (0)
|
|
868
|
|
869 #define GET_EXTERNAL_LIST_LENGTH(list, len) \
|
|
870 do { \
|
|
871 Lisp_Object GELL_elt, GELL_tail; \
|
|
872 EXTERNAL_LIST_LOOP_4_NO_DECLARE (GELL_elt, list, GELL_tail, len) \
|
|
873 ; \
|
|
874 } while (0)
|
|
875
|
|
876 /* For a list that's known to be in valid list format, where we may
|
|
877 be deleting the current element out of the list --
|
|
878 will abort() if the list is not in valid format */
|
|
879 #define LIST_LOOP_DELETING(consvar, nextconsvar, list) \
|
|
880 for (consvar = list; \
|
|
881 !NILP (consvar) ? (nextconsvar = XCDR (consvar), 1) :0; \
|
|
882 consvar = nextconsvar)
|
|
883
|
|
884 /* LIST_LOOP_DELETE_IF and EXTERNAL_LIST_LOOP_DELETE_IF:
|
|
885
|
|
886 These two macros delete all elements of LIST (either an internal or
|
|
887 external list, according to which macro is used) satisfying
|
|
888 CONDITION, a C expression referring to variable ELT. ELT is
|
|
889 automatically declared. Circularities are trapped in external
|
|
890 lists (and cause errors). Neither macro need be declared inside
|
|
891 brackets. */
|
|
892
|
|
893 #define LIST_LOOP_DELETE_IF(elt, list, condition) do { \
|
|
894 /* Do not use ##list when creating new variables because \
|
|
895 that may not be just a variable name. */ \
|
|
896 Lisp_Object prev_tail_##elt = Qnil; \
|
|
897 LIST_LOOP_3 (elt, list, tail_##elt) \
|
|
898 { \
|
|
899 if (condition) \
|
|
900 { \
|
|
901 if (NILP (prev_tail_##elt)) \
|
|
902 list = XCDR (tail_##elt); \
|
|
903 else \
|
|
904 XCDR (prev_tail_##elt) = XCDR (tail_##elt); \
|
|
905 } \
|
|
906 else \
|
|
907 prev_tail_##elt = tail_##elt; \
|
|
908 } \
|
|
909 } while (0)
|
|
910
|
|
911 #define EXTERNAL_LIST_LOOP_DELETE_IF(elt, list, condition) do { \
|
|
912 Lisp_Object prev_tail_##elt = Qnil; \
|
|
913 EXTERNAL_LIST_LOOP_4 (elt, list, tail_##elt, len_##elt) \
|
|
914 { \
|
|
915 if (condition) \
|
|
916 { \
|
|
917 if (NILP (prev_tail_##elt)) \
|
|
918 list = XCDR (tail_##elt); \
|
|
919 else \
|
|
920 XCDR (prev_tail_##elt) = XCDR (tail_##elt); \
|
|
921 /* Keep tortoise from ever passing hare. */ \
|
|
922 len_##elt = 0; \
|
|
923 } \
|
|
924 else \
|
|
925 prev_tail_##elt = tail_##elt; \
|
|
926 } \
|
|
927 } while (0)
|
|
928
|
|
929
|
|
930 /* Macros for looping over external alists.
|
|
931
|
|
932 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
|
|
933
|
|
934 EXTERNAL_ALIST_LOOP_4 is similar to EXTERNAL_LIST_LOOP_2, but it
|
|
935 assumes the elements are aconses (the elements in an alist) and
|
|
936 sets two additional argument variables ELT_CAR and ELT_CDR to the
|
|
937 car and cdr of the acons. All of the variables ELT, ELT_CAR and
|
|
938 ELT_CDR are automatically declared.
|
|
939
|
|
940 EXTERNAL_ALIST_LOOP_5 adds a TAIL argument to EXTERNAL_ALIST_LOOP_4,
|
|
941 just like EXTERNAL_LIST_LOOP_3 does, and again TAIL is automatically
|
|
942 declared.
|
|
943
|
|
944 EXTERNAL_ALIST_LOOP_6 adds a LEN argument to EXTERNAL_ALIST_LOOP_5,
|
|
945 just like EXTERNAL_LIST_LOOP_4 does, and again LEN is automatically
|
|
946 declared.
|
|
947
|
|
948 EXTERNAL_ALIST_LOOP_6_NO_DECLARE does not declare any of its arguments,
|
|
949 just like EXTERNAL_LIST_LOOP_4_NO_DECLARE, and so these must be declared
|
|
950 manually.
|
|
951 */
|
428
|
952
|
|
953 /* Optimized and safe macros for looping over external alists. */
|
|
954 #define EXTERNAL_ALIST_LOOP_4(elt, elt_car, elt_cdr, list) \
|
442
|
955 Lisp_Object elt, elt_car, elt_cdr; \
|
428
|
956 Lisp_Object hare_##elt, tortoise_##elt; \
|
|
957 EMACS_INT len_##elt; \
|
442
|
958 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
|
428
|
959 len_##elt, hare_##elt, tortoise_##elt, \
|
|
960 CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
961
|
|
962 #define EXTERNAL_ALIST_LOOP_5(elt, elt_car, elt_cdr, list, tail) \
|
442
|
963 Lisp_Object elt, elt_car, elt_cdr, tail; \
|
428
|
964 Lisp_Object tortoise_##elt; \
|
|
965 EMACS_INT len_##elt; \
|
442
|
966 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
|
428
|
967 len_##elt, tail, tortoise_##elt, \
|
|
968 CIRCULAR_LIST_SUSPICION_LENGTH) \
|
|
969
|
|
970 #define EXTERNAL_ALIST_LOOP_6(elt, elt_car, elt_cdr, list, tail, len) \
|
442
|
971 Lisp_Object elt, elt_car, elt_cdr, tail; \
|
|
972 EMACS_INT len; \
|
428
|
973 Lisp_Object tortoise_##elt; \
|
442
|
974 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
|
428
|
975 len, tail, tortoise_##elt, \
|
|
976 CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
977
|
442
|
978 #define EXTERNAL_ALIST_LOOP_6_NO_DECLARE(elt, elt_car, elt_cdr, list, \
|
|
979 tail, len) \
|
|
980 Lisp_Object tortoise_##elt; \
|
|
981 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
|
|
982 len, tail, tortoise_##elt, \
|
|
983 CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
984
|
|
985
|
|
986 #define PRIVATE_EXTERNAL_ALIST_LOOP_8(elt, elt_car, elt_cdr, list, len, \
|
|
987 hare, tortoise, suspicion_length) \
|
|
988 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, hare, tortoise, \
|
|
989 suspicion_length) \
|
428
|
990 if (CONSP (elt) ? (elt_car = XCAR (elt), elt_cdr = XCDR (elt), 0) :1) \
|
|
991 continue; \
|
|
992 else
|
|
993
|
442
|
994 /* Macros for looping over external property lists.
|
|
995
|
|
996 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
|
|
997
|
|
998 EXTERNAL_PROPERTY_LIST_LOOP_3 maps over an external list assumed to
|
|
999 be a property list, consisting of alternating pairs of keys
|
|
1000 (typically symbols or keywords) and values. Each iteration
|
|
1001 processes one such pair out of LIST, assigning the two elements to
|
|
1002 KEY and VALUE respectively. Malformed lists and circularities are
|
|
1003 trapped as usual, and in addition, property lists with an odd number
|
|
1004 of elements also signal an error.
|
|
1005
|
|
1006 EXTERNAL_PROPERTY_LIST_LOOP_4 adds a TAIL argument to
|
|
1007 EXTERNAL_PROPERTY_LIST_LOOP_3, just like EXTERNAL_LIST_LOOP_3 does,
|
|
1008 and again TAIL is automatically declared.
|
|
1009
|
|
1010 EXTERNAL_PROPERTY_LIST_LOOP_5 adds a LEN argument to
|
|
1011 EXTERNAL_PROPERTY_LIST_LOOP_4, just like EXTERNAL_LIST_LOOP_4 does,
|
|
1012 and again LEN is automatically declared. Note that in this case,
|
|
1013 LEN counts the iterations, NOT the total number of list elements
|
|
1014 processed, which is 2 * LEN.
|
|
1015
|
|
1016 EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE does not declare any of its
|
|
1017 arguments, just like EXTERNAL_LIST_LOOP_4_NO_DECLARE, and so these
|
|
1018 must be declared manually. */
|
428
|
1019
|
|
1020 /* Optimized and safe macros for looping over external property lists. */
|
|
1021 #define EXTERNAL_PROPERTY_LIST_LOOP_3(key, value, list) \
|
|
1022 Lisp_Object key, value, hare_##key, tortoise_##key; \
|
442
|
1023 EMACS_INT len_##key; \
|
428
|
1024 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len_##key, hare_##key, \
|
|
1025 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1026
|
|
1027 #define EXTERNAL_PROPERTY_LIST_LOOP_4(key, value, list, tail) \
|
|
1028 Lisp_Object key, value, tail, tortoise_##key; \
|
442
|
1029 EMACS_INT len_##key; \
|
428
|
1030 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len_##key, tail, \
|
|
1031 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1032
|
|
1033 #define EXTERNAL_PROPERTY_LIST_LOOP_5(key, value, list, tail, len) \
|
|
1034 Lisp_Object key, value, tail, tortoise_##key; \
|
|
1035 EMACS_INT len; \
|
|
1036 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \
|
|
1037 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1038
|
442
|
1039 #define EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE(key, value, list, \
|
|
1040 tail, len) \
|
|
1041 Lisp_Object tortoise_##key; \
|
|
1042 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \
|
|
1043 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1044
|
428
|
1045
|
|
1046 #define EXTERNAL_PROPERTY_LIST_LOOP_7(key, value, list, len, hare, \
|
|
1047 tortoise, suspicion_length) \
|
|
1048 for (tortoise = hare = list, len = 0; \
|
|
1049 \
|
|
1050 ((CONSP (hare) && \
|
|
1051 (key = XCAR (hare), \
|
|
1052 hare = XCDR (hare), \
|
442
|
1053 (CONSP (hare) ? 1 : \
|
|
1054 (signal_malformed_property_list_error (list), 0)))) ? \
|
428
|
1055 (value = XCAR (hare), 1) : \
|
|
1056 (NILP (hare) ? 0 : \
|
|
1057 (signal_malformed_property_list_error (list), 0))); \
|
|
1058 \
|
|
1059 hare = XCDR (hare), \
|
|
1060 ((++len < suspicion_length) ? \
|
|
1061 ((void) 0) : \
|
|
1062 (((len & 1) ? \
|
|
1063 ((void) (tortoise = XCDR (XCDR (tortoise)))) : \
|
|
1064 ((void) 0)) \
|
|
1065 , \
|
|
1066 (EQ (hare, tortoise) ? \
|
|
1067 ((void) signal_circular_property_list_error (list)) : \
|
|
1068 ((void) 0)))))
|
|
1069
|
|
1070 /* For a property list (alternating keywords/values) that may not be
|
|
1071 in valid list format -- will signal an error if the list is not in
|
|
1072 valid format. CONSVAR is used to keep track of the iterations
|
|
1073 without modifying PLIST.
|
|
1074
|
|
1075 We have to be tricky to still keep the same C format.*/
|
|
1076 #define EXTERNAL_PROPERTY_LIST_LOOP(tail, key, value, plist) \
|
|
1077 for (tail = plist; \
|
|
1078 (CONSP (tail) && CONSP (XCDR (tail)) ? \
|
|
1079 (key = XCAR (tail), value = XCAR (XCDR (tail))) : \
|
|
1080 (key = Qunbound, value = Qunbound)), \
|
|
1081 !NILP (tail); \
|
|
1082 tail = XCDR (XCDR (tail))) \
|
|
1083 if (UNBOUNDP (key)) \
|
|
1084 Fsignal (Qmalformed_property_list, list1 (plist)); \
|
|
1085 else
|
|
1086
|
|
1087 #define PROPERTY_LIST_LOOP(tail, key, value, plist) \
|
|
1088 for (tail = plist; \
|
|
1089 NILP (tail) ? 0 : \
|
|
1090 (key = XCAR (tail), tail = XCDR (tail), \
|
|
1091 value = XCAR (tail), tail = XCDR (tail), 1); \
|
|
1092 )
|
|
1093
|
|
1094 /* Return 1 if LIST is properly acyclic and nil-terminated, else 0. */
|
442
|
1095 INLINE_HEADER int TRUE_LIST_P (Lisp_Object object);
|
|
1096 INLINE_HEADER int
|
428
|
1097 TRUE_LIST_P (Lisp_Object object)
|
|
1098 {
|
|
1099 Lisp_Object hare, tortoise;
|
|
1100 EMACS_INT len;
|
|
1101
|
|
1102 for (hare = tortoise = object, len = 0;
|
|
1103 CONSP (hare);
|
|
1104 hare = XCDR (hare), len++)
|
|
1105 {
|
|
1106 if (len < CIRCULAR_LIST_SUSPICION_LENGTH)
|
|
1107 continue;
|
|
1108
|
|
1109 if (len & 1)
|
|
1110 tortoise = XCDR (tortoise);
|
|
1111 else if (EQ (hare, tortoise))
|
|
1112 return 0;
|
|
1113 }
|
|
1114
|
|
1115 return NILP (hare);
|
|
1116 }
|
|
1117
|
|
1118 /* Signal an error if LIST is not properly acyclic and nil-terminated. */
|
|
1119 #define CHECK_TRUE_LIST(list) do { \
|
|
1120 Lisp_Object CTL_list = (list); \
|
|
1121 Lisp_Object CTL_hare, CTL_tortoise; \
|
436
|
1122 EMACS_INT CTL_len; \
|
428
|
1123 \
|
|
1124 for (CTL_hare = CTL_tortoise = CTL_list, CTL_len = 0; \
|
|
1125 CONSP (CTL_hare); \
|
|
1126 CTL_hare = XCDR (CTL_hare), CTL_len++) \
|
|
1127 { \
|
|
1128 if (CTL_len < CIRCULAR_LIST_SUSPICION_LENGTH) \
|
|
1129 continue; \
|
|
1130 \
|
|
1131 if (CTL_len & 1) \
|
|
1132 CTL_tortoise = XCDR (CTL_tortoise); \
|
|
1133 else if (EQ (CTL_hare, CTL_tortoise)) \
|
|
1134 Fsignal (Qcircular_list, list1 (CTL_list)); \
|
|
1135 } \
|
|
1136 \
|
|
1137 if (! NILP (CTL_hare)) \
|
|
1138 signal_malformed_list_error (CTL_list); \
|
|
1139 } while (0)
|
|
1140
|
442
|
1141 /*------------------------------ string --------------------------------*/
|
428
|
1142
|
|
1143 struct Lisp_String
|
|
1144 {
|
|
1145 struct lrecord_header lheader;
|
|
1146 Bytecount size;
|
|
1147 Bufbyte *data;
|
|
1148 Lisp_Object plist;
|
|
1149 };
|
|
1150 typedef struct Lisp_String Lisp_String;
|
|
1151
|
|
1152 DECLARE_LRECORD (string, Lisp_String);
|
|
1153 #define XSTRING(x) XRECORD (x, string, Lisp_String)
|
|
1154 #define XSETSTRING(x, p) XSETRECORD (x, p, string)
|
|
1155 #define STRINGP(x) RECORDP (x, string)
|
|
1156 #define CHECK_STRING(x) CHECK_RECORD (x, string)
|
|
1157 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string)
|
|
1158
|
|
1159 #ifdef MULE
|
|
1160
|
442
|
1161 Charcount bytecount_to_charcount (const Bufbyte *ptr, Bytecount len);
|
|
1162 Bytecount charcount_to_bytecount (const Bufbyte *ptr, Charcount len);
|
428
|
1163
|
|
1164 #else /* not MULE */
|
|
1165
|
|
1166 # define bytecount_to_charcount(ptr, len) (len)
|
|
1167 # define charcount_to_bytecount(ptr, len) (len)
|
|
1168
|
|
1169 #endif /* not MULE */
|
|
1170
|
|
1171 #define string_length(s) ((s)->size)
|
|
1172 #define XSTRING_LENGTH(s) string_length (XSTRING (s))
|
|
1173 #define XSTRING_CHAR_LENGTH(s) string_char_length (XSTRING (s))
|
|
1174 #define string_data(s) ((s)->data + 0)
|
|
1175 #define XSTRING_DATA(s) string_data (XSTRING (s))
|
|
1176 #define string_byte(s, i) ((s)->data[i] + 0)
|
|
1177 #define XSTRING_BYTE(s, i) string_byte (XSTRING (s), i)
|
|
1178 #define string_byte_addr(s, i) (&((s)->data[i]))
|
|
1179 #define set_string_length(s, len) ((void) ((s)->size = (len)))
|
|
1180 #define set_string_data(s, ptr) ((void) ((s)->data = (ptr)))
|
442
|
1181 #define set_string_byte(s, i, b) ((void) ((s)->data[i] = (b)))
|
428
|
1182
|
|
1183 void resize_string (Lisp_String *s, Bytecount pos, Bytecount delta);
|
|
1184
|
|
1185 #ifdef MULE
|
|
1186
|
442
|
1187 INLINE_HEADER Charcount string_char_length (Lisp_String *s);
|
|
1188 INLINE_HEADER Charcount
|
428
|
1189 string_char_length (Lisp_String *s)
|
|
1190 {
|
|
1191 return bytecount_to_charcount (string_data (s), string_length (s));
|
|
1192 }
|
|
1193
|
|
1194 # define string_char(s, i) charptr_emchar_n (string_data (s), i)
|
|
1195 # define string_char_addr(s, i) charptr_n_addr (string_data (s), i)
|
|
1196 void set_string_char (Lisp_String *s, Charcount i, Emchar c);
|
|
1197
|
|
1198 #else /* not MULE */
|
|
1199
|
|
1200 # define string_char_length(s) string_length (s)
|
|
1201 # define string_char(s, i) ((Emchar) string_byte (s, i))
|
|
1202 # define string_char_addr(s, i) string_byte_addr (s, i)
|
442
|
1203 # define set_string_char(s, i, c) set_string_byte (s, i, (Bufbyte)c)
|
428
|
1204
|
|
1205 #endif /* not MULE */
|
|
1206
|
456
|
1207 /* Return the true aligned size of a struct whose last member is a
|
|
1208 variable-length array field. (this is known as the "struct hack") */
|
|
1209 /* Implementation: in practice, structtype and fieldtype usually have
|
|
1210 the same alignment, but we can't be sure. We need to use
|
|
1211 ALIGN_SIZE to be absolutely sure of getting the correct alignment.
|
|
1212 To help the compiler's optimizer, we use a ternary expression that
|
|
1213 only a very stupid compiler would fail to correctly simplify. */
|
|
1214 #define FLEXIBLE_ARRAY_STRUCT_SIZEOF(structtype, \
|
|
1215 fieldtype, \
|
|
1216 fieldname, \
|
|
1217 array_length) \
|
|
1218 (ALIGNOF (structtype) == ALIGNOF (fieldtype) \
|
|
1219 ? (offsetof (structtype, fieldname) + \
|
|
1220 (offsetof (structtype, fieldname[1]) - \
|
|
1221 offsetof (structtype, fieldname[0])) * \
|
|
1222 (array_length)) \
|
|
1223 : (ALIGN_SIZE \
|
|
1224 ((offsetof (structtype, fieldname) + \
|
|
1225 (offsetof (structtype, fieldname[1]) - \
|
|
1226 offsetof (structtype, fieldname[0])) * \
|
|
1227 (array_length)), \
|
|
1228 ALIGNOF (structtype))))
|
442
|
1229
|
|
1230 /*------------------------------ vector --------------------------------*/
|
428
|
1231
|
|
1232 struct Lisp_Vector
|
|
1233 {
|
|
1234 struct lcrecord_header header;
|
|
1235 long size;
|
|
1236 /* next is now chained through v->contents[size], terminated by Qzero.
|
|
1237 This means that pure vectors don't need a "next" */
|
|
1238 /* struct Lisp_Vector *next; */
|
|
1239 Lisp_Object contents[1];
|
|
1240 };
|
|
1241 typedef struct Lisp_Vector Lisp_Vector;
|
|
1242
|
|
1243 DECLARE_LRECORD (vector, Lisp_Vector);
|
|
1244 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector)
|
|
1245 #define XSETVECTOR(x, p) XSETRECORD (x, p, vector)
|
|
1246 #define VECTORP(x) RECORDP (x, vector)
|
|
1247 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector)
|
|
1248 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector)
|
|
1249
|
|
1250 #define vector_length(v) ((v)->size)
|
|
1251 #define XVECTOR_LENGTH(s) vector_length (XVECTOR (s))
|
|
1252 #define vector_data(v) ((v)->contents)
|
|
1253 #define XVECTOR_DATA(s) vector_data (XVECTOR (s))
|
|
1254
|
442
|
1255 /*---------------------------- bit vectors -----------------------------*/
|
428
|
1256
|
|
1257 #if (LONGBITS < 16)
|
|
1258 #error What the hell?!
|
|
1259 #elif (LONGBITS < 32)
|
|
1260 # define LONGBITS_LOG2 4
|
|
1261 # define LONGBITS_POWER_OF_2 16
|
|
1262 #elif (LONGBITS < 64)
|
|
1263 # define LONGBITS_LOG2 5
|
|
1264 # define LONGBITS_POWER_OF_2 32
|
|
1265 #elif (LONGBITS < 128)
|
|
1266 # define LONGBITS_LOG2 6
|
|
1267 # define LONGBITS_POWER_OF_2 64
|
|
1268 #else
|
|
1269 #error You really have 128-bit integers?!
|
|
1270 #endif
|
|
1271
|
|
1272 struct Lisp_Bit_Vector
|
|
1273 {
|
|
1274 struct lrecord_header lheader;
|
|
1275 Lisp_Object next;
|
|
1276 size_t size;
|
|
1277 unsigned long bits[1];
|
|
1278 };
|
|
1279 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector;
|
|
1280
|
|
1281 DECLARE_LRECORD (bit_vector, Lisp_Bit_Vector);
|
|
1282 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector)
|
|
1283 #define XSETBIT_VECTOR(x, p) XSETRECORD (x, p, bit_vector)
|
|
1284 #define BIT_VECTORP(x) RECORDP (x, bit_vector)
|
|
1285 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector)
|
|
1286 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector)
|
|
1287
|
|
1288 #define BITP(x) (INTP (x) && (XINT (x) == 0 || XINT (x) == 1))
|
|
1289
|
|
1290 #define CHECK_BIT(x) do { \
|
|
1291 if (!BITP (x)) \
|
|
1292 dead_wrong_type_argument (Qbitp, x);\
|
|
1293 } while (0)
|
|
1294
|
|
1295 #define CONCHECK_BIT(x) do { \
|
|
1296 if (!BITP (x)) \
|
|
1297 x = wrong_type_argument (Qbitp, x); \
|
|
1298 } while (0)
|
|
1299
|
|
1300 #define bit_vector_length(v) ((v)->size)
|
|
1301 #define bit_vector_next(v) ((v)->next)
|
|
1302
|
442
|
1303 INLINE_HEADER int bit_vector_bit (Lisp_Bit_Vector *v, size_t n);
|
|
1304 INLINE_HEADER int
|
428
|
1305 bit_vector_bit (Lisp_Bit_Vector *v, size_t n)
|
|
1306 {
|
|
1307 return ((v->bits[n >> LONGBITS_LOG2] >> (n & (LONGBITS_POWER_OF_2 - 1)))
|
|
1308 & 1);
|
|
1309 }
|
|
1310
|
442
|
1311 INLINE_HEADER void set_bit_vector_bit (Lisp_Bit_Vector *v, size_t n, int value);
|
|
1312 INLINE_HEADER void
|
428
|
1313 set_bit_vector_bit (Lisp_Bit_Vector *v, size_t n, int value)
|
|
1314 {
|
|
1315 if (value)
|
|
1316 v->bits[n >> LONGBITS_LOG2] |= (1UL << (n & (LONGBITS_POWER_OF_2 - 1)));
|
|
1317 else
|
|
1318 v->bits[n >> LONGBITS_LOG2] &= ~(1UL << (n & (LONGBITS_POWER_OF_2 - 1)));
|
|
1319 }
|
|
1320
|
|
1321 /* Number of longs required to hold LEN bits */
|
|
1322 #define BIT_VECTOR_LONG_STORAGE(len) \
|
|
1323 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2)
|
|
1324
|
442
|
1325 /*------------------------------ symbol --------------------------------*/
|
428
|
1326
|
440
|
1327 typedef struct Lisp_Symbol Lisp_Symbol;
|
428
|
1328 struct Lisp_Symbol
|
|
1329 {
|
|
1330 struct lrecord_header lheader;
|
|
1331 /* next symbol in this obarray bucket */
|
440
|
1332 Lisp_Symbol *next;
|
|
1333 Lisp_String *name;
|
428
|
1334 Lisp_Object value;
|
|
1335 Lisp_Object function;
|
|
1336 Lisp_Object plist;
|
|
1337 };
|
|
1338
|
|
1339 #define SYMBOL_IS_KEYWORD(sym) \
|
|
1340 ((string_byte (symbol_name (XSYMBOL (sym)), 0) == ':') \
|
|
1341 && EQ (sym, oblookup (Vobarray, \
|
|
1342 string_data (symbol_name (XSYMBOL (sym))), \
|
|
1343 string_length (symbol_name (XSYMBOL (sym))))))
|
|
1344 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj))
|
|
1345
|
|
1346 DECLARE_LRECORD (symbol, Lisp_Symbol);
|
|
1347 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol)
|
|
1348 #define XSETSYMBOL(x, p) XSETRECORD (x, p, symbol)
|
|
1349 #define SYMBOLP(x) RECORDP (x, symbol)
|
|
1350 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol)
|
|
1351 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol)
|
|
1352
|
|
1353 #define symbol_next(s) ((s)->next)
|
|
1354 #define symbol_name(s) ((s)->name)
|
|
1355 #define symbol_value(s) ((s)->value)
|
|
1356 #define symbol_function(s) ((s)->function)
|
|
1357 #define symbol_plist(s) ((s)->plist)
|
|
1358
|
442
|
1359 /*------------------------------- subr ---------------------------------*/
|
428
|
1360
|
|
1361 typedef Lisp_Object (*lisp_fn_t) (void);
|
|
1362
|
|
1363 struct Lisp_Subr
|
|
1364 {
|
|
1365 struct lrecord_header lheader;
|
442
|
1366 short min_args;
|
|
1367 short max_args;
|
|
1368 const char *prompt;
|
|
1369 const char *doc;
|
|
1370 const char *name;
|
428
|
1371 lisp_fn_t subr_fn;
|
|
1372 };
|
|
1373 typedef struct Lisp_Subr Lisp_Subr;
|
|
1374
|
|
1375 DECLARE_LRECORD (subr, Lisp_Subr);
|
|
1376 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr)
|
|
1377 #define XSETSUBR(x, p) XSETRECORD (x, p, subr)
|
|
1378 #define SUBRP(x) RECORDP (x, subr)
|
|
1379 #define CHECK_SUBR(x) CHECK_RECORD (x, subr)
|
|
1380 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr)
|
|
1381
|
436
|
1382 #define subr_function(subr) ((subr)->subr_fn)
|
|
1383 #define SUBR_FUNCTION(subr,max_args) \
|
|
1384 ((Lisp_Object (*) (EXFUN_##max_args)) (subr)->subr_fn)
|
|
1385 #define subr_name(subr) ((subr)->name)
|
428
|
1386
|
442
|
1387 /*------------------------------ marker --------------------------------*/
|
|
1388
|
428
|
1389
|
440
|
1390 typedef struct Lisp_Marker Lisp_Marker;
|
428
|
1391 struct Lisp_Marker
|
|
1392 {
|
|
1393 struct lrecord_header lheader;
|
440
|
1394 Lisp_Marker *next;
|
|
1395 Lisp_Marker *prev;
|
428
|
1396 struct buffer *buffer;
|
|
1397 Memind memind;
|
|
1398 char insertion_type;
|
|
1399 };
|
|
1400
|
|
1401 DECLARE_LRECORD (marker, Lisp_Marker);
|
|
1402 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker)
|
|
1403 #define XSETMARKER(x, p) XSETRECORD (x, p, marker)
|
|
1404 #define MARKERP(x) RECORDP (x, marker)
|
|
1405 #define CHECK_MARKER(x) CHECK_RECORD (x, marker)
|
|
1406 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker)
|
|
1407
|
|
1408 /* The second check was looking for GCed markers still in use */
|
|
1409 /* if (INTP (XMARKER (x)->lheader.next.v)) abort (); */
|
|
1410
|
|
1411 #define marker_next(m) ((m)->next)
|
|
1412 #define marker_prev(m) ((m)->prev)
|
|
1413
|
442
|
1414 /*------------------------------- char ---------------------------------*/
|
428
|
1415
|
|
1416 #define CHARP(x) (XTYPE (x) == Lisp_Type_Char)
|
|
1417
|
|
1418 #ifdef ERROR_CHECK_TYPECHECK
|
|
1419
|
442
|
1420 INLINE_HEADER Emchar XCHAR (Lisp_Object obj);
|
|
1421 INLINE_HEADER Emchar
|
428
|
1422 XCHAR (Lisp_Object obj)
|
|
1423 {
|
|
1424 assert (CHARP (obj));
|
|
1425 return XCHARVAL (obj);
|
|
1426 }
|
|
1427
|
|
1428 #else
|
|
1429
|
442
|
1430 #define XCHAR(x) ((Emchar)XCHARVAL (x))
|
428
|
1431
|
|
1432 #endif
|
|
1433
|
|
1434 #define CHECK_CHAR(x) CHECK_NONRECORD (x, Lisp_Type_Char, Qcharacterp)
|
|
1435 #define CONCHECK_CHAR(x) CONCHECK_NONRECORD (x, Lisp_Type_Char, Qcharacterp)
|
|
1436
|
|
1437
|
442
|
1438 /*------------------------------ float ---------------------------------*/
|
428
|
1439
|
|
1440 #ifdef LISP_FLOAT_TYPE
|
|
1441
|
|
1442 /* Note: the 'unused_next_' field exists only to ensure that the
|
|
1443 `next' pointer fits within the structure, for the purposes of the
|
|
1444 free list. This makes a difference in the unlikely case of
|
|
1445 sizeof(double) being smaller than sizeof(void *). */
|
|
1446
|
|
1447 struct Lisp_Float
|
|
1448 {
|
|
1449 struct lrecord_header lheader;
|
|
1450 union { double d; struct Lisp_Float *unused_next_; } data;
|
|
1451 };
|
|
1452 typedef struct Lisp_Float Lisp_Float;
|
|
1453
|
|
1454 DECLARE_LRECORD (float, Lisp_Float);
|
|
1455 #define XFLOAT(x) XRECORD (x, float, Lisp_Float)
|
|
1456 #define XSETFLOAT(x, p) XSETRECORD (x, p, float)
|
|
1457 #define FLOATP(x) RECORDP (x, float)
|
|
1458 #define CHECK_FLOAT(x) CHECK_RECORD (x, float)
|
|
1459 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float)
|
|
1460
|
|
1461 #define float_data(f) ((f)->data.d)
|
|
1462 #define XFLOAT_DATA(x) float_data (XFLOAT (x))
|
|
1463
|
|
1464 #define XFLOATINT(n) extract_float (n)
|
|
1465
|
|
1466 #define CHECK_INT_OR_FLOAT(x) do { \
|
|
1467 if (!INT_OR_FLOATP (x)) \
|
|
1468 dead_wrong_type_argument (Qnumberp, x); \
|
|
1469 } while (0)
|
|
1470
|
|
1471 #define CONCHECK_INT_OR_FLOAT(x) do { \
|
|
1472 if (!INT_OR_FLOATP (x)) \
|
|
1473 x = wrong_type_argument (Qnumberp, x); \
|
|
1474 } while (0)
|
|
1475
|
|
1476 # define INT_OR_FLOATP(x) (INTP (x) || FLOATP (x))
|
|
1477
|
|
1478 #else /* not LISP_FLOAT_TYPE */
|
|
1479
|
|
1480 #define XFLOAT(x) --- error! No float support. ---
|
|
1481 #define XSETFLOAT(x, p) --- error! No float support. ---
|
|
1482 #define FLOATP(x) 0
|
|
1483 #define CHECK_FLOAT(x) --- error! No float support. ---
|
|
1484 #define CONCHECK_FLOAT(x) --- error! No float support. ---
|
|
1485
|
|
1486 #define XFLOATINT(n) XINT(n)
|
|
1487 #define CHECK_INT_OR_FLOAT CHECK_INT
|
|
1488 #define CONCHECK_INT_OR_FLOAT CONCHECK_INT
|
|
1489 #define INT_OR_FLOATP(x) INTP (x)
|
|
1490
|
|
1491 #endif /* not LISP_FLOAT_TYPE */
|
|
1492
|
442
|
1493 /*-------------------------------- int ---------------------------------*/
|
428
|
1494
|
|
1495 #define ZEROP(x) EQ (x, Qzero)
|
|
1496
|
|
1497 #ifdef ERROR_CHECK_TYPECHECK
|
|
1498
|
442
|
1499 INLINE_HEADER EMACS_INT XINT (Lisp_Object obj);
|
|
1500 INLINE_HEADER EMACS_INT
|
428
|
1501 XINT (Lisp_Object obj)
|
|
1502 {
|
|
1503 assert (INTP (obj));
|
|
1504 return XREALINT (obj);
|
|
1505 }
|
|
1506
|
442
|
1507 INLINE_HEADER EMACS_INT XCHAR_OR_INT (Lisp_Object obj);
|
|
1508 INLINE_HEADER EMACS_INT
|
428
|
1509 XCHAR_OR_INT (Lisp_Object obj)
|
|
1510 {
|
|
1511 assert (INTP (obj) || CHARP (obj));
|
|
1512 return CHARP (obj) ? XCHAR (obj) : XINT (obj);
|
|
1513 }
|
|
1514
|
|
1515 #else /* no error checking */
|
|
1516
|
|
1517 #define XINT(obj) XREALINT (obj)
|
|
1518 #define XCHAR_OR_INT(obj) (CHARP (obj) ? XCHAR (obj) : XINT (obj))
|
|
1519
|
|
1520 #endif /* no error checking */
|
|
1521
|
|
1522 #define CHECK_INT(x) do { \
|
|
1523 if (!INTP (x)) \
|
|
1524 dead_wrong_type_argument (Qintegerp, x); \
|
|
1525 } while (0)
|
|
1526
|
|
1527 #define CONCHECK_INT(x) do { \
|
|
1528 if (!INTP (x)) \
|
|
1529 x = wrong_type_argument (Qintegerp, x); \
|
|
1530 } while (0)
|
|
1531
|
|
1532 #define NATNUMP(x) (INTP (x) && XINT (x) >= 0)
|
|
1533
|
|
1534 #define CHECK_NATNUM(x) do { \
|
|
1535 if (!NATNUMP (x)) \
|
|
1536 dead_wrong_type_argument (Qnatnump, x); \
|
|
1537 } while (0)
|
|
1538
|
|
1539 #define CONCHECK_NATNUM(x) do { \
|
|
1540 if (!NATNUMP (x)) \
|
|
1541 x = wrong_type_argument (Qnatnump, x); \
|
|
1542 } while (0)
|
|
1543
|
|
1544 /* next three always continuable because they coerce their arguments. */
|
|
1545 #define CHECK_INT_COERCE_CHAR(x) do { \
|
|
1546 if (INTP (x)) \
|
|
1547 ; \
|
|
1548 else if (CHARP (x)) \
|
|
1549 x = make_int (XCHAR (x)); \
|
|
1550 else \
|
|
1551 x = wrong_type_argument (Qinteger_or_char_p, x); \
|
|
1552 } while (0)
|
|
1553
|
|
1554 #define CHECK_INT_COERCE_MARKER(x) do { \
|
|
1555 if (INTP (x)) \
|
|
1556 ; \
|
|
1557 else if (MARKERP (x)) \
|
|
1558 x = make_int (marker_position (x)); \
|
|
1559 else \
|
|
1560 x = wrong_type_argument (Qinteger_or_marker_p, x); \
|
|
1561 } while (0)
|
|
1562
|
|
1563 #define CHECK_INT_COERCE_CHAR_OR_MARKER(x) do { \
|
|
1564 if (INTP (x)) \
|
|
1565 ; \
|
|
1566 else if (CHARP (x)) \
|
|
1567 x = make_int (XCHAR (x)); \
|
|
1568 else if (MARKERP (x)) \
|
|
1569 x = make_int (marker_position (x)); \
|
|
1570 else \
|
|
1571 x = wrong_type_argument (Qinteger_char_or_marker_p, x); \
|
|
1572 } while (0)
|
|
1573
|
|
1574
|
442
|
1575 /*--------------------------- readonly objects -------------------------*/
|
440
|
1576
|
428
|
1577 #define CHECK_C_WRITEABLE(obj) \
|
|
1578 do { if (c_readonly (obj)) c_write_error (obj); } while (0)
|
|
1579
|
|
1580 #define CHECK_LISP_WRITEABLE(obj) \
|
|
1581 do { if (lisp_readonly (obj)) lisp_write_error (obj); } while (0)
|
|
1582
|
|
1583 #define C_READONLY(obj) (C_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
|
|
1584 #define LISP_READONLY(obj) (LISP_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
|
|
1585
|
442
|
1586 /*----------------------------- structrures ----------------------------*/
|
428
|
1587
|
|
1588 typedef struct structure_keyword_entry structure_keyword_entry;
|
|
1589 struct structure_keyword_entry
|
|
1590 {
|
|
1591 Lisp_Object keyword;
|
|
1592 int (*validate) (Lisp_Object keyword, Lisp_Object value,
|
|
1593 Error_behavior errb);
|
|
1594 };
|
|
1595
|
|
1596 typedef struct
|
|
1597 {
|
|
1598 Dynarr_declare (structure_keyword_entry);
|
|
1599 } structure_keyword_entry_dynarr;
|
|
1600
|
|
1601 typedef struct structure_type structure_type;
|
|
1602 struct structure_type
|
|
1603 {
|
|
1604 Lisp_Object type;
|
|
1605 structure_keyword_entry_dynarr *keywords;
|
|
1606 int (*validate) (Lisp_Object data, Error_behavior errb);
|
|
1607 Lisp_Object (*instantiate) (Lisp_Object data);
|
|
1608 };
|
|
1609
|
|
1610 typedef struct
|
|
1611 {
|
|
1612 Dynarr_declare (structure_type);
|
|
1613 } structure_type_dynarr;
|
|
1614
|
|
1615 struct structure_type *define_structure_type (Lisp_Object type,
|
|
1616 int (*validate)
|
|
1617 (Lisp_Object data,
|
|
1618 Error_behavior errb),
|
|
1619 Lisp_Object (*instantiate)
|
|
1620 (Lisp_Object data));
|
|
1621 void define_structure_type_keyword (struct structure_type *st,
|
|
1622 Lisp_Object keyword,
|
|
1623 int (*validate) (Lisp_Object keyword,
|
|
1624 Lisp_Object value,
|
|
1625 Error_behavior errb));
|
|
1626
|
442
|
1627 /*---------------------------- weak lists ------------------------------*/
|
428
|
1628
|
|
1629 enum weak_list_type
|
|
1630 {
|
|
1631 /* element disappears if it's unmarked. */
|
|
1632 WEAK_LIST_SIMPLE,
|
|
1633 /* element disappears if it's a cons and either its car or
|
|
1634 cdr is unmarked. */
|
|
1635 WEAK_LIST_ASSOC,
|
|
1636 /* element disappears if it's a cons and its car is unmarked. */
|
|
1637 WEAK_LIST_KEY_ASSOC,
|
|
1638 /* element disappears if it's a cons and its cdr is unmarked. */
|
442
|
1639 WEAK_LIST_VALUE_ASSOC,
|
|
1640 /* element disappears if it's a cons and neither its car nor
|
|
1641 its cdr is marked. */
|
|
1642 WEAK_LIST_FULL_ASSOC
|
428
|
1643 };
|
|
1644
|
|
1645 struct weak_list
|
|
1646 {
|
|
1647 struct lcrecord_header header;
|
|
1648 Lisp_Object list; /* don't mark through this! */
|
|
1649 enum weak_list_type type;
|
|
1650 Lisp_Object next_weak; /* don't mark through this! */
|
|
1651 };
|
|
1652
|
|
1653 DECLARE_LRECORD (weak_list, struct weak_list);
|
|
1654 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list)
|
|
1655 #define XSETWEAK_LIST(x, p) XSETRECORD (x, p, weak_list)
|
|
1656 #define WEAK_LISTP(x) RECORDP (x, weak_list)
|
|
1657 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list)
|
|
1658 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list)
|
|
1659
|
|
1660 #define weak_list_list(w) ((w)->list)
|
|
1661 #define XWEAK_LIST_LIST(w) (XWEAK_LIST (w)->list)
|
|
1662
|
|
1663 Lisp_Object make_weak_list (enum weak_list_type type);
|
|
1664 /* The following two are only called by the garbage collector */
|
|
1665 int finish_marking_weak_lists (void);
|
|
1666 void prune_weak_lists (void);
|
|
1667
|
442
|
1668 /*-------------------------- lcrecord-list -----------------------------*/
|
428
|
1669
|
|
1670 struct lcrecord_list
|
|
1671 {
|
|
1672 struct lcrecord_header header;
|
|
1673 Lisp_Object free;
|
|
1674 size_t size;
|
442
|
1675 const struct lrecord_implementation *implementation;
|
428
|
1676 };
|
|
1677
|
|
1678 DECLARE_LRECORD (lcrecord_list, struct lcrecord_list);
|
|
1679 #define XLCRECORD_LIST(x) XRECORD (x, lcrecord_list, struct lcrecord_list)
|
|
1680 #define XSETLCRECORD_LIST(x, p) XSETRECORD (x, p, lcrecord_list)
|
|
1681 #define LCRECORD_LISTP(x) RECORDP (x, lcrecord_list)
|
|
1682 /* #define CHECK_LCRECORD_LIST(x) CHECK_RECORD (x, lcrecord_list)
|
|
1683 Lcrecord lists should never escape to the Lisp level, so
|
|
1684 functions should not be doing this. */
|
|
1685
|
|
1686 Lisp_Object make_lcrecord_list (size_t size,
|
442
|
1687 const struct lrecord_implementation
|
428
|
1688 *implementation);
|
|
1689 Lisp_Object allocate_managed_lcrecord (Lisp_Object lcrecord_list);
|
|
1690 void free_managed_lcrecord (Lisp_Object lcrecord_list, Lisp_Object lcrecord);
|
|
1691
|
|
1692
|
|
1693 /************************************************************************/
|
|
1694 /* Definitions of primitive Lisp functions and variables */
|
|
1695 /************************************************************************/
|
|
1696
|
|
1697
|
|
1698 /* DEFUN - Define a built-in Lisp-visible C function or `subr'.
|
|
1699 `lname' should be the name to give the function in Lisp,
|
|
1700 as a null-terminated C string.
|
|
1701 `Fname' should be the C equivalent of `lname', using only characters
|
|
1702 valid in a C identifier, with an "F" prepended.
|
|
1703 The name of the C constant structure that records information
|
|
1704 on this function for internal use is "S" concatenated with Fname.
|
|
1705 `min_args' should be a number, the minimum number of arguments allowed.
|
|
1706 `max_args' should be a number, the maximum number of arguments allowed,
|
|
1707 or else MANY or UNEVALLED.
|
|
1708 MANY means pass a vector of evaluated arguments,
|
|
1709 in the form of an integer number-of-arguments
|
|
1710 followed by the address of a vector of Lisp_Objects
|
|
1711 which contains the argument values.
|
|
1712 UNEVALLED means pass the list of unevaluated arguments.
|
|
1713 `prompt' says how to read arguments for an interactive call.
|
|
1714 See the doc string for `interactive'.
|
|
1715 A null string means call interactively with no arguments.
|
|
1716 `arglist' are the comma-separated arguments (always Lisp_Objects) for
|
|
1717 the function.
|
|
1718 The docstring for the function is placed as a "C" comment between
|
|
1719 the prompt and the `args' argument. make-docfile reads the
|
|
1720 comment and creates the DOC file from it.
|
|
1721 */
|
|
1722
|
|
1723 #define EXFUN_0 void
|
|
1724 #define EXFUN_1 Lisp_Object
|
|
1725 #define EXFUN_2 Lisp_Object,Lisp_Object
|
|
1726 #define EXFUN_3 Lisp_Object,Lisp_Object,Lisp_Object
|
|
1727 #define EXFUN_4 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object
|
|
1728 #define EXFUN_5 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object
|
|
1729 #define EXFUN_6 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
|
|
1730 Lisp_Object
|
|
1731 #define EXFUN_7 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
|
|
1732 Lisp_Object,Lisp_Object
|
|
1733 #define EXFUN_8 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
|
|
1734 Lisp_Object,Lisp_Object,Lisp_Object
|
|
1735 #define EXFUN_MANY int, Lisp_Object*
|
|
1736 #define EXFUN_UNEVALLED Lisp_Object
|
|
1737 #define EXFUN(sym, max_args) Lisp_Object sym (EXFUN_##max_args)
|
|
1738
|
|
1739 #define SUBR_MAX_ARGS 8
|
|
1740 #define MANY -2
|
|
1741 #define UNEVALLED -1
|
|
1742
|
|
1743 /* Can't be const, because then subr->doc is read-only and
|
|
1744 Snarf_documentation chokes */
|
|
1745
|
|
1746 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \
|
|
1747 Lisp_Object Fname (EXFUN_##max_args); \
|
442
|
1748 static struct Lisp_Subr S##Fname = \
|
|
1749 { \
|
|
1750 { /* struct lrecord_header */ \
|
|
1751 lrecord_type_subr, /* lrecord_type_index */ \
|
|
1752 1, /* mark bit */ \
|
|
1753 1, /* c_readonly bit */ \
|
|
1754 1 /* lisp_readonly bit */ \
|
|
1755 }, \
|
|
1756 min_args, \
|
|
1757 max_args, \
|
|
1758 prompt, \
|
|
1759 0, /* doc string */ \
|
|
1760 lname, \
|
|
1761 (lisp_fn_t) Fname \
|
|
1762 }; \
|
428
|
1763 Lisp_Object Fname (DEFUN_##max_args arglist)
|
|
1764
|
|
1765 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a
|
|
1766 prototype that matches max_args, and add the obligatory
|
|
1767 `Lisp_Object' type declaration to the formal C arguments. */
|
|
1768
|
|
1769 #define DEFUN_MANY(named_int, named_Lisp_Object) named_int, named_Lisp_Object
|
|
1770 #define DEFUN_UNEVALLED(args) Lisp_Object args
|
|
1771 #define DEFUN_0() void
|
|
1772 #define DEFUN_1(a) Lisp_Object a
|
|
1773 #define DEFUN_2(a,b) DEFUN_1(a), Lisp_Object b
|
|
1774 #define DEFUN_3(a,b,c) DEFUN_2(a,b), Lisp_Object c
|
|
1775 #define DEFUN_4(a,b,c,d) DEFUN_3(a,b,c), Lisp_Object d
|
|
1776 #define DEFUN_5(a,b,c,d,e) DEFUN_4(a,b,c,d), Lisp_Object e
|
|
1777 #define DEFUN_6(a,b,c,d,e,f) DEFUN_5(a,b,c,d,e), Lisp_Object f
|
|
1778 #define DEFUN_7(a,b,c,d,e,f,g) DEFUN_6(a,b,c,d,e,f), Lisp_Object g
|
|
1779 #define DEFUN_8(a,b,c,d,e,f,g,h) DEFUN_7(a,b,c,d,e,f,g),Lisp_Object h
|
|
1780
|
|
1781 /* WARNING: If you add defines here for higher values of max_args,
|
|
1782 make sure to also fix the clauses in PRIMITIVE_FUNCALL(),
|
|
1783 and change the define of SUBR_MAX_ARGS above. */
|
|
1784
|
|
1785 #include "symeval.h"
|
|
1786
|
|
1787 /* `specpdl' is the special binding/unwind-protect stack.
|
|
1788
|
|
1789 Knuth says (see the Jargon File):
|
|
1790 At MIT, `pdl' [abbreviation for `Push Down List'] used to
|
|
1791 be a more common synonym for `stack'.
|
|
1792 Everywhere else `stack' seems to be the preferred term.
|
|
1793
|
|
1794 specpdl_depth is the current depth of `specpdl'.
|
|
1795 Save this for use later as arg to `unbind_to'. */
|
|
1796 extern int specpdl_depth_counter;
|
|
1797 #define specpdl_depth() specpdl_depth_counter
|
|
1798
|
442
|
1799
|
|
1800 #define CHECK_FUNCTION(fun) do { \
|
|
1801 while (NILP (Ffunctionp (fun))) \
|
|
1802 signal_invalid_function_error (fun); \
|
|
1803 } while (0)
|
|
1804
|
428
|
1805
|
|
1806 /************************************************************************/
|
|
1807 /* Checking for QUIT */
|
|
1808 /************************************************************************/
|
|
1809
|
|
1810 /* Asynchronous events set something_happened, and then are processed
|
|
1811 within the QUIT macro. At this point, we are guaranteed to not be in
|
|
1812 any sensitive code. */
|
|
1813
|
|
1814 extern volatile int something_happened;
|
|
1815 int check_what_happened (void);
|
|
1816
|
|
1817 extern volatile int quit_check_signal_happened;
|
|
1818 extern volatile int quit_check_signal_tick_count;
|
|
1819 int check_quit (void);
|
|
1820
|
|
1821 void signal_quit (void);
|
|
1822
|
|
1823 /* Nonzero if ought to quit now. */
|
|
1824 #define QUITP \
|
|
1825 ((quit_check_signal_happened ? check_quit () : 0), \
|
|
1826 (!NILP (Vquit_flag) && (NILP (Vinhibit_quit) \
|
|
1827 || EQ (Vquit_flag, Qcritical))))
|
|
1828
|
|
1829 /* QUIT used to call QUITP, but there are some places where QUITP
|
|
1830 is called directly, and check_what_happened() should only be called
|
|
1831 when Emacs is actually ready to quit because it could do things
|
|
1832 like switch threads. */
|
|
1833 #define INTERNAL_QUITP \
|
|
1834 ((something_happened ? check_what_happened () : 0), \
|
|
1835 (!NILP (Vquit_flag) && \
|
|
1836 (NILP (Vinhibit_quit) || EQ (Vquit_flag, Qcritical))))
|
|
1837
|
|
1838 #define INTERNAL_REALLY_QUITP \
|
|
1839 (check_what_happened (), \
|
|
1840 (!NILP (Vquit_flag) && \
|
|
1841 (NILP (Vinhibit_quit) || EQ (Vquit_flag, Qcritical))))
|
|
1842
|
|
1843 /* Check quit-flag and quit if it is non-nil. Also do any other things
|
|
1844 that might have gotten queued until it was safe. */
|
|
1845 #define QUIT do { if (INTERNAL_QUITP) signal_quit (); } while (0)
|
|
1846
|
|
1847 #define REALLY_QUIT do { if (INTERNAL_REALLY_QUITP) signal_quit (); } while (0)
|
|
1848
|
|
1849
|
|
1850 /************************************************************************/
|
|
1851 /* hashing */
|
|
1852 /************************************************************************/
|
|
1853
|
|
1854 /* #### for a 64-bit machine, we should substitute a prime just over 2^32 */
|
|
1855 #define GOOD_HASH 65599 /* prime number just over 2^16; Dragon book, p. 435 */
|
|
1856 #define HASH2(a,b) (GOOD_HASH * (a) + (b))
|
|
1857 #define HASH3(a,b,c) (GOOD_HASH * HASH2 (a,b) + (c))
|
|
1858 #define HASH4(a,b,c,d) (GOOD_HASH * HASH3 (a,b,c) + (d))
|
|
1859 #define HASH5(a,b,c,d,e) (GOOD_HASH * HASH4 (a,b,c,d) + (e))
|
|
1860 #define HASH6(a,b,c,d,e,f) (GOOD_HASH * HASH5 (a,b,c,d,e) + (f))
|
|
1861 #define HASH7(a,b,c,d,e,f,g) (GOOD_HASH * HASH6 (a,b,c,d,e,f) + (g))
|
|
1862 #define HASH8(a,b,c,d,e,f,g,h) (GOOD_HASH * HASH7 (a,b,c,d,e,f,g) + (h))
|
|
1863 #define HASH9(a,b,c,d,e,f,g,h,i) (GOOD_HASH * HASH8 (a,b,c,d,e,f,g,h) + (i))
|
|
1864
|
|
1865 #define LISP_HASH(obj) ((unsigned long) LISP_TO_VOID (obj))
|
442
|
1866 unsigned long string_hash (const char *xv);
|
|
1867 unsigned long memory_hash (const void *xv, size_t size);
|
428
|
1868 unsigned long internal_hash (Lisp_Object obj, int depth);
|
|
1869 unsigned long internal_array_hash (Lisp_Object *arr, int size, int depth);
|
|
1870
|
|
1871
|
|
1872 /************************************************************************/
|
|
1873 /* String translation */
|
|
1874 /************************************************************************/
|
|
1875
|
|
1876 #ifdef I18N3
|
|
1877 #ifdef HAVE_LIBINTL_H
|
|
1878 #include <libintl.h>
|
|
1879 #else
|
442
|
1880 char *dgettext (const char *, const char *);
|
|
1881 char *gettext (const char *);
|
|
1882 char *textdomain (const char *);
|
|
1883 char *bindtextdomain (const char *, const char *);
|
428
|
1884 #endif /* HAVE_LIBINTL_H */
|
|
1885
|
|
1886 #define GETTEXT(x) gettext(x)
|
|
1887 #define LISP_GETTEXT(x) Fgettext (x)
|
|
1888 #else /* !I18N3 */
|
|
1889 #define GETTEXT(x) (x)
|
|
1890 #define LISP_GETTEXT(x) (x)
|
|
1891 #endif /* !I18N3 */
|
|
1892
|
|
1893 /* DEFER_GETTEXT is used to identify strings which are translated when
|
|
1894 they are referenced instead of when they are defined.
|
|
1895 These include Qerror_messages and initialized arrays of strings.
|
|
1896 */
|
|
1897 #define DEFER_GETTEXT(x) (x)
|
|
1898
|
|
1899
|
|
1900 /************************************************************************/
|
|
1901 /* Garbage collection / GC-protection */
|
|
1902 /************************************************************************/
|
|
1903
|
|
1904 /* number of bytes of structure consed since last GC */
|
|
1905
|
|
1906 extern EMACS_INT consing_since_gc;
|
|
1907
|
|
1908 /* threshold for doing another gc */
|
|
1909
|
458
|
1910 extern Fixnum gc_cons_threshold;
|
428
|
1911
|
|
1912 /* Structure for recording stack slots that need marking */
|
|
1913
|
|
1914 /* This is a chain of structures, each of which points at a Lisp_Object
|
|
1915 variable whose value should be marked in garbage collection.
|
|
1916 Normally every link of the chain is an automatic variable of a function,
|
|
1917 and its `val' points to some argument or local variable of the function.
|
|
1918 On exit to the function, the chain is set back to the value it had on
|
|
1919 entry. This way, no link remains in the chain when the stack frame
|
|
1920 containing the link disappears.
|
|
1921
|
|
1922 Every function that can call Feval must protect in this fashion all
|
|
1923 Lisp_Object variables whose contents will be used again. */
|
|
1924
|
|
1925 extern struct gcpro *gcprolist;
|
|
1926
|
|
1927 struct gcpro
|
|
1928 {
|
|
1929 struct gcpro *next;
|
|
1930 Lisp_Object *var; /* Address of first protected variable */
|
|
1931 int nvars; /* Number of consecutive protected variables */
|
|
1932 };
|
|
1933
|
|
1934 /* Normally, you declare variables gcpro1, gcpro2, ... and use the
|
|
1935 GCPROn() macros. However, if you need to have nested gcpro's,
|
|
1936 declare ngcpro1, ngcpro2, ... and use NGCPROn(). If you need
|
|
1937 to nest another level, use nngcpro1, nngcpro2, ... and use
|
|
1938 NNGCPROn(). If you need to nest yet another level, create
|
|
1939 the appropriate macros. */
|
|
1940
|
|
1941 #ifdef DEBUG_GCPRO
|
|
1942
|
|
1943 void debug_gcpro1 (char *, int, struct gcpro *, Lisp_Object *);
|
|
1944 void debug_gcpro2 (char *, int, struct gcpro *, struct gcpro *,
|
|
1945 Lisp_Object *, Lisp_Object *);
|
|
1946 void debug_gcpro3 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
|
|
1947 Lisp_Object *, Lisp_Object *, Lisp_Object *);
|
|
1948 void debug_gcpro4 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
|
|
1949 struct gcpro *, Lisp_Object *, Lisp_Object *, Lisp_Object *,
|
|
1950 Lisp_Object *);
|
|
1951 void debug_gcpro5 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
|
|
1952 struct gcpro *, struct gcpro *, Lisp_Object *, Lisp_Object *,
|
|
1953 Lisp_Object *, Lisp_Object *, Lisp_Object *);
|
|
1954 void debug_ungcpro(char *, int, struct gcpro *);
|
|
1955
|
|
1956 #define GCPRO1(v) \
|
|
1957 debug_gcpro1 (__FILE__, __LINE__,&gcpro1,&v)
|
|
1958 #define GCPRO2(v1,v2) \
|
|
1959 debug_gcpro2 (__FILE__, __LINE__,&gcpro1,&gcpro2,&v1,&v2)
|
|
1960 #define GCPRO3(v1,v2,v3) \
|
|
1961 debug_gcpro3 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&v1,&v2,&v3)
|
|
1962 #define GCPRO4(v1,v2,v3,v4) \
|
|
1963 debug_gcpro4 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,\
|
|
1964 &v1,&v2,&v3,&v4)
|
|
1965 #define GCPRO5(v1,v2,v3,v4,v5) \
|
|
1966 debug_gcpro5 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,&gcpro5,\
|
|
1967 &v1,&v2,&v3,&v4,&v5)
|
|
1968 #define UNGCPRO \
|
|
1969 debug_ungcpro(__FILE__, __LINE__,&gcpro1)
|
|
1970
|
|
1971 #define NGCPRO1(v) \
|
|
1972 debug_gcpro1 (__FILE__, __LINE__,&ngcpro1,&v)
|
|
1973 #define NGCPRO2(v1,v2) \
|
|
1974 debug_gcpro2 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&v1,&v2)
|
|
1975 #define NGCPRO3(v1,v2,v3) \
|
|
1976 debug_gcpro3 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&v1,&v2,&v3)
|
|
1977 #define NGCPRO4(v1,v2,v3,v4) \
|
|
1978 debug_gcpro4 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,\
|
|
1979 &v1,&v2,&v3,&v4)
|
|
1980 #define NGCPRO5(v1,v2,v3,v4,v5) \
|
|
1981 debug_gcpro5 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,\
|
|
1982 &ngcpro5,&v1,&v2,&v3,&v4,&v5)
|
|
1983 #define NUNGCPRO \
|
|
1984 debug_ungcpro(__FILE__, __LINE__,&ngcpro1)
|
|
1985
|
|
1986 #define NNGCPRO1(v) \
|
|
1987 debug_gcpro1 (__FILE__, __LINE__,&nngcpro1,&v)
|
|
1988 #define NNGCPRO2(v1,v2) \
|
|
1989 debug_gcpro2 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&v1,&v2)
|
|
1990 #define NNGCPRO3(v1,v2,v3) \
|
|
1991 debug_gcpro3 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&v1,&v2,&v3)
|
|
1992 #define NNGCPRO4(v1,v2,v3,v4) \
|
|
1993 debug_gcpro4 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,\
|
|
1994 &v1,&v2,&v3,&v4)
|
|
1995 #define NNGCPRO5(v1,v2,v3,v4,v5) \
|
|
1996 debug_gcpro5 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,\
|
|
1997 &nngcpro5,&v1,&v2,&v3,&v4,&v5)
|
|
1998 #define NNUNGCPRO \
|
|
1999 debug_ungcpro(__FILE__, __LINE__,&nngcpro1)
|
|
2000
|
|
2001 #else /* ! DEBUG_GCPRO */
|
|
2002
|
|
2003 #define GCPRO1(var1) ((void) ( \
|
|
2004 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
|
|
2005 gcprolist = &gcpro1 ))
|
|
2006
|
|
2007 #define GCPRO2(var1, var2) ((void) ( \
|
|
2008 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
|
|
2009 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
|
|
2010 gcprolist = &gcpro2 ))
|
|
2011
|
|
2012 #define GCPRO3(var1, var2, var3) ((void) ( \
|
|
2013 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
|
|
2014 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
|
|
2015 gcpro3.next = &gcpro2, gcpro3.var = &var3, gcpro3.nvars = 1, \
|
|
2016 gcprolist = &gcpro3 ))
|
|
2017
|
|
2018 #define GCPRO4(var1, var2, var3, var4) ((void) ( \
|
|
2019 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
|
|
2020 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
|
|
2021 gcpro3.next = &gcpro2, gcpro3.var = &var3, gcpro3.nvars = 1, \
|
|
2022 gcpro4.next = &gcpro3, gcpro4.var = &var4, gcpro4.nvars = 1, \
|
|
2023 gcprolist = &gcpro4 ))
|
|
2024
|
|
2025 #define GCPRO5(var1, var2, var3, var4, var5) ((void) ( \
|
|
2026 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
|
|
2027 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
|
|
2028 gcpro3.next = &gcpro2, gcpro3.var = &var3, gcpro3.nvars = 1, \
|
|
2029 gcpro4.next = &gcpro3, gcpro4.var = &var4, gcpro4.nvars = 1, \
|
|
2030 gcpro5.next = &gcpro4, gcpro5.var = &var5, gcpro5.nvars = 1, \
|
|
2031 gcprolist = &gcpro5 ))
|
|
2032
|
|
2033 #define UNGCPRO ((void) (gcprolist = gcpro1.next))
|
|
2034
|
|
2035 #define NGCPRO1(var1) ((void) ( \
|
|
2036 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
|
|
2037 gcprolist = &ngcpro1 ))
|
|
2038
|
|
2039 #define NGCPRO2(var1, var2) ((void) ( \
|
|
2040 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
|
|
2041 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
|
|
2042 gcprolist = &ngcpro2 ))
|
|
2043
|
|
2044 #define NGCPRO3(var1, var2, var3) ((void) ( \
|
|
2045 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
|
|
2046 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
|
|
2047 ngcpro3.next = &ngcpro2, ngcpro3.var = &var3, ngcpro3.nvars = 1, \
|
|
2048 gcprolist = &ngcpro3 ))
|
|
2049
|
|
2050 #define NGCPRO4(var1, var2, var3, var4) ((void) ( \
|
|
2051 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
|
|
2052 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
|
|
2053 ngcpro3.next = &ngcpro2, ngcpro3.var = &var3, ngcpro3.nvars = 1, \
|
|
2054 ngcpro4.next = &ngcpro3, ngcpro4.var = &var4, ngcpro4.nvars = 1, \
|
|
2055 gcprolist = &ngcpro4 ))
|
|
2056
|
|
2057 #define NGCPRO5(var1, var2, var3, var4, var5) ((void) ( \
|
|
2058 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
|
|
2059 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
|
|
2060 ngcpro3.next = &ngcpro2, ngcpro3.var = &var3, ngcpro3.nvars = 1, \
|
|
2061 ngcpro4.next = &ngcpro3, ngcpro4.var = &var4, ngcpro4.nvars = 1, \
|
|
2062 ngcpro5.next = &ngcpro4, ngcpro5.var = &var5, ngcpro5.nvars = 1, \
|
|
2063 gcprolist = &ngcpro5 ))
|
|
2064
|
|
2065 #define NUNGCPRO ((void) (gcprolist = ngcpro1.next))
|
|
2066
|
|
2067 #define NNGCPRO1(var1) ((void) ( \
|
|
2068 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
|
|
2069 gcprolist = &nngcpro1 ))
|
|
2070
|
|
2071 #define NNGCPRO2(var1, var2) ((void) ( \
|
|
2072 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
|
|
2073 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
|
|
2074 gcprolist = &nngcpro2 ))
|
|
2075
|
|
2076 #define NNGCPRO3(var1, var2, var3) ((void) ( \
|
|
2077 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
|
|
2078 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
|
|
2079 nngcpro3.next = &nngcpro2, nngcpro3.var = &var3, nngcpro3.nvars = 1, \
|
|
2080 gcprolist = &nngcpro3 ))
|
|
2081
|
|
2082 #define NNGCPRO4(var1, var2, var3, var4) ((void) ( \
|
|
2083 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
|
|
2084 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
|
|
2085 nngcpro3.next = &nngcpro2, nngcpro3.var = &var3, nngcpro3.nvars = 1, \
|
|
2086 nngcpro4.next = &nngcpro3, nngcpro4.var = &var4, nngcpro4.nvars = 1, \
|
|
2087 gcprolist = &nngcpro4 ))
|
|
2088
|
|
2089 #define NNGCPRO5(var1, var2, var3, var4, var5) ((void) ( \
|
|
2090 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
|
|
2091 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
|
|
2092 nngcpro3.next = &nngcpro2, nngcpro3.var = &var3, nngcpro3.nvars = 1, \
|
|
2093 nngcpro4.next = &nngcpro3, nngcpro4.var = &var4, nngcpro4.nvars = 1, \
|
|
2094 nngcpro5.next = &nngcpro4, nngcpro5.var = &var5, nngcpro5.nvars = 1, \
|
|
2095 gcprolist = &nngcpro5 ))
|
|
2096
|
|
2097 #define NNUNGCPRO ((void) (gcprolist = nngcpro1.next))
|
|
2098
|
|
2099 #endif /* ! DEBUG_GCPRO */
|
|
2100
|
|
2101 /* Another try to fix SunPro C compiler warnings */
|
|
2102 /* "end-of-loop code not reached" */
|
|
2103 /* "statement not reached */
|
442
|
2104 #if defined __SUNPRO_C || defined __USLC__
|
428
|
2105 #define RETURN_SANS_WARNINGS if (1) return
|
|
2106 #define RETURN_NOT_REACHED(value)
|
|
2107 #else
|
|
2108 #define RETURN_SANS_WARNINGS return
|
|
2109 #define RETURN_NOT_REACHED(value) return value;
|
|
2110 #endif
|
|
2111
|
|
2112 /* Evaluate expr, UNGCPRO, and then return the value of expr. */
|
|
2113 #define RETURN_UNGCPRO(expr) do \
|
|
2114 { \
|
|
2115 Lisp_Object ret_ungc_val = (expr); \
|
|
2116 UNGCPRO; \
|
|
2117 RETURN_SANS_WARNINGS ret_ungc_val; \
|
|
2118 } while (0)
|
|
2119
|
|
2120 /* Evaluate expr, NUNGCPRO, UNGCPRO, and then return the value of expr. */
|
|
2121 #define RETURN_NUNGCPRO(expr) do \
|
|
2122 { \
|
|
2123 Lisp_Object ret_ungc_val = (expr); \
|
|
2124 NUNGCPRO; \
|
|
2125 UNGCPRO; \
|
|
2126 RETURN_SANS_WARNINGS ret_ungc_val; \
|
|
2127 } while (0)
|
|
2128
|
|
2129 /* Evaluate expr, NNUNGCPRO, NUNGCPRO, UNGCPRO, and then return the
|
|
2130 value of expr. */
|
|
2131 #define RETURN_NNUNGCPRO(expr) do \
|
|
2132 { \
|
|
2133 Lisp_Object ret_ungc_val = (expr); \
|
|
2134 NNUNGCPRO; \
|
|
2135 NUNGCPRO; \
|
|
2136 UNGCPRO; \
|
|
2137 RETURN_SANS_WARNINGS ret_ungc_val; \
|
|
2138 } while (0)
|
|
2139
|
|
2140 /* Evaluate expr, return it if it's not Qunbound. */
|
|
2141 #define RETURN_IF_NOT_UNBOUND(expr) do \
|
|
2142 { \
|
|
2143 Lisp_Object ret_nunb_val = (expr); \
|
|
2144 if (!UNBOUNDP (ret_nunb_val)) \
|
|
2145 RETURN_SANS_WARNINGS ret_nunb_val; \
|
|
2146 } while (0)
|
|
2147
|
452
|
2148 extern Lisp_Object_ptr_dynarr *staticpros;
|
|
2149
|
428
|
2150 /* Call staticpro (&var) to protect static variable `var'. */
|
|
2151 void staticpro (Lisp_Object *);
|
|
2152
|
|
2153 /* Call staticpro_nodump (&var) to protect static variable `var'. */
|
|
2154 /* var will not be saved at dump time */
|
|
2155 void staticpro_nodump (Lisp_Object *);
|
|
2156
|
458
|
2157 /* dump_add_root_struct_ptr (&var, &desc) dumps the structure pointed to by `var'. */
|
452
|
2158 #ifdef PDUMP
|
|
2159 void dump_add_root_struct_ptr (void *, const struct struct_description *);
|
|
2160 #else
|
|
2161 #define dump_add_root_struct_ptr(varaddr,descaddr) DO_NOTHING
|
|
2162 #endif
|
|
2163
|
458
|
2164 /* dump_add_opaque (&var, size) dumps the opaque static structure `var'. */
|
452
|
2165 #ifdef PDUMP
|
|
2166 void dump_add_opaque (void *, size_t);
|
|
2167 #else
|
|
2168 #define dump_add_opaque(varaddr,size) DO_NOTHING
|
|
2169 #endif
|
|
2170
|
458
|
2171 /* Call dump_add_opaque_int (&int_var) to dump `int_var', of type `int'. */
|
|
2172 #ifdef PDUMP
|
|
2173 #define dump_add_opaque_int(int_varaddr) do { \
|
|
2174 int *dao_ = (int_varaddr); /* type check */ \
|
|
2175 dump_add_opaque (dao_, sizeof (*dao_)); \
|
|
2176 } while (0)
|
|
2177 #else
|
|
2178 #define dump_add_opaque_int(int_varaddr) DO_NOTHING
|
|
2179 #endif
|
|
2180
|
|
2181 /* Call dump_add_opaque_fixnum (&fixnum_var) to dump `fixnum_var', of type `Fixnum'. */
|
|
2182 #ifdef PDUMP
|
|
2183 #define dump_add_opaque_fixnum(fixnum_varaddr) do { \
|
|
2184 Fixnum *dao_ = (fixnum_varaddr); /* type check */ \
|
|
2185 dump_add_opaque (dao_, sizeof (*dao_)); \
|
|
2186 } while (0)
|
|
2187 #else
|
|
2188 #define dump_add_opaque_fixnum(fixnum_varaddr) DO_NOTHING
|
|
2189 #endif
|
|
2190
|
452
|
2191 /* Call dump_add_root_object (&var) to ensure that var is properly updated after pdump. */
|
|
2192 #ifdef PDUMP
|
|
2193 void dump_add_root_object (Lisp_Object *);
|
|
2194 #else
|
|
2195 #define dump_add_root_object(varaddr) DO_NOTHING
|
|
2196 #endif
|
|
2197
|
|
2198 /* Call dump_add_root_object (&var) to ensure that var is properly updated after
|
|
2199 pdump. var must point to a linked list of objects out of which
|
428
|
2200 some may not be dumped */
|
452
|
2201 #ifdef PDUMP
|
|
2202 void dump_add_weak_object_chain (Lisp_Object *);
|
|
2203 #else
|
|
2204 #define dump_add_weak_object_chain(varaddr) DO_NOTHING
|
|
2205 #endif
|
428
|
2206
|
|
2207 /* Nonzero means Emacs has already been initialized.
|
|
2208 Used during startup to detect startup of dumped Emacs. */
|
|
2209 extern int initialized;
|
|
2210
|
|
2211 #ifdef MEMORY_USAGE_STATS
|
|
2212
|
|
2213 /* This structure is used to keep statistics on the amount of memory
|
|
2214 in use.
|
|
2215
|
|
2216 WAS_REQUESTED stores the actual amount of memory that was requested
|
|
2217 of the allocation function. The *_OVERHEAD fields store the
|
|
2218 additional amount of memory that was grabbed by the functions to
|
|
2219 facilitate allocation, reallocation, etc. MALLOC_OVERHEAD is for
|
|
2220 memory allocated with malloc(); DYNARR_OVERHEAD is for dynamic
|
|
2221 arrays; GAP_OVERHEAD is for gap arrays. Note that for (e.g.)
|
|
2222 dynamic arrays, there is both MALLOC_OVERHEAD and DYNARR_OVERHEAD
|
|
2223 memory: The dynamic array allocates memory above and beyond what
|
|
2224 was asked of it, and when it in turns allocates memory using
|
|
2225 malloc(), malloc() allocates memory beyond what it was asked
|
|
2226 to allocate.
|
|
2227
|
|
2228 Functions that accept a structure of this sort do not initialize
|
|
2229 the fields to 0, and add any existing values to whatever was there
|
|
2230 before; this way, you can get a cumulative effect. */
|
|
2231
|
|
2232 struct overhead_stats
|
|
2233 {
|
|
2234 int was_requested;
|
|
2235 int malloc_overhead;
|
|
2236 int dynarr_overhead;
|
|
2237 int gap_overhead;
|
|
2238 };
|
|
2239
|
|
2240 #endif /* MEMORY_USAGE_STATS */
|
|
2241
|
|
2242 #ifndef DIRECTORY_SEP
|
|
2243 #define DIRECTORY_SEP '/'
|
|
2244 #endif
|
|
2245 #ifndef IS_DIRECTORY_SEP
|
|
2246 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP)
|
|
2247 #endif
|
|
2248 #ifndef IS_DEVICE_SEP
|
|
2249 #ifndef DEVICE_SEP
|
|
2250 #define IS_DEVICE_SEP(c) 0
|
|
2251 #else
|
|
2252 #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP)
|
|
2253 #endif
|
|
2254 #endif
|
|
2255 #ifndef IS_ANY_SEP
|
|
2256 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c)
|
|
2257 #endif
|
|
2258
|
|
2259 #ifdef HAVE_INTTYPES_H
|
|
2260 #include <inttypes.h>
|
|
2261 #elif SIZEOF_VOID_P == SIZEOF_INT
|
|
2262 typedef int intptr_t;
|
|
2263 typedef unsigned int uintptr_t;
|
|
2264 #elif SIZEOF_VOID_P == SIZEOF_LONG
|
|
2265 typedef long intptr_t;
|
|
2266 typedef unsigned long uintptr_t;
|
|
2267 #elif defined(SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG
|
|
2268 typedef long long intptr_t;
|
|
2269 typedef unsigned long long uintptr_t;
|
|
2270 #else
|
|
2271 /* Just pray. May break, may not. */
|
|
2272 typedef long intptr_t;
|
|
2273 typedef unsigned long uintptr_t;
|
|
2274 #endif
|
|
2275
|
442
|
2276
|
|
2277 /************************************************************************/
|
|
2278 /* prototypes */
|
|
2279 /************************************************************************/
|
|
2280
|
|
2281 /* NOTE: Prototypes should go HERE, not in various header files, unless
|
|
2282 they specifically reference a type that's not defined in lisp.h.
|
|
2283 (And even then, you might consider adding the type to lisp.h.)
|
|
2284
|
|
2285 The idea is that header files typically contain the innards of objects,
|
|
2286 and we want to minimize the number of "dependencies" of one file on
|
|
2287 the specifics of such objects. Putting prototypes here minimizes the
|
|
2288 number of header files that need to be included -- good for a number
|
|
2289 of reasons. --ben */
|
|
2290
|
|
2291 /*--------------- prototypes for various public c functions ------------*/
|
|
2292
|
|
2293 /* Prototypes for all init/syms_of/vars_of initialization functions. */
|
|
2294 #include "symsinit.h"
|
|
2295
|
428
|
2296 /* Defined in alloc.c */
|
|
2297 void release_breathing_space (void);
|
|
2298 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object);
|
|
2299 Lisp_Object make_vector (size_t, Lisp_Object);
|
|
2300 Lisp_Object vector1 (Lisp_Object);
|
|
2301 Lisp_Object vector2 (Lisp_Object, Lisp_Object);
|
|
2302 Lisp_Object vector3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2303 Lisp_Object make_bit_vector (size_t, Lisp_Object);
|
|
2304 Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, size_t);
|
|
2305 Lisp_Object noseeum_make_marker (void);
|
|
2306 void garbage_collect_1 (void);
|
|
2307 Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2308 Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2309 Lisp_Object list1 (Lisp_Object);
|
|
2310 Lisp_Object list2 (Lisp_Object, Lisp_Object);
|
|
2311 Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2312 Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2313 Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2314 Lisp_Object);
|
|
2315 Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2316 Lisp_Object, Lisp_Object);
|
|
2317 DECLARE_DOESNT_RETURN (memory_full (void));
|
|
2318 void disksave_object_finalization (void);
|
|
2319 extern int purify_flag;
|
|
2320 extern int gc_currently_forbidden;
|
|
2321 Lisp_Object restore_gc_inhibit (Lisp_Object);
|
|
2322 extern EMACS_INT gc_generation_number[1];
|
|
2323 int c_readonly (Lisp_Object);
|
|
2324 int lisp_readonly (Lisp_Object);
|
442
|
2325 Lisp_Object build_string (const char *);
|
|
2326 Lisp_Object build_ext_string (const char *, Lisp_Object);
|
|
2327 Lisp_Object build_translated_string (const char *);
|
|
2328 Lisp_Object make_string (const Bufbyte *, Bytecount);
|
|
2329 Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object);
|
428
|
2330 Lisp_Object make_uninit_string (Bytecount);
|
|
2331 Lisp_Object make_float (double);
|
442
|
2332 Lisp_Object make_string_nocopy (const Bufbyte *, Bytecount);
|
428
|
2333 void free_cons (Lisp_Cons *);
|
|
2334 void free_list (Lisp_Object);
|
|
2335 void free_alist (Lisp_Object);
|
|
2336 void mark_conses_in_list (Lisp_Object);
|
|
2337 void free_marker (Lisp_Marker *);
|
|
2338 int object_dead_p (Lisp_Object);
|
|
2339 void mark_object (Lisp_Object obj);
|
|
2340 int marked_p (Lisp_Object obj);
|
|
2341
|
|
2342 #ifdef MEMORY_USAGE_STATS
|
|
2343 size_t malloced_storage_size (void *, size_t, struct overhead_stats *);
|
|
2344 size_t fixed_type_block_overhead (size_t);
|
|
2345 #endif
|
|
2346 #ifdef PDUMP
|
|
2347 void pdump (void);
|
442
|
2348 int pdump_load (const char *);
|
428
|
2349
|
|
2350 extern char *pdump_start, *pdump_end;
|
|
2351 #define DUMPEDP(adr) ((((char *)(adr)) < pdump_end) && (((char *)(adr)) >= pdump_start))
|
|
2352 #else
|
|
2353 #define DUMPEDP(adr) 0
|
|
2354 #endif
|
|
2355
|
|
2356 /* Defined in buffer.c */
|
|
2357 Lisp_Object make_buffer (struct buffer *);
|
|
2358 Lisp_Object get_truename_buffer (Lisp_Object);
|
|
2359 void switch_to_buffer (Lisp_Object, Lisp_Object);
|
|
2360 extern int find_file_compare_truenames;
|
|
2361 extern int find_file_use_truenames;
|
|
2362
|
|
2363 /* Defined in callproc.c */
|
442
|
2364 char *egetenv (const char *);
|
428
|
2365
|
|
2366 /* Defined in console.c */
|
|
2367 void stuff_buffered_input (Lisp_Object);
|
|
2368
|
442
|
2369 /* Defined in console-msw.c */
|
|
2370 EXFUN (Fmswindows_message_box, 3);
|
|
2371 extern int mswindows_message_outputted;
|
|
2372
|
428
|
2373 /* Defined in data.c */
|
|
2374 DECLARE_DOESNT_RETURN (c_write_error (Lisp_Object));
|
|
2375 DECLARE_DOESNT_RETURN (lisp_write_error (Lisp_Object));
|
|
2376 DECLARE_DOESNT_RETURN (args_out_of_range (Lisp_Object, Lisp_Object));
|
|
2377 DECLARE_DOESNT_RETURN (args_out_of_range_3 (Lisp_Object, Lisp_Object,
|
|
2378 Lisp_Object));
|
|
2379 Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
|
|
2380 DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object));
|
|
2381 void check_int_range (EMACS_INT, EMACS_INT, EMACS_INT);
|
|
2382
|
|
2383 enum arith_comparison {
|
|
2384 arith_equal,
|
|
2385 arith_notequal,
|
|
2386 arith_less,
|
|
2387 arith_grtr,
|
|
2388 arith_less_or_equal,
|
|
2389 arith_grtr_or_equal };
|
|
2390 Lisp_Object arithcompare (Lisp_Object, Lisp_Object, enum arith_comparison);
|
|
2391
|
|
2392 Lisp_Object word_to_lisp (unsigned int);
|
|
2393 unsigned int lisp_to_word (Lisp_Object);
|
|
2394
|
|
2395 /* Defined in dired.c */
|
442
|
2396 Lisp_Object make_directory_hash_table (const char *);
|
428
|
2397 Lisp_Object wasteful_word_to_lisp (unsigned int);
|
|
2398
|
|
2399 /* Defined in doc.c */
|
|
2400 Lisp_Object unparesseuxify_doc_string (int, EMACS_INT, char *, Lisp_Object);
|
|
2401 Lisp_Object read_doc_string (Lisp_Object);
|
|
2402
|
|
2403 /* Defined in doprnt.c */
|
442
|
2404 Bytecount emacs_doprnt_c (Lisp_Object, const Bufbyte *, Lisp_Object,
|
428
|
2405 Bytecount, ...);
|
442
|
2406 Bytecount emacs_doprnt_va (Lisp_Object, const Bufbyte *, Lisp_Object,
|
428
|
2407 Bytecount, va_list);
|
442
|
2408 Bytecount emacs_doprnt_lisp (Lisp_Object, const Bufbyte *, Lisp_Object,
|
|
2409 Bytecount, int, const Lisp_Object *);
|
|
2410 Bytecount emacs_doprnt_lisp_2 (Lisp_Object, const Bufbyte *, Lisp_Object,
|
428
|
2411 Bytecount, int, ...);
|
442
|
2412 Lisp_Object emacs_doprnt_string_c (const Bufbyte *, Lisp_Object,
|
428
|
2413 Bytecount, ...);
|
442
|
2414 Lisp_Object emacs_doprnt_string_va (const Bufbyte *, Lisp_Object,
|
428
|
2415 Bytecount, va_list);
|
442
|
2416 Lisp_Object emacs_doprnt_string_lisp (const Bufbyte *, Lisp_Object,
|
|
2417 Bytecount, int, const Lisp_Object *);
|
|
2418 Lisp_Object emacs_doprnt_string_lisp_2 (const Bufbyte *, Lisp_Object,
|
428
|
2419 Bytecount, int, ...);
|
|
2420
|
|
2421 /* Defined in editfns.c */
|
|
2422 void uncache_home_directory (void);
|
440
|
2423 Extbyte *get_home_directory (void);
|
428
|
2424 char *user_login_name (uid_t *);
|
|
2425 Bufpos bufpos_clip_to_bounds (Bufpos, Bufpos, Bufpos);
|
|
2426 Bytind bytind_clip_to_bounds (Bytind, Bytind, Bytind);
|
|
2427 void buffer_insert1 (struct buffer *, Lisp_Object);
|
|
2428 Lisp_Object make_string_from_buffer (struct buffer *, Bufpos, Charcount);
|
|
2429 Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Bufpos, Charcount);
|
|
2430 Lisp_Object save_excursion_save (void);
|
|
2431 Lisp_Object save_restriction_save (void);
|
|
2432 Lisp_Object save_excursion_restore (Lisp_Object);
|
|
2433 Lisp_Object save_restriction_restore (Lisp_Object);
|
|
2434
|
|
2435 /* Defined in emacsfns.c */
|
|
2436 Lisp_Object save_current_buffer_restore (Lisp_Object);
|
|
2437
|
|
2438 /* Defined in emacs.c */
|
442
|
2439 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (fatal (const char *,
|
428
|
2440 ...), 1, 2);
|
442
|
2441 int stderr_out (const char *, ...) PRINTF_ARGS (1, 2);
|
|
2442 int stdout_out (const char *, ...) PRINTF_ARGS (1, 2);
|
428
|
2443 SIGTYPE fatal_error_signal (int);
|
442
|
2444 Lisp_Object make_arg_list (int, Extbyte **);
|
|
2445 void make_argc_argv (Lisp_Object, int *, Extbyte ***);
|
|
2446 void free_argc_argv (Extbyte **);
|
|
2447 Lisp_Object decode_env_path (const char *, const char *);
|
|
2448 Lisp_Object decode_path (const char *);
|
428
|
2449 /* Nonzero means don't do interactive redisplay and don't change tty modes */
|
442
|
2450 extern int noninteractive, noninteractive1;
|
|
2451 extern int fatal_error_in_progress;
|
428
|
2452 extern int preparing_for_armageddon;
|
458
|
2453 extern Fixnum emacs_priority;
|
428
|
2454 extern int running_asynch_code;
|
|
2455 extern int suppress_early_error_handler_backtrace;
|
|
2456
|
|
2457 /* Defined in eval.c */
|
|
2458 DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, Lisp_Object));
|
442
|
2459 void maybe_signal_error (Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2460 Error_behavior);
|
428
|
2461 Lisp_Object maybe_signal_continuable_error (Lisp_Object, Lisp_Object,
|
|
2462 Lisp_Object, Error_behavior);
|
442
|
2463 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (type_error (Lisp_Object,
|
|
2464 const char *,
|
|
2465 ...), 2, 3);
|
|
2466 void maybe_type_error (Lisp_Object, Lisp_Object, Error_behavior, const char *,
|
|
2467 ...) PRINTF_ARGS (4, 5);
|
|
2468 Lisp_Object continuable_type_error (Lisp_Object, const char *, ...)
|
|
2469 PRINTF_ARGS (2, 3);
|
|
2470 Lisp_Object maybe_continuable_type_error (Lisp_Object, Lisp_Object,
|
|
2471 Error_behavior,
|
|
2472 const char *, ...)
|
|
2473 PRINTF_ARGS (4, 5);
|
|
2474 DECLARE_DOESNT_RETURN (signal_type_error (Lisp_Object, const char *,
|
|
2475 Lisp_Object));
|
|
2476 void maybe_signal_type_error (Lisp_Object, const char *, Lisp_Object,
|
|
2477 Lisp_Object, Error_behavior);
|
|
2478 Lisp_Object signal_type_continuable_error (Lisp_Object, const char *,
|
|
2479 Lisp_Object);
|
|
2480 Lisp_Object maybe_signal_type_continuable_error (Lisp_Object, const char *,
|
|
2481 Lisp_Object,
|
|
2482 Lisp_Object, Error_behavior);
|
|
2483 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (type_error_with_frob
|
|
2484 (Lisp_Object, Lisp_Object,
|
|
2485 const char *,
|
|
2486 ...), 3, 4);
|
|
2487 void maybe_type_error_with_frob (Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2488 Error_behavior,
|
|
2489 const char *, ...) PRINTF_ARGS (5, 6);
|
|
2490 Lisp_Object continuable_type_error_with_frob (Lisp_Object, Lisp_Object,
|
|
2491 const char *,
|
|
2492 ...) PRINTF_ARGS (3, 4);
|
|
2493 Lisp_Object maybe_continuable_type_error_with_frob
|
|
2494 (Lisp_Object, Lisp_Object, Lisp_Object, Error_behavior, const char *, ...)
|
|
2495 PRINTF_ARGS (5, 6);
|
|
2496 DECLARE_DOESNT_RETURN (signal_type_error_2 (Lisp_Object, const char *,
|
|
2497 Lisp_Object, Lisp_Object));
|
|
2498 void maybe_signal_type_error_2 (Lisp_Object, const char *, Lisp_Object,
|
|
2499 Lisp_Object, Lisp_Object, Error_behavior);
|
|
2500 Lisp_Object signal_type_continuable_error_2 (Lisp_Object, const char *,
|
|
2501 Lisp_Object, Lisp_Object);
|
|
2502 Lisp_Object maybe_signal_type_continuable_error_2 (Lisp_Object, const char *,
|
|
2503 Lisp_Object, Lisp_Object,
|
|
2504 Lisp_Object,
|
|
2505 Error_behavior);
|
|
2506 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (error (const char *,
|
428
|
2507 ...), 1, 2);
|
442
|
2508 void maybe_error (Lisp_Object, Error_behavior, const char *,
|
428
|
2509 ...) PRINTF_ARGS (3, 4);
|
442
|
2510 Lisp_Object continuable_error (const char *, ...) PRINTF_ARGS (1, 2);
|
428
|
2511 Lisp_Object maybe_continuable_error (Lisp_Object, Error_behavior,
|
442
|
2512 const char *, ...) PRINTF_ARGS (3, 4);
|
|
2513 DECLARE_DOESNT_RETURN (signal_simple_error (const char *, Lisp_Object));
|
|
2514 void maybe_signal_simple_error (const char *, Lisp_Object,
|
428
|
2515 Lisp_Object, Error_behavior);
|
442
|
2516 Lisp_Object signal_simple_continuable_error (const char *, Lisp_Object);
|
|
2517 Lisp_Object maybe_signal_simple_continuable_error (const char *, Lisp_Object,
|
428
|
2518 Lisp_Object, Error_behavior);
|
|
2519 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (error_with_frob
|
442
|
2520 (Lisp_Object, const char *,
|
428
|
2521 ...), 2, 3);
|
|
2522 void maybe_error_with_frob (Lisp_Object, Lisp_Object, Error_behavior,
|
442
|
2523 const char *, ...) PRINTF_ARGS (4, 5);
|
|
2524 Lisp_Object continuable_error_with_frob (Lisp_Object, const char *,
|
428
|
2525 ...) PRINTF_ARGS (2, 3);
|
|
2526 Lisp_Object maybe_continuable_error_with_frob
|
442
|
2527 (Lisp_Object, Lisp_Object, Error_behavior, const char *, ...) PRINTF_ARGS (4, 5);
|
|
2528 DECLARE_DOESNT_RETURN (signal_simple_error_2 (const char *,
|
428
|
2529 Lisp_Object, Lisp_Object));
|
442
|
2530 void maybe_signal_simple_error_2 (const char *, Lisp_Object, Lisp_Object,
|
428
|
2531 Lisp_Object, Error_behavior);
|
442
|
2532 Lisp_Object signal_simple_continuable_error_2 (const char *,
|
428
|
2533 Lisp_Object, Lisp_Object);
|
442
|
2534 Lisp_Object maybe_signal_simple_continuable_error_2 (const char *, Lisp_Object,
|
428
|
2535 Lisp_Object, Lisp_Object,
|
|
2536 Error_behavior);
|
436
|
2537 DECLARE_DOESNT_RETURN (signal_malformed_list_error (Lisp_Object));
|
|
2538 DECLARE_DOESNT_RETURN (signal_malformed_property_list_error (Lisp_Object));
|
|
2539 DECLARE_DOESNT_RETURN (signal_circular_list_error (Lisp_Object));
|
|
2540 DECLARE_DOESNT_RETURN (signal_circular_property_list_error (Lisp_Object));
|
|
2541
|
442
|
2542 DECLARE_DOESNT_RETURN (syntax_error (const char *reason, Lisp_Object frob));
|
|
2543 DECLARE_DOESNT_RETURN (syntax_error_2 (const char *reason, Lisp_Object frob1,
|
|
2544 Lisp_Object frob2));
|
|
2545 DECLARE_DOESNT_RETURN (invalid_argument (const char *reason,
|
|
2546 Lisp_Object frob));
|
|
2547 DECLARE_DOESNT_RETURN (invalid_argument_2 (const char *reason,
|
|
2548 Lisp_Object frob1,
|
|
2549 Lisp_Object frob2));
|
|
2550 DECLARE_DOESNT_RETURN (invalid_operation (const char *reason,
|
|
2551 Lisp_Object frob));
|
|
2552 DECLARE_DOESNT_RETURN (invalid_operation_2 (const char *reason,
|
|
2553 Lisp_Object frob1,
|
|
2554 Lisp_Object frob2));
|
|
2555 DECLARE_DOESNT_RETURN (invalid_change (const char *reason,
|
|
2556 Lisp_Object frob));
|
|
2557 DECLARE_DOESNT_RETURN (invalid_change_2 (const char *reason,
|
|
2558 Lisp_Object frob1,
|
|
2559 Lisp_Object frob2));
|
|
2560
|
436
|
2561 Lisp_Object signal_void_function_error (Lisp_Object);
|
|
2562 Lisp_Object signal_invalid_function_error (Lisp_Object);
|
|
2563 Lisp_Object signal_wrong_number_of_arguments_error (Lisp_Object, int);
|
|
2564
|
428
|
2565 Lisp_Object run_hook_with_args_in_buffer (struct buffer *, int, Lisp_Object *,
|
|
2566 enum run_hooks_condition);
|
|
2567 Lisp_Object run_hook_with_args (int, Lisp_Object *, enum run_hooks_condition);
|
|
2568 void va_run_hook_with_args (Lisp_Object, int, ...);
|
|
2569 void va_run_hook_with_args_in_buffer (struct buffer *, Lisp_Object, int, ...);
|
|
2570 Lisp_Object run_hook (Lisp_Object);
|
|
2571 Lisp_Object apply1 (Lisp_Object, Lisp_Object);
|
|
2572 Lisp_Object call0 (Lisp_Object);
|
|
2573 Lisp_Object call1 (Lisp_Object, Lisp_Object);
|
|
2574 Lisp_Object call2 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2575 Lisp_Object call3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2576 Lisp_Object call4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2577 Lisp_Object);
|
|
2578 Lisp_Object call5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2579 Lisp_Object, Lisp_Object);
|
|
2580 Lisp_Object call6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2581 Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2582 Lisp_Object call7 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2583 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2584 Lisp_Object call8 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2585 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2586 Lisp_Object);
|
|
2587 Lisp_Object call0_in_buffer (struct buffer *, Lisp_Object);
|
|
2588 Lisp_Object call1_in_buffer (struct buffer *, Lisp_Object, Lisp_Object);
|
|
2589 Lisp_Object call2_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
|
|
2590 Lisp_Object);
|
|
2591 Lisp_Object call3_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
|
|
2592 Lisp_Object, Lisp_Object);
|
|
2593 Lisp_Object call4_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
|
|
2594 Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2595 Lisp_Object call5_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
|
|
2596 Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2597 Lisp_Object);
|
|
2598 Lisp_Object call6_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
|
|
2599 Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2600 Lisp_Object, Lisp_Object);
|
|
2601 Lisp_Object eval_in_buffer (struct buffer *, Lisp_Object);
|
|
2602 Lisp_Object call0_with_handler (Lisp_Object, Lisp_Object);
|
|
2603 Lisp_Object call1_with_handler (Lisp_Object, Lisp_Object, Lisp_Object);
|
442
|
2604 Lisp_Object eval_in_buffer_trapping_errors (const char *, struct buffer *,
|
428
|
2605 Lisp_Object);
|
442
|
2606 Lisp_Object run_hook_trapping_errors (const char *, Lisp_Object);
|
|
2607 Lisp_Object safe_run_hook_trapping_errors (const char *, Lisp_Object, int);
|
|
2608 Lisp_Object call0_trapping_errors (const char *, Lisp_Object);
|
|
2609 Lisp_Object call1_trapping_errors (const char *, Lisp_Object, Lisp_Object);
|
|
2610 Lisp_Object call2_trapping_errors (const char *,
|
428
|
2611 Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2612 Lisp_Object call_with_suspended_errors (lisp_fn_t, volatile Lisp_Object, Lisp_Object,
|
|
2613 Error_behavior, int, ...);
|
|
2614 /* C Code should be using internal_catch, record_unwind_p, condition_case_1 */
|
|
2615 Lisp_Object internal_catch (Lisp_Object, Lisp_Object (*) (Lisp_Object),
|
|
2616 Lisp_Object, int * volatile);
|
|
2617 Lisp_Object condition_case_1 (Lisp_Object,
|
|
2618 Lisp_Object (*) (Lisp_Object),
|
|
2619 Lisp_Object,
|
|
2620 Lisp_Object (*) (Lisp_Object, Lisp_Object),
|
|
2621 Lisp_Object);
|
|
2622 Lisp_Object condition_case_3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2623 Lisp_Object unbind_to (int, Lisp_Object);
|
|
2624 void specbind (Lisp_Object, Lisp_Object);
|
|
2625 void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
|
|
2626 void do_autoload (Lisp_Object, Lisp_Object);
|
|
2627 Lisp_Object un_autoload (Lisp_Object);
|
|
2628 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);
|
442
|
2629 void warn_when_safe (Lisp_Object, Lisp_Object, const char *,
|
428
|
2630 ...) PRINTF_ARGS (3, 4);
|
|
2631
|
|
2632
|
|
2633 /* Defined in event-stream.c */
|
|
2634 void wait_delaying_user_input (int (*) (void *), void *);
|
|
2635 int detect_input_pending (void);
|
|
2636 void reset_this_command_keys (Lisp_Object, int);
|
|
2637 Lisp_Object enqueue_misc_user_event (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2638 Lisp_Object enqueue_misc_user_event_pos (Lisp_Object, Lisp_Object,
|
|
2639 Lisp_Object, int, int, int, int);
|
442
|
2640 extern int modifier_keys_are_sticky;
|
428
|
2641
|
|
2642 /* Defined in event-Xt.c */
|
442
|
2643 void enqueue_Xt_dispatch_event (Lisp_Object event);
|
428
|
2644 void signal_special_Xt_user_event (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2645
|
|
2646
|
|
2647 /* Defined in events.c */
|
|
2648 void clear_event_resource (void);
|
|
2649 Lisp_Object allocate_event (void);
|
|
2650
|
|
2651 /* Defined in fileio.c */
|
|
2652 void record_auto_save (void);
|
|
2653 void force_auto_save_soon (void);
|
442
|
2654 DECLARE_DOESNT_RETURN (report_file_error (const char *, Lisp_Object));
|
|
2655 void maybe_report_file_error (const char *, Lisp_Object,
|
428
|
2656 Lisp_Object, Error_behavior);
|
442
|
2657 DECLARE_DOESNT_RETURN (signal_file_error (const char *, Lisp_Object));
|
|
2658 void maybe_signal_file_error (const char *, Lisp_Object,
|
428
|
2659 Lisp_Object, Error_behavior);
|
442
|
2660 DECLARE_DOESNT_RETURN (signal_double_file_error (const char *, const char *,
|
428
|
2661 Lisp_Object));
|
442
|
2662 void maybe_signal_double_file_error (const char *, const char *,
|
428
|
2663 Lisp_Object, Lisp_Object, Error_behavior);
|
442
|
2664 DECLARE_DOESNT_RETURN (signal_double_file_error_2 (const char *, const char *,
|
428
|
2665 Lisp_Object, Lisp_Object));
|
442
|
2666 void maybe_signal_double_file_error_2 (const char *, const char *,
|
428
|
2667 Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2668 Error_behavior);
|
|
2669 Lisp_Object lisp_strerror (int);
|
|
2670 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
|
|
2671 ssize_t read_allowing_quit (int, void *, size_t);
|
442
|
2672 ssize_t write_allowing_quit (int, const void *, size_t);
|
428
|
2673 int internal_delete_file (Lisp_Object);
|
|
2674
|
|
2675 /* Defined in filelock.c */
|
|
2676 void lock_file (Lisp_Object);
|
|
2677 void unlock_file (Lisp_Object);
|
|
2678 void unlock_all_files (void);
|
|
2679 void unlock_buffer (struct buffer *);
|
|
2680
|
|
2681 /* Defined in filemode.c */
|
|
2682 void filemodestring (struct stat *, char *);
|
|
2683
|
|
2684 /* Defined in floatfns.c */
|
|
2685 double extract_float (Lisp_Object);
|
|
2686
|
|
2687 /* Defined in fns.c */
|
|
2688 Lisp_Object list_sort (Lisp_Object, Lisp_Object,
|
|
2689 int (*) (Lisp_Object, Lisp_Object, Lisp_Object));
|
|
2690 Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2691
|
|
2692 void bump_string_modiff (Lisp_Object);
|
|
2693 Lisp_Object memq_no_quit (Lisp_Object, Lisp_Object);
|
|
2694 Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object);
|
|
2695 Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object);
|
|
2696 Lisp_Object rassq_no_quit (Lisp_Object, Lisp_Object);
|
|
2697 Lisp_Object delq_no_quit (Lisp_Object, Lisp_Object);
|
|
2698 Lisp_Object delq_no_quit_and_free_cons (Lisp_Object, Lisp_Object);
|
|
2699 Lisp_Object remassoc_no_quit (Lisp_Object, Lisp_Object);
|
|
2700 Lisp_Object remassq_no_quit (Lisp_Object, Lisp_Object);
|
|
2701 Lisp_Object remrassq_no_quit (Lisp_Object, Lisp_Object);
|
|
2702
|
|
2703 int plists_differ (Lisp_Object, Lisp_Object, int, int, int);
|
|
2704 Lisp_Object internal_plist_get (Lisp_Object, Lisp_Object);
|
|
2705 void internal_plist_put (Lisp_Object *, Lisp_Object, Lisp_Object);
|
|
2706 int internal_remprop (Lisp_Object *, Lisp_Object);
|
|
2707 Lisp_Object external_plist_get (Lisp_Object *, Lisp_Object,
|
|
2708 int, Error_behavior);
|
|
2709 void external_plist_put (Lisp_Object *, Lisp_Object,
|
|
2710 Lisp_Object, int, Error_behavior);
|
|
2711 int external_remprop (Lisp_Object *, Lisp_Object, int, Error_behavior);
|
|
2712 int internal_equal (Lisp_Object, Lisp_Object, int);
|
|
2713 Lisp_Object concat2 (Lisp_Object, Lisp_Object);
|
|
2714 Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2715 Lisp_Object vconcat2 (Lisp_Object, Lisp_Object);
|
|
2716 Lisp_Object vconcat3 (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2717 Lisp_Object nconc2 (Lisp_Object, Lisp_Object);
|
|
2718 Lisp_Object bytecode_nconc2 (Lisp_Object *);
|
442
|
2719 void check_losing_bytecode (const char *, Lisp_Object);
|
428
|
2720
|
|
2721 /* Defined in glyphs.c */
|
|
2722 Error_behavior decode_error_behavior_flag (Lisp_Object);
|
|
2723 Lisp_Object encode_error_behavior_flag (Error_behavior);
|
|
2724
|
|
2725 /* Defined in indent.c */
|
|
2726 int bi_spaces_at_point (struct buffer *, Bytind);
|
|
2727 int column_at_point (struct buffer *, Bufpos, int);
|
440
|
2728 int string_column_at_point (Lisp_String *, Bufpos, int);
|
428
|
2729 int current_column (struct buffer *);
|
|
2730 void invalidate_current_column (void);
|
|
2731 Bufpos vmotion (struct window *, Bufpos, int, int *);
|
|
2732 Bufpos vmotion_pixels (Lisp_Object, Bufpos, int, int, int *);
|
|
2733
|
|
2734 /* Defined in keymap.c */
|
|
2735 void where_is_to_char (Lisp_Object, char *);
|
|
2736
|
|
2737 /* Defined in lread.c */
|
|
2738 void ebolify_bytecode_constants (Lisp_Object);
|
|
2739 void close_load_descs (void);
|
|
2740 int locate_file (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int);
|
|
2741 EXFUN (Flocate_file_clear_hashing, 1);
|
442
|
2742 int isfloat_string (const char *);
|
428
|
2743
|
|
2744 /* Well, I've decided to enable this. -- ben */
|
|
2745 /* And I've decided to make it work right. -- sb */
|
|
2746 #define LOADHIST
|
|
2747 /* Define the following symbol to enable load history of dumped files */
|
|
2748 #define LOADHIST_DUMPED
|
|
2749 /* Define the following symbol to enable load history of C source */
|
|
2750 #define LOADHIST_BUILTIN
|
|
2751
|
|
2752 #ifdef LOADHIST /* this is just a stupid idea */
|
|
2753 #define LOADHIST_ATTACH(x) \
|
|
2754 do { if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); } \
|
|
2755 while (0)
|
|
2756 #else /*! LOADHIST */
|
|
2757 # define LOADHIST_ATTACH(x)
|
|
2758 #endif /*! LOADHIST */
|
|
2759
|
|
2760 /* Defined in marker.c */
|
|
2761 Bytind bi_marker_position (Lisp_Object);
|
|
2762 Bufpos marker_position (Lisp_Object);
|
|
2763 void set_bi_marker_position (Lisp_Object, Bytind);
|
|
2764 void set_marker_position (Lisp_Object, Bufpos);
|
|
2765 void unchain_marker (Lisp_Object);
|
|
2766 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object);
|
|
2767 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2768 #ifdef MEMORY_USAGE_STATS
|
|
2769 int compute_buffer_marker_usage (struct buffer *, struct overhead_stats *);
|
|
2770 #endif
|
|
2771
|
|
2772 /* Defined in menubar.c */
|
|
2773 extern int popup_menu_up_p;
|
|
2774 extern int menubar_show_keybindings;
|
|
2775 extern int popup_menu_titles;
|
|
2776
|
|
2777 /* Defined in minibuf.c */
|
|
2778 extern int minibuf_level;
|
442
|
2779 Charcount scmp_1 (const Bufbyte *, const Bufbyte *, Charcount, int);
|
428
|
2780 #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case)
|
|
2781 extern int completion_ignore_case;
|
442
|
2782 int regexp_ignore_completion_p (const Bufbyte *, Lisp_Object,
|
428
|
2783 Bytecount, Bytecount);
|
|
2784 Lisp_Object clear_echo_area (struct frame *, Lisp_Object, int);
|
|
2785 Lisp_Object clear_echo_area_from_print (struct frame *, Lisp_Object, int);
|
442
|
2786 void echo_area_append (struct frame *, const Bufbyte *, Lisp_Object,
|
428
|
2787 Bytecount, Bytecount, Lisp_Object);
|
442
|
2788 void echo_area_message (struct frame *, const Bufbyte *, Lisp_Object,
|
428
|
2789 Bytecount, Bytecount, Lisp_Object);
|
|
2790 Lisp_Object echo_area_status (struct frame *);
|
|
2791 int echo_area_active (struct frame *);
|
|
2792 Lisp_Object echo_area_contents (struct frame *);
|
442
|
2793 void message_internal (const Bufbyte *, Lisp_Object, Bytecount, Bytecount);
|
|
2794 void message_append_internal (const Bufbyte *, Lisp_Object,
|
428
|
2795 Bytecount, Bytecount);
|
442
|
2796 void message (const char *, ...) PRINTF_ARGS (1, 2);
|
|
2797 void message_append (const char *, ...) PRINTF_ARGS (1, 2);
|
|
2798 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2);
|
428
|
2799 void clear_message (void);
|
|
2800
|
|
2801 /* Defined in print.c */
|
|
2802 void write_string_to_stdio_stream (FILE *, struct console *,
|
442
|
2803 const Bufbyte *, Bytecount, Bytecount,
|
|
2804 Lisp_Object, int);
|
428
|
2805 void debug_print (Lisp_Object);
|
|
2806 void debug_short_backtrace (int);
|
|
2807 void temp_output_buffer_setup (Lisp_Object);
|
|
2808 void temp_output_buffer_show (Lisp_Object, Lisp_Object);
|
|
2809 /* NOTE: Do not call this with the data of a Lisp_String. Use princ.
|
|
2810 * Note: stream should be defaulted before calling
|
|
2811 * (eg Qnil means stdout, not Vstandard_output, etc) */
|
442
|
2812 void write_c_string (const char *, Lisp_Object);
|
428
|
2813 /* Same goes for this function. */
|
442
|
2814 void write_string_1 (const Bufbyte *, Bytecount, Lisp_Object);
|
428
|
2815 void print_cons (Lisp_Object, Lisp_Object, int);
|
|
2816 void print_vector (Lisp_Object, Lisp_Object, int);
|
|
2817 void print_string (Lisp_Object, Lisp_Object, int);
|
446
|
2818 char *long_to_string (char *, long);
|
428
|
2819 void print_internal (Lisp_Object, Lisp_Object, int);
|
|
2820 void print_symbol (Lisp_Object, Lisp_Object, int);
|
|
2821 void print_float (Lisp_Object, Lisp_Object, int);
|
|
2822 extern int print_escape_newlines;
|
|
2823 extern int print_readably;
|
|
2824 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object,
|
|
2825 Lisp_Object (*) (Lisp_Object),
|
|
2826 Lisp_Object, Lisp_Object);
|
|
2827 void float_to_string (char *, double);
|
|
2828 void internal_object_printer (Lisp_Object, Lisp_Object, int);
|
|
2829
|
|
2830 /* Defined in profile.c */
|
|
2831 void mark_profiling_info (void);
|
|
2832 void profile_increase_call_count (Lisp_Object);
|
|
2833 extern int profiling_active;
|
|
2834 extern int profiling_redisplay_flag;
|
|
2835
|
|
2836 /* Defined in rangetab.c */
|
|
2837 void put_range_table (Lisp_Object, EMACS_INT, EMACS_INT, Lisp_Object);
|
|
2838 int unified_range_table_bytes_needed (Lisp_Object);
|
|
2839 int unified_range_table_bytes_used (void *);
|
|
2840 void unified_range_table_copy_data (Lisp_Object, void *);
|
|
2841 Lisp_Object unified_range_table_lookup (void *, EMACS_INT, Lisp_Object);
|
|
2842 int unified_range_table_nentries (void *);
|
|
2843 void unified_range_table_get_range (void *, int, EMACS_INT *, EMACS_INT *,
|
|
2844 Lisp_Object *);
|
|
2845
|
|
2846 /* Defined in search.c */
|
|
2847 struct re_pattern_buffer;
|
|
2848 struct re_registers;
|
|
2849 Bufpos scan_buffer (struct buffer *, Emchar, Bufpos, Bufpos, EMACS_INT, EMACS_INT *, int);
|
|
2850 Bufpos find_next_newline (struct buffer *, Bufpos, int);
|
|
2851 Bufpos find_next_newline_no_quit (struct buffer *, Bufpos, int);
|
|
2852 Bytind bi_find_next_newline_no_quit (struct buffer *, Bytind, int);
|
440
|
2853 Bytind bi_find_next_emchar_in_string (Lisp_String*, Emchar, Bytind, EMACS_INT);
|
428
|
2854 Bufpos find_before_next_newline (struct buffer *, Bufpos, Bufpos, int);
|
|
2855 struct re_pattern_buffer *compile_pattern (Lisp_Object, struct re_registers *,
|
446
|
2856 Lisp_Object, int, Error_behavior);
|
442
|
2857 Bytecount fast_string_match (Lisp_Object, const Bufbyte *,
|
428
|
2858 Lisp_Object, Bytecount,
|
|
2859 Bytecount, int, Error_behavior, int);
|
|
2860 Bytecount fast_lisp_string_match (Lisp_Object, Lisp_Object);
|
|
2861 void restore_match_data (void);
|
|
2862
|
|
2863 /* Defined in signal.c */
|
|
2864 void init_interrupts_late (void);
|
|
2865 extern int dont_check_for_quit;
|
|
2866 void begin_dont_check_for_quit (void);
|
|
2867 void emacs_sleep (int);
|
|
2868
|
|
2869 /* Defined in sound.c */
|
|
2870 void init_device_sound (struct device *);
|
|
2871
|
|
2872 /* Defined in specifier.c */
|
|
2873 Lisp_Object specifier_instance (Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2874 Error_behavior, int, int, Lisp_Object);
|
|
2875 Lisp_Object specifier_instance_no_quit (Lisp_Object, Lisp_Object, Lisp_Object,
|
|
2876 Error_behavior, int, Lisp_Object);
|
|
2877
|
|
2878 /* Defined in symbols.c */
|
490
|
2879 unsigned int hash_string (const Bufbyte *, Bytecount);
|
442
|
2880 Lisp_Object intern (const char *);
|
|
2881 Lisp_Object oblookup (Lisp_Object, const Bufbyte *, Bytecount);
|
428
|
2882 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *);
|
|
2883 Lisp_Object indirect_function (Lisp_Object, int);
|
|
2884 Lisp_Object symbol_value_in_buffer (Lisp_Object, Lisp_Object);
|
|
2885 void kill_buffer_local_variables (struct buffer *);
|
|
2886 int symbol_value_buffer_local_info (Lisp_Object, struct buffer *);
|
|
2887 Lisp_Object find_symbol_value (Lisp_Object);
|
|
2888 Lisp_Object find_symbol_value_quickly (Lisp_Object, int);
|
|
2889 Lisp_Object top_level_value (Lisp_Object);
|
|
2890 void reject_constant_symbols (Lisp_Object sym, Lisp_Object newval,
|
|
2891 int function_p,
|
|
2892 Lisp_Object follow_past_lisp_magic);
|
|
2893
|
|
2894 /* Defined in syntax.c */
|
|
2895 Bufpos scan_words (struct buffer *, Bufpos, int);
|
|
2896
|
|
2897 /* Defined in undo.c */
|
|
2898 Lisp_Object truncate_undo_list (Lisp_Object, int, int);
|
|
2899 void record_extent (Lisp_Object, int);
|
|
2900 void record_insert (struct buffer *, Bufpos, Charcount);
|
|
2901 void record_delete (struct buffer *, Bufpos, Charcount);
|
|
2902 void record_change (struct buffer *, Bufpos, Charcount);
|
|
2903
|
|
2904 /* Defined in unex*.c */
|
|
2905 int unexec (char *, char *, uintptr_t, uintptr_t, uintptr_t);
|
|
2906 #ifdef RUN_TIME_REMAP
|
|
2907 int run_time_remap (char *);
|
|
2908 #endif
|
|
2909
|
|
2910 /* Defined in vm-limit.c */
|
442
|
2911 void memory_warnings (void *, void (*) (const char *));
|
428
|
2912
|
|
2913 /* Defined in window.c */
|
|
2914 Lisp_Object save_window_excursion_unwind (Lisp_Object);
|
|
2915 Lisp_Object display_buffer (Lisp_Object, Lisp_Object, Lisp_Object);
|
|
2916
|
442
|
2917 /*--------------- prototypes for Lisp primitives in C ------------*/
|
|
2918
|
428
|
2919 /* The following were machine generated 19980312 */
|
|
2920
|
|
2921 EXFUN (Faccept_process_output, 3);
|
|
2922 EXFUN (Fadd1, 1);
|
|
2923 EXFUN (Fadd_spec_to_specifier, 5);
|
|
2924 EXFUN (Fadd_timeout, 4);
|
|
2925 EXFUN (Fappend, MANY);
|
|
2926 EXFUN (Fapply, MANY);
|
|
2927 EXFUN (Faref, 2);
|
|
2928 EXFUN (Faset, 3);
|
|
2929 EXFUN (Fassoc, 2);
|
|
2930 EXFUN (Fassq, 2);
|
|
2931 EXFUN (Fbacktrace, 2);
|
|
2932 EXFUN (Fbeginning_of_line, 2);
|
|
2933 EXFUN (Fbobp, 1);
|
|
2934 EXFUN (Fbolp, 1);
|
|
2935 EXFUN (Fboundp, 1);
|
|
2936 EXFUN (Fbuffer_substring, 3);
|
|
2937 EXFUN (Fbuilt_in_variable_type, 1);
|
|
2938 EXFUN (Fbyte_code, 3);
|
|
2939 EXFUN (Fcall_interactively, 3);
|
|
2940 EXFUN (Fcanonicalize_lax_plist, 2);
|
|
2941 EXFUN (Fcanonicalize_plist, 2);
|
|
2942 EXFUN (Fcar, 1);
|
|
2943 EXFUN (Fcar_safe, 1);
|
|
2944 EXFUN (Fcdr, 1);
|
|
2945 EXFUN (Fchar_after, 2);
|
|
2946 EXFUN (Fchar_to_string, 1);
|
|
2947 EXFUN (Fcheck_valid_plist, 1);
|
442
|
2948 EXFUN (Fvalid_plist_p, 1);
|
428
|
2949 EXFUN (Fclear_range_table, 1);
|
|
2950 EXFUN (Fcoding_category_list, 0);
|
|
2951 EXFUN (Fcoding_category_system, 1);
|
|
2952 EXFUN (Fcoding_priority_list, 0);
|
|
2953 EXFUN (Fcoding_system_charset, 2);
|
|
2954 EXFUN (Fcoding_system_doc_string, 1);
|
|
2955 EXFUN (Fcoding_system_list, 0);
|
|
2956 EXFUN (Fcoding_system_name, 1);
|
|
2957 EXFUN (Fcoding_system_p, 1);
|
|
2958 EXFUN (Fcoding_system_property, 2);
|
|
2959 EXFUN (Fcoding_system_type, 1);
|
|
2960 EXFUN (Fcommand_execute, 3);
|
|
2961 EXFUN (Fcommandp, 1);
|
|
2962 EXFUN (Fconcat, MANY);
|
|
2963 EXFUN (Fcons, 2);
|
|
2964 EXFUN (Fcopy_alist, 1);
|
|
2965 EXFUN (Fcopy_coding_system, 2);
|
|
2966 EXFUN (Fcopy_event, 2);
|
|
2967 EXFUN (Fcopy_list, 1);
|
|
2968 EXFUN (Fcopy_marker, 2);
|
|
2969 EXFUN (Fcopy_sequence, 1);
|
|
2970 EXFUN (Fcopy_tree, 2);
|
|
2971 EXFUN (Fcurrent_window_configuration, 1);
|
|
2972 EXFUN (Fdecode_big5_char, 1);
|
|
2973 EXFUN (Fdecode_coding_region, 4);
|
|
2974 EXFUN (Fdecode_shift_jis_char, 1);
|
|
2975 EXFUN (Fdefault_boundp, 1);
|
|
2976 EXFUN (Fdefault_value, 1);
|
|
2977 EXFUN (Fdefine_key, 3);
|
442
|
2978 EXFUN (Fdelete, 2);
|
428
|
2979 EXFUN (Fdelete_region, 3);
|
|
2980 EXFUN (Fdelete_process, 1);
|
|
2981 EXFUN (Fdelq, 2);
|
|
2982 EXFUN (Fdestructive_alist_to_plist, 1);
|
|
2983 EXFUN (Fdetect_coding_region, 3);
|
|
2984 EXFUN (Fdgettext, 2);
|
|
2985 EXFUN (Fding, 3);
|
|
2986 EXFUN (Fdirectory_file_name, 1);
|
|
2987 EXFUN (Fdisable_timeout, 1);
|
|
2988 EXFUN (Fdiscard_input, 0);
|
|
2989 EXFUN (Fdispatch_event, 1);
|
|
2990 EXFUN (Fdisplay_error, 2);
|
|
2991 EXFUN (Fdo_auto_save, 2);
|
|
2992 EXFUN (Fdowncase, 2);
|
|
2993 EXFUN (Felt, 2);
|
|
2994 EXFUN (Fencode_big5_char, 1);
|
|
2995 EXFUN (Fencode_coding_region, 4);
|
|
2996 EXFUN (Fencode_shift_jis_char, 1);
|
|
2997 EXFUN (Fend_of_line, 2);
|
|
2998 EXFUN (Fenqueue_eval_event, 2);
|
|
2999 EXFUN (Feobp, 1);
|
|
3000 EXFUN (Feolp, 1);
|
|
3001 EXFUN (Fequal, 2);
|
|
3002 EXFUN (Ferror_message_string, 1);
|
|
3003 EXFUN (Feval, 1);
|
|
3004 EXFUN (Fevent_to_character, 4);
|
|
3005 EXFUN (Fexecute_kbd_macro, 2);
|
|
3006 EXFUN (Fexpand_abbrev, 0);
|
|
3007 EXFUN (Fexpand_file_name, 2);
|
|
3008 EXFUN (Fextent_at, 5);
|
|
3009 EXFUN (Fextent_property, 3);
|
|
3010 EXFUN (Ffboundp, 1);
|
|
3011 EXFUN (Ffile_accessible_directory_p, 1);
|
|
3012 EXFUN (Ffile_directory_p, 1);
|
|
3013 EXFUN (Ffile_executable_p, 1);
|
|
3014 EXFUN (Ffile_exists_p, 1);
|
|
3015 EXFUN (Ffile_name_absolute_p, 1);
|
|
3016 EXFUN (Ffile_name_as_directory, 1);
|
|
3017 EXFUN (Ffile_name_directory, 1);
|
|
3018 EXFUN (Ffile_name_nondirectory, 1);
|
|
3019 EXFUN (Ffile_readable_p, 1);
|
|
3020 EXFUN (Ffile_symlink_p, 1);
|
|
3021 EXFUN (Ffile_truename, 2);
|
|
3022 EXFUN (Ffind_coding_system, 1);
|
|
3023 EXFUN (Ffind_file_name_handler, 2);
|
|
3024 EXFUN (Ffollowing_char, 1);
|
|
3025 EXFUN (Fformat, MANY);
|
|
3026 EXFUN (Fforward_char, 2);
|
|
3027 EXFUN (Fforward_line, 2);
|
|
3028 EXFUN (Ffset, 2);
|
|
3029 EXFUN (Ffuncall, MANY);
|
442
|
3030 EXFUN (Ffunctionp, 1);
|
428
|
3031 EXFUN (Fgeq, MANY);
|
|
3032 EXFUN (Fget, 3);
|
|
3033 EXFUN (Fget_buffer_process, 1);
|
|
3034 EXFUN (Fget_coding_system, 1);
|
|
3035 EXFUN (Fget_process, 1);
|
|
3036 EXFUN (Fget_range_table, 3);
|
|
3037 EXFUN (Fgettext, 1);
|
|
3038 EXFUN (Fgoto_char, 2);
|
|
3039 EXFUN (Fgtr, MANY);
|
|
3040 EXFUN (Findent_to, 3);
|
|
3041 EXFUN (Findirect_function, 1);
|
|
3042 EXFUN (Finsert, MANY);
|
|
3043 EXFUN (Finsert_buffer_substring, 3);
|
|
3044 EXFUN (Finsert_char, 4);
|
|
3045 EXFUN (Finsert_file_contents_internal, 7);
|
|
3046 EXFUN (Finteractive_p, 0);
|
|
3047 EXFUN (Fintern, 2);
|
|
3048 EXFUN (Fintern_soft, 2);
|
|
3049 EXFUN (Fkey_description, 1);
|
|
3050 EXFUN (Fkill_emacs, 1);
|
|
3051 EXFUN (Fkill_local_variable, 1);
|
442
|
3052 EXFUN (Flast, 2);
|
428
|
3053 EXFUN (Flax_plist_get, 3);
|
|
3054 EXFUN (Flax_plist_remprop, 2);
|
|
3055 EXFUN (Flength, 1);
|
|
3056 EXFUN (Fleq, MANY);
|
|
3057 EXFUN (Flist, MANY);
|
|
3058 EXFUN (Flistp, 1);
|
|
3059 EXFUN (Flist_modules, 0);
|
|
3060 EXFUN (Fload_module, 3);
|
440
|
3061 EXFUN (Flookup_key, 3);
|
428
|
3062 EXFUN (Flss, MANY);
|
|
3063 EXFUN (Fmake_byte_code, MANY);
|
|
3064 EXFUN (Fmake_coding_system, 4);
|
|
3065 EXFUN (Fmake_glyph_internal, 1);
|
|
3066 EXFUN (Fmake_list, 2);
|
|
3067 EXFUN (Fmake_marker, 0);
|
|
3068 EXFUN (Fmake_range_table, 0);
|
|
3069 EXFUN (Fmake_sparse_keymap, 1);
|
|
3070 EXFUN (Fmake_string, 2);
|
|
3071 EXFUN (Fmake_symbol, 1);
|
|
3072 EXFUN (Fmake_vector, 2);
|
|
3073 EXFUN (Fmapcar, 2);
|
|
3074 EXFUN (Fmarker_buffer, 1);
|
|
3075 EXFUN (Fmarker_position, 1);
|
|
3076 EXFUN (Fmatch_beginning, 1);
|
|
3077 EXFUN (Fmatch_end, 1);
|
|
3078 EXFUN (Fmax, MANY);
|
|
3079 EXFUN (Fmember, 2);
|
|
3080 EXFUN (Fmemq, 2);
|
|
3081 EXFUN (Fmin, MANY);
|
|
3082 EXFUN (Fminus, MANY);
|
|
3083 EXFUN (Fnarrow_to_region, 3);
|
|
3084 EXFUN (Fnconc, MANY);
|
|
3085 EXFUN (Fnext_event, 2);
|
|
3086 EXFUN (Fnreverse, 1);
|
|
3087 EXFUN (Fnthcdr, 2);
|
|
3088 EXFUN (Fnumber_to_string, 1);
|
|
3089 EXFUN (Fold_assq, 2);
|
|
3090 EXFUN (Fold_equal, 2);
|
|
3091 EXFUN (Fold_member, 2);
|
|
3092 EXFUN (Fold_memq, 2);
|
|
3093 EXFUN (Fplist_get, 3);
|
|
3094 EXFUN (Fplist_member, 2);
|
|
3095 EXFUN (Fplist_put, 3);
|
|
3096 EXFUN (Fplus, MANY);
|
|
3097 EXFUN (Fpoint, 1);
|
|
3098 EXFUN (Fpoint_marker, 2);
|
|
3099 EXFUN (Fpoint_max, 1);
|
|
3100 EXFUN (Fpoint_min, 1);
|
|
3101 EXFUN (Fpreceding_char, 1);
|
|
3102 EXFUN (Fprefix_numeric_value, 1);
|
|
3103 EXFUN (Fprin1, 2);
|
|
3104 EXFUN (Fprin1_to_string, 2);
|
|
3105 EXFUN (Fprinc, 2);
|
|
3106 EXFUN (Fprint, 2);
|
|
3107 EXFUN (Fprocess_status, 1);
|
|
3108 EXFUN (Fprogn, UNEVALLED);
|
|
3109 EXFUN (Fprovide, 1);
|
|
3110 EXFUN (Fput, 3);
|
|
3111 EXFUN (Fput_range_table, 4);
|
|
3112 EXFUN (Fput_text_property, 5);
|
|
3113 EXFUN (Fquo, MANY);
|
|
3114 EXFUN (Frassq, 2);
|
|
3115 EXFUN (Fread, 1);
|
|
3116 EXFUN (Fread_key_sequence, 3);
|
|
3117 EXFUN (Freally_free, 1);
|
|
3118 EXFUN (Frem, 2);
|
|
3119 EXFUN (Fremassq, 2);
|
442
|
3120 EXFUN (Freplace_list, 2);
|
428
|
3121 EXFUN (Fselected_frame, 1);
|
|
3122 EXFUN (Fset, 2);
|
|
3123 EXFUN (Fset_coding_category_system, 2);
|
|
3124 EXFUN (Fset_coding_priority_list, 1);
|
|
3125 EXFUN (Fset_default, 2);
|
|
3126 EXFUN (Fset_marker, 3);
|
|
3127 EXFUN (Fset_standard_case_table, 1);
|
|
3128 EXFUN (Fsetcar, 2);
|
|
3129 EXFUN (Fsetcdr, 2);
|
|
3130 EXFUN (Fsignal, 2);
|
|
3131 EXFUN (Fsit_for, 2);
|
|
3132 EXFUN (Fskip_chars_backward, 3);
|
|
3133 EXFUN (Fskip_chars_forward, 3);
|
|
3134 EXFUN (Fsleep_for, 1);
|
|
3135 EXFUN (Fsort, 2);
|
|
3136 EXFUN (Fspecifier_spec_list, 4);
|
|
3137 EXFUN (Fstring_equal, 2);
|
|
3138 EXFUN (Fstring_lessp, 2);
|
|
3139 EXFUN (Fstring_match, 4);
|
|
3140 EXFUN (Fsub1, 1);
|
|
3141 EXFUN (Fsubr_max_args, 1);
|
|
3142 EXFUN (Fsubr_min_args, 1);
|
|
3143 EXFUN (Fsubsidiary_coding_system, 2);
|
|
3144 EXFUN (Fsubstitute_command_keys, 1);
|
|
3145 EXFUN (Fsubstitute_in_file_name, 1);
|
|
3146 EXFUN (Fsubstring, 3);
|
|
3147 EXFUN (Fsymbol_function, 1);
|
|
3148 EXFUN (Fsymbol_name, 1);
|
|
3149 EXFUN (Fsymbol_plist, 1);
|
|
3150 EXFUN (Fsymbol_value, 1);
|
|
3151 EXFUN (Fsystem_name, 0);
|
|
3152 EXFUN (Fthrow, 2);
|
|
3153 EXFUN (Ftimes, MANY);
|
|
3154 EXFUN (Ftruncate, 1);
|
|
3155 EXFUN (Fundo_boundary, 0);
|
|
3156 EXFUN (Funhandled_file_name_directory, 1);
|
|
3157 EXFUN (Funlock_buffer, 0);
|
|
3158 EXFUN (Fupcase, 2);
|
|
3159 EXFUN (Fupcase_initials, 2);
|
|
3160 EXFUN (Fupcase_initials_region, 3);
|
|
3161 EXFUN (Fupcase_region, 3);
|
|
3162 EXFUN (Fuser_home_directory, 0);
|
|
3163 EXFUN (Fuser_login_name, 1);
|
|
3164 EXFUN (Fvector, MANY);
|
|
3165 EXFUN (Fverify_visited_file_modtime, 1);
|
|
3166 EXFUN (Fvertical_motion, 3);
|
|
3167 EXFUN (Fwiden, 1);
|
|
3168
|
442
|
3169 /*--------------- prototypes for constant symbols ------------*/
|
|
3170
|
|
3171 extern Lisp_Object Q_style;
|
|
3172 extern Lisp_Object Qactivate_menubar_hook;
|
|
3173 extern Lisp_Object Qarith_error;
|
|
3174 extern Lisp_Object Qarrayp, Qautoload;
|
|
3175 extern Lisp_Object Qbackground, Qbackground_pixmap;
|
|
3176 extern Lisp_Object Qbeginning_of_buffer, Qbig5;
|
|
3177 extern Lisp_Object Qbitp, Qblinking;
|
|
3178 extern Lisp_Object Qbuffer_glyph_p, Qbuffer_live_p, Qbuffer_read_only;
|
|
3179 extern Lisp_Object Qbyte_code, Qcall_interactively;
|
428
|
3180 extern Lisp_Object Qcategory_designator_p, Qcategory_table_value_p, Qccl, Qcdr;
|
442
|
3181 extern Lisp_Object Qchar_or_string_p, Qcharacterp;
|
|
3182 extern Lisp_Object Qcharset_g0, Qcharset_g1, Qcharset_g2, Qcharset_g3;
|
|
3183 extern Lisp_Object Qcircular_list, Qcircular_property_list;
|
428
|
3184 extern Lisp_Object Qcoding_system_error;
|
442
|
3185 extern Lisp_Object Qcolor_pixmap_image_instance_p;
|
|
3186 extern Lisp_Object Qcommandp, Qcompletion_ignore_case;
|
|
3187 extern Lisp_Object Qconsole_live_p, Qconst_specifier, Qcr;
|
|
3188 extern Lisp_Object Qcrlf, Qcurrent_menubar, Qctext;
|
|
3189 extern Lisp_Object Qcyclic_variable_indirection, Qdecode;
|
|
3190 extern Lisp_Object Qdefun, Qdevice_live_p;
|
|
3191 extern Lisp_Object Qdim, Qdisabled, Qdisplay_table;
|
|
3192 extern Lisp_Object Qdomain_error;
|
|
3193 extern Lisp_Object Qediting_error;
|
|
3194 extern Lisp_Object Qencode, Qend_of_buffer, Qend_of_file, Qend_open;
|
|
3195 extern Lisp_Object Qeol_cr, Qeol_crlf, Qeol_lf, Qeol_type;
|
428
|
3196 extern Lisp_Object Qerror, Qerror_conditions, Qerror_message, Qescape_quoted;
|
442
|
3197 extern Lisp_Object Qevent_live_p, Qexit, Qextent_live_p;
|
|
3198 extern Lisp_Object Qexternal_debugging_output, Qfeaturep;
|
|
3199 extern Lisp_Object Qfile_error;
|
|
3200 extern Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output;
|
428
|
3201 extern Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output, Qforeground;
|
442
|
3202 extern Lisp_Object Qformat, Qframe_live_p;
|
|
3203 extern Lisp_Object Qicon_glyph_p, Qidentity;
|
428
|
3204 extern Lisp_Object Qinhibit_quit, Qinhibit_read_only;
|
442
|
3205 extern Lisp_Object Qinput_charset_conversion;
|
428
|
3206 extern Lisp_Object Qinteger_char_or_marker_p, Qinteger_or_char_p;
|
442
|
3207 extern Lisp_Object Qinteger_or_marker_p, Qintegerp, Qinteractive;
|
|
3208 extern Lisp_Object Qinternal_error, Qinvalid_argument;
|
|
3209 extern Lisp_Object Qinvalid_change, Qinvalid_function, Qinvalid_operation;
|
|
3210 extern Lisp_Object Qinvalid_read_syntax, Qinvalid_state;
|
|
3211 extern Lisp_Object Qio_error;
|
|
3212 extern Lisp_Object Qiso2022;
|
|
3213 extern Lisp_Object Qlambda, Qlayout;
|
|
3214 extern Lisp_Object Qlf;
|
|
3215 extern Lisp_Object Qlist_formation_error;
|
|
3216 extern Lisp_Object Qlistp, Qload, Qlock_shift, Qmacro;
|
440
|
3217 extern Lisp_Object Qmakunbound, Qmalformed_list, Qmalformed_property_list;
|
442
|
3218 extern Lisp_Object Qmark;
|
|
3219 extern Lisp_Object Qmnemonic;
|
|
3220 extern Lisp_Object Qmono_pixmap_image_instance_p;
|
|
3221 extern Lisp_Object Qmouse_leave_buffer_hook;
|
|
3222 extern Lisp_Object Qnas, Qnatnump, Qnative_layout;
|
428
|
3223 extern Lisp_Object Qno_ascii_cntl, Qno_ascii_eol, Qno_catch;
|
442
|
3224 extern Lisp_Object Qno_conversion, Qno_iso6429;
|
|
3225 extern Lisp_Object Qnothing_image_instance_p;
|
428
|
3226 extern Lisp_Object Qnumber_char_or_marker_p, Qnumberp;
|
442
|
3227 extern Lisp_Object Qoutput_charset_conversion;
|
|
3228 extern Lisp_Object Qoverflow_error, Qpoint, Qpointer_glyph_p;
|
|
3229 extern Lisp_Object Qpointer_image_instance_p, Qpost_read_conversion;
|
|
3230 extern Lisp_Object Qpre_write_conversion, Qprint_length;
|
|
3231 extern Lisp_Object Qprint_string_length, Qprogn, Qquit;
|
|
3232 extern Lisp_Object Qquote, Qrange_error, Qread_char;
|
428
|
3233 extern Lisp_Object Qread_from_minibuffer, Qreally_early_error_handler;
|
442
|
3234 extern Lisp_Object Qregion_beginning, Qregion_end;
|
440
|
3235 extern Lisp_Object Qrun_hooks, Qsans_modifiers;
|
442
|
3236 extern Lisp_Object Qsave_buffers_kill_emacs;
|
430
|
3237 extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo;
|
440
|
3238 extern Lisp_Object Qsequencep, Qset, Qsetting_constant;
|
|
3239 extern Lisp_Object Qseven, Qshift_jis, Qshort;
|
442
|
3240 extern Lisp_Object Qsingularity_error;
|
|
3241 extern Lisp_Object Qstandard_input, Qstandard_output;
|
|
3242 extern Lisp_Object Qstart_open;
|
|
3243 extern Lisp_Object Qstring_lessp, Qsubwindow;
|
440
|
3244 extern Lisp_Object Qsubwindow_image_instance_p;
|
442
|
3245 extern Lisp_Object Qsyntax_error, Qt;
|
|
3246 extern Lisp_Object Qtext_image_instance_p;
|
|
3247 extern Lisp_Object Qtop_level;
|
|
3248 extern Lisp_Object Qtrue_list_p;
|
|
3249 extern Lisp_Object Qunbound, Qunderflow_error;
|
|
3250 extern Lisp_Object Qunderline, Quser_files_and_directories;
|
|
3251 extern Lisp_Object Qvalues;
|
|
3252 extern Lisp_Object Qvariable_documentation, Qvariable_domain;
|
|
3253 extern Lisp_Object Qvoid_function, Qvoid_variable;
|
|
3254 extern Lisp_Object Qwindow_live_p, Qwrong_number_of_arguments;
|
|
3255 extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p;
|
462
|
3256 extern Lisp_Object Qgtk;
|
442
|
3257
|
|
3258 #define SYMBOL(fou) extern Lisp_Object fou
|
|
3259 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
|
|
3260 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
|
|
3261 extern Lisp_Object tout_le_monde
|
|
3262
|
|
3263 #include "general-slots.h"
|
|
3264
|
|
3265 #undef SYMBOL
|
|
3266 #undef SYMBOL_KEYWORD
|
|
3267 #undef SYMBOL_GENERAL
|
|
3268
|
|
3269 /*--------------- prototypes for variables of type Lisp_Object ------------*/
|
|
3270
|
446
|
3271 extern Lisp_Object Vactivate_menubar_hook;
|
|
3272 extern Lisp_Object Vautoload_queue, Vblank_menubar;
|
428
|
3273 extern Lisp_Object Vcharset_ascii, Vcharset_composite, Vcharset_control_1;
|
|
3274 extern Lisp_Object Vcoding_system_for_read, Vcoding_system_for_write;
|
|
3275 extern Lisp_Object Vcoding_system_hash_table, Vcommand_history;
|
|
3276 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory;
|
|
3277 extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory;
|
|
3278 extern Lisp_Object Vconsole_list, Vcontrolling_terminal;
|
|
3279 extern Lisp_Object Vcurrent_compiled_function_annotation, Vcurrent_load_list;
|
|
3280 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory;
|
434
|
3281 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook;
|
|
3282 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name;
|
428
|
3283 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version;
|
|
3284 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path;
|
|
3285 extern Lisp_Object Vexecuting_macro, Vfeatures, Vfile_domain;
|
|
3286 extern Lisp_Object Vfile_name_coding_system, Vinhibit_quit;
|
|
3287 extern Lisp_Object Vinvocation_directory, Vinvocation_name;
|
|
3288 extern Lisp_Object Vkeyboard_coding_system, Vlast_command, Vlast_command_char;
|
|
3289 extern Lisp_Object Vlast_command_event, Vlast_input_event;
|
|
3290 extern Lisp_Object Vload_file_name_internal;
|
|
3291 extern Lisp_Object Vload_file_name_internal_the_purecopy, Vload_history;
|
|
3292 extern Lisp_Object Vload_path, Vmark_even_if_inactive, Vmenubar_configuration;
|
|
3293 extern Lisp_Object Vminibuf_preprompt, Vminibuf_prompt, Vminibuffer_zero;
|
|
3294 extern Lisp_Object Vmodule_directory, Vmswindows_downcase_file_names;
|
|
3295 extern Lisp_Object Vmswindows_get_true_file_attributes, Vobarray;
|
|
3296 extern Lisp_Object Vprint_length, Vprint_level, Vprocess_environment;
|
|
3297 extern Lisp_Object Vquit_flag;
|
|
3298 extern Lisp_Object Vrecent_keys_ring, Vshell_file_name, Vsite_directory;
|
|
3299 extern Lisp_Object Vsite_module_directory;
|
|
3300 extern Lisp_Object Vstandard_input, Vstandard_output, Vstdio_str;
|
|
3301 extern Lisp_Object Vsynchronous_sounds, Vsystem_name, Vterminal_coding_system;
|
|
3302 extern Lisp_Object Vthis_command_keys, Vunread_command_event;
|
|
3303 extern Lisp_Object Vx_initial_argv_list;
|
|
3304
|
440
|
3305 #endif /* INCLUDED_lisp_h_ */
|