gdb: Convert language la_emitchar field to a method
This commit changes the language_data::la_emitchar function pointer member variable into a member function of language_defn. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (emit_char): Renamed to ada_language::emitchar. (ada_language_data): Delete la_emitchar initializer. (ada_language::emitchar): New member function, implementation from emit_char. * c-lang.c (c_language_data): Delete la_emitchar initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_emit_char): Rename to f_language::emitchar. (f_language_data): Delete la_emitchar initializer. (f_language::emitchar): New member function, implementation from f_emit_char. * go-lang.c (go_language_data): Delete la_emitchar initializer. * language.c (unk_lang_emit_char): Delete. (language_defn::emitchar): New member function definition. (unknown_language_data): Delete la_emitchar initializer. (unknown_language::emitchar): New member function. (auto_language_data): Delete la_emitchar initializer. (auto_language::emitchar): New member function. * language.h (language_data): Delete la_emitchar field. (language_defn::emitchar): New member field declaration. (LA_EMIT_CHAR): Update call to emitchar. * m2-lang.c (m2_emit_char): Rename to m2_language::emitchar. (m2_language_data): Delete la_emitchar initializer. (m2_language::emitchar): New member function, implementation from m2_emit_char. * objc-lang.c (objc_language_data): Delete la_emitchar initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_emit_char): Rename to pascal_language::emitchar. (pascal_language_data): Delete la_emitchar initializer. (pascal_language::emitchar): New member function, implementation from pascal_emit_char. * rust-lang.c (rust_emitchar): Rename to rust_language::emitchar. (rust_language_data): Delete la_emitchar initializer. (rust_language::emitchar): New member function, implementation from rust_emitchar.
This commit is contained in:
parent
1bf9c36374
commit
ec8cec5b96
13 changed files with 173 additions and 152 deletions
|
@ -1,3 +1,44 @@
|
||||||
|
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
|
* ada-lang.c (emit_char): Renamed to ada_language::emitchar.
|
||||||
|
(ada_language_data): Delete la_emitchar initializer.
|
||||||
|
(ada_language::emitchar): New member function, implementation from
|
||||||
|
emit_char.
|
||||||
|
* c-lang.c (c_language_data): Delete la_emitchar initializer.
|
||||||
|
(cplus_language_data): Likewise.
|
||||||
|
(asm_language_data): Likewise.
|
||||||
|
(minimal_language_data): Likewise.
|
||||||
|
* d-lang.c (d_language_data): Likewise.
|
||||||
|
* f-lang.c (f_emit_char): Rename to f_language::emitchar.
|
||||||
|
(f_language_data): Delete la_emitchar initializer.
|
||||||
|
(f_language::emitchar): New member function, implementation from
|
||||||
|
f_emit_char.
|
||||||
|
* go-lang.c (go_language_data): Delete la_emitchar initializer.
|
||||||
|
* language.c (unk_lang_emit_char): Delete.
|
||||||
|
(language_defn::emitchar): New member function definition.
|
||||||
|
(unknown_language_data): Delete la_emitchar initializer.
|
||||||
|
(unknown_language::emitchar): New member function.
|
||||||
|
(auto_language_data): Delete la_emitchar initializer.
|
||||||
|
(auto_language::emitchar): New member function.
|
||||||
|
* language.h (language_data): Delete la_emitchar field.
|
||||||
|
(language_defn::emitchar): New member field declaration.
|
||||||
|
(LA_EMIT_CHAR): Update call to emitchar.
|
||||||
|
* m2-lang.c (m2_emit_char): Rename to m2_language::emitchar.
|
||||||
|
(m2_language_data): Delete la_emitchar initializer.
|
||||||
|
(m2_language::emitchar): New member function, implementation from
|
||||||
|
m2_emit_char.
|
||||||
|
* objc-lang.c (objc_language_data): Delete la_emitchar
|
||||||
|
initializer.
|
||||||
|
* opencl-lang.c (opencl_language_data): Likewise.
|
||||||
|
* p-lang.c (pascal_emit_char): Rename to pascal_language::emitchar.
|
||||||
|
(pascal_language_data): Delete la_emitchar initializer.
|
||||||
|
(pascal_language::emitchar): New member function, implementation
|
||||||
|
from pascal_emit_char.
|
||||||
|
* rust-lang.c (rust_emitchar): Rename to rust_language::emitchar.
|
||||||
|
(rust_language_data): Delete la_emitchar initializer.
|
||||||
|
(rust_language::emitchar): New member function, implementation
|
||||||
|
from rust_emitchar.
|
||||||
|
|
||||||
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
|
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
* ada-lang.c (resolve): Rename to ada_language::post_parser.
|
* ada-lang.c (resolve): Rename to ada_language::post_parser.
|
||||||
|
|
|
@ -13504,14 +13504,6 @@ enum ada_primitive_types {
|
||||||
|
|
||||||
/* Language vector */
|
/* Language vector */
|
||||||
|
|
||||||
/* Not really used, but needed in the ada_language_defn. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
|
|
||||||
{
|
|
||||||
ada_emit_char (c, type, stream, quoter, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct exp_descriptor ada_exp_descriptor = {
|
static const struct exp_descriptor ada_exp_descriptor = {
|
||||||
ada_print_subexp,
|
ada_print_subexp,
|
||||||
ada_operator_length,
|
ada_operator_length,
|
||||||
|
@ -13691,7 +13683,6 @@ extern const struct language_data ada_language_data =
|
||||||
&ada_exp_descriptor,
|
&ada_exp_descriptor,
|
||||||
ada_printchar, /* Print a character constant */
|
ada_printchar, /* Print a character constant */
|
||||||
ada_printstr, /* Function to print string constant */
|
ada_printstr, /* Function to print string constant */
|
||||||
emit_char, /* Function to print single char (not used) */
|
|
||||||
ada_print_typedef, /* Print a typedef using appropriate syntax */
|
ada_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
NULL, /* name_of_this */
|
NULL, /* name_of_this */
|
||||||
true, /* la_store_sym_names_in_linkage_form_p */
|
true, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
@ -14116,6 +14107,14 @@ public:
|
||||||
resolve_subexp (expp, &pc, 1, context_type, completing, tracker);
|
resolve_subexp (expp, &pc, 1, context_type, completing, tracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* See language.h. */
|
/* See language.h. */
|
||||||
|
|
||||||
|
|
|
@ -891,7 +891,6 @@ extern const struct language_data c_language_data =
|
||||||
&exp_descriptor_c,
|
&exp_descriptor_c,
|
||||||
c_printchar, /* Print a character constant */
|
c_printchar, /* Print a character constant */
|
||||||
c_printstr, /* Function to print string constant */
|
c_printstr, /* Function to print string constant */
|
||||||
c_emit_char, /* Print a single char */
|
|
||||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
NULL, /* name_of_this */
|
NULL, /* name_of_this */
|
||||||
true, /* la_store_sym_names_in_linkage_form_p */
|
true, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
@ -997,7 +996,6 @@ extern const struct language_data cplus_language_data =
|
||||||
&exp_descriptor_c,
|
&exp_descriptor_c,
|
||||||
c_printchar, /* Print a character constant */
|
c_printchar, /* Print a character constant */
|
||||||
c_printstr, /* Function to print string constant */
|
c_printstr, /* Function to print string constant */
|
||||||
c_emit_char, /* Print a single char */
|
|
||||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
"this", /* name_of_this */
|
"this", /* name_of_this */
|
||||||
false, /* la_store_sym_names_in_linkage_form_p */
|
false, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
@ -1200,7 +1198,6 @@ extern const struct language_data asm_language_data =
|
||||||
&exp_descriptor_c,
|
&exp_descriptor_c,
|
||||||
c_printchar, /* Print a character constant */
|
c_printchar, /* Print a character constant */
|
||||||
c_printstr, /* Function to print string constant */
|
c_printstr, /* Function to print string constant */
|
||||||
c_emit_char, /* Print a single char */
|
|
||||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
NULL, /* name_of_this */
|
NULL, /* name_of_this */
|
||||||
true, /* la_store_sym_names_in_linkage_form_p */
|
true, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
@ -1261,7 +1258,6 @@ extern const struct language_data minimal_language_data =
|
||||||
&exp_descriptor_c,
|
&exp_descriptor_c,
|
||||||
c_printchar, /* Print a character constant */
|
c_printchar, /* Print a character constant */
|
||||||
c_printstr, /* Function to print string constant */
|
c_printstr, /* Function to print string constant */
|
||||||
c_emit_char, /* Print a single char */
|
|
||||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
NULL, /* name_of_this */
|
NULL, /* name_of_this */
|
||||||
true, /* la_store_sym_names_in_linkage_form_p */
|
true, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
|
|
@ -144,7 +144,6 @@ extern const struct language_data d_language_data =
|
||||||
&exp_descriptor_c,
|
&exp_descriptor_c,
|
||||||
c_printchar, /* Print a character constant. */
|
c_printchar, /* Print a character constant. */
|
||||||
c_printstr, /* Function to print string constant. */
|
c_printstr, /* Function to print string constant. */
|
||||||
c_emit_char, /* Print a single char. */
|
|
||||||
c_print_typedef, /* Print a typedef using appropriate
|
c_print_typedef, /* Print a typedef using appropriate
|
||||||
syntax. */
|
syntax. */
|
||||||
"this",
|
"this",
|
||||||
|
|
26
gdb/f-lang.c
26
gdb/f-lang.c
|
@ -42,8 +42,6 @@
|
||||||
/* Local functions */
|
/* Local functions */
|
||||||
|
|
||||||
static void f_printchar (int c, struct type *type, struct ui_file * stream);
|
static void f_printchar (int c, struct type *type, struct ui_file * stream);
|
||||||
static void f_emit_char (int c, struct type *type,
|
|
||||||
struct ui_file * stream, int quoter);
|
|
||||||
|
|
||||||
/* Return the encoding that should be used for the character type
|
/* Return the encoding that should be used for the character type
|
||||||
TYPE. */
|
TYPE. */
|
||||||
|
@ -72,20 +70,6 @@ f_get_encoding (struct type *type)
|
||||||
return encoding;
|
return encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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.
|
|
||||||
FIXME: This is a copy of the same function from c-exp.y. It should
|
|
||||||
be replaced with a true F77 version. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
f_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
|
|
||||||
{
|
|
||||||
const char *encoding = f_get_encoding (type);
|
|
||||||
|
|
||||||
generic_emit_char (c, type, stream, quoter, encoding);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Implementation of la_printchar. */
|
/* Implementation of la_printchar. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -566,7 +550,6 @@ extern const struct language_data f_language_data =
|
||||||
&exp_descriptor_f,
|
&exp_descriptor_f,
|
||||||
f_printchar, /* Print character constant */
|
f_printchar, /* Print character constant */
|
||||||
f_printstr, /* function to print string constant */
|
f_printstr, /* function to print string constant */
|
||||||
f_emit_char, /* Function to print a single character */
|
|
||||||
f_print_typedef, /* Print a typedef using appropriate syntax */
|
f_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
NULL, /* name_of_this */
|
NULL, /* name_of_this */
|
||||||
false, /* la_store_sym_names_in_linkage_form_p */
|
false, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
@ -718,6 +701,15 @@ public:
|
||||||
return f_parse (ps);
|
return f_parse (ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See language.h. */
|
||||||
|
|
||||||
|
void emitchar (int ch, struct type *chtype,
|
||||||
|
struct ui_file *stream, int quoter) const override
|
||||||
|
{
|
||||||
|
const char *encoding = f_get_encoding (chtype);
|
||||||
|
generic_emit_char (ch, chtype, stream, quoter, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/* See language.h. */
|
/* See language.h. */
|
||||||
|
|
|
@ -529,7 +529,6 @@ extern const struct language_data go_language_data =
|
||||||
&exp_descriptor_c,
|
&exp_descriptor_c,
|
||||||
c_printchar, /* Print a character constant. */
|
c_printchar, /* Print a character constant. */
|
||||||
c_printstr, /* Function to print string constant. */
|
c_printstr, /* Function to print string constant. */
|
||||||
c_emit_char, /* Print a single char. */
|
|
||||||
c_print_typedef, /* Print a typedef using appropriate
|
c_print_typedef, /* Print a typedef using appropriate
|
||||||
syntax. */
|
syntax. */
|
||||||
NULL, /* name_of_this */
|
NULL, /* name_of_this */
|
||||||
|
|
|
@ -49,9 +49,6 @@
|
||||||
|
|
||||||
static void set_range_case (void);
|
static void set_range_case (void);
|
||||||
|
|
||||||
static void unk_lang_emit_char (int c, struct type *type,
|
|
||||||
struct ui_file *stream, int quoter);
|
|
||||||
|
|
||||||
static void unk_lang_printchar (int c, struct type *type,
|
static void unk_lang_printchar (int c, struct type *type,
|
||||||
struct ui_file *stream);
|
struct ui_file *stream);
|
||||||
|
|
||||||
|
@ -657,6 +654,15 @@ language_defn::value_print_inner
|
||||||
return c_value_print_inner (val, stream, recurse, options);
|
return c_value_print_inner (val, stream, recurse, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See language.h. */
|
||||||
|
|
||||||
|
void
|
||||||
|
language_defn::emitchar (int ch, struct type *chtype,
|
||||||
|
struct ui_file * stream, int quoter) const
|
||||||
|
{
|
||||||
|
c_emit_char (ch, chtype, stream, quoter);
|
||||||
|
}
|
||||||
|
|
||||||
/* The default implementation of the get_symbol_name_matcher_inner method
|
/* The default implementation of the get_symbol_name_matcher_inner method
|
||||||
from the language_defn class. Matches with strncmp_iw. */
|
from the language_defn class. Matches with strncmp_iw. */
|
||||||
|
|
||||||
|
@ -722,16 +728,6 @@ default_is_string_type_p (struct type *type)
|
||||||
return (type->code () == TYPE_CODE_STRING);
|
return (type->code () == TYPE_CODE_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Define the language that is no language. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
unk_lang_emit_char (int c, struct type *type, struct ui_file *stream,
|
|
||||||
int quoter)
|
|
||||||
{
|
|
||||||
error (_("internal error - unimplemented "
|
|
||||||
"function unk_lang_emit_char called."));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unk_lang_printchar (int c, struct type *type, struct ui_file *stream)
|
unk_lang_printchar (int c, struct type *type, struct ui_file *stream)
|
||||||
{
|
{
|
||||||
|
@ -779,7 +775,6 @@ extern const struct language_data unknown_language_data =
|
||||||
&exp_descriptor_standard,
|
&exp_descriptor_standard,
|
||||||
unk_lang_printchar, /* Print character constant */
|
unk_lang_printchar, /* Print character constant */
|
||||||
unk_lang_printstr,
|
unk_lang_printstr,
|
||||||
unk_lang_emit_char,
|
|
||||||
default_print_typedef, /* Print a typedef using appropriate syntax */
|
default_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
"this", /* name_of_this */
|
"this", /* name_of_this */
|
||||||
true, /* store_sym_names_in_linkage_form_p */
|
true, /* store_sym_names_in_linkage_form_p */
|
||||||
|
@ -848,6 +843,14 @@ public:
|
||||||
/* No parsing is done, just claim success. */
|
/* No parsing is done, just claim success. */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See language.h. */
|
||||||
|
|
||||||
|
void emitchar (int ch, struct type *chtype,
|
||||||
|
struct ui_file *stream, int quoter) const override
|
||||||
|
{
|
||||||
|
error (_("unimplemented unknown_language::emitchar called"));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Single instance of the unknown language class. */
|
/* Single instance of the unknown language class. */
|
||||||
|
@ -869,7 +872,6 @@ extern const struct language_data auto_language_data =
|
||||||
&exp_descriptor_standard,
|
&exp_descriptor_standard,
|
||||||
unk_lang_printchar, /* Print character constant */
|
unk_lang_printchar, /* Print character constant */
|
||||||
unk_lang_printstr,
|
unk_lang_printstr,
|
||||||
unk_lang_emit_char,
|
|
||||||
default_print_typedef, /* Print a typedef using appropriate syntax */
|
default_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
"this", /* name_of_this */
|
"this", /* name_of_this */
|
||||||
false, /* store_sym_names_in_linkage_form_p */
|
false, /* store_sym_names_in_linkage_form_p */
|
||||||
|
@ -938,6 +940,14 @@ public:
|
||||||
/* No parsing is done, just claim success. */
|
/* No parsing is done, just claim success. */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See language.h. */
|
||||||
|
|
||||||
|
void emitchar (int ch, struct type *chtype,
|
||||||
|
struct ui_file *stream, int quoter) const override
|
||||||
|
{
|
||||||
|
error (_("unimplemented auto_language::emitchar called"));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Single instance of the fake "auto" language. */
|
/* Single instance of the fake "auto" language. */
|
||||||
|
|
|
@ -233,9 +233,6 @@ struct language_data
|
||||||
const char *encoding, int force_ellipses,
|
const char *encoding, int force_ellipses,
|
||||||
const struct value_print_options *);
|
const struct value_print_options *);
|
||||||
|
|
||||||
void (*la_emitchar) (int ch, struct type *chtype,
|
|
||||||
struct ui_file * stream, int quoter);
|
|
||||||
|
|
||||||
/* Print a typedef using syntax appropriate for this language.
|
/* Print a typedef using syntax appropriate for this language.
|
||||||
TYPE is the underlying type. NEW_SYMBOL is the symbol naming
|
TYPE is the underlying type. NEW_SYMBOL is the symbol naming
|
||||||
the type. STREAM is the output stream on which to print. */
|
the type. STREAM is the output stream on which to print. */
|
||||||
|
@ -544,6 +541,12 @@ struct language_defn : language_data
|
||||||
/* By default the post-parser does nothing. */
|
/* By default the post-parser does nothing. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
|
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
|
||||||
|
@ -651,7 +654,7 @@ extern enum language set_language (enum language);
|
||||||
(current_language->la_printstr(stream, elttype, string, length, \
|
(current_language->la_printstr(stream, elttype, string, length, \
|
||||||
encoding, force_ellipses,options))
|
encoding, force_ellipses,options))
|
||||||
#define LA_EMIT_CHAR(ch, type, stream, quoter) \
|
#define LA_EMIT_CHAR(ch, type, stream, quoter) \
|
||||||
(current_language->la_emitchar(ch, type, stream, quoter))
|
(current_language->emitchar (ch, type, stream, quoter))
|
||||||
|
|
||||||
#define LA_PRINT_ARRAY_INDEX(index_type, index_value, stream, options) \
|
#define LA_PRINT_ARRAY_INDEX(index_type, index_value, stream, options) \
|
||||||
(current_language->print_array_index(index_type, index_value, stream, \
|
(current_language->print_array_index(index_type, index_value, stream, \
|
||||||
|
|
|
@ -30,59 +30,6 @@
|
||||||
#include "gdbarch.h"
|
#include "gdbarch.h"
|
||||||
|
|
||||||
static void m2_printchar (int, struct type *, struct ui_file *);
|
static void m2_printchar (int, struct type *, struct ui_file *);
|
||||||
static void m2_emit_char (int, struct type *, struct ui_file *, int);
|
|
||||||
|
|
||||||
/* 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.
|
|
||||||
FIXME: This is a copy of the same function from c-exp.y. It should
|
|
||||||
be replaced with a true Modula version. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
m2_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
|
|
||||||
{
|
|
||||||
|
|
||||||
c &= 0xFF; /* Avoid sign bit follies. */
|
|
||||||
|
|
||||||
if (PRINT_LITERAL_FORM (c))
|
|
||||||
{
|
|
||||||
if (c == '\\' || c == quoter)
|
|
||||||
{
|
|
||||||
fputs_filtered ("\\", stream);
|
|
||||||
}
|
|
||||||
fprintf_filtered (stream, "%c", c);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case '\n':
|
|
||||||
fputs_filtered ("\\n", stream);
|
|
||||||
break;
|
|
||||||
case '\b':
|
|
||||||
fputs_filtered ("\\b", stream);
|
|
||||||
break;
|
|
||||||
case '\t':
|
|
||||||
fputs_filtered ("\\t", stream);
|
|
||||||
break;
|
|
||||||
case '\f':
|
|
||||||
fputs_filtered ("\\f", stream);
|
|
||||||
break;
|
|
||||||
case '\r':
|
|
||||||
fputs_filtered ("\\r", stream);
|
|
||||||
break;
|
|
||||||
case '\033':
|
|
||||||
fputs_filtered ("\\e", stream);
|
|
||||||
break;
|
|
||||||
case '\007':
|
|
||||||
fputs_filtered ("\\a", stream);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: This is a copy of the same function from c-exp.y. It should
|
/* FIXME: This is a copy of the same function from c-exp.y. It should
|
||||||
be replaced with a true Modula version. */
|
be replaced with a true Modula version. */
|
||||||
|
@ -364,7 +311,6 @@ extern const struct language_data m2_language_data =
|
||||||
&exp_descriptor_modula2,
|
&exp_descriptor_modula2,
|
||||||
m2_printchar, /* Print character constant */
|
m2_printchar, /* Print character constant */
|
||||||
m2_printstr, /* function to print string constant */
|
m2_printstr, /* function to print string constant */
|
||||||
m2_emit_char, /* Function to print a single character */
|
|
||||||
m2_print_typedef, /* Print a typedef using appropriate syntax */
|
m2_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
NULL, /* name_of_this */
|
NULL, /* name_of_this */
|
||||||
false, /* la_store_sym_names_in_linkage_form_p */
|
false, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
@ -435,6 +381,51 @@ public:
|
||||||
{
|
{
|
||||||
return m2_parse (ps);
|
return m2_parse (ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See language.h. */
|
||||||
|
|
||||||
|
void emitchar (int ch, struct type *chtype,
|
||||||
|
struct ui_file *stream, int quoter) const override
|
||||||
|
{
|
||||||
|
ch &= 0xFF; /* Avoid sign bit follies. */
|
||||||
|
|
||||||
|
if (PRINT_LITERAL_FORM (ch))
|
||||||
|
{
|
||||||
|
if (ch == '\\' || ch == quoter)
|
||||||
|
fputs_filtered ("\\", stream);
|
||||||
|
fprintf_filtered (stream, "%c", ch);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (ch)
|
||||||
|
{
|
||||||
|
case '\n':
|
||||||
|
fputs_filtered ("\\n", stream);
|
||||||
|
break;
|
||||||
|
case '\b':
|
||||||
|
fputs_filtered ("\\b", stream);
|
||||||
|
break;
|
||||||
|
case '\t':
|
||||||
|
fputs_filtered ("\\t", stream);
|
||||||
|
break;
|
||||||
|
case '\f':
|
||||||
|
fputs_filtered ("\\f", stream);
|
||||||
|
break;
|
||||||
|
case '\r':
|
||||||
|
fputs_filtered ("\\r", stream);
|
||||||
|
break;
|
||||||
|
case '\033':
|
||||||
|
fputs_filtered ("\\e", stream);
|
||||||
|
break;
|
||||||
|
case '\007':
|
||||||
|
fputs_filtered ("\\a", stream);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf_filtered (stream, "\\%.3o", (unsigned int) ch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Single instance of the M2 language. */
|
/* Single instance of the M2 language. */
|
||||||
|
|
|
@ -339,7 +339,6 @@ extern const struct language_data objc_language_data =
|
||||||
&exp_descriptor_standard,
|
&exp_descriptor_standard,
|
||||||
c_printchar, /* Print a character constant */
|
c_printchar, /* Print a character constant */
|
||||||
c_printstr, /* Function to print string constant */
|
c_printstr, /* Function to print string constant */
|
||||||
c_emit_char,
|
|
||||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
"self", /* name_of_this */
|
"self", /* name_of_this */
|
||||||
false, /* la_store_sym_names_in_linkage_form_p */
|
false, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
|
|
@ -1018,7 +1018,6 @@ extern const struct language_data opencl_language_data =
|
||||||
&exp_descriptor_opencl,
|
&exp_descriptor_opencl,
|
||||||
c_printchar, /* Print a character constant */
|
c_printchar, /* Print a character constant */
|
||||||
c_printstr, /* Function to print string constant */
|
c_printstr, /* Function to print string constant */
|
||||||
c_emit_char, /* Print a single char */
|
|
||||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
NULL, /* name_of_this */
|
NULL, /* name_of_this */
|
||||||
false, /* la_store_sym_names_in_linkage_form_p */
|
false, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
|
30
gdb/p-lang.c
30
gdb/p-lang.c
|
@ -192,23 +192,6 @@ pascal_one_char (int c, struct ui_file *stream, int *in_quotes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pascal_emit_char (int c, struct type *type,
|
|
||||||
struct ui_file *stream, int quoter);
|
|
||||||
|
|
||||||
/* 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. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
pascal_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
|
|
||||||
{
|
|
||||||
int in_quotes = 0;
|
|
||||||
|
|
||||||
pascal_one_char (c, stream, &in_quotes);
|
|
||||||
if (in_quotes)
|
|
||||||
fputs_filtered ("'", stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pascal_printchar (int c, struct type *type, struct ui_file *stream)
|
pascal_printchar (int c, struct type *type, struct ui_file *stream)
|
||||||
{
|
{
|
||||||
|
@ -395,7 +378,6 @@ extern const struct language_data pascal_language_data =
|
||||||
&exp_descriptor_standard,
|
&exp_descriptor_standard,
|
||||||
pascal_printchar, /* Print a character constant */
|
pascal_printchar, /* Print a character constant */
|
||||||
pascal_printstr, /* Function to print string constant */
|
pascal_printstr, /* Function to print string constant */
|
||||||
pascal_emit_char, /* Print a single char */
|
|
||||||
pascal_print_typedef, /* Print a typedef using appropriate syntax */
|
pascal_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
"this", /* name_of_this */
|
"this", /* name_of_this */
|
||||||
false, /* la_store_sym_names_in_linkage_form_p */
|
false, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
@ -497,6 +479,18 @@ public:
|
||||||
{
|
{
|
||||||
return pascal_parse (ps);
|
return pascal_parse (ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See language.h. */
|
||||||
|
|
||||||
|
void emitchar (int ch, struct type *chtype,
|
||||||
|
struct ui_file *stream, int quoter) const override
|
||||||
|
{
|
||||||
|
int in_quotes = 0;
|
||||||
|
|
||||||
|
pascal_one_char (ch, stream, &in_quotes);
|
||||||
|
if (in_quotes)
|
||||||
|
fputs_filtered ("'", stream);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Single instance of the Pascal language class. */
|
/* Single instance of the Pascal language class. */
|
||||||
|
|
|
@ -281,32 +281,6 @@ rust_get_trait_object_pointer (struct value *value)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* la_emitchar implementation for Rust. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
rust_emitchar (int c, struct type *type, struct ui_file *stream, int quoter)
|
|
||||||
{
|
|
||||||
if (!rust_chartype_p (type))
|
|
||||||
generic_emit_char (c, type, stream, quoter,
|
|
||||||
target_charset (get_type_arch (type)));
|
|
||||||
else if (c == '\\' || c == quoter)
|
|
||||||
fprintf_filtered (stream, "\\%c", c);
|
|
||||||
else if (c == '\n')
|
|
||||||
fputs_filtered ("\\n", stream);
|
|
||||||
else if (c == '\r')
|
|
||||||
fputs_filtered ("\\r", stream);
|
|
||||||
else if (c == '\t')
|
|
||||||
fputs_filtered ("\\t", stream);
|
|
||||||
else if (c == '\0')
|
|
||||||
fputs_filtered ("\\0", stream);
|
|
||||||
else if (c >= 32 && c <= 127 && isprint (c))
|
|
||||||
fputc_filtered (c, stream);
|
|
||||||
else if (c <= 255)
|
|
||||||
fprintf_filtered (stream, "\\x%02x", c);
|
|
||||||
else
|
|
||||||
fprintf_filtered (stream, "\\u{%06x}", c);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* la_printchar implementation for Rust. */
|
/* la_printchar implementation for Rust. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1991,7 +1965,6 @@ extern const struct language_data rust_language_data =
|
||||||
&exp_descriptor_rust,
|
&exp_descriptor_rust,
|
||||||
rust_printchar, /* Print a character constant */
|
rust_printchar, /* Print a character constant */
|
||||||
rust_printstr, /* Function to print string constant */
|
rust_printstr, /* Function to print string constant */
|
||||||
rust_emitchar, /* Print a single char */
|
|
||||||
rust_print_typedef, /* Print a typedef using appropriate syntax */
|
rust_print_typedef, /* Print a typedef using appropriate syntax */
|
||||||
NULL, /* name_of_this */
|
NULL, /* name_of_this */
|
||||||
false, /* la_store_sym_names_in_linkage_form_p */
|
false, /* la_store_sym_names_in_linkage_form_p */
|
||||||
|
@ -2147,6 +2120,32 @@ public:
|
||||||
{
|
{
|
||||||
return rust_parse (ps);
|
return rust_parse (ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See language.h. */
|
||||||
|
|
||||||
|
void emitchar (int ch, struct type *chtype,
|
||||||
|
struct ui_file *stream, int quoter) const override
|
||||||
|
{
|
||||||
|
if (!rust_chartype_p (chtype))
|
||||||
|
generic_emit_char (ch, chtype, stream, quoter,
|
||||||
|
target_charset (get_type_arch (chtype)));
|
||||||
|
else if (ch == '\\' || ch == quoter)
|
||||||
|
fprintf_filtered (stream, "\\%c", ch);
|
||||||
|
else if (ch == '\n')
|
||||||
|
fputs_filtered ("\\n", stream);
|
||||||
|
else if (ch == '\r')
|
||||||
|
fputs_filtered ("\\r", stream);
|
||||||
|
else if (ch == '\t')
|
||||||
|
fputs_filtered ("\\t", stream);
|
||||||
|
else if (ch == '\0')
|
||||||
|
fputs_filtered ("\\0", stream);
|
||||||
|
else if (ch >= 32 && ch <= 127 && isprint (ch))
|
||||||
|
fputc_filtered (ch, stream);
|
||||||
|
else if (ch <= 255)
|
||||||
|
fprintf_filtered (stream, "\\x%02x", ch);
|
||||||
|
else
|
||||||
|
fprintf_filtered (stream, "\\u{%06x}", ch);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Single instance of the Rust language class. */
|
/* Single instance of the Rust language class. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue