binutils-gdb/gdb/m2-lang.c

471 lines
13 KiB
C
Raw Normal View History

/* Modula 2 language support routines for GDB, the GNU debugger.
Copyright 1992 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
1995-08-02 05:41:12 +02:00
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#include "parser-defs.h"
#include "language.h"
#include "m2-lang.h"
#include "c-lang.h"
static struct type *m2_create_fundamental_type PARAMS ((struct objfile *, int));
static void m2_printstr PARAMS ((GDB_FILE *, char *, unsigned int, int));
static void m2_printchar PARAMS ((int, GDB_FILE *));
static void emit_char PARAMS ((int, GDB_FILE *, int));
/* Print the character C on STREAM as part of the contents of a literal
string whose delimiter is QUOTER. Note that that format for printing
characters and strings is language specific.
FIXME: This is a copy of the same function from c-exp.y. It should
be replaced with a true Modula version.
*/
static void
emit_char (c, stream, quoter)
register int c;
GDB_FILE *stream;
int quoter;
{
c &= 0xFF; /* Avoid sign bit follies */
if (PRINT_LITERAL_FORM (c))
{
if (c == '\\' || c == quoter)
{
fputs_filtered ("\\", stream);
}
fprintf_filtered (stream, "%c", c);
}
else
{
switch (c)
{
case '\n':
fputs_filtered ("\\n", stream);
break;
case '\b':
fputs_filtered ("\\b", stream);
break;
case '\t':
fputs_filtered ("\\t", stream);
break;
case '\f':
fputs_filtered ("\\f", stream);
break;
case '\r':
fputs_filtered ("\\r", stream);
break;
case '\033':
fputs_filtered ("\\e", stream);
break;
case '\007':
fputs_filtered ("\\a", stream);
break;
default:
fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
break;
}
}
}
/* FIXME: This is a copy of the same function from c-exp.y. It should
be replaced with a true Modula version. */
static void
m2_printchar (c, stream)
int c;
GDB_FILE *stream;
{
fputs_filtered ("'", stream);
emit_char (c, stream, '\'');
fputs_filtered ("'", stream);
}
/* Print the character string STRING, printing at most LENGTH characters.
Printing stops early if the number hits print_max; repeat counts
are printed as appropriate. Print ellipses at the end if we
had to stop before printing LENGTH characters, or if FORCE_ELLIPSES.
FIXME: This is a copy of the same function from c-exp.y. It should
be replaced with a true Modula version. */
static void
m2_printstr (stream, string, length, force_ellipses)
GDB_FILE *stream;
char *string;
unsigned int length;
int force_ellipses;
{
register unsigned int i;
unsigned int things_printed = 0;
int in_quotes = 0;
int need_comma = 0;
extern int inspect_it;
extern int repeat_count_threshold;
extern int print_max;
if (length == 0)
{
fputs_filtered ("\"\"", gdb_stdout);
return;
}
for (i = 0; i < length && things_printed < print_max; ++i)
{
/* Position of the character we are examining
to see whether it is repeated. */
unsigned int rep1;
/* Number of repetitions we have detected so far. */
unsigned int reps;
QUIT;
if (need_comma)
{
fputs_filtered (", ", stream);
need_comma = 0;
}
rep1 = i + 1;
reps = 1;
while (rep1 < length && string[rep1] == string[i])
{
++rep1;
++reps;
}
if (reps > repeat_count_threshold)
{
if (in_quotes)
{
if (inspect_it)
fputs_filtered ("\\\", ", stream);
else
fputs_filtered ("\", ", stream);
in_quotes = 0;
}
m2_printchar (string[i], stream);
fprintf_filtered (stream, " <repeats %u times>", reps);
i = rep1 - 1;
things_printed += repeat_count_threshold;
need_comma = 1;
}
else
{
if (!in_quotes)
{
if (inspect_it)
fputs_filtered ("\\\"", stream);
else
fputs_filtered ("\"", stream);
in_quotes = 1;
}
emit_char (string[i], stream, '"');
++things_printed;
}
}
/* Terminate the quotes if necessary. */
if (in_quotes)
{
if (inspect_it)
fputs_filtered ("\\\"", stream);
else
fputs_filtered ("\"", stream);
}
if (force_ellipses || i < length)
fputs_filtered ("...", stream);
}
/* FIXME: This is a copy of c_create_fundamental_type(), before
all the non-C types were stripped from it. Needs to be fixed
by an experienced Modula programmer. */
static struct type *
m2_create_fundamental_type (objfile, typeid)
struct objfile *objfile;
int typeid;
{
register struct type *type = NULL;
switch (typeid)
{
default:
/* FIXME: For now, if we are asked to produce a type not in this
language, create the equivalent of a C integer type with the
name "<?type?>". When all the dust settles from the type
reconstruction work, this should probably become an error. */
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
0, "<?type?>", objfile);
warning ("internal error: no Modula fundamental type %d", typeid);
break;
case FT_VOID:
type = init_type (TYPE_CODE_VOID,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0, "void", objfile);
break;
case FT_BOOLEAN:
type = init_type (TYPE_CODE_BOOL,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "boolean", objfile);
break;
case FT_STRING:
* c-exp.y (exp:STRING): Convert C strings into array-of-char constants with an explicit null byte terminator. OP_STRING is now used for real string types. * c-lang.c (builtin_type_*): Move declarations to lang.c since they are used by all languages. * c-lang.c (_initialize_c_language): Move initializations of builtin_type_* to lang.c. * c-typeprint.c (c_type_print_varspec_prefix, c_type_print_varspec_suffix): TYPE_CODE_PASCAL_ARRAY renamed to TYPE_CODE_STRING. * c-valprint.c (c_val_print): Change the way character arrays are printed as strings to be consistent with the way strings are printed when pointer-to-char types are dereferenced. Remove test of print_max before calling val_print_string, which now does it's own test. * eval.c (evaluate_subexp): Add case for OP_ARRAY. * expprint.c (print_subexp, dump_expression): Add case for OP_ARRAY. * expression.h (enum exp_opcode): Add OP_ARRAY and document. * gdbtypes.c (builtin_type_*): Add declarations moved from c-lang.c. * gdbtypes.c (create_string_type): New function to create real string types. * gdbtypes.c (recursive_dump_type): TYPE_CODE_PASCAL_ARRAY renamed to TYPE_CODE_STRING. * gdbtypes.c (_initialize_gdbtypes): Add initializations of builtin_type_* types moved from c-lang.c. * gdbtypes.h (enum type_code): TYPE_CODE_PASCAL_ARRAY renamed to TYPE_CODE_STRING. * gdbtypes.h (builtin_type_string): Add extern declaration. * gdbtypes.h (create_string_type): Add prototype. * m2-lang.c (m2_create_fundamental_type): TYPE_CODE_PASCAL_ARRAY renamed to TYPE_CODE_STRING. * m88k-tdep.c (pushed_size): TYPE_CODE_PASCAL_ARRAY renamed to TYPE_CODE_STRING. * mipsread.c (_initialize_mipsread): TYPE_CODE_PASCAL_ARRAY renamed to TYPE_CODE_STRING. * parse.c (length_of_subexp, prefixify_subexp): Add case for OP_ARRAY. * printcmd.c (print_formatted): Recognize TYPE_CODE_STRING. * typeprint.c (print_type_scalar): TYPE_CODE_PASCAL_ARRAY renamed to TYPE_CODE_STRING. * valops.c (allocate_space_in_inferior): New function and prototype, using code ripped out of value_string. * valops.c (value_string): Rewritten to use new function allocate_space_in_inferior, but temporarily disabled until some other support is in place. * valops.c (value_array): New function to create array constants. * valprint.c (val_print_string): Add comment to document use, complete rewrite to fix several small buglets. * value.h (value_array): Add prototype. * value.h (val_print_string): Change prototype to match rewrite. **** start-sanitize-chill **** * ch-valprint.c (chill_val_print): Add case for TYPE_CODE_STRING. * ch-exp.y (match_character_literal): Disable recognition of control sequence form of character literals and document why. **** end-sanitize-chill ****
1993-01-16 06:15:58 +01:00
type = init_type (TYPE_CODE_STRING,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0, "string", objfile);
break;
case FT_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0, "char", objfile);
break;
case FT_SIGNED_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0, "signed char", objfile);
break;
case FT_UNSIGNED_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
break;
case FT_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
0, "short", objfile);
break;
case FT_SIGNED_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
0, "short", objfile); /* FIXME-fnf */
break;
case FT_UNSIGNED_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
break;
case FT_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
0, "int", objfile);
break;
case FT_SIGNED_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
0, "int", objfile); /* FIXME -fnf */
break;
case FT_UNSIGNED_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
break;
case FT_FIXED_DECIMAL:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
0, "fixed decimal", objfile);
break;
case FT_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
0, "long", objfile);
break;
case FT_SIGNED_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
0, "long", objfile); /* FIXME -fnf */
break;
case FT_UNSIGNED_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
break;
case FT_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
0, "long long", objfile);
break;
case FT_SIGNED_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
0, "signed long long", objfile);
break;
case FT_UNSIGNED_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
break;
case FT_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
0, "float", objfile);
break;
case FT_DBL_PREC_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
0, "double", objfile);
break;
case FT_FLOAT_DECIMAL:
type = init_type (TYPE_CODE_FLT,
TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
0, "floating decimal", objfile);
break;
case FT_EXT_PREC_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
0, "long double", objfile);
break;
case FT_COMPLEX:
* eval.c (evaluate_subexp): Clean up handling of OP_UNDETERMINED_ARGLIST (no backtracking, more general). * f-valprint.c (f_val_print): Print TYPE_CODE_STRING using LA_PRINT_STRING, and not val_print_string (which reads from inferior). * ch-lang.c (chill_is_varying_struct), ch-lang.h: Remve function duplicate function made redundant by chill_varying_type. Re-write of f77 string and complex number support: * language.h (struct language_defn): New fields string_lower_bound and string_char_type. * c-lang.c (c_language_defn, cplus_language_defn, asm_language_defn), language.c (unknown_language_defn, auto_language_defn, local_language_defn), m2-lang.c (m2_language_defn), f-lang.c (f_language_defn), ch-lang.c (chill_language_defn): Set new fields. * gdbtypes.c (create_string_type): Use new string_char_type field. * valops.c (value_string): Use new string_lower_bound field. * defs.h (TARGET_COMPLEX_BIT, TARGET_DOUBLE_COMPLEX_BIT): Removed. * f-lang.c (f_create_fundamental_type, _initialize_f_language), m2-lang.c (m2_create_fundamental_type), gdbtypes.c (_initialize_gdbtypes): Set TYPE_TARGET_TYPE of complex types. Set their TYPE_CODEs to TYPE_CODE_COMPLEX. * mdebugread.c (mdebug_type_complex, mdebug_type_double_complex): Removed. Use builtin_type_complex and builtin_type_double_complex. * gdbtypes.h (enum type_code): Removed TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * c-typeprint.c, f-typeprint.c, f-valprint.c, eval.c: Removed uses of TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * gdbtypes.c, gdbtypes.h (f77_create_literal_complex_type, f77_create_literal_string_type): Removed. * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_MEMADDR, VALUE_SUBSTRING_MYADDR): Removed. * expression.h (enum exp_opcode): Rename OP_F77_LITERAL_COMPLEX to OP_COMPLEX. * parse.c: Update accordingly. * f-valprint.c (f77_print_cmplx): Removed. (f_val_print case TYPE_CODE_COMPLEX): Re-write to use print_floating. * f-exp.y (STRING_LITERAL): Use OP_STRING instead of OP_ARRAY. * eval.c (evaluate_subexp): For case OP_ARRAY, don't call f77_value_literal_string. * valops.c, value.h (f77_value_literal_string, f77_value_substring, f77_assign_from_literal_string, f77_assign_from_literal_complex): Removed. (value_assign): No longer need to handle literal types. * valops.c (f77_value_literal_complex), value.h: Re-written and renamed to value_literal_complex. Last arg is now a (complex) type. * valops.c (f77_cast_into_complex): Re-written and renamed to cast_into_complex. * eval.c (evaluate_subexp): Update accordingly.
1995-02-02 04:37:26 +01:00
type = init_type (TYPE_CODE_COMPLEX,
2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
0, "complex", objfile);
* eval.c (evaluate_subexp): Clean up handling of OP_UNDETERMINED_ARGLIST (no backtracking, more general). * f-valprint.c (f_val_print): Print TYPE_CODE_STRING using LA_PRINT_STRING, and not val_print_string (which reads from inferior). * ch-lang.c (chill_is_varying_struct), ch-lang.h: Remve function duplicate function made redundant by chill_varying_type. Re-write of f77 string and complex number support: * language.h (struct language_defn): New fields string_lower_bound and string_char_type. * c-lang.c (c_language_defn, cplus_language_defn, asm_language_defn), language.c (unknown_language_defn, auto_language_defn, local_language_defn), m2-lang.c (m2_language_defn), f-lang.c (f_language_defn), ch-lang.c (chill_language_defn): Set new fields. * gdbtypes.c (create_string_type): Use new string_char_type field. * valops.c (value_string): Use new string_lower_bound field. * defs.h (TARGET_COMPLEX_BIT, TARGET_DOUBLE_COMPLEX_BIT): Removed. * f-lang.c (f_create_fundamental_type, _initialize_f_language), m2-lang.c (m2_create_fundamental_type), gdbtypes.c (_initialize_gdbtypes): Set TYPE_TARGET_TYPE of complex types. Set their TYPE_CODEs to TYPE_CODE_COMPLEX. * mdebugread.c (mdebug_type_complex, mdebug_type_double_complex): Removed. Use builtin_type_complex and builtin_type_double_complex. * gdbtypes.h (enum type_code): Removed TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * c-typeprint.c, f-typeprint.c, f-valprint.c, eval.c: Removed uses of TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * gdbtypes.c, gdbtypes.h (f77_create_literal_complex_type, f77_create_literal_string_type): Removed. * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_MEMADDR, VALUE_SUBSTRING_MYADDR): Removed. * expression.h (enum exp_opcode): Rename OP_F77_LITERAL_COMPLEX to OP_COMPLEX. * parse.c: Update accordingly. * f-valprint.c (f77_print_cmplx): Removed. (f_val_print case TYPE_CODE_COMPLEX): Re-write to use print_floating. * f-exp.y (STRING_LITERAL): Use OP_STRING instead of OP_ARRAY. * eval.c (evaluate_subexp): For case OP_ARRAY, don't call f77_value_literal_string. * valops.c, value.h (f77_value_literal_string, f77_value_substring, f77_assign_from_literal_string, f77_assign_from_literal_complex): Removed. (value_assign): No longer need to handle literal types. * valops.c (f77_value_literal_complex), value.h: Re-written and renamed to value_literal_complex. Last arg is now a (complex) type. * valops.c (f77_cast_into_complex): Re-written and renamed to cast_into_complex. * eval.c (evaluate_subexp): Update accordingly.
1995-02-02 04:37:26 +01:00
TYPE_TARGET_TYPE (type)
= m2_create_fundamental_type (objfile, FT_FLOAT);
break;
case FT_DBL_PREC_COMPLEX:
* eval.c (evaluate_subexp): Clean up handling of OP_UNDETERMINED_ARGLIST (no backtracking, more general). * f-valprint.c (f_val_print): Print TYPE_CODE_STRING using LA_PRINT_STRING, and not val_print_string (which reads from inferior). * ch-lang.c (chill_is_varying_struct), ch-lang.h: Remve function duplicate function made redundant by chill_varying_type. Re-write of f77 string and complex number support: * language.h (struct language_defn): New fields string_lower_bound and string_char_type. * c-lang.c (c_language_defn, cplus_language_defn, asm_language_defn), language.c (unknown_language_defn, auto_language_defn, local_language_defn), m2-lang.c (m2_language_defn), f-lang.c (f_language_defn), ch-lang.c (chill_language_defn): Set new fields. * gdbtypes.c (create_string_type): Use new string_char_type field. * valops.c (value_string): Use new string_lower_bound field. * defs.h (TARGET_COMPLEX_BIT, TARGET_DOUBLE_COMPLEX_BIT): Removed. * f-lang.c (f_create_fundamental_type, _initialize_f_language), m2-lang.c (m2_create_fundamental_type), gdbtypes.c (_initialize_gdbtypes): Set TYPE_TARGET_TYPE of complex types. Set their TYPE_CODEs to TYPE_CODE_COMPLEX. * mdebugread.c (mdebug_type_complex, mdebug_type_double_complex): Removed. Use builtin_type_complex and builtin_type_double_complex. * gdbtypes.h (enum type_code): Removed TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * c-typeprint.c, f-typeprint.c, f-valprint.c, eval.c: Removed uses of TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * gdbtypes.c, gdbtypes.h (f77_create_literal_complex_type, f77_create_literal_string_type): Removed. * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_MEMADDR, VALUE_SUBSTRING_MYADDR): Removed. * expression.h (enum exp_opcode): Rename OP_F77_LITERAL_COMPLEX to OP_COMPLEX. * parse.c: Update accordingly. * f-valprint.c (f77_print_cmplx): Removed. (f_val_print case TYPE_CODE_COMPLEX): Re-write to use print_floating. * f-exp.y (STRING_LITERAL): Use OP_STRING instead of OP_ARRAY. * eval.c (evaluate_subexp): For case OP_ARRAY, don't call f77_value_literal_string. * valops.c, value.h (f77_value_literal_string, f77_value_substring, f77_assign_from_literal_string, f77_assign_from_literal_complex): Removed. (value_assign): No longer need to handle literal types. * valops.c (f77_value_literal_complex), value.h: Re-written and renamed to value_literal_complex. Last arg is now a (complex) type. * valops.c (f77_cast_into_complex): Re-written and renamed to cast_into_complex. * eval.c (evaluate_subexp): Update accordingly.
1995-02-02 04:37:26 +01:00
type = init_type (TYPE_CODE_COMPLEX,
2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
0, "double complex", objfile);
* eval.c (evaluate_subexp): Clean up handling of OP_UNDETERMINED_ARGLIST (no backtracking, more general). * f-valprint.c (f_val_print): Print TYPE_CODE_STRING using LA_PRINT_STRING, and not val_print_string (which reads from inferior). * ch-lang.c (chill_is_varying_struct), ch-lang.h: Remve function duplicate function made redundant by chill_varying_type. Re-write of f77 string and complex number support: * language.h (struct language_defn): New fields string_lower_bound and string_char_type. * c-lang.c (c_language_defn, cplus_language_defn, asm_language_defn), language.c (unknown_language_defn, auto_language_defn, local_language_defn), m2-lang.c (m2_language_defn), f-lang.c (f_language_defn), ch-lang.c (chill_language_defn): Set new fields. * gdbtypes.c (create_string_type): Use new string_char_type field. * valops.c (value_string): Use new string_lower_bound field. * defs.h (TARGET_COMPLEX_BIT, TARGET_DOUBLE_COMPLEX_BIT): Removed. * f-lang.c (f_create_fundamental_type, _initialize_f_language), m2-lang.c (m2_create_fundamental_type), gdbtypes.c (_initialize_gdbtypes): Set TYPE_TARGET_TYPE of complex types. Set their TYPE_CODEs to TYPE_CODE_COMPLEX. * mdebugread.c (mdebug_type_complex, mdebug_type_double_complex): Removed. Use builtin_type_complex and builtin_type_double_complex. * gdbtypes.h (enum type_code): Removed TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * c-typeprint.c, f-typeprint.c, f-valprint.c, eval.c: Removed uses of TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * gdbtypes.c, gdbtypes.h (f77_create_literal_complex_type, f77_create_literal_string_type): Removed. * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_MEMADDR, VALUE_SUBSTRING_MYADDR): Removed. * expression.h (enum exp_opcode): Rename OP_F77_LITERAL_COMPLEX to OP_COMPLEX. * parse.c: Update accordingly. * f-valprint.c (f77_print_cmplx): Removed. (f_val_print case TYPE_CODE_COMPLEX): Re-write to use print_floating. * f-exp.y (STRING_LITERAL): Use OP_STRING instead of OP_ARRAY. * eval.c (evaluate_subexp): For case OP_ARRAY, don't call f77_value_literal_string. * valops.c, value.h (f77_value_literal_string, f77_value_substring, f77_assign_from_literal_string, f77_assign_from_literal_complex): Removed. (value_assign): No longer need to handle literal types. * valops.c (f77_value_literal_complex), value.h: Re-written and renamed to value_literal_complex. Last arg is now a (complex) type. * valops.c (f77_cast_into_complex): Re-written and renamed to cast_into_complex. * eval.c (evaluate_subexp): Update accordingly.
1995-02-02 04:37:26 +01:00
TYPE_TARGET_TYPE (type)
= m2_create_fundamental_type (objfile, FT_DBL_PREC_FLOAT);
break;
case FT_EXT_PREC_COMPLEX:
* eval.c (evaluate_subexp): Clean up handling of OP_UNDETERMINED_ARGLIST (no backtracking, more general). * f-valprint.c (f_val_print): Print TYPE_CODE_STRING using LA_PRINT_STRING, and not val_print_string (which reads from inferior). * ch-lang.c (chill_is_varying_struct), ch-lang.h: Remve function duplicate function made redundant by chill_varying_type. Re-write of f77 string and complex number support: * language.h (struct language_defn): New fields string_lower_bound and string_char_type. * c-lang.c (c_language_defn, cplus_language_defn, asm_language_defn), language.c (unknown_language_defn, auto_language_defn, local_language_defn), m2-lang.c (m2_language_defn), f-lang.c (f_language_defn), ch-lang.c (chill_language_defn): Set new fields. * gdbtypes.c (create_string_type): Use new string_char_type field. * valops.c (value_string): Use new string_lower_bound field. * defs.h (TARGET_COMPLEX_BIT, TARGET_DOUBLE_COMPLEX_BIT): Removed. * f-lang.c (f_create_fundamental_type, _initialize_f_language), m2-lang.c (m2_create_fundamental_type), gdbtypes.c (_initialize_gdbtypes): Set TYPE_TARGET_TYPE of complex types. Set their TYPE_CODEs to TYPE_CODE_COMPLEX. * mdebugread.c (mdebug_type_complex, mdebug_type_double_complex): Removed. Use builtin_type_complex and builtin_type_double_complex. * gdbtypes.h (enum type_code): Removed TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * c-typeprint.c, f-typeprint.c, f-valprint.c, eval.c: Removed uses of TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * gdbtypes.c, gdbtypes.h (f77_create_literal_complex_type, f77_create_literal_string_type): Removed. * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_MEMADDR, VALUE_SUBSTRING_MYADDR): Removed. * expression.h (enum exp_opcode): Rename OP_F77_LITERAL_COMPLEX to OP_COMPLEX. * parse.c: Update accordingly. * f-valprint.c (f77_print_cmplx): Removed. (f_val_print case TYPE_CODE_COMPLEX): Re-write to use print_floating. * f-exp.y (STRING_LITERAL): Use OP_STRING instead of OP_ARRAY. * eval.c (evaluate_subexp): For case OP_ARRAY, don't call f77_value_literal_string. * valops.c, value.h (f77_value_literal_string, f77_value_substring, f77_assign_from_literal_string, f77_assign_from_literal_complex): Removed. (value_assign): No longer need to handle literal types. * valops.c (f77_value_literal_complex), value.h: Re-written and renamed to value_literal_complex. Last arg is now a (complex) type. * valops.c (f77_cast_into_complex): Re-written and renamed to cast_into_complex. * eval.c (evaluate_subexp): Update accordingly.
1995-02-02 04:37:26 +01:00
type = init_type (TYPE_CODE_COMPLEX,
2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
0, "long double complex", objfile);
* eval.c (evaluate_subexp): Clean up handling of OP_UNDETERMINED_ARGLIST (no backtracking, more general). * f-valprint.c (f_val_print): Print TYPE_CODE_STRING using LA_PRINT_STRING, and not val_print_string (which reads from inferior). * ch-lang.c (chill_is_varying_struct), ch-lang.h: Remve function duplicate function made redundant by chill_varying_type. Re-write of f77 string and complex number support: * language.h (struct language_defn): New fields string_lower_bound and string_char_type. * c-lang.c (c_language_defn, cplus_language_defn, asm_language_defn), language.c (unknown_language_defn, auto_language_defn, local_language_defn), m2-lang.c (m2_language_defn), f-lang.c (f_language_defn), ch-lang.c (chill_language_defn): Set new fields. * gdbtypes.c (create_string_type): Use new string_char_type field. * valops.c (value_string): Use new string_lower_bound field. * defs.h (TARGET_COMPLEX_BIT, TARGET_DOUBLE_COMPLEX_BIT): Removed. * f-lang.c (f_create_fundamental_type, _initialize_f_language), m2-lang.c (m2_create_fundamental_type), gdbtypes.c (_initialize_gdbtypes): Set TYPE_TARGET_TYPE of complex types. Set their TYPE_CODEs to TYPE_CODE_COMPLEX. * mdebugread.c (mdebug_type_complex, mdebug_type_double_complex): Removed. Use builtin_type_complex and builtin_type_double_complex. * gdbtypes.h (enum type_code): Removed TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * c-typeprint.c, f-typeprint.c, f-valprint.c, eval.c: Removed uses of TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * gdbtypes.c, gdbtypes.h (f77_create_literal_complex_type, f77_create_literal_string_type): Removed. * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_MEMADDR, VALUE_SUBSTRING_MYADDR): Removed. * expression.h (enum exp_opcode): Rename OP_F77_LITERAL_COMPLEX to OP_COMPLEX. * parse.c: Update accordingly. * f-valprint.c (f77_print_cmplx): Removed. (f_val_print case TYPE_CODE_COMPLEX): Re-write to use print_floating. * f-exp.y (STRING_LITERAL): Use OP_STRING instead of OP_ARRAY. * eval.c (evaluate_subexp): For case OP_ARRAY, don't call f77_value_literal_string. * valops.c, value.h (f77_value_literal_string, f77_value_substring, f77_assign_from_literal_string, f77_assign_from_literal_complex): Removed. (value_assign): No longer need to handle literal types. * valops.c (f77_value_literal_complex), value.h: Re-written and renamed to value_literal_complex. Last arg is now a (complex) type. * valops.c (f77_cast_into_complex): Re-written and renamed to cast_into_complex. * eval.c (evaluate_subexp): Update accordingly.
1995-02-02 04:37:26 +01:00
TYPE_TARGET_TYPE (type)
= m2_create_fundamental_type (objfile, FT_EXT_PREC_FLOAT);
break;
}
return (type);
}
/* Table of operators and their precedences for printing expressions. */
* Makefile.in (VERSION): Bump to 4.7.4. * Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c, m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c. * Makefile.in (HFILES): Add valprint.h. * Makefile.in (OBS): Add typeprint.o, c-typeprint.o, m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o. * typeprint.c, typeprint.h: New files for language independent type printing functions. * c-typeprint.c, m2-typeprint.c: New files for language dependent type printing functions and definitions. * valprint.h: New include file for language independent value printing definitions. * c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language dependent value printing functions. * c-exp.y (production ptype): Add range_type variable and use new create_range_type function. * c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab), infcmd.c (path_var_name), language.c (unk_op_print_tab), m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent "const static" to ANSI-conformant "static const". * c-exp.y (c_create_fundamental_type): Remove unused nbytes. * c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type, and c_val_print. * c-lang.h (c_print_type, c_val_print): Add prototypes. * coffread.c (decode_type): Add range_type variable and call to new create_range_type function. * complaints.c (complain): Remove unused val variable. * complaints.c (_initialize_complaints): Make it void. * convex-tdep.c (value_of_trapped_internalvar): Add range_type variable and call new create_range_type function. * defs.h (enum val_prettyprint): Move enum from value.h to here so we can avoid having to include value.h just for prototypes that need the enum (thanks ANSI). * dwarfread.c (struct_type): Local anonymous_size variable is only used if !BITS_BIG_ENDIAN. * dwarfread.c (decode_subscript_data_item): Add rangetype variable and call new create_range_type function. * elfread.c (elf_symfile_read): Remove unused dbx and text_sect variables. * eval.c (evaluate_subexp): Remove unused local variable name and the statement with no side effects that initializes it. * expprint.c (print_subexp): Change local_printstr to LA_PRINT_STRING. * gdbtypes.c (create_range_type): New function that creates a range type using code fragments from object file readers as an example of what has to be initialized. * gdbtypes.c (create_array_type): Removed index_type, low_bound, and high_bound parameters, replaced with a single range_type parameter. Change function body to use passed in range_type rather than handcrafting one. * gdbtypes.h (create_range_type): Add prototype. * gdbtypes.h (create_array_type): Change prototype parameters. * infrun.c (normal_stop): Remove unused local variables tem and c. * infrun.c (hook_stop_stub): Return 0 rather than random value. * language.c (unk_lang_print_type, unk_lang_val_print): Add stub functions that call error if called. * language.c (unknown_language_defn, auto_language_defn, local_language_defn): Add initializers unk_lang_print_type and unk_lang_val_print. * language.h (struct language_defn): Reformat for larger comments, add la_print_type and la_val_print members. Add LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING. * m2-lang.c (m2_create_fundamental_type): Remove unused local variable nbytes. * m2-lang.c (m2_language_defn): Add initializers m2_print_type and m2_val_print. * m2-lang.h (m2_print_type, m2_val_print): Add prototypes. * main.c (execute_command): Remove unused local variable cmdlines. * main.c (echo_command), stabsread.c (read_type), printcmd.c (clear_displays), symmisc.c (block_depth), values.c (clear_value_history): Make testing of truth value of assignment result explicit. * mipsread.c (upgrade_type): Update FIXME to include future use of create_range_type. * printcmd.c (ptype_command, ptype_eval, whatis_command, whatis_exp, maintenance_print_type): Move prototypes and functions to new typeprint.c. * printcmd.c (_initialize_printcmd): Move add_com calls for ptype_command and whatis_command to new typeprint.c. * ser-bsd.c (serial_open): Remove unused variable sgttyb. * source.c (find_source_lines): Local variable c only used when LSEEK_NOT_LINEAR is defined. * stabsread.c (read_array_type): Use new create_range_type function. * stabsread.c (read_range_type): Add new index_type variable and call new create_range_type function rather than handcrafting range types. * symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE. * symtab.c (typedef_print usages): Use c_typedef_print, renamed. * symtab.c (type_print_base usages): Use c_type_print_base. * symtab.c (type_print_varspec_prefix usages): Use c_type_print_varspec_prefix. * symtab.c (type_print_method_args usages): Use cp_type_print_method_args. * valprint.c: Completely ripped apart and the fragments used to create c-valprint.c, cp-valprint.c, m2-valprint.c, and valprint.h. Remaining stuff is language independent. * value.h (struct fn_field): Forward declare for prototypes. * value.h (type_print_1): Remove prototype. * value.h (enum val_prettyprint): Moved to defs.h. * value.h (typedef_print): Prototype renamed to c_typedef_print. * value.h (baseclass_offset): Add prototype. **** start-sanitize-chill **** * Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c. * Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o. * ch-typeprint.c: New file for language dependent type printing. * ch-valprint.c: New file for language dependent value printing. * ch-exp.y (parse_number): Remove prototype and stub function. * ch-exp.y (decode_integer_literal): Removed unused digits and temp variables. * ch-exp.y (convert_float): Completely ifdef out for now. * ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5), ch-lang.c (chill_op_print_tab): Change from ANSI-obsolescent "const static" to ANSI-conformant "static const". * ch-exp.y (yylex): Add unhandled storage class enumeration literals to switch statement for completeness. * ch-lang.c (chill_create_fundamental_types): Remove unused nbytes variable. Change dummy type to 2 bytes to match int. Handle FT_VOID types gratuituously added to chill DWARF by compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR type rather than a one byte TYPE_CODE_INT type. * ch-lang.c (chill_language_defn): Add chill_print_type and chill_val_print. * ch-lang.h (chill_print_type, chill_val_print): Add prototypes. **** end-sanitize-chill ****
1992-12-18 21:21:32 +01:00
static const struct op_print m2_op_print_tab[] = {
{"+", BINOP_ADD, PREC_ADD, 0},
{"+", UNOP_PLUS, PREC_PREFIX, 0},
{"-", BINOP_SUB, PREC_ADD, 0},
{"-", UNOP_NEG, PREC_PREFIX, 0},
{"*", BINOP_MUL, PREC_MUL, 0},
{"/", BINOP_DIV, PREC_MUL, 0},
{"DIV", BINOP_INTDIV, PREC_MUL, 0},
{"MOD", BINOP_REM, PREC_MUL, 0},
{":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
{"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
{"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
{"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
{"=", BINOP_EQUAL, PREC_EQUAL, 0},
{"<>", BINOP_NOTEQUAL, PREC_EQUAL, 0},
{"<=", BINOP_LEQ, PREC_ORDER, 0},
{">=", BINOP_GEQ, PREC_ORDER, 0},
{">", BINOP_GTR, PREC_ORDER, 0},
{"<", BINOP_LESS, PREC_ORDER, 0},
{"^", UNOP_IND, PREC_PREFIX, 0},
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
{"CAP", UNOP_CAP, PREC_BUILTIN_FUNCTION, 0},
{"CHR", UNOP_CHR, PREC_BUILTIN_FUNCTION, 0},
{"ORD", UNOP_ORD, PREC_BUILTIN_FUNCTION, 0},
{"FLOAT",UNOP_FLOAT, PREC_BUILTIN_FUNCTION, 0},
{"HIGH", UNOP_HIGH, PREC_BUILTIN_FUNCTION, 0},
{"MAX", UNOP_MAX, PREC_BUILTIN_FUNCTION, 0},
{"MIN", UNOP_MIN, PREC_BUILTIN_FUNCTION, 0},
{"ODD", UNOP_ODD, PREC_BUILTIN_FUNCTION, 0},
{"TRUNC", UNOP_TRUNC, PREC_BUILTIN_FUNCTION, 0},
{NULL, 0, 0, 0}
};
/* The built-in types of Modula-2. */
struct type *builtin_type_m2_char;
struct type *builtin_type_m2_int;
struct type *builtin_type_m2_card;
struct type *builtin_type_m2_real;
struct type *builtin_type_m2_bool;
* defs.h: Define CONST_PTR as blank if compiling with Microsoft C, else it's `const'. * c-lang.c c-lang.h ch-lang.c f-lang.c language.c m2-lang.c scm-lang.c: Microsoft C can't hack const pointers. Use CONST_PTR macro instead. * configure configure.in defs.h: Use AC_C_CONST to figure out if the compiler supports const. Gets rid of some cruft in defs.h. * dwarf2read.c: <string.h> -> "gdb_string.h" * remote-sim.c: Add prototypes. Fix call to gdbsim_kill. * sparcl-tdep.c (download): Add prototypes to write_routine and start_routine args. * mswin/gdbwin.c: Don't include both varargs.h AND stdarg.h. Get rid of varargs.h Include string.h. * (gdbwin_update gdbwin_fputs regs_changed_f bpt_changed_f update): Fix prototypes, fix calls. * (update): Return value for catch_errors. * (run_execute_command togdb_command_from_tty togdb_command): Cleanup catching of errors from calls to execute_command. Also, dup command string to avoid modifying const strings. * (togdb_breakinfo_i_init togdb_breakinfo_i_next): Use 0 instead of NULL when see if b->address isn't set. * (bi_disable_bpt bi_enable_bpt bi_delete_all bi_delete_breakpoint): Add arg to calls to update. * (gui_command): Add prototype. * (mswin_query): Fix prototype. * (_initialize_gdbwin): Dup string to avoid modifying const. * (info_path togdb_get_info_path): Remove const from decls cuz this can't be const (it points at malloc'ed memory). * (togdb_searchpath): Remove const from path. Dup string to avoid modifying const strings. * rindex -> strrchr. * (gdbwin_list_symbols): Regexp param is const. * Fix lots of refs to psymtabs to deref correct pointers. * (togdb_set_breakpoint_sal): Call set_breakpoint_sal with sal, not &sal. * mswin/gdbwin.h (togdb_searchpath togdb_get_info_path toget_set_info_path): Fix prototypes to match reality. * mswin/gui.cpp: Define _beginthreadex and _endthreadex routines with proper prototypes. * mswin/iface.cpp (gdbwin_fputs): Define with correct number of args. * mswin/ser-win32s.c: Fix defs of min and max. * mswin/serdll32.c (OpenComm16): Make cbInQueue and cbOutQueue be USHORT. * (WriteComm16): Change lpBug from LPVOID to LPCSTR. * mswin/serdll32.h: Fix prototypes for OpenComm16 and WriteComm16.
1996-08-13 02:01:37 +02:00
struct type ** CONST_PTR (m2_builtin_types[]) =
{
&builtin_type_m2_char,
&builtin_type_m2_int,
&builtin_type_m2_card,
&builtin_type_m2_real,
&builtin_type_m2_bool,
0
};
const struct language_defn m2_language_defn = {
"modula-2",
language_m2,
m2_builtin_types,
range_check_on,
type_check_on,
m2_parse, /* parser */
m2_error, /* parser error function */
evaluate_subexp_standard,
m2_printchar, /* Print character constant */
m2_printstr, /* function to print string constant */
m2_create_fundamental_type, /* Create fundamental type in this language */
* Makefile.in (VERSION): Bump to 4.7.4. * Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c, m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c. * Makefile.in (HFILES): Add valprint.h. * Makefile.in (OBS): Add typeprint.o, c-typeprint.o, m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o. * typeprint.c, typeprint.h: New files for language independent type printing functions. * c-typeprint.c, m2-typeprint.c: New files for language dependent type printing functions and definitions. * valprint.h: New include file for language independent value printing definitions. * c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language dependent value printing functions. * c-exp.y (production ptype): Add range_type variable and use new create_range_type function. * c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab), infcmd.c (path_var_name), language.c (unk_op_print_tab), m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent "const static" to ANSI-conformant "static const". * c-exp.y (c_create_fundamental_type): Remove unused nbytes. * c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type, and c_val_print. * c-lang.h (c_print_type, c_val_print): Add prototypes. * coffread.c (decode_type): Add range_type variable and call to new create_range_type function. * complaints.c (complain): Remove unused val variable. * complaints.c (_initialize_complaints): Make it void. * convex-tdep.c (value_of_trapped_internalvar): Add range_type variable and call new create_range_type function. * defs.h (enum val_prettyprint): Move enum from value.h to here so we can avoid having to include value.h just for prototypes that need the enum (thanks ANSI). * dwarfread.c (struct_type): Local anonymous_size variable is only used if !BITS_BIG_ENDIAN. * dwarfread.c (decode_subscript_data_item): Add rangetype variable and call new create_range_type function. * elfread.c (elf_symfile_read): Remove unused dbx and text_sect variables. * eval.c (evaluate_subexp): Remove unused local variable name and the statement with no side effects that initializes it. * expprint.c (print_subexp): Change local_printstr to LA_PRINT_STRING. * gdbtypes.c (create_range_type): New function that creates a range type using code fragments from object file readers as an example of what has to be initialized. * gdbtypes.c (create_array_type): Removed index_type, low_bound, and high_bound parameters, replaced with a single range_type parameter. Change function body to use passed in range_type rather than handcrafting one. * gdbtypes.h (create_range_type): Add prototype. * gdbtypes.h (create_array_type): Change prototype parameters. * infrun.c (normal_stop): Remove unused local variables tem and c. * infrun.c (hook_stop_stub): Return 0 rather than random value. * language.c (unk_lang_print_type, unk_lang_val_print): Add stub functions that call error if called. * language.c (unknown_language_defn, auto_language_defn, local_language_defn): Add initializers unk_lang_print_type and unk_lang_val_print. * language.h (struct language_defn): Reformat for larger comments, add la_print_type and la_val_print members. Add LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING. * m2-lang.c (m2_create_fundamental_type): Remove unused local variable nbytes. * m2-lang.c (m2_language_defn): Add initializers m2_print_type and m2_val_print. * m2-lang.h (m2_print_type, m2_val_print): Add prototypes. * main.c (execute_command): Remove unused local variable cmdlines. * main.c (echo_command), stabsread.c (read_type), printcmd.c (clear_displays), symmisc.c (block_depth), values.c (clear_value_history): Make testing of truth value of assignment result explicit. * mipsread.c (upgrade_type): Update FIXME to include future use of create_range_type. * printcmd.c (ptype_command, ptype_eval, whatis_command, whatis_exp, maintenance_print_type): Move prototypes and functions to new typeprint.c. * printcmd.c (_initialize_printcmd): Move add_com calls for ptype_command and whatis_command to new typeprint.c. * ser-bsd.c (serial_open): Remove unused variable sgttyb. * source.c (find_source_lines): Local variable c only used when LSEEK_NOT_LINEAR is defined. * stabsread.c (read_array_type): Use new create_range_type function. * stabsread.c (read_range_type): Add new index_type variable and call new create_range_type function rather than handcrafting range types. * symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE. * symtab.c (typedef_print usages): Use c_typedef_print, renamed. * symtab.c (type_print_base usages): Use c_type_print_base. * symtab.c (type_print_varspec_prefix usages): Use c_type_print_varspec_prefix. * symtab.c (type_print_method_args usages): Use cp_type_print_method_args. * valprint.c: Completely ripped apart and the fragments used to create c-valprint.c, cp-valprint.c, m2-valprint.c, and valprint.h. Remaining stuff is language independent. * value.h (struct fn_field): Forward declare for prototypes. * value.h (type_print_1): Remove prototype. * value.h (enum val_prettyprint): Moved to defs.h. * value.h (typedef_print): Prototype renamed to c_typedef_print. * value.h (baseclass_offset): Add prototype. **** start-sanitize-chill **** * Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c. * Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o. * ch-typeprint.c: New file for language dependent type printing. * ch-valprint.c: New file for language dependent value printing. * ch-exp.y (parse_number): Remove prototype and stub function. * ch-exp.y (decode_integer_literal): Removed unused digits and temp variables. * ch-exp.y (convert_float): Completely ifdef out for now. * ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5), ch-lang.c (chill_op_print_tab): Change from ANSI-obsolescent "const static" to ANSI-conformant "static const". * ch-exp.y (yylex): Add unhandled storage class enumeration literals to switch statement for completeness. * ch-lang.c (chill_create_fundamental_types): Remove unused nbytes variable. Change dummy type to 2 bytes to match int. Handle FT_VOID types gratuituously added to chill DWARF by compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR type rather than a one byte TYPE_CODE_INT type. * ch-lang.c (chill_language_defn): Add chill_print_type and chill_val_print. * ch-lang.h (chill_print_type, chill_val_print): Add prototypes. **** end-sanitize-chill ****
1992-12-18 21:21:32 +01:00
m2_print_type, /* Print a type using appropriate syntax */
m2_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
{"", "", "", ""}, /* Binary format info */
Tue Sep 28 09:45:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * symmisc.c (print_symbol): Use %02x not %2x for LOC_CONST_BYTES. Clean up problems with targets and hosts that have 64 bit longs and pointers and 32 bit ints. * breakpoint.c, buildsym.c, c-lang.c, c-valprint.c, ch-lang.c, ch-valprint.c, core.c, cp-valprint.c, dbxread.c, exec.c, expprint.c, gdbtypes.c, infcmd.c, language.c, language.h, m2-lang.c, maint.c, mips-tdep.c, mipsread.c, partial-stab.h, printcmd.c, remote-vx.c, solib.c, source.c, stack.c, symfile.c, symmisc.c, symtab.c, valops.c, valprint.c, xcoffexec.c: Change all printf formats from %x to %lx if outputting an address. Change la_*_format to use long format. local_hex_string, local_hex_string_custom now take an unsigned long argument, change all callers. * coffread.c (read_coff_symtab): Remove superfluous cast for complaint output. * dbxread.c (end_psymtab): Cast MSYMBOL_INFO to long, not int. * findvar.c, value.h (write_register): Change register value to long. * gdbtypes.h (struct type): Change `bitsize' to long as TYPE_FIELD_STATIC_PHYSNAME uses this field as a pointer. * inferior.h (struct inferior_status): Change type of stop_pc to CORE_ADDR. * language.h (local_octal_string, local_octal_string_custom): Remove prototype, the functions are neither defined nor used. * mipsread.c (parse_symbol): Use temporary variable for bitsize as f->bitsize is a long now. * objfiles.c (add_to_objfile_sections, build_objfile_section_table): Use unsigned long casts instead of int for abusing sections_end pointer as integer. * stack.c (parse_frame_specification): Change type of `args' to CORE_ADDR for SETUP_ARBITRARY_FRAME. * printcmd.c (make_vasize): Allow redefinition via MAKEVA_SIZE. * mipsread.c (parse_type): Alpha cc now supports the t->continued bit, update algorithm to match the way the compiler uses it.
1993-09-28 18:43:25 +01:00
{"%loB", "", "o", "B"}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
{"0%lXH", "0", "X", "H"}, /* Hex format info */
m2_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
* eval.c (evaluate_subexp): Clean up handling of OP_UNDETERMINED_ARGLIST (no backtracking, more general). * f-valprint.c (f_val_print): Print TYPE_CODE_STRING using LA_PRINT_STRING, and not val_print_string (which reads from inferior). * ch-lang.c (chill_is_varying_struct), ch-lang.h: Remve function duplicate function made redundant by chill_varying_type. Re-write of f77 string and complex number support: * language.h (struct language_defn): New fields string_lower_bound and string_char_type. * c-lang.c (c_language_defn, cplus_language_defn, asm_language_defn), language.c (unknown_language_defn, auto_language_defn, local_language_defn), m2-lang.c (m2_language_defn), f-lang.c (f_language_defn), ch-lang.c (chill_language_defn): Set new fields. * gdbtypes.c (create_string_type): Use new string_char_type field. * valops.c (value_string): Use new string_lower_bound field. * defs.h (TARGET_COMPLEX_BIT, TARGET_DOUBLE_COMPLEX_BIT): Removed. * f-lang.c (f_create_fundamental_type, _initialize_f_language), m2-lang.c (m2_create_fundamental_type), gdbtypes.c (_initialize_gdbtypes): Set TYPE_TARGET_TYPE of complex types. Set their TYPE_CODEs to TYPE_CODE_COMPLEX. * mdebugread.c (mdebug_type_complex, mdebug_type_double_complex): Removed. Use builtin_type_complex and builtin_type_double_complex. * gdbtypes.h (enum type_code): Removed TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * c-typeprint.c, f-typeprint.c, f-valprint.c, eval.c: Removed uses of TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX. * gdbtypes.c, gdbtypes.h (f77_create_literal_complex_type, f77_create_literal_string_type): Removed. * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_MEMADDR, VALUE_SUBSTRING_MYADDR): Removed. * expression.h (enum exp_opcode): Rename OP_F77_LITERAL_COMPLEX to OP_COMPLEX. * parse.c: Update accordingly. * f-valprint.c (f77_print_cmplx): Removed. (f_val_print case TYPE_CODE_COMPLEX): Re-write to use print_floating. * f-exp.y (STRING_LITERAL): Use OP_STRING instead of OP_ARRAY. * eval.c (evaluate_subexp): For case OP_ARRAY, don't call f77_value_literal_string. * valops.c, value.h (f77_value_literal_string, f77_value_substring, f77_assign_from_literal_string, f77_assign_from_literal_complex): Removed. (value_assign): No longer need to handle literal types. * valops.c (f77_value_literal_complex), value.h: Re-written and renamed to value_literal_complex. Last arg is now a (complex) type. * valops.c (f77_cast_into_complex): Re-written and renamed to cast_into_complex. * eval.c (evaluate_subexp): Update accordingly.
1995-02-02 04:37:26 +01:00
0, /* String lower bound */
&builtin_type_m2_char, /* Type of string elements */
LANG_MAGIC
};
/* Initialization for Modula-2 */
void
_initialize_m2_language ()
{
/* Modula-2 "pervasive" types. NOTE: these can be redefined!!! */
builtin_type_m2_int =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
0,
"INTEGER", (struct objfile *) NULL);
builtin_type_m2_card =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"CARDINAL", (struct objfile *) NULL);
builtin_type_m2_real =
init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
0,
"REAL", (struct objfile *) NULL);
builtin_type_m2_char =
init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"CHAR", (struct objfile *) NULL);
builtin_type_m2_bool =
init_type (TYPE_CODE_BOOL, TARGET_INT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"BOOLEAN", (struct objfile *) NULL);
add_language (&m2_language_defn);
}