// WinMain function int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) { INSTANCE *instance; is_debug = false; MayaquaMinimalMode(); InitMayaqua(false, is_debug, 0, NULL); InitCedar(); ViSetSkip(); ViLoadStringTables(); InitWinUi(_U(IDS_TITLE+skip), _A(IDS_FONT+skip), ToInt(_A(IDS_FONT_SIZE+skip))); instance = NewSingleInstance(VI_INSTANCE_NAME); if (instance == NULL) { MsgBox(NULL, MB_ICONINFORMATION, _U(IDS_INSTANCE_EXISTS+skip)); } else { ViMain(); FreeSingleInstance(instance); if (sleep_before_exit) { SleepThread(60 * 1000); } } FreeWinUi(); ViFreeStringTables(); FreeCedar(); FreeMayaqua(); return 0; }
/** Convert arbitrary conditon objects containing standard tags * * Function entry expects as a parameter a valid DetElement handle * pointing to the subdetector, which detector elements should be * realigned. * * <temperature path="/world/TPC" name="AbientTemperatur" value="20.9*Celcius"/> * <temperature path="TPC" name="AbientTemperatur" value="20.9*Celcius"/> * <temperature name="AbientTemperatur" value="20.9*Celcius"/> * * <temperature name="AbientTemperatur" value="20.9*Kelvin"/> * <pressure name="external_pressure" value="980*hPa"/> * <include ref="..."/> * * The object tag name is passed as the conditons type to the system. * The data payload may either be specified as an attribute to the * element or as text (data payload as the inner XML of the element). * * These items have: * - a name defining the condition within the detector element * - a value interpreted as a double. In XML the value may be dressed with a unit * which will be correctly treated by the expression evaluator * - a path (optionally). attribute_values are ALWAYS treated within the context * of the containing detector element. If pathes are relative, they are * relative to the embedding element. If pathes are absolute, the embedding * element is ignored. * * @author M.Frank * @version 1.0 * @date 01/04/2014 */ template <> void Converter<arbitrary>::operator()(xml_h e) const { xml_comp_t elt(e); string tag = elt.tag(); if ( tag == "open_transaction" ) return; else if ( tag == "close_transaction" ) return; else if ( tag == "include" ) Converter<include>(lcdd,param)(e); else if ( tag == "conditions" ) Converter<conditions>(lcdd,param)(e); else if ( tag == "detelement" ) Converter<conditions>(lcdd,param)(e); else if ( tag == "subdetectors" ) xml_coll_t(e,_U(star)).for_each(Converter<conditions>(lcdd,param)); else if ( tag == "detelements" ) xml_coll_t(e,_U(star)).for_each(Converter<conditions>(lcdd,param)); else if ( tag == "alignment" ) { dd4hep_ptr<Entry> val(_createStackEntry(param,e)); val->value = elt.attr<string>(_U(ref)); _getArgs(param)->stack->push_back(val.release()); } else { dd4hep_ptr<Entry> val(_createStackEntry(param,e)); val->value = elt.hasAttr(_U(value)) ? elt.valueStr() : e.text(); _getArgs(param)->stack->push_back(val.release()); } }
/// Helper: Extract the validity from the xml element string _getValidity(xml_h elt) { if ( !elt.ptr() ) return "Infinite"; else if ( !elt.hasAttr(_U(validity)) ) return _getValidity(elt.parent()); return elt.attr<string>(_U(validity)); }
bool TagEntry::TypedefFromPattern(const wxString& tagPattern, const wxString& typedefName, wxString& name, wxString& templateInit, bool nameIncludeTemplate) { wxString pattern(tagPattern); pattern.StartsWith(wxT("/^"), &pattern); const wxCharBuffer cdata = pattern.mb_str(wxConvUTF8); clTypedefList li; get_typedefs(cdata.data(), li); if(li.size() == 1) { clTypedef td = *li.begin(); templateInit = _U(td.m_realType.m_templateDecl.c_str()); if(td.m_realType.m_typeScope.empty() == false) { name << _U(td.m_realType.m_typeScope.c_str()); if(nameIncludeTemplate) { name << templateInit; } name << wxT("::"); } name << _U(td.m_realType.m_type.c_str()); return true; } return false; }
static DD4hep::Geometry::Ref_t createSimpleBarrel(DD4hep::Geometry::LCDD& aLcdd, DD4hep::XML::Handle_t aXmlElement, DD4hep::Geometry::SensitiveDetector aSensDet) { DD4hep::XML::DetElement x_det = aXmlElement; std::string name = x_det.nameStr(); DD4hep::XML::Dimension dim(x_det.dimensions()); DD4hep::XML::Dimension pos(x_det.position()); DD4hep::XML::Dimension rot(x_det.rotation()); DD4hep::Geometry::DetElement det(name, x_det.id()); DD4hep::Geometry::Volume det_vol(name + "_vol", DD4hep::Geometry::Tube(dim.rmin(), dim.rmax(), dim.dz()), aLcdd.material(x_det.materialStr())); DD4hep::Geometry::Volume mother = aLcdd.pickMotherVolume(det); DD4hep::Geometry::Transform3D transform( DD4hep::Geometry::Rotation3D(DD4hep::Geometry::RotationZYX(rot.z(), rot.y(), rot.x())), DD4hep::Geometry::Position(pos.x(), pos.y(), pos.z())); DD4hep::Geometry::PlacedVolume phv = mother.placeVolume(det_vol, transform); det_vol.setVisAttributes(aLcdd, x_det.visStr()); det_vol.setLimitSet(aLcdd, x_det.limitsStr()); det_vol.setRegion(aLcdd, x_det.regionStr()); if (x_det.isSensitive()) { DD4hep::Geometry::SensitiveDetector sd = aSensDet; DD4hep::XML::Dimension sd_typ = x_det.child(_U(sensitive)); det_vol.setSensitiveDetector(aSensDet); sd.setType(sd_typ.typeStr()); } if (x_det.hasAttr(_U(id))) { phv.addPhysVolID("system", x_det.id()); } det.setPlacement(phv); return det; }
void wxguiDialog::addTextInput(std::string idx, std::string name, std::string def_text) { wxBoxSizer *box = new wxBoxSizer(wxHORIZONTAL); wxStaticText *text = new wxStaticText(panel, -1, _U(name.c_str())); wxTextCtrl *tc = new wxTextCtrl(panel, -1, _U(def_text.c_str())); box->Add(text, 1, wxRIGHT); box->Add(tc, 1); vbox->Add(box, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10); vbox->Add(-1, 10); map[idx] = new wxguiWidget(tc, textctrl_gettext); }
template <> void Converter<include>::operator()(xml_h e) const { XML::DocumentHolder doc(XML::DocumentHandler().load(e, e.attr_value(_U(ref)))); xml_h node = doc.root(); string tag = node.tag(); if ( tag == "display" ) xml_coll_t(node,_U(vis)).for_each(Converter<vis>(this->lcdd,param)); else if ( tag == "vismapping" ) xml_coll_t(node,_U(volume)).for_each(Converter<volume>(this->lcdd,param)); else if ( tag == "DDDB_VIS" ) Converter<dddb_vis>(lcdd,param)(node); else if ( tag == "dddb_vis" ) Converter<dddb_vis>(lcdd,param)(node); }
void CCopyDatasetDlg::OnSelchangeSrcdatasource() { // TODO: Add your control notification handler code here LONG nSelect = m_cmbSrcDatasource.GetCurSel(); if(nSelect >= 0) { CString strAlias; m_cmbSrcDatasource.GetLBText(nSelect, strAlias); OgdcString strTmp = strAlias; m_pDataSources->Lookup(strTmp, m_pSrcDataSource); m_cmbSrcDataset.ResetContent(); for(int j = 0; j < m_pSrcDataSource->GetDatasetCount();j++) { m_pDataset = m_pSrcDataSource->GetDataset(j); OgdcString strName; if (m_pDataset!=NULL) { strName = m_pDataset->GetName(); } else strName = _U(""); m_cmbSrcDataset.AddString(strName); } m_cmbSrcDataset.SetCurSel(0); OnSelchangeDataset(); } else { m_pSrcDataSource = NULL; } }
// Error handler for the UncrustifyCodeBeautifier void UncrustifyErrorHandler(const char* errorMessage) { wxString errStr; errStr << _U(errorMessage); wxMessageBox(errStr, _("Uncrustify Error"), wxOK | wxICON_ERROR); //CL_DEBUG(errStr.c_str()); }
void main(void) { HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED); if (SUCCEEDED(hr)) { { SI(IUnknown) siUnk; hr = siUnk.Instantiate(CLSID_Goodbye); if (SUCCEEDED(hr)) { SI(IHello) siHello = siUnk; siHello->HelloWorld(); } SI(IPersistStorage) sips; hr = sips.BindToObject(_U("D:\\dbox\\courseware\\ecom\\02_cxx.ppt")); SI(IClassFactory) sicf; hr = sicf.GetClassObject(OLESTR("Excel.Sheet")); SI(IUnknown) p1; hr = sicf->CreateInstance(0, IID_PPV(p1)); hr = OleRun(p1.GetNonAddRefedInterface()); } CoUninitialize(); } }
/** Convert objects containing standard conditions tags * * Function entry expects as a parameter a valid DetElement handle * pointing to the subdetector, which detector elements should be * realigned. A absolute or relative DetElement path may be supplied by * the element as an attribute: * * <conditions path="/world/TPC/TPC_SideA/TPC_SideA_sector02"> * ... * </conditions> * * @author M.Frank * @version 1.0 * @date 01/04/2014 */ template <> void Converter<conditions>::operator()(xml_h e) const { ConversionArg* arg = _getArgs(param); DetElement elt = arg->detector; arg->detector = _getDetector(param,e); xml_coll_t(e,_U(star)).for_each(Converter<arbitrary>(lcdd,param)); arg->detector = elt; }
template <> void Converter<dddb_vis>::operator()(xml_h e) const { xml_coll_t(e, _U(include)).for_each( Converter<include>(lcdd,param)); xml_coll_t(e, _U(display)).for_each(_U(include), Converter<include>(lcdd,param)); xml_coll_t(e, _LBU(vismapping)).for_each(_U(include), Converter<include>(lcdd,param)); xml_coll_t(e, _U(display)).for_each(_U(vis), Converter<vis> (lcdd,param)); xml_coll_t(e, _LBU(vismapping)).for_each(_U(volume), Converter<volume> (lcdd,param)); }
void CodeFormatter::AstyleFormat(const wxString& input, const wxString& options, wxString& output) { char* textOut = AStyleMain(_C(input), _C(options), ASErrorHandler, ASMemoryAlloc); if(textOut) { output = _U(textOut); output.Trim(); delete[] textOut; } }
void wxguiDialog::addSubmit(std::string name) { wxBoxSizer *box = new wxBoxSizer(wxHORIZONTAL); wxButton *bu = new wxButton(panel, ID_SUBMIT, _U(name.c_str())); Connect(ID_SUBMIT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxguiDialog::OnSubmit)); box->Add(bu, 1); vbox->Add(box, 0, wxALIGN_CENTER | wxBOTTOM, 10); }
// Check the signature of the EXE file, and displays a warning if dangerous bool ViCheckExeSign(HWND hWnd, wchar_t *exew) { wchar_t tmp[2048]; bool danger = true; wchar_t *warningMessage = _U(IDS_SIGN_WARNING+skip); wchar_t *warningMessageTitle = _U(IDS_SIGN_WARNING_TITLE+skip); // Validate arguments if (hWnd == NULL || exew == NULL) { return false; } if (MsCheckFileDigitalSignatureW(hWnd, exew, &danger)) { if (danger == false) { // Safe return true; } else { wchar_t filename[MAX_PATH]; GetFileNameFromFilePathW(filename, sizeof(filename), exew); // Show the message because there is potentially dangerous swprintf(tmp, sizeof(tmp) / 2, warningMessage, filename, filename, filename); if (MessageBoxW(hWnd, tmp, warningMessageTitle, MB_OKCANCEL | MB_DEFBUTTON2 | MB_ICONEXCLAMATION) == IDOK) { return true; } return false; } } else { // Danger return false; } }
static inline QString toString(double value, bool sign, int n = 1) { if (n <= 0) return toString(qRound(value), sign); QString ret; if (sign && value >= 0) ret = (value > 0 ? _L("+") : _U("±")); QByteArray fmt("%."); fmt.reserve(10); fmt.append(QByteArray::number(n)).append("f"); return ret += QString().sprintf(fmt.data(), value); }
/** Simple cone using dimensions to be used to define cone composed of 1 single material @author Clement Helsens **/ static DD4hep::Geometry::Ref_t createSimpleCone(DD4hep::Geometry::LCDD& lcdd, xml_h e, DD4hep::Geometry::SensitiveDetector sensDet) { xml_det_t x_det = e; std::string name = x_det.nameStr(); DD4hep::Geometry::DetElement coneDet(name, x_det.id()); DD4hep::Geometry::Volume experimentalHall = lcdd.pickMotherVolume(coneDet); xml_comp_t coneDim(x_det.child(_U(dimensions))); DD4hep::Geometry::Cone cone(coneDim.dz(), coneDim.rmin1(), coneDim.rmax1(), coneDim.rmin2(), coneDim.rmax2()); DD4hep::Geometry::Volume coneVol(x_det.nameStr() + "_SimpleCone", cone, lcdd.material(coneDim.materialStr())); if (x_det.isSensitive()) { DD4hep::XML::Dimension sdType(x_det.child(_U(sensitive))); coneVol.setSensitiveDetector(sensDet); sensDet.setType(sdType.typeStr()); } DD4hep::Geometry::PlacedVolume conePhys; double zoff = coneDim.z_offset(); if (fabs(zoff) > 0.000000000001) { double reflectionAngle = 0.; if (coneDim.hasAttr(_Unicode(reflect))) { if (coneDim.reflect()) { reflectionAngle = M_PI; } } DD4hep::Geometry::Position trans(0., 0., zoff); conePhys = experimentalHall.placeVolume(coneVol, DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationX(reflectionAngle), trans)); } else conePhys = experimentalHall.placeVolume(coneVol); conePhys.addPhysVolID("system", x_det.id()); coneDet.setPlacement(conePhys); coneDet.setVisAttributes(lcdd, x_det.visStr(), coneVol); return coneDet; }
int navlog_viewer_GUI_designApp::OnRun() { try { return wxApp::OnRun(); } catch (std::exception &e) { ::wxMessageBox(_U(e.what()),_("Exception:")); return -1; } }
int main(int argc, char* argv[]) #endif { if (argc < 2) { std::ucerr << _U("Usage: ") << argv[0] << _U(" <pgnfile>") << std::endl; return EXIT_FAILURE; } boost::intrusive_ptr<pgn::IParser> pgnparser; pgnparser = pgn::IParser::create(argv[1]); if (pgnparser == NULL) { std::ucerr << _U("Critical error: can't open ") << argv[1] << _U(" file") << std::endl; return EXIT_FAILURE; } return EXIT_SUCCESS; }
TEST_FIXTURE(Parser55FeaturesTestClass, Yield) { UnicodeString code = _U( "class IteratorClass {\n" " function iterate() {\n" " for ($i = 0; $i < 100; $i++) {\n" " yield $i;\n" " }\n" " }\n" "}\n" ); CHECK(Parser.LintString(code, LintResults)); }
wxguiDialog::wxguiDialog(std::string _name) : guiDialog(_name), wxDialog(NULL, -1, _U(_name.c_str()), wxDefaultPosition), name(_name) { panel = new wxPanel(this, -1); vbox = new wxBoxSizer(wxVERTICAL); //hbox = new wxBoxSizer(wxHORIZONTAL); //vbox->Add(panel, 1); //vbox->Add(hbox, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, 10); }
CCopyDatasetDlg::CCopyDatasetDlg(CWnd* pParent /*=NULL*/) : CDialog(CCopyDatasetDlg::IDD, pParent) { //{{AFX_DATA_INIT(CCopyDatasetDlg) m_strSrcDTName = _U(""); //}}AFX_DATA_INIT m_pDataSources = NULL; m_pObjDataSource = NULL; m_pDataset = NULL; m_pSrcDataSource = NULL; }
TEST_FIXTURE(Parser55FeaturesTestClass, ParserTernaryWithDefault) { Parser.SetClassObserver(&Observer); UnicodeString code = _U( "<?php\n" "class MyClass {\n" " function stop($name) {\n" " $this->name = $name ?: new MyClass(); \n" " }\n" "}\n" ); CHECK(Parser.ScanString(code, LintResults)); CHECK_VECTOR_SIZE(1, Observer.ClassName); CHECK_UNISTR_EQUALS("MyClass", Observer.ClassName[0]); }
TEST_FIXTURE(Parser55FeaturesTestClass, ListInForEach) { UnicodeString code = _U( "<?php\n" "$array = [\n" " [1, 2],\n" " [3, 4],\n" "];\n" "\n" "foreach ($array as list($a, $b)) {\n" " echo \"A: $a; B: $b\";\n" "}\n" ); CHECK(Parser.LintString(code, LintResults)); }
// Installer dialog initialization void ViInstallDlgOnInit(HWND hWnd, VI_INSTALL_DLG *d) { // Validate arguments if (hWnd == NULL || d == NULL) { return; } d->hWnd = hWnd; SetIcon(hWnd, 0, IDI_MAIN); SetText(hWnd, 0, _U(IDS_DLG_TITLE+skip)); SetText(hWnd, S_TITLE, _U(IDS_DLG_TITLE+skip)); SetText(hWnd, S_STATUS, _U(IDS_INSTALL_DLG__STATUS_INIT+skip)); SetText(hWnd, IDCANCEL, _U(IDS_INSTALL_CANCEL+skip)); DlgFont(hWnd, S_TITLE+skip, 12, true); SetRange(hWnd, P_PROGRESS, 0, 100); SetPos(hWnd, P_PROGRESS, 0); SetTimer(hWnd, 1, 22, NULL); }
void CAMCode<B,T,D>::AdvMom () { CalcE (_B, _Ua, _dnf); T ni, dth = T(.5) * _time.Dt (); FldVector ui, uf, bi, ei; DomainIterator<D> itu, itb, ite; _dn.GetDomainIterator (itu, false); _B.GetDomainIterator (itb, false); _E.GetDomainIteratorAll (ite, true); do { ni = _dn(itu); ui = _U (itu); uf = _Uf(itu); bi = _B (itb); CartStencil::Average (_E, ite, ei); _U(itu) = uf + dth * (ni*ei + ui % bi); } while (itu.Next() && itb.Next() && ite.Next()); }
TEST_FIXTURE(Parser55FeaturesTestClass, FinallyClause) { UnicodeString code = _U( "class SafeClass {\n" " function safeCall($url) {\n" " try { \n" " } catch (Exception $e) {\n" " \n" " } finally {\n" " \n" " }\n" " }\n" "}\n" ); CHECK(Parser.LintString(code, LintResults)); }
UncertainTransformation::UncertainTransformation(const Transformation & T, double diagonalTranslationVariance, double diagonalRotationVariance) : Transformation(T) { _U.setZero(); _U(0,0) = diagonalTranslationVariance; _U(1,1) = diagonalTranslationVariance; _U(2,2) = diagonalTranslationVariance; _U(3,3) = diagonalRotationVariance; _U(4,4) = diagonalRotationVariance; _U(5,5) = diagonalRotationVariance; }
TEST_FIXTURE(Parser55FeaturesTestClass, ParserClassStaticIndirectVariable) { Parser.SetClassObserver(&Observer); Parser.SetClassMemberObserver(&Observer); Parser.SetVariableObserver(&Observer); UnicodeString code = _U( "<?php\n" "class MyClass {\n" " function stop() {\n" " $this::$appname = null;\n" " }\n" "}\n" ); CHECK(Parser.ScanString(code, LintResults)); // not capturing indirect variables for now CHECK_VECTOR_SIZE(0, Observer.VariableExpressions); }
TEST_FIXTURE(Parser55FeaturesTestClass, ExpressionsInEmpty) { UnicodeString code = _U( "<?php\n" "function always_false() {\n" " return false;\n" "}\n" "\n" "if (empty(always_false())) {\n" " echo 'This will be printed.';\n" "}\n" "\n" "if (empty(true)) {\n" " echo 'This will not be printed.';\n" "}\n" ); CHECK(Parser.LintString(code, LintResults)); }