static FIXUP *_merge_fixup_lists( FIXUP *dst_list, FIXUP *src_list, ssize_t dst_end, cexception_t *ex ) { FIXUP *src_fixup; foreach_fixup( src_fixup, src_list ) { int is_abs = fixup_is_absolute( src_fixup ); ssize_t addr = fixup_address( src_fixup ); const char *name = fixup_name( src_fixup ); dst_list = new_fixup( name, addr + dst_end, is_abs, dst_list, ex ); }
/* * Process a node, adding entries for its children and its properties. */ void proc_device_tree_add_node(struct device_node *np, struct proc_dir_entry *de) { struct property *pp; struct proc_dir_entry *ent; struct device_node *child; const char *p; set_node_proc_entry(np, de); for (child = NULL; (child = of_get_next_child(np, child));) { /* Use everything after the last slash, or the full name */ p = strrchr(child->full_name, '/'); if (!p) p = child->full_name; else ++p; if (duplicate_name(de, p)) p = fixup_name(np, de, p); ent = proc_mkdir(p, de); if (ent == NULL) break; proc_device_tree_add_node(child, ent); } of_node_put(child); for (pp = np->properties; pp != NULL; pp = pp->next) { p = pp->name; if (strchr(p, '/')) continue; if (duplicate_name(de, p)) p = fixup_name(np, de, p); ent = __proc_device_tree_add_prop(de, pp, p); if (ent == NULL) break; } }
void thrcode_fixup_op_break( THRCODE *thrcode, const char *loop_label, int address ) { FIXUP *fixup, *next , *unused = NULL; for( fixup = thrcode->op_break_fixups; fixup != NULL; ) { next = fixup_next( fixup ); if( strcmp( loop_label, fixup_name( fixup )) == 0 ) { thrcode_fixup( thrcode, fixup, address ); delete_fixup( fixup ); } else { unused = fixup_append( fixup, unused ); } fixup = next; } thrcode->op_break_fixups = unused; }
void thrcode_fixup_function_calls( THRCODE *thrcode, const char *function_name, int address ) { FIXUP *fixup, *next , *unused = NULL; for( fixup = thrcode->forward_function_calls; fixup != NULL; ) { next = fixup_next( fixup ); if( strcmp( function_name, fixup_name( fixup )) == 0 ) { thrcode_fixup( thrcode, fixup, address ); delete_fixup( fixup ); } else { unused = fixup_append( fixup, unused ); } fixup = next; } thrcode->forward_function_calls = unused; }
Item::Item(const rapidjson::Value &json) : name_(fixup_name(json["name"].GetString())), location_(ItemLocation(json)), typeLine_(fixup_name(json["typeLine"].GetString())), corrupted_(json["corrupted"].GetBool()), identified_(json["identified"].GetBool()), w_(json["w"].GetInt()), h_(json["h"].GetInt()), frameType_(json["frameType"].GetInt()), icon_(json["icon"].GetString()), sockets_cnt_(0), links_cnt_(0), sockets_({ 0, 0, 0, 0 }), json_(Util::RapidjsonSerialize(json)), has_mtx_(false), ilvl_(0) { for (auto &mod_type : ITEM_MOD_TYPES) { text_mods_[mod_type] = std::vector<std::string>(); if (json.HasMember(mod_type.c_str())) { auto &mods = text_mods_[mod_type]; for (auto &mod : json[mod_type.c_str()]) mods.push_back(mod.GetString()); } } if (json.HasMember("note")) { note_ = json["note"].GetString(); } if (json.HasMember("properties")) { for (auto prop_it = json["properties"].Begin(); prop_it != json["properties"].End(); ++prop_it) { auto &prop = *prop_it; std::string name = prop["name"].GetString(); if (name == "Map Level") name = "Level"; if (name == "Elemental Damage") { for (auto value_it = prop["values"].Begin(); value_it != prop["values"].End(); ++value_it) elemental_damage_.push_back(std::make_pair((*value_it)[0].GetString(), (*value_it)[1].GetInt())); } else { if (prop["values"].Size()) properties_[name] = prop["values"][0][0].GetString(); } ItemProperty property; property.name = name; property.display_mode = prop["displayMode"].GetInt(); for (auto &value : prop["values"]) { ItemPropertyValue v; v.str = value[0].GetString(); v.type = value[1].GetInt(); property.values.push_back(v); } text_properties_.push_back(property); } } if (json.HasMember("requirements")) { for (auto &req : json["requirements"]) { std::string name = req["name"].GetString(); std::string value = req["values"][0][0].GetString(); requirements_[name] = std::atoi(value.c_str()); ItemPropertyValue v; v.str = value; v.type = req["values"][0][1].GetInt(); text_requirements_.push_back({ name, v }); } } if (json.HasMember("sockets")) { ItemSocketGroup current_group = { 0, 0, 0, 0 }; sockets_cnt_ = json["sockets"].Size(); int counter = 0, prev_group = -1; for (auto &socket : json["sockets"]) { ItemSocket current_socket = { static_cast<unsigned char>(socket["group"].GetInt()), socket["attr"].GetString()[0] }; text_sockets_.push_back(current_socket); if (prev_group != current_socket.group) { counter = 0; socket_groups_.push_back(current_group); current_group = { 0, 0, 0, 0 }; } prev_group = current_socket.group; ++counter; links_cnt_ = std::max(links_cnt_, counter); switch (current_socket.attr) { case 'S': sockets_.r++; current_group.r++; break; case 'D': sockets_.g++; current_group.g++; break; case 'I': sockets_.b++; current_group.b++; break; case 'G': sockets_.w++; current_group.w++; break; } } socket_groups_.push_back(current_group); } CalculateHash(json); count_ = 1; if (properties_.find("Stack Size") != properties_.end()) { std::string size = properties_["Stack Size"]; if (size.find("/") != std::string::npos) { size = size.substr(0, size.find("/")); count_ = std::stoi(size); } } has_mtx_ = json.HasMember("cosmeticMods"); if (json.HasMember("ilvl")) ilvl_ = json["ilvl"].GetInt(); GenerateMods(json); }