Changeset 13618 in project


Ignore:
Timestamp:
03/09/09 19:36:57 (11 years ago)
Author:
Kon Lovett
Message:

Added primitive inlines.

Location:
release/4/stack
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • release/4/stack/tags/2.0.0/stack.meta

    r13557 r13618  
    1010 (needs setup-helper)
    1111 (files
     12  "chicken-primitive-object-inlines.scm"
    1213  "tests"
    1314  "stack.scm"
  • release/4/stack/trunk/stack.meta

    r13557 r13618  
    1010 (needs setup-helper)
    1111 (files
     12  "chicken-primitive-object-inlines.scm"
    1213  "tests"
    1314  "stack.scm"
  • release/4/stack/trunk/stack.scm

    r13536 r13618  
    7575(define-inline (%stack-pop! stk)
    7676  (%stack-count-dec! stk 1)
    77         (let ([ls (%stack-list stk)])
     77        (let ((ls (%stack-list stk)))
    7878                (%stack-list-set! stk (%cdr ls))
    7979                (%car ls) ) )
     
    8888
    8989(define-inline (%stack-node-ref loc stk idx)
    90   (let ([pr (%list-pair-ref (%stack-list stk) idx)])
     90  (let ((pr (%list-pair-ref (%stack-list stk) idx)))
    9191                (if (not (%null? pr)) pr
    9292                          (##sys#signal-hook #:bounds-error loc "out of range" idx 0 (%stack-count stk)) ) ) )
     
    147147(define (list->stack ls)
    148148  (%check-list 'list->stack ls)
    149         (let ([stk (%make-stack)])
     149        (let ((stk (%make-stack)))
    150150    (%stack-count-set! stk (%length ls))
    151151    (%stack-list-set! stk (%list-copy ls))
     
    185185  (%check-index 'stack-cut! start 0 end)
    186186  (%check-index 'stack-cut! end start (%fx+ (%stack-count stk) 1))
    187   (let ([cnt (%fx- end start)])
     187  (let ((cnt (%fx- end start)))
    188188    (%stack-count-dec! stk cnt)
    189189    ; From the top?
    190190    (if (%fx= 0 start)
    191191        ;then removing leading elements
    192         (let* ([spr (%stack-list stk)]
    193                [epr (%list-pair-ref spr (%fx- cnt 1))]
    194                [ls spr])
     192        (let* ((spr (%stack-list stk))
     193               (epr (%list-pair-ref spr (%fx- cnt 1)))
     194               (ls spr))
    195195          (%stack-list-set! stk (%cdr epr))
    196196          (%set-cdr!/immediate epr '())
    197197          ls )
    198198        ;else removing interior elements
    199         (let* ([spr (%stack-node-ref 'stack-cut! stk (%fx- start 1))]
    200                [epr (%list-pair-ref spr cnt)]
    201                [ls (%cdr spr)])
     199        (let* ((spr (%stack-node-ref 'stack-cut! stk (%fx- start 1)))
     200               (epr (%list-pair-ref spr cnt))
     201               (ls (%cdr spr)))
    202202          (%set-cdr!/maybe-immediate spr (%cdr epr))
    203203          (%set-cdr!/immediate epr '())
Note: See TracChangeset for help on using the changeset viewer.