2 * cdb, cdb-wr - Tcl bindings for tinycdb and a journalling write extension
3 * Copyright 2006-2012 Ian Jackson
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #ifndef CHIARK_TCL_CDB_H
20 #define CHIARK_TCL_CDB_H
22 #include <sys/types.h>
33 #include "cdb+tcmdif.h"
35 #define RWSCF_OKJUNK 002
37 extern const IdDataSpec cdbtcl_databases, cdbtcl_rwdatabases;
39 /*---------- from lookup.c ----------*/
41 int cht_cdb_donesomelookup(Tcl_Interp *ip, void *db_v,
42 Tcl_Obj *def, Tcl_Obj **result,
43 const Byte *data, int dlen,
44 int (*storeanswer)(Tcl_Interp *ip, Tcl_Obj **result,
45 const Byte *data, int len));
46 int cht_cdb_storeanswer_string(Tcl_Interp *ip, Tcl_Obj **result,
47 const Byte *data, int len);
48 int cht_cdb_storeanswer_hb(Tcl_Interp *ip, Tcl_Obj **result,
49 const Byte *data, int len);
50 int cht_cdb_lookup_cdb(Tcl_Interp *ip, struct cdb *cdb,
51 const Byte *key, int klen,
52 const Byte **data_r, int *dlen_r);
54 /*---------- macros ----------*/
57 rc= cht_posixerr(ip, errno, "failed to " m); goto x_rc; \
60 #endif /*CHIARK_TCL_CDB_H*/