root/tags/5.4.pre05/ciupdclps.c @ 1

Revision 1, 2.9 kB (checked in by heitor.barbieri, 2 years ago)

Criação do svn para Cisis.

Line 
1
2
3/* Begin PROCXCLPSREC
4*/
5#if PROCXCLPSREC
6             if (strncmp(p,"collapse=",9) == 0) {
7            char *xarea=NULL;
8            LONGX nbytes;
9            char *q;
10            LONGX xtag;
11            int a2b=0;
12            short int a2bshort;
13            LONGX a2blong;
14            int noccs;
15
16            nbytes=MFRmfrl+BUFSIZ;
17            nbytes+=(MFRmfrl>BUFSIZ)?MFRmfrl:BUFSIZ; /* <== */
18
19            p+=9;
20            if (sscanf(p,"%ld",&xtag) != 1) fatal("fldupdat/procx/Gcollapse/tag");
21            while (isdigit(*p)) p++;
22            if (*p == '=') {
23                p++;
24                if (strncmp(p,"short",5) == 0) {
25                  a2b=sizeof(a2bshort);
26                  p+=5;
27                }
28                if (strncmp(p,"long",4) == 0) {
29                  a2b=sizeof(a2blong);
30                  p+=4;
31                }
32                //if (strncmp(p,"float",5) == 0) {
33                //  a2b=sizeof(a2bfloat);
34                //  p+=5;
35                //}
36            }
37            if (*p) fatal("fldupdat/procx/Gcollapse");
38#if CICPP
39            try { xarea = (char *) new char [nbytes]; }
40            catch (BAD_ALLOC) { xarea = (char *)ALLONULL; }
41#else /* CICPP */
42            xarea=(char *)ALLOC((ALLOPARM)nbytes);
43#endif /* CICPP */
44            if (xarea == (char *)ALLONULL) fatal("fldupdat/procx/Gcollapse/ALLOC");
45            q=xarea;
46            if (xtag)
47              sprintf(q,"D%ld",xtag);
48            else
49              sprintf(q,"D*");
50            q+=strlen(q);
51            for (noccs=0, xdir=0; xdir < MFRnvf; xdir++) {
52                if (DIRtag(xdir) == (UWORD)xtag || !xtag) {
53                    noccs++;
54                } /* end tag */
55            } /* end xdir */
56            sprintf(q,"H %ld %ld ",xtag,(LONGX)noccs*a2b);
57            q+=strlen(q);
58            for (xdir=0; xdir < MFRnvf; xdir++) {
59                if (DIRtag(xdir) == (UWORD)xtag || !xtag) {
60                    FFI left=DIRlen(xdir);
61                    char *fldp=FIELDP(xdir);
62                    unsigned LONGX value=0;
63                    while (left--) {
64                        if (!isdigit(*fldp)) break;
65                        value=value*10+((int)(*fldp)-(int)'0');
66                        fldp++;
67                    }
68                    if (a2b == sizeof(a2bshort)) {
69                        a2bshort=(short int)value;
70                        memcpy(q,(void *)&a2bshort,a2b);
71                    } else {
72                        a2blong=(LONGX)value;
73                        memcpy(q,(void *)&a2blong,a2b);
74                    }
75                    q+=a2b;
76                } /* end tag */
77            } /* end xdir */
78            *q='\0';
79#if CICPP
80        if (recp->xfldupdat(xarea)) fatal(errp);
81        delete xarea;
82#else /* CICPP */
83        if (fldupdat(irec,xarea)) fatal(errp);
84        if (xarea) FREE(xarea);
85#endif /* CICPP */
86
87          return NULL; //isgdump=1;
88
89        }
90        else
91#endif /* PROCXCLPSREC */
92/* End PROCXCLPSREC
93*/
Note: See TracBrowser for help on using the browser.