-
- return lex_end_of_command ();
-
-fail:
- free (v);
- return CMD_PART_SUCCESS_MAYBE;
-}
-
-static int
-parse_varnames (void)
-{
- int i;
-
- if (!parse_variables (default_dict, &v, &nv, PV_SAME_TYPE))
- return 0;
- if (!lex_match ('('))
- {
- msg (SE, _("`(' expected after variable name%s."), nv > 1 ? "s" : "");
- return 0;
- }
-
- type = v[0]->type;
- if (type == NUMERIC)
- return 1;
-
- width = v[0]->width;
- for (i = 1; i < nv; i++)
- if (v[i]->type == ALPHA && v[i]->nv != 1)
- {
- msg (SE, _("Long string value specified."));
- return 0;
- }
- else if (v[i]->type == ALPHA && (int) width != v[i]->width)
- {
- msg (SE, _("Short strings must be of equal width."));
- return 0;
- }
-
- return 1;
-}
-
-/* Number or range? */
-enum
- {
- MV_NOR_NOTHING, /* Empty. */
- MV_NOR_NUMBER, /* Single number. */
- MV_NOR_RANGE /* Range. */
- };
-
-/* A single value or a range. */
-struct num_or_range
- {
- int type; /* One of NOR_*. */
- double d[2]; /* d[0]=lower bound or value, d[1]=upper bound. */
- };
-
-/* Parses something of the form <num>, or LO[WEST] THRU <num>, or
- <num> THRU HI[GHEST], or <num> THRU <num>, and sets the appropriate
- members of NOR. Returns success. */
-static int
-parse_num_or_range (struct num_or_range * nor)
-{
- if (lex_match_id ("LO") || lex_match_id ("LOWEST"))
- {
- nor->type = MV_NOR_RANGE;
- if (!lex_force_match_id ("THRU"))
- return 0;
- if (!lex_force_num ())
- return 0;
- nor->d[0] = LOWEST;
- nor->d[1] = tokval;
- }
- else if (lex_is_number ())
- {
- nor->d[0] = tokval;
- lex_get ();
-
- if (lex_match_id ("THRU"))
- {
- nor->type = MV_NOR_RANGE;
- if (lex_match_id ("HI") || lex_match_id ("HIGHEST"))
- nor->d[1] = HIGHEST;
- else
- {
- if (!lex_force_num ())
- return 0;
- nor->d[1] = tokval;
- lex_get ();
-
- if (nor->d[0] > nor->d[1])
- {
- msg (SE, _("Range %g THRU %g is not valid because %g is "
- "greater than %g."),
- nor->d[0], nor->d[1], nor->d[0], nor->d[1]);
- return 0;
- }
- }
- }
- else
- nor->type = MV_NOR_NUMBER;
- }
- else
- return -1;
-
- return 1;
-}
-
-/* Parses a set of numeric missing values and stores them into
- `missing[]' and `miss_type' global variables. */
-static int
-parse_numeric (void)
-{
- struct num_or_range set[3];
- int r;
-
- set[1].type = set[2].type = MV_NOR_NOTHING;
-
- /* Get first number or range. */
- r = parse_num_or_range (&set[0]);
- if (r < 1)
- {
- if (r == -1)
- msg (SE, _("Number or range expected."));
- return 0;
- }
-
- /* Get second and third optional number or range. */
- lex_match (',');
- r = parse_num_or_range (&set[1]);
- if (r == 1)
- {
- lex_match (',');
- r = parse_num_or_range (&set[2]);
- }
- if (r == 0)
- return 0;
-
- /* Force range, if present, into set[0]. */
- if (set[1].type == MV_NOR_RANGE)
- {
- struct num_or_range t = set[1];
- set[1] = set[0];
- set[0] = t;
- }
- if (set[2].type == MV_NOR_RANGE)
- {
- struct num_or_range t = set[2];
- set[2] = set[0];
- set[0] = t;
- }