X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fcommand.c;h=2284deedc8324a51c05bad47f9ea6a4b90e506de;hb=c246143823df29e9ce4c5115c647a47954dea883;hp=cfae2ba03e5ec4b2b5c1f56e90f2c5993ed9d7c0;hpb=3816248a008a4af75aac6319d0c9929cb7ff679e;p=pspp diff --git a/src/language/command.c b/src/language/command.c index cfae2ba03e..2284deedc8 100644 --- a/src/language/command.c +++ b/src/language/command.c @@ -1,6 +1,5 @@ /* PSPP - computes sample statistics. Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. - Written by Ben Pfaff . This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -32,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -137,14 +136,15 @@ static enum cmd_result do_parse_command (struct lexer *, struct dataset *, enum dot. On failure, skips to the terminating dot. Returns the command's success or failure result. */ enum cmd_result -cmd_parse (struct lexer *lexer, struct dataset *ds, enum cmd_state state) +cmd_parse_in_state (struct lexer *lexer, struct dataset *ds, + enum cmd_state state) { int result; - + som_new_series (); result = do_parse_command (lexer, ds, state); - if (cmd_result_is_failure (result)) + if (cmd_result_is_failure (result)) lex_discard_rest_of_command (lexer); unset_cmd_algorithm (); @@ -153,6 +153,17 @@ cmd_parse (struct lexer *lexer, struct dataset *ds, enum cmd_state state) return result; } +enum cmd_result +cmd_parse (struct lexer *lexer, struct dataset *ds) +{ + const struct dictionary *dict = dataset_dict (ds); + return cmd_parse_in_state (lexer, ds, + proc_has_source (ds) && + dict_get_var_cnt (dict) > 0 ? + CMD_STATE_DATA : CMD_STATE_INITIAL); +} + + /* Parses an entire command, from command name to terminating dot. */ static enum cmd_result @@ -162,7 +173,7 @@ do_parse_command (struct lexer *lexer, struct dataset *ds, enum cmd_state state) enum cmd_result result; /* Read the command's first token. */ - getl_set_prompt_style (GETL_PROMPT_FIRST); + prompt_set_style (PROMPT_FIRST); set_completion_state (state); lex_get (lexer); if (lex_token (lexer) == T_STOP) @@ -172,7 +183,7 @@ do_parse_command (struct lexer *lexer, struct dataset *ds, enum cmd_state state) /* Null commands can result from extra empty lines. */ return CMD_SUCCESS; } - getl_set_prompt_style (GETL_PROMPT_LATER); + prompt_set_style (PROMPT_LATER); /* Parse the command name. */ command = parse_command_name (lexer);