comparison src/lisp.h @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents b1f74adcc1ff
children 79940b592197
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
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 Ben Wing. 4 Copyright (C) 1995, 1996, 2000, 2001, 2002 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
116 follows. Extbyte is guaranteed to be just a char, so for example 116 follows. Extbyte is guaranteed to be just a char, so for example
117 strlen (Extbyte *) is OK. Extbyte is only a documentation device 117 strlen (Extbyte *) is OK. Extbyte is only a documentation device
118 for referring to external text. */ 118 for referring to external text. */
119 119
120 typedef char Extbyte; 120 typedef char Extbyte;
121 typedef unsigned char UExtbyte;
121 122
122 /* A byte in a string in binary format: */ 123 /* A byte in a string in binary format: */
123 typedef char Char_Binary; 124 typedef char Char_Binary;
124 typedef signed char SChar_Binary; 125 typedef signed char SChar_Binary;
125 typedef unsigned char UChar_Binary; 126 typedef unsigned char UChar_Binary;
150 typedef EMACS_INT Membpos; 151 typedef EMACS_INT Membpos;
151 152
152 /* Counts of bytes or chars */ 153 /* Counts of bytes or chars */
153 typedef EMACS_INT Bytecount; 154 typedef EMACS_INT Bytecount;
154 typedef EMACS_INT Charcount; 155 typedef EMACS_INT Charcount;
155
156 /* Counts of elements */ 156 /* Counts of elements */
157 typedef EMACS_INT Elemcount; 157 typedef EMACS_INT Elemcount;
158
159 /* Hash codes */ 158 /* Hash codes */
160 typedef unsigned long Hashcode; 159 typedef unsigned long Hashcode;
160
161 #ifdef HAVE_INTTYPES_H
162 #include <inttypes.h>
163 #elif SIZEOF_VOID_P == SIZEOF_INT
164 typedef int intptr_t;
165 typedef unsigned int uintptr_t;
166 #elif SIZEOF_VOID_P == SIZEOF_LONG
167 typedef long intptr_t;
168 typedef unsigned long uintptr_t;
169 #elif defined(SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG
170 typedef long long intptr_t;
171 typedef unsigned long long uintptr_t;
172 #else
173 /* Just pray. May break, may not. */
174 typedef long intptr_t;
175 typedef unsigned long uintptr_t;
176 #endif
161 177
162 /* ------------------------ dynamic arrays ------------------- */ 178 /* ------------------------ dynamic arrays ------------------- */
163 179
164 #define Dynarr_declare(type) \ 180 #define Dynarr_declare(type) \
165 type *base; \ 181 type *base; \
192 #define Dynarr_reset(d) ((d)->cur = 0) 208 #define Dynarr_reset(d) ((d)->cur = 0)
193 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur) 209 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur)
194 #define Dynarr_insert_many_at_start(d, el, len) \ 210 #define Dynarr_insert_many_at_start(d, el, len) \
195 Dynarr_insert_many (d, el, len, 0) 211 Dynarr_insert_many (d, el, len, 0)
196 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1) 212 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1)
197 #define Dynarr_add_lisp_string(d, s) do { \ 213 #define Dynarr_add_lisp_string(d, s, codesys) \
198 Lisp_String *dyna_ls_s = XSTRING (s); \ 214 do { \
199 Dynarr_add_many (d, (char *) string_data (dyna_ls_s), \ 215 Lisp_Object dyna_ls_s = (s); \
200 string_length (dyna_ls_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); \
201 } while (0) 224 } while (0)
202 225
203 #define Dynarr_add(d, el) ( \ 226 #define Dynarr_add(d, el) ( \
204 (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : (void) 0, \ 227 (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : (void) 0, \
205 ((d)->base)[(d)->cur++] = (el), \ 228 ((d)->base)[(d)->cur++] = (el), \
207 230
208 /* The following defines will get you into real trouble if you aren't 231 /* The following defines will get you into real trouble if you aren't
209 careful. But they can save a lot of execution time when used wisely. */ 232 careful. But they can save a lot of execution time when used wisely. */
210 #define Dynarr_increment(d) ((d)->cur++) 233 #define Dynarr_increment(d) ((d)->cur++)
211 #define Dynarr_set_size(d, n) ((d)->cur = n) 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)
212 241
213 #ifdef MEMORY_USAGE_STATS 242 #ifdef MEMORY_USAGE_STATS
214 struct overhead_stats; 243 struct overhead_stats;
215 Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats); 244 Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats);
216 #endif 245 #endif
238 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type))) 267 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type)))
239 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type))) 268 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type)))
240 #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue))) 269 #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue)))
241 #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type))) 270 #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type)))
242 #define XREALLOC_ARRAY(ptr, type, len) ((void) (ptr = (type *) xrealloc (ptr, (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)))
243 #define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type))) 273 #define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type)))
244 274
245 /* also generally useful if you want to avoid arbitrary size limits 275 /* also generally useful if you want to avoid arbitrary size limits
246 but don't need a full dynamic array. Assumes that BASEVAR points 276 but don't need a full dynamic array. Assumes that BASEVAR points
247 to a malloced array of TYPE objects (or possibly a NULL pointer, 277 to a malloced array of TYPE objects (or possibly a NULL pointer,
305 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \ 335 # define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
306 extern void decl PRINTF_ARGS(str,idx) 336 extern void decl PRINTF_ARGS(str,idx)
307 # endif /* GNUC */ 337 # endif /* GNUC */
308 #endif 338 #endif
309 339
340 /* Another try to fix SunPro C compiler warnings */
341 /* "end-of-loop code not reached" */
342 /* "statement not reached */
343 #if defined __SUNPRO_C || defined __USLC__
344 #define RETURN_SANS_WARNINGS if (1) return
345 #define RETURN_NOT_REACHED(value)
346 #else
347 #define RETURN_SANS_WARNINGS return
348 #define RETURN_NOT_REACHED(value) return value;
349 #endif
350
310 /* No type has a greater alignment requirement than max_align_t. 351 /* No type has a greater alignment requirement than max_align_t.
311 (except perhaps for types we don't use, like long double) */ 352 (except perhaps for types we don't use, like long double) */
312 typedef union 353 typedef union
313 { 354 {
314 struct { long l; } l; 355 struct { long l; } l;
315 struct { void *p; } p; 356 struct { void *p; } p;
316 struct { void (*f)(void); } f; 357 struct { void (*f)(void); } f;
317 struct { double d; } d; 358 struct { double d; } d;
318 } max_align_t; 359 } max_align_t;
360
361 /* ALIGNOF returns the required alignment of a type -- i.e. a value such
362 that data of this type must begin at a memory address which is a
363 multiple of that value. For simple types, this is often the same size
364 as the type itself. */
319 365
320 #ifndef ALIGNOF 366 #ifndef ALIGNOF
321 # if defined (__GNUC__) && (__GNUC__ >= 2) 367 # if defined (__GNUC__) && (__GNUC__ >= 2)
322 /* gcc has an extension that gives us exactly what we want. */ 368 /* gcc has an extension that gives us exactly what we want. */
323 # define ALIGNOF(type) __alignof__ (type) 369 # define ALIGNOF(type) __alignof__ (type)
335 template<typename T> struct alignment_trick { char c; T member; }; 381 template<typename T> struct alignment_trick { char c; T member; };
336 # define ALIGNOF(type) offsetof (alignment_trick<type>, member) 382 # define ALIGNOF(type) offsetof (alignment_trick<type>, member)
337 # endif 383 # endif
338 #endif /* ALIGNOF */ 384 #endif /* ALIGNOF */
339 385
386 /* ALIGN_SIZE returns the smallest size greater than or equal to LEN which
387 is a multiple of UNIT. This can be used to assure that data that
388 follows a block of the returned size is of correct alignment for a type
389 whose alignment (as returned by ALIGNOF) is UNIT (provided that the
390 block itself is correctly aligned for this type; memory returned by
391 malloc() is guaranteed to be correctly aligned for all types). */
392
340 #define ALIGN_SIZE(len, unit) \ 393 #define ALIGN_SIZE(len, unit) \
341 ((((len) + (unit) - 1) / (unit)) * (unit)) 394 ((((len) + (unit) - 1) / (unit)) * (unit))
395
396 /* MAX_ALIGN_SIZE returns the smallest size greater than or equal to LEN
397 which guarantees that data following a block of such size is correctly
398 aligned for all types (provided that the block itself is so aligned,
399 which is the case for memory returned by malloc()). */
400
401 #define MAX_ALIGN_SIZE(len) ALIGN_SIZE (len, ALIGNOF (max_align_t))
342 402
343 /* #### Yuck, this is kind of evil */ 403 /* #### Yuck, this is kind of evil */
344 #define ALIGN_PTR(ptr, unit) \ 404 #define ALIGN_PTR(ptr, unit) \
345 ((void *) ALIGN_SIZE ((size_t) (ptr), unit)) 405 ((void *) ALIGN_SIZE ((size_t) (ptr), unit))
346 406
353 #endif 413 #endif
354 414
355 /* We define assert iff USE_ASSERTIONS or DEBUG_XEMACS is defined. 415 /* We define assert iff USE_ASSERTIONS or DEBUG_XEMACS is defined.
356 Otherwise we define it to be empty. Quantify has shown that the 416 Otherwise we define it to be empty. Quantify has shown that the
357 time the assert checks take is measurable so let's not include them 417 time the assert checks take is measurable so let's not include them
358 in production binaries. */ 418 in production binaries.
419
420 assert() returns 1 if the assert succeeded (or wasn't tried), 0 if
421 failed. (Normally, it would have aborted here, but with
422 ASSERTIONS_DONT_ABORT defined, it will continue. */
359 423
360 #ifdef USE_ASSERTIONS 424 #ifdef USE_ASSERTIONS
361 /* Highly dubious kludge */ 425 /* Highly dubious kludge */
362 /* (thanks, Jamie, I feel better now -- ben) */ 426 /* (thanks, Jamie, I feel better now -- ben) */
363 void assert_failed (const char *, int, const char *); 427 void assert_failed (const char *, int, const char *);
365 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x)) 429 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
366 #else 430 #else
367 # ifdef DEBUG_XEMACS 431 # ifdef DEBUG_XEMACS
368 # define assert(x) ((x) ? (void) 0 : (void) abort ()) 432 # define assert(x) ((x) ? (void) 0 : (void) abort ())
369 # else 433 # else
370 # define assert(x) 434 # define assert(x) ((void) 0)
371 # endif 435 # endif
372 #endif 436 #endif
437
438 #if 0
439 #ifdef USE_ASSERTIONS
440 /* Highly dubious kludge */
441 /* (thanks, Jamie, I feel better now -- ben) */
442 void assert_failed (const char *, int, const char *);
443 # define abort() (assert_failed (__FILE__, __LINE__, "abort()"))
444 # define assert(x) ((x) ? 1 : (assert_failed (__FILE__, __LINE__, #x), 0))
445 #else
446 # ifdef DEBUG_XEMACS
447 # define assert(x) ((x) ? 1 : ((void) abort (), 0))
448 # else
449 # define assert(x) (1)
450 # endif
451 #endif
452 #endif /* 0 */
373 453
374 /*#ifdef DEBUG_XEMACS*/ 454 /*#ifdef DEBUG_XEMACS*/
375 #define REGISTER 455 #define REGISTER
376 #define register 456 #define register
377 /*#else*/ 457 /*#else*/
389 /* We put typedefs here so that prototype declarations don't choke. 469 /* We put typedefs here so that prototype declarations don't choke.
390 Note that we don't actually declare the structures here (except 470 Note that we don't actually declare the structures here (except
391 maybe for simple structures like Dynarrs); that keeps them private 471 maybe for simple structures like Dynarrs); that keeps them private
392 to the routines that actually use them. */ 472 to the routines that actually use them. */
393 473
394 typedef struct lstream Lstream; 474 /* ------------------------------- */
395 475 /* Error_Behavior typedefs */
396 typedef int face_index; 476 /* ------------------------------- */
397 477
398 typedef struct 478 #ifndef ERROR_CHECK_TYPECHECK
399 { 479
400 Dynarr_declare (struct face_cachel); 480 typedef enum error_behavior
401 } face_cachel_dynarr; 481 {
402 482 ERROR_ME,
403 typedef int glyph_index; 483 ERROR_ME_NOT,
404 484 ERROR_ME_WARN
405 /* This is shared by process.h, events.h and others in future. 485 } Error_Behavior;
406 See events.h for description */ 486
407 typedef unsigned int USID; 487 #define ERRB_EQ(a, b) ((a) == (b))
408 488
409 typedef struct 489 #else
410 { 490
411 Dynarr_declare (struct glyph_cachel); 491 /* By defining it like this, we provide strict type-checking
412 } glyph_cachel_dynarr; 492 for code that lazily uses ints. */
493
494 typedef struct _error_behavior_struct_
495 {
496 int really_unlikely_name_to_have_accidentally_in_a_non_errb_structure;
497 } Error_Behavior;
498
499 extern Error_Behavior ERROR_ME;
500 extern Error_Behavior ERROR_ME_NOT;
501 extern Error_Behavior ERROR_ME_WARN;
502
503 #define ERRB_EQ(a, b) \
504 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \
505 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure)
506
507 #endif
508
509 /* ------------------------------- */
510 /* Empty structures and typedefs */
511 /* ------------------------------- */
413 512
414 struct buffer; /* "buffer.h" */ 513 struct buffer; /* "buffer.h" */
415 struct console; /* "console.h" */ 514 struct console; /* "console.h" */
416 struct device; /* "device.h" */ 515 struct device; /* "device.h" */
417 struct extent_fragment; 516 struct extent_fragment;
418 struct extent; 517 struct extent;
419 typedef struct extent *EXTENT;
420 struct frame; /* "frame.h" */ 518 struct frame; /* "frame.h" */
421 struct window; /* "window.h" */ 519 struct window; /* "window.h" */
422 typedef struct Lisp_Event Lisp_Event; /* "events.h" */
423 typedef struct Lisp_Face Lisp_Face; /* "faces.h" */
424 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */
425 struct stat; /* <sys/stat.h> */ 520 struct stat; /* <sys/stat.h> */
426 typedef struct Lisp_Color_Instance Lisp_Color_Instance; 521 struct utimbuf; /* "systime.h" or <utime.h> */
427 typedef struct Lisp_Font_Instance Lisp_Font_Instance;
428 typedef struct Lisp_Image_Instance Lisp_Image_Instance;
429 typedef struct Lisp_Gui_Item Lisp_Gui_Item;
430 struct display_line; 522 struct display_line;
431 struct display_glyph_area; 523 struct display_glyph_area;
432 struct display_box; 524 struct display_box;
433 struct redisplay_info; 525 struct redisplay_info;
434 struct window_mirror; 526 struct window_mirror;
435 struct scrollbar_instance; 527 struct scrollbar_instance;
436 struct font_metric_info; 528 struct font_metric_info;
437 struct face_cachel; 529 struct face_cachel;
438 struct console_type_entry; 530 struct console_type_entry;
439 531
532 /* This is shared by process.h, events.h and others in future.
533 See events.h for description */
534 typedef unsigned int USID;
535 typedef int face_index;
536 typedef int glyph_index;
537 typedef struct lstream Lstream;
538 typedef struct extent *EXTENT;
539 typedef struct Lisp_Event Lisp_Event; /* "events.h" */
540 typedef struct Lisp_Face Lisp_Face; /* "faces.h" */
541 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */
542 typedef struct Lisp_Color_Instance Lisp_Color_Instance;
543 typedef struct Lisp_Font_Instance Lisp_Font_Instance;
544 typedef struct Lisp_Image_Instance Lisp_Image_Instance;
545 typedef struct Lisp_Gui_Item Lisp_Gui_Item;
546
547 /* ------------------------------- */
548 /* Dynarr typedefs */
549 /* ------------------------------- */
550
551 /* Dynarr typedefs -- basic types first */
552
440 typedef struct 553 typedef struct
441 { 554 {
442 Dynarr_declare (Intbyte); 555 Dynarr_declare (Intbyte);
443 } Intbyte_dynarr; 556 } Intbyte_dynarr;
444 557
455 typedef struct 568 typedef struct
456 { 569 {
457 Dynarr_declare (char); 570 Dynarr_declare (char);
458 } char_dynarr; 571 } char_dynarr;
459 572
573 typedef struct
574 {
575 Dynarr_declare (char *);
576 } char_ptr_dynarr;
577
460 typedef unsigned char unsigned_char; 578 typedef unsigned char unsigned_char;
461 typedef struct 579 typedef struct
462 { 580 {
463 Dynarr_declare (unsigned char); 581 Dynarr_declare (unsigned char);
464 } unsigned_char_dynarr; 582 } unsigned_char_dynarr;
492 typedef struct 610 typedef struct
493 { 611 {
494 Dynarr_declare (Bytecount); 612 Dynarr_declare (Bytecount);
495 } Bytecount_dynarr; 613 } Bytecount_dynarr;
496 614
615 /* Dynarr typedefs -- more complex types */
616
617 typedef struct
618 {
619 Dynarr_declare (struct face_cachel);
620 } face_cachel_dynarr;
621
622 typedef struct
623 {
624 Dynarr_declare (struct glyph_cachel);
625 } glyph_cachel_dynarr;
626
497 typedef struct 627 typedef struct
498 { 628 {
499 Dynarr_declare (struct console_type_entry); 629 Dynarr_declare (struct console_type_entry);
500 } console_type_entry_dynarr; 630 } console_type_entry_dynarr;
631
632 /* ------------------------------- */
633 /* enum typedefs */
634 /* ------------------------------- */
501 635
502 enum run_hooks_condition 636 enum run_hooks_condition
503 { 637 {
504 RUN_HOOKS_TO_COMPLETION, 638 RUN_HOOKS_TO_COMPLETION,
505 RUN_HOOKS_UNTIL_SUCCESS, 639 RUN_HOOKS_UNTIL_SUCCESS,
522 EDGE_ETCHED_OUT, 656 EDGE_ETCHED_OUT,
523 EDGE_BEVEL_IN, 657 EDGE_BEVEL_IN,
524 EDGE_BEVEL_OUT 658 EDGE_BEVEL_OUT
525 }; 659 };
526 660
527 #ifndef ERROR_CHECK_TYPECHECK
528
529 typedef enum error_behavior
530 {
531 ERROR_ME,
532 ERROR_ME_NOT,
533 ERROR_ME_WARN
534 } Error_Behavior;
535
536 #define ERRB_EQ(a, b) ((a) == (b))
537
538 #else
539
540 /* By defining it like this, we provide strict type-checking
541 for code that lazily uses ints. */
542
543 typedef struct _error_behavior_struct_
544 {
545 int really_unlikely_name_to_have_accidentally_in_a_non_errb_structure;
546 } Error_Behavior;
547
548 extern Error_Behavior ERROR_ME;
549 extern Error_Behavior ERROR_ME_NOT;
550 extern Error_Behavior ERROR_ME_WARN;
551
552 #define ERRB_EQ(a, b) \
553 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \
554 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure)
555
556 #endif
557
558 enum munge_me_out_the_door 661 enum munge_me_out_the_door
559 { 662 {
560 MUNGE_ME_FUNCTION_KEY, 663 MUNGE_ME_FUNCTION_KEY,
561 MUNGE_ME_KEY_TRANSLATION 664 MUNGE_ME_KEY_TRANSLATION
562 }; 665 };
666
667 /* ------------------------------- */
668 /* misc */
669 /* ------------------------------- */
670
671 #ifdef MEMORY_USAGE_STATS
672
673 /* This structure is used to keep statistics on the amount of memory
674 in use.
675
676 WAS_REQUESTED stores the actual amount of memory that was requested
677 of the allocation function. The *_OVERHEAD fields store the
678 additional amount of memory that was grabbed by the functions to
679 facilitate allocation, reallocation, etc. MALLOC_OVERHEAD is for
680 memory allocated with malloc(); DYNARR_OVERHEAD is for dynamic
681 arrays; GAP_OVERHEAD is for gap arrays. Note that for (e.g.)
682 dynamic arrays, there is both MALLOC_OVERHEAD and DYNARR_OVERHEAD
683 memory: The dynamic array allocates memory above and beyond what
684 was asked of it, and when it in turns allocates memory using
685 malloc(), malloc() allocates memory beyond what it was asked
686 to allocate.
687
688 Functions that accept a structure of this sort do not initialize
689 the fields to 0, and add any existing values to whatever was there
690 before; this way, you can get a cumulative effect. */
691
692 struct overhead_stats
693 {
694 int was_requested;
695 int malloc_overhead;
696 int dynarr_overhead;
697 int gap_overhead;
698 };
699
700 #endif /* MEMORY_USAGE_STATS */
563 701
564 702
565 /************************************************************************/ 703 /************************************************************************/
566 /* Definition of Lisp_Object data type */ 704 /* Definition of Lisp_Object data type */
567 /************************************************************************/ 705 /************************************************************************/
647 symbol-value-forward), that can never be visible to 785 symbol-value-forward), that can never be visible to
648 the Lisp caller and thus can be used in the C code 786 the Lisp caller and thus can be used in the C code
649 to mean "no such value". */ 787 to mean "no such value". */
650 788
651 #define UNBOUNDP(val) EQ (val, Qunbound) 789 #define UNBOUNDP(val) EQ (val, Qunbound)
790
791 /* Evaluate expr, return it if it's not Qunbound. */
792 #define RETURN_IF_NOT_UNBOUND(expr) do \
793 { \
794 Lisp_Object ret_nunb_val = (expr); \
795 if (!UNBOUNDP (ret_nunb_val)) \
796 RETURN_SANS_WARNINGS ret_nunb_val; \
797 } while (0)
652 798
653 /*------------------------------- cons ---------------------------------*/ 799 /*------------------------------- cons ---------------------------------*/
654 800
655 /* In a cons, the markbit of the car is the gc mark bit */ 801 /* In a cons, the markbit of the car is the gc mark bit */
656 802
1152 1298
1153 /*------------------------------ string --------------------------------*/ 1299 /*------------------------------ string --------------------------------*/
1154 1300
1155 struct Lisp_String 1301 struct Lisp_String
1156 { 1302 {
1157 struct lrecord_header lheader; 1303 union
1304 {
1305 struct lrecord_header lheader;
1306 struct
1307 {
1308 /* WARNING: Everything before ascii_begin must agree exactly with
1309 struct lrecord_header */
1310 unsigned int type :8;
1311 unsigned int mark :1;
1312 unsigned int c_readonly :1;
1313 unsigned int lisp_readonly :1;
1314 /* Number of chars at beginning of string that are one byte in length
1315 (BYTE_ASCII_P) */
1316 unsigned int ascii_begin :21;
1317 } v;
1318 } u;
1158 Bytecount size; 1319 Bytecount size;
1159 Intbyte *data; 1320 Intbyte *data;
1160 Lisp_Object plist; 1321 Lisp_Object plist;
1161 }; 1322 };
1162 typedef struct Lisp_String Lisp_String; 1323 typedef struct Lisp_String Lisp_String;
1324
1325 #define MAX_STRING_ASCII_BEGIN ((2 << 21) - 1)
1163 1326
1164 DECLARE_LRECORD (string, Lisp_String); 1327 DECLARE_LRECORD (string, Lisp_String);
1165 #define XSTRING(x) XRECORD (x, string, Lisp_String) 1328 #define XSTRING(x) XRECORD (x, string, Lisp_String)
1166 #define XSETSTRING(x, p) XSETRECORD (x, p, string) 1329 #define XSETSTRING(x, p) XSETRECORD (x, p, string)
1167 #define wrap_string(p) wrap_record (p, string) 1330 #define wrap_string(p) wrap_record (p, string)
1181 1344
1182 #endif /* not MULE */ 1345 #endif /* not MULE */
1183 1346
1184 #define string_length(s) ((s)->size) 1347 #define string_length(s) ((s)->size)
1185 #define XSTRING_LENGTH(s) string_length (XSTRING (s)) 1348 #define XSTRING_LENGTH(s) string_length (XSTRING (s))
1186 #define XSTRING_CHAR_LENGTH(s) string_char_length (XSTRING (s))
1187 #define string_data(s) ((s)->data + 0) 1349 #define string_data(s) ((s)->data + 0)
1188 #define XSTRING_DATA(s) string_data (XSTRING (s)) 1350 #define XSTRING_DATA(s) string_data (XSTRING (s))
1351 #define string_ascii_begin(s) ((s)->u.v.ascii_begin + 0)
1352 #define XSTRING_ASCII_BEGIN(s) string_ascii_begin (XSTRING (s))
1353 #define string_char_length(s) string_index_byte_to_char (s, string_length (s))
1354 #define XSTRING_CHAR_LENGTH(s) string_char_length (XSTRING (s))
1189 #define string_byte(s, i) ((s)->data[i] + 0) 1355 #define string_byte(s, i) ((s)->data[i] + 0)
1190 #define XSTRING_BYTE(s, i) string_byte (XSTRING (s), i) 1356 #define XSTRING_BYTE(s, i) string_byte (XSTRING (s), i)
1191 #define string_byte_addr(s, i) (&((s)->data[i])) 1357 #define string_byte_addr(s, i) (&((s)->data[i]))
1358 #define string_char(s, i) charptr_emchar (string_char_addr (s, i))
1359 #define XSTRING_CHAR(s, i) string_char (XSTRING (s), i)
1360 #define XSTRING_INDEX_CHAR_TO_BYTE(s, idx) \
1361 string_index_char_to_byte (XSTRING (s), idx)
1362 #define XSTRING_INDEX_BYTE_TO_CHAR(s, idx) \
1363 string_index_byte_to_char (XSTRING (s), idx)
1364 #define XSTRING_OFFSET_BYTE_TO_CHAR_LEN(s, off, len) \
1365 string_offset_byte_to_char_len (XSTRING (s), off, len)
1366 #define XSTRING_OFFSET_CHAR_TO_BYTE_LEN(s, off, len) \
1367 string_offset_char_to_byte_len (XSTRING (s), off, len)
1192 #define set_string_length(s, len) ((void) ((s)->size = (len))) 1368 #define set_string_length(s, len) ((void) ((s)->size = (len)))
1193 #define set_string_data(s, ptr) ((void) ((s)->data = (ptr))) 1369 #define set_string_data(s, ptr) ((void) ((s)->data = (ptr)))
1370 /* WARNING: If you modify an existing string, you must call
1371 bump_string_modiff() afterwards. */
1194 #define set_string_byte(s, i, b) ((void) ((s)->data[i] = (b))) 1372 #define set_string_byte(s, i, b) ((void) ((s)->data[i] = (b)))
1373 #define set_string_ascii_begin(s, val) ((void) ((s)->u.v.ascii_begin = (val)))
1374
1375 #ifdef ERROR_CHECK_CHARBPOS
1376 #define SLEDGEHAMMER_CHECK_ASCII_BEGIN
1377 #endif
1378
1379 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN
1380 void sledgehammer_check_ascii_begin (Lisp_Object str);
1381 #else
1382 #define sledgehammer_check_ascii_begin(str)
1383 #endif
1384
1385 /* Make an alloca'd copy of a Lisp string */
1386 #define LISP_STRING_TO_ALLOCA(s, lval) \
1387 do { \
1388 Intbyte **_lta_ = (Intbyte **) &(lval); \
1389 Lisp_Object _lta_2 = (s); \
1390 *_lta_ = alloca_array (Intbyte, 1 + XSTRING_LENGTH (_lta_2)); \
1391 memcpy (*_lta_, XSTRING_DATA (_lta_2), 1 + XSTRING_LENGTH (_lta_2)); \
1392 } while (0)
1393
1394 /* Make an alloca'd copy of a Intbyte * */
1395 #define INTBYTE_STRING_TO_ALLOCA(p, lval) \
1396 do { \
1397 Intbyte **_bsta_ = (Intbyte **) &(lval); \
1398 const Intbyte *_bsta_2 = (p); \
1399 Bytecount _bsta_3 = qxestrlen (_bsta_2); \
1400 *_bsta_ = alloca_array (Intbyte, 1 + _bsta_3); \
1401 memcpy (*_bsta_, _bsta_2, 1 + _bsta_3); \
1402 } while (0)
1403
1404 #define alloca_intbytes(num) alloca_array (Intbyte, num)
1405 #define alloca_extbytes(num) alloca_array (Extbyte, num)
1195 1406
1196 void resize_string (Lisp_String *s, Bytecount pos, Bytecount delta); 1407 void resize_string (Lisp_String *s, Bytecount pos, Bytecount delta);
1197 1408
1198 #ifdef MULE 1409 #ifdef MULE
1199 1410
1200 INLINE_HEADER Charcount string_char_length (Lisp_String *s); 1411 /* Convert a byte index into a string into a char index. */
1201 INLINE_HEADER Charcount 1412 DECLARE_INLINE_HEADER (
1202 string_char_length (Lisp_String *s) 1413 Charcount
1203 { 1414 string_index_byte_to_char (Lisp_String *s, Bytecount idx)
1204 return bytecount_to_charcount (string_data (s), string_length (s)); 1415 )
1416 {
1417 Charcount retval;
1418 if (idx <= (Bytecount) string_ascii_begin (s))
1419 retval = idx;
1420 else
1421 retval = (string_ascii_begin (s) +
1422 bytecount_to_charcount (string_data (s) + string_ascii_begin (s),
1423 idx - string_ascii_begin (s)));
1424 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN
1425 assert (retval == bytecount_to_charcount (string_data (s), idx));
1426 #endif
1427 return retval;
1205 } 1428 }
1206 1429
1207 # define string_char(s, i) charptr_emchar_n (string_data (s), i) 1430 /* Convert a char index into a string into a byte index. */
1208 # define string_char_addr(s, i) charptr_n_addr (string_data (s), i) 1431 DECLARE_INLINE_HEADER (
1432 Bytecount
1433 string_index_char_to_byte (Lisp_String *s, Charcount idx)
1434 )
1435 {
1436 Bytecount retval;
1437 if (idx <= (Charcount) string_ascii_begin (s))
1438 retval = idx;
1439 else
1440 retval = (string_ascii_begin (s) +
1441 charcount_to_bytecount (string_data (s) + string_ascii_begin (s),
1442 idx - string_ascii_begin (s)));
1443 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN
1444 assert (retval == charcount_to_bytecount (string_data (s), idx));
1445 #endif
1446 return retval;
1447 }
1448
1449 /* Convert a substring length (starting at byte offset OFF) from bytes to
1450 chars. */
1451 DECLARE_INLINE_HEADER (
1452 Charcount
1453 string_offset_byte_to_char_len (Lisp_String *s, Bytecount off, Bytecount len)
1454 )
1455 {
1456 Charcount retval;
1457 if (off + len <= (Bytecount) string_ascii_begin (s))
1458 retval = len;
1459 else if (off < (Bytecount) string_ascii_begin (s))
1460 retval =
1461 string_ascii_begin (s) - off +
1462 bytecount_to_charcount (string_data (s) + string_ascii_begin (s),
1463 len - (string_ascii_begin (s) - off));
1464 else
1465 retval = bytecount_to_charcount (string_data (s) + off, len);
1466 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN
1467 assert (retval == bytecount_to_charcount (string_data (s) + off, len));
1468 #endif
1469 return retval;
1470 }
1471
1472 /* Convert a substring length (starting at byte offset OFF) from chars to
1473 bytes. */
1474 DECLARE_INLINE_HEADER (
1475 Bytecount
1476 string_offset_char_to_byte_len (Lisp_String *s, Bytecount off, Charcount len)
1477 )
1478 {
1479 Bytecount retval;
1480 if (off + len <= (Bytecount) string_ascii_begin (s))
1481 retval = len;
1482 else if (off < (Bytecount) string_ascii_begin (s))
1483 retval =
1484 string_ascii_begin (s) - off +
1485 charcount_to_bytecount (string_data (s) + string_ascii_begin (s),
1486 len - (string_ascii_begin (s) - off));
1487 else
1488 retval = charcount_to_bytecount (string_data (s) + off, len);
1489 #ifdef SLEDGEHAMMER_CHECK_ASCII_BEGIN
1490 assert (retval == charcount_to_bytecount (string_data (s) + off, len));
1491 #endif
1492 return retval;
1493 }
1494
1495 DECLARE_INLINE_HEADER (
1496 Intbyte *
1497 string_char_addr (Lisp_String *s, Charcount idx)
1498 )
1499 {
1500 return string_data (s) + string_index_char_to_byte (s, idx);
1501 }
1502
1209 void set_string_char (Lisp_String *s, Charcount i, Emchar c); 1503 void set_string_char (Lisp_String *s, Charcount i, Emchar c);
1210 1504
1211 #else /* not MULE */ 1505 #else /* not MULE */
1212 1506
1213 # define string_char_length(s) string_length (s) 1507 #define string_index_byte_to_char(s, idx) (idx)
1214 # define string_char(s, i) ((Emchar) string_byte (s, i)) 1508 #define string_index_char_to_byte(s, idx) (idx)
1509 #define string_offset_byte_to_char_len(s, off, len) (len)
1510 #define string_offset_char_to_byte_len(s, off, len) (len)
1215 # define string_char_addr(s, i) string_byte_addr (s, i) 1511 # define string_char_addr(s, i) string_byte_addr (s, i)
1216 # define set_string_char(s, i, c) set_string_byte (s, i, (Intbyte)c) 1512 /* WARNING: If you modify an existing string, you must call
1513 bump_string_modiff() afterwards. */
1514 # define set_string_char(s, i, c) set_string_byte (s, i, (Intbyte) c)
1217 1515
1218 #endif /* not MULE */ 1516 #endif /* not MULE */
1219 1517
1220 /* Return the true aligned size of a struct whose last member is a 1518 /* Return the true aligned size of a struct whose last member is a
1221 variable-length array field. (this is known as the "struct hack") */ 1519 variable-length array field. (this is known as the "struct hack") */
1707 Lisp_Object make_lcrecord_list (Elemcount size, 2005 Lisp_Object make_lcrecord_list (Elemcount size,
1708 const struct lrecord_implementation 2006 const struct lrecord_implementation
1709 *implementation); 2007 *implementation);
1710 Lisp_Object allocate_managed_lcrecord (Lisp_Object lcrecord_list); 2008 Lisp_Object allocate_managed_lcrecord (Lisp_Object lcrecord_list);
1711 void free_managed_lcrecord (Lisp_Object lcrecord_list, Lisp_Object lcrecord); 2009 void free_managed_lcrecord (Lisp_Object lcrecord_list, Lisp_Object lcrecord);
2010
2011
2012 /************************************************************************/
2013 /* Definitions related to the format of text and of characters */
2014 /************************************************************************/
2015
2016 /* Note:
2017
2018 "internally formatted text" and the term "internal format" in
2019 general are likely to refer to the format of text in buffers and
2020 strings; "externally formatted text" and the term "external format"
2021 refer to any text format used in the O.S. or elsewhere outside of
2022 XEmacs. The format of text and of a character are related and
2023 there must be a one-to-one relationship (hopefully through a
2024 relatively simple algorithmic means of conversion) between a string
2025 of text and an equivalent array of characters, but the conversion
2026 between the two is NOT necessarily trivial.
2027
2028 In a non-Mule XEmacs, allowed characters are numbered 0 through
2029 255, where no fixed meaning is assigned to them, but (when
2030 representing text, rather than bytes in a binary file) in practice
2031 the lower half represents ASCII and the upper half some other 8-bit
2032 character set (chosen by setting the font, case tables, syntax
2033 tables, etc. appropriately for the character set through ad-hoc
2034 means such as the `iso-8859-1' file and the
2035 `standard-display-european' function).
2036
2037 #### Finish this.
2038
2039 */
2040 #include "text.h"
1712 2041
1713 2042
1714 /************************************************************************/ 2043 /************************************************************************/
1715 /* Definitions of primitive Lisp functions and variables */ 2044 /* Definitions of primitive Lisp functions and variables */
1716 /************************************************************************/ 2045 /************************************************************************/
1811 At MIT, `pdl' [abbreviation for `Push Down List'] used to 2140 At MIT, `pdl' [abbreviation for `Push Down List'] used to
1812 be a more common synonym for `stack'. 2141 be a more common synonym for `stack'.
1813 Everywhere else `stack' seems to be the preferred term. 2142 Everywhere else `stack' seems to be the preferred term.
1814 2143
1815 specpdl_depth is the current depth of `specpdl'. 2144 specpdl_depth is the current depth of `specpdl'.
1816 Save this for use later as arg to `unbind_to'. */ 2145 Save this for use later as arg to `unbind_to_1'. */
1817 extern int specpdl_depth_counter; 2146 extern int specpdl_depth_counter;
1818 #define specpdl_depth() specpdl_depth_counter 2147 #define specpdl_depth() specpdl_depth_counter
1819 2148
1820 2149
1821 #define CHECK_FUNCTION(fun) do { \ 2150 #define CHECK_FUNCTION(fun) do { \
1831 /* Asynchronous events set something_happened, and then are processed 2160 /* Asynchronous events set something_happened, and then are processed
1832 within the QUIT macro. At this point, we are guaranteed to not be in 2161 within the QUIT macro. At this point, we are guaranteed to not be in
1833 any sensitive code. */ 2162 any sensitive code. */
1834 2163
1835 extern volatile int something_happened; 2164 extern volatile int something_happened;
2165 extern int dont_check_for_quit;
1836 int check_what_happened (void); 2166 int check_what_happened (void);
1837 2167
1838 extern volatile int quit_check_signal_happened; 2168 extern volatile int quit_check_signal_happened;
1839 extern volatile int quit_check_signal_tick_count; 2169 extern volatile int quit_check_signal_tick_count;
1840 int check_quit (void); 2170 int check_quit (void);
1841 2171
1842 void signal_quit (void); 2172 void signal_quit (void);
1843 2173
2174 #define QUIT_FLAG_SAYS_SHOULD_QUIT \
2175 (!NILP (Vquit_flag) && \
2176 (NILP (Vinhibit_quit) \
2177 || (EQ (Vquit_flag, Qcritical) && !dont_check_for_quit)))
2178
1844 /* Nonzero if ought to quit now. */ 2179 /* Nonzero if ought to quit now. */
1845 #define QUITP \ 2180 #define QUITP \
1846 ((quit_check_signal_happened ? check_quit () : 0), \ 2181 ((quit_check_signal_happened ? check_quit () : 0), \
1847 (!NILP (Vquit_flag) && (NILP (Vinhibit_quit) \ 2182 QUIT_FLAG_SAYS_SHOULD_QUIT)
1848 || EQ (Vquit_flag, Qcritical))))
1849 2183
1850 /* QUIT used to call QUITP, but there are some places where QUITP 2184 /* QUIT used to call QUITP, but there are some places where QUITP
1851 is called directly, and check_what_happened() should only be called 2185 is called directly, and check_what_happened() should only be called
1852 when Emacs is actually ready to quit because it could do things 2186 when Emacs is actually ready to quit because it could do things
1853 like switch threads. */ 2187 like switch threads. */
1854 #define INTERNAL_QUITP \ 2188 #define INTERNAL_QUITP \
1855 ((something_happened ? check_what_happened () : 0), \ 2189 ((something_happened ? check_what_happened () : 0), \
1856 (!NILP (Vquit_flag) && \ 2190 QUIT_FLAG_SAYS_SHOULD_QUIT)
1857 (NILP (Vinhibit_quit) || EQ (Vquit_flag, Qcritical))))
1858 2191
1859 #define INTERNAL_REALLY_QUITP \ 2192 #define INTERNAL_REALLY_QUITP \
1860 (check_what_happened (), \ 2193 (check_what_happened (), \
1861 (!NILP (Vquit_flag) && \ 2194 QUIT_FLAG_SAYS_SHOULD_QUIT)
1862 (NILP (Vinhibit_quit) || EQ (Vquit_flag, Qcritical))))
1863 2195
1864 /* Check quit-flag and quit if it is non-nil. Also do any other things 2196 /* Check quit-flag and quit if it is non-nil. Also do any other things
1865 that might have gotten queued until it was safe. */ 2197 that might have gotten queued until it was safe. */
1866 #define QUIT do { if (INTERNAL_QUITP) signal_quit (); } while (0) 2198 #define QUIT do { if (INTERNAL_QUITP) signal_quit (); } while (0)
1867 2199
1892 2224
1893 /************************************************************************/ 2225 /************************************************************************/
1894 /* String translation */ 2226 /* String translation */
1895 /************************************************************************/ 2227 /************************************************************************/
1896 2228
1897 #ifdef I18N3 2229 /* When support for message translation exists, GETTEXT() translates a
1898 #ifdef HAVE_LIBINTL_H 2230 string from English into the language defined by
1899 #include <libintl.h> 2231 `current-language-environment'. This is done by looking the string
1900 #else 2232 up in a large predefined table; if no translation is found, the
1901 char *dgettext (const char *, const char *); 2233 original string is returned, and the failure is possibly logged so
1902 char *gettext (const char *); 2234 that the translation can later be entered into the table.
1903 char *textdomain (const char *); 2235
1904 char *bindtextdomain (const char *, const char *); 2236 In addition to this, there is a mechanism to snarf message strings
1905 #endif /* HAVE_LIBINTL_H */ 2237 out of the source code so that they can be entered into the tables.
1906 2238 This is what make-msgfile.lex does.
1907 #define GETTEXT(x) gettext(x) 2239
1908 #define LISP_GETTEXT(x) Fgettext (x) 2240 Handling `format' strings is more difficult: The format string
1909 #else /* !I18N3 */ 2241 should get translated, but not under all circumstances. When the
1910 #define GETTEXT(x) (x) 2242 format string is a Lisp string, what should happen is that
1911 #define LISP_GETTEXT(x) (x) 2243 Fformat() should format the untranslated args[0] and return that,
1912 #endif /* !I18N3 */ 2244 and also call Fgettext() on args[0] and, if that is different,
2245 format it and store it in the `string-translatable' property of the
2246 returned string. See Fgettext().
2247
2248 CGETTEXT() is the same as GETTEXT() but works with char * strings
2249 instead of Intbyte * strings.
2250
2251 build_msg_string() is a shorthand for build_string (GETTEXT (x)).
2252 build_msg_intstring() is a shorthand for build_intstring (GETTEXT (x)).
2253 */
2254
2255 #define GETTEXT(x) (x)
2256 #define CGETTEXT(x) (x)
2257 #define LISP_GETTEXT(x) (x)
1913 2258
1914 /* DEFER_GETTEXT is used to identify strings which are translated when 2259 /* DEFER_GETTEXT is used to identify strings which are translated when
1915 they are referenced instead of when they are defined. 2260 they are referenced instead of when they are defined.
1916 These include Qerror_messages and initialized arrays of strings. 2261 These include Qerror_messages and initialized arrays of strings.
1917 */ 2262 */
1946 extern struct gcpro *gcprolist; 2291 extern struct gcpro *gcprolist;
1947 2292
1948 struct gcpro 2293 struct gcpro
1949 { 2294 {
1950 struct gcpro *next; 2295 struct gcpro *next;
1951 Lisp_Object *var; /* Address of first protected variable */ 2296 const Lisp_Object *var; /* Address of first protected variable */
1952 int nvars; /* Number of consecutive protected variables */ 2297 int nvars; /* Number of consecutive protected variables */
1953 }; 2298 };
1954 2299
1955 /* Normally, you declare variables gcpro1, gcpro2, ... and use the 2300 /* Normally, you declare variables gcpro1, gcpro2, ... and use the
1956 GCPROn() macros. However, if you need to have nested gcpro's, 2301 GCPROn() macros. However, if you need to have nested gcpro's,
2117 2462
2118 #define NNUNGCPRO ((void) (gcprolist = nngcpro1.next)) 2463 #define NNUNGCPRO ((void) (gcprolist = nngcpro1.next))
2119 2464
2120 #endif /* ! DEBUG_GCPRO */ 2465 #endif /* ! DEBUG_GCPRO */
2121 2466
2122 /* Another try to fix SunPro C compiler warnings */
2123 /* "end-of-loop code not reached" */
2124 /* "statement not reached */
2125 #if defined __SUNPRO_C || defined __USLC__
2126 #define RETURN_SANS_WARNINGS if (1) return
2127 #define RETURN_NOT_REACHED(value)
2128 #else
2129 #define RETURN_SANS_WARNINGS return
2130 #define RETURN_NOT_REACHED(value) return value;
2131 #endif
2132
2133 /* Evaluate expr, UNGCPRO, and then return the value of expr. */ 2467 /* Evaluate expr, UNGCPRO, and then return the value of expr. */
2134 #define RETURN_UNGCPRO(expr) do \ 2468 #define RETURN_UNGCPRO(expr) do \
2135 { \ 2469 { \
2136 Lisp_Object ret_ungc_val = (expr); \ 2470 Lisp_Object ret_ungc_val = (expr); \
2137 UNGCPRO; \ 2471 UNGCPRO; \
2156 NUNGCPRO; \ 2490 NUNGCPRO; \
2157 UNGCPRO; \ 2491 UNGCPRO; \
2158 RETURN_SANS_WARNINGS ret_ungc_val; \ 2492 RETURN_SANS_WARNINGS ret_ungc_val; \
2159 } while (0) 2493 } while (0)
2160 2494
2161 /* Evaluate expr, return it if it's not Qunbound. */
2162 #define RETURN_IF_NOT_UNBOUND(expr) do \
2163 { \
2164 Lisp_Object ret_nunb_val = (expr); \
2165 if (!UNBOUNDP (ret_nunb_val)) \
2166 RETURN_SANS_WARNINGS ret_nunb_val; \
2167 } while (0)
2168
2169 extern Lisp_Object_ptr_dynarr *staticpros; 2495 extern Lisp_Object_ptr_dynarr *staticpros;
2170 2496
2171 void register_post_gc_action (void (*fun) (void *), void *arg); 2497 #ifdef DEBUG_XEMACS
2498
2499 /* Help debug crashes gc-marking a staticpro'ed object. */
2500
2501 void staticpro_1 (Lisp_Object *, char *);
2502 void staticpro_nodump_1 (Lisp_Object *, char *);
2503 #define staticpro(ptr) staticpro_1 (ptr, #ptr)
2504 #define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, #ptr)
2505
2506 #else
2172 2507
2173 /* Call staticpro (&var) to protect static variable `var'. */ 2508 /* Call staticpro (&var) to protect static variable `var'. */
2174 void staticpro (Lisp_Object *); 2509 void staticpro (Lisp_Object *);
2175 2510
2176 /* Call staticpro_nodump (&var) to protect static variable `var'. */ 2511 /* Call staticpro_nodump (&var) to protect static variable `var'. */
2177 /* var will not be saved at dump time */ 2512 /* var will not be saved at dump time */
2178 void staticpro_nodump (Lisp_Object *); 2513 void staticpro_nodump (Lisp_Object *);
2179 2514
2180 /* dump_add_root_struct_ptr (&var, &desc) dumps the structure pointed to by `var'. */ 2515 #endif
2516
2517 void register_post_gc_action (void (*fun) (void *), void *arg);
2518 int begin_gc_forbidden (void);
2519 void end_gc_forbidden (int count);
2520
2521
2522 /************************************************************************/
2523 /* Dumping */
2524 /************************************************************************/
2525
2526 /* dump_add_root_struct_ptr (&var, &desc) dumps the structure pointed to by
2527 `var'. This is for a single relocatable pointer located in the data
2528 segment (i.e. the block pointed to is in the heap). */
2181 #ifdef PDUMP 2529 #ifdef PDUMP
2182 void dump_add_root_struct_ptr (void *, const struct struct_description *); 2530 void dump_add_root_struct_ptr (void *, const struct struct_description *);
2183 #else 2531 #else
2184 #define dump_add_root_struct_ptr(varaddr,descaddr) DO_NOTHING 2532 #define dump_add_root_struct_ptr(varaddr,descaddr) DO_NOTHING
2185 #endif 2533 #endif
2186 2534
2187 /* dump_add_opaque (&var, size) dumps the opaque static structure `var'. */ 2535 /* dump_add_opaque (&var, size) dumps the opaque static structure `var'.
2536 This is for a static block of memory (in the data segment, not the
2537 heap), with no relocatable pointers in it. */
2188 #ifdef PDUMP 2538 #ifdef PDUMP
2189 void dump_add_opaque (const void *, Bytecount); 2539 void dump_add_opaque (const void *, Bytecount);
2190 #else 2540 #else
2191 #define dump_add_opaque(varaddr,size) DO_NOTHING 2541 #define dump_add_opaque(varaddr,size) DO_NOTHING
2542 #endif
2543
2544 /* dump_add_root_block (&var, &desc) dumps the static structure located at
2545 `var' and described by DESC. This is for a static block of memory (in
2546 the data segment, not the heap), with relocatable pointers in it, as
2547 described by DESC. (#### Not yet implemented) */
2548 #ifdef PDUMP
2549 void dump_add_root_block (void *ptraddress,
2550 const struct lrecord_description *desc);
2551 #else
2552 #define dump_add_root_block(ptraddress,desc) DO_NOTHING
2192 #endif 2553 #endif
2193 2554
2194 /* Call dump_add_opaque_int (&int_var) to dump `int_var', of type `int'. */ 2555 /* Call dump_add_opaque_int (&int_var) to dump `int_var', of type `int'. */
2195 #ifdef PDUMP 2556 #ifdef PDUMP
2196 #define dump_add_opaque_int(int_varaddr) do { \ 2557 #define dump_add_opaque_int(int_varaddr) do { \
2229 2590
2230 /* Nonzero means Emacs has already been initialized. 2591 /* Nonzero means Emacs has already been initialized.
2231 Used during startup to detect startup of dumped Emacs. */ 2592 Used during startup to detect startup of dumped Emacs. */
2232 extern int initialized; 2593 extern int initialized;
2233 2594
2234 #ifdef MEMORY_USAGE_STATS 2595
2235 2596
2236 /* This structure is used to keep statistics on the amount of memory 2597 /************************************************************************/
2237 in use. 2598 /* Misc definitions */
2238 2599 /************************************************************************/
2239 WAS_REQUESTED stores the actual amount of memory that was requested
2240 of the allocation function. The *_OVERHEAD fields store the
2241 additional amount of memory that was grabbed by the functions to
2242 facilitate allocation, reallocation, etc. MALLOC_OVERHEAD is for
2243 memory allocated with malloc(); DYNARR_OVERHEAD is for dynamic
2244 arrays; GAP_OVERHEAD is for gap arrays. Note that for (e.g.)
2245 dynamic arrays, there is both MALLOC_OVERHEAD and DYNARR_OVERHEAD
2246 memory: The dynamic array allocates memory above and beyond what
2247 was asked of it, and when it in turns allocates memory using
2248 malloc(), malloc() allocates memory beyond what it was asked
2249 to allocate.
2250
2251 Functions that accept a structure of this sort do not initialize
2252 the fields to 0, and add any existing values to whatever was there
2253 before; this way, you can get a cumulative effect. */
2254
2255 struct overhead_stats
2256 {
2257 Bytecount was_requested;
2258 Bytecount malloc_overhead;
2259 Bytecount dynarr_overhead;
2260 Bytecount gap_overhead;
2261 };
2262
2263 #endif /* MEMORY_USAGE_STATS */
2264
2265 #ifndef DIRECTORY_SEP
2266 #define DIRECTORY_SEP '/'
2267 #endif
2268 #ifndef IS_DIRECTORY_SEP
2269 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP)
2270 #endif
2271 #ifndef IS_DEVICE_SEP
2272 #ifndef DEVICE_SEP
2273 #define IS_DEVICE_SEP(c) 0
2274 #else
2275 #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP)
2276 #endif
2277 #endif
2278 #ifndef IS_ANY_SEP
2279 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c)
2280 #endif
2281
2282 #ifdef HAVE_INTTYPES_H
2283 #include <inttypes.h>
2284 #elif SIZEOF_VOID_P == SIZEOF_INT
2285 typedef int intptr_t;
2286 typedef unsigned int uintptr_t;
2287 #elif SIZEOF_VOID_P == SIZEOF_LONG
2288 typedef long intptr_t;
2289 typedef unsigned long uintptr_t;
2290 #elif defined(SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG
2291 typedef long long intptr_t;
2292 typedef unsigned long long uintptr_t;
2293 #else
2294 /* Just pray. May break, may not. */
2295 typedef long intptr_t;
2296 typedef unsigned long uintptr_t;
2297 #endif
2298
2299 2600
2300 /************************************************************************/ 2601 /************************************************************************/
2301 /* prototypes */ 2602 /* prototypes */
2302 /************************************************************************/ 2603 /************************************************************************/
2303 2604
2339 Lisp_Object, Lisp_Object); 2640 Lisp_Object, Lisp_Object);
2340 DECLARE_DOESNT_RETURN (memory_full (void)); 2641 DECLARE_DOESNT_RETURN (memory_full (void));
2341 void disksave_object_finalization (void); 2642 void disksave_object_finalization (void);
2342 extern int purify_flag; 2643 extern int purify_flag;
2343 extern int gc_currently_forbidden; 2644 extern int gc_currently_forbidden;
2344 Lisp_Object restore_gc_inhibit (Lisp_Object);
2345 extern EMACS_INT gc_generation_number[1]; 2645 extern EMACS_INT gc_generation_number[1];
2346 int c_readonly (Lisp_Object); 2646 int c_readonly (Lisp_Object);
2347 int lisp_readonly (Lisp_Object); 2647 int lisp_readonly (Lisp_Object);
2648 Lisp_Object build_intstring (const Intbyte *);
2348 Lisp_Object build_string (const CIntbyte *); 2649 Lisp_Object build_string (const CIntbyte *);
2349 Lisp_Object build_ext_string (const Extbyte *, Lisp_Object); 2650 Lisp_Object build_ext_string (const Extbyte *, Lisp_Object);
2350 Lisp_Object build_translated_string (const CIntbyte *); 2651 Lisp_Object build_msg_intstring (const Intbyte *);
2652 Lisp_Object build_msg_string (const CIntbyte *);
2351 Lisp_Object make_string (const Intbyte *, Bytecount); 2653 Lisp_Object make_string (const Intbyte *, Bytecount);
2352 Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object); 2654 Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object);
2655 void init_string_ascii_begin (Lisp_Object string);
2353 Lisp_Object make_uninit_string (Bytecount); 2656 Lisp_Object make_uninit_string (Bytecount);
2354 Lisp_Object make_float (double); 2657 Lisp_Object make_float (double);
2355 Lisp_Object make_string_nocopy (const Intbyte *, Bytecount); 2658 Lisp_Object make_string_nocopy (const Intbyte *, Bytecount);
2356 void free_cons (Lisp_Cons *); 2659 void free_cons (Lisp_Cons *);
2357 void free_list (Lisp_Object); 2660 void free_list (Lisp_Object);
2375 #else 2678 #else
2376 #define DUMPEDP(adr) 0 2679 #define DUMPEDP(adr) 0
2377 #endif 2680 #endif
2378 2681
2379 /* Defined in buffer.c */ 2682 /* Defined in buffer.c */
2380 Lisp_Object make_buffer (struct buffer *);
2381 Lisp_Object get_truename_buffer (Lisp_Object); 2683 Lisp_Object get_truename_buffer (Lisp_Object);
2382 void switch_to_buffer (Lisp_Object, Lisp_Object); 2684 void switch_to_buffer (Lisp_Object, Lisp_Object);
2383 extern int find_file_compare_truenames; 2685 extern int find_file_compare_truenames;
2384 extern int find_file_use_truenames; 2686 extern int find_file_use_truenames;
2687 Intbyte *get_initial_directory (Intbyte *pathname, Bytecount size);
2688 extern Lisp_Object Vbuffer_alist;
2689 void set_buffer_internal (struct buffer *b);
2690 struct buffer *decode_buffer (Lisp_Object buffer, int allow_string);
2691
2692 void record_buffer (Lisp_Object buf);
2693 Lisp_Object get_buffer (Lisp_Object name,
2694 int error_if_deleted_or_does_not_exist);
2695 int map_over_sharing_buffers (struct buffer *buf,
2696 int (*mapfun) (struct buffer *buf,
2697 void *closure),
2698 void *closure);
2699
2700 extern struct buffer *current_buffer;
2701
2702 extern void init_initial_directory (void); /* initialize initial_directory */
2703
2704 EXFUN (Fbuffer_disable_undo, 1);
2705 EXFUN (Fbuffer_modified_p, 1);
2706 EXFUN (Fbuffer_name, 1);
2707 EXFUN (Fcurrent_buffer, 0);
2708 EXFUN (Ferase_buffer, 1);
2709 EXFUN (Fget_buffer, 1);
2710 EXFUN (Fget_buffer_create, 1);
2711 EXFUN (Fget_file_buffer, 1);
2712 EXFUN (Fkill_buffer, 1);
2713 EXFUN (Fother_buffer, 3);
2714 EXFUN (Frecord_buffer, 1);
2715 EXFUN (Fset_buffer, 1);
2716 EXFUN (Fset_buffer_modified_p, 2);
2717
2718 extern Lisp_Object QSscratch, Qafter_change_function, Qafter_change_functions;
2719 extern Lisp_Object Qbefore_change_function, Qbefore_change_functions;
2720 extern Lisp_Object Qbuffer_or_string_p, Qdefault_directory, Qfirst_change_hook;
2721 extern Lisp_Object Qpermanent_local, Vafter_change_function;
2722 extern Lisp_Object Vafter_change_functions, Vbefore_change_function;
2723 extern Lisp_Object Vbefore_change_functions, Vbuffer_alist, Vbuffer_defaults;
2724 extern Lisp_Object Vinhibit_read_only, Vtransient_mark_mode;
2385 2725
2386 /* Defined in bytecode.c */ 2726 /* Defined in bytecode.c */
2387 DECLARE_DOESNT_RETURN (invalid_byte_code 2727 DECLARE_DOESNT_RETURN (invalid_byte_code
2388 (const CIntbyte *reason, Lisp_Object frob)); 2728 (const CIntbyte *reason, Lisp_Object frob));
2389 2729
2390 /* Defined in callproc.c */ 2730 /* Defined in callproc.c */
2391 char *egetenv (const char *); 2731 Intbyte *egetenv (const CIntbyte *var);
2732 void eputenv (const CIntbyte *var, const CIntbyte *value);
2733 extern int env_initted;
2392 2734
2393 /* Defined in console.c */ 2735 /* Defined in console.c */
2394 void stuff_buffered_input (Lisp_Object); 2736 void stuff_buffered_input (Lisp_Object);
2395 2737
2396 /* Defined in console-msw.c */ 2738 /* Defined in console-msw.c */
2397 EXFUN (Fmswindows_message_box, 3); 2739 EXFUN (Fmswindows_message_box, 3);
2398 extern int mswindows_message_outputted; 2740 extern int mswindows_message_outputted;
2741 void mswindows_hide_console (void);
2742 int mswindows_output_console_string (const Intbyte *ptr, Bytecount len);
2743 void write_string_to_mswindows_debugging_output (Intbyte *str, Bytecount len);
2399 2744
2400 /* Defined in data.c */ 2745 /* Defined in data.c */
2401 DECLARE_DOESNT_RETURN (c_write_error (Lisp_Object)); 2746 DECLARE_DOESNT_RETURN (c_write_error (Lisp_Object));
2402 DECLARE_DOESNT_RETURN (lisp_write_error (Lisp_Object)); 2747 DECLARE_DOESNT_RETURN (lisp_write_error (Lisp_Object));
2403 DECLARE_DOESNT_RETURN (args_out_of_range (Lisp_Object, Lisp_Object)); 2748 DECLARE_DOESNT_RETURN (args_out_of_range (Lisp_Object, Lisp_Object));
2405 Lisp_Object)); 2750 Lisp_Object));
2406 Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); 2751 Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
2407 DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object)); 2752 DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object));
2408 void check_int_range (EMACS_INT, EMACS_INT, EMACS_INT); 2753 void check_int_range (EMACS_INT, EMACS_INT, EMACS_INT);
2409 2754
2755 EXFUN (Fint_to_char, 1);
2756 EXFUN (Fchar_to_int, 1);
2757
2410 enum arith_comparison { 2758 enum arith_comparison {
2411 arith_equal, 2759 arith_equal,
2412 arith_notequal, 2760 arith_notequal,
2413 arith_less, 2761 arith_less,
2414 arith_grtr, 2762 arith_grtr,
2421 values! Use make_time. */ 2769 values! Use make_time. */
2422 Lisp_Object word_to_lisp (unsigned int); 2770 Lisp_Object word_to_lisp (unsigned int);
2423 unsigned int lisp_to_word (Lisp_Object); 2771 unsigned int lisp_to_word (Lisp_Object);
2424 2772
2425 /* Defined in dired.c */ 2773 /* Defined in dired.c */
2426 Lisp_Object make_directory_hash_table (const char *); 2774 Lisp_Object make_directory_hash_table (const Intbyte *);
2427 Lisp_Object wasteful_word_to_lisp (unsigned int); 2775 Lisp_Object wasteful_word_to_lisp (unsigned int);
2428 2776
2429 /* Defined in doc.c */ 2777 /* Defined in doc.c */
2430 Lisp_Object unparesseuxify_doc_string (int, EMACS_INT, char *, Lisp_Object); 2778 Lisp_Object unparesseuxify_doc_string (int, EMACS_INT, Intbyte *, Lisp_Object);
2431 Lisp_Object read_doc_string (Lisp_Object); 2779 Lisp_Object read_doc_string (Lisp_Object);
2432 2780
2433 /* Defined in doprnt.c */ 2781 /* Defined in doprnt.c */
2434 Bytecount emacs_doprnt_c (Lisp_Object, const Intbyte *, Lisp_Object, 2782
2435 Bytecount, ...); 2783 Bytecount emacs_doprnt_va (Lisp_Object stream, const Intbyte *format_nonreloc,
2436 Bytecount emacs_doprnt_va (Lisp_Object, const Intbyte *, Lisp_Object, 2784 Bytecount format_length, Lisp_Object format_reloc,
2437 Bytecount, va_list); 2785 va_list vargs);
2438 Bytecount emacs_doprnt_lisp (Lisp_Object, const Intbyte *, Lisp_Object, 2786 Bytecount emacs_doprnt (Lisp_Object stream, const Intbyte *format_nonreloc,
2439 Bytecount, int, const Lisp_Object *); 2787 Bytecount format_length, Lisp_Object format_reloc,
2440 Bytecount emacs_doprnt_lisp_2 (Lisp_Object, const Intbyte *, Lisp_Object, 2788 int nargs, const Lisp_Object *largs, ...);
2441 Bytecount, int, ...); 2789 Lisp_Object emacs_vsprintf_string_lisp (const CIntbyte *format_nonreloc,
2442 Lisp_Object emacs_doprnt_string_c (const Intbyte *, Lisp_Object, 2790 Lisp_Object format_reloc, int nargs,
2443 Bytecount, ...); 2791 const Lisp_Object *largs);
2444 Lisp_Object emacs_doprnt_string_va (const Intbyte *, Lisp_Object, 2792 Lisp_Object emacs_sprintf_string_lisp (const CIntbyte *format_nonreloc,
2445 Bytecount, va_list); 2793 Lisp_Object format_reloc, int nargs, ...);
2446 Lisp_Object emacs_doprnt_string_lisp (const Intbyte *, Lisp_Object, 2794 Intbyte *emacs_vsprintf_malloc_lisp (const CIntbyte *format_nonreloc,
2447 Bytecount, int, const Lisp_Object *); 2795 Lisp_Object format_reloc, int nargs,
2448 Lisp_Object emacs_doprnt_string_lisp_2 (const Intbyte *, Lisp_Object, 2796 const Lisp_Object *largs,
2449 Bytecount, int, ...); 2797 Bytecount *len_out);
2798 Intbyte *emacs_sprintf_malloc_lisp (Bytecount *len_out,
2799 const CIntbyte *format_nonreloc,
2800 Lisp_Object format_reloc, int nargs, ...);
2801 Lisp_Object emacs_vsprintf_string (const CIntbyte *format, va_list vargs);
2802 Lisp_Object emacs_sprintf_string (const CIntbyte *format, ...)
2803 PRINTF_ARGS (1, 2);
2804 Intbyte *emacs_vsprintf_malloc (const CIntbyte *format, va_list vargs,
2805 Bytecount *len_out);
2806 Intbyte *emacs_sprintf_malloc (Bytecount *len_out, const CIntbyte *format, ...)
2807 PRINTF_ARGS (2, 3);
2808 Bytecount emacs_vsprintf (Intbyte *output, const CIntbyte *format,
2809 va_list vargs);
2810 Bytecount emacs_sprintf (Intbyte *output, const CIntbyte *format, ...)
2811 PRINTF_ARGS (2, 3);
2812
2450 2813
2451 /* Defined in editfns.c */ 2814 /* Defined in editfns.c */
2452 void uncache_home_directory (void); 2815 void uncache_home_directory (void);
2453 Extbyte *get_home_directory (void); 2816 Intbyte *get_home_directory (void);
2454 char *user_login_name (uid_t *); 2817 Intbyte *user_login_name (uid_t *);
2455 Charbpos charbpos_clip_to_bounds (Charbpos, Charbpos, Charbpos); 2818 Charbpos charbpos_clip_to_bounds (Charbpos, Charbpos, Charbpos);
2456 Bytebpos bytebpos_clip_to_bounds (Bytebpos, Bytebpos, Bytebpos); 2819 Bytebpos bytebpos_clip_to_bounds (Bytebpos, Bytebpos, Bytebpos);
2457 void buffer_insert1 (struct buffer *, Lisp_Object); 2820 void buffer_insert1 (struct buffer *, Lisp_Object);
2458 Lisp_Object make_string_from_buffer (struct buffer *, Charbpos, Charcount); 2821 Lisp_Object make_string_from_buffer (struct buffer *, Charbpos, Charcount);
2459 Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Charbpos, Charcount); 2822 Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Charbpos, Charcount);
2460 Lisp_Object make_time (time_t); 2823 Lisp_Object make_time (time_t);
2461 Lisp_Object save_excursion_save (void); 2824 Lisp_Object save_excursion_save (void);
2462 Lisp_Object save_restriction_save (void); 2825 Lisp_Object save_restriction_save (void);
2463 Lisp_Object save_excursion_restore (Lisp_Object); 2826 Lisp_Object save_excursion_restore (Lisp_Object);
2464 Lisp_Object save_restriction_restore (Lisp_Object); 2827 Lisp_Object save_restriction_restore (Lisp_Object);
2828 void widen_buffer (struct buffer *b, int no_clip);
2829 int beginning_of_line_p (struct buffer *b, Charbpos pt);
2465 2830
2466 /* Defined in emacsfns.c */ 2831 /* Defined in emacsfns.c */
2467 Lisp_Object save_current_buffer_restore (Lisp_Object); 2832 Lisp_Object save_current_buffer_restore (Lisp_Object);
2468 2833
2469 /* Defined in emacs.c */ 2834 /* Defined in emacs.c */
2470 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (fatal (const char *,
2471 ...), 1, 2);
2472 int stderr_out (const char *, ...) PRINTF_ARGS (1, 2);
2473 int stdout_out (const char *, ...) PRINTF_ARGS (1, 2);
2474 SIGTYPE fatal_error_signal (int); 2835 SIGTYPE fatal_error_signal (int);
2475 Lisp_Object make_arg_list (int, Extbyte **); 2836 Lisp_Object make_arg_list (int, Extbyte **);
2476 void make_argc_argv (Lisp_Object, int *, Extbyte ***); 2837 void make_argc_argv (Lisp_Object, int *, Extbyte ***);
2477 void free_argc_argv (Extbyte **); 2838 void free_argc_argv (Extbyte **);
2478 Lisp_Object decode_env_path (const char *, const char *); 2839 Lisp_Object split_external_path (const Extbyte *path);
2479 Lisp_Object decode_path (const char *); 2840 Lisp_Object split_env_path (const CIntbyte *evarname, const Intbyte *default_);
2841
2480 /* Nonzero means don't do interactive redisplay and don't change tty modes */ 2842 /* Nonzero means don't do interactive redisplay and don't change tty modes */
2481 extern int noninteractive, noninteractive1; 2843 extern int noninteractive, noninteractive1;
2482 extern int fatal_error_in_progress; 2844 extern int inhibit_non_essential_printing_operations;
2483 extern int preparing_for_armageddon; 2845 extern int preparing_for_armageddon;
2484 extern Fixnum emacs_priority; 2846 extern Fixnum emacs_priority;
2485 extern int running_asynch_code; 2847 extern int running_asynch_code;
2486 extern int suppress_early_error_handler_backtrace; 2848 extern int suppress_early_error_handler_backtrace;
2849 void debug_break (void);
2850 int debug_can_access_memory (void *ptr, Bytecount len);
2851 void really_abort (void);
2487 2852
2488 /* Defined in eval.c */ 2853 /* Defined in eval.c */
2489 DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object)); 2854 DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object));
2490 void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object, 2855 void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object,
2491 Error_Behavior); 2856 Error_Behavior);
2663 Lisp_Object (*) (Lisp_Object), 3028 Lisp_Object (*) (Lisp_Object),
2664 Lisp_Object, 3029 Lisp_Object,
2665 Lisp_Object (*) (Lisp_Object, Lisp_Object), 3030 Lisp_Object (*) (Lisp_Object, Lisp_Object),
2666 Lisp_Object); 3031 Lisp_Object);
2667 Lisp_Object condition_case_3 (Lisp_Object, Lisp_Object, Lisp_Object); 3032 Lisp_Object condition_case_3 (Lisp_Object, Lisp_Object, Lisp_Object);
2668 Lisp_Object unbind_to (int, Lisp_Object); 3033 Lisp_Object unbind_to_1 (int, Lisp_Object);
3034 #define unbind_to(obj) unbind_to_1 (obj, Qnil)
2669 void specbind (Lisp_Object, Lisp_Object); 3035 void specbind (Lisp_Object, Lisp_Object);
2670 void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); 3036 int record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
3037 int record_unwind_protect_freeing (void *ptr);
3038 int record_unwind_protect_freeing_dynarr (void *ptr);
2671 void do_autoload (Lisp_Object, Lisp_Object); 3039 void do_autoload (Lisp_Object, Lisp_Object);
2672 Lisp_Object un_autoload (Lisp_Object); 3040 Lisp_Object un_autoload (Lisp_Object);
2673 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object); 3041 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);
2674 void warn_when_safe (Lisp_Object, Lisp_Object, const CIntbyte *, 3042 void warn_when_safe (Lisp_Object, Lisp_Object, const CIntbyte *,
2675 ...) PRINTF_ARGS (3, 4); 3043 ...) PRINTF_ARGS (3, 4);
2690 3058
2691 3059
2692 /* Defined in events.c */ 3060 /* Defined in events.c */
2693 void clear_event_resource (void); 3061 void clear_event_resource (void);
2694 Lisp_Object allocate_event (void); 3062 Lisp_Object allocate_event (void);
3063
3064 EXFUN (Fevent_x_pixel, 1);
3065 EXFUN (Fevent_y_pixel, 1);
3066
3067
3068 /* Defined in file-coding.c */
3069 EXFUN (Fcoding_category_list, 0);
3070 EXFUN (Fcoding_category_system, 1);
3071 EXFUN (Fcoding_priority_list, 0);
3072 EXFUN (Fcoding_system_description, 1);
3073 EXFUN (Fcoding_system_documentation, 1);
3074 EXFUN (Fcoding_system_list, 1);
3075 EXFUN (Fcoding_system_name, 1);
3076 EXFUN (Fcoding_system_p, 1);
3077 EXFUN (Fcoding_system_property, 2);
3078 EXFUN (Fcoding_system_type, 1);
3079 EXFUN (Fcopy_coding_system, 2);
3080 EXFUN (Fdecode_big5_char, 1);
3081 EXFUN (Fdecode_coding_region, 4);
3082 EXFUN (Fdecode_shift_jis_char, 1);
3083 EXFUN (Fdefine_coding_system_alias, 2);
3084 EXFUN (Fdetect_coding_region, 3);
3085 EXFUN (Fdefault_encoding_detection_enabled_p, 0);
3086 EXFUN (Fencode_big5_char, 1);
3087 EXFUN (Fencode_coding_region, 4);
3088 EXFUN (Fencode_shift_jis_char, 1);
3089 EXFUN (Ffind_coding_system, 1);
3090 EXFUN (Fget_coding_system, 1);
3091 EXFUN (Fmake_coding_system, 4);
3092 EXFUN (Fset_coding_category_system, 2);
3093 EXFUN (Fset_coding_priority_list, 1);
3094 EXFUN (Fsubsidiary_coding_system, 2);
3095
3096 extern Lisp_Object Qshift_jis, Qiso2022, Qbig5, Qccl;
3097 extern Lisp_Object Qcharset_g0;
3098 extern Lisp_Object Qcharset_g1, Qcharset_g2, Qcharset_g3, Qcoding_system_error;
3099 extern Lisp_Object Qcoding_systemp, Qcr, Qcrlf, Qdecode, Qencode;
3100 extern Lisp_Object Qeol_cr, Qeol_crlf, Qeol_lf, Qeol_type, Qescape_quoted;
3101 extern Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output;
3102 extern Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output;
3103 extern Lisp_Object Qinput_charset_conversion, Qlf, Qlock_shift;
3104 extern Lisp_Object Qmnemonic, Qno_ascii_cntl, Qno_ascii_eol;
3105 extern Lisp_Object Qno_conversion, Qraw_text;
3106 extern Lisp_Object Qno_iso6429, Qoutput_charset_conversion;
3107 extern Lisp_Object Qpost_read_conversion, Qpre_write_conversion, Qseven;
3108 extern Lisp_Object Qshort, Vcoding_system_for_read;
3109 extern Lisp_Object Vcoding_system_for_write;
3110 extern Lisp_Object Vfile_name_coding_system, Vkeyboard_coding_system;
3111 extern Lisp_Object Vterminal_coding_system;
3112 extern Lisp_Object Qcanonicalize_after_coding;
3113 void init_charset_unicode_tables (Lisp_Object charset);
3114 void free_charset_unicode_tables (Lisp_Object charset);
3115 void recalculate_unicode_precedence (void);
3116 int coding_system_is_for_text_file (Lisp_Object coding_system);
3117 Lisp_Object find_coding_system_for_text_file (Lisp_Object name, int eol_wrap);
3118 Lisp_Object get_coding_system_for_text_file (Lisp_Object name, int eol_wrap);
3119 int coding_system_is_binary (Lisp_Object coding_system);
3120
2695 3121
2696 /* Defined in fileio.c */ 3122 /* Defined in fileio.c */
2697 void record_auto_save (void); 3123 void record_auto_save (void);
2698 void force_auto_save_soon (void); 3124 void force_auto_save_soon (void);
2699 DECLARE_DOESNT_RETURN (report_error_with_errno (Lisp_Object errtype, 3125 DECLARE_DOESNT_RETURN (report_error_with_errno (Lisp_Object errtype,
2704 const CIntbyte *string, 3130 const CIntbyte *string,
2705 Lisp_Object data)); 3131 Lisp_Object data));
2706 DECLARE_DOESNT_RETURN (report_file_error (const CIntbyte *, Lisp_Object)); 3132 DECLARE_DOESNT_RETURN (report_file_error (const CIntbyte *, Lisp_Object));
2707 Lisp_Object lisp_strerror (int); 3133 Lisp_Object lisp_strerror (int);
2708 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object); 3134 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
2709 Bytecount read_allowing_quit (int fildes, void *buf, Bytecount size);
2710 Bytecount write_allowing_quit (int fildes, const void *buf,
2711 Bytecount size);
2712 int internal_delete_file (Lisp_Object); 3135 int internal_delete_file (Lisp_Object);
2713 3136
2714 /* Defined in filelock.c */ 3137 /* Defined in filelock.c */
2715 void lock_file (Lisp_Object); 3138 void lock_file (Lisp_Object);
2716 void unlock_file (Lisp_Object); 3139 void unlock_file (Lisp_Object);
2755 Lisp_Object vconcat3 (Lisp_Object, Lisp_Object, Lisp_Object); 3178 Lisp_Object vconcat3 (Lisp_Object, Lisp_Object, Lisp_Object);
2756 Lisp_Object nconc2 (Lisp_Object, Lisp_Object); 3179 Lisp_Object nconc2 (Lisp_Object, Lisp_Object);
2757 Lisp_Object bytecode_nconc2 (Lisp_Object *); 3180 Lisp_Object bytecode_nconc2 (Lisp_Object *);
2758 void check_losing_bytecode (const char *, Lisp_Object); 3181 void check_losing_bytecode (const char *, Lisp_Object);
2759 3182
3183 Lisp_Object add_suffix_to_symbol (Lisp_Object symbol,
3184 const Char_ASCII *ascii_string);
3185 Lisp_Object add_prefix_to_symbol (const Char_ASCII *ascii_string,
3186 Lisp_Object symbol);
3187
2760 /* Defined in glyphs.c */ 3188 /* Defined in glyphs.c */
2761 Error_Behavior decode_error_behavior_flag (Lisp_Object); 3189 Error_Behavior decode_error_behavior_flag (Lisp_Object);
2762 Lisp_Object encode_error_behavior_flag (Error_Behavior); 3190 Lisp_Object encode_error_behavior_flag (Error_Behavior);
2763 3191
2764 /* Defined in glyphs-shared.c */ 3192 /* Defined in glyphs-shared.c */
2781 int current_column (struct buffer *); 3209 int current_column (struct buffer *);
2782 void invalidate_current_column (void); 3210 void invalidate_current_column (void);
2783 Charbpos vmotion (struct window *, Charbpos, int, int *); 3211 Charbpos vmotion (struct window *, Charbpos, int, int *);
2784 Charbpos vmotion_pixels (Lisp_Object, Charbpos, int, int, int *); 3212 Charbpos vmotion_pixels (Lisp_Object, Charbpos, int, int, int *);
2785 3213
3214 /* Defined in insdel.c */
3215 void set_buffer_point (struct buffer *buf, Charbpos pos, Bytebpos bipos);
3216
3217 /* Defined in intl-win32.c */
3218 EXFUN (Fmswindows_set_current_locale, 1);
3219 EXFUN (Fmswindows_current_locale, 0);
3220 EXFUN (Fmswindows_user_default_locale, 0);
3221 EXFUN (Fmswindows_system_default_locale, 0);
3222 EXFUN (Fmswindows_locale_code_page, 1);
3223 EXFUN (Fmswindows_supported_locales, 0);
3224 EXFUN (Fmswindows_charset_code_page, 1);
3225 EXFUN (Fmswindows_set_charset_code_page, 2);
3226
3227 extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode;
3228 extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode;
3229
2786 /* Defined in keymap.c */ 3230 /* Defined in keymap.c */
2787 void where_is_to_char (Lisp_Object, char *); 3231 void where_is_to_char (Lisp_Object, char *);
2788 3232
2789 /* Defined in lread.c */ 3233 /* Defined in lread.c */
2790 void ebolify_bytecode_constants (Lisp_Object); 3234 void ebolify_bytecode_constants (Lisp_Object);
2818 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object); 3262 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object);
2819 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); 3263 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
2820 #ifdef MEMORY_USAGE_STATS 3264 #ifdef MEMORY_USAGE_STATS
2821 int compute_buffer_marker_usage (struct buffer *, struct overhead_stats *); 3265 int compute_buffer_marker_usage (struct buffer *, struct overhead_stats *);
2822 #endif 3266 #endif
3267 void init_buffer_markers (struct buffer *b);
3268 void uninit_buffer_markers (struct buffer *b);
2823 3269
2824 /* Defined in menubar.c */ 3270 /* Defined in menubar.c */
2825 extern int popup_menu_up_p; 3271 extern int popup_menu_up_p;
2826 extern int menubar_show_keybindings; 3272 extern int menubar_show_keybindings;
2827 extern int popup_menu_titles; 3273 extern int popup_menu_titles;
2848 void message (const char *, ...) PRINTF_ARGS (1, 2); 3294 void message (const char *, ...) PRINTF_ARGS (1, 2);
2849 void message_append (const char *, ...) PRINTF_ARGS (1, 2); 3295 void message_append (const char *, ...) PRINTF_ARGS (1, 2);
2850 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2); 3296 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2);
2851 void clear_message (void); 3297 void clear_message (void);
2852 3298
3299 /* Defined in mule-charset.c */
3300 extern Lisp_Object Ql2r, Qr2l;
3301
2853 /* Defined in print.c */ 3302 /* Defined in print.c */
2854 void write_string_to_stdio_stream (FILE *, struct console *, 3303
2855 const Intbyte *, Bytecount, Bytecount, 3304 /* Lower-level ways to output data: */
2856 Lisp_Object, int); 3305 void print_internal (Lisp_Object, Lisp_Object, int);
2857 void debug_print (Lisp_Object); 3306 void debug_print (Lisp_Object);
2858 void debug_short_backtrace (int);
2859 void temp_output_buffer_setup (Lisp_Object);
2860 void temp_output_buffer_show (Lisp_Object, Lisp_Object);
2861 /* NOTE: Do not call this with the data of a Lisp_String. Use princ. 3307 /* NOTE: Do not call this with the data of a Lisp_String. Use princ.
2862 * Note: stream should be defaulted before calling 3308 * Note: stream should be defaulted before calling
2863 * (eg Qnil means stdout, not Vstandard_output, etc) */ 3309 * (eg Qnil means stdout, not Vstandard_output, etc) */
2864 void write_c_string (const char *, Lisp_Object); 3310 void write_c_string (const CIntbyte *str, Lisp_Object stream);
2865 /* Same goes for this function. */ 3311 /* Same goes for this function. */
2866 void write_string_1 (const Intbyte *, Bytecount, Lisp_Object); 3312 void write_string (const Intbyte *str, Lisp_Object stream);
3313 /* Same goes for this function. */
3314 void write_string_1 (const Intbyte *str, Bytecount size, Lisp_Object stream);
3315
3316 /* Higher-level (printf-style) ways to output data: */
3317 void write_fmt_string (Lisp_Object stream, const CIntbyte *fmt, ...);
3318 void write_fmt_string_lisp (Lisp_Object stream, const CIntbyte *fmt,
3319 int nargs, ...);
3320 void stderr_out (const CIntbyte *, ...) PRINTF_ARGS (1, 2);
3321 void stderr_out_lisp (const CIntbyte *, int nargs, ...);
3322 void stdout_out (const CIntbyte *, ...) PRINTF_ARGS (1, 2);
3323 void debug_out (const CIntbyte *, ...) PRINTF_ARGS (1, 2);
3324 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (fatal (const CIntbyte *,
3325 ...), 1, 2);
3326
3327 /* Internal functions: */
3328 void temp_output_buffer_setup (Lisp_Object);
3329 void temp_output_buffer_show (Lisp_Object, Lisp_Object);
2867 void print_cons (Lisp_Object, Lisp_Object, int); 3330 void print_cons (Lisp_Object, Lisp_Object, int);
2868 void print_vector (Lisp_Object, Lisp_Object, int); 3331 void print_vector (Lisp_Object, Lisp_Object, int);
2869 void print_string (Lisp_Object, Lisp_Object, int); 3332 void print_string (Lisp_Object, Lisp_Object, int);
2870 3333 void print_symbol (Lisp_Object, Lisp_Object, int);
3334 void print_float (Lisp_Object, Lisp_Object, int);
2871 /* The number of bytes required to store the decimal printed 3335 /* The number of bytes required to store the decimal printed
2872 representation of an integral type. Add a few bytes for truncation, 3336 representation of an integral type. Add a few bytes for truncation,
2873 optional sign prefix, and null byte terminator. 3337 optional sign prefix, and null byte terminator.
2874 2.40824 == log (256) / log (10). 3338 2.40824 == log (256) / log (10).
2875 3339
2877 floating point computations to define a compile-time integral 3341 floating point computations to define a compile-time integral
2878 constant. */ 3342 constant. */
2879 #define DECIMAL_PRINT_SIZE(integral_type) \ 3343 #define DECIMAL_PRINT_SIZE(integral_type) \
2880 (((2410824 * sizeof (integral_type)) / 1000000) + 3) 3344 (((2410824 * sizeof (integral_type)) / 1000000) + 3)
2881 void long_to_string (char *, long); 3345 void long_to_string (char *, long);
2882
2883 void print_internal (Lisp_Object, Lisp_Object, int);
2884 void print_symbol (Lisp_Object, Lisp_Object, int);
2885 void print_float (Lisp_Object, Lisp_Object, int);
2886 extern int print_escape_newlines; 3346 extern int print_escape_newlines;
2887 extern int print_readably; 3347 extern int print_readably;
2888 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object, 3348 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object,
2889 Lisp_Object (*) (Lisp_Object), 3349 Lisp_Object (*) (Lisp_Object),
2890 Lisp_Object, Lisp_Object); 3350 Lisp_Object, Lisp_Object);
2891 void float_to_string (char *, double); 3351 void float_to_string (char *, double);
2892 void internal_object_printer (Lisp_Object, Lisp_Object, int); 3352 void internal_object_printer (Lisp_Object, Lisp_Object, int);
3353 void debug_short_backtrace (int);
3354 void debug_backtrace (void);
2893 3355
2894 /* Defined in process.c */ 3356 /* Defined in process.c */
2895 DECLARE_DOESNT_RETURN (report_process_error (const char *, Lisp_Object)); 3357 DECLARE_DOESNT_RETURN (report_process_error (const char *, Lisp_Object));
2896 DECLARE_DOESNT_RETURN (report_network_error (const char *, Lisp_Object)); 3358 DECLARE_DOESNT_RETURN (report_network_error (const char *, Lisp_Object));
2897 3359
2930 extern Fixnum warn_about_possibly_incompatible_back_references; 3392 extern Fixnum warn_about_possibly_incompatible_back_references;
2931 3393
2932 3394
2933 /* Defined in signal.c */ 3395 /* Defined in signal.c */
2934 void init_interrupts_late (void); 3396 void init_interrupts_late (void);
2935 extern int dont_check_for_quit; 3397 int begin_dont_check_for_quit (void);
2936 void begin_dont_check_for_quit (void);
2937 void emacs_sleep (int);
2938 3398
2939 /* Defined in sound.c */ 3399 /* Defined in sound.c */
2940 void init_device_sound (struct device *); 3400 void init_device_sound (struct device *);
2941 DECLARE_DOESNT_RETURN (report_sound_error (const Char_ASCII *, Lisp_Object)); 3401 DECLARE_DOESNT_RETURN (report_sound_error (const Char_ASCII *, Lisp_Object));
2942 3402
2946 Lisp_Object specifier_instance_no_quit (Lisp_Object, Lisp_Object, Lisp_Object, 3406 Lisp_Object specifier_instance_no_quit (Lisp_Object, Lisp_Object, Lisp_Object,
2947 Error_Behavior, int, Lisp_Object); 3407 Error_Behavior, int, Lisp_Object);
2948 3408
2949 /* Defined in symbols.c */ 3409 /* Defined in symbols.c */
2950 unsigned int hash_string (const Intbyte *, Bytecount); 3410 unsigned int hash_string (const Intbyte *, Bytecount);
2951 Lisp_Object intern (const char *); 3411 Lisp_Object intern_int (const Intbyte *str);
3412 Lisp_Object intern (const CIntbyte *str);
2952 Lisp_Object oblookup (Lisp_Object, const Intbyte *, Bytecount); 3413 Lisp_Object oblookup (Lisp_Object, const Intbyte *, Bytecount);
2953 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *); 3414 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *);
2954 Lisp_Object indirect_function (Lisp_Object, int); 3415 Lisp_Object indirect_function (Lisp_Object, int);
2955 Lisp_Object symbol_value_in_buffer (Lisp_Object, Lisp_Object); 3416 Lisp_Object symbol_value_in_buffer (Lisp_Object, Lisp_Object);
2956 void kill_buffer_local_variables (struct buffer *); 3417 void kill_buffer_local_variables (struct buffer *);
2962 int function_p, 3423 int function_p,
2963 Lisp_Object follow_past_lisp_magic); 3424 Lisp_Object follow_past_lisp_magic);
2964 3425
2965 /* Defined in syntax.c */ 3426 /* Defined in syntax.c */
2966 Charbpos scan_words (struct buffer *, Charbpos, int); 3427 Charbpos scan_words (struct buffer *, Charbpos, int);
3428
3429 /* Defined in sysdep.c */
3430 long get_random (void);
3431 void seed_random (long arg);
3432
3433 /* Defined in text.c */
3434 void find_charsets_in_intbyte_string (unsigned char *charsets,
3435 const Intbyte *str,
3436 Bytecount len);
3437 void find_charsets_in_emchar_string (unsigned char *charsets,
3438 const Emchar *str,
3439 Charcount len);
3440 int intbyte_string_displayed_columns (const Intbyte *str, Bytecount len);
3441 int emchar_string_displayed_columns (const Emchar *str, Charcount len);
3442 Charcount intbyte_string_nonascii_chars (const Intbyte *str, Bytecount len);
3443 void convert_intbyte_string_into_emchar_dynarr (const Intbyte *str,
3444 Bytecount len,
3445 Emchar_dynarr *dyn);
3446 Charcount convert_intbyte_string_into_emchar_string (const Intbyte *str,
3447 Bytecount len,
3448 Emchar *arr);
3449 void convert_emchar_string_into_intbyte_dynarr (Emchar *arr, int nels,
3450 Intbyte_dynarr *dyn);
3451 Intbyte *convert_emchar_string_into_malloced_string (Emchar *arr, int nels,
3452 Bytecount *len_out);
3453
3454 /* flags for get_buffer_pos_char(), get_buffer_range_char(), etc. */
3455 /* At most one of GB_COERCE_RANGE and GB_NO_ERROR_IF_BAD should be
3456 specified. At most one of GB_NEGATIVE_FROM_END and GB_NO_ERROR_IF_BAD
3457 should be specified. */
3458
3459 #define GB_ALLOW_PAST_ACCESSIBLE (1 << 0)
3460 #define GB_ALLOW_NIL (1 << 1)
3461 #define GB_CHECK_ORDER (1 << 2)
3462 #define GB_COERCE_RANGE (1 << 3)
3463 #define GB_NO_ERROR_IF_BAD (1 << 4)
3464 #define GB_NEGATIVE_FROM_END (1 << 5)
3465 #define GB_HISTORICAL_STRING_BEHAVIOR (GB_NEGATIVE_FROM_END | GB_ALLOW_NIL)
3466
3467 Charbpos get_buffer_pos_char (struct buffer *b, Lisp_Object pos,
3468 unsigned int flags);
3469 Bytebpos get_buffer_pos_byte (struct buffer *b, Lisp_Object pos,
3470 unsigned int flags);
3471 void get_buffer_range_char (struct buffer *b, Lisp_Object from, Lisp_Object to,
3472 Charbpos *from_out, Charbpos *to_out,
3473 unsigned int flags);
3474 void get_buffer_range_byte (struct buffer *b, Lisp_Object from, Lisp_Object to,
3475 Bytebpos *from_out, Bytebpos *to_out,
3476 unsigned int flags);
3477 Charcount get_string_pos_char (Lisp_Object string, Lisp_Object pos,
3478 unsigned int flags);
3479 Bytecount get_string_pos_byte (Lisp_Object string, Lisp_Object pos,
3480 unsigned int flags);
3481 void get_string_range_char (Lisp_Object string, Lisp_Object from,
3482 Lisp_Object to, Charcount *from_out,
3483 Charcount *to_out, unsigned int flags);
3484 void get_string_range_byte (Lisp_Object string, Lisp_Object from,
3485 Lisp_Object to, Bytecount *from_out,
3486 Bytecount *to_out, unsigned int flags);
3487 Charbpos get_buffer_or_string_pos_char (Lisp_Object object, Lisp_Object pos,
3488 unsigned int flags);
3489 Bytebpos get_buffer_or_string_pos_byte (Lisp_Object object, Lisp_Object pos,
3490 unsigned int flags);
3491 void get_buffer_or_string_range_char (Lisp_Object object, Lisp_Object from,
3492 Lisp_Object to, Charbpos *from_out,
3493 Charbpos *to_out, unsigned int flags);
3494 void get_buffer_or_string_range_byte (Lisp_Object object, Lisp_Object from,
3495 Lisp_Object to, Bytebpos *from_out,
3496 Bytebpos *to_out, unsigned int flags);
3497 Charbpos buffer_or_string_accessible_begin_char (Lisp_Object object);
3498 Charbpos buffer_or_string_accessible_end_char (Lisp_Object object);
3499 Bytebpos buffer_or_string_accessible_begin_byte (Lisp_Object object);
3500 Bytebpos buffer_or_string_accessible_end_byte (Lisp_Object object);
3501 Charbpos buffer_or_string_absolute_begin_char (Lisp_Object object);
3502 Charbpos buffer_or_string_absolute_end_char (Lisp_Object object);
3503 Bytebpos buffer_or_string_absolute_begin_byte (Lisp_Object object);
3504 Bytebpos buffer_or_string_absolute_end_byte (Lisp_Object object);
3505
3506 #ifdef ENABLE_COMPOSITE_CHARS
3507
3508 Emchar lookup_composite_char (Intbyte *str, int len);
3509 Lisp_Object composite_char_string (Emchar ch);
3510 #endif /* ENABLE_COMPOSITE_CHARS */
3511
3512 EXFUN (Ffind_charset, 1);
3513 EXFUN (Fget_charset, 1);
3514 EXFUN (Fcharset_list, 0);
3515
3516 extern Lisp_Object Vcharset_ascii;
3517 extern Lisp_Object Vcharset_control_1;
3518 extern Lisp_Object Vcharset_latin_iso8859_1;
3519 extern Lisp_Object Vcharset_latin_iso8859_2;
3520 extern Lisp_Object Vcharset_latin_iso8859_3;
3521 extern Lisp_Object Vcharset_latin_iso8859_4;
3522 extern Lisp_Object Vcharset_thai_tis620;
3523 extern Lisp_Object Vcharset_greek_iso8859_7;
3524 extern Lisp_Object Vcharset_arabic_iso8859_6;
3525 extern Lisp_Object Vcharset_hebrew_iso8859_8;
3526 extern Lisp_Object Vcharset_katakana_jisx0201;
3527 extern Lisp_Object Vcharset_latin_jisx0201;
3528 extern Lisp_Object Vcharset_cyrillic_iso8859_5;
3529 extern Lisp_Object Vcharset_latin_iso8859_9;
3530 extern Lisp_Object Vcharset_japanese_jisx0208_1978;
3531 extern Lisp_Object Vcharset_chinese_gb2312;
3532 extern Lisp_Object Vcharset_japanese_jisx0208;
3533 extern Lisp_Object Vcharset_korean_ksc5601;
3534 extern Lisp_Object Vcharset_japanese_jisx0212;
3535 extern Lisp_Object Vcharset_chinese_cns11643_1;
3536 extern Lisp_Object Vcharset_chinese_cns11643_2;
3537 extern Lisp_Object Vcharset_chinese_big5_1;
3538 extern Lisp_Object Vcharset_chinese_big5_2;
3539 extern Lisp_Object Vcharset_composite;
3540
3541 Emchar Lstream_get_emchar_1 (Lstream *stream, int first_char);
3542 int Lstream_fput_emchar (Lstream *stream, Emchar ch);
3543 void Lstream_funget_emchar (Lstream *stream, Emchar ch);
3544
3545 DECLARE_INLINE_HEADER (Intbyte *qxestrdup (const Intbyte *s))
3546 {
3547 return (Intbyte *) xstrdup ((const char *) s);
3548 }
3549
3550 DECLARE_INLINE_HEADER (Bytecount qxestrlen (const Intbyte *s))
3551 {
3552 return strlen ((const char *) s);
3553 }
3554
3555 DECLARE_INLINE_HEADER (Charcount qxestrcharlen (const Intbyte *s))
3556 {
3557 return bytecount_to_charcount (s, qxestrlen (s));
3558 }
3559
3560 DECLARE_INLINE_HEADER (int qxestrcmp (const Intbyte *s1,
3561 const Intbyte *s2))
3562 {
3563 return strcmp ((const char *) s1, (const char *) s2);
3564 }
3565
3566 DECLARE_INLINE_HEADER (int qxestrcmp_c (const Intbyte *s1,
3567 const char *s2))
3568 {
3569 return strcmp ((const char *) s1, s2);
3570 }
3571
3572 DECLARE_INLINE_HEADER (int qxestrncmp (const Intbyte *string1,
3573 const Intbyte *string2,
3574 Bytecount count))
3575 {
3576 return strncmp ((const char *) string1, (const char *) string2,
3577 (size_t) count);
3578 }
3579
3580 DECLARE_INLINE_HEADER (int qxestrncmp_c (const Intbyte *string1,
3581 const char *string2,
3582 Bytecount count))
3583 {
3584 return strncmp ((const char *) string1, string2, (size_t) count);
3585 }
3586
3587 DECLARE_INLINE_HEADER (Intbyte *qxestrcpy (Intbyte *strDest,
3588 const Intbyte *strSource))
3589 {
3590 return (Intbyte *) strcpy ((char *) strDest, (const char *) strSource);
3591 }
3592
3593 DECLARE_INLINE_HEADER (Intbyte *qxestrcpy_c (Intbyte *strDest,
3594 const char *strSource))
3595 {
3596 return (Intbyte *) strcpy ((char *) strDest, strSource);
3597 }
3598
3599 DECLARE_INLINE_HEADER (Intbyte *qxestrncpy (Intbyte *strDest,
3600 const Intbyte *strSource,
3601 Bytecount count))
3602 {
3603 return (Intbyte *) strncpy ((char *) strDest, (const char *) strSource,
3604 (size_t) count);
3605 }
3606
3607 DECLARE_INLINE_HEADER (Intbyte *qxestrncpy_c (Intbyte *strDest,
3608 const char *strSource,
3609 Bytecount count))
3610 {
3611 return (Intbyte *) strncpy ((char *) strDest, strSource, (size_t) count);
3612 }
3613
3614 DECLARE_INLINE_HEADER (Intbyte *qxestrcat (Intbyte *strDest,
3615 const Intbyte *strSource))
3616 {
3617 return (Intbyte *) strcat ((char *) strDest, (const char *) strSource);
3618 }
3619
3620 DECLARE_INLINE_HEADER (Intbyte *qxestrcat_c (Intbyte *strDest,
3621 const char *strSource))
3622 {
3623 return (Intbyte *) strcat ((char *) strDest, strSource);
3624 }
3625
3626 DECLARE_INLINE_HEADER (Intbyte *qxestrncat (Intbyte *strDest,
3627 const Intbyte *strSource,
3628 Bytecount count))
3629 {
3630 return (Intbyte *) strncat ((char *) strDest, (const char *) strSource,
3631 (size_t) count);
3632 }
3633
3634 DECLARE_INLINE_HEADER (Intbyte *qxestrncat_c (Intbyte *strDest,
3635 const char *strSource,
3636 Bytecount count))
3637 {
3638 return (Intbyte *) strncat ((char *) strDest, strSource, (size_t) count);
3639 }
3640
3641 DECLARE_INLINE_HEADER (Intbyte *qxestrchr (const Intbyte *s, Emchar c))
3642 {
3643 assert (c >= 0 && c <= 255);
3644 return (Intbyte *) strchr ((const char *) s, c);
3645 }
3646
3647 DECLARE_INLINE_HEADER (Intbyte *qxestrrchr (const Intbyte *s, Emchar c))
3648 {
3649 assert (c >= 0 && c <= 255);
3650 return (Intbyte *) strrchr ((const char *) s, c);
3651 }
3652
3653 DECLARE_INLINE_HEADER (Intbyte *qxestrstr (const Intbyte *string1,
3654 const Intbyte *string2))
3655 {
3656 return (Intbyte *) strstr ((const char *) string1, (const char *) string2);
3657 }
3658
3659 DECLARE_INLINE_HEADER (Bytecount qxestrcspn (const Intbyte *string,
3660 const CIntbyte *strCharSet))
3661 {
3662 return (Bytecount) strcspn ((const char *) string, strCharSet);
3663 }
3664
3665 DECLARE_INLINE_HEADER (Bytecount qxestrspn (const Intbyte *string,
3666 const CIntbyte *strCharSet))
3667 {
3668 return (Bytecount) strspn ((const char *) string, strCharSet);
3669 }
3670
3671 DECLARE_INLINE_HEADER (Intbyte *qxestrpbrk (const Intbyte *string,
3672 const CIntbyte *strCharSet))
3673 {
3674 return (Intbyte *) strpbrk ((const char *) string, strCharSet);
3675 }
3676
3677 DECLARE_INLINE_HEADER (Intbyte *qxestrtok (Intbyte *strToken,
3678 const CIntbyte *strDelimit))
3679 {
3680 return (Intbyte *) strtok ((char *) strToken, strDelimit);
3681 }
3682
3683 DECLARE_INLINE_HEADER (double qxestrtod (const Intbyte *nptr,
3684 Intbyte **endptr))
3685 {
3686 return strtod ((const char *) nptr, (char **) endptr);
3687 }
3688
3689 DECLARE_INLINE_HEADER (long qxestrtol (const Intbyte *nptr, Intbyte **endptr,
3690 int base))
3691 {
3692 return strtol ((const char *) nptr, (char **) endptr, base);
3693 }
3694
3695 DECLARE_INLINE_HEADER (unsigned long qxestrtoul (const Intbyte *nptr,
3696 Intbyte **endptr,
3697 int base))
3698 {
3699 return strtoul ((const char *) nptr, (char **) endptr, base);
3700 }
3701
3702 DECLARE_INLINE_HEADER (int qxeatoi (const Intbyte *string))
3703 {
3704 return atoi ((const char *) string);
3705 }
3706
3707 int qxesprintf (Intbyte *buffer, const CIntbyte *format, ...)
3708 PRINTF_ARGS (2, 3);
3709
3710 /* Do not use POSIX locale routines. Not Mule-correct. */
3711 #define qxestrcoll DO NOT USE.
3712 #define qxestrxfrm DO NOT USE.
3713
3714 int qxestrcasecmp (const Intbyte *s1, const Intbyte *s2);
3715 int qxestrcasecmp_c (const Intbyte *s1, const Char_ASCII *s2);
3716 int qxestrcasecmp_i18n (const Intbyte *s1, const Intbyte *s2);
3717 int ascii_strcasecmp (const Char_ASCII *s1, const Char_ASCII *s2);
3718 int lisp_strcasecmp (Lisp_Object s1, Lisp_Object s2);
3719 int lisp_strcasecmp_i18n (Lisp_Object s1, Lisp_Object s2);
3720 int qxestrncasecmp (const Intbyte *s1, const Intbyte *s2, Bytecount len);
3721 int qxestrncasecmp_c (const Intbyte *s1, const Char_ASCII *s2, Bytecount len);
3722 int qxestrncasecmp_i18n (const Intbyte *s1, const Intbyte *s2, Bytecount len);
3723 int ascii_strncasecmp (const Char_ASCII *s1, const Char_ASCII *s2,
3724 Bytecount len);
3725 int qxememcmp (const Intbyte *s1, const Intbyte *s2, Bytecount len);
3726 int qxememcasecmp (const Intbyte *s1, const Intbyte *s2, Bytecount len);
3727 int qxememcasecmp_i18n (const Intbyte *s1, const Intbyte *s2, Bytecount len);
3728
3729 void buffer_mule_signal_inserted_region (struct buffer *buf, Charbpos start,
3730 Bytecount bytelength,
3731 Charcount charlength);
3732 void buffer_mule_signal_deleted_region (struct buffer *buf, Charbpos start,
3733 Charbpos end, Bytebpos bi_start,
3734 Bytebpos bi_end);
3735
3736 /* Defined in unicode.c */
3737 extern const struct struct_description to_unicode_description[];
3738 extern const struct struct_description from_unicode_description[];
3739 void init_charset_unicode_tables (Lisp_Object charset);
3740 void free_charset_unicode_tables (Lisp_Object charset);
3741 void recalculate_unicode_precedence (void);
3742 extern Lisp_Object Qunicode;
3743 extern Lisp_Object Qutf_16, Qutf_8, Qucs_4, Qutf_7;
3744 #ifdef MEMORY_USAGE_STATS
3745 Bytecount compute_from_unicode_table_size (Lisp_Object charset,
3746 struct overhead_stats *stats);
3747 Bytecount compute_to_unicode_table_size (Lisp_Object charset,
3748 struct overhead_stats *stats);
3749 #endif /* MEMORY_USAGE_STATS */
2967 3750
2968 /* Defined in undo.c */ 3751 /* Defined in undo.c */
2969 Lisp_Object truncate_undo_list (Lisp_Object, int, int); 3752 Lisp_Object truncate_undo_list (Lisp_Object, int, int);
2970 void record_extent (Lisp_Object, int); 3753 void record_extent (Lisp_Object, int);
2971 void record_insert (struct buffer *, Charbpos, Charcount); 3754 void record_insert (struct buffer *, Charbpos, Charcount);
3016 EXFUN (Fchar_after, 2); 3799 EXFUN (Fchar_after, 2);
3017 EXFUN (Fchar_to_string, 1); 3800 EXFUN (Fchar_to_string, 1);
3018 EXFUN (Fcheck_valid_plist, 1); 3801 EXFUN (Fcheck_valid_plist, 1);
3019 EXFUN (Fvalid_plist_p, 1); 3802 EXFUN (Fvalid_plist_p, 1);
3020 EXFUN (Fclear_range_table, 1); 3803 EXFUN (Fclear_range_table, 1);
3021 EXFUN (Fcoding_category_list, 0);
3022 EXFUN (Fcoding_category_system, 1);
3023 EXFUN (Fcoding_priority_list, 0);
3024 EXFUN (Fcoding_system_doc_string, 1);
3025 EXFUN (Fcoding_system_list, 0);
3026 EXFUN (Fcoding_system_name, 1);
3027 EXFUN (Fcoding_system_p, 1);
3028 EXFUN (Fcoding_system_property, 2);
3029 EXFUN (Fcoding_system_type, 1);
3030 EXFUN (Fcommand_execute, 3); 3804 EXFUN (Fcommand_execute, 3);
3031 EXFUN (Fcommandp, 1); 3805 EXFUN (Fcommandp, 1);
3032 EXFUN (Fconcat, MANY); 3806 EXFUN (Fconcat, MANY);
3033 EXFUN (Fcons, 2); 3807 EXFUN (Fcons, 2);
3034 EXFUN (Fcopy_alist, 1); 3808 EXFUN (Fcopy_alist, 1);
3035 EXFUN (Fcopy_coding_system, 2);
3036 EXFUN (Fcopy_event, 2); 3809 EXFUN (Fcopy_event, 2);
3037 EXFUN (Fcopy_list, 1); 3810 EXFUN (Fcopy_list, 1);
3038 EXFUN (Fcopy_marker, 2); 3811 EXFUN (Fcopy_marker, 2);
3039 EXFUN (Fcopy_sequence, 1); 3812 EXFUN (Fcopy_sequence, 1);
3040 EXFUN (Fcopy_tree, 2); 3813 EXFUN (Fcopy_tree, 2);
3041 EXFUN (Fcurrent_window_configuration, 1); 3814 EXFUN (Fcurrent_window_configuration, 1);
3042 EXFUN (Fdecode_big5_char, 1);
3043 EXFUN (Fdecode_coding_region, 4);
3044 EXFUN (Fdecode_shift_jis_char, 1);
3045 EXFUN (Fdefault_boundp, 1); 3815 EXFUN (Fdefault_boundp, 1);
3046 EXFUN (Fdefault_value, 1); 3816 EXFUN (Fdefault_value, 1);
3047 EXFUN (Fdefine_key, 3); 3817 EXFUN (Fdefine_key, 3);
3048 EXFUN (Fdelete, 2); 3818 EXFUN (Fdelete, 2);
3049 EXFUN (Fdelete_region, 3); 3819 EXFUN (Fdelete_region, 3);
3050 EXFUN (Fdelete_process, 1); 3820 EXFUN (Fdelete_process, 1);
3051 EXFUN (Fdelq, 2); 3821 EXFUN (Fdelq, 2);
3052 EXFUN (Fdestructive_alist_to_plist, 1); 3822 EXFUN (Fdestructive_alist_to_plist, 1);
3053 EXFUN (Fdetect_coding_region, 3);
3054 EXFUN (Fdgettext, 2); 3823 EXFUN (Fdgettext, 2);
3055 EXFUN (Fding, 3); 3824 EXFUN (Fding, 3);
3056 EXFUN (Fdirectory_file_name, 1); 3825 EXFUN (Fdirectory_file_name, 1);
3057 EXFUN (Fdisable_timeout, 1); 3826 EXFUN (Fdisable_timeout, 1);
3058 EXFUN (Fdiscard_input, 0); 3827 EXFUN (Fdiscard_input, 0);
3059 EXFUN (Fdispatch_event, 1); 3828 EXFUN (Fdispatch_event, 1);
3060 EXFUN (Fdisplay_error, 2); 3829 EXFUN (Fdisplay_error, 2);
3061 EXFUN (Fdo_auto_save, 2); 3830 EXFUN (Fdo_auto_save, 2);
3062 EXFUN (Fdowncase, 2); 3831 EXFUN (Fdowncase, 2);
3063 EXFUN (Felt, 2); 3832 EXFUN (Felt, 2);
3064 EXFUN (Fencode_big5_char, 1);
3065 EXFUN (Fencode_coding_region, 4);
3066 EXFUN (Fencode_shift_jis_char, 1);
3067 EXFUN (Fend_of_line, 2); 3833 EXFUN (Fend_of_line, 2);
3068 EXFUN (Fenqueue_eval_event, 2); 3834 EXFUN (Fenqueue_eval_event, 2);
3069 EXFUN (Feobp, 1); 3835 EXFUN (Feobp, 1);
3070 EXFUN (Feolp, 1); 3836 EXFUN (Feolp, 1);
3071 EXFUN (Fequal, 2); 3837 EXFUN (Fequal, 2);
3087 EXFUN (Ffile_name_directory, 1); 3853 EXFUN (Ffile_name_directory, 1);
3088 EXFUN (Ffile_name_nondirectory, 1); 3854 EXFUN (Ffile_name_nondirectory, 1);
3089 EXFUN (Ffile_readable_p, 1); 3855 EXFUN (Ffile_readable_p, 1);
3090 EXFUN (Ffile_symlink_p, 1); 3856 EXFUN (Ffile_symlink_p, 1);
3091 EXFUN (Ffile_truename, 2); 3857 EXFUN (Ffile_truename, 2);
3092 EXFUN (Ffind_coding_system, 1);
3093 EXFUN (Ffind_file_name_handler, 2); 3858 EXFUN (Ffind_file_name_handler, 2);
3094 EXFUN (Ffollowing_char, 1); 3859 EXFUN (Ffollowing_char, 1);
3095 EXFUN (Fformat, MANY); 3860 EXFUN (Fformat, MANY);
3096 EXFUN (Fforward_char, 2); 3861 EXFUN (Fforward_char, 2);
3097 EXFUN (Fforward_line, 2); 3862 EXFUN (Fforward_line, 2);
3099 EXFUN (Ffuncall, MANY); 3864 EXFUN (Ffuncall, MANY);
3100 EXFUN (Ffunctionp, 1); 3865 EXFUN (Ffunctionp, 1);
3101 EXFUN (Fgeq, MANY); 3866 EXFUN (Fgeq, MANY);
3102 EXFUN (Fget, 3); 3867 EXFUN (Fget, 3);
3103 EXFUN (Fget_buffer_process, 1); 3868 EXFUN (Fget_buffer_process, 1);
3104 EXFUN (Fget_coding_system, 1);
3105 EXFUN (Fget_process, 1); 3869 EXFUN (Fget_process, 1);
3106 EXFUN (Fget_range_table, 3); 3870 EXFUN (Fget_range_table, 3);
3107 EXFUN (Fgettext, 1); 3871 EXFUN (Fgettext, 1);
3108 EXFUN (Fgoto_char, 2); 3872 EXFUN (Fgoto_char, 2);
3109 EXFUN (Fgtr, MANY); 3873 EXFUN (Fgtr, MANY);
3129 EXFUN (Flist_modules, 0); 3893 EXFUN (Flist_modules, 0);
3130 EXFUN (Fload_module, 3); 3894 EXFUN (Fload_module, 3);
3131 EXFUN (Flookup_key, 3); 3895 EXFUN (Flookup_key, 3);
3132 EXFUN (Flss, MANY); 3896 EXFUN (Flss, MANY);
3133 EXFUN (Fmake_byte_code, MANY); 3897 EXFUN (Fmake_byte_code, MANY);
3134 EXFUN (Fmake_coding_system, 4); 3898 EXFUN (Fmake_charset, 3);
3135 EXFUN (Fmake_glyph_internal, 1); 3899 EXFUN (Fmake_glyph_internal, 1);
3136 EXFUN (Fmake_list, 2); 3900 EXFUN (Fmake_list, 2);
3137 EXFUN (Fmake_marker, 0); 3901 EXFUN (Fmake_marker, 0);
3138 EXFUN (Fmake_range_table, 0); 3902 EXFUN (Fmake_range_table, 0);
3903 EXFUN (Fmake_temp_name, 1);
3139 EXFUN (Fmake_sparse_keymap, 1); 3904 EXFUN (Fmake_sparse_keymap, 1);
3140 EXFUN (Fmake_string, 2); 3905 EXFUN (Fmake_string, 2);
3141 EXFUN (Fmake_symbol, 1); 3906 EXFUN (Fmake_symbol, 1);
3142 EXFUN (Fmake_vector, 2); 3907 EXFUN (Fmake_vector, 2);
3143 EXFUN (Fmapcar, 2); 3908 EXFUN (Fmapcar, 2);
3186 EXFUN (Fread_key_sequence, 3); 3951 EXFUN (Fread_key_sequence, 3);
3187 EXFUN (Freally_free, 1); 3952 EXFUN (Freally_free, 1);
3188 EXFUN (Frem, 2); 3953 EXFUN (Frem, 2);
3189 EXFUN (Fremassq, 2); 3954 EXFUN (Fremassq, 2);
3190 EXFUN (Freplace_list, 2); 3955 EXFUN (Freplace_list, 2);
3956 EXFUN (Frunning_temacs_p, 0);
3191 EXFUN (Fselected_frame, 1); 3957 EXFUN (Fselected_frame, 1);
3192 EXFUN (Fset, 2); 3958 EXFUN (Fset, 2);
3193 EXFUN (Fset_coding_category_system, 2);
3194 EXFUN (Fset_coding_priority_list, 1);
3195 EXFUN (Fset_default, 2); 3959 EXFUN (Fset_default, 2);
3196 EXFUN (Fset_marker, 3); 3960 EXFUN (Fset_marker, 3);
3197 EXFUN (Fset_standard_case_table, 1); 3961 EXFUN (Fset_standard_case_table, 1);
3198 EXFUN (Fsetcar, 2); 3962 EXFUN (Fsetcar, 2);
3199 EXFUN (Fsetcdr, 2); 3963 EXFUN (Fsetcdr, 2);
3208 EXFUN (Fstring_lessp, 2); 3972 EXFUN (Fstring_lessp, 2);
3209 EXFUN (Fstring_match, 4); 3973 EXFUN (Fstring_match, 4);
3210 EXFUN (Fsub1, 1); 3974 EXFUN (Fsub1, 1);
3211 EXFUN (Fsubr_max_args, 1); 3975 EXFUN (Fsubr_max_args, 1);
3212 EXFUN (Fsubr_min_args, 1); 3976 EXFUN (Fsubr_min_args, 1);
3213 EXFUN (Fsubsidiary_coding_system, 2);
3214 EXFUN (Fsubstitute_command_keys, 1); 3977 EXFUN (Fsubstitute_command_keys, 1);
3215 EXFUN (Fsubstitute_in_file_name, 1); 3978 EXFUN (Fsubstitute_in_file_name, 1);
3216 EXFUN (Fsubstring, 3); 3979 EXFUN (Fsubstring, 3);
3217 EXFUN (Fsymbol_function, 1); 3980 EXFUN (Fsymbol_function, 1);
3218 EXFUN (Fsymbol_name, 1); 3981 EXFUN (Fsymbol_name, 1);
3236 EXFUN (Fvertical_motion, 3); 3999 EXFUN (Fvertical_motion, 3);
3237 EXFUN (Fwiden, 1); 4000 EXFUN (Fwiden, 1);
3238 4001
3239 /*--------------- prototypes for constant symbols ------------*/ 4002 /*--------------- prototypes for constant symbols ------------*/
3240 4003
3241 extern Lisp_Object Q_style; 4004 /* Use the following when you have to add a bunch of symbols. */
3242 extern Lisp_Object Qactivate_menubar_hook; 4005
3243 extern Lisp_Object Qarith_error; 4006 /*
3244 extern Lisp_Object Qarrayp, Qautoload; 4007
3245 extern Lisp_Object Qbackground, Qbackground_pixmap; 4008 (defun redo-symbols (beg end)
3246 extern Lisp_Object Qbeginning_of_buffer, Qbig5; 4009 "Snarf any symbols out of the region and print them into a temporary buffer,
3247 extern Lisp_Object Qbitp, Qblinking; 4010 which is displayed when the function finishes. The symbols are laid out with
3248 extern Lisp_Object Qbuffer_glyph_p, Qbuffer_live_p, Qbuffer_read_only; 4011 `extern Lisp_Object ' before each one, with as many as can fit on one line
3249 extern Lisp_Object Qbyte_code, Qcall_interactively; 4012 \(the maximum line width is controlled by the constant `max-line-length' in the
3250 extern Lisp_Object Qcategory_designator_p, Qcategory_table_value_p, Qccl, Qcdr; 4013 code)."
3251 extern Lisp_Object Qchar_or_string_p, Qcharacterp; 4014 (interactive "r")
3252 extern Lisp_Object Qcharset_g0, Qcharset_g1, Qcharset_g2, Qcharset_g3; 4015 (save-excursion
3253 extern Lisp_Object Qcircular_list, Qcircular_property_list; 4016 (goto-char beg)
3254 extern Lisp_Object Qcolor_pixmap_image_instance_p; 4017 (let (syms)
3255 extern Lisp_Object Qcommandp, Qcompletion_ignore_case; 4018 (while (re-search-forward "\\s-\\(Q[A-Za-z_0-9]+\\)" end t)
3256 extern Lisp_Object Qconsole_live_p, Qconst_specifier, Qconversion_error, Qcr; 4019 (push (match-string 1) syms))
3257 extern Lisp_Object Qcrlf, Qcurrent_menubar, Qctext; 4020 (setq syms (sort syms #'string-lessp))
3258 extern Lisp_Object Qcyclic_variable_indirection, Qdecode; 4021 (with-output-to-temp-buffer "*Symbols*"
3259 extern Lisp_Object Qdefun, Qdevice_live_p; 4022 (let* ((col 0)
3260 extern Lisp_Object Qdim, Qdisabled, Qdisabled_command_hook, Qdisplay_table; 4023 (start "extern Lisp_Object ")
3261 extern Lisp_Object Qdomain_error; 4024 (startlen (length start))
3262 extern Lisp_Object Qediting_error; 4025 ;; with a default-width frame of 80 chars, you can only fit
3263 extern Lisp_Object Qencode, Qend_of_buffer, Qend_of_file, Qend_open; 4026 ;; 79 before wrapping. you can see this to a lower value if
3264 extern Lisp_Object Qeol_cr, Qeol_crlf, Qeol_lf, Qeol_type; 4027 ;; you don't want it right up against the right margin.
3265 extern Lisp_Object Qerror, Qerror_conditions, Qerror_lacks_explanatory_string; 4028 (max-line-length 79))
3266 extern Lisp_Object Qerror_message, Qescape_quoted; 4029 (dolist (sym syms)
3267 extern Lisp_Object Qevent_live_p, Qexit, Qextent_live_p; 4030 (cond (;; if something already on line (this will always be the
3268 extern Lisp_Object Qexternal_debugging_output, Qfeaturep; 4031 ;; case except the very first iteration), see what
3269 extern Lisp_Object Qfile_error; 4032 ;; space we've got. (need to take into account 2
3270 extern Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output; 4033 ;; for the comma+space, 1 for the semicolon at the
3271 extern Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output, Qforeground; 4034 ;; end.) if enough space, do it.
3272 extern Lisp_Object Qformat, Qframe_live_p, Qgui_error; 4035 (and (> col 0) (< (+ col (length sym) 2)
3273 extern Lisp_Object Qicon_glyph_p, Qidentity; 4036 (1- max-line-length)))
3274 extern Lisp_Object Qinhibit_quit, Qinhibit_read_only; 4037 (princ ", ")
3275 extern Lisp_Object Qinput_charset_conversion; 4038 (princ sym)
3276 extern Lisp_Object Qinteger_char_or_marker_p, Qinteger_or_char_p; 4039 (incf col 2)
3277 extern Lisp_Object Qinteger_or_marker_p, Qintegerp, Qinteractive; 4040 (incf col (length sym)))
3278 extern Lisp_Object Qinternal_error, Qinvalid_argument, Qinvalid_byte_code; 4041 (t
3279 extern Lisp_Object Qinvalid_change, Qinvalid_constant, Qinvalid_function; 4042 ;; either we're first iteration or we ran out of space.
3280 extern Lisp_Object Qinvalid_operation; 4043 ;; if the latter, terminate the previous line. this
3281 extern Lisp_Object Qinvalid_read_syntax, Qinvalid_state; 4044 ;; loop is written on purpose so that it always prints
3282 extern Lisp_Object Qio_error; 4045 ;; at least one item, even if that would go over.
3283 extern Lisp_Object Qiso2022; 4046 (when (> col 0)
3284 extern Lisp_Object Qlambda, Qlayout; 4047 (princ ";\n")
3285 extern Lisp_Object Qlf; 4048 (setq col 0))
3286 extern Lisp_Object Qlist_formation_error; 4049 (princ start)
3287 extern Lisp_Object Qlistp, Qload, Qlock_shift, Qmacro; 4050 (incf col startlen)
3288 extern Lisp_Object Qmakunbound, Qmalformed_list, Qmalformed_property_list; 4051 (princ sym)
3289 extern Lisp_Object Qmark; 4052 (incf col (length sym)))))
3290 extern Lisp_Object Qmnemonic; 4053 ;; finally terminate the last line.
3291 extern Lisp_Object Qmono_pixmap_image_instance_p; 4054 (princ ";\n"))))))
3292 extern Lisp_Object Qmouse_leave_buffer_hook; 4055
3293 extern Lisp_Object Qnatnump, Qnative_layout, Qnetwork_error; 4056 */
3294 extern Lisp_Object Qno_ascii_cntl, Qno_ascii_eol, Qno_catch; 4057
3295 extern Lisp_Object Qno_conversion, Qno_iso6429; 4058 extern Lisp_Object Qactivate_menubar_hook, Qarith_error, Qarrayp, Qautoload;
3296 extern Lisp_Object Qnothing_image_instance_p; 4059 extern Lisp_Object Qbackground, Qbackground_pixmap, Qbeginning_of_buffer;
3297 extern Lisp_Object Qnumber_char_or_marker_p, Qnumberp, Qout_of_memory; 4060 extern Lisp_Object Qbitp, Qblinking, Qbuffer_glyph_p, Qbuffer_live_p;
3298 extern Lisp_Object Qoutput_charset_conversion; 4061 extern Lisp_Object Qbuffer_read_only, Qbyte_code, Qcall_interactively;
4062 extern Lisp_Object Qcategory_designator_p, Qcategory_table_value_p, Qcdr;
4063 extern Lisp_Object Qchar_or_string_p, Qcharacterp, Qcircular_list;
4064 extern Lisp_Object Qcircular_property_list, Qcolor_pixmap_image_instance_p;
4065 extern Lisp_Object Qcommandp, Qcompletion_ignore_case, Qconsole_live_p;
4066 extern Lisp_Object Qconst_specifier, Qconversion_error, Qcurrent_menubar;
4067 extern Lisp_Object Qcyclic_variable_indirection, Qdefun, Qdevice_live_p, Qdim;
4068 extern Lisp_Object Qdirection, Qdisabled, Qdisabled_command_hook;
4069 extern Lisp_Object Qdisplay_table, Qdomain_error, Qediting_error;
4070 extern Lisp_Object Qend_of_buffer, Qend_of_file, Qend_open, Qerror;
4071 extern Lisp_Object Qerror_conditions, Qerror_lacks_explanatory_string;
4072 extern Lisp_Object Qerror_message, Qevent_live_p, Qexit, Qextent_live_p;
4073 extern Lisp_Object Qexternal_debugging_output, Qfeaturep, Qfile_error, Qfinal;
4074 extern Lisp_Object Qforeground, Qformat, Qframe_live_p, Qgraphic, Qgtk;
4075 extern Lisp_Object Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit;
4076 extern Lisp_Object Qinhibit_read_only, Qinteger_char_or_marker_p;
4077 extern Lisp_Object Qinteger_or_char_p, Qinteger_or_marker_p, Qintegerp;
4078 extern Lisp_Object Qinteractive, Qinternal_error, Qinvalid_argument;
4079 extern Lisp_Object Qinvalid_byte_code, Qinvalid_change, Qinvalid_constant;
4080 extern Lisp_Object Qinvalid_function, Qinvalid_operation;
4081 extern Lisp_Object Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlambda;
4082 extern Lisp_Object Qlayout, Qlist_formation_error, Qlistp, Qload, Qlock_shift;
4083 extern Lisp_Object Qlong_name, Qmacro, Qmakunbound, Qmalformed_list;
4084 extern Lisp_Object Qmalformed_property_list, Qmark;
4085 extern Lisp_Object Qmono_pixmap_image_instance_p, Qmouse_leave_buffer_hook;
4086 extern Lisp_Object Qnative_layout, Qnatnump, Qnetwork_error, Qno_catch;
4087 extern Lisp_Object Qnothing_image_instance_p, Qnumber_char_or_marker_p;
4088 extern Lisp_Object Qnumberp, Qout_of_memory, Qoutput_charset_conversion;
3299 extern Lisp_Object Qoverflow_error, Qpoint, Qpointer_glyph_p; 4089 extern Lisp_Object Qoverflow_error, Qpoint, Qpointer_glyph_p;
3300 extern Lisp_Object Qpointer_image_instance_p, Qpost_read_conversion; 4090 extern Lisp_Object Qpointer_image_instance_p, Qprint_length;
3301 extern Lisp_Object Qpre_write_conversion, Qprint_length;
3302 extern Lisp_Object Qprint_string_length, Qprinting_unreadable_object; 4091 extern Lisp_Object Qprint_string_length, Qprinting_unreadable_object;
3303 extern Lisp_Object Qprogn, Qprocess_error, Qquit; 4092 extern Lisp_Object Qprocess_error, Qprogn, Qquit, Qquote, Qrange_error;
3304 extern Lisp_Object Qquote, Qrange_error, Qread_char; 4093 extern Lisp_Object Qread_char, Qread_from_minibuffer;
3305 extern Lisp_Object Qread_from_minibuffer, Qreally_early_error_handler; 4094 extern Lisp_Object Qreally_early_error_handler, Qregion_beginning;
3306 extern Lisp_Object Qregion_beginning, Qregion_end; 4095 extern Lisp_Object Qregion_end, Qregistry, Qreverse_direction_charset;
3307 extern Lisp_Object Qrun_hooks, Qsans_modifiers; 4096 extern Lisp_Object Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs;
3308 extern Lisp_Object Qsave_buffers_kill_emacs; 4097 extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo, Qsequencep;
3309 extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo; 4098 extern Lisp_Object Qset, Qsetting_constant, Qshort_name, Qsingularity_error;
3310 extern Lisp_Object Qsequencep, Qset, Qsetting_constant; 4099 extern Lisp_Object Qsound_error, Qstack_overflow, Qstandard_input;
3311 extern Lisp_Object Qseven, Qshift_jis, Qshort; 4100 extern Lisp_Object Qstandard_output, Qstart_open, Qstring_lessp;
3312 extern Lisp_Object Qsingularity_error, Qsound_error, Qstack_overflow; 4101 extern Lisp_Object Qstructure_formation_error, Qsubwindow;
3313 extern Lisp_Object Qstandard_input, Qstandard_output; 4102 extern Lisp_Object Qsubwindow_image_instance_p, Qsyntax_error, Qt;
3314 extern Lisp_Object Qstart_open; 4103 extern Lisp_Object Qtext_conversion_error, Qtext_image_instance_p, Qtop_level;
3315 extern Lisp_Object Qstring_lessp, Qstructure_formation_error, Qsubwindow; 4104 extern Lisp_Object Qtrue_list_p, Qunbound, Qunderflow_error, Qunderline;
3316 extern Lisp_Object Qsubwindow_image_instance_p; 4105 extern Lisp_Object Quser_files_and_directories, Qvalues;
3317 extern Lisp_Object Qsyntax_error, Qt, Qtext_conversion_error; 4106 extern Lisp_Object Qvariable_documentation, Qvariable_domain, Qvoid_function;
3318 extern Lisp_Object Qtext_image_instance_p; 4107 extern Lisp_Object Qvoid_variable, Qwindow_live_p, Qwrong_number_of_arguments;
3319 extern Lisp_Object Qtop_level;
3320 extern Lisp_Object Qtrue_list_p;
3321 extern Lisp_Object Qunbound, Qunderflow_error;
3322 extern Lisp_Object Qunderline, Quser_files_and_directories;
3323 extern Lisp_Object Qvalues;
3324 extern Lisp_Object Qvariable_documentation, Qvariable_domain;
3325 extern Lisp_Object Qvoid_function, Qvoid_variable;
3326 extern Lisp_Object Qwindow_live_p, Qwrong_number_of_arguments;
3327 extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p; 4108 extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p;
3328 extern Lisp_Object Qgtk;
3329 4109
3330 #define SYMBOL(fou) extern Lisp_Object fou 4110 #define SYMBOL(fou) extern Lisp_Object fou
3331 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou 4111 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
3332 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \ 4112 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
3333 extern Lisp_Object tout_le_monde 4113 extern Lisp_Object tout_le_monde
3340 4120
3341 /*--------------- prototypes for variables of type Lisp_Object ------------*/ 4121 /*--------------- prototypes for variables of type Lisp_Object ------------*/
3342 4122
3343 extern Lisp_Object Vactivate_menubar_hook; 4123 extern Lisp_Object Vactivate_menubar_hook;
3344 extern Lisp_Object Vautoload_queue, Vblank_menubar; 4124 extern Lisp_Object Vautoload_queue, Vblank_menubar;
3345 extern Lisp_Object Vcharset_ascii, Vcharset_composite, Vcharset_control_1; 4125 extern Lisp_Object Vcommand_history;
3346 extern Lisp_Object Vcoding_system_for_read, Vcoding_system_for_write;
3347 extern Lisp_Object Vcoding_system_hash_table, Vcommand_history;
3348 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory; 4126 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory;
3349 extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory; 4127 extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory;
3350 extern Lisp_Object Vconsole_list, Vcontrolling_terminal; 4128 extern Lisp_Object Vconsole_list, Vcontrolling_terminal;
3351 extern Lisp_Object Vcurrent_compiled_function_annotation, Vcurrent_load_list; 4129 extern Lisp_Object Vcurrent_compiled_function_annotation, Vcurrent_load_list;
3352 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory; 4130 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory;
3353 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook; 4131 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook;
3354 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name; 4132 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name;
3355 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version; 4133 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version;
3356 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path; 4134 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path;
3357 extern Lisp_Object Vexecuting_macro, Vfeatures, Vfile_domain; 4135 extern Lisp_Object Vexecuting_macro, Vfeatures, Vfile_domain;
3358 extern Lisp_Object Vfile_name_coding_system, Vinhibit_quit; 4136 extern Lisp_Object Vinhibit_quit, Vinvocation_directory, Vinvocation_name;
3359 extern Lisp_Object Vinvocation_directory, Vinvocation_name; 4137 extern Lisp_Object Vlast_command, Vlast_command_char;
3360 extern Lisp_Object Vkeyboard_coding_system, Vlast_command, Vlast_command_char;
3361 extern Lisp_Object Vlast_command_event, Vlast_input_event; 4138 extern Lisp_Object Vlast_command_event, Vlast_input_event;
3362 extern Lisp_Object Vload_file_name_internal; 4139 extern Lisp_Object Vload_file_name_internal;
3363 extern Lisp_Object Vload_file_name_internal_the_purecopy, Vload_history; 4140 extern Lisp_Object Vload_file_name_internal_the_purecopy, Vload_history;
3364 extern Lisp_Object Vload_path, Vmark_even_if_inactive, Vmenubar_configuration; 4141 extern Lisp_Object Vload_path, Vmark_even_if_inactive, Vmenubar_configuration;
3365 extern Lisp_Object Vminibuf_preprompt, Vminibuf_prompt, Vminibuffer_zero; 4142 extern Lisp_Object Vminibuf_preprompt, Vminibuf_prompt, Vminibuffer_zero;
3368 extern Lisp_Object Vprint_length, Vprint_level, Vprocess_environment; 4145 extern Lisp_Object Vprint_length, Vprint_level, Vprocess_environment;
3369 extern Lisp_Object Vquit_flag; 4146 extern Lisp_Object Vquit_flag;
3370 extern Lisp_Object Vrecent_keys_ring, Vshell_file_name, Vsite_directory; 4147 extern Lisp_Object Vrecent_keys_ring, Vshell_file_name, Vsite_directory;
3371 extern Lisp_Object Vsite_module_directory; 4148 extern Lisp_Object Vsite_module_directory;
3372 extern Lisp_Object Vstandard_input, Vstandard_output, Vstdio_str; 4149 extern Lisp_Object Vstandard_input, Vstandard_output, Vstdio_str;
3373 extern Lisp_Object Vsynchronous_sounds, Vsystem_name, Vterminal_coding_system; 4150 extern Lisp_Object Vsynchronous_sounds, Vsystem_name;
3374 extern Lisp_Object Vthis_command_keys, Vunread_command_event; 4151 extern Lisp_Object Vthis_command_keys, Vunread_command_event;
3375 extern Lisp_Object Vx_initial_argv_list; 4152 extern Lisp_Object Vx_initial_argv_list;
3376 4153
3377 #endif /* INCLUDED_lisp_h_ */ 4154 #endif /* INCLUDED_lisp_h_ */