tactic clear_tactic(name const & n) { auto fn = [=](environment const &, io_state const &, proof_state const & _s) -> optional<proof_state> { if (!_s.get_goals()) { throw_no_goal_if_enabled(_s); return none_proof_state(); } proof_state s = apply_substitution(_s); goals const & gs = s.get_goals(); goal g = head(gs); goals tail_gs = tail(gs); if (auto p = g.find_hyp(n)) { expr const & h = p->first; unsigned i = p->second; buffer<expr> hyps; g.get_hyps(hyps); hyps.erase(hyps.size() - i - 1); if (depends_on(g.get_type(), h)) { throw_tactic_exception_if_enabled(s, sstream() << "invalid 'clear' tactic, conclusion depends on '" << n << "'"); return none_proof_state(); } if (auto h2 = depends_on(i, hyps.end() - i, h)) { throw_tactic_exception_if_enabled(s, sstream() << "invalid 'clear' tactic, hypothesis '" << *h2 << "' depends on '" << n << "'"); return none_proof_state(); } name_generator ngen = s.get_ngen(); expr new_type = g.get_type(); expr new_meta = mk_app(mk_metavar(ngen.next(), Pi(hyps, new_type)), hyps); goal new_g(new_meta, new_type); substitution new_subst = s.get_subst(); assign(new_subst, g, new_meta); proof_state new_s(s, goals(new_g, tail_gs), new_subst, ngen); return some_proof_state(new_s); } else { throw_tactic_exception_if_enabled(s, sstream() << "invalid 'clear' tactic, goal does not have a hypothesis " << " named '" << n << "'"); return none_proof_state(); } }; return tactic01(fn); }
STATIC_INLINE void low_peephole(void) { int i; for (i=0;i<lopt_index;i++) { if (uses_mem(i)) { int j=i-1; while (j>=i-4 && j>=0 && !depends_on(i,j)) { j--; } if (j!=i-1) { lopt_inst x=linst[i]; int k=i; j++; while (k>j) { linst[k]=linst[k-1]; k--; } linst[j]=x; } } } }
tactic revert_tactic(name const & n) { auto fn = [=](environment const &, io_state const &, proof_state const & s) -> optional<proof_state> { goals const & gs = s.get_goals(); if (empty(gs)) { throw_no_goal_if_enabled(s); return none_proof_state(); } goal g = head(gs); goals tail_gs = tail(gs); if (auto p = g.find_hyp(n)) { expr const & h = p->first; unsigned i = p->second; buffer<expr> hyps; g.get_hyps(hyps); hyps.erase(hyps.size() - i - 1); if (optional<expr> other_h = depends_on(i, hyps.end() - i, h)) { throw_tactic_exception_if_enabled(s, sstream() << "invalid 'revert' tactic, hypothesis '" << local_pp_name(*other_h) << "' depends on '" << local_pp_name(h) << "'"); return none_proof_state(); // other hypotheses depend on h } name_generator ngen = s.get_ngen(); expr new_type = Pi(h, g.get_type()); expr new_meta = mk_app(mk_metavar(ngen.next(), Pi(hyps, new_type)), hyps); goal new_g(new_meta, new_type); substitution new_subst = s.get_subst(); assign(new_subst, g, mk_app(new_meta, h)); proof_state new_s(s, goals(new_g, tail_gs), new_subst, ngen); return some_proof_state(new_s); } else { throw_tactic_exception_if_enabled(s, sstream() << "invalid 'revert' tactic, unknown hypothesis '" << n << "'"); return none_proof_state(); } }; return tactic01(fn); }
expr clear(metavar_context & mctx, expr const & mvar, expr const & H) { lean_assert(is_metavar(mvar)); lean_assert(is_local(H)); optional<metavar_decl> g = mctx.get_metavar_decl(mvar); if (!g) throw exception("clear tactic failed, there are no goals to be solved"); local_context lctx = g->get_context(); optional<local_decl> d = lctx.get_local_decl(H); if (!d) throw exception(sstream() << "clear tactic failed, unknown '" << local_pp_name(H) << "' hypothesis"); if (depends_on(g->get_type(), mctx, 1, &H)) throw exception(sstream() << "clear tactic failed, target type depends on '" << local_pp_name(H) << "'"); if (optional<local_decl> d2 = lctx.has_dependencies(*d, mctx)) throw exception(sstream() << "clear tactic failed, hypothesis '" << d2->get_pp_name() << "' depends on '" << local_pp_name(H) << "'"); lctx.clear(*d); expr new_mvar = mctx.mk_metavar_decl(lctx, g->get_type()); mctx.assign(mvar, new_mvar); return new_mvar; }
bool depends_on_any(expr const & e, unsigned hs_sz, expr const * hs) { return std::any_of(hs, hs+hs_sz, [&](expr const & h) { return depends_on(e, h); }); }
optional<expr> depends_on(unsigned sz, expr const * es, expr const & h) { for (unsigned i = 0; i < sz; i++) if (depends_on(es[i], h)) return some_expr(es[i]); return none_expr(); }
REFERENCE_TIME rt; hr = CoCreateInstance(clsidCodec, NULL, CLSCTX_INPROC_SERVER, IID_IMediaObject, (LPVOID*)&pObj); BOOST_REQUIRE(hr == S_OK); BOOST_REQUIRE(pObj != NULL); hr = pObj->GetInputMaxLatency(0, &rt); BOOST_CHECK(hr == E_NOTIMPL); hr = pObj->SetInputMaxLatency(0, rt); BOOST_CHECK(hr == E_NOTIMPL); pObj->Release(); } BOOST_TEST_DECORATOR(*depends_on("dmo_CoCreateInstance_encoder")*depends_on("dmo_QueryInterface_encoder")) BOOST_DATA_TEST_CASE(dmo_NotImpl_encoder, data::make(vecCodecFcc), fcc) { DMOEncoderCLSID clsid(fcc); dmo_NotImpl(clsid); } BOOST_TEST_DECORATOR(*depends_on("dmo_CoCreateInstance_decoder")*depends_on("dmo_QueryInterface_decoder")) BOOST_DATA_TEST_CASE(dmo_NotImpl_decoder, data::make(vecCodecFcc), fcc) { DMODecoderCLSID clsid(fcc); dmo_NotImpl(clsid); } BOOST_TEST_DECORATOR(*depends_on("dmo_CoCreateInstance_encoder")*depends_on("dmo_QueryInterface_encoder")) BOOST_DATA_TEST_CASE(dmo_NotImpl_encoder_IAMVfwCompressDialogs, data::make(vecCodecFcc), fcc)
/* 文字コードはSJIS 改行コードはCRLF */ /* $Id$ */ #include "stdafx.h" #include "test_win_fmt.h" #include "test_clip.h" #include "expand.h" #include "tuple_container.h" #include "VideoClip.h" #include "ICCloser.h" #include "Compare.h" BOOST_TEST_DECORATOR(*depends_on("vcm_ICOpen_decoder")*depends_on("vcm_ICOpen_encoder")) BOOST_DATA_TEST_CASE(vcm_encdec, make_data_from_tuple_container(vecEncDecClips), src, dst, fmt, config, tolerance) { VideoClip srcClip(src); VideoClip dstClip(dst); DWORD fccCodec = FCC(fmt); BOOST_REQUIRE(srcClip.GetWidth() == dstClip.GetWidth()); BOOST_REQUIRE(srcClip.GetHeight() == dstClip.GetHeight()); DWORD fccSrc = srcClip.GetFourCC(); DWORD fccDst = dstClip.GetFourCC(); unsigned int nWidth = srcClip.GetWidth(); unsigned int nHeight = srcClip.GetHeight(); size_t cbSrcData; size_t cbDstData; size_t cbCompressedData;
BOOST_CHECK(mt.majortype == MEDIATYPE_Video); BOOST_CHECK(mt.bFixedSizeSamples == TRUE); BOOST_CHECK(mt.bTemporalCompression == FALSE); BOOST_CHECK(mt.formattype == FORMAT_VideoInfo); DWORD fccOut = DirectShowFormatToVCMFormat(mt.subtype); pvih = (VIDEOINFOHEADER*)mt.pbFormat; BOOST_CHECK(pvih->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)); BOOST_CHECK(pvih->bmiHeader.biWidth == TEST_WIDTH); BOOST_CHECK(pvih->bmiHeader.biHeight == TEST_HEIGHT); BOOST_CHECK(pvih->bmiHeader.biPlanes == 1); BOOST_CHECK(pvih->bmiHeader.biBitCount == FCC2BitCount(fccOut)); BOOST_CHECK(pvih->bmiHeader.biCompression == FCC2Compression(fccOut)); outTypes.push_back(mt.subtype); MoFreeMediaType(&mt); } BOOST_CHECK(hr == DMO_E_NO_MORE_ITEMS); BOOST_CHECK_EQUAL(outTypes, expected); pObj->Release(); } BOOST_TEST_DECORATOR(*depends_on("dmo_SetInputType_encoder_subtype_ok")*depends_on("dmo_SetInputType_decoder_ok")) BOOST_DATA_TEST_CASE(dmo_GetOutputType_decoder_inset, data::make(vecCodecFcc) ^ data::make(vecTopPriorityEncoderInputSubtype) ^ data::make(vecSupportedDecoderOutputSubtypes), fcc, guid, expected) { DMOEncoderCLSID clsidEnc(fcc); DMODecoderCLSID clsidDec(fcc); dmo_GetOutputType_decoder_inset_(clsidEnc, clsidDec, guid, expected); }