void VAISNAVADAY::GetTextEP(TString &str) { double h1, m1, h2, m2; m1 = modf(eparana_time1, &h1); if (eparana_time2 >= 0.0) { m2 = modf(eparana_time2, &h2); if (GCDisplaySettings::getValue(50)) str.Format(" %s %02d:%02d (%s) - %02d:%02d (%s) %s", GCStrings::getString(60).c_str(), int(h1), int(m1*60), GCStrings::GetParanaReasonText(eparana_type1), int(h2), int(m2*60), GCStrings::GetParanaReasonText(eparana_type2), GCStrings::GetDSTSignature(nDST)); else str.Format(" %s %02d:%02d - %02d:%02d (%s)", GCStrings::getString(60).c_str(), int(h1), int(m1*60), int(h2), int(m2*60), GCStrings::GetDSTSignature(nDST)); } else if (eparana_time1 >= 0.0) { if (GCDisplaySettings::getValue(50)) str.Format(" %s %02d:%02d (%s) %s", GCStrings::getString(61).c_str(), int(h1), int(m1*60), GCStrings::GetParanaReasonText(eparana_type1), GCStrings::GetDSTSignature(nDST) ); else str.Format(" %s %02d:%02d (%s)", GCStrings::getString(61).c_str(), int(h1), int(m1*60), GCStrings::GetDSTSignature(nDST) ); } else { str = " "; str += GCStrings::getString(62); } }
void TaskHandler( void ){ LONG currentTask = InterlockedIncrement( &m_nCurrentTask ); TString str; str.Format(_T("[%u] Task #%u is starting."), GetCurrentThreadId(), currentTask); AddMessage( (LPCTSTR)str ); Sleep( currentTask * 1000 ); str.Format(_T("[%u] Task #%u is done."), GetCurrentThreadId(), currentTask); AddMessage( (LPCTSTR)str ); if( InterlockedDecrement(&m_nCurrentTask) == 0 ){ PostMessage( WM_APP_COMPLETED, 0, (LPARAM)currentTask ); } }
BOOL TFile::WriteString2(int i, const char * psz) { TString str; str.Format("%d\r\n%s\r\n", i, psz); WriteString(str); return TRUE; }
BOOL TFile::WriteString2(int i, int n) { TString str; str.Format("%d\r\n%d\r\n", i, n); WriteString(str); return TRUE; }
BOOL TFile::WriteString2(int i, double a) { TString str; str.Format("%d\r\n%f\r\n", i, a); WriteString(str); return TRUE; }
LRESULT OnCompleted( WPARAM wParam, LPARAM lParam ){ TString str; str.Format(_T("___Task #%u was the last task of the batch____"), lParam); AddMessage( (LPCTSTR)str ); m_btnStart.Enable( TRUE ); return 0; }
BOOL DlgEditCustomEvent::OnInitDialog() { CDialog::OnInitDialog(); TString str; // TODO: Add extra initialization here CComboBox * p; int i; p = (CComboBox *)GetDlgItem(IDC_COMBO1); for(i =0; i < 30; i++) { str.Format("%s Tithi (%s Paksa)", GCStrings::GetTithiName(i), GCStrings::GetPaksaName(i/15)); p->AddString(str); } p->SetCurSel(this->m_nTithi); if (m_nClass != 6) p->EnableWindow(FALSE); p = (CComboBox *)GetDlgItem(IDC_COMBO2); for(i = 0; i < 12; i++) { p->AddString(GCStrings::GetMasaName(i)); } p->SetCurSel(this->m_nMasa); if (m_nClass != 6) p->EnableWindow(FALSE); p = (CComboBox *)GetDlgItem(IDC_COMBO3); for(i = 0; i <= 6; i++) { p->AddString(GCStrings::GetEventClassText(i)); } p->SetCurSel(this->m_nClass); if (m_nClass != 6) p->EnableWindow(FALSE); else p->EnableWindow(GCDisplaySettings::getValue(44)==1); p = (CComboBox *)GetDlgItem(IDC_COMBO4); p->AddString("no fast"); p->AddString(GCStrings::GetFastingName(0x201)); p->AddString(GCStrings::GetFastingName(0x202)); p->AddString(GCStrings::GetFastingName(0x203)); p->AddString(GCStrings::GetFastingName(0x204)); p->AddString(GCStrings::GetFastingName(0x205)); p->SetCurSel(this->m_nFastType); if (m_nClass != 6) p->EnableWindow(FALSE); if (m_nClass != 6) GetDlgItem(IDC_EDIT2)->EnableWindow(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
/* BEGIN GCAL 1.4.3 */ void VAISNAVADAY::GetTextA(TString &str, int bPaksa, int bNaks, int bYoga, int bFlag, int bRasi) { // static char * dow[] = {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" }; TString s1, s2; s1 = GCStrings::GetTithiName(astrodata.nTithi); if ((astrodata.nTithi == 10) || (astrodata.nTithi == 25) || (astrodata.nTithi == 11) || (astrodata.nTithi == 26)) { if (ekadasi_parana == false) { if (nMhdType == EV_NULL) { s1 += " "; s1 += GCStrings::getString(58); } else { s1 += " "; s1 += GCStrings::getString(59); } } } GCStrings::getString(this->date.dayOfWeek).Left(2, s2); str.Format("%2d %s %d %s %-34s%c ", this->date.day, GCStrings::GetMonthAbreviation(date.month), this->date.year , s2.c_str() ,s1.c_str(), (bPaksa ? GCStrings::GetPaksaChar(this->astrodata.nPaksa) : ' ')); if (bYoga) { s2.Format("%-10s", GCStrings::GetYogaName(this->astrodata.nYoga)); str += s2; } if (bNaks) { s2.Format("%-15s", GCStrings::GetNaksatraName(this->astrodata.nNaksatra)); str += s2; } if (this->nFastType != FAST_NULL && bFlag) str += " *"; else str += " "; if (bRasi) { if (bRasi == 1) s2.Format(" %-15s", GCStrings::GetSankrantiName(GCRasi::GetRasi(this->astrodata.moon.longitude_deg, this->astrodata.msAyanamsa))); else s2.Format(" %-15s", GCStrings::GetSankrantiNameEn(GCRasi::GetRasi(this->astrodata.moon.longitude_deg, this->astrodata.msAyanamsa))); str += s2; } }
BOOL DlgEventsGaubdTM::OnInitDialog() { CDialog::OnInitDialog(); int i = 0, n; TString str; str.Format("%s Paksa", GCStrings::GetPaksaName(0)); i = m_list1.AddString(str); m_list1.SetItemData(i, -1); for(n = 0; n < 15; n++) { str.Format(" %s Tithi", GCStrings::GetTithiName(n)); i = m_list1.AddString(str); m_list1.SetItemData(i, n); } str.Format("%s Paksa", GCStrings::GetPaksaName(1)); i = m_list1.AddString(str); m_list1.SetItemData(i, -1); for(n = 15; n < 30; n++) { str.Format(" %s Tithi", GCStrings::GetTithiName(n)); i = m_list1.AddString(str); m_list1.SetItemData(i, n); } for(n = 0; n < 12; n++) { str.Format(" %s Masa", GCStrings::GetMasaName((n + 11)%12)); i = m_list2.AddString(str); m_list2.SetItemData(i, (n + 11)%12); } m_list1.SetCurSel(1); m_list2.SetCurSel(0); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void DumpFile( LPTSTR lpFilename ){ BUFFER buf; if( LoadFileData(lpFilename, buf) ) { m_wndList.DeleteAllItems(); TString str; int item = 0; unsigned idx = 0; unsigned siz = buf.size(); while( idx < siz ) { int loop = 16; if( int(siz - idx) < 16 ){ loop = int(siz - idx); } str.Format(_T("%08X"), idx); m_wndList.InsertItem(item, (LPTSTR)str); for( int i=0; i<loop; i++ ){ str.Format(_T("%02X"), buf.at(idx+i)); m_wndList.SetItem(item, i+1, (LPTSTR)str); } str.clear(); for( int i=0; i<loop; i++ ){ if( ::isgraph(int(buf.at(idx+i))) ) str.AppendFormat(_T("%c"), buf.at(idx+i)); else str.AppendFormat(_T(" ")); } m_wndList.SetItem(item, 17, (LPTSTR)str); idx += 16; item += 1; } } }
void CFrameLocs::OnGoogleShowlocation() { // TODO: Add your command handler code here TString str; int n; CLocation * loc = NULL; POSITION pos; pos = m_wndLocs.GetFirstSelectedItemPosition(); if (pos != NULL && (n = m_wndLocs.GetNextSelectedItem(pos),n>=0)) { loc = (CLocation *)m_wndLocs.GetItemData(n); if (loc != NULL) { str.Format("<html><head><meta http-equiv=\"REFRESH\" content=\"0;url=http://maps.google.com/?ie=UTF8&ll=%f,%f&spn=0.774196,1.235962&z=10" "\"></head><body></body><html>", loc->m_fLatitude, loc->m_fLongitude); TFile file; TString fileName; fileName = GCalApp_GetFileName(GSTR_TEMFOLDER); fileName += "temp.html"; if (file.Open(fileName, "w") == TRUE) { file.WriteString(str); file.Close(); ShellExecute(this->m_hWnd, NULL, fileName, NULL, NULL, SW_SHOW); } /* str.Format("http://maps.google.com/?ie=UTF8&ll=%f,%f&spn=0.774196,1.235962&z=10", loc->m_fLatitude, loc->m_fLongitude); if (p_wndWeb != NULL) { p_wndWeb->Navigate(str.c_str()); m_wndTab.SetCurSel(1); ShowControlsForTab(1); }*/ } } return; }
BOOL DlgSetPrintStyle::OnInitDialog() { CDialog::OnInitDialog(); CheckRadioButton(IDC_RADIO1, IDC_RADIO2, IDC_RADIO1); OnRadio1(); m_nStyle = 0; m_nFontSize = 11; m_nHeaderSize = 18; m_strFont = "Tahoma"; int i; TString str; for(i = 0; i < 20; i++) { str.Format("%d", i + 5); m_cbSizeText.AddString(str); m_cbSizeHdr.AddString(str); } m_cbSizeText.SetCurSel(m_nFontSize - 5); m_cbSizeHdr.SetCurSel(m_nHeaderSize - 5); m_wndFontName.SetWindowText(m_strFont); SetDlgItemInt(IDC_EDIT2, m_margins.top, FALSE); SetDlgItemInt(IDC_EDIT3, m_margins.left, FALSE); SetDlgItemInt(IDC_EDIT4, m_margins.right, FALSE); SetDlgItemInt(IDC_EDIT5, m_margins.bottom, FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL DlgGetStartDate::OnInitDialog() { int i; TString str; VCTIME vc; SYSTEMTIME st; if (bFinal) SetDlgItemText(IDC_BUTTON1, "Calculate"); m_setMenu.CreatePopupMenu(); m_setMenu.AppendMenu(MF_STRING, ID_SET_TODAY, "set today"); m_setMenu.AppendMenu(MF_STRING, ID_SET_START_MONTH, "set start of the month"); m_setMenu.AppendMenu(MF_STRING, ID_SET_START_YEAR, "set start of the year"); m_setMenu.AppendMenu(MF_STRING, ID_SET_START_MASA, "set start of the masa"); m_setMenu.AppendMenu(MF_STRING, ID_SET_START_GYEAR, "set start of the gaurabda year"); // inicializacia prvkov okna CDialog::OnInitDialog(); m_hdr.InitMyFont(); m_hdr.SetWindowText("Get Start Date"); for(i = 1; i <= 31; i++) { str.Format("%d", i); w_day.AddString(str.c_str()); } for(i = 0; i < 12; i++) { w_month.AddString(GCStrings::getString(760 + i).c_str()); } if (s_init == 0 || m_resultA.gyear < 0 || m_resultA.gyear > 2500) { GetLocalTime(&st); m_resultC.day = st.wDay; m_resultC.month = st.wMonth; m_resultC.year = st.wYear; m_resultC.shour = double(0.5); m_resultC.tzone = m_earth.tzone; GCCalendar::VCTIMEtoVATIME(m_resultC, m_resultA, m_earth); s_init = 1; } m_resultC.tzone = m_earth.tzone; f_update = FALSE; w_day.SetCurSel(m_resultC.day - 1); w_month.SetCurSel(m_resultC.month - 1); SetDlgItemInt(IDC_EDIT2, m_resultC.year, FALSE); w_tithi.SetCurSel(m_resultA.tithi); w_masa.SetCurSel(GCCalendar::MasaToComboMasa(m_resultA.masa)); SetDlgItemInt(IDC_EDIT1, m_resultA.gyear, FALSE); f_update = TRUE; m_nNextStep = 0; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void calculateTriggerRates( TString inFile0Name = "root://eoscms//eos/cms/store/caf/user/velicanu/PA2013_merged_HiForest/pPb_hiForest2_pilotRun_200kHz_v3.root", // TString inFile0Name = "/castor/cern.ch/user/m/miheejo/openHLT/cms442/r181530_reco_v1_2/HIExpressPhysics_hiexp-hirun2011-r181530-reco-v1_2.root", // "/castor/cern.ch/user/k/kimy/openHLT//openhlt_run181531.root", // "/castor/cern.ch/user/v/velicanu/HIHLT_Validation_Test_GRIF_v10.root", Int_t runNum = 202792, TString outdir = "output", char *projectTitle = "HIpARun2013", string source = "data" ) { char szBuf[256]; int scale = 23; // event selectoin //Form("&&Run==%d&&LumiBlock>%d",runNum,goodLumiStart) // trigger under investigation // const int ntrigs = 8; // const char* triggerPath[ntrigs] = {"","HLT_HIMinBiasHfOrBSC", // "L1_SingleMu3_BptxAND","HLT_HIL1SingleMu3","HLT_HIL2Mu3", // "L1_DoubleMuOpen_BptxAND","HLT_HIL1DoubleMuOpen","HLT_HIL2DoubleMu3"}; /* const int ntrigs = 9; const char* triggerPath[ntrigs] = { "", "HLT_PAL1SingleMuOpen_v1", "HLT_PAL1SingleMu3_v1", "HLT_PAL1SingleMu7_v1", "HLT_PAL1SingleMu12_v1", "HLT_PAL1DoubleMu0_v1", "HLT_PADimuon0_NoVertexing_v1", "HLT_PAMu5_v1", "HLT_PAMu8_v1" }; */ //trigger list for singleMu rate plot const int ntrigs = 4 ; const char* triggerPath[ntrigs] = { "", "HLT_PAMu3_v1", "HLT_PAMu7_v1", "HLT_PAMu12_v1" }; /* //trigger list for DoubleMu rate plot const int ntrigs = 4 ; const char* triggerPath[ntrigs] = { "", "HLT_PAL1DoubleMuOpen_v1", "HLT_PAL1DoubleMu0_HighQ_v1", "HLT_PAL2DoubleMu3_v1" }; //trigger list fo bJet+Mu rate plot const int ntrigs =5; const char* triggerPath[ntrigs] = { "", "HLT_PAMu3PFJet20_v1", "HLT_PAMu3PFJet40_v1", "HLT_PAMu7PFJet20_v1", "HLT_PABTagMu_Jet20_Mu4_v1" };*/ TString str; TH1D *ahTemp[ntrigs]; double ahTempRate[ntrigs]; //Rates (Integrated over lumisections) // Load input TChain * HltTree = new TChain("hltanalysis/HltTree","HI OpenHLT Tree"); HltTree->Add(inFile0Name); cout << inFile0Name << endl; cout << " # entries: " << HltTree->GetEntries() << endl; int nEvents = HltTree->GetEntries(); for(int it=1; it<ntrigs; it++) { TH1D *ph = new TH1D("ph",";Lumi Section; Counts ",1100,0,1100); HltTree->Draw("LumiBlock>>ph",str.Format("%s",triggerPath[it])); TLegend *lTemp= new TLegend(0.2,0.8,0.8,0.9); lTemp->SetHeader(str.Format("Run : %d",runNum)); lTemp->SetMargin(0.05); lTemp->SetFillStyle(0); lTemp->SetLineColor(0); lTemp->SetLineWidth(5.0); lTemp->SetTextSize(0.03); lTemp->AddEntry(ph,str.Format("%s",triggerPath[it],"l")); lTemp->Draw("same"); c1->SaveAs(str.Format("%d_%s.pdf",runNum,triggerPath[it])); TH1D *phLumi = (TH1D*)gDirectory->Get("ph"); phLumi->SetDirectory(0); phLumi->Scale(1./(phLumi->GetBinWidth(1)*23));// 1lumi unit=23 sec ahTempRate[it] = phLumi->Integral()/phLumi->GetNbinsX(); ahTemp[it] = phLumi; cout<< triggerPath[it]<<"\t"<<phLumi->GetEntries()<< "\t" << ahTempRate[it] << endl; } //---------------------------- // drawing part // axis // TH1D * phLumiAxis = new TH1D("phLumiAxis",";Lumi Section;dEvt/dLumiSec",1100,0,1100); TH1D * phLumiAxis = new TH1D("phLumiAxis",";Lumi Section;Rate [Hz]",1,0,1200); phLumiAxis->SetMinimum(0.01); phLumiAxis->SetMaximum(1e+3); gStyle->SetOptStat(kFALSE); // legend TLegend *l0= new TLegend(0.2,0.7,0.8,0.9); l0->SetHeader(str.Format("Run : %d",runNum)); l0->SetMargin(0.03); l0->SetFillStyle(0); l0->SetLineColor(0); l0->SetLineWidth(1.0); l0->SetTextSize(0.03); // canvas TCanvas *pcLumi = new TCanvas("pcLumi","pcLumi"); pcLumi->cd(); phLumiAxis->Draw(); pcLumi->SetLogy(); for(int it=1; it<ntrigs; it++) { TH1 *phLocal = (TH1 *)(ahTemp[it]->Clone("phLocal")); phLocal->SetDirectory(0); phLocal->SetLineColor(it); if (it >= 10) phLocal->SetLineColor(it+20); if(it==5) phLocal->SetLineColor(kOrange+2); phLocal->Draw("same"); l0->AddEntry(phLocal,str.Format("%s: %.2f Hz",triggerPath[it],ahTempRate[it]),"l"); pcLumi->Update(); } l0->Draw("same"); pcLumi->SaveAs(str.Format("%d_ratedMu.png",runNum)); }
void multidimSampling() { #ifdef __CINT__ std::cout << "DO NOT RUN WITH CINT:" << std::endl; std::cout << "we are using a custom function which requires" << std::endl; std::cout << "that this tutorial must be compiled with ACLIC" << std::endl; return; #endif const int N = 100000; //const int NBin = 1000; const int DIM = 4; double xmin[] = {-10,-10,-10, -10}; double xmax[] = { 10, 10, 10, 10}; double par0[] = { 1., -1., 2, 0, // the gaussian mu 1, 2, 1, 3, // the sigma 0.5,0.,0.,0.,0.,0.8 }; // the correlation const int NPAR = DIM + DIM*(DIM+1)/2; // 14 in the 4d case // generate the sample GausND gaus4d(4); TF1 * f = new TF1("functionND",gaus4d,0,1,14); f->SetParameters(par0); double x0[] = {0,0,0,0}; // for debugging if (debug) f->EvalPar(x0,0); debug = false; TString name; for (int i = 0; i < NPAR; ++i ) { if (i < DIM) f->SetParName(i, name.Format("mu_%d",i+1) ); else if (i < 2*DIM) f->SetParName(i, name.Format("sig_%d",i-DIM+1) ); else if (i < 2*DIM) f->SetParName(i, name.Format("sig_%d",i-2*DIM+1) ); } //ROOT::Math::DistSamplerOptions::SetDefaultSampler("Foam"); DistSampler * sampler = Factory::CreateDistSampler(); if (sampler == 0) { Info("multidimSampling","Default sampler %s is not available try with Foam ", ROOT::Math::DistSamplerOptions::DefaultSampler().c_str() ); ROOT::Math::DistSamplerOptions::SetDefaultSampler("Foam"); } sampler = Factory::CreateDistSampler(); if (sampler == 0) { Error("multidimSampling","Foam sampler is not available - exit "); return; } sampler->SetFunction(*f,DIM); sampler->SetRange(xmin,xmax); bool ret = sampler->Init(); std::vector<double> data1(DIM*N); double v[DIM]; TStopwatch w; if (!ret) { Error("Sampler::Init","Error initializing unuran sampler"); return; } // generate the data w.Start(); for (int i = 0; i < N; ++i) { sampler->Sample(v); for (int j = 0; j < DIM; ++j) data1[N*j + i] = v[j]; } w.Stop(); w.Print(); // fill tree with data TFile * file = new TFile("multiDimSampling.root","RECREATE"); double x[DIM]; TTree * t1 = new TTree("t1","Tree from Unuran"); t1->Branch("x",x,"x[4]/D"); for (int i = 0; i < N; ++i) { for (int j = 0; j < DIM; ++j) { x[j] = data1[i+N*j]; } t1->Fill(); } // plot the data t1->Draw("x[0]:x[1]:x[2]:x[3]","","candle"); TCanvas * c2 = new TCanvas(); c2->Divide(3,2); int ic=1; c2->cd(ic++); t1->Draw("x[0]:x[1]"); c2->cd(ic++); t1->Draw("x[0]:x[2]"); c2->cd(ic++); t1->Draw("x[0]:x[3]"); c2->cd(ic++); t1->Draw("x[1]:x[2]"); c2->cd(ic++); t1->Draw("x[1]:x[3]"); c2->cd(ic++); t1->Draw("x[2]:x[3]"); t1->Write(); file->Close(); }
int CCommandLineVCal::ParseCommandArguments(const char * m_lpCmdLine) { CCommandLineVCal * cmd = this; // if no arguments, then application should open window if (_tcslen(m_lpCmdLine) < 1) return FALSE; char * arg = new char[_tcslen(m_lpCmdLine) + 1]; if (arg == NULL) return FALSE; const char * parse = m_lpCmdLine; int argp = 0; int argc = 0; char * args[64]; char stopc; char * pw = arg; while(*parse) { while(*parse != 0 && *parse==' ') parse++; if (*parse) { args[argc] = pw; argc++; } stopc = (*parse == '\"') ? '\"' : ' '; if (stopc == '\"') parse++; while(*parse != 0 && *parse != stopc) { *pw = *parse; pw++; parse++; } if (*parse) parse++; *pw = 0; pw++; } CLocationRef loc; VCTIME vcStart, vcEnd; VATIME vaStart, vaEnd; int nCount; int nReq; TString str; TString strFileOut; FILE * fout = stdout; loc.m_fLatitude = 0.0; loc.m_fLongitude = 0.0; loc.m_fTimezone = 0.0; loc.m_nDST = 0; loc.m_strName = ""; vcStart.day = 0; vcStart.month = 0; vcStart.year = 0; vcEnd.Set(vcStart); vaStart.tithi = vaStart.masa = vaStart.gyear = 0; vaEnd.Set(vaStart); nCount = -1; for(int i = 0; i < argc; i++) { //TRACE2("arg %d = %s\n", i, args[i]); if (strcmp(args[i],"-L") == 0) { if (argc >= i+2) { loc.m_strLongitude = args[i+1]; cmd->GetArg_EarthPos(args[i+1], & loc.m_fLatitude, & loc.m_fLongitude); //TRACE2("-L latitude=%f longitude=%f\n", loc.m_fLatitude, loc.m_fLongitude); } i++; } else if (strcmp(args[i],"-N") == 0) { if (argc >= i+2) { loc.m_strName = args[i+1]; //TRACE1("-N name=%s\n", loc.m_strName); } i++; } else if (strcmp(args[i],"-SV") == 0) { if (argc >= i+2) { cmd->GetArg_VaisnDate(args[i+1], &vaStart); } i++; } else if (strcmp(args[i],"-SG") == 0) { if (argc >= i+2) { cmd->GetArg_Date(args[i+1], &vcStart); } i++; } else if (strcmp(args[i],"-ST") == 0) { if (argc >= i+2) { cmd->GetArg_Time(args[i+1], &vcStart); } i++; } else if (strcmp(args[i],"-EG") == 0) { if (argc >= i+2) { cmd->GetArg_Date(args[i+1], &vcEnd); //AfxTrace("-EG day=%d month=%d year=%d\n", vcEnd.day, vcEnd.month, vcEnd.year); } i++; } else if (strcmp(args[i],"-EV") == 0) { if (argc >= i+2) { cmd->GetArg_VaisnDate(args[i+1], &vaEnd); //AfxTrace("-EV tithi=%d masa=%d gyear=%d\n", vaEnd.tithi, vaEnd.masa, vaEnd.gyear); } i++; } else if (strcmp(args[i],"-EC") == 0) { if (argc >= i+2) { nCount = atoi(args[i+1]); //AfxTrace("couint = %d\n", nCount); } i++; } else if (strcmp(args[i],"-TZ") == 0) { if (argc >= i+2) { cmd->GetArg_TimeZone(args[i+1], & loc.m_fTimezone); //TRACE1("-TZ timezone=%f\n", loc.m_fTimezone); } i++; } else if (strcmp(args[i],"-LNG") == 0) { if (argc >= i+2) { TString strLang; strLang = args[i+1]; TString strFile; if (GCGlobal::GetLangFileForAcr(strLang, strFile) == TRUE) { GCStrings::InitLanguageOutputFromFile(strFile); } } i++; } else if (strcmp(args[i],"-DST") == 0) { if (argc >= i+2) { loc.m_nDST = TTimeZone::GetID(args[i+1]); } i++; } else if (strcmp(args[i],"-O") == 0) { if (argc >= i+2) { if (fout != stdout && fout != stderr) fclose(fout); fout = fopen(args[i+1], "wt"); //strFileOut = args[i+1]; if (fout == NULL) fout = stderr; } i++; } else if (stricmp(args[i],"-R") == 0) { if (argc >= i+2) { if (stricmp(args[i + 1], "calendar") == 0) { nReq = 10; } else if (stricmp(args[i + 1], "appday") == 0) { nReq = 11; } else if (stricmp(args[i + 1], "tithi") == 0) { nReq = 12; } else if (stricmp(args[i + 1], "sankranti") == 0) { nReq = 13; } else if (stricmp(args[i + 1], "naksatra") == 0) { nReq = 14; } else if (stricmp(args[i + 1], "firstday") == 0) { nReq = 15; } else if (stricmp(args[i + 1], "gcalendar") == 0) { nReq = 16; } else if (stricmp(args[i + 1], "gtithi") == 0) { nReq = 17; } else if (stricmp(args[i + 1], "next") == 0) { nReq = 18; } else if (stricmp(args[i + 1], "xlan") == 0) { nReq = 50; } else if (stricmp(args[i + 1], "help") == 0) { nReq = 60; } /*else if (stricmp(args[i + 1], "") == 0) { } else if (stricmp(args[i + 1], "") == 0) { } else if (stricmp(args[i + 1], "") == 0) { } else if (stricmp(args[i + 1], "") == 0) { }*/ } i++; } } loc.m_strFullName.Format("%s (%s %s, %s)", loc.m_strName.c_str(), loc.m_strLatitude.c_str(), loc.m_strLongitude.c_str(), loc.m_strTimeZone.c_str()); vcStart.tzone = loc.m_fTimezone; vcEnd.tzone = loc.m_fTimezone; //AfxTrace("vcStart = %d,%d,%d,...,%f\n", vcStart.day, vcStart.month, vcStart.year, vcStart.shour); switch(nReq) { case 10: case 13: case 14: if (vcStart.year == 0 && vaStart.gyear != 0) GCCalendar::VATIMEtoVCTIME(vaStart, &vcStart, (EARTHDATA)loc); if (vcEnd.year == 0 && vaEnd.gyear != 0) GCCalendar::VATIMEtoVCTIME(vaEnd, &vcEnd, (EARTHDATA)loc); break; default: break; } if (vcStart.year != 0 && vcEnd.year != 0 && nCount < 0) nCount = int(vcEnd.GetJulian() - vcStart.GetJulian()); if (nCount < 0) nCount = 30; TResultApp appday; TResultCalendar calendar; //AfxTrace("Count === %d\n", nCount); switch(nReq) { case 10: // -R -O -LAT -LON -SG -C [-DST -NAME] vcStart.NextDay(); vcStart.PreviousDay(); GCUserInterface::CalculateCalendar(calendar, loc, vcStart, nCount); calendar.writeXml(fout); break; case 11: // -R -O -LAT -LON -SG -ST [-NAME] appday.calculateAppDay(loc, vcStart); appday.formatXml(str); fputs(str, fout); break; case 12: GCTithi::writeXml( fout, loc, vcStart); break; case 13: if (vcEnd.year == 0) { vcEnd.Set(vcStart); vcEnd.AddDays(nCount); } GCSankranti::writeXml(fout, loc, vcStart, vcEnd); break; case 14: GCNaksatra::writeXml(fout, loc, vcStart, nCount); break; case 15: GCCalendar::writeFirstDayXml(fout, loc, vcStart); break; case 16: vcStart.Set(DAYDATA::GetFirstDayOfYear((EARTHDATA)loc, vcStart.year)); vcEnd.Set(DAYDATA::GetFirstDayOfYear((EARTHDATA)loc, vcStart.year + 1)); nCount = int(vcEnd.GetJulian() - vcStart.GetJulian()); GCUserInterface::CalculateCalendar(calendar, loc, vcStart, nCount); calendar.writeXml(fout); break; case 17: GCTithi::writeGaurabdaTithiXml( fout, loc, vaStart, vaEnd); break; case 18: GCTithi::writeGaurabdaNextTithiXml( fout, loc, vcStart, vaStart); break; case 50: { int i = 0; TString str; fputs("10000\nEnglish\n10001\nen\n", fout); // export obsahu do subora for(i = 0; i < 900; i ++) { if (!GCStrings::getString(i).IsEmpty()) { str.Format("%d\n%s\n", i, GCStrings::getString(i).c_str()); fputs(str, fout); } } } break; } // application should be windowless // since some parameters are present delete [] arg; return TRUE; }