void Foam::fvMeshTools::addPatchFields ( objectRegistry& obr, const dictionary& patchFieldDict, const word& defaultPatchFieldType, const typename GeoField::value_type& defaultPatchValue ) { HashTable<GeoField*> flds(obr.lookupClass<GeoField>()); const wordList fldNames(flds.sortedToc()); forAll(fldNames, i) { GeoField& fld = *flds[fldNames[i]]; typename GeoField::Boundary& bfld = fld.boundaryFieldRef(); label sz = bfld.size(); bfld.setSize(sz+1); if (patchFieldDict.found(fld.name())) { bfld.set ( sz, GeoField::Patch::New ( fld.mesh().boundary()[sz], fld(), patchFieldDict.subDict(fld.name()) ) ); } else { bfld.set ( sz, GeoField::Patch::New ( defaultPatchFieldType, fld.mesh().boundary()[sz], fld() ) ); bfld[sz] == defaultPatchValue; } }
void Foam::fvMeshTools::setPatchFields ( typename GeoField::Mesh& mesh, const label patchi, const dictionary& patchFieldDict ) { objectRegistry& obr = const_cast<objectRegistry&>(mesh.thisDb()); HashTable<GeoField*> flds(obr.lookupClass<GeoField>()); forAllIter(typename HashTable<GeoField*>, flds, iter) { GeoField& fld = *iter(); typename GeoField::Boundary& bfld = fld.boundaryFieldRef(); if (patchFieldDict.found(fld.name())) { bfld.set ( patchi, GeoField::Patch::New ( mesh.boundary()[patchi], fld(), patchFieldDict.subDict(fld.name()) ) ); } } }
void DrishtiImport::Old2New(QStringList flnms) { if (flnms.count() > 1) { FilesListDialog fld(flnms); fld.exec(); if (fld.result() == QDialog::Rejected) { QMessageBox::information(0, "Convert", "No conversion done"); return; } } QFileInfo f(flnms[0]); Global::setPreviousDirectory(f.absolutePath()); QString direc = QFileDialog::getExistingDirectory(0, "Save Converted file to", Global::previousDirectory(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks | QFileDialog::DontUseNativeDialog); for (uint i=0; i<flnms.count(); i++) Raw2Pvl::Old2New(flnms[i], direc); QMessageBox::information(0, "Conversion", "-----Done-----"); }
forAll(objects, i) { const word& object = objects[i]; IOobject header ( object, vMesh_.mesh().time().timeName(), "lagrangian"/cloudName_, vMesh_.mesh(), IOobject::MUST_READ, IOobject::NO_WRITE, false ); IOField<Type> fld(header); os_ << object << ' ' << pTraits<Type>::nComponents << ' ' << fld.size() << " float" << std::endl; DynamicList<floatScalar> fField(pTraits<Type>::nComponents*fld.size()); writeFuns::insert(fld, fField); writeFuns::write(os_, binary_, fField); }
void RemapWidget::handleTimeSeries() { QStringList flnms; flnms = QFileDialog::getOpenFileNames(0, "Load Raw Files", Global::previousDirectory(), "RAW Files (*.raw *.*)"); if (flnms.size() == 0) return; if (flnms.count() > 1) { FilesListDialog fld(flnms); fld.exec(); if (fld.result() == QDialog::Rejected) return; } QString mesg; mesg = "All operations on the first volume will be used\n"; mesg += "as a template for others in the timeseries.\n"; mesg += "Subsampling, smoothing, remaping applied to\n"; mesg += "the first volume will be applied to others."; QMessageBox::information(0, "Time series", mesg); QFileInfo f(flnms[0]); Global::setPreviousDirectory(f.absolutePath()); setFile(flnms, RAWVolume); m_timeseriesFiles = flnms; }
static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString &tableName, bool onlyPIndex = false) { QString schema; QString table(tableName); int indexOfSeparator = tableName.indexOf(QLatin1Char('.')); if (indexOfSeparator > -1) { schema = tableName.left(indexOfSeparator).append(QLatin1Char('.')); table = tableName.mid(indexOfSeparator + 1); } q.exec(QLatin1String("PRAGMA ") + schema + QLatin1String("table_info (") + _q_escapeIdentifier(table) + QLatin1String(")")); QSqlIndex ind; while (q.next()) { bool isPk = q.value(5).toInt(); if (onlyPIndex && !isPk) continue; QString typeName = q.value(2).toString().toLower(); QSqlField fld(q.value(1).toString(), qGetColumnType(typeName)); if (isPk && (typeName == QLatin1String("integer"))) // INTEGER PRIMARY KEY fields are auto-generated in sqlite // INT PRIMARY KEY is not the same as INTEGER PRIMARY KEY! fld.setAutoValue(true); fld.setRequired(q.value(3).toInt() != 0); fld.setDefaultValue(q.value(4)); ind.append(fld); } return ind; }
void SQLiteResultPrivate::initColumns(bool emptyResultset) { int nCols = sqlite3_column_count(stmt); if (nCols <= 0) return; q->init(nCols); for (int i = 0; i < nCols; ++i) { QString colName = stringFromUnicode(reinterpret_cast<const QChar *>( sqlite3_column_name16(stmt, i)) ).remove(QLatin1Char('"')); // must use typeName for resolving the type to match SQLiteDriver::record QString typeName = stringFromUnicode(reinterpret_cast<const QChar *>( sqlite3_column_decltype16(stmt, i))); int dotIdx = colName.lastIndexOf(QLatin1Char('.')); QSqlField fld(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), qGetColumnType(typeName)); // sqlite3_column_type is documented to have undefined behavior if the result set is empty int stp = emptyResultset ? -1 : sqlite3_column_type(stmt, i); fld.setSqlType(stp); rInf.append(fld); } }
static QSqlIndex qGetTableInfo(QSqlQuery &q, QString &tableName, bool onlyPIndex = false) { QString dbName; QString table(tableName); int indexOfSeparator = tableName.indexOf(QLatin1Char('.')); if (indexOfSeparator > -1) { dbName = tableName.left(indexOfSeparator +1 ); table = tableName.mid(indexOfSeparator + 1); } q.exec(QLatin1String("PRAGMA ") + dbName + QLatin1String("table_info (") + _q_escapeIdentifier(table) + QLatin1String(")")); const int NAME_IDX = 1; const int TYPE_IDX = 2; const int NOTNULL_IDX = 3; const int DFLT_VALUE_IDX = 4; const int PK_IDX = 5; QSqlIndex ind; while (q.next()) { bool isPk = q.value(PK_IDX).toInt(); if (onlyPIndex && !isPk) continue; QString typeName = q.value(TYPE_IDX).toString().toLower(); QSqlField fld(q.value(NAME_IDX).toString(), qGetColumnType(typeName)); if (isPk && (typeName == QLatin1String("integer"))) // INTEGER PRIMARY KEY fields are auto-generated in sqlite // INT PRIMARY KEY is not the same as INTEGER PRIMARY KEY! fld.setAutoValue(true); fld.setRequired(q.value(NOTNULL_IDX).toInt() != 0); fld.setDefaultValue(q.value(DFLT_VALUE_IDX)); ind.append(fld); } return ind; }
static DoubleFuncPtr gen_invoke_double_managed_func() { static DoubleFuncPtr func = NULL; if (func) { return func; } const int STUB_SIZE = 132; char * stub = (char *) malloc_fixed_code_for_jit(STUB_SIZE, DEFAULT_CODE_ALIGNMENT, CODE_BLOCK_HEAT_DEFAULT, CAA_Allocate); func = (DoubleFuncPtr) stub; stub = gen_invoke_common_managed_func(stub); // Put return value on FPU stack. M_Opnd memloc(esp_reg, -8); stub = sse_mov(stub, memloc, xmm0_opnd, true); stub = fld(stub, memloc, true); stub = ret(stub); assert(stub - (char *)func <= STUB_SIZE); compile_add_dynamic_generated_code_chunk("invoke_double_managed_func", false, (void*)func, stub - (char*)func); DUMP_STUB(func, "invoke_double_managed_func", stub - (char *)func); return func; }
static naRef dofld(naContext c, int argc, naRef* args, int sign) { naRef s = argc > 0 ? args[0] : naNil(); int bit = argc > 1 ? (int)naNumValue(args[1]).num : -1; int len = argc > 2 ? (int)naNumValue(args[2]).num : -1; unsigned int f; if(!naIsString(s) || !MUTABLE(args[0]) || bit < 0 || len < 0) naRuntimeError(c, "missing/bad argument to fld/sfld"); f = fld(c, (void*)naStr_data(s), naStr_len(s), bit, len); if(!sign) return naNum(f); if(f & (1 << (len-1))) f |= ~((1<<len)-1); // sign extend return naNum((signed int)f); }
void DrishtiImport::loadFiles(QStringList flnms, int pluginidx) { if (flnms.count() > 1) { FilesListDialog fld(flnms); fld.exec(); if (fld.result() == QDialog::Rejected) return; } QFileInfo f(flnms[0]); Global::setPreviousDirectory(f.absolutePath()); int idx = pluginidx; if (idx == -1) { QStringList ftypes; for(int i=0; i<m_pluginFileTypes.size(); i++) { ftypes << QString("%1 : %2"). \ arg(i+1).arg(m_pluginFileTypes[i]); } QString option = QInputDialog::getItem(0, "Select File Type", "File Type", ftypes, 0, false); idx = ftypes.indexOf(option); if (idx == -1) { QMessageBox::information(0, "Error", QString("No plugin found for %1").arg(option)); return; } } if (idx >= 0) m_remapWidget->setFile(flnms, m_pluginFileDLib[idx]); if (ui.action8_bit->isChecked()) m_remapWidget->setPvlMapMax(255); else m_remapWidget->setPvlMapMax(65535); }
void QSQLiteResultPrivate::initColumns(bool emptyResultset) { int nCols = sqlite3_column_count(stmt); if (nCols <= 0) return; q->init(nCols); for (int i = 0; i < nCols; ++i) { QString colName = QString(reinterpret_cast<const QChar *>( sqlite3_column_name16(stmt, i)) ).remove(QLatin1Char('"')); // must use typeName for resolving the type to match QSqliteDriver::record QString typeName = QString(reinterpret_cast<const QChar *>( sqlite3_column_decltype16(stmt, i))); // sqlite3_column_type is documented to have undefined behavior if the result set is empty int stp = emptyResultset ? -1 : sqlite3_column_type(stmt, i); QVariant::Type fieldType; if (!typeName.isEmpty()) { fieldType = qGetColumnType(typeName); } else { // Get the proper type for the field based on stp value switch (stp) { case SQLITE_INTEGER: fieldType = QVariant::Int; break; case SQLITE_FLOAT: fieldType = QVariant::Double; break; case SQLITE_BLOB: fieldType = QVariant::ByteArray; break; case SQLITE_TEXT: fieldType = QVariant::String; break; case SQLITE_NULL: default: fieldType = QVariant::Invalid; break; } } int dotIdx = colName.lastIndexOf(QLatin1Char('.')); QSqlField fld(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), fieldType); fld.setSqlType(stp); rInf.append(fld); } }
void complete() { #ifdef XBYAK32 sub(esp, 8); movsd(ptr [esp], xm0); fld(qword [esp]); add(esp, 8); #else #ifdef XBYAK64_WIN movaps(xm6, ptr [rsp + 8]); movaps(xm7, ptr [rsp + 8 + 16]); #endif #endif ret(); }
void http::skip_application::do_action(http::request_message& msg) { message_headers const& hdrs = msg.headers(); //! провер¤ем, что это не запрос от winamp-a http::buffer_t fld(&winamp_fld[0], sizeof(winamp_fld) - 1); http::vector_ptr val = hdrs.get(fld); skipped_ = val.get() != 0; //! провер¤ем, что запрос не есть тунелированное потоковое видиео //! Real Time Streaming Protocol (RTSP) RFC2326 if(!skipped_) { vector_ptr const& subtype = msg.media_subtype(); char *media_sub_type = _strlwr(&(*subtype)[0]); skipped_ = (_stricmp(media_sub_type, qtplayer_stream) == 0 || _stricmp(media_sub_type, vvtk_tunnel) == 0); } }
QSqlRecord DbSchema::sqlRecord(QObject *table, bool lowercase_field_names) { QSqlRecord ret; QQmlListReference fields(table, "fields", m_eventPlugin->qmlEngine()); for (int i = 0; i < fields.count(); ++i) { QObject *field = fields.at(i); QString name = field->property("name").toString(); if(lowercase_field_names) name = name.toLower(); QVariant typev = field->property("type"); QObject *type = typev.value<QObject*>(); QF_ASSERT(type != nullptr, "Internal error: Cannot get field type", return QSqlRecord()); QByteArray type_name = type->property("metaTypeName").toString().toLatin1(); QSqlField fld(name, QVariant::nameToType(type_name.constData())); ret.append(fld); //qfInfo() << type << "name:" << name << "type:" << type_name; } return ret; }
int MHL7Compare::compareComponents(const MString& segName, const MString& fldExist, const MString& fldNew) { MString fld(fldExist); char *Exist = fld.strData(); fld = fldNew; char *New = fld.strData(); // position pointers at the last element of the fields char *pExist = &Exist[fldExist.size()-1]; char *pNew = &New[fldNew.size()-1]; // move to the last non empty component for (; pExist != Exist; pExist--) if (*pExist != '^') break; for (; pNew != New; pNew--) if (*pNew != '^') break; while ((pExist > Exist) && (pNew > New)) { if (*pExist != *pNew) break; pExist--; pNew--; } if (*pExist != *pNew) { delete [] Exist; delete [] New; return 0; } delete [] Exist; delete [] New; return 1; }
void QSymSQLResultPrivate::initColumns(QSqlRecord& rec) { int nCols = stmt.ColumnCount(); if (nCols <= 0) { q->setLastError(qMakeError(access, QCoreApplication::translate("QSymSQLResult", "Error retrieving column count"), QSqlError::UnknownError, nCols)); return; } for (int i = 0; i < nCols; ++i) { TPtrC cName; TInt err = stmt.ColumnName(i, cName); if (err != KErrNone) { q->setLastError(qMakeError(access, QCoreApplication::translate("QSymSQLResult", "Error retrieving column name"), QSqlError::UnknownError, err)); return; } QString colName = qt_TDesC2QString(cName); // must use typeName for resolving the type to match QSymSQLDriver::record TPtrC tName; TSqlColumnType decColType; err = stmt.DeclaredColumnType(i, decColType); if (err != KErrNone) { q->setLastError(qMakeError(access, QCoreApplication::translate("QSymSQLResult", "Error retrieving column type"), QSqlError::UnknownError, err)); return; } int dotIdx = colName.lastIndexOf(QLatin1Char('.')); QSqlField fld(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), qGetColumnType(decColType)); rec.append(fld); } }
/* * The Meat of the class. * This function will populate the QTableWidget, mp_tablewidget, with * QTableWidgetItems representing the results of a query for what jobs exist on * the media name passed from the constructor stored in m_mediaName. */ void JobList::populateTable() { /* Can't do this in constructor because not neccesarily conected in constructor */ prepareFilterWidgets(); m_populated = true; Freeze frz(*mp_tableWidget); /* disable updating*/ /* Set up query */ QString query; fillQueryString(query); /* Set up the Header for the table */ QStringList headerlist = (QStringList() << tr("Job Id") << tr("Job Name") << tr("Client") << tr("Job Starttime") << tr("Job Type") << tr("Job Level") << tr("Job Files") << tr("Job Bytes") << tr("Job Status") << tr("Purged") << tr("File Set") << tr("Pool Name") << tr("First Volume") << tr("VolCount")); m_jobIdIndex = headerlist.indexOf(tr("Job Id")); m_purgedIndex = headerlist.indexOf(tr("Purged")); m_typeIndex = headerlist.indexOf(tr("Job Type")); m_statusIndex = headerlist.indexOf(tr("Job Status")); m_startIndex = headerlist.indexOf(tr("Job Starttime")); m_filesIndex = headerlist.indexOf(tr("Job Files")); m_bytesIndex = headerlist.indexOf(tr("Job Bytes")); m_levelIndex = headerlist.indexOf(tr("Job Level")); m_nameIndex = headerlist.indexOf(tr("Job Name")); m_filesetIndex = headerlist.indexOf(tr("File Set")); m_clientIndex = headerlist.indexOf(tr("Client")); /* Initialize the QTableWidget */ m_checkCurrentWidget = false; mp_tableWidget->clear(); m_checkCurrentWidget = true; mp_tableWidget->setColumnCount(headerlist.size()); mp_tableWidget->setHorizontalHeaderLabels(headerlist); mp_tableWidget->horizontalHeader()->setHighlightSections(false); mp_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); mp_tableWidget->setSortingEnabled(false); /* rows move on insert if sorting enabled */ if (mainWin->m_sqlDebug) { Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data()); } QStringList results; if (m_console->sql_cmd(query, results)) { m_resultCount = results.count(); QStringList fieldlist; mp_tableWidget->setRowCount(results.size()); int row = 0; /* Iterate through the record returned from the query */ QString resultline; foreach (resultline, results) { fieldlist = resultline.split("\t"); if (fieldlist.size() < 13) continue; /* some fields missing, ignore row */ TableItemFormatter jobitem(*mp_tableWidget, row); /* Iterate through fields in the record */ QStringListIterator fld(fieldlist); int col = 0; /* job id */ jobitem.setNumericFld(col++, fld.next()); /* job name */ jobitem.setTextFld(col++, fld.next()); /* client */ jobitem.setTextFld(col++, fld.next()); /* job starttime */ jobitem.setTextFld(col++, fld.next(), true); /* job type */ jobitem.setJobTypeFld(col++, fld.next()); /* job level */ jobitem.setJobLevelFld(col++, fld.next()); /* job files */ jobitem.setNumericFld(col++, fld.next()); /* job bytes */ jobitem.setBytesFld(col++, fld.next()); /* job status */ jobitem.setJobStatusFld(col++, fld.next()); /* purged */ jobitem.setBoolFld(col++, fld.next()); /* fileset */ jobitem.setTextFld(col++, fld.next()); /* pool name */ jobitem.setTextFld(col++, fld.next()); /* First Media */ jobitem.setTextFld(col++, fld.next()); /* Medias count */ jobitem.setNumericFld(col++, fld.next()); row++; }
void title_screen(void){ char j,k,choice; while(1){ stop = 1; players = team = demo = choice = tt = 0; init_msx(2); title_irq(); cursor_off(); memmove((char*)0xd800,(char*)(&bmp_data + LINES*40 + LINES*320),LINES*40); // memset((char*)0xcea8,0xff,40); fill(); revers(1); textcolor(1); cputsxy(12,18, "one player game"); textcolor(2); cputsxy(12,19, "two player team"); textcolor(7); cputsxy(11,20, "two player battle"); textcolor(2); cputsxy(15,21, "highscores"); // textcolor(1); cputsxy(18,22, "demo"); while (!demo){ do_bar(choice); j = *(char*)0xdc00; if (j == 111) break; if (j == 126){ if (choice){ for (k=0;k<8;++k){ do_bar(--choice); } } } else if (j == 125){ if (choice < 24){ for (k=0;k<8;++k){ do_bar(++choice); } } } } if (demo) break; choice>>=3; if (choice == 1){ team = 1; } else if (choice == 2){ players = 1; } else if (choice == 3){ game_irq(); show_highscores(); continue; } break; } fld(17); while (!fld_done); game_irq(); // gfx_mode(); fill(); *(char*)0xd016 = 0x10; delay (35); if (demo){ txt_mode(); print2x2_centered("demo mode",7,8,10); delay(255); } }
void LIR_Assembler::emit_op1(LIR_Op1* op) { switch (op->code()) { case lir_move: if (op->move_kind() == lir_move_volatile) { assert(op->patch_code() == lir_patch_none, "can't patch volatiles"); volatile_move_op(op->in_opr(), op->result_opr(), op->type(), op->info()); } else { move_op(op->in_opr(), op->result_opr(), op->type(), op->patch_code(), op->info(), op->pop_fpu_stack(), op->move_kind() == lir_move_unaligned, op->move_kind() == lir_move_wide); } break; case lir_roundfp: { LIR_OpRoundFP* round_op = op->as_OpRoundFP(); roundfp_op(round_op->in_opr(), round_op->tmp(), round_op->result_opr(), round_op->pop_fpu_stack()); break; } case lir_return: return_op(op->in_opr()); break; case lir_safepoint: if (compilation()->debug_info_recorder()->last_pc_offset() == code_offset()) { _masm->nop(); } safepoint_poll(op->in_opr(), op->info()); break; case lir_fxch: fxch(op->in_opr()->as_jint()); break; case lir_fld: fld(op->in_opr()->as_jint()); break; case lir_ffree: ffree(op->in_opr()->as_jint()); break; case lir_branch: break; case lir_push: push(op->in_opr()); break; case lir_pop: pop(op->in_opr()); break; case lir_neg: negate(op->in_opr(), op->result_opr()); break; case lir_leal: leal(op->in_opr(), op->result_opr()); break; case lir_null_check: if (GenerateCompilerNullChecks) { ImplicitNullCheckStub* stub = add_debug_info_for_null_check_here(op->info()); if (op->in_opr()->is_single_cpu()) { _masm->null_check(op->in_opr()->as_register(), stub->entry()); } else { Unimplemented(); } } break; case lir_monaddr: monitor_address(op->in_opr()->as_constant_ptr()->as_jint(), op->result_opr()); break; #ifdef SPARC case lir_pack64: pack64(op->in_opr(), op->result_opr()); break; case lir_unpack64: unpack64(op->in_opr(), op->result_opr()); break; #endif case lir_unwind: unwind_op(op->in_opr()); break; default: Unimplemented(); break; } }
bool QgsNewGeoPackageLayerDialog::apply() { QString fileName( mDatabase->filePath() ); if ( !fileName.endsWith( QLatin1String( ".gpkg" ), Qt::CaseInsensitive ) ) fileName += QLatin1String( ".gpkg" ); bool createNewDb = false; if ( QFile( fileName ).exists( fileName ) ) { bool overwrite = false; switch ( mBehavior ) { case Prompt: { QMessageBox msgBox; msgBox.setIcon( QMessageBox::Question ); msgBox.setWindowTitle( tr( "The File Already Exists." ) ); msgBox.setText( tr( "Do you want to overwrite the existing file with a new database or add a new layer to it?" ) ); QPushButton *overwriteButton = msgBox.addButton( tr( "Overwrite" ), QMessageBox::ActionRole ); QPushButton *addNewLayerButton = msgBox.addButton( tr( "Add new layer" ), QMessageBox::ActionRole ); msgBox.setStandardButtons( QMessageBox::Cancel ); msgBox.setDefaultButton( addNewLayerButton ); bool cancel = false; if ( property( "hideDialogs" ).toBool() ) { overwrite = property( "question_existing_db_answer_overwrite" ).toBool(); if ( !overwrite ) cancel = !property( "question_existing_db_answer_add_new_layer" ).toBool(); } else { int ret = msgBox.exec(); if ( ret == QMessageBox::Cancel ) cancel = true; if ( msgBox.clickedButton() == overwriteButton ) overwrite = true; } if ( cancel ) { return false; } break; } case Overwrite: overwrite = true; break; case AddNewLayer: overwrite = false; break; } if ( overwrite ) { QFile( fileName ).remove(); createNewDb = true; } } else { createNewDb = true; } OGRSFDriverH hGpkgDriver = OGRGetDriverByName( "GPKG" ); if ( !hGpkgDriver ) { if ( !property( "hideDialogs" ).toBool() ) QMessageBox::critical( this, tr( "Layer creation failed" ), tr( "GeoPackage driver not found" ) ); return false; } gdal::ogr_datasource_unique_ptr hDS; if ( createNewDb ) { hDS.reset( OGR_Dr_CreateDataSource( hGpkgDriver, fileName.toUtf8().constData(), nullptr ) ); if ( !hDS ) { QString msg( tr( "Creation of database failed (OGR error: %1)" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) ); if ( !property( "hideDialogs" ).toBool() ) QMessageBox::critical( this, tr( "Layer creation failed" ), msg ); return false; } } else { OGRSFDriverH hDriver = nullptr; hDS.reset( OGROpen( fileName.toUtf8().constData(), true, &hDriver ) ); if ( !hDS ) { QString msg( tr( "Opening of database failed (OGR error: %1)" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) ); if ( !property( "hideDialogs" ).toBool() ) QMessageBox::critical( this, tr( "Layer creation failed" ), msg ); return false; } if ( hDriver != hGpkgDriver ) { QString msg( tr( "Opening of file succeeded, but this is not a GeoPackage database" ) ); if ( !property( "hideDialogs" ).toBool() ) QMessageBox::critical( this, tr( "Layer creation failed" ), msg ); return false; } } QString tableName( mTableNameEdit->text() ); bool overwriteTable = false; if ( OGR_DS_GetLayerByName( hDS.get(), tableName.toUtf8().constData() ) ) { if ( property( "hideDialogs" ).toBool() ) { overwriteTable = property( "question_existing_layer_answer_overwrite" ).toBool(); } else if ( QMessageBox::question( this, tr( "Existing layer" ), tr( "A table with the same name already exists. Do you want to overwrite it?" ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) == QMessageBox::Yes ) { overwriteTable = true; } if ( !overwriteTable ) { return false; } } QString layerIdentifier( mLayerIdentifierEdit->text() ); QString layerDescription( mLayerDescriptionEdit->text() ); OGRwkbGeometryType wkbType = static_cast<OGRwkbGeometryType> ( mGeometryTypeBox->currentData( Qt::UserRole ).toInt() ); // z-coordinate & m-value. if ( mGeometryWithZCheckBox->isChecked() ) wkbType = OGR_GT_SetZ( wkbType ); if ( mGeometryWithMCheckBox->isChecked() ) wkbType = OGR_GT_SetM( wkbType ); OGRSpatialReferenceH hSRS = nullptr; // consider spatial reference system of the layer QgsCoordinateReferenceSystem srs = mCrsSelector->crs(); if ( wkbType != wkbNone && srs.isValid() ) { QString srsWkt = srs.toWkt(); hSRS = OSRNewSpatialReference( srsWkt.toLocal8Bit().data() ); } // Set options char **options = nullptr; if ( overwriteTable ) options = CSLSetNameValue( options, "OVERWRITE", "YES" ); if ( !layerIdentifier.isEmpty() ) options = CSLSetNameValue( options, "IDENTIFIER", layerIdentifier.toUtf8().constData() ); if ( !layerDescription.isEmpty() ) options = CSLSetNameValue( options, "DESCRIPTION", layerDescription.toUtf8().constData() ); QString featureId( mFeatureIdColumnEdit->text() ); if ( !featureId.isEmpty() ) options = CSLSetNameValue( options, "FID", featureId.toUtf8().constData() ); QString geometryColumn( mGeometryColumnEdit->text() ); if ( wkbType != wkbNone && !geometryColumn.isEmpty() ) options = CSLSetNameValue( options, "GEOMETRY_COLUMN", geometryColumn.toUtf8().constData() ); if ( wkbType != wkbNone ) options = CSLSetNameValue( options, "SPATIAL_INDEX", mCheckBoxCreateSpatialIndex->isChecked() ? "YES" : "NO" ); OGRLayerH hLayer = OGR_DS_CreateLayer( hDS.get(), tableName.toUtf8().constData(), hSRS, wkbType, options ); CSLDestroy( options ); if ( hSRS ) OSRRelease( hSRS ); if ( !hLayer ) { QString msg( tr( "Creation of layer failed (OGR error: %1)" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) ); if ( !property( "hideDialogs" ).toBool() ) QMessageBox::critical( this, tr( "Layer creation failed" ), msg ); return false; } QTreeWidgetItemIterator it( mAttributeView ); while ( *it ) { QString fieldName( ( *it )->text( 0 ) ); QString fieldType( ( *it )->text( 1 ) ); QString fieldWidth( ( *it )->text( 2 ) ); OGRFieldType ogrType( OFTString ); if ( fieldType == QLatin1String( "text" ) ) ogrType = OFTString; else if ( fieldType == QLatin1String( "integer" ) ) ogrType = OFTInteger; else if ( fieldType == QLatin1String( "integer64" ) ) ogrType = OFTInteger64; else if ( fieldType == QLatin1String( "real" ) ) ogrType = OFTReal; else if ( fieldType == QLatin1String( "date" ) ) ogrType = OFTDate; else if ( fieldType == QLatin1String( "datetime" ) ) ogrType = OFTDateTime; int ogrWidth = fieldWidth.toInt(); gdal::ogr_field_def_unique_ptr fld( OGR_Fld_Create( fieldName.toUtf8().constData(), ogrType ) ); OGR_Fld_SetWidth( fld.get(), ogrWidth ); if ( OGR_L_CreateField( hLayer, fld.get(), true ) != OGRERR_NONE ) { if ( !property( "hideDialogs" ).toBool() ) { QMessageBox::critical( this, tr( "Layer creation failed" ), tr( "Creation of field %1 failed (OGR error: %2)" ) .arg( fieldName, QString::fromUtf8( CPLGetLastErrorMsg() ) ) ); } return false; } ++it; } // In GDAL >= 2.0, the driver implements a deferred creation strategy, so // issue a command that will force table creation CPLErrorReset(); OGR_L_ResetReading( hLayer ); if ( CPLGetLastErrorType() != CE_None ) { QString msg( tr( "Creation of layer failed (OGR error: %1)" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) ); if ( !property( "hideDialogs" ).toBool() ) QMessageBox::critical( this, tr( "Layer creation failed" ), msg ); return false; } hDS.reset(); QString uri( QStringLiteral( "%1|layername=%2" ).arg( fileName, tableName ) ); QString userVisiblelayerName( layerIdentifier.isEmpty() ? tableName : layerIdentifier ); QgsVectorLayer *layer = new QgsVectorLayer( uri, userVisiblelayerName, QStringLiteral( "ogr" ) ); if ( layer->isValid() ) { // register this layer with the central layers registry QList<QgsMapLayer *> myList; myList << layer; //addMapLayers returns a list of all successfully added layers //so we compare that to our original list. if ( myList == QgsProject::instance()->addMapLayers( myList ) ) return true; } else { if ( !property( "hideDialogs" ).toBool() ) QMessageBox::critical( this, tr( "Invalid Layer" ), tr( "%1 is an invalid layer and cannot be loaded." ).arg( tableName ) ); delete layer; } return false; }
/* * Populate the text in the window */ void MediaInfo::populateForm() { utime_t t; time_t ttime; QString stat, LastWritten; struct tm tm; char buf[256]; QString query = "SELECT MediaId, VolumeName, Pool.Name, MediaType, FirstWritten," "LastWritten, VolMounts, VolBytes, Media.Enabled," "Location.Location, VolStatus, RecyclePool.Name, Media.Recycle, " "VolReadTime/1000000, VolWriteTime/1000000, Media.VolUseDuration, " "Media.MaxVolJobs, Media.MaxVolFiles, Media.MaxVolBytes, " "Media.VolRetention,InChanger,Slot " "FROM Media JOIN Pool USING (PoolId) LEFT JOIN Pool AS RecyclePool " "ON (Media.RecyclePoolId=RecyclePool.PoolId) " "LEFT JOIN Location ON (Media.LocationId=Location.LocationId) " "WHERE Media.VolumeName='" + m_mediaName + "'"; if (mainWin->m_sqlDebug) { Pmsg1(000, "MediaInfo query cmd : %s\n",query.toUtf8().data()); } QStringList results; if (m_console->sql_cmd(query, results)) { QString resultline; QStringList fieldlist; foreach (resultline, results) { // should have only one result fieldlist = resultline.split("\t"); QStringListIterator fld(fieldlist); m_mediaId = fld.next(); label_VolumeName->setText(fld.next()); label_Pool->setText(fld.next()); label_MediaType->setText(fld.next()); label_FirstWritten->setText(fld.next()); LastWritten = fld.next(); label_LastWritten->setText(LastWritten); // label_VolFiles->setText(fld.next()); label_VolMounts->setText(fld.next()); label_VolBytes->setText(convertBytesSI(fld.next().toULongLong())); label_Enabled->setPixmap(QPixmap(":/images/inflag" + fld.next() + ".png")); label_Location->setText(fld.next()); label_VolStatus->setText(fld.next()); label_RecyclePool->setText(fld.next()); chkbox_Recycle->setCheckState(fld.next().toInt()?Qt::Checked:Qt::Unchecked); edit_utime(fld.next().toULongLong(), buf, sizeof(buf)); label_VolReadTime->setText(QString(buf)); edit_utime(fld.next().toULongLong(), buf, sizeof(buf)); label_VolWriteTime->setText(QString(buf)); edit_utime(fld.next().toULongLong(), buf, sizeof(buf)); label_VolUseDuration->setText(QString(buf)); label_MaxVolJobs->setText(fld.next()); label_MaxVolFiles->setText(fld.next()); label_MaxVolBytes->setText(fld.next()); stat = fld.next(); edit_utime(stat.toULongLong(), buf, sizeof(buf)); label_VolRetention->setText(QString(buf)); if (LastWritten != "") { t = str_to_utime(LastWritten.toAscii().data()); t = t + stat.toULongLong(); ttime = t; localtime_r(&ttime, &tm); strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm); label_Expire->setText(QString(buf)); } label_Online->setPixmap(QPixmap(":/images/inflag"+fld.next()+".png")); // label_VolFiles->setText(fld.next()); // label_VolErrors->setText(fld.next()); // stat=fld.next(); // jobstatus_to_ascii_gui(stat[0].toAscii(), buf, sizeof(buf)); // stat = buf; // }
/* SQLite dbs have no user name, passwords, hosts or ports. just file names. */ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, const QString &, int, const QString &conOpts) { if (isOpen()) close(); if (db.isEmpty()) return false; bool sharedCache = false; int openMode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, timeOut=5000; QStringList opts=QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';')); foreach(const QString &option, opts) { if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) { bool ok; int nt = option.mid(21).toInt(&ok); if (ok) timeOut = nt; } if (option == QLatin1String("QSQLITE_OPEN_READONLY")) openMode = SQLITE_OPEN_READONLY; if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) sharedCache = true; } sqlite3_enable_shared_cache(sharedCache); #ifndef QT_WEBOS if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) { #else // QT_WEBOS #if SQLITE_VERSION_NUMBER >= 3005000 if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) { #else if (sqlite3_open(db.toUtf8().constData(), &d->access) == SQLITE_OK) { #endif #endif // QT_WEBOS sqlite3_busy_timeout(d->access, timeOut); setOpen(true); setOpenError(false); return true; } else { setLastError(qMakeError(d->access, tr("Error opening database"), QSqlError::ConnectionError)); setOpenError(true); return false; } } void QSQLiteDriver::close() { if (isOpen()) { foreach (QSQLiteResult *result, d->results) result->d->finalize(); if (sqlite3_close(d->access) != SQLITE_OK) setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError)); d->access = 0; setOpen(false); setOpenError(false); } } QSqlResult *QSQLiteDriver::createResult() const { return new QSQLiteResult(this); } bool QSQLiteDriver::beginTransaction() { if (!isOpen() || isOpenError()) return false; QSqlQuery q(createResult()); if (!q.exec(QLatin1String("BEGIN"))) { setLastError(QSqlError(tr("Unable to begin transaction"), q.lastError().databaseText(), QSqlError::TransactionError)); return false; } return true; } bool QSQLiteDriver::commitTransaction() { if (!isOpen() || isOpenError()) return false; QSqlQuery q(createResult()); if (!q.exec(QLatin1String("COMMIT"))) { setLastError(QSqlError(tr("Unable to commit transaction"), q.lastError().databaseText(), QSqlError::TransactionError)); return false; } return true; } bool QSQLiteDriver::rollbackTransaction() { if (!isOpen() || isOpenError()) return false; QSqlQuery q(createResult()); if (!q.exec(QLatin1String("ROLLBACK"))) { setLastError(QSqlError(tr("Unable to rollback transaction"), q.lastError().databaseText(), QSqlError::TransactionError)); return false; } return true; } QStringList QSQLiteDriver::tables(QSql::TableType type) const { QStringList res; if (!isOpen()) return res; QSqlQuery q(createResult()); q.setForwardOnly(true); QString sql = QLatin1String("SELECT name FROM sqlite_master WHERE %1 " "UNION ALL SELECT name FROM sqlite_temp_master WHERE %1"); if ((type & QSql::Tables) && (type & QSql::Views)) sql = sql.arg(QLatin1String("type='table' OR type='view'")); else if (type & QSql::Tables) sql = sql.arg(QLatin1String("type='table'")); else if (type & QSql::Views) sql = sql.arg(QLatin1String("type='view'")); else sql.clear(); if (!sql.isEmpty() && q.exec(sql)) { while(q.next()) res.append(q.value(0).toString()); } if (type & QSql::SystemTables) { // there are no internal tables beside this one: res.append(QLatin1String("sqlite_master")); } return res; } static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString &tableName, bool onlyPIndex = false) { QString schema; QString table(tableName); int indexOfSeparator = tableName.indexOf(QLatin1Char('.')); if (indexOfSeparator > -1) { schema = tableName.left(indexOfSeparator).append(QLatin1Char('.')); table = tableName.mid(indexOfSeparator + 1); } q.exec(QLatin1String("PRAGMA ") + schema + QLatin1String("table_info (") + _q_escapeIdentifier(table) + QLatin1String(")")); QSqlIndex ind; while (q.next()) { bool isPk = q.value(5).toInt(); if (onlyPIndex && !isPk) continue; QString typeName = q.value(2).toString().toLower(); QSqlField fld(q.value(1).toString(), qGetColumnType(typeName)); if (isPk && (typeName == QLatin1String("integer"))) // INTEGER PRIMARY KEY fields are auto-generated in sqlite // INT PRIMARY KEY is not the same as INTEGER PRIMARY KEY! fld.setAutoValue(true); fld.setRequired(q.value(3).toInt() != 0); fld.setDefaultValue(q.value(4)); ind.append(fld); } return ind; }
int encode_op(char *opcode, char *op_data) { int rd,rs,rt,imm,funct,shaft,target; char tmp[256]; const char *fi = "%s %d"; const char *fg = "%s %%g%d"; const char *ff = "%s %%f%d"; const char *fl = "%s %s"; const char *fgi = "%s %%g%d, %d"; const char *fgl = "%s %%g%d, %s"; const char *fgg = "%s %%g%d, %%g%d"; const char *fggl = "%s %%g%d, %%g%d, %s"; const char *fggi = "%s %%g%d, %%g%d, %d"; const char *fggg = "%s %%g%d, %%g%d, %%g%d"; const char *fff = "%s %%f%d, %%f%d"; const char *fgf = "%s %%g%d, %%f%d"; const char *ffg = "%s %%f%d, %%g%d"; const char *fffl = "%s %%f%d, %%f%d, %s"; const char *ffff = "%s %%f%d, %%f%d, %%f%d"; const char *ffgi = "%s %%f%d, %%g%d, %d"; const char *ffgg = "%s %%f%d, %%g%d, %%g%d"; char lname[256]; shaft = funct = target = 0; if(strcmp(opcode, "mvhi") == 0){ if(sscanf(op_data, fgi, tmp, &rs, &imm) == 3) return mvhi(rs,0,imm); } if(strcmp(opcode, "mvlo") == 0){ if(sscanf(op_data, fgi, tmp, &rs, &imm) == 3) return mvlo(rs,0,imm); } if(strcmp(opcode, "add") == 0){ if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4) return add(rs,rt,rd,0); } if(strcmp(opcode, "nor") == 0){ if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4) return nor(rs,rt,rd,0); } if(strcmp(opcode, "sub") == 0){ if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4) return sub(rs,rt,rd,0); } if(strcmp(opcode, "mul") == 0){ if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4) return mul(rs,rt,rd,0); } if(strcmp(opcode, "addi") == 0){ if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4) return addi(rs,rt,imm); } if(strcmp(opcode, "subi") == 0){ if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4) return subi(rs,rt,imm); } if(strcmp(opcode, "muli") == 0){ if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4) return muli(rs,rt,imm); } if(strcmp(opcode, "input") == 0){ if(sscanf(op_data, fg, tmp, &rd) == 2) return input(0,0,rd,0); } if(strcmp(opcode, "inputw") == 0){ if(sscanf(op_data, fg, tmp, &rd) == 2) return inputw(0,0,rd,0); } if(strcmp(opcode, "inputf") == 0){ if(sscanf(op_data, ff, tmp, &rd) == 2) return inputf(0,0,rd,0); } if(strcmp(opcode, "output") == 0){ if(sscanf(op_data, fg, tmp, &rs) == 2) return output(rs,0,0,0); } if(strcmp(opcode, "outputw") == 0){ if(sscanf(op_data, fg, tmp, &rs) == 2) return outputw(rs,0,0,0); } if(strcmp(opcode, "outputf") == 0){ if(sscanf(op_data, ff, tmp, &rs) == 2) return outputf(rs,0,0,0); } if(strcmp(opcode, "and") == 0){ if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4) return _and(rs,rt,rd,0); } if(strcmp(opcode, "or") == 0){ if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4) return _or(rs,rt,rd,0); } if(strcmp(opcode, "sll") == 0){ if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4) return sll(rs,rt,rd,0); } if(strcmp(opcode, "srl") == 0){ if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4) return srl(rs,rt,rd,0); } if(strcmp(opcode, "slli") == 0){ if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4) return slli(rs,rt,imm); } if(strcmp(opcode, "srli") == 0){ if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4) return srli(rs,rt,imm); } if(strcmp(opcode, "b") == 0){ if(sscanf(op_data, fg, tmp, &rs) == 2) return b(rs,0,0,0); } if(strcmp(opcode, "jmp") == 0){ if(sscanf(op_data, fl, tmp, lname) == 2) { strcpy(label_name[label_cnt],lname); return jmp(label_cnt++); } } if(strcmp(opcode, "jeq") == 0){ if(sscanf(op_data, fggl, tmp, &rs, &rt, lname) == 4) { strcpy(label_name[label_cnt],lname); return jeq(rs,rt,label_cnt++); } } if(strcmp(opcode, "jne") == 0){ if(sscanf(op_data, fggl, tmp, &rs, &rt, lname) == 4) { strcpy(label_name[label_cnt],lname); return jne(rs,rt,label_cnt++); } } if(strcmp(opcode, "jlt") == 0){ if(sscanf(op_data, fggl, tmp, &rs, &rt, lname) == 4) { strcpy(label_name[label_cnt],lname); return jlt(rs,rt,label_cnt++); } } if(strcmp(opcode, "jle") == 0){ if(sscanf(op_data, fggl, tmp, &rs, &rt, lname) == 4) { strcpy(label_name[label_cnt],lname); return jle(rs,rt,label_cnt++); } } if(strcmp(opcode, "call") == 0){ if(sscanf(op_data, fl, tmp, lname) == 2) { strcpy(label_name[label_cnt],lname); return call(label_cnt++); } } if(strcmp(opcode, "callR") == 0){ if(sscanf(op_data, fg, tmp, &rs) == 2) return callr(rs,0,0,0); } if(strcmp(opcode, "return") == 0){ return _return(0); } if(strcmp(opcode, "ld") == 0){ if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4) return ld(rs,rt,rd,0); } if(strcmp(opcode, "ldi") == 0){ if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4) return ldi(rs,rt,imm); } if(strcmp(opcode, "ldlr") == 0){ if(sscanf(op_data, fgi, tmp, &rs, &imm) == 3) return ldlr(rs,0,imm); } if(strcmp(opcode, "fld") == 0){ if(sscanf(op_data, ffgg, tmp, &rd, &rs,&rt) == 4) return fld(rs,rt,rd,0); } if(strcmp(opcode, "st") == 0){ if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4) return st(rs,rt,rd,0); } if(strcmp(opcode, "sti") == 0){ if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4) return sti(rs,rt,imm); } if(strcmp(opcode, "stlr") == 0){ if(sscanf(op_data, fgi, tmp, &rs, &imm) == 3) return stlr(rs,0,imm); } if(strcmp(opcode, "fst") == 0){ if(sscanf(op_data, ffgg, tmp, &rd, &rs,&rt) == 4) return fst(rs,rt,rd,0); } if(strcmp(opcode, "fadd") == 0){ if(sscanf(op_data, ffff, tmp, &rd, &rs, &rt) == 4) return fadd(rs,rt,rd,0); } if(strcmp(opcode, "fsub") == 0){ if(sscanf(op_data, ffff, tmp, &rd, &rs, &rt) == 4) return fsub(rs,rt,rd,0); } if(strcmp(opcode, "fmul") == 0){ if(sscanf(op_data, ffff, tmp, &rd, &rs, &rt) == 4) return fmul(rs,rt,rd,0); } if(strcmp(opcode, "fdiv") == 0){ if(sscanf(op_data, ffff, tmp, &rd, &rs, &rt) == 4) return fdiv(rs,rt,rd,0); } if(strcmp(opcode, "fsqrt") == 0){ if(sscanf(op_data, fff, tmp, &rd, &rs) == 3) return fsqrt(rs,0,rd,0); } if(strcmp(opcode, "fabs") == 0){ if(sscanf(op_data, fff, tmp, &rd, &rs) == 3) return _fabs(rs,0,rd,0); } if(strcmp(opcode, "fmov") == 0){ if(sscanf(op_data, fff, tmp, &rd, &rs) == 3) return fmov(rs,0,rd,0); } if(strcmp(opcode, "fneg") == 0){ if(sscanf(op_data, fff, tmp, &rd, &rs) == 3) return fneg(rs,0,rd,0); } if(strcmp(opcode, "fldi") == 0){ if(sscanf(op_data, ffgi, tmp, &rt, &rs, &imm) == 4) return fldi(rs,rt,imm); } if(strcmp(opcode, "fsti") == 0){ if(sscanf(op_data, ffgi, tmp, &rt, &rs, &imm) == 4) return fsti(rs,rt,imm); } if(strcmp(opcode, "fjeq") == 0){ if(sscanf(op_data, fffl, tmp, &rs, &rt, lname) == 4) { strcpy(label_name[label_cnt],lname); return fjeq(rs,rt,label_cnt++); } } if(strcmp(opcode, "fjlt") == 0){ if(sscanf(op_data, fffl, tmp, &rs, &rt, lname) == 4) { strcpy(label_name[label_cnt],lname); return fjlt(rs,rt,label_cnt++); } } if(strcmp(opcode, "halt") == 0){ return halt(0,0,0,0); } if(strcmp(opcode, "setL") == 0){ if(sscanf(op_data, fgl, tmp, &rd, lname) == 3) { strcpy(label_name[label_cnt],lname); return setl(0,rd,label_cnt++); } } if(strcmp(opcode, "padd") == 0){ if(sscanf(op_data, fgi, tmp, &rt, &imm) == 3) { return padd(0,rt,imm); } } if(strcmp(opcode, "link") == 0){ if(sscanf(op_data, fi, tmp, &imm) == 2) { return link(0,0,imm); } } if(strcmp(opcode, "movlr") == 0){ return movlr(0,0,0,0); } if(strcmp(opcode, "btmplr") == 0){ return btmplr(0,0,0,0); } /* if(strcmp(opcode, "padd") == 0){ if(sscanf(op_data, fgg, tmp, &rd, &rt) == 3) { return padd(0,rt,d,0); } } */ return -1; }