X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdictionary%2Fnumeric.c;h=5a1ab18d1f82a2c9a5bc981b45b909921c7c1b6d;hb=e070d7ddf78446b9852c61c9af84ad3659bac3b3;hp=f946e74a4808e61696f4bdcb563fb582904b1ceb;hpb=b0bf9b1b0f727fafac4296a048e3f45db5936f81;p=pspp-builds.git diff --git a/src/language/dictionary/numeric.c b/src/language/dictionary/numeric.c index f946e74a..5a1ab18d 100644 --- a/src/language/dictionary/numeric.c +++ b/src/language/dictionary/numeric.c @@ -22,11 +22,13 @@ #include #include -#include +#include #include #include +#include #include -#include +#include +#include #include #include @@ -35,7 +37,7 @@ /* Parses the NUMERIC command. */ int -cmd_numeric (void) +cmd_numeric (struct dataset *ds) { size_t i; @@ -55,7 +57,7 @@ cmd_numeric (void) /* Get the optional format specification. */ if (lex_match ('(')) { - if (!parse_format_specifier (&f, 0)) + if (!parse_format_specifier (&f)) goto fail; if (formats[f.type].cat & FCAT_STRING) { @@ -76,7 +78,7 @@ cmd_numeric (void) /* Create each variable. */ for (i = 0; i < nv; i++) { - struct variable *new_var = dict_create_var (default_dict, v[i], 0); + struct variable *new_var = dict_create_var (dataset_dict (ds), v[i], 0); if (!new_var) msg (SE, _("There is already a variable named %s."), v[i]); else @@ -106,7 +108,7 @@ fail: /* Parses the STRING command. */ int -cmd_string (void) +cmd_string (struct dataset *ds) { size_t i; @@ -125,8 +127,7 @@ cmd_string (void) if (!parse_DATA_LIST_vars (&v, &nv, PV_NONE)) return CMD_FAILURE; - if (!lex_force_match ('(') - || !parse_format_specifier (&f, 0)) + if (!lex_force_match ('(') || !parse_format_specifier (&f)) goto fail; if (!(formats[f.type].cat & FCAT_STRING)) { @@ -150,14 +151,13 @@ cmd_string (void) width = f.w / 2; break; default: - assert (0); - abort (); + NOT_REACHED (); } /* Create each variable. */ for (i = 0; i < nv; i++) { - struct variable *new_var = dict_create_var (default_dict, v[i], + struct variable *new_var = dict_create_var (dataset_dict (ds), v[i], width); if (!new_var) msg (SE, _("There is already a variable named %s."), v[i]); @@ -185,14 +185,14 @@ fail: /* Parses the LEAVE command. */ int -cmd_leave (void) +cmd_leave (struct dataset *ds) { struct variable **v; size_t nv; size_t i; - if (!parse_variables (default_dict, &v, &nv, PV_NONE)) + if (!parse_variables (dataset_dict (ds), &v, &nv, PV_NONE)) return CMD_CASCADING_FAILURE; for (i = 0; i < nv; i++) v[i]->leave = true;