Mercurial > hg > xemacs-beta
comparison src/lisp.h @ 793:e38acbeb1cae
[xemacs-hg @ 2002-03-29 04:46:17 by ben]
lots o' fixes
etc/ChangeLog: New file.
Separated out all entries for etc/ into their own ChangeLog.
Includes entries for the following files:
etc/BABYL, etc/BETA, etc/CHARSETS, etc/DISTRIB, etc/Emacs.ad,
etc/FTP, etc/GNUS-NEWS, etc/GOATS, etc/HELLO, etc/INSTALL,
etc/MACHINES, etc/MAILINGLISTS, etc/MSDOS, etc/MYTHOLOGY, etc/NEWS,
etc/OXYMORONS, etc/PACKAGES, etc/README, etc/TUTORIAL,
etc/TUTORIAL.de, etc/TUTORIAL.ja, etc/TUTORIAL.ko, etc/TUTORIAL.se,
etc/aliases.ksh, etc/altrasoft-logo.xpm, etc/check_cygwin_setup.sh,
etc/custom/example-themes/europe-theme.el,
etc/custom/example-themes/ex-custom-file,
etc/custom/example-themes/example-theme.el, etc/e/eterm.ti,
etc/edt-user.doc, etc/enriched.doc, etc/etags.1, etc/gnuserv.1,
etc/gnuserv.README, etc/package-index.LATEST.gpg,
etc/package-index.LATEST.pgp, etc/photos/jan.png, etc/recycle.xpm,
etc/refcard.tex, etc/sample.Xdefaults, etc/sample.emacs,
etc/sgml/CATALOG, etc/sgml/HTML32.dtd, etc/skk/SKK.tut.E,
etc/smilies/Face_ase.xbm, etc/smilies/Face_ase2.xbm,
etc/smilies/Face_ase3.xbm, etc/smilies/Face_smile.xbm,
etc/smilies/Face_weep.xbm, etc/sounds, etc/toolbar,
etc/toolbar/workshop-cap-up.xpm, etc/xemacs-ja.1, etc/xemacs.1,
etc/yow.lines, etc\BETA, etc\NEWS, etc\README, etc\TUTORIAL,
etc\TUTORIAL.de, etc\check_cygwin_setup.sh, etc\sample.init.el,
etc\unicode\README, etc\unicode\mule-ucs\*, etc\unicode\other\*
unicode/unicode-consortium/8859-16.TXT: New file.
mule/english.el: Define this charset now, since a bug was fixed that formerly
prevented it.
mule/ethio-util.el: Fix compile errors involving Unicode `characters', which should be
integers.
Makefile.in.in: Always include gui.c, to fix compile error when TTY-only.
EmacsFrame.c, abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, bytecode.h, callint.c, callproc.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.c, console-msw.h, console-tty.c, console-x.c, console-x.h, console.c, console.h, data.c, database.c, device-gtk.c, device-msw.c, device-x.c, device.c, device.h, dialog-msw.c, doc.c, doprnt.c, dumper.c, dynarr.c, editfns.c, eldap.c, eldap.h, elhash.c, elhash.h, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, events.h, extents.c, extents.h, faces.c, faces.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, free-hook.c, general-slots.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gtk-xemacs.c, gui-msw.c, gui-x.c, gui-x.h, gui.c, gui.h, gutter.c, gutter.h, indent.c, input-method-xlib.c, insdel.c, keymap.c, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-canna.c, mule-ccl.c, mule-charset.c, mule-wnnfns.c, native-gtk-toolbar.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, opaque.c, opaque.h, postgresql.c, postgresql.h, print.c, process-unix.c, process.c, process.h, rangetab.c, rangetab.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, search.c, select-gtk.c, select-x.c, sound.c, specifier.c, specifier.h, strftime.c, symbols.c, symeval.h, syntax.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, toolbar.h, tooltalk.c, tooltalk.h, ui-gtk.c, ui-gtk.h, undo.c, vm-limit.c, window.c, window.h: Eliminate XSETFOO. Replace all usages with wrap_foo().
Make symbol->name a Lisp_Object, not Lisp_String *. Eliminate
nearly all uses of Lisp_String * in favor of Lisp_Object, and
correct macros so most of them favor Lisp_Object.
Create new error-behavior ERROR_ME_DEBUG_WARN -- output warnings,
but at level `debug' (usually ignored). Use it when instantiating
specifiers, so problems can be debugged. Move
log-warning-minimum-level into C so that we can optimize
ERROR_ME_DEBUG_WARN.
Fix warning levels consistent with new definitions.
Add default_ and parent fields to char table; not yet implemented.
New fun Dynarr_verify(); use for further error checking on Dynarrs.
Rearrange code at top of lisp.h in conjunction with dynarr changes.
Fix eifree(). Use Eistrings in various places
(format_event_object(), where_is_to_char(), and callers thereof)
to avoid fixed-size strings buffers. New fun write_eistring().
Reindent and fix GPM code to follow standards.
Set default MS Windows font to Lucida Console (same size as
Courier New but less interline spacing, so more lines fit).
Increase default frame size on Windows to 50 lines. (If that's too
big for the workspace, the frame will be shrunk as necessary.)
Fix problem with text files with no newlines (). (Change
`convert-eol' coding system to use `nil' for autodetect,
consistent with make-coding-system.)
Correct compile warnings in vm-limit.c.
Fix handling of reverse-direction charsets to avoid errors when
opening (e.g.) mule-ucs/lisp/reldata/uiso8859-6.el.
Recode some object printing methods to use write_fmt_string()
instead of a fixed buffer and sprintf.
Turn on display of png comments as warnings (level `info'), now
that they're unobtrusive.
Revamped the sound documentation.
Fixed bug in redisplay w.r.t. hscroll/truncation/continuation
glyphs causing jumping up and down of the lines, since they're
bigger than the line size. (It was seen most obviously when
there's a horizontal scroll bar, e.g. do C-h a glyph or something
like that.) The problem was that the glyph-contrib-p setting on
glyphs was ignored even if it was set properly, which it wasn't
until now.
author | ben |
---|---|
date | Fri, 29 Mar 2002 04:49:13 +0000 |
parents | 026c5bf9c134 |
children | a5954632b187 |
comparison
equal
deleted
inserted
replaced
792:4e83fdb13eb9 | 793:e38acbeb1cae |
---|---|
173 /* Just pray. May break, may not. */ | 173 /* Just pray. May break, may not. */ |
174 typedef long intptr_t; | 174 typedef long intptr_t; |
175 typedef unsigned long uintptr_t; | 175 typedef unsigned long uintptr_t; |
176 #endif | 176 #endif |
177 | 177 |
178 /* ------------------------ dynamic arrays ------------------- */ | 178 /* ------------------------ basic compiler defines ------------------- */ |
179 | |
180 #define Dynarr_declare(type) \ | |
181 type *base; \ | |
182 int elsize; \ | |
183 int cur; \ | |
184 int largest; \ | |
185 int max | |
186 | |
187 typedef struct dynarr | |
188 { | |
189 Dynarr_declare (void); | |
190 } Dynarr; | |
191 | |
192 void *Dynarr_newf (int elsize); | |
193 void Dynarr_resize (void *dy, int size); | |
194 void Dynarr_insert_many (void *d, const void *el, int len, int start); | |
195 void Dynarr_delete_many (void *d, int start, int len); | |
196 void Dynarr_free (void *d); | |
197 | |
198 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type))) | |
199 #define Dynarr_new2(dynarr_type, type) \ | |
200 ((dynarr_type *) Dynarr_newf (sizeof (type))) | |
201 #define Dynarr_at(d, pos) ((d)->base[pos]) | |
202 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) | |
203 #define Dynarr_begin(d) Dynarr_atp (d, 0) | |
204 #define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d)) | |
205 #define Dynarr_sizeof(d) ((d)->cur * (d)->elsize) | |
206 #define Dynarr_length(d) ((d)->cur) | |
207 #define Dynarr_largest(d) ((d)->largest) | |
208 #define Dynarr_reset(d) ((d)->cur = 0) | |
209 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur) | |
210 #define Dynarr_insert_many_at_start(d, el, len) \ | |
211 Dynarr_insert_many (d, el, len, 0) | |
212 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1) | |
213 #define Dynarr_add_lisp_string(d, s, codesys) \ | |
214 do { \ | |
215 Lisp_Object dyna_ls_s = (s); \ | |
216 Lisp_Object dyna_ls_cs = (codesys); \ | |
217 Extbyte *dyna_ls_eb; \ | |
218 Bytecount dyna_ls_bc; \ | |
219 \ | |
220 TO_EXTERNAL_FORMAT (LISP_STRING, dyna_ls_s, \ | |
221 ALLOCA, (dyna_ls_eb, dyna_ls_bc), \ | |
222 dyna_ls_cs); \ | |
223 Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \ | |
224 } while (0) | |
225 | |
226 #define Dynarr_add(d, el) ( \ | |
227 (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : (void) 0, \ | |
228 ((d)->base)[(d)->cur++] = (el), \ | |
229 (d)->cur > (d)->largest ? (d)->largest = (d)->cur : (int) 0) | |
230 | |
231 /* The following defines will get you into real trouble if you aren't | |
232 careful. But they can save a lot of execution time when used wisely. */ | |
233 #define Dynarr_increment(d) ((d)->cur++) | |
234 #define Dynarr_set_size(d, n) ((d)->cur = n) | |
235 | |
236 #define Dynarr_pop(d) \ | |
237 (assert ((d)->cur > 0), (d)->cur--, Dynarr_at (d, (d)->cur)) | |
238 #define Dynarr_delete(d, i) Dynarr_delete_many (d, i, len) | |
239 #define Dynarr_delete_by_pointer(d, p) \ | |
240 Dynarr_delete_many (d, (p) - ((d)->base), 1) | |
241 | |
242 #ifdef MEMORY_USAGE_STATS | |
243 struct overhead_stats; | |
244 Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats); | |
245 #endif | |
246 | 179 |
247 /* Also define min() and max(). (Some compilers put them in strange | 180 /* Also define min() and max(). (Some compilers put them in strange |
248 places that won't be referenced by the above include files, such | 181 places that won't be referenced by the above include files, such |
249 as 'macros.h' under Solaris.) */ | 182 as 'macros.h' under Solaris.) */ |
250 | 183 |
252 #define min(a,b) (((a) <= (b)) ? (a) : (b)) | 185 #define min(a,b) (((a) <= (b)) ? (a) : (b)) |
253 #endif | 186 #endif |
254 #ifndef max | 187 #ifndef max |
255 #define max(a,b) (((a) > (b)) ? (a) : (b)) | 188 #define max(a,b) (((a) > (b)) ? (a) : (b)) |
256 #endif | 189 #endif |
257 | |
258 /* Memory allocation */ | |
259 void malloc_warning (const char *); | |
260 void *xmalloc (Bytecount size); | |
261 void *xmalloc_and_zero (Bytecount size); | |
262 void *xrealloc (void *, Bytecount size); | |
263 char *xstrdup (const char *); | |
264 /* generally useful */ | |
265 #define countof(x) ((int) (sizeof(x)/sizeof((x)[0]))) | |
266 #define xnew(type) ((type *) xmalloc (sizeof (type))) | |
267 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type))) | |
268 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type))) | |
269 #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue))) | |
270 #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type))) | |
271 #define XREALLOC_ARRAY(ptr, type, len) ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type)))) | |
272 #define alloca_new(type) ((type *) alloca (sizeof (type))) | |
273 #define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type))) | |
274 | |
275 /* also generally useful if you want to avoid arbitrary size limits | |
276 but don't need a full dynamic array. Assumes that BASEVAR points | |
277 to a malloced array of TYPE objects (or possibly a NULL pointer, | |
278 if SIZEVAR is 0), with the total size stored in SIZEVAR. This | |
279 macro will realloc BASEVAR as necessary so that it can hold at | |
280 least NEEDED_SIZE objects. The reallocing is done by doubling, | |
281 which ensures constant amortized time per element. */ | |
282 #define DO_REALLOC(basevar, sizevar, needed_size, type) do { \ | |
283 Bytecount do_realloc_needed_size = (needed_size); \ | |
284 if ((sizevar) < do_realloc_needed_size) \ | |
285 { \ | |
286 if ((sizevar) < 32) \ | |
287 (sizevar) = 32; \ | |
288 while ((sizevar) < do_realloc_needed_size) \ | |
289 (sizevar) *= 2; \ | |
290 XREALLOC_ARRAY (basevar, type, (sizevar)); \ | |
291 } \ | |
292 } while (0) | |
293 | |
294 #ifdef ERROR_CHECK_MALLOC | |
295 void xfree_1 (void *); | |
296 #define xfree(lvalue) do \ | |
297 { \ | |
298 void **xfree_ptr = (void **) &(lvalue); \ | |
299 xfree_1 (*xfree_ptr); \ | |
300 *xfree_ptr = (void *) 0xDEADBEEF; \ | |
301 } while (0) | |
302 #else | |
303 void xfree (void *); | |
304 #endif /* ERROR_CHECK_MALLOC */ | |
305 | 190 |
306 #ifndef PRINTF_ARGS | 191 #ifndef PRINTF_ARGS |
307 # if defined (__GNUC__) && (__GNUC__ >= 2) | 192 # if defined (__GNUC__) && (__GNUC__ >= 2) |
308 # define PRINTF_ARGS(string_index,first_to_check) \ | 193 # define PRINTF_ARGS(string_index,first_to_check) \ |
309 __attribute__ ((format (printf, string_index, first_to_check))) | 194 __attribute__ ((format (printf, string_index, first_to_check))) |
346 #else | 231 #else |
347 #define RETURN_SANS_WARNINGS return | 232 #define RETURN_SANS_WARNINGS return |
348 #define RETURN_NOT_REACHED(value) return value; | 233 #define RETURN_NOT_REACHED(value) return value; |
349 #endif | 234 #endif |
350 | 235 |
236 #ifndef DO_NOTHING | |
237 #define DO_NOTHING do {} while (0) | |
238 #endif | |
239 | |
240 #ifndef DECLARE_NOTHING | |
241 #define DECLARE_NOTHING struct nosuchstruct | |
242 #endif | |
243 | |
244 /*#ifdef DEBUG_XEMACS*/ | |
245 #define REGISTER | |
246 #define register | |
247 /*#else*/ | |
248 /*#define REGISTER register*/ | |
249 /*#endif*/ | |
250 | |
251 /* ------------------------ alignment definitions ------------------- */ | |
252 | |
351 /* No type has a greater alignment requirement than max_align_t. | 253 /* No type has a greater alignment requirement than max_align_t. |
352 (except perhaps for types we don't use, like long double) */ | 254 (except perhaps for types we don't use, like long double) */ |
353 typedef union | 255 typedef union |
354 { | 256 { |
355 struct { long l; } l; | 257 struct { long l; } l; |
402 | 304 |
403 /* #### Yuck, this is kind of evil */ | 305 /* #### Yuck, this is kind of evil */ |
404 #define ALIGN_PTR(ptr, unit) \ | 306 #define ALIGN_PTR(ptr, unit) \ |
405 ((void *) ALIGN_SIZE ((size_t) (ptr), unit)) | 307 ((void *) ALIGN_SIZE ((size_t) (ptr), unit)) |
406 | 308 |
407 #ifndef DO_NOTHING | 309 /* ------------------------ assertions ------------------- */ |
408 #define DO_NOTHING do {} while (0) | |
409 #endif | |
410 | |
411 #ifndef DECLARE_NOTHING | |
412 #define DECLARE_NOTHING struct nosuchstruct | |
413 #endif | |
414 | 310 |
415 /* We define assert iff USE_ASSERTIONS or DEBUG_XEMACS is defined. | 311 /* We define assert iff USE_ASSERTIONS or DEBUG_XEMACS is defined. |
416 Otherwise we define it to be empty. Quantify has shown that the | 312 Otherwise we define it to be empty. Quantify has shown that the |
417 time the assert checks take is measurable so let's not include them | 313 time the assert checks take is measurable so let's not include them |
418 in production binaries. | 314 in production binaries. |
456 # define assert(x) (1) | 352 # define assert(x) (1) |
457 # endif | 353 # endif |
458 #endif | 354 #endif |
459 #endif /* 0 */ | 355 #endif /* 0 */ |
460 | 356 |
461 /*#ifdef DEBUG_XEMACS*/ | 357 /* ------------------------ simple memory allocation ------------------- */ |
462 #define REGISTER | 358 |
463 #define register | 359 /* Memory allocation */ |
464 /*#else*/ | 360 void malloc_warning (const char *); |
465 /*#define REGISTER register*/ | 361 void *xmalloc (Bytecount size); |
466 /*#endif*/ | 362 void *xmalloc_and_zero (Bytecount size); |
467 | 363 void *xrealloc (void *, Bytecount size); |
364 char *xstrdup (const char *); | |
365 /* generally useful */ | |
366 #define countof(x) ((int) (sizeof(x)/sizeof((x)[0]))) | |
367 #define xnew(type) ((type *) xmalloc (sizeof (type))) | |
368 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type))) | |
369 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type))) | |
370 #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue))) | |
371 #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type))) | |
372 #define XREALLOC_ARRAY(ptr, type, len) ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type)))) | |
373 #define alloca_new(type) ((type *) alloca (sizeof (type))) | |
374 #define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type))) | |
375 | |
376 /* also generally useful if you want to avoid arbitrary size limits | |
377 but don't need a full dynamic array. Assumes that BASEVAR points | |
378 to a malloced array of TYPE objects (or possibly a NULL pointer, | |
379 if SIZEVAR is 0), with the total size stored in SIZEVAR. This | |
380 macro will realloc BASEVAR as necessary so that it can hold at | |
381 least NEEDED_SIZE objects. The reallocing is done by doubling, | |
382 which ensures constant amortized time per element. */ | |
383 #define DO_REALLOC(basevar, sizevar, needed_size, type) do { \ | |
384 Bytecount do_realloc_needed_size = (needed_size); \ | |
385 if ((sizevar) < do_realloc_needed_size) \ | |
386 { \ | |
387 if ((sizevar) < 32) \ | |
388 (sizevar) = 32; \ | |
389 while ((sizevar) < do_realloc_needed_size) \ | |
390 (sizevar) *= 2; \ | |
391 XREALLOC_ARRAY (basevar, type, (sizevar)); \ | |
392 } \ | |
393 } while (0) | |
394 | |
395 #ifdef ERROR_CHECK_MALLOC | |
396 void xfree_1 (void *); | |
397 #define xfree(lvalue) do \ | |
398 { \ | |
399 void **xfree_ptr = (void **) &(lvalue); \ | |
400 xfree_1 (*xfree_ptr); \ | |
401 *xfree_ptr = (void *) 0xDEADBEEF; \ | |
402 } while (0) | |
403 #else | |
404 void xfree (void *); | |
405 #endif /* ERROR_CHECK_MALLOC */ | |
406 | |
407 /* ------------------------ dynamic arrays ------------------- */ | |
408 | |
409 #define Dynarr_declare(type) \ | |
410 type *base; \ | |
411 int elsize; \ | |
412 int cur; \ | |
413 int largest; \ | |
414 int max | |
415 | |
416 typedef struct dynarr | |
417 { | |
418 Dynarr_declare (void); | |
419 } Dynarr; | |
420 | |
421 void *Dynarr_newf (int elsize); | |
422 void Dynarr_resize (void *dy, int size); | |
423 void Dynarr_insert_many (void *d, const void *el, int len, int start); | |
424 void Dynarr_delete_many (void *d, int start, int len); | |
425 void Dynarr_free (void *d); | |
426 | |
427 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type))) | |
428 #define Dynarr_new2(dynarr_type, type) \ | |
429 ((dynarr_type *) Dynarr_newf (sizeof (type))) | |
430 #define Dynarr_at(d, pos) ((d)->base[pos]) | |
431 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) | |
432 #define Dynarr_begin(d) Dynarr_atp (d, 0) | |
433 #define Dynarr_end(d) Dynarr_atp (d, Dynarr_length (d)) | |
434 #define Dynarr_sizeof(d) ((d)->cur * (d)->elsize) | |
435 | |
436 #ifdef ERROR_CHECK_TYPECHECK | |
437 DECLARE_INLINE_HEADER ( | |
438 Dynarr * | |
439 Dynarr_verify_1 (void *d, const char *file, int line) | |
440 ) | |
441 { | |
442 Dynarr *dy = (Dynarr *) d; | |
443 assert_at_line (dy->cur >= 0 && dy->cur <= dy->largest && | |
444 dy->largest <= dy->max, file, line); | |
445 return dy; | |
446 } | |
447 | |
448 #define Dynarr_verify(d) Dynarr_verify_1 (d, __FILE__, __LINE__) | |
449 #else | |
450 #define Dynarr_verify(d) (d) | |
451 #endif /* ERROR_CHECK_TYPECHECK */ | |
452 | |
453 #define Dynarr_length(d) (Dynarr_verify (d)->cur) | |
454 #define Dynarr_largest(d) (Dynarr_verify (d)->largest) | |
455 #define Dynarr_reset(d) (Dynarr_verify (d)->cur = 0) | |
456 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur) | |
457 #define Dynarr_insert_many_at_start(d, el, len) \ | |
458 Dynarr_insert_many (d, el, len, 0) | |
459 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1) | |
460 #define Dynarr_add_lisp_string(d, s, codesys) \ | |
461 do { \ | |
462 Lisp_Object dyna_ls_s = (s); \ | |
463 Lisp_Object dyna_ls_cs = (codesys); \ | |
464 Extbyte *dyna_ls_eb; \ | |
465 Bytecount dyna_ls_bc; \ | |
466 \ | |
467 TO_EXTERNAL_FORMAT (LISP_STRING, dyna_ls_s, \ | |
468 ALLOCA, (dyna_ls_eb, dyna_ls_bc), \ | |
469 dyna_ls_cs); \ | |
470 Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \ | |
471 } while (0) | |
472 | |
473 #define Dynarr_add(d, el) ( \ | |
474 Dynarr_verify (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : \ | |
475 (void) 0, \ | |
476 ((d)->base)[(d)->cur++] = (el), \ | |
477 (d)->cur > (d)->largest ? (d)->largest = (d)->cur : (int) 0) | |
478 | |
479 /* The following defines will get you into real trouble if you aren't | |
480 careful. But they can save a lot of execution time when used wisely. */ | |
481 #define Dynarr_increment(d) ((d)->cur++) | |
482 #define Dynarr_set_size(d, n) ((d)->cur = n) | |
483 | |
484 #define Dynarr_pop(d) \ | |
485 (assert ((d)->cur > 0), (d)->cur--, Dynarr_at (d, (d)->cur)) | |
486 #define Dynarr_delete(d, i) Dynarr_delete_many (d, i, len) | |
487 #define Dynarr_delete_by_pointer(d, p) \ | |
488 Dynarr_delete_many (d, (p) - ((d)->base), 1) | |
489 | |
490 #ifdef MEMORY_USAGE_STATS | |
491 struct overhead_stats; | |
492 Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats); | |
493 #endif | |
468 | 494 |
469 | 495 |
470 /************************************************************************/ | 496 /************************************************************************/ |
471 /* typedefs */ | 497 /* typedefs */ |
472 /************************************************************************/ | 498 /************************************************************************/ |
486 | 512 |
487 typedef enum error_behavior | 513 typedef enum error_behavior |
488 { | 514 { |
489 ERROR_ME, | 515 ERROR_ME, |
490 ERROR_ME_NOT, | 516 ERROR_ME_NOT, |
491 ERROR_ME_WARN | 517 ERROR_ME_WARN, |
518 ERROR_ME_DEBUG_WARN | |
492 } Error_Behavior; | 519 } Error_Behavior; |
493 | 520 |
494 #define ERRB_EQ(a, b) ((a) == (b)) | 521 #define ERRB_EQ(a, b) ((a) == (b)) |
495 | 522 |
496 #else | 523 #else |
504 } Error_Behavior; | 531 } Error_Behavior; |
505 | 532 |
506 extern Error_Behavior ERROR_ME; | 533 extern Error_Behavior ERROR_ME; |
507 extern Error_Behavior ERROR_ME_NOT; | 534 extern Error_Behavior ERROR_ME_NOT; |
508 extern Error_Behavior ERROR_ME_WARN; | 535 extern Error_Behavior ERROR_ME_WARN; |
536 extern Error_Behavior ERROR_ME_DEBUG_WARN; | |
509 | 537 |
510 #define ERRB_EQ(a, b) \ | 538 #define ERRB_EQ(a, b) \ |
511 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \ | 539 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \ |
512 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure) | 540 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure) |
513 | 541 |
826 }; | 854 }; |
827 #endif | 855 #endif |
828 | 856 |
829 DECLARE_LRECORD (cons, Lisp_Cons); | 857 DECLARE_LRECORD (cons, Lisp_Cons); |
830 #define XCONS(x) XRECORD (x, cons, Lisp_Cons) | 858 #define XCONS(x) XRECORD (x, cons, Lisp_Cons) |
831 #define XSETCONS(x, p) XSETRECORD (x, p, cons) | |
832 #define wrap_cons(p) wrap_record (p, cons) | 859 #define wrap_cons(p) wrap_record (p, cons) |
833 #define CONSP(x) RECORDP (x, cons) | 860 #define CONSP(x) RECORDP (x, cons) |
834 #define CHECK_CONS(x) CHECK_RECORD (x, cons) | 861 #define CHECK_CONS(x) CHECK_RECORD (x, cons) |
835 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons) | 862 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons) |
836 | 863 |
1321 /* Number of chars at beginning of string that are one byte in length | 1348 /* Number of chars at beginning of string that are one byte in length |
1322 (BYTE_ASCII_P) */ | 1349 (BYTE_ASCII_P) */ |
1323 unsigned int ascii_begin :21; | 1350 unsigned int ascii_begin :21; |
1324 } v; | 1351 } v; |
1325 } u; | 1352 } u; |
1326 Bytecount size; | 1353 Bytecount size_; |
1327 Intbyte *data; | 1354 Intbyte *data_; |
1328 Lisp_Object plist; | 1355 Lisp_Object plist; |
1329 }; | 1356 }; |
1330 typedef struct Lisp_String Lisp_String; | 1357 typedef struct Lisp_String Lisp_String; |
1331 | 1358 |
1332 #define MAX_STRING_ASCII_BEGIN ((2 << 21) - 1) | 1359 #define MAX_STRING_ASCII_BEGIN ((2 << 21) - 1) |
1333 | 1360 |
1334 DECLARE_LRECORD (string, Lisp_String); | 1361 DECLARE_LRECORD (string, Lisp_String); |
1335 #define XSTRING(x) XRECORD (x, string, Lisp_String) | 1362 #define XSTRING(x) XRECORD (x, string, Lisp_String) |
1336 #define XSETSTRING(x, p) XSETRECORD (x, p, string) | |
1337 #define wrap_string(p) wrap_record (p, string) | 1363 #define wrap_string(p) wrap_record (p, string) |
1338 #define STRINGP(x) RECORDP (x, string) | 1364 #define STRINGP(x) RECORDP (x, string) |
1339 #define CHECK_STRING(x) CHECK_RECORD (x, string) | 1365 #define CHECK_STRING(x) CHECK_RECORD (x, string) |
1340 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string) | 1366 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string) |
1341 | 1367 |
1349 # define bytecount_to_charcount(ptr, len) (len) | 1375 # define bytecount_to_charcount(ptr, len) (len) |
1350 # define charcount_to_bytecount(ptr, len) (len) | 1376 # define charcount_to_bytecount(ptr, len) (len) |
1351 | 1377 |
1352 #endif /* not MULE */ | 1378 #endif /* not MULE */ |
1353 | 1379 |
1354 #define string_length(s) ((s)->size) | 1380 /* Operations on Lisp_String *'s; only ones left */ |
1355 #define XSTRING_LENGTH(s) string_length (XSTRING (s)) | 1381 #define set_string_length(s, len) ((void) ((s)->size_ = (len))) |
1356 #define string_data(s) ((s)->data + 0) | 1382 #define set_string_data(s, ptr) ((void) ((s)->data_ = (ptr))) |
1357 #define XSTRING_DATA(s) string_data (XSTRING (s)) | 1383 |
1358 #define string_ascii_begin(s) ((s)->u.v.ascii_begin + 0) | 1384 #define XSTRING_LENGTH(s) (XSTRING (s)->size_) |
1359 #define XSTRING_ASCII_BEGIN(s) string_ascii_begin (XSTRING (s)) | 1385 #define XSTRING_PLIST(s) (XSTRING (s)->plist) |
1360 #define string_char_length(s) string_index_byte_to_char (s, string_length (s)) | 1386 #define XSTRING_DATA(s) (XSTRING (s)->data_ + 0) |
1361 #define XSTRING_CHAR_LENGTH(s) string_char_length (XSTRING (s)) | 1387 #define XSTRING_ASCII_BEGIN(s) (XSTRING (s)->u.v.ascii_begin + 0) |
1362 #define string_byte(s, i) ((s)->data[i] + 0) | 1388 #define XSTRING_CHAR_LENGTH(s) \ |
1363 #define XSTRING_BYTE(s, i) string_byte (XSTRING (s), i) | 1389 string_index_byte_to_char (s, XSTRING_LENGTH (s)) |
1364 #define string_byte_addr(s, i) (&((s)->data[i])) | 1390 #define XSTRING_BYTE(s, i) (XSTRING (s)->data_[i] + 0) |
1365 #define string_char(s, i) charptr_emchar (string_char_addr (s, i)) | 1391 #define set_string_byte(s, i, c) (XSTRING (s)->data_[i] = (c)) |
1366 #define XSTRING_CHAR(s, i) string_char (XSTRING (s), i) | 1392 |
1367 #define XSTRING_INDEX_CHAR_TO_BYTE(s, idx) \ | 1393 #define string_byte_addr(s, i) (&((XSTRING (s))->data_[i])) |
1368 string_index_char_to_byte (XSTRING (s), idx) | 1394 #define XSTRING_CHAR(s, i) charptr_emchar (string_char_addr (s, i)) |
1369 #define XSTRING_INDEX_BYTE_TO_CHAR(s, idx) \ | 1395 #define XSET_STRING_LENGTH(s, ptr) set_string_length (XSTRING (s), ptr) |
1370 string_index_byte_to_char (XSTRING (s), idx) | 1396 #define XSET_STRING_DATA(s, ptr) set_string_data (XSTRING (s), ptr) |
1371 #define XSTRING_OFFSET_BYTE_TO_CHAR_LEN(s, off, len) \ | |
1372 string_offset_byte_to_char_len (XSTRING (s), off, len) | |
1373 #define XSTRING_OFFSET_CHAR_TO_BYTE_LEN(s, off, len) \ | |
1374 string_offset_char_to_byte_len (XSTRING (s), off, len) | |
1375 #define set_string_length(s, len) ((void) ((s)->size = (len))) | |
1376 #define set_string_data(s, ptr) ((void) ((s)->data = (ptr))) | |
1377 /* WARNING: If you modify an existing string, you must call | 1397 /* WARNING: If you modify an existing string, you must call |
1378 bump_string_modiff() afterwards. */ | 1398 bump_string_modiff() afterwards. */ |
1379 #define set_string_byte(s, i, b) ((void) ((s)->data[i] = (b))) | 1399 #define XSET_STRING_ASCII_BEGIN(s, val) \ |
1380 #define set_string_ascii_begin(s, val) ((void) ((s)->u.v.ascii_begin = (val))) | 1400 ((void) (XSTRING (s)->u.v.ascii_begin = (val))) |
1381 | 1401 |
1382 #ifdef ERROR_CHECK_CHARBPOS | 1402 #ifdef ERROR_CHECK_CHARBPOS |
1383 #define SLEDGEHAMMER_CHECK_ASCII_BEGIN | 1403 #define SLEDGEHAMMER_CHECK_ASCII_BEGIN |
1384 #endif | 1404 #endif |
1385 | 1405 |
1409 } while (0) | 1429 } while (0) |
1410 | 1430 |
1411 #define alloca_intbytes(num) alloca_array (Intbyte, num) | 1431 #define alloca_intbytes(num) alloca_array (Intbyte, num) |
1412 #define alloca_extbytes(num) alloca_array (Extbyte, num) | 1432 #define alloca_extbytes(num) alloca_array (Extbyte, num) |
1413 | 1433 |
1414 void resize_string (Lisp_String *s, Bytecount pos, Bytecount delta); | 1434 void resize_string (Lisp_Object s, Bytecount pos, Bytecount delta); |
1415 | 1435 |
1416 #ifdef MULE | 1436 #ifdef MULE |
1417 | 1437 |
1418 /* Convert a byte index into a string into a char index. */ | 1438 /* Convert a byte index into a string into a char index. */ |
1419 DECLARE_INLINE_HEADER ( | 1439 DECLARE_INLINE_HEADER ( |
1420 Charcount | 1440 Charcount |
1421 string_index_byte_to_char (Lisp_String *s, Bytecount idx) | 1441 string_index_byte_to_char (Lisp_Object s, Bytecount idx) |
1422 ) | 1442 ) |
1423 { | 1443 { |
1424 Charcount retval; | 1444 Charcount retval; |
1425 if (idx <= (Bytecount) string_ascii_begin (s)) | 1445 if (idx <= (Bytecount) XSTRING_ASCII_BEGIN (s)) |
1426 retval = idx; | 1446 retval = idx; |
1427 else | 1447 else |
1428 retval = (string_ascii_begin (s) + | 1448 retval = (XSTRING_ASCII_BEGIN (s) + |
1429 bytecount_to_charcount (string_data (s) + string_ascii_begin (s), | 1449 bytecount_to_charcount (XSTRING_DATA (s) + |
1430 idx - string_ascii_begin (s))); | 1450 XSTRING_ASCII_BEGIN (s), |
1451 idx - XSTRING_ASCII_BEGIN (s))); | |
1431 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN | 1452 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN |
1432 assert (retval == bytecount_to_charcount (string_data (s), idx)); | 1453 assert (retval == bytecount_to_charcount (XSTRING_DATA (s), idx)); |
1433 #endif | 1454 #endif |
1434 return retval; | 1455 return retval; |
1435 } | 1456 } |
1436 | 1457 |
1437 /* Convert a char index into a string into a byte index. */ | 1458 /* Convert a char index into a string into a byte index. */ |
1438 DECLARE_INLINE_HEADER ( | 1459 DECLARE_INLINE_HEADER ( |
1439 Bytecount | 1460 Bytecount |
1440 string_index_char_to_byte (Lisp_String *s, Charcount idx) | 1461 string_index_char_to_byte (Lisp_Object s, Charcount idx) |
1441 ) | 1462 ) |
1442 { | 1463 { |
1443 Bytecount retval; | 1464 Bytecount retval; |
1444 if (idx <= (Charcount) string_ascii_begin (s)) | 1465 if (idx <= (Charcount) XSTRING_ASCII_BEGIN (s)) |
1445 retval = idx; | 1466 retval = idx; |
1446 else | 1467 else |
1447 retval = (string_ascii_begin (s) + | 1468 retval = (XSTRING_ASCII_BEGIN (s) + |
1448 charcount_to_bytecount (string_data (s) + string_ascii_begin (s), | 1469 charcount_to_bytecount (XSTRING_DATA (s) + |
1449 idx - string_ascii_begin (s))); | 1470 XSTRING_ASCII_BEGIN (s), |
1471 idx - XSTRING_ASCII_BEGIN (s))); | |
1450 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN | 1472 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN |
1451 assert (retval == charcount_to_bytecount (string_data (s), idx)); | 1473 assert (retval == charcount_to_bytecount (XSTRING_DATA (s), idx)); |
1452 #endif | 1474 #endif |
1453 return retval; | 1475 return retval; |
1454 } | 1476 } |
1455 | 1477 |
1456 /* Convert a substring length (starting at byte offset OFF) from bytes to | 1478 /* Convert a substring length (starting at byte offset OFF) from bytes to |
1457 chars. */ | 1479 chars. */ |
1458 DECLARE_INLINE_HEADER ( | 1480 DECLARE_INLINE_HEADER ( |
1459 Charcount | 1481 Charcount |
1460 string_offset_byte_to_char_len (Lisp_String *s, Bytecount off, Bytecount len) | 1482 string_offset_byte_to_char_len (Lisp_Object s, Bytecount off, Bytecount len) |
1461 ) | 1483 ) |
1462 { | 1484 { |
1463 Charcount retval; | 1485 Charcount retval; |
1464 if (off + len <= (Bytecount) string_ascii_begin (s)) | 1486 if (off + len <= (Bytecount) XSTRING_ASCII_BEGIN (s)) |
1465 retval = len; | 1487 retval = len; |
1466 else if (off < (Bytecount) string_ascii_begin (s)) | 1488 else if (off < (Bytecount) XSTRING_ASCII_BEGIN (s)) |
1467 retval = | 1489 retval = |
1468 string_ascii_begin (s) - off + | 1490 XSTRING_ASCII_BEGIN (s) - off + |
1469 bytecount_to_charcount (string_data (s) + string_ascii_begin (s), | 1491 bytecount_to_charcount (XSTRING_DATA (s) + XSTRING_ASCII_BEGIN (s), |
1470 len - (string_ascii_begin (s) - off)); | 1492 len - (XSTRING_ASCII_BEGIN (s) - off)); |
1471 else | 1493 else |
1472 retval = bytecount_to_charcount (string_data (s) + off, len); | 1494 retval = bytecount_to_charcount (XSTRING_DATA (s) + off, len); |
1473 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN | 1495 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN |
1474 assert (retval == bytecount_to_charcount (string_data (s) + off, len)); | 1496 assert (retval == bytecount_to_charcount (XSTRING_DATA (s) + off, len)); |
1475 #endif | 1497 #endif |
1476 return retval; | 1498 return retval; |
1477 } | 1499 } |
1478 | 1500 |
1479 /* Convert a substring length (starting at byte offset OFF) from chars to | 1501 /* Convert a substring length (starting at byte offset OFF) from chars to |
1480 bytes. */ | 1502 bytes. */ |
1481 DECLARE_INLINE_HEADER ( | 1503 DECLARE_INLINE_HEADER ( |
1482 Bytecount | 1504 Bytecount |
1483 string_offset_char_to_byte_len (Lisp_String *s, Bytecount off, Charcount len) | 1505 string_offset_char_to_byte_len (Lisp_Object s, Bytecount off, Charcount len) |
1484 ) | 1506 ) |
1485 { | 1507 { |
1486 Bytecount retval; | 1508 Bytecount retval; |
1487 if (off + len <= (Bytecount) string_ascii_begin (s)) | 1509 if (off + len <= (Bytecount) XSTRING_ASCII_BEGIN (s)) |
1488 retval = len; | 1510 retval = len; |
1489 else if (off < (Bytecount) string_ascii_begin (s)) | 1511 else if (off < (Bytecount) XSTRING_ASCII_BEGIN (s)) |
1490 retval = | 1512 retval = |
1491 string_ascii_begin (s) - off + | 1513 XSTRING_ASCII_BEGIN (s) - off + |
1492 charcount_to_bytecount (string_data (s) + string_ascii_begin (s), | 1514 charcount_to_bytecount (XSTRING_DATA (s) + XSTRING_ASCII_BEGIN (s), |
1493 len - (string_ascii_begin (s) - off)); | 1515 len - (XSTRING_ASCII_BEGIN (s) - off)); |
1494 else | 1516 else |
1495 retval = charcount_to_bytecount (string_data (s) + off, len); | 1517 retval = charcount_to_bytecount (XSTRING_DATA (s) + off, len); |
1496 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN | 1518 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN |
1497 assert (retval == charcount_to_bytecount (string_data (s) + off, len)); | 1519 assert (retval == charcount_to_bytecount (XSTRING_DATA (s) + off, len)); |
1498 #endif | 1520 #endif |
1499 return retval; | 1521 return retval; |
1500 } | 1522 } |
1501 | 1523 |
1502 DECLARE_INLINE_HEADER ( | 1524 DECLARE_INLINE_HEADER ( |
1503 Intbyte * | 1525 Intbyte * |
1504 string_char_addr (Lisp_String *s, Charcount idx) | 1526 string_char_addr (Lisp_Object s, Charcount idx) |
1505 ) | 1527 ) |
1506 { | 1528 { |
1507 return string_data (s) + string_index_char_to_byte (s, idx); | 1529 return XSTRING_DATA (s) + string_index_char_to_byte (s, idx); |
1508 } | 1530 } |
1509 | 1531 |
1510 void set_string_char (Lisp_String *s, Charcount i, Emchar c); | 1532 void set_string_char (Lisp_Object s, Charcount i, Emchar c); |
1511 | 1533 |
1512 #else /* not MULE */ | 1534 #else /* not MULE */ |
1513 | 1535 |
1514 #define string_index_byte_to_char(s, idx) (idx) | 1536 #define string_index_byte_to_char(s, idx) (idx) |
1515 #define string_index_char_to_byte(s, idx) (idx) | 1537 #define string_index_char_to_byte(s, idx) (idx) |
1516 #define string_offset_byte_to_char_len(s, off, len) (len) | 1538 #define string_offset_byte_to_char_len(s, off, len) (len) |
1517 #define string_offset_char_to_byte_len(s, off, len) (len) | 1539 #define string_offset_char_to_byte_len(s, off, len) (len) |
1518 # define string_char_addr(s, i) string_byte_addr (s, i) | 1540 # define string_char_addr(s, i) string_byte_addr (s, i) |
1519 /* WARNING: If you modify an existing string, you must call | 1541 /* WARNING: If you modify an existing string, you must call |
1520 bump_string_modiff() afterwards. */ | 1542 bump_string_modiff() afterwards. */ |
1521 # define set_string_char(s, i, c) set_string_byte (s, i, (Intbyte) c) | 1543 # define set_string_char(s, i, c) set_string_byte (s, i, c) |
1522 | 1544 |
1523 #endif /* not MULE */ | 1545 #endif /* not MULE */ |
1524 | 1546 |
1525 /* Return the true aligned size of a struct whose last member is a | 1547 /* Return the true aligned size of a struct whose last member is a |
1526 variable-length array field. (this is known as the "struct hack") */ | 1548 variable-length array field. (this is known as the "struct hack") */ |
1558 }; | 1580 }; |
1559 typedef struct Lisp_Vector Lisp_Vector; | 1581 typedef struct Lisp_Vector Lisp_Vector; |
1560 | 1582 |
1561 DECLARE_LRECORD (vector, Lisp_Vector); | 1583 DECLARE_LRECORD (vector, Lisp_Vector); |
1562 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector) | 1584 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector) |
1563 #define XSETVECTOR(x, p) XSETRECORD (x, p, vector) | |
1564 #define wrap_vector(p) wrap_record (p, vector) | 1585 #define wrap_vector(p) wrap_record (p, vector) |
1565 #define VECTORP(x) RECORDP (x, vector) | 1586 #define VECTORP(x) RECORDP (x, vector) |
1566 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector) | 1587 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector) |
1567 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector) | 1588 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector) |
1568 | 1589 |
1597 }; | 1618 }; |
1598 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector; | 1619 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector; |
1599 | 1620 |
1600 DECLARE_LRECORD (bit_vector, Lisp_Bit_Vector); | 1621 DECLARE_LRECORD (bit_vector, Lisp_Bit_Vector); |
1601 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector) | 1622 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector) |
1602 #define XSETBIT_VECTOR(x, p) XSETRECORD (x, p, bit_vector) | |
1603 #define wrap_bit_vector(p) wrap_record (p, bit_vector) | 1623 #define wrap_bit_vector(p) wrap_record (p, bit_vector) |
1604 #define BIT_VECTORP(x) RECORDP (x, bit_vector) | 1624 #define BIT_VECTORP(x) RECORDP (x, bit_vector) |
1605 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector) | 1625 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector) |
1606 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector) | 1626 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector) |
1607 | 1627 |
1648 struct Lisp_Symbol | 1668 struct Lisp_Symbol |
1649 { | 1669 { |
1650 struct lrecord_header lheader; | 1670 struct lrecord_header lheader; |
1651 /* next symbol in this obarray bucket */ | 1671 /* next symbol in this obarray bucket */ |
1652 Lisp_Symbol *next; | 1672 Lisp_Symbol *next; |
1653 Lisp_String *name; | 1673 Lisp_Object name; |
1654 Lisp_Object value; | 1674 Lisp_Object value; |
1655 Lisp_Object function; | 1675 Lisp_Object function; |
1656 Lisp_Object plist; | 1676 Lisp_Object plist; |
1657 }; | 1677 }; |
1658 | 1678 |
1659 #define SYMBOL_IS_KEYWORD(sym) \ | 1679 #define SYMBOL_IS_KEYWORD(sym) \ |
1660 ((string_byte (symbol_name (XSYMBOL (sym)), 0) == ':') \ | 1680 ((XSTRING_BYTE (symbol_name (XSYMBOL (sym)), 0) == ':') \ |
1661 && EQ (sym, oblookup (Vobarray, \ | 1681 && EQ (sym, oblookup (Vobarray, \ |
1662 string_data (symbol_name (XSYMBOL (sym))), \ | 1682 XSTRING_DATA (symbol_name (XSYMBOL (sym))), \ |
1663 string_length (symbol_name (XSYMBOL (sym)))))) | 1683 XSTRING_LENGTH (symbol_name (XSYMBOL (sym)))))) |
1664 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj)) | 1684 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj)) |
1665 | 1685 |
1666 DECLARE_LRECORD (symbol, Lisp_Symbol); | 1686 DECLARE_LRECORD (symbol, Lisp_Symbol); |
1667 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol) | 1687 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol) |
1668 #define XSETSYMBOL(x, p) XSETRECORD (x, p, symbol) | |
1669 #define wrap_symbol(p) wrap_record (p, symbol) | 1688 #define wrap_symbol(p) wrap_record (p, symbol) |
1670 #define SYMBOLP(x) RECORDP (x, symbol) | 1689 #define SYMBOLP(x) RECORDP (x, symbol) |
1671 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol) | 1690 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol) |
1672 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol) | 1691 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol) |
1673 | 1692 |
1674 #define symbol_next(s) ((s)->next) | 1693 #define symbol_next(s) ((s)->next) |
1675 #define symbol_name(s) ((s)->name) | 1694 #define symbol_name(s) ((s)->name) |
1676 #define symbol_value(s) ((s)->value) | 1695 #define symbol_value(s) ((s)->value) |
1677 #define symbol_function(s) ((s)->function) | 1696 #define symbol_function(s) ((s)->function) |
1678 #define symbol_plist(s) ((s)->plist) | 1697 #define symbol_plist(s) ((s)->plist) |
1698 | |
1699 #define XSYMBOL_NEXT(s) (XSYMBOL (s)->next) | |
1700 #define XSYMBOL_NAME(s) (XSYMBOL (s)->name) | |
1701 #define XSYMBOL_VALUE(s) (XSYMBOL (s)->value) | |
1702 #define XSYMBOL_FUNCTION(s) (XSYMBOL (s)->function) | |
1703 #define XSYMBOL_PLIST(s) (XSYMBOL (s)->plist) | |
1704 | |
1679 | 1705 |
1680 /*------------------------------- subr ---------------------------------*/ | 1706 /*------------------------------- subr ---------------------------------*/ |
1681 | 1707 |
1682 typedef Lisp_Object (*lisp_fn_t) (void); | 1708 typedef Lisp_Object (*lisp_fn_t) (void); |
1683 | 1709 |
1693 }; | 1719 }; |
1694 typedef struct Lisp_Subr Lisp_Subr; | 1720 typedef struct Lisp_Subr Lisp_Subr; |
1695 | 1721 |
1696 DECLARE_LRECORD (subr, Lisp_Subr); | 1722 DECLARE_LRECORD (subr, Lisp_Subr); |
1697 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr) | 1723 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr) |
1698 #define XSETSUBR(x, p) XSETRECORD (x, p, subr) | |
1699 #define wrap_subr(p) wrap_record (p, subr) | 1724 #define wrap_subr(p) wrap_record (p, subr) |
1700 #define SUBRP(x) RECORDP (x, subr) | 1725 #define SUBRP(x) RECORDP (x, subr) |
1701 #define CHECK_SUBR(x) CHECK_RECORD (x, subr) | 1726 #define CHECK_SUBR(x) CHECK_RECORD (x, subr) |
1702 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr) | 1727 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr) |
1703 | 1728 |
1720 char insertion_type; | 1745 char insertion_type; |
1721 }; | 1746 }; |
1722 | 1747 |
1723 DECLARE_LRECORD (marker, Lisp_Marker); | 1748 DECLARE_LRECORD (marker, Lisp_Marker); |
1724 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker) | 1749 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker) |
1725 #define XSETMARKER(x, p) XSETRECORD (x, p, marker) | |
1726 #define wrap_marker(p) wrap_record (p, marker) | 1750 #define wrap_marker(p) wrap_record (p, marker) |
1727 #define MARKERP(x) RECORDP (x, marker) | 1751 #define MARKERP(x) RECORDP (x, marker) |
1728 #define CHECK_MARKER(x) CHECK_RECORD (x, marker) | 1752 #define CHECK_MARKER(x) CHECK_RECORD (x, marker) |
1729 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker) | 1753 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker) |
1730 | 1754 |
1776 }; | 1800 }; |
1777 typedef struct Lisp_Float Lisp_Float; | 1801 typedef struct Lisp_Float Lisp_Float; |
1778 | 1802 |
1779 DECLARE_LRECORD (float, Lisp_Float); | 1803 DECLARE_LRECORD (float, Lisp_Float); |
1780 #define XFLOAT(x) XRECORD (x, float, Lisp_Float) | 1804 #define XFLOAT(x) XRECORD (x, float, Lisp_Float) |
1781 #define XSETFLOAT(x, p) XSETRECORD (x, p, float) | |
1782 #define wrap_float(p) wrap_record (p, float) | 1805 #define wrap_float(p) wrap_record (p, float) |
1783 #define FLOATP(x) RECORDP (x, float) | 1806 #define FLOATP(x) RECORDP (x, float) |
1784 #define CHECK_FLOAT(x) CHECK_RECORD (x, float) | 1807 #define CHECK_FLOAT(x) CHECK_RECORD (x, float) |
1785 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float) | 1808 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float) |
1786 | 1809 |
1802 # define INT_OR_FLOATP(x) (INTP (x) || FLOATP (x)) | 1825 # define INT_OR_FLOATP(x) (INTP (x) || FLOATP (x)) |
1803 | 1826 |
1804 #else /* not LISP_FLOAT_TYPE */ | 1827 #else /* not LISP_FLOAT_TYPE */ |
1805 | 1828 |
1806 #define XFLOAT(x) --- error! No float support. --- | 1829 #define XFLOAT(x) --- error! No float support. --- |
1807 #define XSETFLOAT(x, p) --- error! No float support. --- | |
1808 #define FLOATP(x) 0 | 1830 #define FLOATP(x) 0 |
1809 #define CHECK_FLOAT(x) --- error! No float support. --- | 1831 #define CHECK_FLOAT(x) --- error! No float support. --- |
1810 #define CONCHECK_FLOAT(x) --- error! No float support. --- | 1832 #define CONCHECK_FLOAT(x) --- error! No float support. --- |
1811 | 1833 |
1812 #define XFLOATINT(n) XINT(n) | 1834 #define XFLOATINT(n) XINT(n) |
1980 Lisp_Object next_weak; /* don't mark through this! */ | 2002 Lisp_Object next_weak; /* don't mark through this! */ |
1981 }; | 2003 }; |
1982 | 2004 |
1983 DECLARE_LRECORD (weak_list, struct weak_list); | 2005 DECLARE_LRECORD (weak_list, struct weak_list); |
1984 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list) | 2006 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list) |
1985 #define XSETWEAK_LIST(x, p) XSETRECORD (x, p, weak_list) | |
1986 #define wrap_weak_list(p) wrap_record (p, weak_list) | 2007 #define wrap_weak_list(p) wrap_record (p, weak_list) |
1987 #define WEAK_LISTP(x) RECORDP (x, weak_list) | 2008 #define WEAK_LISTP(x) RECORDP (x, weak_list) |
1988 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list) | 2009 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list) |
1989 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list) | 2010 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list) |
1990 | 2011 |
2006 const struct lrecord_implementation *implementation; | 2027 const struct lrecord_implementation *implementation; |
2007 }; | 2028 }; |
2008 | 2029 |
2009 DECLARE_LRECORD (lcrecord_list, struct lcrecord_list); | 2030 DECLARE_LRECORD (lcrecord_list, struct lcrecord_list); |
2010 #define XLCRECORD_LIST(x) XRECORD (x, lcrecord_list, struct lcrecord_list) | 2031 #define XLCRECORD_LIST(x) XRECORD (x, lcrecord_list, struct lcrecord_list) |
2011 #define XSETLCRECORD_LIST(x, p) XSETRECORD (x, p, lcrecord_list) | |
2012 #define wrap_lcrecord_list(p) wrap_record (p, lcrecord_list) | 2032 #define wrap_lcrecord_list(p) wrap_record (p, lcrecord_list) |
2013 #define LCRECORD_LISTP(x) RECORDP (x, lcrecord_list) | 2033 #define LCRECORD_LISTP(x) RECORDP (x, lcrecord_list) |
2014 /* #define CHECK_LCRECORD_LIST(x) CHECK_RECORD (x, lcrecord_list) | 2034 /* #define CHECK_LCRECORD_LIST(x) CHECK_RECORD (x, lcrecord_list) |
2015 Lcrecord lists should never escape to the Lisp level, so | 2035 Lcrecord lists should never escape to the Lisp level, so |
2016 functions should not be doing this. */ | 2036 functions should not be doing this. */ |
3217 DECLARE_DOESNT_RETURN (gui_error_2 (const char *reason, | 3237 DECLARE_DOESNT_RETURN (gui_error_2 (const char *reason, |
3218 Lisp_Object frob0, Lisp_Object frob1)); | 3238 Lisp_Object frob0, Lisp_Object frob1)); |
3219 /* Defined in indent.c */ | 3239 /* Defined in indent.c */ |
3220 int bi_spaces_at_point (struct buffer *, Bytebpos); | 3240 int bi_spaces_at_point (struct buffer *, Bytebpos); |
3221 int column_at_point (struct buffer *, Charbpos, int); | 3241 int column_at_point (struct buffer *, Charbpos, int); |
3222 int string_column_at_point (Lisp_String *, Charbpos, int); | 3242 int string_column_at_point (Lisp_Object, Charbpos, int); |
3223 int current_column (struct buffer *); | 3243 int current_column (struct buffer *); |
3224 void invalidate_current_column (void); | 3244 void invalidate_current_column (void); |
3225 Charbpos vmotion (struct window *, Charbpos, int, int *); | 3245 Charbpos vmotion (struct window *, Charbpos, int, int *); |
3226 Charbpos vmotion_pixels (Lisp_Object, Charbpos, int, int, int *); | 3246 Charbpos vmotion_pixels (Lisp_Object, Charbpos, int, int, int *); |
3227 | 3247 |
3240 | 3260 |
3241 extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode; | 3261 extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode; |
3242 extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode; | 3262 extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode; |
3243 | 3263 |
3244 /* Defined in keymap.c */ | 3264 /* Defined in keymap.c */ |
3245 void where_is_to_char (Lisp_Object, char *); | 3265 void where_is_to_char (Lisp_Object, Eistring *); |
3246 | 3266 |
3247 /* Defined in lread.c */ | 3267 /* Defined in lread.c */ |
3248 void ebolify_bytecode_constants (Lisp_Object); | 3268 void ebolify_bytecode_constants (Lisp_Object); |
3249 void close_load_descs (void); | 3269 void close_load_descs (void); |
3250 int locate_file (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int); | 3270 int locate_file (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int); |
3324 void write_c_string (const CIntbyte *str, Lisp_Object stream); | 3344 void write_c_string (const CIntbyte *str, Lisp_Object stream); |
3325 /* Same goes for this function. */ | 3345 /* Same goes for this function. */ |
3326 void write_string (const Intbyte *str, Lisp_Object stream); | 3346 void write_string (const Intbyte *str, Lisp_Object stream); |
3327 /* Same goes for this function. */ | 3347 /* Same goes for this function. */ |
3328 void write_string_1 (const Intbyte *str, Bytecount size, Lisp_Object stream); | 3348 void write_string_1 (const Intbyte *str, Bytecount size, Lisp_Object stream); |
3349 void write_eistring (const Eistring *ei, Lisp_Object stream); | |
3329 | 3350 |
3330 /* Higher-level (printf-style) ways to output data: */ | 3351 /* Higher-level (printf-style) ways to output data: */ |
3331 void write_fmt_string (Lisp_Object stream, const CIntbyte *fmt, ...); | 3352 void write_fmt_string (Lisp_Object stream, const CIntbyte *fmt, ...); |
3332 void write_fmt_string_lisp (Lisp_Object stream, const CIntbyte *fmt, | 3353 void write_fmt_string_lisp (Lisp_Object stream, const CIntbyte *fmt, |
3333 int nargs, ...); | 3354 int nargs, ...); |
3392 struct re_registers; | 3413 struct re_registers; |
3393 Charbpos scan_buffer (struct buffer *, Emchar, Charbpos, Charbpos, EMACS_INT, EMACS_INT *, int); | 3414 Charbpos scan_buffer (struct buffer *, Emchar, Charbpos, Charbpos, EMACS_INT, EMACS_INT *, int); |
3394 Charbpos find_next_newline (struct buffer *, Charbpos, int); | 3415 Charbpos find_next_newline (struct buffer *, Charbpos, int); |
3395 Charbpos find_next_newline_no_quit (struct buffer *, Charbpos, int); | 3416 Charbpos find_next_newline_no_quit (struct buffer *, Charbpos, int); |
3396 Bytebpos bi_find_next_newline_no_quit (struct buffer *, Bytebpos, int); | 3417 Bytebpos bi_find_next_newline_no_quit (struct buffer *, Bytebpos, int); |
3397 Bytebpos bi_find_next_emchar_in_string (Lisp_String*, Emchar, Bytebpos, EMACS_INT); | 3418 Bytebpos bi_find_next_emchar_in_string (Lisp_Object, Emchar, Bytebpos, EMACS_INT); |
3398 Charbpos find_before_next_newline (struct buffer *, Charbpos, Charbpos, int); | 3419 Charbpos find_before_next_newline (struct buffer *, Charbpos, Charbpos, int); |
3399 struct re_pattern_buffer *compile_pattern (Lisp_Object, struct re_registers *, | 3420 struct re_pattern_buffer *compile_pattern (Lisp_Object, struct re_registers *, |
3400 Lisp_Object, int, Error_Behavior); | 3421 Lisp_Object, int, Error_Behavior); |
3401 Bytecount fast_string_match (Lisp_Object, const Intbyte *, | 3422 Bytecount fast_string_match (Lisp_Object, const Intbyte *, |
3402 Lisp_Object, Bytecount, | 3423 Lisp_Object, Bytecount, |