1a77dba0nectar/*
233f661cstas * Copyright (c) 2002 Kungliga Tekniska H��gskolan
3a77dba0nectar * (Royal Institute of Technology, Stockholm, Sweden).
4a77dba0nectar * All rights reserved.
533f661cstas *
6a77dba0nectar * Redistribution and use in source and binary forms, with or without
7a77dba0nectar * modification, are permitted provided that the following conditions
8a77dba0nectar * are met:
933f661cstas *
10a77dba0nectar * 1. Redistributions of source code must retain the above copyright
11a77dba0nectar *    notice, this list of conditions and the following disclaimer.
1233f661cstas *
13a77dba0nectar * 2. Redistributions in binary form must reproduce the above copyright
14a77dba0nectar *    notice, this list of conditions and the following disclaimer in the
15a77dba0nectar *    documentation and/or other materials provided with the distribution.
1633f661cstas *
17a77dba0nectar * 3. Neither the name of the Institute nor the names of its contributors
18a77dba0nectar *    may be used to endorse or promote products derived from this software
19a77dba0nectar *    without specific prior written permission.
2033f661cstas *
21a77dba0nectar * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22a77dba0nectar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23a77dba0nectar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24a77dba0nectar * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25a77dba0nectar * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26a77dba0nectar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27a77dba0nectar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28a77dba0nectar * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29a77dba0nectar * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30a77dba0nectar * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31a77dba0nectar * SUCH DAMAGE.
32a77dba0nectar */
33a77dba0nectar
3433f661cstas/* $Id$ */
35a77dba0nectar
36a77dba0nectar#ifndef __ndbm_wrap_h__
37a77dba0nectar#define __ndbm_wrap_h__
38a77dba0nectar
39a77dba0nectar#include <stdio.h>
40a77dba0nectar#include <sys/types.h>
41a77dba0nectar
4251b6601dfr#ifndef ROKEN_LIB_FUNCTION
4351b6601dfr#ifdef _WIN32
4433f661cstas#define ROKEN_LIB_FUNCTION
4533f661cstas#define ROKEN_LIB_CALL     __cdecl
4651b6601dfr#else
4751b6601dfr#define ROKEN_LIB_FUNCTION
4833f661cstas#define ROKEN_LIB_CALL
4951b6601dfr#endif
5051b6601dfr#endif
5151b6601dfr
52a77dba0nectar#ifndef dbm_rename
53a77dba0nectar#define dbm_rename(X)	__roken_ ## X
54a77dba0nectar#endif
55a77dba0nectar
56a77dba0nectar#define dbm_open	dbm_rename(dbm_open)
57a77dba0nectar#define dbm_close	dbm_rename(dbm_close)
58a77dba0nectar#define dbm_delete	dbm_rename(dbm_delete)
59a77dba0nectar#define dbm_fetch	dbm_rename(dbm_fetch)
60a77dba0nectar#define dbm_get		dbm_rename(dbm_get)
61a77dba0nectar#define dbm_firstkey	dbm_rename(dbm_firstkey)
62a77dba0nectar#define dbm_nextkey	dbm_rename(dbm_nextkey)
63a77dba0nectar#define dbm_store	dbm_rename(dbm_store)
64a77dba0nectar#define dbm_error	dbm_rename(dbm_error)
65a77dba0nectar#define dbm_clearerr	dbm_rename(dbm_clearerr)
66a77dba0nectar
67a77dba0nectar#define datum		dbm_rename(datum)
68a77dba0nectar
69a77dba0nectartypedef struct {
70a77dba0nectar    void *dptr;
71a77dba0nectar    size_t dsize;
72a77dba0nectar} datum;
73a77dba0nectar
74a77dba0nectar#define DBM_REPLACE 1
75a77dba0nectartypedef struct DBM DBM;
76a77dba0nectar
77a77dba0nectar#if 0
78a77dba0nectartypedef struct {
79a77dba0nectar    int dummy;
80a77dba0nectar} DBM;
81a77dba0nectar#endif
82a77dba0nectar
8333f661cstasROKEN_LIB_FUNCTION int   ROKEN_LIB_CALL dbm_clearerr (DBM*);
8433f661cstasROKEN_LIB_FUNCTION void  ROKEN_LIB_CALL dbm_close (DBM*);
8533f661cstasROKEN_LIB_FUNCTION int   ROKEN_LIB_CALL dbm_delete (DBM*, datum);
8633f661cstasROKEN_LIB_FUNCTION int   ROKEN_LIB_CALL dbm_error (DBM*);
8733f661cstasROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_fetch (DBM*, datum);
8833f661cstasROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_firstkey (DBM*);
8933f661cstasROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_nextkey (DBM*);
9033f661cstasROKEN_LIB_FUNCTION DBM*  ROKEN_LIB_CALL dbm_open (const char*, int, mode_t);
9133f661cstasROKEN_LIB_FUNCTION int   ROKEN_LIB_CALL dbm_store (DBM*, datum, datum, int);
92a77dba0nectar
93a77dba0nectar#endif /* __ndbm_wrap_h__ */
94