| 1238 | } |
| 1239 | |
| 1240 | static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) |
| 1241 | { |
| 1242 | struct gstr *gs = (struct gstr*)data; |
| 1243 | const char *sym_str = NULL; |
| 1244 | |
| 1245 | if (sym) |
| 1246 | sym_str = sym_get_string_value(sym); |
| 1247 | |
| 1248 | if (gs->max_width) { |
| 1249 | unsigned extra_length = strlen(str); |
| 1250 | const char *last_cr = strrchr(gs->s, '\n'); |
| 1251 | unsigned last_line_length; |
| 1252 | |
| 1253 | if (sym_str) |
| 1254 | extra_length += 4 + strlen(sym_str); |
| 1255 | |
| 1256 | if (!last_cr) |
| 1257 | last_cr = gs->s; |
| 1258 | |
| 1259 | last_line_length = strlen(gs->s) - (last_cr - gs->s); |
| 1260 | |
| 1261 | if ((last_line_length + extra_length) > gs->max_width) |
| 1262 | str_append(gs, "\\\n"); |
| 1263 | } |
| 1264 | |
| 1265 | str_append(gs, str); |
| 1266 | if (sym && sym->type != S_UNKNOWN) |
| 1267 | str_printf(gs, " [=%s]", sym_str); |
| 1268 | } |
| 1269 | |
| 1270 | void expr_gstr_print(struct expr *e, struct gstr *gs) |
| 1271 | { |
nothing calls this directly
no test coverage detected