39 if (psmap[tbit / 8] & 0x80) {
42 psmap[tbit / 8] |= 0x80;
45 if (psmap[tbit / 8] & 0x40) {
48 psmap[tbit / 8] |= 0x40;
51 if (psmap[tbit / 8] & 0x20) {
54 psmap[tbit / 8] |= 0x20;
57 if (psmap[tbit / 8] & 0x10) {
60 psmap[tbit / 8] |= 0x10;
63 if (psmap[tbit / 8] & 0x08) {
66 psmap[tbit / 8] |= 0x08;
69 if (psmap[tbit / 8] & 0x04) {
72 psmap[tbit / 8] |= 0x04;
75 if (psmap[tbit / 8] & 0x02) {
78 psmap[tbit / 8] |= 0x02;
81 if (psmap[tbit / 8] & 0x01) {
84 psmap[tbit / 8] |= 0x01;
96 if (!(psmap[tbit / 8] & 0x80)) {
99 psmap[tbit / 8] ^= 0x80;
102 if (!(psmap[tbit / 8] & 0x40)) {
105 psmap[tbit / 8] ^= 0x40;
108 if (!(psmap[tbit / 8] & 0x20)) {
111 psmap[tbit / 8] ^= 0x20;
114 if (!(psmap[tbit / 8] & 0x10)) {
117 psmap[tbit / 8] ^= 0x10;
120 if (!(psmap[tbit / 8] & 0x08)) {
123 psmap[tbit / 8] ^= 0x08;
126 if (!(psmap[tbit / 8] & 0x04)) {
129 psmap[tbit / 8] ^= 0x04;
132 if (!(psmap[tbit / 8] & 0x02)) {
135 psmap[tbit / 8] ^= 0x02;
138 if (!(psmap[tbit / 8] & 0x01)) {
141 psmap[tbit / 8] ^= 0x01;
154 printf (
"Table node size: %d bytes\n", psvbptr->inodesize);
160 printf (
"Unable to allocate data row buffer!\n");
164 printf (
"Unable to get data status!\n");
167 if (psvbptr->iopenmode & ISVARLEN) {
169 (off_t) (sstat.st_size + psvbptr->iminrowlength + INTSIZE +
170 QUADSIZE) / (psvbptr->iminrowlength + INTSIZE +
174 psvbptr->iminrowlength) / (psvbptr->iminrowlength + 1);
178 printf (
"Unable to allocate node map!\n");
183 printf (
"Unable to allocate node map!\n");
188 printf (
"Unable to get index status!\n");
191 gtindexsize = (off_t)(sstat.st_size + psvbptr->inodesize -
192 1) / psvbptr->inodesize;
195 printf (
"Unable to allocate node map!\n");
200 printf (
"Unable to allocate node map!\n");
205 printf (
"Unable to allocate buffer!\n");
243 for (tloop = 1; tloop <=
gtdatasize; tloop++) {
263 off_t tfreehead, tfreerow, tholdhead, tloop;
271 tfreehead = tholdhead;
324 for (tloop = 0; tloop < (
gtdatasize + 7) / 8; tloop++) {
342 off_t tfreehead, tfreenode, tholdhead;
349 tholdhead = tfreehead;
447 memset (&stree, 0,
sizeof (stree));
455 if (
ivbnodeload (ihandle, ikey, &stree, tnode, ilevel)) {
458 for (iloop = 0; iloop < stree.
ikeysinnode; iloop++) {
465 printf (
"Index is out of order!\n");
474 printf (
"Index is out of order!\n");
487 printf (
"Bad data row pointer!\n");
512 for (tloop = 0; tloop < (
gtdatasize + 7) / 8; tloop++) {
525 int ikey, iloop, ipart;
527 for (iloop = 0; iloop <
MAXSUBS; iloop++) {
532 printf (
"Corrupted Key Descriptor node(s)! Can't continue!\n");
536 for (ikey = 0; ikey < psvbptr->
inkeys; ikey++) {
537 printf (
"Index %d: ", ikey + 1);
540 k_flags & ISDUPS ?
"ISDUPS" :
"ISNODUPS");
543 k_flags & DCOMPRESS ?
"DCOMPRESS " :
"");
546 k_flags & LCOMPRESS ?
"LCOMPRESS " :
"");
549 k_flags & TCOMPRESS ?
"TCOMPRESS" :
"");
550 for (ipart = 0; ipart < psvbptr->
pskeydesc[ikey]->k_nparts; ipart++) {
551 printf (
" Part %d: ", ipart + 1);
553 psvbptr->
pskeydesc[ikey]->k_part[ipart].kp_start);
555 psvbptr->
pskeydesc[ikey]->k_part[ipart].kp_leng);
556 switch (psvbptr->
pskeydesc[ikey]->k_part[ipart].
568 printf (
"DOUBLETYPE");
571 printf (
"FLOATTYPE");
577 printf (
"UNKNOWN TYPE");
580 if (psvbptr->
pskeydesc[ikey]->k_part[ipart].kp_type & ISDESC) {
581 printf (
" ISDESC\n");
611 printf (
"Rebuilding index free list\n");
621 printf (
"Error %d rebuilding index free list!\n",
iserrno);
633 printf (
"Rebuilding data free list\n");
640 printf (
"Error %d rebuilding data free list!\n",
iserrno);
654 unsigned char ckeyvalue[VB_MAX_KEYLEN];
657 if (psvbptr->
pskeydesc[ikey]->k_nparts == 0) {
661 iresult =
ivbkeysearch (ihandle, ISGREAT, ikey, 0, ckeyvalue, 0);
663 if (iresult >= 0 && !
ivbkeyload (ihandle, ikey, ISPREV, 0, &psKey)
664 && !memcmp (psKey->
ckey, ckeyvalue,
667 if (psvbptr->
pskeydesc[ikey]->k_flags & ISDUPS) {
670 printf (
"Error! Duplicate entry in key %d\n", ikey);
673 iresult =
ivbkeysearch (ihandle, ISGTEQ, ikey, 0, ckeyvalue, tdupnumber);
688 for (trownumber = 1; trownumber <=
gtdatasize; trownumber++) {
693 for (ikey = 0; ikey <
MAXSUBS; ikey++) {
707 int ikeycounttorebuild = 0, iloop;
709 for (tloop = 0; tloop < (
gtindexsize + 7) / 8; tloop++) {
721 for (iloop = 0; iloop <
MAXSUBS; iloop++)
723 if (!ikeycounttorebuild) {
724 printf (
"Rebuilding keys: ");
726 printf (
"%d ", iloop + 1);
727 ikeycounttorebuild++;
729 if (ikeycounttorebuild) {
770 ihandle =
isopen (pcfile, ISINOUT + ISEXCLLOCK);
771 if (ihandle < 0 &&
iserrno == EROWSIZE) {
772 printf (
"Recovery of ISVARLEN files not possible\n");
773 printf (
"File %s contains variable length rows!\n", pcfile);
780 printf (
"Error %d opening %s\n",
iserrno, pcfile);
784 printf (
"Processing: %s\n", pcfile);
static int ipreamble(ihandle)
struct VBFILE svbfile[128 *3]
static int inl_ldint(void *pclocation)
static int ichecktree(int ihandle, int ikey, off_t tnode, int ilevel)
int isfullclose(const int ihandle)
int ivbdatafree(const int ihandle, const off_t trownumber)
int ischeck(const char *pcfile)
static off_t gtlastuseddata
static char * gpsindexmap[2]
int ivbkeysearch(const int ihandle, const int imode, const int ikeynumber, int ilength, unsigned char *pckeyvalue, off_t tdupnumber)
int ivbblockread(const int ihandle, const int iisindex, const off_t tblocknumber, char *cbuffer)
static char * gpsdatamap[2]
int ivbkeycompare(const int ihandle, const int ikeynumber, int ilength, unsigned char *pckey1, unsigned char *pckey2)
static int girebuilddatafree
int ivbenter(const int ihandle, const unsigned int imodifying, const unsigned int ispecial)
int ivbkeyload(const int ihandle, const int ikeynumber, const int imode, const int isetcurr, struct VBKEY **ppskey)
int ivbnodeload(const int ihandle, const int ikeynumber, struct VBTREE *pstree, const off_t tnodenumber, const int iprevlvl)
static int iindexfreecheck(int ihandle)
static void vrebuilddatafree(int ihandle)
static void inl_stint(int ivalue, void *pclocation)
unsigned char iisdictlocked
static void ipostamble(int ihandle)
int isopen(const char *pcfilename, int imode)
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
void vvbkeyallfree(const int ihandle, const int ikeynumber, struct VBTREE *pstree)
static int ibittestandset(char *psmap, off_t tbit)
static int girebuildindexfree
struct DICTNODE sdictnode
static int idatacheck(int ihandle)
static int idatafreecheck(int ihandle)
static void vrebuildkeys(int ihandle)
static int icheckkey(int ihandle, int ikey)
void vvbmakekey(const struct keydesc *pskeydesc, char *pcrow_buffer, unsigned char *pckeyvalue)
int ivbdataread(const int ihandle, char *pcbuffer, int *pideletedrow, const off_t trownumber)
void * pvvbmalloc(const size_t size)
struct DICTINFO * psvbfile[128+1]
int ivbnodefree(const int ihandle, const off_t tnodenumber)
int ivbkeyinsert(const int ihandle, struct VBTREE *pstree, const int ikeynumber, unsigned char *pckeyvalue, off_t trownode, off_t tdupnumber, struct VBTREE *pschild)
int ivbexit(const int ihandle)
int ivbblockwrite(const int ihandle, const int iisindex, const off_t tblocknumber, const char *cbuffer)
void vvbtreeallfree(const int ihandle, const int ikeynumber, struct VBTREE *pstree)
static int iindexcheck(int ihandle)
struct VBKEY * pskeylist[512]
static void inl_stquad(off_t tvalue, void *pclocation)
static int girebuildkey[32]
static int icheckkeydesc(int ihandle)
struct VBTREE * pstree[32]
static void vrebuildindexfree(int ihandle)
struct keydesc * pskeydesc[32]
static int ibittestandreset(char *psmap, off_t tbit)
static off_t inl_ldquad(void *pclocation)
static void vprocess(int ihandle)
static void vaddkeyforrow(int ihandle, int ikey, off_t trownumber)