root/tags/5.52/mxtxt.c

Revision 4, 2.0 kB (checked in by heitor.barbieri, 2 years ago)

Versão 5.52 do cisis (28/04/2010)

Line 
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
12extern 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
24int mxtext(xmxp,irec,textp)
25void *xmxp;
26LONGX irec;
27char *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 %6ld|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
Note: See TracBrowser for help on using the browser.