diff options
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 152 |
1 files changed, 86 insertions, 66 deletions
diff --git a/src/buffer.h b/src/buffer.h index 276cca32e48..d461415e036 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Header file for the buffer manipulation primitives. | 1 | /* Header file for the buffer manipulation primitives. |
| 2 | 2 | ||
| 3 | Copyright (C) 1985-1986, 1993-1995, 1997-2013 Free Software Foundation, | 3 | Copyright (C) 1985-1986, 1993-1995, 1997-2014 Free Software Foundation, |
| 4 | Inc. | 4 | Inc. |
| 5 | 5 | ||
| 6 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| @@ -18,13 +18,10 @@ GNU General Public License for more details. | |||
| 18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 20 | 20 | ||
| 21 | #include <sys/types.h> /* for off_t, time_t */ | 21 | #include <sys/types.h> |
| 22 | #include "systime.h" /* for EMACS_TIME */ | 22 | #include <time.h> |
| 23 | 23 | ||
| 24 | INLINE_HEADER_BEGIN | 24 | INLINE_HEADER_BEGIN |
| 25 | #ifndef BUFFER_INLINE | ||
| 26 | # define BUFFER_INLINE INLINE | ||
| 27 | #endif | ||
| 28 | 25 | ||
| 29 | /* Accessing the parameters of the current buffer. */ | 26 | /* Accessing the parameters of the current buffer. */ |
| 30 | 27 | ||
| @@ -229,7 +226,7 @@ INLINE_HEADER_BEGIN | |||
| 229 | BUF_BEG_UNCHANGED (buf) = (start) - BUF_BEG (buf); \ | 226 | BUF_BEG_UNCHANGED (buf) = (start) - BUF_BEG (buf); \ |
| 230 | } \ | 227 | } \ |
| 231 | } \ | 228 | } \ |
| 232 | while (0) | 229 | while (false) |
| 233 | 230 | ||
| 234 | 231 | ||
| 235 | /* Macros to set PT in the current buffer, or another buffer. */ | 232 | /* Macros to set PT in the current buffer, or another buffer. */ |
| @@ -249,6 +246,7 @@ extern void temp_set_point (struct buffer *, ptrdiff_t); | |||
| 249 | extern void set_point_both (ptrdiff_t, ptrdiff_t); | 246 | extern void set_point_both (ptrdiff_t, ptrdiff_t); |
| 250 | extern void temp_set_point_both (struct buffer *, | 247 | extern void temp_set_point_both (struct buffer *, |
| 251 | ptrdiff_t, ptrdiff_t); | 248 | ptrdiff_t, ptrdiff_t); |
| 249 | extern void set_point_from_marker (Lisp_Object); | ||
| 252 | extern void enlarge_buffer_text (struct buffer *, ptrdiff_t); | 250 | extern void enlarge_buffer_text (struct buffer *, ptrdiff_t); |
| 253 | 251 | ||
| 254 | 252 | ||
| @@ -304,7 +302,7 @@ extern void enlarge_buffer_text (struct buffer *, ptrdiff_t); | |||
| 304 | else \ | 302 | else \ |
| 305 | wrong_type_argument (Qinteger_or_marker_p, __pos); \ | 303 | wrong_type_argument (Qinteger_or_marker_p, __pos); \ |
| 306 | } \ | 304 | } \ |
| 307 | while (0) | 305 | while (false) |
| 308 | 306 | ||
| 309 | /* Maximum number of bytes in a buffer. | 307 | /* Maximum number of bytes in a buffer. |
| 310 | A buffer cannot contain more bytes than a 1-origin fixnum can represent, | 308 | A buffer cannot contain more bytes than a 1-origin fixnum can represent, |
| @@ -474,10 +472,13 @@ struct buffer_text | |||
| 474 | to move a marker within a buffer. */ | 472 | to move a marker within a buffer. */ |
| 475 | struct Lisp_Marker *markers; | 473 | struct Lisp_Marker *markers; |
| 476 | 474 | ||
| 477 | /* Usually 0. Temporarily set to 1 in decode_coding_gap to | 475 | /* Usually false. Temporarily true in decode_coding_gap to |
| 478 | prevent Fgarbage_collect from shrinking the gap and losing | 476 | prevent Fgarbage_collect from shrinking the gap and losing |
| 479 | not-yet-decoded bytes. */ | 477 | not-yet-decoded bytes. */ |
| 480 | bool inhibit_shrinking; | 478 | bool_bf inhibit_shrinking : 1; |
| 479 | |||
| 480 | /* True if it needs to be redisplayed. */ | ||
| 481 | bool_bf redisplay : 1; | ||
| 481 | }; | 482 | }; |
| 482 | 483 | ||
| 483 | /* Most code should use this macro to access Lisp fields in struct buffer. */ | 484 | /* Most code should use this macro to access Lisp fields in struct buffer. */ |
| @@ -632,9 +633,9 @@ struct buffer | |||
| 632 | /* List of symbols naming the file format used for auto-save file. */ | 633 | /* List of symbols naming the file format used for auto-save file. */ |
| 633 | Lisp_Object INTERNAL_FIELD (auto_save_file_format); | 634 | Lisp_Object INTERNAL_FIELD (auto_save_file_format); |
| 634 | 635 | ||
| 635 | /* True if the newline position cache and width run cache are | 636 | /* True if the newline position cache, width run cache and BIDI paragraph |
| 636 | enabled. See search.c and indent.c. */ | 637 | cache are enabled. See search.c, indent.c and bidi.c for details. */ |
| 637 | Lisp_Object INTERNAL_FIELD (cache_long_line_scans); | 638 | Lisp_Object INTERNAL_FIELD (cache_long_scans); |
| 638 | 639 | ||
| 639 | /* If the width run cache is enabled, this table contains the | 640 | /* If the width run cache is enabled, this table contains the |
| 640 | character widths width_run_cache (see above) assumes. When we | 641 | character widths width_run_cache (see above) assumes. When we |
| @@ -740,7 +741,7 @@ struct buffer | |||
| 740 | Lisp_Object INTERNAL_FIELD (cursor_in_non_selected_windows); | 741 | Lisp_Object INTERNAL_FIELD (cursor_in_non_selected_windows); |
| 741 | 742 | ||
| 742 | /* No more Lisp_Object beyond this point. Except undo_list, | 743 | /* No more Lisp_Object beyond this point. Except undo_list, |
| 743 | which is handled specially in Fgarbage_collect . */ | 744 | which is handled specially in Fgarbage_collect. */ |
| 744 | 745 | ||
| 745 | /* This structure holds the coordinates of the buffer contents | 746 | /* This structure holds the coordinates of the buffer contents |
| 746 | in ordinary buffers. In indirect buffers, this is not used. */ | 747 | in ordinary buffers. In indirect buffers, this is not used. */ |
| @@ -794,13 +795,13 @@ struct buffer | |||
| 794 | char local_flags[MAX_PER_BUFFER_VARS]; | 795 | char local_flags[MAX_PER_BUFFER_VARS]; |
| 795 | 796 | ||
| 796 | /* Set to the modtime of the visited file when read or written. | 797 | /* Set to the modtime of the visited file when read or written. |
| 797 | EMACS_NSECS (modtime) == NONEXISTENT_MODTIME_NSECS means | 798 | modtime.tv_nsec == NONEXISTENT_MODTIME_NSECS means |
| 798 | visited file was nonexistent. EMACS_NSECS (modtime) == | 799 | visited file was nonexistent. modtime.tv_nsec == |
| 799 | UNKNOWN_MODTIME_NSECS means visited file modtime unknown; | 800 | UNKNOWN_MODTIME_NSECS means visited file modtime unknown; |
| 800 | in no case complain about any mismatch on next save attempt. */ | 801 | in no case complain about any mismatch on next save attempt. */ |
| 801 | #define NONEXISTENT_MODTIME_NSECS (-1) | 802 | #define NONEXISTENT_MODTIME_NSECS (-1) |
| 802 | #define UNKNOWN_MODTIME_NSECS (-2) | 803 | #define UNKNOWN_MODTIME_NSECS (-2) |
| 803 | EMACS_TIME modtime; | 804 | struct timespec modtime; |
| 804 | 805 | ||
| 805 | /* Size of the file when modtime was set. This is used to detect the | 806 | /* Size of the file when modtime was set. This is used to detect the |
| 806 | case where the file grew while we were reading it, so the modtime | 807 | case where the file grew while we were reading it, so the modtime |
| @@ -839,16 +840,19 @@ struct buffer | |||
| 839 | the character's width; if it maps a character to zero, we don't | 840 | the character's width; if it maps a character to zero, we don't |
| 840 | know what its width is. This allows compute_motion to process | 841 | know what its width is. This allows compute_motion to process |
| 841 | such regions very quickly, using algebra instead of inspecting | 842 | such regions very quickly, using algebra instead of inspecting |
| 842 | each character. See also width_table, below. */ | 843 | each character. See also width_table, below. |
| 844 | |||
| 845 | The latter cache is used to speedup bidi_find_paragraph_start. */ | ||
| 843 | struct region_cache *newline_cache; | 846 | struct region_cache *newline_cache; |
| 844 | struct region_cache *width_run_cache; | 847 | struct region_cache *width_run_cache; |
| 848 | struct region_cache *bidi_paragraph_cache; | ||
| 845 | 849 | ||
| 846 | /* Non-zero means don't use redisplay optimizations for | 850 | /* Non-zero means don't use redisplay optimizations for |
| 847 | displaying this buffer. */ | 851 | displaying this buffer. */ |
| 848 | unsigned prevent_redisplay_optimizations_p : 1; | 852 | bool_bf prevent_redisplay_optimizations_p : 1; |
| 849 | 853 | ||
| 850 | /* Non-zero whenever the narrowing is changed in this buffer. */ | 854 | /* Non-zero whenever the narrowing is changed in this buffer. */ |
| 851 | unsigned clip_changed : 1; | 855 | bool_bf clip_changed : 1; |
| 852 | 856 | ||
| 853 | /* List of overlays that end at or before the current center, | 857 | /* List of overlays that end at or before the current center, |
| 854 | in order of end-position. */ | 858 | in order of end-position. */ |
| @@ -870,98 +874,104 @@ struct buffer | |||
| 870 | }; | 874 | }; |
| 871 | 875 | ||
| 872 | /* Most code should use these functions to set Lisp fields in struct | 876 | /* Most code should use these functions to set Lisp fields in struct |
| 873 | buffer. */ | 877 | buffer. (Some setters that are private to a single .c file are |
| 874 | BUFFER_INLINE void | 878 | defined as static in those files.) */ |
| 879 | INLINE void | ||
| 875 | bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) | 880 | bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) |
| 876 | { | 881 | { |
| 877 | b->INTERNAL_FIELD (bidi_paragraph_direction) = val; | 882 | b->INTERNAL_FIELD (bidi_paragraph_direction) = val; |
| 878 | } | 883 | } |
| 879 | BUFFER_INLINE void | 884 | INLINE void |
| 885 | bset_cache_long_scans (struct buffer *b, Lisp_Object val) | ||
| 886 | { | ||
| 887 | b->INTERNAL_FIELD (cache_long_scans) = val; | ||
| 888 | } | ||
| 889 | INLINE void | ||
| 880 | bset_case_canon_table (struct buffer *b, Lisp_Object val) | 890 | bset_case_canon_table (struct buffer *b, Lisp_Object val) |
| 881 | { | 891 | { |
| 882 | b->INTERNAL_FIELD (case_canon_table) = val; | 892 | b->INTERNAL_FIELD (case_canon_table) = val; |
| 883 | } | 893 | } |
| 884 | BUFFER_INLINE void | 894 | INLINE void |
| 885 | bset_case_eqv_table (struct buffer *b, Lisp_Object val) | 895 | bset_case_eqv_table (struct buffer *b, Lisp_Object val) |
| 886 | { | 896 | { |
| 887 | b->INTERNAL_FIELD (case_eqv_table) = val; | 897 | b->INTERNAL_FIELD (case_eqv_table) = val; |
| 888 | } | 898 | } |
| 889 | BUFFER_INLINE void | 899 | INLINE void |
| 890 | bset_directory (struct buffer *b, Lisp_Object val) | 900 | bset_directory (struct buffer *b, Lisp_Object val) |
| 891 | { | 901 | { |
| 892 | b->INTERNAL_FIELD (directory) = val; | 902 | b->INTERNAL_FIELD (directory) = val; |
| 893 | } | 903 | } |
| 894 | BUFFER_INLINE void | 904 | INLINE void |
| 895 | bset_display_count (struct buffer *b, Lisp_Object val) | 905 | bset_display_count (struct buffer *b, Lisp_Object val) |
| 896 | { | 906 | { |
| 897 | b->INTERNAL_FIELD (display_count) = val; | 907 | b->INTERNAL_FIELD (display_count) = val; |
| 898 | } | 908 | } |
| 899 | BUFFER_INLINE void | 909 | INLINE void |
| 900 | bset_display_time (struct buffer *b, Lisp_Object val) | 910 | bset_display_time (struct buffer *b, Lisp_Object val) |
| 901 | { | 911 | { |
| 902 | b->INTERNAL_FIELD (display_time) = val; | 912 | b->INTERNAL_FIELD (display_time) = val; |
| 903 | } | 913 | } |
| 904 | BUFFER_INLINE void | 914 | INLINE void |
| 905 | bset_downcase_table (struct buffer *b, Lisp_Object val) | 915 | bset_downcase_table (struct buffer *b, Lisp_Object val) |
| 906 | { | 916 | { |
| 907 | b->INTERNAL_FIELD (downcase_table) = val; | 917 | b->INTERNAL_FIELD (downcase_table) = val; |
| 908 | } | 918 | } |
| 909 | BUFFER_INLINE void | 919 | INLINE void |
| 910 | bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) | 920 | bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) |
| 911 | { | 921 | { |
| 912 | b->INTERNAL_FIELD (enable_multibyte_characters) = val; | 922 | b->INTERNAL_FIELD (enable_multibyte_characters) = val; |
| 913 | } | 923 | } |
| 914 | BUFFER_INLINE void | 924 | INLINE void |
| 915 | bset_filename (struct buffer *b, Lisp_Object val) | 925 | bset_filename (struct buffer *b, Lisp_Object val) |
| 916 | { | 926 | { |
| 917 | b->INTERNAL_FIELD (filename) = val; | 927 | b->INTERNAL_FIELD (filename) = val; |
| 918 | } | 928 | } |
| 919 | BUFFER_INLINE void | 929 | INLINE void |
| 920 | bset_keymap (struct buffer *b, Lisp_Object val) | 930 | bset_keymap (struct buffer *b, Lisp_Object val) |
| 921 | { | 931 | { |
| 922 | b->INTERNAL_FIELD (keymap) = val; | 932 | b->INTERNAL_FIELD (keymap) = val; |
| 923 | } | 933 | } |
| 924 | BUFFER_INLINE void | 934 | INLINE void |
| 925 | bset_last_selected_window (struct buffer *b, Lisp_Object val) | 935 | bset_last_selected_window (struct buffer *b, Lisp_Object val) |
| 926 | { | 936 | { |
| 927 | b->INTERNAL_FIELD (last_selected_window) = val; | 937 | b->INTERNAL_FIELD (last_selected_window) = val; |
| 928 | } | 938 | } |
| 929 | BUFFER_INLINE void | 939 | INLINE void |
| 930 | bset_local_var_alist (struct buffer *b, Lisp_Object val) | 940 | bset_local_var_alist (struct buffer *b, Lisp_Object val) |
| 931 | { | 941 | { |
| 932 | b->INTERNAL_FIELD (local_var_alist) = val; | 942 | b->INTERNAL_FIELD (local_var_alist) = val; |
| 933 | } | 943 | } |
| 934 | BUFFER_INLINE void | 944 | INLINE void |
| 935 | bset_mark_active (struct buffer *b, Lisp_Object val) | 945 | bset_mark_active (struct buffer *b, Lisp_Object val) |
| 936 | { | 946 | { |
| 937 | b->INTERNAL_FIELD (mark_active) = val; | 947 | b->INTERNAL_FIELD (mark_active) = val; |
| 938 | } | 948 | } |
| 939 | BUFFER_INLINE void | 949 | INLINE void |
| 940 | bset_point_before_scroll (struct buffer *b, Lisp_Object val) | 950 | bset_point_before_scroll (struct buffer *b, Lisp_Object val) |
| 941 | { | 951 | { |
| 942 | b->INTERNAL_FIELD (point_before_scroll) = val; | 952 | b->INTERNAL_FIELD (point_before_scroll) = val; |
| 943 | } | 953 | } |
| 944 | BUFFER_INLINE void | 954 | INLINE void |
| 945 | bset_read_only (struct buffer *b, Lisp_Object val) | 955 | bset_read_only (struct buffer *b, Lisp_Object val) |
| 946 | { | 956 | { |
| 947 | b->INTERNAL_FIELD (read_only) = val; | 957 | b->INTERNAL_FIELD (read_only) = val; |
| 948 | } | 958 | } |
| 949 | BUFFER_INLINE void | 959 | INLINE void |
| 950 | bset_truncate_lines (struct buffer *b, Lisp_Object val) | 960 | bset_truncate_lines (struct buffer *b, Lisp_Object val) |
| 951 | { | 961 | { |
| 952 | b->INTERNAL_FIELD (truncate_lines) = val; | 962 | b->INTERNAL_FIELD (truncate_lines) = val; |
| 953 | } | 963 | } |
| 954 | BUFFER_INLINE void | 964 | INLINE void |
| 955 | bset_undo_list (struct buffer *b, Lisp_Object val) | 965 | bset_undo_list (struct buffer *b, Lisp_Object val) |
| 956 | { | 966 | { |
| 957 | b->INTERNAL_FIELD (undo_list) = val; | 967 | b->INTERNAL_FIELD (undo_list) = val; |
| 958 | } | 968 | } |
| 959 | BUFFER_INLINE void | 969 | INLINE void |
| 960 | bset_upcase_table (struct buffer *b, Lisp_Object val) | 970 | bset_upcase_table (struct buffer *b, Lisp_Object val) |
| 961 | { | 971 | { |
| 962 | b->INTERNAL_FIELD (upcase_table) = val; | 972 | b->INTERNAL_FIELD (upcase_table) = val; |
| 963 | } | 973 | } |
| 964 | BUFFER_INLINE void | 974 | INLINE void |
| 965 | bset_width_table (struct buffer *b, Lisp_Object val) | 975 | bset_width_table (struct buffer *b, Lisp_Object val) |
| 966 | { | 976 | { |
| 967 | b->INTERNAL_FIELD (width_table) = val; | 977 | b->INTERNAL_FIELD (width_table) = val; |
| @@ -1011,7 +1021,7 @@ bset_width_table (struct buffer *b, Lisp_Object val) | |||
| 1011 | else \ | 1021 | else \ |
| 1012 | eassert (b->indirections >= 0); \ | 1022 | eassert (b->indirections >= 0); \ |
| 1013 | } \ | 1023 | } \ |
| 1014 | } while (0) | 1024 | } while (false) |
| 1015 | 1025 | ||
| 1016 | /* Chain of all buffers, including killed ones. */ | 1026 | /* Chain of all buffers, including killed ones. */ |
| 1017 | 1027 | ||
| @@ -1073,6 +1083,8 @@ extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object); | |||
| 1073 | extern void record_buffer (Lisp_Object); | 1083 | extern void record_buffer (Lisp_Object); |
| 1074 | extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); | 1084 | extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 1075 | extern void mmap_set_vars (bool); | 1085 | extern void mmap_set_vars (bool); |
| 1086 | extern void restore_buffer (Lisp_Object); | ||
| 1087 | extern void set_buffer_if_live (Lisp_Object); | ||
| 1076 | 1088 | ||
| 1077 | /* Set the current buffer to B. | 1089 | /* Set the current buffer to B. |
| 1078 | 1090 | ||
| @@ -1083,7 +1095,7 @@ extern void mmap_set_vars (bool); | |||
| 1083 | windows than the selected one requires a select_window at some | 1095 | windows than the selected one requires a select_window at some |
| 1084 | time, and that increments windows_or_buffers_changed. */ | 1096 | time, and that increments windows_or_buffers_changed. */ |
| 1085 | 1097 | ||
| 1086 | BUFFER_INLINE void | 1098 | INLINE void |
| 1087 | set_buffer_internal (struct buffer *b) | 1099 | set_buffer_internal (struct buffer *b) |
| 1088 | { | 1100 | { |
| 1089 | if (current_buffer != b) | 1101 | if (current_buffer != b) |
| @@ -1093,7 +1105,7 @@ set_buffer_internal (struct buffer *b) | |||
| 1093 | /* Arrange to go back to the original buffer after the next | 1105 | /* Arrange to go back to the original buffer after the next |
| 1094 | call to unbind_to if the original buffer is still alive. */ | 1106 | call to unbind_to if the original buffer is still alive. */ |
| 1095 | 1107 | ||
| 1096 | BUFFER_INLINE void | 1108 | INLINE void |
| 1097 | record_unwind_current_buffer (void) | 1109 | record_unwind_current_buffer (void) |
| 1098 | { | 1110 | { |
| 1099 | record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); | 1111 | record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); |
| @@ -1107,24 +1119,32 @@ record_unwind_current_buffer (void) | |||
| 1107 | do { \ | 1119 | do { \ |
| 1108 | ptrdiff_t maxlen = 40; \ | 1120 | ptrdiff_t maxlen = 40; \ |
| 1109 | overlays = alloca (maxlen * sizeof *overlays); \ | 1121 | overlays = alloca (maxlen * sizeof *overlays); \ |
| 1110 | noverlays = overlays_at (posn, 0, &overlays, &maxlen, \ | 1122 | noverlays = overlays_at (posn, false, &overlays, &maxlen, \ |
| 1111 | nextp, NULL, chrq); \ | 1123 | nextp, NULL, chrq); \ |
| 1112 | if (noverlays > maxlen) \ | 1124 | if (noverlays > maxlen) \ |
| 1113 | { \ | 1125 | { \ |
| 1114 | maxlen = noverlays; \ | 1126 | maxlen = noverlays; \ |
| 1115 | overlays = alloca (maxlen * sizeof *overlays); \ | 1127 | overlays = alloca (maxlen * sizeof *overlays); \ |
| 1116 | noverlays = overlays_at (posn, 0, &overlays, &maxlen, \ | 1128 | noverlays = overlays_at (posn, false, &overlays, &maxlen, \ |
| 1117 | nextp, NULL, chrq); \ | 1129 | nextp, NULL, chrq); \ |
| 1118 | } \ | 1130 | } \ |
| 1119 | } while (0) | 1131 | } while (false) |
| 1120 | 1132 | ||
| 1133 | extern Lisp_Object Vbuffer_alist; | ||
| 1121 | extern Lisp_Object Qbefore_change_functions; | 1134 | extern Lisp_Object Qbefore_change_functions; |
| 1122 | extern Lisp_Object Qafter_change_functions; | 1135 | extern Lisp_Object Qafter_change_functions; |
| 1123 | extern Lisp_Object Qfirst_change_hook; | 1136 | extern Lisp_Object Qfirst_change_hook; |
| 1137 | extern Lisp_Object Qpriority, Qbefore_string, Qafter_string; | ||
| 1138 | |||
| 1139 | /* FOR_EACH_LIVE_BUFFER (LIST_VAR, BUF_VAR) followed by a statement is | ||
| 1140 | a `for' loop which iterates over the buffers from Vbuffer_alist. */ | ||
| 1141 | |||
| 1142 | #define FOR_EACH_LIVE_BUFFER(list_var, buf_var) \ | ||
| 1143 | FOR_EACH_ALIST_VALUE (Vbuffer_alist, list_var, buf_var) | ||
| 1124 | 1144 | ||
| 1125 | /* Get text properties of B. */ | 1145 | /* Get text properties of B. */ |
| 1126 | 1146 | ||
| 1127 | BUFFER_INLINE INTERVAL | 1147 | INLINE INTERVAL |
| 1128 | buffer_intervals (struct buffer *b) | 1148 | buffer_intervals (struct buffer *b) |
| 1129 | { | 1149 | { |
| 1130 | eassert (b->text != NULL); | 1150 | eassert (b->text != NULL); |
| @@ -1133,7 +1153,7 @@ buffer_intervals (struct buffer *b) | |||
| 1133 | 1153 | ||
| 1134 | /* Set text properties of B to I. */ | 1154 | /* Set text properties of B to I. */ |
| 1135 | 1155 | ||
| 1136 | BUFFER_INLINE void | 1156 | INLINE void |
| 1137 | set_buffer_intervals (struct buffer *b, INTERVAL i) | 1157 | set_buffer_intervals (struct buffer *b, INTERVAL i) |
| 1138 | { | 1158 | { |
| 1139 | eassert (b->text != NULL); | 1159 | eassert (b->text != NULL); |
| @@ -1142,7 +1162,7 @@ set_buffer_intervals (struct buffer *b, INTERVAL i) | |||
| 1142 | 1162 | ||
| 1143 | /* Non-zero if current buffer has overlays. */ | 1163 | /* Non-zero if current buffer has overlays. */ |
| 1144 | 1164 | ||
| 1145 | BUFFER_INLINE bool | 1165 | INLINE bool |
| 1146 | buffer_has_overlays (void) | 1166 | buffer_has_overlays (void) |
| 1147 | { | 1167 | { |
| 1148 | return current_buffer->overlays_before || current_buffer->overlays_after; | 1168 | return current_buffer->overlays_before || current_buffer->overlays_after; |
| @@ -1162,7 +1182,7 @@ buffer_has_overlays (void) | |||
| 1162 | the buffer to the next character after fetching this one. Instead, | 1182 | the buffer to the next character after fetching this one. Instead, |
| 1163 | use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ | 1183 | use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ |
| 1164 | 1184 | ||
| 1165 | BUFFER_INLINE int | 1185 | INLINE int |
| 1166 | FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) | 1186 | FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) |
| 1167 | { | 1187 | { |
| 1168 | unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) | 1188 | unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) |
| @@ -1174,7 +1194,7 @@ FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) | |||
| 1174 | If POS doesn't point the head of valid multi-byte form, only the byte at | 1194 | If POS doesn't point the head of valid multi-byte form, only the byte at |
| 1175 | POS is returned. No range checking. */ | 1195 | POS is returned. No range checking. */ |
| 1176 | 1196 | ||
| 1177 | BUFFER_INLINE int | 1197 | INLINE int |
| 1178 | BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) | 1198 | BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) |
| 1179 | { | 1199 | { |
| 1180 | unsigned char *p | 1200 | unsigned char *p |
| @@ -1185,7 +1205,7 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) | |||
| 1185 | 1205 | ||
| 1186 | /* Return number of windows showing B. */ | 1206 | /* Return number of windows showing B. */ |
| 1187 | 1207 | ||
| 1188 | BUFFER_INLINE int | 1208 | INLINE int |
| 1189 | buffer_window_count (struct buffer *b) | 1209 | buffer_window_count (struct buffer *b) |
| 1190 | { | 1210 | { |
| 1191 | if (b->base_buffer) | 1211 | if (b->base_buffer) |
| @@ -1247,12 +1267,12 @@ extern int last_per_buffer_idx; | |||
| 1247 | #define PER_BUFFER_VAR_IDX(VAR) \ | 1267 | #define PER_BUFFER_VAR_IDX(VAR) \ |
| 1248 | PER_BUFFER_IDX (PER_BUFFER_VAR_OFFSET (VAR)) | 1268 | PER_BUFFER_IDX (PER_BUFFER_VAR_OFFSET (VAR)) |
| 1249 | 1269 | ||
| 1250 | /* Value is non-zero if the variable with index IDX has a local value | 1270 | /* Value is true if the variable with index IDX has a local value |
| 1251 | in buffer B. */ | 1271 | in buffer B. */ |
| 1252 | 1272 | ||
| 1253 | #define PER_BUFFER_VALUE_P(B, IDX) \ | 1273 | #define PER_BUFFER_VALUE_P(B, IDX) \ |
| 1254 | (((IDX) < 0 || IDX >= last_per_buffer_idx) \ | 1274 | (((IDX) < 0 || IDX >= last_per_buffer_idx) \ |
| 1255 | ? (emacs_abort (), 0) \ | 1275 | ? (emacs_abort (), false) \ |
| 1256 | : ((B)->local_flags[IDX] != 0)) | 1276 | : ((B)->local_flags[IDX] != 0)) |
| 1257 | 1277 | ||
| 1258 | /* Set whether per-buffer variable with index IDX has a buffer-local | 1278 | /* Set whether per-buffer variable with index IDX has a buffer-local |
| @@ -1263,7 +1283,7 @@ extern int last_per_buffer_idx; | |||
| 1263 | if ((IDX) < 0 || (IDX) >= last_per_buffer_idx) \ | 1283 | if ((IDX) < 0 || (IDX) >= last_per_buffer_idx) \ |
| 1264 | emacs_abort (); \ | 1284 | emacs_abort (); \ |
| 1265 | (B)->local_flags[IDX] = (VAL); \ | 1285 | (B)->local_flags[IDX] = (VAL); \ |
| 1266 | } while (0) | 1286 | } while (false) |
| 1267 | 1287 | ||
| 1268 | /* Return the index value of the per-buffer variable at offset OFFSET | 1288 | /* Return the index value of the per-buffer variable at offset OFFSET |
| 1269 | in the buffer structure. | 1289 | in the buffer structure. |
| @@ -1292,13 +1312,13 @@ extern int last_per_buffer_idx; | |||
| 1292 | /* Functions to get and set default value of the per-buffer | 1312 | /* Functions to get and set default value of the per-buffer |
| 1293 | variable at offset OFFSET in the buffer structure. */ | 1313 | variable at offset OFFSET in the buffer structure. */ |
| 1294 | 1314 | ||
| 1295 | BUFFER_INLINE Lisp_Object | 1315 | INLINE Lisp_Object |
| 1296 | per_buffer_default (int offset) | 1316 | per_buffer_default (int offset) |
| 1297 | { | 1317 | { |
| 1298 | return *(Lisp_Object *)(offset + (char *) &buffer_defaults); | 1318 | return *(Lisp_Object *)(offset + (char *) &buffer_defaults); |
| 1299 | } | 1319 | } |
| 1300 | 1320 | ||
| 1301 | BUFFER_INLINE void | 1321 | INLINE void |
| 1302 | set_per_buffer_default (int offset, Lisp_Object value) | 1322 | set_per_buffer_default (int offset, Lisp_Object value) |
| 1303 | { | 1323 | { |
| 1304 | *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value; | 1324 | *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value; |
| @@ -1307,20 +1327,20 @@ set_per_buffer_default (int offset, Lisp_Object value) | |||
| 1307 | /* Functions to get and set buffer-local value of the per-buffer | 1327 | /* Functions to get and set buffer-local value of the per-buffer |
| 1308 | variable at offset OFFSET in the buffer structure. */ | 1328 | variable at offset OFFSET in the buffer structure. */ |
| 1309 | 1329 | ||
| 1310 | BUFFER_INLINE Lisp_Object | 1330 | INLINE Lisp_Object |
| 1311 | per_buffer_value (struct buffer *b, int offset) | 1331 | per_buffer_value (struct buffer *b, int offset) |
| 1312 | { | 1332 | { |
| 1313 | return *(Lisp_Object *)(offset + (char *) b); | 1333 | return *(Lisp_Object *)(offset + (char *) b); |
| 1314 | } | 1334 | } |
| 1315 | 1335 | ||
| 1316 | BUFFER_INLINE void | 1336 | INLINE void |
| 1317 | set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value) | 1337 | set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value) |
| 1318 | { | 1338 | { |
| 1319 | *(Lisp_Object *)(offset + (char *) b) = value; | 1339 | *(Lisp_Object *)(offset + (char *) b) = value; |
| 1320 | } | 1340 | } |
| 1321 | 1341 | ||
| 1322 | /* Downcase a character C, or make no change if that cannot be done. */ | 1342 | /* Downcase a character C, or make no change if that cannot be done. */ |
| 1323 | BUFFER_INLINE int | 1343 | INLINE int |
| 1324 | downcase (int c) | 1344 | downcase (int c) |
| 1325 | { | 1345 | { |
| 1326 | Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); | 1346 | Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); |
| @@ -1328,11 +1348,11 @@ downcase (int c) | |||
| 1328 | return NATNUMP (down) ? XFASTINT (down) : c; | 1348 | return NATNUMP (down) ? XFASTINT (down) : c; |
| 1329 | } | 1349 | } |
| 1330 | 1350 | ||
| 1331 | /* 1 if C is upper case. */ | 1351 | /* True if C is upper case. */ |
| 1332 | BUFFER_INLINE bool uppercasep (int c) { return downcase (c) != c; } | 1352 | INLINE bool uppercasep (int c) { return downcase (c) != c; } |
| 1333 | 1353 | ||
| 1334 | /* Upcase a character C known to be not upper case. */ | 1354 | /* Upcase a character C known to be not upper case. */ |
| 1335 | BUFFER_INLINE int | 1355 | INLINE int |
| 1336 | upcase1 (int c) | 1356 | upcase1 (int c) |
| 1337 | { | 1357 | { |
| 1338 | Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); | 1358 | Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); |
| @@ -1340,14 +1360,14 @@ upcase1 (int c) | |||
| 1340 | return NATNUMP (up) ? XFASTINT (up) : c; | 1360 | return NATNUMP (up) ? XFASTINT (up) : c; |
| 1341 | } | 1361 | } |
| 1342 | 1362 | ||
| 1343 | /* 1 if C is lower case. */ | 1363 | /* True if C is lower case. */ |
| 1344 | BUFFER_INLINE bool | 1364 | INLINE bool |
| 1345 | lowercasep (int c) | 1365 | lowercasep (int c) |
| 1346 | { | 1366 | { |
| 1347 | return !uppercasep (c) && upcase1 (c) != c; | 1367 | return !uppercasep (c) && upcase1 (c) != c; |
| 1348 | } | 1368 | } |
| 1349 | 1369 | ||
| 1350 | /* Upcase a character C, or make no change if that cannot be done. */ | 1370 | /* Upcase a character C, or make no change if that cannot be done. */ |
| 1351 | BUFFER_INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } | 1371 | INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } |
| 1352 | 1372 | ||
| 1353 | INLINE_HEADER_END | 1373 | INLINE_HEADER_END |