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>
34 #include "cdb+tcmdif.h"
36 #define RWSCF_OKJUNK 002
38 extern const IdDataSpec cdbtcl_databases, cdbtcl_rwdatabases;
40 /*---------- from lookup.c ----------*/
42 int cht_cdb_donesomelookup(Tcl_Interp *ip, void *db_v,
43 Tcl_Obj *def, Tcl_Obj **result,
44 const Byte *data, int dlen,
45 int (*storeanswer)(Tcl_Interp *ip, Tcl_Obj **result,
46 const Byte *data, int len));
47 int cht_cdb_storeanswer_string(Tcl_Interp *ip, Tcl_Obj **result,
48 const Byte *data, int len);
49 int cht_cdb_storeanswer_hb(Tcl_Interp *ip, Tcl_Obj **result,
50 const Byte *data, int len);
51 int cht_cdb_lookup_cdb(Tcl_Interp *ip, struct cdb *cdb,
52 const Byte *key, int klen,
53 const Byte **data_r, int *dlen_r);
55 /*---------- macros ----------*/
58 rc= cht_posixerr(ip, errno, "failed to " m); goto x_rc; \
61 #endif /*CHIARK_TCL_CDB_H*/