* defs.h (sevenbit_strings): Add declaration.
* defs.h (printchar): Replace with gdb_printchar. * language.h (language_defn): Add new function pointers la_printchar and la_printstr, to do language dependent printing of characters and strings. * language.h (local_printchar, local_printstr): New macros to call language dependent functions pointed to by la_printchar and la_printstr respectively. * c-exp.y (emit_char, c_printchar, c_printstr): New language dependent functions for printing characters and strings. * c-exp.y (c_language_defn, cplus_language_defn): Add c_printchar and c_printstr. * command.c (do_setshow_command): Rename printchar use to gdb_printchar. * expprint.c (print_subexp): Replace C style string output with call to local_printstr. * language.c (unk_lang_printchar, unk_lang_printstr): New stubs, currently errors. * language.c (unknown_language_defn, auto_language_defn, local_language_defn): Add unk_lang_printchar and unk_lang_printstr. * m2-exp.y (emit_char, m2_printchar, m2_printstr): New language dependent functions to print characters and strings. * m2-exp.y (m2_language_defn): Add m2_printchar and m2_printstr. * utils.c (printchar): Renamed to gdb_printchar. * valprint.c (print_string): Remove prototype, function moved to c-exp.y, where it becomes c_printstr. * valprint.c (print_max): Made global for reference from the language dependent printing routines in *-exp.y. * valprint.c (repeat_count_threshold): New variable with function of old REPEAT_COUNT_THREHOLD define, but now settable by user. Change all references to old macro to references to new variable. * valprint.c (value_print, val_print): Replace calls to print_string with calls to local_printstr. * valprint.c (val_print): Replace C style character printing with call to local_printchar. * valprint.c (val_print): Add case for TYPE_CODE_CHAR. * valprint.c (_initialize_valprint): Add add_show_from_set call for setting up repeat_count_threshold as print variable. **** start-sanitize-chill **** * ch-exp.y (decode_integer_value): New function. * ch-exp.y (decode_integer_literal): Use decode_integer_value. * ch-exp.y (chill_printchar, chill_printstr): New language dependent functions for printing characters and strings. * ch-exp.y (chill_language_defn): Add chill_printchar and chill_printstr. **** end-sanitize-chill ****
This commit is contained in:
parent
242d9c06b2
commit
5d074aa977
8 changed files with 594 additions and 104 deletions
|
@ -74,9 +74,12 @@ print_subexp (exp, pos, stream, prec)
|
|||
/* Common ops */
|
||||
|
||||
case OP_SCOPE:
|
||||
myprec = PREC_PREFIX;
|
||||
assoc = 0;
|
||||
(*pos) += 2;
|
||||
type_print (exp->elts[pc + 1].type, "", stream, 0);
|
||||
fputs_filtered ("::", stream);
|
||||
print_subexp (exp, pos, stream,
|
||||
(enum precedence) ((int) myprec + assoc));
|
||||
fputs_filtered (" :: ", stream);
|
||||
nargs = strlen (&exp->elts[pc + 2].string);
|
||||
(*pos) += 1 + (nargs + sizeof (union exp_element)) / sizeof (union exp_element);
|
||||
|
||||
|
@ -114,6 +117,13 @@ print_subexp (exp, pos, stream, prec)
|
|||
reg_names[longest_to_int (exp->elts[pc + 1].longconst)]);
|
||||
return;
|
||||
|
||||
case OP_BOOL:
|
||||
(*pos) += 2;
|
||||
fprintf_filtered (stream, "%s",
|
||||
longest_to_int (exp->elts[pc + 1].longconst)
|
||||
? "TRUE" : "FALSE");
|
||||
return;
|
||||
|
||||
case OP_INTERNALVAR:
|
||||
(*pos) += 2;
|
||||
fprintf_filtered (stream, "$%s",
|
||||
|
@ -137,10 +147,10 @@ print_subexp (exp, pos, stream, prec)
|
|||
case OP_STRING:
|
||||
nargs = strlen (&exp->elts[pc + 1].string);
|
||||
(*pos) += 2 + (nargs + sizeof (union exp_element)) / sizeof (union exp_element);
|
||||
fputs_filtered ("\"", stream);
|
||||
for (tem = 0; tem < nargs; tem++)
|
||||
printchar ((&exp->elts[pc + 1].string)[tem], stream, '"');
|
||||
fputs_filtered ("\"", stream);
|
||||
/* local_printstr will print using the current repeat count threshold.
|
||||
If necessary, we can temporarily set it to zero, or pass it as an
|
||||
additional parameter to local_printstr. -fnf */
|
||||
local_printstr (stream, &exp->elts[pc + 1].string, nargs, 0);
|
||||
return;
|
||||
|
||||
case TERNOP_COND:
|
||||
|
@ -160,30 +170,20 @@ print_subexp (exp, pos, stream, prec)
|
|||
return;
|
||||
|
||||
case STRUCTOP_STRUCT:
|
||||
tem = strlen (&exp->elts[pc + 2].string);
|
||||
(*pos) += 3 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
|
||||
tem = strlen (&exp->elts[pc + 1].string);
|
||||
(*pos) += 2 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
|
||||
print_subexp (exp, pos, stream, PREC_SUFFIX);
|
||||
fputs_filtered (".", stream);
|
||||
if (exp->elts[pc + 1].type)
|
||||
{
|
||||
type_print (exp->elts[pc + 1].type, "", stream, 0);
|
||||
fputs_filtered ("::", stream);
|
||||
}
|
||||
fputs_filtered (&exp->elts[pc + 2].string, stream);
|
||||
fputs_filtered (&exp->elts[pc + 1].string, stream);
|
||||
return;
|
||||
|
||||
/* Will not occur for Modula-2 */
|
||||
case STRUCTOP_PTR:
|
||||
tem = strlen (&exp->elts[pc + 2].string);
|
||||
(*pos) += 3 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
|
||||
tem = strlen (&exp->elts[pc + 1].string);
|
||||
(*pos) += 2 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
|
||||
print_subexp (exp, pos, stream, PREC_SUFFIX);
|
||||
fputs_filtered ("->", stream);
|
||||
if (exp->elts[pc + 1].type)
|
||||
{
|
||||
type_print (exp->elts[pc + 1].type, "", stream, 0);
|
||||
fputs_filtered ("::", stream);
|
||||
}
|
||||
fputs_filtered (&exp->elts[pc + 2].string, stream);
|
||||
fputs_filtered (&exp->elts[pc + 1].string, stream);
|
||||
return;
|
||||
|
||||
case BINOP_SUBSCRIPT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue