From: Kenichi Handa Date: Wed, 20 Apr 2005 07:50:59 +0000 (+0000) Subject: (Fset_char_table_range): Don't set slots used as default X-Git-Tag: ttn-vms-21-2-B4~874 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2b048bf56106f9818da25051f7608c57cb884396;p=emacs.git (Fset_char_table_range): Don't set slots used as default values for ascii, eight-bit-control, eight-bit-graphic. Don't call Faref with charset-id. (Fset_char_table_default): Document how to treat normal character argument. Handle special slots used as default values of ascii, eight-bit-control, eight-bit-control. Make a sub chartable if necessary. --- diff --git a/src/ChangeLog b/src/ChangeLog index 5fde4ff5286..8b01a1a6bb7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,26 @@ +2005-04-20 Kenichi Handa + + * lisp.h (CHAR_TABLE_DEFAULT_SLOT_ASCII): New macro. + (CHAR_TABLE_DEFAULT_SLOT_8_BIT_CONTROL): New macro. + (CHAR_TABLE_DEFAULT_SLOT_8_BIT_GRAPHIC): New macro. + + * alloc.c (make_sub_char_table): Argument changed to initial + value of the slots. + + * data.c (Faref): Handle special slots used as default values of + ascii, eight-bit-control, eight-bit-control. Don't ignore a + default value set for a group of characters. + (Faset): Signal an error if IDXVAL is not a valid character code. + Make a sub-chartable with correct initial value. + + * fns.c (Fset_char_table_range): Don't set slots used as default + values for ascii, eight-bit-control, eight-bit-graphic. Don't + call Faref with charset-id. + (Fset_char_table_default): Document how to treat normal character + argument. Handle special slots used as default values of ascii, + eight-bit-control, eight-bit-control. Make a sub chartable if + necessary. + 2005-04-20 Kenichi Handa * search.c (boyer_moore): Fix previous change. diff --git a/src/fns.c b/src/fns.c index 088b6ca500d..bad4da80959 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2578,7 +2578,14 @@ character set, or a character code. Return VALUE. */) if (EQ (range, Qt)) for (i = 0; i < CHAR_TABLE_ORDINARY_SLOTS; i++) - XCHAR_TABLE (char_table)->contents[i] = value; + { + /* Don't set these special slots used for default values of + ascii, eight-bit-control, and eight-bit-graphic. */ + if (i != CHAR_TABLE_DEFAULT_SLOT_ASCII + && i != CHAR_TABLE_DEFAULT_SLOT_8_BIT_CONTROL + && i != CHAR_TABLE_DEFAULT_SLOT_8_BIT_GRAPHIC) + XCHAR_TABLE (char_table)->contents[i] = value; + } else if (EQ (range, Qnil)) XCHAR_TABLE (char_table)->defalt = value; else if (SYMBOLP (range)) @@ -2609,19 +2616,12 @@ character set, or a character code. Return VALUE. */) Faset (char_table, range, value); else if (VECTORP (range)) { - if (XVECTOR (range)->size == 1) - return Faset (char_table, - make_number (XINT (XVECTOR (range)->contents[0]) + 128), - value); - else - { - int size = XVECTOR (range)->size; - Lisp_Object *val = XVECTOR (range)->contents; - Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0], - size <= 1 ? Qnil : val[1], - size <= 2 ? Qnil : val[2]); - return Faset (char_table, ch, value); - } + int size = XVECTOR (range)->size; + Lisp_Object *val = XVECTOR (range)->contents; + Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0], + size <= 1 ? Qnil : val[1], + size <= 2 ? Qnil : val[2]); + Faset (char_table, ch, value); } else error ("Invalid RANGE argument to `set-char-table-range'"); @@ -2633,6 +2633,8 @@ DEFUN ("set-char-table-default", Fset_char_table_default, Sset_char_table_default, 3, 3, 0, doc: /* Set the default value in CHAR-TABLE for generic character CH to VALUE. The generic character specifies the group of characters. +If CH is a normal character, set the default value for a group of +characters to which CH belongs. See also the documentation of `make-char'. */) (char_table, ch, value) Lisp_Object char_table, ch, value; @@ -2652,27 +2654,34 @@ See also the documentation of `make-char'. */) if (! CHARSET_VALID_P (charset)) invalid_character (c); - if (charset == CHARSET_ASCII) - return (XCHAR_TABLE (char_table)->defalt = value); + if (SINGLE_BYTE_CHAR_P (c)) + { + /* We use special slots for the default values of single byte + characters. */ + int default_slot + = (c < 0x80 ? CHAR_TABLE_DEFAULT_SLOT_ASCII + : c < 0xA0 ? CHAR_TABLE_DEFAULT_SLOT_8_BIT_CONTROL + : CHAR_TABLE_DEFAULT_SLOT_8_BIT_GRAPHIC); + + return (XCHAR_TABLE (char_table)->contents[default_slot] = value); + } /* Even if C is not a generic char, we had better behave as if a generic char is specified. */ if (!CHARSET_DEFINED_P (charset) || CHARSET_DIMENSION (charset) == 1) code1 = 0; temp = XCHAR_TABLE (char_table)->contents[charset + 128]; + if (! SUB_CHAR_TABLE_P (temp)) + { + temp = make_sub_char_table (temp); + XCHAR_TABLE (char_table)->contents[charset + 128] = temp; + } if (!code1) { - if (SUB_CHAR_TABLE_P (temp)) - XCHAR_TABLE (temp)->defalt = value; - else - XCHAR_TABLE (char_table)->contents[charset + 128] = value; + XCHAR_TABLE (temp)->defalt = value; return value; } - if (SUB_CHAR_TABLE_P (temp)) - char_table = temp; - else - char_table = (XCHAR_TABLE (char_table)->contents[charset + 128] - = make_sub_char_table (temp)); + char_table = temp; temp = XCHAR_TABLE (char_table)->contents[code1]; if (SUB_CHAR_TABLE_P (temp)) XCHAR_TABLE (temp)->defalt = value;