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
|
/*
* Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*/
#include <online.dcl>
struct zonline online;
struct zversion version;
struct zref ref;
struct zstdindex stdindex;
struct ztrace trace;
/*
Initialises the System
Inputs:
pointer to path for files
e.g. c:\bible\scholar
*/
void DOINIT(CHAR *olbpath)
{
static CHAR *titles[10] =
{"\\id.dat", "\\text.dat", "\\textndx.dat", "\\tokens.dat",
"\\version.dat", "\\xref.dat", "\\xrefndx.dat", "\\xrefndxs.dat",
"\\cxref\\cxref.dat", "\\cxref\\cxrefndx.dat"};
CHAR path[64];
static long int zero ={0};
struct
{
CHAR key;
CHAR size[2];
INT indexsize;
int token_blksize;
} record;
int i;
int j;
/*
Open Files
*/
trace.level = -1;
X("Doinit");
for (i = 0; i < 8; i++)
{
STRCPY(path, olbpath, 64, "Doinit-1");
STRCAT(path, titles[i], 64,"Doinit-2");
call OPEN(i, path);
online.lrecl[i] = 0;
}
/*
Initialise Version Structure
*/
call READ(fp_version, sizeof(version), &version.version_id);
call CLOSE(fp_version);
call DUMPLINE("VERSION.DAT", 16, &version.version_id);
/* convert PLI strings to C-Weed format */
/*
for (i = 0; i < 128; i++)
call PLITOC(&(version.hot_words[i][0]), 9);
*/
for (i = 0; i < 66; i++)
call PLITOC(&(version.books[i][0]), 15);
/*
setup access to TEXT.DAT file
*/
call DREAD(fp_textndx, 3, &record.key, zero);
call DUMPLINE("TEXTNDX.DAT", 3, &record.key);
online.textndxsz = record.size[0];
if (record.key == 0) then
online.lrecl[fp_textndx] = 3;
else
online.lrecl[fp_textndx] = record.size[0];
/*
setup access to XREF.DAT file
*/
call DREAD(fp_xrefndx, 7, &record.key, zero);
call DUMPLINE("XREFNDX.DAT", 7, &record.key);
online.lrecl[fp_xrefndx] = record.size[0] + record.size[1];
online.xrefndxsz[0] = record.size[0];
online.xrefndxsz[1] = record.size[1];
if (record.key == 2) then
{
online.indexsize = record.indexsize;
online.tokenblksize = record.token_blksize * 2;
online.tokenarea = &online.tokenwork[0];
}
else
online.tokenblksize = 0;
/*
setup access to XREFNDXS.DAT file
*/
call DREAD(fp_xrefndxs, 3, &record.key, zero);
call DUMPLINE("XREFNDXS.DAT", 3, &record.key);
if (record.key == 0) then
online.lrecl[fp_xrefndxs] = 3;
else
online.lrecl[fp_xrefndxs] = record.size[0];
online.version_mark = 3;
/*
Setup Version ID for multiple versions
*/
call VERINIT();
/*
Setup Cross Reference Files
*/
for (i = 8; i < 10; i++)
{
STRCPY(path, olbpath, 64, "Doinit-3");
j = strlen(path);
while(path[j] != '\\')
j--;
path[j] = 0;
STRCAT(path, titles[i], 64, "Doinit-4");
call OPEN(i, path);
online.lrecl[i] = 0;
}
/*
setup access to CXREF.DAT file
*/
call DREAD(fp_cxrefndx, 3, &record.key, zero);
call DUMPLINE("CXREFNDX.DAT", 3, &record.key);
if (record.key == 0) then
online.lrecl[fp_cxrefndx] = 3;
else
online.lrecl[fp_cxrefndx] = record.size[0];
trace.traceflag = 1;
Y();
}
|