aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorKenichi Handa1997-04-07 07:12:13 +0000
committerKenichi Handa1997-04-07 07:12:13 +0000
commit39e16e513ff5f37f1f2c7408f504146c3699c606 (patch)
tree07d1acc06108da9943f18bf6f085ed728fdb8736 /src/data.c
parent3720677d59a1e8356c78add992350997a9eaeb13 (diff)
downloademacs-39e16e513ff5f37f1f2c7408f504146c3699c606.tar.gz
emacs-39e16e513ff5f37f1f2c7408f504146c3699c606.zip
(Faref, Faset): Adjusted for the new structure of
Lisp_Char_Table.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c103
1 files changed, 53 insertions, 50 deletions
diff --git a/src/data.c b/src/data.c
index 5db57f5e0cf..da8f207fb53 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1549,7 +1549,7 @@ or a byte-code object. IDX starts at 0.")
1549 args_out_of_range (array, idx); 1549 args_out_of_range (array, idx);
1550 if (idxval < CHAR_TABLE_SINGLE_BYTE_SLOTS) 1550 if (idxval < CHAR_TABLE_SINGLE_BYTE_SLOTS)
1551 { 1551 {
1552 /* For ASCII or 8-bit European characters, the element is 1552 /* For ASCII and 8-bit European characters, the element is
1553 stored in the top table. */ 1553 stored in the top table. */
1554 val = XCHAR_TABLE (array)->contents[idxval]; 1554 val = XCHAR_TABLE (array)->contents[idxval];
1555 if (NILP (val)) 1555 if (NILP (val))
@@ -1567,44 +1567,50 @@ or a byte-code object. IDX starts at 0.")
1567 } 1567 }
1568 else 1568 else
1569 { 1569 {
1570 int idx[3]; /* For charset, code1, and code2. */ 1570 int code[4], i;
1571 int i, len; 1571 Lisp_Object sub_table;
1572 Lisp_Object sub_array;
1573 1572
1574 SPLIT_NON_ASCII_CHAR (idxval, idx[0], idx[1], idx[2]); 1573 SPLIT_NON_ASCII_CHAR (idxval, code[0], code[1], code[2]);
1575 len = (COMPOSITE_CHAR_P (idxval) || idx[2]) ? 3 : (idx[1] ? 2 : 1); 1574 if (code[0] != CHARSET_COMPOSITION)
1576 /* The top level char-table should be indexed from 256 for 1575 {
1577 each non-ASCII charsets. */ 1576 if (code[1] < 32) code[1] = -1;
1578 idx[0] += 128; 1577 else if (code[2] < 32) code[2] = -1;
1578 }
1579 /* Here, the possible range of CODE[0] (== charset ID) is
1580 128..MAX_CHARSET. Since the top level char table contains
1581 data for multibyte characters after 256th element, we must
1582 increment CODE[0] by 128 to get a correct index. */
1583 code[0] += 128;
1584 code[3] = -1; /* anchor */
1579 1585
1580 try_parent_char_table: 1586 try_parent_char_table:
1581 sub_array = array; 1587 sub_table = array;
1582 for (i = 0; i < len; i++) 1588 for (i = 0; code[i] >= 0; i++)
1583 { 1589 {
1584 val = XCHAR_TABLE (sub_array)->contents[idx[i]]; 1590 val = XCHAR_TABLE (sub_table)->contents[code[i]];
1585 if (NILP (val)) 1591 if (SUB_CHAR_TABLE_P (val))
1586 val = XCHAR_TABLE (sub_array)->defalt; 1592 sub_table = val;
1587 if (NILP (val)) 1593 else
1588 { 1594 {
1589 array = XCHAR_TABLE (array)->parent; 1595 if (NILP (val))
1590 if (NILP (array)) 1596 val = XCHAR_TABLE (sub_table)->defalt;
1591 return Qnil; 1597 if (NILP (val))
1592 goto try_parent_char_table; 1598 {
1599 array = XCHAR_TABLE (array)->parent;
1600 if (!NILP (array))
1601 goto try_parent_char_table;
1602 }
1603 return val;
1593 } 1604 }
1594 if (!CHAR_TABLE_P (val))
1595 return val;
1596 sub_array = val;
1597 } 1605 }
1598 /* We come here because ARRAY is deeper than the specified 1606 /* Here, VAL is a sub char table. We try the default value
1599 indices. We return a default value stored at the deepest 1607 and parent. */
1600 level specified. */ 1608 val = XCHAR_TABLE (val)->defalt;
1601 val = XCHAR_TABLE (sub_array)->defalt;
1602 if (NILP (val)) 1609 if (NILP (val))
1603 { 1610 {
1604 array = XCHAR_TABLE (array)->parent; 1611 array = XCHAR_TABLE (array)->parent;
1605 if (NILP (array)) 1612 if (!NILP (array))
1606 return Qnil; 1613 goto try_parent_char_table;
1607 goto try_parent_char_table;
1608 } 1614 }
1609 return val; 1615 return val;
1610 } 1616 }
@@ -1672,33 +1678,30 @@ ARRAY may be a vector or a string. IDX starts at 0.")
1672 XCHAR_TABLE (array)->contents[idxval] = newelt; 1678 XCHAR_TABLE (array)->contents[idxval] = newelt;
1673 else 1679 else
1674 { 1680 {
1675 int idx[3]; /* For charset, code1, and code2. */ 1681 int code[4], i;
1676 int i, len;
1677 Lisp_Object val; 1682 Lisp_Object val;
1678 1683
1679 SPLIT_NON_ASCII_CHAR (idxval, idx[0], idx[1], idx[2]); 1684 SPLIT_NON_ASCII_CHAR (idxval, code[0], code[1], code[2]);
1680 len = (COMPOSITE_CHAR_P (idxval) || idx[2]) ? 2 : (idx[1] ? 1 : 0); 1685 if (code[0] != CHARSET_COMPOSITION)
1681 /* The top level char-table should be indexed from 256 for 1686 {
1682 each non-ASCII charsets. */ 1687 if (code[1] < 32) code[1] = -1;
1683 idx[0] += 128; 1688 else if (code[2] < 32) code[2] = -1;
1684 1689 }
1685 for (i = 0; i < len; i++) 1690 /* See the comment of the corresponding part in Faref. */
1691 code[0] += 128;
1692 code[3] = -1; /* anchor */
1693 for (i = 0; code[i + 1] >= 0; i++)
1686 { 1694 {
1687 val = XCHAR_TABLE (array)->contents[idx[i]]; 1695 val = XCHAR_TABLE (array)->contents[code[i]];
1688 if (CHAR_TABLE_P (val)) 1696 if (SUB_CHAR_TABLE_P (val))
1689 /* Look into this deeper array. */
1690 array = val; 1697 array = val;
1691 else 1698 else
1692 { 1699 /* VAL is a leaf. Create a sub char table with the
1693 /* VAL is the leaf. Create a deeper array with the 1700 default value VAL here and look into it. */
1694 default value VAL, set it in the slot of VAL, and 1701 array = (XCHAR_TABLE (array)->contents[code[i]]
1695 look into it. */ 1702 = make_sub_char_table (val));
1696 array = XCHAR_TABLE (array)->contents[idx[i]]
1697 = Fmake_char_table (Qnil, Qnil);
1698 XCHAR_TABLE (array)->defalt = val;
1699 }
1700 } 1703 }
1701 return XCHAR_TABLE (array)->contents[idx[i]] = newelt; 1704 XCHAR_TABLE (array)->contents[code[i]] = newelt;
1702 } 1705 }
1703 } 1706 }
1704 else 1707 else