/* Header for GDB line completion.
- Copyright (C) 2000-2017 Free Software Foundation, Inc.
+ Copyright (C) 2000-2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#if !defined (COMPLETER_H)
#define COMPLETER_H 1
-#include "gdb_vecs.h"
+#include "common/gdb_vecs.h"
#include "command.h"
/* Types of functions in struct match_list_displayer. */
it is not there already. If too many completions were already
found, this throws an error. */
void add_completion (gdb::unique_xmalloc_ptr<char> name,
- completion_match_for_lcd *match_for_lcd = NULL);
+ completion_match_for_lcd *match_for_lcd = NULL,
+ const char *text = NULL, const char *word = NULL);
/* Add all completions matches in LIST. Elements are moved out of
LIST. */
{ m_custom_word_point = point; }
/* Advance the custom word point by LEN. */
- void advance_custom_word_point_by (size_t len);
+ void advance_custom_word_point_by (int len);
/* Whether to tell readline to skip appending a whitespace after the
completion. See m_suppress_append_ws. */
it is not there already. If false is returned, too many
completions were found. */
bool maybe_add_completion (gdb::unique_xmalloc_ptr<char> name,
- completion_match_for_lcd *match_for_lcd);
+ completion_match_for_lcd *match_for_lcd,
+ const char *text, const char *word);
/* Given a new match, recompute the lowest common denominator (LCD)
to hand over to readline. Normally readline computes this itself
"std::vector<..>::push_back", "std::string::push_back", etc., and
in this case we want the lowest common denominator to be
"push_back" instead of "std::". */
- void recompute_lowest_common_denominator (const char *new_match);
+ void recompute_lowest_common_denominator
+ (gdb::unique_xmalloc_ptr<char> &&new_match);
/* Completion match outputs returned by the symbol name matching
routines (see symbol_name_matcher_ftype). These results are only
const char *line_buffer,
int point);
+/* Complete LINE and return completion results. For completion purposes,
+ cursor position is assumed to be at the end of LINE. WORD is set to
+ the end of word to complete. QUOTE_CHAR is set to the opening quote
+ character if we found an unclosed quoted substring, '\0' otherwise. */
+extern completion_result
+ complete (const char *line, char const **word, int *quote_char);
+
/* Find the bounds of the word in TEXT for completion purposes, and
return a pointer to the end of the word. Calls the completion
machinery for a handle_brkchars phase (using TRACKER) to figure out