From fc71ad23ddd09cfc590e487eb3be266a11837465 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 5 Feb 1996 20:50:26 +0000 Subject: [PATCH] * language.c (set_language_command): Use languages table when printing available languages. --- gdb/ChangeLog | 16 ++++++++++++---- gdb/language.c | 39 ++++++++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e85ae31f1c2..f37172e0c74 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,8 +1,16 @@ -Sat Feb 3 10:45:10 1996 Fred Fish +Mon Feb 5 09:51:55 1996 Tom Tromey - * exec.c (exec_file_command): Fix problem reported by Hans Verkuil - (hans@wyst.hobby.nl) where filename in malloc'd memory is referenced - after being freed. + * language.c (set_language_command): Use languages table when + printing available languages. + +Sat Feb 3 12:22:05 1996 Fred Fish + + Fix problems reported by Hans Verkuil (hans@wyst.hobby.nl): + * command.c (add_cmd): Add missing initialization for enums member. + Reorder members to match structure declaration to make it easier to + tell when one is missing. + * exec.c (exec_file_command): Fix problem where filename in malloc'd + memory is referenced after being freed. Sat Feb 3 03:26:21 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) diff --git a/gdb/language.c b/gdb/language.c index b9c04aeef9d..9f56066cbc2 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ whenever the working language changes. That would be a lot faster. */ #include "defs.h" +#include #include "gdb_string.h" #ifdef ANSI_PROTOTYPES #include @@ -163,19 +164,31 @@ set_language_command (ignore, from_tty) enum language flang; char *err_lang; - /* FIXME -- do this from the list, with HELP. */ - if (!language || !language[0]) { - printf_unfiltered("The currently understood settings are:\n\n"); - printf_unfiltered ("local or auto Automatic setting based on source file\n"); - printf_unfiltered ("c Use the C language\n"); - printf_unfiltered ("c++ Use the C++ language\n"); - printf_unfiltered ("chill Use the Chill language\n"); - printf_unfiltered ("fortran Use the Fortran language\n"); - printf_unfiltered ("modula-2 Use the Modula-2 language\n"); - /* Restore the silly string. */ - set_language(current_language->la_language); - return; - } + if (!language || !language[0]) + { + printf_unfiltered("The currently understood settings are:\n\n"); + printf_unfiltered ("local or auto Automatic setting based on source file\n"); + + for (i = 0; i < languages_size; ++i) + { + /* Already dealt with these above. */ + if (languages[i]->la_language == language_unknown + || languages[i]->la_language == language_auto) + continue; + + /* FIXME for now assume that the human-readable name is just + a capitalization of the internal name. */ + printf_unfiltered ("%-16s Use the %c%s language\n", + languages[i]->la_name, + /* Capitalize first letter of language + name. */ + toupper (languages[i]->la_name[0]), + languages[i]->la_name + 1); + } + /* Restore the silly string. */ + set_language(current_language->la_language); + return; + } /* Search the list of languages for a match. */ for (i = 0; i < languages_size; i++) { -- 2.30.2