mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
* language.h (language_format_info): New structure to bundle
local formatting information. * language.h (language_defn): Replace individual format info with language_format_info structs. * language.h (local_*_format, local_*_format_prefix, local_*_format_specifier, local_*_format_suffix): New macros for binary/octal/decimal/hex formats to access info elements. * c-exp.y (c_language_defn): Update for new format handling. * m2-exp.y (m2_language_defn): Update for new format handling. * dbxread.c (language.h): Include for partial-stab.h use. * defs.h (local_hex_format, local_hex_format_custom, local_hex_string, local_hex_string_custom): Move to language.h. * language.c (local_hex_format_custom, local_hex_string, local_hex_string_custom, local_octal_format_custom): Use new format handling. * language.c (unknown_language_defn, auto_language_defn, local_language_defn): Update for new format handling. * printcmd.c (print_scalar_formatted): Use new macros to access decimal and binary format info for printing. **** start-sanitize-chill **** * c-exp.y (chill_language_defn): Update for new format handling. * ch-exp.y (CHARACTER_LITERAL): Add support to yylex. * ch-exp.y (match_integer_literal): Add function. * ch-exp.y (builtin_type_chill_char): Add definition. * gdbtypes.h (builtin_type_chill_char): Add declaration. **** end-sanitize-chill ****
This commit is contained in:
@ -1,3 +1,32 @@
|
||||
Wed Nov 18 14:27:47 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* language.h (language_format_info): New structure to bundle
|
||||
local formatting information.
|
||||
* language.h (language_defn): Replace individual format info
|
||||
with language_format_info structs.
|
||||
* language.h (local_*_format, local_*_format_prefix,
|
||||
local_*_format_specifier, local_*_format_suffix): New macros
|
||||
for binary/octal/decimal/hex formats to access info elements.
|
||||
* c-exp.y (c_language_defn): Update for new format handling.
|
||||
* m2-exp.y (m2_language_defn): Update for new format handling.
|
||||
* dbxread.c (language.h): Include for partial-stab.h use.
|
||||
* defs.h (local_hex_format, local_hex_format_custom,
|
||||
local_hex_string, local_hex_string_custom): Move to language.h.
|
||||
* language.c (local_hex_format_custom, local_hex_string,
|
||||
local_hex_string_custom, local_octal_format_custom): Use new
|
||||
format handling.
|
||||
* language.c (unknown_language_defn, auto_language_defn,
|
||||
local_language_defn): Update for new format handling.
|
||||
* printcmd.c (print_scalar_formatted): Use new macros
|
||||
to access decimal and binary format info for printing.
|
||||
**** start-sanitize-chill ****
|
||||
* c-exp.y (chill_language_defn): Update for new format handling.
|
||||
* ch-exp.y (CHARACTER_LITERAL): Add support to yylex.
|
||||
* ch-exp.y (match_integer_literal): Add function.
|
||||
* ch-exp.y (builtin_type_chill_char): Add definition.
|
||||
* gdbtypes.h (builtin_type_chill_char): Add declaration.
|
||||
**** end-sanitize-chill ****
|
||||
|
||||
Tue Nov 17 11:17:06 1992 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* tm-rs6000.h (BELIEVE_PCC_PROMOTION): Define, since AIX cc gets
|
||||
|
12
gdb/c-exp.y
12
gdb/c-exp.y
@ -1564,8 +1564,10 @@ const struct language_defn c_language_defn = {
|
||||
&BUILTIN_TYPE_LONGEST, /* longest signed integral type */
|
||||
&BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
|
||||
&builtin_type_double, /* longest floating point type */ /*FIXME*/
|
||||
"0x%x", "0x%", "x", /* Hex format, prefix, suffix */
|
||||
"0%o", "0%", "o", /* Octal format, prefix, suffix */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%o", "0", "o", ""}, /* Octal format info */
|
||||
{"%d", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%x", "0x", "x", ""}, /* Hex format info */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
LANG_MAGIC
|
||||
};
|
||||
@ -1581,8 +1583,10 @@ const struct language_defn cplus_language_defn = {
|
||||
&BUILTIN_TYPE_LONGEST, /* longest signed integral type */
|
||||
&BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
|
||||
&builtin_type_double, /* longest floating point type */ /*FIXME*/
|
||||
"0x%x", "0x%", "x", /* Hex format, prefix, suffix */
|
||||
"0%o", "0%", "o", /* Octal format, prefix, suffix */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%o", "0", "o", ""}, /* Octal format info */
|
||||
{"%d", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%x", "0x", "x", ""}, /* Hex format info */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
LANG_MAGIC
|
||||
};
|
||||
|
198
gdb/ch-exp.y
198
gdb/ch-exp.y
@ -150,7 +150,7 @@ static int parse_number PARAMS ((void));
|
||||
|
||||
%token <typed_val> INTEGER_LITERAL
|
||||
%token <ulval> BOOLEAN_LITERAL
|
||||
%token <voidval> CHARACTER_LITERAL
|
||||
%token <typed_val> CHARACTER_LITERAL
|
||||
%token <voidval> SET_LITERAL
|
||||
%token <voidval> EMPTINESS_LITERAL
|
||||
%token <voidval> CHARACTER_STRING_LITERAL
|
||||
@ -397,7 +397,10 @@ literal : INTEGER_LITERAL
|
||||
}
|
||||
| CHARACTER_LITERAL
|
||||
{
|
||||
$$ = 0; /* FIXME */
|
||||
write_exp_elt_opcode (OP_LONG);
|
||||
write_exp_elt_type ($1.type);
|
||||
write_exp_elt_longcst ((LONGEST) ($1.val));
|
||||
write_exp_elt_opcode (OP_LONG);
|
||||
}
|
||||
| SET_LITERAL
|
||||
{
|
||||
@ -762,34 +765,177 @@ buffer_location : FIXME { $$ = 0; }
|
||||
|
||||
%%
|
||||
|
||||
/* Recognize a character literal. */
|
||||
static int
|
||||
decode_integer_literal (valptr, tokptrptr)
|
||||
int *valptr;
|
||||
char **tokptrptr;
|
||||
{
|
||||
char *tokptr = *tokptrptr;
|
||||
int base = 0;
|
||||
int ival = 0;
|
||||
int digits = 0;
|
||||
int temp;
|
||||
int explicit_base = 0;
|
||||
|
||||
/* Look for an explicit base specifier, which is optional. */
|
||||
|
||||
switch (*tokptr)
|
||||
{
|
||||
case 'd':
|
||||
case 'D':
|
||||
explicit_base++;
|
||||
base = 10;
|
||||
tokptr++;
|
||||
break;
|
||||
case 'b':
|
||||
case 'B':
|
||||
explicit_base++;
|
||||
base = 2;
|
||||
tokptr++;
|
||||
break;
|
||||
case 'h':
|
||||
case 'H':
|
||||
explicit_base++;
|
||||
base = 16;
|
||||
tokptr++;
|
||||
break;
|
||||
case 'o':
|
||||
case 'O':
|
||||
explicit_base++;
|
||||
base = 8;
|
||||
tokptr++;
|
||||
break;
|
||||
default:
|
||||
base = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we found an explicit base ensure that the character after the
|
||||
explicit base is a single quote. */
|
||||
|
||||
if (explicit_base && (*tokptr++ != '\''))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Start looking for a value composed of valid digits as set by the base
|
||||
in use. Note that '_' characters are valid anywhere, in any quantity,
|
||||
and are simply ignored. Since we must find at least one valid digit,
|
||||
or reject this token as an integer literal, we keep track of how many
|
||||
digits we have encountered. */
|
||||
|
||||
while (*tokptr != '\0')
|
||||
{
|
||||
temp = tolower (*tokptr);
|
||||
tokptr++;
|
||||
switch (temp)
|
||||
{
|
||||
case '_':
|
||||
continue;
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
temp -= '0';
|
||||
break;
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
temp -= 'a';
|
||||
temp += 10;
|
||||
break;
|
||||
default:
|
||||
temp = base;
|
||||
break;
|
||||
}
|
||||
if (temp < base)
|
||||
{
|
||||
digits++;
|
||||
ival *= base;
|
||||
ival += temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Found something not in domain for current base. */
|
||||
tokptr--; /* Unconsume what gave us indigestion. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we didn't find any digits, then we don't have a valid integer
|
||||
literal, so reject the entire token. Also, if we have an explicit
|
||||
base, then the next character must not be a single quote, or we
|
||||
have a bitstring literal, so reject the entire token in this case
|
||||
as well. Otherwise, update the lexical scan pointer, and return
|
||||
non-zero for success. */
|
||||
|
||||
if (digits == 0)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
else if (explicit_base && (*tokptr == '\''))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
*valptr = ival;
|
||||
*tokptrptr = tokptr;
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Recognize a character literal. A character literal is single character
|
||||
or a control sequence, enclosed in single quotes. A control sequence
|
||||
is a comma separated list of one or more integer literals, enclosed
|
||||
in parenthesis and introduced with a circumflex character.
|
||||
|
||||
EX: 'a' '^(7)' '^(7,8)'
|
||||
|
||||
Returns CHARACTER_LITERAL if a match is found.
|
||||
*/
|
||||
|
||||
static int
|
||||
decode_character_literal ()
|
||||
match_character_literal ()
|
||||
{
|
||||
char *tokptr = lexptr;
|
||||
int ival = 0;
|
||||
|
||||
/* All character literals must start with a single quote. If we don't
|
||||
find it, don't bother looking any further. */
|
||||
|
||||
if (*tokptr++ != '\'')
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (*tokptr != '\\')
|
||||
{
|
||||
ival = *++tokptr;
|
||||
tokptr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Determine which form we have, either a control sequence or the
|
||||
single character form. */
|
||||
|
||||
}
|
||||
if (*++tokptr != '\'')
|
||||
if ((*tokptr == '^') && (*(tokptr + 1) == '('))
|
||||
{
|
||||
/* Match and decode a control sequence. Return zero if we don't
|
||||
find a valid integer literal, or if the next unconsumed character
|
||||
after the integer literal is not the trailing ')'.
|
||||
FIXME: We currently don't handle the multiple integer literal
|
||||
form. */
|
||||
tokptr += 2;
|
||||
if (!decode_integer_literal (&ival, &tokptr) || (*tokptr++ != ')'))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ival = *tokptr++;
|
||||
}
|
||||
|
||||
/* The trailing quote has not yet been consumed. If we don't find
|
||||
it, then we have no match. */
|
||||
|
||||
if (*tokptr++ != '\'')
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
yylval.typed_val.val = ival;
|
||||
yylval.typed_val.type = builtin_type_int;
|
||||
yylval.typed_val.type = builtin_type_chill_char;
|
||||
lexptr = tokptr;
|
||||
return (CHARACTER_LITERAL);
|
||||
}
|
||||
@ -800,7 +946,7 @@ decode_character_literal ()
|
||||
in any integer literal. */
|
||||
|
||||
static int
|
||||
decode_integer_literal ()
|
||||
match_integer_literal ()
|
||||
{
|
||||
char *tokptr = lexptr;
|
||||
int ival = 0;
|
||||
@ -867,8 +1013,7 @@ decode_integer_literal ()
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
temp -= '0';
|
||||
break;
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e':
|
||||
case 'f':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
temp -= 'a';
|
||||
temp += 10;
|
||||
break;
|
||||
@ -1028,8 +1173,10 @@ yylex ()
|
||||
token, such as a character literal. */
|
||||
switch (*lexptr)
|
||||
{
|
||||
case '^':
|
||||
case '\'':
|
||||
if ((token = decode_character_literal ()) != 0)
|
||||
token = match_character_literal ();
|
||||
if (token != 0)
|
||||
{
|
||||
return (token);
|
||||
}
|
||||
@ -1094,7 +1241,8 @@ yylex ()
|
||||
lexptr += 5;
|
||||
return (BOOLEAN_LITERAL);
|
||||
}
|
||||
if ((token = decode_integer_literal ()) != 0)
|
||||
token = match_integer_literal ();
|
||||
if (token != 0);
|
||||
{
|
||||
return (token);
|
||||
}
|
||||
@ -1143,6 +1291,7 @@ const static struct op_print chill_op_print_tab[] = {
|
||||
/* The built-in types of Chill. */
|
||||
|
||||
struct type *builtin_type_chill_bool;
|
||||
struct type *builtin_type_chill_char;
|
||||
struct type *builtin_type_chill_long;
|
||||
struct type *builtin_type_chill_ulong;
|
||||
struct type *builtin_type_chill_real;
|
||||
@ -1150,6 +1299,7 @@ struct type *builtin_type_chill_real;
|
||||
struct type ** const (chill_builtin_types[]) =
|
||||
{
|
||||
&builtin_type_chill_bool,
|
||||
&builtin_type_chill_char,
|
||||
&builtin_type_chill_long,
|
||||
&builtin_type_chill_ulong,
|
||||
&builtin_type_chill_real,
|
||||
@ -1167,8 +1317,10 @@ const struct language_defn chill_language_defn = {
|
||||
&BUILTIN_TYPE_LONGEST, /* longest signed integral type */
|
||||
&BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
|
||||
&builtin_type_chill_real, /* longest floating point type */
|
||||
"0x%x", "0x%", "x", /* Hex format, prefix, suffix */
|
||||
"0%o", "0%", "o", /* Octal format, prefix, suffix */
|
||||
{"", "B'", "", ""}, /* Binary format info */
|
||||
{"O'%o", "O'", "o", ""}, /* Octal format info */
|
||||
{"D'%d", "D'", "d", ""}, /* Decimal format info */
|
||||
{"H'%x", "H'", "x", ""}, /* Hex format info */
|
||||
chill_op_print_tab, /* expression operators for printing */
|
||||
LANG_MAGIC
|
||||
};
|
||||
@ -1182,6 +1334,10 @@ _initialize_chill_exp ()
|
||||
init_type (TYPE_CODE_BOOL, TARGET_INT_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED,
|
||||
"BOOL", (struct objfile *) NULL);
|
||||
builtin_type_chill_char =
|
||||
init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED,
|
||||
"CHAR", (struct objfile *) NULL);
|
||||
builtin_type_chill_long =
|
||||
init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
|
||||
0,
|
||||
|
@ -493,6 +493,7 @@ extern struct type *builtin_type_m2_bool;
|
||||
/* Chill types */
|
||||
|
||||
extern struct type *builtin_type_chill_bool;
|
||||
extern struct type *builtin_type_chill_char;
|
||||
extern struct type *builtin_type_chill_long;
|
||||
extern struct type *builtin_type_chill_ulong;
|
||||
extern struct type *builtin_type_chill_real;
|
||||
|
@ -483,9 +483,11 @@ local_hex_format_custom(pre)
|
||||
{
|
||||
static char form[50];
|
||||
|
||||
strcpy (form, current_language->la_hex_format_pre);
|
||||
strcpy (form, local_hex_format_prefix ());
|
||||
strcat (form, "%");
|
||||
strcat (form, pre);
|
||||
strcat (form, current_language->la_hex_format_suf);
|
||||
strcat (form, local_hex_format_specifier ());
|
||||
strcat (form, local_hex_format_suffix ());
|
||||
return form;
|
||||
}
|
||||
|
||||
@ -497,7 +499,7 @@ local_hex_string (num)
|
||||
{
|
||||
static char res[50];
|
||||
|
||||
sprintf (res, current_language->la_hex_format, num);
|
||||
sprintf (res, local_hex_format(), num);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -522,9 +524,11 @@ local_octal_format_custom(pre)
|
||||
{
|
||||
static char form[50];
|
||||
|
||||
strcpy (form, current_language->la_octal_format_pre);
|
||||
strcpy (form, local_octal_format_prefix ());
|
||||
strcat (form, "%");
|
||||
strcat (form, pre);
|
||||
strcat (form, current_language->la_octal_format_suf);
|
||||
strcat (form, local_octal_format_specifier ());
|
||||
strcat (form, local_octal_format_suffix ());
|
||||
return form;
|
||||
}
|
||||
|
||||
@ -563,7 +567,10 @@ simple_type(type)
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns non-zero if its argument is of an ordered type. */
|
||||
/* Returns non-zero if its argument is of an ordered type.
|
||||
An ordered type is one in which the elements can be tested for the
|
||||
properties of "greater than", "less than", etc, or for which the
|
||||
operations "increment" or "decrement" make sense. */
|
||||
int
|
||||
ordered_type (type)
|
||||
struct type *type;
|
||||
@ -643,6 +650,9 @@ character_type (type)
|
||||
{
|
||||
switch(current_language->la_language)
|
||||
{
|
||||
/* start-sanitize-chill */
|
||||
case language_chill:
|
||||
/* end-sanitize-chill */
|
||||
case language_m2:
|
||||
return TYPE_CODE(type) != TYPE_CODE_CHAR ? 0 : 1;
|
||||
|
||||
@ -651,10 +661,6 @@ character_type (type)
|
||||
return (TYPE_CODE(type) == TYPE_CODE_INT) &&
|
||||
TYPE_LENGTH(type) == sizeof(char)
|
||||
? 1 : 0;
|
||||
/* start-sanitize-chill */
|
||||
case language_chill:
|
||||
error ("Missing Chill support in function character_type."); /*FIXME*/
|
||||
/* end-sanitize-chill */
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
@ -1106,8 +1112,10 @@ const struct language_defn unknown_language_defn = {
|
||||
&builtin_type_error, /* longest signed integral type */
|
||||
&builtin_type_error, /* longest unsigned integral type */
|
||||
&builtin_type_error, /* longest floating point type */
|
||||
"0x%x", "0x%", "x", /* Hex format, prefix, suffix */
|
||||
"0%o", "0%", "o", /* Octal format, prefix, suffix */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%o", "0", "o", ""}, /* Octal format info */
|
||||
{"%d", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%x", "0x", "x", ""}, /* Hex format info */
|
||||
unk_op_print_tab, /* expression operators for printing */
|
||||
LANG_MAGIC
|
||||
};
|
||||
@ -1124,8 +1132,10 @@ const struct language_defn auto_language_defn = {
|
||||
&builtin_type_error, /* longest signed integral type */
|
||||
&builtin_type_error, /* longest unsigned integral type */
|
||||
&builtin_type_error, /* longest floating point type */
|
||||
"0x%x", "0x%", "x", /* Hex format, prefix, suffix */
|
||||
"0%o", "0%", "o", /* Octal format, prefix, suffix */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%o", "0", "o", ""}, /* Octal format info */
|
||||
{"%d", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%x", "0x", "x", ""}, /* Hex format info */
|
||||
unk_op_print_tab, /* expression operators for printing */
|
||||
LANG_MAGIC
|
||||
};
|
||||
@ -1141,8 +1151,10 @@ const struct language_defn local_language_defn = {
|
||||
&builtin_type_error, /* longest signed integral type */
|
||||
&builtin_type_error, /* longest unsigned integral type */
|
||||
&builtin_type_error, /* longest floating point type */
|
||||
"0x%x", "0x%", "x", /* Hex format, prefix, suffix */
|
||||
"0%o", "0%", "o", /* Octal format, prefix, suffix */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%o", "0", "o", ""}, /* Octal format info */
|
||||
{"%d", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%x", "0x", "x", ""}, /* Hex format info */
|
||||
unk_op_print_tab, /* expression operators for printing */
|
||||
LANG_MAGIC
|
||||
};
|
||||
|
116
gdb/language.h
116
gdb/language.h
@ -64,6 +64,37 @@ extern enum type_mode {type_mode_auto, type_mode_manual} type_mode;
|
||||
extern enum type_check
|
||||
{type_check_off, type_check_warn, type_check_on} type_check;
|
||||
|
||||
/* Information for doing language dependent formatting of printed values. */
|
||||
|
||||
struct language_format_info
|
||||
{
|
||||
/* The format that can be passed directly to standard C printf functions
|
||||
to generate a completely formatted value in the format appropriate for
|
||||
the language. */
|
||||
|
||||
char *la_format;
|
||||
|
||||
/* The prefix to be used when directly printing a value, or constructing
|
||||
a standard C printf format. This generally is everything up to the
|
||||
conversion specification (the part introduced by the '%' character
|
||||
and terminated by the conversion specifier character). */
|
||||
|
||||
char *la_format_prefix;
|
||||
|
||||
/* The conversion specifier. This is generally everything after the
|
||||
field width and precision, typically only a single character such
|
||||
as 'o' for octal format or 'x' for hexadecimal format. */
|
||||
|
||||
char *la_format_specifier;
|
||||
|
||||
/* The suffix to be used when directly printing a value, or constructing
|
||||
a standard C printf format. This generally is everything after the
|
||||
conversion specification (the part introduced by the '%' character
|
||||
and terminated by the conversion specifier character). */
|
||||
|
||||
char *la_format_suffix; /* Suffix for custom format string */
|
||||
};
|
||||
|
||||
/* Structure tying together assorted information about a language. */
|
||||
|
||||
struct language_defn {
|
||||
@ -78,12 +109,14 @@ struct language_defn {
|
||||
struct type **la_longest_int; /* Longest signed integral type */
|
||||
struct type **la_longest_unsigned_int; /* Longest uns integral type */
|
||||
struct type **la_longest_float; /* Longest floating point type */
|
||||
char *la_hex_format; /* Hexadecimal printf format str */
|
||||
char *la_hex_format_pre; /* Prefix for custom format string */
|
||||
char *la_hex_format_suf; /* Suffix for custom format string */
|
||||
char *la_octal_format; /* Octal printf format str */
|
||||
char *la_octal_format_pre; /* Prefix for custom format string */
|
||||
char *la_octal_format_suf; /* Suffix for custom format string */
|
||||
struct language_format_info
|
||||
la_binary_format; /* Base 2 (binary) formats. */
|
||||
struct language_format_info
|
||||
la_octal_format; /* Base 8 (octal) formats. */
|
||||
struct language_format_info
|
||||
la_decimal_format; /* Base 10 (decimal) formats */
|
||||
struct language_format_info
|
||||
la_hex_format; /* Base 16 (hexadecimal) formats */
|
||||
const struct op_print
|
||||
*la_op_print_tab; /* Table for printing expressions */
|
||||
/* Add fields above this point, so the magic number is always last. */
|
||||
@ -141,18 +174,73 @@ set_language PARAMS ((enum language));
|
||||
#define longest_unsigned_int() (*current_language->la_longest_unsigned_int)
|
||||
#define longest_float() (*current_language->la_longest_float)
|
||||
|
||||
/* Hexadecimal number formatting is in defs.h because it is so common
|
||||
throughout GDB. */
|
||||
/* Return a format string for printf that will print a number in one of
|
||||
the local (language-specific) formats. Result is static and is
|
||||
overwritten by the next call. Takes printf options like "08" or "l"
|
||||
(to produce e.g. %08x or %lx). */
|
||||
|
||||
/* Return a format string for printf that will print a number in the local
|
||||
(language-specific) octal format. Result is static and is
|
||||
overwritten by the next call. local_octal_format_custom takes printf
|
||||
options like "08" or "l" (to produce e.g. %08x or %lx). */
|
||||
#define local_binary_format() \
|
||||
(current_language->la_binary_format.la_format)
|
||||
#define local_binary_format_prefix() \
|
||||
(current_language->la_binary_format.la_format_prefix)
|
||||
#define local_binary_format_specifier() \
|
||||
(current_language->la_binary_format.la_format_specifier)
|
||||
#define local_binary_format_suffix() \
|
||||
(current_language->la_binary_format.la_format_suffix)
|
||||
|
||||
#define local_octal_format() (current_language->la_octal_format)
|
||||
#define local_octal_format() \
|
||||
(current_language->la_octal_format.la_format)
|
||||
#define local_octal_format_prefix() \
|
||||
(current_language->la_octal_format.la_format_prefix)
|
||||
#define local_octal_format_specifier() \
|
||||
(current_language->la_octal_format.la_format_specifier)
|
||||
#define local_octal_format_suffix() \
|
||||
(current_language->la_octal_format.la_format_suffix)
|
||||
|
||||
#define local_decimal_format() \
|
||||
(current_language->la_decimal_format.la_format)
|
||||
#define local_decimal_format_prefix() \
|
||||
(current_language->la_decimal_format.la_format_prefix)
|
||||
#define local_decimal_format_specifier() \
|
||||
(current_language->la_decimal_format.la_format_specifier)
|
||||
#define local_decimal_format_suffix() \
|
||||
(current_language->la_decimal_format.la_format_suffix)
|
||||
|
||||
#define local_hex_format() \
|
||||
(current_language->la_hex_format.la_format)
|
||||
#define local_hex_format_prefix() \
|
||||
(current_language->la_hex_format.la_format_prefix)
|
||||
#define local_hex_format_specifier() \
|
||||
(current_language->la_hex_format.la_format_specifier)
|
||||
#define local_hex_format_suffix() \
|
||||
(current_language->la_hex_format.la_format_suffix)
|
||||
|
||||
/* Return a format string for printf that will print a number in one of
|
||||
the local (language-specific) formats. Result is static and is
|
||||
overwritten by the next call. Takes printf options like "08" or "l"
|
||||
(to produce e.g. %08x or %lx). */
|
||||
|
||||
extern char *
|
||||
local_octal_format_custom PARAMS ((char *));
|
||||
local_octal_format_custom PARAMS ((char *)); /* language.c */
|
||||
|
||||
extern char *
|
||||
local_hex_format_custom PARAMS ((char *)); /* language.c */
|
||||
|
||||
/* Return a string that contains a number formatted in one of the local
|
||||
(language-specific) formats. Result is static and is overwritten by
|
||||
the next call. Takes printf options like "08" or "l". */
|
||||
|
||||
extern char *
|
||||
local_octal_string PARAMS ((int)); /* language.c */
|
||||
|
||||
extern char *
|
||||
local_octal_string_custom PARAMS ((int, char *));/* language.c */
|
||||
|
||||
extern char *
|
||||
local_hex_string PARAMS ((int)); /* language.c */
|
||||
|
||||
extern char *
|
||||
local_hex_string_custom PARAMS ((int, char *)); /* language.c */
|
||||
|
||||
/* Type predicates */
|
||||
|
||||
|
@ -1230,8 +1230,10 @@ const struct language_defn m2_language_defn = {
|
||||
&builtin_type_m2_int, /* longest signed integral type */
|
||||
&builtin_type_m2_card, /* longest unsigned integral type */
|
||||
&builtin_type_m2_real, /* longest floating point type */
|
||||
"0%XH", "0%", "XH", /* Hex format string, prefix, suffix */
|
||||
"%oB", "%", "oB", /* Octal format string, prefix, suffix */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"%oB", "", "o", "B"}, /* Octal format info */
|
||||
{"%d", "", "d", ""}, /* Decimal format info */
|
||||
{"0%XH", "0", "X", "H"}, /* Hex format info */
|
||||
m2_op_print_tab, /* expression operators for printing */
|
||||
LANG_MAGIC
|
||||
};
|
||||
|
Reference in New Issue
Block a user