void unit_loop_dump(Unit_loop *ul) { Linked_list* ll = ul->statements; debug_pr_lvl(), puts(">loop unit"); debug_pr_lvl(), puts(" start statement :"); if(ul->start_action) { debug_lvl++; op_dump(ul->start_action); debug_lvl--; } else debug_pr_lvl(), puts(" (none)"); debug_pr_lvl(), puts(" start condition :"); if(ul->start_condition) { debug_lvl++; op_dump(ul->start_condition); debug_lvl--; } else debug_pr_lvl(), puts(" (none)"); debug_pr_lvl(), puts(" end condition :"); if(ul->end_condition) { debug_lvl++; op_dump(ul->end_condition); debug_lvl--; } else debug_pr_lvl(), puts(" (none)"); debug_pr_lvl(), puts(" statements : "); debug_lvl++; while(ll) { switch(ll->type) { case LLT_UNIT : unit_dump((Unit*)(ll->value)); break; case LLT_OPERATION : op_dump((Operation*)(ll->value)); break; case LLT_VARIABLE : var_dump((Variable*)(ll->value)); break; case LLT_CONDITION : unit_cond_dump((Unit_conditional*)(ll->value)); break; case LLT_LOOP : // a faire break; default : debug_pr_lvl(), puts(">(error type statement)"); } ll = ll->next; } debug_lvl--; }
int main(int argc, char **argv) { int i, idx, op = -1; if (argc < 2) print_usage_and_exit(); for (i = 0; i < sizeof(OPS) / sizeof(OPS[0]); i++) if (!strcmp(argv[1], OPS[i])){ op = i; break; } if (op == -1) print_usage_and_exit(); idx = initialize(argc, argv, op); switch (op){ case OP_MAKE: return op_make(&options); case OP_DUMP: return op_dump(&options); case OP_INDEX: return op_index(&options); case OP_MERGE: return op_merge(&options, (const char**)&argv[idx], argc - idx); default: print_usage_and_exit(); } return 0; }
// Affichage debug d'unité void unit_dump(Unit *u) { Linked_list *ll = u->statements; debug_pr_lvl(), puts(">unit :"); debug_pr_lvl(), puts(" statements : "); debug_lvl++; while(ll) { switch(ll->type) { case LLT_UNIT : unit_dump((Unit*)(ll->value)); break; case LLT_OPERATION : op_dump((Operation*)(ll->value)); break; case LLT_VARIABLE : var_dump((Variable*)(ll->value)); break; case LLT_CONDITION : unit_cond_dump((Unit_conditional*)(ll->value)); break; case LLT_LOOP : unit_loop_dump((Unit_loop*)(ll->value)); break; default : debug_pr_lvl(), puts(">(error type statement)"); } ll = ll->next; } debug_lvl--; }
// Affichage debug d'opération void op_dump(Operation *o) { debug_pr_lvl(), puts(">operation :"); debug_pr_lvl(), printf(" type : %s (%x)\n", operation_type_debug(o->type), o->type); // Valeur if(o->identifier.s) { debug_pr_lvl(), printf(" info.val : %s\n", o->identifier.s ? o->identifier.s : "(null)"); debug_pr_lvl(), printf(" info.val_h : %lu\n", (long unsigned)o->identifier.s_h); } /*if(o->info.line) debug_pr_lvl(), printf(" info.line : %u\n", o->info.line);*/ // Variable if(o->value) { debug_pr_lvl(), printf(" info.value : \n"); debug_lvl++; var_dump(o->value); debug_lvl--; } // Branches if(o->operations[0]) { debug_pr_lvl(), printf(" left operation : \n"); debug_lvl++; op_dump((Operation*)o->operations[0]); debug_lvl--; } if(o->operations[1]) { debug_pr_lvl(), printf(" right operation : \n"); debug_lvl++; op_dump((Operation*)o->operations[1]); debug_lvl--; } }
/* * Dump the contents of the prom corresponding to all known keywords. */ static void dump_prom(void) { struct keytabent *ktent; if (use_openprom) { /* * We have a special dump routine for this. */ op_dump(); } #if defined(__sparc__) && !defined(__sparc64__) else for (ktent = eekeytab; ktent->kt_keyword != NULL; ++ktent) (*ktent->kt_handler)(ktent, NULL); #endif /* __sparc__ && !__sparc64__ */ }