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. */
40 #include "expression.h"
43 #include "parser-defs.h"
46 show_language_command PARAMS ((char *, int));
49 set_language_command PARAMS ((char *, int));
52 show_type_command PARAMS ((char *, int));
55 set_type_command PARAMS ((char *, int));
58 show_range_command PARAMS ((char *, int));
61 set_range_command PARAMS ((char *, int));
64 set_range_str PARAMS ((void));
67 set_type_str PARAMS ((void));
70 set_lang_str PARAMS ((void));
73 unk_lang_error PARAMS ((char *));
76 unk_lang_parser PARAMS ((void));
79 show_check PARAMS ((char *, int));
82 set_check PARAMS ((char *, int));
85 set_type_range PARAMS ((void));
87 /* Forward declaration */
88 extern const struct language_defn unknown_language_defn;
90 /* The current (default at startup) state of type and range checking.
91 (If the modes are set to "auto", though, these are changed based
92 on the default language at startup, and then again based on the
93 language of the first source file. */
95 enum range_mode range_mode = range_mode_auto;
96 enum range_check range_check = range_check_off;
97 enum type_mode type_mode = type_mode_auto;
98 enum type_check type_check = type_check_off;
100 /* The current language and language_mode (see language.h) */
102 const struct language_defn *current_language = &unknown_language_defn;
103 enum language_mode language_mode = language_mode_auto;
105 /* The list of supported languages. The list itself is malloc'd. */
107 static const struct language_defn **languages;
108 static unsigned languages_size;
109 static unsigned languages_allocsize;
110 #define DEFAULT_ALLOCSIZE 3
112 /* The "set language/type/range" commands all put stuff in these
113 buffers. This is to make them work as set/show commands. The
114 user's string is copied here, then the set_* commands look at
115 them and update them to something that looks nice when it is
118 static char *language;
122 /* Warning issued when current_language and the language of the current
123 frame do not match. */
124 char lang_frame_mismatch_warn[] =
125 "Warning: the current language does not match this frame.";
128 /* This page contains the functions corresponding to GDB commands
129 and their helpers. */
131 /* Show command. Display a warning if the language set
132 does not match the frame. */
134 show_language_command (ignore, from_tty)
138 enum language flang; /* The language of the current frame */
140 flang = get_frame_language();
141 if (flang != language_unknown &&
142 language_mode == language_mode_manual &&
143 current_language->la_language != flang)
144 printf_filtered("%s\n",lang_frame_mismatch_warn);
147 /* Set command. Change the current working language. */
149 set_language_command (ignore, from_tty)
157 /* FIXME -- do this from the list, with HELP. */
158 if (!language || !language[0]) {
159 printf("The currently understood settings are:\n\n\
160 local or auto Automatic setting based on source file\n\
161 c Use the C language\n\
162 c++ Use the C++ language\n\
163 modula-2 Use the Modula-2 language\n");
164 /* Restore the silly string. */
165 set_language(current_language->la_language);
169 /* Search the list of languages for a match. */
170 for (i = 0; i < languages_size; i++) {
171 if (!strcmp (languages[i]->la_name, language)) {
172 /* Found it! Go into manual mode, and use this language. */
173 if (languages[i]->la_language == language_auto) {
174 /* Enter auto mode. Set to the current frame's language, if known. */
175 language_mode = language_mode_auto;
176 flang = get_frame_language();
177 if (flang!=language_unknown)
181 /* Enter manual mode. Set the specified language. */
182 language_mode = language_mode_manual;
183 current_language = languages[i];
191 /* Reset the language (esp. the global string "language") to the
193 err_lang=savestring(language,strlen(language));
194 make_cleanup (free, err_lang); /* Free it after error */
195 set_language(current_language->la_language);
196 error ("Unknown language `%s'.",err_lang);
199 /* Show command. Display a warning if the type setting does
200 not match the current language. */
202 show_type_command(ignore, from_tty)
206 if (type_check != current_language->la_type_check)
208 "Warning: the current type check setting does not match the language.\n");
211 /* Set command. Change the setting for type checking. */
213 set_type_command(ignore, from_tty)
217 if (!strcmp(type,"on"))
219 type_check = type_check_on;
220 type_mode = type_mode_manual;
222 else if (!strcmp(type,"warn"))
224 type_check = type_check_warn;
225 type_mode = type_mode_manual;
227 else if (!strcmp(type,"off"))
229 type_check = type_check_off;
230 type_mode = type_mode_manual;
232 else if (!strcmp(type,"auto"))
234 type_mode = type_mode_auto;
236 /* Avoid hitting the set_type_str call below. We
237 did it in set_type_range. */
241 show_type_command((char *)NULL, from_tty);
244 /* Show command. Display a warning if the range setting does
245 not match the current language. */
247 show_range_command(ignore, from_tty)
252 if (range_check != current_language->la_range_check)
254 "Warning: the current range check setting does not match the language.\n");
257 /* Set command. Change the setting for range checking. */
259 set_range_command(ignore, from_tty)
263 if (!strcmp(range,"on"))
265 range_check = range_check_on;
266 range_mode = range_mode_manual;
268 else if (!strcmp(range,"warn"))
270 range_check = range_check_warn;
271 range_mode = range_mode_manual;
273 else if (!strcmp(range,"off"))
275 range_check = range_check_off;
276 range_mode = range_mode_manual;
278 else if (!strcmp(range,"auto"))
280 range_mode = range_mode_auto;
282 /* Avoid hitting the set_range_str call below. We
283 did it in set_type_range. */
287 show_range_command((char *)0, from_tty);
290 /* Set the status of range and type checking based on
291 the current modes and the current language.
292 If SHOW is non-zero, then print out the current language,
293 type and range checking status. */
298 if (range_mode == range_mode_auto)
299 range_check = current_language->la_range_check;
301 if (type_mode == type_mode_auto)
302 type_check = current_language->la_type_check;
308 /* Set current language to (enum language) LANG. */
316 for (i = 0; i < languages_size; i++) {
317 if (languages[i]->la_language == lang) {
318 current_language = languages[i];
326 /* This page contains functions that update the global vars
327 language, type and range. */
334 if (language_mode == language_mode_auto)
335 prefix = "auto; currently ";
337 language = concat(prefix, current_language->la_name, NULL);
343 char *tmp, *prefix = "";
346 if (type_mode==type_mode_auto)
347 prefix = "auto; currently ";
357 case type_check_warn:
361 error ("Unrecognized type check setting.");
364 type = concat(prefix,tmp,NULL);
370 char *tmp, *pref = "";
373 if (range_mode==range_mode_auto)
374 pref = "auto; currently ";
381 case range_check_off:
384 case range_check_warn:
388 error ("Unrecognized range check setting.");
391 range = concat(pref,tmp,NULL);
395 /* Print out the current language settings: language, range and
396 type checking. If QUIETLY, print only what has changed. */
398 language_info (quietly)
401 /* FIXME: quietly is ignored at the moment. */
402 printf("Current Language: %s\n",language);
403 show_language_command((char *)0, 1);
404 printf("Type checking: %s\n",type);
405 show_type_command((char *)0, 1);
406 printf("Range checking: %s\n",range);
407 show_range_command((char *)0, 1);
410 /* Return the result of a binary operation. */
412 #if 0 /* Currently unused */
415 binop_result_type(v1,v2)
420 l1 = TYPE_LENGTH(VALUE_TYPE(v1));
421 l2 = TYPE_LENGTH(VALUE_TYPE(v2));
423 switch(current_language->la_language)
427 if (TYPE_CODE(VALUE_TYPE(v1))==TYPE_CODE_FLT)
428 return TYPE_CODE(VALUE_TYPE(v2)) == TYPE_CODE_FLT && l2 > l1 ?
429 VALUE_TYPE(v2) : VALUE_TYPE(v1);
430 else if (TYPE_CODE(VALUE_TYPE(v2))==TYPE_CODE_FLT)
431 return TYPE_CODE(VALUE_TYPE(v1)) == TYPE_CODE_FLT && l1 > l2 ?
432 VALUE_TYPE(v1) : VALUE_TYPE(v2);
433 else if (TYPE_UNSIGNED(VALUE_TYPE(v1)) && l1 > l2)
434 return VALUE_TYPE(v1);
435 else if (TYPE_UNSIGNED(VALUE_TYPE(v2)) && l2 > l1)
436 return VALUE_TYPE(v2);
437 else /* Both are signed. Result is the longer type */
438 return l1 > l2 ? VALUE_TYPE(v1) : VALUE_TYPE(v2);
441 /* If we are doing type-checking, l1 should equal l2, so this is
443 return l1 > l2 ? VALUE_TYPE(v1) : VALUE_TYPE(v2);
447 return (struct type *)0; /* For lint */
453 /* This page contains functions that return format strings for
454 printf for printing out numbers in different formats */
456 /* Returns the appropriate printf format for hexadecimal
459 local_hex_format_custom(pre)
462 static char form[50];
464 strcpy (form, current_language->la_hex_format_pre);
466 strcat (form, current_language->la_hex_format_suf);
470 /* Converts a number to hexadecimal and stores it in a static
471 string. Returns a pointer to this string. */
473 local_hex_string (num)
478 sprintf (res, current_language->la_hex_format, num);
482 /* Converts a number to custom hexadecimal and stores it in a static
483 string. Returns a pointer to this string. */
485 local_hex_string_custom(num,pre)
491 sprintf (res, local_hex_format_custom(pre), num);
495 /* Returns the appropriate printf format for octal
498 local_octal_format_custom(pre)
501 static char form[50];
503 strcpy (form, current_language->la_octal_format_pre);
505 strcat (form, current_language->la_octal_format_suf);
509 /* This page contains functions that are used in type/range checking.
510 They all return zero if the type/range check fails.
512 It is hoped that these will make extending GDB to parse different
513 languages a little easier. These are primarily used in eval.c when
514 evaluating expressions and making sure that their types are correct.
515 Instead of having a mess of conjucted/disjuncted expressions in an "if",
516 the ideas of type can be wrapped up in the following functions.
518 Note that some of them are not currently dependent upon which language
519 is currently being parsed. For example, floats are the same in
520 C and Modula-2 (ie. the only floating point type has TYPE_CODE of
521 TYPE_CODE_FLT), while booleans are different. */
523 /* Returns non-zero if its argument is a simple type. This is the same for
524 both Modula-2 and for C. In the C case, TYPE_CODE_CHAR will never occur,
525 and thus will never cause the failure of the test. */
530 switch (TYPE_CODE (type)) {
535 case TYPE_CODE_RANGE:
544 /* Returns non-zero if its argument is of an ordered type. */
549 switch (TYPE_CODE (type)) {
554 case TYPE_CODE_RANGE:
562 /* Returns non-zero if the two types are the same */
564 same_type (arg1, arg2)
565 struct type *arg1, *arg2;
567 if (structured_type(arg1) ? !structured_type(arg2) : structured_type(arg2))
568 /* One is structured and one isn't */
570 else if (structured_type(arg1) && structured_type(arg2))
572 else if (numeric_type(arg1) && numeric_type(arg2))
573 return (TYPE_CODE(arg2) == TYPE_CODE(arg1)) &&
574 (TYPE_UNSIGNED(arg1) == TYPE_UNSIGNED(arg2))
580 /* Returns non-zero if the type is integral */
585 switch(current_language->la_language)
589 return (TYPE_CODE(type) != TYPE_CODE_INT) &&
590 (TYPE_CODE(type) != TYPE_CODE_ENUM) ? 0 : 1;
592 return TYPE_CODE(type) != TYPE_CODE_INT ? 0 : 1;
594 error ("Language not supported.");
598 /* Returns non-zero if the value is numeric */
603 switch (TYPE_CODE (type)) {
613 /* Returns non-zero if the value is a character type */
615 character_type (type)
618 switch(current_language->la_language)
621 return TYPE_CODE(type) != TYPE_CODE_CHAR ? 0 : 1;
625 return (TYPE_CODE(type) == TYPE_CODE_INT) &&
626 TYPE_LENGTH(type) == sizeof(char)
632 /* Returns non-zero if the value is a boolean type */
637 switch(current_language->la_language)
640 return TYPE_CODE(type) != TYPE_CODE_BOOL ? 0 : 1;
644 return TYPE_CODE(type) != TYPE_CODE_INT ? 0 : 1;
649 /* Returns non-zero if the value is a floating-point type */
654 return TYPE_CODE(type) == TYPE_CODE_FLT;
657 /* Returns non-zero if the value is a pointer type */
662 return TYPE_CODE(type) == TYPE_CODE_PTR ||
663 TYPE_CODE(type) == TYPE_CODE_REF;
666 /* Returns non-zero if the value is a structured type */
668 structured_type(type)
671 switch(current_language->la_language)
675 return (TYPE_CODE(type) == TYPE_CODE_STRUCT) ||
676 (TYPE_CODE(type) == TYPE_CODE_UNION) ||
677 (TYPE_CODE(type) == TYPE_CODE_ARRAY);
679 return (TYPE_CODE(type) == TYPE_CODE_STRUCT) ||
680 (TYPE_CODE(type) == TYPE_CODE_SET) ||
681 (TYPE_CODE(type) == TYPE_CODE_ARRAY);
686 /* This page contains functions that return info about
687 (struct value) values used in GDB. */
689 /* Returns non-zero if the value VAL represents a true value. */
698 switch (current_language->la_language) {
702 return !value_zerop (val);
705 type = VALUE_TYPE(val);
706 if (TYPE_CODE (type) != TYPE_CODE_BOOL)
707 return 0; /* Not a BOOLEAN at all */
708 /* Search the fields for one that matches the current value. */
709 len = TYPE_NFIELDS (type);
710 v = value_as_long (val);
711 for (i = 0; i < len; i++)
714 if (v == TYPE_FIELD_BITPOS (type, i))
718 return 0; /* Not a valid BOOLEAN value */
719 if (!strcmp ("TRUE", TYPE_FIELD_NAME(VALUE_TYPE(val), i)))
720 return 1; /* BOOLEAN with value TRUE */
722 return 0; /* BOOLEAN with value FALSE */
726 error ("Language not supported.");
730 /* Returns non-zero if the operator OP is defined on
731 the values ARG1 and ARG2. */
733 #if 0 /* Currently unused */
736 binop_type_check(arg1,arg2,op)
740 struct type *t1, *t2;
742 /* If we're not checking types, always return success. */
747 if (arg2!=(value)NULL)
756 if ((numeric_type(t1) && pointer_type(t2)) ||
757 (pointer_type(t1) && numeric_type(t2)))
759 printf("warning: combining pointer and integer.\n");
765 if (!numeric_type(t1) || !numeric_type(t2))
766 type_op_error ("Arguments to %s must be numbers.",op);
767 else if (!same_type(t1,t2))
768 type_op_error ("Arguments to %s must be of the same type.",op);
773 if (!boolean_type(t1) || !boolean_type(t2))
774 type_op_error ("Arguments to %s must be of boolean type.",op);
778 if ((pointer_type(t1) && !(pointer_type(t2) || integral_type(t2))) ||
779 (pointer_type(t2) && !(pointer_type(t1) || integral_type(t1))))
780 type_op_error ("A pointer can only be compared to an integer or pointer.",op);
781 else if ((pointer_type(t1) && integral_type(t2)) ||
782 (integral_type(t1) && pointer_type(t2)))
784 printf("warning: combining integer and pointer.\n");
787 else if (!simple_type(t1) || !simple_type(t2))
788 type_op_error ("Arguments to %s must be of simple type.",op);
789 else if (!same_type(t1,t2))
790 type_op_error ("Arguments to %s must be of the same type.",op);
794 if (!integral_type(t1) || !integral_type(t2))
795 type_op_error ("Arguments to %s must be of integral type.",op);
802 if (!ordered_type(t1) || !ordered_type(t2))
803 type_op_error ("Arguments to %s must be of ordered type.",op);
804 else if (!same_type(t1,t2))
805 type_op_error ("Arguments to %s must be of the same type.",op);
809 if (pointer_type(t1) && !integral_type(t2))
810 type_op_error ("A pointer can only be assigned an integer.",op);
811 else if (pointer_type(t1) && integral_type(t2))
813 printf("warning: combining integer and pointer.");
816 else if (!simple_type(t1) || !simple_type(t2))
817 type_op_error ("Arguments to %s must be of simple type.",op);
818 else if (!same_type(t1,t2))
819 type_op_error ("Arguments to %s must be of the same type.",op);
822 /* Unary checks -- arg2 is null */
825 if (!boolean_type(t1))
826 type_op_error ("Argument to %s must be of boolean type.",op);
831 if (!numeric_type(t1))
832 type_op_error ("Argument to %s must be of numeric type.",op);
836 if (integral_type(t1))
838 printf("warning: combining pointer and integer.\n");
841 else if (!pointer_type(t1))
842 type_op_error ("Argument to %s must be a pointer.",op);
845 case UNOP_PREINCREMENT:
846 case UNOP_POSTINCREMENT:
847 case UNOP_PREDECREMENT:
848 case UNOP_POSTDECREMENT:
849 if (!ordered_type(t1))
850 type_op_error ("Argument to %s must be of an ordered type.",op);
854 /* Ok. The following operators have different meanings in
855 different languages. */
856 switch(current_language->la_language)
864 if (!numeric_type(t1) || !numeric_type(t2))
865 type_op_error ("Arguments to %s must be numbers.",op);
876 if (!float_type(t1) || !float_type(t2))
877 type_op_error ("Arguments to %s must be floating point numbers.",op);
880 if (!integral_type(t1) || !integral_type(t2))
881 type_op_error ("Arguments to %s must be of integral type.",op);
892 /* This page contains functions for the printing out of
893 error messages that occur during type- and range-
896 /* Prints the format string FMT with the operator as a string
897 corresponding to the opcode OP. If FATAL is non-zero, then
898 this is an error and error () is called. Otherwise, it is
899 a warning and printf() is called. */
901 op_error (fmt,op,fatal)
907 error (fmt,op_string(op));
911 printf(fmt,op_string(op));
916 /* These are called when a language fails a type- or range-check.
917 The first argument should be a printf()-style format string, and
918 the rest of the arguments should be its arguments. If
919 [type|range]_check is [type|range]_check_on, then return_to_top_level()
920 is called in the style of error (). Otherwise, the message is prefixed
921 by "warning: " and we do not return to the top level. */
924 type_error (va_alist)
930 if (type_check==type_check_warn)
931 fprintf(stderr,"warning: ");
933 target_terminal_ours();
936 string = va_arg (args, char *);
937 vfprintf (stderr, string, args);
938 fprintf (stderr, "\n");
940 if (type_check==type_check_on)
941 return_to_top_level();
945 range_error (va_alist)
951 if (range_check==range_check_warn)
952 fprintf(stderr,"warning: ");
954 target_terminal_ours();
957 string = va_arg (args, char *);
958 vfprintf (stderr, string, args);
959 fprintf (stderr, "\n");
961 if (range_check==range_check_on)
962 return_to_top_level();
966 /* This page contains miscellaneous functions */
968 /* Return the language as a string */
975 for (i = 0; i < languages_size; i++) {
976 if (languages[i]->la_language == lang) {
977 return languages[i]->la_name;
983 struct cmd_list_element *setchecklist = NULL;
984 struct cmd_list_element *showchecklist = NULL;
987 set_check (ignore, from_tty)
992 "\"set check\" must be followed by the name of a check subcommand.\n");
993 help_list(setchecklist, "set check ", -1, stdout);
997 show_check (arg, from_tty)
1001 cmd_show_list(showchecklist, from_tty, "");
1004 /* Add a language to the set of known languages. */
1008 const struct language_defn *lang;
1010 if (lang->la_magic != LANG_MAGIC)
1012 fprintf(stderr, "Magic number of %s language struct wrong\n",
1019 languages_allocsize = DEFAULT_ALLOCSIZE;
1020 languages = (const struct language_defn **) xmalloc
1021 (languages_allocsize * sizeof (*languages));
1023 if (languages_size >= languages_allocsize)
1025 languages_allocsize *= 2;
1026 languages = (const struct language_defn **) xrealloc ((char *) languages,
1027 languages_allocsize * sizeof (*languages));
1029 languages[languages_size++] = lang;
1032 /* Define the language that is no language. */
1041 unk_lang_error (msg)
1044 error ("Attempted to parse an expression with unknown language");
1047 static struct type ** const (unknown_builtin_types[]) = { 0 };
1048 static const struct op_print unk_op_print_tab[] = { 0 };
1050 const struct language_defn unknown_language_defn = {
1053 &unknown_builtin_types[0],
1058 &builtin_type_error, /* longest signed integral type */
1059 &builtin_type_error, /* longest unsigned integral type */
1060 &builtin_type_error, /* longest floating point type */
1061 "0x%x", "0x%", "x", /* Hex format, prefix, suffix */
1062 "0%o", "0%", "o", /* Octal format, prefix, suffix */
1063 unk_op_print_tab, /* expression operators for printing */
1067 /* These two structs define fake entries for the "local" and "auto" options. */
1068 const struct language_defn auto_language_defn = {
1071 &unknown_builtin_types[0],
1076 &builtin_type_error, /* longest signed integral type */
1077 &builtin_type_error, /* longest unsigned integral type */
1078 &builtin_type_error, /* longest floating point type */
1079 "0x%x", "0x%", "x", /* Hex format, prefix, suffix */
1080 "0%o", "0%", "o", /* Octal format, prefix, suffix */
1081 unk_op_print_tab, /* expression operators for printing */
1085 const struct language_defn local_language_defn = {
1088 &unknown_builtin_types[0],
1093 &builtin_type_error, /* longest signed integral type */
1094 &builtin_type_error, /* longest unsigned integral type */
1095 &builtin_type_error, /* longest floating point type */
1096 "0x%x", "0x%", "x", /* Hex format, prefix, suffix */
1097 "0%o", "0%", "o", /* Octal format, prefix, suffix */
1098 unk_op_print_tab, /* expression operators for printing */
1102 /* Initialize the language routines */
1105 _initialize_language()
1107 struct cmd_list_element *set, *show;
1109 /* GDB commands for language specific stuff */
1111 set = add_set_cmd ("language", class_support, var_string_noescape,
1113 "Set the current source language.",
1115 show = add_show_from_set (set, &showlist);
1116 set->function.cfunc = set_language_command;
1117 show->function.cfunc = show_language_command;
1119 add_prefix_cmd ("check", no_class, set_check,
1120 "Set the status of the type/range checker",
1121 &setchecklist, "set check ", 0, &setlist);
1122 add_alias_cmd ("c", "check", no_class, 1, &setlist);
1123 add_alias_cmd ("ch", "check", no_class, 1, &setlist);
1125 add_prefix_cmd ("check", no_class, show_check,
1126 "Show the status of the type/range checker",
1127 &showchecklist, "show check ", 0, &showlist);
1128 add_alias_cmd ("c", "check", no_class, 1, &showlist);
1129 add_alias_cmd ("ch", "check", no_class, 1, &showlist);
1131 set = add_set_cmd ("type", class_support, var_string_noescape,
1133 "Set type checking. (on/warn/off/auto)",
1135 show = add_show_from_set (set, &showchecklist);
1136 set->function.cfunc = set_type_command;
1137 show->function.cfunc = show_type_command;
1139 set = add_set_cmd ("range", class_support, var_string_noescape,
1141 "Set range checking. (on/warn/off/auto)",
1143 show = add_show_from_set (set, &showchecklist);
1144 set->function.cfunc = set_range_command;
1145 show->function.cfunc = show_range_command;
1147 add_language (&unknown_language_defn);
1148 add_language (&local_language_defn);
1149 add_language (&auto_language_defn);
1151 language = savestring ("auto",strlen("auto"));
1152 range = savestring ("auto",strlen("auto"));
1153 type = savestring ("auto",strlen("auto"));
1155 /* Have the above take effect */
1157 set_language_command (language, 0);
1158 set_type_command (NULL, 0);
1159 set_range_command (NULL, 0);