aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.h
diff options
context:
space:
mode:
authorPaul Eggert2013-09-20 08:34:36 -0700
committerPaul Eggert2013-09-20 08:34:36 -0700
commit00382e8b9834e58203507d0461884671b78ebc01 (patch)
treecf28670199af0c1189cbcfbd14ffa49cbaaa0fba /src/buffer.h
parent2fd3a9f7491a59d427150fab0ad4df6ea12b3249 (diff)
downloademacs-00382e8b9834e58203507d0461884671b78ebc01.tar.gz
emacs-00382e8b9834e58203507d0461884671b78ebc01.zip
A simpler, centralized INLINE.
* lib-src/profile.c (INLINE): New macro. (SYSTIME_INLINE): Remove. * src/conf_post.h (INLINE): Define only if not already defined. This allows us to use a single INLINE, defined by one file per executable. * src/emacs.c (INLINE): Define it. Also, include category.h, charset.h, composite.h, dispextern.h, syntax.h, systime.h, so that their INLINE definitions are expanded properly for Emacs. * src/blockinput.h, src/keyboard.c (BLOCKINPUT_INLINE): * src/buffer.h, src/buffer.c (BUFFER_INLINE): * src/category.h, src/category.c (CATEGORY_INLINE): * src/character.h, src/character.c (CHARACTER_INLINE): * src/charset.h, src/charset.c (CHARSET_INLINE): * src/composite.h, src/composite.c (COMPOSITE_INLINE): * src/dispextern.h, src/dispnew.c (DISPEXTERN_INLINE): * src/frame.h, src/frame.c (FRAME_INLINE): * src/intervals.h, src/intervals.c (INTERVALS_INLINE): * src/keyboard.h, src/keyboard.c (KEYBOARD_INLINE): * src/lisp.h, src/alloc.c (LISP_INLINE): * src/process.h, src/process.c (PROCESS_INLINE): * src/syntax.h, src/syntax.c (SYNTAX_INLINE): * src/systime.h, src/sysdep.c (SYSTIME_INLINE): * src/termhooks.h, src/terminal.h (TERMHOOKS_INLINE): * src/window.h, src/window.c (WINDOW_INLINE): Remove. All uses replaced with INLINE.
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h75
1 files changed, 36 insertions, 39 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 169a15c7d0f..a36c0d13c9e 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -22,9 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22#include <time.h> 22#include <time.h>
23 23
24INLINE_HEADER_BEGIN 24INLINE_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
@@ -875,97 +872,97 @@ struct buffer
875 872
876/* Most code should use these functions to set Lisp fields in struct 873/* Most code should use these functions to set Lisp fields in struct
877 buffer. */ 874 buffer. */
878BUFFER_INLINE void 875INLINE void
879bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) 876bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val)
880{ 877{
881 b->INTERNAL_FIELD (bidi_paragraph_direction) = val; 878 b->INTERNAL_FIELD (bidi_paragraph_direction) = val;
882} 879}
883BUFFER_INLINE void 880INLINE void
884bset_case_canon_table (struct buffer *b, Lisp_Object val) 881bset_case_canon_table (struct buffer *b, Lisp_Object val)
885{ 882{
886 b->INTERNAL_FIELD (case_canon_table) = val; 883 b->INTERNAL_FIELD (case_canon_table) = val;
887} 884}
888BUFFER_INLINE void 885INLINE void
889bset_case_eqv_table (struct buffer *b, Lisp_Object val) 886bset_case_eqv_table (struct buffer *b, Lisp_Object val)
890{ 887{
891 b->INTERNAL_FIELD (case_eqv_table) = val; 888 b->INTERNAL_FIELD (case_eqv_table) = val;
892} 889}
893BUFFER_INLINE void 890INLINE void
894bset_directory (struct buffer *b, Lisp_Object val) 891bset_directory (struct buffer *b, Lisp_Object val)
895{ 892{
896 b->INTERNAL_FIELD (directory) = val; 893 b->INTERNAL_FIELD (directory) = val;
897} 894}
898BUFFER_INLINE void 895INLINE void
899bset_display_count (struct buffer *b, Lisp_Object val) 896bset_display_count (struct buffer *b, Lisp_Object val)
900{ 897{
901 b->INTERNAL_FIELD (display_count) = val; 898 b->INTERNAL_FIELD (display_count) = val;
902} 899}
903BUFFER_INLINE void 900INLINE void
904bset_display_time (struct buffer *b, Lisp_Object val) 901bset_display_time (struct buffer *b, Lisp_Object val)
905{ 902{
906 b->INTERNAL_FIELD (display_time) = val; 903 b->INTERNAL_FIELD (display_time) = val;
907} 904}
908BUFFER_INLINE void 905INLINE void
909bset_downcase_table (struct buffer *b, Lisp_Object val) 906bset_downcase_table (struct buffer *b, Lisp_Object val)
910{ 907{
911 b->INTERNAL_FIELD (downcase_table) = val; 908 b->INTERNAL_FIELD (downcase_table) = val;
912} 909}
913BUFFER_INLINE void 910INLINE void
914bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) 911bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val)
915{ 912{
916 b->INTERNAL_FIELD (enable_multibyte_characters) = val; 913 b->INTERNAL_FIELD (enable_multibyte_characters) = val;
917} 914}
918BUFFER_INLINE void 915INLINE void
919bset_filename (struct buffer *b, Lisp_Object val) 916bset_filename (struct buffer *b, Lisp_Object val)
920{ 917{
921 b->INTERNAL_FIELD (filename) = val; 918 b->INTERNAL_FIELD (filename) = val;
922} 919}
923BUFFER_INLINE void 920INLINE void
924bset_keymap (struct buffer *b, Lisp_Object val) 921bset_keymap (struct buffer *b, Lisp_Object val)
925{ 922{
926 b->INTERNAL_FIELD (keymap) = val; 923 b->INTERNAL_FIELD (keymap) = val;
927} 924}
928BUFFER_INLINE void 925INLINE void
929bset_last_selected_window (struct buffer *b, Lisp_Object val) 926bset_last_selected_window (struct buffer *b, Lisp_Object val)
930{ 927{
931 b->INTERNAL_FIELD (last_selected_window) = val; 928 b->INTERNAL_FIELD (last_selected_window) = val;
932} 929}
933BUFFER_INLINE void 930INLINE void
934bset_local_var_alist (struct buffer *b, Lisp_Object val) 931bset_local_var_alist (struct buffer *b, Lisp_Object val)
935{ 932{
936 b->INTERNAL_FIELD (local_var_alist) = val; 933 b->INTERNAL_FIELD (local_var_alist) = val;
937} 934}
938BUFFER_INLINE void 935INLINE void
939bset_mark_active (struct buffer *b, Lisp_Object val) 936bset_mark_active (struct buffer *b, Lisp_Object val)
940{ 937{
941 b->INTERNAL_FIELD (mark_active) = val; 938 b->INTERNAL_FIELD (mark_active) = val;
942} 939}
943BUFFER_INLINE void 940INLINE void
944bset_point_before_scroll (struct buffer *b, Lisp_Object val) 941bset_point_before_scroll (struct buffer *b, Lisp_Object val)
945{ 942{
946 b->INTERNAL_FIELD (point_before_scroll) = val; 943 b->INTERNAL_FIELD (point_before_scroll) = val;
947} 944}
948BUFFER_INLINE void 945INLINE void
949bset_read_only (struct buffer *b, Lisp_Object val) 946bset_read_only (struct buffer *b, Lisp_Object val)
950{ 947{
951 b->INTERNAL_FIELD (read_only) = val; 948 b->INTERNAL_FIELD (read_only) = val;
952} 949}
953BUFFER_INLINE void 950INLINE void
954bset_truncate_lines (struct buffer *b, Lisp_Object val) 951bset_truncate_lines (struct buffer *b, Lisp_Object val)
955{ 952{
956 b->INTERNAL_FIELD (truncate_lines) = val; 953 b->INTERNAL_FIELD (truncate_lines) = val;
957} 954}
958BUFFER_INLINE void 955INLINE void
959bset_undo_list (struct buffer *b, Lisp_Object val) 956bset_undo_list (struct buffer *b, Lisp_Object val)
960{ 957{
961 b->INTERNAL_FIELD (undo_list) = val; 958 b->INTERNAL_FIELD (undo_list) = val;
962} 959}
963BUFFER_INLINE void 960INLINE void
964bset_upcase_table (struct buffer *b, Lisp_Object val) 961bset_upcase_table (struct buffer *b, Lisp_Object val)
965{ 962{
966 b->INTERNAL_FIELD (upcase_table) = val; 963 b->INTERNAL_FIELD (upcase_table) = val;
967} 964}
968BUFFER_INLINE void 965INLINE void
969bset_width_table (struct buffer *b, Lisp_Object val) 966bset_width_table (struct buffer *b, Lisp_Object val)
970{ 967{
971 b->INTERNAL_FIELD (width_table) = val; 968 b->INTERNAL_FIELD (width_table) = val;
@@ -1089,7 +1086,7 @@ extern void set_buffer_if_live (Lisp_Object);
1089 windows than the selected one requires a select_window at some 1086 windows than the selected one requires a select_window at some
1090 time, and that increments windows_or_buffers_changed. */ 1087 time, and that increments windows_or_buffers_changed. */
1091 1088
1092BUFFER_INLINE void 1089INLINE void
1093set_buffer_internal (struct buffer *b) 1090set_buffer_internal (struct buffer *b)
1094{ 1091{
1095 if (current_buffer != b) 1092 if (current_buffer != b)
@@ -1099,7 +1096,7 @@ set_buffer_internal (struct buffer *b)
1099/* Arrange to go back to the original buffer after the next 1096/* Arrange to go back to the original buffer after the next
1100 call to unbind_to if the original buffer is still alive. */ 1097 call to unbind_to if the original buffer is still alive. */
1101 1098
1102BUFFER_INLINE void 1099INLINE void
1103record_unwind_current_buffer (void) 1100record_unwind_current_buffer (void)
1104{ 1101{
1105 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); 1102 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
@@ -1138,7 +1135,7 @@ extern Lisp_Object Qpriority, Qbefore_string, Qafter_string;
1138 1135
1139/* Get text properties of B. */ 1136/* Get text properties of B. */
1140 1137
1141BUFFER_INLINE INTERVAL 1138INLINE INTERVAL
1142buffer_intervals (struct buffer *b) 1139buffer_intervals (struct buffer *b)
1143{ 1140{
1144 eassert (b->text != NULL); 1141 eassert (b->text != NULL);
@@ -1147,7 +1144,7 @@ buffer_intervals (struct buffer *b)
1147 1144
1148/* Set text properties of B to I. */ 1145/* Set text properties of B to I. */
1149 1146
1150BUFFER_INLINE void 1147INLINE void
1151set_buffer_intervals (struct buffer *b, INTERVAL i) 1148set_buffer_intervals (struct buffer *b, INTERVAL i)
1152{ 1149{
1153 eassert (b->text != NULL); 1150 eassert (b->text != NULL);
@@ -1156,7 +1153,7 @@ set_buffer_intervals (struct buffer *b, INTERVAL i)
1156 1153
1157/* Non-zero if current buffer has overlays. */ 1154/* Non-zero if current buffer has overlays. */
1158 1155
1159BUFFER_INLINE bool 1156INLINE bool
1160buffer_has_overlays (void) 1157buffer_has_overlays (void)
1161{ 1158{
1162 return current_buffer->overlays_before || current_buffer->overlays_after; 1159 return current_buffer->overlays_before || current_buffer->overlays_after;
@@ -1176,7 +1173,7 @@ buffer_has_overlays (void)
1176 the buffer to the next character after fetching this one. Instead, 1173 the buffer to the next character after fetching this one. Instead,
1177 use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ 1174 use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */
1178 1175
1179BUFFER_INLINE int 1176INLINE int
1180FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) 1177FETCH_MULTIBYTE_CHAR (ptrdiff_t pos)
1181{ 1178{
1182 unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) 1179 unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0)
@@ -1188,7 +1185,7 @@ FETCH_MULTIBYTE_CHAR (ptrdiff_t pos)
1188 If POS doesn't point the head of valid multi-byte form, only the byte at 1185 If POS doesn't point the head of valid multi-byte form, only the byte at
1189 POS is returned. No range checking. */ 1186 POS is returned. No range checking. */
1190 1187
1191BUFFER_INLINE int 1188INLINE int
1192BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) 1189BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos)
1193{ 1190{
1194 unsigned char *p 1191 unsigned char *p
@@ -1199,7 +1196,7 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos)
1199 1196
1200/* Return number of windows showing B. */ 1197/* Return number of windows showing B. */
1201 1198
1202BUFFER_INLINE int 1199INLINE int
1203buffer_window_count (struct buffer *b) 1200buffer_window_count (struct buffer *b)
1204{ 1201{
1205 if (b->base_buffer) 1202 if (b->base_buffer)
@@ -1306,13 +1303,13 @@ extern int last_per_buffer_idx;
1306/* Functions to get and set default value of the per-buffer 1303/* Functions to get and set default value of the per-buffer
1307 variable at offset OFFSET in the buffer structure. */ 1304 variable at offset OFFSET in the buffer structure. */
1308 1305
1309BUFFER_INLINE Lisp_Object 1306INLINE Lisp_Object
1310per_buffer_default (int offset) 1307per_buffer_default (int offset)
1311{ 1308{
1312 return *(Lisp_Object *)(offset + (char *) &buffer_defaults); 1309 return *(Lisp_Object *)(offset + (char *) &buffer_defaults);
1313} 1310}
1314 1311
1315BUFFER_INLINE void 1312INLINE void
1316set_per_buffer_default (int offset, Lisp_Object value) 1313set_per_buffer_default (int offset, Lisp_Object value)
1317{ 1314{
1318 *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value; 1315 *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value;
@@ -1321,20 +1318,20 @@ set_per_buffer_default (int offset, Lisp_Object value)
1321/* Functions to get and set buffer-local value of the per-buffer 1318/* Functions to get and set buffer-local value of the per-buffer
1322 variable at offset OFFSET in the buffer structure. */ 1319 variable at offset OFFSET in the buffer structure. */
1323 1320
1324BUFFER_INLINE Lisp_Object 1321INLINE Lisp_Object
1325per_buffer_value (struct buffer *b, int offset) 1322per_buffer_value (struct buffer *b, int offset)
1326{ 1323{
1327 return *(Lisp_Object *)(offset + (char *) b); 1324 return *(Lisp_Object *)(offset + (char *) b);
1328} 1325}
1329 1326
1330BUFFER_INLINE void 1327INLINE void
1331set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value) 1328set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value)
1332{ 1329{
1333 *(Lisp_Object *)(offset + (char *) b) = value; 1330 *(Lisp_Object *)(offset + (char *) b) = value;
1334} 1331}
1335 1332
1336/* Downcase a character C, or make no change if that cannot be done. */ 1333/* Downcase a character C, or make no change if that cannot be done. */
1337BUFFER_INLINE int 1334INLINE int
1338downcase (int c) 1335downcase (int c)
1339{ 1336{
1340 Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); 1337 Lisp_Object downcase_table = BVAR (current_buffer, downcase_table);
@@ -1343,10 +1340,10 @@ downcase (int c)
1343} 1340}
1344 1341
1345/* 1 if C is upper case. */ 1342/* 1 if C is upper case. */
1346BUFFER_INLINE bool uppercasep (int c) { return downcase (c) != c; } 1343INLINE bool uppercasep (int c) { return downcase (c) != c; }
1347 1344
1348/* Upcase a character C known to be not upper case. */ 1345/* Upcase a character C known to be not upper case. */
1349BUFFER_INLINE int 1346INLINE int
1350upcase1 (int c) 1347upcase1 (int c)
1351{ 1348{
1352 Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); 1349 Lisp_Object upcase_table = BVAR (current_buffer, upcase_table);
@@ -1355,13 +1352,13 @@ upcase1 (int c)
1355} 1352}
1356 1353
1357/* 1 if C is lower case. */ 1354/* 1 if C is lower case. */
1358BUFFER_INLINE bool 1355INLINE bool
1359lowercasep (int c) 1356lowercasep (int c)
1360{ 1357{
1361 return !uppercasep (c) && upcase1 (c) != c; 1358 return !uppercasep (c) && upcase1 (c) != c;
1362} 1359}
1363 1360
1364/* Upcase a character C, or make no change if that cannot be done. */ 1361/* Upcase a character C, or make no change if that cannot be done. */
1365BUFFER_INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } 1362INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); }
1366 1363
1367INLINE_HEADER_END 1364INLINE_HEADER_END