(PC-do-completion): Do not forget to use `pred' as the default-directory
[emacs.git] / src / lisp.h
blobdf22444560bc1498413267e6e2dcb66e58a2dde8
1 /* Fundamental definitions for GNU Emacs Lisp interpreter.
2 Copyright (C) 1985,86,87,93,94,95,97,98,1999,2000, 2001, 2002, 2003
3 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #ifndef EMACS_LISP_H
23 #define EMACS_LISP_H
25 /* Declare the prototype for a general external function. */
26 #if defined (PROTOTYPES) || defined (WINDOWSNT)
27 #define P_(proto) proto
28 #else
29 #define P_(proto) ()
30 #endif
32 #if 0
33 /* Define this temporarily to hunt a bug. If defined, the size of
34 strings is redundantly recorded in sdata structures so that it can
35 be compared to the sizes recorded in Lisp strings. */
37 #define GC_CHECK_STRING_BYTES 1
38 #endif /* 0 */
41 /* These are default choices for the types to use. */
42 #ifdef _LP64
43 #ifndef EMACS_INT
44 #define EMACS_INT long
45 #define BITS_PER_EMACS_INT BITS_PER_LONG
46 #endif
47 #ifndef EMACS_UINT
48 #define EMACS_UINT unsigned long
49 #endif
50 #else /* not _LP64 */
51 #ifndef EMACS_INT
52 #define EMACS_INT int
53 #define BITS_PER_EMACS_INT BITS_PER_INT
54 #endif
55 #ifndef EMACS_UINT
56 #define EMACS_UINT unsigned int
57 #endif
58 #endif
60 /* Extra internal type checking? */
61 extern int suppress_checking;
62 extern void die P_((const char *, const char *, int));
64 #ifdef ENABLE_CHECKING
66 #define CHECK(check,msg) (((check) || suppress_checking \
67 ? (void) 0 \
68 : die ((msg), __FILE__, __LINE__)), \
71 /* Let's get some compile-time checking too. */
72 #undef NO_UNION_TYPE
74 #else
76 /* Produce same side effects and result, but don't complain. */
77 #define CHECK(check,msg) ((check),0)
79 #endif
81 /* Used for making sure that Emacs is compilable in all
82 configurations. */
84 #ifdef USE_LISP_UNION_TYPE
85 #undef NO_UNION_TYPE
86 #endif
88 /* Define an Emacs version of "assert", since some system ones are
89 flaky. */
90 #ifndef ENABLE_CHECKING
91 #define eassert(X) (void) 0
92 #else /* ENABLE_CHECKING */
93 #if defined (__GNUC__) && __GNUC__ >= 2 && defined (__STDC__)
94 #define eassert(cond) CHECK(cond,"assertion failed: " #cond)
95 #else
96 #define eassert(cond) CHECK(cond,"assertion failed")
97 #endif
98 #endif /* ENABLE_CHECKING */
100 /* Define the fundamental Lisp data structures. */
102 /* This is the set of Lisp data types. */
104 enum Lisp_Type
106 /* Integer. XINT (obj) is the integer value. */
107 Lisp_Int,
109 /* Symbol. XSYMBOL (object) points to a struct Lisp_Symbol. */
110 Lisp_Symbol,
112 /* Miscellaneous. XMISC (object) points to a union Lisp_Misc,
113 whose first member indicates the subtype. */
114 Lisp_Misc,
116 /* String. XSTRING (object) points to a struct Lisp_String.
117 The length of the string, and its contents, are stored therein. */
118 Lisp_String,
120 /* Vector of Lisp objects, or something resembling it.
121 XVECTOR (object) points to a struct Lisp_Vector, which contains
122 the size and contents. The size field also contains the type
123 information, if it's not a real vector object. */
124 Lisp_Vectorlike,
126 /* Cons. XCONS (object) points to a struct Lisp_Cons. */
127 Lisp_Cons,
129 Lisp_Float,
131 /* This is not a type code. It is for range checking. */
132 Lisp_Type_Limit
135 /* This is the set of data types that share a common structure.
136 The first member of the structure is a type code from this set.
137 The enum values are arbitrary, but we'll use large numbers to make it
138 more likely that we'll spot the error if a random word in memory is
139 mistakenly interpreted as a Lisp_Misc. */
140 enum Lisp_Misc_Type
142 Lisp_Misc_Free = 0x5eab,
143 Lisp_Misc_Marker,
144 Lisp_Misc_Intfwd,
145 Lisp_Misc_Boolfwd,
146 Lisp_Misc_Objfwd,
147 Lisp_Misc_Buffer_Objfwd,
148 Lisp_Misc_Buffer_Local_Value,
149 Lisp_Misc_Some_Buffer_Local_Value,
150 Lisp_Misc_Overlay,
151 Lisp_Misc_Kboard_Objfwd,
152 Lisp_Misc_Save_Value,
153 /* Currently floats are not a misc type,
154 but let's define this in case we want to change that. */
155 Lisp_Misc_Float,
156 /* This is not a type code. It is for range checking. */
157 Lisp_Misc_Limit
160 #ifndef GCTYPEBITS
161 #define GCTYPEBITS 3
162 #endif
164 /* These values are overridden by the m- file on some machines. */
165 #ifndef VALBITS
166 #define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
167 #endif
169 #ifndef NO_UNION_TYPE
171 #ifndef WORDS_BIG_ENDIAN
173 /* Definition of Lisp_Object for little-endian machines. */
175 typedef
176 union Lisp_Object
178 /* Used for comparing two Lisp_Objects;
179 also, positive integers can be accessed fast this way. */
180 EMACS_INT i;
182 struct
184 EMACS_INT val : VALBITS;
185 EMACS_UINT type : GCTYPEBITS;
186 } s;
187 struct
189 EMACS_UINT val : VALBITS;
190 EMACS_UINT type : GCTYPEBITS;
191 } u;
192 struct
194 EMACS_UINT val : VALBITS;
195 enum Lisp_Type type : GCTYPEBITS;
196 } gu;
198 Lisp_Object;
200 #else /* If WORDS_BIG_ENDIAN */
202 typedef
203 union Lisp_Object
205 /* Used for comparing two Lisp_Objects;
206 also, positive integers can be accessed fast this way. */
207 EMACS_INT i;
209 struct
211 EMACS_UINT type : GCTYPEBITS;
212 EMACS_INT val : VALBITS;
213 } s;
214 struct
216 EMACS_UINT type : GCTYPEBITS;
217 EMACS_UINT val : VALBITS;
218 } u;
219 struct
221 enum Lisp_Type type : GCTYPEBITS;
222 EMACS_UINT val : VALBITS;
223 } gu;
225 Lisp_Object;
227 #endif /* WORDS_BIG_ENDIAN */
229 #ifdef __GNUC__
230 static __inline__ Lisp_Object
231 LISP_MAKE_RVALUE (Lisp_Object o)
233 return o;
235 #else
236 /* This isn't quite right - it keeps the argument as an lvalue.
237 Making it const via casting would help avoid code actually
238 modifying the location in question, but the casting could cover
239 other type-related bugs. */
240 #define LISP_MAKE_RVALUE(o) (o)
241 #endif
243 #endif /* NO_UNION_TYPE */
246 /* If union type is not wanted, define Lisp_Object as just a number. */
248 #ifdef NO_UNION_TYPE
249 #define Lisp_Object EMACS_INT
250 #define LISP_MAKE_RVALUE(o) (0+(o))
251 #endif /* NO_UNION_TYPE */
253 #ifndef VALMASK
254 #define VALMASK ((((EMACS_INT) 1)<<VALBITS) - 1)
255 #endif
256 #define GCTYPEMASK ((((EMACS_INT) 1)<<GCTYPEBITS) - 1)
258 /* Two flags that are set during GC. On some machines, these flags
259 are defined differently by the m- file. */
261 /* This is set in the car of a cons to indicate it is marked.
262 Likewise in the type slot of a float and in the size slot of strings. */
264 #ifndef MARKBIT
265 #define MARKBIT ((EMACS_INT) ((EMACS_UINT) 1 << (VALBITS + GCTYPEBITS - 1)))
266 #endif /*MARKBIT */
268 /* In the size word of a vector, this bit means the vector has been marked. */
270 #ifndef ARRAY_MARK_FLAG
271 #define ARRAY_MARK_FLAG ((MARKBIT >> 1) & ~MARKBIT)
272 #endif /* no ARRAY_MARK_FLAG */
274 /* In the size word of a struct Lisp_Vector, this bit means it's really
275 some other vector-like object. */
276 #ifndef PSEUDOVECTOR_FLAG
277 #define PSEUDOVECTOR_FLAG ((ARRAY_MARK_FLAG >> 1) & ~ARRAY_MARK_FLAG)
278 #endif
280 /* In a pseudovector, the size field actually contains a word with one
281 PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to
282 indicate the actual type. */
283 enum pvec_type
285 PVEC_NORMAL_VECTOR = 0,
286 PVEC_PROCESS = 0x200,
287 PVEC_FRAME = 0x400,
288 PVEC_COMPILED = 0x800,
289 PVEC_WINDOW = 0x1000,
290 PVEC_WINDOW_CONFIGURATION = 0x2000,
291 PVEC_SUBR = 0x4000,
292 PVEC_CHAR_TABLE = 0x8000,
293 PVEC_BOOL_VECTOR = 0x10000,
294 PVEC_BUFFER = 0x20000,
295 PVEC_HASH_TABLE = 0x40000,
296 PVEC_TYPE_MASK = 0x7fe00
298 #if 0 /* This is used to make the value of PSEUDOVECTOR_FLAG available to
299 GDB. It doesn't work on OS Alpha. Moved to a variable in
300 emacs.c. */
301 PVEC_FLAG = PSEUDOVECTOR_FLAG
302 #endif
305 /* For convenience, we also store the number of elements in these bits. */
306 #define PSEUDOVECTOR_SIZE_MASK 0x1ff
308 /* These macros extract various sorts of values from a Lisp_Object.
309 For example, if tem is a Lisp_Object whose type is Lisp_Cons,
310 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */
312 #ifdef NO_UNION_TYPE
314 /* One need to override this if there must be high bits set in data space
315 (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work
316 on all machines, but would penalize machines which don't need it)
318 #ifndef XTYPE
319 #define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) >> VALBITS))
320 #endif
322 #ifndef XSETTYPE
323 #define XSETTYPE(a, b) ((a) = XUINT (a) | ((EMACS_INT)(b) << VALBITS))
324 #endif
326 /* For integers known to be positive, XFASTINT provides fast retrieval
327 and XSETFASTINT provides fast storage. This takes advantage of the
328 fact that Lisp_Int is 0.
329 Beware: XFASTINT applied to a non-positive integer or to something
330 else than an integer should return something that preserves all the
331 info that was in the Lisp_Object, because it is used in EQ. */
332 #define XFASTINT(a) ((a) + 0)
333 #define XSETFASTINT(a, b) ((a) = (b))
335 /* Extract the value of a Lisp_Object as a signed integer. */
337 #ifndef XINT /* Some machines need to do this differently. */
338 #define XINT(a) ((EMACS_INT) (((a) << (BITS_PER_EMACS_INT - VALBITS)) \
339 >> (BITS_PER_EMACS_INT - VALBITS)))
340 #endif
342 /* Extract the value as an unsigned integer. This is a basis
343 for extracting it as a pointer to a structure in storage. */
345 #ifndef XUINT
346 #define XUINT(a) ((EMACS_UINT) ((a) & VALMASK))
347 #endif
349 #ifndef XSET
350 #define XSET(var, type, ptr) \
351 ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK))
352 #endif
354 /* Convert a C integer into a Lisp_Object integer. */
356 #define make_number(N) \
357 ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
359 /* During garbage collection, XGCTYPE must be used for extracting types
360 so that the mark bit is ignored. XMARKBIT accesses the markbit.
361 Markbits are used only in particular slots of particular structure types.
362 Other markbits are always zero.
363 Outside of garbage collection, all mark bits are always zero. */
365 #ifndef XGCTYPE
366 #define XGCTYPE(a) ((enum Lisp_Type) (((a) >> VALBITS) & GCTYPEMASK))
367 #endif
369 #endif /* NO_UNION_TYPE */
371 #ifndef NO_UNION_TYPE
373 #define XTYPE(a) ((enum Lisp_Type) (a).u.type)
374 #define XSETTYPE(a, b) ((a).u.type = (char) (b))
376 /* For integers known to be positive, XFASTINT provides fast retrieval
377 and XSETFASTINT provides fast storage. This takes advantage of the
378 fact that Lisp_Int is 0. */
379 #define XFASTINT(a) ((a).i + 0)
380 #define XSETFASTINT(a, b) ((a).i = (b))
382 #ifdef EXPLICIT_SIGN_EXTEND
383 /* Make sure we sign-extend; compilers have been known to fail to do so. */
384 #define XINT(a) (((a).i << (BITS_PER_EMACS_INT - VALBITS)) \
385 >> (BITS_PER_EMACS_INT - VALBITS))
386 #else
387 #define XINT(a) ((a).s.val)
388 #endif /* EXPLICIT_SIGN_EXTEND */
390 #define XUINT(a) ((a).u.val)
392 #define XSET(var, vartype, ptr) \
393 (((var).s.val = ((EMACS_INT) (ptr))), ((var).s.type = ((char) (vartype))))
395 #if __GNUC__ >= 2 && defined (__OPTIMIZE__)
396 #define make_number(N) \
397 (__extension__ ({ Lisp_Object _l; _l.s.val = (N); _l.s.type = Lisp_Int; _l; }))
398 #else
399 extern Lisp_Object make_number ();
400 #endif
402 /* During garbage collection, XGCTYPE must be used for extracting types
403 so that the mark bit is ignored. XMARKBIT access the markbit.
404 Markbits are used only in particular slots of particular structure types.
405 Other markbits are always zero.
406 Outside of garbage collection, all mark bits are always zero. */
408 #define XGCTYPE(a) ((a).gu.type)
410 #endif /* NO_UNION_TYPE */
412 #ifndef XPNTR
413 #ifdef HAVE_SHM
414 /* In this representation, data is found in two widely separated segments. */
415 extern size_t pure_size;
416 #define XPNTR(a) \
417 (XUINT (a) | (XUINT (a) > pure_size ? DATA_SEG_BITS : PURE_SEG_BITS))
418 #else /* not HAVE_SHM */
419 #ifdef DATA_SEG_BITS
420 /* This case is used for the rt-pc.
421 In the diffs I was given, it checked for ptr = 0
422 and did not adjust it in that case.
423 But I don't think that zero should ever be found
424 in a Lisp object whose data type says it points to something. */
425 #define XPNTR(a) (XUINT (a) | DATA_SEG_BITS)
426 #else
427 #define XPNTR(a) XUINT (a)
428 #endif
429 #endif /* not HAVE_SHM */
430 #endif /* no XPNTR */
432 /* Largest and smallest representable fixnum values. These are the C
433 values. */
435 #define MOST_NEGATIVE_FIXNUM - ((EMACS_INT) 1 << (VALBITS - 1))
436 #define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << (VALBITS - 1)) - 1)
438 /* Value is non-zero if C integer I doesn't fit into a Lisp fixnum. */
440 #define FIXNUM_OVERFLOW_P(i) \
441 ((EMACS_INT)(i) > MOST_POSITIVE_FIXNUM \
442 || (EMACS_INT) (i) < MOST_NEGATIVE_FIXNUM)
444 /* Extract a value or address from a Lisp_Object. */
446 #define XCONS(a) (eassert (GC_CONSP(a)),(struct Lisp_Cons *) XPNTR(a))
447 #define XVECTOR(a) (eassert (GC_VECTORLIKEP(a)),(struct Lisp_Vector *) XPNTR(a))
448 #define XSTRING(a) (eassert (GC_STRINGP(a)),(struct Lisp_String *) XPNTR(a))
449 #define XSYMBOL(a) (eassert (GC_SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a))
450 #define XFLOAT(a) (eassert (GC_FLOATP(a)),(struct Lisp_Float *) XPNTR(a))
452 /* Misc types. */
454 #define XMISC(a) ((union Lisp_Misc *) XPNTR(a))
455 #define XMISCTYPE(a) (XMARKER (a)->type)
456 #define XMARKER(a) (&(XMISC(a)->u_marker))
457 #define XINTFWD(a) (&(XMISC(a)->u_intfwd))
458 #define XBOOLFWD(a) (&(XMISC(a)->u_boolfwd))
459 #define XOBJFWD(a) (&(XMISC(a)->u_objfwd))
460 #define XBUFFER_OBJFWD(a) (&(XMISC(a)->u_buffer_objfwd))
461 #define XBUFFER_LOCAL_VALUE(a) (&(XMISC(a)->u_buffer_local_value))
462 #define XOVERLAY(a) (&(XMISC(a)->u_overlay))
463 #define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd))
464 #define XSAVE_VALUE(a) (&(XMISC(a)->u_save_value))
466 /* Pseudovector types. */
468 #define XPROCESS(a) (eassert (GC_PROCESSP(a)),(struct Lisp_Process *) XPNTR(a))
469 #define XWINDOW(a) (eassert (GC_WINDOWP(a)),(struct window *) XPNTR(a))
470 #define XSUBR(a) (eassert (GC_SUBRP(a)),(struct Lisp_Subr *) XPNTR(a))
471 #define XBUFFER(a) (eassert (GC_BUFFERP(a)),(struct buffer *) XPNTR(a))
472 #define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a))
473 #define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a))
475 /* Construct a Lisp_Object from a value or address. */
477 #define XSETINT(a, b) (a) = make_number (b)
478 #define XSETCONS(a, b) XSET (a, Lisp_Cons, b)
479 #define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b)
480 #define XSETSTRING(a, b) XSET (a, Lisp_String, b)
481 #define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b)
482 #define XSETFLOAT(a, b) XSET (a, Lisp_Float, b)
484 /* Misc types. */
486 #define XSETMISC(a, b) XSET (a, Lisp_Misc, b)
487 #define XSETMARKER(a, b) (XSETMISC (a, b), XMISCTYPE (a) = Lisp_Misc_Marker)
489 /* Pseudovector types. */
491 #define XSETPSEUDOVECTOR(a, b, code) \
492 (XSETVECTOR (a, b), XVECTOR (a)->size |= PSEUDOVECTOR_FLAG | (code))
493 #define XSETWINDOW_CONFIGURATION(a, b) \
494 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
495 #define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))
496 #define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
497 #define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
498 #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
499 #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
500 #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
501 #define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR))
503 /* Convenience macros for dealing with Lisp arrays. */
505 #define AREF(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX]
506 #define ASET(ARRAY, IDX, VAL) (AREF ((ARRAY), (IDX)) = (VAL))
507 #define ASIZE(ARRAY) XVECTOR ((ARRAY))->size
509 /* Convenience macros for dealing with Lisp strings. */
511 #define SREF(string, index) (XSTRING (string)->data[index] + 0)
512 #define SSET(string, index, new) (XSTRING (string)->data[index] = (new))
513 #define SDATA(string) (XSTRING (string)->data + 0)
514 #define SCHARS(string) (XSTRING (string)->size + 0)
515 #define SBYTES(string) (STRING_BYTES (XSTRING (string)) + 0)
517 #define STRING_SET_CHARS(string, newsize) \
518 (XSTRING (string)->size = (newsize))
520 #define STRING_COPYIN(string, index, new, count) \
521 bcopy (new, XSTRING (string)->data + index, count)
524 /* See the macros in intervals.h. */
526 typedef struct interval *INTERVAL;
528 /* Complain if object is not string or buffer type */
529 #define CHECK_STRING_OR_BUFFER(x) \
530 { if (!STRINGP ((x)) && !BUFFERP ((x))) \
531 x = wrong_type_argument (Qbuffer_or_string_p, (x)); }
533 /* In a cons, the markbit of the car is the gc mark bit */
535 struct Lisp_Cons
537 /* Please do not use the names of these elements in code other
538 than the core lisp implementation. Use XCAR and XCDR below. */
539 #ifdef HIDE_LISP_IMPLEMENTATION
540 Lisp_Object car_, cdr_;
541 #else
542 Lisp_Object car, cdr;
543 #endif
546 /* Take the car or cdr of something known to be a cons cell. */
547 /* The _AS_LVALUE macros shouldn't be used outside of the minimal set
548 of code that has to know what a cons cell looks like. Other code not
549 part of the basic lisp implementation should assume that the car and cdr
550 fields are not accessible as lvalues. (What if we want to switch to
551 a copying collector someday? Cached cons cell field addresses may be
552 invalidated at arbitrary points.) */
553 #ifdef HIDE_LISP_IMPLEMENTATION
554 #define XCAR_AS_LVALUE(c) (XCONS ((c))->car_)
555 #define XCDR_AS_LVALUE(c) (XCONS ((c))->cdr_)
556 #else
557 #define XCAR_AS_LVALUE(c) (XCONS ((c))->car)
558 #define XCDR_AS_LVALUE(c) (XCONS ((c))->cdr)
559 #endif
561 /* Use these from normal code. */
562 #define XCAR(c) LISP_MAKE_RVALUE(XCAR_AS_LVALUE(c))
563 #define XCDR(c) LISP_MAKE_RVALUE(XCDR_AS_LVALUE(c))
565 /* Use these to set the fields of a cons cell.
567 Note that both arguments may refer to the same object, so 'n'
568 should not be read after 'c' is first modified. Also, neither
569 argument should be evaluated more than once; side effects are
570 especially common in the second argument. */
571 #define XSETCAR(c,n) (XCAR_AS_LVALUE(c) = (n))
572 #define XSETCDR(c,n) (XCDR_AS_LVALUE(c) = (n))
574 /* For performance: Fast storage of positive integers into the
575 fields of a cons cell. See above caveats. */
576 #define XSETCARFASTINT(c,n) XSETFASTINT(XCAR_AS_LVALUE(c),(n))
577 #define XSETCDRFASTINT(c,n) XSETFASTINT(XCDR_AS_LVALUE(c),(n))
579 /* Take the car or cdr of something whose type is not known. */
580 #define CAR(c) \
581 (CONSP ((c)) ? XCAR ((c)) \
582 : NILP ((c)) ? Qnil \
583 : wrong_type_argument (Qlistp, (c)))
585 #define CDR(c) \
586 (CONSP ((c)) ? XCDR ((c)) \
587 : NILP ((c)) ? Qnil \
588 : wrong_type_argument (Qlistp, (c)))
590 /* Nonzero if STR is a multibyte string. */
591 #define STRING_MULTIBYTE(STR) \
592 (XSTRING (STR)->size_byte >= 0)
594 /* Return the length in bytes of STR. */
596 #ifdef GC_CHECK_STRING_BYTES
598 struct Lisp_String;
599 extern int string_bytes P_ ((struct Lisp_String *));
600 #define STRING_BYTES(S) string_bytes ((S))
602 #else /* not GC_CHECK_STRING_BYTES */
604 #define STRING_BYTES(STR) \
605 ((STR)->size_byte < 0 ? (STR)->size : (STR)->size_byte)
607 #endif /* not GC_CHECK_STRING_BYTES */
609 /* Mark STR as a unibyte string. */
610 #define STRING_SET_UNIBYTE(STR) (XSTRING (STR)->size_byte = -1)
612 /* Get text properties. */
613 #define STRING_INTERVALS(STR) (XSTRING (STR)->intervals + 0)
615 /* Set text properties. */
616 #define STRING_SET_INTERVALS(STR, INT) (XSTRING (STR)->intervals = (INT))
618 /* In a string or vector, the sign bit of the `size' is the gc mark bit */
620 struct Lisp_String
622 EMACS_INT size;
623 EMACS_INT size_byte;
624 INTERVAL intervals; /* text properties in this string */
625 unsigned char *data;
628 /* If a struct is made to look like a vector, this macro returns the length
629 of the shortest vector that would hold that struct. */
630 #define VECSIZE(type) ((sizeof (type) - (sizeof (struct Lisp_Vector) \
631 - sizeof (Lisp_Object)) \
632 + sizeof(Lisp_Object) - 1) /* round up */ \
633 / sizeof (Lisp_Object))
635 struct Lisp_Vector
637 EMACS_INT size;
638 struct Lisp_Vector *next;
639 Lisp_Object contents[1];
642 /* A char table is a kind of vectorlike, with contents are like a
643 vector but with a few other slots. For some purposes, it makes
644 sense to handle a chartable with type struct Lisp_Vector. An
645 element of a char table can be any Lisp objects, but if it is a sub
646 char-table, we treat it a table that contains information of a
647 group of characters of the same charsets or a specific character of
648 a charset. A sub char-table has the same structure as a char table
649 except for that the former omits several slots at the tail. A sub
650 char table appears only in an element of a char table, and there's
651 no way to access it directly from Emacs Lisp program. */
653 /* This is the number of slots that apply to characters or character
654 sets. The first 128 are for ASCII, the next 128 are for 8-bit
655 European characters, and the last 128 are for multibyte characters.
656 The first 256 are indexed by the code itself, but the last 128 are
657 indexed by (charset-id + 128). */
658 #define CHAR_TABLE_ORDINARY_SLOTS 384
660 /* This is the number of slots that apply to characters of ASCII and
661 8-bit Europeans only. */
662 #define CHAR_TABLE_SINGLE_BYTE_SLOTS 256
664 /* This is the number of slots that every char table must have. This
665 counts the ordinary slots and the top, defalt, parent, and purpose
666 slots. */
667 #define CHAR_TABLE_STANDARD_SLOTS (CHAR_TABLE_ORDINARY_SLOTS + 4)
669 /* This is the number of slots that apply to position-code-1 and
670 position-code-2 of a multibyte character at the 2nd and 3rd level
671 sub char tables respectively. */
672 #define SUB_CHAR_TABLE_ORDINARY_SLOTS 128
674 /* This is the number of slots that every sub char table must have.
675 This counts the ordinary slots and the top and defalt slot. */
676 #define SUB_CHAR_TABLE_STANDARD_SLOTS (SUB_CHAR_TABLE_ORDINARY_SLOTS + 2)
678 /* Return the number of "extra" slots in the char table CT. */
680 #define CHAR_TABLE_EXTRA_SLOTS(CT) \
681 (((CT)->size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
683 /* Almost equivalent to Faref (CT, IDX) with optimization for ASCII
684 and 8-bit Europeans characters. For these characters, do not check
685 validity of CT. Do not follow parent. */
686 #define CHAR_TABLE_REF(CT, IDX) \
687 ((IDX) >= 0 && (IDX) < CHAR_TABLE_SINGLE_BYTE_SLOTS \
688 ? (!NILP (XCHAR_TABLE (CT)->contents[IDX]) \
689 ? XCHAR_TABLE (CT)->contents[IDX] \
690 : XCHAR_TABLE (CT)->defalt) \
691 : Faref (CT, make_number (IDX)))
693 /* Almost equivalent to Faref (CT, IDX) with optimization for ASCII
694 and 8-bit Europeans characters. However, if the result is nil,
695 return IDX.
697 For these characters, do not check validity of CT
698 and do not follow parent. */
699 #define CHAR_TABLE_TRANSLATE(CT, IDX) \
700 ((IDX) < CHAR_TABLE_SINGLE_BYTE_SLOTS \
701 ? (!NILP (XCHAR_TABLE (CT)->contents[IDX]) \
702 ? XINT (XCHAR_TABLE (CT)->contents[IDX]) \
703 : IDX) \
704 : char_table_translate (CT, IDX))
706 /* Equivalent to Faset (CT, IDX, VAL) with optimization for ASCII and
707 8-bit Europeans characters. Do not check validity of CT. */
708 #define CHAR_TABLE_SET(CT, IDX, VAL) \
709 do { \
710 if (XFASTINT (IDX) < CHAR_TABLE_SINGLE_BYTE_SLOTS) \
711 XCHAR_TABLE (CT)->contents[XFASTINT (IDX)] = VAL; \
712 else \
713 Faset (CT, IDX, VAL); \
714 } while (0)
716 struct Lisp_Char_Table
718 /* This is the vector's size field, which also holds the
719 pseudovector type information. It holds the size, too.
720 The size counts the top, defalt, purpose, and parent slots.
721 The last three are not counted if this is a sub char table. */
722 EMACS_INT size;
723 struct Lisp_Vector *next;
724 /* This holds a flag to tell if this is a top level char table (t)
725 or a sub char table (nil). */
726 Lisp_Object top;
727 /* This holds a default value,
728 which is used whenever the value for a specific character is nil. */
729 Lisp_Object defalt;
730 /* This holds an actual value of each element. A sub char table
731 has only SUB_CHAR_TABLE_ORDINARY_SLOTS number of elements. */
732 Lisp_Object contents[CHAR_TABLE_ORDINARY_SLOTS];
734 /* A sub char table doesn't has the following slots. */
736 /* This points to another char table, which we inherit from
737 when the value for a specific character is nil.
738 The `defalt' slot takes precedence over this. */
739 Lisp_Object parent;
740 /* This should be a symbol which says what kind of use
741 this char-table is meant for.
742 Typically now the values can be `syntax-table' and `display-table'. */
743 Lisp_Object purpose;
744 /* These hold additional data. */
745 Lisp_Object extras[1];
748 /* A boolvector is a kind of vectorlike, with contents are like a string. */
749 struct Lisp_Bool_Vector
751 /* This is the vector's size field. It doesn't have the real size,
752 just the subtype information. */
753 EMACS_INT vector_size;
754 struct Lisp_Vector *next;
755 /* This is the size in bits. */
756 EMACS_INT size;
757 /* This contains the actual bits, packed into bytes. */
758 unsigned char data[1];
761 /* This structure describes a built-in function.
762 It is generated by the DEFUN macro only.
763 defsubr makes it into a Lisp object.
765 This type is treated in most respects as a pseudovector,
766 but since we never dynamically allocate or free them,
767 we don't need a next-vector field. */
769 struct Lisp_Subr
771 EMACS_INT size;
772 Lisp_Object (*function) ();
773 short min_args, max_args;
774 char *symbol_name;
775 char *prompt;
776 char *doc;
780 /***********************************************************************
781 Symbols
782 ***********************************************************************/
784 /* Interned state of a symbol. */
786 enum symbol_interned
788 SYMBOL_UNINTERNED = 0,
789 SYMBOL_INTERNED = 1,
790 SYMBOL_INTERNED_IN_INITIAL_OBARRAY = 2
793 /* In a symbol, the markbit of the plist is used as the gc mark bit */
795 struct Lisp_Symbol
797 unsigned gcmarkbit : 1;
799 /* Non-zero means symbol serves as a variable alias. The symbol
800 holding the real value is found in the value slot. */
801 unsigned indirect_variable : 1;
803 /* Non-zero means symbol is constant, i.e. changing its value
804 should signal an error. */
805 unsigned constant : 1;
807 /* Interned state of the symbol. This is an enumerator from
808 enum symbol_interned. */
809 unsigned interned : 2;
811 /* The symbol's name, as a Lisp string.
813 The name "xname" is used to intentionally break code referring to
814 the old field "name" of type pointer to struct Lisp_String. */
815 Lisp_Object xname;
817 /* Value of the symbol or Qunbound if unbound. If this symbol is a
818 defvaralias, `value' contains the symbol for which it is an
819 alias. Use the SYMBOL_VALUE and SET_SYMBOL_VALUE macros to get
820 and set a symbol's value, to take defvaralias into account. */
821 Lisp_Object value;
823 /* Function value of the symbol or Qunbound if not fboundp. */
824 Lisp_Object function;
826 /* The symbol's property list. */
827 Lisp_Object plist;
829 /* Next symbol in obarray bucket, if the symbol is interned. */
830 struct Lisp_Symbol *next;
833 /* Value is name of symbol. */
835 #define SYMBOL_NAME(sym) \
836 LISP_MAKE_RVALUE (XSYMBOL (sym)->xname)
838 /* Value is non-zero if SYM is an interned symbol. */
840 #define SYMBOL_INTERNED_P(sym) \
841 (XSYMBOL (sym)->interned != SYMBOL_UNINTERNED)
843 /* Value is non-zero if SYM is interned in initial_obarray. */
845 #define SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P(sym) \
846 (XSYMBOL (sym)->interned == SYMBOL_INTERNED_IN_INITIAL_OBARRAY)
848 /* Value is non-zero if symbol is considered a constant, i.e. its
849 value cannot be changed (there is an exception for keyword symbols,
850 whose value can be set to the keyword symbol itself). */
852 #define SYMBOL_CONSTANT_P(sym) XSYMBOL (sym)->constant
854 /* Value is the value of SYM, with defvaralias taken into
855 account. */
857 #define SYMBOL_VALUE(sym) \
858 (XSYMBOL (sym)->indirect_variable \
859 ? XSYMBOL (indirect_variable (sym))->value \
860 : XSYMBOL (sym)->value)
862 /* Set SYM's value to VAL, taking defvaralias into account. */
864 #define SET_SYMBOL_VALUE(sym, val) \
865 do { \
866 if (XSYMBOL (sym)->indirect_variable) \
867 XSYMBOL (indirect_variable ((sym)))->value = (val); \
868 else \
869 XSYMBOL (sym)->value = (val); \
870 } while (0)
873 /***********************************************************************
874 Hash Tables
875 ***********************************************************************/
877 /* The structure of a Lisp hash table. */
879 struct Lisp_Hash_Table
881 /* Vector fields. The hash table code doesn't refer to these. */
882 EMACS_INT size;
883 struct Lisp_Vector *vec_next;
885 /* Function used to compare keys. */
886 Lisp_Object test;
888 /* Nil if table is non-weak. Otherwise a symbol describing the
889 weakness of the table. */
890 Lisp_Object weak;
892 /* When the table is resized, and this is an integer, compute the
893 new size by adding this to the old size. If a float, compute the
894 new size by multiplying the old size with this factor. */
895 Lisp_Object rehash_size;
897 /* Resize hash table when number of entries/ table size is >= this
898 ratio, a float. */
899 Lisp_Object rehash_threshold;
901 /* Number of key/value entries in the table. */
902 Lisp_Object count;
904 /* Vector of keys and values. The key of item I is found at index
905 2 * I, the value is found at index 2 * I + 1. */
906 Lisp_Object key_and_value;
908 /* Vector of hash codes.. If hash[I] is nil, this means that that
909 entry I is unused. */
910 Lisp_Object hash;
912 /* Vector used to chain entries. If entry I is free, next[I] is the
913 entry number of the next free item. If entry I is non-free,
914 next[I] is the index of the next entry in the collision chain. */
915 Lisp_Object next;
917 /* Index of first free entry in free list. */
918 Lisp_Object next_free;
920 /* Bucket vector. A non-nil entry is the index of the first item in
921 a collision chain. This vector's size can be larger than the
922 hash table size to reduce collisions. */
923 Lisp_Object index;
925 /* Next weak hash table if this is a weak hash table. The head
926 of the list is in Vweak_hash_tables. */
927 Lisp_Object next_weak;
929 /* User-supplied hash function, or nil. */
930 Lisp_Object user_hash_function;
932 /* User-supplied key comparison function, or nil. */
933 Lisp_Object user_cmp_function;
935 /* C function to compare two keys. */
936 int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object,
937 unsigned, Lisp_Object, unsigned));
939 /* C function to compute hash code. */
940 unsigned (* hashfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object));
944 #define XHASH_TABLE(OBJ) \
945 ((struct Lisp_Hash_Table *) XPNTR (OBJ))
947 #define XSET_HASH_TABLE(VAR, PTR) \
948 (XSETPSEUDOVECTOR (VAR, PTR, PVEC_HASH_TABLE))
950 #define HASH_TABLE_P(OBJ) PSEUDOVECTORP (OBJ, PVEC_HASH_TABLE)
951 #define GC_HASH_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_HASH_TABLE)
953 #define CHECK_HASH_TABLE(x) \
954 do \
956 if (!HASH_TABLE_P ((x))) \
957 x = wrong_type_argument (Qhash_table_p, (x)); \
959 while (0)
961 /* Value is the key part of entry IDX in hash table H. */
963 #define HASH_KEY(H, IDX) AREF ((H)->key_and_value, 2 * (IDX))
965 /* Value is the value part of entry IDX in hash table H. */
967 #define HASH_VALUE(H, IDX) AREF ((H)->key_and_value, 2 * (IDX) + 1)
969 /* Value is the index of the next entry following the one at IDX
970 in hash table H. */
972 #define HASH_NEXT(H, IDX) AREF ((H)->next, (IDX))
974 /* Value is the hash code computed for entry IDX in hash table H. */
976 #define HASH_HASH(H, IDX) AREF ((H)->hash, (IDX))
978 /* Value is the index of the element in hash table H that is the
979 start of the collision list at index IDX in the index vector of H. */
981 #define HASH_INDEX(H, IDX) AREF ((H)->index, (IDX))
983 /* Value is the size of hash table H. */
985 #define HASH_TABLE_SIZE(H) XVECTOR ((H)->next)->size
987 /* Default size for hash tables if not specified. */
989 #define DEFAULT_HASH_SIZE 65
991 /* Default threshold specifying when to resize a hash table. The
992 value gives the ratio of current entries in the hash table and the
993 size of the hash table. */
995 #define DEFAULT_REHASH_THRESHOLD 0.8
997 /* Default factor by which to increase the size of a hash table. */
999 #define DEFAULT_REHASH_SIZE 1.5
1002 /* These structures are used for various misc types. */
1004 /* A miscellaneous object, when it's on the free list. */
1005 struct Lisp_Free
1007 int type : 16; /* = Lisp_Misc_Free */
1008 unsigned gcmarkbit : 1;
1009 int spacer : 15;
1010 union Lisp_Misc *chain;
1013 struct Lisp_Marker
1015 int type : 16; /* = Lisp_Misc_Marker */
1016 unsigned gcmarkbit : 1;
1017 int spacer : 14;
1018 /* 1 means normal insertion at the marker's position
1019 leaves the marker after the inserted text. */
1020 unsigned int insertion_type : 1;
1021 /* This is the buffer that the marker points into,
1022 or 0 if it points nowhere. */
1023 struct buffer *buffer;
1025 /* The remaining fields are meaningless in a marker that
1026 does not point anywhere. */
1028 /* For markers that point somewhere,
1029 this is used to chain of all the markers in a given buffer. */
1030 struct Lisp_Marker *next;
1031 /* This is the char position where the marker points. */
1032 EMACS_INT charpos;
1033 /* This is the byte position. */
1034 EMACS_INT bytepos;
1037 /* Forwarding pointer to an int variable.
1038 This is allowed only in the value cell of a symbol,
1039 and it means that the symbol's value really lives in the
1040 specified int variable. */
1041 struct Lisp_Intfwd
1043 int type : 16; /* = Lisp_Misc_Intfwd */
1044 unsigned gcmarkbit : 1;
1045 int spacer : 15;
1046 EMACS_INT *intvar;
1049 /* Boolean forwarding pointer to an int variable.
1050 This is like Lisp_Intfwd except that the ostensible
1051 "value" of the symbol is t if the int variable is nonzero,
1052 nil if it is zero. */
1053 struct Lisp_Boolfwd
1055 int type : 16; /* = Lisp_Misc_Boolfwd */
1056 unsigned gcmarkbit : 1;
1057 int spacer : 15;
1058 int *boolvar;
1061 /* Forwarding pointer to a Lisp_Object variable.
1062 This is allowed only in the value cell of a symbol,
1063 and it means that the symbol's value really lives in the
1064 specified variable. */
1065 struct Lisp_Objfwd
1067 int type : 16; /* = Lisp_Misc_Objfwd */
1068 unsigned gcmarkbit : 1;
1069 int spacer : 15;
1070 Lisp_Object *objvar;
1073 /* Like Lisp_Objfwd except that value lives in a slot in the
1074 current buffer. Value is byte index of slot within buffer. */
1075 struct Lisp_Buffer_Objfwd
1077 int type : 16; /* = Lisp_Misc_Buffer_Objfwd */
1078 unsigned gcmarkbit : 1;
1079 int spacer : 15;
1080 int offset;
1083 /* struct Lisp_Buffer_Local_Value is used in a symbol value cell when
1084 the symbol has buffer-local or frame-local bindings. (Exception:
1085 some buffer-local variables are built-in, with their values stored
1086 in the buffer structure itself. They are handled differently,
1087 using struct Lisp_Buffer_Objfwd.)
1089 The `realvalue' slot holds the variable's current value, or a
1090 forwarding pointer to where that value is kept. This value is the
1091 one that corresponds to the loaded binding. To read or set the
1092 variable, you must first make sure the right binding is loaded;
1093 then you can access the value in (or through) `realvalue'.
1095 `buffer' and `frame' are the buffer and frame for which the loaded
1096 binding was found. If those have changed, to make sure the right
1097 binding is loaded it is necessary to find which binding goes with
1098 the current buffer and selected frame, then load it. To load it,
1099 first unload the previous binding, then copy the value of the new
1100 binding into `realvalue' (or through it). Also update
1101 LOADED-BINDING to point to the newly loaded binding.
1103 Lisp_Misc_Buffer_Local_Value and Lisp_Misc_Some_Buffer_Local_Value
1104 both use this kind of structure. With the former, merely setting
1105 the variable creates a local binding for the current buffer. With
1106 the latter, setting the variable does not do that; only
1107 make-local-variable does that. */
1109 struct Lisp_Buffer_Local_Value
1111 int type : 16; /* = Lisp_Misc_Buffer_Local_Value
1112 or Lisp_Misc_Some_Buffer_Local_Value */
1113 unsigned gcmarkbit : 1;
1114 int spacer : 12;
1116 /* 1 means this variable is allowed to have frame-local bindings,
1117 so check for them when looking for the proper binding. */
1118 unsigned int check_frame : 1;
1119 /* 1 means that the binding now loaded was found
1120 as a local binding for the buffer in the `buffer' slot. */
1121 unsigned int found_for_buffer : 1;
1122 /* 1 means that the binding now loaded was found
1123 as a local binding for the frame in the `frame' slot. */
1124 unsigned int found_for_frame : 1;
1125 Lisp_Object realvalue;
1126 /* The buffer and frame for which the loaded binding was found. */
1127 Lisp_Object buffer, frame;
1129 /* A cons cell, (LOADED-BINDING . DEFAULT-VALUE).
1131 LOADED-BINDING is the binding now loaded. It is a cons cell
1132 whose cdr is the binding's value. The cons cell may be an
1133 element of a buffer's local-variable alist, or an element of a
1134 frame's parameter alist, or it may be this cons cell.
1136 DEFAULT-VALUE is the variable's default value, seen when the
1137 current buffer and selected frame do not have their own
1138 bindings for the variable. When the default binding is loaded,
1139 LOADED-BINDING is actually this very cons cell; thus, its car
1140 points to itself. */
1141 Lisp_Object cdr;
1144 /* START and END are markers in the overlay's buffer, and
1145 PLIST is the overlay's property list. */
1146 struct Lisp_Overlay
1148 int type : 16; /* = Lisp_Misc_Overlay */
1149 unsigned gcmarkbit : 1;
1150 int spacer : 15;
1151 struct Lisp_Overlay *next;
1152 Lisp_Object start, end, plist;
1155 /* Like Lisp_Objfwd except that value lives in a slot in the
1156 current kboard. */
1157 struct Lisp_Kboard_Objfwd
1159 int type : 16; /* = Lisp_Misc_Kboard_Objfwd */
1160 unsigned gcmarkbit : 1;
1161 int spacer : 15;
1162 int offset;
1165 /* Hold a C pointer for later use.
1166 This type of object is used in the arg to record_unwind_protect. */
1167 struct Lisp_Save_Value
1169 int type : 16; /* = Lisp_Misc_Save_Value */
1170 unsigned gcmarkbit : 1;
1171 int spacer : 15;
1172 void *pointer;
1173 int integer;
1177 /* To get the type field of a union Lisp_Misc, use XMISCTYPE.
1178 It uses one of these struct subtypes to get the type field. */
1180 union Lisp_Misc
1182 struct Lisp_Free u_free;
1183 struct Lisp_Marker u_marker;
1184 struct Lisp_Intfwd u_intfwd;
1185 struct Lisp_Boolfwd u_boolfwd;
1186 struct Lisp_Objfwd u_objfwd;
1187 struct Lisp_Buffer_Objfwd u_buffer_objfwd;
1188 struct Lisp_Buffer_Local_Value u_buffer_local_value;
1189 struct Lisp_Overlay u_overlay;
1190 struct Lisp_Kboard_Objfwd u_kboard_objfwd;
1191 struct Lisp_Save_Value u_save_value;
1194 /* Lisp floating point type */
1195 struct Lisp_Float
1197 #ifdef HIDE_LISP_IMPLEMENTATION
1198 double data_;
1199 #else
1200 double data;
1201 #endif
1204 #ifdef HIDE_LISP_IMPLEMENTATION
1205 #define XFLOAT_DATA(f) (XFLOAT (f)->data_)
1206 #else
1207 #define XFLOAT_DATA(f) (XFLOAT (f)->data)
1208 #endif
1210 /* A character, declared with the following typedef, is a member
1211 of some character set associated with the current buffer. */
1212 #ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */
1213 #define _UCHAR_T
1214 typedef unsigned char UCHAR;
1215 #endif
1217 /* Meanings of slots in a Lisp_Compiled: */
1219 #define COMPILED_ARGLIST 0
1220 #define COMPILED_BYTECODE 1
1221 #define COMPILED_CONSTANTS 2
1222 #define COMPILED_STACK_DEPTH 3
1223 #define COMPILED_DOC_STRING 4
1224 #define COMPILED_INTERACTIVE 5
1226 /* Flag bits in a character. These also get used in termhooks.h.
1227 Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE
1228 (MUlti-Lingual Emacs) might need 22 bits for the character value
1229 itself, so we probably shouldn't use any bits lower than 0x0400000. */
1230 #define CHAR_ALT (0x0400000)
1231 #define CHAR_SUPER (0x0800000)
1232 #define CHAR_HYPER (0x1000000)
1233 #define CHAR_SHIFT (0x2000000)
1234 #define CHAR_CTL (0x4000000)
1235 #define CHAR_META (0x8000000)
1237 #define CHAR_MODIFIER_MASK \
1238 (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META)
1241 /* Actually, the current Emacs uses 19 bits for the character value
1242 itself. */
1243 #define CHARACTERBITS 19
1245 /* The maximum byte size consumed by push_key_description.
1246 All callers should assure that at least this size of memory is
1247 allocated at the place pointed by the second argument.
1249 Thers are 6 modifiers, each consumes 2 chars.
1250 The octal form of a character code consumes
1251 (1 + CHARACTERBITS / 3 + 1) chars (including backslash at the head).
1252 We need one more byte for string terminator `\0'. */
1253 #define KEY_DESCRIPTION_SIZE ((2 * 6) + 1 + (CHARACTERBITS / 3) + 1 + 1)
1255 #ifdef USE_X_TOOLKIT
1256 #ifdef NO_UNION_TYPE
1257 /* Use this for turning a (void *) into a Lisp_Object, as when the
1258 Lisp_Object is passed into a toolkit callback function. */
1259 #define VOID_TO_LISP(larg,varg) \
1260 do { ((larg) = ((Lisp_Object) (varg))); } while (0)
1261 #define CVOID_TO_LISP VOID_TO_LISP
1263 /* Use this for turning a Lisp_Object into a (void *), as when the
1264 Lisp_Object is passed into a toolkit callback function. */
1265 #define LISP_TO_VOID(larg) ((void *) (larg))
1266 #define LISP_TO_CVOID(varg) ((const void *) (larg))
1268 #else /* not NO_UNION_TYPE */
1269 /* Use this for turning a (void *) into a Lisp_Object, as when the
1270 Lisp_Object is passed into a toolkit callback function. */
1271 #define VOID_TO_LISP(larg,varg) \
1272 do { ((larg).v = (void *) (varg)); } while (0)
1273 #define CVOID_TO_LISP(larg,varg) \
1274 do { ((larg).cv = (const void *) (varg)); } while (0)
1276 /* Use this for turning a Lisp_Object into a (void *), as when the
1277 Lisp_Object is passed into a toolkit callback function. */
1278 #define LISP_TO_VOID(larg) ((larg).v)
1279 #define LISP_TO_CVOID(larg) ((larg).cv)
1280 #endif /* not NO_UNION_TYPE */
1281 #endif /* USE_X_TOOLKIT */
1284 /* The glyph datatype, used to represent characters on the display. */
1286 /* Glyph code to use as an index to the glyph table. If it is out of
1287 range for the glyph table, or the corresonding element in the table
1288 is nil, the low 8 bits are the single byte character code, and the
1289 bits above are the numeric face ID. If FID is the face ID of a
1290 glyph on a frame F, then F->display.x->faces[FID] contains the
1291 description of that face. This is an int instead of a short, so we
1292 can support a good bunch of face ID's (2^(31 - 8)); given that we
1293 have no mechanism for tossing unused frame face ID's yet, we'll
1294 probably run out of 255 pretty quickly.
1295 This is always -1 for a multibyte character. */
1296 #define GLYPH int
1298 /* Mask bits for face. */
1299 #define GLYPH_MASK_FACE 0x7FF80000
1300 /* Mask bits for character code. */
1301 #define GLYPH_MASK_CHAR 0x0007FFFF /* The lowest 19 bits */
1303 /* The FAST macros assume that we already know we're in an X window. */
1305 /* Set a character code and a face ID in a glyph G. */
1306 #define FAST_MAKE_GLYPH(char, face) ((char) | ((face) << CHARACTERBITS))
1308 /* Return a glyph's character code. */
1309 #define FAST_GLYPH_CHAR(glyph) ((glyph) & GLYPH_MASK_CHAR)
1311 /* Return a glyph's face ID. */
1312 #define FAST_GLYPH_FACE(glyph) (((glyph) & GLYPH_MASK_FACE) >> CHARACTERBITS)
1314 /* Slower versions that test the frame type first. */
1315 #define MAKE_GLYPH(f, char, face) (FAST_MAKE_GLYPH (char, face))
1316 #define GLYPH_CHAR(f, g) (FAST_GLYPH_CHAR (g))
1317 #define GLYPH_FACE(f, g) (FAST_GLYPH_FACE (g))
1319 /* Return 1 iff GLYPH contains valid character code. */
1320 #define GLYPH_CHAR_VALID_P(glyph) CHAR_VALID_P (FAST_GLYPH_CHAR (glyph), 1)
1322 /* The ID of the mode line highlighting face. */
1323 #define GLYPH_MODE_LINE_FACE 1
1325 /* Data type checking */
1327 #define NILP(x) (XFASTINT (x) == XFASTINT (Qnil))
1328 #define GC_NILP(x) GC_EQ (x, Qnil)
1330 #define NUMBERP(x) (INTEGERP (x) || FLOATP (x))
1331 #define GC_NUMBERP(x) (GC_INTEGERP (x) || GC_FLOATP (x))
1332 #define NATNUMP(x) (INTEGERP (x) && XINT (x) >= 0)
1333 #define GC_NATNUMP(x) (GC_INTEGERP (x) && XINT (x) >= 0)
1335 #define INTEGERP(x) (XTYPE ((x)) == Lisp_Int)
1336 #define GC_INTEGERP(x) (XGCTYPE ((x)) == Lisp_Int)
1337 #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol)
1338 #define GC_SYMBOLP(x) (XGCTYPE ((x)) == Lisp_Symbol)
1339 #define MISCP(x) (XTYPE ((x)) == Lisp_Misc)
1340 #define GC_MISCP(x) (XGCTYPE ((x)) == Lisp_Misc)
1341 #define VECTORLIKEP(x) (XTYPE ((x)) == Lisp_Vectorlike)
1342 #define GC_VECTORLIKEP(x) (XGCTYPE ((x)) == Lisp_Vectorlike)
1343 #define STRINGP(x) (XTYPE ((x)) == Lisp_String)
1344 #define GC_STRINGP(x) (XGCTYPE ((x)) == Lisp_String)
1345 #define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
1346 #define GC_CONSP(x) (XGCTYPE ((x)) == Lisp_Cons)
1348 #define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
1349 #define GC_FLOATP(x) (XGCTYPE ((x)) == Lisp_Float)
1350 #define VECTORP(x) (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
1351 #define GC_VECTORP(x) (GC_VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
1352 #define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
1353 #define GC_OVERLAYP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
1354 #define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
1355 #define GC_MARKERP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
1356 #define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
1357 #define GC_INTFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
1358 #define BOOLFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Boolfwd)
1359 #define GC_BOOLFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Boolfwd)
1360 #define OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd)
1361 #define GC_OBJFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd)
1362 #define BUFFER_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd)
1363 #define GC_BUFFER_OBJFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd)
1364 #define BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
1365 #define GC_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
1366 #define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value)
1367 #define GC_SOME_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value)
1368 #define KBOARD_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
1369 #define GC_KBOARD_OBJFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
1372 /* True if object X is a pseudovector whose code is CODE. */
1373 #define PSEUDOVECTORP(x, code) \
1374 (VECTORLIKEP (x) \
1375 && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) \
1376 == (PSEUDOVECTOR_FLAG | (code))))
1378 /* True if object X is a pseudovector whose code is CODE.
1379 This one works during GC. */
1380 #define GC_PSEUDOVECTORP(x, code) \
1381 (GC_VECTORLIKEP (x) \
1382 && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) \
1383 == (PSEUDOVECTOR_FLAG | (code))))
1385 /* Test for specific pseudovector types. */
1386 #define WINDOW_CONFIGURATIONP(x) PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
1387 #define GC_WINDOW_CONFIGURATIONP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
1388 #define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS)
1389 #define GC_PROCESSP(x) GC_PSEUDOVECTORP (x, PVEC_PROCESS)
1390 #define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
1391 #define GC_WINDOWP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW)
1392 #define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR)
1393 #define GC_SUBRP(x) GC_PSEUDOVECTORP (x, PVEC_SUBR)
1394 #define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
1395 #define GC_COMPILEDP(x) GC_PSEUDOVECTORP (x, PVEC_COMPILED)
1396 #define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER)
1397 #define GC_BUFFERP(x) GC_PSEUDOVECTORP (x, PVEC_BUFFER)
1398 #define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE)
1399 #define GC_CHAR_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_CHAR_TABLE)
1400 #define BOOL_VECTOR_P(x) PSEUDOVECTORP (x, PVEC_BOOL_VECTOR)
1401 #define GC_BOOL_VECTOR_P(x) GC_PSEUDOVECTORP (x, PVEC_BOOL_VECTOR)
1402 #define FRAMEP(x) PSEUDOVECTORP (x, PVEC_FRAME)
1403 #define GC_FRAMEP(x) GC_PSEUDOVECTORP (x, PVEC_FRAME)
1405 #define SUB_CHAR_TABLE_P(x) (CHAR_TABLE_P (x) && NILP (XCHAR_TABLE (x)->top))
1407 #define EQ(x, y) (XFASTINT (x) == XFASTINT (y))
1408 #define GC_EQ(x, y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y))
1410 #define CHECK_LIST(x) \
1411 do { if (!CONSP ((x)) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0)
1413 #define CHECK_STRING(x) \
1414 do { if (!STRINGP ((x))) x = wrong_type_argument (Qstringp, (x)); } while (0)
1416 #define CHECK_STRING_CAR(x) \
1417 do { if (!STRINGP (XCAR (x))) XSETCAR (x, wrong_type_argument (Qstringp, XCAR (x))); } while (0)
1419 #define CHECK_CONS(x) \
1420 do { if (!CONSP ((x))) x = wrong_type_argument (Qconsp, (x)); } while (0)
1422 #define CHECK_SYMBOL(x) \
1423 do { if (!SYMBOLP ((x))) x = wrong_type_argument (Qsymbolp, (x)); } while (0)
1425 #define CHECK_CHAR_TABLE(x) \
1426 do { if (!CHAR_TABLE_P ((x))) \
1427 x = wrong_type_argument (Qchar_table_p, (x)); } while (0)
1429 #define CHECK_VECTOR(x) \
1430 do { if (!VECTORP ((x))) x = wrong_type_argument (Qvectorp, (x)); } while (0)
1432 #define CHECK_VECTOR_OR_CHAR_TABLE(x) \
1433 do { if (!VECTORP ((x)) && !CHAR_TABLE_P ((x))) \
1434 x = wrong_type_argument (Qvector_or_char_table_p, (x)); \
1435 } while (0)
1437 #define CHECK_BUFFER(x) \
1438 do { if (!BUFFERP ((x))) x = wrong_type_argument (Qbufferp, (x)); } while (0)
1440 #define CHECK_WINDOW(x) \
1441 do { if (!WINDOWP ((x))) x = wrong_type_argument (Qwindowp, (x)); } while (0)
1443 /* This macro rejects windows on the interior of the window tree as
1444 "dead", which is what we want; this is an argument-checking macro, and
1445 the user should never get access to interior windows.
1447 A window of any sort, leaf or interior, is dead iff the buffer,
1448 vchild, and hchild members are all nil. */
1450 #define CHECK_LIVE_WINDOW(x) \
1451 do { \
1452 if (!WINDOWP ((x)) \
1453 || NILP (XWINDOW ((x))->buffer)) \
1454 x = wrong_type_argument (Qwindow_live_p, (x)); \
1455 } while (0)
1457 #define CHECK_PROCESS(x) \
1458 do { if (!PROCESSP ((x))) x = wrong_type_argument (Qprocessp, (x)); } while (0)
1460 #define CHECK_NUMBER(x) \
1461 do { if (!INTEGERP ((x))) x = wrong_type_argument (Qintegerp, (x)); } while (0)
1463 #define CHECK_NATNUM(x) \
1464 do { if (!NATNUMP (x)) x = wrong_type_argument (Qwholenump, (x)); } while (0)
1466 #define CHECK_MARKER(x) \
1467 do { if (!MARKERP ((x))) x = wrong_type_argument (Qmarkerp, (x)); } while (0)
1469 #define CHECK_NUMBER_COERCE_MARKER(x) \
1470 do { if (MARKERP ((x))) XSETFASTINT (x, marker_position (x)); \
1471 else if (!INTEGERP ((x))) x = wrong_type_argument (Qinteger_or_marker_p, (x)); } while (0)
1473 #define XFLOATINT(n) extract_float((n))
1475 #define CHECK_FLOAT(x) \
1476 do { if (!FLOATP (x)) \
1477 x = wrong_type_argument (Qfloatp, (x)); } while (0)
1479 #define CHECK_NUMBER_OR_FLOAT(x) \
1480 do { if (!FLOATP (x) && !INTEGERP (x)) \
1481 x = wrong_type_argument (Qnumberp, (x)); } while (0)
1483 #define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \
1484 do { if (MARKERP (x)) XSETFASTINT (x, marker_position (x)); \
1485 else if (!INTEGERP (x) && !FLOATP (x)) \
1486 x = wrong_type_argument (Qnumber_or_marker_p, (x)); } while (0)
1488 #define CHECK_OVERLAY(x) \
1489 do { if (!OVERLAYP ((x))) x = wrong_type_argument (Qoverlayp, (x));} while (0)
1491 /* Since we can't assign directly to the CAR or CDR fields of a cons
1492 cell, use these when checking that those fields contain numbers. */
1493 #define CHECK_NUMBER_CAR(x) \
1494 do { \
1495 Lisp_Object tmp = XCAR (x); \
1496 CHECK_NUMBER (tmp); \
1497 XSETCAR ((x), tmp); \
1498 } while (0)
1500 #define CHECK_NUMBER_CDR(x) \
1501 do { \
1502 Lisp_Object tmp = XCDR (x); \
1503 CHECK_NUMBER (tmp); \
1504 XSETCDR ((x), tmp); \
1505 } while (0)
1507 /* Cast pointers to this type to compare them. Some machines want int. */
1508 #ifndef PNTR_COMPARISON_TYPE
1509 #define PNTR_COMPARISON_TYPE EMACS_UINT
1510 #endif
1512 /* Define a built-in function for calling from Lisp.
1513 `lname' should be the name to give the function in Lisp,
1514 as a null-terminated C string.
1515 `fnname' should be the name of the function in C.
1516 By convention, it starts with F.
1517 `sname' should be the name for the C constant structure
1518 that records information on this function for internal use.
1519 By convention, it should be the same as `fnname' but with S instead of F.
1520 It's too bad that C macros can't compute this from `fnname'.
1521 `minargs' should be a number, the minimum number of arguments allowed.
1522 `maxargs' should be a number, the maximum number of arguments allowed,
1523 or else MANY or UNEVALLED.
1524 MANY means pass a vector of evaluated arguments,
1525 in the form of an integer number-of-arguments
1526 followed by the address of a vector of Lisp_Objects
1527 which contains the argument values.
1528 UNEVALLED means pass the list of unevaluated arguments
1529 `prompt' says how to read arguments for an interactive call.
1530 See the doc string for `interactive'.
1531 A null string means call interactively with no arguments.
1532 `doc' is documentation for the user. */
1534 #if (!defined (__STDC__) && !defined (PROTOTYPES)) \
1535 || defined (USE_NONANSI_DEFUN)
1537 #define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
1538 Lisp_Object fnname (); \
1539 struct Lisp_Subr sname = \
1540 { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
1541 fnname, minargs, maxargs, lname, prompt, 0}; \
1542 Lisp_Object fnname
1544 #else
1546 /* This version of DEFUN declares a function prototype with the right
1547 arguments, so we can catch errors with maxargs at compile-time. */
1548 #define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
1549 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
1550 struct Lisp_Subr sname = \
1551 { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
1552 fnname, minargs, maxargs, lname, prompt, 0}; \
1553 Lisp_Object fnname
1555 /* Note that the weird token-substitution semantics of ANSI C makes
1556 this work for MANY and UNEVALLED. */
1557 #define DEFUN_ARGS_MANY (int, Lisp_Object *)
1558 #define DEFUN_ARGS_UNEVALLED (Lisp_Object)
1559 #define DEFUN_ARGS_0 (void)
1560 #define DEFUN_ARGS_1 (Lisp_Object)
1561 #define DEFUN_ARGS_2 (Lisp_Object, Lisp_Object)
1562 #define DEFUN_ARGS_3 (Lisp_Object, Lisp_Object, Lisp_Object)
1563 #define DEFUN_ARGS_4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
1564 #define DEFUN_ARGS_5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
1565 Lisp_Object)
1566 #define DEFUN_ARGS_6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
1567 Lisp_Object, Lisp_Object)
1568 #define DEFUN_ARGS_7 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
1569 Lisp_Object, Lisp_Object, Lisp_Object)
1570 #define DEFUN_ARGS_8 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
1571 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
1572 #endif
1574 /* Non-zero if OBJ is a Lisp function. */
1576 #define FUNCTIONP(OBJ) \
1577 ((CONSP (OBJ) && EQ (XCAR (OBJ), Qlambda)) \
1578 || (SYMBOLP (OBJ) && !NILP (Ffboundp (OBJ))) \
1579 || COMPILEDP (OBJ) \
1580 || SUBRP (OBJ))
1582 /* defsubr (Sname);
1583 is how we define the symbol for function `name' at start-up time. */
1584 extern void defsubr P_ ((struct Lisp_Subr *));
1586 #define MANY -2
1587 #define UNEVALLED -1
1589 extern void defvar_lisp P_ ((char *, Lisp_Object *));
1590 extern void defvar_lisp_nopro P_ ((char *, Lisp_Object *));
1591 extern void defvar_bool P_ ((char *, int *));
1592 extern void defvar_int P_ ((char *, EMACS_INT *));
1593 extern void defvar_per_buffer P_ ((char *, Lisp_Object *, Lisp_Object, char *));
1594 extern void defvar_kboard P_ ((char *, int));
1596 /* Macros we use to define forwarded Lisp variables.
1597 These are used in the syms_of_FILENAME functions. */
1599 #define DEFVAR_LISP(lname, vname, doc) defvar_lisp (lname, vname)
1600 #define DEFVAR_LISP_NOPRO(lname, vname, doc) defvar_lisp_nopro (lname, vname)
1601 #define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname)
1602 #define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname)
1603 #define DEFVAR_PER_BUFFER(lname, vname, type, doc) \
1604 defvar_per_buffer (lname, vname, type, 0)
1605 #define DEFVAR_KBOARD(lname, vname, doc) \
1606 defvar_kboard (lname, \
1607 (int)((char *)(&current_kboard->vname) \
1608 - (char *)current_kboard))
1612 /* Structure for recording Lisp call stack for backtrace purposes. */
1614 /* The special binding stack holds the outer values of variables while
1615 they are bound by a function application or a let form, stores the
1616 code to be executed for Lisp unwind-protect forms, and stores the C
1617 functions to be called for record_unwind_protect.
1619 If func is non-zero, undoing this binding applies func to old_value;
1620 This implements record_unwind_protect.
1622 Otherwise, the element is a variable binding.
1624 If the symbol field is a symbol, it is an ordinary variable binding.
1626 Otherwise, it should be a structure (SYMBOL WHERE
1627 . CURRENT-BUFFER), which means having bound a local value while
1628 CURRENT-BUFFER was active. If WHERE is nil this means we saw the
1629 default value when binding SYMBOL. WHERE being a buffer or frame
1630 means we saw a buffer-local or frame-local value. Other values of
1631 WHERE mean an internal error. */
1633 typedef Lisp_Object (*specbinding_func) P_ ((Lisp_Object));
1635 struct specbinding
1637 volatile Lisp_Object symbol, old_value;
1638 volatile specbinding_func func;
1639 Lisp_Object unused; /* Dividing by 16 is faster than by 12 */
1642 extern struct specbinding *specpdl;
1643 extern volatile struct specbinding *specpdl_ptr;
1644 extern int specpdl_size;
1646 extern EMACS_INT max_specpdl_size;
1648 #define SPECPDL_INDEX() (specpdl_ptr - specpdl)
1650 /* Everything needed to describe an active condition case. */
1651 struct handler
1653 /* The handler clauses and variable from the condition-case form. */
1654 /* For a handler set up in Lisp code, this is always a list.
1655 For an internal handler set up by internal_condition_case*,
1656 this can instead be the symbol t or `error'.
1657 t: handle all conditions.
1658 error: handle all conditions, and errors can run the debugger
1659 or display a backtrace. */
1660 Lisp_Object handler;
1661 Lisp_Object var;
1662 /* Fsignal stores here the condition-case clause that applies,
1663 and Fcondition_case thus knows which clause to run. */
1664 Lisp_Object chosen_clause;
1666 /* Used to effect the longjump out to the handler. */
1667 struct catchtag *tag;
1669 /* The next enclosing handler. */
1670 struct handler *next;
1673 extern struct handler *handlerlist;
1675 extern struct catchtag *catchlist;
1676 extern struct backtrace *backtrace_list;
1678 extern Lisp_Object memory_signal_data;
1680 /* An address near the bottom of the stack.
1681 Tells GC how to save a copy of the stack. */
1682 extern char *stack_bottom;
1684 /* Check quit-flag and quit if it is non-nil.
1685 Typing C-g does not directly cause a quit; it only sets Vquit_flag.
1686 So the program needs to do QUIT at times when it is safe to quit.
1687 Every loop that might run for a long time or might not exit
1688 ought to do QUIT at least once, at a safe place.
1689 Unless that is impossible, of course.
1690 But it is very desirable to avoid creating loops where QUIT is impossible.
1692 Exception: if you set immediate_quit to nonzero,
1693 then the handler that responds to the C-g does the quit itself.
1694 This is a good thing to do around a loop that has no side effects
1695 and (in particular) cannot call arbitrary Lisp code. */
1697 #define QUIT \
1698 do { \
1699 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
1701 Vquit_flag = Qnil; \
1702 Fsignal (Qquit, Qnil); \
1704 } while (0)
1706 /* Nonzero if ought to quit now. */
1708 #define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
1710 /* Variables used locally in the following case handling macros. */
1711 extern int case_temp1;
1712 extern Lisp_Object case_temp2;
1714 /* Current buffer's map from characters to lower-case characters. */
1716 #define DOWNCASE_TABLE current_buffer->downcase_table
1718 /* Current buffer's map from characters to upper-case characters. */
1720 #define UPCASE_TABLE current_buffer->upcase_table
1722 /* Downcase a character, or make no change if that cannot be done. */
1724 #define DOWNCASE(CH) \
1725 ((case_temp1 = (CH), \
1726 case_temp2 = CHAR_TABLE_REF (DOWNCASE_TABLE, case_temp1), \
1727 NATNUMP (case_temp2)) \
1728 ? XFASTINT (case_temp2) : case_temp1)
1730 /* 1 if CH is upper case. */
1732 #define UPPERCASEP(CH) (DOWNCASE (CH) != (CH))
1734 /* 1 if CH is neither upper nor lower case. */
1736 #define NOCASEP(CH) (UPCASE1 (CH) == (CH))
1738 /* 1 if CH is lower case. */
1740 #define LOWERCASEP(CH) (!UPPERCASEP (CH) && !NOCASEP(CH))
1742 /* Upcase a character, or make no change if that cannot be done. */
1744 #define UPCASE(CH) (!UPPERCASEP (CH) ? UPCASE1 (CH) : (CH))
1746 /* Upcase a character known to be not upper case. */
1748 #define UPCASE1(CH) \
1749 ((case_temp1 = (CH), \
1750 case_temp2 = CHAR_TABLE_REF (UPCASE_TABLE, case_temp1), \
1751 NATNUMP (case_temp2)) \
1752 ? XFASTINT (case_temp2) : case_temp1)
1754 extern Lisp_Object Vascii_downcase_table;
1756 /* Number of bytes of structure consed since last GC. */
1758 extern int consing_since_gc;
1760 /* Threshold for doing another gc. */
1762 extern EMACS_INT gc_cons_threshold;
1764 /* Structure for recording stack slots that need marking. */
1766 /* This is a chain of structures, each of which points at a Lisp_Object variable
1767 whose value should be marked in garbage collection.
1768 Normally every link of the chain is an automatic variable of a function,
1769 and its `val' points to some argument or local variable of the function.
1770 On exit to the function, the chain is set back to the value it had on entry.
1771 This way, no link remains in the chain when the stack frame containing the
1772 link disappears.
1774 Every function that can call Feval must protect in this fashion all
1775 Lisp_Object variables whose contents will be used again. */
1777 extern struct gcpro *gcprolist;
1779 struct gcpro
1781 struct gcpro *next;
1783 /* Address of first protected variable. */
1784 volatile Lisp_Object *var;
1786 /* Number of consecutive protected variables. */
1787 int nvars;
1789 #ifdef DEBUG_GCPRO
1790 int level;
1791 #endif
1794 /* Values of GC_MARK_STACK during compilation:
1796 0 Use GCPRO as before
1797 1 Do the real thing, make GCPROs and UNGCPRO no-ops.
1798 2 Mark the stack, and check that everything GCPRO'd is
1799 marked.
1800 3 Mark using GCPRO's, mark stack last, and count how many
1801 dead objects are kept alive. */
1804 #define GC_USE_GCPROS_AS_BEFORE 0
1805 #define GC_MAKE_GCPROS_NOOPS 1
1806 #define GC_MARK_STACK_CHECK_GCPROS 2
1807 #define GC_USE_GCPROS_CHECK_ZOMBIES 3
1809 #ifndef GC_MARK_STACK
1810 #define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
1811 #endif
1813 #if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
1815 /* Do something silly with gcproN vars just so gcc shuts up. */
1816 /* You get warnings from MIPSPro... */
1818 #define GCPRO1(varname) ((void) gcpro1)
1819 #define GCPRO2(varname1, varname2)(((void) gcpro2, (void) gcpro1))
1820 #define GCPRO3(varname1, varname2, varname3) \
1821 (((void) gcpro3, (void) gcpro2, (void) gcpro1))
1822 #define GCPRO4(varname1, varname2, varname3, varname4) \
1823 (((void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
1824 #define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
1825 (((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
1826 #define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
1827 (((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
1828 #define UNGCPRO ((void) 0)
1830 #else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
1832 #ifndef DEBUG_GCPRO
1834 #define GCPRO1(varname) \
1835 {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \
1836 gcprolist = &gcpro1; }
1838 #define GCPRO2(varname1, varname2) \
1839 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1840 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1841 gcprolist = &gcpro2; }
1843 #define GCPRO3(varname1, varname2, varname3) \
1844 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1845 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1846 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1847 gcprolist = &gcpro3; }
1849 #define GCPRO4(varname1, varname2, varname3, varname4) \
1850 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1851 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1852 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1853 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
1854 gcprolist = &gcpro4; }
1856 #define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
1857 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1858 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1859 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1860 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
1861 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
1862 gcprolist = &gcpro5; }
1864 #define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
1865 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1866 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1867 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1868 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
1869 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
1870 gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \
1871 gcprolist = &gcpro6; }
1873 #define UNGCPRO (gcprolist = gcpro1.next)
1875 #else
1877 extern int gcpro_level;
1879 #define GCPRO1(varname) \
1880 {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \
1881 gcpro1.level = gcpro_level++; \
1882 gcprolist = &gcpro1; }
1884 #define GCPRO2(varname1, varname2) \
1885 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1886 gcpro1.level = gcpro_level; \
1887 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1888 gcpro2.level = gcpro_level++; \
1889 gcprolist = &gcpro2; }
1891 #define GCPRO3(varname1, varname2, varname3) \
1892 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1893 gcpro1.level = gcpro_level; \
1894 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1895 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1896 gcpro3.level = gcpro_level++; \
1897 gcprolist = &gcpro3; }
1899 #define GCPRO4(varname1, varname2, varname3, varname4) \
1900 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1901 gcpro1.level = gcpro_level; \
1902 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1903 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1904 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
1905 gcpro4.level = gcpro_level++; \
1906 gcprolist = &gcpro4; }
1908 #define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
1909 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1910 gcpro1.level = gcpro_level; \
1911 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1912 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1913 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
1914 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
1915 gcpro5.level = gcpro_level++; \
1916 gcprolist = &gcpro5; }
1918 #define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
1919 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1920 gcpro1.level = gcpro_level; \
1921 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1922 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1923 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
1924 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
1925 gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \
1926 gcpro6.level = gcpro_level++; \
1927 gcprolist = &gcpro6; }
1929 #define UNGCPRO \
1930 ((--gcpro_level != gcpro1.level) \
1931 ? (abort (), 0) \
1932 : ((gcprolist = gcpro1.next), 0))
1934 #endif /* DEBUG_GCPRO */
1935 #endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
1938 /* Evaluate expr, UNGCPRO, and then return the value of expr. */
1939 #define RETURN_UNGCPRO(expr) \
1940 do \
1942 Lisp_Object ret_ungc_val; \
1943 ret_ungc_val = (expr); \
1944 UNGCPRO; \
1945 return ret_ungc_val; \
1947 while (0)
1949 /* Call staticpro (&var) to protect static variable `var'. */
1951 void staticpro P_ ((Lisp_Object *));
1953 /* Declare a Lisp-callable function. The MAXARGS parameter has the same
1954 meaning as in the DEFUN macro, and is used to construct a prototype. */
1955 #if (!defined (__STDC__) && !defined (PROTOTYPES)) \
1956 || defined (USE_NONANSI_DEFUN)
1957 #define EXFUN(fnname, maxargs) \
1958 extern Lisp_Object fnname ()
1959 #else
1960 /* We can use the same trick as in the DEFUN macro to generate the
1961 appropriate prototype. */
1962 #define EXFUN(fnname, maxargs) \
1963 extern Lisp_Object fnname DEFUN_ARGS_ ## maxargs
1964 #endif
1966 /* Forward declarations for prototypes. */
1967 struct window;
1968 struct frame;
1970 /* Defined in data.c */
1971 extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
1972 extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
1973 extern Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range;
1974 extern Lisp_Object Qvoid_variable, Qvoid_function;
1975 extern Lisp_Object Qsetting_constant, Qinvalid_read_syntax;
1976 extern Lisp_Object Qinvalid_function, Qwrong_number_of_arguments, Qno_catch;
1977 extern Lisp_Object Qend_of_file, Qarith_error;
1978 extern Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
1979 extern Lisp_Object Qmark_inactive, Qtext_read_only;
1981 extern Lisp_Object Qrange_error, Qdomain_error, Qsingularity_error;
1982 extern Lisp_Object Qoverflow_error, Qunderflow_error;
1984 extern Lisp_Object Qintegerp, Qnumberp, Qnatnump, Qwholenump;
1985 extern Lisp_Object Qsymbolp, Qlistp, Qconsp;
1986 extern Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp;
1987 extern Lisp_Object Qchar_or_string_p, Qmarkerp, Qvectorp;
1988 extern Lisp_Object Qinteger_or_marker_p, Qnumber_or_marker_p;
1989 extern Lisp_Object Qchar_table_p, Qvector_or_char_table_p;
1990 extern Lisp_Object Qboundp, Qfboundp;
1991 extern Lisp_Object Qbuffer_or_string_p;
1992 extern Lisp_Object Qcdr;
1994 extern Lisp_Object Qfloatp, Qinteger_or_floatp, Qinteger_or_float_or_marker_p;
1996 extern Lisp_Object Qframep;
1998 extern void circular_list_error P_ ((Lisp_Object));
2000 EXFUN (Feq, 2);
2001 EXFUN (Fnull, 1);
2002 EXFUN (Flistp, 1);
2003 EXFUN (Fconsp, 1);
2004 EXFUN (Fatom, 1);
2005 EXFUN (Fnlistp, 1);
2006 EXFUN (Fintegerp, 1);
2007 EXFUN (Fnatnump, 1);
2008 EXFUN (Fsymbolp, 1);
2009 EXFUN (Fvectorp, 1);
2010 EXFUN (Fstringp, 1);
2011 EXFUN (Fmultibyte_string_p, 1);
2012 EXFUN (Farrayp, 1);
2013 EXFUN (Fsequencep, 1);
2014 EXFUN (Fbufferp, 1);
2015 EXFUN (Fmarkerp, 1);
2016 EXFUN (Fsubrp, 1);
2017 EXFUN (Fchar_or_string_p, 1);
2018 EXFUN (Finteger_or_marker_p, 1);
2019 EXFUN (Ffloatp, 1);
2020 EXFUN (Finteger_or_floatp, 1);
2021 EXFUN (Finteger_or_float_or_marker_p, 1);
2023 EXFUN (Fcar, 1);
2024 EXFUN (Fcar_safe, 1);
2025 EXFUN (Fcdr, 1);
2026 EXFUN (Fcdr_safe, 1);
2027 EXFUN (Fsetcar, 2);
2028 EXFUN (Fsetcdr, 2);
2029 EXFUN (Fboundp, 1);
2030 EXFUN (Ffboundp, 1);
2031 EXFUN (Fmakunbound, 1);
2032 EXFUN (Ffmakunbound, 1);
2033 EXFUN (Fsymbol_function, 1);
2034 EXFUN (Fsymbol_plist, 1);
2035 EXFUN (Fsymbol_name, 1);
2036 extern Lisp_Object indirect_function P_ ((Lisp_Object));
2037 EXFUN (Findirect_function, 1);
2038 EXFUN (Ffset, 2);
2039 EXFUN (Fsetplist, 2);
2040 EXFUN (Fsymbol_value, 1);
2041 extern Lisp_Object find_symbol_value P_ ((Lisp_Object));
2042 EXFUN (Fset, 2);
2043 EXFUN (Fdefault_value, 1);
2044 EXFUN (Fset_default, 2);
2045 EXFUN (Fdefault_boundp, 1);
2046 EXFUN (Fmake_local_variable, 1);
2047 EXFUN (Flocal_variable_p, 2);
2048 EXFUN (Flocal_variable_if_set_p, 2);
2050 EXFUN (Faref, 2);
2051 EXFUN (Faset, 3);
2053 EXFUN (Fstring_to_number, 2);
2054 EXFUN (Fnumber_to_string, 1);
2055 EXFUN (Feqlsign, 2);
2056 EXFUN (Fgtr, 2);
2057 EXFUN (Flss, 2);
2058 EXFUN (Fgeq, 2);
2059 EXFUN (Fleq, 2);
2060 EXFUN (Fneq, 2);
2061 EXFUN (Fzerop, 1);
2062 EXFUN (Fplus, MANY);
2063 EXFUN (Fminus, MANY);
2064 EXFUN (Ftimes, MANY);
2065 EXFUN (Fquo, MANY);
2066 EXFUN (Frem, 2);
2067 EXFUN (Fmax, MANY);
2068 EXFUN (Fmin, MANY);
2069 EXFUN (Flogand, MANY);
2070 EXFUN (Flogior, MANY);
2071 EXFUN (Flogxor, MANY);
2072 EXFUN (Flognot, 1);
2073 EXFUN (Flsh, 2);
2074 EXFUN (Fash, 2);
2076 EXFUN (Fadd1, 1);
2077 EXFUN (Fsub1, 1);
2078 EXFUN (Fmake_variable_buffer_local, 1);
2080 extern Lisp_Object indirect_variable P_ ((Lisp_Object));
2081 extern Lisp_Object long_to_cons P_ ((unsigned long));
2082 extern unsigned long cons_to_long P_ ((Lisp_Object));
2083 extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object));
2084 extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
2085 extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object));
2086 extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object,
2087 Lisp_Object, struct buffer *));
2088 extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object));
2089 extern Lisp_Object set_internal P_ ((Lisp_Object, Lisp_Object, struct buffer *, int));
2090 extern void syms_of_data P_ ((void));
2091 extern void init_data P_ ((void));
2092 extern void swap_in_global_binding P_ ((Lisp_Object));
2094 /* Defined in cmds.c */
2095 EXFUN (Fend_of_line, 1);
2096 EXFUN (Fforward_char, 1);
2097 EXFUN (Fforward_line, 1);
2098 extern int internal_self_insert P_ ((int, int));
2099 extern void syms_of_cmds P_ ((void));
2100 extern void keys_of_cmds P_ ((void));
2102 /* Defined in coding.c */
2103 EXFUN (Fcoding_system_p, 1);
2104 EXFUN (Fcheck_coding_system, 1);
2105 EXFUN (Fread_coding_system, 2);
2106 EXFUN (Fread_non_nil_coding_system, 1);
2107 EXFUN (Ffind_operation_coding_system, MANY);
2108 EXFUN (Fupdate_coding_systems_internal, 0);
2109 EXFUN (Fencode_coding_string, 3);
2110 EXFUN (Fdecode_coding_string, 3);
2111 extern Lisp_Object detect_coding_system P_ ((const unsigned char *, int, int,
2112 int));
2113 extern void init_coding P_ ((void));
2114 extern void init_coding_once P_ ((void));
2115 extern void syms_of_coding P_ ((void));
2116 extern Lisp_Object code_convert_string_norecord P_ ((Lisp_Object, Lisp_Object,
2117 int));
2119 /* Defined in charset.c */
2120 extern EMACS_INT nonascii_insert_offset;
2121 extern Lisp_Object Vnonascii_translation_table;
2122 EXFUN (Fchar_bytes, 1);
2123 EXFUN (Fchar_width, 1);
2124 EXFUN (Fstring, MANY);
2125 extern int chars_in_text P_ ((const unsigned char *, int));
2126 extern int multibyte_chars_in_text P_ ((const unsigned char *, int));
2127 extern int unibyte_char_to_multibyte P_ ((int));
2128 extern int multibyte_char_to_unibyte P_ ((int, Lisp_Object));
2129 extern Lisp_Object Qcharset;
2130 extern void init_charset_once P_ ((void));
2131 extern void syms_of_charset P_ ((void));
2133 /* Defined in syntax.c */
2134 EXFUN (Fforward_word, 1);
2135 EXFUN (Fskip_chars_forward, 2);
2136 EXFUN (Fskip_chars_backward, 2);
2137 EXFUN (Fsyntax_table_p, 1);
2138 EXFUN (Fsyntax_table, 0);
2139 EXFUN (Fset_syntax_table, 1);
2140 extern void init_syntax_once P_ ((void));
2141 extern void syms_of_syntax P_ ((void));
2143 /* Defined in fns.c */
2144 extern int use_dialog_box;
2145 extern int next_almost_prime P_ ((int));
2146 extern Lisp_Object larger_vector P_ ((Lisp_Object, int, Lisp_Object));
2147 extern void sweep_weak_hash_tables P_ ((void));
2148 extern Lisp_Object Qstring_lessp;
2149 EXFUN (Foptimize_char_table, 1);
2150 extern Lisp_Object Vfeatures;
2151 extern Lisp_Object QCtest, QCweakness, Qequal;
2152 unsigned sxhash P_ ((Lisp_Object, int));
2153 Lisp_Object make_hash_table P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
2154 Lisp_Object, Lisp_Object, Lisp_Object,
2155 Lisp_Object));
2156 Lisp_Object copy_hash_table P_ ((struct Lisp_Hash_Table *));
2157 int hash_lookup P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned *));
2158 int hash_put P_ ((struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
2159 unsigned));
2160 void hash_remove P_ ((struct Lisp_Hash_Table *, Lisp_Object));
2161 void hash_clear P_ ((struct Lisp_Hash_Table *));
2162 void remove_hash_entry P_ ((struct Lisp_Hash_Table *, int));
2163 extern void init_fns P_ ((void));
2164 EXFUN (Fsxhash, 1);
2165 EXFUN (Fmake_hash_table, MANY);
2166 EXFUN (Fcopy_hash_table, 1);
2167 EXFUN (Fhash_table_count, 1);
2168 EXFUN (Fhash_table_rehash_size, 1);
2169 EXFUN (Fhash_table_rehash_threshold, 1);
2170 EXFUN (Fhash_table_size, 1);
2171 EXFUN (Fhash_table_test, 1);
2172 EXFUN (Fhash_table_weak, 1);
2173 EXFUN (Fhash_table_p, 1);
2174 EXFUN (Fclrhash, 1);
2175 EXFUN (Fgethash, 3);
2176 EXFUN (Fputhash, 3);
2177 EXFUN (Fremhash, 2);
2178 EXFUN (Fmaphash, 2);
2179 EXFUN (Fdefine_hash_table_test, 3);
2181 EXFUN (Fidentity, 1);
2182 EXFUN (Frandom, 1);
2183 EXFUN (Flength, 1);
2184 EXFUN (Fsafe_length, 1);
2185 EXFUN (Fappend, MANY);
2186 EXFUN (Fconcat, MANY);
2187 EXFUN (Fvconcat, MANY);
2188 EXFUN (Fcopy_sequence, 1);
2189 EXFUN (Fstring_make_multibyte, 1);
2190 EXFUN (Fstring_make_unibyte, 1);
2191 EXFUN (Fstring_as_multibyte, 1);
2192 EXFUN (Fstring_as_unibyte, 1);
2193 EXFUN (Fstring_to_multibyte, 1);
2194 EXFUN (Fsubstring, 3);
2195 extern Lisp_Object substring_both P_ ((Lisp_Object, int, int, int, int));
2196 EXFUN (Fnth, 2);
2197 EXFUN (Fnthcdr, 2);
2198 EXFUN (Fmemq, 2);
2199 EXFUN (Fassq, 2);
2200 EXFUN (Fassoc, 2);
2201 EXFUN (Felt, 2);
2202 EXFUN (Fmember, 2);
2203 EXFUN (Frassq, 2);
2204 EXFUN (Fdelq, 2);
2205 EXFUN (Fsort, 2);
2206 EXFUN (Freverse, 1);
2207 EXFUN (Fnreverse, 1);
2208 EXFUN (Fget, 2);
2209 EXFUN (Fput, 3);
2210 EXFUN (Fequal, 2);
2211 EXFUN (Ffillarray, 2);
2212 EXFUN (Fnconc, MANY);
2213 EXFUN (Fmapcar, 2);
2214 EXFUN (Fmapconcat, 3);
2215 EXFUN (Fy_or_n_p, 1);
2216 extern Lisp_Object do_yes_or_no_p P_ ((Lisp_Object));
2217 EXFUN (Frequire, 3);
2218 EXFUN (Fprovide, 2);
2219 extern Lisp_Object concat2 P_ ((Lisp_Object, Lisp_Object));
2220 extern Lisp_Object concat3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
2221 extern Lisp_Object nconc2 P_ ((Lisp_Object, Lisp_Object));
2222 extern Lisp_Object assq_no_quit P_ ((Lisp_Object, Lisp_Object));
2223 extern void clear_string_char_byte_cache P_ ((void));
2224 extern int string_char_to_byte P_ ((Lisp_Object, int));
2225 extern int string_byte_to_char P_ ((Lisp_Object, int));
2226 extern Lisp_Object string_make_multibyte P_ ((Lisp_Object));
2227 extern Lisp_Object string_make_unibyte P_ ((Lisp_Object));
2228 EXFUN (Fcopy_alist, 1);
2229 EXFUN (Fplist_get, 2);
2230 EXFUN (Fplist_put, 3);
2231 EXFUN (Fplist_member, 2);
2232 EXFUN (Fset_char_table_parent, 2);
2233 EXFUN (Fchar_table_extra_slot, 2);
2234 EXFUN (Fset_char_table_extra_slot, 3);
2235 EXFUN (Frassoc, 2);
2236 EXFUN (Fstring_equal, 2);
2237 EXFUN (Fcompare_strings, 7);
2238 EXFUN (Fstring_lessp, 2);
2239 extern int char_table_translate P_ ((Lisp_Object, int));
2240 extern void map_char_table P_ ((void (*) (Lisp_Object, Lisp_Object, Lisp_Object),
2241 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, int,
2242 Lisp_Object *));
2243 extern Lisp_Object char_table_ref_and_index P_ ((Lisp_Object, int, int *));
2244 extern void syms_of_fns P_ ((void));
2246 /* Defined in floatfns.c */
2247 extern double extract_float P_ ((Lisp_Object));
2248 EXFUN (Ffloat, 1);
2249 EXFUN (Ftruncate, 2);
2250 extern void init_floatfns P_ ((void));
2251 extern void syms_of_floatfns P_ ((void));
2253 /* Defined in insdel.c */
2254 extern Lisp_Object Qinhibit_modification_hooks;
2255 extern void move_gap P_ ((int));
2256 extern void move_gap_both P_ ((int, int));
2257 extern void make_gap P_ ((int));
2258 extern int copy_text P_ ((const unsigned char *, unsigned char *, int, int, int));
2259 extern int count_size_as_multibyte P_ ((const unsigned char *, int));
2260 extern int count_combining_before P_ ((const unsigned char *, int, int, int));
2261 extern int count_combining_after P_ ((const unsigned char *, int, int, int));
2262 extern void insert P_ ((const unsigned char *, int));
2263 extern void insert_and_inherit P_ ((const unsigned char *, int));
2264 extern void insert_1 P_ ((const unsigned char *, int, int, int, int));
2265 extern void insert_1_both P_ ((const unsigned char *, int, int, int, int, int));
2266 extern void insert_from_string P_ ((Lisp_Object, int, int, int, int, int));
2267 extern void insert_from_buffer P_ ((struct buffer *, int, int, int));
2268 extern void insert_char P_ ((int));
2269 extern void insert_string P_ ((const char *));
2270 extern void insert_before_markers P_ ((const unsigned char *, int));
2271 extern void insert_before_markers_and_inherit P_ ((const unsigned char *, int));
2272 extern void insert_from_string_before_markers P_ ((Lisp_Object, int, int, int, int, int));
2273 extern void del_range P_ ((int, int));
2274 extern Lisp_Object del_range_1 P_ ((int, int, int, int));
2275 extern void del_range_byte P_ ((int, int, int));
2276 extern void del_range_both P_ ((int, int, int, int, int));
2277 extern Lisp_Object del_range_2 P_ ((int, int, int, int, int));
2278 extern void modify_region P_ ((struct buffer *, int, int));
2279 extern void prepare_to_modify_buffer P_ ((int, int, int *));
2280 extern void signal_before_change P_ ((int, int, int *));
2281 extern void signal_after_change P_ ((int, int, int));
2282 extern void adjust_after_replace P_ ((int, int, Lisp_Object, int, int));
2283 extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int));
2284 extern void adjust_after_insert P_ ((int, int, int, int, int));
2285 extern void replace_range P_ ((int, int, Lisp_Object, int, int, int));
2286 extern void syms_of_insdel P_ ((void));
2288 /* Defined in dispnew.c */
2289 extern Lisp_Object selected_frame;
2290 extern EMACS_INT baud_rate;
2291 EXFUN (Fding, 1);
2292 EXFUN (Fredraw_frame, 1);
2293 EXFUN (Fredraw_display, 0);
2294 EXFUN (Fsleep_for, 2);
2295 EXFUN (Fsit_for, 3);
2296 extern Lisp_Object sit_for P_ ((int, int, int, int, int));
2297 extern void init_display P_ ((void));
2298 extern void syms_of_display P_ ((void));
2299 extern void safe_bcopy P_ ((const char *, char *, int));
2301 /* Defined in xdisp.c */
2302 extern Lisp_Object Qinhibit_point_motion_hooks;
2303 extern Lisp_Object Qinhibit_redisplay, Qdisplay;
2304 extern Lisp_Object Qinhibit_eval_during_redisplay;
2305 extern Lisp_Object Qmessage_truncate_lines;
2306 extern Lisp_Object Vmessage_log_max;
2307 extern int message_enable_multibyte;
2308 extern Lisp_Object echo_area_buffer[2];
2309 extern void check_message_stack P_ ((void));
2310 extern void setup_echo_area_for_printing P_ ((int));
2311 extern int push_message P_ ((void));
2312 extern Lisp_Object pop_message_unwind P_ ((Lisp_Object));
2313 extern Lisp_Object restore_message_unwind P_ ((Lisp_Object));
2314 extern void pop_message P_ ((void));
2315 extern void restore_message P_ ((void));
2316 extern Lisp_Object current_message P_ ((void));
2317 extern void set_message P_ ((const char *s, Lisp_Object, int, int));
2318 extern void clear_message P_ ((int, int));
2319 extern void message P_ ((/* char *, ... */));
2320 extern void message_nolog P_ ((/* char *, ... */));
2321 extern void message1 P_ ((char *));
2322 extern void message1_nolog P_ ((char *));
2323 extern void message2 P_ ((const char *, int, int));
2324 extern void message2_nolog P_ ((const char *, int, int));
2325 extern void message3 P_ ((Lisp_Object, int, int));
2326 extern void message3_nolog P_ ((Lisp_Object, int, int));
2327 extern void message_dolog P_ ((const char *, int, int, int));
2328 extern void message_with_string P_ ((char *, Lisp_Object, int));
2329 extern void message_log_maybe_newline P_ ((void));
2330 extern void update_echo_area P_ ((void));
2331 extern void truncate_echo_area P_ ((int));
2332 extern void redisplay P_ ((void));
2333 extern int check_point_in_composition
2334 P_ ((struct buffer *, int, struct buffer *, int));
2335 extern void redisplay_preserve_echo_area P_ ((int));
2336 extern void mark_window_display_accurate P_ ((Lisp_Object, int));
2337 extern void prepare_menu_bars P_ ((void));
2339 void set_frame_cursor_types P_ ((struct frame *, Lisp_Object));
2340 extern void syms_of_xdisp P_ ((void));
2341 extern void init_xdisp P_ ((void));
2342 extern Lisp_Object safe_eval P_ ((Lisp_Object));
2343 extern int pos_visible_p P_ ((struct window *, int, int *, int));
2345 /* Defined in vm-limit.c. */
2346 extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ()));
2348 /* Defined in alloc.c */
2349 extern void check_pure_size P_ ((void));
2350 extern void allocate_string_data P_ ((struct Lisp_String *, int, int));
2351 extern void uninterrupt_malloc P_ ((void));
2352 extern void malloc_warning P_ ((char *));
2353 extern void memory_full P_ ((void));
2354 extern void buffer_memory_full P_ ((void));
2355 extern int survives_gc_p P_ ((Lisp_Object));
2356 extern void mark_object P_ ((Lisp_Object));
2357 extern Lisp_Object Vpurify_flag;
2358 extern Lisp_Object Vmemory_full;
2359 EXFUN (Fcons, 2);
2360 EXFUN (list2, 2);
2361 EXFUN (list3, 3);
2362 EXFUN (list4, 4);
2363 EXFUN (list5, 5);
2364 EXFUN (Flist, MANY);
2365 EXFUN (Fmake_list, 2);
2366 extern Lisp_Object allocate_misc P_ ((void));
2367 EXFUN (Fmake_vector, 2);
2368 EXFUN (Fvector, MANY);
2369 EXFUN (Fmake_symbol, 1);
2370 EXFUN (Fmake_marker, 0);
2371 EXFUN (Fmake_string, 2);
2372 extern Lisp_Object build_string P_ ((const char *));
2373 extern Lisp_Object make_string P_ ((const char *, int));
2374 extern Lisp_Object make_unibyte_string P_ ((const char *, int));
2375 extern Lisp_Object make_multibyte_string P_ ((const char *, int, int));
2376 extern Lisp_Object make_event_array P_ ((int, Lisp_Object *));
2377 extern Lisp_Object make_uninit_string P_ ((int));
2378 extern Lisp_Object make_uninit_multibyte_string P_ ((int, int));
2379 extern Lisp_Object make_string_from_bytes P_ ((const char *, int, int));
2380 extern Lisp_Object make_specified_string P_ ((const char *, int, int, int));
2381 EXFUN (Fpurecopy, 1);
2382 extern Lisp_Object make_pure_string P_ ((char *, int, int, int));
2383 extern Lisp_Object pure_cons P_ ((Lisp_Object, Lisp_Object));
2384 extern Lisp_Object make_pure_vector P_ ((EMACS_INT));
2385 EXFUN (Fgarbage_collect, 0);
2386 EXFUN (Fmake_byte_code, MANY);
2387 EXFUN (Fmake_bool_vector, 2);
2388 EXFUN (Fmake_char_table, 2);
2389 extern Lisp_Object make_sub_char_table P_ ((Lisp_Object));
2390 extern Lisp_Object Qchar_table_extra_slots;
2391 extern struct Lisp_Vector *allocate_vector P_ ((EMACS_INT));
2392 extern struct Lisp_Vector *allocate_other_vector P_ ((EMACS_INT));
2393 extern struct Lisp_Hash_Table *allocate_hash_table P_ ((void));
2394 extern struct window *allocate_window P_ ((void));
2395 extern struct frame *allocate_frame P_ ((void));
2396 extern struct Lisp_Process *allocate_process P_ ((void));
2397 extern int gc_in_progress;
2398 extern int abort_on_gc;
2399 extern Lisp_Object make_float P_ ((double));
2400 extern void display_malloc_warning P_ ((void));
2401 extern int inhibit_garbage_collection P_ ((void));
2402 extern Lisp_Object make_save_value P_ ((void *, int));
2403 extern void free_marker P_ ((Lisp_Object));
2404 extern void free_cons P_ ((struct Lisp_Cons *));
2405 extern void init_alloc_once P_ ((void));
2406 extern void init_alloc P_ ((void));
2407 extern void syms_of_alloc P_ ((void));
2408 extern struct buffer * allocate_buffer P_ ((void));
2410 /* Defined in print.c */
2411 extern Lisp_Object Vprin1_to_string_buffer;
2412 extern void debug_print P_ ((Lisp_Object));
2413 EXFUN (Fprin1, 2);
2414 EXFUN (Fprin1_to_string, 2);
2415 EXFUN (Fprinc, 2);
2416 EXFUN (Fterpri, 1);
2417 EXFUN (Fprint, 2);
2418 EXFUN (Ferror_message_string, 1);
2419 extern Lisp_Object Vstandard_output, Qstandard_output;
2420 extern Lisp_Object Qexternal_debugging_output;
2421 extern void temp_output_buffer_setup P_ ((const char *));
2422 extern int print_level, print_escape_newlines;
2423 extern Lisp_Object Qprint_escape_newlines;
2424 extern void write_string P_ ((char *, int));
2425 extern void write_string_1 P_ ((char *, int, Lisp_Object));
2426 extern void print_error_message P_ ((Lisp_Object, Lisp_Object, char *, Lisp_Object));
2427 extern Lisp_Object internal_with_output_to_temp_buffer
2428 P_ ((const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object));
2429 extern void float_to_string P_ ((unsigned char *, double));
2430 extern void syms_of_print P_ ((void));
2432 /* Defined in doprnt.c */
2433 extern int doprnt P_ ((char *, int, char *, char *, int, char **));
2434 extern int doprnt_lisp P_ ((char *, int, char *, char *, int, char **));
2436 /* Defined in lread.c */
2437 extern Lisp_Object Qvariable_documentation, Qstandard_input;
2438 extern Lisp_Object Vobarray, initial_obarray, Vstandard_input;
2439 EXFUN (Fread, 1);
2440 EXFUN (Fread_from_string, 3);
2441 EXFUN (Fintern, 2);
2442 EXFUN (Fintern_soft, 2);
2443 EXFUN (Fload, 5);
2444 EXFUN (Fget_file_char, 0);
2445 EXFUN (Fread_char, 2);
2446 EXFUN (Fread_event, 2);
2447 extern Lisp_Object read_filtered_event P_ ((int, int, int, int));
2448 EXFUN (Feval_region, 4);
2449 extern Lisp_Object intern P_ ((const char *));
2450 extern Lisp_Object make_symbol P_ ((char *));
2451 extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int));
2452 #define LOADHIST_ATTACH(x) \
2453 if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list)
2454 extern Lisp_Object Vcurrent_load_list;
2455 extern Lisp_Object Vload_history, Vload_suffixes;
2456 extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
2457 Lisp_Object *, Lisp_Object));
2458 extern int isfloat_string P_ ((char *));
2459 extern void map_obarray P_ ((Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
2460 Lisp_Object));
2461 extern void dir_warning P_ ((char *, Lisp_Object));
2462 extern void close_load_descs P_ ((void));
2463 extern void init_obarray P_ ((void));
2464 extern void init_lread P_ ((void));
2465 extern void syms_of_lread P_ ((void));
2467 /* Defined in eval.c */
2468 extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
2469 extern Lisp_Object Vinhibit_quit, Qinhibit_quit, Vquit_flag;
2470 extern Lisp_Object Vautoload_queue;
2471 extern Lisp_Object Vdebug_on_error;
2472 extern Lisp_Object Vsignaling_function;
2473 extern int handling_signal;
2474 extern int interactive_p P_ ((int));
2476 /* To run a normal hook, use the appropriate function from the list below.
2477 The calling convention:
2479 if (!NILP (Vrun_hooks))
2480 call1 (Vrun_hooks, Qmy_funny_hook);
2482 should no longer be used. */
2483 extern Lisp_Object Vrun_hooks;
2484 EXFUN (Frun_hooks, MANY);
2485 EXFUN (Frun_hook_with_args, MANY);
2486 EXFUN (Frun_hook_with_args_until_success, MANY);
2487 EXFUN (Frun_hook_with_args_until_failure, MANY);
2488 extern Lisp_Object run_hook_list_with_args P_ ((Lisp_Object, int, Lisp_Object *));
2489 extern void run_hook_with_args_2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
2490 EXFUN (Fand, UNEVALLED);
2491 EXFUN (For, UNEVALLED);
2492 EXFUN (Fif, UNEVALLED);
2493 EXFUN (Fprogn, UNEVALLED);
2494 EXFUN (Fprog1, UNEVALLED);
2495 EXFUN (Fprog2, UNEVALLED);
2496 EXFUN (Fsetq, UNEVALLED);
2497 EXFUN (Fquote, UNEVALLED);
2498 EXFUN (Fuser_variable_p, 1);
2499 EXFUN (Finteractive_p, 0);
2500 EXFUN (Fdefun, UNEVALLED);
2501 EXFUN (Flet, UNEVALLED);
2502 EXFUN (FletX, UNEVALLED);
2503 EXFUN (Fwhile, UNEVALLED);
2504 EXFUN (Fcatch, UNEVALLED);
2505 EXFUN (Fthrow, 2) NO_RETURN;
2506 EXFUN (Funwind_protect, UNEVALLED);
2507 EXFUN (Fcondition_case, UNEVALLED);
2508 EXFUN (Fsignal, 2);
2509 EXFUN (Fautoload, 5);
2510 EXFUN (Fcommandp, 2);
2511 EXFUN (Feval, 1);
2512 EXFUN (Fapply, MANY);
2513 EXFUN (Ffuncall, MANY);
2514 EXFUN (Fbacktrace, 0);
2515 extern Lisp_Object apply1 P_ ((Lisp_Object, Lisp_Object));
2516 extern Lisp_Object call0 P_ ((Lisp_Object));
2517 extern Lisp_Object call1 P_ ((Lisp_Object, Lisp_Object));
2518 extern Lisp_Object call2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
2519 extern Lisp_Object call3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2520 extern Lisp_Object call4 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2521 extern Lisp_Object call5 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2522 extern Lisp_Object call6 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2523 EXFUN (Fdo_auto_save, 2);
2524 extern Lisp_Object apply_lambda P_ ((Lisp_Object, Lisp_Object, int));
2525 extern Lisp_Object internal_catch P_ ((Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object));
2526 extern Lisp_Object internal_condition_case P_ ((Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object)));
2527 extern Lisp_Object internal_condition_case_1 P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)));
2528 extern Lisp_Object internal_condition_case_2 P_ ((Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object)));
2529 extern void specbind P_ ((Lisp_Object, Lisp_Object));
2530 extern void record_unwind_protect P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object));
2531 extern Lisp_Object unbind_to P_ ((int, Lisp_Object));
2532 extern void error P_ ((/* char *, ... */)) NO_RETURN;
2533 extern void do_autoload P_ ((Lisp_Object, Lisp_Object));
2534 extern Lisp_Object un_autoload P_ ((Lisp_Object));
2535 EXFUN (Ffetch_bytecode, 1);
2536 extern void init_eval_once P_ ((void));
2537 extern Lisp_Object safe_call P_ ((int, Lisp_Object *));
2538 extern Lisp_Object safe_call1 P_ ((Lisp_Object, Lisp_Object));
2539 extern void init_eval P_ ((void));
2540 extern void syms_of_eval P_ ((void));
2542 /* Defined in editfns.c */
2543 EXFUN (Fpropertize, MANY);
2544 EXFUN (Fcurrent_message, 0);
2545 EXFUN (Fgoto_char, 1);
2546 EXFUN (Fpoint_min_marker, 0);
2547 EXFUN (Fpoint_max_marker, 0);
2548 EXFUN (Fpoint_min, 0);
2549 EXFUN (Fpoint_max, 0);
2550 EXFUN (Fpoint, 0);
2551 EXFUN (Fpoint_marker, 0);
2552 EXFUN (Fmark_marker, 0);
2553 EXFUN (Fline_beginning_position, 1);
2554 EXFUN (Fline_end_position, 1);
2555 EXFUN (Ffollowing_char, 0);
2556 EXFUN (Fprevious_char, 0);
2557 EXFUN (Fchar_after, 1);
2558 EXFUN (Finsert, MANY);
2559 EXFUN (Finsert_and_inherit, MANY);
2560 EXFUN (Finsert_before_markers, MANY);
2561 EXFUN (Finsert_buffer_substring, 3);
2562 EXFUN (Finsert_char, 3);
2563 extern void insert1 P_ ((Lisp_Object));
2564 EXFUN (Feolp, 0);
2565 EXFUN (Feobp, 0);
2566 EXFUN (Fbolp, 0);
2567 EXFUN (Fbobp, 0);
2568 EXFUN (Fformat, MANY);
2569 EXFUN (Fmessage, MANY);
2570 extern Lisp_Object format2 P_ ((char *, Lisp_Object, Lisp_Object));
2571 extern Lisp_Object make_buffer_string P_ ((int, int, int));
2572 EXFUN (Fbuffer_substring, 2);
2573 EXFUN (Fbuffer_string, 0);
2574 extern Lisp_Object save_excursion_save P_ ((void));
2575 extern Lisp_Object save_restriction_save P_ ((void));
2576 extern Lisp_Object save_excursion_restore P_ ((Lisp_Object));
2577 extern Lisp_Object save_restriction_restore P_ ((Lisp_Object));
2578 EXFUN (Fchar_to_string, 1);
2579 EXFUN (Fdelete_region, 2);
2580 EXFUN (Fnarrow_to_region, 2);
2581 EXFUN (Fwiden, 0);
2582 EXFUN (Fuser_login_name, 1);
2583 EXFUN (Fsystem_name, 0);
2584 EXFUN (Fcurrent_time, 0);
2585 extern int clip_to_bounds P_ ((int, int, int));
2586 extern Lisp_Object make_buffer_string P_ ((int, int, int));
2587 extern Lisp_Object make_buffer_string_both P_ ((int, int, int, int, int));
2588 extern void init_editfns P_ ((void));
2589 extern void syms_of_editfns P_ ((void));
2590 EXFUN (Fcurrent_message, 0);
2591 extern Lisp_Object Vinhibit_field_text_motion;
2592 EXFUN (Fconstrain_to_field, 5);
2593 EXFUN (Ffield_string, 1);
2594 EXFUN (Fdelete_field, 1);
2595 EXFUN (Ffield_beginning, 3);
2596 EXFUN (Ffield_end, 3);
2597 EXFUN (Ffield_string_no_properties, 1);
2598 extern void set_time_zone_rule P_ ((char *));
2600 /* defined in buffer.c */
2601 extern int mouse_face_overlay_overlaps P_ ((Lisp_Object));
2602 extern void nsberror P_ ((Lisp_Object));
2603 extern char *no_switch_window P_ ((Lisp_Object window));
2604 EXFUN (Fset_buffer_multibyte, 1);
2605 EXFUN (Foverlay_start, 1);
2606 EXFUN (Foverlay_end, 1);
2607 extern void adjust_overlays_for_insert P_ ((EMACS_INT, EMACS_INT));
2608 extern void adjust_overlays_for_delete P_ ((EMACS_INT, EMACS_INT));
2609 extern void fix_overlays_in_range P_ ((int, int));
2610 extern void report_overlay_modification P_ ((Lisp_Object, Lisp_Object, int,
2611 Lisp_Object, Lisp_Object, Lisp_Object));
2612 extern int overlay_touches_p P_ ((int));
2613 extern Lisp_Object Vbuffer_alist, Vinhibit_read_only;
2614 EXFUN (Fget_buffer, 1);
2615 EXFUN (Fget_buffer_create, 1);
2616 EXFUN (Fset_buffer, 1);
2617 EXFUN (set_buffer_if_live, 1);
2618 EXFUN (Fbarf_if_buffer_read_only, 0);
2619 EXFUN (Fcurrent_buffer, 0);
2620 EXFUN (Fswitch_to_buffer, 2);
2621 EXFUN (Fpop_to_buffer, 3);
2622 EXFUN (Fother_buffer, 3);
2623 EXFUN (Foverlay_get, 2);
2624 EXFUN (Fbuffer_modified_p, 1);
2625 EXFUN (Fset_buffer_modified_p, 1);
2626 EXFUN (Fkill_buffer, 1);
2627 EXFUN (Fkill_all_local_variables, 0);
2628 EXFUN (Fbuffer_disable_undo, 1);
2629 EXFUN (Fbuffer_enable_undo, 1);
2630 EXFUN (Ferase_buffer, 0);
2631 extern Lisp_Object Qoverlayp;
2632 extern Lisp_Object get_truename_buffer P_ ((Lisp_Object));
2633 extern struct buffer *all_buffers;
2634 EXFUN (Fprevious_overlay_change, 1);
2635 EXFUN (Fbuffer_file_name, 1);
2636 extern void init_buffer_once P_ ((void));
2637 extern void init_buffer P_ ((void));
2638 extern void syms_of_buffer P_ ((void));
2639 extern void keys_of_buffer P_ ((void));
2641 /* defined in marker.c */
2643 EXFUN (Fmarker_position, 1);
2644 EXFUN (Fmarker_buffer, 1);
2645 EXFUN (Fcopy_marker, 2);
2646 EXFUN (Fset_marker, 3);
2647 extern int marker_position P_ ((Lisp_Object));
2648 extern int marker_byte_position P_ ((Lisp_Object));
2649 extern void clear_charpos_cache P_ ((struct buffer *));
2650 extern int charpos_to_bytepos P_ ((int));
2651 extern int buf_charpos_to_bytepos P_ ((struct buffer *, int));
2652 extern int buf_bytepos_to_charpos P_ ((struct buffer *, int));
2653 extern void unchain_marker P_ ((struct Lisp_Marker *marker));
2654 extern Lisp_Object set_marker_restricted P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
2655 extern Lisp_Object set_marker_both P_ ((Lisp_Object, Lisp_Object, int, int));
2656 extern Lisp_Object set_marker_restricted_both P_ ((Lisp_Object, Lisp_Object,
2657 int, int));
2658 extern void syms_of_marker P_ ((void));
2660 /* Defined in fileio.c */
2662 extern Lisp_Object Qfile_error;
2663 EXFUN (Ffind_file_name_handler, 2);
2664 EXFUN (Ffile_name_as_directory, 1);
2665 EXFUN (Fmake_temp_name, 1);
2666 EXFUN (Fexpand_file_name, 2);
2667 EXFUN (Ffile_name_nondirectory, 1);
2668 EXFUN (Fsubstitute_in_file_name, 1);
2669 EXFUN (Ffile_symlink_p, 1);
2670 EXFUN (Fverify_visited_file_modtime, 1);
2671 EXFUN (Ffile_exists_p, 1);
2672 EXFUN (Ffile_name_absolute_p, 1);
2673 EXFUN (Fdirectory_file_name, 1);
2674 EXFUN (Ffile_name_directory, 1);
2675 extern Lisp_Object expand_and_dir_to_file P_ ((Lisp_Object, Lisp_Object));
2676 EXFUN (Ffile_accessible_directory_p, 1);
2677 EXFUN (Funhandled_file_name_directory, 1);
2678 EXFUN (Ffile_directory_p, 1);
2679 EXFUN (Fwrite_region, 7);
2680 EXFUN (Ffile_readable_p, 1);
2681 EXFUN (Ffile_executable_p, 1);
2682 EXFUN (Fread_file_name, 6);
2683 extern Lisp_Object close_file_unwind P_ ((Lisp_Object));
2684 extern void report_file_error P_ ((const char *, Lisp_Object));
2685 extern int internal_delete_file P_ ((Lisp_Object));
2686 extern void syms_of_fileio P_ ((void));
2687 EXFUN (Fmake_temp_name, 1);
2688 extern void init_fileio_once P_ ((void));
2689 extern Lisp_Object make_temp_name P_ ((Lisp_Object, int));
2691 /* Defined in abbrev.c */
2693 extern void syms_of_abbrev P_ ((void));
2695 /* defined in search.c */
2696 extern void shrink_regexp_cache P_ ((void));
2697 EXFUN (Fstring_match, 3);
2698 extern void restore_match_data P_ ((void));
2699 EXFUN (Fmatch_data, 2);
2700 EXFUN (Fset_match_data, 1);
2701 EXFUN (Fmatch_beginning, 1);
2702 EXFUN (Fmatch_end, 1);
2703 EXFUN (Flooking_at, 1);
2704 extern int fast_string_match P_ ((Lisp_Object, Lisp_Object));
2705 extern int fast_c_string_match_ignore_case P_ ((Lisp_Object, const char *));
2706 extern int scan_buffer P_ ((int, int, int, int, int *, int));
2707 extern int scan_newline P_ ((int, int, int, int, int, int));
2708 extern int find_next_newline P_ ((int, int));
2709 extern int find_next_newline_no_quit P_ ((int, int));
2710 extern int find_before_next_newline P_ ((int, int, int));
2711 extern void syms_of_search P_ ((void));
2713 /* defined in minibuf.c */
2715 extern Lisp_Object last_minibuf_string;
2716 extern void choose_minibuf_frame P_ ((void));
2717 EXFUN (Fcompleting_read, 8);
2718 EXFUN (Fread_from_minibuffer, 7);
2719 EXFUN (Fread_variable, 2);
2720 EXFUN (Fread_buffer, 3);
2721 EXFUN (Fread_minibuffer, 2);
2722 EXFUN (Feval_minibuffer, 2);
2723 EXFUN (Fread_string, 5);
2724 EXFUN (Fread_no_blanks_input, 3);
2725 extern Lisp_Object get_minibuffer P_ ((int));
2726 extern void temp_echo_area_glyphs P_ ((Lisp_Object));
2727 extern void init_minibuf_once P_ ((void));
2728 extern void syms_of_minibuf P_ ((void));
2729 extern void keys_of_minibuf P_ ((void));
2731 /* Defined in callint.c */
2733 extern Lisp_Object Qminus, Qplus, Vcurrent_prefix_arg;
2734 extern Lisp_Object Vcommand_history;
2735 extern Lisp_Object Qcall_interactively, Qmouse_leave_buffer_hook;
2736 EXFUN (Fcall_interactively, 3);
2737 EXFUN (Fprefix_numeric_value, 1);
2738 extern void syms_of_callint P_ ((void));
2740 /* defined in casefiddle.c */
2742 EXFUN (Fdowncase, 1);
2743 EXFUN (Fupcase, 1);
2744 EXFUN (Fcapitalize, 1);
2745 EXFUN (Fupcase_region, 2);
2746 EXFUN (Fupcase_initials, 1);
2747 EXFUN (Fupcase_initials_region, 2);
2748 extern void syms_of_casefiddle P_ ((void));
2749 extern void keys_of_casefiddle P_ ((void));
2751 /* defined in casetab.c */
2753 EXFUN (Fset_case_table, 1);
2754 EXFUN (Fset_standard_case_table, 1);
2755 extern void init_casetab_once P_ ((void));
2756 extern void syms_of_casetab P_ ((void));
2758 /* defined in keyboard.c */
2760 extern int echoing;
2761 extern Lisp_Object echo_message_buffer;
2762 extern struct kboard *echo_kboard;
2763 extern void cancel_echoing P_ ((void));
2764 extern Lisp_Object Qdisabled, QCfilter;
2765 extern Lisp_Object Vtty_erase_char, Vhelp_form, Vtop_level;
2766 extern int input_pending;
2767 EXFUN (Fdiscard_input, 0);
2768 EXFUN (Frecursive_edit, 0);
2769 EXFUN (Ftop_level, 0);
2770 EXFUN (Fcommand_execute, 4);
2771 EXFUN (Finput_pending_p, 0);
2772 extern Lisp_Object menu_bar_items P_ ((Lisp_Object));
2773 extern Lisp_Object tool_bar_items P_ ((Lisp_Object, int *));
2774 extern Lisp_Object Qvertical_scroll_bar;
2775 extern void discard_mouse_events P_ ((void));
2776 EXFUN (Fevent_convert_list, 1);
2777 EXFUN (Fread_key_sequence, 5);
2778 EXFUN (Fset_input_mode, 4);
2779 extern int detect_input_pending P_ ((void));
2780 extern int detect_input_pending_run_timers P_ ((int));
2781 extern void safe_run_hooks P_ ((Lisp_Object));
2782 extern void cmd_error_internal P_ ((Lisp_Object, char *));
2783 extern Lisp_Object command_loop_1 P_ ((void));
2784 extern Lisp_Object recursive_edit_1 P_ ((void));
2785 extern void record_auto_save P_ ((void));
2786 extern void init_keyboard P_ ((void));
2787 extern void syms_of_keyboard P_ ((void));
2788 extern void keys_of_keyboard P_ ((void));
2789 extern char *push_key_description P_ ((unsigned int, char *, int));
2792 /* defined in indent.c */
2793 EXFUN (Fvertical_motion, 2);
2794 EXFUN (Findent_to, 2);
2795 EXFUN (Fcurrent_column, 0);
2796 EXFUN (Fmove_to_column, 2);
2797 extern double current_column P_ ((void));
2798 extern void invalidate_current_column P_ ((void));
2799 extern int indented_beyond_p P_ ((int, int, double));
2800 extern void syms_of_indent P_ ((void));
2802 /* defined in frame.c */
2803 extern Lisp_Object Qvisible;
2804 extern void store_frame_param P_ ((struct frame *, Lisp_Object, Lisp_Object));
2805 extern void store_in_alist P_ ((Lisp_Object *, Lisp_Object, Lisp_Object));
2806 extern Lisp_Object do_switch_frame P_ ((Lisp_Object, int, int));
2807 extern Lisp_Object get_frame_param P_ ((struct frame *, Lisp_Object));
2808 extern Lisp_Object frame_buffer_predicate P_ ((Lisp_Object));
2809 EXFUN (Fframep, 1);
2810 EXFUN (Fselect_frame, 2);
2811 EXFUN (Fselected_frame, 0);
2812 EXFUN (Fwindow_frame, 1);
2813 EXFUN (Fframe_root_window, 1);
2814 EXFUN (Fframe_first_window, 1);
2815 EXFUN (Fframe_selected_window, 1);
2816 EXFUN (Fframe_list, 0);
2817 EXFUN (Fnext_frame, 2);
2818 EXFUN (Fdelete_frame, 2);
2819 EXFUN (Fset_mouse_position, 3);
2820 EXFUN (Fmake_frame_visible, 1);
2821 EXFUN (Fmake_frame_invisible, 2);
2822 EXFUN (Ficonify_frame, 1);
2823 EXFUN (Fframe_visible_p, 1);
2824 EXFUN (Fvisible_frame_list, 0);
2825 EXFUN (Fframe_parameter, 2);
2826 EXFUN (Fframe_parameters, 1);
2827 EXFUN (Fmodify_frame_parameters, 2);
2828 EXFUN (Fset_frame_height, 3);
2829 EXFUN (Fset_frame_width, 3);
2830 EXFUN (Fset_frame_size, 3);
2831 EXFUN (Fset_frame_position, 3);
2832 EXFUN (Fraise_frame, 1);
2833 EXFUN (Fredirect_frame_focus, 2);
2834 EXFUN (Fset_frame_selected_window, 2);
2835 extern Lisp_Object frame_buffer_list P_ ((Lisp_Object));
2836 extern void frames_discard_buffer P_ ((Lisp_Object));
2837 extern void set_frame_buffer_list P_ ((Lisp_Object, Lisp_Object));
2838 extern void frames_bury_buffer P_ ((Lisp_Object));
2839 extern void syms_of_frame P_ ((void));
2841 /* defined in emacs.c */
2842 extern Lisp_Object decode_env_path P_ ((char *, char *));
2843 extern Lisp_Object Vinvocation_name, Vinvocation_directory;
2844 extern Lisp_Object Vinstallation_directory, empty_string;
2845 EXFUN (Fkill_emacs, 1);
2846 #if HAVE_SETLOCALE
2847 void fixup_locale P_ ((void));
2848 void synchronize_system_messages_locale P_ ((void));
2849 void synchronize_system_time_locale P_ ((void));
2850 #else
2851 #define setlocale(category, locale)
2852 #define fixup_locale()
2853 #define synchronize_system_messages_locale()
2854 #define synchronize_system_time_locale()
2855 #endif
2856 void shut_down_emacs P_ ((int, int, Lisp_Object));
2857 /* Nonzero means don't do interactive redisplay and don't change tty modes */
2858 extern int noninteractive;
2859 /* Nonzero means don't do use window-system-specific display code */
2860 extern int inhibit_window_system;
2861 /* Nonzero means that a filter or a sentinel is running. */
2862 extern int running_asynch_code;
2864 /* defined in process.c */
2865 EXFUN (Fget_process, 1);
2866 EXFUN (Fget_buffer_process, 1);
2867 EXFUN (Fprocessp, 1);
2868 EXFUN (Fprocess_status, 1);
2869 EXFUN (Fkill_process, 2);
2870 EXFUN (Fprocess_send_eof, 1);
2871 EXFUN (Fwaiting_for_user_input_p, 0);
2872 extern Lisp_Object Qprocessp;
2873 extern void kill_buffer_processes P_ ((Lisp_Object));
2874 extern int wait_reading_process_input P_ ((int, int, Lisp_Object, int));
2875 extern void deactivate_process P_ ((Lisp_Object));
2876 extern void add_keyboard_wait_descriptor P_ ((int));
2877 extern void delete_keyboard_wait_descriptor P_ ((int));
2878 extern void close_process_descs P_ ((void));
2879 extern void status_notify P_ ((void));
2880 extern int read_process_output P_ ((Lisp_Object, int));
2881 extern void init_process P_ ((void));
2882 extern void syms_of_process P_ ((void));
2883 extern void setup_process_coding_systems P_ ((Lisp_Object));
2885 /* defined in callproc.c */
2886 extern Lisp_Object Vexec_path, Vexec_suffixes,
2887 Vexec_directory, Vdata_directory;
2888 extern Lisp_Object Vdoc_directory;
2889 EXFUN (Fcall_process, MANY);
2890 extern int child_setup P_ ((int, int, int, char **, int, Lisp_Object));
2891 extern void init_callproc_1 P_ ((void));
2892 extern void init_callproc P_ ((void));
2893 extern void set_process_environment P_ ((void));
2894 extern void syms_of_callproc P_ ((void));
2896 /* defined in doc.c */
2897 extern Lisp_Object Vdoc_file_name;
2898 EXFUN (Fsubstitute_command_keys, 1);
2899 EXFUN (Fdocumentation, 2);
2900 EXFUN (Fdocumentation_property, 3);
2901 extern Lisp_Object read_doc_string P_ ((Lisp_Object));
2902 extern Lisp_Object get_doc_string P_ ((Lisp_Object, int, int));
2903 extern void syms_of_doc P_ ((void));
2904 extern int read_bytecode_char P_ ((int));
2906 /* defined in bytecode.c */
2907 extern Lisp_Object Qbytecode;
2908 EXFUN (Fbyte_code, 3);
2909 extern void syms_of_bytecode P_ ((void));
2910 extern struct byte_stack *byte_stack_list;
2911 extern void mark_byte_stack P_ ((void));
2912 extern void unmark_byte_stack P_ ((void));
2914 /* defined in macros.c */
2915 extern Lisp_Object Qexecute_kbd_macro;
2916 EXFUN (Fexecute_kbd_macro, 3);
2917 EXFUN (Fcancel_kbd_macro_events, 0);
2918 extern void init_macros P_ ((void));
2919 extern void syms_of_macros P_ ((void));
2921 /* defined in undo.c */
2922 extern Lisp_Object Qinhibit_read_only;
2923 EXFUN (Fundo_boundary, 0);
2924 extern Lisp_Object truncate_undo_list P_ ((Lisp_Object, int, int));
2925 extern void record_marker_adjustment P_ ((Lisp_Object, int));
2926 extern void record_insert P_ ((int, int));
2927 extern void record_delete P_ ((int, Lisp_Object));
2928 extern void record_first_change P_ ((void));
2929 extern void record_change P_ ((int, int));
2930 extern void record_property_change P_ ((int, int, Lisp_Object, Lisp_Object,
2931 Lisp_Object));
2932 extern void syms_of_undo P_ ((void));
2934 /* defined in textprop.c */
2935 extern Lisp_Object Qfont, Qmouse_face;
2936 extern Lisp_Object Qinsert_in_front_hooks, Qinsert_behind_hooks;
2937 EXFUN (Fnext_single_property_change, 4);
2938 EXFUN (Fnext_single_char_property_change, 4);
2939 EXFUN (Fprevious_single_property_change, 4);
2940 EXFUN (Fput_text_property, 5);
2941 EXFUN (Fprevious_char_property_change, 2);
2942 EXFUN (Fnext_char_property_change, 2);
2943 extern void report_interval_modification P_ ((Lisp_Object, Lisp_Object));
2944 extern Lisp_Object next_single_char_property_change P_ ((Lisp_Object,
2945 Lisp_Object,
2946 Lisp_Object,
2947 Lisp_Object));
2949 /* defined in xmenu.c */
2950 EXFUN (Fx_popup_menu, 2);
2951 EXFUN (Fx_popup_dialog, 2);
2952 extern void syms_of_xmenu P_ ((void));
2954 /* defined in sysdep.c */
2955 extern void stuff_char P_ ((char c));
2956 extern void init_sigio P_ ((int));
2957 extern void request_sigio P_ ((void));
2958 extern void unrequest_sigio P_ ((void));
2959 extern void reset_sys_modes P_ ((void));
2960 extern void sys_subshell P_ ((void));
2961 extern void sys_suspend P_ ((void));
2962 extern void discard_tty_input P_ ((void));
2963 extern void init_sys_modes P_ ((void));
2964 extern void reset_sys_modes P_ ((void));
2965 extern void get_frame_size P_ ((int *, int *));
2966 extern void wait_for_termination P_ ((int));
2967 extern void flush_pending_output P_ ((int));
2968 extern void child_setup_tty P_ ((int));
2969 extern void setup_pty P_ ((int));
2970 extern int set_window_size P_ ((int, int, int));
2971 extern void create_process P_ ((Lisp_Object, char **, Lisp_Object));
2972 extern int tabs_safe_p P_ ((void));
2973 extern void init_baud_rate P_ ((void));
2974 extern int emacs_open P_ ((const char *, int, int));
2975 extern int emacs_close P_ ((int));
2976 extern int emacs_read P_ ((int, char *, unsigned int));
2977 extern int emacs_write P_ ((int, const char *, unsigned int));
2979 /* defined in filelock.c */
2980 EXFUN (Funlock_buffer, 0);
2981 EXFUN (Ffile_locked_p, 1);
2982 extern void unlock_all_files P_ ((void));
2983 extern void lock_file P_ ((Lisp_Object));
2984 extern void unlock_file P_ ((Lisp_Object));
2985 extern void unlock_buffer P_ ((struct buffer *));
2986 extern void syms_of_filelock P_ ((void));
2987 extern void init_filelock P_ ((void));
2989 /* Defined in sound.c */
2990 extern void syms_of_sound P_ ((void));
2991 extern void init_sound P_ ((void));
2993 /* Defined in category.c */
2994 extern void init_category_once P_ ((void));
2995 extern void syms_of_category P_ ((void));
2997 /* Defined in ccl.c */
2998 extern void syms_of_ccl P_ ((void));
3000 /* Defined in dired.c */
3001 EXFUN (Ffile_attributes, 1);
3002 extern void syms_of_dired P_ ((void));
3004 /* Defined in term.c */
3005 extern void syms_of_term P_ ((void));
3006 extern void fatal () NO_RETURN;
3008 #ifdef HAVE_X_WINDOWS
3009 /* Defined in fontset.c */
3010 extern void syms_of_fontset P_ ((void));
3011 EXFUN (Fset_fontset_font, 4);
3012 #endif
3014 /* Defined in xfaces.c */
3015 extern void syms_of_xfaces P_ ((void));
3017 /* Defined in getloadavg.c */
3018 extern int getloadavg P_ ((double *, int));
3020 #ifdef HAVE_X_WINDOWS
3021 /* Defined in xfns.c */
3022 extern void syms_of_xfns P_ ((void));
3023 extern void init_xfns P_ ((void));
3024 extern Lisp_Object Vx_resource_name;
3025 extern Lisp_Object Vx_resource_class;
3026 EXFUN (Fxw_display_color_p, 1);
3027 EXFUN (Fx_file_dialog, 4);
3028 #endif /* HAVE_X_WINDOWS */
3030 /* Defined in xsmfns.c */
3031 extern void syms_of_xsmfns P_ ((void));
3033 /* Defined in xselect.c */
3034 extern void syms_of_xselect P_ ((void));
3036 /* Defined in xterm.c */
3037 extern void syms_of_xterm P_ ((void));
3039 /* Defined in getloadavg.c */
3040 extern int getloadavg P_ ((double [], int));
3042 /* Nonzero means Emacs has already been initialized.
3043 Used during startup to detect startup of dumped Emacs. */
3044 extern int initialized;
3046 extern int immediate_quit; /* Nonzero means ^G can quit instantly */
3048 extern POINTER_TYPE *xmalloc P_ ((size_t));
3049 extern POINTER_TYPE *xrealloc P_ ((POINTER_TYPE *, size_t));
3050 extern void xfree P_ ((POINTER_TYPE *));
3052 extern char *xstrdup P_ ((const char *));
3054 #ifndef USE_CRT_DLL
3055 extern char *egetenv P_ ((char *));
3056 #endif
3058 /* Set up the name of the machine we're running on. */
3059 extern void init_system_name P_ ((void));
3061 /* Some systems (e.g., NT) use a different path separator than Unix,
3062 in addition to a device separator. Default the path separator
3063 to '/', and don't test for a device separator in IS_ANY_SEP. */
3065 #ifdef WINDOWSNT
3066 extern Lisp_Object Vdirectory_sep_char;
3067 #endif
3069 #ifndef DIRECTORY_SEP
3070 #define DIRECTORY_SEP '/'
3071 #endif
3072 #ifndef IS_DIRECTORY_SEP
3073 #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
3074 #endif
3075 #ifndef IS_DEVICE_SEP
3076 #ifndef DEVICE_SEP
3077 #define IS_DEVICE_SEP(_c_) 0
3078 #else
3079 #define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP)
3080 #endif
3081 #endif
3082 #ifndef IS_ANY_SEP
3083 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_))
3084 #endif
3086 #ifdef SWITCH_ENUM_BUG
3087 #define SWITCH_ENUM_CAST(x) ((int)(x))
3088 #else
3089 #define SWITCH_ENUM_CAST(x) (x)
3090 #endif
3092 /* Loop over Lisp list LIST. Signal an error if LIST is not a proper
3093 list, or if it contains circles.
3095 HARE and TORTOISE should be the names of Lisp_Object variables, and
3096 N should be the name of an EMACS_INT variable declared in the
3097 function where the macro is used. Each nested loop should use
3098 its own variables.
3100 In the loop body, HARE is set to each cons of LIST, and N is the
3101 length of the list processed so far. */
3103 #define LIST_END_P(list, obj) \
3104 (NILP (obj) \
3105 ? 1 \
3106 : (CONSP (obj) \
3107 ? 0 \
3108 : (wrong_type_argument (Qlistp, (list))), 1))
3110 #define FOREACH(hare, list, tortoise, n) \
3111 for (tortoise = hare = (list), n = 0; \
3112 !LIST_END_P (list, hare); \
3113 (hare = XCDR (hare), ++n, \
3114 ((n & 1) != 0 \
3115 ? (tortoise = XCDR (tortoise), \
3116 (EQ (hare, tortoise) \
3117 && (circular_list_error ((list)), 1))) \
3118 : 0)))
3120 /* The ubiquitous min and max macros. */
3122 #ifdef max
3123 #undef max
3124 #undef min
3125 #endif
3126 #define min(a, b) ((a) < (b) ? (a) : (b))
3127 #define max(a, b) ((a) > (b) ? (a) : (b))
3129 /* Return a fixnum or float, depending on whether VAL fits in a Lisp
3130 fixnum. */
3132 #define make_fixnum_or_float(val) \
3133 (FIXNUM_OVERFLOW_P (val) \
3134 ? make_float (val) \
3135 : make_number ((EMACS_INT)(val)))
3137 #endif /* EMACS_LISP_H */
3139 /* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e
3140 (do not change this comment) */