Move line_header_hash to dwarf2_per_objfile
[deliverable/binutils-gdb.git] / gdb / cli / cli-utils.h
index 1ab879df9d54d389d39b4223f4187bc397c2d85d..c8c69a51c4d770986edeeb58c82024c3e59f45bd 100644 (file)
@@ -1,6 +1,6 @@
 /* CLI utilities.
 
-   Copyright (C) 2011-2019 Free Software Foundation, Inc.
+   Copyright (C) 2011-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef CLI_UTILS_H
-#define CLI_UTILS_H
+#ifndef CLI_CLI_UTILS_H
+#define CLI_CLI_UTILS_H
+
+#include "completer.h"
+
+struct cmd_list_element;
 
 /* *PP is a string denoting a number.  Get the number.  Advance *PP
    after the string and any trailing whitespace.
@@ -39,22 +43,9 @@ extern int get_number (const char **);
 
 extern int get_number (char **);
 
-/* Extract from ARGS the arguments [-q] [-t TYPEREGEXP] [--] NAMEREGEXP.
-
-   The caller is responsible to initialize *QUIET to false, *REGEXP
-   and *T_REGEXP to "".
-   extract_info_print_args can then be called iteratively to search
-   for valid arguments, as part of a 'main parsing loop' searching for
-   -q/-t/-- arguments together with other flags and options.
-
-   Returns true and updates *ARGS + one of *QUIET, *REGEXP, *T_REGEXP if
-   it finds a valid argument.
-   Returns false if no valid argument is found at the beginning of ARGS.  */
-
-extern bool extract_info_print_args (const char **args,
-                                    bool *quiet,
-                                    std::string *regexp,
-                                    std::string *t_regexp);
+/* Like get_number_trailer, but works with ULONGEST, and throws on
+   error instead of returning 0.  */
+extern ULONGEST get_ulongest (const char **pp, int trailer = '\0');
 
 /* Throws an error telling the user that ARGS starts with an option
    unrecognized by COMMAND.  */
@@ -64,10 +55,13 @@ extern void report_unrecognized_option_error (const char *command,
 
 
 /* Builds the help string for a command documented by PREFIX,
-   followed by the extract_info_print_args help for ENTITY_KIND.  */
+   followed by the extract_info_print_args help for ENTITY_KIND.  If
+   DOCUMENT_N_FLAG is true then help text describing the -n flag is also
+   included.  */
 
 const char *info_print_args_help (const char *prefix,
-                                 const char *entity_kind);
+                                 const char *entity_kind,
+                                 bool document_n_flag);
 
 /* Parse a number or a range.
    A number will be of the form handled by get_number.
@@ -188,9 +182,19 @@ extern std::string extract_arg (const char **arg);
 /* A helper function that looks for an argument at the start of a
    string.  The argument must also either be at the end of the string,
    or be followed by whitespace.  Returns 1 if it finds the argument,
-   0 otherwise.  If the argument is found, it updates *STR.  */
+   0 otherwise.  If the argument is found, it updates *STR to point
+   past the argument and past any whitespace following the
+   argument.  */
 extern int check_for_argument (const char **str, const char *arg, int arg_len);
 
+/* Same as above, but ARG's length is computed.  */
+
+static inline int
+check_for_argument (const char **str, const char *arg)
+{
+  return check_for_argument (str, arg, strlen (arg));
+}
+
 /* Same, for non-const STR.  */
 
 static inline int
@@ -200,16 +204,14 @@ check_for_argument (char **str, const char *arg, int arg_len)
                             arg, arg_len);
 }
 
-/* A helper function that looks for a set of flags at the start of a
-   string.  The possible flags are given as a null terminated string.
-   A flag in STR must either be at the end of the string,
-   or be followed by whitespace.
-   Returns 0 if no valid flag is found at the start of STR.
-   Otherwise updates *STR, and returns N (which is > 0),
-   such that FLAGS [N - 1] is the valid found flag.  */
-extern int parse_flags (const char **str, const char *flags);
+static inline int
+check_for_argument (char **str, const char *arg)
+{
+  return check_for_argument (str, arg, strlen (arg));
+}
 
-/* qcs_flags struct regroups the flags parsed by parse_flags_qcs.  */
+/* qcs_flags struct groups the -q, -c, and -s flags parsed by "thread
+   apply" and "frame apply" commands */
 
 struct qcs_flags
 {
@@ -218,24 +220,9 @@ struct qcs_flags
   bool silent = false;
 };
 
-/* A helper function that uses parse_flags to handle the flags qcs :
-     A flag -q sets FLAGS->QUIET to true.
-     A flag -c sets FLAGS->CONT to true.
-     A flag -s sets FLAGS->SILENT to true.
-
-   The caller is responsible to initialize *FLAGS to false before the (first)
-   call to parse_flags_qcs.
-   parse_flags_qcs can then be called iteratively to search for more
-   valid flags, as part of a 'main parsing loop' searching for -q/-c/-s
-   flags together with other flags and options.
-
-   Returns true and updates *STR and one of FLAGS->QUIET, FLAGS->CONT,
-   FLAGS->SILENT if it finds a valid flag.
-   Returns false if no valid flag is found at the beginning of STR.
-
-   Throws an error if a flag is found such that both FLAGS->CONT and
-   FLAGS->SILENT are true.  */
+/* Validate FLAGS.  Throws an error if both FLAGS->CONT and
+   FLAGS->SILENT are true.  WHICH_COMMAND is included in the error
+   message.  */
+extern void validate_flags_qcs (const char *which_command, qcs_flags *flags);
 
-extern bool parse_flags_qcs (const char *which_command, const char **str,
-                            qcs_flags *flags);
-#endif /* CLI_UTILS_H */
+#endif /* CLI_CLI_UTILS_H */
This page took 0.026266 seconds and 4 git commands to generate.