You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
#include <config.h>
#include "data-list.h"
int fc, lc; /* Column numbers in record. */
/* Free format only. */
- char name[9]; /* Name of variable. */
+ char name[LONG_NAME_LEN + 1]; /* Name of variable. */
};
/* Constants for DATA LIST type. */
if (lex_match_id ("TAB"))
delim = '\t';
else if (token == T_STRING && tokstr.length == 1)
- delim = tokstr.string[0];
+ {
+ delim = tokstr.string[0];
+ lex_get();
+ }
else
{
lex_error (NULL);
add_transformation (&new_pgm->h);
}
else
- vfm_source = create_case_source (&data_list_source_class,
- default_dict, dls);
+ vfm_source = create_case_source (&data_list_source_class, dls);
return CMD_SUCCESS;
while (lex_match ('/'))
{
fx.recno++;
- if (lex_integer_p ())
+ if (lex_is_integer ())
{
if (lex_integer () < fx.recno)
{
if (!parse_DATA_LIST_vars (&fx.name, &fx.name_cnt, PV_NONE))
return 0;
- if (token == T_NUM)
+ if (lex_is_number ())
{
if (!fixed_parse_compatible (&fx, &dls->first, &dls->last))
goto fail;
else
{
msg (SE, _("SPSS-like or FORTRAN-like format "
- "specification expected after variable names."));
+ "specification expected after variable names."));
goto fail;
}
else
input.type = FMT_F;
- if (lex_integer_p ())
+ if (lex_is_integer ())
{
if (lex_integer () < 1)
{
input.type = FMT_F;
input.d = 0;
}
- if (!check_input_specifier (&input))
+ if (!check_input_specifier (&input, 1))
return 0;
/* Start column for next specification. */
tail = new;
/* Parse count. */
- if (lex_integer_p ())
+ if (lex_is_integer ())
{
new->count = lex_integer ();
lex_get ();
}
else if (lex_match ('/'))
new->f.type = FMT_NEWREC;
- else if (!parse_format_specifier (&new->f, 1)
- || !check_input_specifier (&new->f))
+ else if (!parse_format_specifier (&new->f, FMTP_ALLOW_XT)
+ || !check_input_specifier (&new->f, 1))
goto fail;
lex_match (',');
if (!parse_DATA_LIST_vars (&name, &name_cnt, PV_NONE))
return 0;
+
if (lex_match ('('))
{
if (!parse_format_specifier (&input, 0)
- || !check_input_specifier (&input)
+ || !check_input_specifier (&input, 1)
|| !lex_force_match (')'))
{
for (i = 0; i < name_cnt; i++)
struct variable *v;
v = dict_create_var (default_dict, name[i], width);
+
if (!v)
{
msg (SE, _("%s is a duplicate variable name."), name[i]);
spec->input = input;
spec->v = v;
spec->fv = v->fv;
- strcpy (spec->name, name[i]);
+ st_trim_copy (spec->name, v->name, sizeof spec->name);
append_var_spec (first, last, spec);
}
for (i = 0; i < name_cnt; i++)
a 1-based column number indicating the beginning of the field
on success. */
static int
-cut_field (const struct data_list_pgm *dls, struct len_string *field,
+cut_field (const struct data_list_pgm *dls, struct fixed_string *field,
int *end_blank)
{
- struct len_string line;
+ struct fixed_string line;
char *cp;
size_t column_start;
return -2;
for (i = 1; i <= dls->rec_cnt; i++)
{
- struct len_string line;
+ struct fixed_string line;
if (dfm_eof (dls->reader))
{
data_in_finite_line (&di, ls_c_str (&line), ls_length (&line),
var_spec->fc, var_spec->lc);
di.v = case_data_rw (c, var_spec->fv);
- di.flags = 0;
+ di.flags = DI_IMPLIED_DECIMALS;
di.f1 = var_spec->fc;
di.format = var_spec->input;
for (var_spec = dls->first; var_spec; var_spec = var_spec->next)
{
- struct len_string field;
+ struct fixed_string field;
int column;
/* Cut out a field and read in a new record if necessary. */
for (var_spec = dls->first; var_spec; var_spec = var_spec->next)
{
- struct len_string field;
+ struct fixed_string field;
int column;
/* Cut out a field and check for end-of-line. */
return 0;
}
}
- else if (lex_integer_p ())
+ else if (lex_is_integer ())
{
value->num = lex_integer ();
if (!parse_DATA_LIST_vars (&fx.name, &fx.name_cnt, PV_NONE))
return 0;
- if (token == T_NUM)
+ if (lex_is_number ())
{
if (!fixed_parse_compatible (&fx, first, last))
goto fail;
{
struct repeating_data_trns *t = (struct repeating_data_trns *) trns;
- struct len_string line; /* Current record. */
+ struct fixed_string line; /* Current record. */
int starts_beg; /* Starting column. */
int starts_end; /* Ending column. */