1 /* Fundamental definitions for XEmacs Lisp interpreter.
2 Copyright (C) 1985-1987, 1992-1995 Free Software Foundation, Inc.
3 Copyright (C) 1993-1996 Richard Mlynarik.
4 Copyright (C) 1995, 1996, 2000 Ben Wing.
6 This file is part of XEmacs.
8 XEmacs is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with XEmacs; see the file COPYING. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
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>
48 /* ------------------------ dynamic arrays ------------------- */
50 #define Dynarr_declare(type) \
59 Dynarr_declare (void);
62 void *Dynarr_newf (int elsize);
63 void Dynarr_resize (void *dy, int size);
64 void Dynarr_insert_many (void *d, const void *el, int len, int start);
65 void Dynarr_delete_many (void *d, int start, int len);
66 void Dynarr_free (void *d);
68 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type)))
69 #define Dynarr_new2(dynarr_type, type) \
70 ((dynarr_type *) Dynarr_newf (sizeof (type)))
71 #define Dynarr_at(d, pos) ((d)->base[pos])
72 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos))
73 #define Dynarr_begin(d) Dynarr_atp (d, 0)
74 #define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d) - 1)
75 #define Dynarr_sizeof(d) ((d)->cur * (d)->elsize)
76 #define Dynarr_length(d) ((d)->cur)
77 #define Dynarr_largest(d) ((d)->largest)
78 #define Dynarr_reset(d) ((d)->cur = 0)
79 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur)
80 #define Dynarr_insert_many_at_start(d, el, len) \
81 Dynarr_insert_many (d, el, len, 0)
82 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1)
83 #define Dynarr_add_lisp_string(d, s) do { \
84 Lisp_String *dyna_ls_s = XSTRING (s); \
85 Dynarr_add_many (d, (char *) string_data (dyna_ls_s), \
86 string_length (dyna_ls_s)); \
89 #define Dynarr_add(d, el) ( \
90 (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : (void) 0, \
91 ((d)->base)[(d)->cur++] = (el), \
92 (d)->cur > (d)->largest ? (d)->largest = (d)->cur : (int) 0)
94 /* The following defines will get you into real trouble if you aren't
95 careful. But they can save a lot of execution time when used wisely. */
96 #define Dynarr_increment(d) ((d)->cur++)
97 #define Dynarr_set_size(d, n) ((d)->cur = n)
99 #ifdef MEMORY_USAGE_STATS
100 struct overhead_stats;
101 size_t Dynarr_memory_usage (void *d, struct overhead_stats *stats);
104 /* Also define min() and max(). (Some compilers put them in strange
105 places that won't be referenced by the above include files, such
106 as 'macros.h' under Solaris.) */
109 #define min(a,b) (((a) <= (b)) ? (a) : (b))
112 #define max(a,b) (((a) > (b)) ? (a) : (b))
115 /* Memory allocation */
116 void malloc_warning (const char *);
117 void *xmalloc (size_t size);
118 void *xmalloc_and_zero (size_t size);
119 void *xrealloc (void *, size_t size);
120 char *xstrdup (const char *);
121 /* generally useful */
122 #define countof(x) ((int) (sizeof(x)/sizeof((x)[0])))
123 #define xnew(type) ((type *) xmalloc (sizeof (type)))
124 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type)))
125 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type)))
126 #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue)))
127 #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type)))
128 #define XREALLOC_ARRAY(ptr, type, len) ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type))))
129 #define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type)))
131 /* also generally useful if you want to avoid arbitrary size limits
132 but don't need a full dynamic array. Assumes that BASEVAR points
133 to a malloced array of TYPE objects (or possibly a NULL pointer,
134 if SIZEVAR is 0), with the total size stored in SIZEVAR. This
135 macro will realloc BASEVAR as necessary so that it can hold at
136 least NEEDED_SIZE objects. The reallocing is done by doubling,
137 which ensures constant amortized time per element. */
138 #define DO_REALLOC(basevar, sizevar, needed_size, type) do { \
139 EMACS_INT do_realloc_needed_size = (needed_size); \
140 if ((sizevar) < do_realloc_needed_size) \
142 if ((sizevar) < 32) \
144 while ((sizevar) < do_realloc_needed_size) \
146 XREALLOC_ARRAY (basevar, type, (sizevar)); \
150 #ifdef ERROR_CHECK_MALLOC
151 void xfree_1 (void *);
152 #define xfree(lvalue) do \
154 void **xfree_ptr = (void **) &(lvalue); \
155 xfree_1 (*xfree_ptr); \
156 *xfree_ptr = (void *) 0xDEADBEEF; \
160 #endif /* ERROR_CHECK_MALLOC */
163 # if defined (__GNUC__) && (__GNUC__ >= 2)
164 # define PRINTF_ARGS(string_index,first_to_check) \
165 __attribute__ ((format (printf, string_index, first_to_check)))
167 # define PRINTF_ARGS(string_index,first_to_check)
171 #ifndef DOESNT_RETURN
172 # if defined __GNUC__
173 # if ((__GNUC__ > 2) || (__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))
174 # define DOESNT_RETURN void
175 # define DECLARE_DOESNT_RETURN(decl) \
176 extern void decl __attribute__ ((noreturn))
177 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
178 /* Should be able to state multiple independent __attribute__s, but \
179 the losing syntax doesn't work that way, and screws losing cpp */ \
181 __attribute__ ((noreturn, format (printf, str, idx)))
183 # define DOESNT_RETURN void volatile
184 # define DECLARE_DOESNT_RETURN(decl) extern void volatile decl
185 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
186 extern void volatile decl PRINTF_ARGS(str,idx)
187 # endif /* GNUC 2.5 */
189 # define DOESNT_RETURN void
190 # define DECLARE_DOESNT_RETURN(decl) extern void decl
191 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
192 extern void decl PRINTF_ARGS(str,idx)
196 /* No type has a greater alignment requirement than max_align_t.
197 (except perhaps for types we don't use, like long double) */
200 struct { long l; } l;
201 struct { void *p; } p;
202 struct { void (*f)(void); } f;
203 struct { double d; } d;
207 # if defined (__GNUC__) && (__GNUC__ >= 2)
208 /* gcc has an extension that gives us exactly what we want. */
209 # define ALIGNOF(type) __alignof__ (type)
210 # elif ! defined (__cplusplus)
211 /* The following is mostly portable, except that:
212 - it doesn't work for inside out declarations like void (*) (void).
213 (so just call ALIGNOF with a typedef'ed name)
214 - it doesn't work with C++. The C++ committee has decided,
215 in its infinite wisdom, that:
216 "Types must be declared in declarations, not in expressions." */
217 # define ALIGNOF(type) offsetof (struct { char c; type member; }, member)
219 /* C++ is annoying, but it has a big bag of tricks.
220 The following doesn't have the "inside out" declaration bug C does. */
221 template<typename T> struct alignment_trick { char c; T member; };
222 # define ALIGNOF(type) offsetof (alignment_trick<type>, member)
226 #define ALIGN_SIZE(len, unit) \
227 ((((len) + (unit) - 1) / (unit)) * (unit))
229 /* #### Yuck, this is kind of evil */
230 #define ALIGN_PTR(ptr, unit) \
231 ((void *) ALIGN_SIZE ((size_t) (ptr), unit))
234 #define DO_NOTHING do {} while (0)
237 #ifndef DECLARE_NOTHING
238 #define DECLARE_NOTHING struct nosuchstruct
241 /* We define assert iff USE_ASSERTIONS or DEBUG_XEMACS is defined.
242 Otherwise we define it to be empty. Quantify has shown that the
243 time the assert checks take is measurable so let's not include them
244 in production binaries. */
246 /* Highly dubious kludge */
247 /* (thanks, Jamie, I feel better now -- ben) */
248 # define ABORT() (assert_failed (__FILE__, __LINE__, "ABORT()"))
249 void assert_failed (const char *, int, const char *);
251 #ifdef USE_ASSERTIONS
252 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
255 # define assert(x) ((x) ? (void) 0 : (void) ABORT ())
261 /*#ifdef DEBUG_XEMACS*/
265 /*#define REGISTER register*/
269 /* EMACS_INT is the underlying integral type into which a Lisp_Object must fit.
270 In particular, it must be large enough to contain a pointer.
271 config.h can override this, e.g. to use `long long' for bigger lisp ints.
273 #### In point of fact, it would NOT be a good idea for config.h to mess
274 with EMACS_INT. A lot of code makes the basic assumption that EMACS_INT
275 is the size of a pointer. */
277 #ifndef SIZEOF_EMACS_INT
278 # define SIZEOF_EMACS_INT SIZEOF_VOID_P
282 # if SIZEOF_EMACS_INT == SIZEOF_LONG
283 # define EMACS_INT long
284 # elif SIZEOF_EMACS_INT == SIZEOF_INT
285 # define EMACS_INT int
286 # elif SIZEOF_EMACS_INT == SIZEOF_LONG_LONG
287 # define EMACS_INT long long
289 # error Unable to determine suitable type for EMACS_INT
294 # define EMACS_UINT unsigned EMACS_INT
297 #define BITS_PER_EMACS_INT (SIZEOF_EMACS_INT * BITS_PER_CHAR)
300 /************************************************************************/
302 /************************************************************************/
304 /* We put typedefs here so that prototype declarations don't choke.
305 Note that we don't actually declare the structures here (except
306 maybe for simple structures like Dynarrs); that keeps them private
307 to the routines that actually use them. */
309 /* ------------------------------- */
310 /* basic char/int typedefs */
311 /* ------------------------------- */
313 /* The definitions we put here use typedefs to attribute specific meaning
314 to types that by themselves are pretty general. Stuff pointed to by a
315 char * or unsigned char * will nearly always be one of four types:
316 a) pointer to internally-formatted text; b) pointer to text in some
317 external format, which can be defined as all formats other than the
318 internal one; c) pure ASCII text; d) binary data that is not meant to
319 be interpreted as text. [A fifth possible type "e) a general pointer
320 to memory" should be replaced with void *.] Using these more specific
321 types rather than the general ones helps avoid the confusions that
322 occur when the semantics of a char * argument being studied are unclear. */
324 typedef unsigned char UChar;
326 /* The data representing the text in a buffer is logically a set
327 of Bufbytes, declared as follows. */
329 typedef UChar Bufbyte;
331 /* Explicitly signed or unsigned versions: */
332 typedef UChar UBufbyte;
333 typedef char SBufbyte;
335 /* The data representing a string in "external" format (binary or any
336 external encoding) is logically a set of Extbytes, declared as
337 follows. Extbyte is guaranteed to be just a char, so for example
338 strlen (Extbyte *) is OK. Extbyte is only a documentation device
339 for referring to external text. */
341 typedef char Extbyte;
343 /* A byte in a string in binary format: */
344 typedef char Char_Binary;
345 typedef UChar UChar_Binary;
347 /* A byte in a string in entirely US-ASCII format: (Nothing outside
348 the range 00 - 7F) */
350 typedef char Char_ASCII;
351 typedef UChar UChar_ASCII;
354 /* To the user, a buffer is made up of characters, declared as follows.
355 In the non-Mule world, characters and Bufbytes are equivalent.
356 In the Mule world, a character requires (typically) 1 to 4
357 Bufbytes for its representation in a buffer. */
361 /* Different ways of referring to a position in a buffer. We use
362 the typedefs in preference to 'EMACS_INT' to make it clearer what
363 sort of position is being used. See extents.c for a description
364 of the different positions. We put them here instead of in
365 buffer.h (where they rightfully belong) to avoid syntax errors
366 in function prototypes. */
368 typedef EMACS_INT Bufpos;
369 typedef EMACS_INT Bytind;
370 typedef EMACS_INT Memind;
372 /* Counts of bytes or chars */
374 typedef EMACS_INT Bytecount;
375 typedef EMACS_INT Charcount;
377 /* Length in bytes of a string in external format */
378 typedef EMACS_INT Extcount;
380 /* ------------------------------- */
381 /* structure/other typedefs */
382 /* ------------------------------- */
384 /* Counts of bytes or array elements */
385 typedef EMACS_INT Memory_count;
386 typedef EMACS_INT Element_count;
388 typedef struct lstream Lstream;
390 typedef unsigned int face_index;
394 Dynarr_declare (struct face_cachel);
395 } face_cachel_dynarr;
397 typedef unsigned int glyph_index;
399 /* This is shared by process.h, events.h and others in future.
400 See events.h for description */
401 typedef unsigned int USID;
405 Dynarr_declare (struct glyph_cachel);
406 } glyph_cachel_dynarr;
408 struct buffer; /* "buffer.h" */
409 struct console; /* "console.h" */
410 struct device; /* "device.h" */
411 struct extent_fragment;
413 typedef struct extent *EXTENT;
414 struct frame; /* "frame.h" */
415 struct window; /* "window.h" */
416 typedef struct Lisp_Event Lisp_Event; /* "events.h" */
417 typedef struct Lisp_Face Lisp_Face; /* "faces.h" */
418 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */
419 struct stat; /* <sys/stat.h> */
420 typedef struct Lisp_Color_Instance Lisp_Color_Instance;
421 typedef struct Lisp_Font_Instance Lisp_Font_Instance;
422 typedef struct Lisp_Image_Instance Lisp_Image_Instance;
423 typedef struct Lisp_Gui_Item Lisp_Gui_Item;
425 struct display_glyph_area;
427 struct redisplay_info;
428 struct window_mirror;
429 struct scrollbar_instance;
430 struct font_metric_info;
432 struct console_type_entry;
436 Dynarr_declare (Bufbyte);
441 Dynarr_declare (Extbyte);
446 Dynarr_declare (Emchar);
451 Dynarr_declare (char);
454 typedef unsigned char unsigned_char;
457 Dynarr_declare (unsigned char);
458 } unsigned_char_dynarr;
460 typedef unsigned long unsigned_long;
463 Dynarr_declare (unsigned long);
464 } unsigned_long_dynarr;
468 Dynarr_declare (int);
473 Dynarr_declare (Bufpos);
478 Dynarr_declare (Bytind);
483 Dynarr_declare (Charcount);
488 Dynarr_declare (Bytecount);
493 Dynarr_declare (struct console_type_entry);
494 } console_type_entry_dynarr;
496 enum run_hooks_condition
498 RUN_HOOKS_TO_COMPLETION,
499 RUN_HOOKS_UNTIL_SUCCESS,
500 RUN_HOOKS_UNTIL_FAILURE
521 #ifndef ERROR_CHECK_TYPECHECK
523 typedef enum error_behavior
530 #define ERRB_EQ(a, b) ((a) == (b))
534 /* By defining it like this, we provide strict type-checking
535 for code that lazily uses ints. */
537 typedef struct _error_behavior_struct_
539 int really_unlikely_name_to_have_accidentally_in_a_non_errb_structure;
542 extern Error_behavior ERROR_ME;
543 extern Error_behavior ERROR_ME_NOT;
544 extern Error_behavior ERROR_ME_WARN;
546 #define ERRB_EQ(a, b) \
547 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \
548 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure)
552 enum munge_me_out_the_door
554 MUNGE_ME_FUNCTION_KEY,
555 MUNGE_ME_KEY_TRANSLATION
559 /************************************************************************/
560 /* Definition of Lisp_Object data type */
561 /************************************************************************/
563 /* Define the fundamental Lisp data structures */
565 /* This is the set of Lisp data types */
575 #define POINTER_TYPE_P(type) ((type) == Lisp_Type_Record)
577 /* Overridden by m/next.h */
578 #ifndef ASSERT_VALID_POINTER
579 # define ASSERT_VALID_POINTER(pnt) (assert ((((EMACS_UINT) pnt) & 3) == 0))
587 #define INT_VALBITS (BITS_PER_EMACS_INT - INT_GCBITS)
588 #define VALBITS (BITS_PER_EMACS_INT - GCBITS)
589 #define EMACS_INT_MAX ((EMACS_INT) ((1UL << (INT_VALBITS - 1)) -1UL))
590 #define EMACS_INT_MIN (-(EMACS_INT_MAX) - 1)
592 #ifdef USE_UNION_TYPE
593 # include "lisp-union.h"
594 #else /* !USE_UNION_TYPE */
595 # include "lisp-disunion.h"
596 #endif /* !USE_UNION_TYPE */
598 #define XPNTR(x) ((void *) XPNTRVAL(x))
600 /* WARNING WARNING WARNING. You must ensure on your own that proper
601 GC protection is provided for the elements in this array. */
604 Dynarr_declare (Lisp_Object);
605 } Lisp_Object_dynarr;
609 Dynarr_declare (Lisp_Object *);
610 } Lisp_Object_ptr_dynarr;
612 /* Close your eyes now lest you vomit or spontaneously combust ... */
614 #define HACKEQ_UNSAFE(obj1, obj2) \
615 (EQ (obj1, obj2) || (!POINTER_TYPE_P (XTYPE (obj1)) \
616 && !POINTER_TYPE_P (XTYPE (obj2)) \
617 && XCHAR_OR_INT (obj1) == XCHAR_OR_INT (obj2)))
620 extern int debug_issue_ebola_notices;
621 int eq_with_ebola_notice (Lisp_Object, Lisp_Object);
622 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) \
623 (debug_issue_ebola_notices ? eq_with_ebola_notice (obj1, obj2) \
626 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) EQ (obj1, obj2)
629 /* OK, you can open them again */
632 /************************************************************************/
633 /** Definitions of basic Lisp objects **/
634 /************************************************************************/
638 /*------------------------------ unbound -------------------------------*/
640 /* Qunbound is a special Lisp_Object (actually of type
641 symbol-value-forward), that can never be visible to
642 the Lisp caller and thus can be used in the C code
643 to mean "no such value". */
645 #define UNBOUNDP(val) EQ (val, Qunbound)
647 /*------------------------------- cons ---------------------------------*/
649 /* In a cons, the markbit of the car is the gc mark bit */
653 struct lrecord_header lheader;
654 Lisp_Object car, cdr;
656 typedef struct Lisp_Cons Lisp_Cons;
659 /* Like a cons, but records info on where the text lives that it was read from */
660 /* This is not really in use now */
662 struct Lisp_Buffer_Cons
664 Lisp_Object car, cdr;
665 struct buffer *buffer;
670 DECLARE_LRECORD (cons, Lisp_Cons);
671 #define XCONS(x) XRECORD (x, cons, Lisp_Cons)
672 #define XSETCONS(x, p) XSETRECORD (x, p, cons)
673 #define CONSP(x) RECORDP (x, cons)
674 #define CHECK_CONS(x) CHECK_RECORD (x, cons)
675 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons)
677 #define CONS_MARKED_P(c) MARKED_RECORD_HEADER_P(&((c)->lheader))
678 #define MARK_CONS(c) MARK_RECORD_HEADER (&((c)->lheader))
680 extern Lisp_Object Qnil;
682 #define NILP(x) EQ (x, Qnil)
683 #define XCAR(a) (XCONS (a)->car)
684 #define XCDR(a) (XCONS (a)->cdr)
685 #define LISTP(x) (CONSP(x) || NILP(x))
687 #define CHECK_LIST(x) do { \
689 dead_wrong_type_argument (Qlistp, x); \
692 #define CONCHECK_LIST(x) do { \
694 x = wrong_type_argument (Qlistp, x); \
697 /*---------------------- list traversal macros -------------------------*/
699 /* Note: These macros are for traversing through a list in some format,
700 and executing code that you specify on each member of the list.
702 There are two kinds of macros, those requiring surrounding braces, and
703 those not requiring this. Which type of macro will be indicated.
704 The general format for using a brace-requiring macro is
707 LIST_LOOP_3 (elt, list, tail)
714 LIST_LOOP_3 (elt, list, tail)
720 You can put variable declarations between the brace and beginning of
721 macro, but NOTHING ELSE.
723 The brace-requiring macros typically declare themselves any arguments
724 that are initialized and iterated by the macros. If for some reason
725 you need to declare these arguments yourself (e.g. to do something on
726 them before the iteration starts, use the _NO_DECLARE versions of the
730 /* There are two basic kinds of macros: those that handle "internal" lists
731 that are known to be correctly structured (i.e. first element is a cons
732 or nil, and the car of each cons is also a cons or nil, and there are
733 no circularities), and those that handle "external" lists, where the
734 list may have any sort of invalid formation. This is reflected in
735 the names: those with "EXTERNAL_" work with external lists, and those
736 without this prefix work with internal lists. The internal-list
737 macros will hit an assertion failure if the structure is ill-formed;
738 the external-list macros will signal an error in this case, either a
739 malformed-list error or a circular-list error.
741 Note also that the simplest external list iterator, EXTERNAL_LIST_LOOP,
742 does *NOT* check for circularities. Therefore, make sure you call
743 QUIT each iteration or so. However, it's probably easier just to use
744 EXTERNAL_LIST_LOOP_2, which is easier to use in any case.
747 /* LIST_LOOP and EXTERNAL_LIST_LOOP are the simplest macros. They don't
748 require brace surrounding, and iterate through a list, which may or may
749 not known to be syntactically correct. EXTERNAL_LIST_LOOP is for those
750 not known to be correct, and it detects and signals a malformed list
751 error when encountering a problem. Circularities, however, are not
752 handled, and cause looping forever, so make sure to include a QUIT.
753 These functions also accept two args, TAIL (set progressively to each
754 cons starting with the first), and LIST, the list to iterate over.
755 TAIL needs to be defined by the program.
757 In each iteration, you can retrieve the current list item using XCAR
758 (tail), or destructively modify the list using XSETCAR (tail,
761 #define LIST_LOOP(tail, list) \
766 #define EXTERNAL_LIST_LOOP(tail, list) \
767 for (tail = list; !NILP (tail); tail = XCDR (tail)) \
769 signal_malformed_list_error (list); \
772 /* The following macros are the "core" macros for list traversal.
774 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
776 LIST_LOOP_2 and EXTERNAL_LIST_LOOP_2 are the standard, most-often used
777 macros. They take two arguments, an element variable ELT and the list
778 LIST. ELT is automatically declared, and set to each element in turn
781 LIST_LOOP_3 and EXTERNAL_LIST_LOOP_3 are the same, but they have a third
782 argument TAIL, another automatically-declared variable. At each iteration,
783 this one points to the cons cell for which ELT is the car.
785 EXTERNAL_LIST_LOOP_4 is like EXTERNAL_LIST_LOOP_3 but takes an additional
786 LEN argument, again automatically declared, which counts the number of
787 iterations gone by. It is 0 during the first iteration.
789 EXTERNAL_LIST_LOOP_4_NO_DECLARE is like EXTERNAL_LIST_LOOP_4 but none
790 of the variables are automatically declared, and so you need to declare
791 them yourself. (ELT and TAIL are Lisp_Objects, and LEN is an EMACS_INT.)
794 #define LIST_LOOP_2(elt, list) \
795 LIST_LOOP_3(elt, list, unused_tail_##elt)
797 #define LIST_LOOP_3(elt, list, tail) \
798 Lisp_Object elt, tail; \
801 0 : (elt = XCAR (tail), 1); \
804 /* The following macros are for traversing lisp lists.
805 Signal an error if LIST is not properly acyclic and nil-terminated.
807 Use tortoise/hare algorithm to check for cycles, but only if it
808 looks like the list is getting too long. Not only is the hare
809 faster than the tortoise; it even gets a head start! */
811 /* Optimized and safe macros for looping over external lists. */
812 #define CIRCULAR_LIST_SUSPICION_LENGTH 1024
814 #define EXTERNAL_LIST_LOOP_1(list) \
815 Lisp_Object ELL1_elt, ELL1_hare, ELL1_tortoise; \
816 EMACS_INT ELL1_len; \
817 PRIVATE_EXTERNAL_LIST_LOOP_6 (ELL1_elt, list, ELL1_len, ELL1_hare, \
818 ELL1_tortoise, CIRCULAR_LIST_SUSPICION_LENGTH)
820 #define EXTERNAL_LIST_LOOP_2(elt, list) \
821 Lisp_Object elt, hare_##elt, tortoise_##elt; \
822 EMACS_INT len_##elt; \
823 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, hare_##elt, \
824 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
826 #define EXTERNAL_LIST_LOOP_3(elt, list, tail) \
827 Lisp_Object elt, tail, tortoise_##elt; \
828 EMACS_INT len_##elt; \
829 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, tail, \
830 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
832 #define EXTERNAL_LIST_LOOP_4_NO_DECLARE(elt, list, tail, len) \
833 Lisp_Object tortoise_##elt; \
834 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
835 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
837 #define EXTERNAL_LIST_LOOP_4(elt, list, tail, len) \
838 Lisp_Object elt, tail, tortoise_##elt; \
840 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
841 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
844 #define PRIVATE_EXTERNAL_LIST_LOOP_6(elt, list, len, hare, \
845 tortoise, suspicion_length) \
846 for (tortoise = hare = list, len = 0; \
848 (CONSP (hare) ? ((elt = XCAR (hare)), 1) : \
850 (signal_malformed_list_error (list), 0))); \
852 hare = XCDR (hare), \
854 ((++len > suspicion_length) \
856 ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \
857 (EQ (hare, tortoise) && (signal_circular_list_error (list), 0)))))
859 /* GET_LIST_LENGTH and GET_EXTERNAL_LIST_LENGTH:
861 These two macros return the length of LIST (either an internal or external
862 list, according to which macro is used), stored into LEN (which must
863 be declared by the caller). Circularities are trapped in external lists
864 (and cause errors). Neither macro need be declared inside brackets. */
866 #define GET_LIST_LENGTH(list, len) do { \
867 Lisp_Object GLL_tail; \
868 for (GLL_tail = list, len = 0; \
870 GLL_tail = XCDR (GLL_tail), ++len) \
874 #define GET_EXTERNAL_LIST_LENGTH(list, len) \
876 Lisp_Object GELL_elt, GELL_tail; \
877 EXTERNAL_LIST_LOOP_4_NO_DECLARE (GELL_elt, list, GELL_tail, len) \
881 /* For a list that's known to be in valid list format, where we may
882 be deleting the current element out of the list --
883 will ABORT() if the list is not in valid format */
884 #define LIST_LOOP_DELETING(consvar, nextconsvar, list) \
885 for (consvar = list; \
886 !NILP (consvar) ? (nextconsvar = XCDR (consvar), 1) :0; \
887 consvar = nextconsvar)
889 /* LIST_LOOP_DELETE_IF and EXTERNAL_LIST_LOOP_DELETE_IF:
891 These two macros delete all elements of LIST (either an internal or
892 external list, according to which macro is used) satisfying
893 CONDITION, a C expression referring to variable ELT. ELT is
894 automatically declared. Circularities are trapped in external
895 lists (and cause errors). Neither macro need be declared inside
898 #define LIST_LOOP_DELETE_IF(elt, list, condition) do { \
899 /* Do not use ##list when creating new variables because \
900 that may not be just a variable name. */ \
901 Lisp_Object prev_tail_##elt = Qnil; \
902 LIST_LOOP_3 (elt, list, tail_##elt) \
906 if (NILP (prev_tail_##elt)) \
907 list = XCDR (tail_##elt); \
909 XCDR (prev_tail_##elt) = XCDR (tail_##elt); \
912 prev_tail_##elt = tail_##elt; \
916 #define EXTERNAL_LIST_LOOP_DELETE_IF(elt, list, condition) do { \
917 Lisp_Object prev_tail_##elt = Qnil; \
918 EXTERNAL_LIST_LOOP_4 (elt, list, tail_##elt, len_##elt) \
922 if (NILP (prev_tail_##elt)) \
923 list = XCDR (tail_##elt); \
925 XCDR (prev_tail_##elt) = XCDR (tail_##elt); \
926 /* Keep tortoise from ever passing hare. */ \
930 prev_tail_##elt = tail_##elt; \
935 /* Macros for looping over external alists.
937 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
939 EXTERNAL_ALIST_LOOP_4 is similar to EXTERNAL_LIST_LOOP_2, but it
940 assumes the elements are aconses (the elements in an alist) and
941 sets two additional argument variables ELT_CAR and ELT_CDR to the
942 car and cdr of the acons. All of the variables ELT, ELT_CAR and
943 ELT_CDR are automatically declared.
945 EXTERNAL_ALIST_LOOP_5 adds a TAIL argument to EXTERNAL_ALIST_LOOP_4,
946 just like EXTERNAL_LIST_LOOP_3 does, and again TAIL is automatically
949 EXTERNAL_ALIST_LOOP_6 adds a LEN argument to EXTERNAL_ALIST_LOOP_5,
950 just like EXTERNAL_LIST_LOOP_4 does, and again LEN is automatically
953 EXTERNAL_ALIST_LOOP_6_NO_DECLARE does not declare any of its arguments,
954 just like EXTERNAL_LIST_LOOP_4_NO_DECLARE, and so these must be declared
958 /* Optimized and safe macros for looping over external alists. */
959 #define EXTERNAL_ALIST_LOOP_4(elt, elt_car, elt_cdr, list) \
960 Lisp_Object elt, elt_car, elt_cdr; \
961 Lisp_Object hare_##elt, tortoise_##elt; \
962 EMACS_INT len_##elt; \
963 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
964 len_##elt, hare_##elt, tortoise_##elt, \
965 CIRCULAR_LIST_SUSPICION_LENGTH)
967 #define EXTERNAL_ALIST_LOOP_5(elt, elt_car, elt_cdr, list, tail) \
968 Lisp_Object elt, elt_car, elt_cdr, tail; \
969 Lisp_Object tortoise_##elt; \
970 EMACS_INT len_##elt; \
971 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
972 len_##elt, tail, tortoise_##elt, \
973 CIRCULAR_LIST_SUSPICION_LENGTH) \
975 #define EXTERNAL_ALIST_LOOP_6(elt, elt_car, elt_cdr, list, tail, len) \
976 Lisp_Object elt, elt_car, elt_cdr, tail; \
978 Lisp_Object tortoise_##elt; \
979 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
980 len, tail, tortoise_##elt, \
981 CIRCULAR_LIST_SUSPICION_LENGTH)
983 #define EXTERNAL_ALIST_LOOP_6_NO_DECLARE(elt, elt_car, elt_cdr, list, \
985 Lisp_Object tortoise_##elt; \
986 PRIVATE_EXTERNAL_ALIST_LOOP_8 (elt, elt_car, elt_cdr, list, \
987 len, tail, tortoise_##elt, \
988 CIRCULAR_LIST_SUSPICION_LENGTH)
991 #define PRIVATE_EXTERNAL_ALIST_LOOP_8(elt, elt_car, elt_cdr, list, len, \
992 hare, tortoise, suspicion_length) \
993 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, hare, tortoise, \
995 if (CONSP (elt) ? (elt_car = XCAR (elt), elt_cdr = XCDR (elt), 0) :1) \
999 /* Macros for looping over external property lists.
1001 *** ALL OF THESE MACROS MUST BE DECLARED INSIDE BRACES -- SEE ABOVE. ***
1003 EXTERNAL_PROPERTY_LIST_LOOP_3 maps over an external list assumed to
1004 be a property list, consisting of alternating pairs of keys
1005 (typically symbols or keywords) and values. Each iteration
1006 processes one such pair out of LIST, assigning the two elements to
1007 KEY and VALUE respectively. Malformed lists and circularities are
1008 trapped as usual, and in addition, property lists with an odd number
1009 of elements also signal an error.
1011 EXTERNAL_PROPERTY_LIST_LOOP_4 adds a TAIL argument to
1012 EXTERNAL_PROPERTY_LIST_LOOP_3, just like EXTERNAL_LIST_LOOP_3 does,
1013 and again TAIL is automatically declared.
1015 EXTERNAL_PROPERTY_LIST_LOOP_5 adds a LEN argument to
1016 EXTERNAL_PROPERTY_LIST_LOOP_4, just like EXTERNAL_LIST_LOOP_4 does,
1017 and again LEN is automatically declared. Note that in this case,
1018 LEN counts the iterations, NOT the total number of list elements
1019 processed, which is 2 * LEN.
1021 EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE does not declare any of its
1022 arguments, just like EXTERNAL_LIST_LOOP_4_NO_DECLARE, and so these
1023 must be declared manually. */
1025 /* Optimized and safe macros for looping over external property lists. */
1026 #define EXTERNAL_PROPERTY_LIST_LOOP_3(key, value, list) \
1027 Lisp_Object key, value, hare_##key, tortoise_##key; \
1028 EMACS_INT len_##key; \
1029 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len_##key, hare_##key, \
1030 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
1032 #define EXTERNAL_PROPERTY_LIST_LOOP_4(key, value, list, tail) \
1033 Lisp_Object key, value, tail, tortoise_##key; \
1034 EMACS_INT len_##key; \
1035 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len_##key, tail, \
1036 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
1038 #define EXTERNAL_PROPERTY_LIST_LOOP_5(key, value, list, tail, len) \
1039 Lisp_Object key, value, tail, tortoise_##key; \
1041 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \
1042 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
1044 #define EXTERNAL_PROPERTY_LIST_LOOP_5_NO_DECLARE(key, value, list, \
1046 Lisp_Object tortoise_##key; \
1047 EXTERNAL_PROPERTY_LIST_LOOP_7 (key, value, list, len, tail, \
1048 tortoise_##key, CIRCULAR_LIST_SUSPICION_LENGTH)
1051 #define EXTERNAL_PROPERTY_LIST_LOOP_7(key, value, list, len, hare, \
1052 tortoise, suspicion_length) \
1053 for (tortoise = hare = list, len = 0; \
1056 (key = XCAR (hare), \
1057 hare = XCDR (hare), \
1058 (CONSP (hare) ? 1 : \
1059 (signal_malformed_property_list_error (list), 0)))) ? \
1060 (value = XCAR (hare), 1) : \
1061 (NILP (hare) ? 0 : \
1062 (signal_malformed_property_list_error (list), 0))); \
1064 hare = XCDR (hare), \
1065 ((++len < suspicion_length) ? \
1068 ((void) (tortoise = XCDR (XCDR (tortoise)))) : \
1071 (EQ (hare, tortoise) ? \
1072 ((void) signal_circular_property_list_error (list)) : \
1075 /* For a property list (alternating keywords/values) that may not be
1076 in valid list format -- will signal an error if the list is not in
1077 valid format. CONSVAR is used to keep track of the iterations
1078 without modifying PLIST.
1080 We have to be tricky to still keep the same C format.*/
1081 #define EXTERNAL_PROPERTY_LIST_LOOP(tail, key, value, plist) \
1082 for (tail = plist; \
1083 (CONSP (tail) && CONSP (XCDR (tail)) ? \
1084 (key = XCAR (tail), value = XCAR (XCDR (tail))) : \
1085 (key = Qunbound, value = Qunbound)), \
1087 tail = XCDR (XCDR (tail))) \
1088 if (UNBOUNDP (key)) \
1089 Fsignal (Qmalformed_property_list, list1 (plist)); \
1092 #define PROPERTY_LIST_LOOP(tail, key, value, plist) \
1093 for (tail = plist; \
1095 (key = XCAR (tail), tail = XCDR (tail), \
1096 value = XCAR (tail), tail = XCDR (tail), 1); \
1099 /* Return 1 if LIST is properly acyclic and nil-terminated, else 0. */
1100 INLINE_HEADER int TRUE_LIST_P (Lisp_Object object);
1102 TRUE_LIST_P (Lisp_Object object)
1104 Lisp_Object hare, tortoise;
1107 for (hare = tortoise = object, len = 0;
1109 hare = XCDR (hare), len++)
1111 if (len < CIRCULAR_LIST_SUSPICION_LENGTH)
1115 tortoise = XCDR (tortoise);
1116 else if (EQ (hare, tortoise))
1123 /* Signal an error if LIST is not properly acyclic and nil-terminated. */
1124 #define CHECK_TRUE_LIST(list) do { \
1125 Lisp_Object CTL_list = (list); \
1126 Lisp_Object CTL_hare, CTL_tortoise; \
1127 EMACS_INT CTL_len; \
1129 for (CTL_hare = CTL_tortoise = CTL_list, CTL_len = 0; \
1131 CTL_hare = XCDR (CTL_hare), CTL_len++) \
1133 if (CTL_len < CIRCULAR_LIST_SUSPICION_LENGTH) \
1137 CTL_tortoise = XCDR (CTL_tortoise); \
1138 else if (EQ (CTL_hare, CTL_tortoise)) \
1139 Fsignal (Qcircular_list, list1 (CTL_list)); \
1142 if (! NILP (CTL_hare)) \
1143 signal_malformed_list_error (CTL_list); \
1146 /*------------------------------ string --------------------------------*/
1150 struct lrecord_header lheader;
1155 typedef struct Lisp_String Lisp_String;
1157 DECLARE_LRECORD (string, Lisp_String);
1158 #define XSTRING(x) XRECORD (x, string, Lisp_String)
1159 #define XSETSTRING(x, p) XSETRECORD (x, p, string)
1160 #define STRINGP(x) RECORDP (x, string)
1161 #define CHECK_STRING(x) CHECK_RECORD (x, string)
1162 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string)
1166 Charcount bytecount_to_charcount (const Bufbyte *ptr, Bytecount len);
1167 Bytecount charcount_to_bytecount (const Bufbyte *ptr, Charcount len);
1169 #else /* not MULE */
1171 # define bytecount_to_charcount(ptr, len) (len)
1172 # define charcount_to_bytecount(ptr, len) (len)
1174 #endif /* not MULE */
1176 #define string_length(s) ((s)->size)
1177 #define XSTRING_LENGTH(s) string_length (XSTRING (s))
1178 #define XSTRING_CHAR_LENGTH(s) string_char_length (XSTRING (s))
1179 #define string_data(s) ((s)->data + 0)
1180 #define XSTRING_DATA(s) string_data (XSTRING (s))
1181 #define string_byte(s, i) ((s)->data[i] + 0)
1182 #define XSTRING_BYTE(s, i) string_byte (XSTRING (s), i)
1183 #define string_byte_addr(s, i) (&((s)->data[i]))
1184 #define set_string_length(s, len) ((void) ((s)->size = (len)))
1185 #define set_string_data(s, ptr) ((void) ((s)->data = (ptr)))
1186 #define set_string_byte(s, i, b) ((void) ((s)->data[i] = (b)))
1188 void resize_string (Lisp_String *s, Bytecount pos, Bytecount delta);
1192 INLINE_HEADER Charcount string_char_length (Lisp_String *s);
1193 INLINE_HEADER Charcount
1194 string_char_length (Lisp_String *s)
1196 return bytecount_to_charcount (string_data (s), string_length (s));
1199 # define string_char(s, i) charptr_emchar_n (string_data (s), i)
1200 # define string_char_addr(s, i) charptr_n_addr (string_data (s), i)
1201 void set_string_char (Lisp_String *s, Charcount i, Emchar c);
1203 #else /* not MULE */
1205 # define string_char_length(s) string_length (s)
1206 # define string_char(s, i) ((Emchar) string_byte (s, i))
1207 # define string_char_addr(s, i) string_byte_addr (s, i)
1208 # define set_string_char(s, i, c) set_string_byte (s, i, (Bufbyte)c)
1210 #endif /* not MULE */
1212 /* Return the true aligned size of a struct whose last member is a
1213 variable-length array field. (this is known as the "struct hack") */
1214 /* Implementation: in practice, structtype and fieldtype usually have
1215 the same alignment, but we can't be sure. We need to use
1216 ALIGN_SIZE to be absolutely sure of getting the correct alignment.
1217 To help the compiler's optimizer, we use a ternary expression that
1218 only a very stupid compiler would fail to correctly simplify. */
1219 #define FLEXIBLE_ARRAY_STRUCT_SIZEOF(structtype, \
1223 (ALIGNOF (structtype) == ALIGNOF (fieldtype) \
1224 ? (offsetof (structtype, fieldname) + \
1225 (offsetof (structtype, fieldname[1]) - \
1226 offsetof (structtype, fieldname[0])) * \
1229 ((offsetof (structtype, fieldname) + \
1230 (offsetof (structtype, fieldname[1]) - \
1231 offsetof (structtype, fieldname[0])) * \
1233 ALIGNOF (structtype))))
1235 /*------------------------------ vector --------------------------------*/
1239 struct lcrecord_header header;
1241 /* next is now chained through v->contents[size], terminated by Qzero.
1242 This means that pure vectors don't need a "next" */
1243 /* struct Lisp_Vector *next; */
1244 Lisp_Object contents[1];
1246 typedef struct Lisp_Vector Lisp_Vector;
1248 DECLARE_LRECORD (vector, Lisp_Vector);
1249 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector)
1250 #define XSETVECTOR(x, p) XSETRECORD (x, p, vector)
1251 #define VECTORP(x) RECORDP (x, vector)
1252 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector)
1253 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector)
1255 #define vector_length(v) ((v)->size)
1256 #define XVECTOR_LENGTH(s) vector_length (XVECTOR (s))
1257 #define vector_data(v) ((v)->contents)
1258 #define XVECTOR_DATA(s) vector_data (XVECTOR (s))
1260 /*---------------------------- bit vectors -----------------------------*/
1263 #error What the hell?!
1264 #elif (LONGBITS < 32)
1265 # define LONGBITS_LOG2 4
1266 # define LONGBITS_POWER_OF_2 16
1267 #elif (LONGBITS < 64)
1268 # define LONGBITS_LOG2 5
1269 # define LONGBITS_POWER_OF_2 32
1270 #elif (LONGBITS < 128)
1271 # define LONGBITS_LOG2 6
1272 # define LONGBITS_POWER_OF_2 64
1274 #error You really have 128-bit integers?!
1277 struct Lisp_Bit_Vector
1279 struct lrecord_header lheader;
1282 unsigned long bits[1];
1284 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector;
1286 DECLARE_LRECORD (bit_vector, Lisp_Bit_Vector);
1287 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector)
1288 #define XSETBIT_VECTOR(x, p) XSETRECORD (x, p, bit_vector)
1289 #define BIT_VECTORP(x) RECORDP (x, bit_vector)
1290 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector)
1291 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector)
1293 #define BITP(x) (INTP (x) && (XINT (x) == 0 || XINT (x) == 1))
1295 #define CHECK_BIT(x) do { \
1297 dead_wrong_type_argument (Qbitp, x);\
1300 #define CONCHECK_BIT(x) do { \
1302 x = wrong_type_argument (Qbitp, x); \
1305 #define bit_vector_length(v) ((v)->size)
1306 #define bit_vector_next(v) ((v)->next)
1308 INLINE_HEADER int bit_vector_bit (Lisp_Bit_Vector *v, size_t n);
1310 bit_vector_bit (Lisp_Bit_Vector *v, size_t n)
1312 return ((v->bits[n >> LONGBITS_LOG2] >> (n & (LONGBITS_POWER_OF_2 - 1)))
1316 INLINE_HEADER void set_bit_vector_bit (Lisp_Bit_Vector *v, size_t n, int value);
1318 set_bit_vector_bit (Lisp_Bit_Vector *v, size_t n, int value)
1321 v->bits[n >> LONGBITS_LOG2] |= (1UL << (n & (LONGBITS_POWER_OF_2 - 1)));
1323 v->bits[n >> LONGBITS_LOG2] &= ~(1UL << (n & (LONGBITS_POWER_OF_2 - 1)));
1326 /* Number of longs required to hold LEN bits */
1327 #define BIT_VECTOR_LONG_STORAGE(len) \
1328 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2)
1330 /*------------------------------ symbol --------------------------------*/
1332 typedef struct Lisp_Symbol Lisp_Symbol;
1335 struct lrecord_header lheader;
1336 /* next symbol in this obarray bucket */
1340 Lisp_Object function;
1344 #define SYMBOL_IS_KEYWORD(sym) \
1345 ((string_byte (symbol_name (XSYMBOL (sym)), 0) == ':') \
1346 && EQ (sym, oblookup (Vobarray, \
1347 string_data (symbol_name (XSYMBOL (sym))), \
1348 string_length (symbol_name (XSYMBOL (sym))))))
1349 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj))
1351 DECLARE_LRECORD (symbol, Lisp_Symbol);
1352 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol)
1353 #define XSETSYMBOL(x, p) XSETRECORD (x, p, symbol)
1354 #define SYMBOLP(x) RECORDP (x, symbol)
1355 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol)
1356 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol)
1358 #define symbol_next(s) ((s)->next)
1359 #define symbol_name(s) ((s)->name)
1360 #define symbol_value(s) ((s)->value)
1361 #define symbol_function(s) ((s)->function)
1362 #define symbol_plist(s) ((s)->plist)
1364 /*------------------------------- subr ---------------------------------*/
1366 typedef Lisp_Object (*lisp_fn_t) (void);
1370 struct lrecord_header lheader;
1378 typedef struct Lisp_Subr Lisp_Subr;
1380 DECLARE_LRECORD (subr, Lisp_Subr);
1381 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr)
1382 #define XSETSUBR(x, p) XSETRECORD (x, p, subr)
1383 #define SUBRP(x) RECORDP (x, subr)
1384 #define CHECK_SUBR(x) CHECK_RECORD (x, subr)
1385 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr)
1387 #define subr_function(subr) ((subr)->subr_fn)
1388 #define SUBR_FUNCTION(subr,max_args) \
1389 ((Lisp_Object (*) (EXFUN_##max_args)) (subr)->subr_fn)
1390 #define subr_name(subr) ((subr)->name)
1392 /*------------------------------ marker --------------------------------*/
1395 typedef struct Lisp_Marker Lisp_Marker;
1398 struct lrecord_header lheader;
1401 struct buffer *buffer;
1403 char insertion_type;
1406 DECLARE_LRECORD (marker, Lisp_Marker);
1407 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker)
1408 #define XSETMARKER(x, p) XSETRECORD (x, p, marker)
1409 #define MARKERP(x) RECORDP (x, marker)
1410 #define CHECK_MARKER(x) CHECK_RECORD (x, marker)
1411 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker)
1413 /* The second check was looking for GCed markers still in use */
1414 /* if (INTP (XMARKER (x)->lheader.next.v)) ABORT (); */
1416 #define marker_next(m) ((m)->next)
1417 #define marker_prev(m) ((m)->prev)
1419 /*------------------------------- char ---------------------------------*/
1421 #define CHARP(x) (XTYPE (x) == Lisp_Type_Char)
1423 #ifdef ERROR_CHECK_TYPECHECK
1425 INLINE_HEADER Emchar XCHAR (Lisp_Object obj);
1426 INLINE_HEADER Emchar
1427 XCHAR (Lisp_Object obj)
1429 assert (CHARP (obj));
1430 return XCHARVAL (obj);
1435 #define XCHAR(x) ((Emchar)XCHARVAL (x))
1439 #define CHECK_CHAR(x) CHECK_NONRECORD (x, Lisp_Type_Char, Qcharacterp)
1440 #define CONCHECK_CHAR(x) CONCHECK_NONRECORD (x, Lisp_Type_Char, Qcharacterp)
1443 /*------------------------------ float ---------------------------------*/
1445 #ifdef LISP_FLOAT_TYPE
1447 /* Note: the 'unused_next_' field exists only to ensure that the
1448 `next' pointer fits within the structure, for the purposes of the
1449 free list. This makes a difference in the unlikely case of
1450 sizeof(double) being smaller than sizeof(void *). */
1454 struct lrecord_header lheader;
1455 union { double d; struct Lisp_Float *unused_next_; } data;
1457 typedef struct Lisp_Float Lisp_Float;
1459 DECLARE_LRECORD (float, Lisp_Float);
1460 #define XFLOAT(x) XRECORD (x, float, Lisp_Float)
1461 #define XSETFLOAT(x, p) XSETRECORD (x, p, float)
1462 #define FLOATP(x) RECORDP (x, float)
1463 #define CHECK_FLOAT(x) CHECK_RECORD (x, float)
1464 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float)
1466 #define float_data(f) ((f)->data.d)
1467 #define XFLOAT_DATA(x) float_data (XFLOAT (x))
1469 #define XFLOATINT(n) extract_float (n)
1471 #define CHECK_INT_OR_FLOAT(x) do { \
1472 if (!INT_OR_FLOATP (x)) \
1473 dead_wrong_type_argument (Qnumberp, x); \
1476 #define CONCHECK_INT_OR_FLOAT(x) do { \
1477 if (!INT_OR_FLOATP (x)) \
1478 x = wrong_type_argument (Qnumberp, x); \
1481 # define INT_OR_FLOATP(x) (INTP (x) || FLOATP (x))
1483 #else /* not LISP_FLOAT_TYPE */
1485 #define XFLOAT(x) --- error! No float support. ---
1486 #define XSETFLOAT(x, p) --- error! No float support. ---
1488 #define CHECK_FLOAT(x) --- error! No float support. ---
1489 #define CONCHECK_FLOAT(x) --- error! No float support. ---
1491 #define XFLOATINT(n) XINT(n)
1492 #define CHECK_INT_OR_FLOAT CHECK_INT
1493 #define CONCHECK_INT_OR_FLOAT CONCHECK_INT
1494 #define INT_OR_FLOATP(x) INTP (x)
1496 #endif /* not LISP_FLOAT_TYPE */
1498 /*-------------------------------- int ---------------------------------*/
1500 #define ZEROP(x) EQ (x, Qzero)
1502 #ifdef ERROR_CHECK_TYPECHECK
1504 INLINE_HEADER EMACS_INT XINT (Lisp_Object obj);
1505 INLINE_HEADER EMACS_INT
1506 XINT (Lisp_Object obj)
1508 assert (INTP (obj));
1509 return XREALINT (obj);
1512 INLINE_HEADER EMACS_INT XCHAR_OR_INT (Lisp_Object obj);
1513 INLINE_HEADER EMACS_INT
1514 XCHAR_OR_INT (Lisp_Object obj)
1516 assert (INTP (obj) || CHARP (obj));
1517 return CHARP (obj) ? XCHAR (obj) : XINT (obj);
1520 #else /* no error checking */
1522 #define XINT(obj) XREALINT (obj)
1523 #define XCHAR_OR_INT(obj) (CHARP (obj) ? XCHAR (obj) : XINT (obj))
1525 #endif /* no error checking */
1527 #define CHECK_INT(x) do { \
1529 dead_wrong_type_argument (Qintegerp, x); \
1532 #define CONCHECK_INT(x) do { \
1534 x = wrong_type_argument (Qintegerp, x); \
1537 #define NATNUMP(x) (INTP (x) && XINT (x) >= 0)
1539 #define CHECK_NATNUM(x) do { \
1541 dead_wrong_type_argument (Qnatnump, x); \
1544 #define CONCHECK_NATNUM(x) do { \
1546 x = wrong_type_argument (Qnatnump, x); \
1549 /* next three always continuable because they coerce their arguments. */
1550 #define CHECK_INT_COERCE_CHAR(x) do { \
1553 else if (CHARP (x)) \
1554 x = make_int (XCHAR (x)); \
1556 x = wrong_type_argument (Qinteger_or_char_p, x); \
1559 #define CHECK_INT_COERCE_MARKER(x) do { \
1562 else if (MARKERP (x)) \
1563 x = make_int (marker_position (x)); \
1565 x = wrong_type_argument (Qinteger_or_marker_p, x); \
1568 #define CHECK_INT_COERCE_CHAR_OR_MARKER(x) do { \
1571 else if (CHARP (x)) \
1572 x = make_int (XCHAR (x)); \
1573 else if (MARKERP (x)) \
1574 x = make_int (marker_position (x)); \
1576 x = wrong_type_argument (Qinteger_char_or_marker_p, x); \
1580 /*--------------------------- readonly objects -------------------------*/
1582 #define CHECK_C_WRITEABLE(obj) \
1583 do { if (c_readonly (obj)) c_write_error (obj); } while (0)
1585 #define CHECK_LISP_WRITEABLE(obj) \
1586 do { if (lisp_readonly (obj)) lisp_write_error (obj); } while (0)
1588 #define C_READONLY(obj) (C_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
1589 #define LISP_READONLY(obj) (LISP_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
1591 /*----------------------------- structures -----------------------------*/
1593 typedef struct structure_keyword_entry structure_keyword_entry;
1594 struct structure_keyword_entry
1596 Lisp_Object keyword;
1597 int (*validate) (Lisp_Object keyword, Lisp_Object value,
1598 Error_behavior errb);
1603 Dynarr_declare (structure_keyword_entry);
1604 } structure_keyword_entry_dynarr;
1606 typedef struct structure_type structure_type;
1607 struct structure_type
1610 structure_keyword_entry_dynarr *keywords;
1611 int (*validate) (Lisp_Object data, Error_behavior errb);
1612 Lisp_Object (*instantiate) (Lisp_Object data);
1617 Dynarr_declare (structure_type);
1618 } structure_type_dynarr;
1620 struct structure_type *define_structure_type (Lisp_Object type,
1623 Error_behavior errb),
1624 Lisp_Object (*instantiate)
1625 (Lisp_Object data));
1626 void define_structure_type_keyword (struct structure_type *st,
1627 Lisp_Object keyword,
1628 int (*validate) (Lisp_Object keyword,
1630 Error_behavior errb));
1632 /*---------------------------- weak lists ------------------------------*/
1636 /* element disappears if it's unmarked. */
1638 /* element disappears if it's a cons and either its car or
1641 /* element disappears if it's a cons and its car is unmarked. */
1642 WEAK_LIST_KEY_ASSOC,
1643 /* element disappears if it's a cons and its cdr is unmarked. */
1644 WEAK_LIST_VALUE_ASSOC,
1645 /* element disappears if it's a cons and neither its car nor
1646 its cdr is marked. */
1647 WEAK_LIST_FULL_ASSOC
1652 struct lcrecord_header header;
1653 Lisp_Object list; /* don't mark through this! */
1654 enum weak_list_type type;
1655 Lisp_Object next_weak; /* don't mark through this! */
1658 DECLARE_LRECORD (weak_list, struct weak_list);
1659 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list)
1660 #define XSETWEAK_LIST(x, p) XSETRECORD (x, p, weak_list)
1661 #define WEAK_LISTP(x) RECORDP (x, weak_list)
1662 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list)
1663 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list)
1665 #define weak_list_list(w) ((w)->list)
1666 #define XWEAK_LIST_LIST(w) (XWEAK_LIST (w)->list)
1668 Lisp_Object make_weak_list (enum weak_list_type type);
1669 /* The following two are only called by the garbage collector */
1670 int finish_marking_weak_lists (void);
1671 void prune_weak_lists (void);
1673 /*-------------------------- lcrecord-list -----------------------------*/
1675 struct lcrecord_list
1677 struct lcrecord_header header;
1680 const struct lrecord_implementation *implementation;
1683 DECLARE_LRECORD (lcrecord_list, struct lcrecord_list);
1684 #define XLCRECORD_LIST(x) XRECORD (x, lcrecord_list, struct lcrecord_list)
1685 #define XSETLCRECORD_LIST(x, p) XSETRECORD (x, p, lcrecord_list)
1686 #define LCRECORD_LISTP(x) RECORDP (x, lcrecord_list)
1687 /* #define CHECK_LCRECORD_LIST(x) CHECK_RECORD (x, lcrecord_list)
1688 Lcrecord lists should never escape to the Lisp level, so
1689 functions should not be doing this. */
1691 Lisp_Object make_lcrecord_list (size_t size,
1692 const struct lrecord_implementation
1694 Lisp_Object allocate_managed_lcrecord (Lisp_Object lcrecord_list);
1695 void free_managed_lcrecord (Lisp_Object lcrecord_list, Lisp_Object lcrecord);
1698 /************************************************************************/
1699 /* Definitions of primitive Lisp functions and variables */
1700 /************************************************************************/
1703 /* DEFUN - Define a built-in Lisp-visible C function or `subr'.
1704 `lname' should be the name to give the function in Lisp,
1705 as a null-terminated C string.
1706 `Fname' should be the C equivalent of `lname', using only characters
1707 valid in a C identifier, with an "F" prepended.
1708 The name of the C constant structure that records information
1709 on this function for internal use is "S" concatenated with Fname.
1710 `min_args' should be a number, the minimum number of arguments allowed.
1711 `max_args' should be a number, the maximum number of arguments allowed,
1712 or else MANY or UNEVALLED.
1713 MANY means pass a vector of evaluated arguments,
1714 in the form of an integer number-of-arguments
1715 followed by the address of a vector of Lisp_Objects
1716 which contains the argument values.
1717 UNEVALLED means pass the list of unevaluated arguments.
1718 `prompt' says how to read arguments for an interactive call.
1719 See the doc string for `interactive'.
1720 A null string means call interactively with no arguments.
1721 `arglist' are the comma-separated arguments (always Lisp_Objects) for
1723 The docstring for the function is placed as a "C" comment between
1724 the prompt and the `args' argument. make-docfile reads the
1725 comment and creates the DOC file from it.
1728 #define EXFUN_0 void
1729 #define EXFUN_1 Lisp_Object
1730 #define EXFUN_2 Lisp_Object,Lisp_Object
1731 #define EXFUN_3 Lisp_Object,Lisp_Object,Lisp_Object
1732 #define EXFUN_4 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object
1733 #define EXFUN_5 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object
1734 #define EXFUN_6 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
1736 #define EXFUN_7 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
1737 Lisp_Object,Lisp_Object
1738 #define EXFUN_8 Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object,Lisp_Object, \
1739 Lisp_Object,Lisp_Object,Lisp_Object
1740 #define EXFUN_MANY int, Lisp_Object*
1741 #define EXFUN_UNEVALLED Lisp_Object
1742 #define EXFUN(sym, max_args) Lisp_Object sym (EXFUN_##max_args)
1744 #define SUBR_MAX_ARGS 8
1746 #define UNEVALLED -1
1748 /* Can't be const, because then subr->doc is read-only and
1749 Snarf_documentation chokes */
1751 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \
1752 Lisp_Object Fname (EXFUN_##max_args); \
1753 static struct Lisp_Subr S##Fname = \
1755 { /* struct lrecord_header */ \
1756 lrecord_type_subr, /* lrecord_type_index */ \
1758 1, /* c_readonly bit */ \
1759 1 /* lisp_readonly bit */ \
1764 0, /* doc string */ \
1768 Lisp_Object Fname (DEFUN_##max_args arglist)
1770 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a
1771 prototype that matches max_args, and add the obligatory
1772 `Lisp_Object' type declaration to the formal C arguments. */
1774 #define DEFUN_MANY(named_int, named_Lisp_Object) named_int, named_Lisp_Object
1775 #define DEFUN_UNEVALLED(args) Lisp_Object args
1776 #define DEFUN_0() void
1777 #define DEFUN_1(a) Lisp_Object a
1778 #define DEFUN_2(a,b) DEFUN_1(a), Lisp_Object b
1779 #define DEFUN_3(a,b,c) DEFUN_2(a,b), Lisp_Object c
1780 #define DEFUN_4(a,b,c,d) DEFUN_3(a,b,c), Lisp_Object d
1781 #define DEFUN_5(a,b,c,d,e) DEFUN_4(a,b,c,d), Lisp_Object e
1782 #define DEFUN_6(a,b,c,d,e,f) DEFUN_5(a,b,c,d,e), Lisp_Object f
1783 #define DEFUN_7(a,b,c,d,e,f,g) DEFUN_6(a,b,c,d,e,f), Lisp_Object g
1784 #define DEFUN_8(a,b,c,d,e,f,g,h) DEFUN_7(a,b,c,d,e,f,g),Lisp_Object h
1786 /* WARNING: If you add defines here for higher values of max_args,
1787 make sure to also fix the clauses in PRIMITIVE_FUNCALL(),
1788 and change the define of SUBR_MAX_ARGS above. */
1790 #include "symeval.h"
1792 /* `specpdl' is the special binding/unwind-protect stack.
1794 Knuth says (see the Jargon File):
1795 At MIT, `pdl' [abbreviation for `Push Down List'] used to
1796 be a more common synonym for `stack'.
1797 Everywhere else `stack' seems to be the preferred term.
1799 specpdl_depth is the current depth of `specpdl'.
1800 Save this for use later as arg to `unbind_to'. */
1801 extern int specpdl_depth_counter;
1802 #define specpdl_depth() specpdl_depth_counter
1805 #define CHECK_FUNCTION(fun) do { \
1806 while (NILP (Ffunctionp (fun))) \
1807 signal_invalid_function_error (fun); \
1811 /************************************************************************/
1812 /* Checking for QUIT */
1813 /************************************************************************/
1815 /* Asynchronous events set something_happened, and then are processed
1816 within the QUIT macro. At this point, we are guaranteed to not be in
1817 any sensitive code. */
1819 extern volatile int something_happened;
1820 int check_what_happened (void);
1822 extern volatile int quit_check_signal_happened;
1823 extern volatile int quit_check_signal_tick_count;
1824 int check_quit (void);
1826 void signal_quit (void);
1828 /* Nonzero if ought to quit now. */
1830 ((quit_check_signal_happened ? check_quit () : 0), \
1831 (!NILP (Vquit_flag) && (NILP (Vinhibit_quit) \
1832 || EQ (Vquit_flag, Qcritical))))
1834 /* QUIT used to call QUITP, but there are some places where QUITP
1835 is called directly, and check_what_happened() should only be called
1836 when Emacs is actually ready to quit because it could do things
1837 like switch threads. */
1838 #define INTERNAL_QUITP \
1839 ((something_happened ? check_what_happened () : 0), \
1840 (!NILP (Vquit_flag) && \
1841 (NILP (Vinhibit_quit) || EQ (Vquit_flag, Qcritical))))
1843 #define INTERNAL_REALLY_QUITP \
1844 (check_what_happened (), \
1845 (!NILP (Vquit_flag) && \
1846 (NILP (Vinhibit_quit) || EQ (Vquit_flag, Qcritical))))
1848 /* Check quit-flag and quit if it is non-nil. Also do any other things
1849 that might have gotten queued until it was safe. */
1850 #define QUIT do { if (INTERNAL_QUITP) signal_quit (); } while (0)
1852 #define REALLY_QUIT do { if (INTERNAL_REALLY_QUITP) signal_quit (); } while (0)
1855 /************************************************************************/
1857 /************************************************************************/
1859 /* #### for a 64-bit machine, we should substitute a prime just over 2^32 */
1860 #define GOOD_HASH 65599 /* prime number just over 2^16; Dragon book, p. 435 */
1861 #define HASH2(a,b) (GOOD_HASH * (a) + (b))
1862 #define HASH3(a,b,c) (GOOD_HASH * HASH2 (a,b) + (c))
1863 #define HASH4(a,b,c,d) (GOOD_HASH * HASH3 (a,b,c) + (d))
1864 #define HASH5(a,b,c,d,e) (GOOD_HASH * HASH4 (a,b,c,d) + (e))
1865 #define HASH6(a,b,c,d,e,f) (GOOD_HASH * HASH5 (a,b,c,d,e) + (f))
1866 #define HASH7(a,b,c,d,e,f,g) (GOOD_HASH * HASH6 (a,b,c,d,e,f) + (g))
1867 #define HASH8(a,b,c,d,e,f,g,h) (GOOD_HASH * HASH7 (a,b,c,d,e,f,g) + (h))
1868 #define HASH9(a,b,c,d,e,f,g,h,i) (GOOD_HASH * HASH8 (a,b,c,d,e,f,g,h) + (i))
1870 #define LISP_HASH(obj) ((unsigned long) LISP_TO_VOID (obj))
1871 unsigned long string_hash (const char *xv);
1872 unsigned long memory_hash (const void *xv, size_t size);
1873 unsigned long internal_hash (Lisp_Object obj, int depth);
1874 unsigned long internal_array_hash (Lisp_Object *arr, int size, int depth);
1877 /************************************************************************/
1878 /* String translation */
1879 /************************************************************************/
1882 #ifdef HAVE_LIBINTL_H
1883 #include <libintl.h>
1885 char *dgettext (const char *, const char *);
1886 char *gettext (const char *);
1887 char *textdomain (const char *);
1888 char *bindtextdomain (const char *, const char *);
1889 #endif /* HAVE_LIBINTL_H */
1891 #define GETTEXT(x) gettext(x)
1892 #define LISP_GETTEXT(x) Fgettext (x)
1894 #define GETTEXT(x) (x)
1895 #define LISP_GETTEXT(x) (x)
1898 /* DEFER_GETTEXT is used to identify strings which are translated when
1899 they are referenced instead of when they are defined.
1900 These include Qerror_messages and initialized arrays of strings.
1902 #define DEFER_GETTEXT(x) (x)
1905 /************************************************************************/
1906 /* Garbage collection / GC-protection */
1907 /************************************************************************/
1909 /* number of bytes of structure consed since last GC */
1911 extern EMACS_INT consing_since_gc;
1913 /* threshold for doing another gc */
1915 extern Fixnum gc_cons_threshold;
1917 /* Structure for recording stack slots that need marking */
1919 /* This is a chain of structures, each of which points at a Lisp_Object
1920 variable whose value should be marked in garbage collection.
1921 Normally every link of the chain is an automatic variable of a function,
1922 and its `val' points to some argument or local variable of the function.
1923 On exit to the function, the chain is set back to the value it had on
1924 entry. This way, no link remains in the chain when the stack frame
1925 containing the link disappears.
1927 Every function that can call Feval must protect in this fashion all
1928 Lisp_Object variables whose contents will be used again. */
1930 extern struct gcpro *gcprolist;
1935 Lisp_Object *var; /* Address of first protected variable */
1936 int nvars; /* Number of consecutive protected variables */
1939 /* Normally, you declare variables gcpro1, gcpro2, ... and use the
1940 GCPROn() macros. However, if you need to have nested gcpro's,
1941 declare ngcpro1, ngcpro2, ... and use NGCPROn(). If you need
1942 to nest another level, use nngcpro1, nngcpro2, ... and use
1943 NNGCPROn(). If you need to nest yet another level, create
1944 the appropriate macros. */
1948 void debug_gcpro1 (char *, int, struct gcpro *, Lisp_Object *);
1949 void debug_gcpro2 (char *, int, struct gcpro *, struct gcpro *,
1950 Lisp_Object *, Lisp_Object *);
1951 void debug_gcpro3 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
1952 Lisp_Object *, Lisp_Object *, Lisp_Object *);
1953 void debug_gcpro4 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
1954 struct gcpro *, Lisp_Object *, Lisp_Object *, Lisp_Object *,
1956 void debug_gcpro5 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
1957 struct gcpro *, struct gcpro *, Lisp_Object *, Lisp_Object *,
1958 Lisp_Object *, Lisp_Object *, Lisp_Object *);
1959 void debug_ungcpro(char *, int, struct gcpro *);
1962 debug_gcpro1 (__FILE__, __LINE__,&gcpro1,&v)
1963 #define GCPRO2(v1,v2) \
1964 debug_gcpro2 (__FILE__, __LINE__,&gcpro1,&gcpro2,&v1,&v2)
1965 #define GCPRO3(v1,v2,v3) \
1966 debug_gcpro3 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&v1,&v2,&v3)
1967 #define GCPRO4(v1,v2,v3,v4) \
1968 debug_gcpro4 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,\
1970 #define GCPRO5(v1,v2,v3,v4,v5) \
1971 debug_gcpro5 (__FILE__, __LINE__,&gcpro1,&gcpro2,&gcpro3,&gcpro4,&gcpro5,\
1972 &v1,&v2,&v3,&v4,&v5)
1974 debug_ungcpro(__FILE__, __LINE__,&gcpro1)
1976 #define NGCPRO1(v) \
1977 debug_gcpro1 (__FILE__, __LINE__,&ngcpro1,&v)
1978 #define NGCPRO2(v1,v2) \
1979 debug_gcpro2 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&v1,&v2)
1980 #define NGCPRO3(v1,v2,v3) \
1981 debug_gcpro3 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&v1,&v2,&v3)
1982 #define NGCPRO4(v1,v2,v3,v4) \
1983 debug_gcpro4 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,\
1985 #define NGCPRO5(v1,v2,v3,v4,v5) \
1986 debug_gcpro5 (__FILE__, __LINE__,&ngcpro1,&ngcpro2,&ngcpro3,&ngcpro4,\
1987 &ngcpro5,&v1,&v2,&v3,&v4,&v5)
1989 debug_ungcpro(__FILE__, __LINE__,&ngcpro1)
1991 #define NNGCPRO1(v) \
1992 debug_gcpro1 (__FILE__, __LINE__,&nngcpro1,&v)
1993 #define NNGCPRO2(v1,v2) \
1994 debug_gcpro2 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&v1,&v2)
1995 #define NNGCPRO3(v1,v2,v3) \
1996 debug_gcpro3 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&v1,&v2,&v3)
1997 #define NNGCPRO4(v1,v2,v3,v4) \
1998 debug_gcpro4 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,\
2000 #define NNGCPRO5(v1,v2,v3,v4,v5) \
2001 debug_gcpro5 (__FILE__, __LINE__,&nngcpro1,&nngcpro2,&nngcpro3,&nngcpro4,\
2002 &nngcpro5,&v1,&v2,&v3,&v4,&v5)
2004 debug_ungcpro(__FILE__, __LINE__,&nngcpro1)
2006 #else /* ! DEBUG_GCPRO */
2008 #define GCPRO1(var1) ((void) ( \
2009 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
2010 gcprolist = &gcpro1 ))
2012 #define GCPRO2(var1, var2) ((void) ( \
2013 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
2014 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
2015 gcprolist = &gcpro2 ))
2017 #define GCPRO3(var1, var2, var3) ((void) ( \
2018 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
2019 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
2020 gcpro3.next = &gcpro2, gcpro3.var = &var3, gcpro3.nvars = 1, \
2021 gcprolist = &gcpro3 ))
2023 #define GCPRO4(var1, var2, var3, var4) ((void) ( \
2024 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
2025 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
2026 gcpro3.next = &gcpro2, gcpro3.var = &var3, gcpro3.nvars = 1, \
2027 gcpro4.next = &gcpro3, gcpro4.var = &var4, gcpro4.nvars = 1, \
2028 gcprolist = &gcpro4 ))
2030 #define GCPRO5(var1, var2, var3, var4, var5) ((void) ( \
2031 gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
2032 gcpro2.next = &gcpro1, gcpro2.var = &var2, gcpro2.nvars = 1, \
2033 gcpro3.next = &gcpro2, gcpro3.var = &var3, gcpro3.nvars = 1, \
2034 gcpro4.next = &gcpro3, gcpro4.var = &var4, gcpro4.nvars = 1, \
2035 gcpro5.next = &gcpro4, gcpro5.var = &var5, gcpro5.nvars = 1, \
2036 gcprolist = &gcpro5 ))
2038 #define UNGCPRO ((void) (gcprolist = gcpro1.next))
2040 #define NGCPRO1(var1) ((void) ( \
2041 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2042 gcprolist = &ngcpro1 ))
2044 #define NGCPRO2(var1, var2) ((void) ( \
2045 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2046 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2047 gcprolist = &ngcpro2 ))
2049 #define NGCPRO3(var1, var2, var3) ((void) ( \
2050 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2051 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2052 ngcpro3.next = &ngcpro2, ngcpro3.var = &var3, ngcpro3.nvars = 1, \
2053 gcprolist = &ngcpro3 ))
2055 #define NGCPRO4(var1, var2, var3, var4) ((void) ( \
2056 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2057 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2058 ngcpro3.next = &ngcpro2, ngcpro3.var = &var3, ngcpro3.nvars = 1, \
2059 ngcpro4.next = &ngcpro3, ngcpro4.var = &var4, ngcpro4.nvars = 1, \
2060 gcprolist = &ngcpro4 ))
2062 #define NGCPRO5(var1, var2, var3, var4, var5) ((void) ( \
2063 ngcpro1.next = gcprolist, ngcpro1.var = &var1, ngcpro1.nvars = 1, \
2064 ngcpro2.next = &ngcpro1, ngcpro2.var = &var2, ngcpro2.nvars = 1, \
2065 ngcpro3.next = &ngcpro2, ngcpro3.var = &var3, ngcpro3.nvars = 1, \
2066 ngcpro4.next = &ngcpro3, ngcpro4.var = &var4, ngcpro4.nvars = 1, \
2067 ngcpro5.next = &ngcpro4, ngcpro5.var = &var5, ngcpro5.nvars = 1, \
2068 gcprolist = &ngcpro5 ))
2070 #define NUNGCPRO ((void) (gcprolist = ngcpro1.next))
2072 #define NNGCPRO1(var1) ((void) ( \
2073 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2074 gcprolist = &nngcpro1 ))
2076 #define NNGCPRO2(var1, var2) ((void) ( \
2077 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2078 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2079 gcprolist = &nngcpro2 ))
2081 #define NNGCPRO3(var1, var2, var3) ((void) ( \
2082 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2083 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2084 nngcpro3.next = &nngcpro2, nngcpro3.var = &var3, nngcpro3.nvars = 1, \
2085 gcprolist = &nngcpro3 ))
2087 #define NNGCPRO4(var1, var2, var3, var4) ((void) ( \
2088 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2089 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2090 nngcpro3.next = &nngcpro2, nngcpro3.var = &var3, nngcpro3.nvars = 1, \
2091 nngcpro4.next = &nngcpro3, nngcpro4.var = &var4, nngcpro4.nvars = 1, \
2092 gcprolist = &nngcpro4 ))
2094 #define NNGCPRO5(var1, var2, var3, var4, var5) ((void) ( \
2095 nngcpro1.next = gcprolist, nngcpro1.var = &var1, nngcpro1.nvars = 1, \
2096 nngcpro2.next = &nngcpro1, nngcpro2.var = &var2, nngcpro2.nvars = 1, \
2097 nngcpro3.next = &nngcpro2, nngcpro3.var = &var3, nngcpro3.nvars = 1, \
2098 nngcpro4.next = &nngcpro3, nngcpro4.var = &var4, nngcpro4.nvars = 1, \
2099 nngcpro5.next = &nngcpro4, nngcpro5.var = &var5, nngcpro5.nvars = 1, \
2100 gcprolist = &nngcpro5 ))
2102 #define NNUNGCPRO ((void) (gcprolist = nngcpro1.next))
2104 #endif /* ! DEBUG_GCPRO */
2106 /* Another try to fix SunPro C compiler warnings */
2107 /* "end-of-loop code not reached" */
2108 /* "statement not reached */
2109 #if defined __SUNPRO_C || defined __USLC__
2110 #define RETURN_SANS_WARNINGS if (1) return
2111 #define RETURN_NOT_REACHED(value)
2113 #define RETURN_SANS_WARNINGS return
2114 #define RETURN_NOT_REACHED(value) return value;
2117 /* Evaluate expr, UNGCPRO, and then return the value of expr. */
2118 #define RETURN_UNGCPRO(expr) do \
2120 Lisp_Object ret_ungc_val = (expr); \
2122 RETURN_SANS_WARNINGS ret_ungc_val; \
2125 /* Evaluate expr, NUNGCPRO, UNGCPRO, and then return the value of expr. */
2126 #define RETURN_NUNGCPRO(expr) do \
2128 Lisp_Object ret_ungc_val = (expr); \
2131 RETURN_SANS_WARNINGS ret_ungc_val; \
2134 /* Evaluate expr, NNUNGCPRO, NUNGCPRO, UNGCPRO, and then return the
2136 #define RETURN_NNUNGCPRO(expr) do \
2138 Lisp_Object ret_ungc_val = (expr); \
2142 RETURN_SANS_WARNINGS ret_ungc_val; \
2145 /* Evaluate expr, return it if it's not Qunbound. */
2146 #define RETURN_IF_NOT_UNBOUND(expr) do \
2148 Lisp_Object ret_nunb_val = (expr); \
2149 if (!UNBOUNDP (ret_nunb_val)) \
2150 RETURN_SANS_WARNINGS ret_nunb_val; \
2153 extern Lisp_Object_ptr_dynarr *staticpros;
2155 void register_post_gc_action (void (*fun) (void *), void *arg);
2157 /* Call staticpro (&var) to protect static variable `var'. */
2158 void staticpro (Lisp_Object *);
2160 /* Call staticpro_nodump (&var) to protect static variable `var'. */
2161 /* var will not be saved at dump time */
2162 void staticpro_nodump (Lisp_Object *);
2164 /* dump_add_root_struct_ptr (&var, &desc) dumps the structure pointed to by `var'. */
2166 void dump_add_root_struct_ptr (void *, const struct struct_description *);
2168 #define dump_add_root_struct_ptr(varaddr,descaddr) DO_NOTHING
2171 /* dump_add_opaque (&var, size) dumps the opaque static structure `var'. */
2173 void dump_add_opaque (void *, size_t);
2175 #define dump_add_opaque(varaddr,size) DO_NOTHING
2178 /* Call dump_add_opaque_int (&int_var) to dump `int_var', of type `int'. */
2180 #define dump_add_opaque_int(int_varaddr) do { \
2181 int *dao_ = (int_varaddr); /* type check */ \
2182 dump_add_opaque (dao_, sizeof (*dao_)); \
2185 #define dump_add_opaque_int(int_varaddr) DO_NOTHING
2188 /* Call dump_add_opaque_fixnum (&fixnum_var) to dump `fixnum_var', of type `Fixnum'. */
2190 #define dump_add_opaque_fixnum(fixnum_varaddr) do { \
2191 Fixnum *dao_ = (fixnum_varaddr); /* type check */ \
2192 dump_add_opaque (dao_, sizeof (*dao_)); \
2195 #define dump_add_opaque_fixnum(fixnum_varaddr) DO_NOTHING
2198 /* Call dump_add_root_object (&var) to ensure that var is properly updated after pdump. */
2200 void dump_add_root_object (Lisp_Object *);
2202 #define dump_add_root_object(varaddr) DO_NOTHING
2205 /* Call dump_add_root_object (&var) to ensure that var is properly updated after
2206 pdump. var must point to a linked list of objects out of which
2207 some may not be dumped */
2209 void dump_add_weak_object_chain (Lisp_Object *);
2211 #define dump_add_weak_object_chain(varaddr) DO_NOTHING
2214 /* Nonzero means Emacs has already been initialized.
2215 Used during startup to detect startup of dumped Emacs. */
2216 extern int initialized;
2218 #ifdef MEMORY_USAGE_STATS
2220 /* This structure is used to keep statistics on the amount of memory
2223 WAS_REQUESTED stores the actual amount of memory that was requested
2224 of the allocation function. The *_OVERHEAD fields store the
2225 additional amount of memory that was grabbed by the functions to
2226 facilitate allocation, reallocation, etc. MALLOC_OVERHEAD is for
2227 memory allocated with malloc(); DYNARR_OVERHEAD is for dynamic
2228 arrays; GAP_OVERHEAD is for gap arrays. Note that for (e.g.)
2229 dynamic arrays, there is both MALLOC_OVERHEAD and DYNARR_OVERHEAD
2230 memory: The dynamic array allocates memory above and beyond what
2231 was asked of it, and when it in turns allocates memory using
2232 malloc(), malloc() allocates memory beyond what it was asked
2235 Functions that accept a structure of this sort do not initialize
2236 the fields to 0, and add any existing values to whatever was there
2237 before; this way, you can get a cumulative effect. */
2239 struct overhead_stats
2242 int malloc_overhead;
2243 int dynarr_overhead;
2247 #endif /* MEMORY_USAGE_STATS */
2249 #ifndef DIRECTORY_SEP
2250 #define DIRECTORY_SEP '/'
2252 #ifndef IS_DIRECTORY_SEP
2253 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP)
2255 #ifndef IS_DEVICE_SEP
2257 #define IS_DEVICE_SEP(c) 0
2259 #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP)
2263 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c)
2266 #ifdef HAVE_INTTYPES_H
2267 #include <inttypes.h>
2268 #elif defined(INTPTR_T_IN_CYGWIN_TYPES_H)
2269 /* Recent Cygwin defines these types in <cygwin/types.h>
2270 We can hope that if they ever get inttypes.h, they won't define twice */
2271 #elif SIZEOF_VOID_P == SIZEOF_INT
2272 typedef int intptr_t;
2273 typedef unsigned int uintptr_t;
2274 #elif SIZEOF_VOID_P == SIZEOF_LONG
2275 typedef long intptr_t;
2276 typedef unsigned long uintptr_t;
2277 #elif defined(SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG
2278 typedef long long intptr_t;
2279 typedef unsigned long long uintptr_t;
2281 /* Just pray. May break, may not. */
2282 typedef long intptr_t;
2283 typedef unsigned long uintptr_t;
2287 /************************************************************************/
2289 /************************************************************************/
2291 /* NOTE: Prototypes should go HERE, not in various header files, unless
2292 they specifically reference a type that's not defined in lisp.h.
2293 (And even then, you might consider adding the type to lisp.h.)
2295 The idea is that header files typically contain the innards of objects,
2296 and we want to minimize the number of "dependencies" of one file on
2297 the specifics of such objects. Putting prototypes here minimizes the
2298 number of header files that need to be included -- good for a number
2299 of reasons. --ben */
2301 /*--------------- prototypes for various public c functions ------------*/
2303 /* Prototypes for all init/syms_of/vars_of initialization functions. */
2304 #include "symsinit.h"
2306 /* Defined in alloc.c */
2307 void release_breathing_space (void);
2308 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object);
2309 Lisp_Object make_vector (size_t, Lisp_Object);
2310 Lisp_Object vector1 (Lisp_Object);
2311 Lisp_Object vector2 (Lisp_Object, Lisp_Object);
2312 Lisp_Object vector3 (Lisp_Object, Lisp_Object, Lisp_Object);
2313 Lisp_Object make_bit_vector (size_t, Lisp_Object);
2314 Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, size_t);
2315 Lisp_Object noseeum_make_marker (void);
2316 void garbage_collect_1 (void);
2317 Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object);
2318 Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object);
2319 Lisp_Object list1 (Lisp_Object);
2320 Lisp_Object list2 (Lisp_Object, Lisp_Object);
2321 Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
2322 Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
2323 Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
2325 Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
2326 Lisp_Object, Lisp_Object);
2327 DECLARE_DOESNT_RETURN (memory_full (void));
2328 void disksave_object_finalization (void);
2329 extern int purify_flag;
2330 extern int gc_currently_forbidden;
2331 Lisp_Object restore_gc_inhibit (Lisp_Object);
2332 extern EMACS_INT gc_generation_number[1];
2333 int c_readonly (Lisp_Object);
2334 int lisp_readonly (Lisp_Object);
2335 Lisp_Object build_string (const char *);
2336 Lisp_Object build_ext_string (const char *, Lisp_Object);
2337 Lisp_Object build_translated_string (const char *);
2338 Lisp_Object make_string (const Bufbyte *, Bytecount);
2339 Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object);
2340 Lisp_Object make_uninit_string (Bytecount);
2341 Lisp_Object make_float (double);
2342 Lisp_Object make_string_nocopy (const Bufbyte *, Bytecount);
2343 void free_cons (Lisp_Cons *);
2344 void free_list (Lisp_Object);
2345 void free_alist (Lisp_Object);
2346 void mark_conses_in_list (Lisp_Object);
2347 void free_marker (Lisp_Marker *);
2348 int object_dead_p (Lisp_Object);
2349 void mark_object (Lisp_Object obj);
2350 int marked_p (Lisp_Object obj);
2352 #ifdef MEMORY_USAGE_STATS
2353 size_t malloced_storage_size (void *, size_t, struct overhead_stats *);
2354 size_t fixed_type_block_overhead (size_t);
2358 int pdump_load (const char *);
2360 extern char *pdump_start, *pdump_end;
2361 #define DUMPEDP(adr) ((((char *)(adr)) < pdump_end) && (((char *)(adr)) >= pdump_start))
2363 #define DUMPEDP(adr) 0
2366 /* Defined in buffer.c */
2367 Lisp_Object make_buffer (struct buffer *);
2368 Lisp_Object get_truename_buffer (Lisp_Object);
2369 void switch_to_buffer (Lisp_Object, Lisp_Object);
2370 extern int find_file_compare_truenames;
2371 extern int find_file_use_truenames;
2373 /* Defined in callproc.c */
2374 char *egetenv (const char *);
2376 /* Defined in console.c */
2377 void stuff_buffered_input (Lisp_Object);
2379 /* Defined in console-msw.c */
2380 EXFUN (Fmswindows_message_box, 3);
2381 extern int mswindows_message_outputted;
2383 /* Defined in data.c */
2384 DECLARE_DOESNT_RETURN (c_write_error (Lisp_Object));
2385 DECLARE_DOESNT_RETURN (lisp_write_error (Lisp_Object));
2386 DECLARE_DOESNT_RETURN (args_out_of_range (Lisp_Object, Lisp_Object));
2387 DECLARE_DOESNT_RETURN (args_out_of_range_3 (Lisp_Object, Lisp_Object,
2389 Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
2390 DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object));
2391 void check_int_range (EMACS_INT, EMACS_INT, EMACS_INT);
2393 enum arith_comparison {
2398 arith_less_or_equal,
2399 arith_grtr_or_equal };
2400 Lisp_Object arithcompare (Lisp_Object, Lisp_Object, enum arith_comparison);
2402 /* Do NOT use word_to_lisp or wasteful_word_to_lisp to decode time_t's
2403 unless you KNOW arg is non-negative. They cannot return negative
2404 values! Use make_time. */
2405 Lisp_Object word_to_lisp (unsigned int);
2406 unsigned int lisp_to_word (Lisp_Object);
2408 /* Defined in dired.c */
2409 Lisp_Object make_directory_hash_table (const char *);
2410 Lisp_Object wasteful_word_to_lisp (unsigned int);
2412 /* Defined in doc.c */
2413 Lisp_Object unparesseuxify_doc_string (int, EMACS_INT, char *, Lisp_Object);
2414 Lisp_Object read_doc_string (Lisp_Object);
2416 /* Defined in doprnt.c */
2417 Bytecount emacs_doprnt_c (Lisp_Object, const Bufbyte *, Lisp_Object,
2419 Bytecount emacs_doprnt_va (Lisp_Object, const Bufbyte *, Lisp_Object,
2420 Bytecount, va_list);
2421 Bytecount emacs_doprnt_lisp (Lisp_Object, const Bufbyte *, Lisp_Object,
2422 Bytecount, int, const Lisp_Object *);
2423 Bytecount emacs_doprnt_lisp_2 (Lisp_Object, const Bufbyte *, Lisp_Object,
2424 Bytecount, int, ...);
2425 Lisp_Object emacs_doprnt_string_c (const Bufbyte *, Lisp_Object,
2427 Lisp_Object emacs_doprnt_string_va (const Bufbyte *, Lisp_Object,
2428 Bytecount, va_list);
2429 Lisp_Object emacs_doprnt_string_lisp (const Bufbyte *, Lisp_Object,
2430 Bytecount, int, const Lisp_Object *);
2431 Lisp_Object emacs_doprnt_string_lisp_2 (const Bufbyte *, Lisp_Object,
2432 Bytecount, int, ...);
2434 /* Defined in editfns.c */
2435 void uncache_home_directory (void);
2436 Extbyte *get_home_directory (void);
2437 char *user_login_name (uid_t *);
2438 Bufpos bufpos_clip_to_bounds (Bufpos, Bufpos, Bufpos);
2439 Bytind bytind_clip_to_bounds (Bytind, Bytind, Bytind);
2440 void buffer_insert1 (struct buffer *, Lisp_Object);
2441 Lisp_Object make_string_from_buffer (struct buffer *, Bufpos, Charcount);
2442 Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Bufpos, Charcount);
2443 Lisp_Object make_time (time_t);
2444 Lisp_Object save_excursion_save (void);
2445 Lisp_Object save_restriction_save (void);
2446 Lisp_Object save_excursion_restore (Lisp_Object);
2447 Lisp_Object save_restriction_restore (Lisp_Object);
2449 /* Defined in emacsfns.c */
2450 Lisp_Object save_current_buffer_restore (Lisp_Object);
2452 /* Defined in emacs.c */
2453 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (fatal (const char *,
2455 int stderr_out (const char *, ...) PRINTF_ARGS (1, 2);
2456 int stdout_out (const char *, ...) PRINTF_ARGS (1, 2);
2457 SIGTYPE fatal_error_signal (int);
2458 Lisp_Object make_arg_list (int, Extbyte **);
2459 void make_argc_argv (Lisp_Object, int *, Extbyte ***);
2460 void free_argc_argv (Extbyte **);
2461 Lisp_Object decode_env_path (const char *, const char *);
2462 Lisp_Object decode_path (const char *);
2463 /* Nonzero means don't do interactive redisplay and don't change tty modes */
2464 extern int noninteractive, noninteractive1;
2465 extern int fatal_error_in_progress;
2466 extern int inhibit_non_essential_printing_operations;
2467 extern int preparing_for_armageddon;
2468 extern Fixnum emacs_priority;
2469 extern int running_asynch_code;
2470 extern int suppress_early_error_handler_backtrace;
2471 void debug_break (void);
2472 int debug_can_access_memory (void *ptr, Bytecount len);
2474 /* Defined in eval.c */
2475 DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, Lisp_Object));
2476 void maybe_signal_error (Lisp_Object, Lisp_Object, Lisp_Object,
2478 Lisp_Object maybe_signal_continuable_error (Lisp_Object, Lisp_Object,
2479 Lisp_Object, Error_behavior);
2480 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (type_error (Lisp_Object,
2483 void maybe_type_error (Lisp_Object, Lisp_Object, Error_behavior, const char *,
2484 ...) PRINTF_ARGS (4, 5);
2485 Lisp_Object continuable_type_error (Lisp_Object, const char *, ...)
2487 Lisp_Object maybe_continuable_type_error (Lisp_Object, Lisp_Object,
2491 DECLARE_DOESNT_RETURN (signal_type_error (Lisp_Object, const char *,
2493 void maybe_signal_type_error (Lisp_Object, const char *, Lisp_Object,
2494 Lisp_Object, Error_behavior);
2495 Lisp_Object signal_type_continuable_error (Lisp_Object, const char *,
2497 Lisp_Object maybe_signal_type_continuable_error (Lisp_Object, const char *,
2499 Lisp_Object, Error_behavior);
2500 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (type_error_with_frob
2501 (Lisp_Object, Lisp_Object,
2504 void maybe_type_error_with_frob (Lisp_Object, Lisp_Object, Lisp_Object,
2506 const char *, ...) PRINTF_ARGS (5, 6);
2507 Lisp_Object continuable_type_error_with_frob (Lisp_Object, Lisp_Object,
2509 ...) PRINTF_ARGS (3, 4);
2510 Lisp_Object maybe_continuable_type_error_with_frob
2511 (Lisp_Object, Lisp_Object, Lisp_Object, Error_behavior, const char *, ...)
2513 DECLARE_DOESNT_RETURN (signal_type_error_2 (Lisp_Object, const char *,
2514 Lisp_Object, Lisp_Object));
2515 void maybe_signal_type_error_2 (Lisp_Object, const char *, Lisp_Object,
2516 Lisp_Object, Lisp_Object, Error_behavior);
2517 Lisp_Object signal_type_continuable_error_2 (Lisp_Object, const char *,
2518 Lisp_Object, Lisp_Object);
2519 Lisp_Object maybe_signal_type_continuable_error_2 (Lisp_Object, const char *,
2520 Lisp_Object, Lisp_Object,
2523 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (error (const char *,
2525 void maybe_error (Lisp_Object, Error_behavior, const char *,
2526 ...) PRINTF_ARGS (3, 4);
2527 Lisp_Object continuable_error (const char *, ...) PRINTF_ARGS (1, 2);
2528 Lisp_Object maybe_continuable_error (Lisp_Object, Error_behavior,
2529 const char *, ...) PRINTF_ARGS (3, 4);
2530 DECLARE_DOESNT_RETURN (signal_simple_error (const char *, Lisp_Object));
2531 void maybe_signal_simple_error (const char *, Lisp_Object,
2532 Lisp_Object, Error_behavior);
2533 Lisp_Object signal_simple_continuable_error (const char *, Lisp_Object);
2534 Lisp_Object maybe_signal_simple_continuable_error (const char *, Lisp_Object,
2535 Lisp_Object, Error_behavior);
2536 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (error_with_frob
2537 (Lisp_Object, const char *,
2539 void maybe_error_with_frob (Lisp_Object, Lisp_Object, Error_behavior,
2540 const char *, ...) PRINTF_ARGS (4, 5);
2541 Lisp_Object continuable_error_with_frob (Lisp_Object, const char *,
2542 ...) PRINTF_ARGS (2, 3);
2543 Lisp_Object maybe_continuable_error_with_frob
2544 (Lisp_Object, Lisp_Object, Error_behavior, const char *, ...) PRINTF_ARGS (4, 5);
2545 DECLARE_DOESNT_RETURN (signal_simple_error_2 (const char *,
2546 Lisp_Object, Lisp_Object));
2547 void maybe_signal_simple_error_2 (const char *, Lisp_Object, Lisp_Object,
2548 Lisp_Object, Error_behavior);
2549 Lisp_Object signal_simple_continuable_error_2 (const char *,
2550 Lisp_Object, Lisp_Object);
2551 Lisp_Object maybe_signal_simple_continuable_error_2 (const char *, Lisp_Object,
2552 Lisp_Object, Lisp_Object,
2554 DECLARE_DOESNT_RETURN (signal_malformed_list_error (Lisp_Object));
2555 DECLARE_DOESNT_RETURN (signal_malformed_property_list_error (Lisp_Object));
2556 DECLARE_DOESNT_RETURN (signal_circular_list_error (Lisp_Object));
2557 DECLARE_DOESNT_RETURN (signal_circular_property_list_error (Lisp_Object));
2559 DECLARE_DOESNT_RETURN (syntax_error (const char *reason, Lisp_Object frob));
2560 DECLARE_DOESNT_RETURN (syntax_error_2 (const char *reason, Lisp_Object frob1,
2561 Lisp_Object frob2));
2562 DECLARE_DOESNT_RETURN (invalid_argument (const char *reason,
2564 DECLARE_DOESNT_RETURN (invalid_argument_2 (const char *reason,
2566 Lisp_Object frob2));
2567 DECLARE_DOESNT_RETURN (invalid_operation (const char *reason,
2569 DECLARE_DOESNT_RETURN (invalid_operation_2 (const char *reason,
2571 Lisp_Object frob2));
2572 DECLARE_DOESNT_RETURN (invalid_change (const char *reason,
2574 DECLARE_DOESNT_RETURN (invalid_change_2 (const char *reason,
2576 Lisp_Object frob2));
2578 Lisp_Object signal_void_function_error (Lisp_Object);
2579 Lisp_Object signal_invalid_function_error (Lisp_Object);
2580 Lisp_Object signal_wrong_number_of_arguments_error (Lisp_Object, int);
2582 Lisp_Object run_hook_with_args_in_buffer (struct buffer *, int, Lisp_Object *,
2583 enum run_hooks_condition);
2584 Lisp_Object run_hook_with_args (int, Lisp_Object *, enum run_hooks_condition);
2585 void va_run_hook_with_args (Lisp_Object, int, ...);
2586 void va_run_hook_with_args_in_buffer (struct buffer *, Lisp_Object, int, ...);
2587 Lisp_Object run_hook (Lisp_Object);
2588 Lisp_Object apply1 (Lisp_Object, Lisp_Object);
2589 Lisp_Object call0 (Lisp_Object);
2590 Lisp_Object call1 (Lisp_Object, Lisp_Object);
2591 Lisp_Object call2 (Lisp_Object, Lisp_Object, Lisp_Object);
2592 Lisp_Object call3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
2593 Lisp_Object call4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
2595 Lisp_Object call5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
2596 Lisp_Object, Lisp_Object);
2597 Lisp_Object call6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
2598 Lisp_Object, Lisp_Object, Lisp_Object);
2599 Lisp_Object call7 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
2600 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
2601 Lisp_Object call8 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
2602 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
2604 Lisp_Object call0_in_buffer (struct buffer *, Lisp_Object);
2605 Lisp_Object call1_in_buffer (struct buffer *, Lisp_Object, Lisp_Object);
2606 Lisp_Object call2_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
2608 Lisp_Object call3_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
2609 Lisp_Object, Lisp_Object);
2610 Lisp_Object call4_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
2611 Lisp_Object, Lisp_Object, Lisp_Object);
2612 Lisp_Object call5_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
2613 Lisp_Object, Lisp_Object, Lisp_Object,
2615 Lisp_Object call6_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
2616 Lisp_Object, Lisp_Object, Lisp_Object,
2617 Lisp_Object, Lisp_Object);
2618 Lisp_Object eval_in_buffer (struct buffer *, Lisp_Object);
2619 Lisp_Object call0_with_handler (Lisp_Object, Lisp_Object);
2620 Lisp_Object call1_with_handler (Lisp_Object, Lisp_Object, Lisp_Object);
2621 Lisp_Object eval_in_buffer_trapping_errors (const char *, struct buffer *,
2623 Lisp_Object run_hook_trapping_errors (const char *, Lisp_Object);
2624 Lisp_Object safe_run_hook_trapping_errors (const char *, Lisp_Object, int);
2625 Lisp_Object call0_trapping_errors (const char *, Lisp_Object);
2626 Lisp_Object call1_trapping_errors (const char *, Lisp_Object, Lisp_Object);
2627 Lisp_Object call2_trapping_errors (const char *,
2628 Lisp_Object, Lisp_Object, Lisp_Object);
2629 Lisp_Object call_with_suspended_errors (lisp_fn_t, volatile Lisp_Object, Lisp_Object,
2630 Error_behavior, int, ...);
2631 /* C Code should be using internal_catch, record_unwind_p, condition_case_1 */
2632 Lisp_Object internal_catch (Lisp_Object, Lisp_Object (*) (Lisp_Object),
2633 Lisp_Object, int * volatile);
2634 Lisp_Object condition_case_1 (Lisp_Object,
2635 Lisp_Object (*) (Lisp_Object),
2637 Lisp_Object (*) (Lisp_Object, Lisp_Object),
2639 Lisp_Object condition_case_3 (Lisp_Object, Lisp_Object, Lisp_Object);
2640 Lisp_Object unbind_to (int, Lisp_Object);
2641 void specbind (Lisp_Object, Lisp_Object);
2642 void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
2643 void do_autoload (Lisp_Object, Lisp_Object);
2644 Lisp_Object un_autoload (Lisp_Object);
2645 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);
2646 void warn_when_safe (Lisp_Object, Lisp_Object, const char *,
2647 ...) PRINTF_ARGS (3, 4);
2650 /* Defined in event-stream.c */
2651 void wait_delaying_user_input (int (*) (void *), void *);
2652 int detect_input_pending (void);
2653 void reset_this_command_keys (Lisp_Object, int);
2654 Lisp_Object enqueue_misc_user_event (Lisp_Object, Lisp_Object, Lisp_Object);
2655 Lisp_Object enqueue_misc_user_event_pos (Lisp_Object, Lisp_Object,
2656 Lisp_Object, int, int, int, int);
2657 extern int modifier_keys_are_sticky;
2659 /* Defined in event-Xt.c */
2660 void enqueue_Xt_dispatch_event (Lisp_Object event);
2661 void signal_special_Xt_user_event (Lisp_Object, Lisp_Object, Lisp_Object);
2664 /* Defined in events.c */
2665 void clear_event_resource (void);
2666 Lisp_Object allocate_event (void);
2668 /* Defined in fileio.c */
2669 void record_auto_save (void);
2670 void force_auto_save_soon (void);
2671 DECLARE_DOESNT_RETURN (report_file_error (const char *, Lisp_Object));
2672 void maybe_report_file_error (const char *, Lisp_Object,
2673 Lisp_Object, Error_behavior);
2674 DECLARE_DOESNT_RETURN (signal_file_error (const char *, Lisp_Object));
2675 void maybe_signal_file_error (const char *, Lisp_Object,
2676 Lisp_Object, Error_behavior);
2677 DECLARE_DOESNT_RETURN (signal_double_file_error (const char *, const char *,
2679 void maybe_signal_double_file_error (const char *, const char *,
2680 Lisp_Object, Lisp_Object, Error_behavior);
2681 DECLARE_DOESNT_RETURN (signal_double_file_error_2 (const char *, const char *,
2682 Lisp_Object, Lisp_Object));
2683 void maybe_signal_double_file_error_2 (const char *, const char *,
2684 Lisp_Object, Lisp_Object, Lisp_Object,
2686 Lisp_Object lisp_strerror (int);
2687 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
2688 ssize_t read_allowing_quit (int, void *, size_t);
2689 ssize_t write_allowing_quit (int, const void *, size_t);
2690 int internal_delete_file (Lisp_Object);
2692 /* Defined in filelock.c */
2693 void lock_file (Lisp_Object);
2694 void unlock_file (Lisp_Object);
2695 void unlock_all_files (void);
2696 void unlock_buffer (struct buffer *);
2698 /* Defined in filemode.c */
2699 void filemodestring (struct stat *, char *);
2701 /* Defined in floatfns.c */
2702 double extract_float (Lisp_Object);
2704 /* Defined in fns.c */
2705 Lisp_Object list_sort (Lisp_Object, Lisp_Object,
2706 int (*) (Lisp_Object, Lisp_Object, Lisp_Object));
2707 Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object);
2709 void bump_string_modiff (Lisp_Object);
2710 Lisp_Object memq_no_quit (Lisp_Object, Lisp_Object);
2711 Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object);
2712 Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object);
2713 Lisp_Object rassq_no_quit (Lisp_Object, Lisp_Object);
2714 Lisp_Object delq_no_quit (Lisp_Object, Lisp_Object);
2715 Lisp_Object delq_no_quit_and_free_cons (Lisp_Object, Lisp_Object);
2716 Lisp_Object remassoc_no_quit (Lisp_Object, Lisp_Object);
2717 Lisp_Object remassq_no_quit (Lisp_Object, Lisp_Object);
2718 Lisp_Object remrassq_no_quit (Lisp_Object, Lisp_Object);
2720 int plists_differ (Lisp_Object, Lisp_Object, int, int, int);
2721 Lisp_Object internal_plist_get (Lisp_Object, Lisp_Object);
2722 void internal_plist_put (Lisp_Object *, Lisp_Object, Lisp_Object);
2723 int internal_remprop (Lisp_Object *, Lisp_Object);
2724 Lisp_Object external_plist_get (Lisp_Object *, Lisp_Object,
2725 int, Error_behavior);
2726 void external_plist_put (Lisp_Object *, Lisp_Object,
2727 Lisp_Object, int, Error_behavior);
2728 int external_remprop (Lisp_Object *, Lisp_Object, int, Error_behavior);
2729 int internal_equal (Lisp_Object, Lisp_Object, int);
2730 Lisp_Object concat2 (Lisp_Object, Lisp_Object);
2731 Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object);
2732 Lisp_Object vconcat2 (Lisp_Object, Lisp_Object);
2733 Lisp_Object vconcat3 (Lisp_Object, Lisp_Object, Lisp_Object);
2734 Lisp_Object nconc2 (Lisp_Object, Lisp_Object);
2735 Lisp_Object bytecode_nconc2 (Lisp_Object *);
2736 void check_losing_bytecode (const char *, Lisp_Object);
2738 /* Defined in glyphs.c */
2739 Error_behavior decode_error_behavior_flag (Lisp_Object);
2740 Lisp_Object encode_error_behavior_flag (Error_behavior);
2742 /* Defined in indent.c */
2743 int bi_spaces_at_point (struct buffer *, Bytind);
2744 int column_at_point (struct buffer *, Bufpos, int);
2745 int string_column_at_point (Lisp_String *, Bufpos, int);
2746 int current_column (struct buffer *);
2747 void invalidate_current_column (void);
2748 Bufpos vmotion (struct window *, Bufpos, int, int *);
2749 Bufpos vmotion_pixels (Lisp_Object, Bufpos, int, int, int *);
2751 /* Defined in keymap.c */
2752 void where_is_to_char (Lisp_Object, char *);
2754 /* Defined in lread.c */
2755 void ebolify_bytecode_constants (Lisp_Object);
2756 void close_load_descs (void);
2757 int locate_file (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int);
2758 EXFUN (Flocate_file_clear_hashing, 1);
2759 int isfloat_string (const char *);
2760 Lisp_Object read_from_c_string (const unsigned char* str, size_t size);
2762 /* Well, I've decided to enable this. -- ben */
2763 /* And I've decided to make it work right. -- sb */
2765 /* Define the following symbol to enable load history of dumped files */
2766 #define LOADHIST_DUMPED
2767 /* Define the following symbol to enable load history of C source */
2768 #define LOADHIST_BUILTIN
2770 #ifdef LOADHIST /* this is just a stupid idea */
2771 #define LOADHIST_ATTACH(x) \
2772 do { if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); } \
2774 #else /*! LOADHIST */
2775 # define LOADHIST_ATTACH(x)
2776 #endif /*! LOADHIST */
2778 /* Defined in marker.c */
2779 Bytind bi_marker_position (Lisp_Object);
2780 Bufpos marker_position (Lisp_Object);
2781 void set_bi_marker_position (Lisp_Object, Bytind);
2782 void set_marker_position (Lisp_Object, Bufpos);
2783 void unchain_marker (Lisp_Object);
2784 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object);
2785 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
2786 #ifdef MEMORY_USAGE_STATS
2787 int compute_buffer_marker_usage (struct buffer *, struct overhead_stats *);
2790 /* Defined in menubar.c */
2791 extern int popup_menu_up_p;
2792 extern int menubar_show_keybindings;
2793 extern int popup_menu_titles;
2795 /* Defined in minibuf.c */
2796 extern int minibuf_level;
2797 Charcount scmp_1 (const Bufbyte *, const Bufbyte *, Charcount, int);
2798 #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case)
2799 extern int completion_ignore_case;
2800 int regexp_ignore_completion_p (const Bufbyte *, Lisp_Object,
2801 Bytecount, Bytecount);
2802 Lisp_Object clear_echo_area (struct frame *, Lisp_Object, int);
2803 Lisp_Object clear_echo_area_from_print (struct frame *, Lisp_Object, int);
2804 void echo_area_append (struct frame *, const Bufbyte *, Lisp_Object,
2805 Bytecount, Bytecount, Lisp_Object);
2806 void echo_area_message (struct frame *, const Bufbyte *, Lisp_Object,
2807 Bytecount, Bytecount, Lisp_Object);
2808 Lisp_Object echo_area_status (struct frame *);
2809 int echo_area_active (struct frame *);
2810 Lisp_Object echo_area_contents (struct frame *);
2811 void message_internal (const Bufbyte *, Lisp_Object, Bytecount, Bytecount);
2812 void message_append_internal (const Bufbyte *, Lisp_Object,
2813 Bytecount, Bytecount);
2814 void message (const char *, ...) PRINTF_ARGS (1, 2);
2815 void message_append (const char *, ...) PRINTF_ARGS (1, 2);
2816 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2);
2817 void clear_message (void);
2819 /* Defined in print.c */
2820 void write_string_to_stdio_stream (FILE *, struct console *,
2821 const Bufbyte *, Bytecount, Bytecount,
2823 void debug_print (Lisp_Object);
2824 void debug_short_backtrace (int);
2825 void temp_output_buffer_setup (Lisp_Object);
2826 void temp_output_buffer_show (Lisp_Object, Lisp_Object);
2827 /* NOTE: Do not call this with the data of a Lisp_String. Use princ.
2828 * Note: stream should be defaulted before calling
2829 * (eg Qnil means stdout, not Vstandard_output, etc) */
2830 void write_c_string (const char *, Lisp_Object);
2831 /* Same goes for this function. */
2832 void write_string_1 (const Bufbyte *, Bytecount, Lisp_Object);
2833 void print_cons (Lisp_Object, Lisp_Object, int);
2834 void print_vector (Lisp_Object, Lisp_Object, int);
2835 void print_string (Lisp_Object, Lisp_Object, int);
2836 char *long_to_string (char *, long);
2837 void print_internal (Lisp_Object, Lisp_Object, int);
2838 void print_symbol (Lisp_Object, Lisp_Object, int);
2839 void print_float (Lisp_Object, Lisp_Object, int);
2840 extern int print_escape_newlines;
2841 extern int print_readably;
2842 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object,
2843 Lisp_Object (*) (Lisp_Object),
2844 Lisp_Object, Lisp_Object);
2845 void float_to_string (char *, double);
2846 void internal_object_printer (Lisp_Object, Lisp_Object, int);
2848 /* Defined in profile.c */
2849 void mark_profiling_info (void);
2850 void profile_increase_call_count (Lisp_Object);
2851 extern int profiling_active;
2852 extern int profiling_redisplay_flag;
2854 /* Defined in rangetab.c */
2855 void put_range_table (Lisp_Object, EMACS_INT, EMACS_INT, Lisp_Object);
2856 int unified_range_table_bytes_needed (Lisp_Object);
2857 int unified_range_table_bytes_used (void *);
2858 void unified_range_table_copy_data (Lisp_Object, void *);
2859 Lisp_Object unified_range_table_lookup (void *, EMACS_INT, Lisp_Object);
2860 int unified_range_table_nentries (void *);
2861 void unified_range_table_get_range (void *, int, EMACS_INT *, EMACS_INT *,
2864 /* Defined in search.c */
2865 struct re_pattern_buffer;
2866 struct re_registers;
2867 Bufpos scan_buffer (struct buffer *, Emchar, Bufpos, Bufpos, EMACS_INT, EMACS_INT *, int);
2868 Bufpos find_next_newline (struct buffer *, Bufpos, int);
2869 Bufpos find_next_newline_no_quit (struct buffer *, Bufpos, int);
2870 Bytind bi_find_next_newline_no_quit (struct buffer *, Bytind, int);
2871 Bytind bi_find_next_emchar_in_string (Lisp_String*, Emchar, Bytind, EMACS_INT);
2872 Bufpos find_before_next_newline (struct buffer *, Bufpos, Bufpos, int);
2873 struct re_pattern_buffer *compile_pattern (Lisp_Object, struct re_registers *,
2874 Lisp_Object, int, Error_behavior);
2875 Bytecount fast_string_match (Lisp_Object, const Bufbyte *,
2876 Lisp_Object, Bytecount,
2877 Bytecount, int, Error_behavior, int);
2878 Bytecount fast_lisp_string_match (Lisp_Object, Lisp_Object);
2879 void restore_match_data (void);
2881 /* Defined in signal.c */
2882 void init_interrupts_late (void);
2883 extern int dont_check_for_quit;
2884 void begin_dont_check_for_quit (void);
2885 void emacs_sleep (int);
2887 /* Defined in sound.c */
2888 void init_device_sound (struct device *);
2890 /* Defined in specifier.c */
2891 Lisp_Object specifier_instance (Lisp_Object, Lisp_Object, Lisp_Object,
2892 Error_behavior, int, int, Lisp_Object);
2893 Lisp_Object specifier_instance_no_quit (Lisp_Object, Lisp_Object, Lisp_Object,
2894 Error_behavior, int, Lisp_Object);
2896 /* Defined in symbols.c */
2897 int hash_string (const Bufbyte *, Bytecount);
2898 Lisp_Object intern (const char *);
2899 Lisp_Object oblookup (Lisp_Object, const Bufbyte *, Bytecount);
2900 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *);
2901 Lisp_Object indirect_function (Lisp_Object, int);
2902 Lisp_Object symbol_value_in_buffer (Lisp_Object, Lisp_Object);
2903 void kill_buffer_local_variables (struct buffer *);
2904 int symbol_value_buffer_local_info (Lisp_Object, struct buffer *);
2905 Lisp_Object find_symbol_value (Lisp_Object);
2906 Lisp_Object find_symbol_value_quickly (Lisp_Object, int);
2907 Lisp_Object top_level_value (Lisp_Object);
2908 void reject_constant_symbols (Lisp_Object sym, Lisp_Object newval,
2910 Lisp_Object follow_past_lisp_magic);
2912 /* Defined in syntax.c */
2913 Bufpos scan_words (struct buffer *, Bufpos, int);
2915 /* Defined in undo.c */
2916 Lisp_Object truncate_undo_list (Lisp_Object, int, int);
2917 void record_extent (Lisp_Object, int);
2918 void record_insert (struct buffer *, Bufpos, Charcount);
2919 void record_delete (struct buffer *, Bufpos, Charcount);
2920 void record_change (struct buffer *, Bufpos, Charcount);
2922 /* Defined in unex*.c */
2923 int unexec (char *, char *, uintptr_t, uintptr_t, uintptr_t);
2924 #ifdef RUN_TIME_REMAP
2925 int run_time_remap (char *);
2928 /* Defined in vm-limit.c */
2929 void memory_warnings (void *, void (*) (const char *));
2931 /* Defined in window.c */
2932 Lisp_Object save_window_excursion_unwind (Lisp_Object);
2933 Lisp_Object display_buffer (Lisp_Object, Lisp_Object, Lisp_Object);
2935 /*--------------- prototypes for Lisp primitives in C ------------*/
2937 /* The following were machine generated 19980312 */
2939 EXFUN (Faccept_process_output, 3);
2941 EXFUN (Fadd_spec_to_specifier, 5);
2942 EXFUN (Fadd_timeout, 4);
2943 EXFUN (Fappend, MANY);
2944 EXFUN (Fapply, MANY);
2949 EXFUN (Fbacktrace, 2);
2950 EXFUN (Fbeginning_of_line, 2);
2954 EXFUN (Fbuffer_substring, 3);
2955 EXFUN (Fbuilt_in_variable_type, 1);
2956 EXFUN (Fbyte_code, 3);
2957 EXFUN (Fcall_interactively, 3);
2958 EXFUN (Fcanonicalize_lax_plist, 2);
2959 EXFUN (Fcanonicalize_plist, 2);
2961 EXFUN (Fcar_safe, 1);
2963 EXFUN (Fchar_after, 2);
2964 EXFUN (Fchar_ref_p, 1);
2965 EXFUN (Fchar_to_string, 1);
2966 EXFUN (Fcheck_valid_plist, 1);
2967 EXFUN (Fvalid_plist_p, 1);
2968 EXFUN (Fclear_range_table, 1);
2969 EXFUN (Fcoding_category_list, 0);
2970 EXFUN (Fcoding_category_system, 1);
2971 EXFUN (Fcoding_priority_list, 0);
2972 EXFUN (Fcoding_system_charset, 2);
2973 EXFUN (Fcoding_system_doc_string, 1);
2974 EXFUN (Fcoding_system_list, 0);
2975 EXFUN (Fcoding_system_name, 1);
2976 EXFUN (Fcoding_system_p, 1);
2977 EXFUN (Fcoding_system_property, 2);
2978 EXFUN (Fcoding_system_type, 1);
2979 EXFUN (Fcommand_execute, 3);
2980 EXFUN (Fcommandp, 1);
2981 EXFUN (Fconcat, MANY);
2983 EXFUN (Fcopy_alist, 1);
2984 EXFUN (Fcopy_coding_system, 2);
2985 EXFUN (Fcopy_event, 2);
2986 EXFUN (Fcopy_list, 1);
2987 EXFUN (Fcopy_marker, 2);
2988 EXFUN (Fcopy_sequence, 1);
2989 EXFUN (Fcopy_tree, 2);
2990 EXFUN (Fcurrent_window_configuration, 1);
2991 EXFUN (Fdecode_big5_char, 1);
2992 EXFUN (Fdecode_coding_region, 4);
2993 EXFUN (Fdecode_shift_jis_char, 1);
2994 EXFUN (Fdefault_boundp, 1);
2995 EXFUN (Fdefault_value, 1);
2996 EXFUN (Fdefine_key, 3);
2998 EXFUN (Fdelete_region, 3);
2999 EXFUN (Fdelete_process, 1);
3001 EXFUN (Fdestructive_alist_to_plist, 1);
3002 EXFUN (Fdetect_coding_region, 3);
3003 EXFUN (Fdgettext, 2);
3005 EXFUN (Fdirectory_file_name, 1);
3006 EXFUN (Fdisable_timeout, 1);
3007 EXFUN (Fdiscard_input, 0);
3008 EXFUN (Fdispatch_event, 1);
3009 EXFUN (Fdisplay_error, 2);
3010 EXFUN (Fdo_auto_save, 2);
3011 EXFUN (Fdowncase, 2);
3013 EXFUN (Fencode_big5_char, 1);
3014 EXFUN (Fencode_coding_region, 4);
3015 EXFUN (Fencode_shift_jis_char, 1);
3016 EXFUN (Fend_of_line, 2);
3017 EXFUN (Fenqueue_eval_event, 2);
3021 EXFUN (Ferror_message_string, 1);
3023 EXFUN (Fevent_to_character, 4);
3024 EXFUN (Fexecute_kbd_macro, 2);
3025 EXFUN (Fexpand_abbrev, 0);
3026 EXFUN (Fexpand_file_name, 2);
3027 EXFUN (Fextent_at, 5);
3028 EXFUN (Fextent_property, 3);
3029 EXFUN (Ffboundp, 1);
3030 EXFUN (Ffile_accessible_directory_p, 1);
3031 EXFUN (Ffile_directory_p, 1);
3032 EXFUN (Ffile_executable_p, 1);
3033 EXFUN (Ffile_exists_p, 1);
3034 EXFUN (Ffile_name_absolute_p, 1);
3035 EXFUN (Ffile_name_as_directory, 1);
3036 EXFUN (Ffile_name_directory, 1);
3037 EXFUN (Ffile_name_nondirectory, 1);
3038 EXFUN (Ffile_readable_p, 1);
3039 EXFUN (Ffile_symlink_p, 1);
3040 EXFUN (Ffile_truename, 2);
3041 EXFUN (Ffind_coding_system, 1);
3042 EXFUN (Ffind_file_name_handler, 2);
3043 EXFUN (Ffollowing_char, 1);
3044 EXFUN (Fformat, MANY);
3045 EXFUN (Fforward_char, 2);
3046 EXFUN (Fforward_line, 2);
3048 EXFUN (Ffuncall, MANY);
3049 EXFUN (Ffunctionp, 1);
3052 EXFUN (Fget_buffer_process, 1);
3053 EXFUN (Fget_coding_system, 1);
3054 EXFUN (Fget_process, 1);
3055 EXFUN (Fget_range_table, 3);
3056 EXFUN (Fgettext, 1);
3057 EXFUN (Fgoto_char, 2);
3059 EXFUN (Findent_to, 3);
3060 EXFUN (Findirect_function, 1);
3061 EXFUN (Finsert, MANY);
3062 EXFUN (Finsert_buffer_substring, 3);
3063 EXFUN (Finsert_char, 4);
3064 EXFUN (Finsert_file_contents_internal, 7);
3065 EXFUN (Finteractive_p, 0);
3067 EXFUN (Fintern_soft, 2);
3068 EXFUN (Fkey_description, 1);
3069 EXFUN (Fkill_emacs, 1);
3070 EXFUN (Fkill_local_variable, 1);
3072 EXFUN (Flax_plist_get, 3);
3073 EXFUN (Flax_plist_remprop, 2);
3076 EXFUN (Flist, MANY);
3078 EXFUN (Flist_modules, 0);
3079 EXFUN (Fload_module, 3);
3080 EXFUN (Flookup_key, 3);
3082 EXFUN (Fmake_byte_code, MANY);
3083 EXFUN (Fmake_coding_system, 4);
3084 EXFUN (Fmake_glyph_internal, 1);
3085 EXFUN (Fmake_list, 2);
3086 EXFUN (Fmake_marker, 0);
3087 EXFUN (Fmake_range_table, 0);
3088 EXFUN (Fmake_sparse_keymap, 1);
3089 EXFUN (Fmake_string, 2);
3090 EXFUN (Fmake_symbol, 1);
3091 EXFUN (Fmake_vector, 2);
3093 EXFUN (Fmarker_buffer, 1);
3094 EXFUN (Fmarker_position, 1);
3095 EXFUN (Fmatch_beginning, 1);
3096 EXFUN (Fmatch_end, 1);
3101 EXFUN (Fminus, MANY);
3102 EXFUN (Fnarrow_to_region, 3);
3103 EXFUN (Fnconc, MANY);
3104 EXFUN (Fnext_event, 2);
3105 EXFUN (Fnreverse, 1);
3107 EXFUN (Fnumber_to_string, 1);
3108 EXFUN (Fold_assq, 2);
3109 EXFUN (Fold_equal, 2);
3110 EXFUN (Fold_member, 2);
3111 EXFUN (Fold_memq, 2);
3112 EXFUN (Fplist_get, 3);
3113 EXFUN (Fplist_member, 2);
3114 EXFUN (Fplist_put, 3);
3115 EXFUN (Fplus, MANY);
3117 EXFUN (Fpoint_marker, 2);
3118 EXFUN (Fpoint_max, 1);
3119 EXFUN (Fpoint_min, 1);
3120 EXFUN (Fpreceding_char, 1);
3121 EXFUN (Fprefix_numeric_value, 1);
3123 EXFUN (Fprin1_to_string, 2);
3126 EXFUN (Fprocess_status, 1);
3127 EXFUN (Fprogn, UNEVALLED);
3128 EXFUN (Fprovide, 1);
3130 EXFUN (Fput_range_table, 4);
3131 EXFUN (Fput_text_property, 5);
3135 EXFUN (Fread_key_sequence, 3);
3136 EXFUN (Freally_free, 1);
3138 EXFUN (Fremassq, 2);
3139 EXFUN (Freplace_list, 2);
3140 EXFUN (Fselected_frame, 1);
3142 EXFUN (Fset_coding_category_system, 2);
3143 EXFUN (Fset_coding_priority_list, 1);
3144 EXFUN (Fset_default, 2);
3145 EXFUN (Fset_marker, 3);
3146 EXFUN (Fset_standard_case_table, 1);
3150 EXFUN (Fsit_for, 2);
3151 EXFUN (Fskip_chars_backward, 3);
3152 EXFUN (Fskip_chars_forward, 3);
3153 EXFUN (Fsleep_for, 1);
3155 EXFUN (Fspecifier_spec_list, 4);
3156 EXFUN (Fstring_equal, 2);
3157 EXFUN (Fstring_lessp, 2);
3158 EXFUN (Fstring_match, 4);
3159 EXFUN (Fstring_to_number, 2);
3161 EXFUN (Fsubr_max_args, 1);
3162 EXFUN (Fsubr_min_args, 1);
3163 EXFUN (Fsubsidiary_coding_system, 2);
3164 EXFUN (Fsubstitute_command_keys, 1);
3165 EXFUN (Fsubstitute_in_file_name, 1);
3166 EXFUN (Fsubstring, 3);
3167 EXFUN (Fsymbol_function, 1);
3168 EXFUN (Fsymbol_name, 1);
3169 EXFUN (Fsymbol_plist, 1);
3170 EXFUN (Fsymbol_value, 1);
3171 EXFUN (Fsystem_name, 0);
3173 EXFUN (Ftimes, MANY);
3174 EXFUN (Ftruncate, 1);
3175 EXFUN (Fundo_boundary, 0);
3176 EXFUN (Funhandled_file_name_directory, 1);
3177 EXFUN (Funlock_buffer, 0);
3179 EXFUN (Fupcase_initials, 2);
3180 EXFUN (Fupcase_initials_region, 3);
3181 EXFUN (Fupcase_region, 3);
3182 EXFUN (Fuser_home_directory, 0);
3183 EXFUN (Fuser_login_name, 1);
3184 EXFUN (Fvector, MANY);
3185 EXFUN (Fverify_visited_file_modtime, 1);
3186 EXFUN (Fvertical_motion, 3);
3189 /*--------------- prototypes for constant symbols ------------*/
3191 extern Lisp_Object Q_style;
3192 extern Lisp_Object Qactivate_menubar_hook;
3193 extern Lisp_Object Qarith_error;
3194 extern Lisp_Object Qarrayp, Qautoload;
3195 extern Lisp_Object Qbackground, Qbackground_pixmap;
3196 extern Lisp_Object Qbeginning_of_buffer, Qbig5;
3197 extern Lisp_Object Qbitp, Qblinking;
3198 extern Lisp_Object Qbuffer_glyph_p, Qbuffer_live_p, Qbuffer_read_only;
3199 extern Lisp_Object Qbyte_code, Qcall_interactively;
3200 extern Lisp_Object Qcategory_designator_p, Qcategory_table_value_p, Qccl, Qcdr;
3201 extern Lisp_Object Qchar_or_string_p, Qcharacterp;
3202 extern Lisp_Object Qcharset_g0, Qcharset_g1, Qcharset_g2, Qcharset_g3;
3203 extern Lisp_Object Qcircular_list, Qcircular_property_list;
3204 extern Lisp_Object Qcoding_system_error;
3205 extern Lisp_Object Qcolor_pixmap_image_instance_p;
3206 extern Lisp_Object Qcommandp, Qcompletion_ignore_case;
3207 extern Lisp_Object Qconsole_live_p, Qconst_specifier, Qcr;
3208 extern Lisp_Object Qcrlf, Qcurrent_menubar, Qctext;
3209 extern Lisp_Object Qcyclic_variable_indirection, Qdecode;
3210 extern Lisp_Object Qdefun, Qdevice_live_p;
3211 extern Lisp_Object Qdim, Qdisabled, Qdisplay_table;
3212 extern Lisp_Object Qdomain_error;
3213 extern Lisp_Object Qediting_error;
3214 extern Lisp_Object Qencode, Qend_of_buffer, Qend_of_file, Qend_open;
3215 extern Lisp_Object Qeol_cr, Qeol_crlf, Qeol_lf, Qeol_type;
3216 extern Lisp_Object Qerror, Qerror_conditions, Qerror_message, Qescape_quoted;
3217 extern Lisp_Object Qevent_live_p, Qexit, Qextent_live_p;
3218 extern Lisp_Object Qexternal_debugging_output, Qfeaturep;
3219 extern Lisp_Object Qfile_error;
3220 extern Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output;
3221 extern Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output, Qforeground;
3222 extern Lisp_Object Qformat, Qframe_live_p;
3223 extern Lisp_Object Qicon_glyph_p, Qidentity;
3224 extern Lisp_Object Qinhibit_quit, Qinhibit_read_only;
3225 extern Lisp_Object Qinput_charset_conversion;
3226 extern Lisp_Object Qinteger_char_or_marker_p, Qinteger_or_char_p;
3227 extern Lisp_Object Qinteger_or_marker_p, Qintegerp, Qinteractive;
3228 extern Lisp_Object Qinternal_error, Qinvalid_argument;
3229 extern Lisp_Object Qinvalid_change, Qinvalid_function, Qinvalid_operation;
3230 extern Lisp_Object Qinvalid_read_syntax, Qinvalid_state;
3231 extern Lisp_Object Qio_error;
3232 extern Lisp_Object Qiso2022;
3233 extern Lisp_Object Qlambda, Qlayout;
3234 extern Lisp_Object Qlf;
3235 extern Lisp_Object Qlist_formation_error;
3236 extern Lisp_Object Qlistp, Qload, Qlock_shift, Qmacro;
3237 extern Lisp_Object Qmakunbound, Qmalformed_list, Qmalformed_property_list;
3238 extern Lisp_Object Qmark;
3239 extern Lisp_Object Qmnemonic;
3240 extern Lisp_Object Qmono_pixmap_image_instance_p;
3241 extern Lisp_Object Qmouse_leave_buffer_hook;
3242 extern Lisp_Object Qnas, Qnatnump, Qnative_layout;
3243 extern Lisp_Object Qno_ascii_cntl, Qno_ascii_eol, Qno_catch;
3244 extern Lisp_Object Qno_conversion, Qno_iso6429;
3245 extern Lisp_Object Qnothing_image_instance_p;
3246 extern Lisp_Object Qnumber_char_or_marker_p, Qnumberp;
3247 extern Lisp_Object Qoutput_charset_conversion;
3248 extern Lisp_Object Qoverflow_error, Qpoint, Qpointer_glyph_p;
3249 extern Lisp_Object Qpointer_image_instance_p, Qpost_read_conversion;
3250 extern Lisp_Object Qpre_write_conversion, Qprint_length;
3251 extern Lisp_Object Qprint_string_length, Qprogn, Qquit;
3252 extern Lisp_Object Qquote, Qrange_error, Qread_char;
3253 extern Lisp_Object Qread_from_minibuffer, Qreally_early_error_handler;
3254 extern Lisp_Object Qregion_beginning, Qregion_end;
3255 extern Lisp_Object Qrun_hooks, Qsans_modifiers;
3256 extern Lisp_Object Qsave_buffers_kill_emacs;
3257 extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo;
3258 extern Lisp_Object Qsequencep, Qset, Qsetting_constant;
3259 extern Lisp_Object Qseven, Qshift_jis, Qshort;
3260 extern Lisp_Object Qsingularity_error;
3261 extern Lisp_Object Qstandard_input, Qstandard_output;
3262 extern Lisp_Object Qstart_open;
3263 extern Lisp_Object Qstring_lessp, Qsubwindow;
3264 extern Lisp_Object Qsubwindow_image_instance_p;
3265 extern Lisp_Object Qsyntax_error, Qt;
3266 extern Lisp_Object Qtext_image_instance_p;
3267 extern Lisp_Object Qtop_level;
3268 extern Lisp_Object Qtrue_list_p;
3269 extern Lisp_Object Qunbound, Qunderflow_error;
3271 extern Lisp_Object Qunloaded;
3273 extern Lisp_Object Qunderline, Quser_files_and_directories;
3274 extern Lisp_Object Qvalues;
3275 extern Lisp_Object Qvariable_documentation, Qvariable_domain;
3276 extern Lisp_Object Qvoid_function, Qvoid_variable;
3277 extern Lisp_Object Qwindow_live_p, Qwrong_number_of_arguments;
3278 extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p;
3279 extern Lisp_Object Qgtk;
3281 #define SYMBOL(fou) extern Lisp_Object fou
3282 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
3283 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
3284 extern Lisp_Object tout_le_monde
3286 #include "general-slots.h"
3289 #undef SYMBOL_KEYWORD
3290 #undef SYMBOL_GENERAL
3292 /*--------------- prototypes for variables of type Lisp_Object ------------*/
3294 extern Lisp_Object Vactivate_menubar_hook;
3295 extern Lisp_Object Vautoload_queue, Vblank_menubar;
3296 extern Lisp_Object Vcharset_ascii, Vcharset_composite, Vcharset_control_1;
3297 extern Lisp_Object Vcharset_latin_iso8859_1, Vcharset_greek_iso8859_7;
3298 extern Lisp_Object Vcharset_cyrillic_iso8859_5, Vcharset_hebrew_iso8859_8;
3299 extern Lisp_Object Vcharset_thai_tis620, Vcharset_katakana_jisx0201;
3300 extern Lisp_Object Vcoding_system_for_read, Vcoding_system_for_write;
3301 extern Lisp_Object Vcoding_system_hash_table, Vcommand_history;
3302 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory;
3303 extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory;
3304 extern Lisp_Object Vconsole_list, Vcontrolling_terminal;
3305 extern Lisp_Object Vcurrent_compiled_function_annotation, Vcurrent_load_list;
3306 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory;
3307 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook;
3308 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name;
3309 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version;
3310 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path;
3311 extern Lisp_Object Vexecuting_macro, Vfeatures, Vfile_domain;
3312 extern Lisp_Object Vfile_name_coding_system, Vinhibit_quit;
3313 extern Lisp_Object Vinvocation_directory, Vinvocation_name;
3314 extern Lisp_Object Vkeyboard_coding_system, Vlast_command, Vlast_command_char;
3315 extern Lisp_Object Vlast_command_event, Vlast_input_event;
3316 extern Lisp_Object Vload_file_name_internal;
3317 extern Lisp_Object Vload_file_name_internal_the_purecopy, Vload_history;
3318 extern Lisp_Object Vload_path, Vmark_even_if_inactive, Vmenubar_configuration;
3319 extern Lisp_Object Vminibuf_preprompt, Vminibuf_prompt, Vminibuffer_zero;
3320 extern Lisp_Object Vmodule_directory, Vmswindows_downcase_file_names;
3321 extern Lisp_Object Vmswindows_get_true_file_attributes, Vobarray;
3322 extern Lisp_Object Vprint_length, Vprint_level, Vprocess_environment;
3323 extern Lisp_Object Vquit_flag;
3324 extern Lisp_Object Vrecent_keys_ring, Vshell_file_name, Vsite_directory;
3325 extern Lisp_Object Vsite_module_directory;
3326 extern Lisp_Object Vstandard_input, Vstandard_output, Vstdio_str;
3327 extern Lisp_Object Vsynchronous_sounds, Vsystem_name, Vterminal_coding_system;
3328 extern Lisp_Object Vthis_command_keys, Vunread_command_event;
3329 extern Lisp_Object Vx_initial_argv_list;
3331 #endif /* INCLUDED_lisp_h_ */