Remove "Written by Ben Pfaff <blp@gnu.org>" lines everywhere.
[pspp-builds.git] / src / language / command.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or
5    modify it under the terms of the GNU General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17    02110-1301, USA. */
18
19 #ifndef COMMAND_H
20 #define COMMAND_H 1
21
22 #include <stdbool.h>
23
24 /* Command return values. */
25 enum cmd_result
26   {
27     /* Successful return values. */
28     CMD_SUCCESS = 1,            /* Successfully parsed and executed. */
29     CMD_EOF = 2,                /* End of input. */
30     CMD_FINISH = 3,             /* FINISH was executed. */
31
32     /* Range of successful return values available for use
33        by agreement between a command and the caller of
34        cmd_parse(). */
35     CMD_PRIVATE_FIRST = 4,      
36     CMD_PRIVATE_LAST = 127,      
37
38     /* Various kinds of failures. */
39     CMD_FAILURE = -1,           /* Not executed at all. */
40     CMD_NOT_IMPLEMENTED = -2,   /* Command not implemented. */
41     CMD_CASCADING_FAILURE = -3  /* Serious error: don't continue. */
42   };
43
44 bool cmd_result_is_success (enum cmd_result);
45 bool cmd_result_is_failure (enum cmd_result);
46
47 /* Command processing state. */
48 enum cmd_state
49   {
50     CMD_STATE_INITIAL,          /* No active file yet defined. */
51     CMD_STATE_DATA,             /* Active file has been defined. */
52     CMD_STATE_INPUT_PROGRAM,    /* Inside INPUT PROGRAM. */
53     CMD_STATE_FILE_TYPE         /* Inside FILE TYPE. */
54   };
55
56 struct dataset;
57 struct lexer; 
58
59 enum cmd_result cmd_parse (struct lexer *lexer, struct dataset *ds, enum cmd_state);
60
61 struct command;
62 const char *cmd_complete (const char *, const struct command **);
63
64 struct dataset;
65
66 /* Prototype all the command functions. */
67 #define DEF_CMD(STATES, FLAGS, NAME, FUNCTION) int FUNCTION (struct lexer *, struct dataset *);
68 #define UNIMPL_CMD(NAME, DESCRIPTION)
69 #include "command.def"
70 #undef DEF_CMD
71 #undef UNIMPL_CMD
72
73 #endif /* command.h */