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