1 /*****************************************************************************/
2 /*                                                                           */
3 /*                 (C) Copyright 1991-1997  Alberto Pasquale                 */
4 /*                                                                           */
5 /*                   A L L   R I G H T S   R E S E R V E D                   */
6 /*                                                                           */
7 /*****************************************************************************/
8 /*                                                                           */
9 /* This source code is NOT in the public domain and it CANNOT be used or     */
10 /* distributed without written permission from the author.                   */
11 /*                                                                           */
12 /*****************************************************************************/
13 /*                                                                           */
14 /*   How to contact the author:  Alberto Pasquale of 2:332/504@fidonet       */
15 /*                               Viale Verdi 106                             */
16 /*                               41100 Modena                                */
17 /*                               Italy                                       */
18 /*                                                                           */
19 /*****************************************************************************/
20 
21 // V7.h
22 
23 #include <typedefs.h>
24 
25 
26 struct _CtlBlk {
27     word    CtlBlkSize; /* Blocksize of Index Blocks   */
28     long    CtlRoot;    /* Block number of Root        */
29     long    CtlHiBlk;   /* Block number of last block  */
30     long    CtlLoLeaf;  /* Block number of first leaf  */
31     long    CtlHiLeaf;  /* Block number of last leaf   */
32     long    CtlFree;    /* Head of freelist            */
33     word    CtlLvls;    /* Number of index levels      */
34     word    CtlParity;  /* XOR of above fields         */
35 };
36 
37 
38 struct _IndxRef {
39     word   IndxOfs; /* Offset of string into block */
40     word   IndxLen; /* Length of string            */
41     long   IndxData;/* Record number of string     */
42     long   IndxPtr; /* Block number of lower index */
43 };
44 
45 
46 struct _INodeBlk {
47     long    IndxFirst;  /* Pointer to next lower level */
48     long    IndxBLink;  /* Pointer to previous link    */
49     long    IndxFLink;  /* Pointer to next link        */
50     short   IndxCnt;    /* Count of Items in block     */
51     word    IndxStr;    /* Offset in block of 1st str  */
52     /* If IndxFirst is NOT -1, this is INode:          */
53     _IndxRef IndxRef[1];
54 };
55 
56 
57 struct _LeafRef {
58     word   KeyOfs;  /* Offset of string into block */
59     word   KeyLen;  /* Length of string            */
60     long   KeyVal;  /* Pointer to data block       */
61 };
62 
63 
64 struct _LNodeBlk {
65     /* IndxFirst is -1 in LNodes   */
66     long    IndxFirst;  /* Pointer to next lower level */
67     long    IndxBLink;  /* Pointer to previous link    */
68     long    IndxFLink;  /* Pointer to next link        */
69     short   IndxCnt;    /* Count of Items in block     */
70     word    IndxStr;    /* Offset in block of 1st str  */
71     _LeafRef LeafRef[1];
72 };
73 
74 
75 struct _ndx {
76     union {
77         _CtlBlk CtlBlk;
78         _INodeBlk INodeBlk;
79         _LNodeBlk LNodeBlk;
80         byte RawNdx[512];
81     };
82 };
83 
84 
85 
86