aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1998-08-07 05:04:36 +0000
committerKenichi Handa1998-08-07 05:04:36 +0000
commit76d7b82914fdf9278d1ce23c1f3e51a8ae7d99bc (patch)
tree452cac5e90c88ab12c2ac7230ede834b940a9791 /src
parent38b62842a11aefbdb1cf572de04e5ee3d0957868 (diff)
downloademacs-76d7b82914fdf9278d1ce23c1f3e51a8ae7d99bc.tar.gz
emacs-76d7b82914fdf9278d1ce23c1f3e51a8ae7d99bc.zip
(multibyte_char_to_unibyte): New function.
(charset_id_internal): Avoid initializer for Lisp_Object. (init_charset_once): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/charset.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/charset.c b/src/charset.c
index b158bf85dff..e43492a67ae 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -342,6 +342,43 @@ unibyte_char_to_multibyte (c)
342 } 342 }
343 return c; 343 return c;
344} 344}
345
346
347/* Convert the multibyte character C to unibyte 8-bit character based
348 on Vnonascii_translation_table or nonascii_insert_offset. If
349 REV_TBL is non-nil, it should be a reverse table of
350 Vnonascii_translation_table, i.e. what given by:
351 Fchar_table_extra_slot (Vnonascii_translation_table, make_number (0)) */
352
353int
354multibyte_char_to_unibyte (c, rev_tbl)
355 int c;
356 Lisp_Object rev_tbl;
357{
358 if (!SINGLE_BYTE_CHAR_P (c))
359 {
360 int c_save = c;
361
362 if (! CHAR_TABLE_P (rev_tbl)
363 && CHAR_TABLE_P (Vnonascii_translation_table))
364 rev_tbl = Fchar_table_extra_slot (Vnonascii_translation_table,
365 make_number (0));
366 if (CHAR_TABLE_P (rev_tbl))
367 {
368 Lisp_Object temp;
369 temp = Faref (rev_tbl, make_number (c));
370 if (INTEGERP (temp))
371 c = XINT (temp);
372 }
373 else if (nonascii_insert_offset > 0)
374 c -= nonascii_insert_offset;
375 if (c < 128 || c >= 256)
376 c = (c_save & 0177) + 0200;
377 }
378
379 return c;
380}
381
345 382
346/* Update the table Vcharset_table with the given arguments (see the 383/* Update the table Vcharset_table with the given arguments (see the
347 document of `define-charset' for the meaning of each argument). 384 document of `define-charset' for the meaning of each argument).
@@ -1648,8 +1685,9 @@ int
1648charset_id_internal (charset_name) 1685charset_id_internal (charset_name)
1649 char *charset_name; 1686 char *charset_name;
1650{ 1687{
1651 Lisp_Object val = Fget (intern (charset_name), Qcharset); 1688 Lisp_Object val;
1652 1689
1690 val= Fget (intern (charset_name), Qcharset);
1653 if (!VECTORP (val)) 1691 if (!VECTORP (val))
1654 error ("Charset %s is not defined", charset_name); 1692 error ("Charset %s is not defined", charset_name);
1655 1693
@@ -1724,8 +1762,9 @@ init_charset_once ()
1724 WIDTH_BY_CHAR_HEAD (LEADING_CODE_PRIVATE_22) = 2; 1762 WIDTH_BY_CHAR_HEAD (LEADING_CODE_PRIVATE_22) = 2;
1725 1763
1726 { 1764 {
1727 Lisp_Object val = Qnil; 1765 Lisp_Object val;
1728 1766
1767 val = Qnil;
1729 for (i = 0x81; i < 0x90; i++) 1768 for (i = 0x81; i < 0x90; i++)
1730 val = Fcons (make_number ((i - 0x70) << 7), val); 1769 val = Fcons (make_number ((i - 0x70) << 7), val);
1731 for (; i < 0x9A; i++) 1770 for (; i < 0x9A; i++)