Back to index

cell-binutils  2.17cvs20070401
gdbm.h
Go to the documentation of this file.
00001 /* GNU DBM - DataBase Manager include file
00002    Copyright 1989, 1991  Free Software Foundation, Inc.
00003    Written by Philip A. Nelson.
00004 
00005 This program is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation; either version 2 of the License, or
00008 (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00018 
00019 /* You may contact the author by:
00020        e-mail:  phil@wwu.edu
00021       us-mail:  Philip A. Nelson
00022                 Computer Science Department
00023                 Western Washington University
00024                 Bellingham, WA 98226
00025         phone:  (206) 676-3035
00026        
00027 *************************************************************************/
00028 
00029 /* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who
00030    can create the database. */
00031 #define  GDBM_READER  0
00032 #define  GDBM_WRITER  1
00033 #define  GDBM_WRCREAT 2
00034 #define  GDBM_NEWDB   3
00035 
00036 /* Parameters to gdbm_store for simple insertion or replacement. */
00037 #define  GDBM_INSERT  0
00038 #define  GDBM_REPLACE 1
00039 
00040 
00041 /* The data and key structure.  This structure is defined for compatibility. */
00042 typedef struct {
00043        char *dptr;
00044        int   dsize;
00045       } datum;
00046 
00047 
00048 /* The file information header. This is good enough for most applications. */
00049 typedef struct {int dummy[10];} *GDBM_FILE;
00050 
00051 
00052 /* These are the routines! */
00053 
00054 extern GDBM_FILE gdbm_open ();
00055 
00056 extern void    gdbm_close ();
00057 
00058 extern datum   gdbm_fetch ();
00059 
00060 extern int     gdbm_store ();
00061 
00062 extern int     gdbm_delete ();
00063 
00064 extern datum   gdbm_firstkey ();
00065 
00066 extern datum   gdbm_nextkey ();
00067 
00068 extern int     gdbm_reorganize ();
00069 
00070 
00071 /* gdbm sends back the following error codes in the variable gdbm_errno. */
00072 typedef enum {       NO_ERROR,
00073               MALLOC_ERROR,
00074               BLOCK_SIZE_ERROR,
00075               FILE_OPEN_ERROR,
00076               FILE_WRITE_ERROR,
00077               FILE_SEEK_ERROR,
00078               FILE_READ_ERROR,
00079               BAD_MAGIC_NUMBER,
00080               EMPTY_DATABASE,
00081               CANT_BE_READER,
00082                CANT_BE_WRITER,
00083               READER_CANT_RECOVER,
00084               READER_CANT_DELETE,
00085               READER_CANT_STORE,
00086               READER_CANT_REORGANIZE,
00087               UNKNOWN_UPDATE,
00088               ITEM_NOT_FOUND,
00089               REORGANIZE_FAILED,
00090               CANNOT_REPLACE}
00091        gdbm_error;