projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed buglet in file open action.
[pspp-builds.git]
/
src
/
language
/
dictionary
/
vector.c
diff --git
a/src/language/dictionary/vector.c
b/src/language/dictionary/vector.c
index 050886d9effd334d203b627e37d6d2e91c6595d4..909daba71a90b131b4753771d936da8e9f43f7e8 100644
(file)
--- a/
src/language/dictionary/vector.c
+++ b/
src/language/dictionary/vector.c
@@
-1,6
+1,5
@@
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@
-37,7
+36,7
@@
#define _(msgid) gettext (msgid)
int
#define _(msgid) gettext (msgid)
int
-cmd_vector (
void
)
+cmd_vector (
struct lexer *lexer, struct dataset *ds
)
{
/* Just to be different, points to a set of null terminated strings
containing the names of the vectors to be created. The list
{
/* Just to be different, points to a set of null terminated strings
containing the names of the vectors to be created. The list
@@
-51,14
+50,16
@@
cmd_vector (void)
/* Maximum allocated position for vecnames, plus one position. */
char *endp = NULL;
/* Maximum allocated position for vecnames, plus one position. */
char *endp = NULL;
+ struct dictionary *dict = dataset_dict (ds);
+
cp = vecnames = xmalloc (256);
endp = &vecnames[256];
do
{
/* Get the name(s) of the new vector(s). */
cp = vecnames = xmalloc (256);
endp = &vecnames[256];
do
{
/* Get the name(s) of the new vector(s). */
- if (!lex_force_id ())
+ if (!lex_force_id (
lexer
))
return CMD_CASCADING_FAILURE;
return CMD_CASCADING_FAILURE;
- while (
token
== T_ID)
+ while (
lex_token (lexer)
== T_ID)
{
if (cp + 16 > endp)
{
{
if (cp + 16 > endp)
{
@@
-69,27
+70,27
@@
cmd_vector (void)
}
for (cp2 = cp; cp2 < cp; cp2 += strlen (cp))
}
for (cp2 = cp; cp2 < cp; cp2 += strlen (cp))
- if (!strcasecmp (cp2,
tokid
))
+ if (!strcasecmp (cp2,
lex_tokid (lexer)
))
{
{
- msg (SE, _("Vector name %s is given twice."),
tokid
);
+ msg (SE, _("Vector name %s is given twice."),
lex_tokid (lexer)
);
goto fail;
}
goto fail;
}
- if (dict_lookup_vector (d
ataset_dict (current_dataset), tokid
))
+ if (dict_lookup_vector (d
ict, lex_tokid (lexer)
))
{
{
- msg (SE, _("There is already a vector with name %s."),
tokid
);
+ msg (SE, _("There is already a vector with name %s."),
lex_tokid (lexer)
);
goto fail;
}
goto fail;
}
- cp = stpcpy (cp,
tokid
) + 1;
- lex_get ();
- lex_match (',');
+ cp = stpcpy (cp,
lex_tokid (lexer)
) + 1;
+ lex_get (
lexer
);
+ lex_match (
lexer,
',');
}
*cp++ = 0;
/* Now that we have the names it's time to check for the short
or long forms. */
}
*cp++ = 0;
/* Now that we have the names it's time to check for the short
or long forms. */
- if (lex_match ('='))
+ if (lex_match (
lexer,
'='))
{
/* Long form. */
struct variable **v;
{
/* Long form. */
struct variable **v;
@@
-104,14
+105,14
@@
cmd_vector (void)
goto fail;
}
goto fail;
}
- if (!parse_variables (
dataset_dict (current_dataset)
, &v, &nv,
- PV_SAME_
TYPE
| PV_DUPLICATE))
+ if (!parse_variables (
lexer, dict
, &v, &nv,
+ PV_SAME_
WIDTH
| PV_DUPLICATE))
goto fail;
goto fail;
- dict_create_vector (d
ataset_dict (current_dataset)
, vecnames, v, nv);
+ dict_create_vector (d
ict
, vecnames, v, nv);
free (v);
}
free (v);
}
- else if (lex_match ('('))
+ else if (lex_match (
lexer,
'('))
{
int i;
{
int i;
@@
-126,16
+127,16
@@
cmd_vector (void)
struct variable **v;
int nv;
struct variable **v;
int nv;
- if (!lex_force_int ())
+ if (!lex_force_int (
lexer
))
return CMD_CASCADING_FAILURE;
return CMD_CASCADING_FAILURE;
- nv = lex_integer ();
- lex_get ();
+ nv = lex_integer (
lexer
);
+ lex_get (
lexer
);
if (nv <= 0)
{
msg (SE, _("Vectors must have at least one element."));
goto fail;
}
if (nv <= 0)
{
msg (SE, _("Vectors must have at least one element."));
goto fail;
}
- if (!lex_force_match (')'))
+ if (!lex_force_match (
lexer,
')'))
goto fail;
/* First check that all the generated variable names
goto fail;
/* First check that all the generated variable names
@@
-158,7
+159,7
@@
cmd_vector (void)
for (i = 0; i < nv; i++)
{
sprintf (name, "%s%d", cp, i + 1);
for (i = 0; i < nv; i++)
{
sprintf (name, "%s%d", cp, i + 1);
- if (dict_lookup_var (d
ataset_dict (current_dataset)
, name))
+ if (dict_lookup_var (d
ict
, name))
{
msg (SE, _("There is already a variable named %s."),
name);
{
msg (SE, _("There is already a variable named %s."),
name);
@@
-175,9
+176,9
@@
cmd_vector (void)
for (i = 0; i < nv; i++)
{
sprintf (name, "%s%d", cp, i + 1);
for (i = 0; i < nv; i++)
{
sprintf (name, "%s%d", cp, i + 1);
- v[i] = dict_create_var_assert (d
ataset_dict (current_dataset)
, name, 0);
+ v[i] = dict_create_var_assert (d
ict
, name, 0);
}
}
- if (!dict_create_vector (d
ataset_dict (current_dataset)
, cp, v, nv))
+ if (!dict_create_vector (d
ict
, cp, v, nv))
NOT_REACHED ();
cp += strlen (cp) + 1;
}
NOT_REACHED ();
cp += strlen (cp) + 1;
}
@@
-194,11
+195,11
@@
cmd_vector (void)
free (vecnames);
vecnames = NULL;
}
free (vecnames);
vecnames = NULL;
}
- while (lex_match ('/'));
+ while (lex_match (
lexer,
'/'));
- if (
token
!= '.')
+ if (
lex_token (lexer)
!= '.')
{
{
- lex_error (_("expecting end of command"));
+ lex_error (
lexer,
_("expecting end of command"));
goto fail;
}
return CMD_SUCCESS;
goto fail;
}
return CMD_SUCCESS;