Mercurial > hg > xemacs-beta
comparison src/editfns.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 | 79c6ff3eef26 |
comparison
equal
deleted
inserted
replaced
866:613552a02607 | 867:804517e16990 |
---|---|
80 | 80 |
81 void | 81 void |
82 init_editfns (void) | 82 init_editfns (void) |
83 { | 83 { |
84 /* Only used in removed code below. */ | 84 /* Only used in removed code below. */ |
85 Intbyte *p; | 85 Ibyte *p; |
86 | 86 |
87 environbuf = 0; | 87 environbuf = 0; |
88 | 88 |
89 /* Set up system_name even when dumping. */ | 89 /* Set up system_name even when dumping. */ |
90 init_system_name (); | 90 init_system_name (); |
106 Convert CHARACTER to a one-character string containing that character. | 106 Convert CHARACTER to a one-character string containing that character. |
107 */ | 107 */ |
108 (character)) | 108 (character)) |
109 { | 109 { |
110 Bytecount len; | 110 Bytecount len; |
111 Intbyte str[MAX_EMCHAR_LEN]; | 111 Ibyte str[MAX_ICHAR_LEN]; |
112 | 112 |
113 if (EVENTP (character)) | 113 if (EVENTP (character)) |
114 { | 114 { |
115 Lisp_Object ch2 = Fevent_to_character (character, Qt, Qnil, Qnil); | 115 Lisp_Object ch2 = Fevent_to_character (character, Qt, Qnil, Qnil); |
116 if (NILP (ch2)) | 116 if (NILP (ch2)) |
119 character = ch2; | 119 character = ch2; |
120 } | 120 } |
121 | 121 |
122 CHECK_CHAR_COERCE_INT (character); | 122 CHECK_CHAR_COERCE_INT (character); |
123 | 123 |
124 len = set_charptr_emchar (str, XCHAR (character)); | 124 len = set_itext_ichar (str, XCHAR (character)); |
125 return make_string (str, len); | 125 return make_string (str, len); |
126 } | 126 } |
127 | 127 |
128 DEFUN ("string-to-char", Fstring_to_char, 1, 1, 0, /* | 128 DEFUN ("string-to-char", Fstring_to_char, 1, 1, 0, /* |
129 Convert arg STRING to a character, the first character of that string. | 129 Convert arg STRING to a character, the first character of that string. |
132 (string)) | 132 (string)) |
133 { | 133 { |
134 CHECK_STRING (string); | 134 CHECK_STRING (string); |
135 | 135 |
136 if (XSTRING_LENGTH (string) != 0) | 136 if (XSTRING_LENGTH (string) != 0) |
137 return make_char (string_emchar (string, 0)); | 137 return make_char (string_ichar (string, 0)); |
138 else | 138 else |
139 /* This used to return Qzero. That is broken, broken, broken. */ | 139 /* This used to return Qzero. That is broken, broken, broken. */ |
140 /* It might be kinder to signal an error directly. -slb */ | 140 /* It might be kinder to signal an error directly. -slb */ |
141 return Qnil; | 141 return Qnil; |
142 } | 142 } |
590 defaulting to c:\\ if they are both undefined. | 590 defaulting to c:\\ if they are both undefined. |
591 On Unix it is obtained from TMPDIR, with /tmp as the default. | 591 On Unix it is obtained from TMPDIR, with /tmp as the default. |
592 */ | 592 */ |
593 ()) | 593 ()) |
594 { | 594 { |
595 Intbyte *tmpdir; | 595 Ibyte *tmpdir; |
596 #if defined(WIN32_NATIVE) | 596 #if defined(WIN32_NATIVE) |
597 tmpdir = egetenv ("TEMP"); | 597 tmpdir = egetenv ("TEMP"); |
598 if (!tmpdir) | 598 if (!tmpdir) |
599 tmpdir = egetenv ("TMP"); | 599 tmpdir = egetenv ("TMP"); |
600 if (!tmpdir) | 600 if (!tmpdir) |
601 tmpdir = (Intbyte *) "c:\\"; | 601 tmpdir = (Ibyte *) "c:\\"; |
602 #else /* WIN32_NATIVE */ | 602 #else /* WIN32_NATIVE */ |
603 tmpdir = egetenv ("TMPDIR"); | 603 tmpdir = egetenv ("TMPDIR"); |
604 if (!tmpdir) | 604 if (!tmpdir) |
605 { | 605 { |
606 struct stat st; | 606 struct stat st; |
607 int myuid = getuid (); | 607 int myuid = getuid (); |
608 Intbyte *login_name = user_login_name (NULL); | 608 Ibyte *login_name = user_login_name (NULL); |
609 DECLARE_EISTRING (eipath); | 609 DECLARE_EISTRING (eipath); |
610 Intbyte *path; | 610 Ibyte *path; |
611 | 611 |
612 eicpy_c (eipath, "/tmp/"); | 612 eicpy_c (eipath, "/tmp/"); |
613 eicat_rawz (eipath, login_name); | 613 eicat_rawz (eipath, login_name); |
614 path = eidata (eipath); | 614 path = eidata (eipath); |
615 if (qxe_lstat (path, &st) < 0 && errno == ENOENT) | 615 if (qxe_lstat (path, &st) < 0 && errno == ENOENT) |
640 } | 640 } |
641 } | 641 } |
642 if (qxe_stat (path, &st) == 0 && S_ISDIR (st.st_mode)) | 642 if (qxe_stat (path, &st) == 0 && S_ISDIR (st.st_mode)) |
643 tmpdir = path; | 643 tmpdir = path; |
644 else | 644 else |
645 tmpdir = (Intbyte *) "/tmp"; | 645 tmpdir = (Ibyte *) "/tmp"; |
646 } | 646 } |
647 } | 647 } |
648 #endif | 648 #endif |
649 | 649 |
650 return build_intstring (tmpdir); | 650 return build_intstring (tmpdir); |
658 If the optional argument UID is present, then environment variables are | 658 If the optional argument UID is present, then environment variables are |
659 ignored and this function returns the login name for that UID, or nil. | 659 ignored and this function returns the login name for that UID, or nil. |
660 */ | 660 */ |
661 (uid)) | 661 (uid)) |
662 { | 662 { |
663 Intbyte *returned_name; | 663 Ibyte *returned_name; |
664 uid_t local_uid; | 664 uid_t local_uid; |
665 | 665 |
666 if (!NILP (uid)) | 666 if (!NILP (uid)) |
667 { | 667 { |
668 CHECK_INT (uid); | 668 CHECK_INT (uid); |
687 corresponds to a nil argument to Fuser_login_name. | 687 corresponds to a nil argument to Fuser_login_name. |
688 | 688 |
689 WARNING: The string returned comes from the data of a Lisp string and | 689 WARNING: The string returned comes from the data of a Lisp string and |
690 therefore will become garbage after the next GC. | 690 therefore will become garbage after the next GC. |
691 */ | 691 */ |
692 Intbyte * | 692 Ibyte * |
693 user_login_name (uid_t *uid) | 693 user_login_name (uid_t *uid) |
694 { | 694 { |
695 /* uid == NULL to return name of this user */ | 695 /* uid == NULL to return name of this user */ |
696 if (uid != NULL) | 696 if (uid != NULL) |
697 { | 697 { |
698 struct passwd *pw = qxe_getpwuid (*uid); | 698 struct passwd *pw = qxe_getpwuid (*uid); |
699 return pw ? (Intbyte *) pw->pw_name : NULL; | 699 return pw ? (Ibyte *) pw->pw_name : NULL; |
700 } | 700 } |
701 else | 701 else |
702 { | 702 { |
703 /* #### - when euid != uid, then LOGNAME and USER are leftovers from the | 703 /* #### - when euid != uid, then LOGNAME and USER are leftovers from the |
704 old environment (I site observed behavior on sunos and linux), so the | 704 old environment (I site observed behavior on sunos and linux), so the |
705 environment variables should be disregarded in that case. --Stig */ | 705 environment variables should be disregarded in that case. --Stig */ |
706 Intbyte *user_name = egetenv ("LOGNAME"); | 706 Ibyte *user_name = egetenv ("LOGNAME"); |
707 if (!user_name) | 707 if (!user_name) |
708 user_name = egetenv ( | 708 user_name = egetenv ( |
709 #ifdef WIN32_NATIVE | 709 #ifdef WIN32_NATIVE |
710 "USERNAME" /* it's USERNAME on NT */ | 710 "USERNAME" /* it's USERNAME on NT */ |
711 #else | 711 #else |
721 /* Since the Cygwin environment may not have an /etc/passwd, | 721 /* Since the Cygwin environment may not have an /etc/passwd, |
722 return "unknown" instead of the null if the username | 722 return "unknown" instead of the null if the username |
723 cannot be determined. | 723 cannot be determined. |
724 */ | 724 */ |
725 /* !!#### fix up in my mule ws */ | 725 /* !!#### fix up in my mule ws */ |
726 return (Intbyte *) (pw ? pw->pw_name : "unknown"); | 726 return (Ibyte *) (pw ? pw->pw_name : "unknown"); |
727 #else | 727 #else |
728 /* For all but Cygwin return NULL (nil) */ | 728 /* For all but Cygwin return NULL (nil) */ |
729 return pw ? pw->pw_name : NULL; | 729 return pw ? pw->pw_name : NULL; |
730 #endif | 730 #endif |
731 } | 731 } |
772 (user)) | 772 (user)) |
773 { | 773 { |
774 Lisp_Object user_name; | 774 Lisp_Object user_name; |
775 struct passwd *pw = NULL; | 775 struct passwd *pw = NULL; |
776 Lisp_Object tem; | 776 Lisp_Object tem; |
777 const Intbyte *p, *q; | 777 const Ibyte *p, *q; |
778 | 778 |
779 if (NILP (user) && STRINGP (Vuser_full_name)) | 779 if (NILP (user) && STRINGP (Vuser_full_name)) |
780 return Vuser_full_name; | 780 return Vuser_full_name; |
781 | 781 |
782 user_name = (STRINGP (user) ? user : Fuser_login_name (user)); | 782 user_name = (STRINGP (user) ? user : Fuser_login_name (user)); |
790 } | 790 } |
791 | 791 |
792 /* #### - Stig sez: this should return nil instead of "unknown" when pw==0 */ | 792 /* #### - Stig sez: this should return nil instead of "unknown" when pw==0 */ |
793 /* Ben sez: bad idea because it's likely to break something */ | 793 /* Ben sez: bad idea because it's likely to break something */ |
794 #ifndef AMPERSAND_FULL_NAME | 794 #ifndef AMPERSAND_FULL_NAME |
795 p = (Intbyte *) (pw ? USER_FULL_NAME : "unknown"); /* don't gettext */ | 795 p = (Ibyte *) (pw ? USER_FULL_NAME : "unknown"); /* don't gettext */ |
796 q = qxestrchr (p, ','); | 796 q = qxestrchr (p, ','); |
797 #else | 797 #else |
798 p = (Intbyte *) (pw ? USER_FULL_NAME : "unknown"); /* don't gettext */ | 798 p = (Ibyte *) (pw ? USER_FULL_NAME : "unknown"); /* don't gettext */ |
799 q = qxestrchr (p, ','); | 799 q = qxestrchr (p, ','); |
800 #endif | 800 #endif |
801 tem = ((!NILP (user) && !pw) | 801 tem = ((!NILP (user) && !pw) |
802 ? Qnil | 802 ? Qnil |
803 : make_string (p, (q ? (Bytecount) (q - p) : qxestrlen (p)))); | 803 : make_string (p, (q ? (Bytecount) (q - p) : qxestrlen (p)))); |
821 #endif /* AMPERSAND_FULL_NAME */ | 821 #endif /* AMPERSAND_FULL_NAME */ |
822 | 822 |
823 return tem; | 823 return tem; |
824 } | 824 } |
825 | 825 |
826 static Intbyte *cached_home_directory; | 826 static Ibyte *cached_home_directory; |
827 | 827 |
828 void | 828 void |
829 uncache_home_directory (void) | 829 uncache_home_directory (void) |
830 { | 830 { |
831 if (cached_home_directory) | 831 if (cached_home_directory) |
832 xfree (cached_home_directory); | 832 xfree (cached_home_directory); |
833 cached_home_directory = NULL; | 833 cached_home_directory = NULL; |
834 } | 834 } |
835 | 835 |
836 /* Returns the home directory */ | 836 /* Returns the home directory */ |
837 Intbyte * | 837 Ibyte * |
838 get_home_directory (void) | 838 get_home_directory (void) |
839 { | 839 { |
840 int output_home_warning = 0; | 840 int output_home_warning = 0; |
841 | 841 |
842 if (cached_home_directory == NULL) | 842 if (cached_home_directory == NULL) |
845 if (cached_home_directory) | 845 if (cached_home_directory) |
846 cached_home_directory = qxestrdup (cached_home_directory); | 846 cached_home_directory = qxestrdup (cached_home_directory); |
847 else | 847 else |
848 { | 848 { |
849 #if defined (WIN32_NATIVE) | 849 #if defined (WIN32_NATIVE) |
850 Intbyte *homedrive, *homepath; | 850 Ibyte *homedrive, *homepath; |
851 | 851 |
852 if ((homedrive = egetenv ("HOMEDRIVE")) != NULL && | 852 if ((homedrive = egetenv ("HOMEDRIVE")) != NULL && |
853 (homepath = egetenv ("HOMEPATH")) != NULL) | 853 (homepath = egetenv ("HOMEPATH")) != NULL) |
854 { | 854 { |
855 cached_home_directory = | 855 cached_home_directory = |
856 (Intbyte *) xmalloc (qxestrlen (homedrive) + | 856 (Ibyte *) xmalloc (qxestrlen (homedrive) + |
857 qxestrlen (homepath) + 1); | 857 qxestrlen (homepath) + 1); |
858 qxesprintf (cached_home_directory, "%s%s", | 858 qxesprintf (cached_home_directory, "%s%s", |
859 homedrive, | 859 homedrive, |
860 homepath); | 860 homepath); |
861 } | 861 } |
862 else | 862 else |
863 { | 863 { |
864 cached_home_directory = qxestrdup ((Intbyte *) "C:\\"); | 864 cached_home_directory = qxestrdup ((Ibyte *) "C:\\"); |
865 output_home_warning = 1; | 865 output_home_warning = 1; |
866 } | 866 } |
867 #else /* !WIN32_NATIVE */ | 867 #else /* !WIN32_NATIVE */ |
868 /* | 868 /* |
869 * Unix, typically. | 869 * Unix, typically. |
870 * Using "/" isn't quite right, but what should we do? | 870 * Using "/" isn't quite right, but what should we do? |
871 * We probably should try to extract pw_dir from /etc/passwd, | 871 * We probably should try to extract pw_dir from /etc/passwd, |
872 * before falling back to this. | 872 * before falling back to this. |
873 */ | 873 */ |
874 cached_home_directory = qxestrdup ((Intbyte *) "/"); | 874 cached_home_directory = qxestrdup ((Ibyte *) "/"); |
875 output_home_warning = 1; | 875 output_home_warning = 1; |
876 #endif /* !WIN32_NATIVE */ | 876 #endif /* !WIN32_NATIVE */ |
877 } | 877 } |
878 if (initialized && output_home_warning) | 878 if (initialized && output_home_warning) |
879 { | 879 { |
892 DEFUN ("user-home-directory", Fuser_home_directory, 0, 0, 0, /* | 892 DEFUN ("user-home-directory", Fuser_home_directory, 0, 0, 0, /* |
893 Return the user's home directory, as a string. | 893 Return the user's home directory, as a string. |
894 */ | 894 */ |
895 ()) | 895 ()) |
896 { | 896 { |
897 Intbyte *path = get_home_directory (); | 897 Ibyte *path = get_home_directory (); |
898 | 898 |
899 return !path ? Qnil : | 899 return !path ? Qnil : |
900 Fexpand_file_name (Fsubstitute_in_file_name (build_intstring (path)), | 900 Fexpand_file_name (Fsubstitute_in_file_name (build_intstring (path)), |
901 Qnil); | 901 Qnil); |
902 } | 902 } |
1227 and from `file-attributes'. | 1227 and from `file-attributes'. |
1228 */ | 1228 */ |
1229 (specified_time)) | 1229 (specified_time)) |
1230 { | 1230 { |
1231 time_t value; | 1231 time_t value; |
1232 Intbyte *the_ctime; | 1232 Ibyte *the_ctime; |
1233 EMACS_INT len; /* this is what make_ext_string() accepts; #### | 1233 EMACS_INT len; /* this is what make_ext_string() accepts; #### |
1234 should it be an Bytecount? */ | 1234 should it be an Bytecount? */ |
1235 | 1235 |
1236 if (! lisp_to_time (specified_time, &value)) | 1236 if (! lisp_to_time (specified_time, &value)) |
1237 value = -1; | 1237 value = -1; |
1314 #endif /* not HAVE_TM_ZONE */ | 1314 #endif /* not HAVE_TM_ZONE */ |
1315 if (s) | 1315 if (s) |
1316 tem = build_ext_string (s, Qnative); | 1316 tem = build_ext_string (s, Qnative); |
1317 else | 1317 else |
1318 { | 1318 { |
1319 Intbyte buf[6]; | 1319 Ibyte buf[6]; |
1320 | 1320 |
1321 /* No local time zone name is available; use "+-NNNN" instead. */ | 1321 /* No local time zone name is available; use "+-NNNN" instead. */ |
1322 int am = (offset < 0 ? -offset : offset) / 60; | 1322 int am = (offset < 0 ? -offset : offset) / 60; |
1323 qxesprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, | 1323 qxesprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, |
1324 am%60); | 1324 am%60); |
1556 text into. If BUFFER is nil, the current buffer is assumed. | 1556 text into. If BUFFER is nil, the current buffer is assumed. |
1557 */ | 1557 */ |
1558 (character, count, ignored, buffer)) | 1558 (character, count, ignored, buffer)) |
1559 { | 1559 { |
1560 /* This function can GC */ | 1560 /* This function can GC */ |
1561 REGISTER Intbyte *string; | 1561 REGISTER Ibyte *string; |
1562 REGISTER Bytecount slen; | 1562 REGISTER Bytecount slen; |
1563 REGISTER Bytecount i, j; | 1563 REGISTER Bytecount i, j; |
1564 REGISTER Bytecount n; | 1564 REGISTER Bytecount n; |
1565 REGISTER Bytecount charlen; | 1565 REGISTER Bytecount charlen; |
1566 Intbyte str[MAX_EMCHAR_LEN]; | 1566 Ibyte str[MAX_ICHAR_LEN]; |
1567 struct buffer *b = decode_buffer (buffer, 1); | 1567 struct buffer *b = decode_buffer (buffer, 1); |
1568 int cou; | 1568 int cou; |
1569 | 1569 |
1570 CHECK_CHAR_COERCE_INT (character); | 1570 CHECK_CHAR_COERCE_INT (character); |
1571 if (NILP (count)) | 1571 if (NILP (count)) |
1574 { | 1574 { |
1575 CHECK_INT (count); | 1575 CHECK_INT (count); |
1576 cou = XINT (count); | 1576 cou = XINT (count); |
1577 } | 1577 } |
1578 | 1578 |
1579 charlen = set_charptr_emchar (str, XCHAR (character)); | 1579 charlen = set_itext_ichar (str, XCHAR (character)); |
1580 n = cou * charlen; | 1580 n = cou * charlen; |
1581 if (n <= 0) | 1581 if (n <= 0) |
1582 return Qnil; | 1582 return Qnil; |
1583 slen = min (n, (Bytecount) 768); | 1583 slen = min (n, (Bytecount) 768); |
1584 string = alloca_array (Intbyte, slen); | 1584 string = alloca_array (Ibyte, slen); |
1585 /* Write as many copies of the character into the temp string as will fit. */ | 1585 /* Write as many copies of the character into the temp string as will fit. */ |
1586 for (i = 0; i + charlen <= slen; i += charlen) | 1586 for (i = 0; i + charlen <= slen; i += charlen) |
1587 for (j = 0; j < charlen; j++) | 1587 for (j = 0; j < charlen; j++) |
1588 string[i + j] = str[j]; | 1588 string[i + j] = str[j]; |
1589 slen = i; | 1589 slen = i; |
1701 if (len2 < length) | 1701 if (len2 < length) |
1702 length = len2; | 1702 length = len2; |
1703 | 1703 |
1704 for (i = 0; i < length; i++) | 1704 for (i = 0; i < length; i++) |
1705 { | 1705 { |
1706 Emchar c1 = BUF_FETCH_CHAR (bp1, begp1 + i); | 1706 Ichar c1 = BUF_FETCH_CHAR (bp1, begp1 + i); |
1707 Emchar c2 = BUF_FETCH_CHAR (bp2, begp2 + i); | 1707 Ichar c2 = BUF_FETCH_CHAR (bp2, begp2 + i); |
1708 if (!NILP (trt)) | 1708 if (!NILP (trt)) |
1709 { | 1709 { |
1710 c1 = TRT_TABLE_OF (trt, c1); | 1710 c1 = TRT_TABLE_OF (trt, c1); |
1711 c2 = TRT_TABLE_OF (trt, c2); | 1711 c2 = TRT_TABLE_OF (trt, c2); |
1712 } | 1712 } |
1749 */ | 1749 */ |
1750 (start, end, fromchar, tochar, noundo)) | 1750 (start, end, fromchar, tochar, noundo)) |
1751 { | 1751 { |
1752 /* This function can GC */ | 1752 /* This function can GC */ |
1753 Charbpos pos, stop; | 1753 Charbpos pos, stop; |
1754 Emchar fromc, toc; | 1754 Ichar fromc, toc; |
1755 int mc_count; | 1755 int mc_count; |
1756 struct buffer *buf = current_buffer; | 1756 struct buffer *buf = current_buffer; |
1757 int count = specpdl_depth (); | 1757 int count = specpdl_depth (); |
1758 | 1758 |
1759 get_buffer_range_char (buf, start, end, &pos, &stop, 0); | 1759 get_buffer_range_char (buf, start, end, &pos, &stop, 0); |
1830 /* This function can GC */ | 1830 /* This function can GC */ |
1831 Charbpos pos, stop; /* Limits of the region. */ | 1831 Charbpos pos, stop; /* Limits of the region. */ |
1832 int cnt = 0; /* Number of changes made. */ | 1832 int cnt = 0; /* Number of changes made. */ |
1833 int mc_count; | 1833 int mc_count; |
1834 struct buffer *buf = current_buffer; | 1834 struct buffer *buf = current_buffer; |
1835 Emchar oc; | 1835 Ichar oc; |
1836 | 1836 |
1837 get_buffer_range_char (buf, start, end, &pos, &stop, 0); | 1837 get_buffer_range_char (buf, start, end, &pos, &stop, 0); |
1838 mc_count = begin_multiple_change (buf, pos, stop); | 1838 mc_count = begin_multiple_change (buf, pos, stop); |
1839 if (STRINGP (table)) | 1839 if (STRINGP (table)) |
1840 { | 1840 { |
1841 Charcount size = string_char_length (table); | 1841 Charcount size = string_char_length (table); |
1842 #ifdef MULE | 1842 #ifdef MULE |
1843 /* Under Mule, string_emchar(n) is O(n), so for large tables or | 1843 /* Under Mule, string_ichar(n) is O(n), so for large tables or |
1844 large regions it makes sense to create an array of Emchars. */ | 1844 large regions it makes sense to create an array of Ichars. */ |
1845 if (size * (stop - pos) > 65536) | 1845 if (size * (stop - pos) > 65536) |
1846 { | 1846 { |
1847 Emchar *etable = alloca_array (Emchar, size); | 1847 Ichar *etable = alloca_array (Ichar, size); |
1848 convert_intbyte_string_into_emchar_string | 1848 convert_ibyte_string_into_ichar_string |
1849 (XSTRING_DATA (table), XSTRING_LENGTH (table), etable); | 1849 (XSTRING_DATA (table), XSTRING_LENGTH (table), etable); |
1850 for (; pos < stop && (oc = BUF_FETCH_CHAR (buf, pos), 1); pos++) | 1850 for (; pos < stop && (oc = BUF_FETCH_CHAR (buf, pos), 1); pos++) |
1851 { | 1851 { |
1852 if (oc < size) | 1852 if (oc < size) |
1853 { | 1853 { |
1854 Emchar nc = etable[oc]; | 1854 Ichar nc = etable[oc]; |
1855 if (nc != oc) | 1855 if (nc != oc) |
1856 { | 1856 { |
1857 buffer_replace_char (buf, pos, nc, 0, 0); | 1857 buffer_replace_char (buf, pos, nc, 0, 0); |
1858 ++cnt; | 1858 ++cnt; |
1859 } | 1859 } |
1865 { | 1865 { |
1866 for (; pos < stop && (oc = BUF_FETCH_CHAR (buf, pos), 1); pos++) | 1866 for (; pos < stop && (oc = BUF_FETCH_CHAR (buf, pos), 1); pos++) |
1867 { | 1867 { |
1868 if (oc < size) | 1868 if (oc < size) |
1869 { | 1869 { |
1870 Emchar nc = string_emchar (table, oc); | 1870 Ichar nc = string_ichar (table, oc); |
1871 if (nc != oc) | 1871 if (nc != oc) |
1872 { | 1872 { |
1873 buffer_replace_char (buf, pos, nc, 0, 0); | 1873 buffer_replace_char (buf, pos, nc, 0, 0); |
1874 ++cnt; | 1874 ++cnt; |
1875 } | 1875 } |
1888 { | 1888 { |
1889 Lisp_Object replacement = vtable[oc]; | 1889 Lisp_Object replacement = vtable[oc]; |
1890 retry: | 1890 retry: |
1891 if (CHAR_OR_CHAR_INTP (replacement)) | 1891 if (CHAR_OR_CHAR_INTP (replacement)) |
1892 { | 1892 { |
1893 Emchar nc = XCHAR_OR_CHAR_INT (replacement); | 1893 Ichar nc = XCHAR_OR_CHAR_INT (replacement); |
1894 if (nc != oc) | 1894 if (nc != oc) |
1895 { | 1895 { |
1896 buffer_replace_char (buf, pos, nc, 0, 0); | 1896 buffer_replace_char (buf, pos, nc, 0, 0); |
1897 ++cnt; | 1897 ++cnt; |
1898 } | 1898 } |
1922 { | 1922 { |
1923 Lisp_Object replacement = get_char_table (oc, table); | 1923 Lisp_Object replacement = get_char_table (oc, table); |
1924 retry2: | 1924 retry2: |
1925 if (CHAR_OR_CHAR_INTP (replacement)) | 1925 if (CHAR_OR_CHAR_INTP (replacement)) |
1926 { | 1926 { |
1927 Emchar nc = XCHAR_OR_CHAR_INT (replacement); | 1927 Ichar nc = XCHAR_OR_CHAR_INT (replacement); |
1928 if (nc != oc) | 1928 if (nc != oc) |
1929 { | 1929 { |
1930 buffer_replace_char (buf, pos, nc, 0, 0); | 1930 buffer_replace_char (buf, pos, nc, 0, 0); |
1931 ++cnt; | 1931 ++cnt; |
1932 } | 1932 } |
2228 Case is ignored if `case-fold-search' is non-nil in BUFFER. | 2228 Case is ignored if `case-fold-search' is non-nil in BUFFER. |
2229 If BUFFER is nil, the current buffer is assumed. | 2229 If BUFFER is nil, the current buffer is assumed. |
2230 */ | 2230 */ |
2231 (character1, character2, buffer)) | 2231 (character1, character2, buffer)) |
2232 { | 2232 { |
2233 Emchar x1, x2; | 2233 Ichar x1, x2; |
2234 struct buffer *b = decode_buffer (buffer, 1); | 2234 struct buffer *b = decode_buffer (buffer, 1); |
2235 | 2235 |
2236 CHECK_CHAR_COERCE_INT (character1); | 2236 CHECK_CHAR_COERCE_INT (character1); |
2237 CHECK_CHAR_COERCE_INT (character2); | 2237 CHECK_CHAR_COERCE_INT (character2); |
2238 x1 = XCHAR (character1); | 2238 x1 = XCHAR (character1); |