+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.
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);
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);
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) */
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. */
/* 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;
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
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
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)
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. */
if (languages[i]->la_language == lang)
{
current_language = languages[i];
- set_type_range ();
+ set_type_range_case ();
set_lang_str ();
break;
}
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. */
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);
}
}
\f
&unknown_builtin_types[0],
range_check_off,
type_check_off,
+ case_sensitive_on,
unk_lang_parser,
unk_lang_error,
evaluate_subexp_standard,
&unknown_builtin_types[0],
range_check_off,
type_check_off,
+ case_sensitive_on,
unk_lang_parser,
unk_lang_error,
evaluate_subexp_standard,
&unknown_builtin_types[0],
range_check_off,
type_check_off,
+ case_sensitive_on,
unk_lang_parser,
unk_lang_error,
evaluate_subexp_standard,
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);
}