ZZ ASTAdd::eval(Environment &env) { pair<VarInfo,VarInfo> p = getTypes(env); VarInfo leftInfo = p.first; VarInfo rightInfo = p.second; // only need to do modular operations if one of the // variables is a group element; otherwise just do things // over the integers bool isElmt = (leftInfo.type == VarInfo::ELEMENT || rightInfo.type == VarInfo::ELEMENT); // integers/exponents can just be added, but if there is an // exponent we want to retain the group information if (isElmt == 0){ return lhs->eval(env) + rhs->eval(env); } else { const Group* lGroup = env.groups.at(leftInfo.group); const Group* rGroup = env.groups.at(rightInfo.group); const Group* retGroup = (lGroup != 0 ? lGroup : rGroup); assert(retGroup); ZZ mod = retGroup->getModulus(); return AddMod(lhs->eval(env), rhs->eval(env), mod); } }
/// Parse Test string replacing keywords to fuzzed values void parseTestWithTypes(std::string& _test) { dev::test::RandomCodeOptions options; options.setWeight(dev::eth::Instruction::STOP, 10); //default 50 options.setWeight(dev::eth::Instruction::SSTORE, 70); options.setWeight(dev::eth::Instruction::CALL, 75); options.setWeight(dev::eth::Instruction::CALLCODE, 55); options.addAddress(dev::Address("0xffffffffffffffffffffffffffffffffffffffff")); options.addAddress(dev::Address("0x1000000000000000000000000000000000000000")); options.addAddress(dev::Address("0x095e7baea6a6c7c4c2dfeb977efac326af552d87")); options.addAddress(dev::Address("0x945304eb96065b2a98b57a48a06ae28d285a71b5")); options.addAddress(dev::Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b")); options.addAddress(dev::Address("0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6")); options.addAddress(dev::Address("0x0000000000000000000000000000000000000001")); options.addAddress(dev::Address("0x0000000000000000000000000000000000000002")); options.addAddress(dev::Address("0x0000000000000000000000000000000000000003")); options.addAddress(dev::Address("0x0000000000000000000000000000000000000004")); options.smartCodeProbability = 60; std::vector<std::string> types = getTypes(); for (unsigned i = 0; i < types.size(); i++) { std::size_t pos = _test.find(types.at(i)); while (pos != std::string::npos) { if (types.at(i) == "[RLP]") { std::string debug; int randomDepth = 1 + dev::test::RandomCode::randomUniInt() % 10; _test.replace(pos, 5, dev::test::RandomCode::rndRLPSequence(randomDepth, debug)); cnote << debug; } else if (types.at(i) == "[CODE]") _test.replace(pos, 6, "0x"+dev::test::RandomCode::generate(10, options)); else if (types.at(i) == "[HEX]") _test.replace(pos, 5, dev::test::RandomCode::randomUniIntHex()); else if (types.at(i) == "[HEX32]") _test.replace(pos, 7, dev::test::RandomCode::randomUniIntHex(std::numeric_limits<uint32_t>::max())); else if (types.at(i) == "[GASLIMIT]") _test.replace(pos, 10, dev::test::RandomCode::randomUniIntHex(dev::u256("3000000000"))); else if (types.at(i) == "[HASH20]") _test.replace(pos, 8, dev::test::RandomCode::rndByteSequence(20)); else if (types.at(i) == "[0xHASH32]") _test.replace(pos, 10, "0x" + dev::test::RandomCode::rndByteSequence(32)); else if (types.at(i) == "[HASH32]") _test.replace(pos, 8, dev::test::RandomCode::rndByteSequence(32)); else if (types.at(i) == "[V]") { int random = dev::test::RandomCode::randomUniInt() % 100; if (random < 30) _test.replace(pos, 3, "0x1c"); else if (random < 60) _test.replace(pos, 3, "0x1d"); else _test.replace(pos, 3, "0x" + dev::test::RandomCode::rndByteSequence(1)); } pos = _test.find(types.at(i)); } } }
HAlarm::HAlarm(QWidget *parent, QSqlDatabase pdb, HUser *puser) : QWidget(parent), ui(new Ui::HAlarm) { ui->setupUi(this); updateButtons(true,true,true,false,false); db=pdb; action="n"; user=puser; if (!db.isOpen()) { QMessageBox::warning(this,QApplication::applicationName(),"Attenzione: connessioe chiusa, riloggare",QMessageBox::Ok); } mod= new QSqlTableModel(0,db); mod->setTable("notifiche"); mod->setSort(1,Qt::DescendingOrder); mod->select(); usermod=new QSqlTableModel(0,db); usermod->setTable("utenti"); usermod->setFilter("attivo > 0"); usermod->setSort(4,Qt::AscendingOrder); usermod->select(); groupmod=new QSqlTableModel(0,db); groupmod->setTable("gruppi"); groupmod->setSort(1,Qt::AscendingOrder); groupmod->select(); getTypes(); ui->lvTarget->setModel(groupmod); ui->lvTarget->setModelColumn(1); ui->lvTarget->selectionModel()->setCurrentIndex(ui->lvTarget->model()->index(0,0),QItemSelectionModel::SelectCurrent); ui->tvMain->setModel(mod); ui->tvMain->setCurrentIndex(mod->index(0,0)); ui->tvMain->setColumnHidden(0,true); ui->tvMain->setColumnHidden(3,true); ui->tvMain->setColumnHidden(4,true); ui->tvMain->setColumnHidden(6,true); ui->tvMain->setColumnHidden(7,true); ui->tvMain->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); toggleUIInteractivity(false); QDataWidgetMapper *wmap=new QDataWidgetMapper(); wmap->setModel(mod); wmap->addMapping(ui->deData,1); wmap->addMapping(ui->cbTipo,2,"currentText"); wmap->addMapping(ui->ptDescrizione,5); wmap->addMapping(ui->cbAttiva,7); wmap->addMapping(ui->leCreator,8); wmap->toFirst(); ui->tvMain->setCurrentIndex(ui->tvMain->model()->index(-1,0)); connect(ui->tvMain->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),wmap,SLOT(setCurrentModelIndex(QModelIndex))); connect(ui->tvMain->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),this,SLOT(setUI())); connect(ui->tvMain->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),this,SLOT(filterTargets())); ui->tvMain->setCurrentIndex(ui->tvMain->model()->index(0,0)); // setUI(); // filterTargets(); }
int Assembly::getTypeCount() { utArray<Type *> types; getTypes(types); return (int)types.size(); }
llvm::Value *CodeGenFunction::CreateComplexVector(ComplexValueTy Value) { llvm::Value *Result = llvm::UndefValue::get( getTypes().GetComplexTypeAsVector(Value.Re->getType())); Result = Builder.CreateInsertElement(Result, Value.Re, Builder.getInt32(0), "re"); return Builder.CreateInsertElement(Result, Value.Im, Builder.getInt32(1), "im"); }
llvm::Value *CodeGenFunction::CreateComplexAggregate(ComplexValueTy Value) { llvm::Value *Result = llvm::UndefValue::get( getTypes().GetComplexType(Value.Re->getType())); Result = Builder.CreateInsertValue(Result, Value.Re, 0, "re"); return Builder.CreateInsertValue(Result, Value.Im, 1, "im"); }
CGeorgesNewDialog::CGeorgesNewDialog(QStringList& result, QWidget *parent) : QDialog(parent), _result(result), _descriptionTemplate(QString()) { _ui.setupUi(this); setWindowIcon(QIcon(":/images/georges_logo.png")); _ui.parentLineEdit->setEnabled(false); _ui.addParentButton->setEnabled(true); // wizard page connect(_ui.wizardBtn, SIGNAL(clicked(bool)), this, SLOT(wizardBtnClicked(bool))); connect(_ui.wizardList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(wizardItemActivated(QListWidgetItem *))); // form page connect(_ui.formBtn, SIGNAL(clicked(bool)), this, SLOT(formBtnClicked(bool))); connect(_ui.addParentButton, SIGNAL(clicked()), this, SLOT(addParentClicked())); connect(_ui.deleteParentButton, SIGNAL(clicked()), this, SLOT(deleteParentClicked())); connect(_ui.formList, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(formItemActivated(QListWidgetItem *))); connect(_ui.formList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(formItemActivated(QListWidgetItem *))); connect(_ui.parentLineEdit, SIGNAL(editingFinished()), this, SLOT(validateParentCombo())); // dfn page connect(_ui.dfnTypeBtn, SIGNAL(clicked(bool)), this, SLOT(dfnTypeClicked(bool))); connect(_ui.buttonBox, SIGNAL(accepted()), this, SLOT(buttonBoxAccepted())); connect(_ui.buttonBox, SIGNAL(rejected()), this, SLOT(buttonBoxRejected())); // wizard list QListWidgetItem *mpWiz = new QListWidgetItem(QIcon(":/images/mp_generic.png"),tr("Raw Material Generator")); _ui.wizardList->addItem(mpWiz); // form list QString path = Modules::mainWin().leveldesignPath(); QStringList typelist; //nlinfo ("Searching files in directory '%s'...", dir.c_str()); NLMISC::CPath::getPathContent(path.toUtf8().constData(),true,false,true,_files); getTypes( /* path.toUtf8() // incompatible parameter type */ ); //nlinfo ("%d supported file types :",FileTypeToId.size()); for ( std::map<std::string,uint8>::iterator it = FileTypeToId.begin(); it != FileTypeToId.end(); ++it ) { typelist.append(QString((*it).first.c_str())); //nlinfo("%s",(*it).first.c_str()); } _ui.formList->addItems(typelist); for(uint i = 0; i < _files.size(); i++) { std::string extStr = NLMISC::CFile::getExtension( _files[i] ); // filter files without existing dfn if (!NLMISC::CPath::exists(extStr + ".dfn") && !NLMISC::CPath::exists(extStr + ".typ")) { continue; } _filelist.append(QString(NLMISC::CFile::getFilename(_files[i]).c_str())); } _ui.parentFrame->hide(); // replace "Heading" and "Descriptive Text" with your string _descriptionTemplate = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"" "\"http://www.w3.org/TR/REC-html40/strict.dtd\">" "\n<html><head><meta name=\"qrichtext\" content=\"1\" />" "<style type=\"text/css\">\np, li { white-space: pre-wrap; }\n</style>" "</head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">" "\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">" "<span style=\" font-size:8pt; font-weight:600;\">Heading</span></p>" "\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">" "<span style=\" font-size:8pt;\">Descriptive Text</span></p></body></html>"; }
unsigned int plKeyCollector::countTypes(const plLocation& loc, bool checkKeys) { return getTypes(loc, checkKeys).size(); }
llvm::Value *CodeGenFunction::CreateCharacterAggregate(CharacterValueTy Value) { llvm::Value *Result = llvm::UndefValue::get( getTypes().GetCharacterType(Value.Ptr->getType())); Result = Builder.CreateInsertValue(Result, Value.Ptr, 0, "ptr"); return Builder.CreateInsertValue(Result, Value.Len, 1, "len"); }
TEST_F(SQLiteUtilTests, test_query_planner) { using TypeList = std::vector<ColumnType>; auto dbc = getTestDBC(); TableColumns columns; std::string query = "select path, path from file"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({TEXT_TYPE, TEXT_TYPE})); query = "select path, seconds from file, time"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({TEXT_TYPE, INTEGER_TYPE})); query = "select path || path from file"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({TEXT_TYPE})); query = "select seconds, path || path from file, time"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({INTEGER_TYPE, TEXT_TYPE})); query = "select seconds, seconds from time"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({INTEGER_TYPE, INTEGER_TYPE})); query = "select count(*) from time"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({BIGINT_TYPE})); query = "select count(*), count(seconds), seconds from time"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({BIGINT_TYPE, BIGINT_TYPE, INTEGER_TYPE})); query = "select 1, 'path', path from file"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({INTEGER_TYPE, TEXT_TYPE, TEXT_TYPE})); query = "select weekday, day, count(*), seconds from time"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({TEXT_TYPE, INTEGER_TYPE, BIGINT_TYPE, INTEGER_TYPE})); query = "select seconds + 1 from time"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({BIGINT_TYPE})); query = "select seconds * seconds from time"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({BIGINT_TYPE})); query = "select seconds > 1, seconds, count(seconds) from time"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({INTEGER_TYPE, INTEGER_TYPE, BIGINT_TYPE})); query = "select f1.*, seconds, f2.directory from (select path || path from file) " "f1, file as f2, time"; getQueryColumnsInternal(query, columns, dbc->db()); EXPECT_EQ(getTypes(columns), TypeList({TEXT_TYPE, INTEGER_TYPE, TEXT_TYPE})); }
void initFreebase() { getTypes(); getSubClassOf(); }
unsigned int getPrefix(Node signature) { typeMetadata t = getTypes(signature); return getPrefix(t.name, t.inTypes); }
Boolean UNIX_Cluster::getTypes(CIMProperty &p) const { p = CIMProperty(PROPERTY_TYPES, getTypes()); return true; }