aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2009-10-18 03:08:32 +0000
committerStefan Monnier2009-10-18 03:08:32 +0000
commit4c0354d71bb71c17af97ec956379603ccbb42a18 (patch)
tree8f3ebc4af4b125f170ea6c3461b945878cf3b07d /src
parente5f035d75ea1e81103dc58b50e3e8afa44fbc34e (diff)
downloademacs-4c0354d71bb71c17af97ec956379603ccbb42a18.tar.gz
emacs-4c0354d71bb71c17af97ec956379603ccbb42a18.zip
Remove leftover table unibyte_to_multibyte_table.
* character.c (unibyte_to_multibyte_table): Remove. (Funibyte_char_to_multibyte): Use MAKE_CHAR_MULTIBYTE. * charset.c (init_charset_once): Don't init unibyte_to_multibyte_table. * character.h (UNIBYTE_TO_CHAR): New macro. (MAKE_CHAR_MULTIBYTE): Use it. (unibyte_to_multibyte_table, unibyte_char_to_multibyte): Remove. * xdisp.c (get_next_display_element): USE ASCII_CHAR_P. (message_dolog, set_message_1): * search.c (Freplace_match): * editfns.c (Fcompare_buffer_substrings): * fns.c (Fcompare_strings): Use MAKE_CHAR_MULTIBYTE. (concat): * insdel.c (copy_text, count_size_as_multibyte): Use ASCII_CHAR_P and BYTE8_TO_CHAR. * term.c (produce_glyphs): * syntax.c (skip_chars): Use BYTE8_TO_CHAR. * regex.c (RE_CHAR_TO_MULTIBYTE): * cmds.c (internal_self_insert): * buffer.h (FETCH_CHAR_AS_MULTIBYTE): Use UNIBYTE_TO_CHAR.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog22
-rw-r--r--src/buffer.h2
-rw-r--r--src/casefiddle.c2
-rw-r--r--src/character.c7
-rw-r--r--src/character.h13
-rw-r--r--src/charset.c5
-rw-r--r--src/cmds.c2
-rw-r--r--src/editfns.c4
-rw-r--r--src/fns.c8
-rw-r--r--src/insdel.c8
-rw-r--r--src/regex.c2
-rw-r--r--src/search.c4
-rw-r--r--src/syntax.c4
-rw-r--r--src/term.c2
-rw-r--r--src/xdisp.c6
15 files changed, 49 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index aefe15108bb..06adb2d92c4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,27 @@
12009-10-18 Stefan Monnier <monnier@iro.umontreal.ca> 12009-10-18 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 Remove leftover table unibyte_to_multibyte_table.
4 * character.c (unibyte_to_multibyte_table): Remove.
5 (Funibyte_char_to_multibyte): Use MAKE_CHAR_MULTIBYTE.
6 * charset.c (init_charset_once): Don't init unibyte_to_multibyte_table.
7 * character.h (UNIBYTE_TO_CHAR): New macro.
8 (MAKE_CHAR_MULTIBYTE): Use it.
9 (unibyte_to_multibyte_table, unibyte_char_to_multibyte): Remove.
10 * xdisp.c (get_next_display_element): USE ASCII_CHAR_P.
11 (message_dolog, set_message_1):
12 * search.c (Freplace_match):
13 * editfns.c (Fcompare_buffer_substrings):
14 * fns.c (Fcompare_strings): Use MAKE_CHAR_MULTIBYTE.
15 (concat):
16 * insdel.c (copy_text, count_size_as_multibyte):
17 Use ASCII_CHAR_P and BYTE8_TO_CHAR.
18 * term.c (produce_glyphs):
19 * syntax.c (skip_chars): Use BYTE8_TO_CHAR.
20 * regex.c (RE_CHAR_TO_MULTIBYTE):
21 * cmds.c (internal_self_insert):
22 * buffer.h (FETCH_CHAR_AS_MULTIBYTE): Use UNIBYTE_TO_CHAR.
23
24
3 * cmds.c (internal_self_insert): `c' is already in "multibyte" form. 25 * cmds.c (internal_self_insert): `c' is already in "multibyte" form.
4 26
52009-10-17 Dan Nicolaescu <dann@ics.uci.edu> 272009-10-17 Dan Nicolaescu <dann@ics.uci.edu>
diff --git a/src/buffer.h b/src/buffer.h
index 7e6e8daeafd..2a04f49ea48 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -339,7 +339,7 @@ extern unsigned char *_fetch_multibyte_char_p;
339#define FETCH_CHAR_AS_MULTIBYTE(pos) \ 339#define FETCH_CHAR_AS_MULTIBYTE(pos) \
340 (!NILP (current_buffer->enable_multibyte_characters) \ 340 (!NILP (current_buffer->enable_multibyte_characters) \
341 ? FETCH_MULTIBYTE_CHAR ((pos)) \ 341 ? FETCH_MULTIBYTE_CHAR ((pos)) \
342 : unibyte_to_multibyte_table[(FETCH_BYTE ((pos)))]) 342 : UNIBYTE_TO_CHAR (FETCH_BYTE ((pos))))
343 343
344 344
345/* Macros for accessing a character or byte, 345/* Macros for accessing a character or byte,
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 7317f61346b..f01faa01198 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -90,7 +90,7 @@ casify_object (flag, obj)
90 for (i = 0; i < size; i++) 90 for (i = 0; i < size; i++)
91 { 91 {
92 c = SREF (obj, i); 92 c = SREF (obj, i);
93 MAKE_CHAR_MULTIBYTE (c); 93 MAKE_CHAR_MULTIBYTE (c);
94 c1 = c; 94 c1 = c;
95 if (inword && flag != CASE_CAPITALIZE_UP) 95 if (inword && flag != CASE_CAPITALIZE_UP)
96 c = DOWNCASE (c); 96 c = DOWNCASE (c);
diff --git a/src/character.c b/src/character.c
index 509a14789ad..e2896444c25 100644
--- a/src/character.c
+++ b/src/character.c
@@ -86,10 +86,6 @@ Lisp_Object Vscript_representative_chars;
86static Lisp_Object Qchar_script_table; 86static Lisp_Object Qchar_script_table;
87 87
88Lisp_Object Vunicode_category_table; 88Lisp_Object Vunicode_category_table;
89
90/* Mapping table from unibyte chars to multibyte chars. */
91int unibyte_to_multibyte_table[256];
92
93 89
94 90
95/* If character code C has modifier masks, reflect them to the 91/* If character code C has modifier masks, reflect them to the
@@ -325,8 +321,7 @@ DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte,
325 c = XFASTINT (ch); 321 c = XFASTINT (ch);
326 if (c >= 0x100) 322 if (c >= 0x100)
327 error ("Not a unibyte character: %d", c); 323 error ("Not a unibyte character: %d", c);
328 if (c >= 0x80) 324 MAKE_CHAR_MULTIBYTE (c);
329 c = BYTE8_TO_CHAR (c);
330 return make_number (c); 325 return make_number (c);
331} 326}
332 327
diff --git a/src/character.h b/src/character.h
index 6f4bcdc6b02..7b6bcd1a5ae 100644
--- a/src/character.h
+++ b/src/character.h
@@ -62,6 +62,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
62/* Return the character code for raw 8-bit byte BYTE. */ 62/* Return the character code for raw 8-bit byte BYTE. */
63#define BYTE8_TO_CHAR(byte) ((byte) + 0x3FFF00) 63#define BYTE8_TO_CHAR(byte) ((byte) + 0x3FFF00)
64 64
65#define UNIBYTE_TO_CHAR(byte) \
66 (ASCII_BYTE_P (byte) ? (byte) : BYTE8_TO_CHAR (byte))
67
65/* Return the raw 8-bit byte for character C. */ 68/* Return the raw 8-bit byte for character C. */
66#define CHAR_TO_BYTE8(c) \ 69#define CHAR_TO_BYTE8(c) \
67 (CHAR_BYTE8_P (c) \ 70 (CHAR_BYTE8_P (c) \
@@ -79,14 +82,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
79 that corresponds to a raw 8-bit byte. */ 82 that corresponds to a raw 8-bit byte. */
80#define CHAR_BYTE8_HEAD_P(byte) ((byte) == 0xC0 || (byte) == 0xC1) 83#define CHAR_BYTE8_HEAD_P(byte) ((byte) == 0xC0 || (byte) == 0xC1)
81 84
82/* Mapping table from unibyte chars to multibyte chars. */
83extern int unibyte_to_multibyte_table[256];
84
85/* Convert the unibyte character C to the corresponding multibyte
86 character. If C can't be converted, return C. */
87#define unibyte_char_to_multibyte(c) \
88 ((c) < 256 ? unibyte_to_multibyte_table[(c)] : (c))
89
90/* If C is not ASCII, make it unibyte. */ 85/* If C is not ASCII, make it unibyte. */
91#define MAKE_CHAR_UNIBYTE(c) \ 86#define MAKE_CHAR_UNIBYTE(c) \
92 do { \ 87 do { \
@@ -97,7 +92,7 @@ extern int unibyte_to_multibyte_table[256];
97 92
98/* If C is not ASCII, make it multibyte. Assumes C < 256. */ 93/* If C is not ASCII, make it multibyte. Assumes C < 256. */
99#define MAKE_CHAR_MULTIBYTE(c) \ 94#define MAKE_CHAR_MULTIBYTE(c) \
100 (eassert ((c) >= 0 && (c) < 256), (c) = unibyte_to_multibyte_table[(c)]) 95 (eassert ((c) >= 0 && (c) < 256), (c) = UNIBYTE_TO_CHAR (c))
101 96
102/* This is the maximum byte length of multibyte form. */ 97/* This is the maximum byte length of multibyte form. */
103#define MAX_MULTIBYTE_LENGTH 5 98#define MAX_MULTIBYTE_LENGTH 5
diff --git a/src/charset.c b/src/charset.c
index e4195de9ff2..7ca9240d74f 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -2331,11 +2331,6 @@ init_charset_once ()
2331 charset_jisx0208_1978 = -1; 2331 charset_jisx0208_1978 = -1;
2332 charset_jisx0208 = -1; 2332 charset_jisx0208 = -1;
2333 charset_ksc5601 = -1; 2333 charset_ksc5601 = -1;
2334
2335 for (i = 0; i < 128; i++)
2336 unibyte_to_multibyte_table[i] = i;
2337 for (; i < 256; i++)
2338 unibyte_to_multibyte_table[i] = BYTE8_TO_CHAR (i);
2339} 2334}
2340 2335
2341#ifdef emacs 2336#ifdef emacs
diff --git a/src/cmds.c b/src/cmds.c
index 9cb287b0296..19073dccf4a 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -503,7 +503,7 @@ internal_self_insert (c, noautofill)
503 && PT > BEGV 503 && PT > BEGV
504 && (!NILP (current_buffer->enable_multibyte_characters) 504 && (!NILP (current_buffer->enable_multibyte_characters)
505 ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword 505 ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword
506 : (SYNTAX (unibyte_char_to_multibyte (XFASTINT (Fprevious_char ()))) 506 : (SYNTAX (UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
507 == Sword))) 507 == Sword)))
508 { 508 {
509 int modiff = MODIFF; 509 int modiff = MODIFF;
diff --git a/src/editfns.c b/src/editfns.c
index e52c3c21954..859e3965824 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2698,7 +2698,7 @@ determines whether case is significant or ignored. */)
2698 else 2698 else
2699 { 2699 {
2700 c1 = BUF_FETCH_BYTE (bp1, i1); 2700 c1 = BUF_FETCH_BYTE (bp1, i1);
2701 c1 = unibyte_char_to_multibyte (c1); 2701 MAKE_CHAR_MULTIBYTE (c1);
2702 i1++; 2702 i1++;
2703 } 2703 }
2704 2704
@@ -2711,7 +2711,7 @@ determines whether case is significant or ignored. */)
2711 else 2711 else
2712 { 2712 {
2713 c2 = BUF_FETCH_BYTE (bp2, i2); 2713 c2 = BUF_FETCH_BYTE (bp2, i2);
2714 c2 = unibyte_char_to_multibyte (c2); 2714 MAKE_CHAR_MULTIBYTE (c2);
2715 i2++; 2715 i2++;
2716 } 2716 }
2717 2717
diff --git a/src/fns.c b/src/fns.c
index 7c3e04e818f..e1431251e24 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -297,7 +297,7 @@ If string STR1 is greater, the value is a positive number N;
297 else 297 else
298 { 298 {
299 c1 = SREF (str1, i1++); 299 c1 = SREF (str1, i1++);
300 c1 = unibyte_char_to_multibyte (c1); 300 MAKE_CHAR_MULTIBYTE (c1);
301 } 301 }
302 302
303 if (STRING_MULTIBYTE (str2)) 303 if (STRING_MULTIBYTE (str2))
@@ -305,7 +305,7 @@ If string STR1 is greater, the value is a positive number N;
305 else 305 else
306 { 306 {
307 c2 = SREF (str2, i2++); 307 c2 = SREF (str2, i2++);
308 c2 = unibyte_char_to_multibyte (c2); 308 MAKE_CHAR_MULTIBYTE (c2);
309 } 309 }
310 310
311 if (c1 == c2) 311 if (c1 == c2)
@@ -703,10 +703,10 @@ concat (nargs, args, target_type, last_special)
703 { 703 {
704 XSETFASTINT (elt, SREF (this, thisindex)); thisindex++; 704 XSETFASTINT (elt, SREF (this, thisindex)); thisindex++;
705 if (some_multibyte 705 if (some_multibyte
706 && XINT (elt) >= 0200 706 && !ASCII_CHAR_P (XINT (elt))
707 && XINT (elt) < 0400) 707 && XINT (elt) < 0400)
708 { 708 {
709 c = unibyte_char_to_multibyte (XINT (elt)); 709 c = BYTE8_TO_CHAR (XINT (elt));
710 XSETINT (elt, c); 710 XSETINT (elt, c);
711 } 711 }
712 } 712 }
diff --git a/src/insdel.c b/src/insdel.c
index eaf899c8a0e..b09bed66d55 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -666,9 +666,9 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr,
666 { 666 {
667 int c = *from_addr++; 667 int c = *from_addr++;
668 668
669 if (c >= 0200) 669 if (!ASCII_CHAR_P (c))
670 { 670 {
671 c = unibyte_char_to_multibyte (c); 671 c = BYTE8_TO_CHAR (c);
672 to_addr += CHAR_STRING (c, to_addr); 672 to_addr += CHAR_STRING (c, to_addr);
673 nbytes--; 673 nbytes--;
674 } 674 }
@@ -694,11 +694,11 @@ count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes)
694 { 694 {
695 unsigned int c = *ptr++; 695 unsigned int c = *ptr++;
696 696
697 if (c < 0200) 697 if (ASCII_CHAR_P (c))
698 outgoing_nbytes++; 698 outgoing_nbytes++;
699 else 699 else
700 { 700 {
701 c = unibyte_char_to_multibyte (c); 701 c = BYTE8_TO_CHAR (c);
702 outgoing_nbytes += CHAR_BYTES (c); 702 outgoing_nbytes += CHAR_BYTES (c);
703 } 703 }
704 } 704 }
diff --git a/src/regex.c b/src/regex.c
index 944ef4e0b66..0c9e137aca0 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -151,7 +151,7 @@
151# define RE_STRING_CHAR_AND_LENGTH(p, s, len, multibyte) \ 151# define RE_STRING_CHAR_AND_LENGTH(p, s, len, multibyte) \
152 (multibyte ? (STRING_CHAR_AND_LENGTH (p, s, len)) : ((len) = 1, *(p))) 152 (multibyte ? (STRING_CHAR_AND_LENGTH (p, s, len)) : ((len) = 1, *(p)))
153 153
154# define RE_CHAR_TO_MULTIBYTE(c) unibyte_to_multibyte_table[(c)] 154# define RE_CHAR_TO_MULTIBYTE(c) UNIBYTE_TO_CHAR (c)
155 155
156# define RE_CHAR_TO_UNIBYTE(c) CHAR_TO_BYTE_SAFE (c) 156# define RE_CHAR_TO_UNIBYTE(c) CHAR_TO_BYTE_SAFE (c)
157 157
diff --git a/src/search.c b/src/search.c
index 6d2f8cc6dbb..e6ae4b660b6 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2759,7 +2759,7 @@ since only regular expressions have distinguished subexpressions. */)
2759 /* Note that we don't have to increment POS. */ 2759 /* Note that we don't have to increment POS. */
2760 c = SREF (newtext, pos_byte++); 2760 c = SREF (newtext, pos_byte++);
2761 if (buf_multibyte) 2761 if (buf_multibyte)
2762 c = unibyte_char_to_multibyte (c); 2762 MAKE_CHAR_MULTIBYTE (c);
2763 } 2763 }
2764 2764
2765 /* Either set ADD_STUFF and ADD_LEN to the text to put in SUBSTED, 2765 /* Either set ADD_STUFF and ADD_LEN to the text to put in SUBSTED,
@@ -2781,7 +2781,7 @@ since only regular expressions have distinguished subexpressions. */)
2781 { 2781 {
2782 c = SREF (newtext, pos_byte++); 2782 c = SREF (newtext, pos_byte++);
2783 if (buf_multibyte) 2783 if (buf_multibyte)
2784 c = unibyte_char_to_multibyte (c); 2784 MAKE_CHAR_MULTIBYTE (c);
2785 } 2785 }
2786 2786
2787 if (c == '&') 2787 if (c == '&')
diff --git a/src/syntax.c b/src/syntax.c
index d84e62ea257..3c5a21de5c7 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1555,14 +1555,14 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
1555 bzero (fastmap + 0200, 0200); 1555 bzero (fastmap + 0200, 0200);
1556 /* We are sure that this loop stops. */ 1556 /* We are sure that this loop stops. */
1557 for (i = 0200; ! fastmap2[i]; i++); 1557 for (i = 0200; ! fastmap2[i]; i++);
1558 c = unibyte_char_to_multibyte (i); 1558 c = BYTE8_TO_CHAR (i);
1559 fastmap[CHAR_LEADING_CODE (c)] = 1; 1559 fastmap[CHAR_LEADING_CODE (c)] = 1;
1560 range_start_byte = i; 1560 range_start_byte = i;
1561 range_start_char = c; 1561 range_start_char = c;
1562 char_ranges = (int *) alloca (sizeof (int) * 128 * 2); 1562 char_ranges = (int *) alloca (sizeof (int) * 128 * 2);
1563 for (i = 129; i < 0400; i++) 1563 for (i = 129; i < 0400; i++)
1564 { 1564 {
1565 c = unibyte_char_to_multibyte (i); 1565 c = BYTE8_TO_CHAR (i);
1566 fastmap[CHAR_LEADING_CODE (c)] = 1; 1566 fastmap[CHAR_LEADING_CODE (c)] = 1;
1567 if (i - range_start_byte != c - range_start_char) 1567 if (i - range_start_byte != c - range_start_char)
1568 { 1568 {
diff --git a/src/term.c b/src/term.c
index d5855b4cbf6..9e18df3160e 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1650,7 +1650,7 @@ produce_glyphs (it)
1650 if (unibyte_display_via_language_environment 1650 if (unibyte_display_via_language_environment
1651 && (it->c >= 0240)) 1651 && (it->c >= 0240))
1652 { 1652 {
1653 it->char_to_display = unibyte_char_to_multibyte (it->c); 1653 it->char_to_display = BYTE8_TO_CHAR (it->c);
1654 it->pixel_width = CHAR_WIDTH (it->char_to_display); 1654 it->pixel_width = CHAR_WIDTH (it->char_to_display);
1655 it->nglyphs = it->pixel_width; 1655 it->nglyphs = it->pixel_width;
1656 if (it->glyph_row) 1656 if (it->glyph_row)
diff --git a/src/xdisp.c b/src/xdisp.c
index 24826fa3b96..a750a1b73b5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5716,7 +5716,7 @@ get_next_display_element (it)
5716 } 5716 }
5717 5717
5718 if (unibyte_display_via_language_environment 5718 if (unibyte_display_via_language_environment
5719 && it->c >= 0x80) 5719 && !ASCII_CHAR_P (it->c))
5720 decoded = DECODE_CHAR (unibyte, it->c); 5720 decoded = DECODE_CHAR (unibyte, it->c);
5721 5721
5722 if (it->c >= 0x80 && ! NILP (Vnobreak_char_display)) 5722 if (it->c >= 0x80 && ! NILP (Vnobreak_char_display))
@@ -7773,7 +7773,7 @@ message_dolog (m, nbytes, nlflag, multibyte)
7773 for (i = 0; i < nbytes; i++) 7773 for (i = 0; i < nbytes; i++)
7774 { 7774 {
7775 c = msg[i]; 7775 c = msg[i];
7776 c = unibyte_char_to_multibyte (c); 7776 MAKE_CHAR_MULTIBYTE (c);
7777 char_bytes = CHAR_STRING (c, str); 7777 char_bytes = CHAR_STRING (c, str);
7778 insert_1_both (str, 1, char_bytes, 1, 0, 0); 7778 insert_1_both (str, 1, char_bytes, 1, 0, 0);
7779 } 7779 }
@@ -9079,7 +9079,7 @@ set_message_1 (a1, a2, nbytes, multibyte_p)
9079 for (i = 0; i < nbytes; i++) 9079 for (i = 0; i < nbytes; i++)
9080 { 9080 {
9081 c = msg[i]; 9081 c = msg[i];
9082 c = unibyte_char_to_multibyte (c); 9082 MAKE_CHAR_MULTIBYTE (c);
9083 n = CHAR_STRING (c, str); 9083 n = CHAR_STRING (c, str);
9084 insert_1_both (str, 1, n, 1, 0, 0); 9084 insert_1_both (str, 1, n, 1, 0, 0);
9085 } 9085 }