root/tags/5.4.pre05/ciifu2.c

Revision 1, 7.3 kB (checked in by heitor.barbieri, 4 years ago)

Criação do svn para Cisis.

Line 
1#if LINDLUX /* 2y */
2
3#define LUXPRINT0 0
4#define LUXPRINT1 0
5#define LUXPRINT2 0
6#define LUXPRINT3 0
7
8#if LUXPRINT0
9    printf("\n");
10#endif
11
12if (invp->lvxiflind) {
13
14    /* process .iyp */
15
16    if (!invp->lvxpages) return;
17
18    /* create .iyp file */
19    fpccreat(NULL,DBXname,ix1extp,0);
20
21#if DUPMFNSTRING
22    /* check duplicated posting - MFNSTRING */
23    for (luxtree=0; luxtree < 2; luxtree++) {
24
25#if LUXPRINT0
26    printf("+++lvx treecase=%d \n",luxtree);
27#endif
28        /* left to right */
29        for (luxpunt=1; luxpunt <= invp->luxpages[luxtree]; ) {
30            luxpagp=invp->luxvpagp[luxtree][luxpunt];
31            if (luxtree) {
32                luxp2=(L2STRU *)luxpagp;
33                for (luxn=0; luxn < luxp2->ock; luxn++) {
34                    luxp2->idx[luxn].info1 = luxaddr;
35                    luxx=luxp2->idx[luxn].info2 * PMFNSIZ;
36                    if (luxx > invp->luxthresh) {
37                        luxx=invp->luxthresh;
38                        luxp2->idx[luxn].info3info4.info3 = -luxx;
39                    }
40                    else
41                        if (luxp2->idx[luxn].info3info4.info3)
42                            fatal("ifupd2/info3");
43                    luxaddr+=luxx;
44                }
45            }
46            else {
47                luxp1=(L1STRU *)luxpagp;
48                for (luxn=0; luxn < luxp1->ock; luxn++) {
49                    luxp1->idx[luxn].info1 = luxaddr;
50                    luxx=luxp1->idx[luxn].info2 * PMFNSIZ;
51                    if (luxx > invp->luxthresh) {
52                        luxx=invp->luxthresh;
53                        luxp1->idx[luxn].info3info4.info3 = -luxx;
54                    }
55                    else
56                        if (luxp1->idx[luxn].info3info4.info3)
57                            fatal("ifupd2/info3");
58                    luxaddr+=luxx;
59                }
60            }
61
62            /* get next leaf */
63            luxpunt=luxpagp->ps;
64
65            if (!luxpunt) break;
66
67        } /* end for luxpunt */
68
69    } /* end for luxtree */
70#endif /* DUPMFNSTRING */
71
72    /* write posting blocks */
73    for (luxx=0; luxx < invp->lvxpages; luxx++) {
74        luxp=(char *)invp->lvxvpagp[luxx];
75        fpcwrite(luxp,LVXIYPBS);
76    } /* end for luxx */
77
78    /* end write posting blocks */
79    fpcclose();
80
81} else {  /* else if invp->lvxlind */
82
83    /* process node's */
84
85    for (luxtree=0; luxtree < 2; luxtree++) {
86
87#if LUXPRINT0
88    printf("+++ltx treecase=%d \n",luxtree);
89#endif
90
91        if (!invp->ltxpages[luxtree]) return;
92
93        /* create .n0x file */
94        fpccreat(NULL,DBXname,nx12extp[luxtree],0);
95
96        /* write node's */
97        for (luxpunt=1; luxpunt <= invp->ltxpages[luxtree]; luxpunt++) {
98            luxx=(luxtree)?N2BSIZ:N1BSIZ;
99            luxp=(char *)invp->ltxvpagp[luxtree][luxpunt];
100            fpcwrite(luxp,luxx);
101        } /* end for luxpunt */
102
103        /* end write leaf's */
104        fpcclose();
105
106    } /* end for luxtree */
107
108
109    /* process leaf's */
110
111    luxaddr=0L;
112    luxpagp=NULL;
113   
114    for (luxtree=0; luxtree < 2; luxtree++, luxpagp=NULL) {
115
116#if LUXPRINT0
117    printf("+++lux treecase=%d \n",luxtree);
118#endif
119
120#if LUXPRINT0
121        printf("*%s\n",DBXname);
122        printf("idtype ordn ordf   n   k  liv    ");
123        printf("posrx nmaxpos  fmaxpos  abnormal\n");
124        printf("%4d  %4d %4d %4d%4d",invp->cn[luxtree].idtype,
125                                        invp->cn[luxtree].ordn,
126                                        invp->cn[luxtree].ordf,
127                                        invp->cn[luxtree].n,
128                                        invp->cn[luxtree].k);
129        printf("%4d %8ld",invp->cn[luxtree].liv,invp->cn[luxtree].posrx);
130        printf("%8ld %8ld    %4d\n",invp->cn[luxtree].nmaxpos,
131                                    invp->cn[luxtree].fmaxpos,
132                                    invp->cn[luxtree].abnormal);
133#endif
134
135        if (!invp->luxpages[luxtree]) return;
136
137        /* create .l0x file */
138        fpccreat(NULL,DBXname,lx12extp[luxtree],0);
139
140        /* update psb - left to right */
141        luxpos=0; luxx=0;
142        for (luxpunt=1; luxpunt <= invp->luxpages[luxtree]; ) {
143            luxpagp=invp->luxvpagp[luxtree][luxpunt];
144            if (luxpagp->pos != luxpunt) fatal("ifupd2/pos");
145            luxpagp->psb=luxpos; luxpos=luxpunt; luxpunt=luxpagp->ps; 
146#if LUXPRINT1
147printf("+++ps=%ld/%ld pos=%ld punt=%ld \n",luxpagp->psb,luxpagp->ps,
148                                                        luxpos,luxpunt);
149#endif
150            luxx++;
151            if (luxx == invp->luxpages[luxtree]) 
152                if (luxpunt) fatal("ifupd2/ps");
153            if (!luxpunt) break;
154        } /* end for luxpunt */
155        if (luxx != invp->luxpages[luxtree]) fatal("ifupd2/pages");
156
157        /* update info1 - left to right */
158        for (luxpunt=1; luxpunt <= invp->luxpages[luxtree]; ) {
159            luxpagp=invp->luxvpagp[luxtree][luxpunt];
160#if LUXPRINT2
161printf("+++pos=%ld punt=%ld thresh=%ld \n",luxpagp->pos,luxpunt,
162                                                        invp->luxthresh);
163#endif
164            if (luxtree) {
165                luxp2=(L2STRU *)luxpagp;
166                for (luxn=0; luxn < luxp2->ock; luxn++) {
167#if LUXPRINT3
168 printf(" %2d ",luxn+1);
169 for (luxp=luxp2->idx[luxn].key, luxx=vlex[luxtree]; luxx--; luxp++)
170  printf("%c",*luxp);
171 printf(" %ld",luxp2->idx[luxn].info1);
172 printf("/%ld",luxp2->idx[luxn].info2);
173 printf("/%ld",luxp2->idx[luxn].info3info4.info3);
174 printf(" [%ld] \n",invp->luxthresh);
175#endif
176                    luxp2->idx[luxn].info1 = luxaddr;
177                    luxx=luxp2->idx[luxn].info2 * PMFNSIZ;
178                    if (luxx > invp->luxthresh) {
179                        luxx=invp->luxthresh;
180                        luxp2->idx[luxn].info3info4.info3 = -luxx;
181                    }
182                    else
183                        if (luxp2->idx[luxn].info3info4.info3)
184                            fatal("ifupd2/info3");
185                    luxaddr+=luxx;
186                }
187            }
188            else {
189                luxp1=(L1STRU *)luxpagp;
190                for (luxn=0; luxn < luxp1->ock; luxn++) {
191#if LUXPRINT3
192 printf("%2d ",luxn+1);
193 for (luxp=luxp1->idx[luxn].key, luxx=vlex[luxtree]; luxx--; luxp++)
194  printf("%c",*luxp);
195 printf(" %ld",luxp1->idx[luxn].info1);
196 printf("/%ld",luxp1->idx[luxn].info2);
197 printf("/%ld",luxp1->idx[luxn].info3info4.info3);
198 printf(" [%ld] \n",invp->luxthresh);
199#endif
200                    luxp1->idx[luxn].info1 = luxaddr;
201                    luxx=luxp1->idx[luxn].info2 * PMFNSIZ;
202                    if (luxx > invp->luxthresh) {
203                        luxx=invp->luxthresh;
204                        luxp1->idx[luxn].info3info4.info3 = -luxx;
205                    }
206                    else
207                        if (luxp1->idx[luxn].info3info4.info3)
208                            fatal("ifupd2/info3");
209                    luxaddr+=luxx;
210                }
211            }
212
213            /* get next leaf */
214            luxpunt=luxpagp->ps;
215
216            if (!luxpunt) break;
217
218        } /* end for luxpunt */
219
220        /* write leaf's */
221        for (luxpunt=1; luxpunt <= invp->luxpages[luxtree]; luxpunt++) {
222            luxx=(luxtree)?L2BSIZ:L1BSIZ;
223            luxp=(char *)invp->luxvpagp[luxtree][luxpunt];
224            fpcwrite(luxp,luxx);
225        } /* end for luxpunt */
226
227        /* end write leaf's */
228        fpcclose();
229
230    } /* end for luxtree */
231
232} /* end if invp->lvxlind */
233
234#endif /* LINDLUX 2y */
Note: See TracBrowser for help on using the browser.