16ca2c52aSchristos /* Header file for GDB CLI set and show commands implementation.
2*184b2d41Schristos    Copyright (C) 2000-2020 Free Software Foundation, Inc.
36ca2c52aSchristos 
46ca2c52aSchristos    This program is free software; you can redistribute it and/or modify
56ca2c52aSchristos    it under the terms of the GNU General Public License as published by
66ca2c52aSchristos    the Free Software Foundation; either version 3 of the License, or
76ca2c52aSchristos    (at your option) any later version.
86ca2c52aSchristos 
96ca2c52aSchristos    This program is distributed in the hope that it will be useful,
106ca2c52aSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
116ca2c52aSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
126ca2c52aSchristos    GNU General Public License for more details.
136ca2c52aSchristos 
146ca2c52aSchristos    You should have received a copy of the GNU General Public License
156ca2c52aSchristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
166ca2c52aSchristos 
17051580eeSchristos #ifndef CLI_CLI_SETSHOW_H
18051580eeSchristos #define CLI_CLI_SETSHOW_H
196ca2c52aSchristos 
20*184b2d41Schristos #include <string>
21*184b2d41Schristos 
226ca2c52aSchristos struct cmd_list_element;
236ca2c52aSchristos 
246ca2c52aSchristos /* Parse ARG, an option to a boolean variable.
256ca2c52aSchristos    Returns 1 for true, 0 for false, and -1 if invalid.  */
266ca2c52aSchristos extern int parse_cli_boolean_value (const char *arg);
276ca2c52aSchristos 
28*184b2d41Schristos /* Same as above, but work with a pointer to pointer.  ARG is advanced
29*184b2d41Schristos    past a successfully parsed value.  */
30*184b2d41Schristos extern int parse_cli_boolean_value (const char **arg);
31*184b2d41Schristos 
32*184b2d41Schristos /* Parse ARG, an option to a var_uinteger or var_zuinteger variable.
33*184b2d41Schristos    Either returns the parsed value on success or throws an error.  If
34*184b2d41Schristos    EXPRESSION is true, *ARG is parsed as an expression; otherwise, it
35*184b2d41Schristos    is parsed with get_ulongest.  It's not possible to parse the
36*184b2d41Schristos    integer as an expression when there may be valid input after the
37*184b2d41Schristos    integer, such as when parsing command options.  E.g., "print
38*184b2d41Schristos    -elements NUMBER -obj --".  In such case, parsing as an expression
39*184b2d41Schristos    would parse "-obj --" as part of the expression as well.  */
40*184b2d41Schristos extern unsigned int parse_cli_var_uinteger (var_types var_type,
41*184b2d41Schristos 					    const char **arg,
42*184b2d41Schristos 					    bool expression);
43*184b2d41Schristos 
44*184b2d41Schristos /* Like parse_cli_var_uinteger, for var_zuinteger_unlimited.  */
45*184b2d41Schristos extern int parse_cli_var_zuinteger_unlimited (const char **arg,
46*184b2d41Schristos 					      bool expression);
47*184b2d41Schristos 
48*184b2d41Schristos /* Parse ARG, an option to a var_enum variable.  ENUM is a
49*184b2d41Schristos    null-terminated array of possible values. Either returns the parsed
50*184b2d41Schristos    value on success or throws an error.  ARG is advanced past the
51*184b2d41Schristos    parsed value.  */
52*184b2d41Schristos const char *parse_cli_var_enum (const char **args,
53*184b2d41Schristos 				const char *const *enums);
54*184b2d41Schristos 
556ca2c52aSchristos extern void do_set_command (const char *arg, int from_tty,
566ca2c52aSchristos 			    struct cmd_list_element *c);
576ca2c52aSchristos extern void do_show_command (const char *arg, int from_tty,
586ca2c52aSchristos 			     struct cmd_list_element *c);
596ca2c52aSchristos 
60*184b2d41Schristos /* Get a string version of C's current value.  */
61*184b2d41Schristos extern std::string get_setshow_command_value_string (const cmd_list_element *c);
62*184b2d41Schristos 
63*184b2d41Schristos extern void cmd_show_list (struct cmd_list_element *list, int from_tty);
646ca2c52aSchristos 
65051580eeSchristos #endif /* CLI_CLI_SETSHOW_H */
66