static void f_printchar (int c, struct type *type, struct ui_file *stream) { fputs_filtered ("'", stream); LA_EMIT_CHAR (c, type, stream, '\''); fputs_filtered ("'", stream); }
void c_printchar (int c, struct type *type, struct ui_file *stream) { enum c_string_type str_type; str_type = classify_type (type, get_type_arch (type), NULL); switch (str_type) { case C_CHAR: break; case C_WIDE_CHAR: fputc_filtered ('L', stream); break; case C_CHAR_16: fputc_filtered ('u', stream); break; case C_CHAR_32: fputc_filtered ('U', stream); break; } fputc_filtered ('\'', stream); LA_EMIT_CHAR (c, type, stream, '\''); fputc_filtered ('\'', stream); }
void c_printchar (int c, struct ui_file *stream) { fputc_filtered ('\'', stream); LA_EMIT_CHAR (c, stream, '\''); fputc_filtered ('\'', stream); }
static void m2_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string, unsigned int length, const char *encoding, int force_ellipses, const struct value_print_options *options) { unsigned int i; unsigned int things_printed = 0; int in_quotes = 0; int need_comma = 0; if (length == 0) { fputs_filtered ("\"\"", gdb_stdout); return; } for (i = 0; i < length && things_printed < options->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 > options->repeat_count_threshold) { if (in_quotes) { if (options->inspect_it) fputs_filtered ("\\\", ", stream); else fputs_filtered ("\", ", stream); in_quotes = 0; } m2_printchar (string[i], type, stream); fprintf_filtered (stream, " <repeats %u times>", reps); i = rep1 - 1; things_printed += options->repeat_count_threshold; need_comma = 1; } else { if (!in_quotes) { if (options->inspect_it) fputs_filtered ("\\\"", stream); else fputs_filtered ("\"", stream); in_quotes = 1; } LA_EMIT_CHAR (string[i], type, stream, '"'); ++things_printed; } } /* Terminate the quotes if necessary. */ if (in_quotes) { if (options->inspect_it) fputs_filtered ("\\\"", stream); else fputs_filtered ("\"", stream); } if (force_ellipses || i < length) fputs_filtered ("...", stream); }
void c_printstr (struct ui_file *stream, char *string, unsigned int length, int width, int force_ellipses) { unsigned int i; unsigned int things_printed = 0; int in_quotes = 0; int need_comma = 0; /* If the string was not truncated due to `set print elements', and the last byte of it is a null, we don't print that, in traditional C style. */ if (!force_ellipses && length > 0 && (extract_unsigned_integer (string + (length - 1) * width, width) == '\0')) length--; if (length == 0) { fputs_filtered ("\"\"", stream); 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; unsigned long current_char; QUIT; if (need_comma) { fputs_filtered (", ", stream); need_comma = 0; } current_char = extract_unsigned_integer (string + i * width, width); rep1 = i + 1; reps = 1; while (rep1 < length && extract_unsigned_integer (string + rep1 * width, width) == current_char) { ++rep1; ++reps; } if (reps > repeat_count_threshold) { if (in_quotes) { if (inspect_it) fputs_filtered ("\\\", ", stream); else fputs_filtered ("\", ", stream); in_quotes = 0; } LA_PRINT_CHAR (current_char, 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; } LA_EMIT_CHAR (current_char, 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); }
void c_printstr(struct ui_file *stream, const gdb_byte *string, unsigned int length, int width, int force_ellipses) { unsigned int i; unsigned int things_printed = 0U; int in_quotes = 0; int need_comma = 0; #if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__cplusplus) # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) # pragma GCC diagnostic push # pragma GCC diagnostic warning "-Wtraditional" # endif /* gcc 4.6+ */ #endif /* GCC (non-c++) */ /* If the string was not truncated due to `set print elements', and * the last byte of it is a null, we do NOT print that, in traditional C * style: */ if (!force_ellipses && (length > 0) && (extract_unsigned_integer(string + (length - 1) * width, width) == '\0')) length--; if (length == 0) { fputs_filtered("\"\"", stream); return; } /* keep condition the same as where we push: */ #if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__cplusplus) # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) # pragma GCC diagnostic pop # endif /* gcc 4.6+ */ #endif /* GCC (non-c++) */ 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; unsigned long current_char; QUIT; if (need_comma) { fputs_filtered(", ", stream); need_comma = 0; } current_char = (unsigned long)extract_unsigned_integer(string + i * width, width); rep1 = i + 1; reps = 1; while ((rep1 < length) && (extract_unsigned_integer(string + rep1 * width, width) == current_char)) { ++rep1; ++reps; } if (reps > repeat_count_threshold) { if (in_quotes) { if (inspect_it) fputs_filtered ("\\\", ", stream); else fputs_filtered ("\", ", stream); in_quotes = 0; } LA_PRINT_CHAR((int)current_char, 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; } LA_EMIT_CHAR((int)current_char, 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); }