Mercurial > hg > xemacs-beta
comparison src/rangetab.c @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 3d6bfa290dbd |
children | 7df0dd720c89 |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
63 | 63 |
64 /* We use a sorted array of ranges. | 64 /* We use a sorted array of ranges. |
65 | 65 |
66 #### We should be using the gap array stuff from extents.c. This | 66 #### We should be using the gap array stuff from extents.c. This |
67 is not hard but just requires moving that stuff out of that file. */ | 67 is not hard but just requires moving that stuff out of that file. */ |
68 | |
69 static Lisp_Object mark_range_table (Lisp_Object, void (*) (Lisp_Object)); | |
70 static void print_range_table (Lisp_Object, Lisp_Object, int); | |
71 static int range_table_equal (Lisp_Object, Lisp_Object, int depth); | |
72 static unsigned long range_table_hash (Lisp_Object obj, int depth); | |
73 DEFINE_LRECORD_IMPLEMENTATION ("range-table", range_table, | |
74 mark_range_table, print_range_table, 0, | |
75 range_table_equal, range_table_hash, | |
76 struct Lisp_Range_Table); | |
77 | 68 |
78 static Lisp_Object | 69 static Lisp_Object |
79 mark_range_table (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 70 mark_range_table (Lisp_Object obj, void (*markobj) (Lisp_Object)) |
80 { | 71 { |
81 struct Lisp_Range_Table *rt = XRANGE_TABLE (obj); | 72 struct Lisp_Range_Table *rt = XRANGE_TABLE (obj); |
162 noise factor from the points chosen below. */ | 153 noise factor from the points chosen below. */ |
163 for (i = 0; i < 5; i++) | 154 for (i = 0; i < 5; i++) |
164 hash = HASH2 (hash, range_table_entry_hash (Dynarr_atp (rt->entries, | 155 hash = HASH2 (hash, range_table_entry_hash (Dynarr_atp (rt->entries, |
165 i*size/5), | 156 i*size/5), |
166 depth)); | 157 depth)); |
167 | |
168 return hash; | 158 return hash; |
169 } | 159 } |
170 | 160 |
161 DEFINE_LRECORD_IMPLEMENTATION ("range-table", range_table, | |
162 mark_range_table, print_range_table, 0, | |
163 range_table_equal, range_table_hash, | |
164 struct Lisp_Range_Table); | |
171 | 165 |
172 /************************************************************************/ | 166 /************************************************************************/ |
173 /* Range table operations */ | 167 /* Range table operations */ |
174 /************************************************************************/ | 168 /************************************************************************/ |
175 | 169 |
230 { | 224 { |
231 return RANGE_TABLEP (object) ? Qt : Qnil; | 225 return RANGE_TABLEP (object) ? Qt : Qnil; |
232 } | 226 } |
233 | 227 |
234 DEFUN ("make-range-table", Fmake_range_table, 0, 0, 0, /* | 228 DEFUN ("make-range-table", Fmake_range_table, 0, 0, 0, /* |
235 Make a new, empty range table. | 229 Return a new, empty range table. |
236 You can manipulate it using `put-range-table', `get-range-table', | 230 You can manipulate it using `put-range-table', `get-range-table', |
237 `remove-range-table', and `clear-range-table'. | 231 `remove-range-table', and `clear-range-table'. |
238 */ | 232 */ |
239 ()) | 233 ()) |
240 { | 234 { |
251 ranges as the given table. The values will not themselves be copied. | 245 ranges as the given table. The values will not themselves be copied. |
252 */ | 246 */ |
253 (old_table)) | 247 (old_table)) |
254 { | 248 { |
255 struct Lisp_Range_Table *rt, *rtnew; | 249 struct Lisp_Range_Table *rt, *rtnew; |
256 Lisp_Object obj = Qnil; | 250 Lisp_Object obj; |
257 | 251 |
258 CHECK_RANGE_TABLE (old_table); | 252 CHECK_RANGE_TABLE (old_table); |
259 rt = XRANGE_TABLE (old_table); | 253 rt = XRANGE_TABLE (old_table); |
260 | 254 |
261 rtnew = alloc_lcrecord_type (struct Lisp_Range_Table, lrecord_range_table); | 255 rtnew = alloc_lcrecord_type (struct Lisp_Range_Table, lrecord_range_table); |