// meta_constant level.instantiate : level → list (name × level) → list level vm_obj level_instantiate(vm_obj const & o, vm_obj const & lst) { level const & l = to_level(o); buffer<name> ns; buffer<level> ls; vm_obj it = lst; while (!is_simple(it)) { vm_obj const & h = cfield(it, 0); ns.push_back(to_name(cfield(h, 0))); ls.push_back(to_level(cfield(h, 1))); it = cfield(it, 1); } return to_obj(instantiate(l, to_list(ns), to_list(ls))); }
vm_obj caching_user_attribute_get_cache(vm_obj const &, vm_obj const & vm_attr, vm_obj const & vm_s) { tactic_state const & s = to_tactic_state(vm_s); name const & n = to_name(cfield(vm_attr, 0)); vm_obj const & cache_handler = cfield(vm_attr, 2); list<name> const & deps = to_list_name(cfield(vm_attr, 3)); LEAN_TACTIC_TRY; environment const & env = s.env(); attribute const & attr = get_attribute(env, n); user_attr_cache & cache = get_user_attribute_cache(); auto it = cache.m_cache.find(attr.get_name()); if (it != cache.m_cache.end()) { if (it->second.m_fingerprint == attr.get_fingerprint(env) && check_dep_fingerprints(env, deps, it->second.m_dep_fingerprints)) { return mk_tactic_success(it->second.m_val, s); } lean_trace("user_attributes_cache", tout() << "cached result for [" << attr.get_name() << "] " << "has been found, but cache fingerprint does not match\n";); } else {
void SQLTableListManager::commitPrimary() { /* MySQL enforces the following detail: the fields that form the primary key are NOT NULL regardless of what */ std::deque<std::string> primaryFields; std::string::size_type ind = 1, prev = 1, tsiz = tempcontents_.size(); while (prev < tempcontents_.size()) { ind = tempcontents_.find(',', prev); if (ind != std::string::npos) { primaryFields.push_back(tempcontents_.substr(prev, ind - prev)); prev = ind + 1; } else { /* the primary key ends in ), we have to jump over this one too */ primaryFields.push_back(tempcontents_.substr(prev, tsiz - prev - 1)); break; } } /* Now that we have the field list let's default these fields from NULL to NOT NULL */ for (std::deque<std::string>::const_iterator it = primaryFields.begin() ; it != primaryFields.end() ; ++it) { std::string cfield(temptable_.indexedfields.at(*it)); if (cfield.find("not null", 0) == std::string::npos) { std::string::size_type nullpos = cfield.find(" null", 0); /* std::string::npos is also ok, we take the whole string */ std::string cfieldmod = cfield.substr(0, nullpos) + " not null"; temptable_.indexedfields.at(*it).assign(cfieldmod); } } temptable_.primary.insert(std::make_pair<std::string, std::string>(tempcontents_, tempconstraint_)); }
dsimp_config::dsimp_config(vm_obj const & o) { m_md = to_transparency_mode(cfield(o, 0)); m_max_steps = force_to_unsigned(cfield(o, 1)); m_canonize_instances = to_bool(cfield(o, 2)); m_single_pass = to_bool(cfield(o, 3)); m_fail_if_unchanged = to_bool(cfield(o, 4)); m_eta = to_bool(cfield(o, 5)); m_zeta = to_bool(cfield(o, 6)); m_beta = to_bool(cfield(o, 7)); m_proj = to_bool(cfield(o, 8)); m_iota = to_bool(cfield(o, 9)); m_unfold_reducible = to_bool(cfield(o, 10)); m_memoize = to_bool(cfield(o, 11)); }