void dr_lib_dump(write_stream_t stream, LPDRMETALIB metaLib, int ident) { int i; int meta_count; stream_putc_count(stream, ' ', ident); if (metaLib == NULL) { stream_printf(stream, "invalid METALIB!!!"); return; } stream_printf( stream, "meta-lib: name=%s, version=%d, build-version=%d, size=%d", dr_lib_name(metaLib), dr_lib_version(metaLib), dr_lib_build_version(metaLib), dr_lib_size(metaLib)); meta_count = dr_lib_meta_num(metaLib); for(i = 0; i < meta_count; ++i) { dr_lib_dump_meta(stream, dr_lib_meta_at(metaLib, i), ident + 4); } stream_putc(stream, '\n'); }
static void dr_lib_dump_meta(write_stream_t stream, LPDRMETA meta, int ident) { stream_putc(stream, '\n'); stream_putc_count(stream, ' ', ident); stream_printf(stream, "%s[%d]:", dr_meta_name(meta), dr_meta_id(meta)); }
void cfg_dump(cfg_t cfg, write_stream_t stream, int ident, int level_ident) { struct cfg_it it; cfg_t child; int c; if(cfg == 0) return; switch(cfg->m_type) { case CPE_CFG_TYPE_SEQUENCE: { stream_putc(stream, '['); c = 0; cfg_it_init(&it, cfg); if ((child = cfg_it_next(&it))) { stream_putc(stream, ' '); cfg_dump(child, stream, ident + level_ident, level_ident); ++c; } while((child = cfg_it_next(&it))) { stream_putc(stream, '\n'); stream_putc_count(stream, ' ', ident); stream_putc(stream, ','); stream_putc(stream, ' '); cfg_dump(child, stream, ident + level_ident, level_ident); ++c; } if (c == 1) { stream_putc(stream, ' '); } else if (c > 1) { stream_putc(stream, '\n'); stream_putc_count(stream, ' ', ident); } stream_putc(stream, ']'); break; } case CPE_CFG_TYPE_STRUCT: { stream_putc(stream, '{'); c = 0; cfg_it_init(&it, cfg); if ((child = cfg_it_next(&it))) { stream_printf(stream, " %s=", cfg_name(child)); cfg_dump(child, stream, ident + level_ident, level_ident); ++c; } while((child = cfg_it_next(&it))) { stream_putc(stream, '\n'); stream_putc_count(stream, ' ', ident); stream_printf(stream, ", %s=", cfg_name(child)); cfg_dump(child, stream, ident + level_ident, level_ident); ++c; } if (c == 1) { stream_putc(stream, ' '); } else if (c > 1) { stream_putc(stream, '\n'); stream_putc_count(stream, ' ', ident); } stream_putc(stream, '}'); break; } default: dr_ctype_print_to_stream(stream, cfg_data(cfg), cfg->m_type, 0); break; } }