void print_DArray_IDinfo ( DArray *array) { int i = 0; if(array->element_size > 0) { PrintVisitor* pV = print_visitor_new(); for(i = 0; i < DArray_end(array); i++) { HashmapNode* node = (HashmapNode*) DArray_get(array,i); ID_info* idi = (ID_info*)node->data; if(idi) { char* type = string_from_ID_info(idi); if(type) { switch (idi->type){ case 0: debug("Const %10s ID: %20s : Remove %d isTrigger %d isPrint %d Value %d\n\n", type, idi->id, idi->k_remove, idi->isTrigger, idi->isPrint, *(int*) idi->value); break; case 1: debug("Input %10s ID: %20s : Remove %d isTrigger %d isPrint %d\n\n", type, idi->id, idi->k_remove, idi->isTrigger, idi->isPrint); break; case 2:{ debug("Output %10s ID: %20s : Remove %d isTrigger %d isPrint %d Value:\n\n", type, idi->id, idi->k_remove, idi->isTrigger, idi->isPrint); ast* value = (ast*) idi->value; value->accept(value, pV->visitor); debug("\n"); break; } case 3:{ debug("Template %10s ID: %20s : Remove -1 isTrigger -1 isPrint -1 Value:\n", type, idi->id); debug(" Parameter: "); list_t* iter = idi->parameter; do{ PARA_info* pI = (PARA_info*) iter->data; if(pI->valuetype == 0) debug("%s: bool, ", pI->id ); else{ if(pI->valuetype == 1) debug("%s: int, ", pI->id ); else debug("%s: double, ", pI->id); } iter = iter->succ; } while (iter != idi->parameter); debug("\n"); ast* value = (ast*) idi->value; value->accept(value, pV->visitor); debug("\n\n"); break; } default: debug("error: 0-3 but was: %d\n\n", idi->type); exit(1); } } } } pV->destroy(pV); } }
void print_DArray_LinkedList( DArray *array) { int i = 0; if(array->end > 0) { debug("Bucket:\n"); PrintVisitor* pV = print_visitor_new(); for(i = 0; i < DArray_end(array); i++) { HashmapNode* node = (HashmapNode*) DArray_get(array,i); list_t* list = (list_t*)node->data; list_t* iter = list; debug("List %s:\n", node->key); do{ ID_info* idi = (ID_info*) iter->data; if(idi) { char* type = string_from_ID_info(idi); if(type) switch (idi->type){ case 0: debug(" Const %10s ID: %20s : Remove %d isTrigger %d isPrint %d Value %d\n", type, idi->id, idi->k_remove, idi->isTrigger, idi->isPrint, *(int*) idi->value); break; case 1: debug(" Input %10s ID: %20s : Remove %d isTrigger %d isPrint %d\n", type, idi->id, idi->k_remove, idi->isTrigger, idi->isPrint); break; case 2:{ debug(" Output %10s ID: %20s : Remove %d isTrigger %d isPrint %d Value:\n", type, idi->id, idi->k_remove, idi->isTrigger, idi->isPrint); ast* value = (ast*) idi->value; value->accept(value, pV->visitor); break; } case 3:{ debug(" Template %10s ID: %20s : Remove -1 isTrigger -1 isPrint -1 Value:\n", type, idi->id); ast* value = (ast*) idi->value; value->accept(value, pV->visitor); break; } default: debug(" error: 0-3 but was: %d\n", idi->type); exit(1); } } iter = iter->succ; } while(iter != list); } pV->destroy(pV); } }