| 1 | |
|---|
| 2 | |
|---|
| 3 | /* Begin PROCG |
|---|
| 4 | */ |
|---|
| 5 | #if PROCG |
|---|
| 6 | |
|---|
| 7 | if (batchp) { /* PROCG batchp */ |
|---|
| 8 | |
|---|
| 9 | char *batchp2; |
|---|
| 10 | #if PROCXREADREC |
|---|
| 11 | int dot = 0; |
|---|
| 12 | char rfnamp2[CIMPL]; |
|---|
| 13 | #endif |
|---|
| 14 | |
|---|
| 15 | for (p=batchp; *p; ) if (isspace(*p)) p++; else break; |
|---|
| 16 | |
|---|
| 17 | c=toupper(*p); errp=p++; |
|---|
| 18 | switch (c) { /* PROCG switch */ |
|---|
| 19 | |
|---|
| 20 | case 'G': |
|---|
| 21 | batchp2=p; |
|---|
| 22 | |
|---|
| 23 | #if PROCXDUMPREC |
|---|
| 24 | #include "ciupddump.c" |
|---|
| 25 | #endif /* PROCXDUMPREC */ |
|---|
| 26 | |
|---|
| 27 | #if PROCXMARKREC |
|---|
| 28 | #include "ciupdmark.c" |
|---|
| 29 | #endif /* PROCXMARKREC */ |
|---|
| 30 | |
|---|
| 31 | #if PROCXCLPSREC |
|---|
| 32 | #include "ciupdclps.c" |
|---|
| 33 | #endif /* PROCXCLPSREC */ |
|---|
| 34 | |
|---|
| 35 | #if PROCXSPLIREC |
|---|
| 36 | #include "ciupdsplt.c" |
|---|
| 37 | #endif /* PROCXSPLIREC */ |
|---|
| 38 | |
|---|
| 39 | //#if PROCXLOADREC |
|---|
| 40 | //#include "ciupdload.c" |
|---|
| 41 | //#endif /* PROCXLOADREC */ |
|---|
| 42 | |
|---|
| 43 | #if PROCXSOCKREC |
|---|
| 44 | //#include "ciupdsock.c" |
|---|
| 45 | #include "ciupdmarx.c" |
|---|
| 46 | #endif /* PROCXSOCKREC */ |
|---|
| 47 | |
|---|
| 48 | #if PROCXDECOREC |
|---|
| 49 | #include "ciupddeco.c" |
|---|
| 50 | #endif /* PROCXDECOREC */ |
|---|
| 51 | |
|---|
| 52 | #if PROCXSLT |
|---|
| 53 | #include "ciupdxslt.c" |
|---|
| 54 | #endif /* PROCXSLT */ |
|---|
| 55 | |
|---|
| 56 | #if PROCXGIZMREC |
|---|
| 57 | // Ggizmo |
|---|
| 58 | if (*p) { |
|---|
| 59 | DBXSTRU *dbxp; |
|---|
| 60 | char namedbx[CIMPL+1]; |
|---|
| 61 | #if !CICPP |
|---|
| 62 | LONGX gwrec; |
|---|
| 63 | #endif |
|---|
| 64 | char *q1,*q2; |
|---|
| 65 | for (q2=namedbx, *q2++=';', q1=p; *q1; q1++) if (*q1 == ',') break; else *q2++ = *q1; |
|---|
| 66 | *q2='\0'; |
|---|
| 67 | dbxp=dbxstorp(namedbx); |
|---|
| 68 | if (!DBXvgzrp) { /* first gizmo definition */ |
|---|
| 69 | #if CICPP |
|---|
| 70 | gizmread(cisisxp,p,&DBXvgzrp); |
|---|
| 71 | #else |
|---|
| 72 | for (gwrec=maxnrec; gwrec--; ) { |
|---|
| 73 | if (!vrecp[gwrec]) /* ja' decrementado */ break; |
|---|
| 74 | } |
|---|
| 75 | if (gwrec < 0) fatal("fldupdat/procx/G/gwrec"); |
|---|
| 76 | gizmread(p,&DBXvgzrp,gwrec); |
|---|
| 77 | if (gwrec >= 0) if (vrecp[gwrec]) { |
|---|
| 78 | FREE(vrecp[gwrec]); vrecp[gwrec]=NULL; nrecs--; |
|---|
| 79 | } |
|---|
| 80 | #endif |
|---|
| 81 | } |
|---|
| 82 | dbxp=dbxstorp(namedbx); /* dbxflush'ed in gizmread */ |
|---|
| 83 | #if CICPP |
|---|
| 84 | recgizmo(cisisxp,recp,DBXvgzrp); |
|---|
| 85 | #else |
|---|
| 86 | recgizmo(irec,DBXvgzrp); |
|---|
| 87 | #endif /* CICPP */ |
|---|
| 88 | } |
|---|
| 89 | return NULL; /*p="";*/ /* exit */ |
|---|
| 90 | //break; |
|---|
| 91 | #endif /* PROCXGIZMREC */ |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | /* procx.c */ |
|---|
| 96 | #if PROCXMFUPDATE |
|---|
| 97 | case 'X': |
|---|
| 98 | keepndbx=ndbxs; |
|---|
| 99 | while (isspace(*p)) p++; |
|---|
| 100 | #define COPY 1 |
|---|
| 101 | #define APPEND 2 |
|---|
| 102 | #define MERGE 3 |
|---|
| 103 | parmcopy=COPY; |
|---|
| 104 | if (strncmp(p,"create=",7) == 0) /* create= */ |
|---|
| 105 | { p+=7; recisis0(p); } |
|---|
| 106 | else { |
|---|
| 107 | if (strncmp(p,"copy=",5) == 0) /* copy= */ |
|---|
| 108 | { p+=5; } |
|---|
| 109 | else |
|---|
| 110 | if (strncmp(p,"append=",7) == 0) /* append= */ |
|---|
| 111 | {p+=7; parmcopy=APPEND;} |
|---|
| 112 | else |
|---|
| 113 | if (strncmp(p,"merge=",6) == 0) /* merge= */ |
|---|
| 114 | {p+=6; parmcopy=MERGE;} |
|---|
| 115 | dbxopt_fatal=0; xfd=dbxopen(p,p,mx1extp); |
|---|
| 116 | if (xfd <= 0) recisis0(p); else CLOSE(xfd); |
|---|
| 117 | } |
|---|
| 118 | |
|---|
| 119 | #if CICPP |
|---|
| 120 | upcrecp=new RECSTRU(cisisxp); |
|---|
| 121 | if (!upcrecp) fatal("fldupdat/procx/upcrec"); |
|---|
| 122 | upcrecp->xrecalloc(sizeof(M0STRU)); |
|---|
| 123 | upirecp=new RECSTRU(cisisxp); |
|---|
| 124 | if (!upirecp) fatal("fldupdat/procx/upirec"); |
|---|
| 125 | upirecp->xrecalloc(RECnbytes); |
|---|
| 126 | #if MULTI |
|---|
| 127 | if (strcmp(p,RECdbxp->dbxname) == 0) /* dbxstorp has already set dbxnetws */ |
|---|
| 128 | dbxstorp(p)->dbxnetws=dbxcinet(p); |
|---|
| 129 | if (dbxstorp(p)->dbxnetws != MONONETS) { |
|---|
| 130 | upirecp->reclock=RLOCK; |
|---|
| 131 | upcrecp->reclock=DELOCK; |
|---|
| 132 | } |
|---|
| 133 | #endif /* MULTI */ |
|---|
| 134 | |
|---|
| 135 | upcrecp->xrecord(p,0L); /* append */ /* DELOCK */ |
|---|
| 136 | #if MULTI |
|---|
| 137 | if (upcrecp->recrc == RCLOCK) fatal("fldupdat/procx/delock"); |
|---|
| 138 | if (upcrecp->recdbxp->dbxnetws != MONONETS) { |
|---|
| 139 | if (parmcopy == APPEND) upirecp->recwlock|=NEWREC; |
|---|
| 140 | else upirecp->recwlock|=NEWREC|FORCE; |
|---|
| 141 | } |
|---|
| 142 | #endif /* MULTI */ |
|---|
| 143 | upirecp->xrecord(p,MFRmfn); /* RLOCK */ |
|---|
| 144 | #if MULTI |
|---|
| 145 | if (upirecp->recrc == RCLOCK) fatal("fldupdat/procx/rlock"); |
|---|
| 146 | #endif /* MULTI */ |
|---|
| 147 | |
|---|
| 148 | if (parmcopy == MERGE) if (upirecp->recrc == RCNORMAL) n=0; |
|---|
| 149 | if (parmcopy == APPEND) if (MFRnvf <= 0) n=0; |
|---|
| 150 | |
|---|
| 151 | if (n) { |
|---|
| 152 | memcpy(upirecp->recmfp->mx,MFX,MFRmfrl); |
|---|
| 153 | if (parmcopy == APPEND) { |
|---|
| 154 | upirecp->recmfp->m1.m1mfn=upcrecp->recmfp->m0.m0nxtmfn; |
|---|
| 155 | #if MULTI |
|---|
| 156 | if (upcrecp->recdbxp->dbxnetws != MONONETS) upirecp->recmfp->m1.m1mfn=0L; |
|---|
| 157 | #endif /* MULTI */ |
|---|
| 158 | } |
|---|
| 159 | upirecp->xrecupdat(); |
|---|
| 160 | } |
|---|
| 161 | #if MULTI |
|---|
| 162 | if (upcrecp->recdbxp->dbxnetws != MONONETS) { |
|---|
| 163 | if (parmcopy == MERGE) if (!n) upirecp->xrecunlck(RLOCK); |
|---|
| 164 | upcrecp->xrecunlck(DELOCK); |
|---|
| 165 | } |
|---|
| 166 | #endif /* MULTI */ |
|---|
| 167 | delete upirecp; |
|---|
| 168 | delete upcrecp; |
|---|
| 169 | #else /* CICPP */ |
|---|
| 170 | for (upcrec=maxnrec; upcrec--; ) if (!vrecp[upcrec]) /* ja' decrementado */ break; |
|---|
| 171 | if (upcrec < 0) fatal("fldupdat/procx/upcrec"); |
|---|
| 172 | recallok(upcrec,(LONGX)sizeof(M0STRU)); |
|---|
| 173 | |
|---|
| 174 | for (upirec=maxnrec; upirec--; ) if (!vrecp[upirec]) /* ja' decrementado */ break; |
|---|
| 175 | if (upirec < 0) fatal("fldupdat/procx/upirec"); |
|---|
| 176 | recallok(upirec,RECnbytes); |
|---|
| 177 | |
|---|
| 178 | #if MULTI |
|---|
| 179 | if (strcmp(p,RECdbxp->dbxname) == 0) /* dbxstorp has already set dbxnetws */ |
|---|
| 180 | dbxstorp(p)->dbxnetws=dbxcinet(p); |
|---|
| 181 | if (dbxstorp(p)->dbxnetws != MONONETS) { |
|---|
| 182 | VREClock(upirec)=RLOCK; |
|---|
| 183 | VREClock(upcrec)=DELOCK; |
|---|
| 184 | } |
|---|
| 185 | #endif /* MULTI */ |
|---|
| 186 | record(upcrec,p,0L); /* append */ /* DELOCK */ |
|---|
| 187 | #if MULTI |
|---|
| 188 | if (VRECrc(upcrec) == RCLOCK) fatal("fldupdat/procx/delock"); |
|---|
| 189 | if (VRDBnetws(upcrec) != MONONETS) { |
|---|
| 190 | if (parmcopy == APPEND) VRECwlock(upirec)|=NEWREC; |
|---|
| 191 | else VRECwlock(upirec)|=NEWREC|FORCE; |
|---|
| 192 | } |
|---|
| 193 | #endif /* MULTI */ |
|---|
| 194 | record(upirec,p,MFRmfn); /* RLOCK */ |
|---|
| 195 | #if MULTI |
|---|
| 196 | if (VRECrc(upirec) == RCLOCK) fatal("fldupdat/procx/rlock"); |
|---|
| 197 | #endif /* MULTI */ |
|---|
| 198 | |
|---|
| 199 | if (parmcopy == MERGE) if (VRECrc(upirec) == RCNORMAL) n=0; |
|---|
| 200 | if (parmcopy == APPEND) if (MFRnvf <= 0) n=0; |
|---|
| 201 | |
|---|
| 202 | if (n) { |
|---|
| 203 | memcpy(VMFX(upirec),MFX,MFRmfrl); |
|---|
| 204 | if (parmcopy == APPEND) { |
|---|
| 205 | VMFRmfn(upirec)=VMF0nxtmfn(upcrec); |
|---|
| 206 | #if MULTI |
|---|
| 207 | if (VRDBnetws(upcrec) != MONONETS) VMFRmfn(upirec)=0L; |
|---|
| 208 | #endif /* MULTI */ |
|---|
| 209 | } |
|---|
| 210 | recupdat(upcrec,upirec); |
|---|
| 211 | } |
|---|
| 212 | #if MULTI |
|---|
| 213 | if (VRECdbxp(upcrec)->dbxnetws != MONONETS) { |
|---|
| 214 | if (parmcopy == MERGE) if (!n) recunlck(upirec,RLOCK); |
|---|
| 215 | recunlck(upcrec,DELOCK); |
|---|
| 216 | } |
|---|
| 217 | #endif /* MULTI */ |
|---|
| 218 | |
|---|
| 219 | FREE(vrecp[upirec]); vrecp[upirec]=NULL; nrecs--; |
|---|
| 220 | FREE(vrecp[upcrec]); vrecp[upcrec]=NULL; nrecs--; |
|---|
| 221 | #endif /* CICPP */ |
|---|
| 222 | #if KEEPDBX |
|---|
| 223 | for (idbx=ndbxs-1; idbx>=keepndbx; idbx--) |
|---|
| 224 | dbxflush(vdbxp[idbx]->dbxname); |
|---|
| 225 | #endif /* KEEPDBX */ |
|---|
| 226 | return NULL; /*p="";*/ /* exit */ |
|---|
| 227 | //break; |
|---|
| 228 | #undef COPY |
|---|
| 229 | #undef APPEND |
|---|
| 230 | #undef MERGE |
|---|
| 231 | #endif /* PROCXMFUPDATE */ |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | /* |
|---|
| 235 | 'R'v32001^*,,','v32001^m,,',gizmo=dbn,tags[;]',,',decod=dbn[;]' |
|---|
| 236 | */ |
|---|
| 237 | /* procx.c */ |
|---|
| 238 | #if PROCXREADREC |
|---|
| 239 | case 'R': |
|---|
| 240 | keepndbx=ndbxs; |
|---|
| 241 | if (*p == '=') { /* use master file directory as stored in DBXSTRU */ |
|---|
| 242 | p++; dot = 1; |
|---|
| 243 | } |
|---|
| 244 | while (isspace(*p)) p++; |
|---|
| 245 | rfnamp=p; rfmfn=MFRmfn; |
|---|
| 246 | rfmfnp=strchr(p,','); |
|---|
| 247 | if (rfmfnp) { |
|---|
| 248 | *rfmfnp++ = '\0'; |
|---|
| 249 | if (sscanf(rfmfnp,"%ld",&rfmfn) != 1) fatal(errp); |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | if (dot) { |
|---|
| 253 | rp = RDBname + strlen(RDBname) - 1; |
|---|
| 254 | while (rp != RDBname) { |
|---|
| 255 | if (*rp=='/' || *rp=='\\') { |
|---|
| 256 | break; |
|---|
| 257 | } |
|---|
| 258 | rp--; |
|---|
| 259 | } |
|---|
| 260 | if (*rp=='/' || *rp=='\\') { |
|---|
| 261 | strncpy(rfnamp2, RDBname, (rp - RDBname + 1)); |
|---|
| 262 | rfnamp2[rp - RDBname + 1] = 0; |
|---|
| 263 | } else { |
|---|
| 264 | *rfnamp2 = 0; |
|---|
| 265 | } |
|---|
| 266 | p = rfnamp + strlen(p) - 1; |
|---|
| 267 | while (p != rfnamp) { |
|---|
| 268 | if (*p=='/' || *p=='\\') { |
|---|
| 269 | p++; |
|---|
| 270 | break; |
|---|
| 271 | } |
|---|
| 272 | p--; |
|---|
| 273 | } |
|---|
| 274 | strcat(rfnamp2, p); |
|---|
| 275 | } else { |
|---|
| 276 | strcpy(rfnamp2, rfnamp); |
|---|
| 277 | } |
|---|
| 278 | #if CICPP |
|---|
| 279 | uprrecp=new RECSTRU(cisisxp); |
|---|
| 280 | if (!uprrecp) fatal("fldupdat/procx/uprrec"); |
|---|
| 281 | uprrecp->xrecalloc(RECnbytes); |
|---|
| 282 | uprrexp=new RECSTRU(cisisxp); rp=p=(char *)uprrexp; |
|---|
| 283 | if (!uprrexp) fatal("fldupdat/procx/uprrex"); |
|---|
| 284 | uprrexp->xrecalloc(RECnbytes); |
|---|
| 285 | uprrecp->xrecord(rfnamp2,rfmfn); keeprecp=recp; recp=uprrecp; |
|---|
| 286 | #else /* CICPP */ |
|---|
| 287 | for (uprrex=maxnrec; uprrex--; ) if (!vrecp[uprrex]) /* ja' decrementado */ break; |
|---|
| 288 | if (uprrex < 0) fatal("fldupdat/procx/r/uprrex"); |
|---|
| 289 | recallok(uprrex,RECnbytes); rp=p=(char *)vrecp[uprrex]; |
|---|
| 290 | for (uprrec=maxnrec; uprrec--; ) if (!vrecp[uprrec]) /* ja' decrementado */ break; |
|---|
| 291 | if (uprrec < 0) fatal("fldupdat/procx/r/uprrec"); |
|---|
| 292 | recallok(uprrec,RECnbytes); |
|---|
| 293 | record(uprrec,rfnamp2,rfmfn); keeprecp=recp; recp=vrecp[uprrec]; |
|---|
| 294 | #endif /* CICPP */ |
|---|
| 295 | if (RECrc == RCNORMAL) for (xdir=0; xdir < MFRnvf; xdir++) { |
|---|
| 296 | sprintf(rp,"H%ld %ld ",(LONGX)DIRtag(xdir),(LONGX)DIRlen(xdir)); rp+=strlen(rp); |
|---|
| 297 | memcpy(rp,FIELDP(xdir),DIRlen(xdir)); rp+=DIRlen(xdir); |
|---|
| 298 | } |
|---|
| 299 | *rp='\0'; recp=keeprecp; |
|---|
| 300 | #if CICPP |
|---|
| 301 | if (recp->xfldupdat(p)) fatal(errp); |
|---|
| 302 | delete uprrexp; |
|---|
| 303 | delete uprrecp; |
|---|
| 304 | #else /* CICPP */ |
|---|
| 305 | if (fldupdat(irec,p)) fatal(errp); |
|---|
| 306 | FREE(vrecp[uprrec]); vrecp[uprrec]=NULL; nrecs--; |
|---|
| 307 | FREE(vrecp[uprrex]); vrecp[uprrex]=NULL; nrecs--; |
|---|
| 308 | #endif /* CICPP */ |
|---|
| 309 | |
|---|
| 310 | #if KEEPDBX && 0 |
|---|
| 311 | for (idbx=ndbxs-1; idbx>=keepndbx; idbx--) |
|---|
| 312 | dbxflush(vdbxp[idbx]->dbxname); |
|---|
| 313 | #endif /* KEEPDBX */ |
|---|
| 314 | return NULL; /*p="";*/ /* exit */ |
|---|
| 315 | //break; |
|---|
| 316 | #endif /* PROCXREADREC */ |
|---|
| 317 | |
|---|
| 318 | /* procx.c */ |
|---|
| 319 | #if PROCXWRITEFILE |
|---|
| 320 | case 'F': |
|---|
| 321 | keepndbx=ndbxs; |
|---|
| 322 | while (isspace(*p)) p++; |
|---|
| 323 | wfnamp=p; |
|---|
| 324 | wfmtspecp=strchr(wfnamp,','); |
|---|
| 325 | if (wfmtspecp) { |
|---|
| 326 | *wfmtspecp++ = '\0'; |
|---|
| 327 | } |
|---|
| 328 | if (!strchr(wfnamp,'=')) |
|---|
| 329 | wfnamp=dbxopenc(RDBname,wfnamp,&wffd,NULL,errp,0,1); /* force append= */ |
|---|
| 330 | else |
|---|
| 331 | wfnamp=dbxopenc(RDBname,wfnamp,&wffd,NULL,errp,0,0); /* allow create=append= */ |
|---|
| 332 | if (wfmtspecp) { |
|---|
| 333 | wfxp=wfmtspecp; |
|---|
| 334 | if (CIWRITE(wffd,wfxp,wflen=strlen(wfxp)) != wflen) fatal(errp); |
|---|
| 335 | } |
|---|
| 336 | CLOSE(wffd); |
|---|
| 337 | #if KEEPDBX |
|---|
| 338 | for (idbx=ndbxs-1; idbx>=keepndbx; idbx--) |
|---|
| 339 | dbxflush(vdbxp[idbx]->dbxname); |
|---|
| 340 | #endif /* KEEPDBX */ |
|---|
| 341 | return NULL; /*p="";*/ /* exit */ |
|---|
| 342 | //break; |
|---|
| 343 | #endif /* PROCXWRITEFILE */ |
|---|
| 344 | |
|---|
| 345 | /* procx.c */ |
|---|
| 346 | #if PROCXIFPRESET |
|---|
| 347 | case 'Z': |
|---|
| 348 | keepndbx=ndbxs; |
|---|
| 349 | while (isspace(*p)) p++; |
|---|
| 350 | ifprnamp=p; if (!*ifprnamp) fatal(errp); |
|---|
| 351 | ifprmfnp=strchr(ifprnamp,','); |
|---|
| 352 | if (!ifprmfnp) ifprmfn=MFRmfn; else { /* AOT 05/10/02 */ |
|---|
| 353 | *ifprmfnp++ = '\0'; |
|---|
| 354 | if (sscanf(ifprmfnp,"%ld",&ifprmfn) != 1) fatal(errp); |
|---|
| 355 | } |
|---|
| 356 | #if MULTI |
|---|
| 357 | if (ifprnamp) { /* ok */ |
|---|
| 358 | DBXSTRU *dbxp; |
|---|
| 359 | RECSTRU *zrecp; |
|---|
| 360 | LONGX zrec; |
|---|
| 361 | int keepewlrc; |
|---|
| 362 | dbxp=dbxstorp(ifprnamp); |
|---|
| 363 | if (DBXnetws != MONONETS) { |
|---|
| 364 | #if CICPP |
|---|
| 365 | zrecp = new RECSTRU(cisisxp); |
|---|
| 366 | zrecp->xrecalloc(RECnbytes); zrecp->reclock=EWLOCK; |
|---|
| 367 | keepewlrc=dbxewlrc; dbxewlrc=1; zrecp->xrecord(ifprnamp,0L); |
|---|
| 368 | if (zrecp->recrc != RCNORMAL) { |
|---|
| 369 | printf("*** fldupdat/procx/z/EWLOCK \n"); fatal(errp); |
|---|
| 370 | } |
|---|
| 371 | #else /* CICPP */ |
|---|
| 372 | for (zrec=maxnrec; zrec--; ) if (!vrecp[zrec]) /* ja' decrementado */ break; |
|---|
| 373 | if (zrec < 0) fatal("fldupdat/procx/z/zrec"); |
|---|
| 374 | recallok(zrec,RECnbytes); zrecp=vrecp[zrec]; zrecp->reclock=EWLOCK; |
|---|
| 375 | keepewlrc=dbxewlrc; dbxewlrc=1; record(zrec,ifprnamp,0L); |
|---|
| 376 | if (zrecp->recrc != RCNORMAL) { |
|---|
| 377 | printf("*** fldupdat/procx/z/EWLOCK \n"); fatal(errp); |
|---|
| 378 | } |
|---|
| 379 | #endif /* CICPP */ |
|---|
| 380 | } |
|---|
| 381 | #endif /* MULTI */ |
|---|
| 382 | #if CICPP |
|---|
| 383 | recreset(ifprnamp,ifprmfn,ifprmfn,NULL,0L); |
|---|
| 384 | #else /* CICPP */ |
|---|
| 385 | recreset(ifprnamp,ifprmfn,ifprmfn,0L,0L); |
|---|
| 386 | #endif /* CICPP */ |
|---|
| 387 | #if MULTI |
|---|
| 388 | if (DBXnetws != MONONETS) { |
|---|
| 389 | #if CICPP |
|---|
| 390 | dbxewlrc=1; if (zrecp->xrecunlck(EWLOCK) != RCNORMAL) fatal("fldupdat/procx/z/unlock"); |
|---|
| 391 | delete zrecp; |
|---|
| 392 | #else /* CICPP */ |
|---|
| 393 | dbxewlrc=1; if (recunlck(zrec,EWLOCK) != RCNORMAL) fatal("fldupdat/procx/z/unlock"); |
|---|
| 394 | FREE(vrecp[zrec]); vrecp[zrec]=NULL; nrecs--; |
|---|
| 395 | #endif /* CICPP */ |
|---|
| 396 | dbxewlrc=keepewlrc; |
|---|
| 397 | } |
|---|
| 398 | #endif /* MULTI */ |
|---|
| 399 | } |
|---|
| 400 | #if KEEPDBX |
|---|
| 401 | for (idbx=ndbxs-1; idbx>=keepndbx; idbx--) |
|---|
| 402 | dbxflush(vdbxp[idbx]->dbxname); |
|---|
| 403 | #endif /* KEEPDBX */ |
|---|
| 404 | return NULL; /*p="";*/ /* exit */ |
|---|
| 405 | //break; |
|---|
| 406 | #endif /* PROCXIFPRESET */ |
|---|
| 407 | |
|---|
| 408 | #if INCPROCX |
|---|
| 409 | /* procx.c */ |
|---|
| 410 | #if PROCXIFUPDATE |
|---|
| 411 | case 'Y': |
|---|
| 412 | /* |
|---|
| 413 | keepndbx=ndbxs; |
|---|
| 414 | */ |
|---|
| 415 | while (isspace(*p)) p++; |
|---|
| 416 | ifnamp=p; |
|---|
| 417 | mfnamp=strchr(p,','); if (!mfnamp) fatal(errp); *mfnamp++ = '\0'; |
|---|
| 418 | mfnp=strchr(mfnamp,','); if (!mfnp) fatal(errp); *mfnp++ = '\0'; |
|---|
| 419 | fstspecp=strchr(mfnp,','); if (!fstspecp) fatal(errp); *fstspecp++ = '\0'; |
|---|
| 420 | if (!*mfnamp) mfnamp="null"; |
|---|
| 421 | if (!*mfnp) ifmfn=MFRmfn; else if (sscanf(mfnp,"%ld",&ifmfn) != 1) fatal(errp); |
|---|
| 422 | |
|---|
| 423 | if (strncmp(ifnamp,"create=",7) == 0) /* create= */ |
|---|
| 424 | { ifnamp+=7; trmisis0(ifnamp); } |
|---|
| 425 | else { |
|---|
| 426 | dbxopt_fatal=0; yfd=dbxopen(ifnamp,ifnamp,iy0extp); |
|---|
| 427 | if (yfd <= 0) { |
|---|
| 428 | dbxopt_fatal=0; yfd=dbxopen(ifnamp,ifnamp,cx1extp); } |
|---|
| 429 | if (yfd <= 0) trmisis0(ifnamp); else CLOSE(yfd); |
|---|
| 430 | } |
|---|
| 431 | if (fstspecp) { /* ok */ |
|---|
| 432 | char *specp; |
|---|
| 433 | specp=loadfile(ifnamp,'@',fstspecp,NULL,0,'\n'); |
|---|
| 434 | if (!specp) fatal(errp); |
|---|
| 435 | fst_gener(&fstpgmp,specp); |
|---|
| 436 | if (fst_error) { |
|---|
| 437 | printf("\n*** FST error#%ld at line %ld\n",fst_error,fst_errl); |
|---|
| 438 | if (fst_error == FSTERRF) |
|---|
| 439 | printf("\n*** FMT error#%ld at offset %ld\n",fmt_error,fmt_errof); |
|---|
| 440 | fatal(errp); |
|---|
| 441 | } |
|---|
| 442 | #if CICPP |
|---|
| 443 | delete [] specp; |
|---|
| 444 | #else |
|---|
| 445 | FREE(specp); |
|---|
| 446 | #endif |
|---|
| 447 | |
|---|
| 448 | if (strcmp(mfnamp,"null") == 0) { |
|---|
| 449 | LONGX qtylk1,qtylk2; |
|---|
| 450 | char *lnk1p=NULL; |
|---|
| 451 | char *lnk2p=NULL; |
|---|
| 452 | DBXSTRU *dbxp; |
|---|
| 453 | LONGX mfn=MFRmfn; MFRmfn=ifmfn; |
|---|
| 454 | fst_inter(fstpgmp,irec,stwp, |
|---|
| 455 | &lnk1p,maxlk1,&lnk2p,maxlk2,&qtylk1,&qtylk2); |
|---|
| 456 | if (dbxtrace) { |
|---|
| 457 | LONGX pmfn,qty; |
|---|
| 458 | UWORD ptag,pocc,pcnt; |
|---|
| 459 | LINK1 *lk1p; |
|---|
| 460 | LINK2 *lk2p; |
|---|
| 461 | printf("+++ Y/ifn=%s.\n",ifnamp); |
|---|
| 462 | printf("+++ Y/dbn=%s.\n",mfnamp); |
|---|
| 463 | printf("+++ Y/mfn=%ld\n",ifmfn); |
|---|
| 464 | printf("+++ Y/fst=%s.\n",fstspecp); |
|---|
| 465 | printf("+++ Y/lnk=%ld+%ld\n",qtylk1,qtylk2); |
|---|
| 466 | for (lk1p=(LINK1 *)lnk1p, qty=qtylk1; qty--; lk1p++) { |
|---|
| 467 | pstdecod(&lk1p->post,&pmfn,&ptag,&pocc,&pcnt); |
|---|
| 468 | prtlink("+++ Y/lk1=",pmfn,ptag,pocc,pcnt,lk1p->key,LE1);} |
|---|
| 469 | for (lk2p=(LINK2 *)lnk2p, qty=qtylk2; qty--; lk2p++) { |
|---|
| 470 | pstdecod(&lk2p->post,&pmfn,&ptag,&pocc,&pcnt); |
|---|
| 471 | prtlink("+++ Y/lk2=",pmfn,ptag,pocc,pcnt,lk2p->key,LE2);} |
|---|
| 472 | } |
|---|
| 473 | |
|---|
| 474 | dbxp=dbxstorp(ifnamp); /* inverted file ! */ |
|---|
| 475 | upif_init(ifnamp); |
|---|
| 476 | svdifupd(lnk1p,qtylk1,lnk2p,qtylk2, /* add new */ |
|---|
| 477 | NULL,0,NULL,0, /* */ |
|---|
| 478 | pstflag,0L); |
|---|
| 479 | DBXirecs++; DBXipadd[0]+=qtylk1; DBXipadd[1]+=qtylk2; |
|---|
| 480 | upif_end(ifnamp,pstflag); |
|---|
| 481 | invflush(ifnamp); |
|---|
| 482 | if (lnk1p) FREE(lnk1p); |
|---|
| 483 | if (lnk2p) FREE(lnk2p); |
|---|
| 484 | fst_free(fstpgmp); |
|---|
| 485 | MFRmfn=mfn; |
|---|
| 486 | } |
|---|
| 487 | else { |
|---|
| 488 | int reset=ifupd_reset; ifupd_reset=0; |
|---|
| 489 | ifupdat(mfnamp,ifmfn,ifmfn, /* AOT 05/10/02 */ |
|---|
| 490 | ifnamp,fstpgmp,stwp,maxlk1,maxlk2,pstflag,endup); |
|---|
| 491 | ifupd_reset=reset; |
|---|
| 492 | } |
|---|
| 493 | } |
|---|
| 494 | #if KEEPDBX |
|---|
| 495 | /* |
|---|
| 496 | for (idbx=ndbxs-1; idbx>=keepndbx; idbx--) |
|---|
| 497 | dbxflush(vdbxp[idbx]->dbxname); |
|---|
| 498 | */ |
|---|
| 499 | #endif /* KEEPDBX */ |
|---|
| 500 | return NULL; /*p="";*/ /* exit */ |
|---|
| 501 | // break; |
|---|
| 502 | #endif /* PROCXIFUPDATE */ |
|---|
| 503 | |
|---|
| 504 | /* procx.c */ |
|---|
| 505 | #if PROCXFSUPDATE |
|---|
| 506 | case 'T': |
|---|
| 507 | keepndbx=ndbxs; |
|---|
| 508 | while (isspace(*p)) p++; |
|---|
| 509 | if (*p=='/') if (toupper(*(p+1))=='H') if (*(p+2)=='=') { p+=3; tyyopth=1; } |
|---|
| 510 | if (p) { |
|---|
| 511 | LONGX rrex,rrec; |
|---|
| 512 | char *stwp=NULL; |
|---|
| 513 | FST_CODE *fstpgmp=NULL; |
|---|
| 514 | LONGX maxlk1=1000; |
|---|
| 515 | LONGX maxlk2=500; |
|---|
| 516 | LONGX qtylk1,qtylk2; |
|---|
| 517 | char *lnk1p=NULL; |
|---|
| 518 | char *lnk2p=NULL; |
|---|
| 519 | char *specp; |
|---|
| 520 | specp=loadfile(RDBname,'@',p,NULL,0,'\n'); |
|---|
| 521 | if (!specp) fatal(errp); |
|---|
| 522 | fst_gener(&fstpgmp,specp); |
|---|
| 523 | if (fst_error) { |
|---|
| 524 | printf("\n*** FST error#%ld at line %ld\n",fst_error,fst_errl); |
|---|
| 525 | if (fst_error == FSTERRF) |
|---|
| 526 | printf("\n*** FMT error#%ld at offset %ld\n",fmt_error,fmt_errof); |
|---|
| 527 | fatal(errp); |
|---|
| 528 | } |
|---|
| 529 | #if CICPP |
|---|
| 530 | delete [] specp; |
|---|
| 531 | #else |
|---|
| 532 | FREE(specp); |
|---|
| 533 | #endif |
|---|
| 534 | for (rrex=maxnrec; rrex--; ) if (!vrecp[rrex]) /* ja' decrementado */ break; |
|---|
| 535 | if (rrex < 0) fatal("fldupdat/procx/t/rrex"); |
|---|
| 536 | recallok(rrex,RECnbytes); fst_batchup=(char *)vrecp[rrex]; |
|---|
| 537 | if (tyyopth) { |
|---|
| 538 | for (rrec=maxnrec; rrec--; ) if (!vrecp[rrec]) /* ja' decrementado */ break; |
|---|
| 539 | if (rrec < 0) fatal("fldupdat/procx/t/rrec"); |
|---|
| 540 | recallok(rrec,fst_hdrx=RECnbytes); fst_hdrp=(char *)vrecp[rrec]; |
|---|
| 541 | } |
|---|
| 542 | *fst_batchup='\0'; |
|---|
| 543 | fst_inter(fstpgmp,irec,stwp, |
|---|
| 544 | &lnk1p,maxlk1,&lnk2p,maxlk2,&qtylk1,&qtylk2); |
|---|
| 545 | if (!*fst_batchup) if (tyyopth) if (*fst_hdrp) { |
|---|
| 546 | char *batchp; |
|---|
| 547 | sprintf(fst_batchup,"H 32767 %d ",fst_hdru); |
|---|
| 548 | batchp=fst_batchup+strlen(fst_batchup); |
|---|
| 549 | memcpy(batchp,fst_hdrp,fst_hdru); *(batchp+fst_hdru)='\0'; |
|---|
| 550 | } |
|---|
| 551 | if (fldupdat(irec,fst_batchup)) fatal(errp); |
|---|
| 552 | fst_batchup=NULL; fst_hdrp=NULL; fst_hdrx=0; |
|---|
| 553 | if (tyyopth) { |
|---|
| 554 | FREE(vrecp[rrec]); vrecp[rrec]=NULL; nrecs--; |
|---|
| 555 | } |
|---|
| 556 | FREE(vrecp[rrex]); vrecp[rrex]=NULL; nrecs--; |
|---|
| 557 | |
|---|
| 558 | if (lnk1p) FREE(lnk1p); |
|---|
| 559 | if (lnk2p) FREE(lnk2p); |
|---|
| 560 | fst_free(fstpgmp); |
|---|
| 561 | } |
|---|
| 562 | #if KEEPDBX |
|---|
| 563 | for (idbx=ndbxs-1; idbx>=keepndbx; idbx--) |
|---|
| 564 | dbxflush(vdbxp[idbx]->dbxname); |
|---|
| 565 | #endif /* KEEPDBX */ |
|---|
| 566 | return NULL; /*p="";*/ /* exit */ |
|---|
| 567 | // break; |
|---|
| 568 | #endif /* PROCXFSUPDATE */ |
|---|
| 569 | #endif /* INCPROCX */ |
|---|
| 570 | |
|---|
| 571 | #if INCPROCX |
|---|
| 572 | /* procxx.c */ |
|---|
| 573 | #if MXFUN || IFLOADFUN /* PROCXXXFUN */ |
|---|
| 574 | case 'C': |
|---|
| 575 | keepndbx=ndbxs; |
|---|
| 576 | while (isspace(*p)) p++; |
|---|
| 577 | #if MXFUN |
|---|
| 578 | if (strncmp(p,"mx",2) == 0 && isspace(*(p+2))) { cisis_mx(p+2+1); } |
|---|
| 579 | #endif /* MXFUN */ |
|---|
| 580 | #if IFLOADFUN |
|---|
| 581 | if (strncmp(p,"ifload",6) == 0 && isspace(*(p+6))) { cisis_ifload(p+6+1); } |
|---|
| 582 | #endif /* IFLOADFUN */ |
|---|
| 583 | #if KEEPDBX |
|---|
| 584 | for (idbx=ndbxs-1; idbx>=keepndbx; idbx--) |
|---|
| 585 | dbxflush(vdbxp[idbx]->dbxname); |
|---|
| 586 | #endif /* KEEPDBX */ |
|---|
| 587 | return NULL; /*p="";*/ /* exit */ |
|---|
| 588 | // break; |
|---|
| 589 | #endif /* MXFUN || IFLOADFUN */ /* PROCXXXFUN */ |
|---|
| 590 | /* procxx.c */ |
|---|
| 591 | #endif /* INCPROCX */ |
|---|
| 592 | |
|---|
| 593 | |
|---|
| 594 | } /* end PROCG switch */ |
|---|
| 595 | |
|---|
| 596 | } /* end PROCG batchp */ |
|---|
| 597 | |
|---|
| 598 | #endif /* PROCG */ |
|---|
| 599 | /* End PROCG |
|---|
| 600 | */ |
|---|