Changeset 14522 in project


Ignore:
Timestamp:
05/04/09 20:36:15 (10 years ago)
Author:
Alex Shinn
Message:

adding in-utf8-string for use with fast-loop

Location:
release/4/utf8/trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/utf8/trunk/utf8-lolevel.scm

    r14275 r14522  
    4848   ;; I/O
    4949   read-utf8-char write-utf8-char char->utf8-string
     50   ;; fast-loop iterator
     51   in-utf8-string
    5052   )
    5153
     
    380382                         (- i 1))))))))))))
    381383
     384;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     385
     386(define-syntax in-utf8-string
     387  (syntax-rules ()
     388    ((in-utf8-string ((var) (str)) next . rest)
     389     (in-utf8-string ((var off) (str)) next . rest))
     390    ((in-utf8-string ((var off) (str)) next . rest)
     391     (next ((tmp str) (lim (sp-last tmp)))
     392           ((off (sp-first tmp)
     393                 (fx+ off (utf8-start-byte->length (string-int-ref str off)))))
     394           ((fx>= off lim))
     395           ((var (sp-ref tmp off)))
     396           ()
     397           . rest))))
     398
    382399)
Note: See TracChangeset for help on using the changeset viewer.