1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
/* ----- RSTBase.h ----- */
#ifndef __RSTBase_h
#define __RSTBase_h
/*** Begin ----- naming rules for structured types ----- **********/
/*
Non vector types are always called "typ<..>",
Exceptions:
Side, rstree.
References to non vector types are always called "ref<..>".
Exceptions:
RSTREE.
Vector types are always called <..>Array.
Exceptions:
RSTName, typpoint, typrect, typfixblock,
and the internal arrays of the R*-tree as
typpath, typentrynumbs, typpagenrs, typflagarray, typpagecountarr.
*/
/*** End ----- naming rules for structured types ----- **********/
/* constants */
#define SIZEfixblock 512
#define maxnum (((SIZEfixblock-2*sizeof(int)) / sizeof(int))-1)
#define maxentries MaxNumbOfEntriesPerPage
#define EntryRange (maxentries+sizeof(int))
#define chainlen 42 /* 3^ 40 = 12,157,665,459,056,928,801 */
#define datasuffix ".Data"
#define dirPDsuffix ".DirPD"
#define dataPDsuffix ".DataPD"
#define STDMODE 0644
#define paramblocknumb 0
#define firstPDblocknumb (paramblocknumb+1)
#define rootblocknumb 0
/* types */
typedef typinterval *refinterval;
typedef char RSTName[MaxNameLength];
typedef double typpoint[NumbOfDim];
typedef double ValueArray[EntryRange];
typedef int IndexArray[EntryRange];
typedef byte ByteArray[EntryRange];
typedef typrect RectArray[EntryRange];
typedef typrect NbrsArray[EntryRange];
typedef typpoint PointArray[EntryRange];
typedef enum {
low,
high
} Side;
typedef struct {
typrect rect;
int ptrtosub;
PADDING_32_BITS;
typdirinfo info;
} typDIRent, *refDIRent; /* inner entry */
typedef struct {
typrect rect;
typinfo info;
} typDATAent, *refDATAent; /* data entry */
typedef union {
typDIRent DIR;
typDATAent DATA;
} typentry, *refentry; /* universal entry */
/* If typentry v; Then */
/* every access to rect by v.DIR.rect */
/* End */
/* hope the compiler-designers agree. */
typedef typDIRent typDIRentries[EntryRange];
typedef typDATAent typDATAentries[EntryRange];
typedef struct {
int nofentries;
PADDING_32_BITS;
typDIRentries entries; /* 0 .. nofentries-1 !! */
} typDIRnode, *refDIRnode; /* inner node */
typedef struct {
int nofentries;
typDATAentries entries; /* 0 .. nofentries-1 !! */
} typDATAnode, *refDATAnode; /* data node */
typedef union {
typDIRnode DIR;
typDATAnode DATA;
} typnode, *refnode; /* universal node */
/* If typnode v; Then */
/* every access to nofentries by v.DIR.nofentries */
/* End */
/* hope the compiler-designers agree. */
typedef refnode typpath[chainlen+1]; /* 1 .. height !! */
typedef int typentrynumbs[chainlen+1]; /* 1 .. height !! */
typedef int typpagenrs[chainlen+1]; /* 1 .. height !! */
typedef boolean typflagarray[chainlen+1]; /* 1 .. height !! */
typedef byte typfixblock[SIZEfixblock];
typedef struct {
int childnr;
int nofnumbers;
int number[maxnum+1]; /* 0 + [1 .. maxnum] !! */
} typpagedir, *refpagedir;
typedef union {
typpagedir _; /* call the intrinsics "_" */
typfixblock fixblock; /* adjust to SIZEfixblock */
} typPDblock, *refPDblock;
typedef int typpagecountarr[chainlen+1]; /* 1 .. height !! */
typedef struct {
boolean unique;
int height;
int SIZE_DIRnofentries, SIZE_DATAnofentries;
int SIZEinfo;
int direntrylen, dataentrylen;
int nbrsexam;
int reinstpercent;
int minfillpercent;
int dirreinsertqty, datareinsertqty;
int pagelen;
int dirM, dirMwords, dirm;
int dataM, dataMwords, datam;
int maxdim;
int dirpagecount, datapagecount, recordcount;
typpagecountarr pagecountarr;
} typparameters, *refparameters;
typedef union {
typparameters _; /* call the intrinsics "_" */
typfixblock fixblock; /* adjust to SIZEfixblock */
} typparamblock, *refparamblock;
typedef struct {
boolean countflag;
int dirvisitcount, datavisitcount;
int dirreadcount, datareadcount;
int dirmodifycount, datamodifycount;
int dirwritecount, datawritecount;
} typcount, *refcount;
typedef struct {
File f;
int bl;
} typfiledesc;
typedef struct {
int dirnodelen, datanodelen;
typpath N, NInst, NDel;
typentrynumbs E, EInst;
typpagenrs P;
typflagarray Nmodified, ReInsert;
typPDblock dirpagedir, datapagedir;
typparamblock parameters;
typcount count;
boolean RSTDone;
PADDING_32_BITS;
refnode helpdirnode, helpdatanode, Ntosplit, Nsibling;
typfiledesc dir, data, dirPD, dataPD;
RSTName dirname;
boolean readonly;
} rstree;
/****************************************************************/
/* begin **** --- types to check for alignment problems --- *****/
typedef
typDIRent typ2DIRentries[2];
typedef
typDATAent typ2DATAentries[2];
typedef
struct {
int nofentries;
PADDING_32_BITS;
typ2DIRentries entries;
} typDIRnodeOf2; /* inner node containing 2 entries */
typedef
struct {
int nofentries;
typ2DATAentries entries;
} typDATAnodeOf2; /* data node containing 2 entries */
typedef
typDIRent typ3DIRentries[3];
typedef
typDATAent typ3DATAentries[3];
typedef
struct {
int nofentries;
PADDING_32_BITS;
typ3DIRentries entries;
} typDIRnodeOf3; /* inner node containing 3 entries */
typedef
struct {
int nofentries;
typ3DATAentries entries;
} typDATAnodeOf3; /* data node containing 3 entries */
/* end **** --- types to check for alignment problems --- *****/
/****************************************************************/
#endif /* !__RSTBase_h */
|