comparison src/chartab.c @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents e121b013d1f0
children 850242ba4a81
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
588 { 588 {
589 struct Lisp_Char_Table *ct; 589 struct Lisp_Char_Table *ct;
590 Lisp_Object obj = Qnil; 590 Lisp_Object obj = Qnil;
591 enum char_table_type ty = symbol_to_char_table_type (type); 591 enum char_table_type ty = symbol_to_char_table_type (type);
592 592
593 ct = (struct Lisp_Char_Table *) 593 ct = alloc_lcrecord_type (struct Lisp_Char_Table, lrecord_char_table);
594 alloc_lcrecord (sizeof (struct Lisp_Char_Table), lrecord_char_table);
595 ct->type = ty; 594 ct->type = ty;
596 if (ty == CHAR_TABLE_TYPE_SYNTAX) 595 if (ty == CHAR_TABLE_TYPE_SYNTAX)
597 { 596 {
598 ct->mirror_table = Fmake_char_table (Qgeneric); 597 ct->mirror_table = Fmake_char_table (Qgeneric);
599 } 598 }
617 { 616 {
618 struct Lisp_Char_Table_Entry *cte; 617 struct Lisp_Char_Table_Entry *cte;
619 Lisp_Object obj = Qnil; 618 Lisp_Object obj = Qnil;
620 int i; 619 int i;
621 620
622 cte = (struct Lisp_Char_Table_Entry *) 621 cte = alloc_lcrecord_type (struct Lisp_Char_Table_Entry,
623 alloc_lcrecord (sizeof (struct Lisp_Char_Table_Entry), 622 lrecord_char_table_entry);
624 lrecord_char_table_entry);
625 for (i = 0; i < 96; i++) 623 for (i = 0; i < 96; i++)
626 cte->level2[i] = initval; 624 cte->level2[i] = initval;
627 XSETCHAR_TABLE_ENTRY (obj, cte); 625 XSETCHAR_TABLE_ENTRY (obj, cte);
628 return obj; 626 return obj;
629 } 627 }
630 628
631 static Lisp_Object 629 static Lisp_Object
632 copy_char_table_entry (Lisp_Object entry) 630 copy_char_table_entry (Lisp_Object entry)
633 { 631 {
634 struct Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (entry); 632 struct Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (entry);
635 struct Lisp_Char_Table_Entry *ctenew;
636 Lisp_Object obj = Qnil; 633 Lisp_Object obj = Qnil;
637 int i; 634 int i;
638 635 struct Lisp_Char_Table_Entry *ctenew =
639 ctenew = (struct Lisp_Char_Table_Entry *) 636 alloc_lcrecord_type (struct Lisp_Char_Table_Entry,
640 alloc_lcrecord (sizeof (struct Lisp_Char_Table_Entry), 637 lrecord_char_table_entry);
641 lrecord_char_table_entry); 638
642 for (i = 0; i < 96; i++) 639 for (i = 0; i < 96; i++)
643 { 640 {
644 Lisp_Object new = cte->level2[i]; 641 Lisp_Object new = cte->level2[i];
645 if (CHAR_TABLE_ENTRYP (new)) 642 if (CHAR_TABLE_ENTRYP (new))
646 ctenew->level2[i] = copy_char_table_entry (new); 643 ctenew->level2[i] = copy_char_table_entry (new);
665 Lisp_Object obj = Qnil; 662 Lisp_Object obj = Qnil;
666 int i; 663 int i;
667 664
668 CHECK_CHAR_TABLE (old_table); 665 CHECK_CHAR_TABLE (old_table);
669 ct = XCHAR_TABLE (old_table); 666 ct = XCHAR_TABLE (old_table);
670 ctnew = (struct Lisp_Char_Table *) 667 ctnew = alloc_lcrecord_type (struct Lisp_Char_Table, lrecord_char_table);
671 alloc_lcrecord (sizeof (struct Lisp_Char_Table), lrecord_char_table);
672 ctnew->type = ct->type; 668 ctnew->type = ct->type;
673 669
674 for (i = 0; i < NUM_ASCII_CHARS; i++) 670 for (i = 0; i < NUM_ASCII_CHARS; i++)
675 { 671 {
676 Lisp_Object new = ct->ascii[i]; 672 Lisp_Object new = ct->ascii[i];
1559 a complicated [] expression (and category lookups are significantly 1555 a complicated [] expression (and category lookups are significantly
1560 faster). 1556 faster).
1561 1557
1562 There are 95 different categories available, one for each printable 1558 There are 95 different categories available, one for each printable
1563 character (including space) in the ASCII charset. Each category 1559 character (including space) in the ASCII charset. Each category
1564 is designated by one such character, called a \"category designator\". 1560 is designated by one such character, called a "category designator".
1565 They are specified in a regexp using the syntax \"\\cX\", where X is 1561 They are specified in a regexp using the syntax "\\cX", where X is
1566 a category designator. 1562 a category designator.
1567 1563
1568 A category table specifies, for each character, the categories that 1564 A category table specifies, for each character, the categories that
1569 the character is in. Note that a character can be in more than one 1565 the character is in. Note that a character can be in more than one
1570 category. More specifically, a category table maps from a character 1566 category. More specifically, a category table maps from a character