aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorKenichi Handa2003-09-08 12:53:41 +0000
committerKenichi Handa2003-09-08 12:53:41 +0000
commit8f924df7df019cce90537647de2627581043b5c4 (patch)
tree6c40bd05679425e710d6b2e5649eae3da5e40a52 /src/data.c
parent463f5630a5e7cbe7f042bc1175d1fa1c4e98860f (diff)
parent9d4807432a01f9b3cc519fcfa3ea92a70ffa7f43 (diff)
downloademacs-8f924df7df019cce90537647de2627581043b5c4.tar.gz
emacs-8f924df7df019cce90537647de2627581043b5c4.zip
*** empty log message ***
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c119
1 files changed, 7 insertions, 112 deletions
diff --git a/src/data.c b/src/data.c
index d18cb187f62..8ee564db821 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"
@@ -447,7 +447,7 @@ DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0,
447 (object) 447 (object)
448 register Lisp_Object object; 448 register Lisp_Object object;
449{ 449{
450 if (INTEGERP (object) || STRINGP (object)) 450 if (CHARACTERP (object) || STRINGP (object))
451 return Qt; 451 return Qt;
452 return Qnil; 452 return Qnil;
453} 453}
@@ -1855,77 +1855,8 @@ or a byte-code object. IDX starts at 0. */)
1855 } 1855 }
1856 else if (CHAR_TABLE_P (array)) 1856 else if (CHAR_TABLE_P (array))
1857 { 1857 {
1858 Lisp_Object val; 1858 CHECK_CHARACTER (idx);
1859 1859 return CHAR_TABLE_REF (array, idxval);
1860 val = Qnil;
1861
1862 if (idxval < 0)
1863 args_out_of_range (array, idx);
1864 if (idxval < CHAR_TABLE_ORDINARY_SLOTS)
1865 {
1866 /* For ASCII and 8-bit European characters, the element is
1867 stored in the top table. */
1868 val = XCHAR_TABLE (array)->contents[idxval];
1869 if (NILP (val))
1870 val = XCHAR_TABLE (array)->defalt;
1871 while (NILP (val)) /* Follow parents until we find some value. */
1872 {
1873 array = XCHAR_TABLE (array)->parent;
1874 if (NILP (array))
1875 return Qnil;
1876 val = XCHAR_TABLE (array)->contents[idxval];
1877 if (NILP (val))
1878 val = XCHAR_TABLE (array)->defalt;
1879 }
1880 return val;
1881 }
1882 else
1883 {
1884 int code[4], i;
1885 Lisp_Object sub_table;
1886
1887 SPLIT_CHAR (idxval, code[0], code[1], code[2]);
1888 if (code[1] < 32) code[1] = -1;
1889 else if (code[2] < 32) code[2] = -1;
1890
1891 /* Here, the possible range of CODE[0] (== charset ID) is
1892 128..MAX_CHARSET. Since the top level char table contains
1893 data for multibyte characters after 256th element, we must
1894 increment CODE[0] by 128 to get a correct index. */
1895 code[0] += 128;
1896 code[3] = -1; /* anchor */
1897
1898 try_parent_char_table:
1899 sub_table = array;
1900 for (i = 0; code[i] >= 0; i++)
1901 {
1902 val = XCHAR_TABLE (sub_table)->contents[code[i]];
1903 if (SUB_CHAR_TABLE_P (val))
1904 sub_table = val;
1905 else
1906 {
1907 if (NILP (val))
1908 val = XCHAR_TABLE (sub_table)->defalt;
1909 if (NILP (val))
1910 {
1911 array = XCHAR_TABLE (array)->parent;
1912 if (!NILP (array))
1913 goto try_parent_char_table;
1914 }
1915 return val;
1916 }
1917 }
1918 /* Here, VAL is a sub char table. We try the default value
1919 and parent. */
1920 val = XCHAR_TABLE (val)->defalt;
1921 if (NILP (val))
1922 {
1923 array = XCHAR_TABLE (array)->parent;
1924 if (!NILP (array))
1925 goto try_parent_char_table;
1926 }
1927 return val;
1928 }
1929 } 1860 }
1930 else 1861 else
1931 { 1862 {
@@ -1988,44 +1919,8 @@ bool-vector. IDX starts at 0. */)
1988 } 1919 }
1989 else if (CHAR_TABLE_P (array)) 1920 else if (CHAR_TABLE_P (array))
1990 { 1921 {
1991 if (idxval < 0) 1922 CHECK_CHARACTER (idx);
1992 args_out_of_range (array, idx); 1923 CHAR_TABLE_SET (array, idxval, newelt);
1993 if (idxval < CHAR_TABLE_ORDINARY_SLOTS)
1994 XCHAR_TABLE (array)->contents[idxval] = newelt;
1995 else
1996 {
1997 int code[4], i;
1998 Lisp_Object val;
1999
2000 SPLIT_CHAR (idxval, code[0], code[1], code[2]);
2001 if (code[1] < 32) code[1] = -1;
2002 else if (code[2] < 32) code[2] = -1;
2003
2004 /* See the comment of the corresponding part in Faref. */
2005 code[0] += 128;
2006 code[3] = -1; /* anchor */
2007 for (i = 0; code[i + 1] >= 0; i++)
2008 {
2009 val = XCHAR_TABLE (array)->contents[code[i]];
2010 if (SUB_CHAR_TABLE_P (val))
2011 array = val;
2012 else
2013 {
2014 Lisp_Object temp;
2015
2016 /* VAL is a leaf. Create a sub char table with the
2017 default value VAL or XCHAR_TABLE (array)->defalt
2018 and look into it. */
2019
2020 temp = make_sub_char_table (NILP (val)
2021 ? XCHAR_TABLE (array)->defalt
2022 : val);
2023 XCHAR_TABLE (array)->contents[code[i]] = temp;
2024 array = temp;
2025 }
2026 }
2027 XCHAR_TABLE (array)->contents[code[i]] = newelt;
2028 }
2029 } 1924 }
2030 else if (STRING_MULTIBYTE (array)) 1925 else if (STRING_MULTIBYTE (array))
2031 { 1926 {
@@ -2071,7 +1966,7 @@ bool-vector. IDX starts at 0. */)
2071 args_out_of_range (array, idx); 1966 args_out_of_range (array, idx);
2072 CHECK_NUMBER (newelt); 1967 CHECK_NUMBER (newelt);
2073 1968
2074 if (XINT (newelt) < 0 || SINGLE_BYTE_CHAR_P (XINT (newelt))) 1969 if (XINT (newelt) < 0 || ASCII_CHAR_P (XINT (newelt)))
2075 SSET (array, idxval, XINT (newelt)); 1970 SSET (array, idxval, XINT (newelt));
2076 else 1971 else
2077 { 1972 {