aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2009-03-28 02:24:22 +0000
committerStefan Monnier2009-03-28 02:24:22 +0000
commitae19ba7cfcf14bad68525ba71a88b14f05ab60a6 (patch)
treefd7ce1264675becab196e2c80b3602820105cbfa
parentab226c507517f8ce23daed706f1d6e0b7369cb00 (diff)
downloademacs-ae19ba7cfcf14bad68525ba71a88b14f05ab60a6.tar.gz
emacs-ae19ba7cfcf14bad68525ba71a88b14f05ab60a6.zip
* insdel.c (move_gap, move_gap_both, gap_left, gap_right)
(adjust_markers_gap_motion, adjust_markers_for_delete) (adjust_markers_for_insert, adjust_point) (adjust_markers_for_replace, make_gap_larger, make_gap_smaller) (make_gap, copy_text, count_size_as_multibyte, insert) (insert_and_inherit, insert_before_markers) (insert_before_markers_and_inherit, insert_1) (count_combining_before, count_combining_after, insert_1_both) (insert_from_string, insert_from_string_before_markers) (insert_from_string_1, insert_from_gap, insert_from_buffer) (insert_from_buffer_1, adjust_after_replace) (adjust_after_replace_noundo, adjust_after_insert, replace_range) (replace_range_2, del_range, del_range_1, del_range_byte) (del_range_both, del_range_2, modify_region) (prepare_to_modify_buffer, signal_before_change) (signal_after_change, Fcombine_after_change_execute): Use EMACS_INT for buffer positions and sizes. * lisp.h: Adjust prototypes accordingly. * fileio.c (adjust_markers_for_delete): Move declaration to lisp.h. (non_regular_inserted, non_regular_nbytes, read_non_regular) (Finsert_file_contents): Use EMACS_INT for buffer positions.
-rw-r--r--src/ChangeLog23
-rw-r--r--src/fileio.c57
-rw-r--r--src/insdel.c356
-rw-r--r--src/lisp.h83
4 files changed, 256 insertions, 263 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7e84e2f934a..7ccd3a34c8f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,28 @@
12009-03-28 Stefan Monnier <monnier@iro.umontreal.ca> 12009-03-28 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * insdel.c (move_gap, move_gap_both, gap_left, gap_right)
4 (adjust_markers_gap_motion, adjust_markers_for_delete)
5 (adjust_markers_for_insert, adjust_point)
6 (adjust_markers_for_replace, make_gap_larger, make_gap_smaller)
7 (make_gap, copy_text, count_size_as_multibyte, insert)
8 (insert_and_inherit, insert_before_markers)
9 (insert_before_markers_and_inherit, insert_1)
10 (count_combining_before, count_combining_after, insert_1_both)
11 (insert_from_string, insert_from_string_before_markers)
12 (insert_from_string_1, insert_from_gap, insert_from_buffer)
13 (insert_from_buffer_1, adjust_after_replace)
14 (adjust_after_replace_noundo, adjust_after_insert, replace_range)
15 (replace_range_2, del_range, del_range_1, del_range_byte)
16 (del_range_both, del_range_2, modify_region)
17 (prepare_to_modify_buffer, signal_before_change)
18 (signal_after_change, Fcombine_after_change_execute): Use EMACS_INT
19 for buffer positions and sizes.
20 * lisp.h: Adjust prototypes accordingly.
21
22 * fileio.c (adjust_markers_for_delete): Move declaration to lisp.h.
23 (non_regular_inserted, non_regular_nbytes, read_non_regular)
24 (Finsert_file_contents): Use EMACS_INT for buffer positions.
25
3 * fileio.c (Finsert_file_contents): Don't limit size to INT_MAX/4. 26 * fileio.c (Finsert_file_contents): Don't limit size to INT_MAX/4.
4 27
52009-03-27 Jan Djärv <jan.h.d@swipnet.se> 282009-03-27 Jan Djärv <jan.h.d@swipnet.se>
diff --git a/src/fileio.c b/src/fileio.c
index 93b6a1d8298..0bdbe9f9a46 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3048,8 +3048,6 @@ Lisp_Object Qfind_buffer_file_type;
3048#define READ_BUF_SIZE (64 << 10) 3048#define READ_BUF_SIZE (64 << 10)
3049#endif 3049#endif
3050 3050
3051extern void adjust_markers_for_delete P_ ((int, int, int, int));
3052
3053/* This function is called after Lisp functions to decide a coding 3051/* This function is called after Lisp functions to decide a coding
3054 system are called, or when they cause an error. Before they are 3052 system are called, or when they cause an error. Before they are
3055 called, the current buffer is set unibyte and it contains only a 3053 called, the current buffer is set unibyte and it contains only a
@@ -3094,8 +3092,8 @@ decide_coding_unwind (unwind_data)
3094/* Used to pass values from insert-file-contents to read_non_regular. */ 3092/* Used to pass values from insert-file-contents to read_non_regular. */
3095 3093
3096static int non_regular_fd; 3094static int non_regular_fd;
3097static int non_regular_inserted; 3095static EMACS_INT non_regular_inserted;
3098static int non_regular_nbytes; 3096static EMACS_INT non_regular_nbytes;
3099 3097
3100 3098
3101/* Read from a non-regular file. 3099/* Read from a non-regular file.
@@ -3106,7 +3104,7 @@ static int non_regular_nbytes;
3106static Lisp_Object 3104static Lisp_Object
3107read_non_regular () 3105read_non_regular ()
3108{ 3106{
3109 int nbytes; 3107 EMACS_INT nbytes;
3110 3108
3111 immediate_quit = 1; 3109 immediate_quit = 1;
3112 QUIT; 3110 QUIT;
@@ -3156,15 +3154,15 @@ variable `last-coding-system-used' to the coding system actually used. */)
3156{ 3154{
3157 struct stat st; 3155 struct stat st;
3158 register int fd; 3156 register int fd;
3159 int inserted = 0; 3157 EMACS_INT inserted = 0;
3160 int nochange = 0; 3158 int nochange = 0;
3161 register int how_much; 3159 register EMACS_INT how_much;
3162 register int unprocessed; 3160 register EMACS_INT unprocessed;
3163 int count = SPECPDL_INDEX (); 3161 int count = SPECPDL_INDEX ();
3164 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 3162 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
3165 Lisp_Object handler, val, insval, orig_filename, old_undo; 3163 Lisp_Object handler, val, insval, orig_filename, old_undo;
3166 Lisp_Object p; 3164 Lisp_Object p;
3167 int total = 0; 3165 EMACS_INT total = 0;
3168 int not_regular = 0; 3166 int not_regular = 0;
3169 unsigned char read_buf[READ_BUF_SIZE]; 3167 unsigned char read_buf[READ_BUF_SIZE];
3170 struct coding_system coding; 3168 struct coding_system coding;
@@ -3340,7 +3338,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3340 We assume that the 1K-byte and 3K-byte for heading 3338 We assume that the 1K-byte and 3K-byte for heading
3341 and tailing respectively are sufficient for this 3339 and tailing respectively are sufficient for this
3342 purpose. */ 3340 purpose. */
3343 int nread; 3341 EMACS_INT nread;
3344 3342
3345 if (st.st_size <= (1024 * 4)) 3343 if (st.st_size <= (1024 * 4))
3346 nread = emacs_read (fd, read_buf, 1024 * 4); 3344 nread = emacs_read (fd, read_buf, 1024 * 4);
@@ -3450,9 +3448,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
3450 /* same_at_start and same_at_end count bytes, 3448 /* same_at_start and same_at_end count bytes,
3451 because file access counts bytes 3449 because file access counts bytes
3452 and BEG and END count bytes. */ 3450 and BEG and END count bytes. */
3453 int same_at_start = BEGV_BYTE; 3451 EMACS_INT same_at_start = BEGV_BYTE;
3454 int same_at_end = ZV_BYTE; 3452 EMACS_INT same_at_end = ZV_BYTE;
3455 int overlap; 3453 EMACS_INT overlap;
3456 /* There is still a possibility we will find the need to do code 3454 /* There is still a possibility we will find the need to do code
3457 conversion. If that happens, we set this variable to 1 to 3455 conversion. If that happens, we set this variable to 1 to
3458 give up on handling REPLACE in the optimized way. */ 3456 give up on handling REPLACE in the optimized way. */
@@ -3471,7 +3469,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3471 match the text at the beginning of the buffer. */ 3469 match the text at the beginning of the buffer. */
3472 while (1) 3470 while (1)
3473 { 3471 {
3474 int nread, bufpos; 3472 EMACS_INT nread, bufpos;
3475 3473
3476 nread = emacs_read (fd, buffer, sizeof buffer); 3474 nread = emacs_read (fd, buffer, sizeof buffer);
3477 if (nread < 0) 3475 if (nread < 0)
@@ -3522,7 +3520,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3522 already found that decoding is necessary, don't waste time. */ 3520 already found that decoding is necessary, don't waste time. */
3523 while (!giveup_match_end) 3521 while (!giveup_match_end)
3524 { 3522 {
3525 int total_read, nread, bufpos, curpos, trial; 3523 EMACS_INT total_read, nread, bufpos, curpos, trial;
3526 3524
3527 /* At what file position are we now scanning? */ 3525 /* At what file position are we now scanning? */
3528 curpos = XINT (end) - (ZV_BYTE - same_at_end); 3526 curpos = XINT (end) - (ZV_BYTE - same_at_end);
@@ -3578,7 +3576,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3578 3576
3579 if (! giveup_match_end) 3577 if (! giveup_match_end)
3580 { 3578 {
3581 int temp; 3579 EMACS_INT temp;
3582 3580
3583 /* We win! We can handle REPLACE the optimized way. */ 3581 /* We win! We can handle REPLACE the optimized way. */
3584 3582
@@ -3638,7 +3636,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3638 EMACS_INT overlap; 3636 EMACS_INT overlap;
3639 EMACS_INT bufpos; 3637 EMACS_INT bufpos;
3640 unsigned char *decoded; 3638 unsigned char *decoded;
3641 int temp; 3639 EMACS_INT temp;
3642 int this_count = SPECPDL_INDEX (); 3640 int this_count = SPECPDL_INDEX ();
3643 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 3641 int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
3644 Lisp_Object conversion_buffer; 3642 Lisp_Object conversion_buffer;
@@ -3663,8 +3661,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
3663 /* We read one bunch by one (READ_BUF_SIZE bytes) to allow 3661 /* We read one bunch by one (READ_BUF_SIZE bytes) to allow
3664 quitting while reading a huge while. */ 3662 quitting while reading a huge while. */
3665 /* try is reserved in some compilers (Microsoft C) */ 3663 /* try is reserved in some compilers (Microsoft C) */
3666 int trytry = min (total - how_much, READ_BUF_SIZE - unprocessed); 3664 EMACS_INT trytry = min (total - how_much,
3667 int this; 3665 READ_BUF_SIZE - unprocessed);
3666 EMACS_INT this;
3668 3667
3669 /* Allow quitting out of the actual I/O. */ 3668 /* Allow quitting out of the actual I/O. */
3670 immediate_quit = 1; 3669 immediate_quit = 1;
@@ -3867,13 +3866,13 @@ variable `last-coding-system-used' to the coding system actually used. */)
3867 /* Here, we don't do code conversion in the loop. It is done by 3866 /* Here, we don't do code conversion in the loop. It is done by
3868 decode_coding_gap after all data are read into the buffer. */ 3867 decode_coding_gap after all data are read into the buffer. */
3869 { 3868 {
3870 int gap_size = GAP_SIZE; 3869 EMACS_INT gap_size = GAP_SIZE;
3871 3870
3872 while (how_much < total) 3871 while (how_much < total)
3873 { 3872 {
3874 /* try is reserved in some compilers (Microsoft C) */ 3873 /* try is reserved in some compilers (Microsoft C) */
3875 int trytry = min (total - how_much, READ_BUF_SIZE); 3874 EMACS_INT trytry = min (total - how_much, READ_BUF_SIZE);
3876 int this; 3875 EMACS_INT this;
3877 3876
3878 if (not_regular) 3877 if (not_regular)
3879 { 3878 {
@@ -4130,7 +4129,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4130 { 4129 {
4131 /* Don't run point motion or modification hooks when decoding. */ 4130 /* Don't run point motion or modification hooks when decoding. */
4132 int count = SPECPDL_INDEX (); 4131 int count = SPECPDL_INDEX ();
4133 int old_inserted = inserted; 4132 EMACS_INT old_inserted = inserted;
4134 specbind (Qinhibit_point_motion_hooks, Qt); 4133 specbind (Qinhibit_point_motion_hooks, Qt);
4135 specbind (Qinhibit_modification_hooks, Qt); 4134 specbind (Qinhibit_modification_hooks, Qt);
4136 4135
@@ -4156,9 +4155,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
4156 Hence we temporarily save `point' and `inserted' here and 4155 Hence we temporarily save `point' and `inserted' here and
4157 restore `point' iff format-decode did not insert or delete 4156 restore `point' iff format-decode did not insert or delete
4158 any text. Otherwise we leave `point' at point-min. */ 4157 any text. Otherwise we leave `point' at point-min. */
4159 int opoint = PT; 4158 EMACS_INT opoint = PT;
4160 int opoint_byte = PT_BYTE; 4159 EMACS_INT opoint_byte = PT_BYTE;
4161 int oinserted = ZV - BEGV; 4160 EMACS_INT oinserted = ZV - BEGV;
4162 int ochars_modiff = CHARS_MODIFF; 4161 int ochars_modiff = CHARS_MODIFF;
4163 4162
4164 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); 4163 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
@@ -4194,9 +4193,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
4194 { 4193 {
4195 /* For the rationale of this see the comment on 4194 /* For the rationale of this see the comment on
4196 format-decode above. */ 4195 format-decode above. */
4197 int opoint = PT; 4196 EMACS_INT opoint = PT;
4198 int opoint_byte = PT_BYTE; 4197 EMACS_INT opoint_byte = PT_BYTE;
4199 int oinserted = ZV - BEGV; 4198 EMACS_INT oinserted = ZV - BEGV;
4200 int ochars_modiff = CHARS_MODIFF; 4199 int ochars_modiff = CHARS_MODIFF;
4201 4200
4202 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); 4201 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
diff --git a/src/insdel.c b/src/insdel.c
index 814d1571d39..70a6a6618ec 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -32,15 +32,23 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
32#define NULL 0 32#define NULL 0
33#endif 33#endif
34 34
35static void insert_from_string_1 P_ ((Lisp_Object, int, int, int, int, int, int)); 35static void insert_from_string_1 (Lisp_Object string,
36static void insert_from_buffer_1 (); 36 EMACS_INT pos, EMACS_INT pos_byte,
37static void gap_left P_ ((int, int, int)); 37 EMACS_INT nchars, EMACS_INT nbytes,
38static void gap_right P_ ((int, int)); 38 int inherit, int before_markers);
39static void adjust_markers_gap_motion P_ ((int, int, int)); 39static void insert_from_buffer_1 (struct buffer *buf,
40static void adjust_markers_for_insert P_ ((int, int, int, int, int)); 40 EMACS_INT from, EMACS_INT nchars,
41void adjust_markers_for_delete P_ ((int, int, int, int)); 41 int inherit);
42static void adjust_markers_for_replace P_ ((int, int, int, int, int, int)); 42static void gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap);
43static void adjust_point P_ ((int, int)); 43static void gap_right (EMACS_INT charpos, EMACS_INT bytepos);
44static void adjust_markers_gap_motion (EMACS_INT from, EMACS_INT to,
45 EMACS_INT amount);
46static void adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte,
47 EMACS_INT to, EMACS_INT to_byte,
48 int before_markers);
49static void adjust_markers_for_replace (EMACS_INT, EMACS_INT, EMACS_INT,
50 EMACS_INT, EMACS_INT, EMACS_INT);
51static void adjust_point (EMACS_INT nchars, EMACS_INT nbytes);
44 52
45Lisp_Object Fcombine_after_change_execute (); 53Lisp_Object Fcombine_after_change_execute ();
46 54
@@ -98,8 +106,7 @@ check_markers ()
98 Note that this can quit! */ 106 Note that this can quit! */
99 107
100void 108void
101move_gap (charpos) 109move_gap (EMACS_INT charpos)
102 int charpos;
103{ 110{
104 move_gap_both (charpos, charpos_to_bytepos (charpos)); 111 move_gap_both (charpos, charpos_to_bytepos (charpos));
105} 112}
@@ -108,8 +115,7 @@ move_gap (charpos)
108 Note that this can quit! */ 115 Note that this can quit! */
109 116
110void 117void
111move_gap_both (charpos, bytepos) 118move_gap_both (EMACS_INT charpos, EMACS_INT bytepos)
112 int charpos, bytepos;
113{ 119{
114 if (bytepos < GPT_BYTE) 120 if (bytepos < GPT_BYTE)
115 gap_left (charpos, bytepos, 0); 121 gap_left (charpos, bytepos, 0);
@@ -123,13 +129,11 @@ move_gap_both (charpos, bytepos)
123 If NEWGAP is nonzero, then don't update beg_unchanged and end_unchanged. */ 129 If NEWGAP is nonzero, then don't update beg_unchanged and end_unchanged. */
124 130
125static void 131static void
126gap_left (charpos, bytepos, newgap) 132gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap)
127 register int charpos, bytepos;
128 int newgap;
129{ 133{
130 register unsigned char *to, *from; 134 register unsigned char *to, *from;
131 register int i; 135 register EMACS_INT i;
132 int new_s1; 136 EMACS_INT new_s1;
133 137
134 if (!newgap) 138 if (!newgap)
135 BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT); 139 BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT);
@@ -200,12 +204,11 @@ gap_left (charpos, bytepos, newgap)
200 and CHARPOS is the corresponding char position. */ 204 and CHARPOS is the corresponding char position. */
201 205
202static void 206static void
203gap_right (charpos, bytepos) 207gap_right (EMACS_INT charpos, EMACS_INT bytepos)
204 register int charpos, bytepos;
205{ 208{
206 register unsigned char *to, *from; 209 register unsigned char *to, *from;
207 register int i; 210 register EMACS_INT i;
208 int new_s1; 211 EMACS_INT new_s1;
209 212
210 BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT); 213 BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT);
211 214
@@ -285,15 +288,14 @@ gap_right (charpos, bytepos)
285int adjust_markers_test; 288int adjust_markers_test;
286 289
287static void 290static void
288adjust_markers_gap_motion (from, to, amount) 291adjust_markers_gap_motion (EMACS_INT from, EMACS_INT to, EMACS_INT amount)
289 register int from, to, amount;
290{ 292{
291 /* Now that a marker has a bytepos, not counting the gap, 293 /* Now that a marker has a bytepos, not counting the gap,
292 nothing needs to be done here. */ 294 nothing needs to be done here. */
293#if 0 295#if 0
294 Lisp_Object marker; 296 Lisp_Object marker;
295 register struct Lisp_Marker *m; 297 register struct Lisp_Marker *m;
296 register int mpos; 298 register EMACS_INT mpos;
297 299
298 marker = BUF_MARKERS (current_buffer); 300 marker = BUF_MARKERS (current_buffer);
299 301
@@ -338,12 +340,12 @@ adjust_markers_gap_motion (from, to, amount)
338 or inside of the range being deleted. */ 340 or inside of the range being deleted. */
339 341
340void 342void
341adjust_markers_for_delete (from, from_byte, to, to_byte) 343adjust_markers_for_delete (EMACS_INT from, EMACS_INT from_byte,
342 register int from, from_byte, to, to_byte; 344 EMACS_INT to, EMACS_INT to_byte)
343{ 345{
344 Lisp_Object marker; 346 Lisp_Object marker;
345 register struct Lisp_Marker *m; 347 register struct Lisp_Marker *m;
346 register int charpos; 348 register EMACS_INT charpos;
347 349
348 for (m = BUF_MARKERS (current_buffer); m; m = m->next) 350 for (m = BUF_MARKERS (current_buffer); m; m = m->next)
349 { 351 {
@@ -403,14 +405,13 @@ adjust_markers_for_delete (from, from_byte, to, to_byte)
403 or BEFORE_MARKERS is true. */ 405 or BEFORE_MARKERS is true. */
404 406
405static void 407static void
406adjust_markers_for_insert (from, from_byte, to, to_byte, before_markers) 408adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte,
407 register int from, from_byte, to, to_byte; 409 EMACS_INT to, EMACS_INT to_byte, int before_markers)
408 int before_markers;
409{ 410{
410 struct Lisp_Marker *m; 411 struct Lisp_Marker *m;
411 int adjusted = 0; 412 int adjusted = 0;
412 int nchars = to - from; 413 EMACS_INT nchars = to - from;
413 int nbytes = to_byte - from_byte; 414 EMACS_INT nbytes = to_byte - from_byte;
414 415
415 for (m = BUF_MARKERS (current_buffer); m; m = m->next) 416 for (m = BUF_MARKERS (current_buffer); m; m = m->next)
416 { 417 {
@@ -455,8 +456,7 @@ adjust_markers_for_insert (from, from_byte, to, to_byte, before_markers)
455 intervals. */ 456 intervals. */
456 457
457static void 458static void
458adjust_point (nchars, nbytes) 459adjust_point (EMACS_INT nchars, EMACS_INT nbytes)
459 int nchars, nbytes;
460{ 460{
461 BUF_PT (current_buffer) += nchars; 461 BUF_PT (current_buffer) += nchars;
462 BUF_PT_BYTE (current_buffer) += nbytes; 462 BUF_PT_BYTE (current_buffer) += nbytes;
@@ -471,14 +471,14 @@ adjust_point (nchars, nbytes)
471 an insertion. */ 471 an insertion. */
472 472
473static void 473static void
474adjust_markers_for_replace (from, from_byte, old_chars, old_bytes, 474adjust_markers_for_replace (EMACS_INT from, EMACS_INT from_byte,
475 new_chars, new_bytes) 475 EMACS_INT old_chars, EMACS_INT old_bytes,
476 int from, from_byte, old_chars, old_bytes, new_chars, new_bytes; 476 EMACS_INT new_chars, EMACS_INT new_bytes)
477{ 477{
478 register struct Lisp_Marker *m; 478 register struct Lisp_Marker *m;
479 int prev_to_byte = from_byte + old_bytes; 479 EMACS_INT prev_to_byte = from_byte + old_bytes;
480 int diff_chars = new_chars - old_chars; 480 EMACS_INT diff_chars = new_chars - old_chars;
481 int diff_bytes = new_bytes - old_bytes; 481 EMACS_INT diff_bytes = new_bytes - old_bytes;
482 482
483 for (m = BUF_MARKERS (current_buffer); m; m = m->next) 483 for (m = BUF_MARKERS (current_buffer); m; m = m->next)
484 { 484 {
@@ -501,13 +501,12 @@ adjust_markers_for_replace (from, from_byte, old_chars, old_bytes,
501/* Make the gap NBYTES_ADDED bytes longer. */ 501/* Make the gap NBYTES_ADDED bytes longer. */
502 502
503void 503void
504make_gap_larger (nbytes_added) 504make_gap_larger (EMACS_INT nbytes_added)
505 int nbytes_added;
506{ 505{
507 Lisp_Object tem; 506 Lisp_Object tem;
508 int real_gap_loc; 507 EMACS_INT real_gap_loc;
509 int real_gap_loc_byte; 508 EMACS_INT real_gap_loc_byte;
510 int old_gap_size; 509 EMACS_INT old_gap_size;
511 510
512 /* If we have to get more space, get enough to last a while. */ 511 /* If we have to get more space, get enough to last a while. */
513 nbytes_added += 2000; 512 nbytes_added += 2000;
@@ -557,16 +556,15 @@ make_gap_larger (nbytes_added)
557/* Make the gap NBYTES_REMOVED bytes shorter. */ 556/* Make the gap NBYTES_REMOVED bytes shorter. */
558 557
559void 558void
560make_gap_smaller (nbytes_removed) 559make_gap_smaller (EMACS_INT nbytes_removed)
561 int nbytes_removed;
562{ 560{
563 Lisp_Object tem; 561 Lisp_Object tem;
564 int real_gap_loc; 562 EMACS_INT real_gap_loc;
565 int real_gap_loc_byte; 563 EMACS_INT real_gap_loc_byte;
566 int real_Z; 564 EMACS_INT real_Z;
567 int real_Z_byte; 565 EMACS_INT real_Z_byte;
568 int real_beg_unchanged; 566 EMACS_INT real_beg_unchanged;
569 int new_gap_size; 567 EMACS_INT new_gap_size;
570 568
571 /* Make sure the gap is at least 20 bytes. */ 569 /* Make sure the gap is at least 20 bytes. */
572 if (GAP_SIZE - nbytes_removed < 20) 570 if (GAP_SIZE - nbytes_removed < 20)
@@ -614,8 +612,7 @@ make_gap_smaller (nbytes_removed)
614} 612}
615 613
616void 614void
617make_gap (nbytes_added) 615make_gap (EMACS_INT nbytes_added)
618 int nbytes_added;
619{ 616{
620 if (nbytes_added >= 0) 617 if (nbytes_added >= 0)
621 make_gap_larger (nbytes_added); 618 make_gap_larger (nbytes_added);
@@ -632,13 +629,9 @@ make_gap (nbytes_added)
632 629
633 Return the number of bytes stored at TO_ADDR. */ 630 Return the number of bytes stored at TO_ADDR. */
634 631
635int 632EMACS_INT
636copy_text (from_addr, to_addr, nbytes, 633copy_text (const unsigned char *from_addr, unsigned char *to_addr,
637 from_multibyte, to_multibyte) 634 EMACS_INT nbytes, int from_multibyte, int to_multibyte)
638 const unsigned char *from_addr;
639 unsigned char *to_addr;
640 int nbytes;
641 int from_multibyte, to_multibyte;
642{ 635{
643 if (from_multibyte == to_multibyte) 636 if (from_multibyte == to_multibyte)
644 { 637 {
@@ -647,8 +640,8 @@ copy_text (from_addr, to_addr, nbytes,
647 } 640 }
648 else if (from_multibyte) 641 else if (from_multibyte)
649 { 642 {
650 int nchars = 0; 643 EMACS_INT nchars = 0;
651 int bytes_left = nbytes; 644 EMACS_INT bytes_left = nbytes;
652 Lisp_Object tbl = Qnil; 645 Lisp_Object tbl = Qnil;
653 646
654 while (bytes_left > 0) 647 while (bytes_left > 0)
@@ -691,13 +684,11 @@ copy_text (from_addr, to_addr, nbytes,
691 to convert some single-byte text to multibyte. 684 to convert some single-byte text to multibyte.
692 The single-byte text consists of NBYTES bytes at PTR. */ 685 The single-byte text consists of NBYTES bytes at PTR. */
693 686
694int 687EMACS_INT
695count_size_as_multibyte (ptr, nbytes) 688count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes)
696 const unsigned char *ptr;
697 int nbytes;
698{ 689{
699 int i; 690 EMACS_INT i;
700 int outgoing_nbytes = 0; 691 EMACS_INT outgoing_nbytes = 0;
701 692
702 for (i = 0; i < nbytes; i++) 693 for (i = 0; i < nbytes; i++)
703 { 694 {
@@ -724,13 +715,11 @@ count_size_as_multibyte (ptr, nbytes)
724 prepare_to_modify_buffer could relocate the text. */ 715 prepare_to_modify_buffer could relocate the text. */
725 716
726void 717void
727insert (string, nbytes) 718insert (const unsigned char *string, EMACS_INT nbytes)
728 register const unsigned char *string;
729 register int nbytes;
730{ 719{
731 if (nbytes > 0) 720 if (nbytes > 0)
732 { 721 {
733 int len = chars_in_text (string, nbytes), opoint; 722 EMACS_INT len = chars_in_text (string, nbytes), opoint;
734 insert_1_both (string, len, nbytes, 0, 1, 0); 723 insert_1_both (string, len, nbytes, 0, 1, 0);
735 opoint = PT - len; 724 opoint = PT - len;
736 signal_after_change (opoint, 0, len); 725 signal_after_change (opoint, 0, len);
@@ -741,13 +730,11 @@ insert (string, nbytes)
741/* Likewise, but inherit text properties from neighboring characters. */ 730/* Likewise, but inherit text properties from neighboring characters. */
742 731
743void 732void
744insert_and_inherit (string, nbytes) 733insert_and_inherit (const unsigned char *string, EMACS_INT nbytes)
745 register const unsigned char *string;
746 register int nbytes;
747{ 734{
748 if (nbytes > 0) 735 if (nbytes > 0)
749 { 736 {
750 int len = chars_in_text (string, nbytes), opoint; 737 EMACS_INT len = chars_in_text (string, nbytes), opoint;
751 insert_1_both (string, len, nbytes, 1, 1, 0); 738 insert_1_both (string, len, nbytes, 1, 1, 0);
752 opoint = PT - len; 739 opoint = PT - len;
753 signal_after_change (opoint, 0, len); 740 signal_after_change (opoint, 0, len);
@@ -758,8 +745,7 @@ insert_and_inherit (string, nbytes)
758/* Insert the character C before point. Do not inherit text properties. */ 745/* Insert the character C before point. Do not inherit text properties. */
759 746
760void 747void
761insert_char (c) 748insert_char (int c)
762 int c;
763{ 749{
764 unsigned char str[MAX_MULTIBYTE_LENGTH]; 750 unsigned char str[MAX_MULTIBYTE_LENGTH];
765 int len; 751 int len;
@@ -778,8 +764,7 @@ insert_char (c)
778/* Insert the null-terminated string S before point. */ 764/* Insert the null-terminated string S before point. */
779 765
780void 766void
781insert_string (s) 767insert_string (const char *s)
782 const char *s;
783{ 768{
784 insert (s, strlen (s)); 769 insert (s, strlen (s));
785} 770}
@@ -790,13 +775,11 @@ insert_string (s)
790 since gc could happen and relocate it. */ 775 since gc could happen and relocate it. */
791 776
792void 777void
793insert_before_markers (string, nbytes) 778insert_before_markers (const unsigned char *string, EMACS_INT nbytes)
794 const unsigned char *string;
795 register int nbytes;
796{ 779{
797 if (nbytes > 0) 780 if (nbytes > 0)
798 { 781 {
799 int len = chars_in_text (string, nbytes), opoint; 782 EMACS_INT len = chars_in_text (string, nbytes), opoint;
800 insert_1_both (string, len, nbytes, 0, 1, 1); 783 insert_1_both (string, len, nbytes, 0, 1, 1);
801 opoint = PT - len; 784 opoint = PT - len;
802 signal_after_change (opoint, 0, len); 785 signal_after_change (opoint, 0, len);
@@ -807,13 +790,12 @@ insert_before_markers (string, nbytes)
807/* Likewise, but inherit text properties from neighboring characters. */ 790/* Likewise, but inherit text properties from neighboring characters. */
808 791
809void 792void
810insert_before_markers_and_inherit (string, nbytes) 793insert_before_markers_and_inherit (const unsigned char *string,
811 const unsigned char *string; 794 EMACS_INT nbytes)
812 register int nbytes;
813{ 795{
814 if (nbytes > 0) 796 if (nbytes > 0)
815 { 797 {
816 int len = chars_in_text (string, nbytes), opoint; 798 EMACS_INT len = chars_in_text (string, nbytes), opoint;
817 insert_1_both (string, len, nbytes, 1, 1, 1); 799 insert_1_both (string, len, nbytes, 1, 1, 1);
818 opoint = PT - len; 800 opoint = PT - len;
819 signal_after_change (opoint, 0, len); 801 signal_after_change (opoint, 0, len);
@@ -824,10 +806,8 @@ insert_before_markers_and_inherit (string, nbytes)
824/* Subroutine used by the insert functions above. */ 806/* Subroutine used by the insert functions above. */
825 807
826void 808void
827insert_1 (string, nbytes, inherit, prepare, before_markers) 809insert_1 (const unsigned char *string, EMACS_INT nbytes,
828 register const unsigned char *string; 810 int inherit, int prepare, int before_markers)
829 register int nbytes;
830 int inherit, prepare, before_markers;
831{ 811{
832 insert_1_both (string, chars_in_text (string, nbytes), nbytes, 812 insert_1_both (string, chars_in_text (string, nbytes), nbytes,
833 inherit, prepare, before_markers); 813 inherit, prepare, before_markers);
@@ -842,10 +822,8 @@ insert_1 (string, nbytes, inherit, prepare, before_markers)
842 which combine in this way. Otherwise, return 0. */ 822 which combine in this way. Otherwise, return 0. */
843 823
844int 824int
845count_combining_before (string, length, pos, pos_byte) 825count_combining_before (const unsigned char *string, EMACS_INT length,
846 const unsigned char *string; 826 EMACS_INT pos, EMACS_INT pos_byte)
847 int length;
848 int pos, pos_byte;
849{ 827{
850 int len, combining_bytes; 828 int len, combining_bytes;
851 const unsigned char *p; 829 const unsigned char *p;
@@ -889,14 +867,12 @@ count_combining_before (string, length, pos, pos_byte)
889 which combine in this way. Otherwise, return 0. */ 867 which combine in this way. Otherwise, return 0. */
890 868
891int 869int
892count_combining_after (string, length, pos, pos_byte) 870count_combining_after (const unsigned char *string,
893 const unsigned char *string; 871 EMACS_INT length, EMACS_INT pos, EMACS_INT pos_byte)
894 int length;
895 int pos, pos_byte;
896{ 872{
897 int opos_byte = pos_byte; 873 EMACS_INT opos_byte = pos_byte;
898 int i; 874 EMACS_INT i;
899 int bytes; 875 EMACS_INT bytes;
900 unsigned char *bufp; 876 unsigned char *bufp;
901 877
902 if (NILP (current_buffer->enable_multibyte_characters)) 878 if (NILP (current_buffer->enable_multibyte_characters))
@@ -955,10 +931,9 @@ count_combining_after (string, length, pos, pos_byte)
955 are the same as in insert_1. */ 931 are the same as in insert_1. */
956 932
957void 933void
958insert_1_both (string, nchars, nbytes, inherit, prepare, before_markers) 934insert_1_both (const unsigned char *string,
959 register const unsigned char *string; 935 EMACS_INT nchars, EMACS_INT nbytes,
960 register int nchars, nbytes; 936 int inherit, int prepare, int before_markers)
961 int inherit, prepare, before_markers;
962{ 937{
963 if (nchars == 0) 938 if (nchars == 0)
964 return; 939 return;
@@ -1035,12 +1010,10 @@ insert_1_both (string, nchars, nbytes, inherit, prepare, before_markers)
1035 without insert noticing. */ 1010 without insert noticing. */
1036 1011
1037void 1012void
1038insert_from_string (string, pos, pos_byte, length, length_byte, inherit) 1013insert_from_string (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1039 Lisp_Object string; 1014 EMACS_INT length, EMACS_INT length_byte, int inherit)
1040 register int pos, pos_byte, length, length_byte;
1041 int inherit;
1042{ 1015{
1043 int opoint = PT; 1016 EMACS_INT opoint = PT;
1044 1017
1045 if (SCHARS (string) == 0) 1018 if (SCHARS (string) == 0)
1046 return; 1019 return;
@@ -1055,13 +1028,12 @@ insert_from_string (string, pos, pos_byte, length, length_byte, inherit)
1055 at the place where the insertion happens are adjusted to point after it. */ 1028 at the place where the insertion happens are adjusted to point after it. */
1056 1029
1057void 1030void
1058insert_from_string_before_markers (string, pos, pos_byte, 1031insert_from_string_before_markers (Lisp_Object string,
1059 length, length_byte, inherit) 1032 EMACS_INT pos, EMACS_INT pos_byte,
1060 Lisp_Object string; 1033 EMACS_INT length, EMACS_INT length_byte,
1061 register int pos, pos_byte, length, length_byte; 1034 int inherit)
1062 int inherit;
1063{ 1035{
1064 int opoint = PT; 1036 EMACS_INT opoint = PT;
1065 1037
1066 if (SCHARS (string) == 0) 1038 if (SCHARS (string) == 0)
1067 return; 1039 return;
@@ -1075,14 +1047,12 @@ insert_from_string_before_markers (string, pos, pos_byte,
1075/* Subroutine of the insertion functions above. */ 1047/* Subroutine of the insertion functions above. */
1076 1048
1077static void 1049static void
1078insert_from_string_1 (string, pos, pos_byte, nchars, nbytes, 1050insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1079 inherit, before_markers) 1051 EMACS_INT nchars, EMACS_INT nbytes,
1080 Lisp_Object string; 1052 int inherit, int before_markers)
1081 register int pos, pos_byte, nchars, nbytes;
1082 int inherit, before_markers;
1083{ 1053{
1084 struct gcpro gcpro1; 1054 struct gcpro gcpro1;
1085 int outgoing_nbytes = nbytes; 1055 EMACS_INT outgoing_nbytes = nbytes;
1086 INTERVAL intervals; 1056 INTERVAL intervals;
1087 1057
1088 /* Make OUTGOING_NBYTES describe the text 1058 /* Make OUTGOING_NBYTES describe the text
@@ -1169,8 +1139,7 @@ insert_from_string_1 (string, pos, pos_byte, nchars, nbytes,
1169 starting at GPT_ADDR. */ 1139 starting at GPT_ADDR. */
1170 1140
1171void 1141void
1172insert_from_gap (nchars, nbytes) 1142insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes)
1173 register EMACS_INT nchars, nbytes;
1174{ 1143{
1175 if (NILP (current_buffer->enable_multibyte_characters)) 1144 if (NILP (current_buffer->enable_multibyte_characters))
1176 nchars = nbytes; 1145 nchars = nbytes;
@@ -1215,12 +1184,10 @@ insert_from_gap (nchars, nbytes)
1215 and relocate BUF's text before the bcopy happens. */ 1184 and relocate BUF's text before the bcopy happens. */
1216 1185
1217void 1186void
1218insert_from_buffer (buf, charpos, nchars, inherit) 1187insert_from_buffer (struct buffer *buf,
1219 struct buffer *buf; 1188 EMACS_INT charpos, EMACS_INT nchars, int inherit)
1220 int charpos, nchars;
1221 int inherit;
1222{ 1189{
1223 int opoint = PT; 1190 EMACS_INT opoint = PT;
1224 1191
1225 insert_from_buffer_1 (buf, charpos, nchars, inherit); 1192 insert_from_buffer_1 (buf, charpos, nchars, inherit);
1226 signal_after_change (opoint, 0, PT - opoint); 1193 signal_after_change (opoint, 0, PT - opoint);
@@ -1228,17 +1195,15 @@ insert_from_buffer (buf, charpos, nchars, inherit)
1228} 1195}
1229 1196
1230static void 1197static void
1231insert_from_buffer_1 (buf, from, nchars, inherit) 1198insert_from_buffer_1 (struct buffer *buf,
1232 struct buffer *buf; 1199 EMACS_INT from, EMACS_INT nchars, int inherit)
1233 int from, nchars;
1234 int inherit;
1235{ 1200{
1236 register Lisp_Object temp; 1201 register Lisp_Object temp;
1237 int chunk, chunk_expanded; 1202 EMACS_INT chunk, chunk_expanded;
1238 int from_byte = buf_charpos_to_bytepos (buf, from); 1203 EMACS_INT from_byte = buf_charpos_to_bytepos (buf, from);
1239 int to_byte = buf_charpos_to_bytepos (buf, from + nchars); 1204 EMACS_INT to_byte = buf_charpos_to_bytepos (buf, from + nchars);
1240 int incoming_nbytes = to_byte - from_byte; 1205 EMACS_INT incoming_nbytes = to_byte - from_byte;
1241 int outgoing_nbytes = incoming_nbytes; 1206 EMACS_INT outgoing_nbytes = incoming_nbytes;
1242 INTERVAL intervals; 1207 INTERVAL intervals;
1243 1208
1244 /* Make OUTGOING_NBYTES describe the text 1209 /* Make OUTGOING_NBYTES describe the text
@@ -1248,8 +1213,8 @@ insert_from_buffer_1 (buf, from, nchars, inherit)
1248 outgoing_nbytes = nchars; 1213 outgoing_nbytes = nchars;
1249 else if (NILP (buf->enable_multibyte_characters)) 1214 else if (NILP (buf->enable_multibyte_characters))
1250 { 1215 {
1251 int outgoing_before_gap = 0; 1216 EMACS_INT outgoing_before_gap = 0;
1252 int outgoing_after_gap = 0; 1217 EMACS_INT outgoing_after_gap = 0;
1253 1218
1254 if (from < BUF_GPT (buf)) 1219 if (from < BUF_GPT (buf))
1255 { 1220 {
@@ -1371,11 +1336,10 @@ insert_from_buffer_1 (buf, from, nchars, inherit)
1371 PREV_TEXT nil means the new text was just inserted. */ 1336 PREV_TEXT nil means the new text was just inserted. */
1372 1337
1373void 1338void
1374adjust_after_replace (from, from_byte, prev_text, len, len_byte) 1339adjust_after_replace (EMACS_INT from, EMACS_INT from_byte,
1375 int from, from_byte, len, len_byte; 1340 Lisp_Object prev_text, EMACS_INT len, EMACS_INT len_byte)
1376 Lisp_Object prev_text;
1377{ 1341{
1378 int nchars_del = 0, nbytes_del = 0; 1342 EMACS_INT nchars_del = 0, nbytes_del = 0;
1379 1343
1380#ifdef BYTE_COMBINING_DEBUG 1344#ifdef BYTE_COMBINING_DEBUG
1381 if (count_combining_before (GPT_ADDR, len_byte, from, from_byte) 1345 if (count_combining_before (GPT_ADDR, len_byte, from, from_byte)
@@ -1438,8 +1402,9 @@ adjust_after_replace (from, from_byte, prev_text, len, len_byte)
1438 This is for use when undo is not enabled in the current buffer. */ 1402 This is for use when undo is not enabled in the current buffer. */
1439 1403
1440void 1404void
1441adjust_after_replace_noundo (from, from_byte, nchars_del, nbytes_del, len, len_byte) 1405adjust_after_replace_noundo (EMACS_INT from, EMACS_INT from_byte,
1442 int from, from_byte, nchars_del, nbytes_del, len, len_byte; 1406 EMACS_INT nchars_del, EMACS_INT nbytes_del,
1407 EMACS_INT len, EMACS_INT len_byte)
1443{ 1408{
1444#ifdef BYTE_COMBINING_DEBUG 1409#ifdef BYTE_COMBINING_DEBUG
1445 if (count_combining_before (GPT_ADDR, len_byte, from, from_byte) 1410 if (count_combining_before (GPT_ADDR, len_byte, from, from_byte)
@@ -1491,10 +1456,10 @@ adjust_after_replace_noundo (from, from_byte, nchars_del, nbytes_del, len, len_b
1491 - FROM) may be incorrect, the correct length is NEWLEN. */ 1456 - FROM) may be incorrect, the correct length is NEWLEN. */
1492 1457
1493void 1458void
1494adjust_after_insert (from, from_byte, to, to_byte, newlen) 1459adjust_after_insert (EMACS_INT from, EMACS_INT from_byte,
1495 int from, from_byte, to, to_byte, newlen; 1460 EMACS_INT to, EMACS_INT to_byte, EMACS_INT newlen)
1496{ 1461{
1497 int len = to - from, len_byte = to_byte - from_byte; 1462 EMACS_INT len = to - from, len_byte = to_byte - from_byte;
1498 1463
1499 if (GPT != to) 1464 if (GPT != to)
1500 move_gap_both (to, to_byte); 1465 move_gap_both (to, to_byte);
@@ -1518,18 +1483,17 @@ adjust_after_insert (from, from_byte, to, to_byte, newlen)
1518 But if MARKERS is 0, don't relocate markers. */ 1483 But if MARKERS is 0, don't relocate markers. */
1519 1484
1520void 1485void
1521replace_range (from, to, new, prepare, inherit, markers) 1486replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1522 Lisp_Object new; 1487 int prepare, int inherit, int markers)
1523 int from, to, prepare, inherit, markers;
1524{ 1488{
1525 int inschars = SCHARS (new); 1489 EMACS_INT inschars = SCHARS (new);
1526 int insbytes = SBYTES (new); 1490 EMACS_INT insbytes = SBYTES (new);
1527 int from_byte, to_byte; 1491 EMACS_INT from_byte, to_byte;
1528 int nbytes_del, nchars_del; 1492 EMACS_INT nbytes_del, nchars_del;
1529 register Lisp_Object temp; 1493 register Lisp_Object temp;
1530 struct gcpro gcpro1; 1494 struct gcpro gcpro1;
1531 INTERVAL intervals; 1495 INTERVAL intervals;
1532 int outgoing_insbytes = insbytes; 1496 EMACS_INT outgoing_insbytes = insbytes;
1533 Lisp_Object deletion; 1497 Lisp_Object deletion;
1534 1498
1535 CHECK_MARKERS (); 1499 CHECK_MARKERS ();
@@ -1539,7 +1503,7 @@ replace_range (from, to, new, prepare, inherit, markers)
1539 1503
1540 if (prepare) 1504 if (prepare)
1541 { 1505 {
1542 int range_length = to - from; 1506 EMACS_INT range_length = to - from;
1543 prepare_to_modify_buffer (from, to, &from); 1507 prepare_to_modify_buffer (from, to, &from);
1544 to = from + range_length; 1508 to = from + range_length;
1545 } 1509 }
@@ -1699,12 +1663,12 @@ replace_range (from, to, new, prepare, inherit, markers)
1699 prepare_to_modify_buffer and never call signal_after_change. */ 1663 prepare_to_modify_buffer and never call signal_after_change. */
1700 1664
1701void 1665void
1702replace_range_2 (from, from_byte, to, to_byte, ins, inschars, insbytes, markers) 1666replace_range_2 (EMACS_INT from, EMACS_INT from_byte,
1703 int from, from_byte, to, to_byte; 1667 EMACS_INT to, EMACS_INT to_byte,
1704 char *ins; 1668 char *ins, EMACS_INT inschars, EMACS_INT insbytes,
1705 int inschars, insbytes, markers; 1669 int markers)
1706{ 1670{
1707 int nbytes_del, nchars_del; 1671 EMACS_INT nbytes_del, nchars_del;
1708 Lisp_Object temp; 1672 Lisp_Object temp;
1709 1673
1710 CHECK_MARKERS (); 1674 CHECK_MARKERS ();
@@ -1812,8 +1776,7 @@ replace_range_2 (from, from_byte, to, to_byte, ins, inschars, insbytes, markers)
1812 If TO comes before FROM, we delete nothing. */ 1776 If TO comes before FROM, we delete nothing. */
1813 1777
1814void 1778void
1815del_range (from, to) 1779del_range (EMACS_INT from, EMACS_INT to)
1816 register int from, to;
1817{ 1780{
1818 del_range_1 (from, to, 1, 0); 1781 del_range_1 (from, to, 1, 0);
1819} 1782}
@@ -1822,10 +1785,9 @@ del_range (from, to)
1822 RET_STRING says to return the deleted text. */ 1785 RET_STRING says to return the deleted text. */
1823 1786
1824Lisp_Object 1787Lisp_Object
1825del_range_1 (from, to, prepare, ret_string) 1788del_range_1 (EMACS_INT from, EMACS_INT to, int prepare, int ret_string)
1826 int from, to, prepare, ret_string;
1827{ 1789{
1828 int from_byte, to_byte; 1790 EMACS_INT from_byte, to_byte;
1829 Lisp_Object deletion; 1791 Lisp_Object deletion;
1830 struct gcpro gcpro1; 1792 struct gcpro gcpro1;
1831 1793
@@ -1840,7 +1802,7 @@ del_range_1 (from, to, prepare, ret_string)
1840 1802
1841 if (prepare) 1803 if (prepare)
1842 { 1804 {
1843 int range_length = to - from; 1805 EMACS_INT range_length = to - from;
1844 prepare_to_modify_buffer (from, to, &from); 1806 prepare_to_modify_buffer (from, to, &from);
1845 to = min (ZV, from + range_length); 1807 to = min (ZV, from + range_length);
1846 } 1808 }
@@ -1859,10 +1821,9 @@ del_range_1 (from, to, prepare, ret_string)
1859/* Like del_range_1 but args are byte positions, not char positions. */ 1821/* Like del_range_1 but args are byte positions, not char positions. */
1860 1822
1861void 1823void
1862del_range_byte (from_byte, to_byte, prepare) 1824del_range_byte (EMACS_INT from_byte, EMACS_INT to_byte, int prepare)
1863 int from_byte, to_byte, prepare;
1864{ 1825{
1865 int from, to; 1826 EMACS_INT from, to;
1866 1827
1867 /* Make args be valid */ 1828 /* Make args be valid */
1868 if (from_byte < BEGV_BYTE) 1829 if (from_byte < BEGV_BYTE)
@@ -1878,8 +1839,8 @@ del_range_byte (from_byte, to_byte, prepare)
1878 1839
1879 if (prepare) 1840 if (prepare)
1880 { 1841 {
1881 int old_from = from, old_to = Z - to; 1842 EMACS_INT old_from = from, old_to = Z - to;
1882 int range_length = to - from; 1843 EMACS_INT range_length = to - from;
1883 prepare_to_modify_buffer (from, to, &from); 1844 prepare_to_modify_buffer (from, to, &from);
1884 to = from + range_length; 1845 to = from + range_length;
1885 1846
@@ -1903,8 +1864,8 @@ del_range_byte (from_byte, to_byte, prepare)
1903 and bytepos. */ 1864 and bytepos. */
1904 1865
1905void 1866void
1906del_range_both (from, from_byte, to, to_byte, prepare) 1867del_range_both (EMACS_INT from, EMACS_INT from_byte,
1907 int from, from_byte, to, to_byte, prepare; 1868 EMACS_INT to, EMACS_INT to_byte, int prepare)
1908{ 1869{
1909 /* Make args be valid */ 1870 /* Make args be valid */
1910 if (from_byte < BEGV_BYTE) 1871 if (from_byte < BEGV_BYTE)
@@ -1922,8 +1883,8 @@ del_range_both (from, from_byte, to, to_byte, prepare)
1922 1883
1923 if (prepare) 1884 if (prepare)
1924 { 1885 {
1925 int old_from = from, old_to = Z - to; 1886 EMACS_INT old_from = from, old_to = Z - to;
1926 int range_length = to - from; 1887 EMACS_INT range_length = to - from;
1927 prepare_to_modify_buffer (from, to, &from); 1888 prepare_to_modify_buffer (from, to, &from);
1928 to = from + range_length; 1889 to = from + range_length;
1929 1890
@@ -1949,10 +1910,10 @@ del_range_both (from, from_byte, to, to_byte, prepare)
1949 If RET_STRING is true, the deleted area is returned as a string. */ 1910 If RET_STRING is true, the deleted area is returned as a string. */
1950 1911
1951Lisp_Object 1912Lisp_Object
1952del_range_2 (from, from_byte, to, to_byte, ret_string) 1913del_range_2 (EMACS_INT from, EMACS_INT from_byte,
1953 int from, from_byte, to, to_byte, ret_string; 1914 EMACS_INT to, EMACS_INT to_byte, int ret_string)
1954{ 1915{
1955 register int nbytes_del, nchars_del; 1916 register EMACS_INT nbytes_del, nchars_del;
1956 Lisp_Object deletion; 1917 Lisp_Object deletion;
1957 1918
1958 CHECK_MARKERS (); 1919 CHECK_MARKERS ();
@@ -2036,9 +1997,8 @@ del_range_2 (from, from_byte, to, to_byte, ret_string)
2036 Otherwise set CHARS_MODIFF to the new value of MODIFF. */ 1997 Otherwise set CHARS_MODIFF to the new value of MODIFF. */
2037 1998
2038void 1999void
2039modify_region (buffer, start, end, preserve_chars_modiff) 2000modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end,
2040 struct buffer *buffer; 2001 int preserve_chars_modiff)
2041 int start, end, preserve_chars_modiff;
2042{ 2002{
2043 struct buffer *old_buffer = current_buffer; 2003 struct buffer *old_buffer = current_buffer;
2044 2004
@@ -2072,9 +2032,7 @@ modify_region (buffer, start, end, preserve_chars_modiff)
2072 by holding its value temporarily in a marker. */ 2032 by holding its value temporarily in a marker. */
2073 2033
2074void 2034void
2075prepare_to_modify_buffer (start, end, preserve_ptr) 2035prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, int *preserve_ptr)
2076 int start, end;
2077 int *preserve_ptr;
2078{ 2036{
2079 struct buffer *base_buffer; 2037 struct buffer *base_buffer;
2080 2038
@@ -2187,9 +2145,8 @@ reset_var_on_error (val)
2187 by holding its value temporarily in a marker. */ 2145 by holding its value temporarily in a marker. */
2188 2146
2189void 2147void
2190signal_before_change (start_int, end_int, preserve_ptr) 2148signal_before_change (EMACS_INT start_int, EMACS_INT end_int,
2191 int start_int, end_int; 2149 int *preserve_ptr)
2192 int *preserve_ptr;
2193{ 2150{
2194 Lisp_Object start, end; 2151 Lisp_Object start, end;
2195 Lisp_Object start_marker, end_marker; 2152 Lisp_Object start_marker, end_marker;
@@ -2266,8 +2223,7 @@ signal_before_change (start_int, end_int, preserve_ptr)
2266 after the change. */ 2223 after the change. */
2267 2224
2268void 2225void
2269signal_after_change (charpos, lendel, lenins) 2226signal_after_change (EMACS_INT charpos, EMACS_INT lendel, EMACS_INT lenins)
2270 int charpos, lendel, lenins;
2271{ 2227{
2272 int count = SPECPDL_INDEX (); 2228 int count = SPECPDL_INDEX ();
2273 if (inhibit_modification_hooks) 2229 if (inhibit_modification_hooks)
@@ -2352,8 +2308,8 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
2352 () 2308 ()
2353{ 2309{
2354 int count = SPECPDL_INDEX (); 2310 int count = SPECPDL_INDEX ();
2355 int beg, end, change; 2311 EMACS_INT beg, end, change;
2356 int begpos, endpos; 2312 EMACS_INT begpos, endpos;
2357 Lisp_Object tail; 2313 Lisp_Object tail;
2358 2314
2359 if (NILP (combine_after_change_list)) 2315 if (NILP (combine_after_change_list))
@@ -2387,7 +2343,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
2387 tail = XCDR (tail)) 2343 tail = XCDR (tail))
2388 { 2344 {
2389 Lisp_Object elt; 2345 Lisp_Object elt;
2390 int thisbeg, thisend, thischange; 2346 EMACS_INT thisbeg, thisend, thischange;
2391 2347
2392 /* Extract the info from the next element. */ 2348 /* Extract the info from the next element. */
2393 elt = XCAR (tail); 2349 elt = XCAR (tail);
diff --git a/src/lisp.h b/src/lisp.h
index 99da7160b64..a68afeb4388 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2452,40 +2452,55 @@ extern void init_image P_ ((void));
2452 2452
2453/* Defined in insdel.c */ 2453/* Defined in insdel.c */
2454extern Lisp_Object Qinhibit_modification_hooks; 2454extern Lisp_Object Qinhibit_modification_hooks;
2455extern void move_gap P_ ((int)); 2455extern void move_gap (EMACS_INT);
2456extern void move_gap_both P_ ((int, int)); 2456extern void move_gap_both (EMACS_INT, EMACS_INT);
2457extern void make_gap P_ ((int)); 2457extern void make_gap (EMACS_INT);
2458extern int copy_text P_ ((const unsigned char *, unsigned char *, int, int, int)); 2458extern int copy_text (const unsigned char *, unsigned char *,
2459extern int count_size_as_multibyte P_ ((const unsigned char *, int)); 2459 EMACS_INT, int, int);
2460extern int count_combining_before P_ ((const unsigned char *, int, int, int)); 2460extern int count_size_as_multibyte (const unsigned char *, EMACS_INT);
2461extern int count_combining_after P_ ((const unsigned char *, int, int, int)); 2461extern int count_combining_before (const unsigned char *,
2462extern void insert P_ ((const unsigned char *, int)); 2462 EMACS_INT, EMACS_INT, EMACS_INT);
2463extern void insert_and_inherit P_ ((const unsigned char *, int)); 2463extern int count_combining_after (const unsigned char *,
2464extern void insert_1 P_ ((const unsigned char *, int, int, int, int)); 2464 EMACS_INT, EMACS_INT, EMACS_INT);
2465extern void insert_1_both P_ ((const unsigned char *, int, int, int, int, int)); 2465extern void insert (const unsigned char *, EMACS_INT);
2466extern void insert_from_gap P_ ((EMACS_INT, EMACS_INT)); 2466extern void insert_and_inherit (const unsigned char *, EMACS_INT);
2467extern void insert_from_string P_ ((Lisp_Object, int, int, int, int, int)); 2467extern void insert_1 (const unsigned char *, EMACS_INT, int, int, int);
2468extern void insert_from_buffer P_ ((struct buffer *, int, int, int)); 2468extern void insert_1_both (const unsigned char *, EMACS_INT, EMACS_INT,
2469extern void insert_char P_ ((int)); 2469 int, int, int);
2470extern void insert_string P_ ((const char *)); 2470extern void insert_from_gap (EMACS_INT, EMACS_INT);
2471extern void insert_before_markers P_ ((const unsigned char *, int)); 2471extern void insert_from_string (Lisp_Object, EMACS_INT, EMACS_INT,
2472extern void insert_before_markers_and_inherit P_ ((const unsigned char *, int)); 2472 EMACS_INT, EMACS_INT, int);
2473extern void insert_from_string_before_markers P_ ((Lisp_Object, int, int, int, int, int)); 2473extern void insert_from_buffer (struct buffer *, EMACS_INT, EMACS_INT, int);
2474extern void del_range P_ ((int, int)); 2474extern void insert_char (int);
2475extern Lisp_Object del_range_1 P_ ((int, int, int, int)); 2475extern void insert_string (const char *);
2476extern void del_range_byte P_ ((int, int, int)); 2476extern void insert_before_markers (const unsigned char *, EMACS_INT);
2477extern void del_range_both P_ ((int, int, int, int, int)); 2477extern void insert_before_markers_and_inherit (const unsigned char *,
2478extern Lisp_Object del_range_2 P_ ((int, int, int, int, int)); 2478 EMACS_INT);
2479extern void modify_region P_ ((struct buffer *, int, int, int)); 2479extern void insert_from_string_before_markers (Lisp_Object, EMACS_INT,
2480extern void prepare_to_modify_buffer P_ ((int, int, int *)); 2480 EMACS_INT, EMACS_INT,
2481extern void signal_before_change P_ ((int, int, int *)); 2481 EMACS_INT, int);
2482extern void signal_after_change P_ ((int, int, int)); 2482extern void del_range (EMACS_INT, EMACS_INT);
2483extern void adjust_after_replace P_ ((int, int, Lisp_Object, int, int)); 2483extern Lisp_Object del_range_1 (EMACS_INT, EMACS_INT, int, int);
2484extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int)); 2484extern void del_range_byte (EMACS_INT, EMACS_INT, int);
2485extern void adjust_after_insert P_ ((int, int, int, int, int)); 2485extern void del_range_both (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, int);
2486extern void replace_range P_ ((int, int, Lisp_Object, int, int, int)); 2486extern Lisp_Object del_range_2 (EMACS_INT, EMACS_INT,
2487extern void replace_range_2 P_ ((int, int, int, int, char *, int, int, int)); 2487 EMACS_INT, EMACS_INT, int);
2488extern void syms_of_insdel P_ ((void)); 2488extern void modify_region (struct buffer *, EMACS_INT, EMACS_INT, int);
2489extern void prepare_to_modify_buffer (EMACS_INT, EMACS_INT, int *);
2490extern void signal_before_change (EMACS_INT, EMACS_INT, int *);
2491extern void signal_after_change (EMACS_INT, EMACS_INT, EMACS_INT);
2492extern void adjust_after_replace (EMACS_INT, EMACS_INT, Lisp_Object,
2493 EMACS_INT, EMACS_INT);
2494extern void adjust_after_replace_noundo (EMACS_INT, EMACS_INT, EMACS_INT,
2495 EMACS_INT, EMACS_INT, EMACS_INT);
2496extern void adjust_after_insert (EMACS_INT, EMACS_INT, EMACS_INT,
2497 EMACS_INT, EMACS_INT);
2498extern void adjust_markers_for_delete (EMACS_INT, EMACS_INT,
2499 EMACS_INT, EMACS_INT);
2500extern void replace_range (EMACS_INT, EMACS_INT, Lisp_Object, int, int, int);
2501extern void replace_range_2 (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
2502 char *, EMACS_INT, EMACS_INT, int);
2503extern void syms_of_insdel (void);
2489 2504
2490/* Defined in dispnew.c */ 2505/* Defined in dispnew.c */
2491extern Lisp_Object selected_frame; 2506extern Lisp_Object selected_frame;