43# define bcopy(a,b,c) memmove(b,a,c)
64 if ((db = (
DBM *)
malloc(
sizeof *db)) == 0)
74 if ((
flags & 03) == O_WRONLY)
76 strcpy(db->dbm_pagbuf, file);
77 strcat(db->dbm_pagbuf,
".pag");
81 strcpy(db->dbm_pagbuf, file);
82 strcat(db->dbm_pagbuf,
".dir");
87 db->dbm_maxbno = statb.st_size*
BYTESIZ-1;
88 db->dbm_pagbno = db->dbm_dirbno = -1;
91 (void) si_close(db->dbm_pagf);
221 fprintf(stderr,
"ndbm: split not paired\n");
225 if (!
additem(ovfbuf, item, item1) ||
288 if (item.dptr !=
NULL)
380 if ((
unsigned)n >= (unsigned)sp[0])
390 item.
dsize = t - sp[n+1];
401 for (
i=0,
j=sp[0];
i<
j;
i+=2, n = sp[
i])
406 if (n == 0 || memcmp(&
buf[sp[
i+1]], item.
dptr, n) == 0)
419 = { 61, 57, 53, 49, 45, 41, 37, 33,
420 29, 25, 21, 17, 13, 9, 5, 1,
424 06100151277L,06106161736L,06452611562L,05001724107L,
425 02614772546L,04120731531L,04665262210L,07347467531L,
426 06735253126L,06042345173L,03072226605L,01464164730L,
427 03247435524L,07652510057L,01546775256L,05714532133L,
428 06173260402L,07517101630L,02431460343L,01743245566L,
429 00261675137L,02433103631L,03421772437L,04447707466L,
430 04435620103L,03757017115L,03641531772L,06767633246L,
431 02673230344L,00260612216L,04133454451L,00615531516L,
432 06137717526L,02574116560L,02304023373L,07061702261L,
433 05153031405L,05322056705L,07401116734L,06552375715L,
434 06165233473L,05311063631L,01212221723L,01052267235L,
435 06000615237L,01075222665L,06330216006L,04402355630L,
436 01451177262L,02000133436L,06025467062L,07121076461L,
437 03123433522L,01010635225L,01716177066L,05161746527L,
438 01736635071L,06243505026L,03637211610L,01756474365L,
439 04723077174L,03642763134L,05750130273L,03655541561L,
456 hashi +=
hitab[c&017];
457 hashl +=
hltab[hashi&63];
461 return (
long)(hashl);
474 if ((
unsigned)n >= (unsigned)i2 || (n & 1))
491 for (sp1 = sp + sp[0], sp += n+1; sp <= sp1; sp++)
510 tmp = (i2+3) *
sizeof(
short);
511 if (i1 <= tmp)
return (0);
513 sp[++i2] = i1 + item1.
dsize;
528 for (
i=0;
i<sp[0];
i++)
534 if (t < (sp[0]+1)*
sizeof(short))
const CanonicalForm int s
static CFList split(const CanonicalForm &F, const int m, const Variable &x)
int dbm_store(DBM *db, datum key, datum dat, int replace)
datum dbm_fetch(DBM *db, datum key)
int singular_fstat(int fd, struct stat *buf)
static void dbm_access(DBM *db, long hash)
int dbm_delete(DBM *db, datum key)
STATIC_VAR long hltab[64]
datum dbm_nextkey(DBM *db)
datum dbm_firstkey(DBM *db)
static int additem(char buf[PBLKSIZ], datum item, datum item1)
DBM * dbm_open(char *file, int flags, int mode)
static void setbit(DBM *db)
static int delitem(char buf[PBLKSIZ], int n)
static int getbit(DBM *db)
long dbm_forder(DBM *db, datum key)
static datum makdatum(char buf[PBLKSIZ], int n)
static int finddatum(char buf[PBLKSIZ], datum item)
static long dcalchash(datum item)
int status int void size_t count int const void size_t count const char int flags
int status int void * buf