Mercurial > hg > xemacs-beta
comparison src/insdel.c @ 867:804517e16990
[xemacs-hg @ 2002-06-05 09:54:39 by ben]
Textual renaming: text/char names
abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization.
[a] distinguish between "charptr" when it refers to operations on
the pointer itself and when it refers to operations on text; and
[b] use consistent naming for everything referring to internal
format, i.e.
Itext == text in internal format
Ibyte == a byte in such text
Ichar == a char as represented in internal character format
thus e.g.
set_charptr_emchar -> set_itext_ichar
The pre and post tags on either side of this change are:
pre-internal-format-textual-renaming
post-internal-format-textual-renaming
See the Internals Manual for details of exactly how this was done,
how to handle the change in your workspace, etc.
author | ben |
---|---|
date | Wed, 05 Jun 2002 09:58:45 +0000 |
parents | 2b6fa2618f76 |
children | 1b0339b048ce |
comparison
equal
deleted
inserted
replaced
866:613552a02607 | 867:804517e16990 |
---|---|
257 /* Move the gap to POS, which is less than the current GPT. */ | 257 /* Move the gap to POS, which is less than the current GPT. */ |
258 | 258 |
259 static void | 259 static void |
260 gap_left (struct buffer *buf, Bytebpos pos) | 260 gap_left (struct buffer *buf, Bytebpos pos) |
261 { | 261 { |
262 Intbyte *to, *from; | 262 Ibyte *to, *from; |
263 Bytecount i; | 263 Bytecount i; |
264 Bytebpos new_s1; | 264 Bytebpos new_s1; |
265 struct buffer *mbuf; | 265 struct buffer *mbuf; |
266 Lisp_Object bufcons; | 266 Lisp_Object bufcons; |
267 | 267 |
328 } | 328 } |
329 | 329 |
330 static void | 330 static void |
331 gap_right (struct buffer *buf, Bytebpos pos) | 331 gap_right (struct buffer *buf, Bytebpos pos) |
332 { | 332 { |
333 Intbyte *to, *from; | 333 Ibyte *to, *from; |
334 Bytecount i; | 334 Bytecount i; |
335 Bytebpos new_s1; | 335 Bytebpos new_s1; |
336 struct buffer *mbuf; | 336 struct buffer *mbuf; |
337 Lisp_Object bufcons; | 337 Lisp_Object bufcons; |
338 | 338 |
467 /* Make the gap INCREMENT bytes longer. */ | 467 /* Make the gap INCREMENT bytes longer. */ |
468 | 468 |
469 static void | 469 static void |
470 make_gap (struct buffer *buf, Bytecount increment) | 470 make_gap (struct buffer *buf, Bytecount increment) |
471 { | 471 { |
472 Intbyte *result; | 472 Ibyte *result; |
473 Lisp_Object tem; | 473 Lisp_Object tem; |
474 Bytebpos real_gap_loc; | 474 Bytebpos real_gap_loc; |
475 Bytecount old_gap_size; | 475 Bytecount old_gap_size; |
476 | 476 |
477 /* If we have to get more space, get enough to last a while. We use | 477 /* If we have to get more space, get enough to last a while. We use |
1003 /************************************************************************/ | 1003 /************************************************************************/ |
1004 /* Insertion of strings */ | 1004 /* Insertion of strings */ |
1005 /************************************************************************/ | 1005 /************************************************************************/ |
1006 | 1006 |
1007 void | 1007 void |
1008 fixup_internal_substring (const Intbyte *nonreloc, Lisp_Object reloc, | 1008 fixup_internal_substring (const Ibyte *nonreloc, Lisp_Object reloc, |
1009 Bytecount offset, Bytecount *len) | 1009 Bytecount offset, Bytecount *len) |
1010 { | 1010 { |
1011 assert ((nonreloc && NILP (reloc)) || (!nonreloc && STRINGP (reloc))); | 1011 assert ((nonreloc && NILP (reloc)) || (!nonreloc && STRINGP (reloc))); |
1012 | 1012 |
1013 if (*len < 0) | 1013 if (*len < 0) |
1045 before modifying a buffer. Similar checks were already done | 1045 before modifying a buffer. Similar checks were already done |
1046 in the higher-level Lisp functions calling insert-file-contents. */ | 1046 in the higher-level Lisp functions calling insert-file-contents. */ |
1047 | 1047 |
1048 Charcount | 1048 Charcount |
1049 buffer_insert_string_1 (struct buffer *buf, Charbpos pos, | 1049 buffer_insert_string_1 (struct buffer *buf, Charbpos pos, |
1050 const Intbyte *nonreloc, Lisp_Object reloc, | 1050 const Ibyte *nonreloc, Lisp_Object reloc, |
1051 Bytecount offset, Bytecount length, | 1051 Bytecount offset, Bytecount length, |
1052 int flags) | 1052 int flags) |
1053 { | 1053 { |
1054 /* This function can GC */ | 1054 /* This function can GC */ |
1055 struct gcpro gcpro1; | 1055 struct gcpro gcpro1; |
1179 #ifdef MULE | 1179 #ifdef MULE |
1180 buffer_mule_signal_inserted_region (buf, pos, length_in_buffer, cclen); | 1180 buffer_mule_signal_inserted_region (buf, pos, length_in_buffer, cclen); |
1181 /* Update our count of ASCII, 8-bit and 16-bit chars and the | 1181 /* Update our count of ASCII, 8-bit and 16-bit chars and the |
1182 entirely-one-byte flag */ | 1182 entirely-one-byte flag */ |
1183 { | 1183 { |
1184 const Intbyte *ptr = nonreloc + offset; | 1184 const Ibyte *ptr = nonreloc + offset; |
1185 const Intbyte *ptrend = ptr + length; | 1185 const Ibyte *ptrend = ptr + length; |
1186 | 1186 |
1187 while (ptr < ptrend) | 1187 while (ptr < ptrend) |
1188 { | 1188 { |
1189 Emchar ch = charptr_emchar (ptr); | 1189 Ichar ch = itext_ichar (ptr); |
1190 if (emchar_ascii_p (ch)) | 1190 if (ichar_ascii_p (ch)) |
1191 buf->text->num_ascii_chars++; | 1191 buf->text->num_ascii_chars++; |
1192 if (emchar_8_bit_fixed_p (ch, wrap_buffer (buf))) | 1192 if (ichar_8_bit_fixed_p (ch, wrap_buffer (buf))) |
1193 buf->text->num_8_bit_fixed_chars++; | 1193 buf->text->num_8_bit_fixed_chars++; |
1194 if (emchar_16_bit_fixed_p (ch, wrap_buffer (buf))) | 1194 if (ichar_16_bit_fixed_p (ch, wrap_buffer (buf))) |
1195 buf->text->num_16_bit_fixed_chars++; | 1195 buf->text->num_16_bit_fixed_chars++; |
1196 INC_CHARPTR (ptr); | 1196 INC_IBYTEPTR (ptr); |
1197 } | 1197 } |
1198 | 1198 |
1199 buf->text->entirely_one_byte_p = | 1199 buf->text->entirely_one_byte_p = |
1200 (BUF_FORMAT (buf) == FORMAT_8_BIT_FIXED || | 1200 (BUF_FORMAT (buf) == FORMAT_8_BIT_FIXED || |
1201 (BUF_FORMAT (buf) == FORMAT_DEFAULT && BUF_Z (buf) == BYTE_BUF_Z (buf))); | 1201 (BUF_FORMAT (buf) == FORMAT_DEFAULT && BUF_Z (buf) == BYTE_BUF_Z (buf))); |
1266 to take place. (If POS is -1, text is inserted at point and point | 1266 to take place. (If POS is -1, text is inserted at point and point |
1267 moves forward past the text.) FLAGS is as above. */ | 1267 moves forward past the text.) FLAGS is as above. */ |
1268 | 1268 |
1269 Charcount | 1269 Charcount |
1270 buffer_insert_raw_string_1 (struct buffer *buf, Charbpos pos, | 1270 buffer_insert_raw_string_1 (struct buffer *buf, Charbpos pos, |
1271 const Intbyte *nonreloc, Bytecount length, | 1271 const Ibyte *nonreloc, Bytecount length, |
1272 int flags) | 1272 int flags) |
1273 { | 1273 { |
1274 /* This function can GC */ | 1274 /* This function can GC */ |
1275 return buffer_insert_string_1 (buf, pos, nonreloc, Qnil, 0, length, | 1275 return buffer_insert_string_1 (buf, pos, nonreloc, Qnil, 0, length, |
1276 flags); | 1276 flags); |
1292 buffer_insert_c_string_1 (struct buffer *buf, Charbpos pos, const char *s, | 1292 buffer_insert_c_string_1 (struct buffer *buf, Charbpos pos, const char *s, |
1293 int flags) | 1293 int flags) |
1294 { | 1294 { |
1295 /* This function can GC */ | 1295 /* This function can GC */ |
1296 const char *translated = GETTEXT (s); | 1296 const char *translated = GETTEXT (s); |
1297 return buffer_insert_string_1 (buf, pos, (const Intbyte *) translated, Qnil, | 1297 return buffer_insert_string_1 (buf, pos, (const Ibyte *) translated, Qnil, |
1298 0, strlen (translated), flags); | 1298 0, strlen (translated), flags); |
1299 } | 1299 } |
1300 | 1300 |
1301 Charcount | 1301 Charcount |
1302 buffer_insert_emacs_char_1 (struct buffer *buf, Charbpos pos, Emchar ch, | 1302 buffer_insert_emacs_char_1 (struct buffer *buf, Charbpos pos, Ichar ch, |
1303 int flags) | 1303 int flags) |
1304 { | 1304 { |
1305 /* This function can GC */ | 1305 /* This function can GC */ |
1306 Intbyte str[MAX_EMCHAR_LEN]; | 1306 Ibyte str[MAX_ICHAR_LEN]; |
1307 Bytecount len = set_charptr_emchar (str, ch); | 1307 Bytecount len = set_itext_ichar (str, ch); |
1308 return buffer_insert_string_1 (buf, pos, str, Qnil, 0, len, flags); | 1308 return buffer_insert_string_1 (buf, pos, str, Qnil, 0, len, flags); |
1309 } | 1309 } |
1310 | 1310 |
1311 Charcount | 1311 Charcount |
1312 buffer_insert_c_char_1 (struct buffer *buf, Charbpos pos, char c, | 1312 buffer_insert_c_char_1 (struct buffer *buf, Charbpos pos, char c, |
1313 int flags) | 1313 int flags) |
1314 { | 1314 { |
1315 /* This function can GC */ | 1315 /* This function can GC */ |
1316 return buffer_insert_emacs_char_1 (buf, pos, (Emchar) (unsigned char) c, | 1316 return buffer_insert_emacs_char_1 (buf, pos, (Ichar) (unsigned char) c, |
1317 flags); | 1317 flags); |
1318 } | 1318 } |
1319 | 1319 |
1320 Charcount | 1320 Charcount |
1321 buffer_insert_from_buffer_1 (struct buffer *buf, Charbpos pos, | 1321 buffer_insert_from_buffer_1 (struct buffer *buf, Charbpos pos, |
1435 { | 1435 { |
1436 Bytebpos i; | 1436 Bytebpos i; |
1437 | 1437 |
1438 for (i = byte_from; i < byte_to; i = next_bytebpos (buf, i)) | 1438 for (i = byte_from; i < byte_to; i = next_bytebpos (buf, i)) |
1439 { | 1439 { |
1440 Emchar ch = BYTE_BUF_FETCH_CHAR (buf, i); | 1440 Ichar ch = BYTE_BUF_FETCH_CHAR (buf, i); |
1441 if (emchar_ascii_p (ch)) | 1441 if (ichar_ascii_p (ch)) |
1442 buf->text->num_ascii_chars--; | 1442 buf->text->num_ascii_chars--; |
1443 if (emchar_8_bit_fixed_p (ch, wrap_buffer (buf))) | 1443 if (ichar_8_bit_fixed_p (ch, wrap_buffer (buf))) |
1444 buf->text->num_8_bit_fixed_chars--; | 1444 buf->text->num_8_bit_fixed_chars--; |
1445 if (emchar_16_bit_fixed_p (ch, wrap_buffer (buf))) | 1445 if (ichar_16_bit_fixed_p (ch, wrap_buffer (buf))) |
1446 buf->text->num_16_bit_fixed_chars--; | 1446 buf->text->num_16_bit_fixed_chars--; |
1447 } | 1447 } |
1448 } | 1448 } |
1449 #endif /* MULE */ | 1449 #endif /* MULE */ |
1450 | 1450 |
1546 /************************************************************************/ | 1546 /************************************************************************/ |
1547 | 1547 |
1548 /* Replace the character at POS in buffer B with CH. */ | 1548 /* Replace the character at POS in buffer B with CH. */ |
1549 | 1549 |
1550 void | 1550 void |
1551 buffer_replace_char (struct buffer *buf, Charbpos pos, Emchar ch, | 1551 buffer_replace_char (struct buffer *buf, Charbpos pos, Ichar ch, |
1552 int not_real_change, int force_lock_check) | 1552 int not_real_change, int force_lock_check) |
1553 { | 1553 { |
1554 /* This function can GC */ | 1554 /* This function can GC */ |
1555 Intbyte newstr[MAX_EMCHAR_LEN]; | 1555 Ibyte newstr[MAX_ICHAR_LEN]; |
1556 Bytecount newlen; | 1556 Bytecount newlen; |
1557 Emchar oldch; | 1557 Ichar oldch; |
1558 | 1558 |
1559 /* Defensive steps just in case a buffer gets deleted and a calling | 1559 /* Defensive steps just in case a buffer gets deleted and a calling |
1560 function doesn't notice it. */ | 1560 function doesn't notice it. */ |
1561 if (!BUFFER_LIVE_P (buf)) | 1561 if (!BUFFER_LIVE_P (buf)) |
1562 return; | 1562 return; |
1563 | 1563 |
1564 newlen = set_charptr_emchar_fmt (newstr, ch, BUF_FORMAT (buf), | 1564 newlen = set_itext_ichar_fmt (newstr, ch, BUF_FORMAT (buf), |
1565 wrap_buffer (buf)); | 1565 wrap_buffer (buf)); |
1566 oldch = BUF_FETCH_CHAR (buf, pos); | 1566 oldch = BUF_FETCH_CHAR (buf, pos); |
1567 if (emchar_fits_in_format (ch, BUF_FORMAT (buf), wrap_buffer (buf)) && | 1567 if (ichar_fits_in_format (ch, BUF_FORMAT (buf), wrap_buffer (buf)) && |
1568 newlen == emchar_len_fmt (oldch, BUF_FORMAT (buf))) | 1568 newlen == ichar_len_fmt (oldch, BUF_FORMAT (buf))) |
1569 { | 1569 { |
1570 struct buffer *mbuf; | 1570 struct buffer *mbuf; |
1571 Lisp_Object bufcons; | 1571 Lisp_Object bufcons; |
1572 | 1572 |
1573 /* then we can just replace the text. */ | 1573 /* then we can just replace the text. */ |
1604 } | 1604 } |
1605 BUF_MODIFF (buf)++; | 1605 BUF_MODIFF (buf)++; |
1606 } | 1606 } |
1607 | 1607 |
1608 #ifdef MULE | 1608 #ifdef MULE |
1609 if (emchar_ascii_p (oldch)) | 1609 if (ichar_ascii_p (oldch)) |
1610 buf->text->num_ascii_chars--; | 1610 buf->text->num_ascii_chars--; |
1611 if (emchar_8_bit_fixed_p (oldch, wrap_buffer (buf))) | 1611 if (ichar_8_bit_fixed_p (oldch, wrap_buffer (buf))) |
1612 buf->text->num_8_bit_fixed_chars--; | 1612 buf->text->num_8_bit_fixed_chars--; |
1613 if (emchar_16_bit_fixed_p (oldch, wrap_buffer (buf))) | 1613 if (ichar_16_bit_fixed_p (oldch, wrap_buffer (buf))) |
1614 buf->text->num_16_bit_fixed_chars--; | 1614 buf->text->num_16_bit_fixed_chars--; |
1615 if (emchar_ascii_p (ch)) | 1615 if (ichar_ascii_p (ch)) |
1616 buf->text->num_ascii_chars++; | 1616 buf->text->num_ascii_chars++; |
1617 if (emchar_8_bit_fixed_p (ch, wrap_buffer (buf))) | 1617 if (ichar_8_bit_fixed_p (ch, wrap_buffer (buf))) |
1618 buf->text->num_8_bit_fixed_chars++; | 1618 buf->text->num_8_bit_fixed_chars++; |
1619 if (emchar_16_bit_fixed_p (ch, wrap_buffer (buf))) | 1619 if (ichar_16_bit_fixed_p (ch, wrap_buffer (buf))) |
1620 buf->text->num_16_bit_fixed_chars++; | 1620 buf->text->num_16_bit_fixed_chars++; |
1621 #endif /* MULE */ | 1621 #endif /* MULE */ |
1622 | 1622 |
1623 memcpy (BUF_BYTE_ADDRESS (buf, pos), newstr, newlen); | 1623 memcpy (BUF_BYTE_ADDRESS (buf, pos), newstr, newlen); |
1624 | 1624 |