model * model::translate(ast_translation & translator) const { model * res = alloc(model, translator.to()); // Translate const interps decl2expr::iterator it1 = m_interp.begin(); decl2expr::iterator end1 = m_interp.end(); for (; it1 != end1; ++it1) { res->register_decl(translator(it1->m_key), translator(it1->m_value)); } // Translate func interps decl2finterp::iterator it2 = m_finterp.begin(); decl2finterp::iterator end2 = m_finterp.end(); for (; it2 != end2; ++it2) { func_interp * fi = it2->m_value; res->register_decl(translator(it2->m_key), fi->translate(translator)); } // Translate usort interps sort2universe::iterator it3 = m_usort2universe.begin(); sort2universe::iterator end3 = m_usort2universe.end(); for (; it3 != end3; ++it3) { ptr_vector<expr> new_universe; for (unsigned i=0; i<it3->m_value->size(); i++) new_universe.push_back(translator(it3->m_value->get(i))); res->register_usort(translator(it3->m_key), new_universe.size(), new_universe.c_ptr()); } return res; }
virtual model_converter * translate(ast_translation & translator) { pb_preproc_model_converter* mc = alloc(pb_preproc_model_converter, translator.to()); for (unsigned i = 0; i < m_const.size(); ++i) { mc->set_value_p(translator(m_const[i].first), translator(m_const[i].second)); } return mc; }
/** \brief Store in r the current set of assertions. r is (owned) by the external assertion set */ void solver_exp::get_assertions(assertion_set & r) { SASSERT(&(r.m()) == &m_ext_mng); ast_translation translator(m, m_ext_mng, false); unsigned sz = m_assertions.size(); for (unsigned i = 0; i < sz; i++) { expr * f = m_assertions.form(i); r.assert_expr(translator(f)); } }
/** \brief Translate the assertion set to a new one that uses a different ast_manager. */ assertion_set * assertion_set::translate(ast_translation & translator) const { ast_manager & m_to = translator.to(); assertion_set * res = alloc(assertion_set, m_to); unsigned sz = m().size(m_forms); for (unsigned i = 0; i < sz; i++) { res->m().push_back(res->m_forms, translator(m().get(m_forms, i))); if (m_to.proofs_enabled()) res->m().push_back(res->m_proofs, translator(m().get(m_proofs, i))); } res->m_inconsistent = m_inconsistent; return res; }
QString FmFileDialog::getOpenFileName( HbWidget *parent, const QString &title, const QString &dir, const QStringList &nameFilters, Options options ) { HbTranslator translator("filemanager"); translator.loadCommon(); QString ret; FmFileDialogPrivate::FmFileDialogArgs args; args.mDialogMode = FmFileDialogPrivate::GetFileMode; args.mTitle = title; args.mDirectory = dir; if( options & DisplayAllDirs ) { args.mDirFilters = QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files; } else { args.mDirFilters = QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files; } args.mNameFilters = nameFilters; args.mOptions = options; FmFileDialog dialog( parent ); dialog.d_ptr->init( args ); if( dialog.exec() ) { ret = FmUtils::fillPathWithSplash( dialog.d_ptr->currentPath() ) + dialog.d_ptr->selectedFile(); } return ret; }
/*! The main entry point of the clock application. Constructs the view manager object. */ int main(int argc, char *argv[]) { OstTraceFunctionEntry0( _MAIN_ENTRY ); // Create and initialize an ClockApplication instance QScopedPointer<ClockApplication> application( new ClockApplication(argc, argv)); // Main window widget. // Includes decorator such as signal strength and battery life indicator. HbMainWindow window; window.setRenderHints( QPainter::HighQualityAntialiasing | QPainter::SmoothPixmapTransform); window.setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); // Load the translation file. HbTranslator translator("clock"); translator.loadCommon(); // Construct the application controller. application->createController(); // Show widget window.show(); // Start the event loop for the application return application->execution(); }
translator load_virtual (string name) { if (translator::instances -> contains (name)) return translator (name); translator trl= tm_new<translator_rep> (name); string s, r; name= name * ".vfn"; if (DEBUG_STD) debug_fonts << "Loading " << name << "\n"; url u ("$TEXMACS_HOME_PATH/fonts/virtual:$TEXMACS_PATH/fonts/virtual", name); load_string (u, s, true); tree t= string_to_scheme_tree (s); ASSERT (is_tuple (t, "virtual-font"), "bad virtual font format"); int i, n= N(t); trl->virt_def= array<tree> (n); for (i=1; i<n; i++) if (is_func (t[i], TUPLE, 2) && is_atomic (t[i][0])) { string s= as_string (t[i][0]); if (N(s)>1) s= "<" * s * ">"; trl->dict (s)= i; trl->virt_def[i]= t[i][1]; // cout << s << "\t" << i << "\t" << t[i][1] << "\n"; } return trl; }
void MapViewer::render_sprites() { //Calculate the projection matrix std::pair<int, int> size = window->get_size(); glm::mat4 projection_matrix = glm::ortho(0.0f, float(size.first), 0.0f, float(size.second), 0.0f, 1.0f); //Draw the sprites const std::vector<int>& sprites = map->get_sprites(); ObjectManager& object_manager = ObjectManager::get_instance(); for (auto it = sprites.begin(); it != sprites.end(); ++it) { if (*it != 0) { std::shared_ptr<Sprite> sprite = object_manager.get_object<Sprite>(*it); if (!sprite) { continue; } if (!sprite->is_renderable()) { continue; } RenderableComponent* sprite_render_component = sprite->get_renderable_component(); //Move sprite to the required position glm::vec3 translator( sprite->get_position().x - get_display_x(), sprite->get_position().y - get_display_y(), 0.0f ); glm::mat4 model(glm::mat4(1.0f)); model = glm::scale (model, glm::vec3(Engine::get_actual_tile_size())); model = glm::translate(model, translator); sprite_render_component->set_modelview_matrix(model); sprite_render_component->set_projection_matrix(projection_matrix); sprite_render_component->bind_shader(); Shader* shader = sprite_render_component->get_shader().get(); if(shader == nullptr) { LOG(ERROR) << "MapViewer::render_map: Shader (sprite_render_component->get_shader()) should not be null"; return; } //TODO: I don't want to actually expose the shader, put these into wrappers in the shader object glUniformMatrix4fv(glGetUniformLocation(shader->get_program(), "mat_projection"), 1, GL_FALSE,glm::value_ptr(sprite_render_component->get_projection_matrix())); glUniformMatrix4fv(glGetUniformLocation(shader->get_program(), "mat_modelview"), 1, GL_FALSE, glm::value_ptr(sprite_render_component->get_modelview_matrix())); sprite_render_component->bind_vbos(); sprite_render_component->bind_textures(); glDrawArrays(GL_TRIANGLES, 0, sprite_render_component->get_num_vertices_render()); sprite_render_component->release_textures(); sprite_render_component->release_vbos(); sprite_render_component->release_shader(); } } }
/* * destination buffer size */ size_t _elf32_xltsize(const Elf_Data *src, unsigned dv, unsigned encode, int tof) { Elf_Type type = src->d_type; unsigned sv = src->d_version; xlator op; if (!valid_version(sv) || !valid_version(dv)) { seterr(ERROR_UNKNOWN_VERSION); return (size_t)-1; } if (tof) { /* * Encoding doesn't really matter (the translator only looks at * the source, which resides in memory), but we need a proper * encoding to select a translator... */ encode = ELFDATA2LSB; } else if (!valid_encoding(encode)) { seterr(ERROR_UNKNOWN_ENCODING); return (size_t)-1; } if (!valid_type(type)) { seterr(ERROR_UNKNOWN_TYPE); return (size_t)-1; } if (!(op = translator(sv, dv, encode, type, tof))) { seterr(ERROR_UNKNOWN_TYPE); return (size_t)-1; } return (*op)(NULL, src->d_buf, src->d_size); }
void solver_exp::get_model_converter(model_converter_ref & mc) { ast_translation translator(m, m_ext_mng, false); if (m_mc) mc = m_mc->translate(translator); else mc = 0; }
int main( int argc, char ** argv ) { QApplication a(argc, argv, TRUE); QTranslator translator( 0 ); QLocale mylocale; QString langCode = mylocale.name(); if ( ! QFile::exists( PREFIX + "/share/pcbsd/i18n/PBI_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); translator.load( QString("PBI_") + langCode, PREFIX + "/share/pcbsd/i18n/" ); a.installTranslator( &translator ); qDebug() << "Locale:" << langCode; PBI w; QString pbifile; if ( argc == 2) pbifile = argv[1]; else return -1; qDebug() << "Loading PBI: " << pbifile; w.ProgramInit(pbifile); w.show(); a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); return a.exec(); }
int main() { std::string sentence = "北韩 是 与 澳洲 有 邦交 的 少数 国家 之一"; std::vector<std::string> vec; std::vector<rule_tree*> tree_vec; std::vector<hypothesis*> hypo_vec; configuration* config = configuration::get_instance(); model* system_model = config->get_model(); lexer lex; std::vector<std::shared_ptr<const trellis_path>> path_list; std::vector<const std::string*> output_vec; load_parameter(); print_parameter(); load_model(); string_split(sentence, " ", vec); lex.set_handler(create_unknow_word_rule); lex.set_input(vec); lex.process(); tree_vec.push_back(lex.get_rule_tree()); tree_vec.push_back(system_model->get_rule_tree(0)); tree_vec.push_back(system_model->get_rule_tree(1)); parser translator(&tree_vec); translator.parse(lex.get_output()); translator.get_all_hypothesis(hypo_vec); /* for (unsigned int i = 0; i < hypo_vec.size(); i++) { std::cout << i << " ||| "; print_hypothesis(hypo_vec[i]); //hypothesis_track(hypo_vec[i]); }*/ translator.get_nbest(1000, &path_list, true); for (unsigned int i = 0; i < path_list.size(); i++) { auto& path = path_list[i]; output_vec.clear(); path->output(&output_vec); std::cout << i << " ||| "; for (unsigned int i = 0; i < output_vec.size(); i++) { std::cout << *output_vec[i] << " "; } auto score_vec = path->get_score_vector(); std::cout << " ||| "; for (unsigned int i = 0; i < score_vec->size(); i++) { std::cout << score_vec->at(i) << " "; } std::cout << " ||| " << path->get_total_score(); std::cout << " ||| " << path->get_heuristic_score(); std::cout << std::endl; } }
void Doom3Group::translateChildren(const Vector3& childTranslation) { if (_owner.inScene()) { ChildTranslator translator(childTranslation); _owner.traverse(translator); } }
void solver_exp::assert_goal(goal const & g) { SASSERT(&(g.m()) == &m_ext_mng); ast_translation translator(m_ext_mng, m, false); unsigned sz = g.size(); for (unsigned i = 0; i < sz; i++) { assert_expr_core(g.form(i), translator); } }
void Doom3GroupNode::removeOriginFromChildren() { if (!_d3Group.isModel()) { BrushTranslator translator(-_d3Group.getOrigin()); traverse(translator); } }
/** \brief Assert an assertion set s (owned by the external manager) */ void solver_exp::assert_set(assertion_set const & s) { SASSERT(&(s.m()) == &m_ext_mng); ast_translation translator(m_ext_mng, m, false); unsigned sz = s.size(); for (unsigned i = 0; i < sz; i++) { assert_expr_core(s.form(i), translator); } }
void Doom3GroupNode::addOriginToChildren() { if (!_d3Group.isModel()) { BrushTranslator translator(_d3Group.getOrigin()); traverse(translator); } }
Point CylindricSurface::compute(double u, double v) { Point originOnGenerator = getGenerator()->compute(u); Point originOnDirector = getDirector()->compute(0); Point next = getDirector()->compute(v); Vector translator(originOnDirector, next); return originOnGenerator.translate(translator); }
/* * direction-independent translation */ static Elf_Data* elf32_xlate(Elf_Data *dst, const Elf_Data *src, unsigned encode, int tof) { Elf_Type type; int dv; int sv; size_t dsize; size_t tmp; xlator op; if (!src || !dst) { return NULL; } if (!src->d_buf || !dst->d_buf) { seterr(ERROR_NULLBUF); return NULL; } if (!valid_encoding(encode)) { seterr(ERROR_UNKNOWN_ENCODING); return NULL; } sv = src->d_version; dv = dst->d_version; if (!valid_version(sv) || !valid_version(dv)) { seterr(ERROR_UNKNOWN_VERSION); return NULL; } type = src->d_type; if (!valid_type(type)) { seterr(ERROR_UNKNOWN_TYPE); return NULL; } op = translator(sv, dv, encode, type, tof); if (!op) { seterr(ERROR_UNKNOWN_TYPE); return NULL; } dsize = (*op)(NULL, src->d_buf, src->d_size); if (dsize == (size_t)-1) { return NULL; } if (dst->d_size < dsize) { seterr(ERROR_DST2SMALL); return NULL; } if (dsize) { tmp = (*op)(dst->d_buf, src->d_buf, src->d_size); if (tmp == (size_t)-1) { return NULL; } elf_assert(tmp == dsize); } dst->d_size = dsize; dst->d_type = type; return dst; }
VampPluginAdapter(const string & script_filename): m_script_filename(script_filename) { ScriptTranslator translator(get_marsystem_manager()); m_prototype = translator.translateFile(script_filename); if (!m_prototype) { cerr << "ERROR: Failed to create prototype for script: " << script_filename << endl; } }
/** \brief Translate the assertion set to a new one that uses a different ast_manager. */ goal * goal::translate(ast_translation & translator) const { expr_dependency_translation dep_translator(translator); ast_manager & m_to = translator.to(); goal * res = alloc(goal, m_to, m_to.proofs_enabled() && proofs_enabled(), models_enabled(), unsat_core_enabled()); unsigned sz = m().size(m_forms); for (unsigned i = 0; i < sz; i++) { res->m().push_back(res->m_forms, translator(m().get(m_forms, i))); if (res->proofs_enabled()) res->m().push_back(res->m_proofs, translator(m().get(m_proofs, i))); if (res->unsat_core_enabled()) res->m().push_back(res->m_dependencies, dep_translator(m().get(m_dependencies, i))); } res->m_inconsistent = m_inconsistent; res->m_depth = m_depth; res->m_precision = m_precision; return res; }
Z3_goal Z3_API Z3_goal_translate(Z3_context c, Z3_goal g, Z3_context target) { Z3_TRY; LOG_Z3_goal_translate(c, g, target); RESET_ERROR_CODE(); ast_translation translator(mk_c(c)->m(), mk_c(target)->m()); Z3_goal_ref * _r = alloc(Z3_goal_ref); _r->m_goal = to_goal_ref(g)->translate(translator); mk_c(target)->save_object(_r); Z3_goal r = of_goal(_r); RETURN_Z3(r); Z3_CATCH_RETURN(0); }
int main( int argc, char **argv ) { QApplication a( argc, argv ); QTranslator translator(0); translator.load("tcpserver_zh","."); a.installTranslator(&translator); TcpServer *tcpserver = new TcpServer(); tcpserver->show(); return a.exec(); }
int main(int argc, char *argv[]) { QFont font("ZYSong18030",12); QApplication::setFont(font); QApplication app(argc,argv); QTranslator translator(0); translator.load("geometry_zh","."); app.installTranslator(&translator); Geometry *g = new Geometry(); g->show(); return app.exec(); }
int main( int argc, char **argv ) { QApplication app( argc, argv ); QTranslator translator( 0 ); translator.load( QString("tt3_") + QTextCodec::locale(), "." ); app.installTranslator( &translator ); MainWindow *mw = new MainWindow; app.setMainWidget( mw ); mw->show(); return app.exec(); }
model_converter * fpa2bv_model_converter_prec::translate(ast_translation & translator) { fpa2bv_model_converter_prec * res = alloc(fpa2bv_model_converter_prec, translator.to()); for (obj_map<func_decl, expr*>::iterator it = m_const2bv.begin(); it != m_const2bv.end(); it++) { func_decl * k = translator(it->m_key); expr * v = translator(it->m_value); res->m_const2bv.insert(k, v); translator.to().inc_ref(k); translator.to().inc_ref(v); } for (obj_map<func_decl, expr*>::iterator it = m_rm_const2bv.begin(); it != m_rm_const2bv.end(); it++) { func_decl * k = translator(it->m_key); expr * v = translator(it->m_value); res->m_rm_const2bv.insert(k, v); translator.to().inc_ref(k); translator.to().inc_ref(v); } return res; }
int main( int argc, char **argv ) { QFont font("ZYSong18030",12); QApplication::setFont(font); QApplication a( argc, argv ); QTranslator translator(0); translator.load("fileviewer_zh","."); a.installTranslator(&translator); FileViewer *fileviewer = new FileViewer(); fileviewer->show(); return a.exec(); }
int main( int argc, char * argv[] ) { QFont font("ZYSong18030",12); QApplication::setFont(font); QApplication a( argc, argv ); QTranslator translator(0); translator.load("stack_zh","."); a.installTranslator(&translator); StackDlg stack; stack.show(); return a.exec(); }
int main( int argc, char **argv ) { QFont font("ZYSong18030",12); QApplication::setFont(font); QApplication a( argc, argv ); QTranslator translator(0); translator.load("udpclient_zh","."); a.installTranslator(&translator); UdpClient *udpclient = new UdpClient(); udpclient->show(); return a.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; // w.setWindowFlags(Qt::FramelessWindowHint); // w.setWindowFlags(Qt::CustomizeWindowHint); w.show(); QTranslator translator(&a);//Loader translator translator.load(QString("./language/KaymaxRecorderUI_en_US"));//Language pack files generated by the linguist tool a.installTranslator(&translator); return a.exec(); }