static inline void apply_string (OT::hb_apply_context_t *c, const typename Proxy::Lookup &lookup, const hb_ot_layout_lookup_accelerator_t &accel) { hb_buffer_t *buffer = c->buffer; if (unlikely (!buffer->len || !c->lookup_mask)) return; c->set_lookup_props (lookup.get_props ()); hb_get_subtables_context_t::array_t subtables; hb_get_subtables_context_t c_get_subtables (subtables); lookup.dispatch (&c_get_subtables); if (likely (!lookup.is_reverse ())) { /* in/out forward substitution/positioning */ if (Proxy::table_index == 0) buffer->clear_output (); buffer->idx = 0; bool ret; ret = apply_forward (c, accel, subtables); if (ret) { if (!Proxy::inplace) buffer->swap_buffers (); else assert (!buffer->has_separate_output ()); } } else { /* in-place backward substitution/positioning */ if (Proxy::table_index == 0) buffer->remove_output (); buffer->idx = buffer->len - 1; apply_backward (c, accel, subtables); } }
optional<expr> apply_strategy() { std::string s_name(get_config().m_strategy); if (s_name == "preprocess") { return apply_preprocess(); } else if (s_name == "simp") { return apply_simp(); } else if (s_name == "simp_nohyps") { return apply_simp_nohyps(); } else if (s_name == "simple") { return apply_simple(); } else if (s_name == "all") { // TODO(Leo): return apply_simple(); } else if (s_name == "cc") { return apply_cc(); } else if (s_name == "grind") { return apply_grind(); } else if (s_name == "grind_simp") { return apply_grind_simp(); } else if (s_name == "core_grind") { return apply_core_grind(); } else if (s_name == "ematch") { return apply_ematch(); } else if (s_name == "ematch_simp") { return apply_ematch_simp(); } else if (s_name == "rec_ematch_simp") { return apply_rec_ematch_simp(); } else if (s_name == "rec_simp") { return apply_rec_simp(); } else if (s_name == "constructor") { return apply_constructor(); } else if (s_name == "unit") { return apply_unit(); } else if (s_name == "backward") { return apply_backward(); } else { throw exception(sstream() << "unknown blast strategy '" << s_name << "'"); } }