bool test(vector<char> rom, uint16_t base) { uint16_t chk = le(rom, base + 0x7fdc); uint16_t cpl = le(rom, base + 0x7fde); uint32_t cmp = chk + cpl; if (cmp == 0xffff) { return true; } return false; }
TEST(LazardEvaluation, Test) { using Poly = carl::MultivariatePolynomial<Rational>; carl::Variable x = carl::freshRealVariable("x"); carl::Variable y = carl::freshRealVariable("y"); carl::Variable z = carl::freshRealVariable("z"); Poly p = (Poly(x)-Poly(y))*z; carl::LazardEvaluation<Rational,Poly> le(p); { carl::UnivariatePolynomial<Rational> p(x, std::initializer_list<Rational>{-2, 0, 1}); carl::Interval<Rational> i(Rational(1), carl::BoundType::STRICT, Rational(2), carl::BoundType::STRICT); carl::RealAlgebraicNumber<Rational> ran(p, i); le.substitute(x, ran); } { carl::UnivariatePolynomial<Rational> p(y, std::initializer_list<Rational>{-2, 0, 1}); carl::Interval<Rational> i(Rational(1), carl::BoundType::STRICT, Rational(2), carl::BoundType::STRICT); carl::RealAlgebraicNumber<Rational> ran(p, i); le.substitute(y, ran); } EXPECT_EQ(-Poly(z), le.getLiftingPoly()); }
int le(int x, int y) { if (x > 0 && y > 0) { return le(x-1, y-1); } else { return (x == 0); } }
void ConfigureLinuxHWDev(VPNum vp) { if (vp) return; { LinuxEnv le(SysCall); vfs_caches_init(0x1<<8); driver_init(); buffer_init(); } ConfigureLinuxHWDevArch(); INITCALL(deadline_slab_setup); INITCALL(device_init); INITCALL(elevator_global_init); INITCALL(init_bio); INITCALL(vio_bus_init); if (!KernelInfo::OnSim() || KernelInfo::OnHV()) { INITCALL(pcibus_class_init); INITCALL(pci_driver_init); INITCALL(pci_init); } }
void Slave::HandleWriteTimeDate(HeaderReadIterator& arHWI) { if (!mIIN.GetNeedTime()) { LOG_BLOCK(LEV_WARNING, "Master is attempting to write time but slave is not requesting time sync"); return; } ObjectReadIterator obj = arHWI.BeginRead(); if (obj.Count() != 1) { mRspIIN.SetParameterError(true); return; } millis_t val = Group50Var1::Inst()->mTime.Get(*obj); mpTime->SetTime(val); mIIN.SetNeedTime(false); if(mpLogger->IsEnabled(LEV_EVENT)) { LogEntry le(LEV_EVENT, mpLogger->GetName(), LOCATION, "Time synchronized with master", TIME_SYNC_UPDATED); le.AddValue("MILLISEC_SINCE_EPOCH", val); mpLogger->Log(le); } }
static void checkTypeSyntax(Val form, int iMin, int iMax, char* szSyntax) { Val n = safe_list_length(form); if (nil == n) error("Malformed type specifier: ~S", form); if (ge(n, iMin) && le(n, iMax)) return; error("Expect ~S: ~S", make_string(szSyntax), form); } // checkTypeSyntax
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) { QWidget* w(new QWidget(this)); setCentralWidget(w); QVBoxLayout* mainLayout(new QVBoxLayout(w)); mainLayout->setAlignment(Qt::AlignRight); sm::LineEdit* le(new sm::LineEdit(w)); le->show(); mainLayout->addWidget(le); sm::LineEdit* le1( new sm::LineEdit(sm::LineEdit::Ctrl::Exam, tr("Enter first name"), w)); le1->SetRegExpr(QString("[a-z]")); le1->show(); mainLayout->addWidget(le1); sm::LineEdit* le2( new sm::LineEdit(sm::LineEdit::Ctrl::Pwd, tr("Password"), w)); le2->show(); mainLayout->addWidget(le2); sm::LineEdit* le3( new sm::LineEdit(sm::LineEdit::Ctrl::ExamAndPwd, tr("Password"), w)); le3->SetRegExpr(QString("")); le3->show(); mainLayout->addWidget(le3); centralWidget()->setLayout(mainLayout); }
void Module::paste_before ( void ) { Module *m = _copied_module_empty; Log_Entry le( _copied_module_settings ); le.remove( ":chain" ); char *print = le.print(); DMESSAGE( "Pasting settings: %s", print ); free( print ); m->set( le ); if ( ! chain()->insert( this, m ) ) { fl_alert( "Copied module cannot be inserted at this point in the chain" ); } free( _copied_module_settings ); _copied_module_settings = NULL; _copied_module_empty = NULL; /* set up for another paste */ m->copy(); }
void Temperature::bc_flag_txyz(const double t, const double* xp, std::vector<int> & bc_flag) const { // T' and its adjoint must be Dirichlet homogeneous everywhere on the boundary, by definition. const double bdry_toll = DEFAULT_BDRY_TOLL; Box* box= static_cast<Box*>(_qtymap.GetMeshTwo()->GetDomain()); std::vector<double> lb(_qtymap.GetMeshTwo()->get_dim()); std::vector<double> le(_qtymap.GetMeshTwo()->get_dim()); lb[0] = box->_lb[0]; //already nondimensionalized le[0] = box->_le[0]; lb[1] = box->_lb[1]; le[1] = box->_le[1]; if (_qtymap.GetMeshTwo()->get_dim() == 3) { lb[2] = box->_lb[2]; le[2] = box->_le[2]; } std::vector<double> x_rotshift(_qtymap.GetMeshTwo()->get_dim()); _qtymap.GetMeshTwo()->_domain->TransformPointToRef(xp,&x_rotshift[0]); if ( (x_rotshift[0]) > -bdry_toll && ( x_rotshift[0]) < bdry_toll ) { //left of the RefBox bc_flag[0]=0; //always fixed } if ( (le[0]-lb[0]) - (x_rotshift[0]) > -bdry_toll && (le[0]-lb[0]) -(x_rotshift[0]) < bdry_toll) { //right of the RefBox bc_flag[0]=0; //always fixed } if (( x_rotshift[1]) > -bdry_toll && ( x_rotshift[1]) < bdry_toll) { //bottom of the RefBox bc_flag[0]=0; //always fixed } if ((le[1]-lb[1]) -(x_rotshift[1]) > -bdry_toll && (le[1]-lb[1]) -(x_rotshift[1]) < bdry_toll) { //top of the RefBox bc_flag[0]=0; //always fixed } if (_qtymap.GetMeshTwo()->get_dim() == 3) { if ( (x_rotshift[2]) > -bdry_toll && ( x_rotshift[2]) < bdry_toll ) { bc_flag[0]=0; } if ((le[2]-lb[2]) -(x_rotshift[2]) > -bdry_toll && (le[2]-lb[2]) -(x_rotshift[2]) < bdry_toll) { bc_flag[0]=0; } } //end dim 3 return; }
void jogador2(char m[][3]) /*Esta função captura a jogada do jogador 2*/ { int x, y; printf("\n\t\t\t Jogador 2\n"); le(&x, &y); /* Le as coordenadas*/ if(m[x][y]==' ') m[x][y]='o'; /* Se a coordenada escolhida estiver em branco ela receberá um o*/ else jogador2(m); /* Senao ela repetira ate que a coordenada seja um espaço em branco*/ }
TEST_F(LazardTest, Proper1) { auto ax = getRAN({-2, 0, 1}, 1, 2); auto ay = getRAN({-2, 0, 1}, 1, 2); auto q = (Poly(x)-y)*z; carl::LazardEvaluation<Rational,Poly> le(q); le.substitute(x, ax); le.substitute(y, ay); EXPECT_EQ(-Poly(z), le.getLiftingPoly()); }
void LogToFile :: StartLogging() { LogEntry le(LEV_EVENT, "FileLogger", LOCATION, "New Log Started", -1); Log(le); mpThread = new Thread(this); mpThread->Start(); mpLog->AddLogSubscriber(this); }
int main() { int x = __VERIFIER_nondet_int(); if(x < 0) return 0; int y = __VERIFIER_nondet_int(); if(y < 0) return 0; int z = __VERIFIER_nondet_int(); le(x,y); }
bool changeToDefense(const Table& table, const SoldierData& friendly) { for (Point p : arrayRange(table)) { const auto& soldier = table[p]; if (soldier && soldier->enemy) { if (le(soldier->soldier, friendly.soldier)) { return true; } } } return false; }
int main() { printf("Informe F para Finalizar a lista\n\n"); int n; le(); printf("\nDigite o numero sorteado: "); scanf("%d",&n); exclui(&lista,n); system("PAUSE"); return 0; }
int main(int argc,char **argv) { /* 1.建立QT应用 */ QApplication app(argc,argv); /* 使中文正常显示 */ QTextCodec *codec=QTextCodec::codecForName("gb2312"); QTextCodec::setCodecForTr(codec); /* 2.建立窗体 */ QWidget win; /* 3.调用窗体方法控制窗体 */ //窗体大小400*300 win.resize(400,300); //居中显示 win.move((1024-400)/2,(768-300)/2); //添加button 在窗体中 QPushButton btn("OK",&win); btn.resize(100,30); btn.move(100,100); // 添加QLineEdit对象 在窗体中 // 使中文正常显示 QLineEdit le(QObject::tr("你好"),&win); le.resize(50,50); le.move(20,20); MySlots myslo; /* 点击按钮弹出一个messagebox QObject::connect( &btn,//信号发送者 SIGNAL(clicked()),//发送的信号 &myslo,//信号发送的槽函数的对象 SLOT(handle())//槽函数 ); */ /* 点击按钮退出窗体 */ QObject::connect( &btn,//信号发送者 SIGNAL(clicked()),//发送的信号 &app,//信号发送的槽函数的对象 SLOT(quit())//槽函数 ); win.setVisible(true); /* 4.等待所有窗体子线程终止 */ return app.exec(); }
Linha::Linha(istream &is, ostream &os) { cout << "[Criando " << tipo() << "]\n"; cout << "Para que uma " << tipo() << " exista, precisamos:\n\n\t> Dois pontos\n\t"; cout << "> Um ponto e um vetor diretor\n\n"; cout << "Logo,\n\n"; while (!le(is)); cout << tipo() << " criada com sucesso.\n"; if (&os != &cout) escreve(os); }
int main (void) { gt (360.0); gt (-360.0); ge (360.0); ge (-360.0); lt (-360.0); lt (360.0); le (-360.0); le (360.0); eq (0.0); eq (360.0); ne (360.0); ne (0.0); return 0; }
void Pressure::bc_flag_txyz(const double t, const double* xp, std::vector<int> & bc_flag) const { const double bdry_toll = DEFAULT_BDRY_TOLL; Box* box = static_cast<Box*>(_qtymap.GetMeshTwo()->GetDomain()); std::vector<double> lb(_qtymap.GetMeshTwo()->get_dim()); std::vector<double> le(_qtymap.GetMeshTwo()->get_dim()); lb[0] = box->_lb[0]; //already nondimensionalized le[0] = box->_le[0]; lb[1] = box->_lb[1]; le[1] = box->_le[1]; if (_qtymap.GetMeshTwo()->get_dim() == 3) { lb[2] = box->_lb[2]; le[2] = box->_le[2]; } std::vector<double> x_rotshift(_qtymap.GetMeshTwo()->get_dim()); _qtymap.GetMeshTwo()->_domain->TransformPointToRef(xp,&x_rotshift[0]); if ( (x_rotshift[0]) > -bdry_toll && ( x_rotshift[0]) < bdry_toll ) {//left of the RefBox // bc_flag[0]=0; } if ( (le[0]-lb[0]) - (x_rotshift[0]) > -bdry_toll && (le[0]-lb[0]) -(x_rotshift[0]) < bdry_toll ){ //right of the RefBox // bc_flag[0]=0; } if (( x_rotshift[1]) > -bdry_toll && ( x_rotshift[1]) < bdry_toll) { //bottom of the RefBox // bc_flag[0]=0; } if ((le[1]-lb[1]) -(x_rotshift[1]) > -bdry_toll && (le[1]-lb[1]) -(x_rotshift[1]) < bdry_toll) { //top of the of the RefBox //outflow only on part of the outlet if ( (x_rotshift[0]) > 0.70*(le[0]-lb[0]) ) { bc_flag[0]=0; } //end part outflow else { // bc_flag[0]=0; } } //top RefBox return; }
void ConfigureLinuxNet(VPNum vp) { if (vp) return; static int net_init = 0; if (net_init) return; char buf[512]; char* ptr = &buf[0]; *ptr=0; StubKBootParms::_GetParameterValue("K42_IP_ADDRESS", ptr, 512); while (*ptr) ++ptr; *ptr = ':'; ++ptr; *ptr = 0; // server ip is blank *ptr = ':'; ++ptr; *ptr = 0; StubKBootParms::_GetParameterValue("K42_IP_ROUTER", ptr, 512); while (*ptr) ++ptr; *ptr = ':'; ++ptr; *ptr = 0; StubKBootParms::_GetParameterValue("K42_IP_NETMASK", ptr, 512); while (*ptr) ++ptr; *ptr = ':'; ++ptr; *ptr = 0; StubKBootParms::_GetParameterValue("K42_IP_HOSTNAME", ptr, 512); while (*ptr) ++ptr; *ptr = ':'; ++ptr; *ptr = 0; StubKBootParms::_GetParameterValue("K42_IP_INTERFACE", ptr, 512); while (*ptr) ++ptr; *ptr = 0; net_init = 1; LinuxEnv le(SysCall); sock_init(); INITCALL(netlink_proto_init); INITCALL(net_dev_init); INITCALL(net_olddevs_init); INITCALL(inet_init); INITCALL(ip_auto_config); ip_auto_config_setup(buf); }
Cubo::Cubo(istream &is, ostream &os) { cout << "[Criando " << tipo() << "]\n"; cout << "Para que um " << tipo() << " exista, precisamos:\n\n"; cout << "\t> Um ponto central para o cubo (\"centro\")\n"; cout << "\t> A distancia entre todas as extremidades (\"raio\")\n"; cout << "Logo,\n\n"; while (!le(is)); cout << tipo() << " criado com sucesso.\n"; if (&os != &cout) escreve(os); }
/*************** Programa Principal ***************/ int main(int argc, char **argv) { char **frases; int n;//Número de frases int i,j; //Contadores if (argv[1] == "-r") //Se -r for digitado como argumento, ordena inverso { printf("\nDigite o numero de elementos \n"); scanf("%d", &n); getchar(); frases = (char **) malloc (n*sizeof(char *)); printf("\nDigite uma frase por Linha - até 200 caracteres \n"); le(frases, n); OrdenaReverso(frases, n); } else { printf("\nDigite o numero de elementos \n"); scanf("%d", &n); getchar(); frases = (char **) malloc (n*sizeof(char *)); printf("\nDigite uma frase por linha - até 200 caracteres\n"); le(frases, n); Ordena(frases, n); } printf("\n Frases Ordenadas \n"); imprime(frases,n); /* Libera espaço alocado dinamicamente */ for (i=0; i<n; i++) { free(frases[i]); } free(frases); getchar(); return(0); }
void html_editor::insert_link() { link_editor le(this); if (le.exec() == QDialog::Accepted) { QString url = le.url(); QString text = le.text(); if (text.isEmpty()) text = url; url.replace("\"", "\\\""); // replace " by \" QString h = QString("<a href=\"%1\">%2</a>").arg(url).arg(text); insert_html(h); } }
std::vector<Constraint> * conditions( const ConstraintSystem & dt, const ConstraintSystem & df, const std::vector<LinearExpression_ppl> & rel, size_t st, size_t sf, size_t sg ) { std::vector<Constraint> * res = new std::vector<Constraint>(); ConstraintSystem::const_iterator itc_cs; for (itc_cs = dt.begin(); itc_cs != dt.end(); itc_cs++) { LinearExpression_ppl le(0); le += itc_cs->inhomogeneous_term(); for (int i = 0; (i < st) && (i < itc_cs->space_dimension()); i++) { le += itc_cs->coefficient(VariableID(i)) * rel[i]; } for (int i = 0; (i < sg) && (st + i < itc_cs->space_dimension()); i++) { le += itc_cs->coefficient(VariableID(st + i)) * VariableID(sf + i); } if (itc_cs->is_equality()) res->push_back(le == 0); else res->push_back(le >= 0); } Polyhedron p(sf + sg); for (itc_cs = df.begin(); itc_cs != df.end(); itc_cs++) p.refine_with_constraint(*itc_cs); std::vector<Constraint>::iterator it_cs = res->begin(); while (it_cs != res->end()) { if (it_cs->is_tautological()) { it_cs = res->erase(it_cs); break; } if (it_cs->is_inconsistent()) { delete res; return NULL; } Polyhedron p_(p); p_.refine_with_constraint(*it_cs); if (p_.contains(p)) it_cs = res->erase(it_cs); else it_cs++; } return res; }
static int insert_entry(int sev, char *buf, int bufsz) { struct log_entry *lent; pthread_attr_t attrs; lent = malloc(sizeof(*lent)); if (!lent) return -1; lent->sev = sev; lent->message = buf; lent->bufsz = bufsz; pthread_mutex_lock(&log_mutex); if (log_size >= MAX_QUEUE_LENGTH) { free(lent->message); free(lent); ++dropped; lent = (struct log_entry *)(le(_log_entries)->le_prev); lent->sev = LOG_WARNING; snprintf(lent->message, lent->bufsz, "%d message(s) lost due to syslog load\n", dropped + 1); /* Dropped +1 because we overwrote a message to * give the 'dropped' message */ } else { ++log_size; dropped = 0; list_insert(&_log_entries, lent); } if (!thread_id) { pthread_attr_init(&attrs); pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED); if (pthread_create(&thread_id, &attrs, _log_thread, NULL) < 0) thread_id = 0; pthread_mutex_unlock(&log_mutex); } else { pthread_mutex_unlock(&log_mutex); pthread_cond_signal(&log_cond); } return 0; }
int main() { char sil_ad[30]; char guncelle_ad[30]; system("color 4F"); int secim; do { secim=menu(); switch (secim) { case 1: kayıt_ekle(Rehber); break; case 2: printf("\nGuncellenicek ismi giriniz:"); scanf("%s",&guncelle_ad); kayıt_guncelle(Rehber,guncelle_ad); break; case 3: printf("Silinecek kisinin adini giriniz: "); scanf("%s",&sil_ad); kayıt_sil(Rehber,sil_ad); break; case 4: kayıt_görüntüle(Rehber); break; case 5: arama(Rehber); break; case 6 : system("CLS"); printf("Gule Gule..."); Sleep(2500); exit(1); default: system("cls"); printf("\n\n\t\tYanlis secim yaptiniz..."); Sleep(2500); main(); break; } } while (secim <= 6 && secim >= 1); return 0; }
void CMyLogger::write(const wchar_t* evt, int level, const char* fname, int line, int process /* = 0 */, int thread /* = 0 */) { int processId = process; if (0 == processId) { processId = GetCurrentProcessId(); } int threadId = thread; if (0 == threadId) { threadId = GetCurrentThreadId(); } InternalLoggingEvent le(_name, level, evt, fname, line, processId, threadId); if(_rfApp.get() != NULL) _rfApp->doAppend(le); if(_conApp.get() != NULL) _conApp->doAppend(le); }
void XMLAstVisitor::visit(Interval *node) { xml::Node interval("Interval", xml::Namespace::ct); xml::Node le("LeftEndpoint", xml::Namespace::ct); if (node->isLeftEndpointOpenClosed()) { le.setAttribute("type", "open"); } xml::Node re("RightEndpoint", xml::Namespace::ct); if (node->isRightEndpointOpenClosed()) { re.setAttribute("type", "open"); } interval.addChild(le); interval.addChild(re); xml::Node le_assign("Assign", xml::Namespace::ct); le.addChild(le_assign); xml::Node re_assign("Assign", xml::Namespace::ct); re.addChild(re_assign); le_assign.addChild(this->accept(node->getLeftEndpoint())); re_assign.addChild(this->accept(node->getRightEndpoint())); this->setValue(interval); }
void Module::paste_before ( void ) { Module *m = _copied_module_empty; m->chain( chain() ); Log_Entry le( _copied_module_settings ); m->set( le ); if ( ! chain()->insert( this, m ) ) { fl_alert( "Copied module cannot be inserted at this point in the chain" ); } free( _copied_module_settings ); _copied_module_settings = NULL; _copied_module_empty = NULL; /* set up for another copy */ m->copy(); }
void TempAdj::bc_flag_txyz(const double t, const double* xp, std::vector<int> & bc_flag) const { const double bdry_toll = DEFAULT_BDRY_TOLL; Box* box= static_cast<Box*>(_qtymap.GetMeshTwo()->GetDomain()); std::vector<double> lb(_qtymap.GetMeshTwo()->get_dim()); std::vector<double> le(_qtymap.GetMeshTwo()->get_dim()); lb[0] = box->_lb[0]; //already nondimensionalized le[0] = box->_le[0]; lb[1] = box->_lb[1]; le[1] = box->_le[1]; if (_qtymap.GetMeshTwo()->get_dim() == 3) { lb[2] = box->_lb[2]; le[2] = box->_le[2]; } std::vector<double> x_rotshift(_qtymap.GetMeshTwo()->get_dim()); _qtymap.GetMeshTwo()->_domain->TransformPointToRef(xp,&x_rotshift[0]); if ( (x_rotshift[0]) > -bdry_toll && ( x_rotshift[0]) < bdry_toll ) { //left of the RefBox bc_flag[0]=0; //always fixed } if ( (le[0]-lb[0]) - (x_rotshift[0]) > -bdry_toll && (le[0]-lb[0]) -(x_rotshift[0]) < bdry_toll) { //right of the RefBox bc_flag[0]=0; //always fixed } if (( x_rotshift[1]) > -bdry_toll && ( x_rotshift[1]) < bdry_toll) { //bottom of the RefBox bc_flag[0]=0; //always fixed } if ((le[1]-lb[1]) -(x_rotshift[1]) > -bdry_toll && (le[1]-lb[1]) -(x_rotshift[1]) < bdry_toll) { //top of the RefBox bc_flag[0]=0; //always fixed } return; }