aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1997-03-18 23:31:34 +0000
committerKenichi Handa1997-03-18 23:31:34 +0000
commit513ee44261593360bdfa5e83ff46ba5d41873a47 (patch)
tree1cb82992ffa65341063ff6cfbad15566bc8e3246 /src
parent03e66c53e14945e49e33f6526083710bad158f46 (diff)
downloademacs-513ee44261593360bdfa5e83ff46ba5d41873a47.tar.gz
emacs-513ee44261593360bdfa5e83ff46ba5d41873a47.zip
Adjusted for the change of MAX_CHARSET.
(str_cmpchar_id): Return -1 if we have no more room for a new composite character. (Fmake_char_internal): Docstring is moved to lisp/mule.el.
Diffstat (limited to 'src')
-rw-r--r--src/charset.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/src/charset.c b/src/charset.c
index 987adc3787e..7a5e0ce269b 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -80,6 +80,14 @@ int width_by_char_head[256];
80 CHARS, and FINAL-CHAR) to Emacs' charset. */ 80 CHARS, and FINAL-CHAR) to Emacs' charset. */
81int iso_charset_table[2][2][128]; 81int iso_charset_table[2][2][128];
82 82
83/* Table of pointers to the structure `cmpchar_info' indexed by
84 CMPCHAR-ID. */
85struct cmpchar_info **cmpchar_table;
86/* The current size of `cmpchar_table'. */
87static int cmpchar_table_size;
88/* Number of the current composite characters. */
89int n_cmpchars;
90
83/* Variables used locally in the macro FETCH_MULTIBYTE_CHAR. */ 91/* Variables used locally in the macro FETCH_MULTIBYTE_CHAR. */
84unsigned char *_fetch_multibyte_char_p; 92unsigned char *_fetch_multibyte_char_p;
85int _fetch_multibyte_char_len; 93int _fetch_multibyte_char_len;
@@ -293,7 +301,7 @@ update_charset_table (charset_id, dimension, chars, width, direction,
293 is set to nil. */ 301 is set to nil. */
294 int i; 302 int i;
295 303
296 for (i = 0; i < MAX_CHARSET; i++) 304 for (i = 0; i <= MAX_CHARSET; i++)
297 if (!NILP (CHARSET_TABLE_ENTRY (i))) 305 if (!NILP (CHARSET_TABLE_ENTRY (i)))
298 { 306 {
299 if (CHARSET_DIMENSION (i) == XINT (dimension) 307 if (CHARSET_DIMENSION (i) == XINT (dimension)
@@ -307,7 +315,7 @@ update_charset_table (charset_id, dimension, chars, width, direction,
307 break; 315 break;
308 } 316 }
309 } 317 }
310 if (i >= MAX_CHARSET) 318 if (i > MAX_CHARSET)
311 /* No such a charset. */ 319 /* No such a charset. */
312 CHARSET_TABLE_INFO (charset, CHARSET_REVERSE_CHARSET_IDX) 320 CHARSET_TABLE_INFO (charset, CHARSET_REVERSE_CHARSET_IDX)
313 = make_number (-1); 321 = make_number (-1);
@@ -487,7 +495,7 @@ CHARSET should be defined by `defined-charset' in advance.")
487 495
488/* Return number of different charsets in STR of length LEN. In 496/* Return number of different charsets in STR of length LEN. In
489 addition, for each found charset N, CHARSETS[N] is set 1. The 497 addition, for each found charset N, CHARSETS[N] is set 1. The
490 caller should allocate CHARSETS (MAX_CHARSET bytes) in advance. */ 498 caller should allocate CHARSETS (MAX_CHARSET + 1 bytes) in advance. */
491 499
492int 500int
493find_charset_in_str (str, len, charsets) 501find_charset_in_str (str, len, charsets)
@@ -519,7 +527,7 @@ BEG and END are buffer positions.")
519 (beg, end) 527 (beg, end)
520 Lisp_Object beg, end; 528 Lisp_Object beg, end;
521{ 529{
522 char charsets[MAX_CHARSET]; 530 char charsets[MAX_CHARSET + 1];
523 int from, to, stop, i; 531 int from, to, stop, i;
524 Lisp_Object val; 532 Lisp_Object val;
525 533
@@ -528,7 +536,7 @@ BEG and END are buffer positions.")
528 stop = to = XFASTINT (end); 536 stop = to = XFASTINT (end);
529 if (from < GPT && GPT < to) 537 if (from < GPT && GPT < to)
530 stop = GPT; 538 stop = GPT;
531 bzero (charsets, MAX_CHARSET); 539 bzero (charsets, MAX_CHARSET + 1);
532 while (1) 540 while (1)
533 { 541 {
534 find_charset_in_str (POS_ADDR (from), stop - from, charsets); 542 find_charset_in_str (POS_ADDR (from), stop - from, charsets);
@@ -538,7 +546,7 @@ BEG and END are buffer positions.")
538 break; 546 break;
539 } 547 }
540 val = Qnil; 548 val = Qnil;
541 for (i = MAX_CHARSET - 1; i >= 0; i--) 549 for (i = MAX_CHARSET; i >= 0; i--)
542 if (charsets[i]) 550 if (charsets[i])
543 val = Fcons (CHARSET_SYMBOL (i), val); 551 val = Fcons (CHARSET_SYMBOL (i), val);
544 return val; 552 return val;
@@ -550,27 +558,22 @@ DEFUN ("find-charset-string", Ffind_charset_string, Sfind_charset_string,
550 (str) 558 (str)
551 Lisp_Object str; 559 Lisp_Object str;
552{ 560{
553 char charsets[MAX_CHARSET]; 561 char charsets[MAX_CHARSET + 1];
554 int i; 562 int i;
555 Lisp_Object val; 563 Lisp_Object val;
556 564
557 CHECK_STRING (str, 0); 565 CHECK_STRING (str, 0);
558 bzero (charsets, MAX_CHARSET); 566 bzero (charsets, MAX_CHARSET + 1);
559 find_charset_in_str (XSTRING (str)->data, XSTRING (str)->size, charsets); 567 find_charset_in_str (XSTRING (str)->data, XSTRING (str)->size, charsets);
560 val = Qnil; 568 val = Qnil;
561 for (i = MAX_CHARSET - 1; i >= 0; i--) 569 for (i = MAX_CHARSET; i >= 0; i--)
562 if (charsets[i]) 570 if (charsets[i])
563 val = Fcons (CHARSET_SYMBOL (i), val); 571 val = Fcons (CHARSET_SYMBOL (i), val);
564 return val; 572 return val;
565} 573}
566 574
567DEFUN ("make-char-internal", Fmake_char_internal, Smake_char_internal, 1, 3, 0, 575DEFUN ("make-char-internal", Fmake_char_internal, Smake_char_internal, 1, 3, 0,
568 "Return a character of CHARSET and position-codes CODE1 and CODE2.\n\ 576 "")
569CODE1 and CODE2 are optional, but if you don't supply\n\
570 sufficient position-codes, return a generic character which stands for\n\
571all characters or group of characters in the character sets.\n\
572A generic character can be an argument of `modify-syntax-entry' and\n\
573`modify-category-entry'.")
574 (charset, code1, code2) 577 (charset, code1, code2)
575 Lisp_Object charset, code1, code2; 578 Lisp_Object charset, code1, code2;
576{ 579{
@@ -910,14 +913,6 @@ hash_string (ptr, len)
910} 913}
911#endif 914#endif
912 915
913/* Table of pointers to the structure `cmpchar_info' indexed by
914 CMPCHAR-ID. */
915struct cmpchar_info **cmpchar_table;
916/* The current size of `cmpchar_table'. */
917static int cmpchar_table_size;
918/* Number of the current composite characters. */
919int n_cmpchars;
920
921#define CMPCHAR_HASH_TABLE_SIZE 0xFFF 916#define CMPCHAR_HASH_TABLE_SIZE 0xFFF
922 917
923static int *cmpchar_hash_table[CMPCHAR_HASH_TABLE_SIZE]; 918static int *cmpchar_hash_table[CMPCHAR_HASH_TABLE_SIZE];
@@ -993,6 +988,10 @@ str_cmpchar_id (str, len)
993 } 988 }
994 989
995 /* We have to register the composite character in cmpchar_table. */ 990 /* We have to register the composite character in cmpchar_table. */
991 if (n_cmpchars > (CHAR_FIELD2_MASK | CHAR_FIELD3_MASK))
992 /* No, we have no more room for a new composite character. */
993 return -1;
994
996 /* Make the entry in hash table. */ 995 /* Make the entry in hash table. */
997 if (hashp == NULL) 996 if (hashp == NULL)
998 { 997 {
@@ -1345,7 +1344,7 @@ init_charset_once ()
1345 Fput (Qcharset_table, Qchar_table_extra_slots, make_number (0)); 1344 Fput (Qcharset_table, Qchar_table_extra_slots, make_number (0));
1346 Vcharset_table = Fmake_char_table (Qcharset_table, Qnil); 1345 Vcharset_table = Fmake_char_table (Qcharset_table, Qnil);
1347 1346
1348 Vcharset_symbol_table = Fmake_vector (make_number (MAX_CHARSET), Qnil); 1347 Vcharset_symbol_table = Fmake_vector (make_number (MAX_CHARSET + 1), Qnil);
1349 1348
1350 /* Setup tables. */ 1349 /* Setup tables. */
1351 for (i = 0; i < 2; i++) 1350 for (i = 0; i < 2; i++)