comparison src/rangetab.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 376386a54a3c
children 8eaf7971accc
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
220 } 220 }
221 221
222 return defalt; 222 return defalt;
223 } 223 }
224 224
225 DEFUN ("range-table-p", Frange_table_p, Srange_table_p, 1, 1, 0 /* 225 DEFUN ("range-table-p", Frange_table_p, 1, 1, 0, /*
226 Return non-nil if OBJECT is a range table. 226 Return non-nil if OBJECT is a range table.
227 */ ) 227 */
228 (object) 228 (object))
229 Lisp_Object object;
230 { 229 {
231 return (RANGE_TABLEP (object) ? Qt : Qnil); 230 return (RANGE_TABLEP (object) ? Qt : Qnil);
232 } 231 }
233 232
234 DEFUN ("make-range-table", Fmake_range_table, Smake_range_table, 0, 0, 0 /* 233 DEFUN ("make-range-table", Fmake_range_table, 0, 0, 0, /*
235 Make a new, empty range table. 234 Make a new, empty range table.
236 You can manipulate it using `put-range-table', `get-range-table', 235 You can manipulate it using `put-range-table', `get-range-table',
237 `remove-range-table', and `clear-range-table'. 236 `remove-range-table', and `clear-range-table'.
238 */ ) 237 */
239 () 238 ())
240 { 239 {
241 struct Lisp_Range_Table *rt; 240 struct Lisp_Range_Table *rt;
242 Lisp_Object obj; 241 Lisp_Object obj;
243 242
244 rt = (struct Lisp_Range_Table *) 243 rt = (struct Lisp_Range_Table *)
246 rt->entries = Dynarr_new (struct range_table_entry); 245 rt->entries = Dynarr_new (struct range_table_entry);
247 XSETRANGE_TABLE (obj, rt); 246 XSETRANGE_TABLE (obj, rt);
248 return obj; 247 return obj;
249 } 248 }
250 249
251 DEFUN ("copy-range-table", Fcopy_range_table, Scopy_range_table, 1, 1, 0 /* 250 DEFUN ("copy-range-table", Fcopy_range_table, 1, 1, 0, /*
252 Make a new range table which contains the same values for the same 251 Make a new range table which contains the same values for the same
253 ranges as the given table. The values will not themselves be copied. 252 ranges as the given table. The values will not themselves be copied.
254 */ ) 253 */
255 (old_table) 254 (old_table))
256 Lisp_Object old_table;
257 { 255 {
258 struct Lisp_Range_Table *rt, *rtnew; 256 struct Lisp_Range_Table *rt, *rtnew;
259 Lisp_Object obj = Qnil; 257 Lisp_Object obj = Qnil;
260 258
261 CHECK_RANGE_TABLE (old_table); 259 CHECK_RANGE_TABLE (old_table);
268 Dynarr_length (rt->entries)); 266 Dynarr_length (rt->entries));
269 XSETRANGE_TABLE (obj, rtnew); 267 XSETRANGE_TABLE (obj, rtnew);
270 return obj; 268 return obj;
271 } 269 }
272 270
273 DEFUN ("get-range-table", Fget_range_table, Sget_range_table, 2, 3, 0 /* 271 DEFUN ("get-range-table", Fget_range_table, 2, 3, 0, /*
274 Find value for position POS in TABLE. 272 Find value for position POS in TABLE.
275 If there is no corresponding value, return DEFAULT (defaults to nil). 273 If there is no corresponding value, return DEFAULT (defaults to nil).
276 */ ) 274 */
277 (pos, table, defalt) 275 (pos, table, defalt))
278 Lisp_Object pos, table, defalt;/* Man kann in C nicht selber buchstabieren */
279 { 276 {
280 struct Lisp_Range_Table *rt; 277 struct Lisp_Range_Table *rt;
281 EMACS_INT po; 278 EMACS_INT po;
282 279
283 CHECK_RANGE_TABLE (table); 280 CHECK_RANGE_TABLE (table);
412 Dynarr_delete_many (rt->entries, insert_me_here, 1); 409 Dynarr_delete_many (rt->entries, insert_me_here, 1);
413 } 410 }
414 } 411 }
415 } 412 }
416 413
417 DEFUN ("put-range-table", Fput_range_table, Sput_range_table, 4, 4, 0 /* 414 DEFUN ("put-range-table", Fput_range_table, 4, 4, 0, /*
418 Set the value for range (START, END) to be VAL in TABLE. 415 Set the value for range (START, END) to be VAL in TABLE.
419 */ ) 416 */
420 (start, end, val, table) 417 (start, end, val, table))
421 Lisp_Object start, end, val, table;
422 { 418 {
423 EMACS_INT first, last; 419 EMACS_INT first, last;
424 420
425 CHECK_RANGE_TABLE (table); 421 CHECK_RANGE_TABLE (table);
426 CHECK_INT_COERCE_CHAR (start); 422 CHECK_INT_COERCE_CHAR (start);
433 put_range_table (table, first, last, val); 429 put_range_table (table, first, last, val);
434 verify_range_table (XRANGE_TABLE (table)); 430 verify_range_table (XRANGE_TABLE (table));
435 return Qnil; 431 return Qnil;
436 } 432 }
437 433
438 DEFUN ("remove-range-table", Fremove_range_table, Sremove_range_table, 3, 3, 0 /* 434 DEFUN ("remove-range-table", Fremove_range_table, 3, 3, 0, /*
439 Remove the value for range (START, END) in TABLE. 435 Remove the value for range (START, END) in TABLE.
440 */ ) 436 */
441 (start, end, table) 437 (start, end, table))
442 Lisp_Object start, end, table;
443 { 438 {
444 return Fput_range_table (start, end, Qunbound, table); 439 return Fput_range_table (start, end, Qunbound, table);
445 } 440 }
446 441
447 DEFUN ("clear-range-table", Fclear_range_table, Sclear_range_table, 1, 1, 0 /* 442 DEFUN ("clear-range-table", Fclear_range_table, 1, 1, 0, /*
448 Flush TABLE. 443 Flush TABLE.
449 */ ) 444 */
450 (table) 445 (table))
451 Lisp_Object table;
452 { 446 {
453 CHECK_RANGE_TABLE (table); 447 CHECK_RANGE_TABLE (table);
454 Dynarr_reset (XRANGE_TABLE (table)->entries); 448 Dynarr_reset (XRANGE_TABLE (table)->entries);
455 return Qnil; 449 return Qnil;
456 } 450 }
457 451
458 DEFUN ("map-range-table", Fmap_range_table, Smap_range_table, 2, 2, 0 /* 452 DEFUN ("map-range-table", Fmap_range_table, 2, 2, 0, /*
459 Map FUNCTION over entries in TABLE, calling it with three args, 453 Map FUNCTION over entries in TABLE, calling it with three args,
460 the beginning and end of the range and the corresponding value. 454 the beginning and end of the range and the corresponding value.
461 */ ) 455 */
462 (function, table) 456 (function, table))
463 Lisp_Object function, table;
464 { 457 {
465 error ("not yet implemented"); 458 error ("not yet implemented");
466 return Qnil; 459 return Qnil;
467 } 460 }
468 461
721 syms_of_rangetab (void) 714 syms_of_rangetab (void)
722 { 715 {
723 defsymbol (&Qrange_tablep, "range-table-p"); 716 defsymbol (&Qrange_tablep, "range-table-p");
724 defsymbol (&Qrange_table, "range-table"); 717 defsymbol (&Qrange_table, "range-table");
725 718
726 defsubr (&Srange_table_p); 719 DEFSUBR (Frange_table_p);
727 defsubr (&Smake_range_table); 720 DEFSUBR (Fmake_range_table);
728 defsubr (&Scopy_range_table); 721 DEFSUBR (Fcopy_range_table);
729 defsubr (&Sget_range_table); 722 DEFSUBR (Fget_range_table);
730 defsubr (&Sput_range_table); 723 DEFSUBR (Fput_range_table);
731 defsubr (&Sremove_range_table); 724 DEFSUBR (Fremove_range_table);
732 defsubr (&Sclear_range_table); 725 DEFSUBR (Fclear_range_table);
733 defsubr (&Smap_range_table); 726 DEFSUBR (Fmap_range_table);
734 } 727 }
735 728
736 void 729 void
737 structure_type_create_rangetab (void) 730 structure_type_create_rangetab (void)
738 { 731 {