comparison src/lisp.h @ 5125:b5df3737028a ben-lisp-object

merge
author Ben Wing <ben@xemacs.org>
date Wed, 24 Feb 2010 01:58:04 -0600
parents 623d57b7fbe8 838630c0734f
children 2a462149bd6a
comparison
equal deleted inserted replaced
5124:623d57b7fbe8 5125:b5df3737028a
1 /* Fundamental definitions for XEmacs Lisp interpreter. 1 /* Fundamental definitions for XEmacs Lisp interpreter.
2 Copyright (C) 1985-1987, 1992-1995 Free Software Foundation, Inc. 2 Copyright (C) 1985-1987, 1992-1995 Free Software Foundation, Inc.
3 Copyright (C) 1993-1996 Richard Mlynarik. 3 Copyright (C) 1993-1996 Richard Mlynarik.
4 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2003, 2004, 2005 Ben Wing. 4 Copyright (C) 1995, 1996, 2000-2005, 2009, 2010 Ben Wing.
5 5
6 This file is part of XEmacs. 6 This file is part of XEmacs.
7 7
8 XEmacs is free software; you can redistribute it and/or modify it 8 XEmacs is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the 9 under the terms of the GNU General Public License as published by the
19 along with XEmacs; see the file COPYING. If not, write to 19 along with XEmacs; see the file COPYING. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */ 21 Boston, MA 02111-1307, USA. */
22 22
23 /* Synched up with: FSF 19.30. */ 23 /* Synched up with: FSF 19.30. */
24
25 #ifndef INCLUDED_lisp_h_
26 #define INCLUDED_lisp_h_
24 27
25 /* Authorship: 28 /* Authorship:
26 29
27 Based on code from pre-release FSF 19, c. 1991. 30 Based on code from pre-release FSF 19, c. 1991.
28 Various changes by Jamie Zawinski 1991-1994: 31 Various changes by Jamie Zawinski 1991-1994:
48 Various macro-related changes by Jerry James, 2003: 51 Various macro-related changes by Jerry James, 2003:
49 MODULE_API introduced; 52 MODULE_API introduced;
50 Compiler-specific definitions modernized and moved to compiler.h. 53 Compiler-specific definitions modernized and moved to compiler.h.
51 */ 54 */
52 55
53 #ifndef INCLUDED_lisp_h_
54 #define INCLUDED_lisp_h_
55
56 /************************************************************************/
57 /* general definitions */
58 /************************************************************************/
59
60 /* Conventions in comments: 56 /* Conventions in comments:
61 57
62 "Mule-izing" is the process of going through a file and eliminating 58 "Mule-izing" is the process of going through a file and eliminating
63 assumptions that the internal format (Ibyte * text) is the same as the 59 assumptions that the internal format (Ibyte * text) is the same as the
64 external format used by library routines. Mule-ization should also 60 external format used by library routines. Mule-ization should also
89 85
90 %%#### marks places that need work for KKCC (the new garbage collector). 86 %%#### marks places that need work for KKCC (the new garbage collector).
91 87
92 */ 88 */
93 89
94 /* -------------------------- include files --------------------- */ 90 /************************************************************************/
91 /* include files */
92 /************************************************************************/
95 93
96 /* We include the following generally useful header files so that you 94 /* We include the following generally useful header files so that you
97 don't have to worry about prototypes when using the standard C 95 don't have to worry about prototypes when using the standard C
98 library functions and macros. These files shouldn't be excessively 96 library functions and macros. These files shouldn't be excessively
99 large so they shouldn't cause that much of a slowdown. */ 97 large so they shouldn't cause that much of a slowdown. */
100 98
101 #include <stdlib.h> 99 #include <stdlib.h>
100 /* Evil, but ... -Wshadow is genuinely useful but also leads to spurious
101 warnings when you have a local var named `index'. Avoid this by
102 hacking around it. */
103 #define index old_index
102 #include <string.h> /* primarily for memcpy, etc. */ 104 #include <string.h> /* primarily for memcpy, etc. */
105 #undef index
103 #include <stdio.h> /* NULL, etc. */ 106 #include <stdio.h> /* NULL, etc. */
104 #include <ctype.h> 107 #include <ctype.h>
105 #include <stdarg.h> 108 #include <stdarg.h>
106 #include <stddef.h> /* offsetof */ 109 #include <stddef.h> /* offsetof */
107 #include <sys/types.h> 110 #include <sys/types.h>
108 #include <limits.h> 111 #include <limits.h>
109 112 #ifdef __cplusplus
110 /* -------------------------- error-checking ------------------------ */ 113 #include <limits> /* necessary for max()/min() under G++ 4 */
111 114 #endif
112 /* The large categories established by configure can be subdivided into 115
113 smaller subcategories, for problems in specific modules. You can't 116
114 control this using configure, but you can manually stick in a define as 117 /************************************************************************/
115 necessary. */ 118 /* error checking */
119 /************************************************************************/
120
121 /* ------------------------- large categories ------------------------- */
122
123 /* How these work:
124
125 The most common classes will be `text' and `type', followed by `structure'.
126 `text' is for problems related to bad textual format. `type' is for
127 problems related to wrongly typed arguments, structure fields, etc.
128 `structure' is for bad data inside of a structure. Sometimes these are
129 used "incorrectly", e.g. `type' is often used for structure-checking.
130 Consider `text':
131
132 `text_checking_assert() will assert() only when ERROR_CHECK_TEXT is defined;
133 otherwise it's a no-op. text_checking_assert_at_line() is similar, but
134 allows you to override the file name and line number normally supplied in
135 the message. This is especially useful in inline header functions, and
136 so there's a special inline_text_checking_assert() for this; this works
137 like text_checking_assert() but supplies the file and line of the calling
138 function. In order for this to work, you need to declare your inline
139 function with INLINE_TEXT_CHECK_ARGS at the end of its argument list,
140 and give its function name a _1 extension or similar. Then create a
141 macro that calls your inline function and includes INLINE_TEXT_CHECK_CALL
142 at the end of the parameter list. This will arrange to pass in and receive
143 the file and line (__FILE__, __LINE__) at place where the call occurs in
144 the calling function; but nothing will get passed in when ERROR_CHECK_TEXT
145 is not defined.
146
147 Currently the full bevy of *foo_checking_assert* macros are defined only
148 for `text' and `types'; for others, only the basic foo_checking_assert()
149 macro is defined. Writing out all the variations for all possible error
150 categories would produce too much clutter. If any of these become
151 needed, they can always be defined. */
152
153 /* #### I suggest revamping these and making proper use of the
154 category/subcategory system. Here is one proposal:
155
156 Major category Minor categories
157 --------------------------------
158 Allocation
159 Malloc
160 Dynarr
161
162 Display
163 Extents
164 Glyphs
165 Redisplay
166
167 Execution
168 Byte-Code
169 Catch
170 Garbage Collection
171 Trapping-Problems
172
173 Lisp Objects
174 Buffers
175 Char Tables
176 Events
177 Lstreams
178 Hash Tables
179 Range Tables
180
181 Types
182 Lrecord Types
183 Subtypes
184
185 Text
186 Byte Positions
187 Conversion
188 Eistrings
189 Itext
190 Lisp Strings
191
192 --ben
193 */
194
195
196 #define INLINE_ERROR_CHECK_ARGS , const char *__file__, int __line__
197 #define INLINE_ERROR_CHECK_CALL , __FILE__, __LINE__
198 #define DISABLED_INLINE_ERROR_CHECK_ARGS
199 #define DISABLED_INLINE_ERROR_CHECK_CALL
200
201 /* For assertions in inline header functions which will report the file and
202 line of the calling function */
203 #define inline_assert(assertion) assert_at_line (assertion, __file__, __line__)
204 /* The following should not use disabled_assert_at_line() because when the
205 inline assert is disabled, params __file__ and __line__ do not exist. */
206 #define disabled_inline_assert(assertion) disabled_assert (assertion)
207
208 /* ------- the specific categories -------- */
209
210 #if defined (ERROR_CHECK_BYTE_CODE) || defined (ERROR_CHECK_DISPLAY) || defined (ERROR_CHECK_EXTENTS) || defined (ERROR_CHECK_GC) || defined (ERROR_CHECK_GLYPHS) || defined (ERROR_CHECK_MALLOC) || defined (ERROR_CHECK_STRUCTURES) || defined (ERROR_CHECK_TEXT) || defined (ERROR_CHECK_TYPES)
211 #define ERROR_CHECK_ANY
212 #endif
213
214 /* KEEP THESE SORTED! */
215
216 #ifdef ERROR_CHECK_BYTE_CODE
217 #define byte_code_checking_assert(assertion) assert (assertion)
218 #else /* not ERROR_CHECK_BYTE_CODE */
219 #define byte_code_checking_assert(assertion) disabled_assert (assertion)
220 #endif /* ERROR_CHECK_BYTE_CODE */
221
222 #ifdef ERROR_CHECK_DISPLAY
223 #define display_checking_assert(assertion) assert (assertion)
224 #else /* not ERROR_CHECK_DISPLAY */
225 #define display_checking_assert(assertion) disabled_assert (assertion)
226 #endif /* ERROR_CHECK_DISPLAY */
227
228 #ifdef ERROR_CHECK_EXTENTS
229 #define extent_checking_assert(assertion) assert (assertion)
230 #else /* not ERROR_CHECK_EXTENTS */
231 #define extent_checking_assert(assertion) disabled_assert (assertion)
232 #endif /* ERROR_CHECK_EXTENTS */
233
234 #ifdef ERROR_CHECK_GC
235 #define gc_checking_assert(assertion) assert (assertion)
236 #else /* not ERROR_CHECK_GC */
237 #define gc_checking_assert(assertion) disabled_assert (assertion)
238 #endif /* ERROR_CHECK_GC */
239
240 #ifdef ERROR_CHECK_GLYPHS
241 #define glyph_checking_assert(assertion) assert (assertion)
242 #else /* not ERROR_CHECK_GLYPHS */
243 #define glyph_checking_assert(assertion) disabled_assert (assertion)
244 #endif /* ERROR_CHECK_GLYPHS */
245
246 #ifdef ERROR_CHECK_MALLOC
247 #define malloc_checking_assert(assertion) assert (assertion)
248 #else /* not ERROR_CHECK_MALLOC */
249 #define malloc_checking_assert(assertion) disabled_assert (assertion)
250 #endif /* ERROR_CHECK_MALLOC */
116 251
117 #ifdef ERROR_CHECK_STRUCTURES 252 #ifdef ERROR_CHECK_STRUCTURES
118 /* Check for problems with the catch list and specbind stack */ 253 #define structure_checking_assert(assertion) assert (assertion)
119 #define ERROR_CHECK_CATCH 254 #else /* not ERROR_CHECK_STRUCTURES */
120 /* Check for insufficient use of call_trapping_problems(), particularly 255 #define structure_checking_assert(assertion) disabled_assert (assertion)
121 due to glyph-related changes causing eval or QUIT within redisplay */ 256 #endif /* ERROR_CHECK_STRUCTURES */
122 #define ERROR_CHECK_TRAPPING_PROBLEMS 257
123 #endif 258 #ifdef ERROR_CHECK_TEXT
259 #define text_checking_assert(assertion) assert (assertion)
260 #define text_checking_assert_at_line(assertion, file, line) \
261 assert_at_line (assertion, file, line)
262 #define inline_text_checking_assert(assertion) inline_assert (assertion)
263 #define INLINE_TEXT_CHECK_ARGS INLINE_ERROR_CHECK_ARGS
264 #define INLINE_TEXT_CHECK_CALL INLINE_ERROR_CHECK_CALL
265 #define text_checking_assert_with_message(assertion, msg) \
266 assert_with_message (assertion, msg)
267 #else /* not ERROR_CHECK_TEXT */
268 #define text_checking_assert(assertion) disabled_assert (assertion)
269 #define text_checking_assert_at_line(assertion, file, line) \
270 disabled_assert_at_line (assertion, file, line)
271 #define inline_text_checking_assert(assertion) \
272 disabled_inline_assert (assertion)
273 #define INLINE_TEXT_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS
274 #define INLINE_TEXT_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL
275 #define text_checking_assert_with_message(assertion, msg) \
276 disabled_assert_with_message (assertion, msg)
277 #endif /* ERROR_CHECK_TEXT */
124 278
125 #ifdef ERROR_CHECK_TYPES 279 #ifdef ERROR_CHECK_TYPES
126 #define type_checking_assert(assertion) assert (assertion) 280 #define type_checking_assert(assertion) assert (assertion)
127 #define type_checking_assert_at_line(assertion, file, line) \ 281 #define type_checking_assert_at_line(assertion, file, line) \
128 assert_at_line (assertion, file, line) 282 assert_at_line (assertion, file, line)
283 #define inline_type_checking_assert(assertion) inline_assert (assertion)
284 #define INLINE_TYPE_CHECK_ARGS INLINE_ERROR_CHECK_ARGS
285 #define INLINE_TYPE_CHECK_CALL INLINE_ERROR_CHECK_CALL
129 #define type_checking_assert_with_message(assertion, msg) \ 286 #define type_checking_assert_with_message(assertion, msg) \
130 assert_with_message (assertion, msg) 287 assert_with_message (assertion, msg)
131 #else 288 #else /* not ERROR_CHECK_TYPES */
132 #define type_checking_assert(assertion) 289 #define type_checking_assert(assertion) disabled_assert (assertion)
133 #define type_checking_assert_at_line(assertion, file, line) 290 #define type_checking_assert_at_line(assertion, file, line) \
134 #define type_checking_assert_with_message(assertion, msg) 291 disabled_assert_at_line (assertion, file, line)
135 #endif 292 #define inline_type_checking_assert(assertion) \
136 #ifdef ERROR_CHECK_GC 293 disabled_inline_assert (assertion)
137 #define gc_checking_assert(assertion) assert (assertion) 294 #define INLINE_TYPE_CHECK_ARGS DISABLED_INLINE_ERROR_CHECK_ARGS
138 #define gc_checking_assert_at_line(assertion, file, line) \ 295 #define INLINE_TYPE_CHECK_CALL DISABLED_INLINE_ERROR_CHECK_CALL
139 assert_at_line (assertion, file, line) 296 #define type_checking_assert_with_message(assertion, msg) \
140 #define gc_checking_assert_with_message(assertion, msg) \ 297 disabled_assert_with_message (assertion, msg)
141 assert_with_message (assertion, msg) 298 #endif /* ERROR_CHECK_TYPES */
142 #else 299
143 #define gc_checking_assert(assertion) 300 /* ------------------------- small categories ------------------------- */
144 #define gc_checking_assert_at_line(assertion, file, line) 301
145 #define gc_checking_assert_with_message(assertion, msg) 302 /* The large categories established by configure can be subdivided into
146 #endif 303 smaller subcategories, for problems in specific modules. You can't
147 #ifdef ERROR_CHECK_TEXT 304 control this using configure, but you can manually stick in a define as
148 #define text_checking_assert(assertion) assert (assertion) 305 necessary.
149 #define text_checking_assert_at_line(assertion, file, line) \ 306
150 assert_at_line (assertion, file, line) 307 The idea is to go ahead and create a new type of error-checking and
151 #define text_checking_assert_with_message(assertion, msg) \ 308 have it turned on if the larger category it is a part of is also
152 assert_with_message (assertion, msg) 309 turned on. For example, ERROR_CHECK_DYNARR is considered a subcategory
153 #else 310 of ERROR_CHECK_STRUCTURES.
154 #define text_checking_assert(assertion) 311
155 #define text_checking_assert_at_line(assertion, file, line) 312 We also define foo_checking_assert() macros for convenience, but
156 #define text_checking_assert_with_message(assertion, msg) 313 generally don't define the many variations of this macro as for the
157 #endif 314 major types above, because it produces too much clutter. If any of
315 these become needed, they can always be defined. */
316
317 #ifdef ERROR_CHECK_STRUCTURES
318 /* Check for problems with the catch list and specbind stack */
319 #define ERROR_CHECK_CATCH
320 /* Check for incoherent Dynarr structures, attempts to access Dynarr
321 positions out of range, reentrant use of Dynarrs through Dynarr locking,
322 etc. */
323 #define ERROR_CHECK_DYNARR
324 /* Check for insufficient use of call_trapping_problems(), particularly
325 due to glyph-related changes causing eval or QUIT within redisplay */
326 #define ERROR_CHECK_TRAPPING_PROBLEMS
327 #endif /* ERROR_CHECK_STRUCTURES */
328
329 #ifdef ERROR_CHECK_CATCH
330 #define catch_checking_assert(assertion) assert (assertion)
331 #else /* not ERROR_CHECK_CATCH */
332 #define catch_checking_assert(assertion) disabled_assert (assertion)
333 #endif /* ERROR_CHECK_CATCH */
334
335 #ifdef ERROR_CHECK_DYNARR
336 #define dynarr_checking_assert(assertion) assert (assertion)
337 #else /* not ERROR_CHECK_DYNARR */
338 #define dynarr_checking_assert(assertion) disabled_assert (assertion)
339 #endif /* ERROR_CHECK_DYNARR */
340
158 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS 341 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS
159 #define trapping_problems_checking_assert(assertion) assert (assertion) 342 #define trapping_problems_checking_assert(assertion) assert (assertion)
160 #define trapping_problems_checking_assert_at_line(assertion, file, line) \ 343 #else /* not ERROR_CHECK_TRAPPING_PROBLEMS */
161 assert_at_line (assertion, file, line) 344 #define trapping_problems_checking_assert(assertion) disabled_assert (assertion)
162 #define trapping_problems_checking_assert_with_message(assertion, msg) \ 345 #endif /* ERROR_CHECK_TRAPPING_PROBLEMS */
163 assert_with_message (assertion, msg)
164 #else
165 #define trapping_problems_checking_assert(assertion)
166 #define trapping_problems_checking_assert_at_line(assertion, file, line)
167 #define trapping_problems_checking_assert_with_message(assertion, msg)
168 #endif
169 346
170 /************************************************************************/ 347 /************************************************************************/
171 /** Definitions of basic types **/ 348 /** Definitions of basic types **/
172 /************************************************************************/ 349 /************************************************************************/
173 350
313 b) [Extbyte] pointer to text in some external format, which can be 490 b) [Extbyte] pointer to text in some external format, which can be
314 defined as all formats other than the internal one 491 defined as all formats other than the internal one
315 c) [Ascbyte] pure ASCII text 492 c) [Ascbyte] pure ASCII text
316 d) [Binbyte] binary data that is not meant to be interpreted as text 493 d) [Binbyte] binary data that is not meant to be interpreted as text
317 e) [Rawbyte] general data in memory, where we don't care about whether 494 e) [Rawbyte] general data in memory, where we don't care about whether
318 it's text or binary 495 it's text or binary; often used when computing memory-
496 based/byte-based offsets of pointers
319 f) [Boolbyte] a zero or a one 497 f) [Boolbyte] a zero or a one
320 g) [Bitbyte] a byte used for bit fields 498 g) [Bitbyte] a byte used for bit fields
321 h) [Chbyte] null-semantics `char *'; used when casting an argument to 499 h) [Chbyte] null-semantics `char *'; used when casting an argument to
322 an external API where the the other types may not be 500 an external API where the the other types may not be
323 appropriate 501 appropriate
1049 and line of the inline function, which is not very useful. */ 1227 and line of the inline function, which is not very useful. */
1050 1228
1051 /* Highly dubious kludge */ 1229 /* Highly dubious kludge */
1052 /* (thanks, Jamie, I feel better now -- ben) */ 1230 /* (thanks, Jamie, I feel better now -- ben) */
1053 MODULE_API void assert_failed (const Ascbyte *, int, const Ascbyte *); 1231 MODULE_API void assert_failed (const Ascbyte *, int, const Ascbyte *);
1054 #define ABORT() (assert_failed (__FILE__, __LINE__, "ABORT()")) 1232 #define ABORT() assert_failed (__FILE__, __LINE__, "ABORT()")
1233 #define abort_with_message(msg) assert_failed (__FILE__, __LINE__, msg)
1234
1235 /* This used to be ((void) (0)) but that triggers lots of unused variable
1236 warnings. It's pointless to force all that code to be rewritten, with
1237 added ifdefs. Any reasonable compiler will eliminate an expression with
1238 no effects. We keep this abstracted out like this in case we want to
1239 change it in the future. */
1240 #define disabled_assert(x) ((void) (x))
1241 #define disabled_assert_with_message(x, msg) ((void) msg, disabled_assert (x))
1242 #define disabled_assert_at_line(x, file, line) \
1243 ((void) file, (void) line, disabled_assert (x))
1055 1244
1056 #ifdef USE_ASSERTIONS 1245 #ifdef USE_ASSERTIONS
1057 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x)) 1246 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
1058 # define assert_with_message(x, msg) \ 1247 # define assert_with_message(x, msg) \
1059 ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, msg)) 1248 ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, msg))
1060 # define assert_at_line(x, file, line) \ 1249 # define assert_at_line(x, file, line) \
1061 ((x) ? (void) 0 : assert_failed (file, line, #x)) 1250 ((x) ? (void) 0 : assert_failed (file, line, #x))
1062 #elif defined (DEBUG_XEMACS)
1063 # define assert(x) ((x) ? (void) 0 : (void) ABORT ())
1064 # define assert_with_message(x, msg) assert (x)
1065 # define assert_at_line(x, file, line) assert (x)
1066 #else 1251 #else
1067 /* This used to be ((void) (0)) but that triggers lots of unused variable 1252 /* This used to be ((void) (0)) but that triggers lots of unused variable
1068 warnings. It's pointless to force all that code to be rewritten, with 1253 warnings. It's pointless to force all that code to be rewritten, with
1069 added ifdefs. Any reasonable compiler will eliminate an expression with 1254 added ifdefs. Any reasonable compiler will eliminate an expression with
1070 no effects. */ 1255 no effects. */
1071 # define assert(x) ((void) (x)) 1256 # define assert(x) disabled_assert (x)
1072 # define assert_with_message(x, msg) assert (x) 1257 # define assert_with_message(x, msg) disabled_assert_with_message (x, msg)
1073 # define assert_at_line(x, file, line) assert (x) 1258 # define assert_at_line(x, file, line) disabled_assert_at_line (x, file, line)
1074 #endif 1259 #endif
1075 1260
1076 /************************************************************************/ 1261 /************************************************************************/
1077 /** Memory allocation **/ 1262 /** Memory allocation **/
1078 /************************************************************************/ 1263 /************************************************************************/
1088 1273
1089 /* Basic free function */ 1274 /* Basic free function */
1090 1275
1091 MODULE_API void xfree_1 (void *); 1276 MODULE_API void xfree_1 (void *);
1092 #ifdef ERROR_CHECK_MALLOC 1277 #ifdef ERROR_CHECK_MALLOC
1093 /* This used to use a temporary variable, which both avoided the multiple 1278 /* This used to use a temporary variable. But that triggered
1094 evaluation and obviated the need for the TYPE argument. But that triggered
1095 complaints under strict aliasing. #### There should be a better way. */ 1279 complaints under strict aliasing. #### There should be a better way. */
1096 #define xfree(lvalue, type) do \ 1280 #define xfree(lvalue) do \
1097 { \ 1281 { \
1098 xfree_1 (lvalue); \ 1282 xfree_1 (lvalue); \
1099 VOIDP_CAST (lvalue) = (void *) DEADBEEF_CONSTANT; \ 1283 VOIDP_CAST (lvalue) = (void *) DEADBEEF_CONSTANT; \
1100 } while (0) 1284 } while (0)
1101 #else 1285 #else
1102 #define xfree(lvalue,type) xfree_1 (lvalue) 1286 #define xfree(lvalue) xfree_1 (lvalue)
1103 #endif /* ERROR_CHECK_MALLOC */ 1287 #endif /* ERROR_CHECK_MALLOC */
1104 1288
1105 /* ------------------------ stack allocation -------------------------- */ 1289 /* ------------------------ stack allocation -------------------------- */
1106 1290
1107 /* Allocating excessively large blocks on the stack can cause crashes. 1291 /* Allocating excessively large blocks on the stack can cause crashes.
1381 { 1565 {
1382 MUNGE_ME_FUNCTION_KEY, 1566 MUNGE_ME_FUNCTION_KEY,
1383 MUNGE_ME_KEY_TRANSLATION 1567 MUNGE_ME_KEY_TRANSLATION
1384 }; 1568 };
1385 1569
1570 /* The various stages of font instantiation; initial means "find a font for
1571 CHARSET that matches the charset's registries" and final means "find a
1572 font for CHARSET that matches iso10646-1, since we haven't found a font
1573 that matches its registry."
1574 */
1575 enum font_specifier_matchspec_stages
1576 {
1577 STAGE_INITIAL,
1578 STAGE_FINAL,
1579 NUM_MATCHSPEC_STAGES,
1580 };
1581
1386 /* ------------------------------- */ 1582 /* ------------------------------- */
1387 /* misc */ 1583 /* misc */
1388 /* ------------------------------- */ 1584 /* ------------------------------- */
1389 1585
1390 #ifdef MEMORY_USAGE_STATS 1586 #ifdef MEMORY_USAGE_STATS
1482 1678
1483 /* OK, you can open them again */ 1679 /* OK, you can open them again */
1484 1680
1485 END_C_DECLS 1681 END_C_DECLS
1486 1682
1683 #include "lrecord.h"
1684
1685 /* Turn any void * pointer into a Lisp object. This is the counterpart of
1686 STORE_LISP_IN_VOID, which works in the opposite direction. Note that
1687 you CANNOT use STORE_LISP_IN_VOID to undo the effects of STORE_VOID_IN_LISP!
1688 Instead, you GET_VOID_FROM_LISP:
1689
1690 STORE_VOID_IN_LISP <--> GET_VOID_FROM_LISP vs.
1691 STORE_LISP_IN_VOID <--> GET_LISP_FROM_VOID
1692
1693 STORE_VOID_IN_LISP has a restriction on the void * pointers it can
1694 handle -- the pointer must be an even address (lowest bit set to 0).
1695 Generally this is not a problem as nowadays virtually all allocation is
1696 at least 4-byte aligned, if not 8-byte.
1697
1698 However, if this proves problematic, you can use make_opaque_ptr(), which
1699 is guaranteed to handle any kind of void * pointer but which does
1700 Lisp allocation.
1701 */
1702
1703 DECLARE_INLINE_HEADER (
1704 Lisp_Object
1705 STORE_VOID_IN_LISP (void *ptr)
1706 )
1707 {
1708 EMACS_UINT p = (EMACS_UINT) ptr;
1709
1710 type_checking_assert ((p & 1) == 0);
1711 return make_int (p >> 1);
1712 }
1713
1714 DECLARE_INLINE_HEADER (
1715 void *
1716 GET_VOID_FROM_LISP (Lisp_Object obj)
1717 )
1718 {
1719 EMACS_UINT p = XUINT (obj);
1720 return (void *) (p << 1);
1721 }
1722
1487 /************************************************************************/ 1723 /************************************************************************/
1488 /** Definitions of basic Lisp objects **/ 1724 /** Definitions of dynamic arrays (Dynarrs) and other allocators **/
1489 /************************************************************************/ 1725 /************************************************************************/
1490 1726
1491 #include "lrecord.h"
1492
1493 BEGIN_C_DECLS 1727 BEGIN_C_DECLS
1494 1728
1495 /* ------------------------ dynamic arrays ------------------- */ 1729 /************* Dynarr declaration *************/
1496 1730
1497 #ifdef NEW_GC 1731 #ifdef NEW_GC
1498 #ifdef ERROR_CHECK_STRUCTURES 1732 #define DECLARE_DYNARR_LISP_IMP() \
1499 #define Dynarr_declare(type) \ 1733 const struct lrecord_implementation *lisp_imp;
1500 struct lrecord_header header; \
1501 type *base; \
1502 const struct lrecord_implementation *lisp_imp; \
1503 int locked; \
1504 int elsize; \
1505 int cur; \
1506 int largest; \
1507 int max
1508 #else 1734 #else
1509 #define Dynarr_declare(type) \ 1735 #define DECLARE_DYNARR_LISP_IMP()
1510 struct lrecord_header header; \ 1736 #endif
1511 type *base; \ 1737
1512 const struct lrecord_implementation *lisp_imp; \ 1738 #ifdef ERROR_CHECK_DYNARR
1513 int elsize; \ 1739 #define DECLARE_DYNARR_LOCKED() \
1514 int cur; \ 1740 int locked;
1515 int largest; \
1516 int max
1517 #endif /* ERROR_CHECK_STRUCTURES */
1518 #else /* not NEW_GC */
1519 #ifdef ERROR_CHECK_STRUCTURES
1520 #define Dynarr_declare(type) \
1521 struct lrecord_header header; \
1522 type *base; \
1523 int locked; \
1524 int elsize; \
1525 int cur; \
1526 int largest; \
1527 int max
1528 #else 1741 #else
1529 #define Dynarr_declare(type) \ 1742 #define DECLARE_DYNARR_LOCKED()
1530 struct lrecord_header header; \ 1743 #endif
1531 type *base; \ 1744
1532 int elsize; \ 1745 #define Dynarr_declare(type) \
1533 int cur; \ 1746 struct lrecord_header header; \
1534 int largest; \ 1747 type *base; \
1535 int max 1748 DECLARE_DYNARR_LISP_IMP () \
1536 #endif /* ERROR_CHECK_STRUCTURES */ 1749 DECLARE_DYNARR_LOCKED () \
1537 #endif /* not NEW_GC */ 1750 int elsize; \
1751 int len_; \
1752 int largest_; \
1753 int max_
1538 1754
1539 typedef struct dynarr 1755 typedef struct dynarr
1540 { 1756 {
1541 Dynarr_declare (void); 1757 Dynarr_declare (void);
1542 } Dynarr; 1758 } Dynarr;
1543 1759
1760 #define XD_DYNARR_DESC(base_type, sub_desc) \
1761 { XD_BLOCK_PTR, offsetof (base_type, base), \
1762 XD_INDIRECT(1, 0), {sub_desc} }, \
1763 { XD_INT, offsetof (base_type, len_) }, \
1764 { XD_INT_RESET, offsetof (base_type, largest_), XD_INDIRECT(1, 0) }, \
1765 { XD_INT_RESET, offsetof (base_type, max_), XD_INDIRECT(1, 0) }
1766
1767 #ifdef NEW_GC
1768 #define XD_LISP_DYNARR_DESC(base_type, sub_desc) \
1769 { XD_LISP_OBJECT_BLOCK_PTR, offsetof (base_type, base), \
1770 XD_INDIRECT(1, 0), {sub_desc} }, \
1771 { XD_INT, offsetof (base_type, len_) }, \
1772 { XD_INT_RESET, offsetof (base_type, largest_), XD_INDIRECT(1, 0) }, \
1773 { XD_INT_RESET, offsetof (base_type, max_), XD_INDIRECT(1, 0) }
1774 #endif /* NEW_GC */
1775
1776 /************* Dynarr verification *************/
1777
1778 #ifdef ERROR_CHECK_DYNARR
1779 DECLARE_INLINE_HEADER (
1780 int
1781 Dynarr_verify_pos_at (void *d, int pos, const Ascbyte *file, int line)
1782 )
1783 {
1784 Dynarr *dy = (Dynarr *) d;
1785 /* We use `largest', not `len', because the redisplay code often
1786 accesses stuff between len and largest. */
1787 assert_at_line (pos >= 0 && pos < dy->largest_, file, line);
1788 return pos;
1789 }
1790
1791 DECLARE_INLINE_HEADER (
1792 int
1793 Dynarr_verify_pos_atp (void *d, int pos, const Ascbyte *file, int line)
1794 )
1795 {
1796 Dynarr *dy = (Dynarr *) d;
1797 /* We use `largest', not `len', because the redisplay code often
1798 accesses stuff between len and largest. */
1799 /* [[ Code will often do something like ...
1800
1801 val = make_bit_vector_from_byte_vector (Dynarr_atp (dyn, 0),
1802 Dynarr_length (dyn));
1803
1804 which works fine when the Dynarr_length is non-zero, but when zero,
1805 the result of Dynarr_atp() not only points past the end of the
1806 allocated array, but the array may not have ever been allocated and
1807 hence the return value is NULL. But the length of 0 causes the
1808 pointer to never get checked. These can occur throughout the code
1809 so we put in a special check. --ben ]]
1810
1811 Update: The common idiom `Dynarr_atp (dyn, 0)' has been changed to
1812 `Dynarr_begin (dyn)'. Possibly this special check at POS 0 can be
1813 done only for Dynarr_begin() not for general Dynarr_atp(). --ben */
1814 if (pos == 0 && dy->len_ == 0)
1815 return pos;
1816 /* #### It's vaguely possible that some code could legitimately want to
1817 retrieve a pointer to the position just past the end of dynarr memory.
1818 This could happen with Dynarr_atp() but not Dynarr_at(). If so, it
1819 will trigger this assert(). In such cases, it should be obvious that
1820 the code wants to do this; rather than relaxing the assert, we should
1821 probably create a new macro Dynarr_atp_allow_end() which is like
1822 Dynarr_atp() but which allows for pointing at invalid addresses -- we
1823 really want to check for cases of accessing just past the end of
1824 memory, which is a likely off-by-one problem to occur and will usually
1825 not trigger a protection fault (instead, you'll just get random
1826 behavior, possibly overwriting other memory, which is bad). --ben */
1827 assert_at_line (pos >= 0 && pos < dy->largest_, file, line);
1828 return pos;
1829 }
1830
1831 DECLARE_INLINE_HEADER (
1832 int
1833 Dynarr_verify_pos_atp_allow_end (void *d, int pos, const Ascbyte *file,
1834 int line)
1835 )
1836 {
1837 Dynarr *dy = (Dynarr *) d;
1838 /* We use `largest', not `len', because the redisplay code often
1839 accesses stuff between len and largest.
1840 We also allow referencing the very end, past the end of allocated
1841 legitimately space. See comments in Dynarr_verify_pos_atp.()*/
1842 assert_at_line (pos >= 0 && pos <= dy->largest_, file, line);
1843 return pos;
1844 }
1845
1846 #else
1847 #define Dynarr_verify_pos_at(d, pos, file, line) (pos)
1848 #define Dynarr_verify_pos_atp(d, pos, file, line) (pos)
1849 #define Dynarr_verify_pos_atp_allow_end(d, pos, file, line) (pos)
1850 #endif /* ERROR_CHECK_DYNARR */
1851
1852 #ifdef ERROR_CHECK_DYNARR
1853 DECLARE_INLINE_HEADER (
1854 Dynarr *
1855 Dynarr_verify_1 (void *d, const Ascbyte *file, int line)
1856 )
1857 {
1858 Dynarr *dy = (Dynarr *) d;
1859 assert_at_line (dy->len_ >= 0 && dy->len_ <= dy->largest_ &&
1860 dy->largest_ <= dy->max_, file, line);
1861 return dy;
1862 }
1863
1864 DECLARE_INLINE_HEADER (
1865 Dynarr *
1866 Dynarr_verify_mod_1 (void *d, const Ascbyte *file, int line)
1867 )
1868 {
1869 Dynarr *dy = (Dynarr *) d;
1870 assert_at_line (!dy->locked, file, line);
1871 return Dynarr_verify_1 (d, file, line);
1872 }
1873
1874 #define Dynarr_verify(d) Dynarr_verify_1 (d, __FILE__, __LINE__)
1875 #define Dynarr_verify_mod(d) Dynarr_verify_mod_1 (d, __FILE__, __LINE__)
1876 #define Dynarr_lock(d) \
1877 do { \
1878 Dynarr *dy = Dynarr_verify_mod (d); \
1879 dy->locked = 1; \
1880 } while (0)
1881 #define Dynarr_unlock(d) \
1882 do { \
1883 Dynarr *dy = Dynarr_verify (d); \
1884 dy->locked = 0; \
1885 } while (0)
1886 #else
1887 #define Dynarr_verify(d) ((Dynarr *) d)
1888 #define Dynarr_verify_mod(d) ((Dynarr *) d)
1889 #define Dynarr_lock(d) DO_NOTHING
1890 #define Dynarr_unlock(d) DO_NOTHING
1891 #endif /* ERROR_CHECK_DYNARR */
1892
1893 /************* Dynarr creation *************/
1894
1544 MODULE_API void *Dynarr_newf (Bytecount elsize); 1895 MODULE_API void *Dynarr_newf (Bytecount elsize);
1545 MODULE_API void Dynarr_resize (void *dy, Elemcount size);
1546 MODULE_API void Dynarr_insert_many (void *d, const void *el, int len, int start);
1547 MODULE_API void Dynarr_delete_many (void *d, int start, int len);
1548 MODULE_API void Dynarr_free (void *d); 1896 MODULE_API void Dynarr_free (void *d);
1549 1897
1550 #ifdef NEW_GC 1898 #ifdef NEW_GC
1551 MODULE_API void *Dynarr_lisp_newf (Bytecount elsize, 1899 MODULE_API void *Dynarr_lisp_newf (Bytecount elsize,
1552 const struct lrecord_implementation 1900 const struct lrecord_implementation
1559 ((dynarr_type *) Dynarr_lisp_newf (sizeof (type)), dynarr_imp, imp) 1907 ((dynarr_type *) Dynarr_lisp_newf (sizeof (type)), dynarr_imp, imp)
1560 #endif /* NEW_GC */ 1908 #endif /* NEW_GC */
1561 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type))) 1909 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type)))
1562 #define Dynarr_new2(dynarr_type, type) \ 1910 #define Dynarr_new2(dynarr_type, type) \
1563 ((dynarr_type *) Dynarr_newf (sizeof (type))) 1911 ((dynarr_type *) Dynarr_newf (sizeof (type)))
1912
1913 /************* Dynarr access *************/
1914
1915 #ifdef ERROR_CHECK_DYNARR
1916 #define Dynarr_at(d, pos) \
1917 ((d)->base[Dynarr_verify_pos_at (d, pos, __FILE__, __LINE__)])
1918 #define Dynarr_atp_allow_end(d, pos) \
1919 (&((d)->base[Dynarr_verify_pos_atp_allow_end (d, pos, __FILE__, __LINE__)]))
1920 #define Dynarr_atp(d, pos) \
1921 (&((d)->base[Dynarr_verify_pos_atp (d, pos, __FILE__, __LINE__)]))
1922 #else
1564 #define Dynarr_at(d, pos) ((d)->base[pos]) 1923 #define Dynarr_at(d, pos) ((d)->base[pos])
1565 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) 1924 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos))
1925 #define Dynarr_atp_allow_end(d, pos) Dynarr_atp (d, pos)
1926 #endif
1927
1928 /* Old #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) */
1566 #define Dynarr_begin(d) Dynarr_atp (d, 0) 1929 #define Dynarr_begin(d) Dynarr_atp (d, 0)
1567 #define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d) - 1) 1930 #define Dynarr_lastp(d) Dynarr_atp (d, Dynarr_length (d) - 1)
1568 #define Dynarr_sizeof(d) ((d)->cur * (d)->elsize) 1931 #define Dynarr_past_lastp(d) Dynarr_atp_allow_end (d, Dynarr_length (d))
1569 1932
1570 #ifdef ERROR_CHECK_STRUCTURES 1933
1571 DECLARE_INLINE_HEADER ( 1934 /************* Dynarr length/size retrieval and setting *************/
1572 Dynarr * 1935
1573 Dynarr_verify_1 (void *d, const Ascbyte *file, int line) 1936 /* Retrieve the length of a Dynarr. The `+ 0' is to ensure that this cannot
1574 ) 1937 be used as an lvalue. */
1575 { 1938 #define Dynarr_length(d) (Dynarr_verify (d)->len_ + 0)
1576 Dynarr *dy = (Dynarr *) d; 1939 /* Retrieve the largest ever length seen of a Dynarr. The `+ 0' is to
1577 assert_at_line (dy->cur >= 0 && dy->cur <= dy->largest && 1940 ensure that this cannot be used as an lvalue. */
1578 dy->largest <= dy->max, file, line); 1941 #define Dynarr_largest(d) (Dynarr_verify (d)->largest_ + 0)
1579 return dy; 1942 /* Retrieve the number of elements that fit in the currently allocated
1580 } 1943 space. The `+ 0' is to ensure that this cannot be used as an lvalue. */
1581 1944 #define Dynarr_max(d) (Dynarr_verify (d)->max_ + 0)
1582 DECLARE_INLINE_HEADER ( 1945 /* Retrieve the advertised memory usage of a Dynarr, i.e. the number of
1583 Dynarr * 1946 bytes occupied by the elements in the Dynarr, not counting any overhead. */
1584 Dynarr_verify_mod_1 (void *d, const Ascbyte *file, int line) 1947 #define Dynarr_sizeof(d) (Dynarr_length (d) * (d)->elsize)
1585 ) 1948 /* Actually set the length of a Dynarr. This is a low-level routine that
1586 { 1949 should not be directly used; use Dynarr_set_length() instead if you need
1587 Dynarr *dy = (Dynarr *) d; 1950 to, but be very careful when doing so! */
1588 assert_at_line (!dy->locked, file, line); 1951 #define Dynarr_set_length_1(d, n) \
1589 assert_at_line (dy->cur >= 0 && dy->cur <= dy->largest && 1952 do { \
1590 dy->largest <= dy->max, file, line); 1953 Elemcount _dsl1_n = (n); \
1591 return dy; 1954 dynarr_checking_assert (_dsl1_n >= 0 && _dsl1_n <= Dynarr_max (d)); \
1592 } 1955 (void) Dynarr_verify_mod (d); \
1593 1956 (d)->len_ = _dsl1_n; \
1594 #define Dynarr_verify(d) Dynarr_verify_1 (d, __FILE__, __LINE__) 1957 /* Use the raw field references here otherwise we get a crash because \
1595 #define Dynarr_verify_mod(d) Dynarr_verify_mod_1 (d, __FILE__, __LINE__) 1958 we've set the length but not yet fixed up the largest value. */ \
1596 #define Dynarr_lock(d) (Dynarr_verify_mod (d)->locked = 1) 1959 if ((d)->len_ > (d)->largest_) \
1597 #define Dynarr_unlock(d) ((d)->locked = 0) 1960 (d)->largest_ = (d)->len_; \
1598 #else 1961 (void) Dynarr_verify_mod (d); \
1599 #define Dynarr_verify(d) (d) 1962 } while (0)
1600 #define Dynarr_verify_mod(d) (d) 1963
1601 #define Dynarr_lock(d) 1964 /* The following two defines will get you into real trouble if you aren't
1602 #define Dynarr_unlock(d) 1965 careful. But they can save a lot of execution time when used wisely. */
1603 #endif /* ERROR_CHECK_STRUCTURES */ 1966 #define Dynarr_set_length(d, n) \
1604 1967 do { \
1605 #define Dynarr_length(d) (Dynarr_verify (d)->cur) 1968 Elemcount _dsl_n = (n); \
1606 #define Dynarr_largest(d) (Dynarr_verify (d)->largest) 1969 dynarr_checking_assert (_dsl_n >= 0 && _dsl_n <= Dynarr_largest (d)); \
1607 #define Dynarr_reset(d) (Dynarr_verify_mod (d)->cur = 0) 1970 Dynarr_set_length_1 (d, _dsl_n); \
1608 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur) 1971 } while (0)
1972 #define Dynarr_increment(d) \
1973 Dynarr_set_length (d, Dynarr_length (d) + 1)
1974
1975 /* Reset the Dynarr's length to 0. */
1976 #define Dynarr_reset(d) Dynarr_set_length (d, 0)
1977
1978 MODULE_API void Dynarr_resize (void *dy, Elemcount size);
1979
1980 #define Dynarr_resize_if(d, numels) \
1981 do { \
1982 Elemcount _dri_numels = (numels); \
1983 if (Dynarr_length (d) + _dri_numels > Dynarr_max (d)) \
1984 Dynarr_resize (d, Dynarr_length (d) + _dri_numels); \
1985 } while (0)
1986
1987 #ifdef MEMORY_USAGE_STATS
1988 struct overhead_stats;
1989 Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats);
1990 #endif
1991
1992 /************* Adding/deleting elements to/from a Dynarr *************/
1993
1994 #ifdef NEW_GC
1995 #define Dynarr_add(d, el) \
1996 do { \
1997 const struct lrecord_implementation *imp = (d)->lisp_imp; \
1998 (void) Dynarr_verify_mod (d); \
1999 Dynarr_resize_if (d, 1); \
2000 ((d)->base)[Dynarr_length (d)] = (el); \
2001 if (imp) \
2002 set_lheader_implementation \
2003 ((struct lrecord_header *)&(((d)->base)[Dynarr_length (d)]), imp); \
2004 Dynarr_set_length_1 (d, Dynarr_length (d) + 1); \
2005 (void) Dynarr_verify_mod (d); \
2006 } while (0)
2007 #else /* not NEW_GC */
2008 #define Dynarr_add(d, el) \
2009 do { \
2010 (void) Dynarr_verify_mod (d); \
2011 Dynarr_resize_if (d, 1); \
2012 ((d)->base)[Dynarr_length (d)] = (el); \
2013 Dynarr_set_length_1 (d, Dynarr_length (d) + 1); \
2014 (void) Dynarr_verify_mod (d); \
2015 } while (0)
2016 #endif /* not NEW_GC */
2017
2018
2019 MODULE_API void Dynarr_insert_many (void *d, const void *el, int len,
2020 int start);
2021 MODULE_API void Dynarr_delete_many (void *d, int start, int len);
2022
1609 #define Dynarr_insert_many_at_start(d, el, len) \ 2023 #define Dynarr_insert_many_at_start(d, el, len) \
1610 Dynarr_insert_many (d, el, len, 0) 2024 Dynarr_insert_many (d, el, len, 0)
1611 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1) 2025 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1)
1612 #define Dynarr_add_lisp_string(d, s, codesys) \ 2026 #define Dynarr_add_lisp_string(d, s, codesys) \
1613 do { \ 2027 do { \
1619 LISP_STRING_TO_SIZED_EXTERNAL (dyna_ls_s, dyna_ls_eb, \ 2033 LISP_STRING_TO_SIZED_EXTERNAL (dyna_ls_s, dyna_ls_eb, \
1620 dyna_ls_bc, dyna_ls_cs); \ 2034 dyna_ls_bc, dyna_ls_cs); \
1621 Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \ 2035 Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \
1622 } while (0) 2036 } while (0)
1623 2037
1624 #ifdef NEW_GC 2038 /* Add LEN contiguous elements to a Dynarr */
1625 #define Dynarr_add(d, el) \ 2039
1626 do { \ 2040 DECLARE_INLINE_HEADER (
1627 const struct lrecord_implementation *imp = (d)->lisp_imp; \ 2041 void
1628 if (Dynarr_verify_mod (d)->cur >= (d)->max) \ 2042 Dynarr_add_many (void *d, const void *el, int len)
1629 Dynarr_resize ((d), (d)->cur+1); \ 2043 )
1630 ((d)->base)[(d)->cur] = (el); \ 2044 {
1631 \ 2045 /* This duplicates Dynarr_insert_many to some extent; but since it is
1632 if (imp) \ 2046 called so often, it seemed useful to remove the unnecessary stuff
1633 set_lheader_implementation \ 2047 from that function and to make it inline */
1634 ((struct lrecord_header *)&(((d)->base)[(d)->cur]), imp); \ 2048 Dynarr *dy = Dynarr_verify_mod (d);
1635 \ 2049 Dynarr_resize_if (dy, len);
1636 (d)->cur++; \ 2050 /* Some functions call us with a value of 0 to mean "reserve space but
1637 if ((d)->cur > (d)->largest) \ 2051 don't write into it" */
1638 (d)->largest = (d)->cur; \ 2052 if (el)
1639 } while (0) 2053 memcpy ((char *) dy->base + Dynarr_sizeof (dy), el, len*dy->elsize);
1640 #else /* not NEW_GC */ 2054 Dynarr_set_length_1 (dy, Dynarr_length (dy) + len);
1641 #define Dynarr_add(d, el) ( \ 2055 (void) Dynarr_verify_mod (dy);
1642 Dynarr_verify_mod (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : \ 2056 }
1643 (void) 0, \
1644 ((d)->base)[(d)->cur++] = (el), \
1645 (d)->cur > (d)->largest ? (d)->largest = (d)->cur : (int) 0)
1646 #endif /* not NEW_GC */
1647
1648
1649 /* The following defines will get you into real trouble if you aren't
1650 careful. But they can save a lot of execution time when used wisely. */
1651 #define Dynarr_increment(d) (Dynarr_verify_mod (d)->cur++)
1652 #define Dynarr_set_size(d, n) (Dynarr_verify_mod (d)->cur = n)
1653 2057
1654 #define Dynarr_pop(d) \ 2058 #define Dynarr_pop(d) \
1655 (assert ((d)->cur > 0), Dynarr_verify_mod (d)->cur--, \ 2059 (dynarr_checking_assert (Dynarr_length (d) > 0), \
1656 Dynarr_at (d, (d)->cur)) 2060 Dynarr_verify_mod (d)->len_--, \
2061 Dynarr_at (d, Dynarr_length (d)))
1657 #define Dynarr_delete(d, i) Dynarr_delete_many (d, i, 1) 2062 #define Dynarr_delete(d, i) Dynarr_delete_many (d, i, 1)
1658 #define Dynarr_delete_by_pointer(d, p) \ 2063 #define Dynarr_delete_by_pointer(d, p) \
1659 Dynarr_delete_many (d, (p) - ((d)->base), 1) 2064 Dynarr_delete_many (d, (p) - ((d)->base), 1)
1660 2065
1661 #define Dynarr_delete_object(d, el) \ 2066 #define Dynarr_delete_object(d, el) \
1667 if (el == Dynarr_at (d, i)) \ 2072 if (el == Dynarr_at (d, i)) \
1668 Dynarr_delete_many (d, i, 1); \ 2073 Dynarr_delete_many (d, i, 1); \
1669 } \ 2074 } \
1670 } while (0) 2075 } while (0)
1671 2076
1672 #ifdef MEMORY_USAGE_STATS 2077 /************* Dynarr typedefs *************/
1673 struct overhead_stats;
1674 Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats);
1675 #endif
1676
1677 void *stack_like_malloc (Bytecount size);
1678 void stack_like_free (void *val);
1679
1680 /* ------------------------------- */
1681 /* Dynarr typedefs */
1682 /* ------------------------------- */
1683 2078
1684 /* Dynarr typedefs -- basic types first */ 2079 /* Dynarr typedefs -- basic types first */
1685 2080
1686 typedef struct 2081 typedef struct
1687 { 2082 {
1717 typedef unsigned long unsigned_long; 2112 typedef unsigned long unsigned_long;
1718 typedef struct 2113 typedef struct
1719 { 2114 {
1720 Dynarr_declare (unsigned long); 2115 Dynarr_declare (unsigned long);
1721 } unsigned_long_dynarr; 2116 } unsigned_long_dynarr;
2117
2118 typedef const Ascbyte *const_Ascbyte_ptr;
2119 typedef struct
2120 {
2121 Dynarr_declare (const Ascbyte *);
2122 } const_Ascbyte_ptr_dynarr;
2123
2124 extern const struct sized_memory_description const_Ascbyte_ptr_description;
2125 extern const struct sized_memory_description const_Ascbyte_ptr_dynarr_description;
1722 2126
1723 typedef struct 2127 typedef struct
1724 { 2128 {
1725 Dynarr_declare (int); 2129 Dynarr_declare (int);
1726 } int_dynarr; 2130 } int_dynarr;
1792 2196
1793 typedef struct 2197 typedef struct
1794 { 2198 {
1795 Dynarr_declare (Lisp_Object *); 2199 Dynarr_declare (Lisp_Object *);
1796 } Lisp_Object_ptr_dynarr; 2200 } Lisp_Object_ptr_dynarr;
2201
2202
2203 /************* Stack-like malloc/free: Another allocator *************/
2204
2205 void *stack_like_malloc (Bytecount size);
2206 void stack_like_free (void *val);
2207
2208
2209 /************************************************************************/
2210 /** Definitions of other basic Lisp objects **/
2211 /************************************************************************/
1797 2212
1798 /*------------------------------ unbound -------------------------------*/ 2213 /*------------------------------ unbound -------------------------------*/
1799 2214
1800 /* Qunbound is a special Lisp_Object (actually of type 2215 /* Qunbound is a special Lisp_Object (actually of type
1801 symbol-value-forward), that can never be visible to 2216 symbol-value-forward), that can never be visible to
2640 #define DECLARE_INLINE_LISP_BIT_VECTOR(numbits) struct { \ 3055 #define DECLARE_INLINE_LISP_BIT_VECTOR(numbits) struct { \
2641 LISP_OBJECT_HEADER lheader; \ 3056 LISP_OBJECT_HEADER lheader; \
2642 Elemcount size; \ 3057 Elemcount size; \
2643 unsigned long bits[BIT_VECTOR_LONG_STORAGE(numbits)]; \ 3058 unsigned long bits[BIT_VECTOR_LONG_STORAGE(numbits)]; \
2644 } 3059 }
3060 /*---------------------- array, sequence -----------------------------*/
3061
3062 #define ARRAYP(x) (VECTORP (x) || STRINGP (x) || BIT_VECTORP (x))
3063
3064 #define CHECK_ARRAY(x) do { \
3065 if (!ARRAYP (x)) \
3066 dead_wrong_type_argument (Qarrayp, x); \
3067 } while (0)
3068
3069 #define CONCHECK_ARRAY(x) do { \
3070 if (!ARRAYP (x)) \
3071 x = wrong_type_argument (Qarrayp, x); \
3072 } while (0)
3073
3074 #define SEQUENCEP(x) (LISTP (x) || ARRAYP (x))
3075
3076 #define CHECK_SEQUENCE(x) do { \
3077 if (!SEQUENCEP (x)) \
3078 dead_wrong_type_argument (Qsequencep, x); \
3079 } while (0)
3080
3081 #define CONCHECK_SEQUENCE(x) do { \
3082 if (!SEQUENCEP (x)) \
3083 x = wrong_type_argument (Qsequencep, x); \
3084 } while (0)
2645 3085
2646 /*------------------------------ symbol --------------------------------*/ 3086 /*------------------------------ symbol --------------------------------*/
2647 3087
2648 typedef struct Lisp_Symbol Lisp_Symbol; 3088 typedef struct Lisp_Symbol Lisp_Symbol;
2649 struct Lisp_Symbol 3089 struct Lisp_Symbol
3479 #define HASH6(a,b,c,d,e,f) (GOOD_HASH * HASH5 (a,b,c,d,e) + (f)) 3919 #define HASH6(a,b,c,d,e,f) (GOOD_HASH * HASH5 (a,b,c,d,e) + (f))
3480 #define HASH7(a,b,c,d,e,f,g) (GOOD_HASH * HASH6 (a,b,c,d,e,f) + (g)) 3920 #define HASH7(a,b,c,d,e,f,g) (GOOD_HASH * HASH6 (a,b,c,d,e,f) + (g))
3481 #define HASH8(a,b,c,d,e,f,g,h) (GOOD_HASH * HASH7 (a,b,c,d,e,f,g) + (h)) 3921 #define HASH8(a,b,c,d,e,f,g,h) (GOOD_HASH * HASH7 (a,b,c,d,e,f,g) + (h))
3482 #define HASH9(a,b,c,d,e,f,g,h,i) (GOOD_HASH * HASH8 (a,b,c,d,e,f,g,h) + (i)) 3922 #define HASH9(a,b,c,d,e,f,g,h,i) (GOOD_HASH * HASH8 (a,b,c,d,e,f,g,h) + (i))
3483 3923
3484 #define LISP_HASH(obj) ((unsigned long) LISP_TO_VOID (obj)) 3924 #define LISP_HASH(obj) ((unsigned long) STORE_LISP_IN_VOID (obj))
3485 Hashcode memory_hash (const void *xv, Bytecount size); 3925 Hashcode memory_hash (const void *xv, Bytecount size);
3486 Hashcode internal_hash (Lisp_Object obj, int depth); 3926 Hashcode internal_hash (Lisp_Object obj, int depth);
3487 Hashcode internal_array_hash (Lisp_Object *arr, int size, int depth); 3927 Hashcode internal_array_hash (Lisp_Object *arr, int size, int depth);
3488 3928
3489 3929
3508 Fformat() should format the untranslated args[0] and return that, 3948 Fformat() should format the untranslated args[0] and return that,
3509 and also call Fgettext() on args[0] and, if that is different, 3949 and also call Fgettext() on args[0] and, if that is different,
3510 format it and store it in the `string-translatable' property of the 3950 format it and store it in the `string-translatable' property of the
3511 returned string. See Fgettext(). 3951 returned string. See Fgettext().
3512 3952
3513 CGETTEXT() is the same as GETTEXT() but works with char * strings 3953 The variations IGETTEXT, CIGETTEXT and ASCGETTEXT operate on
3514 instead of Ibyte * strings. 3954 Ibyte *, CIbyte *, and Ascbyte * strings, respectively. The
3515 3955 ASCGETTEXT version has an assert check to verify that its string
3516 build_msg_string() is a shorthand for build_string (GETTEXT (x)). 3956 really is pure-ASCII. Plain GETTEXT is defined as ASCGETTEXT, and
3517 build_msg_intstring() is a shorthand for build_intstring (GETTEXT (x)). 3957 so works the same way. (There are no versions that work for Extbyte *.
3958 Translate to internal format before working on it.)
3959
3960 There are similar functions for building a Lisp string from a C
3961 string and translating in the process. They again come in three
3962 variants: build_msg_istring(), build_msg_cistring(), and
3963 build_msg_ascstring(). Again, build_msg_ascstring() asserts that
3964 its text is pure-ASCII, and build_msg_string() is the same as
3965 build_msg_ascstring().
3518 */ 3966 */
3519 3967
3520 #define GETTEXT(x) (x) 3968 /* Return value NOT Ascbyte, because the result in general will have been
3521 #define CGETTEXT(x) (x) 3969 translated into a foreign language. */
3522 #define LISP_GETTEXT(x) (x) 3970 DECLARE_INLINE_HEADER (const CIbyte *ASCGETTEXT (const Ascbyte *s))
3523 3971 {
3524 /* DEFER_GETTEXT is used to identify strings which are translated when 3972 ASSERT_ASCTEXT_ASCII (s);
3525 they are referenced instead of when they are defined. 3973 return s;
3526 These include Qerror_messages and initialized arrays of strings. 3974 }
3975
3976 DECLARE_INLINE_HEADER (const Ibyte *IGETTEXT (const Ibyte *s))
3977 {
3978 return s;
3979 }
3980
3981 DECLARE_INLINE_HEADER (const CIbyte *CIGETTEXT (const CIbyte *s))
3982 {
3983 return s;
3984 }
3985
3986 DECLARE_INLINE_HEADER (Lisp_Object LISP_GETTEXT (Lisp_Object s))
3987 {
3988 return s;
3989 }
3990
3991 #define GETTEXT ASCGETTEXT
3992
3993 MODULE_API Lisp_Object build_msg_istring (const Ibyte *);
3994 MODULE_API Lisp_Object build_msg_cistring (const CIbyte *);
3995 MODULE_API Lisp_Object build_msg_ascstring (const Ascbyte *);
3996 #define build_msg_string build_msg_ascstring
3997
3998
3999 /* DEFER_GETTEXT() and variants are used to identify strings which are not
4000 meant to be translated immediately, but instead at some later time.
4001 This is used in strings that are stored somewhere at dump or
4002 initialization time, at a time when the current language environment is
4003 not set. It is the duty of the user of the string to call GETTEXT or
4004 some variant at the appropriate time. DEFER_GETTTEXT() serves only as a
4005 marker that the string is translatable, and will as a result be snarfed
4006 during message snarfing (see above).
4007
4008 build_defer_string() and variants are the deferred equivalents of
4009 build_msg_string() and variants. Similarly to DEFER_GETTEXT(), they
4010 don't actually do any translation, but serve as place markers for
4011 message snarfing. However, they may do something more than just build
4012 a Lisp string -- in particular, they may store a string property
4013 indicating that the string is translatable (see discussion above about
4014 this property).
3527 */ 4015 */
3528 #define DEFER_GETTEXT(x) (x) 4016
4017 DECLARE_INLINE_HEADER (const Ascbyte *DEFER_ASCGETTEXT (const Ascbyte *s))
4018 {
4019 ASSERT_ASCTEXT_ASCII (s);
4020 return s;
4021 }
4022
4023 DECLARE_INLINE_HEADER (const Ibyte *DEFER_IGETTEXT (const Ibyte *s))
4024 {
4025 return s;
4026 }
4027
4028 DECLARE_INLINE_HEADER (const CIbyte *DEFER_CIGETTEXT (const CIbyte *s))
4029 {
4030 return s;
4031 }
4032
4033 #define DEFER_GETTEXT DEFER_ASCGETTEXT
4034
4035 MODULE_API Lisp_Object build_defer_istring (const Ibyte *);
4036 MODULE_API Lisp_Object build_defer_cistring (const CIbyte *);
4037 MODULE_API Lisp_Object build_defer_ascstring (const Ascbyte *);
4038
4039 #define build_defer_string build_defer_ascstring
4040
4041
4042 void write_msg_istring (Lisp_Object stream, const Ibyte *str);
4043 void write_msg_cistring (Lisp_Object stream, const CIbyte *str);
4044 void write_msg_ascstring (Lisp_Object stream, const Ascbyte *str);
4045
4046 #define write_msg_string write_msg_ascstring
3529 4047
3530 4048
3531 /************************************************************************/ 4049 /************************************************************************/
3532 /* Garbage collection / GC-protection */ 4050 /* Garbage collection / GC-protection */
3533 /************************************************************************/ 4051 /************************************************************************/
3815 extern Lisp_Object_ptr_dynarr *staticpros_nodump; 4333 extern Lisp_Object_ptr_dynarr *staticpros_nodump;
3816 #ifdef DEBUG_XEMACS 4334 #ifdef DEBUG_XEMACS
3817 4335
3818 /* Help debug crashes gc-marking a staticpro'ed object. */ 4336 /* Help debug crashes gc-marking a staticpro'ed object. */
3819 4337
3820 MODULE_API void staticpro_1 (Lisp_Object *, Ascbyte *); 4338 MODULE_API void staticpro_1 (Lisp_Object *, const Ascbyte *);
3821 MODULE_API void staticpro_nodump_1 (Lisp_Object *, Ascbyte *); 4339 MODULE_API void staticpro_nodump_1 (Lisp_Object *, const Ascbyte *);
3822 /* g++ 4.3 complains about the conversion of const char to char. 4340 #define staticpro(ptr) staticpro_1 (ptr, #ptr)
3823 These end up in a dynarray, so we would need to define a whole new class 4341 #define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, #ptr)
3824 of dynarray just to handle the const char stuff.
3825 ####Check to see how hard this might be. */
3826 #define staticpro(ptr) staticpro_1 (ptr, (Ascbyte *) #ptr)
3827 #define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, (Ascbyte *) #ptr)
3828 4342
3829 #ifdef HAVE_SHLIB 4343 #ifdef HAVE_SHLIB
3830 MODULE_API void unstaticpro_nodump_1 (Lisp_Object *, Ascbyte *); 4344 MODULE_API void unstaticpro_nodump_1 (Lisp_Object *, const Ascbyte *);
3831 #define unstaticpro_nodump(ptr) unstaticpro_nodump_1 (ptr, (Ascbyte *) #ptr) 4345 #define unstaticpro_nodump(ptr) unstaticpro_nodump_1 (ptr, #ptr)
3832 #endif 4346 #endif
3833 4347
3834 #else 4348 #else
3835 4349
3836 /* Call staticpro (&var) to protect static variable `var'. */ 4350 /* Call staticpro (&var) to protect static variable `var'. */
3837 MODULE_API void staticpro (Lisp_Object *); 4351 MODULE_API void staticpro (Lisp_Object *);
4352 /* staticpro_1 (varptr, name) is used when we're not directly calling
4353 staticpro() on the address of a Lisp variable, but on a pointer we
4354 got from elsewhere. In that case, NAME is a string describing the
4355 actual variable in question. NAME is used only for debugging purposes,
4356 and hence when not DEBUG_XEMACS, staticpro_1() just calls staticpro().
4357 With DEBUG_XEMACS, however, it's the reverse -- staticpro() calls
4358 staticpro_1(), using the ANSI "stringize" operator to construct a string
4359 out of the variable name. */
4360 #define staticpro_1(ptr, name) staticpro (ptr)
3838 4361
3839 /* Call staticpro_nodump (&var) to protect static variable `var'. */ 4362 /* Call staticpro_nodump (&var) to protect static variable `var'. */
3840 /* var will not be saved at dump time */ 4363 /* var will not be saved at dump time */
3841 MODULE_API void staticpro_nodump (Lisp_Object *); 4364 MODULE_API void staticpro_nodump (Lisp_Object *);
4365 #define staticpro_nodump_1(ptr, name) staticpro_nodump (ptr)
3842 4366
3843 #ifdef HAVE_SHLIB 4367 #ifdef HAVE_SHLIB
3844 /* Call unstaticpro_nodump (&var) to stop protecting static variable `var'. */ 4368 /* Call unstaticpro_nodump (&var) to stop protecting static variable `var'. */
3845 MODULE_API void unstaticpro_nodump (Lisp_Object *); 4369 MODULE_API void unstaticpro_nodump (Lisp_Object *);
3846 #endif 4370 #endif
3849 4373
3850 #ifdef NEW_GC 4374 #ifdef NEW_GC
3851 extern Lisp_Object_dynarr *mcpros; 4375 extern Lisp_Object_dynarr *mcpros;
3852 #ifdef DEBUG_XEMACS 4376 #ifdef DEBUG_XEMACS
3853 /* Help debug crashes gc-marking a mcpro'ed object. */ 4377 /* Help debug crashes gc-marking a mcpro'ed object. */
3854 MODULE_API void mcpro_1 (Lisp_Object, char *); 4378 MODULE_API void mcpro_1 (Lisp_Object, const Ascbyte *);
3855 #define mcpro(ptr) mcpro_1 (ptr, #ptr) 4379 #define mcpro(ptr) mcpro_1 (ptr, #ptr)
3856 #else /* not DEBUG_XEMACS */ 4380 #else /* not DEBUG_XEMACS */
3857 /* Call mcpro (&var) to protect mc variable `var'. */ 4381 /* Call mcpro (&var) to protect mc variable `var'. */
3858 MODULE_API void mcpro (Lisp_Object); 4382 MODULE_API void mcpro (Lisp_Object);
3859 #endif /* not DEBUG_XEMACS */ 4383 #endif /* not DEBUG_XEMACS */
3872 /************************************************************************/ 4396 /************************************************************************/
3873 4397
3874 /************************************************************************/ 4398 /************************************************************************/
3875 /* Other numeric types */ 4399 /* Other numeric types */
3876 /************************************************************************/ 4400 /************************************************************************/
3877 #ifdef WITH_NUMBER_TYPES
3878 #include "number.h" 4401 #include "number.h"
3879 #else
3880 #define make_integer(x) make_int(x)
3881 #endif
3882 4402
3883 4403
3884 /************************************************************************/ 4404 /************************************************************************/
3885 /* prototypes */ 4405 /* prototypes */
3886 /************************************************************************/ 4406 /************************************************************************/
3906 MODULE_API EXFUN (Fexpand_abbrev, 0); 4426 MODULE_API EXFUN (Fexpand_abbrev, 0);
3907 4427
3908 /* Defined in alloc.c */ 4428 /* Defined in alloc.c */
3909 MODULE_API EXFUN (Fcons, 2); 4429 MODULE_API EXFUN (Fcons, 2);
3910 MODULE_API EXFUN (Flist, MANY); 4430 MODULE_API EXFUN (Flist, MANY);
4431 EXFUN (Fbit_vector, MANY);
3911 EXFUN (Fmake_byte_code, MANY); 4432 EXFUN (Fmake_byte_code, MANY);
3912 MODULE_API EXFUN (Fmake_list, 2); 4433 MODULE_API EXFUN (Fmake_list, 2);
3913 MODULE_API EXFUN (Fmake_string, 2); 4434 MODULE_API EXFUN (Fmake_string, 2);
4435 EXFUN (Fstring, MANY);
3914 MODULE_API EXFUN (Fmake_symbol, 1); 4436 MODULE_API EXFUN (Fmake_symbol, 1);
3915 MODULE_API EXFUN (Fmake_vector, 2); 4437 MODULE_API EXFUN (Fmake_vector, 2);
3916 MODULE_API EXFUN (Fvector, MANY); 4438 MODULE_API EXFUN (Fvector, MANY);
3917 4439
3918 #ifndef NEW_GC 4440 #ifndef NEW_GC
3947 extern EMACS_INT gc_generation_number[1]; 4469 extern EMACS_INT gc_generation_number[1];
3948 #endif /* not NEW_GC */ 4470 #endif /* not NEW_GC */
3949 int c_readonly (Lisp_Object); 4471 int c_readonly (Lisp_Object);
3950 int lisp_readonly (Lisp_Object); 4472 int lisp_readonly (Lisp_Object);
3951 MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src); 4473 MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src);
3952 MODULE_API Lisp_Object build_intstring (const Ibyte *); 4474 MODULE_API Lisp_Object build_istring (const Ibyte *);
3953 MODULE_API Lisp_Object build_string (const CIbyte *); 4475 MODULE_API Lisp_Object build_cistring (const CIbyte *);
3954 MODULE_API Lisp_Object build_ext_string (const Extbyte *, Lisp_Object); 4476 MODULE_API Lisp_Object build_ascstring (const Ascbyte *);
3955 MODULE_API Lisp_Object build_msg_intstring (const Ibyte *); 4477 MODULE_API Lisp_Object build_extstring (const Extbyte *, Lisp_Object);
3956 MODULE_API Lisp_Object build_msg_string (const CIbyte *);
3957 MODULE_API Lisp_Object make_string (const Ibyte *, Bytecount); 4478 MODULE_API Lisp_Object make_string (const Ibyte *, Bytecount);
3958 MODULE_API Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object); 4479 MODULE_API Lisp_Object make_extstring (const Extbyte *, EMACS_INT, Lisp_Object);
3959 void init_string_ascii_begin (Lisp_Object string); 4480 void init_string_ascii_begin (Lisp_Object string);
3960 Lisp_Object make_uninit_string (Bytecount); 4481 Lisp_Object make_uninit_string (Bytecount);
3961 MODULE_API Lisp_Object make_float (double); 4482 MODULE_API Lisp_Object make_float (double);
3962 Lisp_Object make_string_nocopy (const Ibyte *, Bytecount); 4483 Lisp_Object make_string_nocopy (const Ibyte *, Bytecount);
3963 void free_cons (Lisp_Object); 4484 void free_cons (Lisp_Object);
4061 4582
4062 /* Defined in bytecode.c */ 4583 /* Defined in bytecode.c */
4063 EXFUN (Fbyte_code, 3); 4584 EXFUN (Fbyte_code, 3);
4064 4585
4065 DECLARE_DOESNT_RETURN (invalid_byte_code 4586 DECLARE_DOESNT_RETURN (invalid_byte_code
4066 (const CIbyte *reason, Lisp_Object frob)); 4587 (const Ascbyte *reason, Lisp_Object frob));
4588
4589 extern Lisp_Object Qbyte_code, Qinvalid_byte_code;
4067 4590
4068 /* Defined in callint.c */ 4591 /* Defined in callint.c */
4069 EXFUN (Fcall_interactively, 3); 4592 EXFUN (Fcall_interactively, 3);
4070 EXFUN (Fprefix_numeric_value, 1); 4593 EXFUN (Fprefix_numeric_value, 1);
4071 4594
4072 /* Defined in casefiddle.c */ 4595 /* Defined in casefiddle.c */
4073 EXFUN (Fdowncase, 2); 4596 EXFUN (Fdowncase, 2);
4597 EXFUN (Fcanoncase, 2);
4074 EXFUN (Fupcase, 2); 4598 EXFUN (Fupcase, 2);
4075 EXFUN (Fupcase_initials, 2); 4599 EXFUN (Fupcase_initials, 2);
4076 EXFUN (Fupcase_initials_region, 3); 4600 EXFUN (Fupcase_initials_region, 3);
4077 EXFUN (Fupcase_region, 3); 4601 EXFUN (Fupcase_region, 3);
4078 4602
4141 /* Do NOT use word_to_lisp or wasteful_word_to_lisp to decode time_t's 4665 /* Do NOT use word_to_lisp or wasteful_word_to_lisp to decode time_t's
4142 unless you KNOW arg is non-negative. They cannot return negative 4666 unless you KNOW arg is non-negative. They cannot return negative
4143 values! Use make_time. */ 4667 values! Use make_time. */
4144 Lisp_Object word_to_lisp (unsigned int); 4668 Lisp_Object word_to_lisp (unsigned int);
4145 unsigned int lisp_to_word (Lisp_Object); 4669 unsigned int lisp_to_word (Lisp_Object);
4670
4671 extern Lisp_Object Qarrayp, Qbitp, Qchar_or_string_p, Qcharacterp,
4672 Qerror_conditions, Qerror_message, Qinteger_char_or_marker_p,
4673 Qinteger_or_char_p, Qinteger_or_marker_p, Qlambda, Qlistp, Qnatnump,
4674 Qnonnegativep, Qnumber_char_or_marker_p, Qnumberp, Qquote, Qtrue_list_p;
4675 extern MODULE_API Lisp_Object Qintegerp;
4676
4677 extern Lisp_Object Qarith_error, Qbeginning_of_buffer, Qbuffer_read_only,
4678 Qcircular_list, Qcircular_property_list, Qconversion_error,
4679 Qcyclic_variable_indirection, Qdomain_error, Qediting_error,
4680 Qend_of_buffer, Qend_of_file, Qerror, Qfile_error, Qinternal_error,
4681 Qinvalid_change, Qinvalid_constant, Qinvalid_function, Qinvalid_operation,
4682 Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlist_formation_error,
4683 Qmalformed_list, Qmalformed_property_list, Qno_catch, Qout_of_memory,
4684 Qoverflow_error, Qprinting_unreadable_object, Qquit, Qrange_error,
4685 Qsetting_constant, Qsingularity_error, Qstack_overflow,
4686 Qstructure_formation_error, Qtext_conversion_error, Qunderflow_error,
4687 Qvoid_function, Qvoid_variable, Qwrong_number_of_arguments,
4688 Qwrong_type_argument;
4689 extern MODULE_API Lisp_Object Qinvalid_argument, Qsyntax_error;
4146 4690
4147 /* Defined in dired.c */ 4691 /* Defined in dired.c */
4148 Lisp_Object make_directory_hash_table (const Ibyte *); 4692 Lisp_Object make_directory_hash_table (const Ibyte *);
4149 Lisp_Object wasteful_word_to_lisp (unsigned int); 4693 Lisp_Object wasteful_word_to_lisp (unsigned int);
4150 4694
4249 extern int inhibit_non_essential_conversion_operations; 4793 extern int inhibit_non_essential_conversion_operations;
4250 extern int preparing_for_armageddon; 4794 extern int preparing_for_armageddon;
4251 extern Fixnum emacs_priority; 4795 extern Fixnum emacs_priority;
4252 extern int suppress_early_error_handler_backtrace; 4796 extern int suppress_early_error_handler_backtrace;
4253 void debug_break (void); 4797 void debug_break (void);
4254 int debug_can_access_memory (void *ptr, Bytecount len); 4798 int debug_can_access_memory (const void *ptr, Bytecount len);
4255 DECLARE_DOESNT_RETURN (really_abort (void)); 4799 DECLARE_DOESNT_RETURN (really_abort (void));
4256 void zero_out_command_line_status_vars (void); 4800 void zero_out_command_line_status_vars (void);
4257 4801
4258 /* Defined in emodules.c */ 4802 /* Defined in emodules.c */
4259 #ifdef HAVE_SHLIB 4803 #ifdef HAVE_SHLIB
4297 Lisp_Object maybe_signal_continuable_ferror (Lisp_Object, Lisp_Object, 4841 Lisp_Object maybe_signal_continuable_ferror (Lisp_Object, Lisp_Object,
4298 Error_Behavior, 4842 Error_Behavior,
4299 const CIbyte *, ...) 4843 const CIbyte *, ...)
4300 PRINTF_ARGS (4, 5); 4844 PRINTF_ARGS (4, 5);
4301 4845
4302 Lisp_Object build_error_data (const CIbyte *reason, Lisp_Object frob); 4846 Lisp_Object build_error_data (const Ascbyte *reason, Lisp_Object frob);
4303 DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, const CIbyte *, 4847 DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, const Ascbyte *,
4304 Lisp_Object)); 4848 Lisp_Object));
4305 void maybe_signal_error (Lisp_Object, const CIbyte *, Lisp_Object, 4849 void maybe_signal_error (Lisp_Object, const Ascbyte *, Lisp_Object,
4306 Lisp_Object, Error_Behavior); 4850 Lisp_Object, Error_Behavior);
4307 Lisp_Object signal_continuable_error (Lisp_Object, const CIbyte *, 4851 Lisp_Object signal_continuable_error (Lisp_Object, const Ascbyte *,
4308 Lisp_Object); 4852 Lisp_Object);
4309 Lisp_Object maybe_signal_continuable_error (Lisp_Object, const CIbyte *, 4853 Lisp_Object maybe_signal_continuable_error (Lisp_Object, const Ascbyte *,
4310 Lisp_Object, 4854 Lisp_Object,
4311 Lisp_Object, Error_Behavior); 4855 Lisp_Object, Error_Behavior);
4312 DECLARE_DOESNT_RETURN (signal_ferror_with_frob (Lisp_Object, Lisp_Object, 4856 DECLARE_DOESNT_RETURN (signal_ferror_with_frob (Lisp_Object, Lisp_Object,
4313 const CIbyte *, ...)) 4857 const Ascbyte *, ...))
4314 PRINTF_ARGS(3, 4); 4858 PRINTF_ARGS(3, 4);
4315 void maybe_signal_ferror_with_frob (Lisp_Object, Lisp_Object, Lisp_Object, 4859 void maybe_signal_ferror_with_frob (Lisp_Object, Lisp_Object, Lisp_Object,
4316 Error_Behavior, 4860 Error_Behavior,
4317 const CIbyte *, ...) PRINTF_ARGS (5, 6); 4861 const Ascbyte *, ...) PRINTF_ARGS (5, 6);
4318 Lisp_Object signal_continuable_ferror_with_frob (Lisp_Object, Lisp_Object, 4862 Lisp_Object signal_continuable_ferror_with_frob (Lisp_Object, Lisp_Object,
4319 const CIbyte *, 4863 const Ascbyte *,
4320 ...) PRINTF_ARGS (3, 4); 4864 ...) PRINTF_ARGS (3, 4);
4321 Lisp_Object maybe_signal_continuable_ferror_with_frob (Lisp_Object, 4865 Lisp_Object maybe_signal_continuable_ferror_with_frob (Lisp_Object,
4322 Lisp_Object, 4866 Lisp_Object,
4323 Lisp_Object, 4867 Lisp_Object,
4324 Error_Behavior, 4868 Error_Behavior,
4325 const CIbyte *, ...) 4869 const Ascbyte *, ...)
4326 PRINTF_ARGS (5, 6); 4870 PRINTF_ARGS (5, 6);
4327 DECLARE_DOESNT_RETURN (signal_error_2 (Lisp_Object, const CIbyte *, 4871 DECLARE_DOESNT_RETURN (signal_error_2 (Lisp_Object, const Ascbyte *,
4328 Lisp_Object, Lisp_Object)); 4872 Lisp_Object, Lisp_Object));
4329 void maybe_signal_error_2 (Lisp_Object, const CIbyte *, Lisp_Object, 4873 void maybe_signal_error_2 (Lisp_Object, const Ascbyte *, Lisp_Object,
4330 Lisp_Object, Lisp_Object, Error_Behavior); 4874 Lisp_Object, Lisp_Object, Error_Behavior);
4331 Lisp_Object signal_continuable_error_2 (Lisp_Object, const CIbyte *, 4875 Lisp_Object signal_continuable_error_2 (Lisp_Object, const Ascbyte *,
4332 Lisp_Object, Lisp_Object); 4876 Lisp_Object, Lisp_Object);
4333 Lisp_Object maybe_signal_continuable_error_2 (Lisp_Object, const CIbyte *, 4877 Lisp_Object maybe_signal_continuable_error_2 (Lisp_Object, const Ascbyte *,
4334 Lisp_Object, Lisp_Object, 4878 Lisp_Object, Lisp_Object,
4335 Lisp_Object, 4879 Lisp_Object,
4336 Error_Behavior); 4880 Error_Behavior);
4337 4881
4338 4882
4341 (Lisp_Object)); 4885 (Lisp_Object));
4342 MODULE_API DECLARE_DOESNT_RETURN (signal_circular_list_error (Lisp_Object)); 4886 MODULE_API DECLARE_DOESNT_RETURN (signal_circular_list_error (Lisp_Object));
4343 MODULE_API DECLARE_DOESNT_RETURN (signal_circular_property_list_error 4887 MODULE_API DECLARE_DOESNT_RETURN (signal_circular_property_list_error
4344 (Lisp_Object)); 4888 (Lisp_Object));
4345 4889
4346 DECLARE_DOESNT_RETURN (syntax_error (const CIbyte *reason, 4890 DECLARE_DOESNT_RETURN (syntax_error (const Ascbyte *reason,
4347 Lisp_Object frob)); 4891 Lisp_Object frob));
4348 DECLARE_DOESNT_RETURN (syntax_error_2 (const CIbyte *reason, 4892 DECLARE_DOESNT_RETURN (syntax_error_2 (const Ascbyte *reason,
4349 Lisp_Object frob1, 4893 Lisp_Object frob1,
4350 Lisp_Object frob2)); 4894 Lisp_Object frob2));
4351 void maybe_syntax_error (const CIbyte *, Lisp_Object, Lisp_Object, 4895 void maybe_syntax_error (const Ascbyte *, Lisp_Object, Lisp_Object,
4352 Error_Behavior); 4896 Error_Behavior);
4353 DECLARE_DOESNT_RETURN (sferror (const CIbyte *reason, Lisp_Object frob)); 4897 DECLARE_DOESNT_RETURN (sferror (const Ascbyte *reason, Lisp_Object frob));
4354 DECLARE_DOESNT_RETURN (sferror_2 (const CIbyte *reason, Lisp_Object frob1, 4898 DECLARE_DOESNT_RETURN (sferror_2 (const Ascbyte *reason, Lisp_Object frob1,
4355 Lisp_Object frob2)); 4899 Lisp_Object frob2));
4356 void maybe_sferror (const CIbyte *, Lisp_Object, Lisp_Object, 4900 void maybe_sferror (const Ascbyte *, Lisp_Object, Lisp_Object,
4357 Error_Behavior); 4901 Error_Behavior);
4358 MODULE_API DECLARE_DOESNT_RETURN (invalid_argument (const CIbyte *reason, 4902 MODULE_API DECLARE_DOESNT_RETURN (invalid_argument (const Ascbyte *reason,
4359 Lisp_Object frob)); 4903 Lisp_Object frob));
4360 MODULE_API DECLARE_DOESNT_RETURN (invalid_argument_2 (const CIbyte *reason, 4904 MODULE_API DECLARE_DOESNT_RETURN (invalid_argument_2 (const Ascbyte *reason,
4361 Lisp_Object frob1, 4905 Lisp_Object frob1,
4362 Lisp_Object frob2)); 4906 Lisp_Object frob2));
4363 void maybe_invalid_argument (const CIbyte *, Lisp_Object, Lisp_Object, 4907 void maybe_invalid_argument (const Ascbyte *, Lisp_Object, Lisp_Object,
4364 Error_Behavior); 4908 Error_Behavior);
4365 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation (const CIbyte *reason, 4909 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation (const Ascbyte *reason,
4366 Lisp_Object frob)); 4910 Lisp_Object frob));
4367 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation_2 (const CIbyte *reason, 4911 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation_2 (const Ascbyte *reason,
4368 Lisp_Object frob1, 4912 Lisp_Object frob1,
4369 Lisp_Object frob2)); 4913 Lisp_Object frob2));
4370 MODULE_API void maybe_invalid_operation (const CIbyte *, Lisp_Object, 4914 MODULE_API void maybe_invalid_operation (const Ascbyte *, Lisp_Object,
4371 Lisp_Object, Error_Behavior); 4915 Lisp_Object, Error_Behavior);
4372 DECLARE_DOESNT_RETURN (invalid_state (const CIbyte *reason, 4916 DECLARE_DOESNT_RETURN (invalid_state (const Ascbyte *reason,
4373 Lisp_Object frob)); 4917 Lisp_Object frob));
4374 DECLARE_DOESNT_RETURN (invalid_state_2 (const CIbyte *reason, 4918 DECLARE_DOESNT_RETURN (invalid_state_2 (const Ascbyte *reason,
4375 Lisp_Object frob1, 4919 Lisp_Object frob1,
4376 Lisp_Object frob2)); 4920 Lisp_Object frob2));
4377 void maybe_invalid_state (const CIbyte *, Lisp_Object, Lisp_Object, 4921 void maybe_invalid_state (const Ascbyte *, Lisp_Object, Lisp_Object,
4378 Error_Behavior); 4922 Error_Behavior);
4379 DECLARE_DOESNT_RETURN (invalid_change (const CIbyte *reason, 4923 DECLARE_DOESNT_RETURN (invalid_change (const Ascbyte *reason,
4380 Lisp_Object frob)); 4924 Lisp_Object frob));
4381 DECLARE_DOESNT_RETURN (invalid_change_2 (const CIbyte *reason, 4925 DECLARE_DOESNT_RETURN (invalid_change_2 (const Ascbyte *reason,
4382 Lisp_Object frob1, 4926 Lisp_Object frob1,
4383 Lisp_Object frob2)); 4927 Lisp_Object frob2));
4384 void maybe_invalid_change (const CIbyte *, Lisp_Object, Lisp_Object, 4928 void maybe_invalid_change (const Ascbyte *, Lisp_Object, Lisp_Object,
4385 Error_Behavior); 4929 Error_Behavior);
4386 MODULE_API DECLARE_DOESNT_RETURN (invalid_constant (const CIbyte *reason, 4930 MODULE_API DECLARE_DOESNT_RETURN (invalid_constant (const Ascbyte *reason,
4387 Lisp_Object frob)); 4931 Lisp_Object frob));
4388 DECLARE_DOESNT_RETURN (invalid_constant_2 (const CIbyte *reason, 4932 DECLARE_DOESNT_RETURN (invalid_constant_2 (const Ascbyte *reason,
4389 Lisp_Object frob1, 4933 Lisp_Object frob1,
4390 Lisp_Object frob2)); 4934 Lisp_Object frob2));
4391 void maybe_invalid_constant (const CIbyte *, Lisp_Object, Lisp_Object, 4935 void maybe_invalid_constant (const Ascbyte *, Lisp_Object, Lisp_Object,
4392 Error_Behavior); 4936 Error_Behavior);
4393 DECLARE_DOESNT_RETURN (wtaerror (const CIbyte *reason, Lisp_Object frob)); 4937 DECLARE_DOESNT_RETURN (wtaerror (const Ascbyte *reason, Lisp_Object frob));
4394 MODULE_API DECLARE_DOESNT_RETURN (out_of_memory (const CIbyte *reason, 4938 MODULE_API DECLARE_DOESNT_RETURN (out_of_memory (const Ascbyte *reason,
4395 Lisp_Object frob)); 4939 Lisp_Object frob));
4396 DECLARE_DOESNT_RETURN (stack_overflow (const CIbyte *reason, 4940 DECLARE_DOESNT_RETURN (stack_overflow (const Ascbyte *reason,
4397 Lisp_Object frob)); 4941 Lisp_Object frob));
4398 MODULE_API DECLARE_DOESNT_RETURN (printing_unreadable_object (const CIbyte *,
4399 ...))
4400 PRINTF_ARGS (1, 2);
4401 4942
4402 Lisp_Object signal_void_function_error (Lisp_Object); 4943 Lisp_Object signal_void_function_error (Lisp_Object);
4403 Lisp_Object signal_invalid_function_error (Lisp_Object); 4944 Lisp_Object signal_invalid_function_error (Lisp_Object);
4404 Lisp_Object signal_wrong_number_of_arguments_error (Lisp_Object, int); 4945 Lisp_Object signal_wrong_number_of_arguments_error (Lisp_Object, int);
4405 4946
4568 int internal_bind_int (int *addr, int newval); 5109 int internal_bind_int (int *addr, int newval);
4569 int internal_bind_lisp_object (Lisp_Object *addr, Lisp_Object newval); 5110 int internal_bind_lisp_object (Lisp_Object *addr, Lisp_Object newval);
4570 void do_autoload (Lisp_Object, Lisp_Object); /* GCPROs both arguments */ 5111 void do_autoload (Lisp_Object, Lisp_Object); /* GCPROs both arguments */
4571 Lisp_Object un_autoload (Lisp_Object); 5112 Lisp_Object un_autoload (Lisp_Object);
4572 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object); 5113 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);
4573 MODULE_API void warn_when_safe (Lisp_Object, Lisp_Object, const CIbyte *, 5114 MODULE_API void warn_when_safe (Lisp_Object, Lisp_Object, const Ascbyte *,
4574 ...) PRINTF_ARGS (3, 4); 5115 ...) PRINTF_ARGS (3, 4);
4575 extern int backtrace_with_internal_sections; 5116 extern int backtrace_with_internal_sections;
4576 5117
5118 extern Lisp_Object Vdebug_on_error;
4577 extern Lisp_Object Vstack_trace_on_error; 5119 extern Lisp_Object Vstack_trace_on_error;
4578 5120
4579 /* Defined in event-stream.c */ 5121 /* Defined in event-stream.c */
4580 EXFUN (Faccept_process_output, 3); 5122 EXFUN (Faccept_process_output, 3);
4581 EXFUN (Fadd_timeout, 4); 5123 EXFUN (Fadd_timeout, 4);
4686 EXFUN (Fverify_visited_file_modtime, 1); 5228 EXFUN (Fverify_visited_file_modtime, 1);
4687 5229
4688 void record_auto_save (void); 5230 void record_auto_save (void);
4689 void force_auto_save_soon (void); 5231 void force_auto_save_soon (void);
4690 DECLARE_DOESNT_RETURN (report_error_with_errno (Lisp_Object errtype, 5232 DECLARE_DOESNT_RETURN (report_error_with_errno (Lisp_Object errtype,
4691 const CIbyte *string, 5233 const Ascbyte *reason,
4692 Lisp_Object data)); 5234 Lisp_Object data));
4693 DECLARE_DOESNT_RETURN (report_file_type_error (Lisp_Object errtype, 5235 DECLARE_DOESNT_RETURN (report_file_error (const Ascbyte *, Lisp_Object));
4694 Lisp_Object oserrmess,
4695 const CIbyte *string,
4696 Lisp_Object data));
4697 DECLARE_DOESNT_RETURN (report_file_error (const CIbyte *, Lisp_Object));
4698 Lisp_Object lisp_strerror (int); 5236 Lisp_Object lisp_strerror (int);
4699 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object); 5237 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
4700 int internal_delete_file (Lisp_Object); 5238 int internal_delete_file (Lisp_Object);
4701 Ibyte *find_end_of_directory_component (const Ibyte *path, 5239 Ibyte *find_end_of_directory_component (const Ibyte *path,
4702 Bytecount len); 5240 Bytecount len);
4730 EXFUN (Fdelq, 2); 5268 EXFUN (Fdelq, 2);
4731 EXFUN (Fdestructive_alist_to_plist, 1); 5269 EXFUN (Fdestructive_alist_to_plist, 1);
4732 EXFUN (Felt, 2); 5270 EXFUN (Felt, 2);
4733 MODULE_API EXFUN (Fequal, 2); 5271 MODULE_API EXFUN (Fequal, 2);
4734 MODULE_API EXFUN (Fget, 3); 5272 MODULE_API EXFUN (Fget, 3);
5273 MODULE_API EXFUN (Feqlsign, MANY);
5274 MODULE_API EXFUN (Fequalp, 2);
4735 EXFUN (Flast, 2); 5275 EXFUN (Flast, 2);
4736 EXFUN (Flax_plist_get, 3); 5276 EXFUN (Flax_plist_get, 3);
4737 EXFUN (Flax_plist_remprop, 2); 5277 EXFUN (Flax_plist_remprop, 2);
4738 MODULE_API EXFUN (Flength, 1); 5278 MODULE_API EXFUN (Flength, 1);
4739 EXFUN (Fmapcar, 2); 5279 EXFUN (FmapcarX, MANY);
4740 EXFUN (Fmember, 2); 5280 EXFUN (Fmember, 2);
4741 EXFUN (Fmemq, 2); 5281 EXFUN (Fmemq, 2);
4742 EXFUN (Fnconc, MANY); 5282 EXFUN (Fnconc, MANY);
4743 MODULE_API EXFUN (Fnreverse, 1); 5283 MODULE_API EXFUN (Fnreverse, 1);
4744 EXFUN (Fnthcdr, 2); 5284 EXFUN (Fnthcdr, 2);
4775 Lisp_Object delq_no_quit_and_free_cons (Lisp_Object, Lisp_Object); 5315 Lisp_Object delq_no_quit_and_free_cons (Lisp_Object, Lisp_Object);
4776 Lisp_Object remassoc_no_quit (Lisp_Object, Lisp_Object); 5316 Lisp_Object remassoc_no_quit (Lisp_Object, Lisp_Object);
4777 Lisp_Object remassq_no_quit (Lisp_Object, Lisp_Object); 5317 Lisp_Object remassq_no_quit (Lisp_Object, Lisp_Object);
4778 Lisp_Object remrassq_no_quit (Lisp_Object, Lisp_Object); 5318 Lisp_Object remrassq_no_quit (Lisp_Object, Lisp_Object);
4779 5319
4780 int plists_differ (Lisp_Object, Lisp_Object, int, int, int); 5320 int plists_differ (Lisp_Object, Lisp_Object, int, int, int, int);
4781 Lisp_Object internal_plist_get (Lisp_Object, Lisp_Object); 5321 Lisp_Object internal_plist_get (Lisp_Object, Lisp_Object);
4782 void internal_plist_put (Lisp_Object *, Lisp_Object, Lisp_Object); 5322 void internal_plist_put (Lisp_Object *, Lisp_Object, Lisp_Object);
4783 int internal_remprop (Lisp_Object *, Lisp_Object); 5323 int internal_remprop (Lisp_Object *, Lisp_Object);
4784 Lisp_Object external_plist_get (Lisp_Object *, Lisp_Object, 5324 Lisp_Object external_plist_get (Lisp_Object *, Lisp_Object,
4785 int, Error_Behavior); 5325 int, Error_Behavior);
4793 int retval, 5333 int retval,
4794 Lisp_Object obj1, Lisp_Object obj2, 5334 Lisp_Object obj1, Lisp_Object obj2,
4795 int depth); 5335 int depth);
4796 int internal_equal (Lisp_Object, Lisp_Object, int); 5336 int internal_equal (Lisp_Object, Lisp_Object, int);
4797 int internal_equalp (Lisp_Object obj1, Lisp_Object obj2, int depth); 5337 int internal_equalp (Lisp_Object obj1, Lisp_Object obj2, int depth);
4798 Lisp_Object concat2 (Lisp_Object, Lisp_Object); 5338 Lisp_Object MODULE_API concat2 (Lisp_Object, Lisp_Object);
4799 Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object); 5339 Lisp_Object MODULE_API concat3 (Lisp_Object, Lisp_Object, Lisp_Object);
4800 Lisp_Object vconcat2 (Lisp_Object, Lisp_Object); 5340 Lisp_Object MODULE_API vconcat2 (Lisp_Object, Lisp_Object);
4801 Lisp_Object vconcat3 (Lisp_Object, Lisp_Object, Lisp_Object); 5341 Lisp_Object MODULE_API vconcat3 (Lisp_Object, Lisp_Object, Lisp_Object);
4802 Lisp_Object nconc2 (Lisp_Object, Lisp_Object); 5342 Lisp_Object MODULE_API nconc2 (Lisp_Object, Lisp_Object);
5343 int internal_equal_0 (Lisp_Object, Lisp_Object, int, int);
4803 Lisp_Object bytecode_nconc2 (Lisp_Object *); 5344 Lisp_Object bytecode_nconc2 (Lisp_Object *);
4804 void check_losing_bytecode (const char *, Lisp_Object); 5345 int bytecode_arithcompare (Lisp_Object obj1, Lisp_Object obj2);
5346 void check_losing_bytecode (const Ascbyte *, Lisp_Object);
4805 5347
4806 Lisp_Object add_suffix_to_symbol (Lisp_Object symbol, 5348 Lisp_Object add_suffix_to_symbol (Lisp_Object symbol,
4807 const Ascbyte *ascii_string); 5349 const Ascbyte *ascii_string);
4808 Lisp_Object add_prefix_to_symbol (const Ascbyte *ascii_string, 5350 Lisp_Object add_prefix_to_symbol (const Ascbyte *ascii_string,
4809 Lisp_Object symbol); 5351 Lisp_Object symbol);
4956 void debug_short_backtrace (int); 5498 void debug_short_backtrace (int);
4957 void debug_backtrace (void); 5499 void debug_backtrace (void);
4958 /* NOTE: Do not call this with the data of a Lisp_String. Use princ. 5500 /* NOTE: Do not call this with the data of a Lisp_String. Use princ.
4959 * Note: stream should be defaulted before calling 5501 * Note: stream should be defaulted before calling
4960 * (eg Qnil means stdout, not Vstandard_output, etc) */ 5502 * (eg Qnil means stdout, not Vstandard_output, etc) */
4961 MODULE_API void write_c_string (Lisp_Object stream, const CIbyte *str); 5503 MODULE_API void write_istring (Lisp_Object stream, const Ibyte *str);
4962 /* Same goes for this function. */ 5504 /* Same goes for this function. */
4963 MODULE_API void write_string (Lisp_Object stream, const Ibyte *str); 5505 MODULE_API void write_cistring (Lisp_Object stream, const CIbyte *str);
5506 /* Same goes for this function. */
5507 MODULE_API void write_ascstring (Lisp_Object stream, const Ascbyte *str);
4964 /* Same goes for this function. */ 5508 /* Same goes for this function. */
4965 void write_string_1 (Lisp_Object stream, const Ibyte *str, Bytecount size); 5509 void write_string_1 (Lisp_Object stream, const Ibyte *str, Bytecount size);
4966 void write_eistring (Lisp_Object stream, const Eistring *ei); 5510 void write_eistring (Lisp_Object stream, const Eistring *ei);
4967 5511
4968 /* Higher-level (printf-style) ways to output data: */ 5512 /* Higher-level (printf-style) ways to output data: */
4997 (((2410824 * sizeof (integral_type)) / 1000000) + 3) 5541 (((2410824 * sizeof (integral_type)) / 1000000) + 3)
4998 void long_to_string (char *, long); 5542 void long_to_string (char *, long);
4999 void ulong_to_bit_string (char *, unsigned long); 5543 void ulong_to_bit_string (char *, unsigned long);
5000 extern int print_escape_newlines; 5544 extern int print_escape_newlines;
5001 extern MODULE_API int print_readably; 5545 extern MODULE_API int print_readably;
5546 extern int in_debug_print;
5002 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object, 5547 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object,
5003 Lisp_Object (*) (Lisp_Object), 5548 Lisp_Object (*) (Lisp_Object),
5004 Lisp_Object, Lisp_Object); 5549 Lisp_Object, Lisp_Object);
5005 void float_to_string (char *, double); 5550 void float_to_string (char *, double);
5006 void internal_object_printer (Lisp_Object obj, Lisp_Object printcharfun, 5551 void internal_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
5007 int UNUSED (escapeflag)); 5552 int UNUSED (escapeflag));
5008 void external_object_printer (Lisp_Object obj, Lisp_Object printcharfun, 5553 void external_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
5009 int UNUSED (escapeflag)); 5554 int UNUSED (escapeflag));
5555 MODULE_API DECLARE_DOESNT_RETURN (printing_unreadable_object (const CIbyte *,
5556 ...))
5557 PRINTF_ARGS (1, 2);
5558 DECLARE_DOESNT_RETURN (printing_unreadable_lcrecord (Lisp_Object obj,
5559 const Ibyte *name));
5010 5560
5011 /* Defined in rangetab.c */ 5561 /* Defined in rangetab.c */
5012 EXFUN (Fclear_range_table, 1); 5562 EXFUN (Fclear_range_table, 1);
5013 EXFUN (Fget_range_table, 3); 5563 EXFUN (Fget_range_table, 3);
5014 EXFUN (Fmake_range_table, 1); 5564 EXFUN (Fmake_range_table, 1);
5033 EXFUN (Fmatch_beginning, 1); 5583 EXFUN (Fmatch_beginning, 1);
5034 EXFUN (Fmatch_end, 1); 5584 EXFUN (Fmatch_end, 1);
5035 EXFUN (Fskip_chars_backward, 3); 5585 EXFUN (Fskip_chars_backward, 3);
5036 EXFUN (Fskip_chars_forward, 3); 5586 EXFUN (Fskip_chars_forward, 3);
5037 EXFUN (Fstring_match, 4); 5587 EXFUN (Fstring_match, 4);
5588 EXFUN (Fregexp_quote, 1);
5038 5589
5039 struct re_pattern_buffer; 5590 struct re_pattern_buffer;
5040 struct re_registers; 5591 struct re_registers;
5041 Charbpos scan_buffer (struct buffer *, Ichar, Charbpos, Charbpos, EMACS_INT, 5592 Charbpos scan_buffer (struct buffer *, Ichar, Charbpos, Charbpos, EMACS_INT,
5042 EMACS_INT *, int); 5593 EMACS_INT *, int);
5093 EXFUN (Fsymbol_name, 1); 5644 EXFUN (Fsymbol_name, 1);
5094 EXFUN (Fsymbol_plist, 1); 5645 EXFUN (Fsymbol_plist, 1);
5095 EXFUN (Fsymbol_value, 1); 5646 EXFUN (Fsymbol_value, 1);
5096 5647
5097 unsigned int hash_string (const Ibyte *, Bytecount); 5648 unsigned int hash_string (const Ibyte *, Bytecount);
5098 Lisp_Object intern_int (const Ibyte *str); 5649 Lisp_Object intern_istring (const Ibyte *str);
5099 MODULE_API Lisp_Object intern (const CIbyte *str); 5650 MODULE_API Lisp_Object intern (const CIbyte *str);
5100 Lisp_Object intern_converting_underscores_to_dashes (const CIbyte *str); 5651 Lisp_Object intern_converting_underscores_to_dashes (const CIbyte *str);
5101 Lisp_Object oblookup (Lisp_Object, const Ibyte *, Bytecount); 5652 Lisp_Object oblookup (Lisp_Object, const Ibyte *, Bytecount);
5102 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *); 5653 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *);
5103 Lisp_Object indirect_function (Lisp_Object, int); 5654 Lisp_Object indirect_function (Lisp_Object, int);
5244 extern Lisp_Object Vcharset_latin_iso8859_2; 5795 extern Lisp_Object Vcharset_latin_iso8859_2;
5245 extern Lisp_Object Vcharset_latin_iso8859_3; 5796 extern Lisp_Object Vcharset_latin_iso8859_3;
5246 extern Lisp_Object Vcharset_latin_iso8859_4; 5797 extern Lisp_Object Vcharset_latin_iso8859_4;
5247 extern Lisp_Object Vcharset_thai_tis620; 5798 extern Lisp_Object Vcharset_thai_tis620;
5248 extern Lisp_Object Vcharset_greek_iso8859_7; 5799 extern Lisp_Object Vcharset_greek_iso8859_7;
5800 extern Lisp_Object Vcharset_arabic_iso8859_6;
5249 extern Lisp_Object Vcharset_hebrew_iso8859_8; 5801 extern Lisp_Object Vcharset_hebrew_iso8859_8;
5250 extern Lisp_Object Vcharset_katakana_jisx0201; 5802 extern Lisp_Object Vcharset_katakana_jisx0201;
5251 extern Lisp_Object Vcharset_latin_jisx0201; 5803 extern Lisp_Object Vcharset_latin_jisx0201;
5252 extern Lisp_Object Vcharset_cyrillic_iso8859_5; 5804 extern Lisp_Object Vcharset_cyrillic_iso8859_5;
5253 extern Lisp_Object Vcharset_latin_iso8859_9; 5805 extern Lisp_Object Vcharset_latin_iso8859_9;
5456 6008
5457 int qxestrcasecmp (const Ibyte *s1, const Ibyte *s2); 6009 int qxestrcasecmp (const Ibyte *s1, const Ibyte *s2);
5458 int qxestrcasecmp_ascii (const Ibyte *s1, const Ascbyte *s2); 6010 int qxestrcasecmp_ascii (const Ibyte *s1, const Ascbyte *s2);
5459 int qxestrcasecmp_i18n (const Ibyte *s1, const Ibyte *s2); 6011 int qxestrcasecmp_i18n (const Ibyte *s1, const Ibyte *s2);
5460 int ascii_strcasecmp (const Ascbyte *s1, const Ascbyte *s2); 6012 int ascii_strcasecmp (const Ascbyte *s1, const Ascbyte *s2);
5461 int lisp_strcasecmp (Lisp_Object s1, Lisp_Object s2); 6013 int lisp_strcasecmp_ascii (Lisp_Object s1, Lisp_Object s2);
5462 int lisp_strcasecmp_i18n (Lisp_Object s1, Lisp_Object s2); 6014 int lisp_strcasecmp_i18n (Lisp_Object s1, Lisp_Object s2);
5463 int qxestrncasecmp (const Ibyte *s1, const Ibyte *s2, Bytecount len); 6015 int qxestrncasecmp (const Ibyte *s1, const Ibyte *s2, Bytecount len);
5464 int qxestrncasecmp_ascii (const Ibyte *s1, const Ascbyte *s2, 6016 int qxestrncasecmp_ascii (const Ibyte *s1, const Ascbyte *s2,
5465 Bytecount len); 6017 Bytecount len);
5466 int qxestrncasecmp_i18n (const Ibyte *s1, const Ibyte *s2, Bytecount len); 6018 int qxestrncasecmp_i18n (const Ibyte *s1, const Ibyte *s2, Bytecount len);
5601 ;; finally terminate the last line. 6153 ;; finally terminate the last line.
5602 (princ ";\n")))))) 6154 (princ ";\n"))))))
5603 6155
5604 */ 6156 */
5605 6157
5606 extern Lisp_Object Qactivate_menubar_hook, Qand_optional, Qand_rest; 6158 extern Lisp_Object Qactivate_menubar_hook, Qand_optional, Qand_rest, Qautoload,
5607 extern Lisp_Object Qarith_error, Qarrayp, Qautoload, Qbackground; 6159 Qbackground, Qbackground_pixmap, Qblinking, Qbuffer_glyph_p, Qbuffer_live_p,
5608 extern Lisp_Object Qbackground_pixmap, Qbeginning_of_buffer, Qbitp, Qblinking; 6160 Qcall_interactively, Qcategory_designator_p,
5609 extern Lisp_Object Qbuffer_glyph_p, Qbuffer_live_p, Qbuffer_read_only; 6161 Qcategory_table_value_p, Qcdr, Qcolor_pixmap_image_instance_p, Qcommandp,
5610 extern Lisp_Object Qbyte_code, Qcall_interactively, Qcategory_designator_p; 6162 Qcompletion_ignore_case, Qconsole_live_p, Qconst_specifier, Qcurrent_menubar,
5611 extern Lisp_Object Qcategory_table_value_p, Qcdr, Qchar_or_string_p; 6163 Qdefun, Qdevice_live_p, Qdim, Qdirection, Qdisabled, Qdisabled_command_hook,
5612 extern Lisp_Object Qcharacterp, Qcircular_list, Qcircular_property_list; 6164 Qdisplay_table, Qdll_error, Qend_open, Qerror_lacks_explanatory_string,
5613 extern Lisp_Object Qcolor_pixmap_image_instance_p, Qcommandp; 6165 Qevent_live_p, Qexit, Qextent_live_p, Qexternal_debugging_output, Qfeaturep,
5614 extern Lisp_Object Qcompletion_ignore_case, Qconsole_live_p, Qconst_specifier; 6166 Qfile_error, Qfile_name_sans_extension, Qfinal, Qforeground, Qformat,
5615 extern Lisp_Object Qconversion_error, Qcurrent_menubar; 6167 Qframe_live_p, Qgraphic, Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit,
5616 extern Lisp_Object Qcyclic_variable_indirection, Qdefun, Qdevice_live_p, Qdim; 6168 Qinhibit_read_only, Qinteractive, Qlayout, Qload, Qlong_name, Qmacro,
5617 extern Lisp_Object Qdirection, Qdisabled, Qdisabled_command_hook; 6169 Qmakunbound, Qmark, Qmodule, Qmono_pixmap_image_instance_p,
5618 extern Lisp_Object Qdisplay_table, Qdll_error, Qdomain_error, Qediting_error; 6170 Qmouse_leave_buffer_hook, Qnative_layout, Qnetwork_error,
5619 extern Lisp_Object Qend_of_buffer, Qend_of_file, Qend_open, Qerror; 6171 Qnothing_image_instance_p, Qpoint, Qpointer_glyph_p,
5620 extern Lisp_Object Qerror_conditions, Qerror_lacks_explanatory_string; 6172 Qpointer_image_instance_p, Qprint_length, Qprint_string_length, Qprogn,
5621 extern Lisp_Object Qerror_message, Qevent_live_p, Qexit, Qextent_live_p; 6173 Qread_char, Qread_from_minibuffer, Qreally_early_error_handler,
5622 extern Lisp_Object Qexternal_debugging_output, Qfeaturep, Qfile_error; 6174 Qregion_beginning, Qregion_end, Qregistries, Qreverse_direction_charset,
5623 extern Lisp_Object Qfile_name_sans_extension, Qfinal; 6175 Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs, Qself_insert_command,
5624 extern Lisp_Object Qforeground, Qformat, Qframe_live_p, Qgraphic; 6176 Qself_insert_defer_undo, Qsequencep, Qset, Qshort_name, Qsound_error,
5625 extern Lisp_Object Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit; 6177 Qstandard_input, Qstandard_output, Qstart_open, Qstring_lessp, Qsubwindow,
5626 extern Lisp_Object Qinhibit_read_only, Qinteger_char_or_marker_p; 6178 Qsubwindow_image_instance_p, Qtext_image_instance_p, Qtop_level, Qunderline,
5627 extern Lisp_Object Qinteger_or_char_p, Qinteger_or_marker_p; 6179 Quser_files_and_directories, Qvalues, Qvariable_documentation,
5628 extern Lisp_Object Qinteractive, Qinternal_error; 6180 Qvariable_domain, Qwindow_live_p, Qyes_or_no_p;
5629 extern Lisp_Object Qinvalid_byte_code, Qinvalid_change, Qinvalid_constant; 6181
5630 extern Lisp_Object Qinvalid_function, Qinvalid_operation; 6182 extern MODULE_API Lisp_Object Qprocess_error, Qt, Qunbound;
5631 extern Lisp_Object Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlambda;
5632 extern Lisp_Object Qlayout, Qlist_formation_error, Qlistp, Qload;
5633 extern Lisp_Object Qlong_name, Qmacro, Qmakunbound, Qmalformed_list;
5634 extern Lisp_Object Qmalformed_property_list, Qmark, Qmodule;
5635 extern Lisp_Object Qmono_pixmap_image_instance_p, Qmouse_leave_buffer_hook;
5636 extern Lisp_Object Qnative_layout, Qnatnump, Qnetwork_error, Qno_catch;
5637 extern Lisp_Object Qnonnegativep, Qnothing_image_instance_p;
5638 extern Lisp_Object Qnumber_char_or_marker_p, Qnumberp, Qout_of_memory;
5639 extern Lisp_Object Qoverflow_error, Qpoint, Qpointer_glyph_p;
5640 extern Lisp_Object Qpointer_image_instance_p, Qprint_length;
5641 extern Lisp_Object Qprint_string_length, Qprinting_unreadable_object;
5642 extern Lisp_Object Qprogn, Qquit, Qquote, Qrange_error;
5643 extern Lisp_Object Qread_char, Qread_from_minibuffer;
5644 extern Lisp_Object Qreally_early_error_handler, Qregion_beginning;
5645 extern Lisp_Object Qregion_end, Qregistries, Qreverse_direction_charset;
5646 extern Lisp_Object Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs;
5647 extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo, Qsequencep;
5648 extern Lisp_Object Qset, Qsetting_constant, Qshort_name, Qsingularity_error;
5649 extern Lisp_Object Qsound_error, Qstack_overflow, Qstandard_input;
5650 extern Lisp_Object Qstandard_output, Qstart_open, Qstring_lessp;
5651 extern Lisp_Object Qstructure_formation_error, Qsubwindow;
5652 extern Lisp_Object Qsubwindow_image_instance_p;
5653 extern Lisp_Object Qtext_conversion_error, Qtext_image_instance_p, Qtop_level;
5654 extern Lisp_Object Qtrue_list_p, Qunderflow_error, Qunderline;
5655 extern Lisp_Object Quser_files_and_directories, Qvalues;
5656 extern Lisp_Object Qvariable_documentation, Qvariable_domain, Qvoid_function;
5657 extern Lisp_Object Qvoid_variable, Qwindow_live_p, Qwrong_number_of_arguments;
5658 extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p;
5659
5660 extern MODULE_API Lisp_Object Qintegerp, Qinvalid_argument, Qprocess_error;
5661 extern MODULE_API Lisp_Object Qsyntax_error, Qt, Qunbound;
5662 6183
5663 #define SYMBOL(fou) extern Lisp_Object fou 6184 #define SYMBOL(fou) extern Lisp_Object fou
5664 #define SYMBOL_MODULE_API(fou) extern MODULE_API Lisp_Object fou 6185 #define SYMBOL_MODULE_API(fou) extern MODULE_API Lisp_Object fou
5665 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou 6186 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
5666 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \ 6187 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
5682 extern Lisp_Object Vautoload_queue, Vblank_menubar; 6203 extern Lisp_Object Vautoload_queue, Vblank_menubar;
5683 extern Lisp_Object Vcommand_history; 6204 extern Lisp_Object Vcommand_history;
5684 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory; 6205 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory;
5685 extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory; 6206 extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory;
5686 extern Lisp_Object Vconsole_list, Vcontrolling_terminal; 6207 extern Lisp_Object Vconsole_list, Vcontrolling_terminal;
5687 extern Lisp_Object Vcurrent_compiled_function_annotation, Vcurrent_load_list; 6208 extern Lisp_Object Vcurrent_load_list;
5688 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory; 6209 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory;
5689 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook; 6210 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook;
5690 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name; 6211 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name;
5691 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version; 6212 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version;
5692 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path; 6213 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path;