Spaces:
Runtime error
Runtime error
| /* gdbm.h - The include file for dbm users. -*- c -*- */ | |
| /* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson. | |
| Copyright (C) 1990-1991, 1993, 2011, 2016-2018 Free Software | |
| Foundation, Inc. | |
| GDBM is free software; you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2, or (at your option) | |
| any later version. | |
| GDBM is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | |
| You should have received a copy of the GNU General Public License | |
| along with GDBM. If not, see <http://www.gnu.org/licenses/>. | |
| You may contact the author by: | |
| e-mail: phil@cs.wwu.edu | |
| us-mail: Philip A. Nelson | |
| Computer Science Department | |
| Western Washington University | |
| Bellingham, WA 98226 | |
| *************************************************************************/ | |
| /* Protection for multiple includes. */ | |
| /* GDBM C++ support */ | |
| extern "C" { | |
| /* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who | |
| can create the database. */ | |
| /* Parameters to gdbm_store for simple insertion or replacement in the | |
| case that the key is already in the database. */ | |
| /* Parameters to gdbm_setopt, specifing the type of operation to perform. */ | |
| /* Compatibility defines: */ | |
| typedef unsigned long long int gdbm_count_t; | |
| /* The data and key structure. */ | |
| typedef struct | |
| { | |
| char *dptr; | |
| int dsize; | |
| } datum; | |
| /* A pointer to the GDBM file. */ | |
| typedef struct gdbm_file_info *GDBM_FILE; | |
| /* External variable, the gdbm build release string. */ | |
| extern const char *gdbm_version; | |
| extern int const gdbm_version_number[3]; | |
| /* GDBM external functions. */ | |
| extern GDBM_FILE gdbm_fd_open (int fd, const char *file_name, int block_size, | |
| int flags, void (*fatal_func) (const char *)); | |
| extern GDBM_FILE gdbm_open (const char *, int, int, int, | |
| void (*)(const char *)); | |
| extern int gdbm_close (GDBM_FILE); | |
| extern int gdbm_store (GDBM_FILE, datum, datum, int); | |
| extern datum gdbm_fetch (GDBM_FILE, datum); | |
| extern int gdbm_delete (GDBM_FILE, datum); | |
| extern datum gdbm_firstkey (GDBM_FILE); | |
| extern datum gdbm_nextkey (GDBM_FILE, datum); | |
| extern int gdbm_reorganize (GDBM_FILE); | |
| extern int gdbm_sync (GDBM_FILE); | |
| extern int gdbm_exists (GDBM_FILE, datum); | |
| extern int gdbm_setopt (GDBM_FILE, int, void *, int); | |
| extern int gdbm_fdesc (GDBM_FILE); | |
| extern int gdbm_export (GDBM_FILE, const char *, int, int); | |
| extern int gdbm_export_to_file (GDBM_FILE dbf, FILE *fp); | |
| extern int gdbm_import (GDBM_FILE, const char *, int); | |
| extern int gdbm_import_from_file (GDBM_FILE dbf, FILE *fp, int flag); | |
| extern int gdbm_count (GDBM_FILE dbf, gdbm_count_t *pcount); | |
| typedef struct gdbm_recovery_s | |
| { | |
| /* Input members. | |
| These are initialized before call to gdbm_recover. The flags argument | |
| specifies which of them are initialized. */ | |
| void (*errfun) (void *data, char const *fmt, ...); | |
| void *data; | |
| size_t max_failed_keys; | |
| size_t max_failed_buckets; | |
| size_t max_failures; | |
| /* Output members. | |
| The gdbm_recover function fills these before returning. */ | |
| size_t recovered_keys; | |
| size_t recovered_buckets; | |
| size_t failed_keys; | |
| size_t failed_buckets; | |
| size_t duplicate_keys; | |
| char *backup_name; | |
| } gdbm_recovery; | |
| extern int gdbm_recover (GDBM_FILE dbf, gdbm_recovery *rcvr, int flags); | |
| extern int gdbm_dump (GDBM_FILE, const char *, int fmt, int open_flags, | |
| int mode); | |
| extern int gdbm_dump_to_file (GDBM_FILE, FILE *, int fmt); | |
| extern int gdbm_load (GDBM_FILE *, const char *, int replace, | |
| int meta_flags, | |
| unsigned long *line); | |
| extern int gdbm_load_from_file (GDBM_FILE *, FILE *, int replace, | |
| int meta_flags, | |
| unsigned long *line); | |
| extern int gdbm_copy_meta (GDBM_FILE dst, GDBM_FILE src); | |
| /* This one was never used and will be removed in the future */ | |
| typedef int gdbm_error; | |
| extern int *gdbm_errno_location (void); | |
| extern const char * const gdbm_errlist[]; | |
| extern int const gdbm_syserr[]; | |
| extern gdbm_error gdbm_last_errno (GDBM_FILE dbf); | |
| extern int gdbm_last_syserr (GDBM_FILE dbf); | |
| extern void gdbm_set_errno (GDBM_FILE dbf, gdbm_error ec, int fatal); | |
| extern void gdbm_clear_error (GDBM_FILE dbf); | |
| extern int gdbm_needs_recovery (GDBM_FILE dbf); | |
| extern int gdbm_check_syserr (gdbm_error n); | |
| /* extra prototypes */ | |
| extern const char *gdbm_strerror (gdbm_error); | |
| extern const char *gdbm_db_strerror (GDBM_FILE dbf); | |
| extern int gdbm_version_cmp (int const a[], int const b[]); | |
| typedef void (*gdbm_debug_printer_t) (char const *, ...); | |
| extern gdbm_debug_printer_t gdbm_debug_printer; | |
| extern int gdbm_debug_flags; | |
| extern int gdbm_debug_token (char const *tok); | |
| extern void gdbm_debug_parse_state (int (*f) (void *, int, char const *), | |
| void *d); | |
| extern void gdbm_debug_datum (datum dat, char const *pfx); | |
| } | |