chiark / gitweb /
dispatch entrypoints
[chiark-tcl.git] / cdb / chiark_tcl_cdb.h
1 /*
2  */
3
4 #ifndef CHIARK_TCL_CDB_H
5 #define CHIARK_TCL_CDB_H
6
7 #include <sys/types.h>
8 #include <sys/stat.h>
9 #include <fcntl.h>
10 #include <unistd.h>
11
12 #include <ctype.h>
13 #include <stdio.h>
14
15 #include <cdb.h>
16
17 #include "hbytes.h"
18 #include "cdb+tcmdif.h"
19
20 #define RWSCF_OKJUNK 002
21
22 extern const IdDataSpec cdbtcl_databases, cdbtcl_rwdatabases;
23
24 /*---------- from lookup.c ----------*/
25
26 int cht_cdb_donesomelookup(Tcl_Interp *ip, void *db_v,
27                            Tcl_Obj *def, Tcl_Obj **result,
28                            const Byte *data, int dlen,
29                            int (*storeanswer)(Tcl_Interp *ip, Tcl_Obj **result,
30                                               const Byte *data, int len));
31 int cht_cdb_storeanswer_string(Tcl_Interp *ip, Tcl_Obj **result,
32                                const Byte *data, int len);
33 int cht_cdb_storeanswer_hb(Tcl_Interp *ip, Tcl_Obj **result,
34                            const Byte *data, int len);
35 int cht_cdb_lookup_cdb(Tcl_Interp *ip, struct cdb *cdb,
36                        const Byte *key, int klen,
37                        const Byte **data_r, int *dlen_r);
38
39 /*---------- macros ----------*/
40
41 #define PE(m) do{                                               \
42     rc= cht_posixerr(ip, errno, "failed to " m); goto x_rc;     \
43   }while(0)
44
45 #endif /*CHIARK_TCL_CDB_H*/