2000-08-10 Jimmy Guo <guo@cup.hp.com>

* c-lang.c: Set case sensitivity on for c_language_defn,
	cplus_language_defn, and asm_language_defn.
	* ch-lang.c: Set case sensitivity on for chill_language_defn.
	* f-lang.c: Set case sensivitity off for f_language_defn.
	* jv-lang.c: Set case sensitivity on for java_language_defn.
	* language.h: Add enum case_mode, case_sensitivity.
	* language.c: Define case_mode, case_sensitivity.  Set case
	sensitivity on for unknown_language_defn, auto_language_defn,
	and local_language_defn.
	(show_case_command,set_case_command,set_case_str): New static func.
	(set_type_range_case): New static func, replaces set_type_range ().
	(set_language_command,set_type_command,set_range_command,set_language):
	Call set_type_range_case ().
	(language_info): Print case sensitivity setting.
	(_initialize_language): Add set/show commands for 'case-sensitive'.
	Set default case mode 'auto'.  Set default language 'auto'.
	* m2-lang.c: Set case sensitivity on for m2_language_defn.
	* p-lang.c: Set case sensitivity on for pascal_language_defn.
	* scm-lang.c: Set case sensitivity off for scm_language_defn.
	* symtab.c (lookup_symbol): Downcase symbol name if case sensivitity
	is off.
This commit is contained in:
Jimmy Guo 2000-08-11 01:02:35 +00:00
parent 548a3e15c8
commit 63872f9d95
11 changed files with 176 additions and 14 deletions

View file

@ -1,3 +1,27 @@
2000-08-10 Jimmy Guo <guo@cup.hp.com>
* c-lang.c: Set case sensitivity on for c_language_defn,
cplus_language_defn, and asm_language_defn.
* ch-lang.c: Set case sensitivity on for chill_language_defn.
* f-lang.c: Set case sensivitity off for f_language_defn.
* jv-lang.c: Set case sensitivity on for java_language_defn.
* language.h: Add enum case_mode, case_sensitivity.
* language.c: Define case_mode, case_sensitivity. Set case
sensitivity on for unknown_language_defn, auto_language_defn,
and local_language_defn.
(show_case_command,set_case_command,set_case_str): New static func.
(set_type_range_case): New static func, replaces set_type_range ().
(set_language_command,set_type_command,set_range_command,set_language):
Call set_type_range_case ().
(language_info): Print case sensitivity setting.
(_initialize_language): Add set/show commands for 'case-sensitive'.
Set default case mode 'auto'. Set default language 'auto'.
* m2-lang.c: Set case sensitivity on for m2_language_defn.
* p-lang.c: Set case sensitivity on for pascal_language_defn.
* scm-lang.c: Set case sensitivity off for scm_language_defn.
* symtab.c (lookup_symbol): Downcase symbol name if case sensivitity
is off.
2000-08-10 Jimmy Guo <guo@cup.hp.com>
* MAINTAINERS: Change my contact email for hp tests maintainership.

View file

@ -409,6 +409,7 @@ const struct language_defn c_language_defn =
c_builtin_types,
range_check_off,
type_check_off,
case_sensitive_on,
c_parse,
c_error,
evaluate_subexp_standard,
@ -460,6 +461,7 @@ const struct language_defn cplus_language_defn =
cplus_builtin_types,
range_check_off,
type_check_off,
case_sensitive_on,
c_parse,
c_error,
evaluate_subexp_standard,
@ -488,6 +490,7 @@ const struct language_defn asm_language_defn =
c_builtin_types,
range_check_off,
type_check_off,
case_sensitive_on,
c_parse,
c_error,
evaluate_subexp_standard,

View file

@ -608,6 +608,7 @@ const struct language_defn chill_language_defn =
chill_builtin_types,
range_check_on,
type_check_on,
case_sensitive_on,
chill_parse, /* parser */
chill_error, /* parser error function */
evaluate_subexp_chill,

View file

@ -460,6 +460,7 @@ const struct language_defn f_language_defn =
f_builtin_types,
range_check_on,
type_check_on,
case_sensitive_off,
f_parse, /* parser */
f_error, /* parser error function */
evaluate_subexp_standard,

View file

@ -1033,6 +1033,7 @@ const struct language_defn java_language_defn =
c_builtin_types,
range_check_off,
type_check_off,
case_sensitive_on,
java_parse,
java_error,
evaluate_subexp_java,

View file

