[RFA] Make word-break-characters language independent (1/3)
Joel Brobecker
brobecker@gnat.com
Thu Oct 2 05:22:00 GMT 2003
This is the first patch of a series of 3 that follow up on a discussion
about making the word_break_characters language dependent. See:
http://sources.redhat.com/ml/gdb-patches/2003-09/msg00399.html.
The plan is as follow:
1. Add a new function in language: default_word_break_characters()
2. Add a new field la_word_break_characters in struct language_defn
Update all instances of this structure to set this new field
to default_word_break_characters.
3. Remove gdb_completer_word_break_characters and
get_gdb_completer_word_break_characters. Replace them with
either default_word_break_characters or the current_language
la_word_break_characters.
In the end, GDB's behavior is entirely identical. But it will allow
Ada to define it's own set of word-break-characters, allowing it to
fine-tune the completion mechanism.
I divided this change in 3 patches to show the process I used, and
to show that the changes are mostly mechanical (and hopefully correct
:-). If necessary, I can break them up further (for instance patch3
can be broken up in two steps), or submit all 3 of them in one patch.
Let me know.
Attached is the first patch.
2003-10-01 J. Brobecker <brobecker@gnat.com>
* language.h (default_word_break_characters): Add prototype.
* language.c (default_word_break_characters): New function.
Ok to apply?
--
Joel
-------------- next part --------------
Index: language.c
===================================================================
RCS file: /cvs/src/src/gdb/language.c,v
retrieving revision 1.38
diff -u -p -r1.38 language.c
--- language.c 25 Sep 2003 08:40:45 -0000 1.38
+++ language.c 2 Oct 2003 04:59:56 -0000
@@ -1176,6 +1176,15 @@ language_demangle (const struct language
return NULL;
}
+/* Return the default string containing the list of characters
+ delimiting words. This is a reasonable default value that
+ most languages should be able to use. */
+
+char *
+default_word_break_characters (void)
+{
+ return " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-";
+}
/* Define the language that is no language. */
Index: language.h
===================================================================
RCS file: /cvs/src/src/gdb/language.h,v
retrieving revision 1.22
diff -u -p -r1.22 language.h
--- language.h 25 Sep 2003 08:40:45 -0000 1.22
+++ language.h 2 Oct 2003 04:59:56 -0000
@@ -502,4 +502,7 @@ extern CORE_ADDR skip_language_trampolin
extern char *language_demangle (const struct language_defn *current_language,
const char *mangled, int options);
+/* Splitting strings into words. */
+extern char *default_word_break_characters (void);
+
#endif /* defined (LANGUAGE_H) */
More information about the Gdb-patches
mailing list