chiark / gitweb /
ro compiles
[chiark-tcl.git] / cdb / chiark_tcl_cdb.h
index 63259a8..d06713d 100644 (file)
@@ -23,17 +23,23 @@ extern const IdDataSpec cdbtcl_databases, cdbtcl_rwdatabases;
 
 /*---------- from lookup.c ----------*/
 
-int cht_cdb_dosomelookup(Tcl_Interp *ip, void *db_v,
-                        const char *key, Tcl_Obj *def,
-                        Tcl_Obj **result,
-                        int (*somelookup)(Tcl_Interp *ip, void *db_v,
-                                          const char *key,
-                                          const Byte **data_r, int *len_r),
-                        int (*storeanswer)(Tcl_Interp *ip, Tcl_Obj **result,
-                                           const Byte *data, int len));
+int cht_cdb_donesomelookup(Tcl_Interp *ip, void *db_v,
+                          Tcl_Obj *def, Tcl_Obj **result,
+                          const Byte *data, int dlen,
+                          int (*storeanswer)(Tcl_Interp *ip, Tcl_Obj **result,
+                                             const Byte *data, int len));
 int cht_cdb_storeanswer_string(Tcl_Interp *ip, Tcl_Obj **result,
                               const Byte *data, int len);
 int cht_cdb_storeanswer_hb(Tcl_Interp *ip, Tcl_Obj **result,
                           const Byte *data, int len);
+int cht_cdb_lookup_cdb(Tcl_Interp *ip, struct cdb *cdb,
+                      const Byte *key, int klen,
+                      const Byte **data_r, int *dlen_r);
+
+/*---------- macros ----------*/
+
+#define PE(m) do{                                              \
+    rc= cht_posixerr(ip, errno, "failed to " m); goto x_rc;    \
+  }while(0)
 
 #endif /*CHIARK_TCL_CDB_H*/