void swap<WidgetStuff::Widget>( WidgetStuff::Widget &a, WidgetStuff::Widget &b ) { // swap(a.pImpl, b.pImpl); //私有成员,不能直接使用 ccc("全特化版本 std::swap"); a.swap(b); }
int main(){ puts( aaa() ); puts( bbb(Tony) ); puts( ccc(Tony) ); puts( ddd(zzz) ); return 0; }
CostPair GraphicsCostEstimator::estimateCompileCost(const osg::Node* node) const { if (!node) return CostPair(0.0,0.0); CollectCompileCosts ccc(this); const_cast<osg::Node*>(node)->accept(ccc); return ccc._costs; }
void project() { ppp(xnxt,ynxt,h,wp); rrr(xnxt,ynxt,h,wr); ooo(xnxt,ynxt,h,wo); jjj(xnxt,ynxt,h,wj); eee(xnxt,ynxt,h,we); ccc(xnxt,ynxt,h,wc); ttt(xnxt,ynxt,h,wt); }
void guidance() { ggg(xnxt,ynxt,h,wg); uuu(xnxt,ynxt,h,wu); iii(xnxt,ynxt,h,wi); ddd(xnxt,ynxt,h,wd); aaa(xnxt,ynxt,h,wa); nnn(xnxt,ynxt,h,wn); ccc(xnxt,ynxt,h,wc); eee(xnxt,ynxt,h,we); }
void computer() { ccc(xnxt,ynxt,h,wc); ooo(xnxt,ynxt,h,wo); mmm(xnxt,ynxt,h,wm); ppp(xnxt,ynxt,h,wp); uuu(xnxt,ynxt,h,wu); ttt(xnxt,ynxt,h,wt); eee(xnxt,ynxt,h,we); rrr(xnxt,ynxt,h,wr); }
void graphics() { ggg(xnxt,ynxt,h,wg); rrr(xnxt,ynxt,h,wr); aaa(xnxt,ynxt,h,wa); ppp(xnxt,ynxt,h,wp); hhh(xnxt,ynxt,h,wh); iii(xnxt,ynxt,h,wi); ccc(xnxt,ynxt,h,wc); sss(xnxt,ynxt,h,ws); }
/* Implements the Unicode Canonical Ordering algorithm (3.11, D109). */ static void canonical_sort(MVMThreadContext *tc, MVMNormalizer *n, MVMint32 from, MVMint32 to) { /* Yes, this is the simplest possible thing. Key thing if you decide to * replace it with something more optimal: it must not re-order code * points with equal CCC. */ MVMint32 reordered = 1; while (reordered) { MVMint32 i = from; reordered = 0; while (i < to - 1) { MVMint64 cccA = ccc(tc, n->buffer[i]); MVMint64 cccB = ccc(tc, n->buffer[i + 1]); if (cccA > cccB && cccB > 0) { MVMCodepoint tmp = n->buffer[i]; n->buffer[i] = n->buffer[i + 1]; n->buffer[i + 1] = tmp; reordered = 1; } i++; } } }
extern "C" NUMANALYSE_API char *VS_DateTimeE(char *numstr) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CString ccc(numstr); try { CSonTime cct; cct = numstr; ccc = cct.FormatE(g_szfmt); ccc = "OK " + ccc; } catch (...) { ccc = "NG invalid time"; } strcpy(g_ConvStr, ccc); return(g_ConvStr); }
void score() { sss(xnxt,ynxt,h,ws); ynxt-=3*s/2; xnxt-=(ws+sp); ccc(xnxt,ynxt,h,ws); ynxt-=3*s/2; xnxt-=(ws+sp); ooo(xnxt,ynxt,h,ws); ynxt-=3*s/2; xnxt-=(ws+sp); rrr(xnxt,ynxt,h,ws); ynxt-=3*s/2; xnxt-=(ws+sp); eee(xnxt,ynxt,h,ws); ynxt-=5*s/2; xnxt-=(ws+sp); }
void Plexus::insert_tpc_channel(int crate, int card, char wireplane, int wirenum, int channel_id, int larsoft_channel, int larsoft_wirenum ) { (void)larsoft_wirenum; // unused variable. Plek* p = new Plek; p->_crate = crate; p->_card = card; p->_channel = (channel_id % 64); // Hack. DB doesn't have a proper motherboard channel id. p->_view = wireplane; switch(p->_view) { case 'U' : p->_plane = 0; break; case 'V' : p->_plane = 1; break; case 'Y' : p->_plane = 2; break; default : p->_plane = -1; break; } p->_planewire = wirenum; p->_wirenum = larsoft_channel; m_ccc_to_plek[ccc(p->_crate,p->_card,p->_channel)] = PlekPtr_t(p); }
bool Plexus::buildHardcodedPmt() { int crate = 10; for(int icard=7;icard<16;icard++) { for(int ichan=0;ichan<64;ichan++) { Plek* p = new Plek; p->_crate = crate; p->_card = icard; p->_channel = ichan; if(ichan<30) { if(icard>7) p->_gain = 1; // low gain else p->_gain = 2; // high gain p->_pmt = ichan; } else { p->_special = std::string("special_").append(std::to_string(ichan)); } m_ccc_to_plek[ccc(p->_crate,p->_card,p->_channel)] = PlekPtr_t(p); } } return true; }
void ashrith() { aaa(xnxt,ynxt,h,wa); sss(xnxt,ynxt,h,ws); hhh(xnxt,ynxt,h,wh); rrr(xnxt,ynxt,h,wr); iii(xnxt,ynxt,h,wi); ttt(xnxt,ynxt,h,wt); hhh(xnxt,ynxt,h,wh); xnxt+=s/2; hhh(xnxt,ynxt,h,wh); xnxt+=s/2; ccc(xnxt,ynxt,h,wc); xnxt+=s/2; n1(xnxt,ynxt,h,w1); n1(xnxt,ynxt,h,w1); iii(xnxt,ynxt,h,wi); ttt(xnxt,ynxt,h,wt); n1(xnxt,ynxt,h,w1); n1(xnxt,ynxt,h,w1); }
/* Performs grapheme composition (to get Normal Form Grapheme) on the range of * codepoints provided. This algorithm is as follows (laid out here because * this is not one of the Unicode standard ones): * 1) If we only have one code point in the range to normalize, then NFC was * already sufficient here. Return. * 2) Take the from position as the location of the current "starterish". * 3) Walk codepoints until we reach "to" or the next codepoint is a starter. * 4) Take the codepoints from and including the last starterish up to the * current one, and get a synthetic for them. Replace them with the * synthetic. * 5) If we didn't reach "to", take the next codepoint as our next starterish * and goto step 3. * Note that this is specified to handle strings starting with non-starter * code point sequences. */ static void grapheme_composition(MVMThreadContext *tc, MVMNormalizer *n, MVMint32 from, MVMint32 to) { if (to - from >= 2) { MVMint32 starterish = from; MVMint32 insert_pos = from; MVMint32 pos = from; while (pos < to) { MVMint32 next_pos = pos + 1; if (next_pos == to || ccc(tc, n->buffer[next_pos]) == 0) { /* Last in buffer or next code point is a non-starter; turn * sequence into a synthetic. */ MVMGrapheme32 g = MVM_nfg_codes_to_grapheme(tc, n->buffer + starterish, next_pos - starterish); n->buffer[insert_pos++] = g; /* The next code point is our new starterish (harmless if we * are already at the end of the buffer). */ starterish = next_pos; } pos++; } memmove(n->buffer + insert_pos, n->buffer + to, (n->buffer_end - to) * sizeof(MVMCodepoint)); n->buffer_end -= to - insert_pos; } }
Plexus::PlekPtr_t Plexus::get(int crate, int card, int channel) { MapType_t::iterator it = m_ccc_to_plek.find(ccc(crate,card,channel)); if(it!=m_ccc_to_plek.end()) return it->second; return m_nullplek; }
void bbb ( void ) { ccc(); }
void draw_Src(TChain *tMc, TChain *tExpA, TChain *tExpB, const char *name, const char *fname, double kSP = 0.5, double kRndm = 0.0) { char str[256]; double rAB; long NA, NB; gStyle->SetOptStat("i"); gStyle->SetOptFit(1); // gStyle->SetOptStat(0); // gStyle->SetOptFit(0); gStyle->SetTitleXSize(0.05); gStyle->SetTitleYSize(0.05); gStyle->SetLabelSize(0.05); gStyle->SetPadLeftMargin(0.15); gStyle->SetPadBottomMargin(0.15); // gStyle->SetLineWidth(4); sprintf(str, "Monte Carlo energy deposit in %s decay;E, MeV", name); TH1D *hMc = new TH1D("hMc", str, 70, 0, 7); sprintf(str, "Monte Carlo SiPM energy deposit in %s decay;E, MeV", name); TH1D *hMcSiPM = new TH1D("hMcSiPM", str, 35, 0, 7); sprintf(str, "Monte Carlo PMT energy deposit in %s decay;E, MeV", name); TH1D *hMcPMT = new TH1D("hMcPMT", str, 35, 0, 7); sprintf(str, "Monte Carlo energy deposit in %s decay with random %2.0f%%;E, MeV", name, kRndm*100); TH1D *hMcR = new TH1D("hMcR", str, 70, 0, 7); sprintf(str, "Monte Carlo number of hits from %s decay", name); TH1D *hMcHits = new TH1D("hMcHits", str, 20, 0, 20); TH2D *hXY = new TH2D("hXY", "XY distribution of gamma flash center;X, cm;Y, cm", 25, 0, 100, 25, 0, 100); sprintf(str, "DANSS energy deposit in %s decay;E, MeV", name); TH1D *hExpA = new TH1D("hExpA", str, 70, 0, 7); TH1D *hExpB = new TH1D("hExpB", str, 70, 0, 7); TH1D *hExpC = new TH1D("hExpC", str, 70, 0, 7); sprintf(str, "SiPM energy deposit in %s decay;E, MeV", name); TH1D *hExpSiPMA = new TH1D("hExpSiPMA", str, 70, 0, 7); TH1D *hExpSiPMB = new TH1D("hExpSiPMB", str, 70, 0, 7); TH1D *hExpSiPMC = new TH1D("hExpSiPMC", str, 70, 0, 7); sprintf(str, "PMT energy deposit in %s decay;E, MeV", name); TH1D *hExpPMTA = new TH1D("hExpPMTA", str, 70, 0, 7); TH1D *hExpPMTB = new TH1D("hExpPMTB", str, 70, 0, 7); TH1D *hExpPMTC = new TH1D("hExpPMTC", str, 70, 0, 7); sprintf(str, "Number of hits from %s decay", name); TH1D *hHitsA = new TH1D("hHitsA", str, 20, 0, 20); TH1D *hHitsB = new TH1D("hHitsB", str, 20, 0, 20); TH1D *hHitsC = new TH1D("hHitsC", str, 20, 0, 20); TH1D *hTmpA = new TH1D("hTmpA", "Normalization counts A", 100, 0, 1000); TH1D *hTmpB = new TH1D("hTmpB", "Normalization counts B", 100, 0, 1000); TCut cxyz("NeutronX[0] >= 0 && NeutronX[1] >= 0 && NeutronX[2] >= 0"); TCut cz50("(NeutronX[2] - 49.5) * (NeutronX[2] - 49.5) < 100"); TCut ccc("(NeutronX[0] - 48) * (NeutronX[0] - 48) + (NeutronX[1] - 48) * (NeutronX[1] - 48) + (NeutronX[2] - 49.5) * (NeutronX[2] - 49.5) < 400"); TCut cVeto("VetoCleanHits < 2 && VetoCleanEnergy < 4"); TCut cn("SiPmCleanHits > 5"); sprintf(str, "%6.4f*SiPmCleanEnergy+%6.4f*PmtCleanEnergy", kSP, 1-kSP); tMc->Project("hMc", str, cxyz && ccc && cVeto && cn); tMc->Project("hMcSiPM", "SiPmCleanEnergy", cxyz && ccc && cVeto && cn); tMc->Project("hMcPMT", "PmtCleanEnergy", cxyz && ccc && cVeto && cn); sprintf(str, "MyRandom::GausAdd(%6.4f*SiPmCleanEnergy+%6.4f*PmtCleanEnergy, %6.4f)", kSP, 1-kSP, kRndm); tMc->Project("hMcR", str, cxyz && ccc && cVeto && cn); tMc->Project("hMcHits", "SiPmCleanHits", cxyz && ccc && cVeto); sprintf(str, "%6.4f*SiPmCleanEnergy+%6.4f*PmtCleanEnergy", kSP, 1-kSP); tExpA->Project("hXY", "NeutronX[1]+2:NeutronX[0]+2", cxyz && cz50 && cVeto && cn); tExpA->Project("hExpA", str, cxyz && ccc && cVeto && cn); tExpB->Project("hExpB", str, cxyz && ccc && cVeto && cn); tExpA->Project("hExpSiPMA", "SiPmCleanEnergy", cxyz && ccc && cVeto && cn); tExpB->Project("hExpSiPMB", "SiPmCleanEnergy", cxyz && ccc && cVeto && cn); tExpA->Project("hExpPMTA", "PmtCleanEnergy", cxyz && ccc && cVeto && cn); tExpB->Project("hExpPMTB", "PmtCleanEnergy", cxyz && ccc && cVeto && cn); tExpA->Project("hHitsA", "SiPmCleanHits", cxyz && ccc && cVeto); tExpB->Project("hHitsB", "SiPmCleanHits", cxyz && ccc && cVeto); NA = tExpA->Project("hTmpA", "SiPmCleanEnergy", "(SiPmCleanEnergy + PmtCleanEnergy) / 2 > 100"); NB = tExpB->Project("hTmpB", "SiPmCleanEnergy", "(SiPmCleanEnergy + PmtCleanEnergy) / 2 > 100"); rAB = 1.0 * NA / NB; printf("NA = %ld NB = %ld rAB = %f\n", NA, NB, rAB); hMc->Sumw2(); hMcSiPM->Sumw2(); hMcPMT->Sumw2(); hMcR->Sumw2(); hMcHits->Sumw2(); hExpA->Sumw2(); hExpB->Sumw2(); hExpSiPMA->Sumw2(); hExpSiPMB->Sumw2(); hExpPMTA->Sumw2(); hExpPMTB->Sumw2(); hHitsA->Sumw2(); hHitsB->Sumw2(); hExpC->Add(hExpA, hExpB, 1.0, -rAB); hExpSiPMC->Add(hExpSiPMA, hExpSiPMB, 1.0, -rAB); hExpPMTC->Add(hExpPMTA, hExpPMTB, 1.0, -rAB); hHitsC->Add(hHitsA, hHitsB, 1.0, -rAB); hMcHits->Scale(hHitsC->Integral() / hMcHits->Integral()); hMcR->Scale(hExpC->Integral() / hMcR->Integral()); hMc->GetYaxis()->SetLabelSize(0.05); hMcSiPM->GetYaxis()->SetLabelSize(0.05); hMcPMT->GetYaxis()->SetLabelSize(0.05); hMcR->GetYaxis()->SetLabelSize(0.05); hMcR->SetLineColor(kRed); hMcHits->GetYaxis()->SetLabelSize(0.05); hMcHits->SetLineColor(kRed); hMcHits->SetMarkerColor(kRed); hMcHits->SetMarkerStyle(kFullCircle); hXY->GetXaxis()->SetLabelSize(0.045); hXY->GetYaxis()->SetLabelSize(0.045); hXY->GetZaxis()->SetLabelSize(0.045); hExpC->GetYaxis()->SetLabelSize(0.05); hExpC->SetLineWidth(2); hExpC->SetLineColor(kBlue); hExpSiPMC->GetYaxis()->SetLabelSize(0.05); hExpPMTC->GetYaxis()->SetLabelSize(0.05); hHitsC->GetYaxis()->SetLabelSize(0.05); hHitsC->SetLineColor(kBlue); hHitsC->SetMarkerColor(kBlue); hHitsC->SetMarkerStyle(kFullSquare); hMcHits->SetStats(0); hHitsC->SetStats(0); TLegend *lg = new TLegend(0.65, 0.8, 0.95, 0.93); lg->AddEntry(hMcHits, "Monte Carlo", "L"); lg->AddEntry(hHitsC, "DANSS", "LP"); lg->SetTextSize(0.035); TCanvas *cMc = new TCanvas("cMc", "Monte Carlo", 1200, 800); cMc->Divide(2, 2); cMc->cd(1); hMc->Fit("gaus", "", "", 1.5, 3.5); cMc->cd(2); hMcSiPM->Fit("gaus", "", "", 1.5, 3.5); cMc->cd(3); hMcPMT->Fit("gaus", "", "", 1.5, 3.5); cMc->cd(4); hMcR->Fit("gaus", "", "", 1.5, 3.5); sprintf(str, "%s.pdf(", fname); cMc->SaveAs(str); TCanvas *cExp = new TCanvas("cExp", "Data", 1200, 800); cExp->Divide(2, 2); cExp->cd(1); hExpC->Fit("gaus", "", "", 1.5, 3.5); cExp->cd(2); hExpSiPMC->Fit("gaus", "", "", 1.5, 3.5); cExp->cd(3); hExpPMTC->Fit("gaus", "", "", 1.5, 3.5); cExp->cd(4); hXY->Draw("colz"); sprintf(str, "%s.pdf", fname); cExp->SaveAs(str); TCanvas *cHits = new TCanvas("cHits", "Hits", 1200, 800); cHits->Divide(2, 1); cHits->cd(1); hHitsC->Draw(); hMcHits->Draw("same,hist"); lg->Draw(); cHits->cd(2); hExpC->Draw(); hMcR->Draw("same,hist"); cHits->Update(); sprintf(str, "%s.pdf)", fname); cHits->SaveAs(str); sprintf(str, "%s.root", fname); TFile *f = new TFile(str, "RECREATE"); if (f->IsOpen()) { f->cd(); hMc->Write(); hMcSiPM->Write(); hMcPMT->Write(); hMcR->Write(); hMcHits->Write(); hXY->Write(); hExpA->Write(); hExpB->Write(); hExpC->Write(); hExpSiPMA->Write(); hExpSiPMB->Write(); hExpSiPMC->Write(); hExpPMTA->Write(); hExpPMTB->Write(); hExpPMTC->Write(); hHitsA->Write(); hHitsB->Write(); hHitsC->Write(); f->Close(); } TCanvas *cPRL = new TCanvas("PRL", "PRL", 800, 800); cPRL->SetLeftMargin(0.17); cPRL->SetRightMargin(0.03); cPRL->SetTopMargin(0.03); cPRL->SetBottomMargin(0.10); hExpC->SetLineColor(kBlack); hExpC->GetXaxis()->SetRange(0, 50); hExpC->SetTitle(";E, MeV;Events/100 keV"); hExpC->SetStats(0); hExpC->GetYaxis()->SetTitleOffset(1.7); hExpC->Draw(); hMcR->Draw("hits,same"); lg->Draw(); sprintf(str, "%s-prl.pdf", fname); cPRL->SaveAs(str); }
void draw_Amps(void) { gStyle->SetOptStat("i"); gStyle->SetOptFit(1); gStyle->SetTitleXSize(0.05); gStyle->SetTitleYSize(0.05); gStyle->SetLabelSize(0.05); gStyle->SetPadLeftMargin(0.15); gStyle->SetPadBottomMargin(0.15); TChain *tNa = new TChain("DanssEvent"); TChain *tCo = new TChain("DanssEvent"); TChain *tBgnd = new TChain("DanssEvent"); tNa->AddFile("../digi.v2/danss_root4_3/danss_020243.root"); tNa->AddFile("../digi.v2/danss_root4_3/danss_020244.root"); tCo->AddFile("../digi.v2/danss_root4_3/danss_020233.root"); tCo->AddFile("../digi.v2/danss_root4_3/danss_020234.root"); tBgnd->AddFile("../digi.v2/danss_root4_3/danss_020252.root"); tBgnd->AddFile("../digi.v2/danss_root4_3/danss_020253.root"); TH1D *hNaSiPMA = new TH1D("hNaSiPMA", "SiPM ^{22}Na;ADC units", 50, 0, 1500); TH1D *hNaSiPMB = new TH1D("hNaSiPMB", "SiPM ^{22}Na;ADC units", 50, 0, 1500); TH1D *hCoSiPMA = new TH1D("hCoSiPMA", "SiPM ^{60}Co;ADC units", 50, 0, 1500); TH1D *hCoSiPMB = new TH1D("hCoSiPMB", "SiPM ^{60}Co;ADC units", 50, 0, 1500); TH1D *hBgndSiPM = new TH1D("hBgndSiPM", "SiPM ^{60}Co;ADC units", 50, 0, 1500); TH1D *hNaPMTA = new TH1D("hNaPMTA", "PMT ^{22}Na;ADC units", 50, 0, 1000); TH1D *hNaPMTB = new TH1D("hNaPMTB", "PMT ^{22}Na;ADC units", 50, 0, 1000); TH1D *hCoPMTA = new TH1D("hCoPMTA", "PMT ^{60}Co;ADC units", 50, 0, 1000); TH1D *hCoPMTB = new TH1D("hCoPMTB", "PMT ^{60}Co;ADC units", 50, 0, 1000); TH1D *hBgndPMT = new TH1D("hBgndPMT", "PMT ^{60}Co;ADC units", 50, 0, 1000); TCut cxyz("NeutronX[0] >= 0 && NeutronX[1] >= 0 && NeutronX[2] >= 0"); TCut ccc("(NeutronX[0] - 48) * (NeutronX[0] - 48) + (NeutronX[1] - 48) * (NeutronX[1] - 48) + (NeutronX[2] - 49.5) * (NeutronX[2] - 49.5) < 400"); TCut cVeto("VetoHits < 2 && VetoEnergy < 4"); tNa->Project("hNaSiPMA", "SiPmCleanEnergy", cxyz && ccc && cVeto); tCo->Project("hCoSiPMA", "SiPmCleanEnergy", cxyz && ccc && cVeto); tBgnd->Project("hBgndSiPM", "SiPmCleanEnergy", cxyz && ccc && cVeto); tNa->Project("hNaPMTA", "PmtCleanEnergy", cxyz && ccc && cVeto); tCo->Project("hCoPMTA", "PmtCleanEnergy", cxyz && ccc && cVeto); tBgnd->Project("hBgndPMT", "PmtCleanEnergy", cxyz && ccc && cVeto); hNaSiPMA->Sumw2(); hCoSiPMA->Sumw2(); hBgndSiPM->Sumw2(); hNaPMTA->Sumw2(); hCoPMTA->Sumw2(); hBgndPMT->Sumw2(); hNaSiPMB->Add(hNaSiPMA, hBgndSiPM, 1.0, -0.977); hCoSiPMB->Add(hCoSiPMA, hBgndSiPM, 1.0, -0.977); hNaPMTB->Add(hNaPMTA, hBgndPMT, 1.0, -0.977); hCoPMTB->Add(hCoPMTA, hBgndPMT, 1.0, -0.977); hNaSiPMB->GetYaxis()->SetLabelSize(0.05); hCoSiPMB->GetYaxis()->SetLabelSize(0.05); hNaPMTB->GetYaxis()->SetLabelSize(0.05); hCoPMTB->GetYaxis()->SetLabelSize(0.05); TCanvas *cAmp = new TCanvas("cAmp", "Raw Amplitude", 1200, 800); cAmp->Divide(2, 2); cAmp->cd(1); hNaSiPMB->Fit("gaus", "", "", 200, 800); cAmp->cd(2); hCoSiPMB->Fit("gaus", "", "", 200, 200); cAmp->cd(3); hNaPMTB->Fit("gaus", "", "", 150, 600); cAmp->cd(4); hCoPMTB->Fit("gaus", "", "", 150, 600); cAmp->SaveAs("22Na_60Co_raw_ADC_amplitudes.pdf"); }
/* Implements the Unicode Canonical Composition algorithm (3.11, D117). */ static void canonical_composition(MVMThreadContext *tc, MVMNormalizer *n, MVMint32 from, MVMint32 to) { MVMint32 c_idx = from + 1; while (c_idx < to) { /* Search for the last non-blocked starter. */ MVMint32 ss_idx = c_idx - 1; MVMint32 c_ccc = ccc(tc, n->buffer[c_idx]); while (ss_idx >= from) { /* Make sure we don't go past a code point that blocks a starter * from the current character we're considering. */ MVMint32 ss_ccc = ccc(tc, n->buffer[ss_idx]); if (ss_ccc >= c_ccc) break; /* Have we found a starter? */ if (ss_ccc == 0) { /* See if there's a primary composite for the starter and the * current code point under consideration. */ MVMCodepoint pc = MVM_unicode_find_primary_composite(tc, n->buffer[ss_idx], n->buffer[c_idx]); if (pc > 0) { /* Replace the starter with the primary composite. */ n->buffer[ss_idx] = pc; /* Move the rest of the buffer back one position. */ memmove(n->buffer + c_idx, n->buffer + c_idx + 1, (n->buffer_end - (c_idx + 1)) * sizeof(MVMCodepoint)); n->buffer_end--; n->buffer_norm_end--; /* Sync cc_idx and to with the change. */ c_idx--; to--; } /* Don't look back beyond this starter; covers the ccc(B) = 0 * case of D105. */ break; } ss_idx--; } /* Move on to the next character. */ c_idx++; } /* Make another pass for the Hangul special case. (A future optimization * may be to incorporate this into the above loop.) */ c_idx = from; while (c_idx < to - 1) { /* Do we have a potential LPart? */ MVMCodepoint LPart = n->buffer[c_idx]; if (LPart >= LBase && LPart <= (LBase + LCount)) { /* Yes, now see if it's followed by a VPart (always safe to look * due to "to - 1" in loop condition above). */ MVMCodepoint LIndex = LPart - LBase; MVMCodepoint VPart = n->buffer[c_idx + 1]; if (VPart >= VBase && VPart <= (VBase + VCount)) { /* Certainly something to compose; compute that. */ MVMCodepoint VIndex = VPart - VBase; MVMCodepoint LVIndex = LIndex * NCount + VIndex * TCount; MVMCodepoint s = SBase + LVIndex; MVMint32 composed = 1; /* Is there a TPart too? */ if (c_idx < to - 2) { MVMCodepoint TPart = n->buffer[c_idx + 2]; if (TPart >= TBase && TPart <= (TBase + TCount)) { /* We need to compose 3 things. */ MVMCodepoint TIndex = TPart - TBase; s += TIndex; composed = 2; } } /* Put composed codepoint into the buffer. */ n->buffer[c_idx] = s; /* Shuffle codepoints after this in the buffer back. */ memmove(n->buffer + c_idx + 1, n->buffer + c_idx + 1 + composed, (n->buffer_end - (c_idx + 1 + composed)) * sizeof(MVMCodepoint)); n->buffer_end -= composed; n->buffer_norm_end -= composed; /* Sync to with updated buffer size. */ to -= composed; } } c_idx++; } }
/* Called when the very fast case of normalization fails (that is, when we get * any two codepoints in a row where at least one is greater than the first * significant codepoint identified by a quick check for the target form). We * may find the quick check itself is enough; if not, we have to do real work * compute the normalization. */ MVMint32 MVM_unicode_normalizer_process_codepoint_full(MVMThreadContext *tc, MVMNormalizer *n, MVMCodepoint in, MVMCodepoint *out) { /* Do a quickcheck on the codepoint we got in and get its CCC. */ MVMint64 qc_in = passes_quickcheck(tc, n, in); MVMint64 ccc_in = ccc(tc, in); /* Fast cases when we pass quick check and what we got in has CCC = 0. */ if (qc_in && ccc_in == 0) { if (MVM_NORMALIZE_COMPOSE(n->form)) { /* We're composing. If we have exactly one thing in the buffer and * it also passes the quick check, and both it and the thing in the * buffer have a CCC of zero, we can hand back the first of the * two - effectively replacing what's in the buffer with the new * codepoint coming in. */ if (n->buffer_end - n->buffer_start == 1) { MVMCodepoint maybe_result = n->buffer[n->buffer_start]; if (passes_quickcheck(tc, n, maybe_result) && ccc(tc, maybe_result) == 0) { *out = n->buffer[n->buffer_start]; n->buffer[n->buffer_start] = in; return 1; } } } else { /* We're only decomposing. There should probably be nothing in the * buffer in this case; if so we can simply return the codepoint. */ if (n->buffer_start == n->buffer_end) { *out = in; return 1; } } } /* If we didn't pass quick check... */ if (!qc_in) { /* If we're composing, then decompose the last thing placed in the * buffer, if any. We need to do this since it may have passed * quickcheck, but having seen some character that does pass then we * must make sure we decomposed the prior passing one too. */ if (MVM_NORMALIZE_COMPOSE(n->form) && n->buffer_end != n->buffer_start) { MVMCodepoint decomp = n->buffer[n->buffer_end - 1]; n->buffer_end--; decomp_codepoint_to_buffer(tc, n, decomp); } /* Decompose this new character into the buffer. We'll need to see * more before we can go any further. */ decomp_codepoint_to_buffer(tc, n, in); return 0; } /* Since anything we have at this point does pass quick check, add it to * the buffer directly. */ add_codepoint_to_buffer(tc, n, in); /* If the codepoint has a CCC that is non-zero, it's not a starter so we * should see more before normalizing. */ if (ccc_in > 0) return 0; /* If we don't have at least one codepoint in the buffer, it's too early * to hand anything back. */ if (n->buffer_end - n->buffer_start <= 1) return 0; /* Perform canonical sorting on everything from the start of the buffer * up to but excluding the quick-check-passing thing we just added. */ canonical_sort(tc, n, n->buffer_start, n->buffer_end - 1); /* Perform canonical composition and grapheme composition if needed. */ if (MVM_NORMALIZE_COMPOSE(n->form)) { canonical_composition(tc, n, n->buffer_start, n->buffer_end - 1); if (MVM_NORMALIZE_GRAPHEME(n->form)) grapheme_composition(tc, n, n->buffer_start, n->buffer_end - 1); } /* We've now normalized all except the latest, quick-check-passing * codepoint. */ n->buffer_norm_end = n->buffer_end - 1; /* Hand back a codepoint, and flag how many more are available. */ *out = n->buffer[n->buffer_start]; return n->buffer_norm_end - n->buffer_start++; }
void bbb (int arg) { ccc (789); }
main() { char option; AbstractPizza* ap1; while( option != 'n' ) { order o2; o2.incrementordernumber(); o2.menu(); int choice; cout<<"\n\t\t********ORDER NUMBER:\t"<<o2.returnordernumber()<<"**********\n"; choice=5; while(!(choice>=1 && choice<=4)) { cout<<"\nPlease Enter Your Choice between 1 & 4:\t\t"; cin>>choice; } switch(choice) { case(1): ap1= new ChickenTikkaPizza; break; case(2): ap1= new BeefRoastPizza; break; case(3): ap1= new FourSeasonPizza; break; case(4): ap1= new HawiianPizza; break; } o2.inputperson(); char choice2='l'; do { cout<<"\nPlease enter c to pay via credit card and p to pay via cash:\t"; fflush(stdin); cin>>choice2; } while(!(choice2=='c' || choice2=='p')); if(choice2=='c') { o2.c1input(); creditcard cca(12, 2004, 1111222); creditcard ccb(12, 2004, 1234567); creditcard ccc(12, 2004, 9876543); creditcard ccd(12, 2004, 1212121); system("cls"); if( ( o2.comparecredit(cca) || o2.comparecredit(ccb) || o2.comparecredit(ccc) || o2.comparecredit(ccd) ) && ( o2.returnc1size() >= ap1->returnprice() ) ) { cout<<"\n\n\n\n\n\n****Your Account Balance\t"<<o2.returnc1size()<<"\n****Your Order Cost\t\t"<<ap1->returnprice()<<"\n****Balance after transaction\t"<<o2.returnc1size()-ap1->returnprice() ; ap1->bake(); } else { if(!( o2.comparecredit(cca) || o2.comparecredit(ccb) || o2.comparecredit(ccc) || o2.comparecredit(ccd) )) cout<<"\n\n\n\n\n\nINVALID CREDIT CARD NUMBER , ORDER COULD NOT BE PROCESSED"; else if(! ( o2.returnc1size() >= ap1->returnprice() ) ) cout<<"\n\n\n\n\n\nINSUFFICIENT FUNDS , ORDER COULD NOT BE PROCESSED"; } } else cout<<"\nThanks for paying by CASH"; choice2='l'; o2.displayperson(); fflush(stdin); option=getch(); } delete ap1; return 0; }
void Plexus::insert(PlekPtr_t p) { m_ccc_to_plek[ccc(p->crate(),p->card(),p->channel())] = p; }
int main() { ccc(); printf("main\n"); return 0; }