Mercurial > emacs
changeset 102753:b6116169967f
* 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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 28 Mar 2009 02:24:22 +0000 |
parents | 9e5b3ff07060 |
children | 8622545afe42 |
files | src/ChangeLog src/fileio.c src/insdel.c src/lisp.h |
diffstat | 4 files changed, 256 insertions(+), 263 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sat Mar 28 02:06:06 2009 +0000 +++ b/src/ChangeLog Sat Mar 28 02:24:22 2009 +0000 @@ -1,5 +1,28 @@ 2009-03-28 Stefan Monnier <monnier@iro.umontreal.ca> + * 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. + * fileio.c (Finsert_file_contents): Don't limit size to INT_MAX/4. 2009-03-27 Jan Djärv <jan.h.d@swipnet.se>
--- a/src/fileio.c Sat Mar 28 02:06:06 2009 +0000 +++ b/src/fileio.c Sat Mar 28 02:24:22 2009 +0000 @@ -3048,8 +3048,6 @@ #define READ_BUF_SIZE (64 << 10) #endif -extern void adjust_markers_for_delete P_ ((int, int, int, int)); - /* This function is called after Lisp functions to decide a coding system are called, or when they cause an error. Before they are called, the current buffer is set unibyte and it contains only a @@ -3094,8 +3092,8 @@ /* Used to pass values from insert-file-contents to read_non_regular. */ static int non_regular_fd; -static int non_regular_inserted; -static int non_regular_nbytes; +static EMACS_INT non_regular_inserted; +static EMACS_INT non_regular_nbytes; /* Read from a non-regular file. @@ -3106,7 +3104,7 @@ static Lisp_Object read_non_regular () { - int nbytes; + EMACS_INT nbytes; immediate_quit = 1; QUIT; @@ -3156,15 +3154,15 @@ { struct stat st; register int fd; - int inserted = 0; + EMACS_INT inserted = 0; int nochange = 0; - register int how_much; - register int unprocessed; + register EMACS_INT how_much; + register EMACS_INT unprocessed; int count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; Lisp_Object handler, val, insval, orig_filename, old_undo; Lisp_Object p; - int total = 0; + EMACS_INT total = 0; int not_regular = 0; unsigned char read_buf[READ_BUF_SIZE]; struct coding_system coding; @@ -3340,7 +3338,7 @@ We assume that the 1K-byte and 3K-byte for heading and tailing respectively are sufficient for this purpose. */ - int nread; + EMACS_INT nread; if (st.st_size <= (1024 * 4)) nread = emacs_read (fd, read_buf, 1024 * 4); @@ -3450,9 +3448,9 @@ /* same_at_start and same_at_end count bytes, because file access counts bytes and BEG and END count bytes. */ - int same_at_start = BEGV_BYTE; - int same_at_end = ZV_BYTE; - int overlap; + EMACS_INT same_at_start = BEGV_BYTE; + EMACS_INT same_at_end = ZV_BYTE; + EMACS_INT overlap; /* There is still a possibility we will find the need to do code conversion. If that happens, we set this variable to 1 to give up on handling REPLACE in the optimized way. */ @@ -3471,7 +3469,7 @@ match the text at the beginning of the buffer. */ while (1) { - int nread, bufpos; + EMACS_INT nread, bufpos; nread = emacs_read (fd, buffer, sizeof buffer); if (nread < 0) @@ -3522,7 +3520,7 @@ already found that decoding is necessary, don't waste time. */ while (!giveup_match_end) { - int total_read, nread, bufpos, curpos, trial; + EMACS_INT total_read, nread, bufpos, curpos, trial; /* At what file position are we now scanning? */ curpos = XINT (end) - (ZV_BYTE - same_at_end); @@ -3578,7 +3576,7 @@ if (! giveup_match_end) { - int temp; + EMACS_INT temp; /* We win! We can handle REPLACE the optimized way. */ @@ -3638,7 +3636,7 @@ EMACS_INT overlap; EMACS_INT bufpos; unsigned char *decoded; - int temp; + EMACS_INT temp; int this_count = SPECPDL_INDEX (); int multibyte = ! NILP (current_buffer->enable_multibyte_characters); Lisp_Object conversion_buffer; @@ -3663,8 +3661,9 @@ /* We read one bunch by one (READ_BUF_SIZE bytes) to allow quitting while reading a huge while. */ /* try is reserved in some compilers (Microsoft C) */ - int trytry = min (total - how_much, READ_BUF_SIZE - unprocessed); - int this; + EMACS_INT trytry = min (total - how_much, + READ_BUF_SIZE - unprocessed); + EMACS_INT this; /* Allow quitting out of the actual I/O. */ immediate_quit = 1; @@ -3867,13 +3866,13 @@ /* Here, we don't do code conversion in the loop. It is done by decode_coding_gap after all data are read into the buffer. */ { - int gap_size = GAP_SIZE; + EMACS_INT gap_size = GAP_SIZE; while (how_much < total) { /* try is reserved in some compilers (Microsoft C) */ - int trytry = min (total - how_much, READ_BUF_SIZE); - int this; + EMACS_INT trytry = min (total - how_much, READ_BUF_SIZE); + EMACS_INT this; if (not_regular) { @@ -4130,7 +4129,7 @@ { /* Don't run point motion or modification hooks when decoding. */ int count = SPECPDL_INDEX (); - int old_inserted = inserted; + EMACS_INT old_inserted = inserted; specbind (Qinhibit_point_motion_hooks, Qt); specbind (Qinhibit_modification_hooks, Qt); @@ -4156,9 +4155,9 @@ Hence we temporarily save `point' and `inserted' here and restore `point' iff format-decode did not insert or delete any text. Otherwise we leave `point' at point-min. */ - int opoint = PT; - int opoint_byte = PT_BYTE; - int oinserted = ZV - BEGV; + EMACS_INT opoint = PT; + EMACS_INT opoint_byte = PT_BYTE; + EMACS_INT oinserted = ZV - BEGV; int ochars_modiff = CHARS_MODIFF; TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); @@ -4194,9 +4193,9 @@ { /* For the rationale of this see the comment on format-decode above. */ - int opoint = PT; - int opoint_byte = PT_BYTE; - int oinserted = ZV - BEGV; + EMACS_INT opoint = PT; + EMACS_INT opoint_byte = PT_BYTE; + EMACS_INT oinserted = ZV - BEGV; int ochars_modiff = CHARS_MODIFF; TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
--- a/src/insdel.c Sat Mar 28 02:06:06 2009 +0000 +++ b/src/insdel.c Sat Mar 28 02:24:22 2009 +0000 @@ -32,15 +32,23 @@ #define NULL 0 #endif -static void insert_from_string_1 P_ ((Lisp_Object, int, int, int, int, int, int)); -static void insert_from_buffer_1 (); -static void gap_left P_ ((int, int, int)); -static void gap_right P_ ((int, int)); -static void adjust_markers_gap_motion P_ ((int, int, int)); -static void adjust_markers_for_insert P_ ((int, int, int, int, int)); -void adjust_markers_for_delete P_ ((int, int, int, int)); -static void adjust_markers_for_replace P_ ((int, int, int, int, int, int)); -static void adjust_point P_ ((int, int)); +static void insert_from_string_1 (Lisp_Object string, + EMACS_INT pos, EMACS_INT pos_byte, + EMACS_INT nchars, EMACS_INT nbytes, + int inherit, int before_markers); +static void insert_from_buffer_1 (struct buffer *buf, + EMACS_INT from, EMACS_INT nchars, + int inherit); +static void gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap); +static void gap_right (EMACS_INT charpos, EMACS_INT bytepos); +static void adjust_markers_gap_motion (EMACS_INT from, EMACS_INT to, + EMACS_INT amount); +static void adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte, + EMACS_INT to, EMACS_INT to_byte, + int before_markers); +static void adjust_markers_for_replace (EMACS_INT, EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT, EMACS_INT); +static void adjust_point (EMACS_INT nchars, EMACS_INT nbytes); Lisp_Object Fcombine_after_change_execute (); @@ -98,8 +106,7 @@ Note that this can quit! */ void -move_gap (charpos) - int charpos; +move_gap (EMACS_INT charpos) { move_gap_both (charpos, charpos_to_bytepos (charpos)); } @@ -108,8 +115,7 @@ Note that this can quit! */ void -move_gap_both (charpos, bytepos) - int charpos, bytepos; +move_gap_both (EMACS_INT charpos, EMACS_INT bytepos) { if (bytepos < GPT_BYTE) gap_left (charpos, bytepos, 0); @@ -123,13 +129,11 @@ If NEWGAP is nonzero, then don't update beg_unchanged and end_unchanged. */ static void -gap_left (charpos, bytepos, newgap) - register int charpos, bytepos; - int newgap; +gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap) { register unsigned char *to, *from; - register int i; - int new_s1; + register EMACS_INT i; + EMACS_INT new_s1; if (!newgap) BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT); @@ -200,12 +204,11 @@ and CHARPOS is the corresponding char position. */ static void -gap_right (charpos, bytepos) - register int charpos, bytepos; +gap_right (EMACS_INT charpos, EMACS_INT bytepos) { register unsigned char *to, *from; - register int i; - int new_s1; + register EMACS_INT i; + EMACS_INT new_s1; BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT); @@ -285,15 +288,14 @@ int adjust_markers_test; static void -adjust_markers_gap_motion (from, to, amount) - register int from, to, amount; +adjust_markers_gap_motion (EMACS_INT from, EMACS_INT to, EMACS_INT amount) { /* Now that a marker has a bytepos, not counting the gap, nothing needs to be done here. */ #if 0 Lisp_Object marker; register struct Lisp_Marker *m; - register int mpos; + register EMACS_INT mpos; marker = BUF_MARKERS (current_buffer); @@ -338,12 +340,12 @@ or inside of the range being deleted. */ void -adjust_markers_for_delete (from, from_byte, to, to_byte) - register int from, from_byte, to, to_byte; +adjust_markers_for_delete (EMACS_INT from, EMACS_INT from_byte, + EMACS_INT to, EMACS_INT to_byte) { Lisp_Object marker; register struct Lisp_Marker *m; - register int charpos; + register EMACS_INT charpos; for (m = BUF_MARKERS (current_buffer); m; m = m->next) { @@ -403,14 +405,13 @@ or BEFORE_MARKERS is true. */ static void -adjust_markers_for_insert (from, from_byte, to, to_byte, before_markers) - register int from, from_byte, to, to_byte; - int before_markers; +adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte, + EMACS_INT to, EMACS_INT to_byte, int before_markers) { struct Lisp_Marker *m; int adjusted = 0; - int nchars = to - from; - int nbytes = to_byte - from_byte; + EMACS_INT nchars = to - from; + EMACS_INT nbytes = to_byte - from_byte; for (m = BUF_MARKERS (current_buffer); m; m = m->next) { @@ -455,8 +456,7 @@ intervals. */ static void -adjust_point (nchars, nbytes) - int nchars, nbytes; +adjust_point (EMACS_INT nchars, EMACS_INT nbytes) { BUF_PT (current_buffer) += nchars; BUF_PT_BYTE (current_buffer) += nbytes; @@ -471,14 +471,14 @@ an insertion. */ static void -adjust_markers_for_replace (from, from_byte, old_chars, old_bytes, - new_chars, new_bytes) - int from, from_byte, old_chars, old_bytes, new_chars, new_bytes; +adjust_markers_for_replace (EMACS_INT from, EMACS_INT from_byte, + EMACS_INT old_chars, EMACS_INT old_bytes, + EMACS_INT new_chars, EMACS_INT new_bytes) { register struct Lisp_Marker *m; - int prev_to_byte = from_byte + old_bytes; - int diff_chars = new_chars - old_chars; - int diff_bytes = new_bytes - old_bytes; + EMACS_INT prev_to_byte = from_byte + old_bytes; + EMACS_INT diff_chars = new_chars - old_chars; + EMACS_INT diff_bytes = new_bytes - old_bytes; for (m = BUF_MARKERS (current_buffer); m; m = m->next) { @@ -501,13 +501,12 @@ /* Make the gap NBYTES_ADDED bytes longer. */ void -make_gap_larger (nbytes_added) - int nbytes_added; +make_gap_larger (EMACS_INT nbytes_added) { Lisp_Object tem; - int real_gap_loc; - int real_gap_loc_byte; - int old_gap_size; + EMACS_INT real_gap_loc; + EMACS_INT real_gap_loc_byte; + EMACS_INT old_gap_size; /* If we have to get more space, get enough to last a while. */ nbytes_added += 2000; @@ -557,16 +556,15 @@ /* Make the gap NBYTES_REMOVED bytes shorter. */ void -make_gap_smaller (nbytes_removed) - int nbytes_removed; +make_gap_smaller (EMACS_INT nbytes_removed) { Lisp_Object tem; - int real_gap_loc; - int real_gap_loc_byte; - int real_Z; - int real_Z_byte; - int real_beg_unchanged; - int new_gap_size; + EMACS_INT real_gap_loc; + EMACS_INT real_gap_loc_byte; + EMACS_INT real_Z; + EMACS_INT real_Z_byte; + EMACS_INT real_beg_unchanged; + EMACS_INT new_gap_size; /* Make sure the gap is at least 20 bytes. */ if (GAP_SIZE - nbytes_removed < 20) @@ -614,8 +612,7 @@ } void -make_gap (nbytes_added) - int nbytes_added; +make_gap (EMACS_INT nbytes_added) { if (nbytes_added >= 0) make_gap_larger (nbytes_added); @@ -632,13 +629,9 @@ Return the number of bytes stored at TO_ADDR. */ -int -copy_text (from_addr, to_addr, nbytes, - from_multibyte, to_multibyte) - const unsigned char *from_addr; - unsigned char *to_addr; - int nbytes; - int from_multibyte, to_multibyte; +EMACS_INT +copy_text (const unsigned char *from_addr, unsigned char *to_addr, + EMACS_INT nbytes, int from_multibyte, int to_multibyte) { if (from_multibyte == to_multibyte) { @@ -647,8 +640,8 @@ } else if (from_multibyte) { - int nchars = 0; - int bytes_left = nbytes; + EMACS_INT nchars = 0; + EMACS_INT bytes_left = nbytes; Lisp_Object tbl = Qnil; while (bytes_left > 0) @@ -691,13 +684,11 @@ to convert some single-byte text to multibyte. The single-byte text consists of NBYTES bytes at PTR. */ -int -count_size_as_multibyte (ptr, nbytes) - const unsigned char *ptr; - int nbytes; +EMACS_INT +count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes) { - int i; - int outgoing_nbytes = 0; + EMACS_INT i; + EMACS_INT outgoing_nbytes = 0; for (i = 0; i < nbytes; i++) { @@ -724,13 +715,11 @@ prepare_to_modify_buffer could relocate the text. */ void -insert (string, nbytes) - register const unsigned char *string; - register int nbytes; +insert (const unsigned char *string, EMACS_INT nbytes) { if (nbytes > 0) { - int len = chars_in_text (string, nbytes), opoint; + EMACS_INT len = chars_in_text (string, nbytes), opoint; insert_1_both (string, len, nbytes, 0, 1, 0); opoint = PT - len; signal_after_change (opoint, 0, len); @@ -741,13 +730,11 @@ /* Likewise, but inherit text properties from neighboring characters. */ void -insert_and_inherit (string, nbytes) - register const unsigned char *string; - register int nbytes; +insert_and_inherit (const unsigned char *string, EMACS_INT nbytes) { if (nbytes > 0) { - int len = chars_in_text (string, nbytes), opoint; + EMACS_INT len = chars_in_text (string, nbytes), opoint; insert_1_both (string, len, nbytes, 1, 1, 0); opoint = PT - len; signal_after_change (opoint, 0, len); @@ -758,8 +745,7 @@ /* Insert the character C before point. Do not inherit text properties. */ void -insert_char (c) - int c; +insert_char (int c) { unsigned char str[MAX_MULTIBYTE_LENGTH]; int len; @@ -778,8 +764,7 @@ /* Insert the null-terminated string S before point. */ void -insert_string (s) - const char *s; +insert_string (const char *s) { insert (s, strlen (s)); } @@ -790,13 +775,11 @@ since gc could happen and relocate it. */ void -insert_before_markers (string, nbytes) - const unsigned char *string; - register int nbytes; +insert_before_markers (const unsigned char *string, EMACS_INT nbytes) { if (nbytes > 0) { - int len = chars_in_text (string, nbytes), opoint; + EMACS_INT len = chars_in_text (string, nbytes), opoint; insert_1_both (string, len, nbytes, 0, 1, 1); opoint = PT - len; signal_after_change (opoint, 0, len); @@ -807,13 +790,12 @@ /* Likewise, but inherit text properties from neighboring characters. */ void -insert_before_markers_and_inherit (string, nbytes) - const unsigned char *string; - register int nbytes; +insert_before_markers_and_inherit (const unsigned char *string, + EMACS_INT nbytes) { if (nbytes > 0) { - int len = chars_in_text (string, nbytes), opoint; + EMACS_INT len = chars_in_text (string, nbytes), opoint; insert_1_both (string, len, nbytes, 1, 1, 1); opoint = PT - len; signal_after_change (opoint, 0, len); @@ -824,10 +806,8 @@ /* Subroutine used by the insert functions above. */ void -insert_1 (string, nbytes, inherit, prepare, before_markers) - register const unsigned char *string; - register int nbytes; - int inherit, prepare, before_markers; +insert_1 (const unsigned char *string, EMACS_INT nbytes, + int inherit, int prepare, int before_markers) { insert_1_both (string, chars_in_text (string, nbytes), nbytes, inherit, prepare, before_markers); @@ -842,10 +822,8 @@ which combine in this way. Otherwise, return 0. */ int -count_combining_before (string, length, pos, pos_byte) - const unsigned char *string; - int length; - int pos, pos_byte; +count_combining_before (const unsigned char *string, EMACS_INT length, + EMACS_INT pos, EMACS_INT pos_byte) { int len, combining_bytes; const unsigned char *p; @@ -889,14 +867,12 @@ which combine in this way. Otherwise, return 0. */ int -count_combining_after (string, length, pos, pos_byte) - const unsigned char *string; - int length; - int pos, pos_byte; +count_combining_after (const unsigned char *string, + EMACS_INT length, EMACS_INT pos, EMACS_INT pos_byte) { - int opos_byte = pos_byte; - int i; - int bytes; + EMACS_INT opos_byte = pos_byte; + EMACS_INT i; + EMACS_INT bytes; unsigned char *bufp; if (NILP (current_buffer->enable_multibyte_characters)) @@ -955,10 +931,9 @@ are the same as in insert_1. */ void -insert_1_both (string, nchars, nbytes, inherit, prepare, before_markers) - register const unsigned char *string; - register int nchars, nbytes; - int inherit, prepare, before_markers; +insert_1_both (const unsigned char *string, + EMACS_INT nchars, EMACS_INT nbytes, + int inherit, int prepare, int before_markers) { if (nchars == 0) return; @@ -1035,12 +1010,10 @@ without insert noticing. */ void -insert_from_string (string, pos, pos_byte, length, length_byte, inherit) - Lisp_Object string; - register int pos, pos_byte, length, length_byte; - int inherit; +insert_from_string (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, + EMACS_INT length, EMACS_INT length_byte, int inherit) { - int opoint = PT; + EMACS_INT opoint = PT; if (SCHARS (string) == 0) return; @@ -1055,13 +1028,12 @@ at the place where the insertion happens are adjusted to point after it. */ void -insert_from_string_before_markers (string, pos, pos_byte, - length, length_byte, inherit) - Lisp_Object string; - register int pos, pos_byte, length, length_byte; - int inherit; +insert_from_string_before_markers (Lisp_Object string, + EMACS_INT pos, EMACS_INT pos_byte, + EMACS_INT length, EMACS_INT length_byte, + int inherit) { - int opoint = PT; + EMACS_INT opoint = PT; if (SCHARS (string) == 0) return; @@ -1075,14 +1047,12 @@ /* Subroutine of the insertion functions above. */ static void -insert_from_string_1 (string, pos, pos_byte, nchars, nbytes, - inherit, before_markers) - Lisp_Object string; - register int pos, pos_byte, nchars, nbytes; - int inherit, before_markers; +insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, + EMACS_INT nchars, EMACS_INT nbytes, + int inherit, int before_markers) { struct gcpro gcpro1; - int outgoing_nbytes = nbytes; + EMACS_INT outgoing_nbytes = nbytes; INTERVAL intervals; /* Make OUTGOING_NBYTES describe the text @@ -1169,8 +1139,7 @@ starting at GPT_ADDR. */ void -insert_from_gap (nchars, nbytes) - register EMACS_INT nchars, nbytes; +insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes) { if (NILP (current_buffer->enable_multibyte_characters)) nchars = nbytes; @@ -1215,12 +1184,10 @@ and relocate BUF's text before the bcopy happens. */ void -insert_from_buffer (buf, charpos, nchars, inherit) - struct buffer *buf; - int charpos, nchars; - int inherit; +insert_from_buffer (struct buffer *buf, + EMACS_INT charpos, EMACS_INT nchars, int inherit) { - int opoint = PT; + EMACS_INT opoint = PT; insert_from_buffer_1 (buf, charpos, nchars, inherit); signal_after_change (opoint, 0, PT - opoint); @@ -1228,17 +1195,15 @@ } static void -insert_from_buffer_1 (buf, from, nchars, inherit) - struct buffer *buf; - int from, nchars; - int inherit; +insert_from_buffer_1 (struct buffer *buf, + EMACS_INT from, EMACS_INT nchars, int inherit) { register Lisp_Object temp; - int chunk, chunk_expanded; - int from_byte = buf_charpos_to_bytepos (buf, from); - int to_byte = buf_charpos_to_bytepos (buf, from + nchars); - int incoming_nbytes = to_byte - from_byte; - int outgoing_nbytes = incoming_nbytes; + EMACS_INT chunk, chunk_expanded; + EMACS_INT from_byte = buf_charpos_to_bytepos (buf, from); + EMACS_INT to_byte = buf_charpos_to_bytepos (buf, from + nchars); + EMACS_INT incoming_nbytes = to_byte - from_byte; + EMACS_INT outgoing_nbytes = incoming_nbytes; INTERVAL intervals; /* Make OUTGOING_NBYTES describe the text @@ -1248,8 +1213,8 @@ outgoing_nbytes = nchars; else if (NILP (buf->enable_multibyte_characters)) { - int outgoing_before_gap = 0; - int outgoing_after_gap = 0; + EMACS_INT outgoing_before_gap = 0; + EMACS_INT outgoing_after_gap = 0; if (from < BUF_GPT (buf)) { @@ -1371,11 +1336,10 @@ PREV_TEXT nil means the new text was just inserted. */ void -adjust_after_replace (from, from_byte, prev_text, len, len_byte) - int from, from_byte, len, len_byte; - Lisp_Object prev_text; +adjust_after_replace (EMACS_INT from, EMACS_INT from_byte, + Lisp_Object prev_text, EMACS_INT len, EMACS_INT len_byte) { - int nchars_del = 0, nbytes_del = 0; + EMACS_INT nchars_del = 0, nbytes_del = 0; #ifdef BYTE_COMBINING_DEBUG if (count_combining_before (GPT_ADDR, len_byte, from, from_byte) @@ -1438,8 +1402,9 @@ This is for use when undo is not enabled in the current buffer. */ void -adjust_after_replace_noundo (from, from_byte, nchars_del, nbytes_del, len, len_byte) - int from, from_byte, nchars_del, nbytes_del, len, len_byte; +adjust_after_replace_noundo (EMACS_INT from, EMACS_INT from_byte, + EMACS_INT nchars_del, EMACS_INT nbytes_del, + EMACS_INT len, EMACS_INT len_byte) { #ifdef BYTE_COMBINING_DEBUG if (count_combining_before (GPT_ADDR, len_byte, from, from_byte) @@ -1491,10 +1456,10 @@ - FROM) may be incorrect, the correct length is NEWLEN. */ void -adjust_after_insert (from, from_byte, to, to_byte, newlen) - int from, from_byte, to, to_byte, newlen; +adjust_after_insert (EMACS_INT from, EMACS_INT from_byte, + EMACS_INT to, EMACS_INT to_byte, EMACS_INT newlen) { - int len = to - from, len_byte = to_byte - from_byte; + EMACS_INT len = to - from, len_byte = to_byte - from_byte; if (GPT != to) move_gap_both (to, to_byte); @@ -1518,18 +1483,17 @@ But if MARKERS is 0, don't relocate markers. */ void -replace_range (from, to, new, prepare, inherit, markers) - Lisp_Object new; - int from, to, prepare, inherit, markers; +replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, + int prepare, int inherit, int markers) { - int inschars = SCHARS (new); - int insbytes = SBYTES (new); - int from_byte, to_byte; - int nbytes_del, nchars_del; + EMACS_INT inschars = SCHARS (new); + EMACS_INT insbytes = SBYTES (new); + EMACS_INT from_byte, to_byte; + EMACS_INT nbytes_del, nchars_del; register Lisp_Object temp; struct gcpro gcpro1; INTERVAL intervals; - int outgoing_insbytes = insbytes; + EMACS_INT outgoing_insbytes = insbytes; Lisp_Object deletion; CHECK_MARKERS (); @@ -1539,7 +1503,7 @@ if (prepare) { - int range_length = to - from; + EMACS_INT range_length = to - from; prepare_to_modify_buffer (from, to, &from); to = from + range_length; } @@ -1699,12 +1663,12 @@ prepare_to_modify_buffer and never call signal_after_change. */ void -replace_range_2 (from, from_byte, to, to_byte, ins, inschars, insbytes, markers) - int from, from_byte, to, to_byte; - char *ins; - int inschars, insbytes, markers; +replace_range_2 (EMACS_INT from, EMACS_INT from_byte, + EMACS_INT to, EMACS_INT to_byte, + char *ins, EMACS_INT inschars, EMACS_INT insbytes, + int markers) { - int nbytes_del, nchars_del; + EMACS_INT nbytes_del, nchars_del; Lisp_Object temp; CHECK_MARKERS (); @@ -1812,8 +1776,7 @@ If TO comes before FROM, we delete nothing. */ void -del_range (from, to) - register int from, to; +del_range (EMACS_INT from, EMACS_INT to) { del_range_1 (from, to, 1, 0); } @@ -1822,10 +1785,9 @@ RET_STRING says to return the deleted text. */ Lisp_Object -del_range_1 (from, to, prepare, ret_string) - int from, to, prepare, ret_string; +del_range_1 (EMACS_INT from, EMACS_INT to, int prepare, int ret_string) { - int from_byte, to_byte; + EMACS_INT from_byte, to_byte; Lisp_Object deletion; struct gcpro gcpro1; @@ -1840,7 +1802,7 @@ if (prepare) { - int range_length = to - from; + EMACS_INT range_length = to - from; prepare_to_modify_buffer (from, to, &from); to = min (ZV, from + range_length); } @@ -1859,10 +1821,9 @@ /* Like del_range_1 but args are byte positions, not char positions. */ void -del_range_byte (from_byte, to_byte, prepare) - int from_byte, to_byte, prepare; +del_range_byte (EMACS_INT from_byte, EMACS_INT to_byte, int prepare) { - int from, to; + EMACS_INT from, to; /* Make args be valid */ if (from_byte < BEGV_BYTE) @@ -1878,8 +1839,8 @@ if (prepare) { - int old_from = from, old_to = Z - to; - int range_length = to - from; + EMACS_INT old_from = from, old_to = Z - to; + EMACS_INT range_length = to - from; prepare_to_modify_buffer (from, to, &from); to = from + range_length; @@ -1903,8 +1864,8 @@ and bytepos. */ void -del_range_both (from, from_byte, to, to_byte, prepare) - int from, from_byte, to, to_byte, prepare; +del_range_both (EMACS_INT from, EMACS_INT from_byte, + EMACS_INT to, EMACS_INT to_byte, int prepare) { /* Make args be valid */ if (from_byte < BEGV_BYTE) @@ -1922,8 +1883,8 @@ if (prepare) { - int old_from = from, old_to = Z - to; - int range_length = to - from; + EMACS_INT old_from = from, old_to = Z - to; + EMACS_INT range_length = to - from; prepare_to_modify_buffer (from, to, &from); to = from + range_length; @@ -1949,10 +1910,10 @@ If RET_STRING is true, the deleted area is returned as a string. */ Lisp_Object -del_range_2 (from, from_byte, to, to_byte, ret_string) - int from, from_byte, to, to_byte, ret_string; +del_range_2 (EMACS_INT from, EMACS_INT from_byte, + EMACS_INT to, EMACS_INT to_byte, int ret_string) { - register int nbytes_del, nchars_del; + register EMACS_INT nbytes_del, nchars_del; Lisp_Object deletion; CHECK_MARKERS (); @@ -2036,9 +1997,8 @@ Otherwise set CHARS_MODIFF to the new value of MODIFF. */ void -modify_region (buffer, start, end, preserve_chars_modiff) - struct buffer *buffer; - int start, end, preserve_chars_modiff; +modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end, + int preserve_chars_modiff) { struct buffer *old_buffer = current_buffer; @@ -2072,9 +2032,7 @@ by holding its value temporarily in a marker. */ void -prepare_to_modify_buffer (start, end, preserve_ptr) - int start, end; - int *preserve_ptr; +prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, int *preserve_ptr) { struct buffer *base_buffer; @@ -2187,9 +2145,8 @@ by holding its value temporarily in a marker. */ void -signal_before_change (start_int, end_int, preserve_ptr) - int start_int, end_int; - int *preserve_ptr; +signal_before_change (EMACS_INT start_int, EMACS_INT end_int, + int *preserve_ptr) { Lisp_Object start, end; Lisp_Object start_marker, end_marker; @@ -2266,8 +2223,7 @@ after the change. */ void -signal_after_change (charpos, lendel, lenins) - int charpos, lendel, lenins; +signal_after_change (EMACS_INT charpos, EMACS_INT lendel, EMACS_INT lenins) { int count = SPECPDL_INDEX (); if (inhibit_modification_hooks) @@ -2352,8 +2308,8 @@ () { int count = SPECPDL_INDEX (); - int beg, end, change; - int begpos, endpos; + EMACS_INT beg, end, change; + EMACS_INT begpos, endpos; Lisp_Object tail; if (NILP (combine_after_change_list)) @@ -2387,7 +2343,7 @@ tail = XCDR (tail)) { Lisp_Object elt; - int thisbeg, thisend, thischange; + EMACS_INT thisbeg, thisend, thischange; /* Extract the info from the next element. */ elt = XCAR (tail);
--- a/src/lisp.h Sat Mar 28 02:06:06 2009 +0000 +++ b/src/lisp.h Sat Mar 28 02:24:22 2009 +0000 @@ -2452,40 +2452,55 @@ /* Defined in insdel.c */ extern Lisp_Object Qinhibit_modification_hooks; -extern void move_gap P_ ((int)); -extern void move_gap_both P_ ((int, int)); -extern void make_gap P_ ((int)); -extern int copy_text P_ ((const unsigned char *, unsigned char *, int, int, int)); -extern int count_size_as_multibyte P_ ((const unsigned char *, int)); -extern int count_combining_before P_ ((const unsigned char *, int, int, int)); -extern int count_combining_after P_ ((const unsigned char *, int, int, int)); -extern void insert P_ ((const unsigned char *, int)); -extern void insert_and_inherit P_ ((const unsigned char *, int)); -extern void insert_1 P_ ((const unsigned char *, int, int, int, int)); -extern void insert_1_both P_ ((const unsigned char *, int, int, int, int, int)); -extern void insert_from_gap P_ ((EMACS_INT, EMACS_INT)); -extern void insert_from_string P_ ((Lisp_Object, int, int, int, int, int)); -extern void insert_from_buffer P_ ((struct buffer *, int, int, int)); -extern void insert_char P_ ((int)); -extern void insert_string P_ ((const char *)); -extern void insert_before_markers P_ ((const unsigned char *, int)); -extern void insert_before_markers_and_inherit P_ ((const unsigned char *, int)); -extern void insert_from_string_before_markers P_ ((Lisp_Object, int, int, int, int, int)); -extern void del_range P_ ((int, int)); -extern Lisp_Object del_range_1 P_ ((int, int, int, int)); -extern void del_range_byte P_ ((int, int, int)); -extern void del_range_both P_ ((int, int, int, int, int)); -extern Lisp_Object del_range_2 P_ ((int, int, int, int, int)); -extern void modify_region P_ ((struct buffer *, int, int, int)); -extern void prepare_to_modify_buffer P_ ((int, int, int *)); -extern void signal_before_change P_ ((int, int, int *)); -extern void signal_after_change P_ ((int, int, int)); -extern void adjust_after_replace P_ ((int, int, Lisp_Object, int, int)); -extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int)); -extern void adjust_after_insert P_ ((int, int, int, int, int)); -extern void replace_range P_ ((int, int, Lisp_Object, int, int, int)); -extern void replace_range_2 P_ ((int, int, int, int, char *, int, int, int)); -extern void syms_of_insdel P_ ((void)); +extern void move_gap (EMACS_INT); +extern void move_gap_both (EMACS_INT, EMACS_INT); +extern void make_gap (EMACS_INT); +extern int copy_text (const unsigned char *, unsigned char *, + EMACS_INT, int, int); +extern int count_size_as_multibyte (const unsigned char *, EMACS_INT); +extern int count_combining_before (const unsigned char *, + EMACS_INT, EMACS_INT, EMACS_INT); +extern int count_combining_after (const unsigned char *, + EMACS_INT, EMACS_INT, EMACS_INT); +extern void insert (const unsigned char *, EMACS_INT); +extern void insert_and_inherit (const unsigned char *, EMACS_INT); +extern void insert_1 (const unsigned char *, EMACS_INT, int, int, int); +extern void insert_1_both (const unsigned char *, EMACS_INT, EMACS_INT, + int, int, int); +extern void insert_from_gap (EMACS_INT, EMACS_INT); +extern void insert_from_string (Lisp_Object, EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT, int); +extern void insert_from_buffer (struct buffer *, EMACS_INT, EMACS_INT, int); +extern void insert_char (int); +extern void insert_string (const char *); +extern void insert_before_markers (const unsigned char *, EMACS_INT); +extern void insert_before_markers_and_inherit (const unsigned char *, + EMACS_INT); +extern void insert_from_string_before_markers (Lisp_Object, EMACS_INT, + EMACS_INT, EMACS_INT, + EMACS_INT, int); +extern void del_range (EMACS_INT, EMACS_INT); +extern Lisp_Object del_range_1 (EMACS_INT, EMACS_INT, int, int); +extern void del_range_byte (EMACS_INT, EMACS_INT, int); +extern void del_range_both (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, int); +extern Lisp_Object del_range_2 (EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT, int); +extern void modify_region (struct buffer *, EMACS_INT, EMACS_INT, int); +extern void prepare_to_modify_buffer (EMACS_INT, EMACS_INT, int *); +extern void signal_before_change (EMACS_INT, EMACS_INT, int *); +extern void signal_after_change (EMACS_INT, EMACS_INT, EMACS_INT); +extern void adjust_after_replace (EMACS_INT, EMACS_INT, Lisp_Object, + EMACS_INT, EMACS_INT); +extern void adjust_after_replace_noundo (EMACS_INT, EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT, EMACS_INT); +extern void adjust_after_insert (EMACS_INT, EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT); +extern void adjust_markers_for_delete (EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT); +extern void replace_range (EMACS_INT, EMACS_INT, Lisp_Object, int, int, int); +extern void replace_range_2 (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, + char *, EMACS_INT, EMACS_INT, int); +extern void syms_of_insdel (void); /* Defined in dispnew.c */ extern Lisp_Object selected_frame;