chiark / gitweb /
lookup wip; see cvs diff from 1.12 before checkin
[chiark-tcl.git] / cdb / writeable.c
index e04cf69830465309ccdf55060c5edd072aad064a..14d81adbf410a6ad590c0866881e99544dda7aec 100644 (file)
@@ -92,6 +92,16 @@ static void ht_maybeupdate(HashTable *ht, const char *key,
   Tcl_SetHashValue(he, val_eat);
 }
 
+static const HashValue *ht_lookup(HashTable *ht, const char *key) {
+  Tcl_HashEntry *he;
+  const HashValue *htv;
+  
+  he= Tcl_FindHashEntry(ht, key);
+  if (!he) return 0;
+  
+  return Tcl_GetHashValue(he);
+}
+
 static int ht_forall(HashTable *ht,
                     int (*fn)(const char *key, HashValue *val,
                               struct ht_forall_ctx *ctx),
@@ -829,3 +839,27 @@ int cht_do_cdbwr_update_hb(ClientData cd, Tcl_Interp *ip,
                           void *rw_v, const char *key, HBytes_Value value) {
   return update(ip, rw_v, key, cht_hb_data(&value), cht_hb_len(&value));
 }
+
+int cht_do_cdbwr_delete(ClientData cd, Tcl_Interp *ip, void *rw_v,
+                       const char *key) {
+  return update(ip, rw_v, key, 0, 0);
+}
+
+/*---------- Lookups ----------*/
+
+static int lookup(Tcl_Interp *ip, Rw *rw, const char *key, ) {
+  const HashValue val;
+
+  val= ht_lookup(&rw->logincore, key);
+  if (!val) {
+    cdb_ &rw->cdb
+
+    return notfound;
+  
+
+int cht_do_cdbwr_lookup(ClientData cd, Tcl_Interp *ip, void *db,
+                       const char *key, Tcl_Obj *def, Tcl_Obj **result) {
+  
+}
+
+int cht_do_cdbwr_lookup_hb(ClientData cd, Tcl_Interp *ip, void *db, const char *key, HBytes_Value def, HBytes_Value *result);