| 1 | |
|---|
| 2 | |
|---|
| 3 | /* Begin PROCXMARKREC |
|---|
| 4 | */ |
|---|
| 5 | #if PROCXMARKREC |
|---|
| 6 | |
|---|
| 7 | if (strncmp(p,"mark=",5) == 0 || /* mx bulas/xbulas uctab=ansi "proc='Gmark[/1]/decselem=dpffabcd'" */ |
|---|
| 8 | strncmp(p,"mark/",5) == 0) { |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | char dcs11[BUFSIZ]; |
|---|
| 12 | char dcs21[BUFSIZ]; |
|---|
| 13 | |
|---|
| 14 | char *dcs11a="decs-cys.bvsalud.org"; |
|---|
| 15 | char *dcs11b="/cgi-bin/wxis1660.exe/decsserver/?IsisScript=../cgi-bin/decsserver/decsserver.xis&previous_page=homepage&task=hierarchic&interface_language="; |
|---|
| 16 | char *dcs12="&mfn_tree="; |
|---|
| 17 | char *dcs21a="decs.ws.bvsalud.org"; |
|---|
| 18 | char *dcs21b="/main.php?service=getTree"; |
|---|
| 19 | |
|---|
| 20 | char *dcslang="p"; |
|---|
| 21 | //char *isolang="pt"; |
|---|
| 22 | char opclng='p'; |
|---|
| 23 | |
|---|
| 24 | int opcout=1; |
|---|
| 25 | int opcgiz=0; |
|---|
| 26 | int opclog=0; |
|---|
| 27 | |
|---|
| 28 | int opclink=0; |
|---|
| 29 | LONGX tag02=0; |
|---|
| 30 | LONGX tag03=0; |
|---|
| 31 | int opcdcs=0; |
|---|
| 32 | LONGX tag20=20; |
|---|
| 33 | |
|---|
| 34 | int opcmark=0; |
|---|
| 35 | char markp[BUFSIZ]={'\0'}; |
|---|
| 36 | |
|---|
| 37 | //int parmprint=0; |
|---|
| 38 | //FILE *parmfp=NULL; |
|---|
| 39 | |
|---|
| 40 | char *xarea=NULL; |
|---|
| 41 | LONGX nbytes,nbytes0,nbytes1; |
|---|
| 42 | char *flag; |
|---|
| 43 | char *ws; |
|---|
| 44 | char *swif=NULL; |
|---|
| 45 | char *swmf=NULL; |
|---|
| 46 | char *swmfp=NULL; |
|---|
| 47 | |
|---|
| 48 | TRMSTRU *swtrmp=NULL; /**/ |
|---|
| 49 | LONGX switrm=(-1L); /**/ |
|---|
| 50 | RECSTRU *swrecp=NULL; /**/ |
|---|
| 51 | LONGX swirec=(-1L); /**/ |
|---|
| 52 | |
|---|
| 53 | char *q; |
|---|
| 54 | LONGX xtag=0; |
|---|
| 55 | int i; |
|---|
| 56 | |
|---|
| 57 | char *haddp=NULL; |
|---|
| 58 | char *hlenp=NULL; |
|---|
| 59 | //char *hdatap=NULL; |
|---|
| 60 | LONGX hlen=0; |
|---|
| 61 | |
|---|
| 62 | char tabsplit[256]; |
|---|
| 63 | char tabperiod[256]; |
|---|
| 64 | |
|---|
| 65 | memset(tabsplit,0x00,sizeof(tabsplit)); |
|---|
| 66 | for (i=0; i<=(int)' '; i++) tabsplit[i]=1; |
|---|
| 67 | |
|---|
| 68 | memset(tabperiod,0x00,sizeof(tabperiod)); |
|---|
| 69 | tabperiod['.']=tabperiod[',']=tabperiod[';']=tabperiod[':']=1; |
|---|
| 70 | |
|---|
| 71 | p+=4; /* skip mark/ */ |
|---|
| 72 | |
|---|
| 73 | q=p; while (isspace(*q)) q++; |
|---|
| 74 | if (*q=='/') { |
|---|
| 75 | q++; while (isspace(*q)) q++; |
|---|
| 76 | if (isdigit(*q)) { |
|---|
| 77 | p=q; for (xtag=0; isdigit(*p); p++ ) xtag=xtag*10+((int)(*p)-(int)'0'); |
|---|
| 78 | if (xtag <= 0) fatal("fldupdat/procx/Gmarx/tag"); |
|---|
| 79 | while (isspace(*p)) p++; |
|---|
| 80 | } |
|---|
| 81 | } |
|---|
| 82 | if (!xtag) xtag=1; //default tag |
|---|
| 83 | |
|---|
| 84 | while (*p == '/') { |
|---|
| 85 | |
|---|
| 86 | char *x; |
|---|
| 87 | if (strncmp(p,"/lang:",6) == 0) { |
|---|
| 88 | p+=6; |
|---|
| 89 | if (*p>='A' && *p<='z') opclng=toupper(*p); p++; |
|---|
| 90 | opclng=(opclng=='I')?'i': (opclng=='E')?'e': (opclng=='P')?'p': '\0'; |
|---|
| 91 | if (!opclng) fatal("fldupdat/procx/Gmark/lang/iep"); |
|---|
| 92 | //isolang=(opclng=='i')?"en": (opclng=='e')?"es": "pt"; |
|---|
| 93 | dcslang=(opclng=='i')?"i" : (opclng=='e')? "e": "p"; |
|---|
| 94 | } else |
|---|
| 95 | if (strncmp(p,"/tree-id:",9) == 0) { |
|---|
| 96 | p+=9; if (sscanf(p,"%ld",&tag20) != 1) { while (isdigit(*p)) p++; } |
|---|
| 97 | else fatal("fldupdat/procx/Gmark/tree-id"); |
|---|
| 98 | } else |
|---|
| 99 | |
|---|
| 100 | if (strncmp(p,"/keys/",6) == 0 || strncmp(p,"/keys=",6) == 0) { p+=5; opcgiz=1; opcout=0; } |
|---|
| 101 | if (strncmp(p,"/g/" ,3) == 0 || strncmp(p,"/g=" ,3) == 0) { p+=2; opcgiz=1; opcout=0; } |
|---|
| 102 | //else |
|---|
| 103 | //if (strncmp(p,"/p/",3) == 0 || strncmp(p,"/p=",3) == 0) { |
|---|
| 104 | // p+=2; |
|---|
| 105 | // parmfp=stdout; |
|---|
| 106 | // parmprint=1; |
|---|
| 107 | //} else |
|---|
| 108 | //if (strncmp(p,"/p:",3) == 0) { |
|---|
| 109 | // char *x; |
|---|
| 110 | // p+=3; |
|---|
| 111 | // for (x=p, parmfp=NULL; *p; p++) if (*p=='=' || *p=='/') { char c= *p; *p='\0'; parmfp=fopen(dbxcipar(NULL/*gidbnp*/,x,'='),"w"); *p=c; break; } |
|---|
| 112 | // if (!parmfp) fatal("fldupdat/procx/Gmark/p:"); |
|---|
| 113 | // parmprint=1; |
|---|
| 114 | //} |
|---|
| 115 | else { |
|---|
| 116 | |
|---|
| 117 | if (strncmp(p,"/log1",5) == 0) { opclog=1; p+=5; } |
|---|
| 118 | if (strncmp(p,"/log2",5) == 0) { opclog=2; p+=5; } |
|---|
| 119 | if (strncmp(p,"/log3",5) == 0) { opclog=3; p+=5; } |
|---|
| 120 | if (strncmp(p,"/log4",5) == 0) { opclog=4; p+=5; } |
|---|
| 121 | if (strncmp(p,"/log5",5) == 0) { opclog=5; p+=5; } |
|---|
| 122 | |
|---|
| 123 | if (strncmp(p,"/decselem=",10) == 0) { opcdcs=3; p+=10-1; } else |
|---|
| 124 | if (strncmp(p,"/decselem/",10) == 0) { opcdcs=3; p+=9; } else |
|---|
| 125 | if (strncmp(p,"/decsws@",8) == 0) { opcdcs=2; p+=8; if (!strchr(p,'=')) fatal("fldupdat/procx/Gmark/dcs21a"); else { char *x=strchr(p,'='); dcs21a=p; *x='\0'; p=x+1; } } else |
|---|
| 126 | if (strncmp(p,"/decsws=",8) == 0) { opcdcs=2; p+=8-1; } else |
|---|
| 127 | if (strncmp(p,"/decsws/",8) == 0) { opcdcs=2; p+=7; } else |
|---|
| 128 | if (strncmp(p,"/decs@",6) == 0) { opcdcs=1; p+=6; if (!strchr(p,'=')) fatal("fldupdat/procx/Gmark/dcs11a"); else { char *x=strchr(p,'='); dcs11a=p; *x='\0'; p=x+1; } } else |
|---|
| 129 | if (strncmp(p,"/decs=",6) == 0) { opcdcs=1; p+=6-1; } else |
|---|
| 130 | if (strncmp(p,"/decs/",6) == 0) { opcdcs=1; p+=5; } else |
|---|
| 131 | if (*p=='/' && strchr(p+1,',')) { |
|---|
| 132 | char *q; |
|---|
| 133 | p++; swmf=p; |
|---|
| 134 | q=strchr(p,','); for (; *p; p++) if (*p=='=' || *p=='/') { swmfp=p; break; } |
|---|
| 135 | if (q) { |
|---|
| 136 | int n; |
|---|
| 137 | *q++='\0'; |
|---|
| 138 | for (n=0; isdigit(*q); q++ ) n=n*10+((int)(*q)-(int)'0'); tag02=n; |
|---|
| 139 | if (*q==',') { q++; for (n=0; isdigit(*q); q++ ) n=n*10+((int)(*q)-(int)'0'); tag03=n; } |
|---|
| 140 | if (*q) if (*p=='=' || *p=='/') ; else fatal("fldupdat/procx/Gmark/mf/tag"); |
|---|
| 141 | } |
|---|
| 142 | opclink=1; |
|---|
| 143 | } |
|---|
| 144 | else |
|---|
| 145 | if (*p=='/') { p++; for (x=p; *p; p++) if (*p=='=' || *p=='/') { char c= *p; *p='\0'; strcpy(markp,x); *p=c; opcmark=1; break; } if (!*markp) fatal("fldupdat/procx/Gmark/mf/tag"); } |
|---|
| 146 | |
|---|
| 147 | } |
|---|
| 148 | |
|---|
| 149 | } /* while /option */ |
|---|
| 150 | |
|---|
| 151 | if (*p=='=') { p++; swif=p; while (*p) p++; } /* mark= */ |
|---|
| 152 | if (!swif) fatal("fldupdat/procx/Gmark/db"); |
|---|
| 153 | if (!swmf) swmf=swif; |
|---|
| 154 | if (swmfp) *swmfp='\0'; |
|---|
| 155 | |
|---|
| 156 | if (*p) fatal("fldupdat/procx/Gmark[/<tag>]{/<elem>|/keys|/decs}=<if>[:<mf>,<otag>[,<ctag>]]"); |
|---|
| 157 | |
|---|
| 158 | |
|---|
| 159 | sprintf(dcs11,"http://%s%s",dcs11a,dcs11b); |
|---|
| 160 | sprintf(dcs21,"http://%s%s",dcs21a,dcs21b); |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | nbytes=(rec_maxmfrl>MAXMFRL)?rec_maxmfrl:MAXMFRL; |
|---|
| 164 | if (nbytes < MFRmfrl) nbytes=MFRmfrl; |
|---|
| 165 | nbytes=nbytes0=nbytes+BUFSIZ; /* data,buffup */ /* nbytes=nbytes0=MFRmfrl+MFRmfrl+BUFSIZ; */ |
|---|
| 166 | nbytes+=(nbytes1=MFRmfrl+BUFSIZ); /* flag */ |
|---|
| 167 | nbytes+=( MFRmfrl+BUFSIZ); /* 6words */ |
|---|
| 168 | #if CICPP |
|---|
| 169 | try { xarea = (char *) new char [nbytes]; } |
|---|
| 170 | catch (BAD_ALLOC) { xarea = (char *)ALLONULL; } |
|---|
| 171 | #else /* CICPP */ |
|---|
| 172 | xarea=(char *)ALLOC((ALLOPARM)nbytes); |
|---|
| 173 | #endif /* CICPP */ |
|---|
| 174 | if (xarea == (char *)ALLONULL) fatal("fldupdat/procx/Gmark/ALLOC"); |
|---|
| 175 | *xarea='\0'; |
|---|
| 176 | |
|---|
| 177 | q=xarea; /* batchp */ |
|---|
| 178 | flag=xarea+nbytes0; |
|---|
| 179 | ws=flag+nbytes1; |
|---|
| 180 | |
|---|
| 181 | /* process data field |
|---|
| 182 | */ |
|---|
| 183 | xdir=fieldx(irec,(UWORD)xtag,1); |
|---|
| 184 | |
|---|
| 185 | if (xdir >= 0) { /* data */ |
|---|
| 186 | LONGX pmfn=0, nwords; |
|---|
| 187 | FFI off, len, inlen; |
|---|
| 188 | char *wsp,*infldp,*x; |
|---|
| 189 | int strip=1; |
|---|
| 190 | |
|---|
| 191 | char *xpw[6]; |
|---|
| 192 | FFI ilw[6]; |
|---|
| 193 | FFI vwoff[6]; |
|---|
| 194 | char *vwfldp[6]; |
|---|
| 195 | FFI vwleft[6]; |
|---|
| 196 | FFI vgoff; |
|---|
| 197 | |
|---|
| 198 | char *fldp; |
|---|
| 199 | FFI left; |
|---|
| 200 | FFI mbysize; |
|---|
| 201 | |
|---|
| 202 | /* */ |
|---|
| 203 | fldp=FIELDP(xdir); |
|---|
| 204 | left=DIRlen(xdir); |
|---|
| 205 | #if QUOTE2X |
|---|
| 206 | for (x=fldp; *x; x++) if (*x == '"') *x='!'; /* aspas para debug */ |
|---|
| 207 | #endif |
|---|
| 208 | memcpy(xarea,fldp,left); xarea[left]='\0'; |
|---|
| 209 | /* */ |
|---|
| 210 | mbysize=left; |
|---|
| 211 | memset(flag,(int)' ',mbysize); flag[mbysize]='\0'; |
|---|
| 212 | |
|---|
| 213 | |
|---|
| 214 | /* flag data chars |
|---|
| 215 | */ |
|---|
| 216 | if (strip) { |
|---|
| 217 | char *x=xarea; |
|---|
| 218 | char *a,*b; |
|---|
| 219 | FFI xa=0,xb=0; |
|---|
| 220 | off=0; |
|---|
| 221 | while ((a=strchr(x,'<')) != NULL) |
|---|
| 222 | if (strchr(a,'>')) { |
|---|
| 223 | for (xa=0, a=x; *a != '<'; a++) xa++; |
|---|
| 224 | flag[(off+=xa)]=upmF3; |
|---|
| 225 | for (xb=1, b=a; *b != '>'; b++) { xb++; flag[off++]=upmF3; } |
|---|
| 226 | flag[off++]=upmF3; |
|---|
| 227 | x=b+1; |
|---|
| 228 | } else { |
|---|
| 229 | off++; |
|---|
| 230 | x++; |
|---|
| 231 | } |
|---|
| 232 | } |
|---|
| 233 | /* everything but tabsplit is word */ |
|---|
| 234 | for (x=xarea, left=DIRlen(xdir), off=0; left--; x++, off++) { |
|---|
| 235 | if (flag[off] == ' ') { |
|---|
| 236 | if (tabsplit[(unsigned char)*x]) flag[off]=upmF1; else flag[off]=upmF2; |
|---|
| 237 | } |
|---|
| 238 | } |
|---|
| 239 | /* remove right most period */ |
|---|
| 240 | for (left=DIRlen(xdir), off=left-1; off>=1; off--) { |
|---|
| 241 | if (flag[off-1] == upmF2) { |
|---|
| 242 | if (tabperiod[(unsigned char)xarea[off]]) |
|---|
| 243 | flag[off]=upmF4; |
|---|
| 244 | } |
|---|
| 245 | } |
|---|
| 246 | if (left==1) if (tabperiod[(unsigned char)*xarea]) flag[0]=upmF4; |
|---|
| 247 | |
|---|
| 248 | /* del/add command |
|---|
| 249 | */ |
|---|
| 250 | if (xtag) sprintf(q,"D%ld",xtag); |
|---|
| 251 | else sprintf(q,"D*"); q+=strlen(q); |
|---|
| 252 | |
|---|
| 253 | sprintf(haddp=q,"H%09ld ",(xtag)?(LONGX)xtag:1L); q+=strlen(q); |
|---|
| 254 | sprintf(hlenp=q,"123456789 "); q+=strlen(q); |
|---|
| 255 | |
|---|
| 256 | //hdatap=q; |
|---|
| 257 | if (opclog == 1) { |
|---|
| 258 | sprintf(q,"\nmask|% 9ld|",(LONGX)DIRlen(xdir)); hlen+=strlen(q); q+=strlen(q); |
|---|
| 259 | memcpy(q,flag,mbysize); hlen+=mbysize; q+=mbysize; |
|---|
| 260 | } |
|---|
| 261 | |
|---|
| 262 | |
|---|
| 263 | /* for chars left |
|---|
| 264 | */ |
|---|
| 265 | for (fldp=FIELDP(xdir), left=DIRlen(xdir), off=0; left; ) { |
|---|
| 266 | int xbreak=0; |
|---|
| 267 | for (pmfn=0, nwords=0, ws[0]='\0', wsp=ws, len=0, infldp=NULL, inlen=0, i=1; i <= 6 && left; i++) { |
|---|
| 268 | xbreak=0; |
|---|
| 269 | while (flag[off] != upmF2 && left) { if (len) if (flag[off] == upmF3) { xbreak=1; break; } /*no marks between words*/ |
|---|
| 270 | if (opcout) if (!infldp) { *q++ = *fldp; hlen++; } |
|---|
| 271 | off++; fldp++; left--; if (infldp) inlen++; } *q='\0'; /*debug*/ |
|---|
| 272 | if (xbreak) break; |
|---|
| 273 | if (flag[off] == upmF2 && i == 1) { vgoff=off; infldp=fldp; } |
|---|
| 274 | if (flag[off] == upmF2 && i >= 2) { *wsp++ = ' '; len++; } |
|---|
| 275 | while (flag[off] == upmF2 && left) { off++; *wsp++ = *fldp++; left--; len++; inlen++; } |
|---|
| 276 | if (len) { vwoff[nwords]=off; vwfldp[nwords]=fldp; vwleft[nwords]=left; } |
|---|
| 277 | if (len) { xpw[nwords]=wsp; ilw[nwords]=inlen; *wsp='\0'; nwords++; } |
|---|
| 278 | } |
|---|
| 279 | |
|---|
| 280 | if (len) { /* lookup */ |
|---|
| 281 | if (opclog==3) { |
|---|
| 282 | sprintf(q,"\ntext|% 9ld|% 9ld|%s|",nwords,(LONGX)len,ws); hlen+=strlen(q); q+=strlen(q); |
|---|
| 283 | } |
|---|
| 284 | for (wsp=ws; *wsp; wsp++) *wsp=isisuctab[(unsigned char)*wsp]; |
|---|
| 285 | while (nwords--) { /* words */ |
|---|
| 286 | TRMSTRU *trmp; |
|---|
| 287 | if (opclog==4) { |
|---|
| 288 | sprintf(q,"\nterm|% 9ld|% 9ld|%s|",nwords+1,(LONGX)strlen(ws),ws); hlen+=strlen(q); q+=strlen(q); |
|---|
| 289 | } |
|---|
| 290 | if (!swtrmp) { |
|---|
| 291 | #if CICPP |
|---|
| 292 | try { swtrmp=new TRMSTRU(cisisxp); } |
|---|
| 293 | catch (BAD_ALLOC) { fatal("fldupdat/procx/Gmark/next/trm"); } |
|---|
| 294 | #else /* CICPP */ |
|---|
| 295 | for (switrm=maxntrm; switrm--; ) { if (!vtrmp[switrm]) /* ja' decrementado */ break; } |
|---|
| 296 | if (switrm<0L) fatal("fldupdat/procx/Gmark/next/trm"); |
|---|
| 297 | #endif /* CICPP */ |
|---|
| 298 | } |
|---|
| 299 | |
|---|
| 300 | #if CICPP |
|---|
| 301 | swtrmp->xterm((unsigned char *)swif,(unsigned char *)ws); |
|---|
| 302 | #else /* CICPP */ |
|---|
| 303 | TERM(switrm,(unsigned char *)swif,(unsigned char *)ws); |
|---|
| 304 | swtrmp=vtrmp[switrm]; /* check ci*.c */ |
|---|
| 305 | #endif /* CICPP */ |
|---|
| 306 | if (TRMrc==RCNORMAL) { |
|---|
| 307 | |
|---|
| 308 | char *fws=ws+len+1; |
|---|
| 309 | char *v20=fws; |
|---|
| 310 | char *v02=fws; |
|---|
| 311 | char *v03=v02+1; |
|---|
| 312 | *v02='\0'; *v03='\0'; |
|---|
| 313 | #if CICPP |
|---|
| 314 | swtrmp->xposting(1L); |
|---|
| 315 | #else /* CICPP */ |
|---|
| 316 | pmfn=posting(switrm,1L); |
|---|
| 317 | #endif /* CICPP */ |
|---|
| 318 | |
|---|
| 319 | if (opclog>=5) { |
|---|
| 320 | sprintf(q,"\n% 9ld|% 9ld|% 9ld|% 9ld|% 9ld|%s|%s|",MFRmfn,(LONGX)vgoff+1,(LONGX)strlen(ws),nwords+1,pmfn,swif,ws); hlen+=strlen(q); q+=strlen(q); |
|---|
| 321 | if (opclog==6) { |
|---|
| 322 | sprintf(q,"% 9ld|",(LONGX)ilw[nwords]); hlen+=strlen(q); q+=strlen(q); |
|---|
| 323 | memcpy(q,infldp,ilw[nwords]); hlen+=ilw[nwords]; q+=ilw[nwords]; |
|---|
| 324 | } |
|---|
| 325 | } |
|---|
| 326 | |
|---|
| 327 | if (opcout || opcdcs || opcmark || opclink ) { |
|---|
| 328 | |
|---|
| 329 | RECSTRU *recp; |
|---|
| 330 | if (!swrecp) { |
|---|
| 331 | #if CICPP |
|---|
| 332 | try { swrecp=new RECSTRU(cisisxp); } |
|---|
| 333 | catch (BAD_ALLOC) { fatal("fldupdat/procx/Gmark/next/rec"); } |
|---|
| 334 | #else /* CICPP */ |
|---|
| 335 | for (swirec=maxnrec; swirec--; ) { if (!vrecp[swirec]) /* ja' decrementado */ break; } |
|---|
| 336 | if (swirec<0L) fatal("fldupdat/procx/Gmark/next/rec"); |
|---|
| 337 | #endif /* CICPP */ |
|---|
| 338 | } |
|---|
| 339 | |
|---|
| 340 | #if CICPP |
|---|
| 341 | swrecp->xrecord(swmf,pmfn); |
|---|
| 342 | #else /* CICPP */ |
|---|
| 343 | RECORD(swirec,swmf,pmfn); |
|---|
| 344 | swrecp=vrecp[swirec]; /* check ci*.c */ |
|---|
| 345 | #endif /* CICPP */ |
|---|
| 346 | if (RECrc == RCNORMAL) { |
|---|
| 347 | int xdir; |
|---|
| 348 | if (opcdcs) { |
|---|
| 349 | xdir=fieldx(swirec,(int)tag20,1); /* occ 1 */ |
|---|
| 350 | if (xdir >= 0) { memcpy(v20,FIELDP(xdir),DIRlen(xdir)); v20[DIRlen(xdir)]='\0'; } |
|---|
| 351 | } |
|---|
| 352 | else if (opclink) { |
|---|
| 353 | xdir=fieldx(swirec,(int)tag02,1); |
|---|
| 354 | if (xdir >= 0) { memcpy(v02,FIELDP(xdir),DIRlen(xdir)); v02[DIRlen(xdir)]='\0'; } |
|---|
| 355 | v03=v02+strlen(v02)+1; *v03='\0'; |
|---|
| 356 | if (tag03) { |
|---|
| 357 | xdir=fieldx(swirec,(int)tag03,1); |
|---|
| 358 | if (xdir >= 0) { memcpy(v03,FIELDP(xdir),DIRlen(xdir)); v03[DIRlen(xdir)]='\0'; } |
|---|
| 359 | } |
|---|
| 360 | if (!*v03) if (*v02=='<') { |
|---|
| 361 | char *x; |
|---|
| 362 | if ((x=strchr(v02,' '))!=NULL) { *x='\0'; sprintf(v03,"</%s>",v02+1); *x=' '; } else |
|---|
| 363 | if ((x=strchr(v02,'>'))!=NULL) { *x='\0'; sprintf(v03,"</%s>",v02+1); *x='>'; } |
|---|
| 364 | } |
|---|
| 365 | } |
|---|
| 366 | } |
|---|
| 367 | |
|---|
| 368 | if (opclink) if (!*v02) pmfn=0L; /* select */ |
|---|
| 369 | |
|---|
| 370 | } /* end if opcout || opcdcs || opcmark || opclink || opcgiz20 */ |
|---|
| 371 | |
|---|
| 372 | if (pmfn) { |
|---|
| 373 | |
|---|
| 374 | if (opcgiz) { |
|---|
| 375 | sprintf(q,"\n% 9ld|% 9ld|% 9ld|% 9ld|% 9ld|%s|%s|",MFRmfn,(LONGX)vgoff+1,(LONGX)strlen(ws),nwords+1,pmfn,swif,ws); hlen+=strlen(q); q+=strlen(q); |
|---|
| 376 | } |
|---|
| 377 | else |
|---|
| 378 | |
|---|
| 379 | if (opcdcs==1) { |
|---|
| 380 | sprintf(q,"<a href=\"%s%s%s%06ld\">",dcs11,dcslang,dcs12,pmfn); hlen+=strlen(q); q+=strlen(q); |
|---|
| 381 | memcpy(q,infldp,ilw[nwords]); hlen+=ilw[nwords]; q+=ilw[nwords]; |
|---|
| 382 | sprintf(q,"</a>"); hlen+=strlen(q); q+=strlen(q); |
|---|
| 383 | } |
|---|
| 384 | else |
|---|
| 385 | if (opcdcs==2) { |
|---|
| 386 | sprintf(q,"<a href=\"%s&tree_id=%s\">",dcs21,v20); hlen+=strlen(q); q+=strlen(q); |
|---|
| 387 | memcpy(q,infldp,ilw[nwords]); hlen+=ilw[nwords]; q+=ilw[nwords]; |
|---|
| 388 | sprintf(q,"</a>"); hlen+=strlen(q); q+=strlen(q); |
|---|
| 389 | } |
|---|
| 390 | else |
|---|
| 391 | if (opcdcs==3) { |
|---|
| 392 | sprintf(q,"<decs mfn=\"%06ld\" tree_id=\"%s\">",pmfn,v20); hlen+=strlen(q); q+=strlen(q); |
|---|
| 393 | memcpy(q,infldp,ilw[nwords]); hlen+=ilw[nwords]; q+=ilw[nwords]; |
|---|
| 394 | sprintf(q,"</decs>"); hlen+=strlen(q); q+=strlen(q); |
|---|
| 395 | } |
|---|
| 396 | else |
|---|
| 397 | if (opcmark) { |
|---|
| 398 | sprintf(q,"<%s key=\"%s\" mfn=\"%ld\">",markp,ws,pmfn); hlen+=strlen(q); q+=strlen(q); |
|---|
| 399 | memcpy(q,infldp,ilw[nwords]); hlen+=ilw[nwords]; q+=ilw[nwords]; |
|---|
| 400 | sprintf(q,"</%s>",markp); hlen+=strlen(q); q+=strlen(q); |
|---|
| 401 | } |
|---|
| 402 | else |
|---|
| 403 | if (opclink) { |
|---|
| 404 | sprintf(q,"%s",v02); hlen+=strlen(q); q+=strlen(q); |
|---|
| 405 | memcpy(q,infldp,ilw[nwords]); hlen+=ilw[nwords]; q+=ilw[nwords]; |
|---|
| 406 | sprintf(q,"%s",v03); hlen+=strlen(q); q+=strlen(q); |
|---|
| 407 | } |
|---|
| 408 | else { /* opcout default is <swif></swif> */ |
|---|
| 409 | sprintf(q,"<%s key=\"%s\" mfn=\"%ld\">",swif,ws,pmfn); hlen+=strlen(q); q+=strlen(q); |
|---|
| 410 | memcpy(q,infldp,ilw[nwords]); hlen+=ilw[nwords]; q+=ilw[nwords]; |
|---|
| 411 | sprintf(q,"</%s>",swif); hlen+=strlen(q); q+=strlen(q); |
|---|
| 412 | } |
|---|
| 413 | |
|---|
| 414 | } /* end pmfn */ |
|---|
| 415 | |
|---|
| 416 | break; /* pmfn is ok */ |
|---|
| 417 | |
|---|
| 418 | } /* end TRMrc == RCNORMAL */ |
|---|
| 419 | |
|---|
| 420 | if (nwords) *xpw[nwords-1]='\0'; |
|---|
| 421 | } /* end words */ |
|---|
| 422 | } /* end len lookup */ |
|---|
| 423 | |
|---|
| 424 | if (pmfn > 0) { |
|---|
| 425 | off=vwoff[nwords]; fldp=vwfldp[nwords]; left=vwleft[nwords]; |
|---|
| 426 | } |
|---|
| 427 | else if (infldp) { |
|---|
| 428 | if (opcout) { memcpy(q,infldp,ilw[0]); hlen+=ilw[0]; q+=ilw[0]; } |
|---|
| 429 | off=vwoff[0]; fldp=vwfldp[0]; left=vwleft[0]; |
|---|
| 430 | } |
|---|
| 431 | |
|---|
| 432 | } /* end chars left */ |
|---|
| 433 | |
|---|
| 434 | } /* end data */ |
|---|
| 435 | |
|---|
| 436 | /*...*/ |
|---|
| 437 | *q='\0'; |
|---|
| 438 | if (hlen) { |
|---|
| 439 | /* actual add lenght */ |
|---|
| 440 | sprintf(hlenp,"%9ld",(LONGX)hlen); hlenp[9]=' '; |
|---|
| 441 | ///* print */ |
|---|
| 442 | //if (parmprint) fprintf(parmfp,"%s",hdatap); |
|---|
| 443 | } |
|---|
| 444 | else if (haddp) *haddp='\0'; |
|---|
| 445 | |
|---|
| 446 | #if CICPP |
|---|
| 447 | delete swtrmp; |
|---|
| 448 | #else /* CICPP */ |
|---|
| 449 | if (switrm>=0L) if (vtrmp[switrm]!=NULL) { /**/ |
|---|
| 450 | FREE(vtrmp[switrm]); vtrmp[switrm]=NULL; ntrms--; |
|---|
| 451 | } |
|---|
| 452 | #endif /* CICPP */ |
|---|
| 453 | #if CICPP |
|---|
| 454 | delete swrecp; |
|---|
| 455 | #else /* CICPP */ |
|---|
| 456 | if (swirec>=0L) if (vrecp[swirec]!=NULL) { /**/ |
|---|
| 457 | FREE(vrecp[swirec]); vrecp[swirec]=NULL; nrecs--; |
|---|
| 458 | } |
|---|
| 459 | #endif /* CICPP */ |
|---|
| 460 | |
|---|
| 461 | #if CICPP |
|---|
| 462 | if (recp->xfldupdat(xarea)) fatal(errp); |
|---|
| 463 | delete xarea; |
|---|
| 464 | #else /* CICPP */ |
|---|
| 465 | if (fldupdat(irec,xarea)) fatal(errp); |
|---|
| 466 | if (xarea) FREE(xarea); |
|---|
| 467 | #endif /* CICPP */ |
|---|
| 468 | |
|---|
| 469 | return NULL; //isgdump=1; |
|---|
| 470 | |
|---|
| 471 | } /* end Gmark */ |
|---|
| 472 | else |
|---|
| 473 | |
|---|
| 474 | #endif /* PROCXMARKREC */ |
|---|
| 475 | /* End PROCXMARKREC |
|---|
| 476 | */ |
|---|