@ -57,6 +57,12 @@ static void show_range_command (char *, int);
static void set_range_command (char *, int);
static void show_case_command (char *, int);
static void set_case_command (char *, int);
static void set_case_str (void);
static void set_range_str (void);
static void set_type_str (void);
@ -71,7 +77,7 @@ static void show_check (char *, int);
static void set_check (char *, int);
static void set_type_range (void);
static void set_type_range_case (void);
static void unk_lang_emit_char (int c, struct ui_file *stream, int quoter);
@ -105,6 +111,8 @@ enum range_mode range_mode = range_mode_auto;
enum range_check range_check = range_check_off;
enum type_mode type_mode = type_mode_auto;
enum type_check type_check = type_check_off;
enum case_mode case_mode = case_mode_auto;
enum case_sensitivity case_sensitivity = case_sensitive_on;
/* The current language and language_mode (see language.h) */
@ -132,6 +140,7 @@ static unsigned languages_allocsize;
static char *language;
static char *type;
static char *range;
static char *case_sensitive;
/* Warning issued when current_language and the language of the current
frame do not match. */
@ -211,7 +220,7 @@ set_language_command (char *ignore, int from_tty)
/* Enter manual mode. Set the specified language. */
language_mode = language_mode_manual;
current_language = languages[i];
set_type_range ();
set_type_range_case ();
set_lang_str ();
expected_language = current_language;
return;
@ -259,9 +268,9 @@ set_type_command (char *ignore, int from_tty)
else if (STREQ (type, "auto"))
{
type_mode = type_mode_auto;
set_type_range ();
set_type_range_case ();
/* Avoid hitting the set_type_str call below. We
did it in set_type_range. */
did it in set_type_range_case. */
return;
}
else
@ -305,9 +314,9 @@ set_range_command (char *ignore, int from_tty)
else if (STREQ (range, "auto"))
{
range_mode = range_mode_auto;
set_type_range ();
set_type_range_case ();
/* Avoid hitting the set_range_str call below. We
did it in set_type_range. */
did it in set_type_range_case. */
return;
}
else
@ -318,12 +327,56 @@ set_range_command (char *ignore, int from_tty)
show_range_command ((char *) 0, from_tty);
}
/* Set the status of range and type checking based on
/* Show command. Display a warning if the case sensitivity setting does
not match the current language. */
static void
show_case_command(ignore, from_tty)
char *ignore;
int from_tty;
{
if (case_sensitivity != current_language->la_case_sensitivity)
printf_unfiltered(
"Warning: the current case sensitivity setting does not match the language.\n");
}
/* Set command. Change the setting for case sensitivity. */
static void
set_case_command(ignore, from_tty)
char *ignore;
int from_tty;
{
if (STREQ (case_sensitive, "on"))
{
case_sensitivity = case_sensitive_on;
case_mode = case_mode_manual;
}
else if (STREQ (case_sensitive, "off"))
{
case_sensitivity = case_sensitive_off;
case_mode = case_mode_manual;
}
else if (STREQ (case_sensitive, "auto"))
{
case_mode = case_mode_auto;
set_type_range_case ();
/* Avoid hitting the set_case_str call below. We
did it in set_type_range_case. */
return;
}
else
{
warning ("Unrecognized case-sensitive setting: \"%s\"", case_sensitive);
}
set_case_str();
show_case_command ((char *) NULL, from_tty);
}
/* Set the status of range and type checking and case sensitivity based on
the current modes and the current language.
If SHOW is non-zero, then print out the current language,
type and range checking status. */
static void
set_type_range (void)
set_type_range_case (void)
{
if (range_mode == range_mode_auto)
@ -332,8 +385,12 @@ set_type_range (void)
if (type_mode == type_mode_auto)
type_check = current_language->la_type_check;
if (case_mode == case_mode_auto)
case_sensitivity = current_language->la_case_sensitivity;
set_type_str ();
set_range_str ();
set_case_str ();
}
/* Set current language to (enum language) LANG. Returns previous language. */
@ -351,7 +408,7 @@ set_language (enum language lang)
if (languages[i]->la_language == lang)
{
current_language = languages[i];
set_type_range ();
set_type_range_case ();
set_lang_str ();
break;
}
@ -431,6 +488,29 @@ set_range_str (void)
range = concat (pref, tmp, NULL);
}
static void
set_case_str()
{
char *tmp = NULL, *prefix = "";
if (case_mode==case_mode_auto)
prefix = "auto; currently ";
switch (case_sensitivity)
{
case case_sensitive_on:
tmp = "on";
break;
case case_sensitive_off:
tmp = "off";
break;
default:
error ("Unrecognized case-sensitive setting.");
}
free (case_sensitive);
case_sensitive = concat (prefix, tmp, NULL);
}
/* Print out the current language settings: language, range and
type checking. If QUIETLY, print only what has changed. */
@ -451,6 +531,8 @@ language_info (int quietly)
show_type_command ((char *) 0, 1);
printf_unfiltered ("Range checking: %s\n", range);
show_range_command ((char *) 0, 1);
printf_unfiltered ("Case sensitivity: %s\n", case_sensitive);
show_case_command ((char *) 0, 1);
}
}
@ -1400,6 +1482,7 @@ const struct language_defn unknown_language_defn =
&unknown_builtin_types[0],
range_check_off,
type_check_off,
case_sensitive_on,
unk_lang_parser,
unk_lang_error,
evaluate_subexp_standard,
@ -1429,6 +1512,7 @@ const struct language_defn auto_language_defn =
&unknown_builtin_types[0],
range_check_off,
type_check_off,
case_sensitive_on,
unk_lang_parser,
unk_lang_error,
evaluate_subexp_standard,
@ -1457,6 +1541,7 @@ const struct language_defn local_language_defn =
&unknown_builtin_types[0],
range_check_off,
type_check_off,
case_sensitive_on,
unk_lang_parser,
unk_lang_error,
evaluate_subexp_standard,
@ -1523,16 +1608,24 @@ _initialize_language (void)
set->function.cfunc = set_range_command;
show->function.cfunc = show_range_command;
set = add_set_cmd ("case-sensitive", class_support, var_string_noescape,
(char *) &case_sensitive,
"Set case sensitivity in name search. (on/off/auto)\n\
For Fortran the default is off; for other languages the default is on.",
&setlist);
show = add_show_from_set (set, &showlist);
set->function.cfunc = set_case_command;
show->function.cfunc = show_case_command;
add_language (&unknown_language_defn);
add_language (&local_language_defn);
add_language (&auto_language_defn);
language = savestring ("auto", strlen ("auto"));
set_language_command (language, 0);
type = savestring ("auto", strlen ("auto"));
set_type_command (NULL, 0);
range = savestring ("auto", strlen ("auto"));
set_range_command (NULL, 0);
case_sensitive = savestring ("auto",strlen ("auto"));
/* Have the above take effect */
set_language (language_auto);
}

