1 /* Fundamental definitions for SXEmacs Lisp interpreter.
2 Copyright (C) 1985-1987, 1992-1995 Free Software Foundation, Inc.
3 Copyright (C) 1993-1996 Richard Mlynarik.
4 Copyright (C) 1995, 1996, 2000 Ben Wing.
5 Copyright (C) 2004 Steve Youngs.
7 This file is part of SXEmacs
9 SXEmacs is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 SXEmacs is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 /* Synched up with: FSF 19.30. */
25 #ifndef INCLUDED_lisp_h_
26 #define INCLUDED_lisp_h_
28 /************************************************************************/
29 /* general definitions */
30 /************************************************************************/
32 /* ------------------------ include files ------------------- */
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. */
40 #include <string.h> /* primarily for memcpy, etc. */
41 #include <stdio.h> /* NULL, etc. */
44 #include <stddef.h> /* offsetof */
45 #include <sys/types.h>
47 #if defined HAVE_STDBOOL_H
53 #elif defined(__GNUC__)
54 # define UNUSED(x) UNUSED_ ## x __attribute__((unused))
55 #elif defined(__LCLINT__)
56 # define UNUSED(x) /*@unused@*/ x
62 #elif defined(__GNUC__)
63 # define WEAK_EXTERN extern __attribute__((weak))
65 # error "Grrr, bloody 'ell, can't figure out how to create weak symbols"
69 #elif defined(__GNUC__)
70 # define WEAK __attribute__((weak))
72 # error "Grrr, bloody 'ell, can't figure out how to create weak symbols"
78 #define LIKELY(_x) __builtin_expect(!!(_x), 1)
82 #define UNLIKELY(_x) __builtin_expect(!!(_x), 0)
85 #if defined SXE_STATIC_EXTERN_INLINE
86 # define extern_inline static inline
87 #elif !defined __GNUC_STDC_INLINE__ && !defined SXE_INLINE_NO_EXTERN
88 # define extern_inline extern inline
90 # define extern_inline inline
93 #ifdef ALL_DEBUG_FLAGS
95 #define SXE_DEBUG_FLAG
98 #define __SXE_DEBUG__(args...) fprintf(stderr, "SXE " args)
99 #ifndef SXE_DEBUG_FLAG
100 #define SXE_DEBUG(args...)
102 #define SXE_DEBUG(args...) __SXE_DEBUG__(args)
104 #define SXE_DEBUG_PT(args...) SXE_DEBUG("[pthread]: " args)
105 #define SXE_CRITICAL(args...) __SXE_DEBUG__("CRITICAL: " args)
109 /* We define assert iff USE_ASSERTIONS or DEBUG_SXEMACS is defined.
110 Otherwise we define it to be empty. Quantify has shown that the
111 time the assert checks take is measurable so let's not include them
112 in production binaries. */
114 #ifdef USE_ASSERTIONS
115 /* Highly dubious kludge */
116 /* (thanks, Jamie, I feel better now -- ben) */
117 void assert_failed(const char *, int, const char *);
118 # define abort() (assert_failed (__FILE__, __LINE__, "abort()"))
119 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
121 # ifdef DEBUG_SXEMACS
122 # define assert(x) ((x) ? (void) 0 : (void) abort ())
129 #ifndef BITS_PER_CHAR
130 #define BITS_PER_CHAR 8
132 #define SXE_SHORTBITS (SIZEOF_SHORT * BITS_PER_CHAR)
133 #define SXE_INTBITS (SIZEOF_INT * BITS_PER_CHAR)
134 #define SXE_LONGBITS (SIZEOF_LONG * BITS_PER_CHAR)
135 #define SXE_LONG_LONG_BITS (SIZEOF_LONG_LONG_INT * BITS_PER_CHAR)
136 #define SXE_VOID_P_BITS (SIZEOF_VOID_P * BITS_PER_CHAR)
139 /* ------------------------ dynamic arrays ------------------- */
141 #define Dynarr_declare(type) \
148 typedef struct dynarr {
149 Dynarr_declare(void);
152 void *Dynarr_newf(int elsize);
153 void Dynarr_resize(void *dy, int size);
154 void Dynarr_insert_many(void *d, const void *el, int len, int start);
155 void Dynarr_delete_many(void *d, int start, int len);
156 void Dynarr_free(void *d);
158 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type)))
159 #define Dynarr_new2(dynarr_type, type) \
160 ((dynarr_type *) Dynarr_newf (sizeof (type)))
161 #define Dynarr_at(d, pos) ((d)->base[pos])
162 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos))
163 #define Dynarr_begin(d) Dynarr_atp (d, 0)
164 #define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d) - 1)
165 #define Dynarr_sizeof(d) ((d)->cur * (d)->elsize)
166 #define Dynarr_length(d) ((d)->cur)
167 #define Dynarr_largest(d) ((d)->largest)
168 #define Dynarr_reset(d) ((d)->cur = 0)
169 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur)
170 #define Dynarr_insert_many_at_start(d, el, len) \
171 Dynarr_insert_many (d, el, len, 0)
172 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1)
173 #define Dynarr_add_lisp_string(d, s) do { \
174 Lisp_String *dyna_ls_s = XSTRING (s); \
175 Dynarr_add_many (d, (char *) string_data (dyna_ls_s), \
176 string_length (dyna_ls_s)); \
179 #define Dynarr_add(d, el) ( \
180 (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : (void) 0, \
181 ((d)->base)[(d)->cur++] = (el), \
182 (d)->cur > (d)->largest ? (d)->largest = (d)->cur : (int) 0)
184 /* The following defines will get you into real trouble if you aren't
185 careful. But they can save a lot of execution time when used wisely. */
186 #define Dynarr_increment(d) ((d)->cur++)
187 #define Dynarr_set_size(d, n) ((d)->cur = n)
189 #ifdef MEMORY_USAGE_STATS
190 struct overhead_stats;
191 size_t Dynarr_memory_usage(void *d, struct overhead_stats *stats);
194 /* Also define min() and max(). (Some compilers put them in strange
195 places that won't be referenced by the above include files, such
196 as 'macros.h' under Solaris.) */
199 #define min(a,b) (((a) <= (b)) ? (a) : (b))
202 #define max(a,b) (((a) > (b)) ? (a) : (b))
206 /************************************************************************/
208 /************************************************************************/
210 #ifdef ALL_DEBUG_FLAGS
212 #define GC_DEBUG_FLAG
215 #if !defined GC_DEBUG_FLAG
216 # define SXE_DEBUG_GC(args...)
218 # define SXE_DEBUG_GC(args...) __SXE_DEBUG__("[gc] " args)
220 #define SXE_DEBUG_GC_PT(args...) SXE_DEBUG_GC("[pthread]: " args)
221 #define SXE_CRITICAL_GC(args...) __SXE_DEBUG__("[gc] CRITICAL: " args)
223 void malloc_warning(const char *);
225 #if defined HAVE_BDWGC && defined EF_USE_BDWGC
226 # if defined HAVE_THREADS
227 # if !defined GC_PTHREADS
228 # define GC_PTHREADS 1
229 # endif /* !GC_PTHREADS */
230 # if !defined GC_THREADS
231 # define GC_THREADS 1
232 # endif /* !GC_THREADS */
233 # endif /* HAVE_THREADS */
236 # if defined GC_DEBUG_FLAG
238 # endif /* GC_DEBUG_FLAG */
239 # if defined HAVE_GC_GC_H
241 # elif defined HAVE_GC_H
244 # error "Take less of those pills!"
247 # if defined GC_DEBUG_FLAG
248 # define zmalloc GC_MALLOC_IGNORE_OFF_PAGE
249 # define zcalloc(n, m) GC_MALLOC((n)*(m))
250 # define zmalloc_atomic GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE
251 # define zmalloc_and_zero GC_MALLOC
252 # define zrealloc GC_REALLOC
253 # define zstrdup GC_STRDUP
255 # define zfree(x) GC_FREE(x)
256 # else /* !GC_DEBUG_FLAG */
257 # define zmalloc GC_malloc_ignore_off_page
258 # define zcalloc(n, m) GC_malloc((n)*(m))
259 # define zmalloc_atomic GC_malloc_atomic_ignore_off_page
260 # define zmalloc_and_zero GC_malloc
261 # define zrealloc GC_realloc
262 # define zstrdup GC_strdup
265 # endif /* GC_DEBUG_FLAG */
270 #define zmalloc_atomic F&^!
271 #define zmalloc_and_zero F&^!
272 #define zrealloc F&^!
273 #define zstrdrup F&^!
276 /* also define libc mem funs */
277 #define ymalloc malloc
278 #define ycalloc(n, m) calloc(n, m)
279 #define ymalloc_atomic(n) ycalloc(1, n)
280 #define ymalloc_and_zero(x) ycalloc(1, x)
281 #define yrealloc realloc
282 #define ystrdup strdup
283 #define yfree(x) free(x)
284 /* and their convenience companions */
285 #define ynew(type) ((type*)ymalloc(sizeof(type)))
286 #define ynew_array(type, len) ((type*)ymalloc((len) * sizeof(type)))
287 #define ynew_and_zero(type) ((type*)ymalloc_and_zero(sizeof(type)))
288 #define ynew_array_and_zero(type, len) \
289 ((type*)ymalloc_and_zero((len) * sizeof(type)))
290 #define YREALLOC_ARRAY(ptr, type, len) \
291 ((void)(ptr = (type *)yrealloc(ptr, (len) * sizeof (type))))
293 #if defined HAVE_BDWGC && defined EF_USE_BDWGC
294 /* and now the x* series */
295 # define xmalloc zmalloc
296 # define xcalloc zcalloc
297 # define xmalloc_atomic zmalloc_atomic
298 # define xmalloc_and_zero zmalloc_and_zero
299 # define xrealloc zrealloc
300 # define xstrdup zstrdup
301 # if defined ERROR_CHECK_MALLOC
302 # define xfree(args...) zfree(args)
303 # else /* !ERROR_CHECK_MALLOC */
304 # define xfree(args...)
305 # endif /* ERROR_CHECK_MALLOC */
308 void *xmalloc(size_t size);
309 void *xmalloc_atomic(size_t size);
310 void *xmalloc_and_zero(size_t size);
311 void *xrealloc(void *, size_t size);
312 char *xstrdup(const char *);
313 # if defined ERROR_CHECK_MALLOC
314 # if SIZEOF_VOID_P == 4
315 # define xfree(lvalue) \
317 void *volatile *xfree_ptr = \
319 ((volatile void*)&(lvalue)); \
320 assert(*xfree_ptr != (void*)0xB00BB4BE); \
322 *xfree_ptr = (void*)0xB00BB4BE; \
324 # elif SIZEOF_VOID_P == 8
325 # define xfree(lvalue) \
327 void *volatile *xfree_ptr = \
329 ((volatile void*)&(lvalue)); \
330 assert(*xfree_ptr != (void*)0xCAFEBABEDEADBEEF); \
332 *xfree_ptr = (void*)0xCAFEBABEDEADBEEF; \
335 # error "Strange-arse system detected. Watch a movie, it\'s more fun!"
337 # else /* !ERROR_CHECK_MALLOC */
338 # define xfree(args...) yfree(args)
339 # endif /* ERROR_CHECK_MALLOC */
342 /* generally useful */
343 #define countof(x) ((int) (sizeof(x)/sizeof((x)[0])))
344 #define xnew(type) ((type *) xmalloc (sizeof (type)))
345 #define xnew_atomic(type) ((type *) xmalloc_atomic (sizeof (type)))
346 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type)))
347 #define xnew_atomic_array(type, len) \
348 ((type*)xmalloc_atomic((len) * sizeof(type)))
349 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type)))
350 #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue)))
351 #define xnew_array_and_zero(type, len) \
352 ((type*)xmalloc_and_zero ((len) * sizeof (type)))
353 #define xrealloc_array(ptr, type, len) \
354 ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type))))
355 #define XREALLOC_ARRAY xrealloc_array
356 #define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type)))
358 #if !defined HAVE_DECL_STRDUP
359 extern char *strdup(const char *s);
360 #endif /* HAVE_DECL_STRDUP */
363 # if defined (__GNUC__) && (__GNUC__ >= 2)
364 # define PRINTF_ARGS(string_index,first_to_check) \
365 __attribute__ ((format (printf, string_index, first_to_check)))
367 # define PRINTF_ARGS(string_index,first_to_check)
371 #ifndef DOESNT_RETURN
372 # if defined __GNUC__
373 # if ((__GNUC__ > 2) || (__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))
374 # define DOESNT_RETURN void
375 # define DECLARE_DOESNT_RETURN(decl) \
376 extern void decl __attribute__ ((noreturn))
377 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
378 /* Should be able to state multiple independent __attribute__s, but \
379 the losing syntax doesn't work that way, and screws losing cpp */ \
381 __attribute__ ((noreturn, format (printf, str, idx)))
383 # define DOESNT_RETURN void volatile
384 # define DECLARE_DOESNT_RETURN(decl) extern void volatile decl
385 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
386 extern void volatile decl PRINTF_ARGS(str,idx)
387 # endif /* GNUC 2.5 */
389 # define DOESNT_RETURN void
390 # define DECLARE_DOESNT_RETURN(decl) extern void decl
391 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
392 extern void decl PRINTF_ARGS(str,idx)
396 /* No type has a greater alignment requirement than max_align_t.
397 (except perhaps for types we don't use, like long double) */
414 # if defined (__GNUC__) && (__GNUC__ >= 2)
415 /* gcc has an extension that gives us exactly what we want. */
416 # define ALIGNOF(type) __alignof__ (type)
417 # elif ! defined (__cplusplus)
418 /* The following is mostly portable, except that:
419 - it doesn't work for inside out declarations like void (*) (void).
420 (so just call ALIGNOF with a typedef'ed name)
421 - it doesn't work with C++. The C++ committee has decided,
422 in its infinite wisdom, that:
423 "Types must be declared in declarations, not in expressions." */
424 # define ALIGNOF(type) offsetof (struct { char c; type member; }, member)
426 /* C++ is annoying, but it has a big bag of tricks.
427 The following doesn't have the "inside out" declaration bug C does. */
428 template < typename T > struct alignment_trick {
432 # define ALIGNOF(type) offsetof (alignment_trick<type>, member)
436 #define ALIGN_SIZE(len, unit) \
437 ((((len) + (unit) - 1) / (unit)) * (unit))
439 /* #### Yuck, this is kind of evil */
440 #define ALIGN_PTR(ptr, unit) \
441 ((void *) ALIGN_SIZE ((size_t) (ptr), unit))
444 #define DO_NOTHING do {} while (0)
447 #ifndef DECLARE_NOTHING
448 #define DECLARE_NOTHING struct nosuchstruct
451 /*#ifdef DEBUG_SXEMACS*/
455 /*#define REGISTER register*/
458 /* EMACS_INT is the underlying integral type into which a Lisp_Object must fit.
459 In particular, it must be large enough to contain a pointer.
460 config.h can override this, e.g. to use `long long' for bigger lisp ints.
462 #### In point of fact, it would NOT be a good idea for config.h to mess
463 with EMACS_INT. A lot of code makes the basic assumption that EMACS_INT
464 is the size of a pointer. */
466 #ifndef SIZEOF_EMACS_INT
467 # define SIZEOF_EMACS_INT SIZEOF_VOID_P
471 # if SIZEOF_EMACS_INT == SIZEOF_LONG
472 # define EMACS_INT long
473 # elif SIZEOF_EMACS_INT == SIZEOF_INT
474 # define EMACS_INT int
475 # elif SIZEOF_EMACS_INT == SIZEOF_LONG_LONG_INT
476 # define EMACS_INT long long
478 # error Unable to determine suitable type for EMACS_INT
483 # define EMACS_UINT unsigned EMACS_INT
486 #define BITS_PER_EMACS_INT (SIZEOF_EMACS_INT * BITS_PER_CHAR)
488 /************************************************************************/
490 /************************************************************************/
492 /* We put typedefs here so that prototype declarations don't choke.
493 Note that we don't actually declare the structures here (except
494 maybe for simple structures like Dynarrs); that keeps them private
495 to the routines that actually use them. */
497 /* ------------------------------- */
498 /* basic char/int typedefs */
499 /* ------------------------------- */
501 /* The definitions we put here use typedefs to attribute specific meaning
502 to types that by themselves are pretty general. Stuff pointed to by a
503 char * or unsigned char * will nearly always be one of four types:
504 a) pointer to internally-formatted text; b) pointer to text in some
505 external format, which can be defined as all formats other than the
506 internal one; c) pure ASCII text; d) binary data that is not meant to
507 be interpreted as text. [A fifth possible type "e) a general pointer
508 to memory" should be replaced with void *.] Using these more specific
509 types rather than the general ones helps avoid the confusions that
510 occur when the semantics of a char * argument being studied are unclear. */
512 typedef unsigned char UChar;
514 /* The data representing the text in a buffer is logically a set
515 of Bufbytes, declared as follows. */
517 typedef UChar Bufbyte;
519 /* Explicitly signed or unsigned versions: */
520 typedef UChar UBufbyte;
521 typedef char SBufbyte;
523 /* The data representing a string in "external" format (binary or any
524 external encoding) is logically a set of Extbytes, declared as
525 follows. Extbyte is guaranteed to be just a char, so for example
526 strlen (Extbyte *) is OK. Extbyte is only a documentation device
527 for referring to external text. */
529 typedef char Extbyte;
531 /* A byte in a string in binary format: */
532 typedef char Char_Binary;
533 typedef UChar UChar_Binary;
535 /* A byte in a string in entirely US-ASCII format: (Nothing outside
536 the range 00 - 7F) */
538 typedef char Char_ASCII;
539 typedef UChar UChar_ASCII;
541 /* To the user, a buffer is made up of characters, declared as follows.
542 In the non-Mule world, characters and Bufbytes are equivalent.
543 In the Mule world, a character requires (typically) 1 to 4
544 Bufbytes for its representation in a buffer. */
548 /* Different ways of referring to a position in a buffer. We use
549 the typedefs in preference to 'EMACS_INT' to make it clearer what
550 sort of position is being used. See extents.c for a description
551 of the different positions. We put them here instead of in
552 buffer.h (where they rightfully belong) to avoid syntax errors
553 in function prototypes. */
555 typedef EMACS_INT Bufpos;
556 typedef EMACS_INT Bytind;
557 typedef EMACS_INT Memind;
559 /* Counts of bytes or chars */
561 typedef EMACS_INT Bytecount;
562 typedef EMACS_INT Charcount;
564 /* Length in bytes of a string in external format */
565 typedef EMACS_INT Extcount;
567 /* ------------------------------- */
568 /* structure/other typedefs */
569 /* ------------------------------- */
571 /* Counts of bytes or array elements */
572 typedef EMACS_INT Memory_count;
573 typedef EMACS_INT Element_count;
575 /* is this right here? */
576 typedef struct lstream_s *lstream_t;
578 typedef struct lstream_s Lstream;
580 typedef unsigned int face_index;
583 Dynarr_declare(struct face_cachel);
584 } face_cachel_dynarr;
586 typedef unsigned int glyph_index;
588 /* This is shared by process.h, events.h and others in future.
589 See events.h for description */
590 typedef long unsigned int USID;
593 Dynarr_declare(struct glyph_cachel);
594 } glyph_cachel_dynarr;
596 struct buffer; /* "buffer.h" */
597 struct console; /* "console.h" */
598 struct device; /* "device.h" */
599 struct extent_fragment;
601 typedef struct extent *EXTENT;
602 struct frame; /* "frame.h" */
603 struct window; /* "window.h" */
604 typedef struct Lisp_Event Lisp_Event; /* "events.h" */
605 typedef struct Lisp_Face Lisp_Face; /* "faces.h" */
606 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */
607 struct stat; /* <sys/stat.h> */
608 typedef struct Lisp_Color_Instance Lisp_Color_Instance;
609 typedef struct Lisp_Font_Instance Lisp_Font_Instance;
610 typedef struct Lisp_Image_Instance Lisp_Image_Instance;
611 typedef struct Lisp_Gui_Item Lisp_Gui_Item;
613 struct display_glyph_area;
615 struct redisplay_info;
616 struct window_mirror;
617 struct scrollbar_instance;
618 struct font_metric_info;
620 struct console_type_entry;
623 Dynarr_declare(Bufbyte);
627 Dynarr_declare(Extbyte);
631 Dynarr_declare(Emchar);
635 Dynarr_declare(char);
638 typedef unsigned char unsigned_char;
640 Dynarr_declare(unsigned char);
641 } unsigned_char_dynarr;
643 typedef unsigned long unsigned_long;
645 Dynarr_declare(unsigned long);
646 } unsigned_long_dynarr;
653 Dynarr_declare(Bufpos);
657 Dynarr_declare(Bytind);
661 Dynarr_declare(Charcount);
665 Dynarr_declare(Bytecount);
669 Dynarr_declare(struct console_type_entry);
670 } console_type_entry_dynarr;
672 enum run_hooks_condition {
673 RUN_HOOKS_TO_COMPLETION,
674 RUN_HOOKS_UNTIL_SUCCESS,
675 RUN_HOOKS_UNTIL_FAILURE
694 #ifndef ERROR_CHECK_TYPECHECK
696 typedef enum error_behavior {
702 #define ERRB_EQ(a, b) ((a) == (b))
706 /* By defining it like this, we provide strict type-checking
707 for code that lazily uses ints. */
709 typedef struct _error_behavior_struct_ {
710 int really_unlikely_name_to_have_accidentally_in_a_non_errb_structure;
713 extern Error_behavior ERROR_ME;
714 extern Error_behavior ERROR_ME_NOT;
715 extern Error_behavior ERROR_ME_WARN;
717 #define ERRB_EQ(a, b) \
718 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \
719 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure)
723 enum munge_me_out_the_door {
724 MUNGE_ME_FUNCTION_KEY,
725 MUNGE_ME_KEY_TRANSLATION
728 /* very cool convenience type */
729 typedef size_t sxe_index_t;
731 /************************************************************************/
732 /* Definition of Lisp_Object data type */
733 /************************************************************************/
735 /* Define the fundamental Lisp data structures */
737 /* This is the set of Lisp data types */
746 #define POINTER_TYPE_P(type) ((type) == Lisp_Type_Record)
748 /* Overridden by m/next.h */
749 #ifndef ASSERT_VALID_POINTER
750 # define ASSERT_VALID_POINTER(pnt) assert((((EMACS_UINT) pnt) & 3) == 0)
758 #define INT_VALBITS (BITS_PER_EMACS_INT - INT_GCBITS)
759 #define VALBITS (BITS_PER_EMACS_INT - GCBITS)
760 #define EMACS_INT_MAX ((EMACS_INT) ((1UL << (INT_VALBITS - 1)) -1UL))
761 #define EMACS_INT_MIN (-(EMACS_INT_MAX) - 1)
762 #define NUMBER_FITS_IN_AN_EMACS_INT(num) \
763 ((num) <= EMACS_INT_MAX && (num) >= EMACS_INT_MIN)
765 #include "lisp-disunion.h"
767 #define XPNTR(x) ((void *) XPNTRVAL(x))
769 /* WARNING WARNING WARNING. You must ensure on your own that proper
770 GC protection is provided for the elements in this array. */
772 Dynarr_declare(Lisp_Object);
773 } Lisp_Object_dynarr;
776 Dynarr_declare(Lisp_Object *);
777 } Lisp_Object_ptr_dynarr;
779 /* Close your eyes now lest you vomit or spontaneously combust ... */
781 #define HACKEQ_UNSAFE(obj1, obj2) \
782 (EQ (obj1, obj2) || (!POINTER_TYPE_P (XTYPE (obj1)) \
783 && !POINTER_TYPE_P (XTYPE (obj2)) \
784 && XCHAR_OR_INT (obj1) == XCHAR_OR_INT (obj2)))
787 extern int debug_issue_ebola_notices;
788 int eq_with_ebola_notice(Lisp_Object, Lisp_Object);
789 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) \
790 (debug_issue_ebola_notices ? eq_with_ebola_notice (obj1, obj2) \
793 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) EQ (obj1, obj2)
796 /* OK, you can open them again */
798 /************************************************************************/
799 /** Definitions of basic Lisp objects **/
800 /************************************************************************/
804 /*------------------------------ unbound -------------------------------*/
806 /* Qunbound is a special Lisp_Object (actually of type
807 symbol-value-forward), that can never be visible to
808 the Lisp caller and thus can be used in the C code
809 to mean "no such value". */
811 #define UNBOUNDP(val) EQ (val, Qunbound)
813 /*------------------------------- cons ---------------------------------*/
815 /* In a cons, the markbit of the car is the gc mark bit */
818 struct lrecord_header lheader;
819 /* for seq iterators */
821 Lisp_Object car, cdr;
823 typedef struct Lisp_Cons Lisp_Cons;
825 DECLARE_LRECORD(cons, Lisp_Cons);
826 #define XCONS(x) XRECORD (x, cons, Lisp_Cons)
827 #define XSETCONS(x, p) XSETRECORD (x, p, cons)
828 #define CONSP(x) RECORDP (x, cons)
829 #define CHECK_CONS(x) CHECK_RECORD (x, cons)
830 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons)
832 #define CONS_MARKED_P(c) MARKED_RECORD_HEADER_P(&((c)->lheader))
833 #define MARK_CONS(c) MARK_RECORD_HEADER (&((c)->lheader))
835 extern Lisp_Object Qnil;
837 #define NILP(x) EQ (x, Qnil)
838 #define XCAR(a) (XCONS (a)->car)
839 #define XCDR(a) (XCONS (a)->cdr)
840 #define LISTP(x) (CONSP(x) || NILP(x))
842 #define CHECK_LIST(x) do { \
844 dead_wrong_type_argument (Qlistp, x); \
847 #define CONCHECK_LIST(x) do { \
849 x = wrong_type_argument (Qlistp, x); \
852 /*---------------------- list traversal macros -------------------------*/
854 /* Note: These macros are for traversing through a list in some format,
855 and executing code that you specify on each member of the list.
857 There are two kinds of macros, those requiring surrounding braces, and
858 those not requiring this. Which type of macro will be indicated.
859 The general format for using a brace-requiring macro is
862 LIST_LOOP_3 (elt, list, tail)
869 LIST_LOOP_3 (elt, list, tail)
875 You can put variable declarations between the brace and beginning of
876 macro, but NOTHING ELSE.
878 The brace-requiring macros typically declare themselves any arguments
879 that are initialized and iterated by the macros. If for some reason
880 you need to declare these arguments yourself (e.g. to do something on
881 them before the iteration starts, use the _NO_DECLARE versions of the
885 /* There are two basic kinds of macros: those that handle "internal" lists
886 that are known to be correctly structured (i.e. first element is a cons
887 or nil, and the car of each cons is also a cons or nil, and there are
888 no circularities), and those that handle "external" lists, where the
889 list may have any sort of invalid formation. This is reflected in
890 the names: those with "EXTERNAL_" work with external lists, and those
891 without this prefix work with internal lists. The internal-list
892 macros will hit an assertion failure if the structure is ill-formed;
893 the external-list macros will signal an error in this case, either a
894 malformed-list error or a circular-list error.
896 Note also that the simplest external list iterator, EXTERNAL_LIST_LOOP,
897 does *NOT* check for circularities. Therefore, make sure you call
898 QUIT each iteration or so. However, it's probably easier just to use
899 EXTERNAL_LIST_LOOP_2, which is easier to use in any case.
902 /* LIST_LOOP and EXTERNAL_LIST_LOOP are the simplest macros. They don't
903 require brace surrounding, and iterate through a list, which may or may
904 not known to be syntactically correct. EXTERNAL_LIST_LOOP is for those
905 not known to be correct, and it detects and signals a malformed list
906 error when encountering a problem. Circularities, however, are not
907 handled, and cause looping forever, so make sure to include a QUIT.
908 These functions also accept two args, TAIL (set progressively to each
909 cons starting with the first), and LIST, the list to iterate over.
910 TAIL needs to be defined by the program.
912 In each iteration, you can retrieve the current list item using XCAR
913 (tail), or destructively modify the list using XSETCAR (tail,
916 #define LIST_LOOP(tail, list) \
921 #define EXTERNAL_LIST_LOOP(tail, list) \
922 for (tail = list; !NILP (tail); tail = XCDR (tail)) \
923 if (!CONSP (tail)) { \
924 signal_malformed_list_error (list); \
927 /* The following macros are the "core" macros for list traversal.
929 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
931 LIST_LOOP_2 and EXTERNAL_LIST_LOOP_2 are the standard, most-often used
932 macros. They take two arguments, an element variable ELT and the list
933 LIST. ELT is automatically declared, and set to each element in turn
936 LIST_LOOP_3 and EXTERNAL_LIST_LOOP_3 are the same, but they have a third
937 argument TAIL, another automatically-declared variable. At each iteration,
938 this one points to the cons cell for which ELT is the car.
940 EXTERNAL_LIST_LOOP_4 is like EXTERNAL_LIST_LOOP_3 but takes an additional
941 LEN argument, again automatically declared, which counts the number of
942 iterations gone by. It is 0 during the first iteration.
944 EXTERNAL_LIST_LOOP_4_NO_DECLARE is like EXTERNAL_LIST_LOOP_4 but none
945 of the variables are automatically declared, and so you need to declare
946 them yourself. (ELT and TAIL are Lisp_Objects, and LEN is an EMACS_INT.)
949 #define LIST_LOOP_2(elt, list) \
950 LIST_LOOP_3(elt, list, unused_tail_##elt)
952 #define LIST_LOOP_3(elt, list, tail) \
953 for (Lisp_Object elt, tail = list; \
954 NILP(tail) ? false : (elt = XCAR (tail), true); \
957 /* The following macros are for traversing lisp lists.
958 Signal an error if LIST is not properly acyclic and nil-terminated.
960 Use tortoise/hare algorithm to check for cycles, but only if it
961 looks like the list is getting too long. Not only is the hare
962 faster than the tortoise; it even gets a head start! */
964 /* Optimized and safe macros for looping over external lists. */
965 #define CIRCULAR_LIST_SUSPICION_LENGTH 1024
967 #define EXTERNAL_LIST_LOOP_1(list) \
968 Lisp_Object ELL1_elt, ELL1_hare, ELL1_tortoise; \
969 EMACS_INT ELL1_len; \
970 PRIVATE_EXTERNAL_LIST_LOOP_6 (ELL1_elt, list, ELL1_len, ELL1_hare, \
971 ELL1_tortoise, CIRCULAR_LIST_SUSPICION_LENGTH)
973 #define EXTERNAL_LIST_LOOP_2(elt, list) \
974 Lisp_Object elt, hare_##elt, tortoise_##elt; \
975 EMACS_INT len_##elt; \
976 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, hare_##elt, \
977 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
979 #define EXTERNAL_LIST_LOOP_3(elt, list, tail) \
980 Lisp_Object elt, tail, tortoise_##elt; \
981 EMACS_INT len_##elt; \
982 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, tail, \
983 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
985 #define EXTERNAL_LIST_LOOP_4_NO_DECLARE(elt, list, tail, len) \
986 Lisp_Object tortoise_##elt; \
987 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
988 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
990 #define EXTERNAL_LIST_LOOP_4(elt, list, tail, len) \
991 Lisp_Object elt, tail, tortoise_##elt; \
993 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
994 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
996 #define PRIVATE_EXTERNAL_LIST_LOOP_6(elt, list, len, hare, \
997 tortoise, suspicion_length) \
998 for (tortoise = hare = list, len = 0; \
1000 (CONSP (hare) ? ((elt = XCAR (hare)), 1) : \
1001 (NILP (hare) ? 0 : \
1002 (signal_malformed_list_error (list), 0))); \
1004 hare = XCDR (hare), \
1006 ((++len > suspicion_length) \
1008 ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \
1009 (EQ (hare, tortoise) && (signal_circular_list_error (list), 0)))))
1011 /* GET_LIST_LENGTH and GET_EXTERNAL_LIST_LENGTH:
1013 These two macros return the length of LIST (either an internal or external
1014 list, according to which macro is used), stored into LEN (which must
1015 be declared by the caller). Circularities are trapped in external lists
1016 (and cause errors). Neither macro need be declared inside brackets. */
1018 #define GET_LIST_LENGTH(list, len) do { \
1019 Lisp_Object GLL_tail; \
1020 for (GLL_tail = list, len = 0; \
1022 GLL_tail = XCDR (GLL_tail), ++len) \
1026 #define GET_EXTERNAL_LIST_LENGTH(list, len) \
1028 Lisp_Object GELL_elt, GELL_tail; \
1029 EXTERNAL_LIST_LOOP_4_NO_DECLARE (GELL_elt, list, GELL_tail, len) \
1033 /* For a list that's known to be in valid list format, where we may
1034 be deleting the current element out of the list --
1035 will abort() if the list is not in valid format */
1036 #define LIST_LOOP_DELETING(consvar, nextconsvar, list) \
1037 for (consvar = list; \
1038 !NILP (consvar) ? (nextconsvar = XCDR (consvar), 1) :0; \
1039 consvar = nextconsvar)
1041 /* LIST_LOOP_DELETE_IF and EXTERNAL_LIST_LOOP_DELETE_IF:
1043 These two macros delete all elements of LIST (either an internal or
1044 external list, according to which macro is used) satisfying
1045 CONDITION, a C expression referring to variable ELT. ELT is
1046 automatically declared. Circularities are trapped in external
1047 lists (and cause errors). Neither macro need be declared inside
1050 #define LIST_LOOP_DELETE_IF(elt, list, condition) do { \
1051 /* Do not use ##list when creating new variables because \
1052 that may not be just a variable name. */ \
1053 Lisp_Object prev_tail_##elt = Qnil; \
1054 LIST_LOOP_3 (elt, list, tail_##elt) \
1058 if (NILP (prev_tail_##elt)) \
1059 list = XCDR (tail_##elt); \
1061 XCDR (prev_tail_##elt) = XCDR (tail_##elt); \
1064 prev_tail_##elt = tail_##elt; \
1068 #define EXTERNAL_LIST_LOOP_DELETE_IF(elt, list, condition) do { \
1069 Lisp_Object prev_tail_##elt = Qnil; \
1070 EXTERNAL_LIST_LOOP_4 (elt, list, tail_##elt, len_##elt) \
1074 if (NILP (prev_tail_##elt)) \
1075 list = XCDR (tail_##elt); \
1077 XCDR (prev_tail_##elt) = XCDR (tail_##elt); \
1078 /* Keep tortoise from ever passing hare. */ \
1082 prev_tail_##elt = tail_##elt; \
1086 /* Macros for looping over external alists.
1088 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
1090 EXTERNAL_ALIST_LOOP_4 is similar to EXTERNAL_LIST_LOOP_2, but it
1091 assumes the elements are aconses (the elements in an alist) and
1092 sets two additional argument variables ELT_CAR and ELT_CDR to the
1093 car and cdr of the acons. All of the variables ELT, ELT_CAR and
1094 ELT_CDR are automatically declared.
1096 EXTERNAL_ALIST_LOOP_5 adds a TAIL argument to EXTERNAL_ALIST_LOOP_4,
1097 just like EXTERNAL_LIST_LOOP_3 does, and again TAIL is automatically
1100 EXTERNAL_ALIST_LOOP_6 adds a LEN argument to EXTERNAL_ALIST_LOOP_5,
1101 just like EXTERNAL_LIST_LOOP_4 does, and again LEN is automatically
1104 EXTERNAL_ALIST_LOOP_6_NO_DECLARE does not declare any of its arguments,
1105 just like EXTERNAL_LIST_LOOP_4_NO_DECLARE, and so these must be declared
1109 /* Optimized and safe macros for looping over external alists. */
1110 #define EXTERNAL_ALIST_LOOP_4(elt, elt_car, elt_cdr, list) \
1111 Lisp_Object elt, elt_car, elt_cdr; \
1112 Lisp_Object hare_##elt, tortoise_##elt; \
1113 EMACS_INT len_##elt; \
1114 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
1115 len_##elt, hare_##elt, tortoise_##elt, \
1116 CIRCULAR_LIST_SUSPICION_LENGTH)
1118 #define EXTERNAL_ALIST_LOOP_5(elt, elt_car, elt_cdr, list, tail) \
1119 Lisp_Object elt, elt_car, elt_cdr, tail; \
1120 Lisp_Object tortoise_##elt; \
1121 EMACS_INT len_##elt; \
1122 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
1123 len_##elt, tail, tortoise_##elt, \
1124 CIRCULAR_LIST_SUSPICION_LENGTH) \
1126 #define EXTERNAL_ALIST_LOOP_6(elt, elt_car, elt_cdr, list, tail, len) \
1127 Lisp_Object elt, elt_car, elt_cdr, tail; \
1129 Lisp_Object tortoise_##elt; \
1130 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
1131 len, tail, tortoise_##elt, \
1132 CIRCULAR_LIST_SUSPICION_LENGTH)
1134 #define EXTERNAL_ALIST_LOOP_6_NO_DECLARE(elt, elt_car, elt_cdr, list, \
1136 Lisp_Object tortoise_##elt; \
1137 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
1138 len, tail, tortoise_##elt, \
1139 CIRCULAR_LIST_SUSPICION_LENGTH)
1141 #define PRIVATE_EXTERNAL_ALIST_LOOP_8(elt, elt_car, elt_cdr, list, len, \
1142 hare, tortoise, suspicion_length) \
1143 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, hare, tortoise, \
1145 if (CONSP (elt) ? (elt_car = XCAR (elt), elt_cdr = XCDR (elt), 0) :1) \
1149 /* Macros for looping over external property lists.
1151 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
1153 EXTERNAL_PROPERTY_LIST_LOOP_3 maps over an external list assumed to
1154 be a property list, consisting of alternating pairs of keys
1155 (typically symbols or keywords) and values. Each iteration
1156 processes one such pair out of LIST, assigning the two elements to
1157 KEY and VALUE respectively. Malformed lists and circularities are
1158 trapped as usual, and in addition, property lists with an odd number
1159 of elements also signal an error.
1161 EXTERNAL_PROPERTY_LIST_LOOP_4 adds a TAIL argument to
1162 EXTERNAL_PROPERTY_LIST_LOOP_3, just like EXTERNAL_LIST_LOOP_3 does,
1163 and again TAIL is automatically declared.
1165 EXTERNAL_PROPERTY_LIST_LOOP_5 adds a LEN argument to
1166 EXTERNAL_PROPERTY_LIST_LOOP_4, just like EXTERNAL_LIST_LOOP_4 does,
1167 and again LEN is automatically declared. Note that in this case,
1168 LEN counts the iterations, NOT the total number of list elements
1169 processed, which is 2 * LEN.
1171 EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE does not declare any of its
1172 arguments, just like EXTERNAL_LIST_LOOP_4_NO_DECLARE, and so these
1173 must be declared manually. */
1175 /* Optimized and safe macros for looping over external property lists. */
1176 #define EXTERNAL_PROPERTY_LIST_LOOP_3(key, value, list) \
1177 Lisp_Object key, value, hare_##key, tortoise_##key; \
1178 EMACS_INT len_##key; \
1179 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len_##key, hare_##key, \
1180 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
1182 #define EXTERNAL_PROPERTY_LIST_LOOP_4(key, value, list, tail) \
1183 Lisp_Object key, value, tail, tortoise_##key; \
1184 EMACS_INT len_##key; \
1185 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len_##key, tail, \
1186 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
1188 #define EXTERNAL_PROPERTY_LIST_LOOP_5(key, value, list, tail, len) \
1189 Lisp_Object key, value, tail, tortoise_##key; \
1191 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \
1192 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
1194 #define EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE(key, value, list, \
1196 Lisp_Object tortoise_##key; \
1197 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \
1198 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
1200 #define EXTERNAL_PROPERTY_LIST_LOOP_7(key, value, list, len, hare, \
1201 tortoise, suspicion_length) \
1202 for (tortoise = hare = list, len = 0; \
1205 (key = XCAR (hare), \
1206 hare = XCDR (hare), \
1207 (CONSP (hare) ? 1 : \
1208 (signal_malformed_property_list_error (list), 0)))) ? \
1209 (value = XCAR (hare), 1) : \
1210 (NILP (hare) ? 0 : \
1211 (signal_malformed_property_list_error (list), 0))); \
1213 hare = XCDR (hare), \
1214 ((++len < suspicion_length) ? \
1217 ((void) (tortoise = XCDR (XCDR (tortoise)))) : \
1220 (EQ (hare, tortoise) ? \
1221 ((void) signal_circular_property_list_error (list)) : \
1224 /* For a property list (alternating keywords/values) that may not be
1225 in valid list format -- will signal an error if the list is not in
1226 valid format. CONSVAR is used to keep track of the iterations
1227 without modifying PLIST.
1229 We have to be tricky to still keep the same C format.*/
1230 #define EXTERNAL_PROPERTY_LIST_LOOP(tail, key, value, plist) \
1231 for (tail = plist; \
1232 (CONSP (tail) && CONSP (XCDR (tail)) ? \
1233 (key = XCAR (tail), value = XCAR (XCDR (tail))) : \
1234 (key = Qunbound, value = Qunbound)), \
1236 tail = XCDR (XCDR (tail))) \
1237 if (UNBOUNDP (key)) \
1238 Fsignal (Qmalformed_property_list, list1 (plist)); \
1241 #define PROPERTY_LIST_LOOP(tail, key, value, plist) \
1242 for (tail = plist; \
1244 (key = XCAR (tail), tail = XCDR (tail), \
1245 value = XCAR (tail), tail = XCDR (tail), 1); \
1248 /* Return 1 if LIST is properly acyclic and nil-terminated, else 0. */
1249 extern_inline int TRUE_LIST_P(Lisp_Object object);
1250 extern_inline int TRUE_LIST_P(Lisp_Object object)
1252 Lisp_Object hare, tortoise;
1255 for (hare = tortoise = object, len = 0;
1256 CONSP(hare); hare = XCDR(hare), len++) {
1257 if (len < CIRCULAR_LIST_SUSPICION_LENGTH)
1261 tortoise = XCDR(tortoise);
1262 else if (EQ(hare, tortoise))
1269 /* Signal an error if LIST is not properly acyclic and nil-terminated. */
1270 #define CHECK_TRUE_LIST(list) do { \
1271 Lisp_Object CTL_list = (list); \
1272 Lisp_Object CTL_hare, CTL_tortoise; \
1273 EMACS_INT CTL_len; \
1275 for (CTL_hare = CTL_tortoise = CTL_list, CTL_len = 0; \
1277 CTL_hare = XCDR (CTL_hare), CTL_len++) \
1279 if (CTL_len < CIRCULAR_LIST_SUSPICION_LENGTH) \
1283 CTL_tortoise = XCDR (CTL_tortoise); \
1284 else if (EQ (CTL_hare, CTL_tortoise)) \
1285 Fsignal (Qcircular_list, list1 (CTL_list)); \
1288 if (! NILP (CTL_hare)) \
1289 signal_malformed_list_error (CTL_list); \
1292 /*------------------------------ string --------------------------------*/
1294 struct Lisp_String {
1295 struct lrecord_header lheader;
1298 #ifdef EF_USE_COMPRE
1303 typedef struct Lisp_String Lisp_String;
1305 DECLARE_LRECORD(string, Lisp_String);
1306 #define XSTRING(x) XRECORD (x, string, Lisp_String)
1307 #define XSETSTRING(x, p) XSETRECORD (x, p, string)
1308 #define STRINGP(x) RECORDP (x, string)
1309 #define CHECK_STRING(x) CHECK_RECORD (x, string)
1310 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string)
1314 Charcount bytecount_to_charcount(const Bufbyte * ptr, Bytecount len);
1315 Bytecount charcount_to_bytecount(const Bufbyte * ptr, Charcount len);
1317 #else /* not MULE */
1319 # define bytecount_to_charcount(ptr, len) (len)
1320 # define charcount_to_bytecount(ptr, len) (len)
1322 #endif /* not MULE */
1324 #define string_length(s) ((s)->size)
1325 #define XSTRING_LENGTH(s) string_length (XSTRING (s))
1326 #define XSTRING_CHAR_LENGTH(s) string_char_length (XSTRING (s))
1327 #define string_data(s) ((s)->data + 0)
1328 #define XSTRING_DATA(s) string_data (XSTRING (s))
1329 #define string_byte(s, i) ((s)->data[i] + 0)
1330 #define XSTRING_BYTE(s, i) string_byte (XSTRING (s), i)
1331 #define string_byte_addr(s, i) (&((s)->data[i]))
1332 #define set_string_length(s, len) ((void) ((s)->size = (len)))
1333 #define set_string_data(s, ptr) ((void) ((s)->data = (ptr)))
1334 #define set_string_byte(s, i, b) ((void) ((s)->data[i] = (b)))
1336 void resize_string(Lisp_String * s, Bytecount pos, Bytecount delta);
1340 extern_inline Charcount string_char_length(const Lisp_String *s);
1341 extern_inline Charcount string_char_length(const Lisp_String *s)
1343 return bytecount_to_charcount(string_data(s), string_length(s));
1346 # define string_char(s, i) charptr_emchar_n (string_data (s), i)
1347 # define string_char_addr(s, i) charptr_n_addr (string_data (s), i)
1348 void set_string_char(Lisp_String * s, Charcount i, Emchar c);
1350 #else /* not MULE */
1352 # define string_char_length(s) string_length (s)
1353 # define string_char(s, i) ((Emchar) string_byte (s, i))
1354 # define string_char_addr(s, i) string_byte_addr (s, i)
1355 # define set_string_char(s, i, c) set_string_byte (s, i, (Bufbyte)c)
1357 #endif /* not MULE */
1359 /* Return the true aligned size of a struct whose last member is a
1360 variable-length array field. (this is known as the "struct hack") */
1361 /* Implementation: in practice, structtype and fieldtype usually have
1362 the same alignment, but we can't be sure. We need to use
1363 ALIGN_SIZE to be absolutely sure of getting the correct alignment.
1364 To help the compiler's optimizer, we use a ternary expression that
1365 only a very stupid compiler would fail to correctly simplify. */
1366 #define FLEXIBLE_ARRAY_STRUCT_SIZEOF(structtype, \
1370 (ALIGNOF (structtype) == ALIGNOF (fieldtype) \
1371 ? (offsetof (structtype, fieldname) + \
1372 (offsetof (structtype, fieldname[1]) - \
1373 offsetof (structtype, fieldname[0])) * \
1376 ((offsetof (structtype, fieldname) + \
1377 (offsetof (structtype, fieldname[1]) - \
1378 offsetof (structtype, fieldname[0])) * \
1380 ALIGNOF (structtype))))
1382 /*------------------------------ vector --------------------------------*/
1384 struct Lisp_Vector {
1385 struct lcrecord_header header;
1386 /* the sequence category */
1388 /* this vector's length */
1390 /* next is now chained through v->contents[size], terminated by Qzero.
1391 This means that pure vectors don't need a "next" */
1392 /* struct Lisp_Vector *next; */
1393 Lisp_Object contents[1];
1395 typedef struct Lisp_Vector Lisp_Vector;
1397 DECLARE_LRECORD(vector, Lisp_Vector);
1398 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector)
1399 #define XSETVECTOR(x, p) XSETRECORD (x, p, vector)
1400 #define VECTORP(x) RECORDP (x, vector)
1401 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector)
1402 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector)
1404 #define vector_length(v) ((v)->size)
1405 #define XVECTOR_LENGTH(s) vector_length (XVECTOR (s))
1406 #define vector_data(v) ((v)->contents)
1407 #define XVECTOR_DATA(s) vector_data (XVECTOR (s))
1409 /*---------------------------- bit vectors -----------------------------*/
1411 #if (SXE_LONGBITS < 16)
1412 #error What the hell?!
1413 #elif (SXE_LONGBITS < 32)
1414 # define LONGBITS_LOG2 4
1415 # define LONGBITS_POWER_OF_2 16
1416 #elif (SXE_LONGBITS < 64)
1417 # define LONGBITS_LOG2 5
1418 # define LONGBITS_POWER_OF_2 32
1419 #elif (SXE_LONGBITS < 128)
1420 # define LONGBITS_LOG2 6
1421 # define LONGBITS_POWER_OF_2 64
1423 #error You really have 128-bit integers?!
1426 struct Lisp_Bit_Vector {
1427 struct lrecord_header lheader;
1429 /* category subsystem */
1434 unsigned long bits[1];
1436 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector;
1438 DECLARE_LRECORD(bit_vector, Lisp_Bit_Vector);
1439 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector)
1440 #define XSETBIT_VECTOR(x, p) XSETRECORD (x, p, bit_vector)
1441 #define BIT_VECTORP(x) RECORDP (x, bit_vector)
1442 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector)
1443 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector)
1445 #define BITP(x) (INTP (x) && (XINT (x) == 0 || XINT (x) == 1))
1447 #define CHECK_BIT(x) do { \
1449 dead_wrong_type_argument (Qbitp, x);\
1452 #define CONCHECK_BIT(x) do { \
1454 x = wrong_type_argument (Qbitp, x); \
1457 #define bit_vector_length(v) ((v)->size)
1458 #define bit_vector_next(v) ((v)->next)
1460 extern_inline int bit_vector_bit(const Lisp_Bit_Vector *v, size_t n);
1461 extern_inline int bit_vector_bit(const Lisp_Bit_Vector *v, size_t n)
1463 return ((v->bits[n >> LONGBITS_LOG2] >> (n & (LONGBITS_POWER_OF_2 - 1)))
1467 extern_inline void set_bit_vector_bit(Lisp_Bit_Vector *v, size_t n, int value);
1468 extern_inline void set_bit_vector_bit(Lisp_Bit_Vector *v, size_t n, int value)
1471 v->bits[n >> LONGBITS_LOG2] |=
1472 (1UL << (n & (LONGBITS_POWER_OF_2 - 1)));
1474 v->bits[n >> LONGBITS_LOG2] &=
1475 ~(1UL << (n & (LONGBITS_POWER_OF_2 - 1)));
1478 /* Number of longs required to hold LEN bits */
1479 #define BIT_VECTOR_LONG_STORAGE(len) \
1480 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2)
1482 /*------------------------------ symbol --------------------------------*/
1484 typedef struct Lisp_Symbol Lisp_Symbol;
1485 struct Lisp_Symbol {
1486 struct lrecord_header lheader;
1487 /* next symbol in this obarray bucket */
1491 Lisp_Object function;
1495 #define SYMBOL_IS_KEYWORD(sym) \
1496 ((string_byte (symbol_name (XSYMBOL (sym)), 0) == ':') \
1497 && EQ (sym, oblookup (Vobarray, \
1498 string_data (symbol_name (XSYMBOL (sym))), \
1499 string_length (symbol_name (XSYMBOL (sym))))))
1500 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj))
1502 DECLARE_LRECORD(symbol, Lisp_Symbol);
1503 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol)
1504 #define XSETSYMBOL(x, p) XSETRECORD (x, p, symbol)
1505 #define SYMBOLP(x) RECORDP (x, symbol)
1506 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol)
1507 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol)
1509 #define symbol_next(s) ((s)->next)
1510 #define symbol_name(s) ((s)->name)
1511 #define symbol_value(s) ((s)->value)
1512 #define symbol_function(s) ((s)->function)
1513 #define symbol_plist(s) ((s)->plist)
1515 /*------------------------------- subr ---------------------------------*/
1517 typedef Lisp_Object(*lisp_fn_t) (void);
1520 struct lrecord_header lheader;
1528 typedef struct Lisp_Subr Lisp_Subr;
1530 DECLARE_LRECORD(subr, Lisp_Subr);
1531 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr)
1532 #define XSETSUBR(x, p) XSETRECORD (x, p, subr)
1533 #define SUBRP(x) RECORDP (x, subr)
1534 #define CHECK_SUBR(x) CHECK_RECORD (x, subr)
1535 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr)
1537 #define subr_function(subr) ((subr)->subr_fn)
1538 #define SUBR_FUNCTION(subr,max_args) \
1539 ((Lisp_Object (*) (EXFUN_##max_args)) (subr)->subr_fn)
1540 #define subr_name(subr) ((subr)->name)
1542 /*------------------------------ marker --------------------------------*/
1544 typedef struct Lisp_Marker Lisp_Marker;
1545 struct Lisp_Marker {
1546 struct lrecord_header lheader;
1549 struct buffer *buffer;
1551 char insertion_type;
1554 DECLARE_LRECORD(marker, Lisp_Marker);
1555 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker)
1556 #define XSETMARKER(x, p) XSETRECORD (x, p, marker)
1557 #define MARKERP(x) RECORDP (x, marker)
1558 #define CHECK_MARKER(x) CHECK_RECORD (x, marker)
1559 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker)
1561 /* The second check was looking for GCed markers still in use */
1562 /* if (INTP (XMARKER (x)->lheader.next.v)) abort (); */
1564 #define marker_next(m) ((m)->next)
1565 #define marker_prev(m) ((m)->prev)
1567 /*------------------------------- char ---------------------------------*/
1569 #define CHARP(x) (XTYPE (x) == Lisp_Type_Char)
1571 #ifdef ERROR_CHECK_TYPECHECK
1573 extern_inline Emchar XCHAR(Lisp_Object obj);
1574 extern_inline Emchar XCHAR(Lisp_Object obj)
1577 return XCHARVAL(obj);
1582 #define XCHAR(x) ((Emchar)XCHARVAL (x))
1586 #define CHECK_CHAR(x) CHECK_NONRECORD (x, Lisp_Type_Char, Qcharacterp)
1587 #define CONCHECK_CHAR(x) CONCHECK_NONRECORD (x, Lisp_Type_Char, Qcharacterp)
1589 /*------------------------------ float ---------------------------------*/
1591 /* moved to ent-float.h */
1593 /*-------------------------------- int ---------------------------------*/
1595 #define ZEROP(x) EQ (x, Qzero)
1597 #ifdef ERROR_CHECK_TYPECHECK
1599 extern_inline EMACS_INT XINT(Lisp_Object obj);
1600 extern_inline EMACS_INT XINT(Lisp_Object obj)
1603 return XREALINT(obj);
1606 extern_inline EMACS_INT XCHAR_OR_INT(Lisp_Object obj);
1607 extern_inline EMACS_INT XCHAR_OR_INT(Lisp_Object obj)
1609 assert(INTP(obj) || CHARP(obj));
1610 return CHARP(obj) ? XCHAR(obj) : XINT(obj);
1613 #else /* no error checking */
1615 #define XINT(obj) XREALINT (obj)
1616 #define XCHAR_OR_INT(obj) (CHARP (obj) ? XCHAR (obj) : XINT (obj))
1618 #endif /* no error checking */
1620 #define CHECK_INT(x) do { \
1622 dead_wrong_type_argument (Qintegerp, x); \
1625 #define CONCHECK_INT(x) do { \
1627 x = wrong_type_argument (Qintegerp, x); \
1630 #define NATNUMP(x) (INTP (x) && XINT (x) >= 0)
1632 #define CHECK_NATNUM(x) do { \
1634 dead_wrong_type_argument (Qnatnump, x); \
1637 #define CONCHECK_NATNUM(x) do { \
1639 x = wrong_type_argument (Qnatnump, x); \
1642 /* next three always continuable because they coerce their arguments. */
1643 #define CHECK_INT_COERCE_CHAR(x) do { \
1646 else if (CHARP (x)) \
1647 x = make_int (XCHAR (x)); \
1649 x = wrong_type_argument (Qinteger_or_char_p, x); \
1652 #define CHECK_INT_COERCE_MARKER(x) do { \
1655 else if (MARKERP (x)) \
1656 x = make_int (marker_position (x)); \
1658 x = wrong_type_argument (Qinteger_or_marker_p, x); \
1661 #define CHECK_INT_COERCE_CHAR_OR_MARKER(x) do { \
1664 else if (CHARP (x)) \
1665 x = make_int (XCHAR (x)); \
1666 else if (MARKERP (x)) \
1667 x = make_int (marker_position (x)); \
1669 x = wrong_type_argument (Qinteger_char_or_marker_p, x); \
1672 /*--------------------------- readonly objects -------------------------*/
1674 #define CHECK_C_WRITEABLE(obj) \
1675 do { if (c_readonly (obj)) c_write_error (obj); } while (0)
1677 #define CHECK_LISP_WRITEABLE(obj) \
1678 do { if (lisp_readonly (obj)) lisp_write_error (obj); } while (0)
1680 #define C_READONLY(obj) (C_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
1681 #define LISP_READONLY(obj) (LISP_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
1683 /*----------------------------- structures -----------------------------*/
1685 typedef struct structure_keyword_entry structure_keyword_entry;
1686 struct structure_keyword_entry {
1687 Lisp_Object keyword;
1688 int (*validate) (Lisp_Object keyword, Lisp_Object value,
1689 Error_behavior errb);
1693 Dynarr_declare(structure_keyword_entry);
1694 } structure_keyword_entry_dynarr;
1696 typedef struct structure_type structure_type;
1697 struct structure_type {
1699 structure_keyword_entry_dynarr *keywords;
1700 int (*validate) (Lisp_Object data, Error_behavior errb);
1701 Lisp_Object(*instantiate) (Lisp_Object data);
1705 Dynarr_declare(structure_type);
1706 } structure_type_dynarr;
1708 struct structure_type *define_structure_type(Lisp_Object type, int (*validate)
1710 Error_behavior errb),
1711 Lisp_Object(*instantiate)
1712 (Lisp_Object data));
1713 void define_structure_type_keyword(struct structure_type *st,
1714 Lisp_Object keyword,
1715 int (*validate) (Lisp_Object keyword,
1717 Error_behavior errb));
1719 /*---------------------------- weak lists ------------------------------*/
1721 enum weak_list_type {
1722 /* element disappears if it's unmarked. */
1724 /* element disappears if it's a cons and either its car or
1727 /* element disappears if it's a cons and its car is unmarked. */
1728 WEAK_LIST_KEY_ASSOC,
1729 /* element disappears if it's a cons and its cdr is unmarked. */
1730 WEAK_LIST_VALUE_ASSOC,
1731 /* element disappears if it's a cons and neither its car nor
1732 its cdr is marked. */
1733 WEAK_LIST_FULL_ASSOC
1737 struct lcrecord_header header;
1738 Lisp_Object list; /* don't mark through this! */
1739 enum weak_list_type type;
1740 Lisp_Object next_weak; /* don't mark through this! */
1743 DECLARE_LRECORD(weak_list, struct weak_list);
1744 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list)
1745 #define XSETWEAK_LIST(x, p) XSETRECORD (x, p, weak_list)
1746 #define WEAK_LISTP(x) RECORDP (x, weak_list)
1747 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list)
1748 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list)
1750 #define weak_list_list(w) ((w)->list)
1751 #define XWEAK_LIST_LIST(w) (XWEAK_LIST (w)->list)
1753 Lisp_Object make_weak_list(enum weak_list_type type);
1754 /* The following two are only called by the garbage collector */
1755 int finish_marking_weak_lists(void);
1756 void prune_weak_lists(void);
1758 /*-------------------------- lcrecord-list -----------------------------*/
1760 struct lcrecord_list {
1761 struct lcrecord_header header;
1764 const struct lrecord_implementation *implementation;
1767 DECLARE_LRECORD(lcrecord_list, struct lcrecord_list);
1768 #define XLCRECORD_LIST(x) XRECORD (x, lcrecord_list, struct lcrecord_list)
1769 #define XSETLCRECORD_LIST(x, p) XSETRECORD (x, p, lcrecord_list)
1770 #define LCRECORD_LISTP(x) RECORDP (x, lcrecord_list)
1771 /* #define CHECK_LCRECORD_LIST(x) CHECK_RECORD (x, lcrecord_list)
1772 Lcrecord lists should never escape to the Lisp level, so
1773 functions should not be doing this. */
1775 Lisp_Object make_lcrecord_list(size_t size, const struct lrecord_implementation
1777 Lisp_Object allocate_managed_lcrecord(Lisp_Object lcrecord_list);
1778 void free_managed_lcrecord(Lisp_Object lcrecord_list, Lisp_Object lcrecord);
1780 /************************************************************************/
1781 /* Definitions of primitive Lisp functions and variables */
1782 /************************************************************************/
1784 /* DEFUN - Define a built-in Lisp-visible C function or `subr'.
1785 `lname' should be the name to give the function in Lisp,
1786 as a null-terminated C string.
1787 `Fname' should be the C equivalent of `lname', using only characters
1788 valid in a C identifier, with an "F" prepended.
1789 The name of the C constant structure that records information
1790 on this function for internal use is "S" concatenated with Fname.
1791 `min_args' should be a number, the minimum number of arguments allowed.
1792 `max_args' should be a number, the maximum number of arguments allowed,
1793 or else MANY or UNEVALLED.
1794 MANY means pass a vector of evaluated arguments,
1795 in the form of an integer number-of-arguments
1796 followed by the address of a vector of Lisp_Objects
1797 which contains the argument values.
1798 UNEVALLED means pass the list of unevaluated arguments.
1799 `prompt' says how to read arguments for an interactive call.
1800 See the doc string for `interactive'.
1801 A null string means call interactively with no arguments.
1802 `arglist' are the comma-separated arguments (always Lisp_Objects) for
1804 The docstring for the function is placed as a "C" comment between
1805 the prompt and the `args' argument. make-docfile reads the
1806 comment and creates the DOC file from it.
1809 #define EXFUN_0 void
1810 #define EXFUN_1 Lisp_Object
1811 #define EXFUN_2 Lisp_Object,Lisp_Object
1812 #define EXFUN_3 Lisp_Object,Lisp_Object,Lisp_Object
1813 #define EXFUN_4 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object
1814 #define EXFUN_5 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object
1815 #define EXFUN_6 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
1817 #define EXFUN_7 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
1818 Lisp_Object,Lisp_Object
1819 #define EXFUN_8 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
1820 Lisp_Object,Lisp_Object,Lisp_Object
1821 #define EXFUN_MANY int, Lisp_Object*
1822 #define EXFUN_UNEVALLED Lisp_Object
1823 #define EXFUN(sym, max_args) Lisp_Object sym (EXFUN_##max_args)
1825 #define SUBR_MAX_ARGS 8
1827 #define UNEVALLED -1
1829 /* Can't be const, because then subr->doc is read-only and
1830 Snarf_documentation chokes */
1832 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \
1833 Lisp_Object Fname (EXFUN_##max_args); \
1834 static struct Lisp_Subr S##Fname = \
1836 { /* struct lrecord_header */ \
1837 lrecord_type_subr, /* lrecord_type_index */ \
1839 1, /* c_readonly bit */ \
1840 1 /* lisp_readonly bit */ \
1845 0, /* doc string */ \
1849 Lisp_Object Fname (DEFUN_##max_args arglist)
1851 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a
1852 prototype that matches max_args, and add the obligatory
1853 `Lisp_Object' type declaration to the formal C arguments. */
1855 #define DEFUN_MANY(named_int, named_Lisp_Object) named_int, named_Lisp_Object
1856 #define DEFUN_UNEVALLED(args) Lisp_Object args
1857 #define DEFUN_0() void
1858 #define DEFUN_1(a) Lisp_Object a
1859 #define DEFUN_2(a,b) DEFUN_1(a), Lisp_Object b
1860 #define DEFUN_3(a,b,c) DEFUN_2(a,b), Lisp_Object c
1861 #define DEFUN_4(a,b,c,d) DEFUN_3(a,b,c), Lisp_Object d
1862 #define DEFUN_5(a,b,c,d,e) DEFUN_4(a,b,c,d), Lisp_Object e
1863 #define DEFUN_6(a,b,c,d,e,f) DEFUN_5(a,b,c,d,e), Lisp_Object f
1864 #define DEFUN_7(a,b,c,d,e,f,g) DEFUN_6(a,b,c,d,e,f), Lisp_Object g
1865 #define DEFUN_8(a,b,c,d,e,f,g,h) DEFUN_7(a,b,c,d,e,f,g),Lisp_Object h
1867 /* WARNING: If you add defines here for higher values of max_args,
1868 make sure to also fix the clauses in PRIMITIVE_FUNCALL(),
1869 and change the define of SUBR_MAX_ARGS above. */
1871 #include "symeval.h"
1873 /* `specpdl' is the special binding/unwind-protect stack.
1875 Knuth says (see the Jargon File):
1876 At MIT, `pdl' [abbreviation for `Push Down List'] used to
1877 be a more common synonym for `stack'.
1878 Everywhere else `stack' seems to be the preferred term.
1880 specpdl_depth is the current depth of `specpdl'.
1881 Save this for use later as arg to `unbind_to'. */
1882 extern int specpdl_depth_counter;
1883 #define specpdl_depth() specpdl_depth_counter
1885 #define CHECK_FUNCTION(fun) do { \
1886 while (NILP (Ffunctionp (fun))) \
1887 signal_invalid_function_error (fun); \
1890 /************************************************************************/
1891 /* Checking for QUIT */
1892 /************************************************************************/
1894 /* Asynchronous events set something_happened, and then are processed
1895 within the QUIT macro. At this point, we are guaranteed to not be in
1896 any sensitive code. */
1898 extern volatile int something_happened;
1899 int check_what_happened(void);
1901 extern volatile int quit_check_signal_happened;
1902 extern volatile int quit_check_signal_tick_count;
1903 int check_quit(void);
1905 void signal_quit(void);
1907 /* Nonzero if ought to quit now. */
1909 ((quit_check_signal_happened ? check_quit () : 0), \
1910 (!NILP (Vquit_flag) && (NILP (Vinhibit_quit) \
1911 || EQ (Vquit_flag, Qcritical))))
1913 /* QUIT used to call QUITP, but there are some places where QUITP
1914 is called directly, and check_what_happened() should only be called
1915 when Emacs is actually ready to quit because it could do things
1916 like switch threads. */
1917 #define INTERNAL_QUITP \
1918 ((something_happened ? check_what_happened () : 0), \
1919 (!NILP (Vquit_flag) && \
1920 (NILP (Vinhibit_quit) || EQ (Vquit_flag, Qcritical))))
1922 #define INTERNAL_REALLY_QUITP \
1923 (check_what_happened (), \
1924 (!NILP (Vquit_flag) && \
1925 (NILP (Vinhibit_quit) || EQ (Vquit_flag, Qcritical))))
1927 /* Check quit-flag and quit if it is non-nil. Also do any other things
1928 that might have gotten queued until it was safe. */
1929 #define QUIT do { if (INTERNAL_QUITP) signal_quit (); } while (0)
1931 #define REALLY_QUIT do { if (INTERNAL_REALLY_QUITP) signal_quit (); } while (0)
1933 /************************************************************************/
1935 /************************************************************************/
1936 typedef long unsigned int hcode_t;
1938 /* #### for a 64-bit machine, we should substitute a prime just over 2^32 */
1939 #define GOOD_HASH 65599 /* prime number just over 2^16; Dragon book, p. 435 */
1940 #define HASH2(a,b) (GOOD_HASH * (a) + (b))
1941 #define HASH3(a,b,c) (GOOD_HASH * HASH2 (a,b) + (c))
1942 #define HASH4(a,b,c,d) (GOOD_HASH * HASH3 (a,b,c) + (d))
1943 #define HASH5(a,b,c,d,e) (GOOD_HASH * HASH4 (a,b,c,d) + (e))
1944 #define HASH6(a,b,c,d,e,f) (GOOD_HASH * HASH5 (a,b,c,d,e) + (f))
1945 #define HASH7(a,b,c,d,e,f,g) (GOOD_HASH * HASH6 (a,b,c,d,e,f) + (g))
1946 #define HASH8(a,b,c,d,e,f,g,h) (GOOD_HASH * HASH7 (a,b,c,d,e,f,g) + (h))
1947 #define HASH9(a,b,c,d,e,f,g,h,i) (GOOD_HASH * HASH8 (a,b,c,d,e,f,g,h) + (i))
1949 #define LISP_HASH(obj) ((hcode_t)LISP_TO_VOID(obj))
1950 hcode_t string_hash(const char *xv);
1951 hcode_t memory_hash(const void *xv, size_t size);
1952 hcode_t internal_hash(const Lisp_Object obj, int depth);
1953 hcode_t internal_array_hash(const Lisp_Object *arr, size_t size, int depth);
1955 /************************************************************************/
1956 /* String translation */
1957 /************************************************************************/
1960 #ifdef HAVE_LIBINTL_H
1961 #include <libintl.h>
1963 char *dgettext(const char *, const char *);
1964 char *gettext(const char *);
1965 char *textdomain(const char *);
1966 char *bindtextdomain(const char *, const char *);
1967 #endif /* HAVE_LIBINTL_H */
1969 #define GETTEXT(x) gettext(x)
1970 #define LISP_GETTEXT(x) Fgettext (x)
1972 #define GETTEXT(x) (x)
1973 #define LISP_GETTEXT(x) (x)
1976 /* DEFER_GETTEXT is used to identify strings which are translated when
1977 they are referenced instead of when they are defined.
1978 These include Qerror_messages and initialized arrays of strings.
1980 #define DEFER_GETTEXT(x) (x)
1982 /************************************************************************/
1983 /* Garbage collection / GC-protection */
1984 /************************************************************************/
1987 #if (defined EF_USE_POM || defined EF_USE_ASYNEQ) && \
1988 !(defined HAVE_BDWGC && defined EF_USE_BDWGC)
1989 #include "semaphore.h"
1990 extern sxe_mutex_t cons_mutex;
1993 lock_allocator(void)
1994 __attribute__((always_inline));
1996 lock_allocator(void)
1998 SXE_DEBUG_GC_PT("locking cons mutex.\n");
1999 SXE_MUTEX_LOCK(&cons_mutex);
2003 unlock_allocator(void)
2004 __attribute__((always_inline));
2006 unlock_allocator(void)
2008 SXE_DEBUG_GC_PT("unlocking cons mutex.\n");
2009 SXE_MUTEX_UNLOCK(&cons_mutex);
2012 #else /* !EF_USE_POM || !BDWGC */
2015 lock_allocator(void)
2016 __attribute__((always_inline));
2018 lock_allocator(void)
2023 unlock_allocator(void)
2024 __attribute__((always_inline));
2026 unlock_allocator(void)
2031 /* number of bytes of structure consed since last GC */
2033 extern EMACS_INT consing_since_gc;
2035 /* threshold for doing another gc */
2037 extern Fixnum gc_cons_threshold;
2039 /* Structure for recording stack slots that need marking */
2041 /* This is a chain of structures, each of which points at a Lisp_Object
2042 variable whose value should be marked in garbage collection.
2043 Normally every link of the chain is an automatic variable of a function,
2044 and its `val' points to some argument or local variable of the function.
2045 On exit to the function, the chain is set back to the value it had on
2046 entry. This way, no link remains in the chain when the stack frame
2047 containing the link disappears.
2049 Every function that can call Feval must protect in this fashion all
2050 Lisp_Object variables whose contents will be used again. */
2052 extern struct gcpro *gcprolist;
2056 Lisp_Object *var; /* Address of first protected variable */
2057 int nvars; /* Number of consecutive protected variables */
2060 #if defined(EF_USE_ASYNEQ)
2061 #include "events/workers.h"
2063 extern void init_threads(int, sxe_thread_f);
2064 extern void fini_threads(int);
2065 extern dllist_t workers;
2067 extern_inline struct gcpro *_get_gcprolist(void);
2068 extern_inline void _set_gcprolist(struct gcpro *provar);
2070 #if defined HAVE_BDWGC && defined EF_USE_BDWGC
2071 extern_inline struct gcpro*
2072 _get_gcprolist(void)
2078 _set_gcprolist(struct gcpro *provar)
2085 extern_inline struct gcpro*
2086 _get_gcprolist(void)
2088 WITH_DLLIST_TRAVERSE(
2090 eq_worker_t eqw = dllist_item;
2091 sxe_thread_t me = pthread_self();
2092 if (eq_worker_thread(eqw) == me) {
2093 RETURN_FROM_DLLIST_TRAVERSE(
2094 workers, eq_worker_gcprolist(eqw));
2100 _set_gcprolist(struct gcpro *provar)
2102 WITH_DLLIST_TRAVERSE(
2104 eq_worker_t eqw = dllist_item;
2105 sxe_thread_t me = pthread_self();
2106 if (eq_worker_thread(eqw) == me) {
2107 eq_worker_gcprolist(eqw) = provar;
2108 RETURN_FROM_DLLIST_TRAVERSE(workers, );
2114 #else /* !EF_USE_ASYNEQ */
2116 #define _get_gcprolist() gcprolist
2117 #define _set_gcprolist(_var) gcprolist = (_var)
2119 #endif /* EF_USE_ASYNEQ */
2121 /* Normally, you declare variables gcpro1, gcpro2, ... and use the
2122 GCPROn() macros. However, if you need to have nested gcpro's,
2123 declare ngcpro1, ngcpro2, ... and use NGCPROn(). If you need
2124 to nest another level, use nngcpro1, nngcpro2, ... and use
2125 NNGCPROn(). If you need to nest yet another level, create
2126 the appropriate macros. */
2129 #if defined HAVE_BDWGC && defined EF_USE_BDWGC
2131 /* tricks to get over a myriad unused variable warnings */
2132 #define gcpro1 gcpro1 __attribute__((unused))
2133 #define gcpro2 gcpro2 __attribute__((unused))
2134 #define gcpro3 gcpro3 __attribute__((unused))
2135 #define gcpro4 gcpro4 __attribute__((unused))
2136 #define gcpro5 gcpro5 __attribute__((unused))
2137 #define gcpro6 gcpro6 __attribute__((unused))
2138 #define gcpro7 gcpro7 __attribute__((unused))
2139 #define gcpro8 gcpro8 __attribute__((unused))
2141 #define ngcpro1 ngcpro1 __attribute__((unused))
2142 #define ngcpro2 ngcpro2 __attribute__((unused))
2143 #define ngcpro3 ngcpro3 __attribute__((unused))
2144 #define ngcpro4 ngcpro4 __attribute__((unused))
2145 #define ngcpro5 ngcpro5 __attribute__((unused))
2146 #define ngcpro6 ngcpro6 __attribute__((unused))
2147 #define ngcpro7 ngcpro7 __attribute__((unused))
2148 #define ngcpro8 ngcpro8 __attribute__((unused))
2150 #define nngcpro1 nngcpro1 __attribute__((unused))
2151 #define nngcpro2 nngcpro2 __attribute__((unused))
2152 #define nngcpro3 nngcpro3 __attribute__((unused))
2153 #define nngcpro4 nngcpro4 __attribute__((unused))
2154 #define nngcpro5 nngcpro5 __attribute__((unused))
2155 #define nngcpro6 nngcpro6 __attribute__((unused))
2156 #define nngcpro7 nngcpro7 __attribute__((unused))
2157 #define nngcpro8 nngcpro8 __attribute__((unused))
2159 #define GCPRO1(args...)
2160 #define GCPRO2(args...)
2161 #define GCPRO3(args...)
2162 #define GCPRO4(args...)
2163 #define GCPRO5(args...)
2164 #define GCPRO6(args...)
2165 #define GCPRO7(args...)
2166 #define GCPRO8(args...)
2167 #define GCPROn(args...)
2168 #define GCPRO1n(args...)
2169 #define GCPRO2n(args...)
2170 #define GCPRO3n(args...)
2171 #define GCPRO1nn(args...)
2174 #define NGCPRO1(args...)
2175 #define NGCPRO2(args...)
2176 #define NGCPRO3(args...)
2177 #define NGCPRO4(args...)
2178 #define NGCPRO5(args...)
2179 #define NGCPRO6(args...)
2180 #define NGCPRO7(args...)
2181 #define NGCPRO8(args...)
2182 #define NGCPROn(args...)
2183 #define NGCPRO1n(args...)
2186 #define NNGCPRO1(args...)
2187 #define NNGCPRO2(args...)
2188 #define NNGCPRO3(args...)
2189 #define NNGCPRO4(args...)
2190 #define NNGCPRO5(args...)
2191 #define NNGCPRO6(args...)
2192 #define NNGCPRO7(args...)
2193 #define NNGCPRO8(args...)
2194 #define NNGCPROn(args...)
2199 #define GCPRO1(var1) \
2202 gcpro1.next = _get_gcprolist(), \
2203 gcpro1.var = &var1, gcpro1.nvars = 1, \
2204 _set_gcprolist(&gcpro1), \
2205 unlock_allocator()))
2207 #define GCPRO2(var1, var2) \
2210 gcpro1.next = _get_gcprolist(), \
2211 gcpro1.var = &var1, gcpro1.nvars = 1, \
2212 gcpro2.next = &gcpro1, \
2213 gcpro2.var = &var2, gcpro2.nvars = 1, \
2214 _set_gcprolist(&gcpro2), \
2215 unlock_allocator()))
2217 #define GCPRO3(var1, var2, var3) \
2220 gcpro1.next = _get_gcprolist(), \
2221 gcpro1.var = &var1, gcpro1.nvars = 1, \
2222 gcpro2.next = &gcpro1, \
2223 gcpro2.var = &var2, gcpro2.nvars = 1, \
2224 gcpro3.next = &gcpro2, \
2225 gcpro3.var = &var3, gcpro3.nvars = 1, \
2226 _set_gcprolist(&gcpro3), \
2227 unlock_allocator()))
2229 #define GCPRO4(var1, var2, var3, var4) \
2232 gcpro1.next = _get_gcprolist(), \
2233 gcpro1.var = &var1, gcpro1.nvars = 1, \
2234 gcpro2.next = &gcpro1, \
2235 gcpro2.var = &var2, gcpro2.nvars = 1, \
2236 gcpro3.next = &gcpro2, \
2237 gcpro3.var = &var3, gcpro3.nvars = 1, \
2238 gcpro4.next = &gcpro3, \
2239 gcpro4.var = &var4, gcpro4.nvars = 1, \
2240 _set_gcprolist(&gcpro4), \
2241 unlock_allocator()))
2243 #define GCPRO5(var1, var2, var3, var4, var5) \
2246 gcpro1.next = _get_gcprolist(), \
2247 gcpro1.var = &var1, gcpro1.nvars = 1, \
2248 gcpro2.next = &gcpro1, \
2249 gcpro2.var = &var2, gcpro2.nvars = 1, \
2250 gcpro3.next = &gcpro2, \
2251 gcpro3.var = &var3, gcpro3.nvars = 1, \
2252 gcpro4.next = &gcpro3, \
2253 gcpro4.var = &var4, gcpro4.nvars = 1, \
2254 gcpro5.next = &gcpro4, \
2255 gcpro5.var = &var5, gcpro5.nvars = 1, \
2256 _set_gcprolist(&gcpro5), \
2257 unlock_allocator()))
2259 #define GCPRO6(var1, var2, var3, var4, var5, var6 ) \
2262 gcpro1.next = _get_gcprolist(), \
2263 gcpro1.var = &var1, gcpro1.nvars = 1, \
2264 gcpro2.next = &gcpro1, \
2265 gcpro2.var = &var2, gcpro2.nvars = 1, \
2266 gcpro3.next = &gcpro2, \
2267 gcpro3.var = &var3, gcpro3.nvars = 1, \
2268 gcpro4.next = &gcpro3, \
2269 gcpro4.var = &var4, gcpro4.nvars = 1, \
2270 gcpro5.next = &gcpro4, \
2271 gcpro5.var = &var5, gcpro5.nvars = 1, \
2272 gcpro6.next = &gcpro5, \
2273 gcpro6.var = &var6, gcpro6.nvars = 1, \
2274 _set_gcprolist(&gcpro6), \
2275 unlock_allocator()))
2277 #define GCPRO7(var1, var2, var3, var4, var5, var6, var7) \
2280 gcpro1.next = _get_gcprolist(), \
2281 gcpro1.var = &var1, gcpro1.nvars = 1, \
2282 gcpro2.next = &gcpro1, \
2283 gcpro2.var = &var2, gcpro2.nvars = 1, \
2284 gcpro3.next = &gcpro2, \
2285 gcpro3.var = &var3, gcpro3.nvars = 1, \
2286 gcpro4.next = &gcpro3, \
2287 gcpro4.var = &var4, gcpro4.nvars = 1, \
2288 gcpro5.next = &gcpro4, \
2289 gcpro5.var = &var5, gcpro5.nvars = 1, \
2290 gcpro6.next = &gcpro5, \
2291 gcpro6.var = &var6, gcpro6.nvars = 1, \
2292 gcpro7.next = &gcpro6, \
2293 gcpro7.var = &var7, gcpro7.nvars = 1, \
2294 _set_gcprolist(&gcpro7), \
2295 unlock_allocator()))
2297 #define GCPRO8(var1, var2, var3, var4, var5, var6, var7, var8) \
2300 gcpro1.next = _get_gcprolist(), \
2301 gcpro1.var = &var1, gcpro1.nvars = 1, \
2302 gcpro2.next = &gcpro1, \
2303 gcpro2.var = &var2, gcpro2.nvars = 1, \
2304 gcpro3.next = &gcpro2, \
2305 gcpro3.var = &var3, gcpro3.nvars = 1, \
2306 gcpro4.next = &gcpro3, \
2307 gcpro4.var = &var4, gcpro4.nvars = 1, \
2308 gcpro5.next = &gcpro4, \
2309 gcpro5.var = &var5, gcpro5.nvars = 1, \
2310 gcpro6.next = &gcpro5, \
2311 gcpro6.var = &var6, gcpro6.nvars = 1, \
2312 gcpro7.next = &gcpro6, \
2313 gcpro7.var = &var7, gcpro7.nvars = 1, \
2314 gcpro8.next = &gcpro7, \
2315 gcpro8.var = &var8, gcpro8.nvars = 1, \
2316 _set_gcprolist(&gcpro8), \
2317 unlock_allocator()))
2319 #define GCPROn(_varp, _nvars) \
2322 gcpro1.next = _get_gcprolist(), \
2323 gcpro1.var = _varp, \
2324 gcpro1.nvars = _nvars, \
2325 _set_gcprolist(&gcpro1), \
2326 unlock_allocator()))
2328 #define GCPRO1n(_v1, _varp, _nvars) \
2331 gcpro1.next = _get_gcprolist(), \
2332 gcpro1.var = &_v1, gcpro1.nvars = 1, \
2333 gcpro2.next = &gcpro1, \
2334 gcpro2.var = _varp, gcpro2.nvars = _nvars, \
2335 _set_gcprolist(&gcpro2), \
2336 unlock_allocator()))
2338 #define GCPRO2n(_v1, _v2, _varp, _nvars) \
2341 gcpro1.next = _get_gcprolist(), \
2342 gcpro1.var = &_v1, gcpro1.nvars = 1, \
2343 gcpro2.next = &gcpro1, \
2344 gcpro2.var = &_v2, gcpro2.nvars = 1, \
2345 gcpro3.next = &gcpro2, \
2346 gcpro3.var = _varp, gcpro3.nvars = _nvars, \
2347 _set_gcprolist(&gcpro3), \
2348 unlock_allocator()))
2350 #define GCPRO3n(_v1, _v2, _v3, _varp, _nvars) \
2353 gcpro1.next = _get_gcprolist(), \
2354 gcpro1.var = &_v1, gcpro1.nvars = 1, \
2355 gcpro2.next = &gcpro1, \
2356 gcpro2.var = &_v2, gcpro2.nvars = 1, \
2357 gcpro3.next = &gcpro2, \
2358 gcpro3.var = &_v3, gcpro3.nvars = 1, \
2359 gcpro4.next = &gcpro3, \
2360 gcpro4.var = _varp, gcpro4.nvars = _nvars, \
2361 _set_gcprolist(&gcpro4), \
2362 unlock_allocator()))
2364 #define GCPRO1nn(_v1, _varp1, _nv1, _varp2, _nv2) \
2367 gcpro1.next = _get_gcprolist(), \
2368 gcpro1.var = &_v1, gcpro1.nvars = 1, \
2369 gcpro2.next = &gcpro1, \
2370 gcpro2.var = _varp1, gcpro2.nvars = _nv1, \
2371 gcpro3.next = &gcpro2, \
2372 gcpro3.var = _varp2, gcpro3.nvars = _nv2, \
2373 _set_gcprolist(&gcpro3), \
2374 unlock_allocator()))
2379 _set_gcprolist(gcpro1.next), \
2380 unlock_allocator()))
2382 #define NGCPRO1(var1) \
2385 ngcpro1.next = _get_gcprolist(), \
2386 ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2387 _set_gcprolist(&ngcpro1), \
2388 unlock_allocator()))
2390 #define NGCPRO2(var1, var2) \
2393 ngcpro1.next = _get_gcprolist(), \
2394 ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2395 ngcpro2.next = &ngcpro1, \
2396 ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2397 _set_gcprolist(&ngcpro2), \
2398 unlock_allocator()))
2400 #define NGCPRO3(var1, var2, var3) \
2403 ngcpro1.next = _get_gcprolist(), \
2404 ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2405 ngcpro2.next = &ngcpro1, \
2406 ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2407 ngcpro3.next = &ngcpro2, \
2408 ngcpro3.var = &var3, ngcpro3.nvars = 1, \
2409 _set_gcprolist(&ngcpro3), \
2410 unlock_allocator()))
2412 #define NGCPRO4(var1, var2, var3, var4) \
2415 ngcpro1.next = _get_gcprolist(), \
2416 ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2417 ngcpro2.next = &ngcpro1, \
2418 ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2419 ngcpro3.next = &ngcpro2, \
2420 ngcpro3.var = &var3, ngcpro3.nvars = 1, \
2421 ngcpro4.next = &ngcpro3, \
2422 ngcpro4.var = &var4, ngcpro4.nvars = 1, \
2423 _set_gcprolist(&ngcpro4), \
2424 unlock_allocator()))
2426 #define NGCPRO5(var1, var2, var3, var4, var5) \
2429 ngcpro1.next = _get_gcprolist(), \
2430 ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2431 ngcpro2.next = &ngcpro1, \
2432 ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2433 ngcpro3.next = &ngcpro2, \
2434 ngcpro3.var = &var3, ngcpro3.nvars = 1, \
2435 ngcpro4.next = &ngcpro3, \
2436 ngcpro4.var = &var4, ngcpro4.nvars = 1, \
2437 ngcpro5.next = &ngcpro4, \
2438 ngcpro5.var = &var5, ngcpro5.nvars = 1, \
2439 _set_gcprolist(&ngcpro5), \
2440 unlock_allocator()))
2442 #define NGCPRO6(var1, var2, var3, var4, var5, var6 ) \
2445 ngcpro1.next = _get_gcprolist(), \
2446 ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2447 ngcpro2.next = &ngcpro1, \
2448 ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2449 ngcpro3.next = &ngcpro2, \
2450 ngcpro3.var = &var3, ngcpro3.nvars = 1, \
2451 ngcpro4.next = &ngcpro3, \
2452 ngcpro4.var = &var4, ngcpro4.nvars = 1, \
2453 ngcpro5.next = &ngcpro4, \
2454 ngcpro5.var = &var5, ngcpro5.nvars = 1, \
2455 ngcpro6.next = &ngcpro5, \
2456 ngcpro6.var = &var6, ngcpro6.nvars = 1, \
2457 _set_gcprolist(&ngcpro6), \
2458 unlock_allocator()))
2460 #define NGCPRO7(var1, var2, var3, var4, var5, var6, var7) \
2463 ngcpro1.next = _get_gcprolist(), \
2464 ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2465 ngcpro2.next = &ngcpro1, \
2466 ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2467 ngcpro3.next = &ngcpro2, \
2468 ngcpro3.var = &var3, ngcpro3.nvars = 1, \
2469 ngcpro4.next = &ngcpro3, \
2470 ngcpro4.var = &var4, ngcpro4.nvars = 1, \
2471 ngcpro5.next = &ngcpro4, \
2472 ngcpro5.var = &var5, ngcpro5.nvars = 1, \
2473 ngcpro6.next = &ngcpro5, \
2474 ngcpro6.var = &var6, ngcpro6.nvars = 1, \
2475 ngcpro7.next = &ngcpro6, \
2476 ngcpro7.var = &var7, ngcpro7.nvars = 1, \
2477 _set_gcprolist(&ngcpro7), \
2478 unlock_allocator()))
2480 #define NGCPRO8(var1, var2, var3, var4, var5, var6, var7, var8) \
2483 ngcpro1.next = _get_gcprolist(), \
2484 ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2485 ngcpro2.next = &ngcpro1, \
2486 ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2487 ngcpro3.next = &ngcpro2, \
2488 ngcpro3.var = &var3, ngcpro3.nvars = 1, \
2489 ngcpro4.next = &ngcpro3, \
2490 ngcpro4.var = &var4, ngcpro4.nvars = 1, \
2491 ngcpro5.next = &ngcpro4, \
2492 ngcpro5.var = &var5, ngcpro5.nvars = 1, \
2493 ngcpro6.next = &ngcpro5, \
2494 ngcpro6.var = &var6, ngcpro6.nvars = 1, \
2495 ngcpro7.next = &ngcpro6, \
2496 ngcpro7.var = &var7, ngcpro7.nvars = 1, \
2497 ngcpro8.next = &ngcpro7, \
2498 ngcpro8.var = &var8, ngcpro8.nvars = 1, \
2499 _set_gcprolist(&ngcpro8), \
2500 unlock_allocator()))
2502 #define NGCPROn(_varp, _nvars) \
2505 ngcpro1.next = _get_gcprolist(), \
2506 ngcpro1.var = _varp, \
2507 ngcpro1.nvars = _nvars, \
2508 _set_gcprolist(&ngcpro1), \
2509 unlock_allocator()))
2511 #define NGCPRO1n(_v1, _varp, _nvars) \
2514 ngcpro1.next = _get_gcprolist(), \
2515 ngcpro1.var = &_v1, ngcpro1.nvars = 1, \
2516 ngcpro2.next = &ngcpro1, \
2517 ngcpro2.var = _varp, ngcpro2.nvars = _nvars, \
2518 _set_gcprolist(&ngcpro2), \
2519 unlock_allocator()))
2524 _set_gcprolist(ngcpro1.next), \
2525 unlock_allocator()))
2527 #define NNGCPRO1(var1) \
2530 nngcpro1.next = _get_gcprolist(), \
2531 nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2532 _set_gcprolist(&nngcpro1), \
2533 unlock_allocator()))
2535 #define NNGCPRO2(var1, var2) \
2538 nngcpro1.next = _get_gcprolist(), \
2539 nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2540 nngcpro2.next = &nngcpro1, \
2541 nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2542 _set_gcprolist(&nngcpro2), \
2543 unlock_allocator()))
2545 #define NNGCPRO3(var1, var2, var3) \
2548 nngcpro1.next = _get_gcprolist(), \
2549 nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2550 nngcpro2.next = &nngcpro1, \
2551 nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2552 nngcpro3.next = &nngcpro2, \
2553 nngcpro3.var = &var3, nngcpro3.nvars = 1, \
2554 _set_gcprolist(&nngcpro3), \
2555 unlock_allocator()))
2557 #define NNGCPRO4(var1, var2, var3, var4) \
2560 nngcpro1.next = _get_gcprolist(), \
2561 nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2562 nngcpro2.next = &nngcpro1, \
2563 nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2564 nngcpro3.next = &nngcpro2, \
2565 nngcpro3.var = &var3, nngcpro3.nvars = 1, \
2566 nngcpro4.next = &nngcpro3, \
2567 nngcpro4.var = &var4, nngcpro4.nvars = 1, \
2568 _set_gcprolist(&nngcpro4), \
2569 unlock_allocator()))
2571 #define NNGCPRO5(var1, var2, var3, var4, var5) \
2574 nngcpro1.next = _get_gcprolist(), \
2575 nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2576 nngcpro2.next = &nngcpro1, \
2577 nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2578 nngcpro3.next = &nngcpro2, \
2579 nngcpro3.var = &var3, nngcpro3.nvars = 1, \
2580 nngcpro4.next = &nngcpro3, \
2581 nngcpro4.var = &var4, nngcpro4.nvars = 1, \
2582 nngcpro5.next = &nngcpro4, \
2583 nngcpro5.var = &var5, nngcpro5.nvars = 1, \
2584 _set_gcprolist(&nngcpro5), \
2585 unlock_allocator()))
2587 #define NNGCPRO6(var1, var2, var3, var4, var5, var6 ) \
2590 nngcpro1.next = _get_gcprolist(), \
2591 nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2592 nngcpro2.next = &nngcpro1, \
2593 nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2594 nngcpro3.next = &nngcpro2, \
2595 nngcpro3.var = &var3, nngcpro3.nvars = 1, \
2596 nngcpro4.next = &nngcpro3, \
2597 nngcpro4.var = &var4, nngcpro4.nvars = 1, \
2598 nngcpro5.next = &nngcpro4, \
2599 nngcpro5.var = &var5, nngcpro5.nvars = 1, \
2600 nngcpro6.next = &nngcpro5, \
2601 nngcpro6.var = &var6, nngcpro6.nvars = 1, \
2602 _set_gcprolist(&nngcpro6), \
2603 unlock_allocator()))
2605 #define NNGCPRO7(var1, var2, var3, var4, var5, var6, var7) \
2608 nngcpro1.next = _get_gcprolist(), \
2609 nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2610 nngcpro2.next = &nngcpro1, \
2611 nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2612 nngcpro3.next = &nngcpro2, \
2613 nngcpro3.var = &var3, nngcpro3.nvars = 1, \
2614 nngcpro4.next = &nngcpro3, \
2615 nngcpro4.var = &var4, nngcpro4.nvars = 1, \
2616 nngcpro5.next = &nngcpro4, \
2617 nngcpro5.var = &var5, nngcpro5.nvars = 1, \
2618 nngcpro6.next = &nngcpro5, \
2619 nngcpro6.var = &var6, nngcpro6.nvars = 1, \
2620 nngcpro7.next = &nngcpro6, \
2621 nngcpro7.var = &var7, nngcpro7.nvars = 1, \
2622 _set_gcprolist(&nngcpro7), \
2623 unlock_allocator()))
2625 #define NNGCPRO8(var1, var2, var3, var4, var5, var6, var7, var8) \
2628 nngcpro1.next = _get_gcprolist(), \
2629 nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2630 nngcpro2.next = &nngcpro1, \
2631 nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2632 nngcpro3.next = &nngcpro2, \
2633 nngcpro3.var = &var3, nngcpro3.nvars = 1, \
2634 nngcpro4.next = &nngcpro3, \
2635 nngcpro4.var = &var4, nngcpro4.nvars = 1, \
2636 nngcpro5.next = &nngcpro4, \
2637 nngcpro5.var = &var5, nngcpro5.nvars = 1, \
2638 nngcpro6.next = &nngcpro5, \
2639 nngcpro6.var = &var6, nngcpro6.nvars = 1, \
2640 nngcpro7.next = &nngcpro6, \
2641 nngcpro7.var = &var7, nngcpro7.nvars = 1, \
2642 nngcpro8.next = &nngcpro7, \
2643 nngcpro8.var = &var8, nngcpro8.nvars = 1, \
2644 _set_gcprolist(&nngcpro8), \
2645 unlock_allocator()))
2647 #define NNGCPROn(_varp, _nvars) \
2650 nngcpro1.next = _get_gcprolist(), \
2651 nngcpro1.var = _varp, \
2652 nngcpro1.nvars = _nvars, \
2653 _set_gcprolist(&nngcpro1), \
2654 unlock_allocator()))
2659 _set_gcprolist(nngcpro1.next), \
2660 unlock_allocator()))
2664 #else /* defined(DEBUG_GCPRO) */
2666 void debug_gcpro1(char *, int, struct gcpro *, Lisp_Object *);
2667 void debug_gcpro2(char *, int, struct gcpro *, struct gcpro *,
2668 Lisp_Object *, Lisp_Object *);
2669 void debug_gcpro3(char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
2670 Lisp_Object *, Lisp_Object *, Lisp_Object *);
2671 void debug_gcpro4(char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
2672 struct gcpro *, Lisp_Object *, Lisp_Object *, Lisp_Object *,
2674 void debug_gcpro5(char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
2675 struct gcpro *, struct gcpro *, Lisp_Object *, Lisp_Object *,
2676 Lisp_Object *, Lisp_Object *, Lisp_Object *);
2677 void debug_gcpro6(char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
2678 struct gcpro *, struct gcpro *, struct gcpro *, Lisp_Object *,
2679 Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *,
2681 void debug_gcpro7(char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
2682 struct gcpro *, struct gcpro *, struct gcpro *, struct gcpro *,
2683 Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *,
2684 Lisp_Object *, Lisp_Object *, Lisp_Object *);
2685 void debug_gcpro8(char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
2686 struct gcpro *, struct gcpro *, struct gcpro *, struct gcpro *,
2687 struct gcpro *, Lisp_Object *, Lisp_Object *,
2688 Lisp_Object *, Lisp_Object *, Lisp_Object *, Lisp_Object *,
2689 Lisp_Object *, Lisp_Object *);
2690 void debug_ungcpro(char *, int, struct gcpro *);
2693 debug_gcpro1 (__FILE__, __LINE__,&gcpro1,&v)
2694 #define GCPRO2(v1,v2) \
2695 debug_gcpro2 (__FILE__, __LINE__,&gcpro1,&gcpro2,&v1,&v2)
2696 #define GCPRO3(v1,v2,v3) \
2697 debug_gcpro3 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&v1,&v2,&v3)
2698 #define GCPRO4(v1,v2,v3,v4) \
2699 debug_gcpro4 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,\
2701 #define GCPRO5(v1,v2,v3,v4,v5) \
2702 debug_gcpro5 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,&gcpro5,\
2703 &v1,&v2,&v3,&v4,&v5)
2704 #define GCPRO6(v1,v2,v3,v4,v5,v6) \
2705 debug_gcpro6 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,&gcpro5,&gcpro6, \
2706 &v1,&v2,&v3,&v4,&v5,&v6)
2707 #define GCPRO7(v1,v2,v3,v4,v5,v6,v7) \
2708 debug_gcpro7 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,&gcpro5,&gcpro6,&gcpro7,\
2709 &v1,&v2,&v3,&v4,&v5,&v6,&v7)
2710 #define GCPRO8(v1,v2,v3,v4,v5,v6,v7,v8) \
2711 debug_gcpro8 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,&gcpro5,&gcpro6,&gcpro7,&gcpro8, \
2712 &v1,&v2,&v3,&v4,&v5,&v6,&v7,&v8)
2714 debug_ungcpro(__FILE__, __LINE__,&gcpro1)
2716 #define NGCPRO1(v) \
2717 debug_gcpro1 (__FILE__, __LINE__,&ngcpro1,&v)
2718 #define NGCPRO2(v1,v2) \
2719 debug_gcpro2 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&v1,&v2)
2720 #define NGCPRO3(v1,v2,v3) \
2721 debug_gcpro3 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&v1,&v2,&v3)
2722 #define NGCPRO4(v1,v2,v3,v4) \
2723 debug_gcpro4 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,\
2725 #define NGCPRO5(v1,v2,v3,v4,v5) \
2726 debug_gcpro5 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,\
2727 &ngcpro5,&v1,&v2,&v3,&v4,&v5)
2728 #define NGCPRO6(v1,v2,v3,v4,v5,v6) \
2729 debug_gcpro6 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,&ngcpro5,&ngcpro6, \
2730 &v1,&v2,&v3,&v4,&v5,&v6)
2731 #define NGCPRO7(v1,v2,v3,v4,v5,v6,v7) \
2732 debug_gcpro7 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,&ngcpro5,&ngcpro6,&ngcpro7,\
2733 &v1,&v2,&v3,&v4,&v5,&v6,&v7)
2734 #define NGCPRO8(v1,v2,v3,v4,v5,v6,v7,v8) \
2735 debug_gcpro8 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,&ngcpro5,&ngcpro6,&ngcpro7,&ngcpro8, \
2736 &v1,&v2,&v3,&v4,&v5,&v6,&v7,&v8)
2738 debug_ungcpro(__FILE__, __LINE__,&ngcpro1)
2740 #define NNGCPRO1(v) \
2741 debug_gcpro1 (__FILE__, __LINE__,&nngcpro1,&v)
2742 #define NNGCPRO2(v1,v2) \
2743 debug_gcpro2 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&v1,&v2)
2744 #define NNGCPRO3(v1,v2,v3) \
2745 debug_gcpro3 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&v1,&v2,&v3)
2746 #define NNGCPRO4(v1,v2,v3,v4) \
2747 debug_gcpro4 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,\
2749 #define NNGCPRO5(v1,v2,v3,v4,v5) \
2750 debug_gcpro5 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,\
2751 &nngcpro5,&v1,&v2,&v3,&v4,&v5)
2752 #define NNGCPRO6(v1,v2,v3,v4,v5,v6) \
2753 debug_gcpro6 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,&nngcpro5,&nngcpro6, \
2754 &v1,&v2,&v3,&v4,&v5,&v6)
2755 #define NNGCPRO7(v1,v2,v3,v4,v5,v6,v7) \
2756 debug_gcpro7 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,&nngcpro5,&nngcpro6,&nngcpro7,\
2757 &v1,&v2,&v3,&v4,&v5,&v6,&v7)
2758 #define NNGCPRO8(v1,v2,v3,v4,v5,v6,v7,v8) \
2759 debug_gcpro8 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,&nngcpro5,&nngcpro6,&nngcpro7,&nngcpro8, \
2760 &v1,&v2,&v3,&v4,&v5,&v6,&v7,&v8)
2762 debug_ungcpro(__FILE__, __LINE__,&nngcpro1)
2764 #endif /* DEBUG_GCPRO */
2766 /* Another try to fix SunPro C compiler warnings */
2767 /* "end-of-loop code not reached" */
2768 /* "statement not reached */
2769 #if defined __SUNPRO_C || defined __USLC__
2770 #define RETURN_SANS_WARNINGS if (1) return
2771 #define RETURN_NOT_REACHED(value)
2773 #define RETURN_SANS_WARNINGS return
2774 #define RETURN_NOT_REACHED(value) return value;
2777 /* Evaluate expr, UNGCPRO, and then return the value of expr. */
2778 #define RETURN_UNGCPRO(expr) \
2780 Lisp_Object ret_ungc_val = (expr); \
2782 RETURN_SANS_WARNINGS ret_ungc_val; \
2785 /* Evaluate expr, NUNGCPRO, UNGCPRO, and then return the value of expr. */
2786 #define RETURN_NUNGCPRO(expr) \
2788 Lisp_Object ret_ungc_val = (expr); \
2791 RETURN_SANS_WARNINGS ret_ungc_val; \
2794 /* Evaluate expr, NNUNGCPRO, NUNGCPRO, UNGCPRO, and then return the
2796 #define RETURN_NNUNGCPRO(expr) \
2798 Lisp_Object ret_ungc_val = (expr); \
2802 RETURN_SANS_WARNINGS ret_ungc_val; \
2805 /* Evaluate expr, return it if it's not Qunbound. */
2806 #define RETURN_IF_NOT_UNBOUND(expr) \
2808 Lisp_Object ret_nunb_val = (expr); \
2809 if (!UNBOUNDP (ret_nunb_val)) \
2810 RETURN_SANS_WARNINGS ret_nunb_val; \
2813 void register_post_gc_action(void (*fun) (void *), void *arg);
2815 /* Call staticpro (&var) to protect static variable `var'. */
2816 void staticpro(Lisp_Object *);
2818 #if defined HAVE_BDWGC && defined EF_USE_BDWGC
2819 #define staticpro_nodump(foo)
2821 /* Call staticpro_nodump (&var) to protect static variable `var'. */
2822 /* var will not be saved at dump time */
2823 void staticpro_nodump(Lisp_Object *);
2826 /* allocation goodies */
2828 /* for size computation */
2829 #include "ent/ent.h"
2831 /* also generally useful if you want to avoid arbitrary size limits
2832 but don't need a full dynamic array. Assumes that BASEVAR points
2833 to a malloced array of TYPE objects (or possibly a NULL pointer,
2834 if SIZEVAR is 0), with the total size stored in SIZEVAR. This
2835 macro will realloc BASEVAR as necessary so that it can hold at
2836 least NEEDED_SIZE objects. The reallocing is done by doubling,
2837 which ensures constant amortized time per element. */
2838 extern_inline EMACS_INT
2839 __alloc_size(EMACS_INT sz, EMACS_INT needed)
2840 __attribute__((always_inline));
2841 extern_inline EMACS_INT
2842 __alloc_size(EMACS_INT sz, EMACS_INT needed)
2844 if (UNLIKELY(needed <= 32)) {
2847 return 1 << (1 + __ase_flsl(needed - 1));
2850 #define DO_REALLOC(basevar, sizevar, needed_size, type) \
2852 EMACS_INT cache_needed_size = (needed_size); \
2853 if (LIKELY((sizevar) >= cache_needed_size)) { \
2856 (sizevar) = __alloc_size((sizevar), cache_needed_size); \
2857 if (UNLIKELY((basevar) == NULL)) { \
2858 (basevar) = xnew_array(type, (sizevar)); \
2860 xrealloc_array(basevar, type, (sizevar)); \
2864 #define DO_REALLOC_ATOMIC(basevar, sizevar, needed_size, type) \
2866 EMACS_INT cache_needed_size = (needed_size); \
2867 if (LIKELY((sizevar) >= cache_needed_size)) { \
2870 (sizevar) = __alloc_size((sizevar), cache_needed_size); \
2871 if (UNLIKELY((basevar) == NULL)) { \
2872 (basevar) = xnew_atomic_array(type, (sizevar)); \
2874 xrealloc_array(basevar, type, (sizevar)); \
2878 #if defined HAVE_BDWGC && defined EF_USE_BDWGC && !defined GC_DEBUG_FLAG
2879 #define free_me __free_me __attribute__((unused))
2882 static inline Lisp_Object
2883 free_malloced_ptr(Lisp_Object unwind_obj)
2885 void *free_me = (void*)get_opaque_ptr(unwind_obj);
2887 free_opaque_ptr(unwind_obj);
2891 /* Don't use alloca for regions larger than this, lest we overflow
2893 #define MAX_ALLOCA 65536
2895 /* We need to setup proper unwinding, because there is a number of
2896 ways these functions can blow up, and we don't want to have memory
2897 leaks in those cases. */
2898 #define XMALLOC_OR_ALLOCA(ptr, len, type) \
2900 size_t XOA_len = (len); \
2901 if (XOA_len > MAX_ALLOCA) { \
2902 ptr = xnew_array(type, XOA_len); \
2903 record_unwind_protect(free_malloced_ptr, \
2904 make_opaque_ptr((void*)ptr)); \
2906 ptr = alloca_array(type, XOA_len); \
2910 #define XMALLOC_ATOMIC_OR_ALLOCA(ptr, len, type) \
2912 size_t XOA_len = (len); \
2913 if (XOA_len > MAX_ALLOCA) { \
2914 ptr = xnew_atomic_array(type, XOA_len); \
2915 record_unwind_protect(free_malloced_ptr, \
2916 make_opaque_ptr((void*)ptr)); \
2918 ptr = alloca_array(type, XOA_len); \
2922 #define XMALLOC_UNBIND(ptr, len, speccount) \
2924 if ((len) > MAX_ALLOCA) { \
2925 unbind_to (speccount, Qnil); \
2930 /* dump_add_root_struct_ptr (&var, &desc) dumps the structure pointed to by `var'. */
2932 void dump_add_root_struct_ptr(void *, const struct struct_description *);
2934 #define dump_add_root_struct_ptr(varaddr,descaddr) DO_NOTHING
2937 /* dump_add_opaque (&var, size) dumps the opaque static structure `var'. */
2939 void dump_add_opaque(void *, size_t);
2941 #define dump_add_opaque(varaddr,size) DO_NOTHING
2944 /* Call dump_add_opaque_int (&int_var) to dump `int_var', of type `int'. */
2946 #define dump_add_opaque_int(int_varaddr) do { \
2947 int *dao_ = (int_varaddr); /* type check */ \
2948 dump_add_opaque (dao_, sizeof (*dao_)); \
2951 #define dump_add_opaque_int(int_varaddr) DO_NOTHING
2954 /* Call dump_add_opaque_fixnum (&fixnum_var) to dump `fixnum_var', of type `Fixnum'. */
2956 #define dump_add_opaque_fixnum(fixnum_varaddr) do { \
2957 Fixnum *dao_ = (fixnum_varaddr); /* type check */ \
2958 dump_add_opaque (dao_, sizeof (*dao_)); \
2961 #define dump_add_opaque_fixnum(fixnum_varaddr) DO_NOTHING
2964 /* Call dump_add_root_object (&var) to ensure that var is properly updated after pdump. */
2966 void dump_add_root_object(Lisp_Object *);
2968 #define dump_add_root_object(varaddr) DO_NOTHING
2971 /* Call dump_add_root_object (&var) to ensure that var is properly updated after
2972 pdump. var must point to a linked list of objects out of which
2973 some may not be dumped */
2975 void dump_add_weak_object_chain(Lisp_Object *);
2977 #define dump_add_weak_object_chain(varaddr) DO_NOTHING
2980 /* Nonzero means Emacs has already been initialized.
2981 Used during startup to detect startup of dumped Emacs. */
2982 extern int initialized;
2984 #ifdef MEMORY_USAGE_STATS
2986 /* This structure is used to keep statistics on the amount of memory
2989 WAS_REQUESTED stores the actual amount of memory that was requested
2990 of the allocation function. The *_OVERHEAD fields store the
2991 additional amount of memory that was grabbed by the functions to
2992 facilitate allocation, reallocation, etc. MALLOC_OVERHEAD is for
2993 memory allocated with malloc(); DYNARR_OVERHEAD is for dynamic
2994 arrays; GAP_OVERHEAD is for gap arrays. Note that for (e.g.)
2995 dynamic arrays, there is both MALLOC_OVERHEAD and DYNARR_OVERHEAD
2996 memory: The dynamic array allocates memory above and beyond what
2997 was asked of it, and when it in turns allocates memory using
2998 malloc(), malloc() allocates memory beyond what it was asked
3001 Functions that accept a structure of this sort do not initialize
3002 the fields to 0, and add any existing values to whatever was there
3003 before; this way, you can get a cumulative effect. */
3005 struct overhead_stats {
3007 int malloc_overhead;
3008 int dynarr_overhead;
3012 #endif /* MEMORY_USAGE_STATS */
3014 #ifndef DIRECTORY_SEP
3015 #define DIRECTORY_SEP '/'
3017 #ifndef IS_DIRECTORY_SEP
3018 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP)
3020 #ifndef IS_DEVICE_SEP
3022 #define IS_DEVICE_SEP(c) 0
3024 #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP)
3028 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c)
3031 #ifdef HAVE_INTTYPES_H
3032 #include <inttypes.h>
3033 #elif SIZEOF_VOID_P == SIZEOF_INT
3034 typedef int intptr_t;
3035 typedef unsigned int uintptr_t;
3036 #elif SIZEOF_VOID_P == SIZEOF_LONG
3037 typedef long intptr_t;
3038 typedef unsigned long uintptr_t;
3039 #elif SIZEOF_VOID_P == SIZEOF_LONG_LONG_INT
3040 typedef long long intptr_t;
3041 typedef unsigned long long uintptr_t;
3043 /* Just pray. May break, may not. */
3044 typedef long intptr_t;
3045 typedef unsigned long uintptr_t;
3048 /************************************************************************/
3049 /* Misc definitions */
3050 /************************************************************************/
3053 /************************************************************************/
3054 /* Other numeric types */
3055 /************************************************************************/
3057 /* more allocation goodies, C99 wise */
3058 extern size_t sys_stk_sz;
3059 extern char *stack_bottom;
3060 extern_inline size_t
3061 __sys_stk_free(void)
3062 __attribute__((always_inline));
3063 extern_inline size_t
3064 __sys_stk_free(void)
3067 return sys_stk_sz - (stack_bottom - &probe);
3071 /************************************************************************/
3073 /************************************************************************/
3075 /* NOTE: Prototypes should go HERE, not in various header files, unless
3076 they specifically reference a type that's not defined in lisp.h.
3077 (And even then, you might consider adding the type to lisp.h.)
3079 The idea is that header files typically contain the innards of objects,
3080 and we want to minimize the number of "dependencies" of one file on
3081 the specifics of such objects. Putting prototypes here minimizes the
3082 number of header files that need to be included -- good for a number
3083 of reasons. --ben */
3085 /*--------------- prototypes for various public c functions ------------*/
3087 /* Prototypes for all init/syms_of/vars_of initialization functions. */
3088 #include "symsinit.h"
3090 /* Defined in alloc.c */
3091 void release_breathing_space(void);
3092 Lisp_Object noseeum_cons(Lisp_Object, Lisp_Object);
3093 Lisp_Object make_vector(size_t, Lisp_Object);
3094 Lisp_Object vector1(Lisp_Object);
3095 Lisp_Object vector2(Lisp_Object, Lisp_Object);
3096 Lisp_Object vector3(Lisp_Object, Lisp_Object, Lisp_Object);
3097 Lisp_Object make_bit_vector(size_t, Lisp_Object);
3098 Lisp_Object make_bit_vector_from_byte_vector(unsigned char *, size_t);
3099 Lisp_Object noseeum_make_marker(void);
3100 void garbage_collect_1(void);
3101 Lisp_Object acons(Lisp_Object, Lisp_Object, Lisp_Object);
3102 Lisp_Object cons3(Lisp_Object, Lisp_Object, Lisp_Object);
3103 Lisp_Object list1(Lisp_Object);
3104 Lisp_Object list2(Lisp_Object, Lisp_Object);
3105 Lisp_Object list3(Lisp_Object, Lisp_Object, Lisp_Object);
3106 Lisp_Object list4(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
3107 Lisp_Object list5(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
3109 Lisp_Object list6(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
3110 Lisp_Object, Lisp_Object);
3111 DECLARE_DOESNT_RETURN(memory_full(void));
3112 void disksave_object_finalization(void);
3113 extern int purify_flag;
3114 extern int gc_currently_forbidden;
3115 Lisp_Object restore_gc_inhibit(Lisp_Object);
3116 extern EMACS_INT gc_generation_number[1];
3117 int c_readonly(Lisp_Object);
3118 int lisp_readonly(Lisp_Object);
3119 Lisp_Object build_string(const char *);
3120 Lisp_Object build_ext_string(const char*, Lisp_Object);
3121 Lisp_Object build_translated_string(const char*);
3122 Lisp_Object make_string(const Bufbyte*, Bytecount);
3123 Lisp_Object make_ext_string(const Extbyte*, EMACS_INT, Lisp_Object);
3124 Lisp_Object make_uninit_string(Bytecount);
3125 Lisp_Object make_string_nocopy(Bufbyte*, Bytecount);
3126 void free_cons(Lisp_Cons *);
3127 void free_list(Lisp_Object);
3128 void free_alist(Lisp_Object);
3129 void mark_conses_in_list(Lisp_Object);
3130 void free_marker(Lisp_Marker *);
3131 int object_dead_p(Lisp_Object);
3132 void mark_object(Lisp_Object obj);
3133 int marked_p(Lisp_Object obj);
3135 #ifdef MEMORY_USAGE_STATS
3136 size_t malloced_storage_size(void *, size_t, struct overhead_stats *);
3137 size_t fixed_type_block_overhead(size_t);
3140 int pdump_load(const char *);
3142 extern char *pdump_start, *pdump_end;
3143 #define DUMPEDP(adr) ((((char *)(adr)) < pdump_end) && (((char *)(adr)) >= pdump_start))
3145 #define DUMPEDP(adr) 0
3148 /* Defined in buffer.c */
3149 Lisp_Object make_buffer(struct buffer *);
3150 Lisp_Object get_truename_buffer(Lisp_Object);
3151 void switch_to_buffer(Lisp_Object, Lisp_Object);
3152 extern int find_file_compare_truenames;
3153 extern int find_file_use_truenames;
3155 /* Defined in callproc.c */
3156 char *egetenv(const char *);
3158 /* Defined in console.c */
3159 void stuff_buffered_input(Lisp_Object);
3161 /* Defined in console-msw.c */
3162 EXFUN(Fmswindows_message_box, 3);
3163 extern int mswindows_message_outputted;
3165 /* Defined in data.c */
3166 DECLARE_DOESNT_RETURN(c_write_error(Lisp_Object));
3167 DECLARE_DOESNT_RETURN(lisp_write_error(Lisp_Object));
3168 DECLARE_DOESNT_RETURN(args_out_of_range(Lisp_Object, Lisp_Object));
3169 DECLARE_DOESNT_RETURN(args_out_of_range_3(Lisp_Object, Lisp_Object,
3171 Lisp_Object wrong_type_argument(Lisp_Object, Lisp_Object);
3172 DECLARE_DOESNT_RETURN(dead_wrong_type_argument(Lisp_Object, Lisp_Object));
3173 void check_int_range(EMACS_INT, EMACS_INT, EMACS_INT);
3176 /* superseded by ent-binary-rel stuff */
3177 enum arith_comparison {
3182 arith_less_or_equal,
3185 Lisp_Object arithcompare(Lisp_Object, Lisp_Object, enum arith_comparison);
3188 /* Do NOT use word_to_lisp or wasteful_word_to_lisp to decode time_t's
3189 unless you KNOW arg is non-negative. They cannot return negative
3190 values! Use make_time. */
3191 Lisp_Object word_to_lisp(unsigned int);
3192 unsigned int lisp_to_word(Lisp_Object);
3194 /* Defined in dired.c */
3195 Lisp_Object make_directory_hash_table(const char *);
3196 Lisp_Object wasteful_word_to_lisp(unsigned int);
3198 /* Defined in doc.c */
3199 Lisp_Object unparesseuxify_doc_string(int, EMACS_INT, char *, Lisp_Object);
3200 Lisp_Object read_doc_string(Lisp_Object);
3202 /* Defined in doprnt.c */
3203 Bytecount emacs_doprnt_c(Lisp_Object, const Bufbyte *, Lisp_Object,
3205 Bytecount emacs_doprnt_va(Lisp_Object, const Bufbyte *, Lisp_Object,
3206 Bytecount, va_list);
3207 Bytecount emacs_doprnt_lisp(Lisp_Object, const Bufbyte *, Lisp_Object,
3208 Bytecount, int, const Lisp_Object *);
3209 Bytecount emacs_doprnt_lisp_2(Lisp_Object, const Bufbyte *, Lisp_Object,
3210 Bytecount, int, ...);
3211 Lisp_Object emacs_doprnt_string_c(const Bufbyte *, Lisp_Object, Bytecount, ...);
3212 Lisp_Object emacs_doprnt_string_va(const Bufbyte *, Lisp_Object,
3213 Bytecount, va_list);
3214 Lisp_Object emacs_doprnt_string_lisp(const Bufbyte *, Lisp_Object,
3215 Bytecount, int, const Lisp_Object *);
3216 Lisp_Object emacs_doprnt_string_lisp_2(const Bufbyte *, Lisp_Object,
3217 Bytecount, int, ...);
3219 /* Defined in editfns.c */
3220 void uncache_home_directory(void);
3221 Extbyte *get_home_directory(void);
3222 char *user_login_name(uid_t *);
3223 Bufpos bufpos_clip_to_bounds(Bufpos, Bufpos, Bufpos);
3224 Bytind bytind_clip_to_bounds(Bytind, Bytind, Bytind);
3225 void buffer_insert1(struct buffer *, Lisp_Object);
3226 Lisp_Object make_string_from_buffer(struct buffer *, Bufpos, Charcount);
3227 Lisp_Object make_string_from_buffer_no_extents(struct buffer *, Bufpos,
3229 Lisp_Object make_time(time_t);
3230 Lisp_Object save_excursion_save(void);
3231 Lisp_Object save_restriction_save(void);
3232 Lisp_Object save_excursion_restore(Lisp_Object);
3233 Lisp_Object save_restriction_restore(Lisp_Object);
3235 /* Defined in emacsfns.c */
3236 Lisp_Object save_current_buffer_restore(Lisp_Object);
3238 /* Defined in emacs.c */
3239 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(fatal(const char *,
3241 int stderr_out(const char *, ...) PRINTF_ARGS(1, 2);
3242 int stdout_out(const char *, ...) PRINTF_ARGS(1, 2);
3243 SIGTYPE fatal_error_signal(int);
3244 Lisp_Object make_arg_list(int, Extbyte **);
3245 void make_argc_argv(Lisp_Object, int *, Extbyte ***);
3246 void free_argc_argv(Extbyte **);
3247 Lisp_Object decode_env_path(const char *, /*const*/ char *);
3248 Lisp_Object decode_path(/*const*/ char *);
3249 /* Nonzero means don't do interactive redisplay and don't change tty modes */
3250 extern int noninteractive, noninteractive1;
3251 extern int fatal_error_in_progress;
3252 extern int inhibit_non_essential_printing_operations;
3253 extern int preparing_for_armageddon;
3254 extern Fixnum emacs_priority;
3255 extern int running_asynch_code;
3256 extern int suppress_early_error_handler_backtrace;
3257 void debug_break(void);
3258 int debug_can_access_memory(void *ptr, Bytecount len);
3260 /* Defined in eval.c */
3261 DECLARE_DOESNT_RETURN(signal_error(Lisp_Object, Lisp_Object));
3262 void maybe_signal_error(Lisp_Object, Lisp_Object, Lisp_Object, Error_behavior);
3263 Lisp_Object maybe_signal_continuable_error(Lisp_Object, Lisp_Object,
3264 Lisp_Object, Error_behavior);
3265 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(type_error(Lisp_Object,
3268 void maybe_type_error(Lisp_Object, Lisp_Object, Error_behavior, const char *,
3269 ...) PRINTF_ARGS(4, 5);
3270 Lisp_Object continuable_type_error(Lisp_Object, const char *, ...)
3272 Lisp_Object maybe_continuable_type_error(Lisp_Object, Lisp_Object,
3274 const char *, ...) PRINTF_ARGS(4, 5);
3275 DECLARE_DOESNT_RETURN(signal_type_error(Lisp_Object, const char *,
3277 void maybe_signal_type_error(Lisp_Object, const char *, Lisp_Object,
3278 Lisp_Object, Error_behavior);
3279 Lisp_Object signal_type_continuable_error(Lisp_Object, const char *,
3281 Lisp_Object maybe_signal_type_continuable_error(Lisp_Object, const char *,
3283 Lisp_Object, Error_behavior);
3284 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(type_error_with_frob
3285 (Lisp_Object, Lisp_Object,
3286 const char *, ...), 3, 4);
3287 void maybe_type_error_with_frob(Lisp_Object, Lisp_Object, Lisp_Object,
3289 const char *, ...) PRINTF_ARGS(5, 6);
3290 Lisp_Object continuable_type_error_with_frob(Lisp_Object, Lisp_Object,
3292 ...) PRINTF_ARGS(3, 4);
3293 Lisp_Object maybe_continuable_type_error_with_frob
3294 (Lisp_Object, Lisp_Object, Lisp_Object, Error_behavior, const char *, ...)
3296 DECLARE_DOESNT_RETURN(signal_type_error_2(Lisp_Object, const char *,
3297 Lisp_Object, Lisp_Object));
3298 void maybe_signal_type_error_2(Lisp_Object, const char *, Lisp_Object,
3299 Lisp_Object, Lisp_Object, Error_behavior);
3300 Lisp_Object signal_type_continuable_error_2(Lisp_Object, const char *,
3301 Lisp_Object, Lisp_Object);
3302 Lisp_Object maybe_signal_type_continuable_error_2(Lisp_Object, const char *,
3303 Lisp_Object, Lisp_Object,
3304 Lisp_Object, Error_behavior);
3305 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(error(const char *,
3307 void maybe_error(Lisp_Object, Error_behavior, const char *,
3308 ...) PRINTF_ARGS(3, 4);
3309 Lisp_Object continuable_error(const char *, ...) PRINTF_ARGS(1, 2);
3310 Lisp_Object maybe_continuable_error(Lisp_Object, Error_behavior,
3311 const char *, ...) PRINTF_ARGS(3, 4);
3312 DECLARE_DOESNT_RETURN(signal_simple_error(const char *, Lisp_Object));
3313 void maybe_signal_simple_error(const char *, Lisp_Object,
3314 Lisp_Object, Error_behavior);
3315 Lisp_Object signal_simple_continuable_error(const char *, Lisp_Object);
3316 Lisp_Object maybe_signal_simple_continuable_error(const char *, Lisp_Object,
3317 Lisp_Object, Error_behavior);
3318 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(error_with_frob
3319 (Lisp_Object, const char *,
3321 void maybe_error_with_frob(Lisp_Object, Lisp_Object, Error_behavior,
3322 const char *, ...) PRINTF_ARGS(4, 5);
3323 Lisp_Object continuable_error_with_frob(Lisp_Object, const char *,
3324 ...) PRINTF_ARGS(2, 3);
3325 Lisp_Object maybe_continuable_error_with_frob
3326 (Lisp_Object, Lisp_Object, Error_behavior, const char *, ...) PRINTF_ARGS(4,
3328 DECLARE_DOESNT_RETURN(signal_simple_error_2
3329 (const char *, Lisp_Object, Lisp_Object));
3330 void maybe_signal_simple_error_2(const char *, Lisp_Object, Lisp_Object,
3331 Lisp_Object, Error_behavior);
3332 Lisp_Object signal_simple_continuable_error_2(const char *, Lisp_Object,
3334 Lisp_Object maybe_signal_simple_continuable_error_2(const char *, Lisp_Object,
3335 Lisp_Object, Lisp_Object,
3337 DECLARE_DOESNT_RETURN(signal_malformed_list_error(Lisp_Object));
3338 DECLARE_DOESNT_RETURN(signal_malformed_property_list_error(Lisp_Object));
3339 DECLARE_DOESNT_RETURN(signal_circular_list_error(Lisp_Object));
3340 DECLARE_DOESNT_RETURN(signal_circular_property_list_error(Lisp_Object));
3342 DECLARE_DOESNT_RETURN(syntax_error(const char *reason, Lisp_Object frob));
3343 DECLARE_DOESNT_RETURN(syntax_error_2(const char *reason, Lisp_Object frob1,
3344 Lisp_Object frob2));
3345 DECLARE_DOESNT_RETURN(invalid_argument(const char *reason, Lisp_Object frob));
3346 DECLARE_DOESNT_RETURN(invalid_argument_2(const char *reason,
3347 Lisp_Object frob1, Lisp_Object frob2));
3348 DECLARE_DOESNT_RETURN(invalid_operation(const char *reason, Lisp_Object frob));
3349 DECLARE_DOESNT_RETURN(invalid_operation_2(const char *reason,
3351 Lisp_Object frob2));
3352 DECLARE_DOESNT_RETURN(invalid_change(const char *reason, Lisp_Object frob));
3353 DECLARE_DOESNT_RETURN(invalid_change_2(const char *reason,
3354 Lisp_Object frob1, Lisp_Object frob2));
3356 Lisp_Object signal_void_function_error(Lisp_Object);
3357 Lisp_Object signal_invalid_function_error(Lisp_Object);
3358 Lisp_Object signal_wrong_number_of_arguments_error(Lisp_Object, int);
3360 Lisp_Object run_hook_with_args_in_buffer(struct buffer *, int, Lisp_Object *,
3361 enum run_hooks_condition);
3362 Lisp_Object run_hook_with_args(int, Lisp_Object *, enum run_hooks_condition);
3363 void va_run_hook_with_args(Lisp_Object, int, ...);
3364 void va_run_hook_with_args_in_buffer(struct buffer *, Lisp_Object, int, ...);
3365 Lisp_Object run_hook(Lisp_Object);
3366 Lisp_Object apply1(Lisp_Object, Lisp_Object);
3367 Lisp_Object call0(Lisp_Object);
3368 Lisp_Object call1(Lisp_Object, Lisp_Object);
3369 Lisp_Object call2(Lisp_Object, Lisp_Object, Lisp_Object);
3370 Lisp_Object call3(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
3371 Lisp_Object call4(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
3373 Lisp_Object call5(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
3374 Lisp_Object, Lisp_Object);
3375 Lisp_Object call6(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
3376 Lisp_Object, Lisp_Object, Lisp_Object);
3377 Lisp_Object call7(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
3378 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
3379 Lisp_Object call8(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
3380 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
3382 Lisp_Object call0_in_buffer(struct buffer *, Lisp_Object);
3383 Lisp_Object call1_in_buffer(struct buffer *, Lisp_Object, Lisp_Object);
3384 Lisp_Object call2_in_buffer(struct buffer *, Lisp_Object, Lisp_Object,
3386 Lisp_Object call3_in_buffer(struct buffer *, Lisp_Object, Lisp_Object,
3387 Lisp_Object, Lisp_Object);
3388 Lisp_Object call4_in_buffer(struct buffer *, Lisp_Object, Lisp_Object,
3389 Lisp_Object, Lisp_Object, Lisp_Object);
3390 Lisp_Object call5_in_buffer(struct buffer *, Lisp_Object, Lisp_Object,
3391 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
3392 Lisp_Object call6_in_buffer(struct buffer *, Lisp_Object, Lisp_Object,
3393 Lisp_Object, Lisp_Object, Lisp_Object,
3394 Lisp_Object, Lisp_Object);
3395 Lisp_Object eval_in_buffer(struct buffer *, Lisp_Object);
3396 Lisp_Object call0_with_handler(Lisp_Object, Lisp_Object);
3397 Lisp_Object call1_with_handler(Lisp_Object, Lisp_Object, Lisp_Object);
3398 Lisp_Object eval_in_buffer_trapping_errors(char*, struct buffer *, Lisp_Object);
3399 Lisp_Object run_hook_trapping_errors(char*, Lisp_Object);
3400 Lisp_Object safe_run_hook_trapping_errors(char*, Lisp_Object, int);
3401 Lisp_Object call0_trapping_errors(char*, Lisp_Object);
3402 Lisp_Object call1_trapping_errors(char*, Lisp_Object, Lisp_Object);
3403 Lisp_Object call2_trapping_errors(char*,
3404 Lisp_Object, Lisp_Object, Lisp_Object);
3405 Lisp_Object call3_trapping_errors(char*,
3406 Lisp_Object, Lisp_Object, Lisp_Object,
3408 Lisp_Object call_with_suspended_errors(lisp_fn_t, volatile Lisp_Object,
3409 Lisp_Object, Error_behavior, int, ...);
3410 /* C Code should be using internal_catch, record_unwind_p, condition_case_1 */
3411 Lisp_Object internal_catch(Lisp_Object, Lisp_Object(*)(Lisp_Object),
3412 Lisp_Object, int *volatile);
3413 Lisp_Object condition_case_1(Lisp_Object,
3414 Lisp_Object(*)(Lisp_Object),
3416 Lisp_Object(*)(Lisp_Object, Lisp_Object),
3418 Lisp_Object condition_case_3(Lisp_Object, Lisp_Object, Lisp_Object);
3419 Lisp_Object unbind_to(int, Lisp_Object);
3420 void specbind(Lisp_Object, Lisp_Object);
3421 void record_unwind_protect(Lisp_Object(*)(Lisp_Object), Lisp_Object);
3422 void do_autoload(Lisp_Object, Lisp_Object);
3423 Lisp_Object un_autoload(Lisp_Object);
3424 void warn_when_safe_lispobj(Lisp_Object, Lisp_Object, Lisp_Object);
3425 void warn_when_safe(Lisp_Object, Lisp_Object, const char *,
3426 ...) PRINTF_ARGS(3, 4);
3428 /* Defined in event-stream.c */
3429 void wait_delaying_user_input(int (*)(void *), void *);
3430 int detect_input_pending(void);
3431 void reset_this_command_keys(Lisp_Object, int);
3432 Lisp_Object enqueue_misc_user_event(Lisp_Object, Lisp_Object, Lisp_Object);
3433 Lisp_Object enqueue_misc_user_event_pos(Lisp_Object, Lisp_Object,
3434 Lisp_Object, int, int, int, int);
3435 extern int modifier_keys_are_sticky;
3437 /* Defined in event-Xt.c */
3438 void enqueue_Xt_dispatch_event(Lisp_Object event);
3439 void signal_special_Xt_user_event(Lisp_Object, Lisp_Object, Lisp_Object);
3441 /* Defined in events.c */
3442 void clear_event_resource(void);
3443 Lisp_Object allocate_event(void);
3445 /* Defined in fileio.c */
3446 void record_auto_save(void);
3447 void force_auto_save_soon(void);
3448 DECLARE_DOESNT_RETURN(report_file_error(const char *, Lisp_Object));
3449 void maybe_report_file_error(const char *, Lisp_Object,
3450 Lisp_Object, Error_behavior);
3451 DECLARE_DOESNT_RETURN(signal_file_error(const char *, Lisp_Object));
3452 void maybe_signal_file_error(const char *, Lisp_Object,
3453 Lisp_Object, Error_behavior);
3454 DECLARE_DOESNT_RETURN(signal_double_file_error(const char *, const char *,
3456 void maybe_signal_double_file_error(const char *, const char *,
3457 Lisp_Object, Lisp_Object, Error_behavior);
3458 DECLARE_DOESNT_RETURN(signal_double_file_error_2(const char *, const char *,
3459 Lisp_Object, Lisp_Object));
3460 void maybe_signal_double_file_error_2(const char *, const char *,
3461 Lisp_Object, Lisp_Object, Lisp_Object,
3463 Lisp_Object lisp_strerror(int);
3464 Lisp_Object expand_and_dir_to_file(Lisp_Object, Lisp_Object);
3465 ssize_t read_allowing_quit(int, void *, size_t);
3466 ssize_t write_allowing_quit(int, const void *, size_t);
3467 int internal_delete_file(Lisp_Object);
3469 /* Defined in filelock.c */
3470 void lock_file(Lisp_Object);
3471 void unlock_file(Lisp_Object);
3472 void unlock_all_files(void);
3473 void unlock_buffer(struct buffer *);
3475 /* Defined in filemode.c */
3476 void filemodestring(struct stat *, char *);
3478 /* Defined in fns.c */
3479 Lisp_Object list_sort(Lisp_Object, Lisp_Object,
3480 int (*)(Lisp_Object, Lisp_Object, Lisp_Object));
3481 Lisp_Object merge(Lisp_Object, Lisp_Object, Lisp_Object);
3483 void bump_string_modiff(Lisp_Object);
3484 Lisp_Object memq_no_quit(Lisp_Object, Lisp_Object);
3485 Lisp_Object assoc_no_quit(Lisp_Object, Lisp_Object);
3486 Lisp_Object assq_no_quit(Lisp_Object, Lisp_Object);
3487 Lisp_Object rassq_no_quit(Lisp_Object, Lisp_Object);
3488 Lisp_Object delq_no_quit(Lisp_Object, Lisp_Object);
3489 Lisp_Object delq_no_quit_and_free_cons(Lisp_Object, Lisp_Object);
3490 Lisp_Object remassoc_no_quit(Lisp_Object, Lisp_Object);
3491 Lisp_Object remassq_no_quit(Lisp_Object, Lisp_Object);
3492 Lisp_Object remrassq_no_quit(Lisp_Object, Lisp_Object);
3494 int plists_differ(Lisp_Object, Lisp_Object, int, int, int);
3495 Lisp_Object internal_plist_get(Lisp_Object, Lisp_Object);
3496 void internal_plist_put(Lisp_Object *, Lisp_Object, Lisp_Object);
3497 int internal_remprop(Lisp_Object *, Lisp_Object);
3498 Lisp_Object external_plist_get(Lisp_Object *, Lisp_Object, int, Error_behavior);
3499 void external_plist_put(Lisp_Object *, Lisp_Object,
3500 Lisp_Object, int, Error_behavior);
3501 int external_remprop(Lisp_Object *, Lisp_Object, int, Error_behavior);
3502 int internal_equal(Lisp_Object, Lisp_Object, int);
3503 Lisp_Object concat2(Lisp_Object, Lisp_Object);
3504 Lisp_Object concat3(Lisp_Object, Lisp_Object, Lisp_Object);
3505 Lisp_Object vconcat2(Lisp_Object, Lisp_Object);
3506 Lisp_Object vconcat3(Lisp_Object, Lisp_Object, Lisp_Object);
3507 Lisp_Object nconc2(Lisp_Object, Lisp_Object);
3508 Lisp_Object bytecode_nconc2(Lisp_Object *);
3509 void check_losing_bytecode(const char *, Lisp_Object);
3511 /* Defined in glyphs.c */
3512 Error_behavior decode_error_behavior_flag(Lisp_Object);
3513 Lisp_Object encode_error_behavior_flag(Error_behavior);
3515 /* Defined in indent.c */
3516 int bi_spaces_at_point(struct buffer *, Bytind);
3517 int column_at_point(struct buffer *, Bufpos, int);
3518 int string_column_at_point(Lisp_String *, Bufpos, int);
3519 int current_column(struct buffer *);
3520 void invalidate_current_column(void);
3521 Bufpos vmotion(struct window *, Bufpos, int, int *);
3522 Bufpos vmotion_pixels(Lisp_Object, Bufpos, int, int, int *);
3524 /* Defined in keymap.c */
3525 void where_is_to_char(Lisp_Object, char *);
3527 /* Defined in lread.c */
3528 void ebolify_bytecode_constants(Lisp_Object);
3529 void close_load_descs(void);
3530 int locate_file(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int);
3531 EXFUN(Flocate_file_clear_hashing, 1);
3532 int isfloat_string(const char *);
3533 #if defined HAVE_MPQ && defined WITH_GMP
3534 int isbigq_string(const char *);
3536 #if defined HAVE_MPC && defined WITH_MPC || \
3537 defined HAVE_PSEUC && defined WITH_PSEUC
3538 int isbigc_string(const char *);
3540 #if defined HAVE_PSEUG && defined WITH_PSEUG
3541 int isgaussian_string(const char *);
3544 /* Well, I've decided to enable this. -- ben */
3545 /* And I've decided to make it work right. -- sb */
3547 /* Define the following symbol to enable load history of dumped files */
3548 #define LOADHIST_DUMPED
3549 /* Define the following symbol to enable load history of C source */
3550 #define LOADHIST_BUILTIN
3552 #ifdef LOADHIST /* this is just a stupid idea */
3553 #define LOADHIST_ATTACH(x) \
3554 do { if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); } \
3556 #else /*! LOADHIST */
3557 # define LOADHIST_ATTACH(x)
3558 #endif /*! LOADHIST */
3560 /* Defined in marker.c */
3561 Bytind bi_marker_position(Lisp_Object);
3562 Bufpos marker_position(Lisp_Object);
3563 void set_bi_marker_position(Lisp_Object, Bytind);
3564 void set_marker_position(Lisp_Object, Bufpos);
3565 void unchain_marker(Lisp_Object);
3566 Lisp_Object noseeum_copy_marker(Lisp_Object, Lisp_Object);
3567 Lisp_Object set_marker_restricted(Lisp_Object, Lisp_Object, Lisp_Object);
3568 #ifdef MEMORY_USAGE_STATS
3569 int compute_buffer_marker_usage(struct buffer *, struct overhead_stats *);
3572 /* Defined in menubar.c */
3573 extern int popup_menu_up_p;
3574 extern int menubar_show_keybindings;
3575 extern int popup_menu_titles;
3577 /* Defined in minibuf.c */
3578 extern int minibuf_level;
3579 Charcount scmp_1(const Bufbyte *, const Bufbyte *, Charcount, int);
3580 #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case)
3581 extern int completion_ignore_case;
3582 int regexp_ignore_completion_p(const Bufbyte *, Lisp_Object,
3583 Bytecount, Bytecount);
3584 Lisp_Object clear_echo_area(struct frame *, Lisp_Object, int);
3585 Lisp_Object clear_echo_area_from_print(struct frame *, Lisp_Object, int);
3586 void echo_area_append(struct frame *, const Bufbyte *, Lisp_Object,
3587 Bytecount, Bytecount, Lisp_Object);
3588 void echo_area_message(struct frame *, const Bufbyte *, Lisp_Object,
3589 Bytecount, Bytecount, Lisp_Object);
3590 Lisp_Object echo_area_status(struct frame *);
3591 int echo_area_active(struct frame *);
3592 Lisp_Object echo_area_contents(struct frame *);
3593 void message_internal(const Bufbyte *, Lisp_Object, Bytecount, Bytecount);
3594 void message_append_internal(const Bufbyte *, Lisp_Object,
3595 Bytecount, Bytecount);
3596 void message(const char *, ...) PRINTF_ARGS(1, 2);
3597 void message_append(const char *, ...) PRINTF_ARGS(1, 2);
3598 void message_no_translate(const char *, ...) PRINTF_ARGS(1, 2);
3599 void clear_message(void);
3601 /* Defined in print.c */
3602 void write_string_to_stdio_stream(FILE *, struct console *,
3603 const Bufbyte *, Bytecount, Bytecount,
3605 void debug_print(Lisp_Object);
3606 void debug_short_backtrace(int);
3607 void temp_output_buffer_setup(Lisp_Object);
3608 void temp_output_buffer_show(Lisp_Object, Lisp_Object);
3609 /* NOTE: Do not call this with the data of a Lisp_String. Use princ.
3610 * Note: stream should be defaulted before calling
3611 * (eg Qnil means stdout, not Vstandard_output, etc) */
3612 void write_c_string(const char *, Lisp_Object);
3613 /* Same goes for this function. */
3614 void write_string_1(const Bufbyte *, Bytecount, Lisp_Object);
3615 void print_cons(Lisp_Object, Lisp_Object, int);
3616 void print_vector(Lisp_Object, Lisp_Object, int);
3617 void print_string(Lisp_Object, Lisp_Object, int);
3618 char *long_to_string(char *, long);
3619 void print_internal(Lisp_Object, Lisp_Object, int);
3620 void print_symbol(Lisp_Object, Lisp_Object, int);
3621 /* The number of bytes required to store the decimal printed
3622 * representation of an integral type. Add a few bytes for truncation,
3623 * optional sign prefix, and null byte terminator.
3624 * 2.40824 == log (256) / log (10).
3626 * We don't use floating point since Sun cc (buggily?) cannot use
3627 * floating point computations to define a compile-time integral
3630 #define DECIMAL_PRINT_SIZE(integral_type) \
3631 (((2410824 * sizeof (integral_type)) / 1000000) + 3)
3632 extern int print_escape_newlines;
3633 extern int print_readably;
3634 Lisp_Object internal_with_output_to_temp_buffer(Lisp_Object,
3635 Lisp_Object(*)(Lisp_Object),
3636 Lisp_Object, Lisp_Object);
3637 void internal_object_printer(Lisp_Object, Lisp_Object, int);
3639 /* Defined in profile.c */
3640 void mark_profiling_info(void);
3641 void profile_increase_call_count(Lisp_Object);
3642 extern int profiling_active;
3643 extern int profiling_redisplay_flag;
3645 /* Defined in rangetab.c */
3646 void put_range_table(Lisp_Object, EMACS_INT, EMACS_INT, Lisp_Object);
3647 int unified_range_table_bytes_needed(Lisp_Object);
3648 int unified_range_table_bytes_used(const void*);
3649 void unified_range_table_copy_data(Lisp_Object, void *);
3650 Lisp_Object unified_range_table_lookup(void *, EMACS_INT, Lisp_Object);
3651 int unified_range_table_nentries(void*);
3652 void unified_range_table_get_range(void *, int, EMACS_INT *, EMACS_INT *,
3655 /* Defined in search.c */
3656 struct re_pattern_buffer;
3657 struct re_registers;
3658 Bufpos scan_buffer(struct buffer *, Emchar, Bufpos, Bufpos, EMACS_INT,
3660 Bufpos find_next_newline(struct buffer *, Bufpos, int);
3661 Bufpos find_next_newline_no_quit(struct buffer *, Bufpos, int);
3662 Bytind bi_find_next_newline_no_quit(struct buffer *, Bytind, int);
3663 Bytind bi_find_next_emchar_in_string(Lisp_String *, Emchar, Bytind, EMACS_INT);
3664 Bufpos find_before_next_newline(struct buffer *, Bufpos, Bufpos, int);
3665 struct re_pattern_buffer *compile_pattern(Lisp_Object, struct re_registers *,
3666 Lisp_Object, int, Error_behavior);
3667 Bytecount fast_string_match(Lisp_Object, const Bufbyte *,
3668 Lisp_Object, Bytecount,
3669 Bytecount, int, Error_behavior, int);
3670 Bytecount fast_lisp_string_match(Lisp_Object, Lisp_Object);
3671 void restore_match_data(void);
3673 /* Defined in signal.c */
3674 void init_interrupts_late(void);
3675 extern int dont_check_for_quit;
3676 void begin_dont_check_for_quit(void);
3677 void emacs_sleep(int);
3679 /* Defined in sound.c */
3680 void init_device_sound(struct device *);
3682 /* Defined in specifier.c */
3683 Lisp_Object specifier_instance(Lisp_Object, Lisp_Object, Lisp_Object,
3684 Error_behavior, int, int, Lisp_Object);
3685 Lisp_Object specifier_instance_no_quit(Lisp_Object, Lisp_Object, Lisp_Object,
3686 Error_behavior, int, Lisp_Object);
3688 /* Defined in symbols.c */
3689 long unsigned int hash_string(const Bufbyte*, Bytecount);
3690 Lisp_Object intern(const char *);
3691 Lisp_Object oblookup(Lisp_Object, const Bufbyte *, Bytecount);
3692 void map_obarray(Lisp_Object, int (*)(Lisp_Object, void *), void *);
3693 Lisp_Object indirect_function(Lisp_Object, int);
3694 Lisp_Object symbol_value_in_buffer(Lisp_Object, Lisp_Object);
3695 void kill_buffer_local_variables(struct buffer *);
3696 int symbol_value_buffer_local_info(Lisp_Object, struct buffer *);
3697 Lisp_Object find_symbol_value(Lisp_Object);
3698 Lisp_Object find_symbol_value_quickly(Lisp_Object, int);
3699 Lisp_Object top_level_value(Lisp_Object);
3700 void reject_constant_symbols(Lisp_Object sym, Lisp_Object newval,
3702 Lisp_Object follow_past_lisp_magic);
3704 /* Defined in syntax.c */
3705 Bufpos scan_words(struct buffer *, Bufpos, int);
3707 /* Defined in undo.c */
3708 Lisp_Object truncate_undo_list(Lisp_Object, int, int);
3709 void record_extent(Lisp_Object, int);
3710 void record_insert(struct buffer *, Bufpos, Charcount);
3711 void record_delete(struct buffer *, Bufpos, Charcount);
3712 void record_change(struct buffer *, Bufpos, Charcount);
3714 /* Defined in unex*.c */
3715 int unexec(char *, char *, uintptr_t, uintptr_t, uintptr_t);
3716 #ifdef RUN_TIME_REMAP
3717 int run_time_remap(char *);
3720 /* Defined in vm-limit.c */
3721 void memory_warnings(void *, void (*)(const char *));
3723 /* Defined in window.c */
3724 Lisp_Object save_window_excursion_unwind(Lisp_Object);
3725 Lisp_Object display_buffer(Lisp_Object, Lisp_Object, Lisp_Object);
3727 /*--------------- prototypes for Lisp primitives in C ------------*/
3729 /* The following were machine generated 19980312 */
3731 EXFUN(Faccept_process_output, 3);
3733 EXFUN(Fadd_spec_to_specifier, 5);
3734 EXFUN(Fadd_timeout, 4);
3735 EXFUN(Fappend, MANY);
3736 EXFUN(Fapply, MANY);
3741 EXFUN(Fbacktrace, 2);
3742 EXFUN(Fbeginning_of_line, 2);
3746 EXFUN(Fbuffer_substring, 3);
3747 EXFUN(Fbuilt_in_variable_type, 1);
3748 EXFUN(Fbyte_code, 3);
3749 EXFUN(Fcall_interactively, 3);
3750 EXFUN(Fcanonicalize_lax_plist, 2);
3751 EXFUN(Fcanonicalize_plist, 2);
3753 EXFUN(Fcar_safe, 1);
3755 EXFUN (Fcdr_safe, 1);
3756 EXFUN(Fchar_after, 2);
3757 EXFUN(Fchar_to_string, 1);
3758 EXFUN(Fcheck_valid_plist, 1);
3759 EXFUN(Fvalid_plist_p, 1);
3760 EXFUN(Fclear_range_table, 1);
3761 EXFUN(Fcoding_category_list, 0);
3762 EXFUN(Fcoding_category_system, 1);
3763 EXFUN(Fcoding_priority_list, 0);
3764 EXFUN(Fcoding_system_charset, 2);
3765 EXFUN(Fcoding_system_doc_string, 1);
3766 EXFUN(Fcoding_system_list, 0);
3767 EXFUN(Fcoding_system_name, 1);
3768 EXFUN(Fcoding_system_p, 1);
3769 EXFUN(Fcoding_system_property, 2);
3770 EXFUN(Fcoding_system_type, 1);
3771 EXFUN(Fcommand_execute, 3);
3772 EXFUN(Fcommandp, 1);
3773 EXFUN(Fconcat, MANY);
3775 EXFUN(Fcopy_alist, 1);
3776 EXFUN(Fcopy_coding_system, 2);
3777 EXFUN(Fcopy_event, 2);
3778 EXFUN(Fcopy_list, 1);
3779 EXFUN(Fcopy_marker, 2);
3780 EXFUN(Fcopy_sequence, 1);
3781 EXFUN(Fcopy_tree, 2);
3782 EXFUN(Fcurrent_window_configuration, 1);
3783 EXFUN(Fdecode_big5_char, 1);
3784 EXFUN(Fdecode_coding_region, 4);
3785 EXFUN(Fdecode_shift_jis_char, 1);
3786 EXFUN(Fdefault_boundp, 1);
3787 EXFUN(Fdefault_value, 1);
3788 EXFUN(Fdefine_key, 3);
3790 EXFUN(Fdelete_region, 3);
3791 EXFUN(Fdelete_process, 1);
3793 EXFUN(Fdestructive_alist_to_plist, 1);
3794 EXFUN(Fdetect_coding_region, 3);
3795 EXFUN(Fdgettext, 2);
3797 EXFUN(Fdirectory_file_name, 1);
3798 EXFUN(Fdisable_timeout, 1);
3799 EXFUN(Fdiscard_input, 0);
3800 EXFUN(Fdispatch_event, 1);
3801 EXFUN(Fdisplay_error, 2);
3802 EXFUN(Fdo_auto_save, 2);
3803 EXFUN(Fdowncase, 2);
3805 EXFUN(Fencode_big5_char, 1);
3806 EXFUN(Fencode_coding_region, 4);
3807 EXFUN(Fencode_shift_jis_char, 1);
3808 EXFUN(Fend_of_line, 2);
3809 EXFUN(Fenqueue_eval_event, 2);
3813 EXFUN(Ferror_message_string, 1);
3815 EXFUN(Fevent_to_character, 4);
3816 EXFUN(Fexecute_kbd_macro, 2);
3817 EXFUN(Fexpand_abbrev, 0);
3818 EXFUN(Fexpand_file_name, 2);
3819 EXFUN(Fextent_at, 5);
3820 EXFUN(Fextent_property, 3);
3822 EXFUN(Ffile_accessible_directory_p, 1);
3823 EXFUN(Ffile_directory_p, 1);
3824 EXFUN(Ffile_executable_p, 1);
3825 EXFUN(Ffile_exists_p, 1);
3826 EXFUN(Ffile_name_absolute_p, 1);
3827 EXFUN(Ffile_name_as_directory, 1);
3828 EXFUN(Ffile_name_directory, 1);
3829 EXFUN(Ffile_name_nondirectory, 1);
3830 EXFUN(Ffile_readable_p, 1);
3831 EXFUN(Ffile_symlink_p, 1);
3832 EXFUN(Ffile_truename, 2);
3833 EXFUN(Ffind_coding_system, 1);
3834 EXFUN(Ffind_file_name_handler, 2);
3835 EXFUN(Ffollowing_char, 1);
3836 EXFUN(Fformat, MANY);
3837 EXFUN(Fforward_char, 2);
3838 EXFUN(Fforward_line, 2);
3840 EXFUN(Ffuncall, MANY);
3841 EXFUN(Ffunctionp, 1);
3844 EXFUN(Fget_buffer_process, 1);
3845 EXFUN(Fget_coding_system, 1);
3846 EXFUN(Fget_process, 1);
3847 EXFUN(Fget_range_table, 3);
3849 EXFUN(Fgoto_char, 2);
3851 EXFUN(Findent_to, 3);
3852 EXFUN(Findirect_function, 1);
3853 EXFUN(Finsert, MANY);
3854 EXFUN(Finsert_buffer_substring, 3);
3855 EXFUN(Finsert_char, 4);
3856 EXFUN(Finsert_file_contents_internal, 7);
3857 EXFUN(Finteractive_p, 0);
3859 EXFUN(Fintern_soft, 2);
3860 EXFUN(Fkey_description, 1);
3861 EXFUN(Fkill_emacs, 1);
3862 EXFUN(Fkill_local_variable, 1);
3864 EXFUN(Flax_plist_get, 3);
3865 EXFUN(Flax_plist_remprop, 2);
3870 EXFUN(Flist_modules, 0);
3871 EXFUN(Fload_module, 3);
3872 EXFUN(Flookup_key, 3);
3874 EXFUN(Fmake_byte_code, MANY);
3875 EXFUN(Fmake_coding_system, 4);
3876 EXFUN(Fmake_glyph_internal, 1);
3877 EXFUN(Fmake_list, 2);
3878 EXFUN(Fmake_marker, 0);
3879 EXFUN(Fmake_range_table, 0);
3880 EXFUN(Fmake_sparse_keymap, 1);
3881 EXFUN(Fmake_string, 2);
3882 EXFUN(Fmake_symbol, 1);
3883 EXFUN(Fmake_vector, 2);
3885 EXFUN(Fmarker_buffer, 1);
3886 EXFUN(Fmarker_position, 1);
3887 EXFUN(Fmatch_beginning, 1);
3888 EXFUN(Fmatch_end, 1);
3893 EXFUN(Fminus, MANY);
3894 EXFUN(Fnarrow_to_region, 3);
3895 EXFUN(Fnconc, MANY);
3896 EXFUN(Fnext_event, 2);
3897 EXFUN(Fnonnegativep, 1);
3898 EXFUN(Fnreverse, 1);
3900 EXFUN(Fnumber_to_string, 1);
3901 EXFUN(Fold_assq, 2);
3902 EXFUN(Fold_equal, 2);
3903 EXFUN(Fold_member, 2);
3904 EXFUN(Fold_memq, 2);
3905 EXFUN(Fplist_get, 3);
3906 EXFUN(Fplist_member, 2);
3907 EXFUN(Fplist_put, 3);
3909 EXFUN(Fpoint_marker, 2);
3910 EXFUN(Fpoint_max, 1);
3911 EXFUN(Fpoint_min, 1);
3913 EXFUN(Fpreceding_char, 1);
3914 EXFUN(Fprefix_numeric_value, 1);
3916 EXFUN(Fprin1_to_string, 2);
3919 EXFUN(Fprocess_status, 1);
3920 EXFUN(Fprogn, UNEVALLED);
3923 EXFUN(Fput_range_table, 4);
3924 EXFUN(Fput_text_property, 5);
3928 EXFUN(Fread_key_sequence, 3);
3929 EXFUN(Freally_free, 1);
3932 EXFUN(Freplace_list, 2);
3934 EXFUN(Fselected_frame, 1);
3936 EXFUN(Fset_coding_category_system, 2);
3937 EXFUN(Fset_coding_priority_list, 1);
3938 EXFUN(Fset_default, 2);
3939 EXFUN(Fset_marker, 3);
3940 EXFUN(Fset_standard_case_table, 1);
3945 EXFUN(Fskip_chars_backward, 3);
3946 EXFUN(Fskip_chars_forward, 3);
3947 EXFUN(Fsleep_for, 1);
3949 EXFUN(Fspecifier_spec_list, 4);
3950 EXFUN(Fstring_equal, 2);
3951 EXFUN(Fstring_lessp, 2);
3952 EXFUN(Fstring_match, 4);
3954 EXFUN(Fsubr_max_args, 1);
3955 EXFUN(Fsubr_min_args, 1);
3956 EXFUN(Fsubsidiary_coding_system, 2);
3957 EXFUN(Fsubstitute_command_keys, 1);
3958 EXFUN(Fsubstitute_in_file_name, 1);
3959 EXFUN(Fsubstring, 3);
3960 EXFUN(Fsymbol_function, 1);
3961 EXFUN(Fsymbol_name, 1);
3962 EXFUN(Fsymbol_plist, 1);
3963 EXFUN(Fsymbol_value, 1);
3964 EXFUN(Fsystem_name, 0);
3966 EXFUN(Ftimes, MANY);
3967 EXFUN(Ftruncate, 1);
3968 EXFUN(Fundo_boundary, 0);
3969 EXFUN(Funhandled_file_name_directory, 1);
3970 EXFUN(Funlock_buffer, 0);
3972 EXFUN(Fupcase_initials, 2);
3973 EXFUN(Fupcase_initials_region, 3);
3974 EXFUN(Fupcase_region, 3);
3975 EXFUN(Fuser_home_directory, 0);
3976 EXFUN(Fuser_login_name, 1);
3977 EXFUN(Fvector, MANY);
3978 EXFUN(Fverify_visited_file_modtime, 1);
3979 EXFUN(Fvertical_motion, 3);
3982 /*--------------- prototypes for constant symbols ------------*/
3984 extern Lisp_Object Q_style;
3985 extern Lisp_Object Qactivate_menubar_hook;
3986 extern Lisp_Object Qafter_change_major_mode_hook;
3987 extern Lisp_Object Qarith_error;
3988 extern Lisp_Object Qarrayp, Qautoload;
3989 extern Lisp_Object Qbackground, Qbackground_pixmap;
3990 extern Lisp_Object Qbeginning_of_buffer, Qbig5;
3991 extern Lisp_Object Qbitp, Qblinking;
3992 extern Lisp_Object Qbuffer_glyph_p, Qbuffer_live_p, Qbuffer_read_only;
3993 extern Lisp_Object Qbyte_code, Qcall_interactively;
3994 extern Lisp_Object Qcategory_designator_p, Qcategory_table_value_p, Qccl, Qcdr;
3995 extern Lisp_Object Qchar_or_string_p, Qcharacterp;
3996 extern Lisp_Object Qcharset_g0, Qcharset_g1, Qcharset_g2, Qcharset_g3;
3997 extern Lisp_Object Qcircular_list, Qcircular_property_list;
3998 extern Lisp_Object Qcoding_system_error;
3999 extern Lisp_Object Qcolor_pixmap_image_instance_p;
4000 extern Lisp_Object Qcommandp, Qcompletion_ignore_case;
4001 extern Lisp_Object Qconsole_live_p, Qconst_specifier, Qcr;
4002 extern Lisp_Object Qcrlf, Qcurrent_menubar, Qctext;
4003 extern Lisp_Object Qcyclic_variable_indirection, Qdecode;
4004 extern Lisp_Object Qdefun, Qdevice_live_p;
4005 extern Lisp_Object Qdictp;
4006 extern Lisp_Object Qdim, Qdisabled, Qdisplay_table;
4007 extern Lisp_Object Qdomain_error;
4008 extern Lisp_Object Qediting_error;
4009 extern Lisp_Object Qencode, Qend_of_buffer, Qend_of_file, Qend_open;
4010 extern Lisp_Object Qeol_cr, Qeol_crlf, Qeol_lf, Qeol_type;
4011 extern Lisp_Object Qerror, Qerror_conditions, Qerror_message, Qescape_quoted;
4012 extern Lisp_Object Qevent_live_p, Qexit, Qextent_live_p;
4013 extern Lisp_Object Qexternal_debugging_output, Qfeaturep;
4014 extern Lisp_Object Qfile_error;
4015 extern Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output;
4016 extern Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output, Qforeground;
4017 extern Lisp_Object Qformat, Qframe_live_p;
4018 extern Lisp_Object Qicon_glyph_p, Qidentity;
4019 extern Lisp_Object Qinhibit_quit, Qinhibit_read_only;
4020 extern Lisp_Object Qinput_charset_conversion;
4021 extern Lisp_Object Qinteger_char_or_marker_p, Qinteger_or_char_p;
4022 extern Lisp_Object Qinteger_or_marker_p, Qintegerp, Qinteractive;
4023 extern Lisp_Object Qinternal_error, Qinvalid_argument;
4024 extern Lisp_Object Qinvalid_change, Qinvalid_function, Qinvalid_operation;
4025 extern Lisp_Object Qinvalid_byte_code, Qinvalid_read_syntax, Qinvalid_state;
4026 extern Lisp_Object Qio_error;
4027 extern Lisp_Object Qiso2022;
4028 extern Lisp_Object Qip_any;
4029 extern Lisp_Object Qlambda, Qlayout;
4030 extern Lisp_Object Qlf;
4031 extern Lisp_Object Qlist_formation_error;
4032 extern Lisp_Object Qlistp, Qload, Qlocalhost, Qlock_shift, Qmacro;
4033 extern Lisp_Object Qmakunbound, Qmalformed_list, Qmalformed_property_list;
4034 extern Lisp_Object Qmark;
4035 extern Lisp_Object Qmnemonic;
4036 extern Lisp_Object Qmono_pixmap_image_instance_p;
4037 extern Lisp_Object Qmouse_leave_buffer_hook;
4038 extern Lisp_Object Qnas, Qnatnump, Qnative_layout;
4039 extern Lisp_Object Qno_ascii_cntl, Qno_ascii_eol, Qno_catch;
4040 extern Lisp_Object Qno_conversion, Qno_iso6429;
4041 extern Lisp_Object Qnonnegativep, Qnothing_image_instance_p;
4042 extern Lisp_Object Qnumber_char_or_marker_p, Qnumberp;
4043 extern Lisp_Object Qoutput_charset_conversion;
4044 extern Lisp_Object Qoverflow_error, Qpoint, Qpointer_glyph_p;
4045 extern Lisp_Object Qpointer_image_instance_p, Qpositivep, Qpost_read_conversion;
4046 extern Lisp_Object Qpre_write_conversion, Qprint_length;
4047 extern Lisp_Object Qprint_string_length, Qprogn, Qquit;
4048 extern Lisp_Object Qquote, Qrange_error, Qread_char;
4049 extern Lisp_Object Qread_from_minibuffer, Qreally_early_error_handler;
4050 extern Lisp_Object Qregion_beginning, Qregion_end;
4051 extern Lisp_Object Qrun_hooks, Qsans_modifiers;
4052 extern Lisp_Object Qsave_buffers_kill_emacs;
4053 extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo;
4054 extern Lisp_Object Qsequencep, Qset, Qsetting_constant;
4055 extern Lisp_Object Qseven, Qshift_jis, Qshort;
4056 extern Lisp_Object Qsingularity_error;
4057 extern Lisp_Object Qstandard_input, Qstandard_output;
4058 extern Lisp_Object Qstart_open;
4059 extern Lisp_Object Qstring_greaterp, Qstring_lessp, Qsubwindow;
4060 extern Lisp_Object Qsubwindow_image_instance_p;
4061 extern Lisp_Object Qsyntax_error, Qt;
4062 extern Lisp_Object Qtext_image_instance_p;
4063 extern Lisp_Object Qtop_level;
4064 extern Lisp_Object Qtrue_list_p;
4065 extern Lisp_Object Qunbound, Qunderflow_error;
4066 extern Lisp_Object Qunderline, Quser_files_and_directories;
4067 extern Lisp_Object Qvalues;
4068 extern Lisp_Object Qvariable_documentation, Qvariable_domain;
4069 extern Lisp_Object Qvoid_function, Qvoid_variable;
4070 extern Lisp_Object Qwindow_live_p, Qwrong_number_of_arguments;
4071 extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p;
4072 extern Lisp_Object Qgtk;
4074 #define SYMBOL(fou) extern Lisp_Object fou
4075 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
4076 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
4077 extern Lisp_Object tout_le_monde
4079 #include "general-slots.h"
4082 #undef SYMBOL_KEYWORD
4083 #undef SYMBOL_GENERAL
4085 /*--------------- prototypes for variables of type Lisp_Object ------------*/
4087 extern Lisp_Object Vactivate_menubar_hook;
4088 extern Lisp_Object Vafter_change_major_mode_hook;
4089 extern Lisp_Object Vautoload_queue, Vblank_menubar;
4090 extern Lisp_Object Vcharset_ascii, Vcharset_composite, Vcharset_control_1;
4091 extern Lisp_Object Vcoding_system_for_read, Vcoding_system_for_write;
4092 extern Lisp_Object Vcoding_system_hash_table, Vcommand_history;
4093 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory;
4094 extern Lisp_Object Vconfigure_site_module_directory;
4095 extern Lisp_Object Vconsole_list, Vcontrolling_terminal;
4096 extern Lisp_Object Vcurrent_compiled_function_annotation, Vcurrent_load_list;
4097 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory;
4098 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook;
4099 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name;
4100 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version;
4101 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path;
4102 extern Lisp_Object Vexecuting_macro, Vfeatures, Vfile_domain;
4103 extern Lisp_Object Vfile_name_coding_system, Vinhibit_quit;
4104 extern Lisp_Object Vinvocation_directory, Vinvocation_name;
4105 extern Lisp_Object Vkeyboard_coding_system, Vlast_command, Vlast_command_char;
4106 extern Lisp_Object Vlast_command_event, Vlast_input_event;
4107 extern Lisp_Object Vload_file_name_internal;
4108 extern Lisp_Object Vload_file_name_internal_the_purecopy, Vload_history;
4109 extern Lisp_Object Vload_path, Vmark_even_if_inactive, Vmenubar_configuration;
4110 extern Lisp_Object Vminibuf_preprompt, Vminibuf_prompt, Vminibuffer_zero;
4111 extern Lisp_Object Vmodule_directory, Vmswindows_downcase_file_names;
4112 extern Lisp_Object Vmswindows_get_true_file_attributes, Vobarray;
4113 extern Lisp_Object Vprint_length, Vprint_level, Vprocess_environment;
4114 extern Lisp_Object Vquit_flag;
4115 extern Lisp_Object Vrecent_keys_ring, Vshell_file_name;
4116 extern Lisp_Object Vsite_module_directory;
4117 extern Lisp_Object Vstandard_input, Vstandard_output, Vstdio_str;
4118 extern Lisp_Object Vsynchronous_sounds, Vsystem_name, Vterminal_coding_system;
4119 extern Lisp_Object Vthis_command_keys, Vunread_command_event;
4120 extern Lisp_Object Vx_initial_argv_list;
4122 #endif /* INCLUDED_lisp_h_ */