24 |
#include "lisp.h" |
#include "lisp.h" |
25 |
#include "intervals.h" |
#include "intervals.h" |
26 |
#include "buffer.h" |
#include "buffer.h" |
27 |
#include "charset.h" |
#include "character.h" |
28 |
#include "window.h" |
#include "window.h" |
29 |
#include "blockinput.h" |
#include "blockinput.h" |
30 |
#include "region-cache.h" |
#include "region-cache.h" |
655 |
int bytes_left = nbytes; |
int bytes_left = nbytes; |
656 |
Lisp_Object tbl = Qnil; |
Lisp_Object tbl = Qnil; |
657 |
|
|
|
/* We set the variable tbl to the reverse table of |
|
|
Vnonascii_translation_table in advance. */ |
|
|
if (CHAR_TABLE_P (Vnonascii_translation_table)) |
|
|
{ |
|
|
tbl = Fchar_table_extra_slot (Vnonascii_translation_table, |
|
|
make_number (0)); |
|
|
if (!CHAR_TABLE_P (tbl)) |
|
|
tbl = Qnil; |
|
|
} |
|
|
|
|
|
/* Convert multibyte to single byte. */ |
|
658 |
while (bytes_left > 0) |
while (bytes_left > 0) |
659 |
{ |
{ |
660 |
int thislen, c; |
int thislen, c; |
661 |
c = STRING_CHAR_AND_LENGTH (from_addr, bytes_left, thislen); |
c = STRING_CHAR_AND_LENGTH (from_addr, bytes_left, thislen); |
662 |
if (!SINGLE_BYTE_CHAR_P (c)) |
if (!ASCII_CHAR_P (c)) |
663 |
c = multibyte_char_to_unibyte (c, tbl); |
c = multibyte_char_to_unibyte (c, tbl); |
664 |
*to_addr++ = c; |
*to_addr++ = c; |
665 |
from_addr += thislen; |
from_addr += thislen; |
1153 |
current_buffer, inherit); |
current_buffer, inherit); |
1154 |
|
|
1155 |
adjust_point (nchars, outgoing_nbytes); |
adjust_point (nchars, outgoing_nbytes); |
1156 |
|
|
1157 |
|
CHECK_MARKERS (); |
1158 |
|
} |
1159 |
|
|
1160 |
|
/* Insert a sequence of NCHARS chars which occupy NBYTES bytes |
1161 |
|
starting at GPT_ADDR. */ |
1162 |
|
|
1163 |
|
void |
1164 |
|
insert_from_gap (nchars, nbytes) |
1165 |
|
register int nchars, nbytes; |
1166 |
|
{ |
1167 |
|
if (NILP (current_buffer->enable_multibyte_characters)) |
1168 |
|
nchars = nbytes; |
1169 |
|
|
1170 |
|
record_insert (GPT, nchars); |
1171 |
|
MODIFF++; |
1172 |
|
|
1173 |
|
GAP_SIZE -= nbytes; |
1174 |
|
GPT += nchars; |
1175 |
|
ZV += nchars; |
1176 |
|
Z += nchars; |
1177 |
|
GPT_BYTE += nbytes; |
1178 |
|
ZV_BYTE += nbytes; |
1179 |
|
Z_BYTE += nbytes; |
1180 |
|
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ |
1181 |
|
|
1182 |
|
if (GPT_BYTE < GPT) |
1183 |
|
abort (); |
1184 |
|
|
1185 |
|
adjust_overlays_for_insert (GPT, nchars); |
1186 |
|
adjust_markers_for_insert (GPT, GPT_BYTE, |
1187 |
|
GPT + nchars, GPT_BYTE + nbytes, |
1188 |
|
0); |
1189 |
|
|
1190 |
|
if (BUF_INTERVALS (current_buffer) != 0) |
1191 |
|
offset_intervals (current_buffer, GPT, nchars); |
1192 |
|
|
1193 |
|
if (GPT - nchars < PT) |
1194 |
|
adjust_point (nchars, nbytes); |
1195 |
|
|
1196 |
|
CHECK_MARKERS (); |
1197 |
} |
} |
1198 |
|
|
1199 |
/* Insert text from BUF, NCHARS characters starting at CHARPOS, into the |
/* Insert text from BUF, NCHARS characters starting at CHARPOS, into the |