comparison src/chartab.c @ 380:8626e4521993 r21-2-5

Import from CVS: tag r21-2-5
author cvs
date Mon, 13 Aug 2007 11:07:10 +0200
parents d883f39b8495
children 74fd4e045ea6
comparison
equal deleted inserted replaced
379:76b7d63099ad 380:8626e4521993
36 #include <config.h> 36 #include <config.h>
37 #include "lisp.h" 37 #include "lisp.h"
38 38
39 #include "buffer.h" 39 #include "buffer.h"
40 #include "chartab.h" 40 #include "chartab.h"
41 #include "commands.h"
42 #include "syntax.h" 41 #include "syntax.h"
43 42
44 Lisp_Object Qchar_tablep, Qchar_table; 43 Lisp_Object Qchar_tablep, Qchar_table;
45 44
46 Lisp_Object Vall_syntax_tables; 45 Lisp_Object Vall_syntax_tables;
96 struct Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (obj); 95 struct Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (obj);
97 int i; 96 int i;
98 97
99 for (i = 0; i < 96; i++) 98 for (i = 0; i < 96; i++)
100 { 99 {
101 (markobj) (cte->level2[i]); 100 markobj (cte->level2[i]);
102 } 101 }
103 return Qnil; 102 return Qnil;
104 } 103 }
105 104
106 static int 105 static int
137 { 136 {
138 struct Lisp_Char_Table *ct = XCHAR_TABLE (obj); 137 struct Lisp_Char_Table *ct = XCHAR_TABLE (obj);
139 int i; 138 int i;
140 139
141 for (i = 0; i < NUM_ASCII_CHARS; i++) 140 for (i = 0; i < NUM_ASCII_CHARS; i++)
142 (markobj) (ct->ascii[i]); 141 markobj (ct->ascii[i]);
143 #ifdef MULE 142 #ifdef MULE
144 for (i = 0; i < NUM_LEADING_BYTES; i++) 143 for (i = 0; i < NUM_LEADING_BYTES; i++)
145 (markobj) (ct->level1[i]); 144 markobj (ct->level1[i]);
146 #endif 145 #endif
147 return ct->mirror_table; 146 return ct->mirror_table;
148 } 147 }
149 148
150 /* WARNING: All functions of this nature need to be written extremely 149 /* WARNING: All functions of this nature need to be written extremely
151 carefully to avoid crashes during GC. Cf. prune_specifiers() 150 carefully to avoid crashes during GC. Cf. prune_specifiers()
152 and prune_weak_hashtables(). */ 151 and prune_weak_hash_tables(). */
153 152
154 void 153 void
155 prune_syntax_tables (int (*obj_marked_p) (Lisp_Object)) 154 prune_syntax_tables (int (*obj_marked_p) (Lisp_Object))
156 { 155 {
157 Lisp_Object rest, prev = Qnil; 156 Lisp_Object rest, prev = Qnil;
158 157
159 for (rest = Vall_syntax_tables; 158 for (rest = Vall_syntax_tables;
160 !GC_NILP (rest); 159 !GC_NILP (rest);
161 rest = XCHAR_TABLE (rest)->next_table) 160 rest = XCHAR_TABLE (rest)->next_table)
162 { 161 {
163 if (! ((*obj_marked_p) (rest))) 162 if (! obj_marked_p (rest))
164 { 163 {
165 /* This table is garbage. Remove it from the list. */ 164 /* This table is garbage. Remove it from the list. */
166 if (GC_NILP (prev)) 165 if (GC_NILP (prev))
167 Vall_syntax_tables = XCHAR_TABLE (rest)->next_table; 166 Vall_syntax_tables = XCHAR_TABLE (rest)->next_table;
168 else 167 else
175 static Lisp_Object 174 static Lisp_Object
176 char_table_type_to_symbol (enum char_table_type type) 175 char_table_type_to_symbol (enum char_table_type type)
177 { 176 {
178 switch (type) 177 switch (type)
179 { 178 {
179 default: abort();
180 case CHAR_TABLE_TYPE_GENERIC: return Qgeneric; 180 case CHAR_TABLE_TYPE_GENERIC: return Qgeneric;
181 case CHAR_TABLE_TYPE_SYNTAX: return Qsyntax; 181 case CHAR_TABLE_TYPE_SYNTAX: return Qsyntax;
182 case CHAR_TABLE_TYPE_DISPLAY: return Qdisplay; 182 case CHAR_TABLE_TYPE_DISPLAY: return Qdisplay;
183 case CHAR_TABLE_TYPE_CHAR: return Qchar; 183 case CHAR_TABLE_TYPE_CHAR: return Qchar;
184 #ifdef MULE 184 #ifdef MULE
185 case CHAR_TABLE_TYPE_CATEGORY: return Qcategory; 185 case CHAR_TABLE_TYPE_CATEGORY: return Qcategory;
186 #endif 186 #endif
187 } 187 }
188
189 abort ();
190 return Qnil; /* not reached */
191 } 188 }
192 189
193 static enum char_table_type 190 static enum char_table_type
194 symbol_to_char_table_type (Lisp_Object symbol) 191 symbol_to_char_table_type (Lisp_Object symbol)
195 { 192 {