| 1 | /* ------------------------------ mxtxt.c --------------------------------- */ |
|---|
| 2 | |
|---|
| 3 | #include <stdio.h> |
|---|
| 4 | #include <string.h> |
|---|
| 5 | |
|---|
| 6 | #if 1 |
|---|
| 7 | #if CIAPI |
|---|
| 8 | #include "ciapi.h" /* CISIS Interface API header file - |
|---|
| 9 | includes cisis, implements cirun.h and ci*.c using ci*.?pp */ |
|---|
| 10 | |
|---|
| 11 | #if !MXFUN |
|---|
| 12 | extern void *ciapip; |
|---|
| 13 | #endif /* MXFUN */ |
|---|
| 14 | |
|---|
| 15 | #else /* CIAPI */ |
|---|
| 16 | #include "cisis.h" /* CISIS Interface */ |
|---|
| 17 | #endif /* CIAPIP */ |
|---|
| 18 | #include "mx.h" /* MX Program header file */ |
|---|
| 19 | #else |
|---|
| 20 | #include "\cisis\include\cisis.h" /* CISIS Interface header file */ |
|---|
| 21 | #include "\cisis\mx\mx.h" /* MX Program header file */ |
|---|
| 22 | #endif |
|---|
| 23 | |
|---|
| 24 | int mxtext(xmxp,irec,textp) |
|---|
| 25 | void *xmxp; |
|---|
| 26 | LONGX irec; |
|---|
| 27 | char *textp; |
|---|
| 28 | { |
|---|
| 29 | RECSTRU *recp; /* mandatory for defines REC,MFR,DIR,FIELDP */ |
|---|
| 30 | UWORD diridx,dirloop,chrloop; |
|---|
| 31 | int textlen; |
|---|
| 32 | char *p; |
|---|
| 33 | |
|---|
| 34 | recp=vrecp[irec]; |
|---|
| 35 | |
|---|
| 36 | textlen=strlen(textp); |
|---|
| 37 | mxtext_found=0; |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | if (RECrc != RCNORMAL) return(0); |
|---|
| 41 | |
|---|
| 42 | for (diridx=0, dirloop=MFRnvf; dirloop--; diridx++) { |
|---|
| 43 | p=FIELDP(diridx); |
|---|
| 44 | for (chrloop=DIRlen(diridx); chrloop; p++) { |
|---|
| 45 | if (*p == *textp) |
|---|
| 46 | if (chrloop >= textlen) |
|---|
| 47 | if (memcmp(p,textp,textlen) == 0) { |
|---|
| 48 | mxtext_found=1; |
|---|
| 49 | break; |
|---|
| 50 | } |
|---|
| 51 | chrloop--; |
|---|
| 52 | } |
|---|
| 53 | if (mxtext_found) { |
|---|
| 54 | if (mxtext_pshow) { |
|---|
| 55 | printf("mfn %6"_LD_"|tag %5u|occ %3d|%s\n", |
|---|
| 56 | MFRmfn,DIRtag(diridx),fldocc(irec,diridx),textp); |
|---|
| 57 | /* prtfield(recp,diridx); */ |
|---|
| 58 | printf("%3u %c",DIRtag(diridx),OPENFCHR); |
|---|
| 59 | p=FIELDP(diridx); |
|---|
| 60 | for (chrloop=DIRlen(diridx); chrloop--; p++) |
|---|
| 61 | printf("%c",*p); |
|---|
| 62 | printf("%c\n",CLOSFCHR); |
|---|
| 63 | } |
|---|
| 64 | break; |
|---|
| 65 | } |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | return(0); /* (mxtext_found); */ /* AOT, 02/04/2001 */ |
|---|
| 69 | |
|---|
| 70 | } /* end of main */ |
|---|
| 71 | |
|---|