version 1.1, 2000/01/09 17:00:50 |
version 1.1.1.3, 2003/09/15 07:09:24 |
Line 253 static char *df_gets() |
|
Line 253 static char *df_gets() |
|
{ |
{ |
int len = 0; |
int len = 0; |
|
|
|
/* HBB 20000526: prompt user for inline data, if in interactive mode */ |
|
if (mixed_data_fp && interactive) |
|
fputs("input data ('e' ends) > ", stderr); |
|
|
if (!fgets(line, max_line_len, data_fp)) |
if (!fgets(line, max_line_len, data_fp)) |
return NULL; |
return NULL; |
|
|
|
|
/* |
/* |
* optimizations by Corey Satten, corey@cac.washington.edu |
* optimizations by Corey Satten, corey@cac.washington.edu |
*/ |
*/ |
if (fast_columns == 0 || |
|
df_no_use_specs > 0 && (use_spec[0].column == dfncp1 || |
|
df_no_use_specs > 1 && (use_spec[1].column == dfncp1 || |
|
df_no_use_specs > 2 && (use_spec[2].column == dfncp1 || |
|
df_no_use_specs > 3 && (use_spec[3].column == dfncp1 || |
|
df_no_use_specs > 4 && (use_spec[4].column == dfncp1 || |
|
df_no_use_specs > 5))))) || |
|
df_no_use_specs == 0) { |
|
|
|
|
if ((fast_columns == 0) |
|
|| (df_no_use_specs == 0) |
|
|| ((df_no_use_specs > 0) |
|
&& (use_spec[0].column == dfncp1 |
|
|| (df_no_use_specs > 1 |
|
&& (use_spec[1].column == dfncp1 |
|
|| (df_no_use_specs > 2 |
|
&& (use_spec[2].column == dfncp1 |
|
|| (df_no_use_specs > 3 |
|
&& (use_spec[3].column == dfncp1 |
|
|| (df_no_use_specs > 4 && (use_spec[4].column == dfncp1 || df_no_use_specs > 5) |
|
) |
|
) |
|
) |
|
) |
|
) |
|
) |
|
) |
|
) |
|
) |
|
) { |
|
|
#ifndef NO_FORTRAN_NUMS |
#ifndef NO_FORTRAN_NUMS |
count = sscanf(s, "%lf%n", &df_column[df_no_cols].datum, &used); |
count = sscanf(s, "%lf%n", &df_column[df_no_cols].datum, &used); |
#else |
#else |
|
|
#endif /* NO_FORTRAN_NUMS */ |
#endif /* NO_FORTRAN_NUMS */ |
} else { |
} else { |
/* skip any space at start of column */ |
/* skip any space at start of column */ |
while (isspace((int)*s)) |
/* HBB tells me that the cast must be to |
|
* unsigned char instead of int. */ |
|
while (isspace((unsigned char) *s)) |
++s; |
++s; |
count = *s ? 1 : 0; |
count = *s ? 1 : 0; |
/* skip chars to end of column */ |
/* skip chars to end of column */ |
for (used = 0; !isspace((int)*s) && (*s != NUL); ++used, ++s) |
used = 0; |
; |
while (!isspace((unsigned char) *s) && (*s != NUL)) |
|
++s; |
} |
} |
|
|
/* it might be a fortran double or quad precision. |
/* it might be a fortran double or quad precision. |
|
|
*/ |
*/ |
|
|
{ |
{ |
static char filename[MAX_LINE_LEN + 1] = ""; |
/* now allocated dynamically */ |
|
static char *filename = NULL; |
int i; |
int i; |
int name_token; |
int name_token; |
|
|
|
|
assert(max_using <= NCOL); |
assert(max_using <= NCOL); |
|
|
/* empty name means re-use last one */ |
/* empty name means re-use last one */ |
|
if (isstring(c_token) && token_len(c_token) == 2) { |
{ |
if (!filename || !*filename) |
char name[MAX_LINE_LEN + 1]; |
int_error("No previous filename",c_token); |
quote_str(name, c_token, MAX_LINE_LEN); |
} else { |
if (name[0]) |
filename = gp_realloc(filename, token_len(c_token), "datafile name"); |
strcpy(filename, name); |
quote_str(filename, c_token, token_len(c_token)); |
else if (!filename[0]) |
|
int_error("No previous filename", c_token); |
|
} |
} |
name_token = c_token++; |
name_token = c_token++; |
|
|