* elfcpp.h (NT_VERSION, NT_ARCH): Define as enum constants.
[binutils.git] / include / gdbm.h
blobd2a6006393476054687f82a3884d5b1909a20948
1 /* GNU DBM - DataBase Manager include file
2 Copyright 1989, 1991 Free Software Foundation, Inc.
3 Written by Philip A. Nelson.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
19 /* You may contact the author by:
20 e-mail: phil@wwu.edu
21 us-mail: Philip A. Nelson
22 Computer Science Department
23 Western Washington University
24 Bellingham, WA 98226
25 phone: (206) 676-3035
27 *************************************************************************/
29 /* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who
30 can create the database. */
31 #define GDBM_READER 0
32 #define GDBM_WRITER 1
33 #define GDBM_WRCREAT 2
34 #define GDBM_NEWDB 3
36 /* Parameters to gdbm_store for simple insertion or replacement. */
37 #define GDBM_INSERT 0
38 #define GDBM_REPLACE 1
41 /* The data and key structure. This structure is defined for compatibility. */
42 typedef struct {
43 char *dptr;
44 int dsize;
45 } datum;
48 /* The file information header. This is good enough for most applications. */
49 typedef struct {int dummy[10];} *GDBM_FILE;
52 /* These are the routines! */
54 extern GDBM_FILE gdbm_open ();
56 extern void gdbm_close ();
58 extern datum gdbm_fetch ();
60 extern int gdbm_store ();
62 extern int gdbm_delete ();
64 extern datum gdbm_firstkey ();
66 extern datum gdbm_nextkey ();
68 extern int gdbm_reorganize ();
71 /* gdbm sends back the following error codes in the variable gdbm_errno. */
72 typedef enum { NO_ERROR,
73 MALLOC_ERROR,
74 BLOCK_SIZE_ERROR,
75 FILE_OPEN_ERROR,
76 FILE_WRITE_ERROR,
77 FILE_SEEK_ERROR,
78 FILE_READ_ERROR,
79 BAD_MAGIC_NUMBER,
80 EMPTY_DATABASE,
81 CANT_BE_READER,
82 CANT_BE_WRITER,
83 READER_CANT_RECOVER,
84 READER_CANT_DELETE,
85 READER_CANT_STORE,
86 READER_CANT_REORGANIZE,
87 UNKNOWN_UPDATE,
88 ITEM_NOT_FOUND,
89 REORGANIZE_FAILED,
90 CANNOT_REPLACE}
91 gdbm_error;