PR symtab/17559
[deliverable/binutils-gdb.git] / gdb / completer.c
index e13265131a4a29e79275766e8add43f4d00e484f..a0f3fa32aca7910ec9874f8cfafe05b5d2f1921c 100644 (file)
@@ -1,5 +1,5 @@
 /* Line completion stuff for GDB, the GNU debugger.
-   Copyright (C) 2000-2013 Free Software Foundation, Inc.
+   Copyright (C) 2000-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -22,8 +22,6 @@
 #include "expression.h"
 #include "filenames.h"         /* For DOSish file names.  */
 #include "language.h"
-#include "gdb_assert.h"
-#include "exceptions.h"
 #include "gdb_signals.h"
 
 #include "cli/cli-decode.h"
@@ -450,6 +448,21 @@ expression_completer (struct cmd_list_element *ignore,
   return location_completer (ignore, p, word);
 }
 
+/* See definition in completer.h.  */
+
+void
+set_gdb_completion_word_break_characters (completer_ftype *fn)
+{
+  /* So far we are only interested in differentiating filename
+     completers from everything else.  */
+  if (fn == filename_completer)
+    rl_completer_word_break_characters
+      = gdb_completer_file_name_break_characters;
+  else
+    rl_completer_word_break_characters
+      = gdb_completer_command_word_break_characters;
+}
+
 /* Here are some useful test cases for completion.  FIXME: These
    should be put in the test suite.  They should be tested with both
    M-? and TAB.
@@ -678,6 +691,9 @@ complete_line_internal (const char *text,
                           p--)
                        ;
                    }
+                 if (reason == handle_brkchars
+                     && c->completer_handle_brkchars != NULL)
+                   (*c->completer_handle_brkchars) (c, p, word);
                  if (reason != handle_brkchars && c->completer != NULL)
                    list = (*c->completer) (c, p, word);
                }
@@ -751,6 +767,9 @@ complete_line_internal (const char *text,
                       p--)
                    ;
                }
+             if (reason == handle_brkchars
+                 && c->completer_handle_brkchars != NULL)
+               (*c->completer_handle_brkchars) (c, p, word);
              if (reason != handle_brkchars && c->completer != NULL)
                list = (*c->completer) (c, p, word);
            }
@@ -772,7 +791,7 @@ complete_line_internal (const char *text,
    should pretend that the line ends at POINT.  */
 
 VEC (char_ptr) *
-complete_line (const char *text, char *line_buffer, int point)
+complete_line (const char *text, const char *line_buffer, int point)
 {
   return complete_line_internal (text, line_buffer, 
                                 point, handle_completions);
@@ -911,11 +930,12 @@ line_completion_function (const char *text, int matches,
    QUOTECHARS or BREAKCHARS is NULL, use the same values used by the
    completer.  */
 
-char *
-skip_quoted_chars (char *str, char *quotechars, char *breakchars)
+const char *
+skip_quoted_chars (const char *str, const char *quotechars,
+                  const char *breakchars)
 {
   char quote_char = '\0';
-  char *scan;
+  const char *scan;
 
   if (quotechars == NULL)
     quotechars = gdb_completer_quote_characters;
@@ -953,8 +973,8 @@ skip_quoted_chars (char *str, char *quotechars, char *breakchars)
    characters and word break characters used by the completer).
    Returns pointer to the location after the "word".  */
 
-char *
-skip_quoted (char *str)
+const char *
+skip_quoted (const char *str)
 {
   return skip_quoted_chars (str, NULL, NULL);
 }
This page took 0.026105 seconds and 4 git commands to generate.