@@ -13893,14 +13893,6 @@ class ada_language : public language_defn
/* See language.h. */
- void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override
- {
- ada_emit_char (ch, chtype, stream, quoter, 1);
- }
-
- /* See language.h. */
-
void printchar (int ch, struct type *chtype,
struct ui_file *stream) const override
{
@@ -135,20 +135,6 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch,
return result;
}
-/* 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. */
-
-void
-language_defn::emitchar (int c, struct type *type,
- struct ui_file *stream, int quoter) const
-{
- const char *encoding;
-
- classify_type (type, type->arch (), &encoding);
- generic_emit_char (c, type, stream, quoter, encoding);
-}
-
/* See language.h. */
void
@@ -156,8 +142,9 @@ language_defn::printchar (int c, struct type *type,
struct ui_file * stream) const
{
c_string_type str_type;
+ const char *encoding;
- str_type = classify_type (type, type->arch (), NULL);
+ str_type = classify_type (type, type->arch (), &encoding);
switch (str_type)
{
case C_CHAR:
@@ -174,7 +161,7 @@ language_defn::printchar (int c, struct type *type,
}
gdb_putc ('\'', stream);
- emitchar (c, type, stream, '\'');
+ generic_emit_char (c, type, stream, '\'', encoding);
gdb_putc ('\'', stream);
}
@@ -158,20 +158,12 @@ class f_language : public language_defn
/* See language.h. */
- void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override
- {
- const char *encoding = get_encoding (chtype);
- generic_emit_char (ch, chtype, stream, quoter, encoding);
- }
-
- /* See language.h. */
-
void printchar (int ch, struct type *chtype,
struct ui_file *stream) const override
{
gdb_puts ("'", stream);
- emitchar (ch, chtype, stream, '\'');
+ const char *encoding = get_encoding (chtype);
+ generic_emit_char (ch, chtype, stream, '\'', encoding);
gdb_puts ("'", stream);
}
@@ -801,15 +801,6 @@ class unknown_language : public language_defn
/* See language.h. */
- void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override
- {
- error (_("emit character not implemented for language \"%s\""),
- natural_name ());
- }
-
- /* See language.h. */
-
void printchar (int ch, struct type *chtype,
struct ui_file *stream) const override
{
@@ -524,12 +524,6 @@ struct language_defn
virtual int parser (struct parser_state *ps) const;
- /* Print the character CH (of type CHTYPE) on STREAM as part of the
- contents of a literal string whose delimiter is QUOTER. */
-
- virtual void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const;
-
virtual void printchar (int ch, struct type *chtype,
struct ui_file * stream) const;
@@ -93,7 +93,7 @@ class m2_language : public language_defn
/* See language.h. */
void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override;
+ struct ui_file *stream, int quoter) const;
/* See language.h. */
@@ -110,7 +110,7 @@ class pascal_language : public language_defn
/* See language.h. */
void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override
+ struct ui_file *stream, int quoter) const
{
int in_quotes = 0;
@@ -1771,13 +1771,14 @@ rust_language::print_type (struct type *type, const char *varstring,
/* See language.h. */
void
-rust_language::emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const
+rust_language::printchar (int ch, struct type *chtype,
+ struct ui_file *stream) const
{
+ fputs_filtered ("'", stream);
if (!rust_chartype_p (chtype))
- generic_emit_char (ch, chtype, stream, quoter,
+ generic_emit_char (ch, chtype, stream, '\'',
target_charset (chtype->arch ()));
- else if (ch == '\\' || ch == quoter)
+ else if (ch == '\\')
gdb_printf (stream, "\\%c", ch);
else if (ch == '\n')
gdb_puts ("\\n", stream);
@@ -1793,6 +1794,7 @@ rust_language::emitchar (int ch, struct type *chtype,
gdb_printf (stream, "\\x%02x", ch);
else
gdb_printf (stream, "\\u{%06x}", ch);
+ gdb_puts ("'", stream);
}
/* See language.h. */
@@ -156,18 +156,8 @@ class rust_language : public language_defn
/* See language.h. */
- void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override;
-
- /* See language.h. */
-
void printchar (int ch, struct type *chtype,
- struct ui_file *stream) const override
- {
- gdb_puts ("'", stream);
- emitchar (ch, chtype, stream, '\'');
- gdb_puts ("'", stream);
- }
+ struct ui_file *stream) const override;
/* See language.h. */