void CFS_MGR::dump_abs_tree(ABS_NODE * an, UINT indent) { while (an != NULL) { switch (ABS_NODE_type(an)) { case ABS_BB: fprintf(g_tfile, "\n"); dump_indent(indent); fprintf(g_tfile, "BB%d", IR_BB_id(ABS_NODE_bb(an))); break; case ABS_LOOP: fprintf(g_tfile, "\n"); dump_indent(indent); fprintf(g_tfile, "LOOP: HEAD=BB%d", IR_BB_id(ABS_NODE_loop_head(an))); dump_abs_tree(ABS_NODE_loop_body(an), indent + 4); break; case ABS_IF: fprintf(g_tfile, "\n"); dump_indent(indent); fprintf(g_tfile, "IF: HEAD=BB%d", IR_BB_id(ABS_NODE_if_head(an))); if (ABS_NODE_true_body(an) != NULL) { fprintf(g_tfile, "\n"); dump_indent(indent); fprintf(g_tfile, "TRUE_BODY:"); dump_abs_tree(ABS_NODE_true_body(an), indent + 4); } if (ABS_NODE_false_body(an) != NULL) { fprintf(g_tfile, "\n"); dump_indent(indent); fprintf(g_tfile, "FALSE_BODY:"); dump_abs_tree(ABS_NODE_false_body(an), indent + 4); } break; } an = ABS_NODE_next(an); } }
static void tn_dump_ep(tn_endpoint_t *fsep, int indent) { const char *prefix = dump_indent(indent); int newind = indent + 1; const char *eppref = dump_indent(newind); log_debug("%sprovider='%s';\n", prefix, fsep->base.ptype->name); log_debug("%sis_temporary='%d';\n", prefix, fsep->base.is_temporary); log_debug("%sis_assigned='%d';\n", prefix, fsep->base.is_assigned); log_debug("%shostname='%d';\n", prefix, fsep->hostname); log_debug("%sfiles={;\n", prefix); for (int i = 0; ; i++) { File *file = (File*) reg_get(&fsep->base.files, i); log_debug("%s// file at %p\n", eppref, file); if (file != NULL) { log_debug("%s{\n", eppref, file); if (file->file.handler->dump != NULL) { file->file.handler->dump((file_t*)file, 0, newind+1); } log_debug("%s{\n", eppref, file); } else { break; } } log_debug("%s}\n", prefix); }
static void dump_value(int indent, amqp_field_value_t v) { dump_indent(indent); putchar(v.kind); switch (v.kind) { case AMQP_FIELD_KIND_BOOLEAN: puts(v.value.boolean ? " true" : " false"); break; case AMQP_FIELD_KIND_I8: printf(" %"PRId8"\n", v.value.i8); break; case AMQP_FIELD_KIND_U8: printf(" %"PRIu8"\n", v.value.u8); break; case AMQP_FIELD_KIND_I16: printf(" %"PRId16"\n", v.value.i16); break; case AMQP_FIELD_KIND_U16: printf(" %"PRIu16"\n", v.value.u16); break; case AMQP_FIELD_KIND_I32: printf(" %"PRId32"\n", v.value.i32); break; case AMQP_FIELD_KIND_U32: printf(" %"PRIu32"\n", v.value.u32); break; case AMQP_FIELD_KIND_I64: printf(" %"PRId64"\n", v.value.i64); break; case AMQP_FIELD_KIND_F32: printf(" %g\n", (double) v.value.f32); break; case AMQP_FIELD_KIND_F64: printf(" %g\n", v.value.f64); break; case AMQP_FIELD_KIND_DECIMAL: printf(" %d:::%u\n", v.value.decimal.decimals, v.value.decimal.value); break; case AMQP_FIELD_KIND_UTF8: printf(" %.*s\n", (int) v.value.bytes.len, (char *) v.value.bytes.bytes); break; case AMQP_FIELD_KIND_BYTES: { int i; putchar(' '); for (i = 0; i < v.value.bytes.len; i++) { printf("%02x", ((char *) v.value.bytes.bytes)[i]); } putchar('\n'); } break; case AMQP_FIELD_KIND_ARRAY: putchar('\n'); { int i; for (i = 0; i < v.value.array.num_entries; i++) { dump_value(indent + 2, v.value.array.entries[i]); } } break; case AMQP_FIELD_KIND_TIMESTAMP: printf(" %"PRIu64"\n", v.value.u64); break; case AMQP_FIELD_KIND_TABLE: putchar('\n'); { int i; for (i = 0; i < v.value.table.num_entries; i++) { dump_indent(indent + 2); printf("%.*s ->\n", (int) v.value.table.entries[i].key.len, (char *) v.value.table.entries[i].key.bytes); dump_value(indent + 4, v.value.table.entries[i].value); } } break; case AMQP_FIELD_KIND_VOID: putchar('\n'); break; default: printf("???\n"); break; } }
void _dump(be_node *node, ssize_t indent) { if (node == NULL) { printf("Nothing to dump, node==null\n"); return; } dump_indent(indent); indent = abs(indent); switch (node->type) { case BE_STR: { uint64_t l = node->val.s.len; char * str = new char[l + 1]; memset(str, 0, l + 1); memcpy(str, node->val.s.ptr ,l); printf("str = %s (len = %lli)\n", str, l); delete[] str; break; } case BE_INT: printf("int = %lli\n", node->val.i); break; case BE_LIST: puts("list ["); for (int i = 0; i < node->val.l.count; i++) _dump(&node->val.l.elements[i], indent + 1); dump_indent(indent); puts("]"); break; case BE_DICT: puts("dict {"); for (int i = 0; i < node->val.d.count; i++) { dump_indent(indent + 1); uint64_t l = node->val.d.keys[i].len; char * str = new char[l + 1]; memset(str, 0, l + 1); memcpy(str, node->val.d.keys[i].ptr ,l); printf("%s => ", str); delete[] str; _dump(&node->val.d.vals[i], -(indent + 1)); } dump_indent(indent); puts("}"); break; } }
static void tn_dump_file(file_t *fp, int recurse, int indent) { File *file = (File*)fp; const char *prefix = dump_indent(indent); log_debug("%shandler='%s';\n", prefix, file->file.handler->name); log_debug("%sparent='%p';\n", prefix, file->file.parent); if (recurse) { log_debug("%s{\n", prefix); if (file->file.parent != NULL && file->file.parent->handler->dump != NULL) { file->file.parent->handler->dump(file->file.parent, 1, indent+1); } log_debug("%s}\n", prefix); } log_debug("%sisdir='%d';\n", prefix, file->file.isdir); log_debug("%sdirstate='%d';\n", prefix, file->file.dirstate); log_debug("%spattern='%s';\n", prefix, file->file.pattern); log_debug("%sfilesize='%d';\n", prefix, file->file.filesize); log_debug("%sfilename='%s';\n", prefix, file->file.filename); log_debug("%srecordlen='%d';\n", prefix, file->file.recordlen); log_debug("%smode='%d';\n", prefix, file->file.mode); log_debug("%stype='%d';\n", prefix, file->file.type); log_debug("%sattr='%d';\n", prefix, file->file.attr); log_debug("%swritable='%d';\n", prefix, file->file.writable); log_debug("%sseekable='%d';\n", prefix, file->file.seekable); }
static void dump_vprintf_indent( dump *ctx, int indent, const char *fmt, va_list l) { if(indent) dump_indent(ctx); vfprintf(ctx->fout, fmt, l); }
void dump_strliteral_indent(dump *ctx, int indent, const char *str, size_t len) { if(indent) dump_indent(ctx); fprintf(ctx->fout, "%s\"", maybe_colour(ctx->fout, col_strlit)); literal_print(ctx->fout, str, len); fprintf(ctx->fout, "\"%s\n", maybe_colour(ctx->fout, col_off)); }
static void tnp_dump(int indent) { const char *prefix = dump_indent(indent); int newind = indent + 1; const char *eppref = dump_indent(newind); log_debug("%s// tcp system provider\n", prefix); log_debug("%sendpoints={\n", prefix); for (int i = 0; ; i++) { tn_endpoint_t *fsep = (tn_endpoint_t*) reg_get(&endpoints, i); if (fsep != NULL) { log_debug("%s// endpoint %p\n", eppref, fsep); log_debug("%s{\n", eppref); tn_dump_ep(fsep, newind+1); log_debug("%s}\n", eppref); } else { break; } } log_debug("%s}\n", prefix); }
static void dump_desc_colour_newline( dump *ctx, const char *desc, const void *uniq, const where *loc, const char *col, int newline) { char *where_str; size_t where_str_len = 0; const char *fname = NULL; unsigned line = 0; const int num_len = 32; dump_indent(ctx); if(!ctx->last_fname || ctx->last_fname != loc->fname) fname = loc->fname; if(!ctx->last_line || ctx->last_line != loc->line) line = loc->line; where_str_len = (fname ? strlen(fname) : 0) + (line ? num_len : 0) + num_len; where_str = umalloc(where_str_len); if(fname) snprintf(where_str, where_str_len, "%s:%d:%d", fname, line, loc->chr); else if(line) snprintf(where_str, where_str_len, "line %d, col %d", line, loc->chr); else snprintf(where_str, where_str_len, "col %d", loc->chr); fprintf(ctx->fout, "%s%s %s%p %s<%s>%s", col, desc, maybe_colour(ctx->fout, col_ptr), uniq, maybe_colour(ctx->fout, col_where), where_str, maybe_colour(ctx->fout, col_off)); dump_newline(ctx, newline); free(where_str); if(fname) ctx->last_fname = fname; if(line) ctx->last_line = line; }
static void dump_inst(struct dump_info *di, const unsigned **assem, struct sh_op op, const struct sh_opcode_info *info) { struct dump_op dop; boolean not_first_arg = FALSE; uint i; assert(info->num_dst <= 1); di->indent -= info->pre_dedent; dump_indent(di->indent); di->indent += info->post_indent; dump_op(op, info->mnemonic); parse_op(di, assem, &dop, info->num_dst, info->num_src); if (info->num_dst > 0) { dump_dstreg(dop.dst, &dop.dstind, di); not_first_arg = TRUE; } for (i = 0; i < info->num_src; i++) { if (not_first_arg) { _debug_printf(", "); } else { _debug_printf(" "); } dump_srcreg(dop.src[i], &dop.srcind[i], di); not_first_arg = TRUE; } _debug_printf("\n"); }
static void dump_ast(SpnAST *ast, int indent) { static const char *const nodnam[] = { "program", "block-statement", "function-statement", "while", "do-while", "for", "foreach", "if", "break", "continue", "return", "empty-statement", "vardecl", "global-constant", "assign", "assign-add", "assign-subtract", "assign-multiply", "assign-divide", "assign-modulo", "assign-and", "assign-or", "assign-xor", "assign-left-shift", "assign-right-shift", "assign-concat", "concatenate", "conditional-ternary", "add", "subtract", "multiply", "divide", "modulo", "logical-and", "logical-or", "bitwise-and", "bitwise-or", "bitwise-xor", "left-shift", "right-shift", "equals", "not-equal", "less-than", "less-than-or-equal", "greater-than", "greater-than-or-equal", "unary-plus", "unary-minus", "preincrement", "predecrement", "sizeof", "typeof", "logical-not", "bitwise-not", "nth-arg", "postincrement", "postdecrement", "array-subscript", "memberof", "function-call", "identifier", "literal", "function-expr", "argc", "decl-argument", "call-argument", "branches", "for-header", "generic-compound" }; dump_indent(indent); printf("(%s", nodnam[ast->node]); /* print name, if any */ if (ast->name != NULL) { printf(" name = \"%s\"", ast->name->cstr); } /* print formatted value */ if ((ast->value.t == SPN_TYPE_NIL && ast->node == SPN_NODE_LITERAL) || ast->value.t != SPN_TYPE_NIL) { printf(" value = "); spn_value_print(&ast->value); } if (ast->left != NULL || ast->right != NULL) { fputc('\n', stdout); } /* dump subtrees, if any */ if (ast->left != NULL) { dump_ast(ast->left, indent + 1); } if (ast->right != NULL) { dump_ast(ast->right, indent + 1); } if (ast->left != NULL || ast->right != NULL) { dump_indent(indent); } puts(")"); }
void mincss_dump_node(node *nod, int depth) { if (depth >= 0) { printf("%02d:", nod->linenum); dump_indent(depth); } switch (nod->typ) { case nod_None: printf("None"); break; case nod_Token: printf("Token"); printf(" (%s)", mincss_token_name(nod->toktype)); break; case nod_Stylesheet: printf("Stylesheet"); break; case nod_TopLevel: printf("TopLevel"); break; case nod_AtRule: printf("AtRule"); break; case nod_Ruleset: printf("Ruleset"); break; case nod_Selector: printf("Selector"); break; case nod_Block: printf("Block"); break; case nod_Parens: printf("Parens"); break; case nod_Brackets: printf("Brackets"); break; case nod_Function: printf("Function"); break; default: printf("??? node-type %d", (int)nod->typ); break; } if (nod->text) { printf(" \""); int ix; for (ix=0; ix<nod->textlen; ix++) { int32_t ch = nod->text[ix]; if (ch < 32) printf("^%c", ch+64); else mincss_putchar_utf8(ch, stdout); } printf("\""); } if (nod->textdiv) { printf(" <%d/%d>", nod->textdiv, nod->textlen); } if (depth >= 0) { printf("\n"); if (nod->nodes) { int ix; for (ix=0; ix<nod->numnodes; ix++) { mincss_dump_node(nod->nodes[ix], depth+1); } } } }
static void dump_value(int indent, amqp_field_value_t v, FILE *out) { int i; dump_indent(indent, out); fputc(v.kind, out); switch (v.kind) { case AMQP_FIELD_KIND_BOOLEAN: fputs(v.value.boolean ? " true\n" : " false\n", out); break; case AMQP_FIELD_KIND_I8: fprintf(out, " %"PRId8"\n", v.value.i8); break; case AMQP_FIELD_KIND_U8: fprintf(out, " %"PRIu8"\n", v.value.u8); break; case AMQP_FIELD_KIND_I16: fprintf(out, " %"PRId16"\n", v.value.i16); break; case AMQP_FIELD_KIND_U16: fprintf(out, " %"PRIu16"\n", v.value.u16); break; case AMQP_FIELD_KIND_I32: fprintf(out, " %"PRId32"\n", v.value.i32); break; case AMQP_FIELD_KIND_U32: fprintf(out, " %"PRIu32"\n", v.value.u32); break; case AMQP_FIELD_KIND_I64: fprintf(out, " %"PRId64"\n", v.value.i64); break; case AMQP_FIELD_KIND_F32: fprintf(out, " %g\n", (double) v.value.f32); break; case AMQP_FIELD_KIND_F64: fprintf(out, " %g\n", v.value.f64); break; case AMQP_FIELD_KIND_DECIMAL: fprintf(out, " %u:::%u\n", v.value.decimal.decimals, v.value.decimal.value); break; case AMQP_FIELD_KIND_UTF8: fprintf(out, " %.*s\n", (int)v.value.bytes.len, (char *)v.value.bytes.bytes); break; case AMQP_FIELD_KIND_BYTES: fputc(' ', out); for (i = 0; i < (int)v.value.bytes.len; i++) { fprintf(out, "%02x", ((char *) v.value.bytes.bytes)[i]); } fputc('\n', out); break; case AMQP_FIELD_KIND_ARRAY: fputc('\n', out); for (i = 0; i < v.value.array.num_entries; i++) { dump_value(indent + 2, v.value.array.entries[i], out); } break; case AMQP_FIELD_KIND_TIMESTAMP: fprintf(out, " %"PRIu64"\n", v.value.u64); break; case AMQP_FIELD_KIND_TABLE: fputc('\n', out); for (i = 0; i < v.value.table.num_entries; i++) { dump_indent(indent + 2, out); fprintf(out, "%.*s ->\n", (int)v.value.table.entries[i].key.len, (char *)v.value.table.entries[i].key.bytes); dump_value(indent + 4, v.value.table.entries[i].value, out); } break; case AMQP_FIELD_KIND_VOID: fputc('\n', out); break; default: fprintf(out, "???\n"); break; } }