mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 04:43:03 +00:00
reports: don't escape the labels
Currently we use "quotearg" to escape the strings output in Dot. As a
result, if the user's locale is C for instance, all the non-ASCII are
escaped. Unfortunately graphviz does not interpret this style of
escaping.
For instance:
5 -> 2 [style=solid label="\"\303\221\303\271\341\271\203\303\251\342\204\235\303\264\""]
was displayed as a sequence of numbers. We now output:
5 -> 2 [style=solid label="\"Ñùṃéℝô\""]
independently of the user's locale.
* src/system.h (obstack_backslash): New.
* src/graphviz.h, src/graphviz.c (escape): Remove, use
obstack_backslash instead.
* src/print-graph.c: Likewise.
* tests/report.at: Adjust.
This commit is contained in:
17
src/system.h
17
src/system.h
@@ -171,6 +171,23 @@ typedef size_t uintptr_t;
|
||||
# define obstack_sgrow(Obs, Str) \
|
||||
obstack_grow (Obs, Str, strlen (Str))
|
||||
|
||||
/* Output Str escaped to be a string.
|
||||
|
||||
For instance "\"foo\"" -> "\\\"foo\\\"". */
|
||||
|
||||
# define obstack_backslash(Obs, Str) \
|
||||
do { \
|
||||
char const *p__; \
|
||||
for (p__ = Str; *p__; p__++) \
|
||||
switch (*p__) \
|
||||
{ \
|
||||
case '"': obstack_sgrow (Obs, "\\\""); break; \
|
||||
case '\\': obstack_sgrow (Obs, "\\\\"); break; \
|
||||
default: obstack_1grow (Obs, *p__); break; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Output Str escaped for our postprocessing (i.e., escape M4 special
|
||||
characters).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user