LabelInfo * allocCustomerLabel(SYM const* st, SMemPool * pool) { LabelInfo * li = allocLabel(pool); LABEL_INFO_name(li) = st; LABEL_INFO_type(li) = L_CLABEL; return li; }
LABEL_INFO * new_clabel(SYM * st, SMEM_POOL * pool) { LABEL_INFO * li = new_label(pool); LABEL_INFO_name(li) = st; LABEL_INFO_type(li) = L_CLABEL; return li; }
//Recusively dumping SCOPE trees. void dump_scope(SCOPE * s, UINT flag) { if (g_tfile == NULL) return; static CHAR buf[8192]; buf[0] = 0; note("\nSCOPE(id:%d, level:%d)", SCOPE_id(s), SCOPE_level(s)); g_indent++; //symbols SYM_LIST * sym_list = SCOPE_sym_tab_list(s); if (sym_list != NULL) { note("\nSYMBAL:"); g_indent++; note("\n"); while (sym_list != NULL) { note("%s\n", SYM_name(SYM_LIST_sym(sym_list))); sym_list = SYM_LIST_next(sym_list); } g_indent--; } //all of defined customer label in code LABEL_INFO * li = SCOPE_label_list(s).get_head(); if (li != NULL) { note("\nDEFINED LABEL:"); g_indent++; note("\n"); for (; li != NULL; li = SCOPE_label_list(s).get_next()) { IS_TRUE0(map_lab2lineno(li) != 0); note("%s (def in line:%d)\n", SYM_name(LABEL_INFO_name(li)), map_lab2lineno(li)); } g_indent--; } //refered customer label in code li = SCOPE_ref_label_list(s).get_head(); if (li != NULL) { note("\nREFED LABEL:"); g_indent++; note("\n"); for (; li != NULL; li = SCOPE_ref_label_list(s).get_next()) { note("%s (use in line:%d)\n", SYM_name(LABEL_INFO_name(li)), map_lab2lineno(li)); } g_indent--; } //enums ENUM_LIST * el = SCOPE_enum_list(s); if (el != NULL) { note("\nENUM LIST:"); g_indent++; note("\n"); while (el != NULL) { buf[0] = 0; format_enum_complete(buf, ENUM_LIST_enum(el)); note("%s\n", buf); el = ENUM_LIST_next(el); } g_indent--; } //user defined type, by 'typedef' USER_TYPE_LIST * utl = SCOPE_user_type_list(s); if (utl != NULL) { note("\nUSER TYPE:"); g_indent++; note("\n"); while (utl != NULL) { buf[0] = 0; format_user_type_spec(buf, USER_TYPE_LIST_utype(utl)); note("%s\n", buf); utl = USER_TYPE_LIST_next(utl); } g_indent--; } //structs STRUCT * st = SCOPE_struct_list(s); if (st != NULL) { note("\nSTRUCT:"); g_indent++; note("\n"); while (st != NULL) { buf[0] = 0; format_struct_complete(buf, st); note("%s\n", buf); st = USER_TYPE_LIST_next(st); } g_indent--; } //unions UNION * un = SCOPE_union_list(s); if (un != NULL) { note("\nUNION:"); g_indent++; note("\n"); while (un != NULL) { buf[0] = 0; format_union_complete(buf, un); note("%s\n", buf); un = USER_TYPE_LIST_next(un); } g_indent--; } //declarations DECL * dcl = SCOPE_decl_list(s); if (dcl != NULL) { note("\nDECLARATIONS:"); note("\n"); g_indent++; while (dcl != NULL) { buf[0] = 0; format_declaration(buf, dcl); note("%s", buf); dump_decl(dcl); //Dump function body if (DECL_is_fun_def(dcl) && HAVE_FLAG(flag, DUMP_SCOPE_FUNC_BODY)) { g_indent += 2; dump_scope(DECL_fun_body(dcl), flag); g_indent -= 2; } //Dump initializing value/expression. if (DECL_is_init(DECL_decl_list(dcl))) { note("= "); g_indent += 2; dump_tree(DECL_init_tree(DECL_decl_list(dcl))); g_indent -= 2; } note("\n"); dcl = DECL_next(dcl); } g_indent--; } fflush(g_tfile); if (HAVE_FLAG(flag, DUMP_SCOPE_STMT_TREE)) { TREE * t = SCOPE_stmt_list(s); if (t != NULL) { note("\nSTATEMENT:"); g_indent++; note("\n"); dump_trees(t); g_indent--; } } g_indent--; }