Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-16
[bpt/emacs.git] / src / lisp.h
CommitLineData
3cfe6dfd 1/* Fundamental definitions for GNU Emacs Lisp interpreter.
6b61353c 2 Copyright (C) 1985,86,87,93,94,95,97,98,1999,2000,01,02,03,2004
f05d7ea2 3 Free Software Foundation, Inc.
3cfe6dfd
JB
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
4746118a 9the Free Software Foundation; either version 2, or (at your option)
3cfe6dfd
JB
10any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs; see the file COPYING. If not, write to
3b7ad313
EN
19the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
3cfe6dfd 21
6b61353c
KH
22#ifndef EMACS_LISP_H
23#define EMACS_LISP_H
24
5010d3b8 25/* Declare the prototype for a general external function. */
9043c90a 26#if defined (PROTOTYPES) || defined (WINDOWSNT)
5010d3b8
GM
27#define P_(proto) proto
28#else
29#define P_(proto) ()
30#endif
31
97305dec 32#if 0
35f464a7
GM
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. */
36
37#define GC_CHECK_STRING_BYTES 1
cdcf58d8
KS
38
39/* Define this to check for short string overrun. */
40
41#define GC_CHECK_STRING_OVERRUN 1
42
43/* Define this to check the string free list. */
44
45#define GC_CHECK_STRING_FREE_LIST 1
46
47/* Define this to check for malloc buffer overrun. */
48
49#define XMALLOC_OVERRUN_CHECK 1
50
51/* Define this to check for errors in cons list. */
52/* #define GC_CHECK_CONS_LIST 1 */
53
03628814 54#endif /* 0 */
35f464a7 55
3cfe6dfd 56
ce99fd65 57/* These are default choices for the types to use. */
68c45bf0
PE
58#ifdef _LP64
59#ifndef EMACS_INT
60#define EMACS_INT long
61#define BITS_PER_EMACS_INT BITS_PER_LONG
62#endif
63#ifndef EMACS_UINT
64#define EMACS_UINT unsigned long
65#endif
66#else /* not _LP64 */
ce99fd65
RS
67#ifndef EMACS_INT
68#define EMACS_INT int
1747fb16 69#define BITS_PER_EMACS_INT BITS_PER_INT
ce99fd65
RS
70#endif
71#ifndef EMACS_UINT
72#define EMACS_UINT unsigned int
73#endif
68c45bf0 74#endif
ce99fd65 75
e0b8c689
KR
76/* Extra internal type checking? */
77extern int suppress_checking;
e0b8c689 78extern void die P_((const char *, const char *, int));
c6129d7e
KR
79
80#ifdef ENABLE_CHECKING
81
6cbe2e28 82#define CHECK(check,msg) (((check) || suppress_checking \
7eb9e30d 83 ? (void) 0 \
6cbe2e28 84 : die ((msg), __FILE__, __LINE__)), \
c6129d7e 85 0)
e0b8c689 86#else
c6129d7e 87
e0b8c689
KR
88/* Produce same side effects and result, but don't complain. */
89#define CHECK(check,msg) ((check),0)
c6129d7e 90
e0b8c689 91#endif
c6129d7e 92
c98863bf 93/* Used for making sure that Emacs is compilable in all
1fb04659 94 configurations. */
c98863bf
GM
95
96#ifdef USE_LISP_UNION_TYPE
97#undef NO_UNION_TYPE
98#endif
99
e0b8c689
KR
100/* Define an Emacs version of "assert", since some system ones are
101 flaky. */
3694b4ab
GM
102#ifndef ENABLE_CHECKING
103#define eassert(X) (void) 0
104#else /* ENABLE_CHECKING */
e0b8c689
KR
105#if defined (__GNUC__) && __GNUC__ >= 2 && defined (__STDC__)
106#define eassert(cond) CHECK(cond,"assertion failed: " #cond)
107#else
108#define eassert(cond) CHECK(cond,"assertion failed")
109#endif
3694b4ab 110#endif /* ENABLE_CHECKING */
e0b8c689 111
99a3d506 112/* Define the fundamental Lisp data structures. */
3cfe6dfd 113
99a3d506 114/* This is the set of Lisp data types. */
3cfe6dfd
JB
115
116enum Lisp_Type
117 {
99a3d506 118 /* Integer. XINT (obj) is the integer value. */
3cfe6dfd
JB
119 Lisp_Int,
120
99a3d506 121 /* Symbol. XSYMBOL (object) points to a struct Lisp_Symbol. */
3cfe6dfd
JB
122 Lisp_Symbol,
123
84d1833e
KH
124 /* Miscellaneous. XMISC (object) points to a union Lisp_Misc,
125 whose first member indicates the subtype. */
126 Lisp_Misc,
3cfe6dfd
JB
127
128 /* String. XSTRING (object) points to a struct Lisp_String.
99a3d506 129 The length of the string, and its contents, are stored therein. */
3cfe6dfd
JB
130 Lisp_String,
131
b5088f80 132 /* Vector of Lisp objects, or something resembling it.
7c06ac2b 133 XVECTOR (object) points to a struct Lisp_Vector, which contains
b5088f80
KH
134 the size and contents. The size field also contains the type
135 information, if it's not a real vector object. */
136 Lisp_Vectorlike,
3cfe6dfd 137
99a3d506 138 /* Cons. XCONS (object) points to a struct Lisp_Cons. */
3cfe6dfd
JB
139 Lisp_Cons,
140
20280af7 141 Lisp_Float,
4d1207f6
RS
142
143 /* This is not a type code. It is for range checking. */
e2ba196c 144 Lisp_Type_Limit
3cfe6dfd
JB
145 };
146
a32fa736 147/* This is the set of data types that share a common structure.
c98adc1b
KH
148 The first member of the structure is a type code from this set.
149 The enum values are arbitrary, but we'll use large numbers to make it
150 more likely that we'll spot the error if a random word in memory is
151 mistakenly interpreted as a Lisp_Misc. */
1c4ca5a3
KH
152enum Lisp_Misc_Type
153 {
c98adc1b 154 Lisp_Misc_Free = 0x5eab,
84d1833e 155 Lisp_Misc_Marker,
ee4c9ce4
KH
156 Lisp_Misc_Intfwd,
157 Lisp_Misc_Boolfwd,
158 Lisp_Misc_Objfwd,
7d65f1c2
KH
159 Lisp_Misc_Buffer_Objfwd,
160 Lisp_Misc_Buffer_Local_Value,
ce7d8eec 161 Lisp_Misc_Some_Buffer_Local_Value,
99a3d506 162 Lisp_Misc_Overlay,
32462604 163 Lisp_Misc_Kboard_Objfwd,
222151aa 164 Lisp_Misc_Save_Value,
99a3d506
RS
165 /* Currently floats are not a misc type,
166 but let's define this in case we want to change that. */
167 Lisp_Misc_Float,
168 /* This is not a type code. It is for range checking. */
169 Lisp_Misc_Limit
1c4ca5a3
KH
170 };
171
e2ba196c
KH
172#ifndef GCTYPEBITS
173#define GCTYPEBITS 3
174#endif
175
5f6bf5fe
SM
176/* These values are overridden by the m- file on some machines. */
177#ifndef VALBITS
6b61353c 178#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
5f6bf5fe
SM
179#endif
180
3cfe6dfd
JB
181#ifndef NO_UNION_TYPE
182
c451d7b1 183#ifndef WORDS_BIG_ENDIAN
3cfe6dfd
JB
184
185/* Definition of Lisp_Object for little-endian machines. */
186
187typedef
188union Lisp_Object
189 {
190 /* Used for comparing two Lisp_Objects;
99a3d506 191 also, positive integers can be accessed fast this way. */
5c20a7bf 192 EMACS_INT i;
3cfe6dfd
JB
193
194 struct
195 {
5c20a7bf 196 EMACS_INT val : VALBITS;
6b61353c 197 enum Lisp_Type type : GCTYPEBITS;
3cfe6dfd
JB
198 } s;
199 struct
200 {
5c20a7bf 201 EMACS_UINT val : VALBITS;
6b61353c 202 enum Lisp_Type type : GCTYPEBITS;
3cfe6dfd 203 } u;
3cfe6dfd
JB
204 }
205Lisp_Object;
206
c451d7b1 207#else /* If WORDS_BIG_ENDIAN */
3cfe6dfd
JB
208
209typedef
210union Lisp_Object
211 {
212 /* Used for comparing two Lisp_Objects;
99a3d506 213 also, positive integers can be accessed fast this way. */
5c20a7bf 214 EMACS_INT i;
3cfe6dfd
JB
215
216 struct
217 {
6b61353c 218 enum Lisp_Type type : GCTYPEBITS;
5c20a7bf 219 EMACS_INT val : VALBITS;
3cfe6dfd
JB
220 } s;
221 struct
222 {
6b61353c 223 enum Lisp_Type type : GCTYPEBITS;
5c20a7bf 224 EMACS_UINT val : VALBITS;
3cfe6dfd 225 } u;
3cfe6dfd
JB
226 }
227Lisp_Object;
228
c451d7b1 229#endif /* WORDS_BIG_ENDIAN */
3cfe6dfd 230
f3fbd155
KR
231#ifdef __GNUC__
232static __inline__ Lisp_Object
233LISP_MAKE_RVALUE (Lisp_Object o)
234{
235 return o;
236}
237#else
f2ba34f4
KR
238/* This isn't quite right - it keeps the argument as an lvalue.
239 Making it const via casting would help avoid code actually
240 modifying the location in question, but the casting could cover
241 other type-related bugs. */
242#define LISP_MAKE_RVALUE(o) (o)
f3fbd155
KR
243#endif
244
3cfe6dfd
JB
245#endif /* NO_UNION_TYPE */
246
247
1c5ca8b6 248/* If union type is not wanted, define Lisp_Object as just a number. */
3cfe6dfd
JB
249
250#ifdef NO_UNION_TYPE
627a9502 251#define Lisp_Object EMACS_INT
f3fbd155 252#define LISP_MAKE_RVALUE(o) (0+(o))
1c5ca8b6 253#endif /* NO_UNION_TYPE */
3cfe6dfd 254
846d69ac
RS
255/* Two flags that are set during GC. On some machines, these flags
256 are defined differently by the m- file. */
257
00baad70 258/* In the size word of a vector, this bit means the vector has been marked. */
846d69ac
RS
259
260#ifndef ARRAY_MARK_FLAG
6b61353c 261#define ARRAY_MARK_FLAG ((EMACS_INT) ((EMACS_UINT) 1 << (VALBITS + GCTYPEBITS - 1)))
846d69ac
RS
262#endif /* no ARRAY_MARK_FLAG */
263
b5088f80
KH
264/* In the size word of a struct Lisp_Vector, this bit means it's really
265 some other vector-like object. */
266#ifndef PSEUDOVECTOR_FLAG
267#define PSEUDOVECTOR_FLAG ((ARRAY_MARK_FLAG >> 1) & ~ARRAY_MARK_FLAG)
268#endif
269
303a5c93 270/* In a pseudovector, the size field actually contains a word with one
b5088f80
KH
271 PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to
272 indicate the actual type. */
99a3d506
RS
273enum pvec_type
274{
275 PVEC_NORMAL_VECTOR = 0,
99a3d506
RS
276 PVEC_PROCESS = 0x200,
277 PVEC_FRAME = 0x400,
278 PVEC_COMPILED = 0x800,
279 PVEC_WINDOW = 0x1000,
280 PVEC_WINDOW_CONFIGURATION = 0x2000,
281 PVEC_SUBR = 0x4000,
608ff985
RS
282 PVEC_CHAR_TABLE = 0x8000,
283 PVEC_BOOL_VECTOR = 0x10000,
284 PVEC_BUFFER = 0x20000,
5010d3b8 285 PVEC_HASH_TABLE = 0x40000,
1842abb2
KH
286 PVEC_SUB_CHAR_TABLE = 0x80000,
287 PVEC_TYPE_MASK = 0x0ffe00
e2c0561e 288
cee971ad
GM
289#if 0 /* This is used to make the value of PSEUDOVECTOR_FLAG available to
290 GDB. It doesn't work on OS Alpha. Moved to a variable in
291 emacs.c. */
e3d48049 292 PVEC_FLAG = PSEUDOVECTOR_FLAG
cee971ad 293#endif
99a3d506 294};
b5088f80
KH
295
296/* For convenience, we also store the number of elements in these bits. */
608ff985 297#define PSEUDOVECTOR_SIZE_MASK 0x1ff
4435a68a
AS
298
299/* Number of bits to put in each character in the internal representation
300 of bool vectors. This should not vary across implementations. */
301#define BOOL_VECTOR_BITS_PER_CHAR 8
3cfe6dfd 302\f
6b61353c 303/***** Select the tagging scheme. *****/
f6c741f9
SM
304/* There are basically two options that control the tagging scheme:
305 - NO_UNION_TYPE says that Lisp_Object should be an integer instead
306 of a union.
307 - USE_LSB_TAG means that we can assume the least 3 bits of pointers are
308 always 0, and we can thus use them to hold tag bits, without
309 restricting our addressing space.
310
311 If USE_LSB_TAG is not set, then we use the top 3 bits for tagging, thus
312 restricting our possible address range. Currently USE_LSB_TAG is not
313 allowed together with a union. This is not due to any fundamental
314 technical (or political ;-) problem: nobody wrote the code to do it yet.
315
316 USE_LSB_TAG not only requires the least 3 bits of pointers returned by
317 malloc to be 0 but also needs to be able to impose a mult-of-8 alignment
318 on the few static Lisp_Objects used: all the defsubr as well
319 as the two special buffers buffer_defaults and buffer_local_symbols. */
6b61353c
KH
320
321/* First, try and define DECL_ALIGN(type,var) which declares a static
322 variable VAR of type TYPE with the added requirement that it be
323 TYPEBITS-aligned. */
9bcc2958
EZ
324#ifndef NO_DECL_ALIGN
325# ifndef DECL_ALIGN
6b61353c 326/* What compiler directive should we use for non-gcc compilers? -stef */
9bcc2958
EZ
327# if defined (__GNUC__)
328# define DECL_ALIGN(type, var) \
329 type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
330# endif
6b61353c
KH
331# endif
332#endif
333
f6c741f9
SM
334/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */
335#if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined MAC_OSX
336/* We also need to be able to specify mult-of-8 alignment on static vars. */
337# if defined DECL_ALIGN
338/* We currently do not support USE_LSB_TAG with a union Lisp_Object. */
339# if defined NO_UNION_TYPE
340# define USE_LSB_TAG
341# endif
342# endif
343#endif
344
9bcc2958 345/* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op. */
f6c741f9
SM
346#ifndef DECL_ALIGN
347# ifdef USE_LSB_TAG
348# error "USE_LSB_TAG used without defining DECL_ALIGN"
349# endif
350# define DECL_ALIGN(type, var) type var
6b61353c
KH
351#endif
352
353\f
3cfe6dfd
JB
354/* These macros extract various sorts of values from a Lisp_Object.
355 For example, if tem is a Lisp_Object whose type is Lisp_Cons,
99a3d506 356 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */
3cfe6dfd
JB
357
358#ifdef NO_UNION_TYPE
359
6b61353c
KH
360#ifdef USE_LSB_TAG
361
362#define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1)
363#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) & TYPEMASK))
364#define XINT(a) (((EMACS_INT) (a)) >> GCTYPEBITS)
365#define XUINT(a) (((EMACS_UINT) (a)) >> GCTYPEBITS)
366#define XSET(var, type, ptr) \
367 (eassert (XTYPE (ptr) == 0), /* Check alignment. */ \
368 (var) = ((EMACS_INT) (type)) | ((EMACS_INT) (ptr)))
369#define make_number(N) (((EMACS_INT) (N)) << GCTYPEBITS)
370
371/* XFASTINT and XSETFASTINT are for use when the integer is known to be
372 positive, in which case the implementation can sometimes be faster
373 depending on the tagging scheme. With USE_LSB_TAG, there's no benefit. */
374#define XFASTINT(a) XINT (a)
375#define XSETFASTINT(a, b) ((a) = make_number (b))
376
377#define XPNTR(a) ((EMACS_INT) ((a) & ~TYPEMASK))
378
379#else /* not USE_LSB_TAG */
380
381#define VALMASK ((((EMACS_INT) 1) << VALBITS) - 1)
382
3cfe6dfd
JB
383/* One need to override this if there must be high bits set in data space
384 (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work
a32fa736 385 on all machines, but would penalize machines which don't need it)
3cfe6dfd 386 */
6b61353c 387#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) >> VALBITS))
3cfe6dfd 388
221f4ef3
KH
389/* For integers known to be positive, XFASTINT provides fast retrieval
390 and XSETFASTINT provides fast storage. This takes advantage of the
6b61353c 391 fact that Lisp_Int is 0. */
e43ec785 392#define XFASTINT(a) ((a) + 0)
221f4ef3 393#define XSETFASTINT(a, b) ((a) = (b))
3cfe6dfd
JB
394
395/* Extract the value of a Lisp_Object as a signed integer. */
396
397#ifndef XINT /* Some machines need to do this differently. */
6b61353c
KH
398#define XINT(a) ((((EMACS_INT) (a)) << (BITS_PER_EMACS_INT - VALBITS)) \
399 >> (BITS_PER_EMACS_INT - VALBITS))
3cfe6dfd
JB
400#endif
401
402/* Extract the value as an unsigned integer. This is a basis
403 for extracting it as a pointer to a structure in storage. */
404
405#ifndef XUINT
c98863bf 406#define XUINT(a) ((EMACS_UINT) ((a) & VALMASK))
3cfe6dfd
JB
407#endif
408
3cfe6dfd
JB
409#ifndef XSET
410#define XSET(var, type, ptr) \
627a9502 411 ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK))
3cfe6dfd
JB
412#endif
413
b7acde90
KH
414/* Convert a C integer into a Lisp_Object integer. */
415
416#define make_number(N) \
417 ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
418
6b61353c 419#endif /* not USE_LSB_TAG */
3cfe6dfd 420
6b61353c 421#define EQ(x, y) ((x) == (y))
3cfe6dfd 422
6b61353c 423#else /* not NO_UNION_TYPE */
3cfe6dfd
JB
424
425#define XTYPE(a) ((enum Lisp_Type) (a).u.type)
3cfe6dfd 426
221f4ef3
KH
427/* For integers known to be positive, XFASTINT provides fast retrieval
428 and XSETFASTINT provides fast storage. This takes advantage of the
429 fact that Lisp_Int is 0. */
e43ec785 430#define XFASTINT(a) ((a).i + 0)
221f4ef3 431#define XSETFASTINT(a, b) ((a).i = (b))
3cfe6dfd
JB
432
433#ifdef EXPLICIT_SIGN_EXTEND
434/* Make sure we sign-extend; compilers have been known to fail to do so. */
e0a583f8 435#define XINT(a) (((a).s.val << (BITS_PER_EMACS_INT - VALBITS)) \
c98863bf 436 >> (BITS_PER_EMACS_INT - VALBITS))
3cfe6dfd
JB
437#else
438#define XINT(a) ((a).s.val)
439#endif /* EXPLICIT_SIGN_EXTEND */
440
441#define XUINT(a) ((a).u.val)
3cfe6dfd
JB
442
443#define XSET(var, vartype, ptr) \
5c20a7bf 444 (((var).s.val = ((EMACS_INT) (ptr))), ((var).s.type = ((char) (vartype))))
3cfe6dfd 445
74e49b38
KR
446#if __GNUC__ >= 2 && defined (__OPTIMIZE__)
447#define make_number(N) \
448 (__extension__ ({ Lisp_Object _l; _l.s.val = (N); _l.s.type = Lisp_Int; _l; }))
449#else
e98227af 450extern Lisp_Object make_number ();
74e49b38 451#endif
e98227af 452
e0a583f8 453#define EQ(x, y) ((x).s.val == (y).s.val && (x).s.type == (y).s.type)
6b61353c
KH
454
455#endif /* NO_UNION_TYPE */
456
3cfe6dfd 457/* During garbage collection, XGCTYPE must be used for extracting types
6b61353c 458 so that the mark bit is ignored. XMARKBIT accesses the markbit.
3cfe6dfd
JB
459 Markbits are used only in particular slots of particular structure types.
460 Other markbits are always zero.
461 Outside of garbage collection, all mark bits are always zero. */
462
6b61353c
KH
463#ifndef XGCTYPE
464/* The distinction does not exist now that the MARKBIT has been eliminated. */
465#define XGCTYPE(a) XTYPE (a)
466#endif
3cfe6dfd 467
8febed74
KR
468#ifndef XPNTR
469#ifdef HAVE_SHM
470/* In this representation, data is found in two widely separated segments. */
471extern size_t pure_size;
472#define XPNTR(a) \
473 (XUINT (a) | (XUINT (a) > pure_size ? DATA_SEG_BITS : PURE_SEG_BITS))
474#else /* not HAVE_SHM */
475#ifdef DATA_SEG_BITS
476/* This case is used for the rt-pc.
477 In the diffs I was given, it checked for ptr = 0
478 and did not adjust it in that case.
479 But I don't think that zero should ever be found
480 in a Lisp object whose data type says it points to something. */
481#define XPNTR(a) (XUINT (a) | DATA_SEG_BITS)
482#else
483#define XPNTR(a) XUINT (a)
484#endif
485#endif /* not HAVE_SHM */
486#endif /* no XPNTR */
487
d9eb1c3d
GM
488/* Largest and smallest representable fixnum values. These are the C
489 values. */
dc8e8b07 490
d9eb1c3d
GM
491#define MOST_NEGATIVE_FIXNUM - ((EMACS_INT) 1 << (VALBITS - 1))
492#define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << (VALBITS - 1)) - 1)
6b61353c
KH
493/* Mask indicating the significant bits of a Lisp_Int.
494 I.e. (x & INTMASK) == XUINT (make_number (x)). */
495#define INTMASK ((((EMACS_INT) 1) << VALBITS) - 1)
dc8e8b07
GM
496
497/* Value is non-zero if C integer I doesn't fit into a Lisp fixnum. */
498
499#define FIXNUM_OVERFLOW_P(i) \
fb756c1c
GM
500 ((EMACS_INT)(i) > MOST_POSITIVE_FIXNUM \
501 || (EMACS_INT) (i) < MOST_NEGATIVE_FIXNUM)
dc8e8b07 502
99a3d506 503/* Extract a value or address from a Lisp_Object. */
3cfe6dfd 504
8801a864 505#define XCONS(a) (eassert (GC_CONSP(a)),(struct Lisp_Cons *) XPNTR(a))
232e274c 506#define XVECTOR(a) (eassert (GC_VECTORLIKEP(a)),(struct Lisp_Vector *) XPNTR(a))
8801a864
KR
507#define XSTRING(a) (eassert (GC_STRINGP(a)),(struct Lisp_String *) XPNTR(a))
508#define XSYMBOL(a) (eassert (GC_SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a))
509#define XFLOAT(a) (eassert (GC_FLOATP(a)),(struct Lisp_Float *) XPNTR(a))
7c06ac2b
RS
510
511/* Misc types. */
c9f6631c 512
7c06ac2b 513#define XMISC(a) ((union Lisp_Misc *) XPNTR(a))
a7aa28f6 514#define XMISCTYPE(a) (XMARKER (a)->type)
84d1833e 515#define XMARKER(a) (&(XMISC(a)->u_marker))
ee4c9ce4
KH
516#define XINTFWD(a) (&(XMISC(a)->u_intfwd))
517#define XBOOLFWD(a) (&(XMISC(a)->u_boolfwd))
518#define XOBJFWD(a) (&(XMISC(a)->u_objfwd))
519#define XBUFFER_OBJFWD(a) (&(XMISC(a)->u_buffer_objfwd))
7d65f1c2 520#define XBUFFER_LOCAL_VALUE(a) (&(XMISC(a)->u_buffer_local_value))
ce7d8eec 521#define XOVERLAY(a) (&(XMISC(a)->u_overlay))
32462604 522#define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd))
222151aa 523#define XSAVE_VALUE(a) (&(XMISC(a)->u_save_value))
3cfe6dfd 524
7c06ac2b 525/* Pseudovector types. */
c9f6631c 526
8801a864
KR
527#define XPROCESS(a) (eassert (GC_PROCESSP(a)),(struct Lisp_Process *) XPNTR(a))
528#define XWINDOW(a) (eassert (GC_WINDOWP(a)),(struct window *) XPNTR(a))
529#define XSUBR(a) (eassert (GC_SUBRP(a)),(struct Lisp_Subr *) XPNTR(a))
530#define XBUFFER(a) (eassert (GC_BUFFERP(a)),(struct buffer *) XPNTR(a))
608ff985 531#define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a))
1842abb2 532#define XSUB_CHAR_TABLE(a) ((struct Lisp_Sub_Char_Table *) XPNTR(a))
608ff985 533#define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a))
99a3d506 534
99a3d506 535/* Construct a Lisp_Object from a value or address. */
7c06ac2b 536
a84f89d5 537#define XSETINT(a, b) (a) = make_number (b)
a94ef819 538#define XSETCONS(a, b) XSET (a, Lisp_Cons, b)
b5088f80 539#define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b)
a94ef819
KH
540#define XSETSTRING(a, b) XSET (a, Lisp_String, b)
541#define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b)
a94ef819 542#define XSETFLOAT(a, b) XSET (a, Lisp_Float, b)
7c06ac2b
RS
543
544/* Misc types. */
c9f6631c 545
7c06ac2b 546#define XSETMISC(a, b) XSET (a, Lisp_Misc, b)
a7aa28f6 547#define XSETMARKER(a, b) (XSETMISC (a, b), XMISCTYPE (a) = Lisp_Misc_Marker)
7c06ac2b
RS
548
549/* Pseudovector types. */
c9f6631c 550
7c06ac2b
RS
551#define XSETPSEUDOVECTOR(a, b, code) \
552 (XSETVECTOR (a, b), XVECTOR (a)->size |= PSEUDOVECTOR_FLAG | (code))
553#define XSETWINDOW_CONFIGURATION(a, b) \
554 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
555#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))
556#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
557#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
558#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
99a3d506 559#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
608ff985
RS
560#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
561#define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR))
1842abb2 562#define XSETSUB_CHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUB_CHAR_TABLE))
c9f6631c
GM
563
564/* Convenience macros for dealing with Lisp arrays. */
565
566#define AREF(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX]
567#define ASET(ARRAY, IDX, VAL) (AREF ((ARRAY), (IDX)) = (VAL))
568#define ASIZE(ARRAY) XVECTOR ((ARRAY))->size
569
d90a14e0
GM
570/* Convenience macros for dealing with Lisp strings. */
571
bba772ab
KR
572#define SREF(string, index) (XSTRING (string)->data[index] + 0)
573#define SSET(string, index, new) (XSTRING (string)->data[index] = (new))
674537ea 574#define SDATA(string) (XSTRING (string)->data + 0)
7412b6fd
KR
575#define SCHARS(string) (XSTRING (string)->size + 0)
576#define SBYTES(string) (STRING_BYTES (XSTRING (string)) + 0)
577
578#define STRING_SET_CHARS(string, newsize) \
579 (XSTRING (string)->size = (newsize))
d90a14e0 580
101d50c8
KR
581#define STRING_COPYIN(string, index, new, count) \
582 bcopy (new, XSTRING (string)->data + index, count)
583
3cfe6dfd 584\f
5f6bf5fe 585/* See the macros in intervals.h. */
e221eae3
JA
586
587typedef struct interval *INTERVAL;
588
589/* Complain if object is not string or buffer type */
874cc80e 590#define CHECK_STRING_OR_BUFFER(x) \
c5af3bb9 591 { if (!STRINGP ((x)) && !BUFFERP ((x))) \
e221eae3 592 x = wrong_type_argument (Qbuffer_or_string_p, (x)); }
e221eae3 593\f
3cfe6dfd
JB
594/* In a cons, the markbit of the car is the gc mark bit */
595
596struct Lisp_Cons
597 {
8f34f70a
KR
598 /* Please do not use the names of these elements in code other
599 than the core lisp implementation. Use XCAR and XCDR below. */
600#ifdef HIDE_LISP_IMPLEMENTATION
601 Lisp_Object car_, cdr_;
602#else
3cfe6dfd 603 Lisp_Object car, cdr;
8f34f70a 604#endif
3cfe6dfd
JB
605 };
606
b7acde90 607/* Take the car or cdr of something known to be a cons cell. */
f3fbd155
KR
608/* The _AS_LVALUE macros shouldn't be used outside of the minimal set
609 of code that has to know what a cons cell looks like. Other code not
610 part of the basic lisp implementation should assume that the car and cdr
611 fields are not accessible as lvalues. (What if we want to switch to
612 a copying collector someday? Cached cons cell field addresses may be
613 invalidated at arbitrary points.) */
8f34f70a 614#ifdef HIDE_LISP_IMPLEMENTATION
f3fbd155
KR
615#define XCAR_AS_LVALUE(c) (XCONS ((c))->car_)
616#define XCDR_AS_LVALUE(c) (XCONS ((c))->cdr_)
8f34f70a 617#else
f3fbd155
KR
618#define XCAR_AS_LVALUE(c) (XCONS ((c))->car)
619#define XCDR_AS_LVALUE(c) (XCONS ((c))->cdr)
8f34f70a 620#endif
b7acde90 621
f3fbd155
KR
622/* Use these from normal code. */
623#define XCAR(c) LISP_MAKE_RVALUE(XCAR_AS_LVALUE(c))
624#define XCDR(c) LISP_MAKE_RVALUE(XCDR_AS_LVALUE(c))
625
626/* Use these to set the fields of a cons cell.
627
628 Note that both arguments may refer to the same object, so 'n'
629 should not be read after 'c' is first modified. Also, neither
630 argument should be evaluated more than once; side effects are
631 especially common in the second argument. */
632#define XSETCAR(c,n) (XCAR_AS_LVALUE(c) = (n))
633#define XSETCDR(c,n) (XCDR_AS_LVALUE(c) = (n))
634
635/* For performance: Fast storage of positive integers into the
636 fields of a cons cell. See above caveats. */
637#define XSETCARFASTINT(c,n) XSETFASTINT(XCAR_AS_LVALUE(c),(n))
638#define XSETCDRFASTINT(c,n) XSETFASTINT(XCDR_AS_LVALUE(c),(n))
639
b7acde90
KH
640/* Take the car or cdr of something whose type is not known. */
641#define CAR(c) \
642 (CONSP ((c)) ? XCAR ((c)) \
643 : NILP ((c)) ? Qnil \
644 : wrong_type_argument (Qlistp, (c)))
645
646#define CDR(c) \
647 (CONSP ((c)) ? XCDR ((c)) \
648 : NILP ((c)) ? Qnil \
649 : wrong_type_argument (Qlistp, (c)))
650
d8fc7ce4
KH
651/* Nonzero if STR is a multibyte string. */
652#define STRING_MULTIBYTE(STR) \
653 (XSTRING (STR)->size_byte >= 0)
654
655/* Return the length in bytes of STR. */
35f464a7
GM
656
657#ifdef GC_CHECK_STRING_BYTES
658
659struct Lisp_String;
660extern int string_bytes P_ ((struct Lisp_String *));
661#define STRING_BYTES(S) string_bytes ((S))
662
663#else /* not GC_CHECK_STRING_BYTES */
664
d8fc7ce4
KH
665#define STRING_BYTES(STR) \
666 ((STR)->size_byte < 0 ? (STR)->size : (STR)->size_byte)
667
35f464a7
GM
668#endif /* not GC_CHECK_STRING_BYTES */
669
491c2516
KR
670/* Mark STR as a unibyte string. */
671#define STRING_SET_UNIBYTE(STR) (XSTRING (STR)->size_byte = -1)
672
673/* Get text properties. */
90b81429
KR
674#define STRING_INTERVALS(STR) (XSTRING (STR)->intervals + 0)
675
676/* Set text properties. */
677#define STRING_SET_INTERVALS(STR, INT) (XSTRING (STR)->intervals = (INT))
d8fc7ce4 678
3cfe6dfd
JB
679/* In a string or vector, the sign bit of the `size' is the gc mark bit */
680
681struct Lisp_String
682 {
627a9502 683 EMACS_INT size;
a1b5012f 684 EMACS_INT size_byte;
4618074a 685 INTERVAL intervals; /* text properties in this string */
f05d7ea2 686 unsigned char *data;
3cfe6dfd
JB
687 };
688
94225242 689/* If a struct is made to look like a vector, this macro returns the length
4115d3f7
RS
690 of the shortest vector that would hold that struct. */
691#define VECSIZE(type) ((sizeof (type) - (sizeof (struct Lisp_Vector) \
692 - sizeof (Lisp_Object)) \
693 + sizeof(Lisp_Object) - 1) /* round up */ \
94225242
KH
694 / sizeof (Lisp_Object))
695
3cfe6dfd
JB
696struct Lisp_Vector
697 {
627a9502 698 EMACS_INT size;
3cfe6dfd
JB
699 struct Lisp_Vector *next;
700 Lisp_Object contents[1];
701 };
702
1842abb2 703/* A char-table is a kind of vectorlike, with contents are like a
ea724a01 704 vector but with a few other slots. For some purposes, it makes
1842abb2 705 sense to handle a char-table with type struct Lisp_Vector. An
ea724a01
KH
706 element of a char table can be any Lisp objects, but if it is a sub
707 char-table, we treat it a table that contains information of a
1842abb2
KH
708 specific range of characters. A sub char-table has the same
709 structure as a vector. A sub char table appears only in an element
710 of a char-table, and there's no way to access it directly from
711 Emacs Lisp program. */
608ff985 712
ea724a01
KH
713/* This is the number of slots that every char table must have. This
714 counts the ordinary slots and the top, defalt, parent, and purpose
715 slots. */
1842abb2 716#define CHAR_TABLE_STANDARD_SLOTS (VECSIZE (struct Lisp_Char_Table) - 1)
608ff985
RS
717
718/* Return the number of "extra" slots in the char table CT. */
719
720#define CHAR_TABLE_EXTRA_SLOTS(CT) \
721 (((CT)->size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
722
b96656ce 723/* Almost equivalent to Faref (CT, IDX) with optimization for ASCII
1842abb2
KH
724 characters. Do not check validity of CT. */
725#define CHAR_TABLE_REF(CT, IDX) \
957e7394 726 ((ASCII_CHAR_P (IDX) \
1842abb2
KH
727 && SUB_CHAR_TABLE_P (XCHAR_TABLE (CT)->ascii) \
728 && !NILP (XSUB_CHAR_TABLE (XCHAR_TABLE (CT)->ascii)->contents[IDX])) \
729 ? XSUB_CHAR_TABLE (XCHAR_TABLE (CT)->ascii)->contents[IDX] \
730 : char_table_ref ((CT), (IDX)))
b96656ce 731
dcafe1c7
KH
732/* Almost equivalent to Faref (CT, IDX). However, if the result is
733 not a character, return IDX.
29b7163f
RS
734
735 For these characters, do not check validity of CT
736 and do not follow parent. */
1842abb2
KH
737#define CHAR_TABLE_TRANSLATE(CT, IDX) \
738 char_table_translate (CT, IDX)
29b7163f 739
b96656ce 740/* Equivalent to Faset (CT, IDX, VAL) with optimization for ASCII and
c497dce4 741 8-bit European characters. Do not check validity of CT. */
1842abb2
KH
742#define CHAR_TABLE_SET(CT, IDX, VAL) \
743 (((IDX) >= 0 && ASCII_CHAR_P (IDX) \
744 && SUB_CHAR_TABLE_P (XCHAR_TABLE (CT)->ascii)) \
745 ? XSUB_CHAR_TABLE (XCHAR_TABLE (CT)->ascii)->contents[IDX] = VAL \
746 : char_table_set (CT, IDX, VAL))
747
1842abb2
KH
748#define CHARTAB_SIZE_BITS_0 6
749#define CHARTAB_SIZE_BITS_1 4
750#define CHARTAB_SIZE_BITS_2 5
751#define CHARTAB_SIZE_BITS_3 7
752
753extern const int chartab_size[4];
754
755struct Lisp_Sub_Char_Table;
b96656ce 756
608ff985
RS
757struct Lisp_Char_Table
758 {
759 /* This is the vector's size field, which also holds the
8f924df7
KH
760 pseudovector type information. It holds the size, too. The size
761 counts the defalt, parent, purpose, ascii, contents, and extras
762 slots. */
608ff985
RS
763 EMACS_INT size;
764 struct Lisp_Vector *next;
1842abb2 765
608ff985
RS
766 /* This holds a default value,
767 which is used whenever the value for a specific character is nil. */
768 Lisp_Object defalt;
ea724a01 769
8f924df7
KH
770 /* This points to another char table, which we inherit from when the
771 value for a specific character is nil. The `defalt' slot takes
772 precedence over this. */
608ff985 773 Lisp_Object parent;
1842abb2 774
8f924df7
KH
775 /* This is a symbol which says what kind of use this char-table is
776 meant for. */
7f73dc9d 777 Lisp_Object purpose;
1842abb2 778
8f924df7
KH
779 /* The bottom sub char-table for characters of the range 0..127. It
780 is nil if none of ASCII character has a specific value. */
781 Lisp_Object ascii;
1842abb2 782
8f924df7 783 Lisp_Object contents[(1 << CHARTAB_SIZE_BITS_0)];
1842abb2 784
8f924df7 785 /* These hold additional data. It is a vector. */
608ff985
RS
786 Lisp_Object extras[1];
787 };
788
1842abb2 789struct Lisp_Sub_Char_Table
8f924df7
KH
790 {
791 /* This is the vector's size field, which also holds the
792 pseudovector type information. It holds the size, too. */
793 EMACS_INT size;
794 struct Lisp_Vector *next;
1842abb2 795
8f924df7
KH
796 /* Depth of this sub char-table. It should be 1, 2, or 3. A sub
797 char-table of depth 1 contains 16 elments, and each element
798 covers 4096 (128*32) characters. A sub char-table of depth 2
799 contains 32 elements, and each element covers 128 characters. A
800 sub char-table of depth 3 contains 128 elements, and each element
801 is for one character. */
802 Lisp_Object depth;
1842abb2 803
8f924df7
KH
804 /* Minimum character covered by the sub char-table. */
805 Lisp_Object min_char;
1842abb2 806
8f924df7
KH
807 Lisp_Object contents[1];
808 };
608ff985
RS
809
810/* A boolvector is a kind of vectorlike, with contents are like a string. */
811struct Lisp_Bool_Vector
812 {
813 /* This is the vector's size field. It doesn't have the real size,
814 just the subtype information. */
815 EMACS_INT vector_size;
816 struct Lisp_Vector *next;
817 /* This is the size in bits. */
818 EMACS_INT size;
819 /* This contains the actual bits, packed into bytes. */
820 unsigned char data[1];
821 };
822
7c06ac2b
RS
823/* This structure describes a built-in function.
824 It is generated by the DEFUN macro only.
825 defsubr makes it into a Lisp object.
826
827 This type is treated in most respects as a pseudovector,
828 but since we never dynamically allocate or free them,
829 we don't need a next-vector field. */
e98227af 830
3cfe6dfd
JB
831struct Lisp_Subr
832 {
7c06ac2b 833 EMACS_INT size;
3cfe6dfd
JB
834 Lisp_Object (*function) ();
835 short min_args, max_args;
836 char *symbol_name;
837 char *prompt;
838 char *doc;
839 };
5010d3b8
GM
840
841\f
a32fa736
GM
842/***********************************************************************
843 Symbols
844 ***********************************************************************/
845
846/* Interned state of a symbol. */
847
848enum symbol_interned
849{
850 SYMBOL_UNINTERNED = 0,
851 SYMBOL_INTERNED = 1,
852 SYMBOL_INTERNED_IN_INITIAL_OBARRAY = 2
853};
854
855/* In a symbol, the markbit of the plist is used as the gc mark bit */
856
857struct Lisp_Symbol
858{
a84f89d5
SM
859 unsigned gcmarkbit : 1;
860
a32fa736
GM
861 /* Non-zero means symbol serves as a variable alias. The symbol
862 holding the real value is found in the value slot. */
863 unsigned indirect_variable : 1;
864
865 /* Non-zero means symbol is constant, i.e. changing its value
866 should signal an error. */
867 unsigned constant : 1;
868
869 /* Interned state of the symbol. This is an enumerator from
870 enum symbol_interned. */
871 unsigned interned : 2;
872
74d70085
KR
873 /* The symbol's name, as a Lisp string.
874
875 The name "xname" is used to intentionally break code referring to
876 the old field "name" of type pointer to struct Lisp_String. */
877 Lisp_Object xname;
a32fa736
GM
878
879 /* Value of the symbol or Qunbound if unbound. If this symbol is a
880 defvaralias, `value' contains the symbol for which it is an
881 alias. Use the SYMBOL_VALUE and SET_SYMBOL_VALUE macros to get
882 and set a symbol's value, to take defvaralias into account. */
883 Lisp_Object value;
884
d28981c9 885 /* Function value of the symbol or Qunbound if not fboundp. */
a32fa736
GM
886 Lisp_Object function;
887
888 /* The symbol's property list. */
889 Lisp_Object plist;
e2c0561e 890
a32fa736
GM
891 /* Next symbol in obarray bucket, if the symbol is interned. */
892 struct Lisp_Symbol *next;
893};
894
74d70085
KR
895/* Value is name of symbol. */
896
897#define SYMBOL_NAME(sym) \
898 LISP_MAKE_RVALUE (XSYMBOL (sym)->xname)
899
a32fa736
GM
900/* Value is non-zero if SYM is an interned symbol. */
901
902#define SYMBOL_INTERNED_P(sym) \
903 (XSYMBOL (sym)->interned != SYMBOL_UNINTERNED)
904
905/* Value is non-zero if SYM is interned in initial_obarray. */
906
907#define SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P(sym) \
908 (XSYMBOL (sym)->interned == SYMBOL_INTERNED_IN_INITIAL_OBARRAY)
909
910/* Value is non-zero if symbol is considered a constant, i.e. its
911 value cannot be changed (there is an exception for keyword symbols,
912 whose value can be set to the keyword symbol itself). */
913
914#define SYMBOL_CONSTANT_P(sym) XSYMBOL (sym)->constant
915
916/* Value is the value of SYM, with defvaralias taken into
917 account. */
918
919#define SYMBOL_VALUE(sym) \
920 (XSYMBOL (sym)->indirect_variable \
921 ? XSYMBOL (indirect_variable (sym))->value \
922 : XSYMBOL (sym)->value)
923
924/* Set SYM's value to VAL, taking defvaralias into account. */
925
926#define SET_SYMBOL_VALUE(sym, val) \
927 do { \
928 if (XSYMBOL (sym)->indirect_variable) \
929 XSYMBOL (indirect_variable ((sym)))->value = (val); \
930 else \
931 XSYMBOL (sym)->value = (val); \
932 } while (0)
e2c0561e 933
a32fa736 934\f
5010d3b8
GM
935/***********************************************************************
936 Hash Tables
937 ***********************************************************************/
938
939/* The structure of a Lisp hash table. */
940
941struct Lisp_Hash_Table
942{
943 /* Vector fields. The hash table code doesn't refer to these. */
944 EMACS_INT size;
945 struct Lisp_Vector *vec_next;
e2c0561e 946
5010d3b8
GM
947 /* Function used to compare keys. */
948 Lisp_Object test;
949
950 /* Nil if table is non-weak. Otherwise a symbol describing the
951 weakness of the table. */
952 Lisp_Object weak;
e2c0561e 953
5010d3b8
GM
954 /* When the table is resized, and this is an integer, compute the
955 new size by adding this to the old size. If a float, compute the
956 new size by multiplying the old size with this factor. */
957 Lisp_Object rehash_size;
958
959 /* Resize hash table when number of entries/ table size is >= this
960 ratio, a float. */
961 Lisp_Object rehash_threshold;
962
963 /* Number of key/value entries in the table. */
964 Lisp_Object count;
965
966 /* Vector of keys and values. The key of item I is found at index
967 2 * I, the value is found at index 2 * I + 1. */
968 Lisp_Object key_and_value;
969
970 /* Vector of hash codes.. If hash[I] is nil, this means that that
971 entry I is unused. */
972 Lisp_Object hash;
973
974 /* Vector used to chain entries. If entry I is free, next[I] is the
975 entry number of the next free item. If entry I is non-free,
976 next[I] is the index of the next entry in the collision chain. */
977 Lisp_Object next;
978
979 /* Index of first free entry in free list. */
980 Lisp_Object next_free;
981
982 /* Bucket vector. A non-nil entry is the index of the first item in
983 a collision chain. This vector's size can be larger than the
984 hash table size to reduce collisions. */
985 Lisp_Object index;
986
987 /* Next weak hash table if this is a weak hash table. The head
988 of the list is in Vweak_hash_tables. */
989 Lisp_Object next_weak;
990
991 /* User-supplied hash function, or nil. */
992 Lisp_Object user_hash_function;
993
994 /* User-supplied key comparison function, or nil. */
995 Lisp_Object user_cmp_function;
996
997 /* C function to compare two keys. */
998 int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object,
999 unsigned, Lisp_Object, unsigned));
1000
1001 /* C function to compute hash code. */
1002 unsigned (* hashfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object));
1003};
1004
1005
1006#define XHASH_TABLE(OBJ) \
1007 ((struct Lisp_Hash_Table *) XPNTR (OBJ))
1008
1009#define XSET_HASH_TABLE(VAR, PTR) \
1010 (XSETPSEUDOVECTOR (VAR, PTR, PVEC_HASH_TABLE))
1011
1012#define HASH_TABLE_P(OBJ) PSEUDOVECTORP (OBJ, PVEC_HASH_TABLE)
1013#define GC_HASH_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_HASH_TABLE)
1014
874cc80e 1015#define CHECK_HASH_TABLE(x) \
5010d3b8
GM
1016 do \
1017 { \
1018 if (!HASH_TABLE_P ((x))) \
1019 x = wrong_type_argument (Qhash_table_p, (x)); \
1020 } \
1021 while (0)
1022
141788b5
SM
1023/* Value is the key part of entry IDX in hash table H. */
1024
1025#define HASH_KEY(H, IDX) AREF ((H)->key_and_value, 2 * (IDX))
1026
1027/* Value is the value part of entry IDX in hash table H. */
1028
1029#define HASH_VALUE(H, IDX) AREF ((H)->key_and_value, 2 * (IDX) + 1)
1030
1031/* Value is the index of the next entry following the one at IDX
1032 in hash table H. */
1033
1034#define HASH_NEXT(H, IDX) AREF ((H)->next, (IDX))
1035
1036/* Value is the hash code computed for entry IDX in hash table H. */
1037
1038#define HASH_HASH(H, IDX) AREF ((H)->hash, (IDX))
1039
1040/* Value is the index of the element in hash table H that is the
1041 start of the collision list at index IDX in the index vector of H. */
1042
1043#define HASH_INDEX(H, IDX) AREF ((H)->index, (IDX))
1044
1045/* Value is the size of hash table H. */
1046
1047#define HASH_TABLE_SIZE(H) XVECTOR ((H)->next)->size
1048
5010d3b8
GM
1049/* Default size for hash tables if not specified. */
1050
1051#define DEFAULT_HASH_SIZE 65
1052
1053/* Default threshold specifying when to resize a hash table. The
1054 value gives the ratio of current entries in the hash table and the
1055 size of the hash table. */
1056
1057#define DEFAULT_REHASH_THRESHOLD 0.8
1058
1059/* Default factor by which to increase the size of a hash table. */
1060
1061#define DEFAULT_REHASH_SIZE 1.5
1062
ee4c9ce4 1063\f
7c06ac2b
RS
1064/* These structures are used for various misc types. */
1065
3cfe6dfd 1066struct Lisp_Marker
308e97d0
RS
1067{
1068 int type : 16; /* = Lisp_Misc_Marker */
a84f89d5
SM
1069 unsigned gcmarkbit : 1;
1070 int spacer : 14;
308e97d0
RS
1071 /* 1 means normal insertion at the marker's position
1072 leaves the marker after the inserted text. */
1073 unsigned int insertion_type : 1;
4ed24bf3
RS
1074 /* This is the buffer that the marker points into,
1075 or 0 if it points nowhere. */
308e97d0 1076 struct buffer *buffer;
4ed24bf3
RS
1077
1078 /* The remaining fields are meaningless in a marker that
1079 does not point anywhere. */
1080
1081 /* For markers that point somewhere,
1082 this is used to chain of all the markers in a given buffer. */
c0ac2f4a 1083 struct Lisp_Marker *next;
4ed24bf3 1084 /* This is the char position where the marker points. */
5f6bf5fe 1085 EMACS_INT charpos;
363aa820 1086 /* This is the byte position. */
5f6bf5fe 1087 EMACS_INT bytepos;
308e97d0 1088};
3cfe6dfd 1089
ee4c9ce4
KH
1090/* Forwarding pointer to an int variable.
1091 This is allowed only in the value cell of a symbol,
1092 and it means that the symbol's value really lives in the
1093 specified int variable. */
1094struct Lisp_Intfwd
84d1833e 1095 {
5bfac5a9 1096 int type : 16; /* = Lisp_Misc_Intfwd */
a84f89d5
SM
1097 unsigned gcmarkbit : 1;
1098 int spacer : 15;
31ade731 1099 EMACS_INT *intvar;
ee4c9ce4
KH
1100 };
1101
1102/* Boolean forwarding pointer to an int variable.
1103 This is like Lisp_Intfwd except that the ostensible
1104 "value" of the symbol is t if the int variable is nonzero,
1105 nil if it is zero. */
1106struct Lisp_Boolfwd
1107 {
5bfac5a9 1108 int type : 16; /* = Lisp_Misc_Boolfwd */
a84f89d5
SM
1109 unsigned gcmarkbit : 1;
1110 int spacer : 15;
ee4c9ce4
KH
1111 int *boolvar;
1112 };
1113
1114/* Forwarding pointer to a Lisp_Object variable.
1115 This is allowed only in the value cell of a symbol,
1116 and it means that the symbol's value really lives in the
1117 specified variable. */
1118struct Lisp_Objfwd
1119 {
5bfac5a9 1120 int type : 16; /* = Lisp_Misc_Objfwd */
a84f89d5
SM
1121 unsigned gcmarkbit : 1;
1122 int spacer : 15;
ee4c9ce4
KH
1123 Lisp_Object *objvar;
1124 };
1125
1126/* Like Lisp_Objfwd except that value lives in a slot in the
1127 current buffer. Value is byte index of slot within buffer. */
1128struct Lisp_Buffer_Objfwd
1129 {
5bfac5a9 1130 int type : 16; /* = Lisp_Misc_Buffer_Objfwd */
a84f89d5
SM
1131 unsigned gcmarkbit : 1;
1132 int spacer : 15;
ee4c9ce4 1133 int offset;
84d1833e
KH
1134 };
1135
65d0110b
RS
1136/* struct Lisp_Buffer_Local_Value is used in a symbol value cell when
1137 the symbol has buffer-local or frame-local bindings. (Exception:
1138 some buffer-local variables are built-in, with their values stored
1139 in the buffer structure itself. They are handled differently,
1140 using struct Lisp_Buffer_Objfwd.)
1141
1142 The `realvalue' slot holds the variable's current value, or a
1143 forwarding pointer to where that value is kept. This value is the
1144 one that corresponds to the loaded binding. To read or set the
1145 variable, you must first make sure the right binding is loaded;
1146 then you can access the value in (or through) `realvalue'.
e2c0561e 1147
65d0110b
RS
1148 `buffer' and `frame' are the buffer and frame for which the loaded
1149 binding was found. If those have changed, to make sure the right
1150 binding is loaded it is necessary to find which binding goes with
1151 the current buffer and selected frame, then load it. To load it,
1152 first unload the previous binding, then copy the value of the new
1153 binding into `realvalue' (or through it). Also update
1154 LOADED-BINDING to point to the newly loaded binding.
7d65f1c2
KH
1155
1156 Lisp_Misc_Buffer_Local_Value and Lisp_Misc_Some_Buffer_Local_Value
65d0110b
RS
1157 both use this kind of structure. With the former, merely setting
1158 the variable creates a local binding for the current buffer. With
1159 the latter, setting the variable does not do that; only
1160 make-local-variable does that. */
1161
7d65f1c2
KH
1162struct Lisp_Buffer_Local_Value
1163 {
4bfba59e
RS
1164 int type : 16; /* = Lisp_Misc_Buffer_Local_Value
1165 or Lisp_Misc_Some_Buffer_Local_Value */
a84f89d5
SM
1166 unsigned gcmarkbit : 1;
1167 int spacer : 12;
65d0110b
RS
1168
1169 /* 1 means this variable is allowed to have frame-local bindings,
1170 so check for them when looking for the proper binding. */
4bfba59e 1171 unsigned int check_frame : 1;
65d0110b
RS
1172 /* 1 means that the binding now loaded was found
1173 as a local binding for the buffer in the `buffer' slot. */
4bfba59e 1174 unsigned int found_for_buffer : 1;
65d0110b
RS
1175 /* 1 means that the binding now loaded was found
1176 as a local binding for the frame in the `frame' slot. */
4bfba59e
RS
1177 unsigned int found_for_frame : 1;
1178 Lisp_Object realvalue;
65d0110b 1179 /* The buffer and frame for which the loaded binding was found. */
4bfba59e 1180 Lisp_Object buffer, frame;
65d0110b
RS
1181
1182 /* A cons cell, (LOADED-BINDING . DEFAULT-VALUE).
1183
1184 LOADED-BINDING is the binding now loaded. It is a cons cell
1185 whose cdr is the binding's value. The cons cell may be an
1186 element of a buffer's local-variable alist, or an element of a
1187 frame's parameter alist, or it may be this cons cell.
1188
1189 DEFAULT-VALUE is the variable's default value, seen when the
1190 current buffer and selected frame do not have their own
1191 bindings for the variable. When the default binding is loaded,
1192 LOADED-BINDING is actually this very cons cell; thus, its car
1193 points to itself. */
4bfba59e 1194 Lisp_Object cdr;
7d65f1c2
KH
1195 };
1196
5f6bf5fe 1197/* START and END are markers in the overlay's buffer, and
ce7d8eec
KH
1198 PLIST is the overlay's property list. */
1199struct Lisp_Overlay
1200 {
5bfac5a9 1201 int type : 16; /* = Lisp_Misc_Overlay */
a84f89d5
SM
1202 unsigned gcmarkbit : 1;
1203 int spacer : 15;
b01ecbc6 1204 struct Lisp_Overlay *next;
ce7d8eec
KH
1205 Lisp_Object start, end, plist;
1206 };
5bfac5a9 1207
f334de0e 1208/* Like Lisp_Objfwd except that value lives in a slot in the
32462604
KH
1209 current kboard. */
1210struct Lisp_Kboard_Objfwd
f334de0e 1211 {
32462604 1212 int type : 16; /* = Lisp_Misc_Kboard_Objfwd */
a84f89d5
SM
1213 unsigned gcmarkbit : 1;
1214 int spacer : 15;
f334de0e
KH
1215 int offset;
1216 };
1217
222151aa
RS
1218/* Hold a C pointer for later use.
1219 This type of object is used in the arg to record_unwind_protect. */
1220struct Lisp_Save_Value
1221 {
1222 int type : 16; /* = Lisp_Misc_Save_Value */
a84f89d5 1223 unsigned gcmarkbit : 1;
5f5d6c62
KS
1224 int spacer : 14;
1225 /* If DOGC is set, POINTER is the address of a memory
1226 area containing INTEGER potential Lisp_Objects. */
1227 unsigned int dogc : 1;
222151aa
RS
1228 void *pointer;
1229 int integer;
1230 };
1231
5bfac5a9 1232
6b61353c
KH
1233/* A miscellaneous object, when it's on the free list. */
1234struct Lisp_Free
1235 {
1236 int type : 16; /* = Lisp_Misc_Free */
1237 unsigned gcmarkbit : 1;
1238 int spacer : 15;
1239 union Lisp_Misc *chain;
1240#ifdef USE_LSB_TAG
1241 /* Try to make sure that sizeof(Lisp_Misc) preserves TYPEBITS-alignment.
1242 This assumes that Lisp_Marker is the largest of the alternatives and
1243 that Lisp_Intfwd has the same size as "Lisp_Free w/o padding". */
1244 char padding[((((sizeof (struct Lisp_Marker) - 1) >> GCTYPEBITS) + 1)
1245 << GCTYPEBITS) - sizeof (struct Lisp_Intfwd)];
1246#endif
1247 };
1248
a7aa28f6
RS
1249/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
1250 It uses one of these struct subtypes to get the type field. */
1251
84d1833e
KH
1252union Lisp_Misc
1253 {
84d1833e
KH
1254 struct Lisp_Free u_free;
1255 struct Lisp_Marker u_marker;
ee4c9ce4
KH
1256 struct Lisp_Intfwd u_intfwd;
1257 struct Lisp_Boolfwd u_boolfwd;
1258 struct Lisp_Objfwd u_objfwd;
1259 struct Lisp_Buffer_Objfwd u_buffer_objfwd;
7d65f1c2 1260 struct Lisp_Buffer_Local_Value u_buffer_local_value;
ce7d8eec 1261 struct Lisp_Overlay u_overlay;
32462604 1262 struct Lisp_Kboard_Objfwd u_kboard_objfwd;
222151aa 1263 struct Lisp_Save_Value u_save_value;
84d1833e 1264 };
7c06ac2b 1265\f
cc94f3b2 1266/* Lisp floating point type */
3cfe6dfd
JB
1267struct Lisp_Float
1268 {
8f34f70a
KR
1269#ifdef HIDE_LISP_IMPLEMENTATION
1270 double data_;
1271#else
e98227af 1272 double data;
8f34f70a 1273#endif
3cfe6dfd 1274 };
8f34f70a
KR
1275
1276#ifdef HIDE_LISP_IMPLEMENTATION
1277#define XFLOAT_DATA(f) (XFLOAT (f)->data_)
1278#else
1279#define XFLOAT_DATA(f) (XFLOAT (f)->data)
1280#endif
3cfe6dfd
JB
1281
1282/* A character, declared with the following typedef, is a member
99a3d506 1283 of some character set associated with the current buffer. */
b2ba7b00
RS
1284#ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */
1285#define _UCHAR_T
3cfe6dfd 1286typedef unsigned char UCHAR;
b2ba7b00 1287#endif
3cfe6dfd
JB
1288
1289/* Meanings of slots in a Lisp_Compiled: */
1290
1291#define COMPILED_ARGLIST 0
1292#define COMPILED_BYTECODE 1
1293#define COMPILED_CONSTANTS 2
1294#define COMPILED_STACK_DEPTH 3
1295#define COMPILED_DOC_STRING 4
1296#define COMPILED_INTERACTIVE 5
88dbfee5 1297
d03f79ef
JB
1298/* Flag bits in a character. These also get used in termhooks.h.
1299 Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE
7c06ac2b
RS
1300 (MUlti-Lingual Emacs) might need 22 bits for the character value
1301 itself, so we probably shouldn't use any bits lower than 0x0400000. */
1302#define CHAR_ALT (0x0400000)
1303#define CHAR_SUPER (0x0800000)
1304#define CHAR_HYPER (0x1000000)
1305#define CHAR_SHIFT (0x2000000)
1306#define CHAR_CTL (0x4000000)
1307#define CHAR_META (0x8000000)
703f2808 1308
048151c1
KH
1309#define CHAR_MODIFIER_MASK \
1310 (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META)
1311
1312
1842abb2 1313/* Actually, the current Emacs uses 22 bits for the character value
6b768554 1314 itself. */
13ac3ac9 1315#define CHARACTERBITS 22
6b768554 1316
b0ca4f56
KH
1317/* The maximum byte size consumed by push_key_description.
1318 All callers should assure that at least this size of memory is
1319 allocated at the place pointed by the second argument.
1320
1321 Thers are 6 modifiers, each consumes 2 chars.
1322 The octal form of a character code consumes
1323 (1 + CHARACTERBITS / 3 + 1) chars (including backslash at the head).
1324 We need one more byte for string terminator `\0'. */
1325#define KEY_DESCRIPTION_SIZE ((2 * 6) + 1 + (CHARACTERBITS / 3) + 1 + 1)
1326
e6faba7f
RS
1327#ifdef USE_X_TOOLKIT
1328#ifdef NO_UNION_TYPE
1329/* Use this for turning a (void *) into a Lisp_Object, as when the
1330 Lisp_Object is passed into a toolkit callback function. */
1331#define VOID_TO_LISP(larg,varg) \
1332 do { ((larg) = ((Lisp_Object) (varg))); } while (0)
1333#define CVOID_TO_LISP VOID_TO_LISP
1334
1335/* Use this for turning a Lisp_Object into a (void *), as when the
1336 Lisp_Object is passed into a toolkit callback function. */
1337#define LISP_TO_VOID(larg) ((void *) (larg))
1338#define LISP_TO_CVOID(varg) ((const void *) (larg))
1339
1340#else /* not NO_UNION_TYPE */
1341/* Use this for turning a (void *) into a Lisp_Object, as when the
1342 Lisp_Object is passed into a toolkit callback function. */
1343#define VOID_TO_LISP(larg,varg) \
1344 do { ((larg).v = (void *) (varg)); } while (0)
1345#define CVOID_TO_LISP(larg,varg) \
1346 do { ((larg).cv = (const void *) (varg)); } while (0)
1347
1348/* Use this for turning a Lisp_Object into a (void *), as when the
1349 Lisp_Object is passed into a toolkit callback function. */
1350#define LISP_TO_VOID(larg) ((larg).v)
1351#define LISP_TO_CVOID(larg) ((larg).cv)
1352#endif /* not NO_UNION_TYPE */
1353#endif /* USE_X_TOOLKIT */
1354
703f2808
JB
1355\f
1356/* The glyph datatype, used to represent characters on the display. */
1357
3b0fee46
KH
1358/* Glyph code to use as an index to the glyph table. If it is out of
1359 range for the glyph table, or the corresonding element in the table
1360 is nil, the low 8 bits are the single byte character code, and the
1361 bits above are the numeric face ID. If FID is the face ID of a
1362 glyph on a frame F, then F->display.x->faces[FID] contains the
1363 description of that face. This is an int instead of a short, so we
1364 can support a good bunch of face ID's (2^(31 - 8)); given that we
6b768554 1365 have no mechanism for tossing unused frame face ID's yet, we'll
3b0fee46
KH
1366 probably run out of 255 pretty quickly.
1367 This is always -1 for a multibyte character. */
1368#define GLYPH int
1369
6b768554 1370/* Mask bits for face. */
1842abb2 1371#define GLYPH_MASK_FACE 0x7FC00000
3b0fee46 1372 /* Mask bits for character code. */
8f924df7 1373#define GLYPH_MASK_CHAR 0x003FFFFF /* The lowest 22 bits */
6b768554 1374
49b0dd75
KH
1375/* The FAST macros assume that we already know we're in an X window. */
1376
3b0fee46 1377/* Set a character code and a face ID in a glyph G. */
7363a903 1378#define FAST_MAKE_GLYPH(char, face) ((char) | ((face) << CHARACTERBITS))
703f2808
JB
1379
1380/* Return a glyph's character code. */
6b768554 1381#define FAST_GLYPH_CHAR(glyph) ((glyph) & GLYPH_MASK_CHAR)
703f2808
JB
1382
1383/* Return a glyph's face ID. */
7363a903 1384#define FAST_GLYPH_FACE(glyph) (((glyph) & GLYPH_MASK_FACE) >> CHARACTERBITS)
49b0dd75
KH
1385
1386/* Slower versions that test the frame type first. */
5010d3b8
GM
1387#define MAKE_GLYPH(f, char, face) (FAST_MAKE_GLYPH (char, face))
1388#define GLYPH_CHAR(f, g) (FAST_GLYPH_CHAR (g))
1389#define GLYPH_FACE(f, g) (FAST_GLYPH_FACE (g))
703f2808 1390
b96656ce 1391/* Return 1 iff GLYPH contains valid character code. */
e9726794 1392#define GLYPH_CHAR_VALID_P(glyph) CHAR_VALID_P (FAST_GLYPH_CHAR (glyph), 1)
b96656ce 1393
4606cc9d
RS
1394/* The ID of the mode line highlighting face. */
1395#define GLYPH_MODE_LINE_FACE 1
3cfe6dfd
JB
1396\f
1397/* Data type checking */
1398
3c7a4fa3 1399#define NILP(x) EQ (x, Qnil)
f498e3b2 1400#define GC_NILP(x) GC_EQ (x, Qnil)
3cfe6dfd 1401
c5af3bb9 1402#define NUMBERP(x) (INTEGERP (x) || FLOATP (x))
c1a2bfad 1403#define GC_NUMBERP(x) (GC_INTEGERP (x) || GC_FLOATP (x))
a4a9f09f 1404#define NATNUMP(x) (INTEGERP (x) && XINT (x) >= 0)
c1a2bfad 1405#define GC_NATNUMP(x) (GC_INTEGERP (x) && XINT (x) >= 0)
4746118a 1406
edfa9106 1407#define INTEGERP(x) (XTYPE ((x)) == Lisp_Int)
6b61353c 1408#define GC_INTEGERP(x) INTEGERP (x)
edfa9106 1409#define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol)
c1a2bfad 1410#define GC_SYMBOLP(x) (XGCTYPE ((x)) == Lisp_Symbol)
84d1833e 1411#define MISCP(x) (XTYPE ((x)) == Lisp_Misc)
c1a2bfad 1412#define GC_MISCP(x) (XGCTYPE ((x)) == Lisp_Misc)
b5088f80
KH
1413#define VECTORLIKEP(x) (XTYPE ((x)) == Lisp_Vectorlike)
1414#define GC_VECTORLIKEP(x) (XGCTYPE ((x)) == Lisp_Vectorlike)
edfa9106 1415#define STRINGP(x) (XTYPE ((x)) == Lisp_String)
c1a2bfad 1416#define GC_STRINGP(x) (XGCTYPE ((x)) == Lisp_String)
3cfe6dfd 1417#define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
c1a2bfad 1418#define GC_CONSP(x) (XGCTYPE ((x)) == Lisp_Cons)
7c06ac2b 1419
edfa9106 1420#define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
c1a2bfad 1421#define GC_FLOATP(x) (XGCTYPE ((x)) == Lisp_Float)
b5088f80
KH
1422#define VECTORP(x) (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
1423#define GC_VECTORP(x) (GC_VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
a7aa28f6
RS
1424#define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
1425#define GC_OVERLAYP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
1426#define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
1427#define GC_MARKERP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
1428#define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
1429#define GC_INTFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
1430#define BOOLFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Boolfwd)
1431#define GC_BOOLFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Boolfwd)
1432#define OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd)
1433#define GC_OBJFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd)
1434#define BUFFER_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd)
1435#define GC_BUFFER_OBJFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd)
1436#define BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
1437#define GC_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
1438#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value)
1439#define GC_SOME_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value)
1440#define KBOARD_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
1441#define GC_KBOARD_OBJFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
edfa9106 1442
7c06ac2b 1443
303a5c93 1444/* True if object X is a pseudovector whose code is CODE. */
7c06ac2b
RS
1445#define PSEUDOVECTORP(x, code) \
1446 (VECTORLIKEP (x) \
1447 && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) \
1448 == (PSEUDOVECTOR_FLAG | (code))))
1449
303a5c93 1450/* True if object X is a pseudovector whose code is CODE.
7c06ac2b
RS
1451 This one works during GC. */
1452#define GC_PSEUDOVECTORP(x, code) \
1453 (GC_VECTORLIKEP (x) \
1454 && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) \
1455 == (PSEUDOVECTOR_FLAG | (code))))
1456
1457/* Test for specific pseudovector types. */
1458#define WINDOW_CONFIGURATIONP(x) PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
1459#define GC_WINDOW_CONFIGURATIONP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
1460#define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS)
1461#define GC_PROCESSP(x) GC_PSEUDOVECTORP (x, PVEC_PROCESS)
1462#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
1463#define GC_WINDOWP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW)
1464#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR)
1465#define GC_SUBRP(x) GC_PSEUDOVECTORP (x, PVEC_SUBR)
1466#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
1467#define GC_COMPILEDP(x) GC_PSEUDOVECTORP (x, PVEC_COMPILED)
99a3d506
RS
1468#define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER)
1469#define GC_BUFFERP(x) GC_PSEUDOVECTORP (x, PVEC_BUFFER)
608ff985 1470#define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE)
1842abb2
KH
1471#define SUB_CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_SUB_CHAR_TABLE)
1472#define GC_SUB_CHAR_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_SUB_CHAR_TABLE)
608ff985
RS
1473#define GC_CHAR_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_CHAR_TABLE)
1474#define BOOL_VECTOR_P(x) PSEUDOVECTORP (x, PVEC_BOOL_VECTOR)
1475#define GC_BOOL_VECTOR_P(x) GC_PSEUDOVECTORP (x, PVEC_BOOL_VECTOR)
7c06ac2b
RS
1476#define FRAMEP(x) PSEUDOVECTORP (x, PVEC_FRAME)
1477#define GC_FRAMEP(x) GC_PSEUDOVECTORP (x, PVEC_FRAME)
ea724a01 1478
6b61353c
KH
1479/* Test for image (image . spec) */
1480#define IMAGEP(x) (CONSP (x) && EQ (XCAR (x), Qimage))
1481
7c06ac2b 1482\f
6b61353c 1483#define GC_EQ(x, y) EQ (x, y)
4746118a 1484
874cc80e 1485#define CHECK_LIST(x) \
c5af3bb9 1486 do { if (!CONSP ((x)) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0)
3cfe6dfd 1487
874cc80e 1488#define CHECK_STRING(x) \
c5af3bb9 1489 do { if (!STRINGP ((x))) x = wrong_type_argument (Qstringp, (x)); } while (0)
3cfe6dfd 1490
57ddb5d0
KR
1491#define CHECK_STRING_CAR(x) \
1492 do { if (!STRINGP (XCAR (x))) XSETCAR (x, wrong_type_argument (Qstringp, XCAR (x))); } while (0)
1493
874cc80e 1494#define CHECK_CONS(x) \
c5af3bb9 1495 do { if (!CONSP ((x))) x = wrong_type_argument (Qconsp, (x)); } while (0)
3cfe6dfd 1496
874cc80e 1497#define CHECK_SYMBOL(x) \
c5af3bb9 1498 do { if (!SYMBOLP ((x))) x = wrong_type_argument (Qsymbolp, (x)); } while (0)
3cfe6dfd 1499
874cc80e 1500#define CHECK_CHAR_TABLE(x) \
a97eb3f3 1501 do { if (!CHAR_TABLE_P ((x))) \
608ff985
RS
1502 x = wrong_type_argument (Qchar_table_p, (x)); } while (0)
1503
874cc80e 1504#define CHECK_VECTOR(x) \
c5af3bb9 1505 do { if (!VECTORP ((x))) x = wrong_type_argument (Qvectorp, (x)); } while (0)
3cfe6dfd 1506
874cc80e 1507#define CHECK_VECTOR_OR_CHAR_TABLE(x) \
7f73dc9d
RS
1508 do { if (!VECTORP ((x)) && !CHAR_TABLE_P ((x))) \
1509 x = wrong_type_argument (Qvector_or_char_table_p, (x)); \
1510 } while (0)
1511
874cc80e 1512#define CHECK_BUFFER(x) \
c5af3bb9 1513 do { if (!BUFFERP ((x))) x = wrong_type_argument (Qbufferp, (x)); } while (0)
3cfe6dfd 1514
874cc80e 1515#define CHECK_WINDOW(x) \
c5af3bb9 1516 do { if (!WINDOWP ((x))) x = wrong_type_argument (Qwindowp, (x)); } while (0)
3cfe6dfd 1517
03273ec5 1518/* This macro rejects windows on the interior of the window tree as
e98227af 1519 "dead", which is what we want; this is an argument-checking macro, and
03273ec5
JB
1520 the user should never get access to interior windows.
1521
1522 A window of any sort, leaf or interior, is dead iff the buffer,
1523 vchild, and hchild members are all nil. */
1524
874cc80e 1525#define CHECK_LIVE_WINDOW(x) \
2ad18bfd 1526 do { \
c5af3bb9 1527 if (!WINDOWP ((x)) \
03273ec5 1528 || NILP (XWINDOW ((x))->buffer)) \
806b4d9b 1529 x = wrong_type_argument (Qwindow_live_p, (x)); \
2ad18bfd 1530 } while (0)
03273ec5 1531
874cc80e 1532#define CHECK_PROCESS(x) \
c5af3bb9 1533 do { if (!PROCESSP ((x))) x = wrong_type_argument (Qprocessp, (x)); } while (0)
3cfe6dfd 1534
874cc80e 1535#define CHECK_NUMBER(x) \
c5af3bb9 1536 do { if (!INTEGERP ((x))) x = wrong_type_argument (Qintegerp, (x)); } while (0)
3cfe6dfd 1537
874cc80e 1538#define CHECK_NATNUM(x) \
a4a9f09f 1539 do { if (!NATNUMP (x)) x = wrong_type_argument (Qwholenump, (x)); } while (0)
3cfe6dfd 1540
874cc80e 1541#define CHECK_MARKER(x) \
c5af3bb9 1542 do { if (!MARKERP ((x))) x = wrong_type_argument (Qmarkerp, (x)); } while (0)
3cfe6dfd 1543
874cc80e 1544#define CHECK_NUMBER_COERCE_MARKER(x) \
221f4ef3 1545 do { if (MARKERP ((x))) XSETFASTINT (x, marker_position (x)); \
c5af3bb9 1546 else if (!INTEGERP ((x))) x = wrong_type_argument (Qinteger_or_marker_p, (x)); } while (0)
3cfe6dfd 1547
3cfe6dfd
JB
1548#define XFLOATINT(n) extract_float((n))
1549
874cc80e 1550#define CHECK_FLOAT(x) \
c5af3bb9 1551 do { if (!FLOATP (x)) \
2ad18bfd 1552 x = wrong_type_argument (Qfloatp, (x)); } while (0)
3cfe6dfd 1553
874cc80e 1554#define CHECK_NUMBER_OR_FLOAT(x) \
c5af3bb9 1555 do { if (!FLOATP (x) && !INTEGERP (x)) \
2ad18bfd 1556 x = wrong_type_argument (Qnumberp, (x)); } while (0)
3cfe6dfd 1557
874cc80e 1558#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \
221f4ef3 1559 do { if (MARKERP (x)) XSETFASTINT (x, marker_position (x)); \
c5af3bb9 1560 else if (!INTEGERP (x) && !FLOATP (x)) \
2ad18bfd 1561 x = wrong_type_argument (Qnumber_or_marker_p, (x)); } while (0)
3cfe6dfd 1562
874cc80e 1563#define CHECK_OVERLAY(x) \
c5af3bb9 1564 do { if (!OVERLAYP ((x))) x = wrong_type_argument (Qoverlayp, (x));} while (0)
20280af7 1565
f3fbd155
KR
1566/* Since we can't assign directly to the CAR or CDR fields of a cons
1567 cell, use these when checking that those fields contain numbers. */
874cc80e 1568#define CHECK_NUMBER_CAR(x) \
f3fbd155
KR
1569 do { \
1570 Lisp_Object tmp = XCAR (x); \
874cc80e 1571 CHECK_NUMBER (tmp); \
f3fbd155
KR
1572 XSETCAR ((x), tmp); \
1573 } while (0)
1574
874cc80e 1575#define CHECK_NUMBER_CDR(x) \
f3fbd155
KR
1576 do { \
1577 Lisp_Object tmp = XCDR (x); \
874cc80e 1578 CHECK_NUMBER (tmp); \
f3fbd155
KR
1579 XSETCDR ((x), tmp); \
1580 } while (0)
1581
8f924df7
KH
1582#define CHECK_NATNUM_CAR(x) \
1583 do { \
1584 Lisp_Object tmp = XCAR (x); \
1585 CHECK_NATNUM (tmp); \
1586 XSETCAR ((x), tmp); \
1587 } while (0)
1588
1589#define CHECK_NATNUM_CDR(x) \
1590 do { \
1591 Lisp_Object tmp = XCDR (x); \
1592 CHECK_NATNUM (tmp); \
1593 XSETCDR ((x), tmp); \
1594 } while (0)
1595
3cfe6dfd
JB
1596/* Cast pointers to this type to compare them. Some machines want int. */
1597#ifndef PNTR_COMPARISON_TYPE
68c45bf0 1598#define PNTR_COMPARISON_TYPE EMACS_UINT
3cfe6dfd
JB
1599#endif
1600\f
1601/* Define a built-in function for calling from Lisp.
1602 `lname' should be the name to give the function in Lisp,
1603 as a null-terminated C string.
1604 `fnname' should be the name of the function in C.
1605 By convention, it starts with F.
1606 `sname' should be the name for the C constant structure
1607 that records information on this function for internal use.
1608 By convention, it should be the same as `fnname' but with S instead of F.
1609 It's too bad that C macros can't compute this from `fnname'.
1610 `minargs' should be a number, the minimum number of arguments allowed.
1611 `maxargs' should be a number, the maximum number of arguments allowed,
1612 or else MANY or UNEVALLED.
1613 MANY means pass a vector of evaluated arguments,
1614 in the form of an integer number-of-arguments
1615 followed by the address of a vector of Lisp_Objects
1616 which contains the argument values.
1617 UNEVALLED means pass the list of unevaluated arguments
1618 `prompt' says how to read arguments for an interactive call.
eab9d423 1619 See the doc string for `interactive'.
3cfe6dfd 1620 A null string means call interactively with no arguments.
eab9d423 1621 `doc' is documentation for the user. */
3cfe6dfd 1622
9d936abc
DL
1623#if (!defined (__STDC__) && !defined (PROTOTYPES)) \
1624 || defined (USE_NONANSI_DEFUN)
df7cd53b 1625
a0f8590d 1626#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
df7cd53b 1627 Lisp_Object fnname (); \
6b61353c 1628 DECL_ALIGN (struct Lisp_Subr, sname) = \
df7cd53b
GM
1629 { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
1630 fnname, minargs, maxargs, lname, prompt, 0}; \
a0f8590d 1631 Lisp_Object fnname
df7cd53b 1632
c451d7b1
RS
1633#else
1634
1635/* This version of DEFUN declares a function prototype with the right
99a3d506 1636 arguments, so we can catch errors with maxargs at compile-time. */
7c06ac2b
RS
1637#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
1638 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
6b61353c 1639 DECL_ALIGN (struct Lisp_Subr, sname) = \
7c06ac2b
RS
1640 { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
1641 fnname, minargs, maxargs, lname, prompt, 0}; \
c451d7b1
RS
1642 Lisp_Object fnname
1643
1644/* Note that the weird token-substitution semantics of ANSI C makes
99a3d506 1645 this work for MANY and UNEVALLED. */
c451d7b1
RS
1646#define DEFUN_ARGS_MANY (int, Lisp_Object *)
1647#define DEFUN_ARGS_UNEVALLED (Lisp_Object)
1648#define DEFUN_ARGS_0 (void)
1649#define DEFUN_ARGS_1 (Lisp_Object)
1650#define DEFUN_ARGS_2 (Lisp_Object, Lisp_Object)
1651#define DEFUN_ARGS_3 (Lisp_Object, Lisp_Object, Lisp_Object)
1652#define DEFUN_ARGS_4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
1653#define DEFUN_ARGS_5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
1654 Lisp_Object)
1655#define DEFUN_ARGS_6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
1656 Lisp_Object, Lisp_Object)
1657#define DEFUN_ARGS_7 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
1658 Lisp_Object, Lisp_Object, Lisp_Object)
5593f7e3
KH
1659#define DEFUN_ARGS_8 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
1660 Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
c451d7b1
RS
1661#endif
1662
276680c4
GM
1663/* Non-zero if OBJ is a Lisp function. */
1664
1665#define FUNCTIONP(OBJ) \
1666 ((CONSP (OBJ) && EQ (XCAR (OBJ), Qlambda)) \
1667 || (SYMBOLP (OBJ) && !NILP (Ffboundp (OBJ))) \
1668 || COMPILEDP (OBJ) \
1669 || SUBRP (OBJ))
e2c0561e 1670
3cfe6dfd 1671/* defsubr (Sname);
d19b9aa8 1672 is how we define the symbol for function `name' at start-up time. */
526a2be7 1673extern void defsubr P_ ((struct Lisp_Subr *));
3cfe6dfd
JB
1674
1675#define MANY -2
1676#define UNEVALLED -1
1677
526a2be7
AS
1678extern void defvar_lisp P_ ((char *, Lisp_Object *));
1679extern void defvar_lisp_nopro P_ ((char *, Lisp_Object *));
1680extern void defvar_bool P_ ((char *, int *));
31ade731 1681extern void defvar_int P_ ((char *, EMACS_INT *));
526a2be7
AS
1682extern void defvar_per_buffer P_ ((char *, Lisp_Object *, Lisp_Object, char *));
1683extern void defvar_kboard P_ ((char *, int));
3cfe6dfd
JB
1684
1685/* Macros we use to define forwarded Lisp variables.
1686 These are used in the syms_of_FILENAME functions. */
1687
3cfe6dfd
JB
1688#define DEFVAR_LISP(lname, vname, doc) defvar_lisp (lname, vname)
1689#define DEFVAR_LISP_NOPRO(lname, vname, doc) defvar_lisp_nopro (lname, vname)
1690#define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname)
1691#define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname)
92d2947b
RS
1692
1693/* TYPE is nil for a general Lisp variable.
1694 An integer specifies a type; then only LIsp values
1695 with that type code are allowed (except that nil is allowed too).
1696 LNAME is the LIsp-level variable name.
1697 VNAME is the name of the buffer slot.
1698 DOC is a dummy where you write the doc string as a comment. */
ef15f270
JB
1699#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \
1700 defvar_per_buffer (lname, vname, type, 0)
92d2947b 1701
32462604
KH
1702#define DEFVAR_KBOARD(lname, vname, doc) \
1703 defvar_kboard (lname, \
1704 (int)((char *)(&current_kboard->vname) \
1705 - (char *)current_kboard))
df7cd53b 1706
df7cd53b 1707
3cfe6dfd 1708\f
78ca380c
JB
1709/* Structure for recording Lisp call stack for backtrace purposes. */
1710
1711/* The special binding stack holds the outer values of variables while
1712 they are bound by a function application or a let form, stores the
1713 code to be executed for Lisp unwind-protect forms, and stores the C
1714 functions to be called for record_unwind_protect.
1715
1716 If func is non-zero, undoing this binding applies func to old_value;
1717 This implements record_unwind_protect.
5fd6e274
RS
1718
1719 Otherwise, the element is a variable binding.
e2c0561e 1720
5fd6e274 1721 If the symbol field is a symbol, it is an ordinary variable binding.
e2c0561e 1722
2d160521
GM
1723 Otherwise, it should be a structure (SYMBOL WHERE
1724 . CURRENT-BUFFER), which means having bound a local value while
1725 CURRENT-BUFFER was active. If WHERE is nil this means we saw the
3326dc20 1726 default value when binding SYMBOL. WHERE being a buffer or frame
2d160521
GM
1727 means we saw a buffer-local or frame-local value. Other values of
1728 WHERE mean an internal error. */
5fd6e274 1729
07c9ebd6
RS
1730typedef Lisp_Object (*specbinding_func) P_ ((Lisp_Object));
1731
3cfe6dfd
JB
1732struct specbinding
1733 {
4e91a530 1734 volatile Lisp_Object symbol, old_value;
07c9ebd6 1735 volatile specbinding_func func;
3cfe6dfd
JB
1736 Lisp_Object unused; /* Dividing by 16 is faster than by 12 */
1737 };
1738
1739extern struct specbinding *specpdl;
4e91a530 1740extern volatile struct specbinding *specpdl_ptr;
3cfe6dfd
JB
1741extern int specpdl_size;
1742
31ade731 1743extern EMACS_INT max_specpdl_size;
c51ea62a 1744
c929397d 1745#define SPECPDL_INDEX() (specpdl_ptr - specpdl)
acb8dc44 1746
78ca380c 1747/* Everything needed to describe an active condition case. */
3cfe6dfd
JB
1748struct handler
1749 {
78ca380c 1750 /* The handler clauses and variable from the condition-case form. */
992dd91a
RS
1751 /* For a handler set up in Lisp code, this is always a list.
1752 For an internal handler set up by internal_condition_case*,
1753 this can instead be the symbol t or `error'.
1754 t: handle all conditions.
1755 error: handle all conditions, and errors can run the debugger
1756 or display a backtrace. */
3cfe6dfd
JB
1757 Lisp_Object handler;
1758 Lisp_Object var;
22bbbd42
RS
1759 /* Fsignal stores here the condition-case clause that applies,
1760 and Fcondition_case thus knows which clause to run. */
1761 Lisp_Object chosen_clause;
78ca380c
JB
1762
1763 /* Used to effect the longjump out to the handler. */
3cfe6dfd 1764 struct catchtag *tag;
78ca380c
JB
1765
1766 /* The next enclosing handler. */
3cfe6dfd
JB
1767 struct handler *next;
1768 };
1769
1770extern struct handler *handlerlist;
1771
1772extern struct catchtag *catchlist;
1773extern struct backtrace *backtrace_list;
1774
22bbbd42
RS
1775extern Lisp_Object memory_signal_data;
1776
3cfe6dfd
JB
1777/* An address near the bottom of the stack.
1778 Tells GC how to save a copy of the stack. */
1779extern char *stack_bottom;
1780
4742f524
RS
1781/* Check quit-flag and quit if it is non-nil.
1782 Typing C-g does not directly cause a quit; it only sets Vquit_flag.
1783 So the program needs to do QUIT at times when it is safe to quit.
1784 Every loop that might run for a long time or might not exit
1785 ought to do QUIT at least once, at a safe place.
1786 Unless that is impossible, of course.
1787 But it is very desirable to avoid creating loops where QUIT is impossible.
1788
1789 Exception: if you set immediate_quit to nonzero,
1790 then the handler that responds to the C-g does the quit itself.
1791 This is a good thing to do around a loop that has no side effects
1792 and (in particular) cannot call arbitrary Lisp code. */
3cfe6dfd 1793
6b61353c
KH
1794#ifdef SYNC_INPUT
1795extern void handle_async_input P_ ((void));
1796extern int interrupt_input_pending;
08fdede6 1797
6b61353c
KH
1798#define QUIT \
1799 do { \
1800 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
1801 { \
08fdede6 1802 Lisp_Object flag = Vquit_flag; \
6b61353c 1803 Vquit_flag = Qnil; \
08fdede6
RS
1804 if (EQ (Vthrow_on_input, flag)) \
1805 Fthrow (Vthrow_on_input, Qnil); \
6b61353c
KH
1806 Fsignal (Qquit, Qnil); \
1807 } \
1808 else if (interrupt_input_pending) \
1809 handle_async_input (); \
1810 } while (0)
1811
1812#else /* not SYNC_INPUT */
1813
a69a6e61
GM
1814#define QUIT \
1815 do { \
1816 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
1817 { \
08fdede6 1818 Lisp_Object flag = Vquit_flag; \
a69a6e61 1819 Vquit_flag = Qnil; \
08fdede6
RS
1820 if (EQ (Vthrow_on_input, flag)) \
1821 Fthrow (Vthrow_on_input, Qnil); \
a69a6e61
GM
1822 Fsignal (Qquit, Qnil); \
1823 } \
1824 } while (0)
3cfe6dfd 1825
6b61353c
KH
1826#endif /* not SYNC_INPUT */
1827
1828
3cfe6dfd
JB
1829/* Nonzero if ought to quit now. */
1830
efb859b4 1831#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
3cfe6dfd 1832\f
8ac90470 1833/* Variables used locally in the following case handling macros. */
2e34157c
RS
1834extern int case_temp1;
1835extern Lisp_Object case_temp2;
8ac90470 1836
e98227af 1837/* Current buffer's map from characters to lower-case characters. */
3cfe6dfd 1838
8ac90470 1839#define DOWNCASE_TABLE current_buffer->downcase_table
3cfe6dfd 1840
e98227af 1841/* Current buffer's map from characters to upper-case characters. */
3cfe6dfd 1842
8ac90470 1843#define UPCASE_TABLE current_buffer->upcase_table
3cfe6dfd 1844
e98227af 1845/* Downcase a character, or make no change if that cannot be done. */
3cfe6dfd 1846
8ac90470
KH
1847#define DOWNCASE(CH) \
1848 ((case_temp1 = (CH), \
1849 case_temp2 = CHAR_TABLE_REF (DOWNCASE_TABLE, case_temp1), \
1850 NATNUMP (case_temp2)) \
1851 ? XFASTINT (case_temp2) : case_temp1)
3cfe6dfd 1852
e98227af 1853/* 1 if CH is upper case. */
3cfe6dfd 1854
476d47ce 1855#define UPPERCASEP(CH) (DOWNCASE (CH) != (CH))
3cfe6dfd 1856
e98227af 1857/* 1 if CH is neither upper nor lower case. */
3cfe6dfd 1858
8ac90470 1859#define NOCASEP(CH) (UPCASE1 (CH) == (CH))
3cfe6dfd 1860
e98227af 1861/* 1 if CH is lower case. */
3cfe6dfd 1862
e98227af 1863#define LOWERCASEP(CH) (!UPPERCASEP (CH) && !NOCASEP(CH))
3cfe6dfd 1864
e98227af 1865/* Upcase a character, or make no change if that cannot be done. */
3cfe6dfd 1866
e98227af
KH
1867#define UPCASE(CH) (!UPPERCASEP (CH) ? UPCASE1 (CH) : (CH))
1868
1869/* Upcase a character known to be not upper case. */
1870
8ac90470
KH
1871#define UPCASE1(CH) \
1872 ((case_temp1 = (CH), \
1873 case_temp2 = CHAR_TABLE_REF (UPCASE_TABLE, case_temp1), \
1874 NATNUMP (case_temp2)) \
1875 ? XFASTINT (case_temp2) : case_temp1)
3cfe6dfd 1876
c6a3c83c 1877extern Lisp_Object Vascii_downcase_table;
3cfe6dfd 1878\f
99a3d506 1879/* Number of bytes of structure consed since last GC. */
3cfe6dfd
JB
1880
1881extern int consing_since_gc;
1882
99a3d506 1883/* Threshold for doing another gc. */
3cfe6dfd 1884
31ade731 1885extern EMACS_INT gc_cons_threshold;
3cfe6dfd 1886
99a3d506 1887/* Structure for recording stack slots that need marking. */
3cfe6dfd
JB
1888
1889/* This is a chain of structures, each of which points at a Lisp_Object variable
1890 whose value should be marked in garbage collection.
1891 Normally every link of the chain is an automatic variable of a function,
1892 and its `val' points to some argument or local variable of the function.
1893 On exit to the function, the chain is set back to the value it had on entry.
e5f55f07
BF
1894 This way, no link remains in the chain when the stack frame containing the
1895 link disappears.
3cfe6dfd
JB
1896
1897 Every function that can call Feval must protect in this fashion all
99a3d506 1898 Lisp_Object variables whose contents will be used again. */
3cfe6dfd
JB
1899
1900extern struct gcpro *gcprolist;
1901
1902struct gcpro
834168ef
GM
1903{
1904 struct gcpro *next;
e2c0561e 1905
834168ef
GM
1906 /* Address of first protected variable. */
1907 volatile Lisp_Object *var;
e2c0561e 1908
834168ef
GM
1909 /* Number of consecutive protected variables. */
1910 int nvars;
e2c0561e 1911
4742f524 1912#ifdef DEBUG_GCPRO
834168ef 1913 int level;
4742f524 1914#endif
834168ef 1915};
3cfe6dfd 1916
1216f5e4
GM
1917/* Values of GC_MARK_STACK during compilation:
1918
1919 0 Use GCPRO as before
1920 1 Do the real thing, make GCPROs and UNGCPRO no-ops.
1921 2 Mark the stack, and check that everything GCPRO'd is
1922 marked.
1923 3 Mark using GCPRO's, mark stack last, and count how many
1924 dead objects are kept alive. */
1925
1926
1927#define GC_USE_GCPROS_AS_BEFORE 0
1928#define GC_MAKE_GCPROS_NOOPS 1
1929#define GC_MARK_STACK_CHECK_GCPROS 2
1930#define GC_USE_GCPROS_CHECK_ZOMBIES 3
1931
1932#ifndef GC_MARK_STACK
1933#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
1934#endif
1935
1936#if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
1937
9f0443f9 1938/* Do something silly with gcproN vars just so gcc shuts up. */
656c33dc 1939/* You get warnings from MIPSPro... */
9f0443f9
SM
1940
1941#define GCPRO1(varname) ((void) gcpro1)
e2c0561e 1942#define GCPRO2(varname1, varname2)(((void) gcpro2, (void) gcpro1))
9f0443f9
SM
1943#define GCPRO3(varname1, varname2, varname3) \
1944 (((void) gcpro3, (void) gcpro2, (void) gcpro1))
1945#define GCPRO4(varname1, varname2, varname3, varname4) \
1946 (((void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
1947#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
1948 (((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
b7301bff
KS
1949#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
1950 (((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
1216f5e4
GM
1951#define UNGCPRO ((void) 0)
1952
1953#else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
1954
4742f524
RS
1955#ifndef DEBUG_GCPRO
1956
3cfe6dfd
JB
1957#define GCPRO1(varname) \
1958 {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \
1959 gcprolist = &gcpro1; }
1960
1961#define GCPRO2(varname1, varname2) \
1962 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1963 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1964 gcprolist = &gcpro2; }
1965
1966#define GCPRO3(varname1, varname2, varname3) \
1967 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1968 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1969 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1970 gcprolist = &gcpro3; }
1971
1972#define GCPRO4(varname1, varname2, varname3, varname4) \
1973 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1974 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1975 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1976 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
1977 gcprolist = &gcpro4; }
1978
c47b8d02
RS
1979#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
1980 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1981 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1982 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1983 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
1984 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
1985 gcprolist = &gcpro5; }
1986
b7301bff
KS
1987#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
1988 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
1989 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
1990 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
1991 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
1992 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
1993 gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \
1994 gcprolist = &gcpro6; }
1995
4742f524 1996#define UNGCPRO (gcprolist = gcpro1.next)
3cfe6dfd 1997
4742f524 1998#else
e98227af 1999
4742f524
RS
2000extern int gcpro_level;
2001
2002#define GCPRO1(varname) \
2003 {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \
2004 gcpro1.level = gcpro_level++; \
2005 gcprolist = &gcpro1; }
2006
2007#define GCPRO2(varname1, varname2) \
2008 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
2009 gcpro1.level = gcpro_level; \
2010 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
2011 gcpro2.level = gcpro_level++; \
2012 gcprolist = &gcpro2; }
2013
2014#define GCPRO3(varname1, varname2, varname3) \
2015 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
2016 gcpro1.level = gcpro_level; \
2017 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
2018 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
2019 gcpro3.level = gcpro_level++; \
2020 gcprolist = &gcpro3; }
2021
2022#define GCPRO4(varname1, varname2, varname3, varname4) \
2023 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
2024 gcpro1.level = gcpro_level; \
2025 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
2026 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
2027 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
2028 gcpro4.level = gcpro_level++; \
2029 gcprolist = &gcpro4; }
2030
2031#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
2032 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
2033 gcpro1.level = gcpro_level; \
2034 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
2035 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
2036 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
2037 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
2038 gcpro5.level = gcpro_level++; \
2039 gcprolist = &gcpro5; }
2040
b7301bff
KS
2041#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
2042 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
2043 gcpro1.level = gcpro_level; \
2044 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
2045 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
2046 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
2047 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
2048 gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \
2049 gcpro6.level = gcpro_level++; \
2050 gcprolist = &gcpro6; }
2051
4742f524
RS
2052#define UNGCPRO \
2053 ((--gcpro_level != gcpro1.level) \
2054 ? (abort (), 0) \
2055 : ((gcprolist = gcpro1.next), 0))
2056
2057#endif /* DEBUG_GCPRO */
1216f5e4
GM
2058#endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
2059
3cfe6dfd 2060
5db82c9d 2061/* Evaluate expr, UNGCPRO, and then return the value of expr. */
c47b8d02 2062#define RETURN_UNGCPRO(expr) \
0868e74e 2063do \
c47b8d02
RS
2064 { \
2065 Lisp_Object ret_ungc_val; \
2066 ret_ungc_val = (expr); \
2067 UNGCPRO; \
2068 return ret_ungc_val; \
2069 } \
0868e74e 2070while (0)
4742f524
RS
2071
2072/* Call staticpro (&var) to protect static variable `var'. */
2073
2074void staticpro P_ ((Lisp_Object *));
3cfe6dfd 2075\f
2f69f2ec
RS
2076/* Declare a Lisp-callable function. The MAXARGS parameter has the same
2077 meaning as in the DEFUN macro, and is used to construct a prototype. */
9d936abc
DL
2078#if (!defined (__STDC__) && !defined (PROTOTYPES)) \
2079 || defined (USE_NONANSI_DEFUN)
2f69f2ec
RS
2080#define EXFUN(fnname, maxargs) \
2081 extern Lisp_Object fnname ()
2082#else
2083/* We can use the same trick as in the DEFUN macro to generate the
2084 appropriate prototype. */
2085#define EXFUN(fnname, maxargs) \
2086 extern Lisp_Object fnname DEFUN_ARGS_ ## maxargs
2087#endif
2088
526a2be7
AS
2089/* Forward declarations for prototypes. */
2090struct window;
2091struct frame;
2f69f2ec 2092
3cfe6dfd
JB
2093/* Defined in data.c */
2094extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
2095extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
2096extern Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range;
2097extern Lisp_Object Qvoid_variable, Qvoid_function;
2098extern Lisp_Object Qsetting_constant, Qinvalid_read_syntax;
2099extern Lisp_Object Qinvalid_function, Qwrong_number_of_arguments, Qno_catch;
6b61353c 2100extern Lisp_Object Qend_of_file, Qarith_error, Qmark_inactive;
3cfe6dfd 2101extern Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
6b61353c 2102extern Lisp_Object Qtext_read_only;
623ed1b0 2103
6b61353c 2104extern Lisp_Object Qintegerp, Qnatnump, Qwholenump, Qsymbolp, Qlistp, Qconsp;
3cfe6dfd 2105extern Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp;
6b61353c 2106extern Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qvectorp;
cde20f41 2107extern Lisp_Object Qbuffer_or_string_p;
6b61353c
KH
2108extern Lisp_Object Qboundp, Qfboundp;
2109extern Lisp_Object Qchar_table_p, Qvector_or_char_table_p;
2110
3cfe6dfd
JB
2111extern Lisp_Object Qcdr;
2112
6b61353c
KH
2113extern Lisp_Object Qrange_error, Qdomain_error, Qsingularity_error;
2114extern Lisp_Object Qoverflow_error, Qunderflow_error;
3cfe6dfd 2115
6b61353c
KH
2116extern Lisp_Object Qfloatp;
2117extern Lisp_Object Qnumberp, Qnumber_or_marker_p;
2118
2119extern Lisp_Object Qinteger;
3cfe6dfd 2120
7436b0a9 2121extern void circular_list_error P_ ((Lisp_Object));
6b61353c
KH
2122EXFUN (Finteractive_form, 1);
2123
2124/* Defined in frame.c */
2125extern Lisp_Object Qframep;
7436b0a9 2126
2f69f2ec
RS
2127EXFUN (Feq, 2);
2128EXFUN (Fnull, 1);
2129EXFUN (Flistp, 1);
2130EXFUN (Fconsp, 1);
2131EXFUN (Fatom, 1);
2132EXFUN (Fnlistp, 1);
2133EXFUN (Fintegerp, 1);
2134EXFUN (Fnatnump, 1);
2135EXFUN (Fsymbolp, 1);
2136EXFUN (Fvectorp, 1);
2137EXFUN (Fstringp, 1);
a1b5012f 2138EXFUN (Fmultibyte_string_p, 1);
2f69f2ec
RS
2139EXFUN (Farrayp, 1);
2140EXFUN (Fsequencep, 1);
2141EXFUN (Fbufferp, 1);
2142EXFUN (Fmarkerp, 1);
2143EXFUN (Fsubrp, 1);
2144EXFUN (Fchar_or_string_p, 1);
2145EXFUN (Finteger_or_marker_p, 1);
2f69f2ec
RS
2146EXFUN (Ffloatp, 1);
2147EXFUN (Finteger_or_floatp, 1);
2148EXFUN (Finteger_or_float_or_marker_p, 1);
3cfe6dfd 2149
2f69f2ec
RS
2150EXFUN (Fcar, 1);
2151EXFUN (Fcar_safe, 1);
2152EXFUN (Fcdr, 1);
2153EXFUN (Fcdr_safe, 1);
2154EXFUN (Fsetcar, 2);
2155EXFUN (Fsetcdr, 2);
2156EXFUN (Fboundp, 1);
2157EXFUN (Ffboundp, 1);
2158EXFUN (Fmakunbound, 1);
2159EXFUN (Ffmakunbound, 1);
2160EXFUN (Fsymbol_function, 1);
2161EXFUN (Fsymbol_plist, 1);
2162EXFUN (Fsymbol_name, 1);
2163extern Lisp_Object indirect_function P_ ((Lisp_Object));
2164EXFUN (Findirect_function, 1);
2165EXFUN (Ffset, 2);
2166EXFUN (Fsetplist, 2);
2167EXFUN (Fsymbol_value, 1);
a154f406 2168extern Lisp_Object find_symbol_value P_ ((Lisp_Object));
2f69f2ec
RS
2169EXFUN (Fset, 2);
2170EXFUN (Fdefault_value, 1);
2171EXFUN (Fset_default, 2);
2172EXFUN (Fdefault_boundp, 1);
2173EXFUN (Fmake_local_variable, 1);
a154f406 2174EXFUN (Flocal_variable_p, 2);
2f69f2ec
RS
2175EXFUN (Flocal_variable_if_set_p, 2);
2176
2177EXFUN (Faref, 2);
2178EXFUN (Faset, 3);
2179
2180EXFUN (Fstring_to_number, 2);
2181EXFUN (Fnumber_to_string, 1);
2182EXFUN (Feqlsign, 2);
2183EXFUN (Fgtr, 2);
2184EXFUN (Flss, 2);
2185EXFUN (Fgeq, 2);
2186EXFUN (Fleq, 2);
2187EXFUN (Fneq, 2);
2188EXFUN (Fzerop, 1);
2189EXFUN (Fplus, MANY);
2190EXFUN (Fminus, MANY);
2191EXFUN (Ftimes, MANY);
2192EXFUN (Fquo, MANY);
2193EXFUN (Frem, 2);
2194EXFUN (Fmax, MANY);
2195EXFUN (Fmin, MANY);
2196EXFUN (Flogand, MANY);
2197EXFUN (Flogior, MANY);
2198EXFUN (Flogxor, MANY);
2199EXFUN (Flognot, 1);
2200EXFUN (Flsh, 2);
2201EXFUN (Fash, 2);
2202
2203EXFUN (Fadd1, 1);
2204EXFUN (Fsub1, 1);
d7935eb6 2205EXFUN (Fmake_variable_buffer_local, 1);
2f69f2ec 2206
a32fa736 2207extern Lisp_Object indirect_variable P_ ((Lisp_Object));
2f69f2ec
RS
2208extern Lisp_Object long_to_cons P_ ((unsigned long));
2209extern unsigned long cons_to_long P_ ((Lisp_Object));
2210extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object));
2211extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
834168ef 2212extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object));
13ff50bb
GM
2213extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object,
2214 Lisp_Object, struct buffer *));
2f69f2ec 2215extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object));
5fd6e274 2216extern Lisp_Object set_internal P_ ((Lisp_Object, Lisp_Object, struct buffer *, int));
46abf440
AS
2217extern void syms_of_data P_ ((void));
2218extern void init_data P_ ((void));
cd1b7ac9 2219extern void swap_in_global_binding P_ ((Lisp_Object));
3cfe6dfd 2220
a37e10f9 2221/* Defined in cmds.c */
2f69f2ec
RS
2222EXFUN (Fend_of_line, 1);
2223EXFUN (Fforward_char, 1);
2224EXFUN (Fforward_line, 1);
526a2be7 2225extern int internal_self_insert P_ ((int, int));
46abf440
AS
2226extern void syms_of_cmds P_ ((void));
2227extern void keys_of_cmds P_ ((void));
a37e10f9 2228
6b768554 2229/* Defined in coding.c */
2f69f2ec
RS
2230EXFUN (Fcoding_system_p, 1);
2231EXFUN (Fcheck_coding_system, 1);
34ba1f2e 2232EXFUN (Fread_coding_system, 2);
2f69f2ec 2233EXFUN (Fread_non_nil_coding_system, 1);
a154f406 2234EXFUN (Ffind_operation_coding_system, MANY);
61727ab5 2235EXFUN (Fupdate_coding_systems_internal, 0);
1842abb2
KH
2236EXFUN (Fencode_coding_string, 4);
2237EXFUN (Fdecode_coding_string, 4);
bedadd04
KH
2238extern Lisp_Object detect_coding_system P_ ((const unsigned char *, int,
2239 int, int, int, Lisp_Object));
85ef85ae 2240extern void init_coding P_ ((void));
46abf440
AS
2241extern void init_coding_once P_ ((void));
2242extern void syms_of_coding P_ ((void));
1842abb2
KH
2243
2244/* Defined in character.c */
2245extern void init_character_once P_ ((void));
2246extern void syms_of_character P_ ((void));
e3432aa4 2247EXFUN (Funibyte_char_to_multibyte, 1);
6b768554 2248
5e741a41
RS
2249/* Defined in charset.c */
2250EXFUN (Fchar_bytes, 1);
ec5d8db7 2251EXFUN (Fchar_width, 1);
4516715a 2252EXFUN (Fstring, MANY);
f29b79a2
KR
2253extern int chars_in_text P_ ((const unsigned char *, int));
2254extern int multibyte_chars_in_text P_ ((const unsigned char *, int));
5666cc6f 2255extern int multibyte_char_to_unibyte P_ ((int, Lisp_Object));
b4e187e2 2256extern Lisp_Object Qcharset;
1842abb2 2257extern void init_charset P_ ((void));
46abf440
AS
2258extern void init_charset_once P_ ((void));
2259extern void syms_of_charset P_ ((void));
8f924df7
KH
2260/* Structure forward declarations. */
2261struct charset;
5e741a41 2262
1842abb2
KH
2263/* Defined in composite.c */
2264extern void syms_of_composite P_ ((void));
5e741a41 2265
a37e10f9 2266/* Defined in syntax.c */
2f69f2ec
RS
2267EXFUN (Fforward_word, 1);
2268EXFUN (Fskip_chars_forward, 2);
2269EXFUN (Fskip_chars_backward, 2);
526a2be7
AS
2270EXFUN (Fsyntax_table_p, 1);
2271EXFUN (Fsyntax_table, 0);
2272EXFUN (Fset_syntax_table, 1);
46abf440
AS
2273extern void init_syntax_once P_ ((void));
2274extern void syms_of_syntax P_ ((void));
a37e10f9 2275
3cfe6dfd 2276/* Defined in fns.c */
9a4f9d30 2277extern int use_dialog_box;
1a7ad14f 2278extern int next_almost_prime P_ ((int));
acb3b16f 2279extern Lisp_Object larger_vector P_ ((Lisp_Object, int, Lisp_Object));
838fad15 2280extern void sweep_weak_hash_tables P_ ((void));
3cfe6dfd
JB
2281extern Lisp_Object Qstring_lessp;
2282extern Lisp_Object Vfeatures;
1842abb2 2283extern Lisp_Object QCtest, QCweakness, Qequal, Qeq;
5010d3b8
GM
2284unsigned sxhash P_ ((Lisp_Object, int));
2285Lisp_Object make_hash_table P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
2286 Lisp_Object, Lisp_Object, Lisp_Object,
2287 Lisp_Object));
d9138d5d 2288Lisp_Object copy_hash_table P_ ((struct Lisp_Hash_Table *));
5010d3b8 2289int hash_lookup P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned *));
19481752
KH
2290int hash_put P_ ((struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
2291 unsigned));
5010d3b8
GM
2292void hash_remove P_ ((struct Lisp_Hash_Table *, Lisp_Object));
2293void hash_clear P_ ((struct Lisp_Hash_Table *));
2294void remove_hash_entry P_ ((struct Lisp_Hash_Table *, int));
15b0ced5 2295extern void init_fns P_ ((void));
5010d3b8
GM
2296EXFUN (Fsxhash, 1);
2297EXFUN (Fmake_hash_table, MANY);
1842abb2 2298EXFUN (Fmakehash, 1);
d9138d5d 2299EXFUN (Fcopy_hash_table, 1);
5010d3b8
GM
2300EXFUN (Fhash_table_count, 1);
2301EXFUN (Fhash_table_rehash_size, 1);
2302EXFUN (Fhash_table_rehash_threshold, 1);
2303EXFUN (Fhash_table_size, 1);
2304EXFUN (Fhash_table_test, 1);
2305EXFUN (Fhash_table_weak, 1);
2306EXFUN (Fhash_table_p, 1);
2307EXFUN (Fclrhash, 1);
2308EXFUN (Fgethash, 3);
2309EXFUN (Fputhash, 3);
2310EXFUN (Fremhash, 2);
2311EXFUN (Fmaphash, 2);
2312EXFUN (Fdefine_hash_table_test, 3);
2313
2f69f2ec
RS
2314EXFUN (Fidentity, 1);
2315EXFUN (Frandom, 1);
2316EXFUN (Flength, 1);
2317EXFUN (Fsafe_length, 1);
2318EXFUN (Fappend, MANY);
2319EXFUN (Fconcat, MANY);
2320EXFUN (Fvconcat, MANY);
2321EXFUN (Fcopy_sequence, 1);
b4e187e2
RS
2322EXFUN (Fstring_make_multibyte, 1);
2323EXFUN (Fstring_make_unibyte, 1);
2324EXFUN (Fstring_as_multibyte, 1);
2325EXFUN (Fstring_as_unibyte, 1);
35e36092 2326EXFUN (Fstring_to_multibyte, 1);
2f69f2ec 2327EXFUN (Fsubstring, 3);
a1b5012f 2328extern Lisp_Object substring_both P_ ((Lisp_Object, int, int, int, int));
2f69f2ec
RS
2329EXFUN (Fnth, 2);
2330EXFUN (Fnthcdr, 2);
2331EXFUN (Fmemq, 2);
2332EXFUN (Fassq, 2);
2333EXFUN (Fassoc, 2);
2334EXFUN (Felt, 2);
2335EXFUN (Fmember, 2);
2336EXFUN (Frassq, 2);
2337EXFUN (Fdelq, 2);
e870dd89 2338EXFUN (Fdelete, 2);
2f69f2ec
RS
2339EXFUN (Fsort, 2);
2340EXFUN (Freverse, 1);
2341EXFUN (Fnreverse, 1);
2342EXFUN (Fget, 2);
2343EXFUN (Fput, 3);
2344EXFUN (Fequal, 2);
2345EXFUN (Ffillarray, 2);
2346EXFUN (Fnconc, MANY);
2347EXFUN (Fmapcar, 2);
2348EXFUN (Fmapconcat, 3);
2349EXFUN (Fy_or_n_p, 1);
2350extern Lisp_Object do_yes_or_no_p P_ ((Lisp_Object));
6f39b7c8 2351EXFUN (Frequire, 3);
13598ab4 2352EXFUN (Fprovide, 2);
2f69f2ec
RS
2353extern Lisp_Object concat2 P_ ((Lisp_Object, Lisp_Object));
2354extern Lisp_Object concat3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
2355extern Lisp_Object nconc2 P_ ((Lisp_Object, Lisp_Object));
2356extern Lisp_Object assq_no_quit P_ ((Lisp_Object, Lisp_Object));
4516715a 2357extern void clear_string_char_byte_cache P_ ((void));
a1b5012f
RS
2358extern int string_char_to_byte P_ ((Lisp_Object, int));
2359extern int string_byte_to_char P_ ((Lisp_Object, int));
ec5d8db7 2360extern Lisp_Object string_make_multibyte P_ ((Lisp_Object));
77ea0764 2361extern Lisp_Object string_to_multibyte P_ ((Lisp_Object));
ec5d8db7 2362extern Lisp_Object string_make_unibyte P_ ((Lisp_Object));
2f69f2ec
RS
2363EXFUN (Fcopy_alist, 1);
2364EXFUN (Fplist_get, 2);
479440d2 2365EXFUN (Fsafe_plist_get, 2);
5010d3b8 2366EXFUN (Fplist_put, 3);
99982883 2367EXFUN (Fplist_member, 2);
2f69f2ec
RS
2368EXFUN (Frassoc, 2);
2369EXFUN (Fstring_equal, 2);
42d65b5f 2370EXFUN (Fcompare_strings, 7);
2f69f2ec 2371EXFUN (Fstring_lessp, 2);
46abf440 2372extern void syms_of_fns P_ ((void));
2f69f2ec
RS
2373
2374/* Defined in floatfns.c */
2f69f2ec
RS
2375extern double extract_float P_ ((Lisp_Object));
2376EXFUN (Ffloat, 1);
2f69f2ec 2377EXFUN (Ftruncate, 2);
46abf440
AS
2378extern void init_floatfns P_ ((void));
2379extern void syms_of_floatfns P_ ((void));
3cfe6dfd 2380
6b61353c
KH
2381/* Defined in fringe.c */
2382extern void syms_of_fringe P_ ((void));
2383extern void init_fringe P_ ((void));
2384extern void init_fringe_once P_ ((void));
2385
2386/* Defined in image.c */
f81b59a3 2387EXFUN (Finit_image_library, 2);
6b61353c
KH
2388extern void syms_of_image P_ ((void));
2389extern void init_image P_ ((void));
2390
c98adc1b 2391/* Defined in insdel.c */
b8b31967 2392extern Lisp_Object Qinhibit_modification_hooks;
2f69f2ec 2393extern void move_gap P_ ((int));
4ed24bf3 2394extern void move_gap_both P_ ((int, int));
2f69f2ec 2395extern void make_gap P_ ((int));
f29b79a2
KR
2396extern int copy_text P_ ((const unsigned char *, unsigned char *, int, int, int));
2397extern int count_size_as_multibyte P_ ((const unsigned char *, int));
2398extern int count_combining_before P_ ((const unsigned char *, int, int, int));
2399extern int count_combining_after P_ ((const unsigned char *, int, int, int));
2400extern void insert P_ ((const unsigned char *, int));
2401extern void insert_and_inherit P_ ((const unsigned char *, int));
2402extern void insert_1 P_ ((const unsigned char *, int, int, int, int));
2403extern void insert_1_both P_ ((const unsigned char *, int, int, int, int, int));
1842abb2 2404extern void insert_from_gap P_ ((int, int));
a1b5012f 2405extern void insert_from_string P_ ((Lisp_Object, int, int, int, int, int));
2f69f2ec
RS
2406extern void insert_from_buffer P_ ((struct buffer *, int, int, int));
2407extern void insert_char P_ ((int));
f29b79a2
KR
2408extern void insert_string P_ ((const char *));
2409extern void insert_before_markers P_ ((const unsigned char *, int));
2410extern void insert_before_markers_and_inherit P_ ((const unsigned char *, int));
a1b5012f 2411extern void insert_from_string_before_markers P_ ((Lisp_Object, int, int, int, int, int));
2f69f2ec 2412extern void del_range P_ ((int, int));
7dae4502 2413extern Lisp_Object del_range_1 P_ ((int, int, int, int));
4ed24bf3
RS
2414extern void del_range_byte P_ ((int, int, int));
2415extern void del_range_both P_ ((int, int, int, int, int));
7dae4502 2416extern Lisp_Object del_range_2 P_ ((int, int, int, int, int));
2f69f2ec
RS
2417extern void modify_region P_ ((struct buffer *, int, int));
2418extern void prepare_to_modify_buffer P_ ((int, int, int *));
2419extern void signal_before_change P_ ((int, int, int *));
2420extern void signal_after_change P_ ((int, int, int));
1e94b998 2421extern void adjust_after_replace P_ ((int, int, Lisp_Object, int, int));
61727ab5 2422extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int));
1e94b998 2423extern void adjust_after_insert P_ ((int, int, int, int, int));
d8fc7ce4 2424extern void replace_range P_ ((int, int, Lisp_Object, int, int, int));
e870dd89 2425extern void replace_range_2 P_ ((int, int, int, int, char *, int, int, int));
46abf440 2426extern void syms_of_insdel P_ ((void));
c98adc1b 2427
1747fb16 2428/* Defined in dispnew.c */
37b793e6 2429extern Lisp_Object selected_frame;
31ade731 2430extern EMACS_INT baud_rate;
2f69f2ec 2431EXFUN (Fding, 1);
f5969ae9 2432EXFUN (Fredraw_frame, 1);
2f69f2ec
RS
2433EXFUN (Fredraw_display, 0);
2434EXFUN (Fsleep_for, 2);
2435EXFUN (Fsit_for, 3);
526a2be7 2436extern Lisp_Object sit_for P_ ((int, int, int, int, int));
46abf440
AS
2437extern void init_display P_ ((void));
2438extern void syms_of_display P_ ((void));
101d50c8 2439extern void safe_bcopy P_ ((const char *, char *, int));
1747fb16 2440
c98adc1b 2441/* Defined in xdisp.c */
c6ae41f3 2442extern Lisp_Object Qinhibit_point_motion_hooks;
016c7a15 2443extern Lisp_Object Qinhibit_redisplay, Qdisplay;
04b80c65 2444extern Lisp_Object Qinhibit_eval_during_redisplay;
25e38168 2445extern Lisp_Object Qmessage_truncate_lines;
6b61353c 2446extern Lisp_Object Qimage;
439ae27b 2447extern Lisp_Object Vmessage_log_max;
a1b5012f 2448extern int message_enable_multibyte;
986113df 2449extern Lisp_Object echo_area_buffer[2];
15b0ced5 2450extern void check_message_stack P_ ((void));
986113df
GM
2451extern void setup_echo_area_for_printing P_ ((int));
2452extern int push_message P_ ((void));
37d66095
RS
2453extern Lisp_Object pop_message_unwind P_ ((Lisp_Object));
2454extern Lisp_Object restore_message_unwind P_ ((Lisp_Object));
986113df
GM
2455extern void pop_message P_ ((void));
2456extern void restore_message P_ ((void));
2457extern Lisp_Object current_message P_ ((void));
f29b79a2 2458extern void set_message P_ ((const char *s, Lisp_Object, int, int));
986113df 2459extern void clear_message P_ ((int, int));
2f69f2ec
RS
2460extern void message P_ ((/* char *, ... */));
2461extern void message_nolog P_ ((/* char *, ... */));
2462extern void message1 P_ ((char *));
2463extern void message1_nolog P_ ((char *));
f29b79a2
KR
2464extern void message2 P_ ((const char *, int, int));
2465extern void message2_nolog P_ ((const char *, int, int));
5010d3b8
GM
2466extern void message3 P_ ((Lisp_Object, int, int));
2467extern void message3_nolog P_ ((Lisp_Object, int, int));
f29b79a2 2468extern void message_dolog P_ ((const char *, int, int, int));
a1b5012f 2469extern void message_with_string P_ ((char *, Lisp_Object, int));
2f69f2ec 2470extern void message_log_maybe_newline P_ ((void));
526a2be7
AS
2471extern void update_echo_area P_ ((void));
2472extern void truncate_echo_area P_ ((int));
2473extern void redisplay P_ ((void));
19481752
KH
2474extern int check_point_in_composition
2475 P_ ((struct buffer *, int, struct buffer *, int));
69d1478a 2476extern void redisplay_preserve_echo_area P_ ((int));
526a2be7 2477extern void prepare_menu_bars P_ ((void));
c4bf5bc3 2478
e4764db0 2479void set_frame_cursor_types P_ ((struct frame *, Lisp_Object));
46abf440
AS
2480extern void syms_of_xdisp P_ ((void));
2481extern void init_xdisp P_ ((void));
a18c0a47 2482extern Lisp_Object safe_eval P_ ((Lisp_Object));
b1bd8134 2483extern int pos_visible_p P_ ((struct window *, int, int *,
f9e69704 2484 int *, int *, int *, int));
c98adc1b 2485
15b0ced5 2486/* Defined in vm-limit.c. */
9043c90a
DL
2487extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ()));
2488
3cfe6dfd 2489/* Defined in alloc.c */
a32fa736 2490extern void check_pure_size P_ ((void));
f05d7ea2 2491extern void allocate_string_data P_ ((struct Lisp_String *, int, int));
aa477689 2492extern void reset_malloc_hooks P_ ((void));
15b0ced5 2493extern void uninterrupt_malloc P_ ((void));
526a2be7
AS
2494extern void malloc_warning P_ ((char *));
2495extern void memory_full P_ ((void));
2496extern void buffer_memory_full P_ ((void));
5010d3b8 2497extern int survives_gc_p P_ ((Lisp_Object));
7c88bf91 2498extern void mark_object P_ ((Lisp_Object));
3cfe6dfd 2499extern Lisp_Object Vpurify_flag;
0cef4798 2500extern Lisp_Object Vmemory_full;
2f69f2ec 2501EXFUN (Fcons, 2);
b4e187e2
RS
2502EXFUN (list2, 2);
2503EXFUN (list3, 3);
2504EXFUN (list4, 4);
2505EXFUN (list5, 5);
2f69f2ec
RS
2506EXFUN (Flist, MANY);
2507EXFUN (Fmake_list, 2);
2508extern Lisp_Object allocate_misc P_ ((void));
2509EXFUN (Fmake_vector, 2);
2510EXFUN (Fvector, MANY);
2511EXFUN (Fmake_symbol, 1);
2512EXFUN (Fmake_marker, 0);
2513EXFUN (Fmake_string, 2);
f29b79a2
KR
2514extern Lisp_Object build_string P_ ((const char *));
2515extern Lisp_Object make_string P_ ((const char *, int));
2516extern Lisp_Object make_unibyte_string P_ ((const char *, int));
2517extern Lisp_Object make_multibyte_string P_ ((const char *, int, int));
2f69f2ec
RS
2518extern Lisp_Object make_event_array P_ ((int, Lisp_Object *));
2519extern Lisp_Object make_uninit_string P_ ((int));
a1b5012f 2520extern Lisp_Object make_uninit_multibyte_string P_ ((int, int));
37ab321e
KH
2521extern Lisp_Object make_string_from_bytes P_ ((const char *, int, int));
2522extern Lisp_Object make_specified_string P_ ((const char *, int, int, int));
2f69f2ec 2523EXFUN (Fpurecopy, 1);
d8fc7ce4 2524extern Lisp_Object make_pure_string P_ ((char *, int, int, int));
2f69f2ec
RS
2525extern Lisp_Object pure_cons P_ ((Lisp_Object, Lisp_Object));
2526extern Lisp_Object make_pure_vector P_ ((EMACS_INT));
2527EXFUN (Fgarbage_collect, 0);
2528EXFUN (Fmake_byte_code, MANY);
2529EXFUN (Fmake_bool_vector, 2);
7f73dc9d 2530extern Lisp_Object Qchar_table_extra_slots;
42cc5ba4
GM
2531extern struct Lisp_Vector *allocate_vector P_ ((EMACS_INT));
2532extern struct Lisp_Vector *allocate_other_vector P_ ((EMACS_INT));
2533extern struct Lisp_Hash_Table *allocate_hash_table P_ ((void));
2534extern struct window *allocate_window P_ ((void));
2535extern struct frame *allocate_frame P_ ((void));
2536extern struct Lisp_Process *allocate_process P_ ((void));
4d57802e 2537extern int gc_in_progress;
95684592 2538extern int abort_on_gc;
2f69f2ec 2539extern Lisp_Object make_float P_ ((double));
526a2be7
AS
2540extern void display_malloc_warning P_ ((void));
2541extern int inhibit_garbage_collection P_ ((void));
222151aa 2542extern Lisp_Object make_save_value P_ ((void *, int));
7f5f601b 2543extern void free_misc P_ ((Lisp_Object));
526a2be7
AS
2544extern void free_marker P_ ((Lisp_Object));
2545extern void free_cons P_ ((struct Lisp_Cons *));
46abf440
AS
2546extern void init_alloc_once P_ ((void));
2547extern void init_alloc P_ ((void));
2548extern void syms_of_alloc P_ ((void));
4516715a 2549extern struct buffer * allocate_buffer P_ ((void));
3cfe6dfd 2550
1842abb2
KH
2551/* Defined in chartab.c */
2552EXFUN (Fmake_char_table, 2);
2553EXFUN (Fchar_table_parent, 1);
2554EXFUN (Fset_char_table_parent, 2);
2555EXFUN (Fchar_table_extra_slot, 2);
2556EXFUN (Fset_char_table_extra_slot, 3);
2557EXFUN (Fchar_table_range, 2);
2558EXFUN (Fset_char_table_range, 3);
2559EXFUN (Fset_char_table_default, 3);
2560EXFUN (Foptimize_char_table, 1);
2561EXFUN (Fmap_char_table, 2);
2562extern Lisp_Object copy_char_table P_ ((Lisp_Object));
2563extern Lisp_Object sub_char_table_ref P_ ((Lisp_Object, int));
2564extern Lisp_Object char_table_ref P_ ((Lisp_Object, int));
2565extern Lisp_Object char_table_ref_and_range P_ ((Lisp_Object, int,
2566 int *, int *));
2567extern Lisp_Object char_table_set P_ ((Lisp_Object, int, Lisp_Object));
2568extern Lisp_Object char_table_set_range P_ ((Lisp_Object, int, int,
2569 Lisp_Object));
2570extern int char_table_translate P_ ((Lisp_Object, int));
2571extern void map_char_table P_ ((void (*) (Lisp_Object, Lisp_Object,
2572 Lisp_Object),
8f924df7 2573 Lisp_Object, Lisp_Object, Lisp_Object));
1842abb2
KH
2574extern void syms_of_chartab P_ ((void));
2575
3cfe6dfd
JB
2576/* Defined in print.c */
2577extern Lisp_Object Vprin1_to_string_buffer;
7de6c766 2578extern void debug_print P_ ((Lisp_Object));
2f69f2ec
RS
2579EXFUN (Fprin1, 2);
2580EXFUN (Fprin1_to_string, 2);
2581EXFUN (Fprinc, 2);
2582EXFUN (Fterpri, 1);
2583EXFUN (Fprint, 2);
2584EXFUN (Ferror_message_string, 1);
3cfe6dfd 2585extern Lisp_Object Vstandard_output, Qstandard_output;
9453ea7b 2586extern Lisp_Object Qexternal_debugging_output;
101d50c8 2587extern void temp_output_buffer_setup P_ ((const char *));
3cfe6dfd
JB
2588extern int print_level, print_escape_newlines;
2589extern Lisp_Object Qprint_escape_newlines;
526a2be7
AS
2590extern void write_string P_ ((char *, int));
2591extern void write_string_1 P_ ((char *, int, Lisp_Object));
8e40b6cb 2592extern void print_error_message P_ ((Lisp_Object, Lisp_Object, char *, Lisp_Object));
526a2be7 2593extern Lisp_Object internal_with_output_to_temp_buffer
101d50c8 2594 P_ ((const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object));
526a2be7 2595extern void float_to_string P_ ((unsigned char *, double));
46abf440 2596extern void syms_of_print P_ ((void));
526a2be7
AS
2597
2598/* Defined in doprnt.c */
2599extern int doprnt P_ ((char *, int, char *, char *, int, char **));
2600extern int doprnt_lisp P_ ((char *, int, char *, char *, int, char **));
3cfe6dfd
JB
2601
2602/* Defined in lread.c */
2603extern Lisp_Object Qvariable_documentation, Qstandard_input;
393306dd 2604extern Lisp_Object Vobarray, initial_obarray, Vstandard_input;
2f69f2ec
RS
2605EXFUN (Fread, 1);
2606EXFUN (Fread_from_string, 3);
2607EXFUN (Fintern, 2);
2608EXFUN (Fintern_soft, 2);
5d8c7983 2609EXFUN (Fload, 5);
2f69f2ec 2610EXFUN (Fget_file_char, 0);
485bf581
RS
2611EXFUN (Fread_char, 2);
2612EXFUN (Fread_event, 2);
2613extern Lisp_Object read_filtered_event P_ ((int, int, int, int));
eb542c51 2614EXFUN (Feval_region, 4);
f29b79a2 2615extern Lisp_Object intern P_ ((const char *));
2f69f2ec 2616extern Lisp_Object make_symbol P_ ((char *));
f29b79a2 2617extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int));
c5e3de70
RS
2618#define LOADHIST_ATTACH(x) \
2619 if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list)
2620extern Lisp_Object Vcurrent_load_list;
183d1833
SM
2621extern Lisp_Object Vload_history, Vload_suffixes;
2622extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
cae578a8 2623 Lisp_Object *, Lisp_Object));
526a2be7
AS
2624extern int isfloat_string P_ ((char *));
2625extern void map_obarray P_ ((Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
2626 Lisp_Object));
2627extern void dir_warning P_ ((char *, Lisp_Object));
2628extern void close_load_descs P_ ((void));
46abf440
AS
2629extern void init_obarray P_ ((void));
2630extern void init_lread P_ ((void));
2631extern void syms_of_lread P_ ((void));
3cfe6dfd
JB
2632
2633/* Defined in eval.c */
2634extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
ad236261 2635extern Lisp_Object Vinhibit_quit, Qinhibit_quit, Vquit_flag;
3cfe6dfd 2636extern Lisp_Object Vautoload_queue;
973e8873 2637extern Lisp_Object Vdebug_on_error;
fab88cb7 2638extern Lisp_Object Vsignaling_function;
21c5a64e 2639extern int handling_signal;
1ee4d0e6 2640extern int interactive_p P_ ((int));
fab88cb7 2641
f1b6e5fc
SM
2642/* To run a normal hook, use the appropriate function from the list below.
2643 The calling convention:
2644
846d69ac 2645 if (!NILP (Vrun_hooks))
f1b6e5fc
SM
2646 call1 (Vrun_hooks, Qmy_funny_hook);
2647
2648 should no longer be used. */
3cfe6dfd 2649extern Lisp_Object Vrun_hooks;
2f69f2ec
RS
2650EXFUN (Frun_hooks, MANY);
2651EXFUN (Frun_hook_with_args, MANY);
2652EXFUN (Frun_hook_with_args_until_success, MANY);
2653EXFUN (Frun_hook_with_args_until_failure, MANY);
14e76ac9 2654extern Lisp_Object run_hook_list_with_args P_ ((Lisp_Object, int, Lisp_Object *));
526a2be7 2655extern void run_hook_with_args_2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
2f69f2ec
RS
2656EXFUN (Fand, UNEVALLED);
2657EXFUN (For, UNEVALLED);
2658EXFUN (Fif, UNEVALLED);
2659EXFUN (Fprogn, UNEVALLED);
2660EXFUN (Fprog1, UNEVALLED);
2661EXFUN (Fprog2, UNEVALLED);
2662EXFUN (Fsetq, UNEVALLED);
2663EXFUN (Fquote, UNEVALLED);
2664EXFUN (Fuser_variable_p, 1);
2665EXFUN (Finteractive_p, 0);
2666EXFUN (Fdefun, UNEVALLED);
2667EXFUN (Flet, UNEVALLED);
2668EXFUN (FletX, UNEVALLED);
2669EXFUN (Fwhile, UNEVALLED);
2670EXFUN (Fcatch, UNEVALLED);
fca99116 2671EXFUN (Fthrow, 2) NO_RETURN;
2f69f2ec
RS
2672EXFUN (Funwind_protect, UNEVALLED);
2673EXFUN (Fcondition_case, UNEVALLED);
834168ef 2674EXFUN (Fsignal, 2);
2f69f2ec 2675EXFUN (Fautoload, 5);
2a4d03b8 2676EXFUN (Fcommandp, 2);
2f69f2ec
RS
2677EXFUN (Feval, 1);
2678EXFUN (Fapply, MANY);
2679EXFUN (Ffuncall, MANY);
2680EXFUN (Fbacktrace, 0);
2681extern Lisp_Object apply1 P_ ((Lisp_Object, Lisp_Object));
2682extern Lisp_Object call0 P_ ((Lisp_Object));
2683extern Lisp_Object call1 P_ ((Lisp_Object, Lisp_Object));
2684extern Lisp_Object call2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
2685extern Lisp_Object call3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2686extern Lisp_Object call4 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2687extern Lisp_Object call5 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2688extern Lisp_Object call6 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
2689EXFUN (Fdo_auto_save, 2);
2690extern Lisp_Object apply_lambda P_ ((Lisp_Object, Lisp_Object, int));
2691extern Lisp_Object internal_catch P_ ((Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object));
2692extern Lisp_Object internal_condition_case P_ ((Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object)));
2693extern Lisp_Object internal_condition_case_1 P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)));
276680c4 2694extern Lisp_Object internal_condition_case_2 P_ ((Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object)));
526a2be7
AS
2695extern void specbind P_ ((Lisp_Object, Lisp_Object));
2696extern void record_unwind_protect P_ ((Lisp_Object (*) (Lisp_Object), Lisp_Object));
2f69f2ec 2697extern Lisp_Object unbind_to P_ ((int, Lisp_Object));
fca99116 2698extern void error P_ ((/* char *, ... */)) NO_RETURN;
526a2be7 2699extern void do_autoload P_ ((Lisp_Object, Lisp_Object));
2f69f2ec
RS
2700extern Lisp_Object un_autoload P_ ((Lisp_Object));
2701EXFUN (Ffetch_bytecode, 1);
46abf440 2702extern void init_eval_once P_ ((void));
a18c0a47
GM
2703extern Lisp_Object safe_call P_ ((int, Lisp_Object *));
2704extern Lisp_Object safe_call1 P_ ((Lisp_Object, Lisp_Object));
46abf440
AS
2705extern void init_eval P_ ((void));
2706extern void syms_of_eval P_ ((void));
3cfe6dfd
JB
2707
2708/* Defined in editfns.c */
5626cdef 2709EXFUN (Fpropertize, MANY);
986113df 2710EXFUN (Fcurrent_message, 0);
2f69f2ec
RS
2711EXFUN (Fgoto_char, 1);
2712EXFUN (Fpoint_min_marker, 0);
2713EXFUN (Fpoint_max_marker, 0);
2714EXFUN (Fpoint_min, 0);
2715EXFUN (Fpoint_max, 0);
2716EXFUN (Fpoint, 0);
2717EXFUN (Fpoint_marker, 0);
2718EXFUN (Fmark_marker, 0);
2719EXFUN (Fline_beginning_position, 1);
2720EXFUN (Fline_end_position, 1);
2721EXFUN (Ffollowing_char, 0);
2722EXFUN (Fprevious_char, 0);
2723EXFUN (Fchar_after, 1);
2724EXFUN (Finsert, MANY);
2725EXFUN (Finsert_and_inherit, MANY);
2726EXFUN (Finsert_before_markers, MANY);
2727EXFUN (Finsert_buffer_substring, 3);
2728EXFUN (Finsert_char, 3);
526a2be7 2729extern void insert1 P_ ((Lisp_Object));
2f69f2ec
RS
2730EXFUN (Feolp, 0);
2731EXFUN (Feobp, 0);
2732EXFUN (Fbolp, 0);
2733EXFUN (Fbobp, 0);
2734EXFUN (Fformat, MANY);
5010d3b8 2735EXFUN (Fmessage, MANY);
ecb32e0f 2736extern Lisp_Object format2 P_ ((char *, Lisp_Object, Lisp_Object));
2f69f2ec
RS
2737extern Lisp_Object make_buffer_string P_ ((int, int, int));
2738EXFUN (Fbuffer_substring, 2);
2739EXFUN (Fbuffer_string, 0);
2740extern Lisp_Object save_excursion_save P_ ((void));
2741extern Lisp_Object save_restriction_save P_ ((void));
2742extern Lisp_Object save_excursion_restore P_ ((Lisp_Object));
2743extern Lisp_Object save_restriction_restore P_ ((Lisp_Object));
2744EXFUN (Fchar_to_string, 1);
2745EXFUN (Fdelete_region, 2);
2746EXFUN (Fnarrow_to_region, 2);
2747EXFUN (Fwiden, 0);
2748EXFUN (Fuser_login_name, 1);
2749EXFUN (Fsystem_name, 0);
f5969ae9 2750EXFUN (Fcurrent_time, 0);
526a2be7 2751extern int clip_to_bounds P_ ((int, int, int));
b745ec7d
KH
2752extern Lisp_Object make_buffer_string P_ ((int, int, int));
2753extern Lisp_Object make_buffer_string_both P_ ((int, int, int, int, int));
46abf440
AS
2754extern void init_editfns P_ ((void));
2755extern void syms_of_editfns P_ ((void));
4baa6f88 2756EXFUN (Fcurrent_message, 0);
8ca534c4 2757extern Lisp_Object Vinhibit_field_text_motion;
8d0941fa 2758EXFUN (Fconstrain_to_field, 5);
4516715a
DL
2759EXFUN (Ffield_string, 1);
2760EXFUN (Fdelete_field, 1);
89512fcd
MB
2761EXFUN (Ffield_beginning, 3);
2762EXFUN (Ffield_end, 3);
4516715a 2763EXFUN (Ffield_string_no_properties, 1);
9a4f9d30 2764extern void set_time_zone_rule P_ ((char *));
3cfe6dfd
JB
2765
2766/* defined in buffer.c */
d3d92d25 2767extern int mouse_face_overlay_overlaps P_ ((Lisp_Object));
526a2be7 2768extern void nsberror P_ ((Lisp_Object));
88d33e52 2769extern char *no_switch_window P_ ((Lisp_Object window));
986113df 2770EXFUN (Fset_buffer_multibyte, 1);
2f69f2ec
RS
2771EXFUN (Foverlay_start, 1);
2772EXFUN (Foverlay_end, 1);
f1d0c238
AS
2773extern void adjust_overlays_for_insert P_ ((EMACS_INT, EMACS_INT));
2774extern void adjust_overlays_for_delete P_ ((EMACS_INT, EMACS_INT));
6b61353c 2775extern void fix_start_end_in_overlays P_ ((int, int));
526a2be7
AS
2776extern void report_overlay_modification P_ ((Lisp_Object, Lisp_Object, int,
2777 Lisp_Object, Lisp_Object, Lisp_Object));
2f69f2ec 2778extern int overlay_touches_p P_ ((int));
628300ba 2779extern Lisp_Object Vbuffer_alist, Vinhibit_read_only;
2f69f2ec
RS
2780EXFUN (Fget_buffer, 1);
2781EXFUN (Fget_buffer_create, 1);
941caafe 2782EXFUN (Fgenerate_new_buffer_name, 2);
2f69f2ec 2783EXFUN (Fset_buffer, 1);
4a2f9c6a 2784EXFUN (set_buffer_if_live, 1);
2f69f2ec
RS
2785EXFUN (Fbarf_if_buffer_read_only, 0);
2786EXFUN (Fcurrent_buffer, 0);
2787EXFUN (Fswitch_to_buffer, 2);
2788EXFUN (Fpop_to_buffer, 3);
dbe7f1ef 2789EXFUN (Fother_buffer, 3);
2f69f2ec
RS
2790EXFUN (Foverlay_get, 2);
2791EXFUN (Fbuffer_modified_p, 1);
2792EXFUN (Fset_buffer_modified_p, 1);
2793EXFUN (Fkill_buffer, 1);
2794EXFUN (Fkill_all_local_variables, 0);
2795EXFUN (Fbuffer_disable_undo, 1);
2796EXFUN (Fbuffer_enable_undo, 1);
2797EXFUN (Ferase_buffer, 0);
20280af7 2798extern Lisp_Object Qoverlayp;
2f69f2ec 2799extern Lisp_Object get_truename_buffer P_ ((Lisp_Object));
3cfe6dfd 2800extern struct buffer *all_buffers;
2f69f2ec 2801EXFUN (Fprevious_overlay_change, 1);
d7935eb6 2802EXFUN (Fbuffer_file_name, 1);
46abf440
AS
2803extern void init_buffer_once P_ ((void));
2804extern void init_buffer P_ ((void));
2805extern void syms_of_buffer P_ ((void));
2806extern void keys_of_buffer P_ ((void));
3cfe6dfd
JB
2807
2808/* defined in marker.c */
2809
2f69f2ec
RS
2810EXFUN (Fmarker_position, 1);
2811EXFUN (Fmarker_buffer, 1);
2812EXFUN (Fcopy_marker, 2);
2813EXFUN (Fset_marker, 3);
526a2be7 2814extern int marker_position P_ ((Lisp_Object));
ec5d8db7
AS
2815extern int marker_byte_position P_ ((Lisp_Object));
2816extern void clear_charpos_cache P_ ((struct buffer *));
2817extern int charpos_to_bytepos P_ ((int));
2818extern int buf_charpos_to_bytepos P_ ((struct buffer *, int));
2819extern int buf_bytepos_to_charpos P_ ((struct buffer *, int));
c0ac2f4a 2820extern void unchain_marker P_ ((struct Lisp_Marker *marker));
526a2be7 2821extern Lisp_Object set_marker_restricted P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
4ed24bf3
RS
2822extern Lisp_Object set_marker_both P_ ((Lisp_Object, Lisp_Object, int, int));
2823extern Lisp_Object set_marker_restricted_both P_ ((Lisp_Object, Lisp_Object,
2824 int, int));
46abf440 2825extern void syms_of_marker P_ ((void));
3cfe6dfd
JB
2826
2827/* Defined in fileio.c */
2828
2829extern Lisp_Object Qfile_error;
2f69f2ec
RS
2830EXFUN (Ffind_file_name_handler, 2);
2831EXFUN (Ffile_name_as_directory, 1);
f5969ae9 2832EXFUN (Fmake_temp_name, 1);
2f69f2ec
RS
2833EXFUN (Fexpand_file_name, 2);
2834EXFUN (Ffile_name_nondirectory, 1);
2835EXFUN (Fsubstitute_in_file_name, 1);
2836EXFUN (Ffile_symlink_p, 1);
2837EXFUN (Fverify_visited_file_modtime, 1);
2838EXFUN (Ffile_exists_p, 1);
2839EXFUN (Ffile_name_absolute_p, 1);
2840EXFUN (Fdirectory_file_name, 1);
2841EXFUN (Ffile_name_directory, 1);
2842extern Lisp_Object expand_and_dir_to_file P_ ((Lisp_Object, Lisp_Object));
2843EXFUN (Ffile_accessible_directory_p, 1);
2844EXFUN (Funhandled_file_name_directory, 1);
2845EXFUN (Ffile_directory_p, 1);
b4e187e2 2846EXFUN (Fwrite_region, 7);
2f69f2ec
RS
2847EXFUN (Ffile_readable_p, 1);
2848EXFUN (Ffile_executable_p, 1);
fda1acc5 2849EXFUN (Fread_file_name, 6);
38a734b8 2850extern Lisp_Object close_file_unwind P_ ((Lisp_Object));
f29b79a2 2851extern void report_file_error P_ ((const char *, Lisp_Object));
526a2be7 2852extern int internal_delete_file P_ ((Lisp_Object));
46abf440 2853extern void syms_of_fileio P_ ((void));
4baa6f88 2854EXFUN (Fmake_temp_name, 1);
15b0ced5 2855extern void init_fileio_once P_ ((void));
9d936abc 2856extern Lisp_Object make_temp_name P_ ((Lisp_Object, int));
453d8ee9 2857EXFUN (Fmake_symbolic_link, 3);
3cfe6dfd
JB
2858
2859/* Defined in abbrev.c */
2860
46abf440 2861extern void syms_of_abbrev P_ ((void));
3cfe6dfd
JB
2862
2863/* defined in search.c */
838fad15 2864extern void shrink_regexp_cache P_ ((void));
2f69f2ec
RS
2865EXFUN (Fstring_match, 3);
2866extern void restore_match_data P_ ((void));
2867EXFUN (Fmatch_data, 2);
f405b38d 2868EXFUN (Fset_match_data, 1);
2f69f2ec
RS
2869EXFUN (Fmatch_beginning, 1);
2870EXFUN (Fmatch_end, 1);
651cd3da 2871EXFUN (Flooking_at, 1);
526a2be7 2872extern int fast_string_match P_ ((Lisp_Object, Lisp_Object));
f29b79a2 2873extern int fast_c_string_match_ignore_case P_ ((Lisp_Object, const char *));
a0aa1111 2874extern int fast_string_match_ignore_case P_ ((Lisp_Object, Lisp_Object));
526a2be7 2875extern int scan_buffer P_ ((int, int, int, int, int *, int));
4ed24bf3 2876extern int scan_newline P_ ((int, int, int, int, int, int));
526a2be7
AS
2877extern int find_next_newline P_ ((int, int));
2878extern int find_next_newline_no_quit P_ ((int, int));
2879extern int find_before_next_newline P_ ((int, int, int));
46abf440 2880extern void syms_of_search P_ ((void));
3cfe6dfd
JB
2881
2882/* defined in minibuf.c */
2883
2884extern Lisp_Object last_minibuf_string;
526a2be7 2885extern void choose_minibuf_frame P_ ((void));
5593f7e3 2886EXFUN (Fcompleting_read, 8);
9e48ae9e 2887EXFUN (Fread_from_minibuffer, 8);
2f69f2ec
RS
2888EXFUN (Fread_variable, 2);
2889EXFUN (Fread_buffer, 3);
2890EXFUN (Fread_minibuffer, 2);
2891EXFUN (Feval_minibuffer, 2);
5593f7e3
KH
2892EXFUN (Fread_string, 5);
2893EXFUN (Fread_no_blanks_input, 3);
2f69f2ec 2894extern Lisp_Object get_minibuffer P_ ((int));
9f1c8be4 2895extern void temp_echo_area_glyphs P_ ((Lisp_Object));
46abf440
AS
2896extern void init_minibuf_once P_ ((void));
2897extern void syms_of_minibuf P_ ((void));
2898extern void keys_of_minibuf P_ ((void));
3cfe6dfd
JB
2899
2900/* Defined in callint.c */
2901
de7885bb 2902extern Lisp_Object Qminus, Qplus, Vcurrent_prefix_arg;
3cfe6dfd 2903extern Lisp_Object Vcommand_history;
7fd61057 2904extern Lisp_Object Qcall_interactively, Qmouse_leave_buffer_hook;
2f69f2ec
RS
2905EXFUN (Fcall_interactively, 3);
2906EXFUN (Fprefix_numeric_value, 1);
46abf440 2907extern void syms_of_callint P_ ((void));
3cfe6dfd
JB
2908
2909/* defined in casefiddle.c */
2910
2f69f2ec
RS
2911EXFUN (Fdowncase, 1);
2912EXFUN (Fupcase, 1);
2913EXFUN (Fcapitalize, 1);
2914EXFUN (Fupcase_region, 2);
2915EXFUN (Fupcase_initials, 1);
2916EXFUN (Fupcase_initials_region, 2);
46abf440
AS
2917extern void syms_of_casefiddle P_ ((void));
2918extern void keys_of_casefiddle P_ ((void));
3cfe6dfd 2919
1747fb16
RS
2920/* defined in casetab.c */
2921
2f69f2ec
RS
2922EXFUN (Fset_case_table, 1);
2923EXFUN (Fset_standard_case_table, 1);
46abf440
AS
2924extern void init_casetab_once P_ ((void));
2925extern void syms_of_casetab P_ ((void));
1747fb16 2926
3cfe6dfd
JB
2927/* defined in keyboard.c */
2928
54cd1651
GM
2929extern int echoing;
2930extern Lisp_Object echo_message_buffer;
417750de 2931extern struct kboard *echo_kboard;
54cd1651 2932extern void cancel_echoing P_ ((void));
1425dcb6 2933extern Lisp_Object Qdisabled, QCfilter;
4b657f72 2934extern Lisp_Object Vtty_erase_char, Vhelp_form, Vtop_level;
08fdede6 2935extern Lisp_Object Vthrow_on_input;
8e7bd231 2936extern int input_pending;
2f69f2ec
RS
2937EXFUN (Fdiscard_input, 0);
2938EXFUN (Frecursive_edit, 0);
04d7d066 2939EXFUN (Ftop_level, 0);
2f69f2ec
RS
2940EXFUN (Fcommand_execute, 4);
2941EXFUN (Finput_pending_p, 0);
2942extern Lisp_Object menu_bar_items P_ ((Lisp_Object));
9ea173e8 2943extern Lisp_Object tool_bar_items P_ ((Lisp_Object, int *));
f498e3b2 2944extern Lisp_Object Qvertical_scroll_bar;
4516715a 2945extern void discard_mouse_events P_ ((void));
2f69f2ec 2946EXFUN (Fevent_convert_list, 1);
e271fdb3 2947EXFUN (Fread_key_sequence, 5);
526a2be7
AS
2948EXFUN (Fset_input_mode, 4);
2949extern int detect_input_pending P_ ((void));
a2d5fca0 2950extern int detect_input_pending_ignore_squeezables P_ ((void));
526a2be7
AS
2951extern int detect_input_pending_run_timers P_ ((int));
2952extern void safe_run_hooks P_ ((Lisp_Object));
2953extern void cmd_error_internal P_ ((Lisp_Object, char *));
2954extern Lisp_Object command_loop_1 P_ ((void));
2955extern Lisp_Object recursive_edit_1 P_ ((void));
2956extern void record_auto_save P_ ((void));
46abf440
AS
2957extern void init_keyboard P_ ((void));
2958extern void syms_of_keyboard P_ ((void));
2959extern void keys_of_keyboard P_ ((void));
89f93679 2960extern char *push_key_description P_ ((unsigned int, char *, int));
3cfe6dfd 2961
3cfe6dfd
JB
2962
2963/* defined in indent.c */
2f69f2ec
RS
2964EXFUN (Fvertical_motion, 2);
2965EXFUN (Findent_to, 2);
2966EXFUN (Fcurrent_column, 0);
2967EXFUN (Fmove_to_column, 2);
0cef4798 2968extern double current_column P_ ((void));
526a2be7 2969extern void invalidate_current_column P_ ((void));
0cef4798 2970extern int indented_beyond_p P_ ((int, int, double));
46abf440 2971extern void syms_of_indent P_ ((void));
3cfe6dfd 2972
ff11dfa1 2973/* defined in frame.c */
a433994a
ST
2974#ifdef HAVE_WINDOW_SYSTEM
2975extern Lisp_Object Vx_resource_name;
2976extern Lisp_Object Vx_resource_class;
2977#endif /* HAVE_WINDOW_SYSTEM */
362fb47a 2978extern Lisp_Object Qvisible;
526a2be7 2979extern void store_frame_param P_ ((struct frame *, Lisp_Object, Lisp_Object));
2f69f2ec 2980extern void store_in_alist P_ ((Lisp_Object *, Lisp_Object, Lisp_Object));
25f873bc 2981extern Lisp_Object do_switch_frame P_ ((Lisp_Object, int, int));
526a2be7 2982extern Lisp_Object get_frame_param P_ ((struct frame *, Lisp_Object));
dbe7f1ef 2983extern Lisp_Object frame_buffer_predicate P_ ((Lisp_Object));
2f69f2ec
RS
2984EXFUN (Fframep, 1);
2985EXFUN (Fselect_frame, 2);
2986EXFUN (Fselected_frame, 0);
2987EXFUN (Fwindow_frame, 1);
2988EXFUN (Fframe_root_window, 1);
2989EXFUN (Fframe_first_window, 1);
2990EXFUN (Fframe_selected_window, 1);
2991EXFUN (Fframe_list, 0);
2992EXFUN (Fnext_frame, 2);
2993EXFUN (Fdelete_frame, 2);
2994EXFUN (Fset_mouse_position, 3);
2995EXFUN (Fmake_frame_visible, 1);
2996EXFUN (Fmake_frame_invisible, 2);
2997EXFUN (Ficonify_frame, 1);
2998EXFUN (Fframe_visible_p, 1);
2999EXFUN (Fvisible_frame_list, 0);
4560730a 3000EXFUN (Fframe_parameter, 2);
2f69f2ec
RS
3001EXFUN (Fframe_parameters, 1);
3002EXFUN (Fmodify_frame_parameters, 2);
3003EXFUN (Fset_frame_height, 3);
3004EXFUN (Fset_frame_width, 3);
3005EXFUN (Fset_frame_size, 3);
3006EXFUN (Fset_frame_position, 3);
3007EXFUN (Fraise_frame, 1);
3008EXFUN (Fredirect_frame_focus, 2);
526a2be7 3009EXFUN (Fset_frame_selected_window, 2);
dbe7f1ef 3010extern Lisp_Object frame_buffer_list P_ ((Lisp_Object));
526a2be7 3011extern void frames_discard_buffer P_ ((Lisp_Object));
dbe7f1ef 3012extern void set_frame_buffer_list P_ ((Lisp_Object, Lisp_Object));
526a2be7 3013extern void frames_bury_buffer P_ ((Lisp_Object));
46abf440 3014extern void syms_of_frame P_ ((void));
3cfe6dfd
JB
3015
3016/* defined in emacs.c */
2f69f2ec 3017extern Lisp_Object decode_env_path P_ ((char *, char *));
3530d534 3018extern Lisp_Object Vinvocation_name, Vinvocation_directory;
1093ec47 3019extern Lisp_Object Vinstallation_directory, empty_string;
2f69f2ec 3020EXFUN (Fkill_emacs, 1);
68c45bf0
PE
3021#if HAVE_SETLOCALE
3022void fixup_locale P_ ((void));
ca9c0567
PE
3023void synchronize_system_messages_locale P_ ((void));
3024void synchronize_system_time_locale P_ ((void));
68c45bf0
PE
3025#else
3026#define setlocale(category, locale)
3027#define fixup_locale()
ca9c0567
PE
3028#define synchronize_system_messages_locale()
3029#define synchronize_system_time_locale()
68c45bf0 3030#endif
2f69f2ec 3031void shut_down_emacs P_ ((int, int, Lisp_Object));
3cfe6dfd
JB
3032/* Nonzero means don't do interactive redisplay and don't change tty modes */
3033extern int noninteractive;
3034/* Nonzero means don't do use window-system-specific display code */
3035extern int inhibit_window_system;
99a3d506 3036/* Nonzero means that a filter or a sentinel is running. */
7074fde6 3037extern int running_asynch_code;
3cfe6dfd
JB
3038
3039/* defined in process.c */
2f69f2ec
RS
3040EXFUN (Fget_process, 1);
3041EXFUN (Fget_buffer_process, 1);
3042EXFUN (Fprocessp, 1);
3043EXFUN (Fprocess_status, 1);
3044EXFUN (Fkill_process, 2);
3045EXFUN (Fprocess_send_eof, 1);
3046EXFUN (Fwaiting_for_user_input_p, 0);
6efad63b 3047extern Lisp_Object Qprocessp;
526a2be7 3048extern void kill_buffer_processes P_ ((Lisp_Object));
d64b707c
KS
3049extern int wait_reading_process_output P_ ((int, int, int, int,
3050 Lisp_Object,
3051 struct Lisp_Process *,
3052 int));
526a2be7
AS
3053extern void deactivate_process P_ ((Lisp_Object));
3054extern void add_keyboard_wait_descriptor P_ ((int));
3055extern void delete_keyboard_wait_descriptor P_ ((int));
3056extern void close_process_descs P_ ((void));
3057extern void status_notify P_ ((void));
3058extern int read_process_output P_ ((Lisp_Object, int));
46abf440
AS
3059extern void init_process P_ ((void));
3060extern void syms_of_process P_ ((void));
d3c8e597 3061extern void setup_process_coding_systems P_ ((Lisp_Object));
3cfe6dfd
JB
3062
3063/* defined in callproc.c */
183d1833
SM
3064extern Lisp_Object Vexec_path, Vexec_suffixes,
3065 Vexec_directory, Vdata_directory;
c65be0e1 3066extern Lisp_Object Vdoc_directory;
f5969ae9 3067EXFUN (Fcall_process, MANY);
526a2be7 3068extern int child_setup P_ ((int, int, int, char **, int, Lisp_Object));
46abf440
AS
3069extern void init_callproc_1 P_ ((void));
3070extern void init_callproc P_ ((void));
3071extern void set_process_environment P_ ((void));
3072extern void syms_of_callproc P_ ((void));
3cfe6dfd 3073
3cfe6dfd
JB
3074/* defined in doc.c */
3075extern Lisp_Object Vdoc_file_name;
2f69f2ec
RS
3076EXFUN (Fsubstitute_command_keys, 1);
3077EXFUN (Fdocumentation, 2);
3078EXFUN (Fdocumentation_property, 3);
3079extern Lisp_Object read_doc_string P_ ((Lisp_Object));
3dd00fc3 3080extern Lisp_Object get_doc_string P_ ((Lisp_Object, int, int));
46abf440 3081extern void syms_of_doc P_ ((void));
4baa6f88 3082extern int read_bytecode_char P_ ((int));
3cfe6dfd
JB
3083
3084/* defined in bytecode.c */
3085extern Lisp_Object Qbytecode;
2f69f2ec 3086EXFUN (Fbyte_code, 3);
46abf440 3087extern void syms_of_bytecode P_ ((void));
35c7a974
GM
3088extern struct byte_stack *byte_stack_list;
3089extern void mark_byte_stack P_ ((void));
8e6e83b3 3090extern void unmark_byte_stack P_ ((void));
3cfe6dfd
JB
3091
3092/* defined in macros.c */
3093extern Lisp_Object Qexecute_kbd_macro;
a361276f 3094EXFUN (Fexecute_kbd_macro, 3);
35e36092 3095EXFUN (Fcancel_kbd_macro_events, 0);
46abf440
AS
3096extern void init_macros P_ ((void));
3097extern void syms_of_macros P_ ((void));
3cfe6dfd 3098
d20c2151 3099/* defined in undo.c */
a387611b 3100extern Lisp_Object Qinhibit_read_only;
2f69f2ec 3101EXFUN (Fundo_boundary, 0);
f10fffca 3102extern void truncate_undo_list P_ ((struct buffer *));
526a2be7
AS
3103extern void record_marker_adjustment P_ ((Lisp_Object, int));
3104extern void record_insert P_ ((int, int));
443de1d7 3105extern void record_delete P_ ((int, Lisp_Object));
526a2be7
AS
3106extern void record_first_change P_ ((void));
3107extern void record_change P_ ((int, int));
3108extern void record_property_change P_ ((int, int, Lisp_Object, Lisp_Object,
3109 Lisp_Object));
46abf440 3110extern void syms_of_undo P_ ((void));
8e43e4b2 3111extern Lisp_Object Vundo_outer_limit;
d20c2151 3112
8537f1cb 3113/* defined in textprop.c */
5f6bf5fe 3114extern Lisp_Object Qfont, Qmouse_face;
c2d8811c 3115extern Lisp_Object Qinsert_in_front_hooks, Qinsert_behind_hooks;
2f69f2ec 3116EXFUN (Fnext_single_property_change, 4);
5433ffa5 3117EXFUN (Fnext_single_char_property_change, 4);
2f69f2ec
RS
3118EXFUN (Fprevious_single_property_change, 4);
3119EXFUN (Fget_text_property, 3);
3120EXFUN (Fput_text_property, 5);
2f69f2ec
RS
3121EXFUN (Fprevious_char_property_change, 2);
3122EXFUN (Fnext_char_property_change, 2);
526a2be7 3123extern void report_interval_modification P_ ((Lisp_Object, Lisp_Object));
50075fa0
GM
3124extern Lisp_Object next_single_char_property_change P_ ((Lisp_Object,
3125 Lisp_Object,
3126 Lisp_Object,
3127 Lisp_Object));
8537f1cb 3128
40131ef5 3129/* defined in xmenu.c */
2f69f2ec
RS
3130EXFUN (Fx_popup_menu, 2);
3131EXFUN (Fx_popup_dialog, 2);
46abf440 3132extern void syms_of_xmenu P_ ((void));
526a2be7
AS
3133
3134/* defined in sysdep.c */
0868e74e 3135extern void stuff_char P_ ((char c));
526a2be7
AS
3136extern void init_sigio P_ ((int));
3137extern void request_sigio P_ ((void));
3138extern void unrequest_sigio P_ ((void));
3139extern void reset_sys_modes P_ ((void));
3140extern void sys_subshell P_ ((void));
3141extern void sys_suspend P_ ((void));
3142extern void discard_tty_input P_ ((void));
3143extern void init_sys_modes P_ ((void));
3144extern void reset_sys_modes P_ ((void));
3145extern void get_frame_size P_ ((int *, int *));
3146extern void wait_for_termination P_ ((int));
3147extern void flush_pending_output P_ ((int));
3148extern void child_setup_tty P_ ((int));
3149extern void setup_pty P_ ((int));
3150extern int set_window_size P_ ((int, int, int));
3151extern void create_process P_ ((Lisp_Object, char **, Lisp_Object));
3152extern int tabs_safe_p P_ ((void));
3153extern void init_baud_rate P_ ((void));
f29b79a2 3154extern int emacs_open P_ ((const char *, int, int));
68c45bf0
PE
3155extern int emacs_close P_ ((int));
3156extern int emacs_read P_ ((int, char *, unsigned int));
101d50c8 3157extern int emacs_write P_ ((int, const char *, unsigned int));
526a2be7
AS
3158
3159/* defined in filelock.c */
3160EXFUN (Funlock_buffer, 0);
9ae8d912 3161EXFUN (Ffile_locked_p, 1);
526a2be7
AS
3162extern void unlock_all_files P_ ((void));
3163extern void lock_file P_ ((Lisp_Object));
3164extern void unlock_file P_ ((Lisp_Object));
3165extern void unlock_buffer P_ ((struct buffer *));
46abf440 3166extern void syms_of_filelock P_ ((void));
15b0ced5
GM
3167extern void init_filelock P_ ((void));
3168
3169/* Defined in sound.c */
3170extern void syms_of_sound P_ ((void));
3171extern void init_sound P_ ((void));
46abf440
AS
3172
3173/* Defined in category.c */
3174extern void init_category_once P_ ((void));
1842abb2 3175extern Lisp_Object char_category_set P_ ((int));
46abf440
AS
3176extern void syms_of_category P_ ((void));
3177
3178/* Defined in ccl.c */
3179extern void syms_of_ccl P_ ((void));
3180
3181/* Defined in dired.c */
6b61353c 3182EXFUN (Ffile_attributes, 2);
46abf440
AS
3183extern void syms_of_dired P_ ((void));
3184
46abf440
AS
3185/* Defined in term.c */
3186extern void syms_of_term P_ ((void));
07cd5d9c 3187extern void fatal () NO_RETURN;
46abf440
AS
3188
3189#ifdef HAVE_X_WINDOWS
3190/* Defined in fontset.c */
3191extern void syms_of_fontset P_ ((void));
957e7394 3192EXFUN (Fset_fontset_font, 5);
c497dce4 3193EXFUN (Fnew_fontset, 2);
46abf440
AS
3194#endif
3195
3196/* Defined in xfaces.c */
3197extern void syms_of_xfaces P_ ((void));
3198
7de6c766
GM
3199/* Defined in getloadavg.c */
3200extern int getloadavg P_ ((double *, int));
3201
46abf440
AS
3202#ifdef HAVE_X_WINDOWS
3203/* Defined in xfns.c */
3204extern void syms_of_xfns P_ ((void));
a433994a
ST
3205#endif /* HAVE_X_WINDOWS */
3206#ifdef HAVE_WINDOW_SYSTEM
3207/* Defined in xfns.c, w32fns.c, or macfns.c */
4516715a 3208EXFUN (Fxw_display_color_p, 1);
f9d64bb3 3209EXFUN (Fx_file_dialog, 5);
a433994a 3210#endif /* HAVE_WINDOW_SYSTEM */
46abf440 3211
e02207d4
JD
3212/* Defined in xsmfns.c */
3213extern void syms_of_xsmfns P_ ((void));
3214
46abf440
AS
3215/* Defined in xselect.c */
3216extern void syms_of_xselect P_ ((void));
3217
3218/* Defined in xterm.c */
3219extern void syms_of_xterm P_ ((void));
4baa6f88
DL
3220
3221/* Defined in getloadavg.c */
3222extern int getloadavg P_ ((double [], int));
b7f34997
AS
3223
3224#ifdef MSDOS
3225/* Defined in msdos.c */
3226EXFUN (Fmsdos_downcase_filename, 1);
3227#endif
83925baa 3228\f
3cfe6dfd
JB
3229/* Nonzero means Emacs has already been initialized.
3230 Used during startup to detect startup of dumped Emacs. */
3231extern int initialized;
3232
3233extern int immediate_quit; /* Nonzero means ^G can quit instantly */
3234
f66aa8f2
GM
3235extern POINTER_TYPE *xmalloc P_ ((size_t));
3236extern POINTER_TYPE *xrealloc P_ ((POINTER_TYPE *, size_t));
074b6efe
DL
3237extern void xfree P_ ((POINTER_TYPE *));
3238
f29b79a2 3239extern char *xstrdup P_ ((const char *));
3cfe6dfd 3240
526a2be7 3241extern char *egetenv P_ ((char *));
e98227af 3242
5d6be39f 3243/* Set up the name of the machine we're running on. */
526a2be7 3244extern void init_system_name P_ ((void));
881a5a80
RS
3245
3246/* Some systems (e.g., NT) use a different path separator than Unix,
3247 in addition to a device separator. Default the path separator
3248 to '/', and don't test for a device separator in IS_ANY_SEP. */
3249
e0c07012
RS
3250#ifdef WINDOWSNT
3251extern Lisp_Object Vdirectory_sep_char;
3252#endif
3253
881a5a80
RS
3254#ifndef DIRECTORY_SEP
3255#define DIRECTORY_SEP '/'
3256#endif
881a5a80
RS
3257#ifndef IS_DIRECTORY_SEP
3258#define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
3259#endif
3260#ifndef IS_DEVICE_SEP
3261#ifndef DEVICE_SEP
3262#define IS_DEVICE_SEP(_c_) 0
3263#else
3264#define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP)
3265#endif
3266#endif
3267#ifndef IS_ANY_SEP
3268#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_))
3269#endif
51bd4610
KH
3270
3271#ifdef SWITCH_ENUM_BUG
3272#define SWITCH_ENUM_CAST(x) ((int)(x))
3273#else
3274#define SWITCH_ENUM_CAST(x) (x)
3275#endif
a32fa736
GM
3276
3277/* Loop over Lisp list LIST. Signal an error if LIST is not a proper
3278 list, or if it contains circles.
e2c0561e 3279
a32fa736
GM
3280 HARE and TORTOISE should be the names of Lisp_Object variables, and
3281 N should be the name of an EMACS_INT variable declared in the
3282 function where the macro is used. Each nested loop should use
3283 its own variables.
3284
3285 In the loop body, HARE is set to each cons of LIST, and N is the
3286 length of the list processed so far. */
3287
3288#define LIST_END_P(list, obj) \
3289 (NILP (obj) \
3290 ? 1 \
3291 : (CONSP (obj) \
3292 ? 0 \
d28981c9 3293 : (wrong_type_argument (Qlistp, (list))), 1))
a32fa736
GM
3294
3295#define FOREACH(hare, list, tortoise, n) \
3296 for (tortoise = hare = (list), n = 0; \
3297 !LIST_END_P (list, hare); \
3298 (hare = XCDR (hare), ++n, \
3299 ((n & 1) != 0 \
3300 ? (tortoise = XCDR (tortoise), \
3301 (EQ (hare, tortoise) \
3302 && (circular_list_error ((list)), 1))) \
3303 : 0)))
8a226de7
GM
3304
3305/* The ubiquitous min and max macros. */
3306
152180e3
AI
3307#ifdef max
3308#undef max
3309#undef min
3310#endif
8a226de7
GM
3311#define min(a, b) ((a) < (b) ? (a) : (b))
3312#define max(a, b) ((a) > (b) ? (a) : (b))
53ede3f4
GM
3313
3314/* Return a fixnum or float, depending on whether VAL fits in a Lisp
3315 fixnum. */
3316
3317#define make_fixnum_or_float(val) \
d28981c9
SM
3318 (FIXNUM_OVERFLOW_P (val) \
3319 ? make_float (val) \
3320 : make_number ((EMACS_INT)(val)))
6b61353c 3321
e32d9872
MB
3322
3323/* Checks the `cycle check' variable CHECK to see if it indicates that
3324 EL is part of a cycle; CHECK must be either Qnil or a value returned
3325 by an earlier use of CYCLE_CHECK. SUSPICIOUS is the number of
3326 elements after which a cycle might be suspected; after that many
3327 elements, this macro begins consing in order to keep more precise
3328 track of elements.
3329
3330 Returns nil if a cycle was detected, otherwise a new value for CHECK
3331 that includes EL.
3332
3333 CHECK is evaluated multiple times, EL and SUSPICIOUS 0 or 1 times, so
3334 the caller should make sure that's ok. */
3335
3336#define CYCLE_CHECK(check, el, suspicious) \
3337 (NILP (check) \
3338 ? make_number (0) \
3339 : (INTEGERP (check) \
3340 ? (XFASTINT (check) < (suspicious) \
3341 ? make_number (XFASTINT (check) + 1) \
3342 : Fcons (el, Qnil)) \
3343 : (!NILP (Fmemq ((el), (check))) \
3344 ? Qnil \
3345 : Fcons ((el), (check)))))
3346
3347
79518a8d
KS
3348/* SAFE_ALLOCA normally allocates memory on the stack, but if size is
3349 larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */
3350
3351#define MAX_ALLOCA 16*1024
3352
3353extern Lisp_Object safe_alloca_unwind (Lisp_Object);
3354
3355#define USE_SAFE_ALLOCA \
c33188d9 3356 int sa_count = SPECPDL_INDEX (), sa_must_free = 0
79518a8d 3357
a9e6bacc
KS
3358/* SAFE_ALLOCA allocates a simple buffer. */
3359
79518a8d
KS
3360#define SAFE_ALLOCA(buf, type, size) \
3361 do { \
3362 if ((size) < MAX_ALLOCA) \
3363 buf = (type) alloca (size); \
3364 else \
3365 { \
3366 buf = (type) xmalloc (size); \
c33188d9 3367 sa_must_free++; \
79518a8d
KS
3368 record_unwind_protect (safe_alloca_unwind, \
3369 make_save_value (buf, 0)); \
3370 } \
3371 } while (0)
3372
a9e6bacc
KS
3373/* SAFE_FREE frees xmalloced memory and enables GC as needed. */
3374
c33188d9 3375#define SAFE_FREE() \
79518a8d 3376 do { \
c33188d9
KS
3377 if (sa_must_free) { \
3378 sa_must_free = 0; \
79518a8d 3379 unbind_to (sa_count, Qnil); \
c33188d9 3380 } \
79518a8d
KS
3381 } while (0)
3382
3383
5f5d6c62
KS
3384/* SAFE_ALLOCA_LISP allocates an array of Lisp_Objects. */
3385
3386#define SAFE_ALLOCA_LISP(buf, nelt) \
3387 do { \
3388 int size_ = (nelt) * sizeof (Lisp_Object); \
3389 if (size_ < MAX_ALLOCA) \
3390 buf = (Lisp_Object *) alloca (size_); \
3391 else \
3392 { \
3393 Lisp_Object arg_; \
3394 buf = (Lisp_Object *) xmalloc (size_); \
3395 arg_ = make_save_value (buf, nelt); \
3396 XSAVE_VALUE (arg_)->dogc = 1; \
c33188d9 3397 sa_must_free++; \
5f5d6c62
KS
3398 record_unwind_protect (safe_alloca_unwind, arg_); \
3399 } \
3400 } while (0)
3401
79518a8d 3402
6b61353c
KH
3403#endif /* EMACS_LISP_H */
3404
3405/* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e
3406 (do not change this comment) */