diff options
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 164 |
1 files changed, 127 insertions, 37 deletions
diff --git a/src/lisp.h b/src/lisp.h index 8ac01211a1f..d9a7c9d0bdc 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -124,7 +124,7 @@ extern _Noreturn void die (const char *, const char *, int); | |||
| 124 | eassert macro altogether, e.g., if XSTRING (x) uses eassert to test | 124 | eassert macro altogether, e.g., if XSTRING (x) uses eassert to test |
| 125 | STRINGP (x), but a particular use of XSTRING is invoked only after | 125 | STRINGP (x), but a particular use of XSTRING is invoked only after |
| 126 | testing that STRINGP (x) is true, making the test redundant. */ | 126 | testing that STRINGP (x) is true, making the test redundant. */ |
| 127 | extern int suppress_checking EXTERNALLY_VISIBLE; | 127 | extern bool suppress_checking EXTERNALLY_VISIBLE; |
| 128 | 128 | ||
| 129 | # define eassert(cond) \ | 129 | # define eassert(cond) \ |
| 130 | ((cond) || suppress_checking \ | 130 | ((cond) || suppress_checking \ |
| @@ -702,7 +702,7 @@ struct Lisp_Cons | |||
| 702 | #define CDR_SAFE(c) \ | 702 | #define CDR_SAFE(c) \ |
| 703 | (CONSP ((c)) ? XCDR ((c)) : Qnil) | 703 | (CONSP ((c)) ? XCDR ((c)) : Qnil) |
| 704 | 704 | ||
| 705 | /* Nonzero if STR is a multibyte string. */ | 705 | /* True if STR is a multibyte string. */ |
| 706 | #define STRING_MULTIBYTE(STR) \ | 706 | #define STRING_MULTIBYTE(STR) \ |
| 707 | (XSTRING (STR)->size_byte >= 0) | 707 | (XSTRING (STR)->size_byte >= 0) |
| 708 | 708 | ||
| @@ -923,7 +923,7 @@ enum | |||
| 923 | 8-bit European characters. Do not check validity of CT. */ | 923 | 8-bit European characters. Do not check validity of CT. */ |
| 924 | #define CHAR_TABLE_SET(CT, IDX, VAL) \ | 924 | #define CHAR_TABLE_SET(CT, IDX, VAL) \ |
| 925 | (ASCII_CHAR_P (IDX) && SUB_CHAR_TABLE_P (XCHAR_TABLE (CT)->ascii) \ | 925 | (ASCII_CHAR_P (IDX) && SUB_CHAR_TABLE_P (XCHAR_TABLE (CT)->ascii) \ |
| 926 | ? sub_char_table_set_contents (XCHAR_TABLE (CT)->ascii, IDX, VAL) \ | 926 | ? set_sub_char_table_contents (XCHAR_TABLE (CT)->ascii, IDX, VAL) \ |
| 927 | : char_table_set (CT, IDX, VAL)) | 927 | : char_table_set (CT, IDX, VAL)) |
| 928 | 928 | ||
| 929 | enum CHARTAB_SIZE_BITS | 929 | enum CHARTAB_SIZE_BITS |
| @@ -936,12 +936,6 @@ enum CHARTAB_SIZE_BITS | |||
| 936 | 936 | ||
| 937 | extern const int chartab_size[4]; | 937 | extern const int chartab_size[4]; |
| 938 | 938 | ||
| 939 | /* Most code should use this macro to set non-array Lisp fields in struct | ||
| 940 | Lisp_Char_Table. For CONTENTS and EXTRAS, use char_table_set_contents | ||
| 941 | and char_table_set_extras, respectively. */ | ||
| 942 | |||
| 943 | #define CSET(c, field, value) ((c)->field = (value)) | ||
| 944 | |||
| 945 | struct Lisp_Char_Table | 939 | struct Lisp_Char_Table |
| 946 | { | 940 | { |
| 947 | /* HEADER.SIZE is the vector's size field, which also holds the | 941 | /* HEADER.SIZE is the vector's size field, which also holds the |
| @@ -990,7 +984,7 @@ struct Lisp_Sub_Char_Table | |||
| 990 | /* Minimum character covered by the sub char-table. */ | 984 | /* Minimum character covered by the sub char-table. */ |
| 991 | Lisp_Object min_char; | 985 | Lisp_Object min_char; |
| 992 | 986 | ||
| 993 | /* Use sub_char_table_set_contents to set this. */ | 987 | /* Use set_sub_char_table_contents to set this. */ |
| 994 | Lisp_Object contents[1]; | 988 | Lisp_Object contents[1]; |
| 995 | }; | 989 | }; |
| 996 | 990 | ||
| @@ -1472,14 +1466,6 @@ struct Lisp_Buffer_Local_Value | |||
| 1472 | Lisp_Object valcell; | 1466 | Lisp_Object valcell; |
| 1473 | }; | 1467 | }; |
| 1474 | 1468 | ||
| 1475 | #define BLV_FOUND(blv) \ | ||
| 1476 | (eassert ((blv)->found == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found) | ||
| 1477 | #define SET_BLV_FOUND(blv, v) \ | ||
| 1478 | (eassert ((v) == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found = (v)) | ||
| 1479 | |||
| 1480 | #define BLV_VALUE(blv) (XCDR ((blv)->valcell)) | ||
| 1481 | #define SET_BLV_VALUE(blv, v) (XSETCDR ((blv)->valcell, v)) | ||
| 1482 | |||
| 1483 | /* Like Lisp_Objfwd except that value lives in a slot in the | 1469 | /* Like Lisp_Objfwd except that value lives in a slot in the |
| 1484 | current kboard. */ | 1470 | current kboard. */ |
| 1485 | struct Lisp_Kboard_Objfwd | 1471 | struct Lisp_Kboard_Objfwd |
| @@ -2358,32 +2344,67 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | |||
| 2358 | XVECTOR (array)->contents[idx] = val; | 2344 | XVECTOR (array)->contents[idx] = val; |
| 2359 | } | 2345 | } |
| 2360 | 2346 | ||
| 2347 | /* Copy COUNT Lisp_Objects from ARGS to contents of V starting from OFFSET. */ | ||
| 2348 | |||
| 2361 | LISP_INLINE void | 2349 | LISP_INLINE void |
| 2362 | set_hash_key (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | 2350 | vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) |
| 2351 | { | ||
| 2352 | eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); | ||
| 2353 | memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); | ||
| 2354 | } | ||
| 2355 | |||
| 2356 | /* Functions to modify hash tables. */ | ||
| 2357 | |||
| 2358 | LISP_INLINE void | ||
| 2359 | set_hash_key_and_value (struct Lisp_Hash_Table *h, Lisp_Object key_and_value) | ||
| 2360 | { | ||
| 2361 | h->key_and_value = key_and_value; | ||
| 2362 | } | ||
| 2363 | |||
| 2364 | LISP_INLINE void | ||
| 2365 | set_hash_key_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | ||
| 2363 | { | 2366 | { |
| 2364 | gc_aset (h->key_and_value, 2 * idx, val); | 2367 | gc_aset (h->key_and_value, 2 * idx, val); |
| 2365 | } | 2368 | } |
| 2366 | 2369 | ||
| 2367 | LISP_INLINE void | 2370 | LISP_INLINE void |
| 2368 | set_hash_value (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | 2371 | set_hash_value_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) |
| 2369 | { | 2372 | { |
| 2370 | gc_aset (h->key_and_value, 2 * idx + 1, val); | 2373 | gc_aset (h->key_and_value, 2 * idx + 1, val); |
| 2371 | } | 2374 | } |
| 2372 | 2375 | ||
| 2373 | LISP_INLINE void | 2376 | LISP_INLINE void |
| 2374 | set_hash_next (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | 2377 | set_hash_next (struct Lisp_Hash_Table *h, Lisp_Object next) |
| 2378 | { | ||
| 2379 | h->next = next; | ||
| 2380 | } | ||
| 2381 | |||
| 2382 | LISP_INLINE void | ||
| 2383 | set_hash_next_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | ||
| 2375 | { | 2384 | { |
| 2376 | gc_aset (h->next, idx, val); | 2385 | gc_aset (h->next, idx, val); |
| 2377 | } | 2386 | } |
| 2378 | 2387 | ||
| 2379 | LISP_INLINE void | 2388 | LISP_INLINE void |
| 2380 | set_hash_hash (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | 2389 | set_hash_hash (struct Lisp_Hash_Table *h, Lisp_Object hash) |
| 2390 | { | ||
| 2391 | h->hash = hash; | ||
| 2392 | } | ||
| 2393 | |||
| 2394 | LISP_INLINE void | ||
| 2395 | set_hash_hash_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | ||
| 2381 | { | 2396 | { |
| 2382 | gc_aset (h->hash, idx, val); | 2397 | gc_aset (h->hash, idx, val); |
| 2383 | } | 2398 | } |
| 2384 | 2399 | ||
| 2385 | LISP_INLINE void | 2400 | LISP_INLINE void |
| 2386 | set_hash_index (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | 2401 | set_hash_index (struct Lisp_Hash_Table *h, Lisp_Object index) |
| 2402 | { | ||
| 2403 | h->index = index; | ||
| 2404 | } | ||
| 2405 | |||
| 2406 | LISP_INLINE void | ||
| 2407 | set_hash_index_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) | ||
| 2387 | { | 2408 | { |
| 2388 | gc_aset (h->index, idx, val); | 2409 | gc_aset (h->index, idx, val); |
| 2389 | } | 2410 | } |
| @@ -2415,6 +2436,52 @@ set_symbol_next (Lisp_Object sym, struct Lisp_Symbol *next) | |||
| 2415 | XSYMBOL (sym)->next = next; | 2436 | XSYMBOL (sym)->next = next; |
| 2416 | } | 2437 | } |
| 2417 | 2438 | ||
| 2439 | /* Buffer-local (also frame-local) variable access functions. */ | ||
| 2440 | |||
| 2441 | LISP_INLINE int | ||
| 2442 | blv_found (struct Lisp_Buffer_Local_Value *blv) | ||
| 2443 | { | ||
| 2444 | eassert (blv->found == !EQ (blv->defcell, blv->valcell)); | ||
| 2445 | return blv->found; | ||
| 2446 | } | ||
| 2447 | |||
| 2448 | LISP_INLINE void | ||
| 2449 | set_blv_found (struct Lisp_Buffer_Local_Value *blv, int found) | ||
| 2450 | { | ||
| 2451 | eassert (found == !EQ (blv->defcell, blv->valcell)); | ||
| 2452 | blv->found = found; | ||
| 2453 | } | ||
| 2454 | |||
| 2455 | LISP_INLINE Lisp_Object | ||
| 2456 | blv_value (struct Lisp_Buffer_Local_Value *blv) | ||
| 2457 | { | ||
| 2458 | return XCDR (blv->valcell); | ||
| 2459 | } | ||
| 2460 | |||
| 2461 | LISP_INLINE void | ||
| 2462 | set_blv_value (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val) | ||
| 2463 | { | ||
| 2464 | XSETCDR (blv->valcell, val); | ||
| 2465 | } | ||
| 2466 | |||
| 2467 | LISP_INLINE void | ||
| 2468 | set_blv_where (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val) | ||
| 2469 | { | ||
| 2470 | blv->where = val; | ||
| 2471 | } | ||
| 2472 | |||
| 2473 | LISP_INLINE void | ||
| 2474 | set_blv_defcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val) | ||
| 2475 | { | ||
| 2476 | blv->defcell = val; | ||
| 2477 | } | ||
| 2478 | |||
| 2479 | LISP_INLINE void | ||
| 2480 | set_blv_valcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val) | ||
| 2481 | { | ||
| 2482 | blv->valcell = val; | ||
| 2483 | } | ||
| 2484 | |||
| 2418 | /* Set overlay's property list. */ | 2485 | /* Set overlay's property list. */ |
| 2419 | 2486 | ||
| 2420 | LISP_INLINE void | 2487 | LISP_INLINE void |
| @@ -2426,7 +2493,7 @@ set_overlay_plist (Lisp_Object overlay, Lisp_Object plist) | |||
| 2426 | /* Get text properties of S. */ | 2493 | /* Get text properties of S. */ |
| 2427 | 2494 | ||
| 2428 | LISP_INLINE INTERVAL | 2495 | LISP_INLINE INTERVAL |
| 2429 | string_get_intervals (Lisp_Object s) | 2496 | string_intervals (Lisp_Object s) |
| 2430 | { | 2497 | { |
| 2431 | return XSTRING (s)->intervals; | 2498 | return XSTRING (s)->intervals; |
| 2432 | } | 2499 | } |
| @@ -2434,29 +2501,53 @@ string_get_intervals (Lisp_Object s) | |||
| 2434 | /* Set text properties of S to I. */ | 2501 | /* Set text properties of S to I. */ |
| 2435 | 2502 | ||
| 2436 | LISP_INLINE void | 2503 | LISP_INLINE void |
| 2437 | string_set_intervals (Lisp_Object s, INTERVAL i) | 2504 | set_string_intervals (Lisp_Object s, INTERVAL i) |
| 2438 | { | 2505 | { |
| 2439 | XSTRING (s)->intervals = i; | 2506 | XSTRING (s)->intervals = i; |
| 2440 | } | 2507 | } |
| 2441 | 2508 | ||
| 2509 | /* Set a Lisp slot in TABLE to VAL. Most code should use this instead | ||
| 2510 | of setting slots directly. */ | ||
| 2511 | |||
| 2512 | LISP_INLINE void | ||
| 2513 | set_char_table_ascii (Lisp_Object table, Lisp_Object val) | ||
| 2514 | { | ||
| 2515 | XCHAR_TABLE (table)->ascii = val; | ||
| 2516 | } | ||
| 2517 | LISP_INLINE void | ||
| 2518 | set_char_table_defalt (Lisp_Object table, Lisp_Object val) | ||
| 2519 | { | ||
| 2520 | XCHAR_TABLE (table)->defalt = val; | ||
| 2521 | } | ||
| 2522 | LISP_INLINE void | ||
| 2523 | set_char_table_parent (Lisp_Object table, Lisp_Object val) | ||
| 2524 | { | ||
| 2525 | XCHAR_TABLE (table)->parent = val; | ||
| 2526 | } | ||
| 2527 | LISP_INLINE void | ||
| 2528 | set_char_table_purpose (Lisp_Object table, Lisp_Object val) | ||
| 2529 | { | ||
| 2530 | XCHAR_TABLE (table)->purpose = val; | ||
| 2531 | } | ||
| 2532 | |||
| 2442 | /* Set different slots in (sub)character tables. */ | 2533 | /* Set different slots in (sub)character tables. */ |
| 2443 | 2534 | ||
| 2444 | LISP_INLINE void | 2535 | LISP_INLINE void |
| 2445 | char_table_set_extras (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) | 2536 | set_char_table_extras (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) |
| 2446 | { | 2537 | { |
| 2447 | eassert (0 <= idx && idx < CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (table))); | 2538 | eassert (0 <= idx && idx < CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (table))); |
| 2448 | XCHAR_TABLE (table)->extras[idx] = val; | 2539 | XCHAR_TABLE (table)->extras[idx] = val; |
| 2449 | } | 2540 | } |
| 2450 | 2541 | ||
| 2451 | LISP_INLINE void | 2542 | LISP_INLINE void |
| 2452 | char_table_set_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) | 2543 | set_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) |
| 2453 | { | 2544 | { |
| 2454 | eassert (0 <= idx && idx < (1 << CHARTAB_SIZE_BITS_0)); | 2545 | eassert (0 <= idx && idx < (1 << CHARTAB_SIZE_BITS_0)); |
| 2455 | XCHAR_TABLE (table)->contents[idx] = val; | 2546 | XCHAR_TABLE (table)->contents[idx] = val; |
| 2456 | } | 2547 | } |
| 2457 | 2548 | ||
| 2458 | LISP_INLINE void | 2549 | LISP_INLINE void |
| 2459 | sub_char_table_set_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) | 2550 | set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) |
| 2460 | { | 2551 | { |
| 2461 | XSUB_CHAR_TABLE (table)->contents[idx] = val; | 2552 | XSUB_CHAR_TABLE (table)->contents[idx] = val; |
| 2462 | } | 2553 | } |
| @@ -2708,7 +2799,7 @@ extern Lisp_Object echo_area_buffer[2]; | |||
| 2708 | extern void add_to_log (const char *, Lisp_Object, Lisp_Object); | 2799 | extern void add_to_log (const char *, Lisp_Object, Lisp_Object); |
| 2709 | extern void check_message_stack (void); | 2800 | extern void check_message_stack (void); |
| 2710 | extern void setup_echo_area_for_printing (int); | 2801 | extern void setup_echo_area_for_printing (int); |
| 2711 | extern int push_message (void); | 2802 | extern bool push_message (void); |
| 2712 | extern Lisp_Object pop_message_unwind (Lisp_Object); | 2803 | extern Lisp_Object pop_message_unwind (Lisp_Object); |
| 2713 | extern Lisp_Object restore_message_unwind (Lisp_Object); | 2804 | extern Lisp_Object restore_message_unwind (Lisp_Object); |
| 2714 | extern void restore_message (void); | 2805 | extern void restore_message (void); |
| @@ -2751,7 +2842,7 @@ extern void uninterrupt_malloc (void); | |||
| 2751 | extern void malloc_warning (const char *); | 2842 | extern void malloc_warning (const char *); |
| 2752 | extern _Noreturn void memory_full (size_t); | 2843 | extern _Noreturn void memory_full (size_t); |
| 2753 | extern _Noreturn void buffer_memory_full (ptrdiff_t); | 2844 | extern _Noreturn void buffer_memory_full (ptrdiff_t); |
| 2754 | extern int survives_gc_p (Lisp_Object); | 2845 | extern bool survives_gc_p (Lisp_Object); |
| 2755 | extern void mark_object (Lisp_Object); | 2846 | extern void mark_object (Lisp_Object); |
| 2756 | #if defined REL_ALLOC && !defined SYSTEM_MALLOC | 2847 | #if defined REL_ALLOC && !defined SYSTEM_MALLOC |
| 2757 | extern void refill_memory_reserve (void); | 2848 | extern void refill_memory_reserve (void); |
| @@ -2790,8 +2881,8 @@ extern Lisp_Object make_uninit_string (EMACS_INT); | |||
| 2790 | extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT); | 2881 | extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT); |
| 2791 | extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t); | 2882 | extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t); |
| 2792 | extern Lisp_Object make_specified_string (const char *, | 2883 | extern Lisp_Object make_specified_string (const char *, |
| 2793 | ptrdiff_t, ptrdiff_t, int); | 2884 | ptrdiff_t, ptrdiff_t, bool); |
| 2794 | extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int); | 2885 | extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, bool); |
| 2795 | extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t); | 2886 | extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t); |
| 2796 | 2887 | ||
| 2797 | /* Make a string allocated in pure space, use STR as string data. */ | 2888 | /* Make a string allocated in pure space, use STR as string data. */ |
| @@ -2825,8 +2916,8 @@ extern struct window *allocate_window (void); | |||
| 2825 | extern struct frame *allocate_frame (void); | 2916 | extern struct frame *allocate_frame (void); |
| 2826 | extern struct Lisp_Process *allocate_process (void); | 2917 | extern struct Lisp_Process *allocate_process (void); |
| 2827 | extern struct terminal *allocate_terminal (void); | 2918 | extern struct terminal *allocate_terminal (void); |
| 2828 | extern int gc_in_progress; | 2919 | extern bool gc_in_progress; |
| 2829 | extern int abort_on_gc; | 2920 | extern bool abort_on_gc; |
| 2830 | extern Lisp_Object make_float (double); | 2921 | extern Lisp_Object make_float (double); |
| 2831 | extern void display_malloc_warning (void); | 2922 | extern void display_malloc_warning (void); |
| 2832 | extern ptrdiff_t inhibit_garbage_collection (void); | 2923 | extern ptrdiff_t inhibit_garbage_collection (void); |
| @@ -2859,9 +2950,8 @@ extern Lisp_Object copy_char_table (Lisp_Object); | |||
| 2859 | extern Lisp_Object char_table_ref (Lisp_Object, int); | 2950 | extern Lisp_Object char_table_ref (Lisp_Object, int); |
| 2860 | extern Lisp_Object char_table_ref_and_range (Lisp_Object, int, | 2951 | extern Lisp_Object char_table_ref_and_range (Lisp_Object, int, |
| 2861 | int *, int *); | 2952 | int *, int *); |
| 2862 | extern Lisp_Object char_table_set (Lisp_Object, int, Lisp_Object); | 2953 | extern void char_table_set (Lisp_Object, int, Lisp_Object); |
| 2863 | extern Lisp_Object char_table_set_range (Lisp_Object, int, int, | 2954 | extern void char_table_set_range (Lisp_Object, int, int, Lisp_Object); |
| 2864 | Lisp_Object); | ||
| 2865 | extern int char_table_translate (Lisp_Object, int); | 2955 | extern int char_table_translate (Lisp_Object, int); |
| 2866 | extern void map_char_table (void (*) (Lisp_Object, Lisp_Object, | 2956 | extern void map_char_table (void (*) (Lisp_Object, Lisp_Object, |
| 2867 | Lisp_Object), | 2957 | Lisp_Object), |