aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorKenichi Handa2002-03-01 01:25:08 +0000
committerKenichi Handa2002-03-01 01:25:08 +0000
commite6e1f521142ad7675a577abb3dec5dd8b51a4d0b (patch)
treecad19387aeeb4954c385b2512c90a50e4ac8fb24 /src/data.c
parent9f504898c4cbdcf3c38a2e0b61a239d5141a7bc1 (diff)
downloademacs-e6e1f521142ad7675a577abb3dec5dd8b51a4d0b.tar.gz
emacs-e6e1f521142ad7675a577abb3dec5dd8b51a4d0b.zip
Include "character.h" instead of "charset.h".
(Faref): Call CHAR_TABLE_REF for a char table. (Faset): Call CHAR_TABLE_SET for a char table.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c115
1 files changed, 5 insertions, 110 deletions
diff --git a/src/data.c b/src/data.c
index 4aea53cc022..c622ac3c939 100644
--- a/src/data.c
+++ b/src/data.c
@@ -25,7 +25,7 @@ Boston, MA 02111-1307, USA. */
25#include <stdio.h> 25#include <stdio.h>
26#include "lisp.h" 26#include "lisp.h"
27#include "puresize.h" 27#include "puresize.h"
28#include "charset.h" 28#include "character.h"
29#include "buffer.h" 29#include "buffer.h"
30#include "keyboard.h" 30#include "keyboard.h"
31#include "frame.h" 31#include "frame.h"
@@ -1845,77 +1845,8 @@ or a byte-code object. IDX starts at 0. */)
1845 } 1845 }
1846 else if (CHAR_TABLE_P (array)) 1846 else if (CHAR_TABLE_P (array))
1847 { 1847 {
1848 Lisp_Object val; 1848 CHECK_CHARACTER (idx);
1849 1849 return CHAR_TABLE_REF (array, idxval);
1850 val = Qnil;
1851
1852 if (idxval < 0)
1853 args_out_of_range (array, idx);
1854 if (idxval < CHAR_TABLE_ORDINARY_SLOTS)
1855 {
1856 /* For ASCII and 8-bit European characters, the element is
1857 stored in the top table. */
1858 val = XCHAR_TABLE (array)->contents[idxval];
1859 if (NILP (val))
1860 val = XCHAR_TABLE (array)->defalt;
1861 while (NILP (val)) /* Follow parents until we find some value. */
1862 {
1863 array = XCHAR_TABLE (array)->parent;
1864 if (NILP (array))
1865 return Qnil;
1866 val = XCHAR_TABLE (array)->contents[idxval];
1867 if (NILP (val))
1868 val = XCHAR_TABLE (array)->defalt;
1869 }
1870 return val;
1871 }
1872 else
1873 {
1874 int code[4], i;
1875 Lisp_Object sub_table;
1876
1877 SPLIT_CHAR (idxval, code[0], code[1], code[2]);
1878 if (code[1] < 32) code[1] = -1;
1879 else if (code[2] < 32) code[2] = -1;
1880
1881 /* Here, the possible range of CODE[0] (== charset ID) is
1882 128..MAX_CHARSET. Since the top level char table contains
1883 data for multibyte characters after 256th element, we must
1884 increment CODE[0] by 128 to get a correct index. */
1885 code[0] += 128;
1886 code[3] = -1; /* anchor */
1887
1888 try_parent_char_table:
1889 sub_table = array;
1890 for (i = 0; code[i] >= 0; i++)
1891 {
1892 val = XCHAR_TABLE (sub_table)->contents[code[i]];
1893 if (SUB_CHAR_TABLE_P (val))
1894 sub_table = val;
1895 else
1896 {
1897 if (NILP (val))
1898 val = XCHAR_TABLE (sub_table)->defalt;
1899 if (NILP (val))
1900 {
1901 array = XCHAR_TABLE (array)->parent;
1902 if (!NILP (array))
1903 goto try_parent_char_table;
1904 }
1905 return val;
1906 }
1907 }
1908 /* Here, VAL is a sub char table. We try the default value
1909 and parent. */
1910 val = XCHAR_TABLE (val)->defalt;
1911 if (NILP (val))
1912 {
1913 array = XCHAR_TABLE (array)->parent;
1914 if (!NILP (array))
1915 goto try_parent_char_table;
1916 }
1917 return val;
1918 }
1919 } 1850 }
1920 else 1851 else
1921 { 1852 {
@@ -1978,44 +1909,8 @@ IDX starts at 0. */)
1978 } 1909 }
1979 else if (CHAR_TABLE_P (array)) 1910 else if (CHAR_TABLE_P (array))
1980 { 1911 {
1981 if (idxval < 0) 1912 CHECK_CHARACTER (idx);
1982 args_out_of_range (array, idx); 1913 CHAR_TABLE_SET (array, idxval, newelt);
1983 if (idxval < CHAR_TABLE_ORDINARY_SLOTS)
1984 XCHAR_TABLE (array)->contents[idxval] = newelt;
1985 else
1986 {
1987 int code[4], i;
1988 Lisp_Object val;
1989
1990 SPLIT_CHAR (idxval, code[0], code[1], code[2]);
1991 if (code[1] < 32) code[1] = -1;
1992 else if (code[2] < 32) code[2] = -1;
1993
1994 /* See the comment of the corresponding part in Faref. */
1995 code[0] += 128;
1996 code[3] = -1; /* anchor */
1997 for (i = 0; code[i + 1] >= 0; i++)
1998 {
1999 val = XCHAR_TABLE (array)->contents[code[i]];
2000 if (SUB_CHAR_TABLE_P (val))
2001 array = val;
2002 else
2003 {
2004 Lisp_Object temp;
2005
2006 /* VAL is a leaf. Create a sub char table with the
2007 default value VAL or XCHAR_TABLE (array)->defalt
2008 and look into it. */
2009
2010 temp = make_sub_char_table (NILP (val)
2011 ? XCHAR_TABLE (array)->defalt
2012 : val);
2013 XCHAR_TABLE (array)->contents[code[i]] = temp;
2014 array = temp;
2015 }
2016 }
2017 XCHAR_TABLE (array)->contents[code[i]] = newelt;
2018 }
2019 } 1914 }
2020 else if (STRING_MULTIBYTE (array)) 1915 else if (STRING_MULTIBYTE (array))
2021 { 1916 {