void ada_printchar (int c, struct type *type, struct ui_file *stream) { fputs_filtered ("'", stream); ada_emit_char (c, type, stream, '\'', TYPE_LENGTH (type)); fputs_filtered ("'", stream); }
void ada_printchar (int c, struct ui_file *stream) { fputs_filtered ("'", stream); ada_emit_char (c, stream, '\'', 1); fputs_filtered ("'", stream); }
static void printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string, unsigned int length, int force_ellipses, int type_len, const struct value_print_options *options) { enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (elttype)); unsigned int i; unsigned int things_printed = 0; int in_quotes = 0; int need_comma = 0; if (length == 0) { fputs_filtered ("\"\"", stream); return; } for (i = 0; i < length && things_printed < options->print_max; i += 1) { /* 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 && char_at (string, rep1, type_len, byte_order) == char_at (string, i, type_len, byte_order)) { rep1 += 1; reps += 1; } if (reps > options->repeat_count_threshold) { if (in_quotes) { fputs_filtered ("\", ", stream); in_quotes = 0; } fputs_filtered ("'", stream); ada_emit_char (char_at (string, i, type_len, byte_order), elttype, stream, '\'', type_len); fputs_filtered ("'", stream); fprintf_filtered (stream, _(" <repeats %u times>"), reps); i = rep1 - 1; things_printed += options->repeat_count_threshold; need_comma = 1; } else { if (!in_quotes) { fputs_filtered ("\"", stream); in_quotes = 1; } ada_emit_char (char_at (string, i, type_len, byte_order), elttype, stream, '"', type_len); things_printed += 1; } } /* Terminate the quotes if necessary. */ if (in_quotes) fputs_filtered ("\"", stream); if (force_ellipses || i < length) fputs_filtered ("...", stream); }
static void printstr (struct ui_file *stream, char *string, unsigned int length, int force_ellipses, int type_len) { unsigned int i; unsigned int things_printed = 0; int in_quotes = 0; int need_comma = 0; if (length == 0) { fputs_filtered ("\"\"", stream); return; } for (i = 0; i < length && things_printed < print_max; i += 1) { /* 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 && char_at (string, rep1, type_len) == char_at (string, i, type_len)) { rep1 += 1; reps += 1; } if (reps > repeat_count_threshold) { if (in_quotes) { if (inspect_it) fputs_filtered ("\\\", ", stream); else fputs_filtered ("\", ", stream); in_quotes = 0; } fputs_filtered ("'", stream); ada_emit_char (char_at (string, i, type_len), stream, '\'', type_len); fputs_filtered ("'", 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; } ada_emit_char (char_at (string, i, type_len), stream, '"', type_len); things_printed += 1; } } /* 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); }