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