From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elena Zannoni To: gdb-patches@sources.redhat.com Subject: [RFA] Move some funcs from top.c to completer.c Date: Wed, 09 May 2001 21:06:00 -0000 Message-id: <15098.5049.922353.613702@kwikemart.cygnus.com> X-SW-Source: 2001-05/msg00136.html After staring at completion stuff for a while, I realized that I could clean this up. [You'll notice that the changes to Makefile.in don't correspond 100% to the new include's. This is because the dependencies were already in the Makefile.in, for some files. I think this was left over from JT include's clean up.] Ok to apply? [Eli: actually this can go in after your patch is committed, if this makes your life easier.] Elena 2001-05-09 Elena Zannoni * top.c (readline_line_completion_function, noop_completer): Move from here... * completer.c (readline_line_completion_function, noop_completer): ...to here. * gdbcmd.h (readline_line_completion_function, noop_completer): Move declarations from here... * completer.h (readline_line_completion_function, noop_completer): ...to here. * corefile.c: Include completer.h. * infcmd.c: Ditto. * proc-api.c: Ditto. * source.c: Ditto. * symfile.c: Ditto. * tracepoint.c: Ditto. * Makefile.in: Update dependencies. Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.83 diff -u -p -r1.83 Makefile.in --- Makefile.in 2001/05/09 05:45:30 1.83 +++ Makefile.in 2001/05/10 03:58:08 @@ -1539,7 +1539,7 @@ ia64-tdep.o: ia64-tdep.c $(defs_h) $(inf $(INCLUDE_DIR)/elf/common.h $(regcache_h) infcmd.o: infcmd.c $(defs_h) environ.h $(gdbcmd_h) $(gdbcore_h) \ - $(inferior_h) target.h language.h symfile.h $(gdb_string_h) + $(inferior_h) target.h language.h symfile.h $(gdb_string_h) completer.h inflow.o: inflow.c $(bfd_h) $(command_h) $(defs_h) $(inferior_h) \ target.h terminal.h gdbthread.h $(gdb_string_h) @@ -1753,7 +1753,7 @@ procfs.o: procfs.c $(command_h) $(defs_h target.h $(gdb_string_h) gdbthread.h proc-utils.h $(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) $< -proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) proc-utils.h +proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) proc-utils.h completer.h proc-events.o: proc-events.c $(defs_h) @@ -1787,7 +1787,7 @@ remote-array.o: remote-array.c $(defs_h) $(version_h) $(regcache_h) remote-rdi.o: remote-rdi.c $(defs_h) $(gdbcore_h) \ - $(inferior_h) $(gdb_string_h) + $(inferior_h) $(gdb_string_h) completer.h rdi-share/libangsd.a: force @dir=rdi-share; \ @@ -1929,7 +1929,8 @@ mon960-rom.o: mon960-rom.c monitor.h $(b $(inferior_h) target.h serial.h terminal.h solib.o: solib.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \ - objfiles.h gnu-regex.h symfile.h target.h $(gdb_string_h) solist.h + objfiles.h gnu-regex.h symfile.h target.h $(gdb_string_h) solist.h \ + completer.h solib-svr4.o: solib-svr4.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \ objfiles.h gnu-regex.h symfile.h target.h $(gdb_string_h) solist.h \ @@ -2043,7 +2044,7 @@ vax-tdep.o: vax-tdep.c $(OP_INCLUDE)/vax w65-tdep.o : w65-tdep.c $(gdbcore_h) $(regcache_h) win32-nat.o: win32-nat.c $(gdbcmd_h) $(gdbcore_h) $(inferior_h) $(defs_h) \ - $(gdb_string_h) $(regcache_h) + $(gdb_string_h) $(regcache_h) completer.h xdr_ld.o: vx-share/xdr_ld.c $(defs_h) vx-share/vxTypes.h \ vx-share/vxWorks.h vx-share/xdr_ld.h Index: completer.c =================================================================== RCS file: /cvs/src/src/gdb/completer.c,v retrieving revision 1.4 diff -u -p -r1.4 completer.c --- completer.c 2001/03/06 08:21:06 1.4 +++ completer.c 2001/05/10 03:58:08 @@ -36,6 +36,8 @@ #include "completer.h" /* Prototypes for local functions */ +char *line_completion_function (char *text, int matches, char *line_buffer, + int point); /* readline uses the word breaks for two things: (1) In figuring out where to point the TEXT parameter to the @@ -89,6 +91,22 @@ char * get_gdb_completer_quote_characters (void) { return gdb_completer_quote_characters; +} + +/* Line completion interface function for readline. */ + +char * +readline_line_completion_function (char *text, int matches) +{ + return line_completion_function (text, matches, rl_line_buffer, rl_point); +} + +/* This can be used for functions which don't want to complete on symbols + but don't want to complete on anything else either. */ +char ** +noop_completer (char *text, char *prefix) +{ + return NULL; } /* Complete on filenames. */ Index: completer.h =================================================================== RCS file: /cvs/src/src/gdb/completer.h,v retrieving revision 1.2 diff -u -p -r1.2 completer.h --- completer.h 2001/03/06 08:21:06 1.2 +++ completer.h 2001/05/10 03:58:08 @@ -21,6 +21,10 @@ extern char *line_completion_function (char *, int, char *, int); +extern char *readline_line_completion_function (char *text, int matches); + +extern char **noop_completer (char *, char *); + extern char **filename_completer (char *, char *); extern char *get_gdb_completer_word_break_characters (void); Index: corefile.c =================================================================== RCS file: /cvs/src/src/gdb/corefile.c,v retrieving revision 1.13 diff -u -p -r1.13 corefile.c --- corefile.c 2001/04/14 19:23:02 1.13 +++ corefile.c 2001/05/10 03:58:08 @@ -34,6 +34,7 @@ #include "gdbcore.h" #include "dis-asm.h" #include "gdb_stat.h" +#include "completer.h" /* Local function declarations. */ Index: gdbcmd.h =================================================================== RCS file: /cvs/src/src/gdb/gdbcmd.h,v retrieving revision 1.5 diff -u -p -r1.5 gdbcmd.h --- gdbcmd.h 2001/03/06 08:21:07 1.5 +++ gdbcmd.h 2001/05/10 03:58:08 @@ -125,8 +125,4 @@ extern void print_command_lines (struct struct command_line *, unsigned int); #endif -extern char **noop_completer (char *, char *); - -extern char **filename_completer (char *, char *); - #endif /* !defined (GDBCMD_H) */ Index: infcmd.c =================================================================== RCS file: /cvs/src/src/gdb/infcmd.c,v retrieving revision 1.27 diff -u -p -r1.27 infcmd.c --- infcmd.c 2001/05/04 04:15:25 1.27 +++ infcmd.c 2001/05/10 03:58:08 @@ -41,6 +41,7 @@ #endif #include "event-top.h" #include "parser-defs.h" +#include "completer.h" /* Functions exported for general use: */ Index: proc-api.c =================================================================== RCS file: /cvs/src/src/gdb/proc-api.c,v retrieving revision 1.9 diff -u -p -r1.9 proc-api.c --- proc-api.c 2001/03/27 02:01:11 1.9 +++ proc-api.c 2001/05/10 03:58:09 @@ -27,6 +27,7 @@ Inc., 59 Temple Place - Suite 330, Bosto #include "defs.h" #include "gdbcmd.h" +#include "completer.h" #if defined (NEW_PROC_API) #define _STRUCTURED_PROC 1 Index: source.c =================================================================== RCS file: /cvs/src/src/gdb/source.c,v retrieving revision 1.13 diff -u -p -r1.13 source.c --- source.c 2001/04/19 23:56:13 1.13 +++ source.c 2001/05/10 03:58:09 @@ -40,6 +40,7 @@ #include "annotate.h" #include "gdbtypes.h" #include "linespec.h" +#include "completer.h" #ifdef UI_OUT #include "ui-out.h" #endif Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.31 diff -u -p -r1.31 symfile.c --- symfile.c 2001/04/05 02:02:13 1.31 +++ symfile.c 2001/05/10 03:58:10 @@ -37,6 +37,7 @@ #include "inferior.h" /* for write_pc */ #include "gdb-stabs.h" #include "obstack.h" +#include "completer.h" #include #include Index: top.c =================================================================== RCS file: /cvs/src/src/gdb/top.c,v retrieving revision 1.34 diff -u -p -r1.34 top.c --- top.c 2001/05/04 04:15:28 1.34 +++ top.c 2001/05/10 03:58:11 @@ -95,8 +95,6 @@ static void init_signals (void); static void stop_sig (int); #endif -static char *readline_line_completion_function (char *, int); - static void init_main (void); static void float_handler (int); @@ -1065,24 +1063,6 @@ static int write_history_p; static int history_size; static char *history_filename; -/* Functions that are used as part of the fancy command line editing. */ - -/* This can be used for functions which don't want to complete on symbols - but don't want to complete on anything else either. */ -/* ARGSUSED */ -char ** -noop_completer (char *text, char *prefix) -{ - return NULL; -} - -/* Line completion interface function for readline. */ - -static char * -readline_line_completion_function (char *text, int matches) -{ - return line_completion_function (text, matches, rl_line_buffer, rl_point); -} #ifdef STOP_SIGNAL static void Index: tracepoint.c =================================================================== RCS file: /cvs/src/src/gdb/tracepoint.c,v retrieving revision 1.20 diff -u -p -r1.20 tracepoint.c --- tracepoint.c 2001/04/17 20:16:30 1.20 +++ tracepoint.c 2001/05/10 03:58:11 @@ -33,6 +33,7 @@ #include "remote.h" #include "linespec.h" #include "regcache.h" +#include "completer.h" #include "ax.h" #include "ax-gdb.h"