/* Parses and executes APPLY DICTIONARY. */
int
-cmd_apply_dictionary (void)
+cmd_apply_dictionary (struct lexer *lexer, struct dataset *ds)
{
struct file_handle *handle;
struct any_reader *reader;
int i;
- lex_match_id ("FROM");
- lex_match ('=');
- handle = fh_parse (FH_REF_FILE | FH_REF_SCRATCH);
+ lex_match_id (lexer, "FROM");
+ lex_match (lexer, '=');
+ handle = fh_parse (lexer, FH_REF_FILE | FH_REF_SCRATCH);
if (!handle)
return CMD_FAILURE;
for (i = 0; i < dict_get_var_cnt (dict); i++)
{
struct variable *s = dict_get_var (dict, i);
- struct variable *t = dict_lookup_var (default_dict, s->name);
+ struct variable *t = dict_lookup_var (dataset_dict (ds), s->name);
if (t == NULL)
continue;
if (dict_get_weight (dict) != NULL)
{
struct variable *new_weight
- = dict_lookup_var (default_dict, dict_get_weight (dict)->name);
+ = dict_lookup_var (dataset_dict (ds), dict_get_weight (dict)->name);
if (new_weight != NULL)
- dict_set_weight (default_dict, new_weight);
+ dict_set_weight (dataset_dict (ds), new_weight);
}
any_reader_close (reader);
- return lex_end_of_command ();
+ return lex_end_of_command (lexer);
}