1 |
adcroft |
1.1 |
/* */ |
2 |
|
|
|
3 |
|
|
|
4 |
|
|
typedef struct ARRAY_Page |
5 |
|
|
{ |
6 |
|
|
unsigned long next; /* Next Page */ |
7 |
|
|
|
8 |
|
|
unsigned long page_number; |
9 |
|
|
int modified; |
10 |
|
|
int in_use; |
11 |
|
|
|
12 |
|
|
struct ARRAY_Page *next_cache; |
13 |
|
|
|
14 |
|
|
unsigned char data[0]; /* Page data */ |
15 |
|
|
} ARRAY_Page; |
16 |
|
|
|
17 |
|
|
#define ARRAY_CACHE_SIZE 97 |
18 |
|
|
|
19 |
|
|
typedef struct ARRAY |
20 |
|
|
{ |
21 |
|
|
unsigned long root_page; |
22 |
|
|
int page_size; |
23 |
|
|
struct ARRAY_Page *cache[ARRAY_CACHE_SIZE]; |
24 |
|
|
int levels; |
25 |
|
|
|
26 |
|
|
FILE *fp; |
27 |
|
|
} ARRAY; |
28 |
|
|
|
29 |
|
|
ARRAY *ARRAY_Create(FILE *fp); |
30 |
|
|
ARRAY *ARRAY_Open(FILE *fp, unsigned long root_page); |
31 |
|
|
unsigned long ARRAY_Close(ARRAY *bt); |
32 |
|
|
int ARRAY_Put(ARRAY *b, int index, unsigned long value); |
33 |
|
|
unsigned long ARRAY_Get(ARRAY *b, int index); |