1 /* Multiple source language support for GDB.
2 Copyright 1991, 1992 Free Software Foundation, Inc.
3 Contributed by the Department of Computer Science at the State University
4 of New York at Buffalo.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
22 /* This file contains functions that return things that are specific
23 to languages. Each function should examine current_language if necessary,
24 and return the appropriate result. */
26 /* FIXME: Most of these would be better organized as macros which
27 return data out of a "language-specific" struct pointer that is set
28 whenever the working language changes. That would be a lot faster. */
39 #include "expression.h"
42 #include "parser-defs.h"
45 show_language_command
PARAMS ((char *, int));
48 set_language_command
PARAMS ((char *, int));
51 show_type_command
PARAMS ((char *, int));
54 set_type_command
PARAMS ((char *, int));
57 show_range_command
PARAMS ((char *, int));
60 set_range_command
PARAMS ((char *, int));
63 set_range_str
PARAMS ((void));
66 set_type_str
PARAMS ((void));
69 set_lang_str
PARAMS ((void));
72 unk_lang_error
PARAMS ((char *));
75 unk_lang_parser
PARAMS ((void));
78 show_check
PARAMS ((char *, int));
81 set_check
PARAMS ((char *, int));
84 set_type_range
PARAMS ((void));
86 /* Forward declaration */
87 extern const struct language_defn unknown_language_defn
;
89 /* The current (default at startup) state of type and range checking.
90 (If the modes are set to "auto", though, these are changed based
91 on the default language at startup, and then again based on the
92 language of the first source file. */
94 enum range_mode range_mode
= range_mode_auto
;
95 enum range_check range_check
= range_check_off
;
96 enum type_mode type_mode
= type_mode_auto
;
97 enum type_check type_check
= type_check_off
;
99 /* The current language and language_mode (see language.h) */
101 const struct language_defn
*current_language
= &unknown_language_defn
;
102 enum language_mode language_mode
= language_mode_auto
;
104 /* The list of supported languages. The list itself is malloc'd. */
106 static const struct language_defn
**languages
;
107 static unsigned languages_size
;
108 static unsigned languages_allocsize
;
109 #define DEFAULT_ALLOCSIZE 3
111 /* The "set language/type/range" commands all put stuff in these
112 buffers. This is to make them work as set/show commands. The
113 user's string is copied here, then the set_* commands look at
114 them and update them to something that looks nice when it is
117 static char *language
;
121 /* Warning issued when current_language and the language of the current
122 frame do not match. */
123 char lang_frame_mismatch_warn
[] =
124 "Warning: the current language does not match this frame.";
127 /* This page contains the functions corresponding to GDB commands
128 and their helpers. */
130 /* Show command. Display a warning if the language set
131 does not match the frame. */
133 show_language_command (ignore
, from_tty
)
137 enum language flang
; /* The language of the current frame */
139 flang
= get_frame_language();
140 if (flang
!= language_unknown
&&
141 language_mode
== language_mode_manual
&&
142 current_language
->la_language
!= flang
)
143 printf_filtered("%s\n",lang_frame_mismatch_warn
);
146 /* Set command. Change the current working language. */
148 set_language_command (ignore
, from_tty
)
156 /* FIXME -- do this from the list, with HELP. */
157 if (!language
|| !language
[0]) {
158 printf("The currently understood settings are:\n\n\
159 local or auto Automatic setting based on source file\n\
160 c Use the C language\n\
161 c++ Use the C++ language\n\
162 modula-2 Use the Modula-2 language\n");
163 /* Restore the silly string. */
164 set_language(current_language
->la_language
);
168 /* Search the list of languages for a match. */
169 for (i
= 0; i
< languages_size
; i
++) {
170 if (!strcmp (languages
[i
]->la_name
, language
)) {
171 /* Found it! Go into manual mode, and use this language. */
172 if (languages
[i
]->la_language
== language_auto
) {
173 /* Enter auto mode. Set to the current frame's language, if known. */
174 language_mode
= language_mode_auto
;
175 flang
= get_frame_language();
176 if (flang
!=language_unknown
)
180 /* Enter manual mode. Set the specified language. */
181 language_mode
= language_mode_manual
;
182 current_language
= languages
[i
];
190 /* Reset the language (esp. the global string "language") to the
192 err_lang
=savestring(language
,strlen(language
));
193 make_cleanup (free
, err_lang
); /* Free it after error */
194 set_language(current_language
->la_language
);
195 error ("Unknown language `%s'.",err_lang
);
198 /* Show command. Display a warning if the type setting does
199 not match the current language. */
201 show_type_command(ignore
, from_tty
)
205 if (type_check
!= current_language
->la_type_check
)
207 "Warning: the current type check setting does not match the language.\n");
210 /* Set command. Change the setting for type checking. */
212 set_type_command(ignore
, from_tty
)
216 if (!strcmp(type
,"on"))
218 type_check
= type_check_on
;
219 type_mode
= type_mode_manual
;
221 else if (!strcmp(type
,"warn"))
223 type_check
= type_check_warn
;
224 type_mode
= type_mode_manual
;
226 else if (!strcmp(type
,"off"))
228 type_check
= type_check_off
;
229 type_mode
= type_mode_manual
;
231 else if (!strcmp(type
,"auto"))
233 type_mode
= type_mode_auto
;
235 /* Avoid hitting the set_type_str call below. We
236 did it in set_type_range. */
240 show_type_command((char *)NULL
, from_tty
);
243 /* Show command. Display a warning if the range setting does
244 not match the current language. */
246 show_range_command(ignore
, from_tty
)
251 if (range_check
!= current_language
->la_range_check
)
253 "Warning: the current range check setting does not match the language.\n");
256 /* Set command. Change the setting for range checking. */
258 set_range_command(ignore
, from_tty
)
262 if (!strcmp(range
,"on"))
264 range_check
= range_check_on
;
265 range_mode
= range_mode_manual
;
267 else if (!strcmp(range
,"warn"))
269 range_check
= range_check_warn
;
270 range_mode
= range_mode_manual
;
272 else if (!strcmp(range
,"off"))
274 range_check
= range_check_off
;
275 range_mode
= range_mode_manual
;
277 else if (!strcmp(range
,"auto"))
279 range_mode
= range_mode_auto
;
281 /* Avoid hitting the set_range_str call below. We
282 did it in set_type_range. */
286 show_range_command((char *)0, from_tty
);
289 /* Set the status of range and type checking based on
290 the current modes and the current language.
291 If SHOW is non-zero, then print out the current language,
292 type and range checking status. */
297 if (range_mode
== range_mode_auto
)
298 range_check
= current_language
->la_range_check
;
300 if (type_mode
== type_mode_auto
)
301 type_check
= current_language
->la_type_check
;
307 /* Set current language to (enum language) LANG. */
315 for (i
= 0; i
< languages_size
; i
++) {
316 if (languages
[i
]->la_language
== lang
) {
317 current_language
= languages
[i
];
325 /* This page contains functions that update the global vars
326 language, type and range. */
333 if (language_mode
== language_mode_auto
)
334 prefix
= "auto; currently ";
336 language
= concat(prefix
, current_language
->la_name
, NULL
);
342 char *tmp
, *prefix
= "";
345 if (type_mode
==type_mode_auto
)
346 prefix
= "auto; currently ";
356 case type_check_warn
:
360 error ("Unrecognized type check setting.");
363 type
= concat(prefix
,tmp
,NULL
);
369 char *tmp
, *pref
= "";
372 if (range_mode
==range_mode_auto
)
373 pref
= "auto; currently ";
380 case range_check_off
:
383 case range_check_warn
:
387 error ("Unrecognized range check setting.");
390 range
= concat(pref
,tmp
,NULL
);
394 /* Print out the current language settings: language, range and
395 type checking. If QUIETLY, print only what has changed. */
397 language_info (quietly
)
400 /* FIXME: quietly is ignored at the moment. */
401 printf("Current Language: %s\n",language
);
402 show_language_command((char *)0, 1);
403 printf("Type checking: %s\n",type
);
404 show_type_command((char *)0, 1);
405 printf("Range checking: %s\n",range
);
406 show_range_command((char *)0, 1);
409 /* Return the result of a binary operation. */
411 #if 0 /* Currently unused */
414 binop_result_type(v1
,v2
)
419 l1
= TYPE_LENGTH(VALUE_TYPE(v1
));
420 l2
= TYPE_LENGTH(VALUE_TYPE(v2
));
422 switch(current_language
->la_language
)
426 if (TYPE_CODE(VALUE_TYPE(v1
))==TYPE_CODE_FLT
)
427 return TYPE_CODE(VALUE_TYPE(v2
)) == TYPE_CODE_FLT
&& l2
> l1
?
428 VALUE_TYPE(v2
) : VALUE_TYPE(v1
);
429 else if (TYPE_CODE(VALUE_TYPE(v2
))==TYPE_CODE_FLT
)
430 return TYPE_CODE(VALUE_TYPE(v1
)) == TYPE_CODE_FLT
&& l1
> l2
?
431 VALUE_TYPE(v1
) : VALUE_TYPE(v2
);
432 else if (TYPE_UNSIGNED(VALUE_TYPE(v1
)) && l1
> l2
)
433 return VALUE_TYPE(v1
);
434 else if (TYPE_UNSIGNED(VALUE_TYPE(v2
)) && l2
> l1
)
435 return VALUE_TYPE(v2
);
436 else /* Both are signed. Result is the longer type */
437 return l1
> l2
? VALUE_TYPE(v1
) : VALUE_TYPE(v2
);
440 /* If we are doing type-checking, l1 should equal l2, so this is
442 return l1
> l2
? VALUE_TYPE(v1
) : VALUE_TYPE(v2
);
446 return (struct type
*)0; /* For lint */
452 /* This page contains functions that return format strings for
453 printf for printing out numbers in different formats */
455 /* Returns the appropriate printf format for hexadecimal
458 local_hex_format_custom(pre
)
461 static char form
[50];
463 strcpy (form
, current_language
->la_hex_format_pre
);
465 strcat (form
, current_language
->la_hex_format_suf
);
469 /* Converts a number to hexadecimal and stores it in a static
470 string. Returns a pointer to this string. */
472 local_hex_string (num
)
477 sprintf (res
, current_language
->la_hex_format
, num
);
481 /* Converts a number to custom hexadecimal and stores it in a static
482 string. Returns a pointer to this string. */
484 local_hex_string_custom(num
,pre
)
490 sprintf (res
, local_hex_format_custom(pre
), num
);
494 /* Returns the appropriate printf format for octal
497 local_octal_format_custom(pre
)
500 static char form
[50];
502 strcpy (form
, current_language
->la_octal_format_pre
);
504 strcat (form
, current_language
->la_octal_format_suf
);
508 /* This page contains functions that are used in type/range checking.
509 They all return zero if the type/range check fails.
511 It is hoped that these will make extending GDB to parse different
512 languages a little easier. These are primarily used in eval.c when
513 evaluating expressions and making sure that their types are correct.
514 Instead of having a mess of conjucted/disjuncted expressions in an "if",
515 the ideas of type can be wrapped up in the following functions.
517 Note that some of them are not currently dependent upon which language
518 is currently being parsed. For example, floats are the same in
519 C and Modula-2 (ie. the only floating point type has TYPE_CODE of
520 TYPE_CODE_FLT), while booleans are different. */
522 /* Returns non-zero if its argument is a simple type. This is the same for
523 both Modula-2 and for C. In the C case, TYPE_CODE_CHAR will never occur,
524 and thus will never cause the failure of the test. */
529 switch (TYPE_CODE (type
)) {
534 case TYPE_CODE_RANGE
:
543 /* Returns non-zero if its argument is of an ordered type. */
548 switch (TYPE_CODE (type
)) {
553 case TYPE_CODE_RANGE
:
561 /* Returns non-zero if the two types are the same */
563 same_type (arg1
, arg2
)
564 struct type
*arg1
, *arg2
;
566 if (structured_type(arg1
) ? !structured_type(arg2
) : structured_type(arg2
))
567 /* One is structured and one isn't */
569 else if (structured_type(arg1
) && structured_type(arg2
))
571 else if (numeric_type(arg1
) && numeric_type(arg2
))
572 return (TYPE_CODE(arg2
) == TYPE_CODE(arg1
)) &&
573 (TYPE_UNSIGNED(arg1
) == TYPE_UNSIGNED(arg2
))
579 /* Returns non-zero if the type is integral */
584 switch(current_language
->la_language
)
588 return (TYPE_CODE(type
) != TYPE_CODE_INT
) &&
589 (TYPE_CODE(type
) != TYPE_CODE_ENUM
) ? 0 : 1;
591 return TYPE_CODE(type
) != TYPE_CODE_INT
? 0 : 1;
593 error ("Language not supported.");
597 /* Returns non-zero if the value is numeric */
602 switch (TYPE_CODE (type
)) {
612 /* Returns non-zero if the value is a character type */
614 character_type (type
)
617 switch(current_language
->la_language
)
620 return TYPE_CODE(type
) != TYPE_CODE_CHAR
? 0 : 1;
624 return (TYPE_CODE(type
) == TYPE_CODE_INT
) &&
625 TYPE_LENGTH(type
) == sizeof(char)
631 /* Returns non-zero if the value is a boolean type */
636 switch(current_language
->la_language
)
639 return TYPE_CODE(type
) != TYPE_CODE_BOOL
? 0 : 1;
643 return TYPE_CODE(type
) != TYPE_CODE_INT
? 0 : 1;
648 /* Returns non-zero if the value is a floating-point type */
653 return TYPE_CODE(type
) == TYPE_CODE_FLT
;
656 /* Returns non-zero if the value is a pointer type */
661 return TYPE_CODE(type
) == TYPE_CODE_PTR
||
662 TYPE_CODE(type
) == TYPE_CODE_REF
;
665 /* Returns non-zero if the value is a structured type */
667 structured_type(type
)
670 switch(current_language
->la_language
)
674 return (TYPE_CODE(type
) == TYPE_CODE_STRUCT
) ||
675 (TYPE_CODE(type
) == TYPE_CODE_UNION
) ||
676 (TYPE_CODE(type
) == TYPE_CODE_ARRAY
);
678 return (TYPE_CODE(type
) == TYPE_CODE_STRUCT
) ||
679 (TYPE_CODE(type
) == TYPE_CODE_SET
) ||
680 (TYPE_CODE(type
) == TYPE_CODE_ARRAY
);
685 /* This page contains functions that return info about
686 (struct value) values used in GDB. */
688 /* Returns non-zero if the value VAL represents a true value. */
697 switch (current_language
->la_language
) {
701 return !value_zerop (val
);
704 type
= VALUE_TYPE(val
);
705 if (TYPE_CODE (type
) != TYPE_CODE_BOOL
)
706 return 0; /* Not a BOOLEAN at all */
707 /* Search the fields for one that matches the current value. */
708 len
= TYPE_NFIELDS (type
);
709 v
= value_as_long (val
);
710 for (i
= 0; i
< len
; i
++)
713 if (v
== TYPE_FIELD_BITPOS (type
, i
))
717 return 0; /* Not a valid BOOLEAN value */
718 if (!strcmp ("TRUE", TYPE_FIELD_NAME(VALUE_TYPE(val
), i
)))
719 return 1; /* BOOLEAN with value TRUE */
721 return 0; /* BOOLEAN with value FALSE */
725 error ("Language not supported.");
729 /* Returns non-zero if the operator OP is defined on
730 the values ARG1 and ARG2. */
732 #if 0 /* Currently unused */
735 binop_type_check(arg1
,arg2
,op
)
739 struct type
*t1
, *t2
;
741 /* If we're not checking types, always return success. */
746 if (arg2
!=(value
)NULL
)
755 if ((numeric_type(t1
) && pointer_type(t2
)) ||
756 (pointer_type(t1
) && numeric_type(t2
)))
758 printf("warning: combining pointer and integer.\n");
764 if (!numeric_type(t1
) || !numeric_type(t2
))
765 type_op_error ("Arguments to %s must be numbers.",op
);
766 else if (!same_type(t1
,t2
))
767 type_op_error ("Arguments to %s must be of the same type.",op
);
772 if (!boolean_type(t1
) || !boolean_type(t2
))
773 type_op_error ("Arguments to %s must be of boolean type.",op
);
777 if ((pointer_type(t1
) && !(pointer_type(t2
) || integral_type(t2
))) ||
778 (pointer_type(t2
) && !(pointer_type(t1
) || integral_type(t1
))))
779 type_op_error ("A pointer can only be compared to an integer or pointer.",op
);
780 else if ((pointer_type(t1
) && integral_type(t2
)) ||
781 (integral_type(t1
) && pointer_type(t2
)))
783 printf("warning: combining integer and pointer.\n");
786 else if (!simple_type(t1
) || !simple_type(t2
))
787 type_op_error ("Arguments to %s must be of simple type.",op
);
788 else if (!same_type(t1
,t2
))
789 type_op_error ("Arguments to %s must be of the same type.",op
);
793 if (!integral_type(t1
) || !integral_type(t2
))
794 type_op_error ("Arguments to %s must be of integral type.",op
);
801 if (!ordered_type(t1
) || !ordered_type(t2
))
802 type_op_error ("Arguments to %s must be of ordered type.",op
);
803 else if (!same_type(t1
,t2
))
804 type_op_error ("Arguments to %s must be of the same type.",op
);
808 if (pointer_type(t1
) && !integral_type(t2
))
809 type_op_error ("A pointer can only be assigned an integer.",op
);
810 else if (pointer_type(t1
) && integral_type(t2
))
812 printf("warning: combining integer and pointer.");
815 else if (!simple_type(t1
) || !simple_type(t2
))
816 type_op_error ("Arguments to %s must be of simple type.",op
);
817 else if (!same_type(t1
,t2
))
818 type_op_error ("Arguments to %s must be of the same type.",op
);
821 /* Unary checks -- arg2 is null */
824 if (!boolean_type(t1
))
825 type_op_error ("Argument to %s must be of boolean type.",op
);
830 if (!numeric_type(t1
))
831 type_op_error ("Argument to %s must be of numeric type.",op
);
835 if (integral_type(t1
))
837 printf("warning: combining pointer and integer.\n");
840 else if (!pointer_type(t1
))
841 type_op_error ("Argument to %s must be a pointer.",op
);
844 case UNOP_PREINCREMENT
:
845 case UNOP_POSTINCREMENT
:
846 case UNOP_PREDECREMENT
:
847 case UNOP_POSTDECREMENT
:
848 if (!ordered_type(t1
))
849 type_op_error ("Argument to %s must be of an ordered type.",op
);
853 /* Ok. The following operators have different meanings in
854 different languages. */
855 switch(current_language
->la_language
)
863 if (!numeric_type(t1
) || !numeric_type(t2
))
864 type_op_error ("Arguments to %s must be numbers.",op
);
875 if (!float_type(t1
) || !float_type(t2
))
876 type_op_error ("Arguments to %s must be floating point numbers.",op
);
879 if (!integral_type(t1
) || !integral_type(t2
))
880 type_op_error ("Arguments to %s must be of integral type.",op
);
891 /* This page contains functions for the printing out of
892 error messages that occur during type- and range-
895 /* Prints the format string FMT with the operator as a string
896 corresponding to the opcode OP. If FATAL is non-zero, then
897 this is an error and error () is called. Otherwise, it is
898 a warning and printf() is called. */
900 op_error (fmt
,op
,fatal
)
906 error (fmt
,op_string(op
));
910 printf(fmt
,op_string(op
));
915 /* These are called when a language fails a type- or range-check.
916 The first argument should be a printf()-style format string, and
917 the rest of the arguments should be its arguments. If
918 [type|range]_check is [type|range]_check_on, then return_to_top_level()
919 is called in the style of error (). Otherwise, the message is prefixed
920 by "warning: " and we do not return to the top level. */
923 type_error (va_alist
)
929 if (type_check
==type_check_warn
)
930 fprintf(stderr
,"warning: ");
932 target_terminal_ours();
935 string
= va_arg (args
, char *);
936 vfprintf (stderr
, string
, args
);
937 fprintf (stderr
, "\n");
939 if (type_check
==type_check_on
)
940 return_to_top_level();
944 range_error (va_alist
)
950 if (range_check
==range_check_warn
)
951 fprintf(stderr
,"warning: ");
953 target_terminal_ours();
956 string
= va_arg (args
, char *);
957 vfprintf (stderr
, string
, args
);
958 fprintf (stderr
, "\n");
960 if (range_check
==range_check_on
)
961 return_to_top_level();
965 /* This page contains miscellaneous functions */
967 /* Return the language as a string */
974 for (i
= 0; i
< languages_size
; i
++) {
975 if (languages
[i
]->la_language
== lang
) {
976 return languages
[i
]->la_name
;
982 struct cmd_list_element
*setchecklist
= NULL
;
983 struct cmd_list_element
*showchecklist
= NULL
;
986 set_check (ignore
, from_tty
)
991 "\"set check\" must be followed by the name of a check subcommand.\n");
992 help_list(setchecklist
, "set check ", -1, stdout
);
996 show_check (arg
, from_tty
)
1000 cmd_show_list(showchecklist
, from_tty
, "");
1003 /* Add a language to the set of known languages. */
1007 const struct language_defn
*lang
;
1009 if (lang
->la_magic
!= LANG_MAGIC
)
1011 fprintf(stderr
, "Magic number of %s language struct wrong\n",
1018 languages_allocsize
= DEFAULT_ALLOCSIZE
;
1019 languages
= (const struct language_defn
**) xmalloc
1020 (languages_allocsize
* sizeof (*languages
));
1022 if (languages_size
>= languages_allocsize
)
1024 languages_allocsize
*= 2;
1025 languages
= (const struct language_defn
**) xrealloc ((char *) languages
,
1026 languages_allocsize
* sizeof (*languages
));
1028 languages
[languages_size
++] = lang
;
1031 /* Define the language that is no language. */
1040 unk_lang_error (msg
)
1043 error ("Attempted to parse an expression with unknown language");
1046 static struct type
** const (unknown_builtin_types
[]) = { 0 };
1047 static const struct op_print unk_op_print_tab
[] = { 0 };
1049 const struct language_defn unknown_language_defn
= {
1052 &unknown_builtin_types
[0],
1057 &builtin_type_error
, /* longest signed integral type */
1058 &builtin_type_error
, /* longest unsigned integral type */
1059 &builtin_type_error
, /* longest floating point type */
1060 "0x%x", "0x%", "x", /* Hex format, prefix, suffix */
1061 "0%o", "0%", "o", /* Octal format, prefix, suffix */
1062 unk_op_print_tab
, /* expression operators for printing */
1066 /* These two structs define fake entries for the "local" and "auto" options. */
1067 const struct language_defn auto_language_defn
= {
1070 &unknown_builtin_types
[0],
1075 &builtin_type_error
, /* longest signed integral type */
1076 &builtin_type_error
, /* longest unsigned integral type */
1077 &builtin_type_error
, /* longest floating point type */
1078 "0x%x", "0x%", "x", /* Hex format, prefix, suffix */
1079 "0%o", "0%", "o", /* Octal format, prefix, suffix */
1080 unk_op_print_tab
, /* expression operators for printing */
1084 const struct language_defn local_language_defn
= {
1087 &unknown_builtin_types
[0],
1092 &builtin_type_error
, /* longest signed integral type */
1093 &builtin_type_error
, /* longest unsigned integral type */
1094 &builtin_type_error
, /* longest floating point type */
1095 "0x%x", "0x%", "x", /* Hex format, prefix, suffix */
1096 "0%o", "0%", "o", /* Octal format, prefix, suffix */
1097 unk_op_print_tab
, /* expression operators for printing */
1101 /* Initialize the language routines */
1104 _initialize_language()
1106 struct cmd_list_element
*set
, *show
;
1108 /* GDB commands for language specific stuff */
1110 set
= add_set_cmd ("language", class_support
, var_string_noescape
,
1112 "Set the current source language.",
1114 show
= add_show_from_set (set
, &showlist
);
1115 set
->function
.cfunc
= set_language_command
;
1116 show
->function
.cfunc
= show_language_command
;
1118 add_prefix_cmd ("check", no_class
, set_check
,
1119 "Set the status of the type/range checker",
1120 &setchecklist
, "set check ", 0, &setlist
);
1121 add_alias_cmd ("c", "check", no_class
, 1, &setlist
);
1122 add_alias_cmd ("ch", "check", no_class
, 1, &setlist
);
1124 add_prefix_cmd ("check", no_class
, show_check
,
1125 "Show the status of the type/range checker",
1126 &showchecklist
, "show check ", 0, &showlist
);
1127 add_alias_cmd ("c", "check", no_class
, 1, &showlist
);
1128 add_alias_cmd ("ch", "check", no_class
, 1, &showlist
);
1130 set
= add_set_cmd ("type", class_support
, var_string_noescape
,
1132 "Set type checking. (on/warn/off/auto)",
1134 show
= add_show_from_set (set
, &showchecklist
);
1135 set
->function
.cfunc
= set_type_command
;
1136 show
->function
.cfunc
= show_type_command
;
1138 set
= add_set_cmd ("range", class_support
, var_string_noescape
,
1140 "Set range checking. (on/warn/off/auto)",
1142 show
= add_show_from_set (set
, &showchecklist
);
1143 set
->function
.cfunc
= set_range_command
;
1144 show
->function
.cfunc
= show_range_command
;
1146 add_language (&unknown_language_defn
);
1147 add_language (&local_language_defn
);
1148 add_language (&auto_language_defn
);
1150 language
= savestring ("auto",strlen("auto"));
1151 range
= savestring ("auto",strlen("auto"));
1152 type
= savestring ("auto",strlen("auto"));
1154 /* Have the above take effect */
1156 set_language_command (language
, 0);
1157 set_type_command (NULL
, 0);
1158 set_range_command (NULL
, 0);