comparison src/rangetab.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 1e7cc382eb16
children e0db3c197671
comparison
equal deleted inserted replaced
5116:e56f73345619 5117:3742ea8250b5
217 { XD_BLOCK_PTR, offsetof (Lisp_Range_Table, entries), 1, 217 { XD_BLOCK_PTR, offsetof (Lisp_Range_Table, entries), 1,
218 { &rted_description } }, 218 { &rted_description } },
219 { XD_END } 219 { XD_END }
220 }; 220 };
221 221
222 DEFINE_LRECORD_IMPLEMENTATION ("range-table", range_table, 222 DEFINE_LISP_OBJECT ("range-table", range_table,
223 1, /*dumpable-flag*/ 223 mark_range_table, print_range_table, 0,
224 mark_range_table, print_range_table, 0,
225 range_table_equal, range_table_hash, 224 range_table_equal, range_table_hash,
226 range_table_description, 225 range_table_description,
227 Lisp_Range_Table); 226 Lisp_Range_Table);
228 227
229 /************************************************************************/ 228 /************************************************************************/
326 there would be eight days. Similarly, there are 15 (= 20 - 5) elements in 325 there would be eight days. Similarly, there are 15 (= 20 - 5) elements in
327 the range [5, 20), but 16 in the range [5, 20]. 326 the range [5, 20), but 16 in the range [5, 20].
328 */ 327 */
329 (type)) 328 (type))
330 { 329 {
331 Lisp_Range_Table *rt = ALLOC_LCRECORD_TYPE (Lisp_Range_Table, 330 Lisp_Object obj = ALLOC_LISP_OBJECT (range_table);
332 &lrecord_range_table); 331 Lisp_Range_Table *rt = XRANGE_TABLE (obj);
333 rt->entries = Dynarr_new (range_table_entry); 332 rt->entries = Dynarr_new (range_table_entry);
334 rt->type = range_table_symbol_to_type (type); 333 rt->type = range_table_symbol_to_type (type);
335 return wrap_range_table (rt); 334 return obj;
336 } 335 }
337 336
338 DEFUN ("copy-range-table", Fcopy_range_table, 1, 1, 0, /* 337 DEFUN ("copy-range-table", Fcopy_range_table, 1, 1, 0, /*
339 Return a new range table which is a copy of RANGE-TABLE. 338 Return a new range table which is a copy of RANGE-TABLE.
340 It will contain the same values for the same ranges as RANGE-TABLE. 339 It will contain the same values for the same ranges as RANGE-TABLE.
341 The values will not themselves be copied. 340 The values will not themselves be copied.
342 */ 341 */
343 (range_table)) 342 (range_table))
344 { 343 {
345 Lisp_Range_Table *rt, *rtnew; 344 Lisp_Range_Table *rt, *rtnew;
345 Lisp_Object obj;
346 346
347 CHECK_RANGE_TABLE (range_table); 347 CHECK_RANGE_TABLE (range_table);
348 rt = XRANGE_TABLE (range_table); 348 rt = XRANGE_TABLE (range_table);
349 349
350 rtnew = ALLOC_LCRECORD_TYPE (Lisp_Range_Table, &lrecord_range_table); 350 obj = ALLOC_LISP_OBJECT (range_table);
351 rtnew = XRANGE_TABLE (obj);
351 rtnew->entries = Dynarr_new (range_table_entry); 352 rtnew->entries = Dynarr_new (range_table_entry);
352 rtnew->type = rt->type; 353 rtnew->type = rt->type;
353 354
354 Dynarr_add_many (rtnew->entries, Dynarr_atp (rt->entries, 0), 355 Dynarr_add_many (rtnew->entries, Dynarr_atp (rt->entries, 0),
355 Dynarr_length (rt->entries)); 356 Dynarr_length (rt->entries));
356 return wrap_range_table (rtnew); 357 return obj;
357 } 358 }
358 359
359 DEFUN ("get-range-table", Fget_range_table, 2, 3, 0, /* 360 DEFUN ("get-range-table", Fget_range_table, 2, 3, 0, /*
360 Find value for position POS in RANGE-TABLE. 361 Find value for position POS in RANGE-TABLE.
361 If there is no corresponding value, return DEFAULT (defaults to nil). 362 If there is no corresponding value, return DEFAULT (defaults to nil).
877 /************************************************************************/ 878 /************************************************************************/
878 879
879 void 880 void
880 syms_of_rangetab (void) 881 syms_of_rangetab (void)
881 { 882 {
882 INIT_LRECORD_IMPLEMENTATION (range_table); 883 INIT_LISP_OBJECT (range_table);
883 884
884 DEFSYMBOL_MULTIWORD_PREDICATE (Qrange_tablep); 885 DEFSYMBOL_MULTIWORD_PREDICATE (Qrange_tablep);
885 DEFSYMBOL (Qrange_table); 886 DEFSYMBOL (Qrange_table);
886 887
887 DEFSYMBOL (Qstart_closed_end_open); 888 DEFSYMBOL (Qstart_closed_end_open);