else
offset = 0;
- gen_field_iterator_init(&iter, strct, p);
+ gen_field_iterator_init(&iter, strct, p,
+ option_color == COLOR_ALWAYS);
while (gen_field_iterator_next(&iter)) {
idx = 0;
print_dword_val(&iter, offset, &dword_num);
struct gen_field_iterator iter;
char *token = NULL;
int idx = 0, dword_num = 0;
- gen_field_iterator_init(&iter, inst, p);
+ gen_field_iterator_init(&iter, inst, p,
+ option_color == COLOR_ALWAYS);
while (gen_field_iterator_next(&iter)) {
idx = 0;
print_dword_val(&iter, offset, &dword_num);
void
gen_field_iterator_init(struct gen_field_iterator *iter,
- struct gen_group *group, const uint32_t *p)
+ struct gen_group *group,
+ const uint32_t *p,
+ bool print_colors)
{
iter->group = group;
iter->p = p;
iter->i = 0;
+ iter->print_colors = print_colors;
}
bool
snprintf(iter->value, sizeof(iter->value),
"%"PRIu64, field(v.qw, f->start, f->end));
break;
- case GEN_TYPE_BOOL:
+ case GEN_TYPE_BOOL: {
+ const char *true_string =
+ iter->print_colors ? "\e[0;35mtrue\e[0m" : "true";
snprintf(iter->value, sizeof(iter->value),
- "%s", field(v.qw, f->start, f->end) ? "true" : "false");
+ "%s", field(v.qw, f->start, f->end) ? true_string : "false");
break;
+ }
case GEN_TYPE_FLOAT:
snprintf(iter->value, sizeof(iter->value), "%f", v.f);
break;
char value[128];
const uint32_t *p;
int i;
+ bool print_colors;
};
struct gen_group {
};
void gen_field_iterator_init(struct gen_field_iterator *iter,
- struct gen_group *group, const uint32_t *p);
+ struct gen_group *group,
+ const uint32_t *p,
+ bool print_colors);
bool gen_field_iterator_next(struct gen_field_iterator *iter);