comparison src/chartab.c @ 5117:3742ea8250b5 ben-lisp-object ben-lisp-object-final-ws-year-2005

Checking in final CVS version of workspace 'ben-lisp-object'
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 00:20:27 -0600
parents facf3239ba30
children e0db3c197671
comparison
equal deleted inserted replaced
5116:e56f73345619 5117:3742ea8250b5
136 static const struct memory_description char_table_entry_description[] = { 136 static const struct memory_description char_table_entry_description[] = {
137 { XD_LISP_OBJECT_ARRAY, offsetof (Lisp_Char_Table_Entry, level2), 96 }, 137 { XD_LISP_OBJECT_ARRAY, offsetof (Lisp_Char_Table_Entry, level2), 96 },
138 { XD_END } 138 { XD_END }
139 }; 139 };
140 140
141 DEFINE_LRECORD_IMPLEMENTATION ("char-table-entry", char_table_entry, 141 DEFINE_LISP_OBJECT ("char-table-entry", char_table_entry,
142 1, /* dumpable flag */ 142 mark_char_table_entry, 0,
143 mark_char_table_entry, internal_object_printer, 143 0, char_table_entry_equal,
144 0, char_table_entry_equal, 144 char_table_entry_hash,
145 char_table_entry_hash, 145 char_table_entry_description,
146 char_table_entry_description, 146 Lisp_Char_Table_Entry);
147 Lisp_Char_Table_Entry);
148 147
149 #endif /* MULE */ 148 #endif /* MULE */
150 149
151 static Lisp_Object 150 static Lisp_Object
152 mark_char_table (Lisp_Object obj) 151 mark_char_table (Lisp_Object obj)
390 { XD_LISP_OBJECT, offsetof (Lisp_Char_Table, mirror_table) }, 389 { XD_LISP_OBJECT, offsetof (Lisp_Char_Table, mirror_table) },
391 { XD_LO_LINK, offsetof (Lisp_Char_Table, next_table) }, 390 { XD_LO_LINK, offsetof (Lisp_Char_Table, next_table) },
392 { XD_END } 391 { XD_END }
393 }; 392 };
394 393
395 DEFINE_LRECORD_IMPLEMENTATION ("char-table", char_table, 394 DEFINE_LISP_OBJECT ("char-table", char_table,
396 1, /*dumpable-flag*/ 395 mark_char_table, print_char_table, 0,
397 mark_char_table, print_char_table, 0,
398 char_table_equal, char_table_hash, 396 char_table_equal, char_table_hash,
399 char_table_description, 397 char_table_description,
400 Lisp_Char_Table); 398 Lisp_Char_Table);
401 399
402 DEFUN ("char-table-p", Fchar_table_p, 1, 1, 0, /* 400 DEFUN ("char-table-p", Fchar_table_p, 1, 1, 0, /*
586 character. Higher-level Lisp functions are provided for 584 character. Higher-level Lisp functions are provided for
587 working with syntax tables. The valid values are integers. 585 working with syntax tables. The valid values are integers.
588 */ 586 */
589 (type)) 587 (type))
590 { 588 {
591 Lisp_Char_Table *ct; 589 Lisp_Object obj = ALLOC_LISP_OBJECT (char_table);
592 Lisp_Object obj; 590 Lisp_Char_Table *ct = XCHAR_TABLE (obj);
593 enum char_table_type ty = symbol_to_char_table_type (type); 591 enum char_table_type ty = symbol_to_char_table_type (type);
594 592
595 ct = ALLOC_LCRECORD_TYPE (Lisp_Char_Table, &lrecord_char_table);
596 ct->type = ty; 593 ct->type = ty;
597 obj = wrap_char_table (ct);
598 if (ty == CHAR_TABLE_TYPE_SYNTAX) 594 if (ty == CHAR_TABLE_TYPE_SYNTAX)
599 { 595 {
600 /* Qgeneric not Qsyntax because a syntax table has a mirror table 596 /* Qgeneric not Qsyntax because a syntax table has a mirror table
601 and we don't want infinite recursion */ 597 and we don't want infinite recursion */
602 ct->mirror_table = Fmake_char_table (Qgeneric); 598 ct->mirror_table = Fmake_char_table (Qgeneric);
622 618
623 static Lisp_Object 619 static Lisp_Object
624 make_char_table_entry (Lisp_Object initval) 620 make_char_table_entry (Lisp_Object initval)
625 { 621 {
626 int i; 622 int i;
627 Lisp_Char_Table_Entry *cte = 623 Lisp_Object obj = ALLOC_LISP_OBJECT (char_table_entry);
628 ALLOC_LCRECORD_TYPE (Lisp_Char_Table_Entry, &lrecord_char_table_entry); 624 Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (obj);
629 625
630 for (i = 0; i < 96; i++) 626 for (i = 0; i < 96; i++)
631 cte->level2[i] = initval; 627 cte->level2[i] = initval;
632 628
633 return wrap_char_table_entry (cte); 629 return obj;
634 } 630 }
635 631
636 static Lisp_Object 632 static Lisp_Object
637 copy_char_table_entry (Lisp_Object entry) 633 copy_char_table_entry (Lisp_Object entry)
638 { 634 {
639 Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (entry); 635 Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (entry);
640 int i; 636 int i;
641 Lisp_Char_Table_Entry *ctenew = 637 Lisp_Object obj = ALLOC_LISP_OBJECT (char_table_entry);
642 ALLOC_LCRECORD_TYPE (Lisp_Char_Table_Entry, &lrecord_char_table_entry); 638 Lisp_Char_Table_Entry *ctenew = XCHAR_TABLE_ENTRY (obj);
643 639
644 for (i = 0; i < 96; i++) 640 for (i = 0; i < 96; i++)
645 { 641 {
646 Lisp_Object new_ = cte->level2[i]; 642 Lisp_Object new_ = cte->level2[i];
647 if (CHAR_TABLE_ENTRYP (new_)) 643 if (CHAR_TABLE_ENTRYP (new_))
648 ctenew->level2[i] = copy_char_table_entry (new_); 644 ctenew->level2[i] = copy_char_table_entry (new_);
649 else 645 else
650 ctenew->level2[i] = new_; 646 ctenew->level2[i] = new_;
651 } 647 }
652 648
653 return wrap_char_table_entry (ctenew); 649 return obj;
654 } 650 }
655 651
656 #endif /* MULE */ 652 #endif /* MULE */
657 653
658 DEFUN ("copy-char-table", Fcopy_char_table, 1, 1, 0, /* 654 DEFUN ("copy-char-table", Fcopy_char_table, 1, 1, 0, /*
666 Lisp_Object obj; 662 Lisp_Object obj;
667 int i; 663 int i;
668 664
669 CHECK_CHAR_TABLE (char_table); 665 CHECK_CHAR_TABLE (char_table);
670 ct = XCHAR_TABLE (char_table); 666 ct = XCHAR_TABLE (char_table);
671 ctnew = ALLOC_LCRECORD_TYPE (Lisp_Char_Table, &lrecord_char_table); 667 obj = ALLOC_LISP_OBJECT (char_table);
668 ctnew = XCHAR_TABLE (obj);
672 ctnew->type = ct->type; 669 ctnew->type = ct->type;
673 ctnew->parent = ct->parent; 670 ctnew->parent = ct->parent;
674 ctnew->default_ = ct->default_; 671 ctnew->default_ = ct->default_;
675 ctnew->mirror_table_p = ct->mirror_table_p; 672 ctnew->mirror_table_p = ct->mirror_table_p;
676 obj = wrap_char_table (ctnew);
677 673
678 for (i = 0; i < NUM_ASCII_CHARS; i++) 674 for (i = 0; i < NUM_ASCII_CHARS; i++)
679 { 675 {
680 Lisp_Object new_ = ct->ascii[i]; 676 Lisp_Object new_ = ct->ascii[i];
681 #ifdef MULE 677 #ifdef MULE
1815 1811
1816 1812
1817 void 1813 void
1818 syms_of_chartab (void) 1814 syms_of_chartab (void)
1819 { 1815 {
1820 INIT_LRECORD_IMPLEMENTATION (char_table); 1816 INIT_LISP_OBJECT (char_table);
1821 1817
1822 #ifdef MULE 1818 #ifdef MULE
1823 INIT_LRECORD_IMPLEMENTATION (char_table_entry); 1819 INIT_LISP_OBJECT (char_table_entry);
1824 1820
1825 DEFSYMBOL (Qcategory_table_p); 1821 DEFSYMBOL (Qcategory_table_p);
1826 DEFSYMBOL (Qcategory_designator_p); 1822 DEFSYMBOL (Qcategory_designator_p);
1827 DEFSYMBOL (Qcategory_table_value_p); 1823 DEFSYMBOL (Qcategory_table_value_p);
1828 #endif /* MULE */ 1824 #endif /* MULE */