Changeset 24295 for lang/scheme

Show
Ignore:
Timestamp:
11/19/08 19:12:38 (7 weeks ago)
Author:
hayamiz
Message:

lang/scheme/gauche-tokyocabinet/trunk:
Now that Gauche-tokyocabinet supports hash-based DB not only B+tree-based.

Location:
lang/scheme/gauche-tokyocabinet/trunk
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • lang/scheme/gauche-tokyocabinet/trunk/DIST

    r10453 r24295  
    3232  echo DIST > DIST_EXCLUDE_X 
    3333  echo DIST_EXCLUDE_X >> DIST_EXCLUDE_X 
     34  echo .svn >> DIST_EXCLUDE_X 
    3435  if [ -f DIST_EXCLUDE ]; then cat DIST_EXCLUDE >> DIST_EXCLUDE_X; fi 
    3536  find . -name CVS -print -prune >> DIST_EXCLUDE_X 
  • lang/scheme/gauche-tokyocabinet/trunk/DIST_EXCLUDE_X

    r10453 r24295  
    11DIST 
    22DIST_EXCLUDE_X 
     3.svn 
  • lang/scheme/gauche-tokyocabinet/trunk/configure.ac

    r10542 r24295  
    66 
    77AC_PREREQ(2.54) 
    8 AC_INIT(Gauche-tokyocabinet, 0.1, y.hayamizu@gmail.com) 
     8AC_INIT(Gauche-tokyocabinet, 0.2, y.hayamizu@gmail.com) 
    99dnl If you want to use the system name (OS, architecture, etc) in the 
    1010dnl configure, uncomment the following line.  In such a case, you need 
  • lang/scheme/gauche-tokyocabinet/trunk/dbm/tokyocabinet.scm

    r10538 r24295  
    55(define-module dbm.tokyocabinet 
    66  (extend dbm) 
    7   (export <tcbdb> 
     7  (export <tcbdb> <tchdb> 
    88 
    99          ;; low level interface 
     
    1111          tcbdb-open tcbdb-close 
    1212          tcbdb-put2 tcbdb-get2 tcbdb-out2 
     13 
     14          tchdb-new tchdb-ecode 
     15          tchdb-open tchdb-close 
     16          tchdb-put2 tchdb-get2 tchdb-out2 
     17 
     18          ;; B+ tree specific API 
    1319          tcbdbcur-new 
    1420          tcbdbcur-first tcbdbcur-last 
    1521          tcbdbcur-prev tcbdbcur-next 
    1622          tcbdbcur-key2 tcbdbcur-val2 
    17           tcbdb-fold tcbdb-map tcbdb-for-each 
    18            
     23 
     24          ;; Hash specific API 
     25          tchdb-iterinit 
     26          tchdb-iternext2 tchdb-iternext3 
     27 
    1928          |BDBOREADER| |BDBOWRITER| |BDBOCREAT| 
    2029          |BDBOTRUNC| |BDBONOLCK| |BDBOLCKNB| 
    21  
     30           
     31          |HDBOREADER| |HDBOWRITER| |HDBOCREAT| 
     32          |HDBOTRUNC| |HDBONOLCK| |HDBOLCKNB| 
     33           
    2234          |TCESUCCESS| |TCETHREAD| |TCEINVALID| 
    2335          |TCENOFILE| |TCENOPERM| |TCEMETA| 
     
    3749(define-class <tcbdb-meta> (<dbm-meta>) 
    3850  ()) 
     51(define-class <tchdb-meta> (<dbm-meta>) 
     52  ()) 
    3953 
    4054(define-class <tcbdb> (<dbm>) 
     
    4357   (nolock :init-keyword :nolock :initform #f)) 
    4458  :metaclass <tcbdb-meta>) 
    45  
    46 ;;; 
    47 ;;; low level interfaces 
    48 ;;; 
    49  
    50 (define (tcbdb-fold bdb proc knil) 
    51   (let1 cur (tcbdbcur-new bdb) 
    52     (if (not (tcbdbcur-first cur)) 
    53         knil 
    54         (let loop((continue? #t) (ret knil)) 
    55           (if (not continue?) 
    56               ret 
    57               (let1 newret (proc (tcbdbcur-key2 cur) (tcbdbcur-val2 cur) ret) 
    58                 (loop (tcbdbcur-next cur) newret))))))) 
    59  
    60 (define (tcbdb-map bdb proc) 
    61   (reverse (tcbdb-fold bdb 
    62                        (lambda (key val kdr) 
    63                          (cons (proc key val) kdr)) 
    64                        ()))) 
    65  
    66 (define (tcbdb-for-each bdb proc) 
    67   (tcbdb-fold bdb 
    68               (lambda (key val kdr) 
    69                 (proc key val)) 
    70               ()) 
    71   (begin)) 
     59(define-class <tchdb> (<dbm>) 
     60  ((raw-tchdb :accessor raw-tchdb-of :initform #f) 
     61   (noblock-lock :init-keyword :noblock-lock :initform #f) 
     62   (nolock :init-keyword :nolock :initform #f)) 
     63  :metaclass <tchdb-meta>) 
    7264 
    7365 
     
    8072  self 
    8173  (unless (slot-bound? self 'path) 
    82     (error "path must be set to open TokyoCabinet BDB database")) 
     74    (error "path must be specified in order to open TokyoCabinet BDB database")) 
    8375  (when (raw-tcbdb-of self) 
    84     (error "gdbm ~S already opened" self)) 
     76    (error "tcbdb ~S already opened" self)) 
    8577  (let* ((path   (slot-ref self 'path)) 
    8678         (nolock (slot-ref self 'nolock)) 
     
    10092           self))) 
    10193  ) 
     94(define-method dbm-open ((self <tchdb>)) 
     95  (next-method) 
     96  self 
     97  (unless (slot-bound? self 'path) 
     98    (error "path must be specified in order to open TokyoCabinet HDB database")) 
     99  (when (raw-tchdb-of self) 
     100    (error "tchdb ~S already opened" self)) 
     101  (let* ((path   (slot-ref self 'path)) 
     102         (nolock (slot-ref self 'nolock)) 
     103         (noblock-lock (slot-ref self 'noblock-lock)) 
     104         (omode  (case (slot-ref self 'rw-mode) 
     105                   ((:read) |HDBOREADER|) 
     106                   ((:write) (logior |HDBOCREAT| |HDBOWRITER| 
     107                                    (if nolock |HDBONOLCK| 0) 
     108                                    (if noblock-lock |HDBOLCKNB| 0))) 
     109                   ((:create) (logior |HDBOWRITER| |HDBOTRUNC| |HDBOCREAT| 
     110                                     (if nolock |HDBONOLCK| 0) 
     111                                     (if noblock-lock |HDBOLCKNB| 0))))) 
     112         (raw-tchdb (tchdb-new))) 
     113    (and (tchdb-open raw-tchdb path omode) 
     114         (begin 
     115           (slot-set! self 'raw-tchdb raw-tchdb) 
     116           self))) 
     117  ) 
    102118 
    103119(define-method dbm-close ((self <tcbdb>)) 
     
    106122         (begin (slot-set! self 'raw-tcbdb #f) 
    107123                #t)))) 
     124(define-method dbm-close ((self <tchdb>)) 
     125  (let ((raw-tchdb (raw-tchdb-of self))) 
     126    (and raw-tchdb (tchdb-close raw-tchdb) 
     127         (begin (slot-set! self 'raw-tchdb #f) 
     128                #t)))) 
    108129 
    109130(define-method dbm-closed? ((self <tcbdb>)) 
    110131  (not (slot-ref self 'raw-tcbdb))) 
     132(define-method dbm-closed? ((self <tchdb>)) 
     133  (not (slot-ref self 'raw-tchdb))) 
    111134 
    112135(define-method dbm-put! ((self <tcbdb>) key value) 
     
    120143            (error "tokyocabinet bdb: database is opened as read only") 
    121144            #f))))) 
     145(define-method dbm-put! ((self <tchdb>) key value) 
     146  (next-method) 
     147  (let ((key (%dbm-k2s self key)) 
     148        (value (%dbm-v2s self value))) 
     149    (let1 ret (tchdb-put2 (raw-tchdb-of self) key value) 
     150    (if ret 
     151        ret 
     152        (if (eq? :read (slot-ref self 'rw-mode)) 
     153            (error "tokyocabinet hdb: database is opened as read only") 
     154            #f))))) 
    122155 
    123156(define-method dbm-get ((self <tcbdb>) key . args) 
     
    131164                      key self) 
    132165              (car args)))))) 
     166(define-method dbm-get ((self <tchdb>) key . args) 
     167  (next-method) 
     168  (let ((key (%dbm-k2s self key))) 
     169    (let1 ret (tchdb-get2 (raw-tchdb-of self) key) 
     170      (if ret 
     171          (%dbm-s2v self ret) 
     172          (if (null? args) 
     173              (errorf "tokyocabinet hdb: not data for key ~s in database ~s" 
     174                      key self) 
     175              (car args)))))) 
    133176 
    134177(define-method dbm-exists? ((self <tcbdb>) key) 
    135178  (and (tcbdb-get2 (raw-tcbdb-of self) (%dbm-k2s self key)) #t)) 
     179(define-method dbm-exists? ((self <tchdb>) key) 
     180  (and (tchdb-get2 (raw-tchdb-of self) (%dbm-k2s self key)) #t)) 
    136181 
    137182(define-method dbm-delete! ((self <tcbdb>) key) 
     
    139184      (if (eq? :read (slot-ref self 'rw-mode)) 
    140185          (error "tokyocabinet bdb: database is opened as read only") 
     186          #f))) 
     187(define-method dbm-delete! ((self <tchdb>) key) 
     188  (or (tchdb-out2 (raw-tchdb-of self) (%dbm-k2s self key)) 
     189      (if (eq? :read (slot-ref self 'rw-mode)) 
     190          (error "tokyocabinet hdb: database is opened as read only") 
    141191          #f))) 
    142192 
     
    153203                                 ret) 
    154204                (loop (tcbdbcur-next cur) newret))))))) 
     205(define-method dbm-fold ((self <tchdb>) proc knil) 
     206  (let1 raw-hdb (raw-tchdb-of self) 
     207    (unless (tchdb-iterinit raw-hdb) 
     208      (error "tokyocabint hdb: iter init failed!")) 
     209    (let loop((continue? #t) (ret knil)) 
     210      (if (not continue?) 
     211          ret 
     212          (receive (cont? key val) 
     213              (tchdb-iternext3 raw-hdb) 
     214            (loop cont? 
     215                  (proc (%dbm-s2k self key) 
     216                        (%dbm-s2v self val) 
     217                        ret))))))) 
     218 
    155219 
    156220;; Epilogue 
  • lang/scheme/gauche-tokyocabinet/trunk/test.scm

    r10508 r24295  
    207207 
    208208(full-test <tcbdb>) 
     209(full-test <tchdb>) 
    209210 
    210211;; epilogue 
    211212(test-end) 
    212213 
    213  
    214  
    215  
    216  
  • lang/scheme/gauche-tokyocabinet/trunk/tokyocabinet.c

    r10508 r24295  
    66 
    77#define TCCALL(call) ((call) ? SCM_TRUE : SCM_FALSE) 
    8  
    9 /* 
    10  * The following function is a dummy one; replace it for 
    11  * your C function definitions. 
    12  */ 
     8// #define DEBUG_GAUCHE_TOKYOCABINET 
     9 
     10/* These variables are for temporary use. */ 
     11static TCXSTR * xkey; 
     12static TCXSTR * xvalue; 
     13 
    1314 
    1415static void tcbdb_finalize(ScmObj obj, void *data) 
     
    1718    tcbdbclose(bdb->bdb); 
    1819} 
     20static void tchdb_finalize(ScmObj obj, void *data) 
     21{ 
     22    ScmRawTchdb *hdb = SCM_RAW_TCHDB(obj); 
     23    tchdbclose(hdb->hdb); 
     24} 
     25 
     26 
    1927 
    2028static void tcbdb_print(ScmObj obj, ScmPort *out, ScmWriteContext *ctx){ 
    2129    Scm_Printf(out, "#<tcbdb-file>"); 
    2230} 
     31static void tchdb_print(ScmObj obj, ScmPort *out, ScmWriteContext *ctx){ 
     32    Scm_Printf(out, "#<tchdb-file>"); 
     33} 
     34 
     35 
    2336 
    2437ScmObj test_tokyocabinet(void) 
     
    2639    return SCM_MAKE_STR("tokyocabinet is working"); 
    2740} 
     41 
     42 
    2843 
    2944ScmObj Scm_tcbdb_ecode(ScmRawTcbdb* bdb){ 
    3045    return SCM_MAKE_INT(tcbdbecode(SCM_RAW_TCBDB(bdb)->bdb)); 
    3146} 
     47ScmObj Scm_tchdb_ecode(ScmRawTchdb* hdb){ 
     48    return SCM_MAKE_INT(tchdbecode(SCM_RAW_TCHDB(hdb)->hdb)); 
     49} 
     50 
     51 
    3252 
    3353ScmObj Scm_tcbdb_new(void){ 
     
    3858    return SCM_OBJ(ret); 
    3959} 
     60ScmObj Scm_tchdb_new(void){ 
     61    ScmRawTchdb *ret = SCM_NEW(ScmRawTchdb); 
     62    SCM_SET_CLASS(ret, SCM_CLASS_RAW_TCHDB); 
     63    Scm_RegisterFinalizer(SCM_OBJ(ret), tchdb_finalize, NULL); 
     64    ret->hdb = tchdbnew(); 
     65    return SCM_OBJ(ret); 
     66} 
     67 
     68 
    4069 
    4170ScmObj Scm_tcbdb_open(ScmRawTcbdb* bdb, ScmString* path, int omode){ 
     
    4473                                  , omode)); 
    4574} 
     75ScmObj Scm_tchdb_open(ScmRawTchdb* hdb, ScmString* path, int omode){ 
     76    ScmObj ret = TCCALL(tchdbopen(hdb->hdb 
     77                                  , Scm_GetString(path) 
     78                                  , omode)); 
     79} 
     80 
     81 
    4682 
    4783ScmObj Scm_tcbdb_close(ScmRawTcbdb* bdb){ 
    4884    return TCCALL(tcbdbclose(bdb->bdb)); 
    4985} 
     86ScmObj Scm_tchdb_close(ScmRawTchdb* hdb){ 
     87    return TCCALL(tchdbclose(hdb->hdb)); 
     88} 
     89 
     90 
    5091 
    5192ScmObj Scm_tcbdb_put2(ScmRawTcbdb* bdb, ScmString* key, ScmString* val){ 
     
    5495                            , Scm_GetString(val))); 
    5596} 
     97ScmObj Scm_tchdb_put2(ScmRawTchdb* hdb, ScmString* key, ScmString* val){ 
     98    return TCCALL(tchdbput2(hdb->hdb 
     99                            , Scm_GetString(key) 
     100                            , Scm_GetString(val))); 
     101} 
     102 
     103 
     104 
    56105ScmObj Scm_tcbdb_get2(ScmRawTcbdb* bdb, ScmString* key){ 
    57106    char * val = tcbdbget2(bdb->bdb 
     
    64113    return ret; 
    65114} 
     115ScmObj Scm_tchdb_get2(ScmRawTchdb* hdb, ScmString* key){ 
     116    char * val = tchdbget2(hdb->hdb 
     117                           , Scm_GetString(key)); 
     118    if(val == NULL){ 
     119        return SCM_FALSE; 
     120    } 
     121 
     122    ScmObj ret = SCM_MAKE_STR(val); 
     123    return ret; 
     124} 
     125 
     126 
    66127 
    67128ScmObj Scm_tcbdb_out2(ScmRawTcbdb* bdb, ScmString* key){ 
     
    69130                            , Scm_GetString(key))); 
    70131} 
    71  
     132ScmObj Scm_tchdb_out2(ScmRawTchdb* hdb, ScmString* key){ 
     133    return TCCALL(tchdbout2(hdb->hdb 
     134                            , Scm_GetString(key))); 
     135} 
     136 
     137 
     138/* 
     139  B+ tree specific API from here 
     140 */ 
    72141static void tcbdbcur_finalize(ScmObj obj, void *data) 
    73142{ 
     
    123192 
    124193/* 
     194  B+ tree specific API until here 
     195 */ 
     196 
     197 
     198/* 
     199  Hash specific API from here 
     200 */ 
     201 
     202 
     203 
     204/* 
     205  Hash specific API until here 
     206 */ 
     207 
     208extern ScmObj Scm_tchdb_iterinit(ScmRawTchdb* hdb){ 
     209#ifdef DEBUG_GAUCHE_TOKYOCABINET 
     210    puts("Scm_tchdb_iterinit"); 
     211#endif 
     212    return TCCALL(tchdbiterinit(hdb->hdb)); 
     213} 
     214 
     215extern ScmObj Scm_tchdb_iternext2(ScmRawTchdb* hdb){ 
     216    char * key = tchdbiternext2(hdb->hdb); 
     217    if (key == NULL){ 
     218        return SCM_FALSE; 
     219    } 
     220 
     221    /* 
     222     *key is newly malloced in tchdbiternext2, so 
     223     SCM_MAKE_STR is appropriate, because it does not 
     224     copy its argument (STM_MAKE_STR_COPYING does) 
     225     */ 
     226    return SCM_MAKE_STR(key); 
     227} 
     228 
     229 
     230 
     231extern ScmObj Scm_tchdb_iternext3(ScmRawTchdb* hdb){ 
     232#ifdef DEBUG_GAUCHE_TOKYOCABINET 
     233    printf("Scm_tchdb_iternext3( 0x%x )", (uintptr_t) hdb); 
     234#endif  
     235    ScmObj ret_iternext, key, val; 
     236 
     237#ifdef DEBUG_GAUCHE_TOKYOCABINET 
     238    printf("call tchdbiternext3( 0x%x , 0x%x , 0x%x )" 
     239           , (uintptr_t) hdb->hdb 
     240           , (uintptr_t) xkey 
     241           , (uintptr_t) xvalue); 
     242#endif 
     243    ret_iternext = TCCALL(tchdbiternext3(hdb->hdb, xkey, xvalue)); 
     244    key = SCM_MAKE_STR_COPYING(tcxstrptr(xkey)); 
     245    val = SCM_MAKE_STR_COPYING(tcxstrptr(xvalue)); 
     246    return Scm_Values3(ret_iternext, key, val); 
     247} 
     248 
     249 
     250 
     251/* 
    125252 * Module initialization function. 
    126253 */ 
     
    130257{ 
    131258    ScmModule *mod; 
     259 
     260    xkey = tcxstrnew(); 
     261    xvalue = tcxstrnew(); 
    132262 
    133263    /* Register this DSO to Gauche */ 
     
    137267    mod = SCM_MODULE(SCM_FIND_MODULE("dbm.tokyocabinet", TRUE)); 
    138268    Scm_InitStaticClass(&Scm_RawTcbdbClass, "<raw-tcbdb>", mod, NULL, 0); 
     269    Scm_InitStaticClass(&Scm_RawTchdbClass, "<raw-tchdb>", mod, NULL, 0); 
    139270 
    140271    /* Register stub-generated procedures */ 
  • lang/scheme/gauche-tokyocabinet/trunk/tokyocabinet.h

    r10508 r24295  
    1212#include <tcutil.h> 
    1313#include <tcbdb.h> 
     14#include <tchdb.h> 
    1415#include <stdlib.h> 
    1516#include <stdbool.h> 
    1617#include <stdint.h> 
     18 
     19 
     20 
    1721 
    1822SCM_DECL_BEGIN 
     
    4852 
    4953// (insert-class-decl "raw-tcbdb") 
     54// (insert-class-decl "raw-tchdb") 
    5055SCM_CLASS_DECL(Scm_RawTcbdbClass); 
     56SCM_CLASS_DECL(Scm_RawTchdbClass); 
     57 
     58 
     59 
    5160static void raw_tcbdb_print(ScmObj, ScmPort *, ScmWriteContext*); 
     61static void raw_tchdb_print(ScmObj, ScmPort *, ScmWriteContext*); 
     62 
     63 
    5264 
    5365#define SCM_CLASS_RAW_TCBDB (&Scm_RawTcbdbClass) 
    5466#define SCM_RAW_TCBDB(obj)  ((ScmRawTcbdb*)obj) 
    5567#define SCM_RAW_TCBDB_P(obj) SCM_XTYPEP(obj, SCM_CLASS_RAW_TCBDB) 
     68 
     69#define SCM_CLASS_RAW_TCHDB (&Scm_RawTchdbClass) 
     70#define SCM_RAW_TCHDB(obj)  ((ScmRawTchdb*)obj) 
     71#define SCM_RAW_TCHDB_P(obj) SCM_XTYPEP(obj, SCM_CLASS_RAW_TCHDB) 
     72 
     73 
    5674 
    5775typedef struct ScmRawTcbdbRec { 
     
    6078    // write manually 
    6179} ScmRawTcbdb; 
     80 
     81typedef struct ScmRawTchdbRec { 
     82    SCM_HEADER; 
     83    TCHDB* hdb; 
     84    // write manually 
     85} ScmRawTchdb; 
     86 
    6287 
    6388 
     
    77102 
    78103 
     104 
    79105static void tcbdb_finalize(ScmObj obj, void *data); 
    80106static void tcbdb_print(ScmObj obj, ScmPort *out, ScmWriteContext *ctx); 
     107 
     108static void tchdb_finalize(ScmObj obj, void *data); 
     109static void tchdb_print(ScmObj obj, ScmPort *out, ScmWriteContext *ctx); 
     110 
     111 
    81112 
    82113extern ScmObj test_tokyocabinet(void); 
     
    88119extern ScmObj Scm_tcbdb_get2(ScmRawTcbdb* bdb, ScmString* key); 
    89120extern ScmObj Scm_tcbdb_out2(ScmRawTcbdb* bdb, ScmString* key); 
     121 
     122extern ScmObj Scm_tchdb_ecode(ScmRawTchdb* bdb); 
     123extern ScmObj Scm_tchdb_new(void); 
     124extern ScmObj Scm_tchdb_open(ScmRawTchdb* bdb, ScmString* path, int omode); 
     125extern ScmObj Scm_tchdb_close(ScmRawTchdb* bdb); 
     126extern ScmObj Scm_tchdb_put2(ScmRawTchdb* bdb, ScmString* key, ScmString* val); 
     127extern ScmObj Scm_tchdb_get2(ScmRawTchdb* bdb, ScmString* key); 
     128extern ScmObj Scm_tchdb_out2(ScmRawTchdb* bdb, ScmString* key); 
     129extern ScmObj Scm_tchdbcur_new(ScmRawTchdb* bdb); 
     130 
     131 
     132 
     133/* B+ tree specific API */ 
    90134extern ScmObj Scm_tcbdbcur_new(ScmRawTcbdb* bdb); 
    91135extern ScmObj Scm_tcbdbcur_del(ScmTcbdbcur* cur); 
     
    97141extern ScmObj Scm_tcbdbcur_val2(ScmTcbdbcur* cur); 
    98142 
     143 
     144/* Hash specific API */ 
     145extern ScmObj Scm_tchdb_iterinit(ScmRawTchdb* hdb); 
     146extern ScmObj Scm_tchdb_iternext2(ScmRawTchdb* hdb); 
     147extern ScmObj Scm_tchdb_iternext3(ScmRawTchdb* hdb); 
     148 
     149 
    99150/* Epilogue */ 
    100151SCM_DECL_END 
  • lang/scheme/gauche-tokyocabinet/trunk/tokyocabinetlib.stub

    r10508 r24295  
    1414  () 
    1515  ()) 
     16(define-cclass <raw-tchdb> "ScmRawTchdb*" "Scm_RawTchdbClass" 
     17  () 
     18  ()) 
     19 
     20 
    1621 
    1722(define-cclass <tcbdbcur> "ScmTcbdbcur*" "Scm_TcbdbcurClass" 
     
    1924  ()) 
    2025 
     26 
    2127(define-cproc test-tokyocabinet () 
    2228  (return "test_tokyocabinet")) 
    2329 
     30 
     31 
    2432(define-cproc tcbdb-ecode (bdb::<raw-tcbdb>) 
    2533  (return "Scm_tcbdb_ecode")) 
     34(define-cproc tchdb-ecode (hdb::<raw-tchdb>) 
     35  (return "Scm_tchdb_ecode")) 
     36 
     37 
    2638 
    2739(define-cproc tcbdb-new () 
    2840  (call "Scm_tcbdb_new")) 
     41(define-cproc tchdb-new () 
     42  (call "Scm_tchdb_new")) 
     43 
    2944 
    3045(define-cproc tcbdb-open (bdb::<raw-tcbdb> 
     
    3247                          omode::<fixnum>) 
    3348  (call "Scm_tcbdb_open")) 
     49(define-cproc tchdb-open (hdb::<raw-tchdb> 
     50                          path::<string> 
     51                          omode::<fixnum>) 
     52  (call "Scm_tchdb_open")) 
     53 
    3454 
    3555(define-cproc tcbdb-close (bdb::<raw-tcbdb>) 
    3656  (call "Scm_tcbdb_close")) 
     57(define-cproc tchdb-close (hdb::<raw-tchdb>) 
     58  (call "Scm_tchdb_close")) 
     59 
    3760 
    3861(define-cproc tcbdb-put2 (bdb::<raw-tcbdb> 
     
    4063                          val::<string>) 
    4164  (call "Scm_tcbdb_put2")) 
     65(define-cproc tchdb-put2 (hdb::<raw-tchdb> 
     66                          key::<string> 
     67                          val::<string>) 
     68  (call "Scm_tchdb_put2")) 
     69 
    4270 
    4371(define-cproc tcbdb-get2 (bdb::<raw-tcbdb> 
     
    4573 
    4674  (call "Scm_tcbdb_get2")) 
     75(define-cproc tchdb-get2 (hdb::<raw-tchdb> 
     76                          key::<string>) 
     77 
     78  (call "Scm_tchdb_get2")) 
     79 
    4780 
    4881(define-cproc tcbdb-out2 (bdb::<raw-tcbdb> 
     
    5083 
    5184  (call "Scm_tcbdb_out2")) 
     85(define-cproc tchdb-out2 (hdb::<raw-tchdb> 
     86                          key::<string>) 
    5287 
     88  (call "Scm_tchdb_out2")) 
     89 
     90;; B+ tree specific API 
    5391(define-cproc tcbdbcur-new (bdb::<raw-tcbdb>) 
    5492  (call "Scm_tcbdbcur_new")) 
    55  
    5693(define-cproc tcbdbcur-first (cur::<tcbdbcur>) 
    5794  (call "Scm_tcbdbcur_first")) 
    58  
    5995(define-cproc tcbdbcur-last (cur::<tcbdbcur>) 
    6096  (call "Scm_tcbdbcur_last")) 
    61  
    6297(define-cproc tcbdbcur-prev (cur::<tcbdbcur>) 
    6398  (call "Scm_tcbdbcur_prev")) 
    64  
    6599(define-cproc tcbdbcur-next (cur::<tcbdbcur>) 
    66100  (call "Scm_tcbdbcur_next")) 
    67  
    68101(define-cproc tcbdbcur-key2 (cur::<tcbdbcur>) 
    69102  (call "Scm_tcbdbcur_key2")) 
    70  
    71103(define-cproc tcbdbcur-val2 (cur::<tcbdbcur>) 
    72104  (call "Scm_tcbdbcur_val2")) 
     105