8 typedef GDBM_FILE GDBM_File;
10 #define GDBM_BLOCKSIZE 0 /* gdbm defaults to stat blocksize */
11 #define gdbm_TIEHASH(dbtype, name, read_write, mode, fatal_func) \
12 gdbm_open(name, GDBM_BLOCKSIZE, read_write, mode, fatal_func)
14 #define gdbm_FETCH(db,key) gdbm_fetch(db,key)
15 #define gdbm_STORE(db,key,value,flags) gdbm_store(db,key,value,flags)
16 #define gdbm_DELETE(db,key) gdbm_delete(db,key)
17 #define gdbm_FIRSTKEY(db) gdbm_firstkey(db)
18 #define gdbm_NEXTKEY(db,key) gdbm_nextkey(db,key)
19 #define gdbm_EXISTS(db,key) gdbm_exists(db,key)
21 typedef void (*FATALFUNC)();
26 croak("GDBM_File::%s not implemented on this architecture", s);
30 /* GDBM allocates the datum with system malloc() and expects the user
31 * to free() it. So we either have to free() it immediately, or have
32 * perl free() it when it deallocates the SV, depending on whether
33 * perl uses malloc()/free() or not. */
35 output_datum(SV *arg, char *str, int size)
37 #if !defined(MYMALLOC) || (defined(MYMALLOC) && defined(PERL_POLLUTE_MALLOC))
38 sv_usepvn(arg, str, size);
40 sv_setpvn(arg, str, size);
45 /* Versions of gdbm prior to 1.7x might not have the gdbm_sync,
46 gdbm_exists, and gdbm_setopt functions. Apparently Slackware
47 (Linux) 2.1 contains gdbm-1.5 (which dates back to 1991).
50 #define gdbm_exists(db,key) not_here("gdbm_exists")
51 #define gdbm_sync(db) (void) not_here("gdbm_sync")
52 #define gdbm_setopt(db,optflag,optval,optlen) not_here("gdbm_setopt")
56 constant(char *name, int arg)
73 if (strEQ(name, "GDBM_CACHESIZE"))
75 return GDBM_CACHESIZE;
79 if (strEQ(name, "GDBM_FAST"))
85 if (strEQ(name, "GDBM_FASTMODE"))
91 if (strEQ(name, "GDBM_INSERT"))
97 if (strEQ(name, "GDBM_NEWDB"))
103 if (strEQ(name, "GDBM_READER"))
109 if (strEQ(name, "GDBM_REPLACE"))
115 if (strEQ(name, "GDBM_WRCREAT"))
121 if (strEQ(name, "GDBM_WRITER"))
175 MODULE = GDBM_File PACKAGE = GDBM_File PREFIX = gdbm_
184 gdbm_TIEHASH(dbtype, name, read_write, mode, fatal_func = (FATALFUNC)croak)
208 gdbm_STORE(db, key, value, flags = GDBM_REPLACE)
215 if (RETVAL < 0 && errno == EPERM)
216 croak("No write permission to gdbm file");
217 croak("gdbm store returned %d, errno %d, key \"%.*s\"",
218 RETVAL,errno,key.dsize,key.dptr);
219 /* gdbm_clearerr(db); */
232 gdbm_NEXTKEY(db, key)
251 gdbm_setopt (db, optflag, optval, optlen)