Mercurial > hg > xemacs-beta
comparison src/chartab.c @ 424:11054d720c21 r21-2-20
Import from CVS: tag r21-2-20
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:26:11 +0200 |
parents | 41dbb7a9d5f2 |
children |
comparison
equal
deleted
inserted
replaced
423:28d9c139be4c | 424:11054d720c21 |
---|---|
93 /************************************************************************/ | 93 /************************************************************************/ |
94 | 94 |
95 #ifdef MULE | 95 #ifdef MULE |
96 | 96 |
97 static Lisp_Object | 97 static Lisp_Object |
98 mark_char_table_entry (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 98 mark_char_table_entry (Lisp_Object obj) |
99 { | 99 { |
100 struct Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (obj); | 100 struct Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (obj); |
101 int i; | 101 int i; |
102 | 102 |
103 for (i = 0; i < 96; i++) | 103 for (i = 0; i < 96; i++) |
104 { | 104 { |
105 markobj (cte->level2[i]); | 105 mark_object (cte->level2[i]); |
106 } | 106 } |
107 return Qnil; | 107 return Qnil; |
108 } | 108 } |
109 | 109 |
110 static int | 110 static int |
141 char_table_entry_description, | 141 char_table_entry_description, |
142 struct Lisp_Char_Table_Entry); | 142 struct Lisp_Char_Table_Entry); |
143 #endif /* MULE */ | 143 #endif /* MULE */ |
144 | 144 |
145 static Lisp_Object | 145 static Lisp_Object |
146 mark_char_table (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 146 mark_char_table (Lisp_Object obj) |
147 { | 147 { |
148 struct Lisp_Char_Table *ct = XCHAR_TABLE (obj); | 148 struct Lisp_Char_Table *ct = XCHAR_TABLE (obj); |
149 int i; | 149 int i; |
150 | 150 |
151 for (i = 0; i < NUM_ASCII_CHARS; i++) | 151 for (i = 0; i < NUM_ASCII_CHARS; i++) |
152 markobj (ct->ascii[i]); | 152 mark_object (ct->ascii[i]); |
153 #ifdef MULE | 153 #ifdef MULE |
154 for (i = 0; i < NUM_LEADING_BYTES; i++) | 154 for (i = 0; i < NUM_LEADING_BYTES; i++) |
155 markobj (ct->level1[i]); | 155 mark_object (ct->level1[i]); |
156 #endif | 156 #endif |
157 return ct->mirror_table; | 157 return ct->mirror_table; |
158 } | 158 } |
159 | 159 |
160 /* WARNING: All functions of this nature need to be written extremely | 160 /* WARNING: All functions of this nature need to be written extremely |
161 carefully to avoid crashes during GC. Cf. prune_specifiers() | 161 carefully to avoid crashes during GC. Cf. prune_specifiers() |
162 and prune_weak_hash_tables(). */ | 162 and prune_weak_hash_tables(). */ |
163 | 163 |
164 void | 164 void |
165 prune_syntax_tables (int (*obj_marked_p) (Lisp_Object)) | 165 prune_syntax_tables (void) |
166 { | 166 { |
167 Lisp_Object rest, prev = Qnil; | 167 Lisp_Object rest, prev = Qnil; |
168 | 168 |
169 for (rest = Vall_syntax_tables; | 169 for (rest = Vall_syntax_tables; |
170 !GC_NILP (rest); | 170 !NILP (rest); |
171 rest = XCHAR_TABLE (rest)->next_table) | 171 rest = XCHAR_TABLE (rest)->next_table) |
172 { | 172 { |
173 if (! obj_marked_p (rest)) | 173 if (! marked_p (rest)) |
174 { | 174 { |
175 /* This table is garbage. Remove it from the list. */ | 175 /* This table is garbage. Remove it from the list. */ |
176 if (GC_NILP (prev)) | 176 if (NILP (prev)) |
177 Vall_syntax_tables = XCHAR_TABLE (rest)->next_table; | 177 Vall_syntax_tables = XCHAR_TABLE (rest)->next_table; |
178 else | 178 else |
179 XCHAR_TABLE (prev)->next_table = | 179 XCHAR_TABLE (prev)->next_table = |
180 XCHAR_TABLE (rest)->next_table; | 180 XCHAR_TABLE (rest)->next_table; |
181 } | 181 } |
429 static const struct lrecord_description char_table_description[] = { | 429 static const struct lrecord_description char_table_description[] = { |
430 { XD_LISP_OBJECT, offsetof(struct Lisp_Char_Table, ascii), NUM_ASCII_CHARS }, | 430 { XD_LISP_OBJECT, offsetof(struct Lisp_Char_Table, ascii), NUM_ASCII_CHARS }, |
431 #ifdef MULE | 431 #ifdef MULE |
432 { XD_LISP_OBJECT, offsetof(struct Lisp_Char_Table, level1), NUM_LEADING_BYTES }, | 432 { XD_LISP_OBJECT, offsetof(struct Lisp_Char_Table, level1), NUM_LEADING_BYTES }, |
433 #endif | 433 #endif |
434 { XD_LISP_OBJECT, offsetof(struct Lisp_Char_Table, mirror_table), 1 }, | |
435 { XD_LO_LINK, offsetof(struct Lisp_Char_Table, next_table) }, | |
434 { XD_END } | 436 { XD_END } |
435 }; | 437 }; |
436 | 438 |
437 DEFINE_LRECORD_IMPLEMENTATION ("char-table", char_table, | 439 DEFINE_LRECORD_IMPLEMENTATION ("char-table", char_table, |
438 mark_char_table, print_char_table, 0, | 440 mark_char_table, print_char_table, 0, |
705 | 707 |
706 if (CHAR_TABLEP (ct->mirror_table)) | 708 if (CHAR_TABLEP (ct->mirror_table)) |
707 ctnew->mirror_table = Fcopy_char_table (ct->mirror_table); | 709 ctnew->mirror_table = Fcopy_char_table (ct->mirror_table); |
708 else | 710 else |
709 ctnew->mirror_table = ct->mirror_table; | 711 ctnew->mirror_table = ct->mirror_table; |
712 ctnew->next_table = Qnil; | |
710 XSETCHAR_TABLE (obj, ctnew); | 713 XSETCHAR_TABLE (obj, ctnew); |
714 if (ctnew->type == CHAR_TABLE_TYPE_SYNTAX) | |
715 { | |
716 ctnew->next_table = Vall_syntax_tables; | |
717 Vall_syntax_tables = obj; | |
718 } | |
711 return obj; | 719 return obj; |
712 } | 720 } |
713 | 721 |
714 static void | 722 static void |
715 decode_char_table_range (Lisp_Object range, struct chartab_range *outrange) | 723 decode_char_table_range (Lisp_Object range, struct chartab_range *outrange) |
1729 return CATEGORY_TABLE_VALUEP (obj) ? Qt : Qnil; | 1737 return CATEGORY_TABLE_VALUEP (obj) ? Qt : Qnil; |
1730 } | 1738 } |
1731 | 1739 |
1732 | 1740 |
1733 #define CATEGORYP(x) \ | 1741 #define CATEGORYP(x) \ |
1734 (CHARP ((x)) && XCHAR ((x)) >= 0x20 && XCHAR ((x)) <= 0x7E) | 1742 (CHARP (x) && XCHAR (x) >= 0x20 && XCHAR (x) <= 0x7E) |
1735 | 1743 |
1736 #define CATEGORY_SET(c) \ | 1744 #define CATEGORY_SET(c) \ |
1737 (get_char_table(c, XCHAR_TABLE(current_buffer->category_table))) | 1745 (get_char_table(c, XCHAR_TABLE(current_buffer->category_table))) |
1738 | 1746 |
1739 /* Return 1 if CATEGORY_SET contains CATEGORY, else return 0. | 1747 /* Return 1 if CATEGORY_SET contains CATEGORY, else return 0. |
1744 /* Return 1 if there is a word boundary between two word-constituent | 1752 /* Return 1 if there is a word boundary between two word-constituent |
1745 characters C1 and C2 if they appear in this order, else return 0. | 1753 characters C1 and C2 if they appear in this order, else return 0. |
1746 Use the macro WORD_BOUNDARY_P instead of calling this function | 1754 Use the macro WORD_BOUNDARY_P instead of calling this function |
1747 directly. */ | 1755 directly. */ |
1748 | 1756 |
1757 int word_boundary_p (Emchar c1, Emchar c2); | |
1749 int | 1758 int |
1750 word_boundary_p (Emchar c1, Emchar c2) | 1759 word_boundary_p (Emchar c1, Emchar c2) |
1751 { | 1760 { |
1752 Lisp_Object category_set1, category_set2; | 1761 Lisp_Object category_set1, category_set2; |
1753 Lisp_Object tail; | 1762 Lisp_Object tail; |
1837 void | 1846 void |
1838 vars_of_chartab (void) | 1847 vars_of_chartab (void) |
1839 { | 1848 { |
1840 /* DO NOT staticpro this. It works just like Vweak_hash_tables. */ | 1849 /* DO NOT staticpro this. It works just like Vweak_hash_tables. */ |
1841 Vall_syntax_tables = Qnil; | 1850 Vall_syntax_tables = Qnil; |
1851 pdump_wire_list (&Vall_syntax_tables); | |
1842 } | 1852 } |
1843 | 1853 |
1844 void | 1854 void |
1845 structure_type_create_chartab (void) | 1855 structure_type_create_chartab (void) |
1846 { | 1856 { |