Changeset 37835 in project


Ignore:
Timestamp:
08/04/19 14:42:10 (2 weeks ago)
Author:
sjamaan
Message:

sequences: Use ##sys#check-fixnum instead of ##sys#check-exact for indices and step sizes

In CHICKEN 4, ##sys#check-exact was what we now call ##sys#check-fixnum
but the sequences code hasn't been updated to match it.

Fixes #1631

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/sequences/trunk/sequences.scm

    r36461 r37835  
    236236(define-polymorphic (make (s) len init)
    237237  ((<list>)
    238    (##sys#check-exact len 'make)
     238   (##sys#check-fixnum len 'make)
    239239   (let loop ((len len) (lst '()))
    240240     (if (fx<= len 0)
     
    310310(define-polymorphic (sub0 (x) start #!optional end)
    311311  ((<list>)
    312    (##sys#check-exact start 'sub)
    313    (when end (##sys#check-exact end 'sub))
     312   (##sys#check-fixnum start 'sub)
     313   (when end (##sys#check-fixnum end 'sub))
    314314   (do ((hd x (cdr hd))
    315315        (i 0 (fx+ i 1)))
     
    323323       (error 'sub "out of range (start)" start x))))
    324324  ((<vector>)
    325    (##sys#check-exact start 'sub)
    326    (when end (##sys#check-exact end 'sub))
     325   (##sys#check-fixnum start 'sub)
     326   (when end (##sys#check-fixnum end 'sub))
    327327   (let* ((len (vector-length x))
    328328          (end (or end len))
     
    334334       (vector-set! v2 j (vector-ref x i)))))
    335335  ((<string>)
    336    (##sys#check-exact start 'sub)
    337    (when end (##sys#check-exact end 'sub))
     336   (##sys#check-fixnum start 'sub)
     337   (when end (##sys#check-fixnum end 'sub))
    338338   (let* ((len (string-length x))
    339339          (end (or end len))
     
    345345       (string-set! v2 j (string-ref x i)))))
    346346  ((<linear-sequence>)
    347    (##sys#check-exact start 'sub)
    348    (when end (##sys#check-exact end 'sub))
     347   (##sys#check-fixnum start 'sub)
     348   (when end (##sys#check-fixnum end 'sub))
    349349   (let* ((head (linear-sequence-head x))
    350350          (sethead (setter head))
     
    366366         (error 'sub "out of range (start)" start x)))))
    367367  ((<random-access-sequence>)
    368    (##sys#check-exact start 'sub)
    369    (when end (##sys#check-exact end 'sub))
     368   (##sys#check-fixnum start 'sub)
     369   (when end (##sys#check-fixnum end 'sub))
    370370   (let* ((size (random-access-sequence-size x))
    371371          (len (size x))
     
    387387   (let ((end (and y/end end/y))
    388388         (y (if y/end y/end end/y)))
    389      (##sys#check-exact start 'sub)
    390      (when end (##sys#check-exact end 'sub))
     389     (##sys#check-fixnum start 'sub)
     390     (when end (##sys#check-fixnum end 'sub))
    391391     (##sys#check-list y 'sub)
    392392     (do ((hd x (cdr hd))
     
    404404   (let ((end (and y/end end/y))
    405405         (y (if y/end y/end end/y)))
    406      (##sys#check-exact start 'sub)
    407      (when end (##sys#check-exact end 'sub))
     406     (##sys#check-fixnum start 'sub)
     407     (when end (##sys#check-fixnum end 'sub))
    408408     (let* ((len (vector-length x))
    409409            (len2 (vector-length y))
     
    416416   (let ((end (and y/end end/y))
    417417         (y (if y/end y/end end/y)))
    418      (##sys#check-exact start 'sub)
    419      (when end (##sys#check-exact end 'sub))
     418     (##sys#check-fixnum start 'sub)
     419     (when end (##sys#check-fixnum end 'sub))
    420420     (let* ((len (string-length x))
    421421            (len2 (string-length y))
     
    428428   (let ((end (and y/end end/y))
    429429         (y (if y/end y/end end/y)))
    430      (##sys#check-exact start 'sub)
    431      (when end (##sys#check-exact end 'sub))
     430     (##sys#check-fixnum start 'sub)
     431     (when end (##sys#check-fixnum end 'sub))
    432432     (let* ((head (linear-sequence-head x))
    433433            (sethead (setter head))
     
    448448   (let ((end (and y/end end/y))
    449449         (y (if y/end y/end end/y)))
    450      (##sys#check-exact start 'sub)
    451      (when end (##sys#check-exact end 'sub))
     450     (##sys#check-fixnum start 'sub)
     451     (when end (##sys#check-fixnum end 'sub))
    452452     (let* ((data1 (random-access-sequence-data x))
    453453            (len1 ((random-access-sequence-size x) data1))
     
    660660(define-polymorphic (advance (it) #!optional (step 1))
    661661  ((<linear-iterator>)
    662    (##sys#check-exact step 'advance)
     662   (##sys#check-fixnum step 'advance)
    663663   (when (fx< step 0)
    664664     (error 'advance "iterator over linear sequence can not advance backwards" it step))
     
    672672           state)))))
    673673  ((<random-access-iterator>)
    674    (##sys#check-exact step 'advance)
     674   (##sys#check-fixnum step 'advance)
    675675   (make-iterator
    676676    (fx+ (iterator-index it) step)
     
    680680(define-polymorphic (advance! (it) #!optional (step 1))
    681681  ((<linear-iterator>)
    682    (##sys#check-exact step 'advance!)
     682   (##sys#check-fixnum step 'advance!)
    683683   (when (fx< step 0)
    684684     (error 'advance! "iterator over linear sequence can not advance backwards" it step))
     
    691691          it))))
    692692  ((<random-access-iterator>)
    693    (##sys#check-exact step 'advance!)
     693   (##sys#check-fixnum step 'advance!)
    694694   (iterator-index-set! it (fx+ (iterator-index it) step))
    695695   it))
Note: See TracChangeset for help on using the changeset viewer.