home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / mntinc25.zoo / gdbm.h < prev    next >
C/C++ Source or Header  |  1992-09-17  |  3KB  |  102 lines

  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  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 1, 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.         phone:  (206) 676-3035
  27.        
  28. *************************************************************************/
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. /* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who
  35.    can create the database. */
  36. #define  GDBM_READER  0        /* A reader. */
  37. #define  GDBM_WRITER  1        /* A writer. */
  38. #define  GDBM_WRCREAT 2        /* A writer.  Create the db if needed. */
  39. #define  GDBM_NEWDB   3        /* A writer.  Always create a new db. */
  40.  
  41. /* Parameters to gdbm_store for simple insertion or replacement in the
  42.    case that the key is already in the database. */
  43. #define  GDBM_INSERT  0        /* Never replace old data with new. */
  44. #define  GDBM_REPLACE 1        /* Always replace old data with new. */
  45.  
  46.  
  47. /* The data and key structure.  This structure is defined for compatibility. */
  48. typedef struct {
  49.     char *dptr;
  50.     int   dsize;
  51.       } datum;
  52.  
  53.  
  54. /* The file information header. This is good enough for most applications. */
  55. typedef struct {int dummy[10];} *GDBM_FILE;
  56.  
  57.  
  58. /* These are the routines! */
  59.  
  60. extern GDBM_FILE gdbm_open ();
  61.  
  62. extern void     gdbm_close ();
  63.  
  64. extern datum     gdbm_fetch ();
  65.  
  66. extern int     gdbm_store ();
  67.  
  68. extern int     gdbm_delete ();
  69.  
  70. extern datum     gdbm_firstkey ();
  71.  
  72. extern datum     gdbm_nextkey ();
  73.  
  74. extern int     gdbm_reorganize ();
  75.  
  76.  
  77. /* gdbm sends back the following error codes in the variable gdbm_errno. */
  78. typedef enum {    GDBM_NO_ERROR,
  79.         GDBM_MALLOC_ERROR,
  80.         GDBM_BLOCK_SIZE_ERROR,
  81.         GDBM_FILE_OPEN_ERROR,
  82.         GDBM_FILE_WRITE_ERROR,
  83.         GDBM_FILE_SEEK_ERROR,
  84.         GDBM_FILE_READ_ERROR,
  85.         GDBM_BAD_MAGIC_NUMBER,
  86.         GDBM_EMPTY_DATABASE,
  87.         GDBM_CANT_BE_READER,
  88.             GDBM_CANT_BE_WRITER,
  89.         GDBM_READER_CANT_DELETE,
  90.         GDBM_READER_CANT_STORE,
  91.         GDBM_READER_CANT_REORGANIZE,
  92.         GDBM_UNKNOWN_UPDATE,
  93.         GDBM_ITEM_NOT_FOUND,
  94.         GDBM_REORGANIZE_FAILED,
  95.         GDBM_CANNOT_REPLACE,
  96.         GDBM_ILLEGAL_DATA}
  97.     gdbm_error;
  98.  
  99. #ifdef __cplusplus
  100. }
  101. #endif
  102.