chiark / gitweb /
fix unused vars
[chiark-tcl.git] / cdb / chiark_tcl_cdb.h
1 /*
2  * cdb, cdb-wr - Tcl bindings for tinycdb and a journalling write extension
3  * Copyright 2006-2012 Ian Jackson
4  *
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.
9  *
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.
14  *
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/>.
17  */
18
19 #ifndef CHIARK_TCL_CDB_H
20 #define CHIARK_TCL_CDB_H
21
22 #include <sys/types.h>
23 #include <sys/stat.h>
24 #include <fcntl.h>
25 #include <unistd.h>
26
27 #include <ctype.h>
28 #include <stdio.h>
29
30 #include <cdb.h>
31
32 #include "hbytes.h"
33 #include "cdb+tcmdif.h"
34
35 #define RWSCF_OKJUNK 002
36
37 extern const IdDataSpec cdbtcl_databases, cdbtcl_rwdatabases;
38
39 /*---------- from lookup.c ----------*/
40
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);
53
54 /*---------- macros ----------*/
55
56 #define PE(m) do{                                               \
57     rc= cht_posixerr(ip, errno, "failed to " m); goto x_rc;     \
58   }while(0)
59
60 #endif /*CHIARK_TCL_CDB_H*/