Thu May 21 13:14:25 1998 John Metzler <jmetzler@cygnus.com>
[deliverable/binutils-gdb.git] / gdb / language.c
CommitLineData
c8023e66 1/* Multiple source language support for GDB.
7ed0f002 2 Copyright 1991, 1992 Free Software Foundation, Inc.
c8023e66
JG
3 Contributed by the Department of Computer Science at the State University
4 of New York at Buffalo.
5
6This file is part of GDB.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
6c9638b4 20Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
c8023e66
JG
21
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. */
25
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. */
29
d747e0af 30#include "defs.h"
fc71ad23 31#include <ctype.h>
2b576293 32#include "gdb_string.h"
c8023e66 33
c8023e66 34#include "symtab.h"
1ab3bf1b 35#include "gdbtypes.h"
c8023e66
JG
36#include "value.h"
37#include "gdbcmd.h"
38#include "frame.h"
c8023e66 39#include "expression.h"
7ed0f002 40#include "language.h"
c8023e66
JG
41#include "target.h"
42#include "parser-defs.h"
43
7ed0f002
JG
44static void
45show_language_command PARAMS ((char *, int));
46
47static void
48set_language_command PARAMS ((char *, int));
49
50static void
51show_type_command PARAMS ((char *, int));
c4668207 52
7ed0f002
JG
53static void
54set_type_command PARAMS ((char *, int));
55
56static void
57show_range_command PARAMS ((char *, int));
58
59static void
60set_range_command PARAMS ((char *, int));
61
62static void
63set_range_str PARAMS ((void));
64
65static void
66set_type_str PARAMS ((void));
67
68static void
69set_lang_str PARAMS ((void));
70
71static void
72unk_lang_error PARAMS ((char *));
73
74static int
75unk_lang_parser PARAMS ((void));
76
77static void
78show_check PARAMS ((char *, int));
79
80static void
81set_check PARAMS ((char *, int));
82
83static void
84set_type_range PARAMS ((void));
c8023e66 85
b607efe7
FF
86static void
87unk_lang_printchar PARAMS ((int, GDB_FILE *));
88
89static void
90unk_lang_printstr PARAMS ((GDB_FILE *, char *, unsigned int, int));
91
92static struct type *
93unk_lang_create_fundamental_type PARAMS ((struct objfile *, int));
94
95static void
96unk_lang_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int));
97
98static int
99unk_lang_val_print PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *,
100 int, int, int, enum val_prettyprint));
101
102static int
103unk_lang_value_print PARAMS ((value_ptr, GDB_FILE *, int, enum val_prettyprint));
104
c8023e66 105/* Forward declaration */
0c6efbcc 106extern const struct language_defn unknown_language_defn;
318bf84f 107extern char *warning_pre_print;
7ed0f002 108
c8023e66
JG
109/* The current (default at startup) state of type and range checking.
110 (If the modes are set to "auto", though, these are changed based
111 on the default language at startup, and then again based on the
112 language of the first source file. */
113
114enum range_mode range_mode = range_mode_auto;
115enum range_check range_check = range_check_off;
116enum type_mode type_mode = type_mode_auto;
117enum type_check type_check = type_check_off;
118
119/* The current language and language_mode (see language.h) */
120
0c6efbcc 121const struct language_defn *current_language = &unknown_language_defn;
c8023e66
JG
122enum language_mode language_mode = language_mode_auto;
123
b5af69c3
JG
124/* The language that the user expects to be typing in (the language
125 of main(), or the last language we notified them about, or C). */
126
127const struct language_defn *expected_language;
128
c8023e66
JG
129/* The list of supported languages. The list itself is malloc'd. */
130
7ed0f002 131static const struct language_defn **languages;
c8023e66
JG
132static unsigned languages_size;
133static unsigned languages_allocsize;
e58de8a2 134#define DEFAULT_ALLOCSIZE 4
c8023e66
JG
135
136/* The "set language/type/range" commands all put stuff in these
137 buffers. This is to make them work as set/show commands. The
138 user's string is copied here, then the set_* commands look at
139 them and update them to something that looks nice when it is
140 printed out. */
141
142static char *language;
143static char *type;
144static char *range;
145
146/* Warning issued when current_language and the language of the current
147 frame do not match. */
148char lang_frame_mismatch_warn[] =
149 "Warning: the current language does not match this frame.";
150
c8023e66
JG
151\f
152/* This page contains the functions corresponding to GDB commands
153 and their helpers. */
154
155/* Show command. Display a warning if the language set
156 does not match the frame. */
7ed0f002 157static void
d8ce1326
JG
158show_language_command (ignore, from_tty)
159 char *ignore;
c8023e66
JG
160 int from_tty;
161{
162 enum language flang; /* The language of the current frame */
163
164 flang = get_frame_language();
165 if (flang != language_unknown &&
166 language_mode == language_mode_manual &&
167 current_language->la_language != flang)
168 printf_filtered("%s\n",lang_frame_mismatch_warn);
169}
170
171/* Set command. Change the current working language. */
7ed0f002 172static void
d8ce1326
JG
173set_language_command (ignore, from_tty)
174 char *ignore;
c8023e66
JG
175 int from_tty;
176{
177 int i;
178 enum language flang;
5f3d478e 179 char *err_lang;
c8023e66 180
fc71ad23
TT
181 if (!language || !language[0])
182 {
183 printf_unfiltered("The currently understood settings are:\n\n");
184 printf_unfiltered ("local or auto Automatic setting based on source file\n");
185
186 for (i = 0; i < languages_size; ++i)
187 {
188 /* Already dealt with these above. */
189 if (languages[i]->la_language == language_unknown
190 || languages[i]->la_language == language_auto)
191 continue;
192
193 /* FIXME for now assume that the human-readable name is just
194 a capitalization of the internal name. */
195 printf_unfiltered ("%-16s Use the %c%s language\n",
196 languages[i]->la_name,
197 /* Capitalize first letter of language
198 name. */
199 toupper (languages[i]->la_name[0]),
200 languages[i]->la_name + 1);
201 }
202 /* Restore the silly string. */
203 set_language(current_language->la_language);
204 return;
205 }
c8023e66
JG
206
207 /* Search the list of languages for a match. */
208 for (i = 0; i < languages_size; i++) {
2e4964ad 209 if (STREQ (languages[i]->la_name, language)) {
c8023e66
JG
210 /* Found it! Go into manual mode, and use this language. */
211 if (languages[i]->la_language == language_auto) {
212 /* Enter auto mode. Set to the current frame's language, if known. */
213 language_mode = language_mode_auto;
214 flang = get_frame_language();
215 if (flang!=language_unknown)
216 set_language(flang);
b5af69c3 217 expected_language = current_language;
c8023e66
JG
218 return;
219 } else {
220 /* Enter manual mode. Set the specified language. */
221 language_mode = language_mode_manual;
222 current_language = languages[i];
223 set_type_range ();
224 set_lang_str();
b5af69c3 225 expected_language = current_language;
c8023e66
JG
226 return;
227 }
228 }
229 }
230
5f3d478e
JG
231 /* Reset the language (esp. the global string "language") to the
232 correct values. */
233 err_lang=savestring(language,strlen(language));
234 make_cleanup (free, err_lang); /* Free it after error */
235 set_language(current_language->la_language);
236 error ("Unknown language `%s'.",err_lang);
c8023e66
JG
237}
238
239/* Show command. Display a warning if the type setting does
240 not match the current language. */
7ed0f002 241static void
d8ce1326
JG
242show_type_command(ignore, from_tty)
243 char *ignore;
c8023e66
JG
244 int from_tty;
245{
246 if (type_check != current_language->la_type_check)
199b2450 247 printf_unfiltered(
c8023e66
JG
248"Warning: the current type check setting does not match the language.\n");
249}
250
251/* Set command. Change the setting for type checking. */
7ed0f002 252static void
d8ce1326
JG
253set_type_command(ignore, from_tty)
254 char *ignore;
c8023e66
JG
255 int from_tty;
256{
2e4964ad 257 if (STREQ(type,"on"))
c8023e66
JG
258 {
259 type_check = type_check_on;
260 type_mode = type_mode_manual;
261 }
2e4964ad 262 else if (STREQ(type,"warn"))
c8023e66
JG
263 {
264 type_check = type_check_warn;
265 type_mode = type_mode_manual;
266 }
2e4964ad 267 else if (STREQ(type,"off"))
c8023e66
JG
268 {
269 type_check = type_check_off;
270 type_mode = type_mode_manual;
271 }
2e4964ad 272 else if (STREQ(type,"auto"))
c8023e66
JG
273 {
274 type_mode = type_mode_auto;
275 set_type_range();
276 /* Avoid hitting the set_type_str call below. We
277 did it in set_type_range. */
278 return;
279 }
280 set_type_str();
d8ce1326 281 show_type_command((char *)NULL, from_tty);
c8023e66
JG
282}
283
284/* Show command. Display a warning if the range setting does
285 not match the current language. */
7ed0f002 286static void
d8ce1326
JG
287show_range_command(ignore, from_tty)
288 char *ignore;
c8023e66
JG
289 int from_tty;
290{
291
292 if (range_check != current_language->la_range_check)
199b2450 293 printf_unfiltered(
c8023e66
JG
294"Warning: the current range check setting does not match the language.\n");
295}
296
297/* Set command. Change the setting for range checking. */
7ed0f002 298static void
d8ce1326
JG
299set_range_command(ignore, from_tty)
300 char *ignore;
c8023e66
JG
301 int from_tty;
302{
2e4964ad 303 if (STREQ(range,"on"))
c8023e66
JG
304 {
305 range_check = range_check_on;
306 range_mode = range_mode_manual;
307 }
2e4964ad 308 else if (STREQ(range,"warn"))
c8023e66
JG
309 {
310 range_check = range_check_warn;
311 range_mode = range_mode_manual;
312 }
2e4964ad 313 else if (STREQ(range,"off"))
c8023e66
JG
314 {
315 range_check = range_check_off;
316 range_mode = range_mode_manual;
317 }
2e4964ad 318 else if (STREQ(range,"auto"))
c8023e66
JG
319 {
320 range_mode = range_mode_auto;
321 set_type_range();
322 /* Avoid hitting the set_range_str call below. We
323 did it in set_type_range. */
324 return;
325 }
326 set_range_str();
d8ce1326 327 show_range_command((char *)0, from_tty);
c8023e66
JG
328}
329
330/* Set the status of range and type checking based on
331 the current modes and the current language.
332 If SHOW is non-zero, then print out the current language,
333 type and range checking status. */
334static void
335set_type_range()
336{
c8023e66
JG
337
338 if (range_mode == range_mode_auto)
339 range_check = current_language->la_range_check;
340
341 if (type_mode == type_mode_auto)
342 type_check = current_language->la_type_check;
343
344 set_type_str();
345 set_range_str();
346}
347
348/* Set current language to (enum language) LANG. */
349
350void
351set_language(lang)
352 enum language lang;
353{
354 int i;
355
356 for (i = 0; i < languages_size; i++) {
357 if (languages[i]->la_language == lang) {
358 current_language = languages[i];
359 set_type_range ();
360 set_lang_str();
545af6ce 361 break;
c8023e66
JG
362 }
363 }
364}
365\f
366/* This page contains functions that update the global vars
367 language, type and range. */
7ed0f002 368static void
c8023e66
JG
369set_lang_str()
370{
d8ce1326 371 char *prefix = "";
c8023e66
JG
372
373 free (language);
374 if (language_mode == language_mode_auto)
375 prefix = "auto; currently ";
376
58ae87f6 377 language = concat(prefix, current_language->la_name, NULL);
c8023e66
JG
378}
379
7ed0f002 380static void
c8023e66
JG
381set_type_str()
382{
383 char *tmp, *prefix = "";
384
385 free (type);
386 if (type_mode==type_mode_auto)
387 prefix = "auto; currently ";
388
389 switch(type_check)
390 {
391 case type_check_on:
392 tmp = "on";
393 break;
394 case type_check_off:
395 tmp = "off";
396 break;
397 case type_check_warn:
398 tmp = "warn";
399 break;
400 default:
401 error ("Unrecognized type check setting.");
402 }
403
58ae87f6 404 type = concat(prefix,tmp,NULL);
c8023e66
JG
405}
406
7ed0f002 407static void
c8023e66
JG
408set_range_str()
409{
410 char *tmp, *pref = "";
411
412 free (range);
413 if (range_mode==range_mode_auto)
414 pref = "auto; currently ";
415
416 switch(range_check)
417 {
418 case range_check_on:
419 tmp = "on";
420 break;
421 case range_check_off:
422 tmp = "off";
423 break;
424 case range_check_warn:
425 tmp = "warn";
426 break;
427 default:
428 error ("Unrecognized range check setting.");
429 }
430
58ae87f6 431 range = concat(pref,tmp,NULL);
c8023e66
JG
432}
433
434
435/* Print out the current language settings: language, range and
7ed0f002 436 type checking. If QUIETLY, print only what has changed. */
b5af69c3 437
c8023e66 438void
7ed0f002
JG
439language_info (quietly)
440 int quietly;
c8023e66 441{
b5af69c3
JG
442 if (quietly && expected_language == current_language)
443 return;
444
445 expected_language = current_language;
199b2450 446 printf_unfiltered("Current language: %s\n",language);
b5af69c3
JG
447 show_language_command((char *)0, 1);
448
449 if (!quietly)
450 {
199b2450 451 printf_unfiltered("Type checking: %s\n",type);
b5af69c3 452 show_type_command((char *)0, 1);
199b2450 453 printf_unfiltered("Range checking: %s\n",range);
b5af69c3
JG
454 show_range_command((char *)0, 1);
455 }
c8023e66
JG
456}
457\f
458/* Return the result of a binary operation. */
7ed0f002
JG
459
460#if 0 /* Currently unused */
461
c8023e66 462struct type *
82a2edfb
JK
463binop_result_type (v1, v2)
464 value_ptr v1, v2;
c8023e66 465{
940d5967
PB
466 int size,uns;
467 struct type *t1 = check_typedef (VALUE_TYPE (v1));
468 struct type *t2 = check_typedef (VALUE_TYPE (v2));
c8023e66 469
940d5967
PB
470 int l1 = TYPE_LENGTH (t1);
471 int l2 = TYPE_LENGTH (t2);
c8023e66
JG
472
473 switch(current_language->la_language)
474 {
475 case language_c:
545af6ce 476 case language_cplus:
940d5967
PB
477 if (TYPE_CODE (t1)==TYPE_CODE_FLT)
478 return TYPE_CODE(t2) == TYPE_CODE_FLT && l2 > l1 ?
c8023e66 479 VALUE_TYPE(v2) : VALUE_TYPE(v1);
940d5967
PB
480 else if (TYPE_CODE(t2)==TYPE_CODE_FLT)
481 return TYPE_CODE(t1)) == TYPE_CODE_FLT && l1 > l2 ?
c8023e66 482 VALUE_TYPE(v1) : VALUE_TYPE(v2);
940d5967 483 else if (TYPE_UNSIGNED(t1) && l1 > l2)
c8023e66 484 return VALUE_TYPE(v1);
940d5967 485 else if (TYPE_UNSIGNED(t2) && l2 > l1)
c8023e66
JG
486 return VALUE_TYPE(v2);
487 else /* Both are signed. Result is the longer type */
488 return l1 > l2 ? VALUE_TYPE(v1) : VALUE_TYPE(v2);
489 break;
490 case language_m2:
491 /* If we are doing type-checking, l1 should equal l2, so this is
492 not needed. */
493 return l1 > l2 ? VALUE_TYPE(v1) : VALUE_TYPE(v2);
494 break;
5aefc1ca 495 case language_chill:
e58de8a2 496 error ("Missing Chill support in function binop_result_check.");/*FIXME*/
c8023e66 497 }
d8ce1326
JG
498 abort();
499 return (struct type *)0; /* For lint */
c8023e66 500}
7ed0f002
JG
501
502#endif /* 0 */
503
c8023e66
JG
504\f
505/* This page contains functions that return format strings for
506 printf for printing out numbers in different formats */
507
508/* Returns the appropriate printf format for hexadecimal
509 numbers. */
510char *
511local_hex_format_custom(pre)
512 char *pre;
513{
514 static char form[50];
515
2e66cf7d
FF
516 strcpy (form, local_hex_format_prefix ());
517 strcat (form, "%");
c8023e66 518 strcat (form, pre);
2e66cf7d
FF
519 strcat (form, local_hex_format_specifier ());
520 strcat (form, local_hex_format_suffix ());
c8023e66
JG
521 return form;
522}
523
524/* Converts a number to hexadecimal and stores it in a static
525 string. Returns a pointer to this string. */
526char *
527local_hex_string (num)
5573d7d4 528 unsigned long num;
c8023e66
JG
529{
530 static char res[50];
531
2e66cf7d 532 sprintf (res, local_hex_format(), num);
c8023e66
JG
533 return res;
534}
535
536/* Converts a number to custom hexadecimal and stores it in a static
537 string. Returns a pointer to this string. */
538char *
539local_hex_string_custom(num,pre)
5573d7d4 540 unsigned long num;
c8023e66
JG
541 char *pre;
542{
543 static char res[50];
544
545 sprintf (res, local_hex_format_custom(pre), num);
546 return res;
547}
548
549/* Returns the appropriate printf format for octal
550 numbers. */
551char *
552local_octal_format_custom(pre)
553 char *pre;
554{
555 static char form[50];
556
2e66cf7d
FF
557 strcpy (form, local_octal_format_prefix ());
558 strcat (form, "%");
c8023e66 559 strcat (form, pre);
2e66cf7d
FF
560 strcat (form, local_octal_format_specifier ());
561 strcat (form, local_octal_format_suffix ());
c8023e66
JG
562 return form;
563}
58a66e24
FF
564
565/* Returns the appropriate printf format for decimal numbers. */
566char *
567local_decimal_format_custom(pre)
568 char *pre;
569{
570 static char form[50];
571
572 strcpy (form, local_decimal_format_prefix ());
573 strcat (form, "%");
574 strcat (form, pre);
575 strcat (form, local_decimal_format_specifier ());
576 strcat (form, local_decimal_format_suffix ());
577 return form;
578}
c8023e66 579\f
940d5967 580#if 0
c8023e66
JG
581/* This page contains functions that are used in type/range checking.
582 They all return zero if the type/range check fails.
583
584 It is hoped that these will make extending GDB to parse different
585 languages a little easier. These are primarily used in eval.c when
586 evaluating expressions and making sure that their types are correct.
587 Instead of having a mess of conjucted/disjuncted expressions in an "if",
588 the ideas of type can be wrapped up in the following functions.
589
590 Note that some of them are not currently dependent upon which language
591 is currently being parsed. For example, floats are the same in
592 C and Modula-2 (ie. the only floating point type has TYPE_CODE of
593 TYPE_CODE_FLT), while booleans are different. */
594
595/* Returns non-zero if its argument is a simple type. This is the same for
596 both Modula-2 and for C. In the C case, TYPE_CODE_CHAR will never occur,
597 and thus will never cause the failure of the test. */
598int
599simple_type(type)
600 struct type *type;
601{
940d5967 602 CHECK_TYPEDEF (type);
c8023e66
JG
603 switch (TYPE_CODE (type)) {
604 case TYPE_CODE_INT:
605 case TYPE_CODE_CHAR:
606 case TYPE_CODE_ENUM:
607 case TYPE_CODE_FLT:
608 case TYPE_CODE_RANGE:
609 case TYPE_CODE_BOOL:
610 return 1;
611
612 default:
613 return 0;
614 }
615}
616
2e66cf7d
FF
617/* Returns non-zero if its argument is of an ordered type.
618 An ordered type is one in which the elements can be tested for the
619 properties of "greater than", "less than", etc, or for which the
620 operations "increment" or "decrement" make sense. */
c8023e66
JG
621int
622ordered_type (type)
623 struct type *type;
624{
940d5967 625 CHECK_TYPEDEF (type);
c8023e66
JG
626 switch (TYPE_CODE (type)) {
627 case TYPE_CODE_INT:
628 case TYPE_CODE_CHAR:
629 case TYPE_CODE_ENUM:
630 case TYPE_CODE_FLT:
631 case TYPE_CODE_RANGE:
632 return 1;
633
634 default:
635 return 0;
636 }
637}
638
639/* Returns non-zero if the two types are the same */
640int
641same_type (arg1, arg2)
642 struct type *arg1, *arg2;
643{
940d5967 644 CHECK_TYPEDEF (type);
c8023e66
JG
645 if (structured_type(arg1) ? !structured_type(arg2) : structured_type(arg2))
646 /* One is structured and one isn't */
647 return 0;
648 else if (structured_type(arg1) && structured_type(arg2))
649 return arg1 == arg2;
650 else if (numeric_type(arg1) && numeric_type(arg2))
651 return (TYPE_CODE(arg2) == TYPE_CODE(arg1)) &&
652 (TYPE_UNSIGNED(arg1) == TYPE_UNSIGNED(arg2))
653 ? 1 : 0;
654 else
655 return arg1==arg2;
656}
657
658/* Returns non-zero if the type is integral */
659int
660integral_type (type)
661 struct type *type;
662{
940d5967 663 CHECK_TYPEDEF (type);
c8023e66
JG
664 switch(current_language->la_language)
665 {
666 case language_c:
545af6ce 667 case language_cplus:
c8023e66
JG
668 return (TYPE_CODE(type) != TYPE_CODE_INT) &&
669 (TYPE_CODE(type) != TYPE_CODE_ENUM) ? 0 : 1;
670 case language_m2:
671 return TYPE_CODE(type) != TYPE_CODE_INT ? 0 : 1;
e58de8a2
FF
672 case language_chill:
673 error ("Missing Chill support in function integral_type."); /*FIXME*/
c8023e66
JG
674 default:
675 error ("Language not supported.");
676 }
677}
678
679/* Returns non-zero if the value is numeric */
680int
681numeric_type (type)
682 struct type *type;
683{
940d5967 684 CHECK_TYPEDEF (type);
c8023e66
JG
685 switch (TYPE_CODE (type)) {
686 case TYPE_CODE_INT:
687 case TYPE_CODE_FLT:
688 return 1;
689
690 default:
691 return 0;
692 }
693}
694
695/* Returns non-zero if the value is a character type */
696int
697character_type (type)
698 struct type *type;
699{
940d5967
PB
700 CHECK_TYPEDEF (type);
701 switch(current_language->la_language)
c8023e66 702 {
2e66cf7d 703 case language_chill:
c8023e66
JG
704 case language_m2:
705 return TYPE_CODE(type) != TYPE_CODE_CHAR ? 0 : 1;
706
707 case language_c:
545af6ce 708 case language_cplus:
c8023e66
JG
709 return (TYPE_CODE(type) == TYPE_CODE_INT) &&
710 TYPE_LENGTH(type) == sizeof(char)
711 ? 1 : 0;
51b57ded
FF
712 default:
713 return (0);
c8023e66
JG
714 }
715}
716
fcbadaee
FF
717/* Returns non-zero if the value is a string type */
718int
719string_type (type)
720 struct type *type;
721{
940d5967
PB
722 CHECK_TYPEDEF (type);
723 switch(current_language->la_language)
fcbadaee 724 {
fcbadaee 725 case language_chill:
fcbadaee
FF
726 case language_m2:
727 return TYPE_CODE(type) != TYPE_CODE_STRING ? 0 : 1;
728
729 case language_c:
730 case language_cplus:
731 /* C does not have distinct string type. */
732 return (0);
733 default:
734 return (0);
735 }
736}
737
c8023e66
JG
738/* Returns non-zero if the value is a boolean type */
739int
740boolean_type (type)
741 struct type *type;
742{
940d5967 743 CHECK_TYPEDEF (type);
61932a8e
JK
744 if (TYPE_CODE (type) == TYPE_CODE_BOOL)
745 return 1;
746 switch(current_language->la_language)
747 {
748 case language_c:
749 case language_cplus:
750 /* Might be more cleanly handled by having a TYPE_CODE_INT_NOT_BOOL
751 for CHILL and such languages, or a TYPE_CODE_INT_OR_BOOL for C. */
752 if (TYPE_CODE (type) == TYPE_CODE_INT)
753 return 1;
51b57ded 754 default:
61932a8e 755 break;
c8023e66 756 }
61932a8e 757 return 0;
c8023e66
JG
758}
759
760/* Returns non-zero if the value is a floating-point type */
761int
762float_type (type)
763 struct type *type;
764{
940d5967
PB
765 CHECK_TYPEDEF (type);
766 return TYPE_CODE(type) == TYPE_CODE_FLT;
c8023e66
JG
767}
768
769/* Returns non-zero if the value is a pointer type */
770int
771pointer_type(type)
772 struct type *type;
773{
774 return TYPE_CODE(type) == TYPE_CODE_PTR ||
775 TYPE_CODE(type) == TYPE_CODE_REF;
776}
777
778/* Returns non-zero if the value is a structured type */
779int
780structured_type(type)
781 struct type *type;
782{
940d5967 783 CHECK_TYPEDEF (type);
c8023e66
JG
784 switch(current_language->la_language)
785 {
786 case language_c:
545af6ce 787 case language_cplus:
c8023e66
JG
788 return (TYPE_CODE(type) == TYPE_CODE_STRUCT) ||
789 (TYPE_CODE(type) == TYPE_CODE_UNION) ||
790 (TYPE_CODE(type) == TYPE_CODE_ARRAY);
791 case language_m2:
792 return (TYPE_CODE(type) == TYPE_CODE_STRUCT) ||
793 (TYPE_CODE(type) == TYPE_CODE_SET) ||
794 (TYPE_CODE(type) == TYPE_CODE_ARRAY);
e58de8a2
FF
795 case language_chill:
796 error ("Missing Chill support in function structured_type."); /*FIXME*/
51b57ded
FF
797 default:
798 return (0);
c8023e66
JG
799 }
800}
940d5967 801#endif
c8023e66 802\f
a366d882
PB
803struct type *
804lang_bool_type ()
805{
806 struct symbol *sym;
807 struct type *type;
808 switch(current_language->la_language)
809 {
810 case language_chill:
811 return builtin_type_chill_bool;
ec5f347c
PB
812 case language_fortran:
813 sym = lookup_symbol ("logical", NULL, VAR_NAMESPACE, NULL, NULL);
814 if (sym)
815 {
b52cac6b 816 type = SYMBOL_TYPE (sym);
ec5f347c
PB
817 if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
818 return type;
819 }
820 return builtin_type_f_logical_s2;
a366d882
PB
821 case language_cplus:
822 sym = lookup_symbol ("bool", NULL, VAR_NAMESPACE, NULL, NULL);
823 if (sym)
824 {
b52cac6b 825 type = SYMBOL_TYPE (sym);
a366d882
PB
826 if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
827 return type;
828 }
829 /* ... else fall through ... */
830 default:
831 return builtin_type_int;
832 }
833}
834\f
c8023e66
JG
835/* This page contains functions that return info about
836 (struct value) values used in GDB. */
837
838/* Returns non-zero if the value VAL represents a true value. */
839int
61932a8e 840value_true (val)
82a2edfb 841 value_ptr val;
c8023e66 842{
61932a8e
JK
843 /* It is possible that we should have some sort of error if a non-boolean
844 value is used in this context. Possibly dependent on some kind of
845 "boolean-checking" option like range checking. But it should probably
846 not depend on the language except insofar as is necessary to identify
847 a "boolean" value (i.e. in C using a float, pointer, etc., as a boolean
848 should be an error, probably). */
849 return !value_logical_not (val);
c8023e66
JG
850}
851\f
852/* Returns non-zero if the operator OP is defined on
853 the values ARG1 and ARG2. */
7ed0f002
JG
854
855#if 0 /* Currently unused */
856
c8023e66
JG
857void
858binop_type_check(arg1,arg2,op)
82a2edfb 859 value_ptr arg1,arg2;
c8023e66
JG
860 int op;
861{
862 struct type *t1, *t2;
863
864 /* If we're not checking types, always return success. */
865 if (!STRICT_TYPE)
866 return;
867
868 t1=VALUE_TYPE(arg1);
82a2edfb 869 if (arg2 != NULL)
c8023e66
JG
870 t2=VALUE_TYPE(arg2);
871 else
872 t2=NULL;
873
874 switch(op)
875 {
876 case BINOP_ADD:
877 case BINOP_SUB:
878 if ((numeric_type(t1) && pointer_type(t2)) ||
879 (pointer_type(t1) && numeric_type(t2)))
880 {
318bf84f 881 warning ("combining pointer and integer.\n");
c8023e66
JG
882 break;
883 }
884 case BINOP_MUL:
885 case BINOP_LSH:
886 case BINOP_RSH:
887 if (!numeric_type(t1) || !numeric_type(t2))
888 type_op_error ("Arguments to %s must be numbers.",op);
889 else if (!same_type(t1,t2))
890 type_op_error ("Arguments to %s must be of the same type.",op);
891 break;
892
e58de8a2
FF
893 case BINOP_LOGICAL_AND:
894 case BINOP_LOGICAL_OR:
c8023e66
JG
895 if (!boolean_type(t1) || !boolean_type(t2))
896 type_op_error ("Arguments to %s must be of boolean type.",op);
897 break;
898
899 case BINOP_EQUAL:
900 if ((pointer_type(t1) && !(pointer_type(t2) || integral_type(t2))) ||
901 (pointer_type(t2) && !(pointer_type(t1) || integral_type(t1))))
902 type_op_error ("A pointer can only be compared to an integer or pointer.",op);
903 else if ((pointer_type(t1) && integral_type(t2)) ||
904 (integral_type(t1) && pointer_type(t2)))
905 {
318bf84f 906 warning ("combining integer and pointer.\n");
c8023e66
JG
907 break;
908 }
909 else if (!simple_type(t1) || !simple_type(t2))
910 type_op_error ("Arguments to %s must be of simple type.",op);
911 else if (!same_type(t1,t2))
912 type_op_error ("Arguments to %s must be of the same type.",op);
913 break;
914
915 case BINOP_REM:
76a0ffb4 916 case BINOP_MOD:
c8023e66
JG
917 if (!integral_type(t1) || !integral_type(t2))
918 type_op_error ("Arguments to %s must be of integral type.",op);
919 break;
920
921 case BINOP_LESS:
922 case BINOP_GTR:
923 case BINOP_LEQ:
924 case BINOP_GEQ:
925 if (!ordered_type(t1) || !ordered_type(t2))
926 type_op_error ("Arguments to %s must be of ordered type.",op);
927 else if (!same_type(t1,t2))
928 type_op_error ("Arguments to %s must be of the same type.",op);
929 break;
930
931 case BINOP_ASSIGN:
932 if (pointer_type(t1) && !integral_type(t2))
933 type_op_error ("A pointer can only be assigned an integer.",op);
934 else if (pointer_type(t1) && integral_type(t2))
935 {
318bf84f 936 warning ("combining integer and pointer.");
c8023e66
JG
937 break;
938 }
939 else if (!simple_type(t1) || !simple_type(t2))
940 type_op_error ("Arguments to %s must be of simple type.",op);
941 else if (!same_type(t1,t2))
942 type_op_error ("Arguments to %s must be of the same type.",op);
943 break;
944
fcbadaee 945 case BINOP_CONCAT:
2fcc38b8
FF
946 /* FIXME: Needs to handle bitstrings as well. */
947 if (!(string_type(t1) || character_type(t1) || integral_type(t1))
948 || !(string_type(t2) || character_type(t2) || integral_type(t2)))
fcbadaee
FF
949 type_op_error ("Arguments to %s must be strings or characters.", op);
950 break;
951
c8023e66
JG
952 /* Unary checks -- arg2 is null */
953
e58de8a2 954 case UNOP_LOGICAL_NOT:
c8023e66
JG
955 if (!boolean_type(t1))
956 type_op_error ("Argument to %s must be of boolean type.",op);
957 break;
958
959 case UNOP_PLUS:
960 case UNOP_NEG:
961 if (!numeric_type(t1))
962 type_op_error ("Argument to %s must be of numeric type.",op);
963 break;
964
965 case UNOP_IND:
966 if (integral_type(t1))
967 {
318bf84f 968 warning ("combining pointer and integer.\n");
c8023e66
JG
969 break;
970 }
971 else if (!pointer_type(t1))
972 type_op_error ("Argument to %s must be a pointer.",op);
973 break;
974
975 case UNOP_PREINCREMENT:
976 case UNOP_POSTINCREMENT:
977 case UNOP_PREDECREMENT:
978 case UNOP_POSTDECREMENT:
979 if (!ordered_type(t1))
980 type_op_error ("Argument to %s must be of an ordered type.",op);
981 break;
982
983 default:
984 /* Ok. The following operators have different meanings in
985 different languages. */
986 switch(current_language->la_language)
987 {
988#ifdef _LANG_c
989 case language_c:
545af6ce 990 case language_cplus:
c8023e66
JG
991 switch(op)
992 {
993 case BINOP_DIV:
994 if (!numeric_type(t1) || !numeric_type(t2))
995 type_op_error ("Arguments to %s must be numbers.",op);
996 break;
997 }
998 break;
999#endif
1000
1001#ifdef _LANG_m2
1002 case language_m2:
1003 switch(op)
1004 {
1005 case BINOP_DIV:
1006 if (!float_type(t1) || !float_type(t2))
1007 type_op_error ("Arguments to %s must be floating point numbers.",op);
1008 break;
1009 case BINOP_INTDIV:
1010 if (!integral_type(t1) || !integral_type(t2))
1011 type_op_error ("Arguments to %s must be of integral type.",op);
1012 break;
1013 }
1014#endif
e58de8a2
FF
1015
1016#ifdef _LANG_chill
1017 case language_chill:
1018 error ("Missing Chill support in function binop_type_check.");/*FIXME*/
1019#endif
1020
c8023e66
JG
1021 }
1022 }
1023}
7ed0f002
JG
1024
1025#endif /* 0 */
1026
c8023e66
JG
1027\f
1028/* This page contains functions for the printing out of
1029 error messages that occur during type- and range-
1030 checking. */
1031
1032/* Prints the format string FMT with the operator as a string
1033 corresponding to the opcode OP. If FATAL is non-zero, then
1034 this is an error and error () is called. Otherwise, it is
1035 a warning and printf() is called. */
1036void
1037op_error (fmt,op,fatal)
1038 char *fmt;
1039 enum exp_opcode op;
1040 int fatal;
1041{
1042 if (fatal)
1043 error (fmt,op_string(op));
1044 else
1045 {
318bf84f 1046 warning (fmt,op_string(op));
c8023e66
JG
1047 }
1048}
1049
1050/* These are called when a language fails a type- or range-check.
1051 The first argument should be a printf()-style format string, and
1052 the rest of the arguments should be its arguments. If
1053 [type|range]_check is [type|range]_check_on, then return_to_top_level()
1054 is called in the style of error (). Otherwise, the message is prefixed
318bf84f 1055 by the value of warning_pre_print and we do not return to the top level. */
7ed0f002 1056
c8023e66 1057void
73d3dbd4 1058#ifdef ANSI_PROTOTYPES
85c613aa
C
1059type_error (char *string, ...)
1060#else
c8023e66 1061type_error (va_alist)
7ed0f002 1062 va_dcl
85c613aa 1063#endif
c8023e66
JG
1064{
1065 va_list args;
73d3dbd4 1066#ifdef ANSI_PROTOTYPES
85c613aa
C
1067 va_start (args, string);
1068#else
c8023e66 1069 char *string;
85c613aa
C
1070 va_start (args);
1071 string = va_arg (args, char *);
1072#endif
c8023e66 1073
a0cf4681 1074 if (type_check == type_check_warn)
e16b9023 1075 fprintf_filtered (gdb_stderr, warning_pre_print);
c8023e66 1076 else
a0cf4681 1077 error_begin ();
c8023e66 1078
e16b9023
JK
1079 vfprintf_filtered (gdb_stderr, string, args);
1080 fprintf_filtered (gdb_stderr, "\n");
c8023e66 1081 va_end (args);
a0cf4681
JK
1082 if (type_check == type_check_on)
1083 return_to_top_level (RETURN_ERROR);
c8023e66
JG
1084}
1085
1086void
73d3dbd4 1087#ifdef ANSI_PROTOTYPES
85c613aa
C
1088range_error (char *string, ...)
1089#else
c8023e66 1090range_error (va_alist)
7ed0f002 1091 va_dcl
85c613aa 1092#endif
c8023e66
JG
1093{
1094 va_list args;
73d3dbd4 1095#ifdef ANSI_PROTOTYPES
85c613aa
C
1096 va_start (args, string);
1097#else
c8023e66 1098 char *string;
85c613aa
C
1099 va_start (args);
1100 string = va_arg (args, char *);
1101#endif
c8023e66 1102
a0cf4681 1103 if (range_check == range_check_warn)
e16b9023 1104 fprintf_filtered (gdb_stderr, warning_pre_print);
c8023e66 1105 else
a0cf4681 1106 error_begin ();
c8023e66 1107
e16b9023
JK
1108 vfprintf_filtered (gdb_stderr, string, args);
1109 fprintf_filtered (gdb_stderr, "\n");
c8023e66 1110 va_end (args);
a0cf4681
JK
1111 if (range_check == range_check_on)
1112 return_to_top_level (RETURN_ERROR);
c8023e66
JG
1113}
1114
1115\f
1116/* This page contains miscellaneous functions */
1117
bf229b4e
FF
1118/* Return the language struct for a given language enum. */
1119
1120const struct language_defn *
1121language_def(lang)
1122 enum language lang;
1123{
1124 int i;
1125
1126 for (i = 0; i < languages_size; i++) {
1127 if (languages[i]->la_language == lang) {
1128 return languages[i];
1129 }
1130 }
1131 return NULL;
1132}
1133
c8023e66
JG
1134/* Return the language as a string */
1135char *
1136language_str(lang)
1137 enum language lang;
1138{
1139 int i;
1140
1141 for (i = 0; i < languages_size; i++) {
1142 if (languages[i]->la_language == lang) {
1143 return languages[i]->la_name;
1144 }
1145 }
1146 return "Unknown";
1147}
1148
c8023e66 1149static void
d8ce1326
JG
1150set_check (ignore, from_tty)
1151 char *ignore;
c8023e66
JG
1152 int from_tty;
1153{
199b2450 1154 printf_unfiltered(
c8023e66 1155"\"set check\" must be followed by the name of a check subcommand.\n");
199b2450 1156 help_list(setchecklist, "set check ", -1, gdb_stdout);
c8023e66
JG
1157}
1158
1159static void
be772100
JG
1160show_check (ignore, from_tty)
1161 char *ignore;
c8023e66
JG
1162 int from_tty;
1163{
1164 cmd_show_list(showchecklist, from_tty, "");
1165}
1166\f
1167/* Add a language to the set of known languages. */
1168
1169void
1170add_language (lang)
7ed0f002 1171 const struct language_defn *lang;
c8023e66
JG
1172{
1173 if (lang->la_magic != LANG_MAGIC)
1174 {
199b2450 1175 fprintf_unfiltered(gdb_stderr, "Magic number of %s language struct wrong\n",
c8023e66
JG
1176 lang->la_name);
1177 abort();
1178 }
1179
1180 if (!languages)
1181 {
1182 languages_allocsize = DEFAULT_ALLOCSIZE;
7ed0f002 1183 languages = (const struct language_defn **) xmalloc
c8023e66
JG
1184 (languages_allocsize * sizeof (*languages));
1185 }
1186 if (languages_size >= languages_allocsize)
1187 {
1188 languages_allocsize *= 2;
7ed0f002 1189 languages = (const struct language_defn **) xrealloc ((char *) languages,
c8023e66
JG
1190 languages_allocsize * sizeof (*languages));
1191 }
1192 languages[languages_size++] = lang;
c8023e66
JG
1193}
1194
1195/* Define the language that is no language. */
1196
7ed0f002 1197static int
c8023e66
JG
1198unk_lang_parser ()
1199{
1200 return 1;
1201}
1202
7ed0f002
JG
1203static void
1204unk_lang_error (msg)
1205 char *msg;
c8023e66
JG
1206{
1207 error ("Attempted to parse an expression with unknown language");
1208}
1209
5d074aa9
FF
1210static void
1211unk_lang_printchar (c, stream)
1212 register int c;
199b2450 1213 GDB_FILE *stream;
5d074aa9
FF
1214{
1215 error ("internal error - unimplemented function unk_lang_printchar called.");
1216}
1217
1218static void
1219unk_lang_printstr (stream, string, length, force_ellipses)
199b2450 1220 GDB_FILE *stream;
5d074aa9
FF
1221 char *string;
1222 unsigned int length;
1223 int force_ellipses;
1224{
1225 error ("internal error - unimplemented function unk_lang_printstr called.");
1226}
1227
bf229b4e
FF
1228static struct type *
1229unk_lang_create_fundamental_type (objfile, typeid)
1230 struct objfile *objfile;
1231 int typeid;
1232{
1233 error ("internal error - unimplemented function unk_lang_create_fundamental_type called.");
1234}
1235
b607efe7 1236static void
a8a69e63
FF
1237unk_lang_print_type (type, varstring, stream, show, level)
1238 struct type *type;
1239 char *varstring;
199b2450 1240 GDB_FILE *stream;
a8a69e63
FF
1241 int show;
1242 int level;
1243{
1244 error ("internal error - unimplemented function unk_lang_print_type called.");
1245}
1246
b607efe7 1247static int
a8a69e63
FF
1248unk_lang_val_print (type, valaddr, address, stream, format, deref_ref,
1249 recurse, pretty)
1250 struct type *type;
1251 char *valaddr;
1252 CORE_ADDR address;
199b2450 1253 GDB_FILE *stream;
a8a69e63
FF
1254 int format;
1255 int deref_ref;
1256 int recurse;
1257 enum val_prettyprint pretty;
1258{
1259 error ("internal error - unimplemented function unk_lang_val_print called.");
1260}
1261
b607efe7 1262static int
e10cfcaa
PB
1263unk_lang_value_print (val, stream, format, pretty)
1264 value_ptr val;
1265 GDB_FILE *stream;
1266 int format;
1267 enum val_prettyprint pretty;
1268{
1269 error ("internal error - unimplemented function unk_lang_value_print called.");
1270}
1271
8501c742 1272static struct type ** CONST_PTR (unknown_builtin_types[]) = { 0 };
a8a69e63 1273static const struct op_print unk_op_print_tab[] = {
8631194d 1274 {NULL, OP_NULL, PREC_NULL, 0}
a8a69e63 1275};
c8023e66
JG
1276
1277const struct language_defn unknown_language_defn = {
1278 "unknown",
1279 language_unknown,
1280 &unknown_builtin_types[0],
1281 range_check_off,
1282 type_check_off,
1283 unk_lang_parser,
1284 unk_lang_error,
7398958c 1285 evaluate_subexp_standard,
5d074aa9
FF
1286 unk_lang_printchar, /* Print character constant */
1287 unk_lang_printstr,
bf229b4e 1288 unk_lang_create_fundamental_type,
a8a69e63
FF
1289 unk_lang_print_type, /* Print a type using appropriate syntax */
1290 unk_lang_val_print, /* Print a value using appropriate syntax */
e10cfcaa 1291 unk_lang_value_print, /* Print a top-level value */
2e66cf7d 1292 {"", "", "", ""}, /* Binary format info */
5573d7d4
JK
1293 {"0%lo", "0", "o", ""}, /* Octal format info */
1294 {"%ld", "", "d", ""}, /* Decimal format info */
1295 {"0x%lx", "0x", "x", ""}, /* Hex format info */
c8023e66 1296 unk_op_print_tab, /* expression operators for printing */
acc4efde 1297 1, /* c-style arrays */
ead95f8a
PB
1298 0, /* String lower bound */
1299 &builtin_type_char, /* Type of string elements */
c8023e66
JG
1300 LANG_MAGIC
1301};
1302
1303/* These two structs define fake entries for the "local" and "auto" options. */
1304const struct language_defn auto_language_defn = {
1305 "auto",
1306 language_auto,
1307 &unknown_builtin_types[0],
1308 range_check_off,
1309 type_check_off,
1310 unk_lang_parser,
1311 unk_lang_error,
7398958c 1312 evaluate_subexp_standard,
5d074aa9
FF
1313 unk_lang_printchar, /* Print character constant */
1314 unk_lang_printstr,
bf229b4e 1315 unk_lang_create_fundamental_type,
a8a69e63
FF
1316 unk_lang_print_type, /* Print a type using appropriate syntax */
1317 unk_lang_val_print, /* Print a value using appropriate syntax */
e10cfcaa 1318 unk_lang_value_print, /* Print a top-level value */
2e66cf7d 1319 {"", "", "", ""}, /* Binary format info */
5573d7d4
JK
1320 {"0%lo", "0", "o", ""}, /* Octal format info */
1321 {"%ld", "", "d", ""}, /* Decimal format info */
1322 {"0x%lx", "0x", "x", ""}, /* Hex format info */
c8023e66 1323 unk_op_print_tab, /* expression operators for printing */
acc4efde 1324 1, /* c-style arrays */
ead95f8a
PB
1325 0, /* String lower bound */
1326 &builtin_type_char, /* Type of string elements */
c8023e66
JG
1327 LANG_MAGIC
1328};
1329
1330const struct language_defn local_language_defn = {
1331 "local",
1332 language_auto,
1333 &unknown_builtin_types[0],
1334 range_check_off,
1335 type_check_off,
1336 unk_lang_parser,
1337 unk_lang_error,
7398958c 1338 evaluate_subexp_standard,
5d074aa9
FF
1339 unk_lang_printchar, /* Print character constant */
1340 unk_lang_printstr,
bf229b4e 1341 unk_lang_create_fundamental_type,
a8a69e63
FF
1342 unk_lang_print_type, /* Print a type using appropriate syntax */
1343 unk_lang_val_print, /* Print a value using appropriate syntax */
e10cfcaa 1344 unk_lang_value_print, /* Print a top-level value */
2e66cf7d 1345 {"", "", "", ""}, /* Binary format info */
5573d7d4
JK
1346 {"0%lo", "0", "o", ""}, /* Octal format info */
1347 {"%ld", "", "d", ""}, /* Decimal format info */
1348 {"0x%lx", "0x", "x", ""}, /* Hex format info */
c8023e66 1349 unk_op_print_tab, /* expression operators for printing */
acc4efde 1350 1, /* c-style arrays */
ead95f8a
PB
1351 0, /* String lower bound */
1352 &builtin_type_char, /* Type of string elements */
c8023e66
JG
1353 LANG_MAGIC
1354};
1355\f
1356/* Initialize the language routines */
1357
1358void
1359_initialize_language()
1360{
1361 struct cmd_list_element *set, *show;
1362
1363 /* GDB commands for language specific stuff */
1364
1365 set = add_set_cmd ("language", class_support, var_string_noescape,
1366 (char *)&language,
0b798409 1367 "Set the current source language.",
c8023e66
JG
1368 &setlist);
1369 show = add_show_from_set (set, &showlist);
1ab3bf1b
JG
1370 set->function.cfunc = set_language_command;
1371 show->function.cfunc = show_language_command;
c8023e66
JG
1372
1373 add_prefix_cmd ("check", no_class, set_check,
1374 "Set the status of the type/range checker",
1375 &setchecklist, "set check ", 0, &setlist);
1376 add_alias_cmd ("c", "check", no_class, 1, &setlist);
1377 add_alias_cmd ("ch", "check", no_class, 1, &setlist);
1378
1379 add_prefix_cmd ("check", no_class, show_check,
1380 "Show the status of the type/range checker",
7cb83757 1381 &showchecklist, "show check ", 0, &showlist);
c8023e66
JG
1382 add_alias_cmd ("c", "check", no_class, 1, &showlist);
1383 add_alias_cmd ("ch", "check", no_class, 1, &showlist);
1384
1385 set = add_set_cmd ("type", class_support, var_string_noescape,
1386 (char *)&type,
7cb83757 1387 "Set type checking. (on/warn/off/auto)",
c8023e66
JG
1388 &setchecklist);
1389 show = add_show_from_set (set, &showchecklist);
1ab3bf1b
JG
1390 set->function.cfunc = set_type_command;
1391 show->function.cfunc = show_type_command;
c8023e66
JG
1392
1393 set = add_set_cmd ("range", class_support, var_string_noescape,
1394 (char *)&range,
7cb83757 1395 "Set range checking. (on/warn/off/auto)",
c8023e66
JG
1396 &setchecklist);
1397 show = add_show_from_set (set, &showchecklist);
1ab3bf1b
JG
1398 set->function.cfunc = set_range_command;
1399 show->function.cfunc = show_range_command;
c8023e66
JG
1400
1401 add_language (&unknown_language_defn);
1402 add_language (&local_language_defn);
1403 add_language (&auto_language_defn);
1404
1405 language = savestring ("auto",strlen("auto"));
1406 range = savestring ("auto",strlen("auto"));
1407 type = savestring ("auto",strlen("auto"));
1408
1409 /* Have the above take effect */
1410
5f3d478e 1411 set_language_command (language, 0);
c8023e66
JG
1412 set_type_command (NULL, 0);
1413 set_range_command (NULL, 0);
1414}
This page took 0.42164 seconds and 4 git commands to generate.