1 | /* gdbm.h - The include file for dbm users. */ |
---|
2 | |
---|
3 | /* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson. |
---|
4 | Copyright (C) 1990, 1991, 1993 Free Software Foundation, Inc. |
---|
5 | |
---|
6 | GDBM is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | GDBM is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | GNU General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU General Public License |
---|
17 | along with GDBM; see the file COPYING. If not, write to |
---|
18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
19 | |
---|
20 | You may contact the author by: |
---|
21 | e-mail: phil@cs.wwu.edu |
---|
22 | us-mail: Philip A. Nelson |
---|
23 | Computer Science Department |
---|
24 | Western Washington University |
---|
25 | Bellingham, WA 98226 |
---|
26 | |
---|
27 | *************************************************************************/ |
---|
28 | |
---|
29 | /* Protection for multiple includes. */ |
---|
30 | #ifndef _GDBM_H_ |
---|
31 | #define _GDBM_H_ |
---|
32 | |
---|
33 | /* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who |
---|
34 | can create the database. */ |
---|
35 | #define GDBM_READER 0 /* A reader. */ |
---|
36 | #define GDBM_WRITER 1 /* A writer. */ |
---|
37 | #define GDBM_WRCREAT 2 /* A writer. Create the db if needed. */ |
---|
38 | #define GDBM_NEWDB 3 /* A writer. Always create a new db. */ |
---|
39 | #define GDBM_FAST 0x10 /* Write fast! => No fsyncs. OBSOLETE. */ |
---|
40 | #define GDBM_SYNC 0x20 /* Sync operations to the disk. */ |
---|
41 | #define GDBM_NOLOCK 0x40 /* Don't do file locking operations. */ |
---|
42 | |
---|
43 | /* Parameters to gdbm_store for simple insertion or replacement in the |
---|
44 | case that the key is already in the database. */ |
---|
45 | #define GDBM_INSERT 0 /* Never replace old data with new. */ |
---|
46 | #define GDBM_REPLACE 1 /* Always replace old data with new. */ |
---|
47 | |
---|
48 | /* Parameters to gdbm_setopt, specifing the type of operation to perform. */ |
---|
49 | #define GDBM_CACHESIZE 1 /* Set the cache size. */ |
---|
50 | #define GDBM_FASTMODE 2 /* Toggle fast mode. OBSOLETE. */ |
---|
51 | #define GDBM_SYNCMODE 3 /* Turn on or off sync operations. */ |
---|
52 | #define GDBM_CENTFREE 4 /* Keep all free blocks in the header. */ |
---|
53 | #define GDBM_COALESCEBLKS 5 /* Attempt to coalesce free blocks. */ |
---|
54 | |
---|
55 | /* The data and key structure. This structure is defined for compatibility. */ |
---|
56 | typedef struct { |
---|
57 | char *dptr; |
---|
58 | int dsize; |
---|
59 | } datum; |
---|
60 | |
---|
61 | |
---|
62 | /* The file information header. This is good enough for most applications. */ |
---|
63 | typedef struct {int dummy[10];} *GDBM_FILE; |
---|
64 | |
---|
65 | /* Determine if the C(++) compiler requires complete function prototype */ |
---|
66 | #ifndef __P |
---|
67 | #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) |
---|
68 | #define __P(x) x |
---|
69 | #else |
---|
70 | #define __P(x) () |
---|
71 | #endif |
---|
72 | #endif |
---|
73 | |
---|
74 | /* External variable, the gdbm build release string. */ |
---|
75 | extern char *gdbm_version; |
---|
76 | |
---|
77 | |
---|
78 | /* GDBM C++ support */ |
---|
79 | #if defined(__cplusplus) || defined(c_plusplus) |
---|
80 | extern "C" { |
---|
81 | #endif |
---|
82 | |
---|
83 | /* These are the routines! */ |
---|
84 | |
---|
85 | extern GDBM_FILE gdbm_open __P((char *, int, int, int, void (*)())); |
---|
86 | extern void gdbm_close __P((GDBM_FILE)); |
---|
87 | extern int gdbm_store __P((GDBM_FILE, datum, datum, int)); |
---|
88 | extern datum gdbm_fetch __P((GDBM_FILE, datum)); |
---|
89 | extern int gdbm_delete __P((GDBM_FILE, datum)); |
---|
90 | extern datum gdbm_firstkey __P((GDBM_FILE)); |
---|
91 | extern datum gdbm_nextkey __P((GDBM_FILE, datum)); |
---|
92 | extern int gdbm_reorganize __P((GDBM_FILE)); |
---|
93 | extern void gdbm_sync __P((GDBM_FILE)); |
---|
94 | extern int gdbm_exists __P((GDBM_FILE, datum)); |
---|
95 | extern int gdbm_setopt __P((GDBM_FILE, int, int *, int)); |
---|
96 | extern int gdbm_fdesc __P((GDBM_FILE)); |
---|
97 | |
---|
98 | #if defined(__cplusplus) || defined(c_plusplus) |
---|
99 | } |
---|
100 | #endif |
---|
101 | |
---|