View file

@ -81,6 +81,26 @@ extern enum type_check
type_check_off, type_check_warn, type_check_on
}
type_check;
/* case_mode ==
case_mode_auto: case_sensitivity set upon selection of scope
case_mode_manual: case_sensitivity set only by user. */
extern enum case_mode
{
case_mode_auto, case_mode_manual
}
case_mode;
/* case_sensitivity ==
case_sensitive_on: Case sensitivity in name matching is used
case_sensitive_off: Case sensitivity in name matching is not used */
extern enum case_sensitivity
{
case_sensitive_on, case_sensitive_off
}
case_sensitivity;
/* Information for doing language dependent formatting of printed values. */
@ -140,6 +160,9 @@ struct language_defn
enum type_check la_type_check;
/* Default case sensitivity */
enum case_sensitivity la_case_sensitivity;
/* Parser function. */
int (*la_parser) (void);

View file

@ -414,6 +414,7 @@ const struct language_defn m2_language_defn =
m2_builtin_types,
range_check_on,
type_check_on,
case_sensitive_on,
m2_parse, /* parser */
m2_error, /* parser error function */
evaluate_subexp_standard,

View file

@ -388,6 +388,7 @@ const struct language_defn pascal_language_defn =
pascal_builtin_types,
range_check_on,
type_check_on,
case_sensitive_on,
pascal_parse,
pascal_error,
evaluate_subexp_standard,

View file

@ -233,6 +233,7 @@ const struct language_defn scm_language_defn =
c_builtin_types,
range_check_off,
type_check_off,
case_sensitive_off,
scm_parse,
c_error,
evaluate_subexp_scm,

View file

@ -584,6 +584,19 @@ lookup_symbol (const char *name, register const struct block *block,
register struct block *b;
register struct minimal_symbol *msymbol;
if (case_sensitivity == case_sensitive_off)
{
char *copy;
int len, i;
len = strlen (name);
copy = (char *) alloca (len + 1);
for (i= 0; i < len; i++)
copy[i] = tolower (name[i]);
copy[len] = 0;
name = copy;
}
/* Search specified block and its superiors. */
while (block != 0)