Changeset 10538 for lang/scheme

Show
Ignore:
Timestamp:
04/27/08 14:18:50 (7 months ago)
Author:
hayamiz
Message:

tokyocabinet bdb passed all tests.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/scheme/gauche-tokyocabinet/trunk/dbm/tokyocabinet.scm

    r10508 r10538  
    126126    (let1 ret (tcbdb-get2 (raw-tcbdb-of self) key) 
    127127      (if ret 
    128           ret 
     128          (%dbm-s2v self ret) 
    129129          (if (null? args) 
    130130              (errorf "tokyocabinet bdb: not data for key ~s in database ~s" 
     
    142142 
    143143(define-method dbm-fold ((self <tcbdb>) proc knil) 
    144   (let ((raw-tcbdb (raw-tcbdb-of self))) 
    145     (if (not raw-tcbdb) 
     144  (let* ((raw-tcbdb (raw-tcbdb-of self)) 
     145         (cur (tcbdbcur-new raw-tcbdb))) 
     146    (if (not (tcbdbcur-first cur)) 
    146147        knil 
    147         (tcbdb-fold raw-tcbdb proc knil)))) 
     148        (let loop((continue? #t) (ret knil)) 
     149          (if (not continue?) 
     150              ret 
     151              (let1 newret (proc (%dbm-s2k self (tcbdbcur-key2 cur)) 
     152                                 (%dbm-s2v self (tcbdbcur-val2 cur)) 
     153                                 ret) 
     154                (loop (tcbdbcur-next cur) newret))))))) 
    148155 
    149156;; Epilogue