17 |
|
#include "rtio.h" |
18 |
|
#include "calcomp.h" |
19 |
|
|
20 |
< |
#define isnum(c) (isdigit(c) || (c)=='-' || (c)=='.' \ |
21 |
< |
|| (c)=='+' || (c)=='e' || (c)=='E') |
20 |
> |
#define isnum(c) (isdigit(c) || ((c)=='-') | ((c)=='.') \ |
21 |
> |
| ((c)=='+') | ((c)=='e') | ((c)=='E')) |
22 |
|
|
23 |
< |
#define isblnk(c) (igneol ? isspace(c) : (c)==' '||(c)=='\t') |
23 |
> |
#define isblnk(c) (igneol ? isspace(c) : ((c)==' ')|((c)=='\t')) |
24 |
|
|
25 |
|
#define INBSIZ 16384 /* longest record */ |
26 |
|
#define MAXCOL 32 /* number of columns recorded */ |
280 |
|
{ |
281 |
|
if (inpfmt != NULL) |
282 |
|
return(getrec()); |
283 |
< |
if (tolower(itype) == 'd') { |
283 |
> |
if ((itype == 'd') | (itype == 'D')) { |
284 |
|
if (getbinary(inpbuf, sizeof(double), nbicols, fp) != nbicols) |
285 |
|
return(0); |
286 |
|
if (itype == 'D') |
287 |
|
swap64(inpbuf, nbicols); |
288 |
|
return(1); |
289 |
|
} |
290 |
< |
if (tolower(itype) == 'f') { |
290 |
> |
if ((itype == 'f') | (itype == 'F')) { |
291 |
|
if (getbinary(inpbuf, sizeof(float), nbicols, fp) != nbicols) |
292 |
|
return(0); |
293 |
|
if (itype == 'F') |
413 |
|
if (nbicols) { |
414 |
|
if (n > nbicols) |
415 |
|
return(0.0); |
416 |
< |
if (tolower(itype) == 'd') { |
416 |
> |
if ((itype == 'd') | (itype == 'D')) { |
417 |
|
cp = inpbuf + (n-1)*sizeof(double); |
418 |
|
return(*(double *)cp); |
419 |
|
} |
468 |
|
) |
469 |
|
{ |
470 |
|
static char zerobuf[sizeof(double)]; |
471 |
+ |
const int otlen = ((otype == 'd') | (otype == 'D')) ? |
472 |
+ |
sizeof(double) : sizeof(float); |
473 |
|
float fval = v; |
474 |
|
|
475 |
|
while (++colpos < n) |
476 |
< |
putbinary(zerobuf, |
475 |
< |
tolower(otype)=='d' ? sizeof(double) : sizeof(float), |
476 |
< |
1, stdout); |
476 |
> |
putbinary(zerobuf, otlen, 1, stdout); |
477 |
|
switch (otype) { |
478 |
|
case 'D': |
479 |
|
swap64((char *)&v, 1); |
700 |
|
if (ipb.chr == EOF) |
701 |
|
return(0); |
702 |
|
} |
703 |
< |
eatline = (!igneol && ipb.chr != '\n'); |
703 |
> |
eatline = !igneol & (ipb.chr != '\n'); |
704 |
|
clearrec(); /* start with fresh record */ |
705 |
|
for (f = inpfmt; f != NULL; f = f->next) |
706 |
|
if (getfield(f) == -1) |
761 |
|
delim = f->next->f.sl[0]; |
762 |
|
cp = buf; |
763 |
|
do { |
764 |
< |
if (ipb.chr == EOF || ipb.chr == '\n') |
764 |
> |
if ((ipb.chr == EOF) | (ipb.chr == '\n')) |
765 |
|
inword = 0; |
766 |
|
else if (blnkeq && delim != EOF) |
767 |
|
inword = isblnk(delim) ? |