void dataPage::initialize_page(pageid_t pageid) { //load the first page Page *p; #ifdef CHECK_FOR_SCRIBBLING p = alloc_ ? alloc->load_page(xid_, pageid) : loadPage(xid_, pageid); if(*stasis_page_type_ptr(p) == DATA_PAGE) { printf("Collision on page %lld\n", (long long)pageid); fflush(stdout); assert(*stasis_page_type_ptr(p) != DATA_PAGE); } #else p = loadUninitializedPage(xid_, pageid); #endif DEBUG("\t\t\t\t\t\t->%lld\n", pageid); //initialize header p->pageType = DATA_PAGE; //clear page (arranges for null-padding) XXX null pad more carefully and use sentinel value instead? memset(p->memAddr, 0, PAGE_SIZE); //we're the last page for now. *is_another_page_ptr(p) = 0; //write 0 to first data size *length_at_offset_ptr(p, calc_chunk_from_offset(write_offset_).slot) = 0; //set the page dirty stasis_page_lsn_write(xid_, p, alloc_->get_lsn(xid_)); releasePage(p); }
void MetadataItemPropertiesPanel::OnIdle(wxIdleEvent& WXUNUSED(event)) { Disconnect(wxID_ANY, wxEVT_IDLE); wxBusyCursor bc; loadPage(); htmlReloadRequestedM = false; }
size_t dataPage::write_bytes(const byte * buf, ssize_t remaining, Page ** latch_p) { if(latch_p) { *latch_p = NULL; } recordid chunk = calc_chunk_from_offset(write_offset_); if(chunk.size > remaining) { chunk.size = remaining; } if(chunk.page >= first_page_ + page_count_) { chunk.size = 0; // no space (should not happen) } else { Page *p = alloc_ ? alloc_->load_page(xid_, chunk.page) : loadPage(xid_, chunk.page); assert(chunk.size); memcpy(data_at_offset_ptr(p, chunk.slot), buf, chunk.size); stasis_page_lsn_write(xid_, p, alloc_->get_lsn(xid_)); if(latch_p && !*latch_p) { writelock(p->rwlatch,0); *latch_p = p; } else { releasePage(p); } write_offset_ += chunk.size; } return chunk.size; }
static void _hStickCentering() { if (KEYINIT) { if ((RX_good & 0x0F) != 0x0F) { lcdWriteString_P(scrRadioCal1); elementIndex = 1; writeSoftkeys(_skBACK); } else lcdWriteString_P(scrRadioCal0); } if (elementIndex == 0) { if (KEY4) { lcdClear(); if (rxCalibrate()) { configSave(); lcdSetPos(3, 0); lcdWriteString_P(strCalSucc); } else lcdWriteString_P(scrRadioCal2); writeSoftkeys(NULL); elementIndex = 1; } } else if (KEY4) loadPage(PAGE_MENU); }
void ProgDetails::updatePage(void) { if (m_page[m_currentPage].isEmpty()) loadPage(); m_browser->SetHtml(m_page[m_currentPage]); }
int main(int argc, char * argv[]) { if(argc != 3) { printf(usage, argv[0]); abort(); } char * endptr; numthreads = strtoul(argv[1], &endptr, 10); if(*endptr != 0) { printf(usage, argv[0]); abort(); } numops= strtoul(argv[2], &endptr, 10) / numthreads; if(*endptr != 0) { printf(usage, argv[0]); abort(); } pthread_t workers[numthreads]; Page * p; Tinit(); dpt = stasis_runtime_dirty_page_table(); p = loadPage(-1,0); for(int i = 0; i < numthreads; i++) { pthread_create(&workers[i], 0, worker, p); } for(int i = 0; i < numthreads; i++) { pthread_join(workers[i], 0); } releasePage(p); Tdeinit(); }
void ProgDetails::updatePage(void) { if (m_data.isEmpty()) loadPage(); m_infoList.Display(m_data); }
static void stasis_alloc_register_old_regions(stasis_alloc_t* alloc) { pageid_t boundary = REGION_FIRST_TAG; boundary_tag t; DEBUG("registering old regions\n"); int succ = TregionReadBoundaryTag(-1, boundary, &t); if(succ) { do { DEBUG("boundary tag %lld type %d\n", boundary, t.allocation_manager); if(t.allocation_manager == STORAGE_MANAGER_TALLOC) { for(pageid_t i = 0; i < t.size; i++) { Page * p = loadPage(-1, boundary + i); readlock(p->rwlatch,0); if(p->pageType == SLOTTED_PAGE) { stasis_allocation_policy_register_new_page(alloc->allocPolicy, p->id, stasis_record_freespace(-1, p)); DEBUG("registered page %lld\n", boundary+i); } else { abort(); } unlock(p->rwlatch); releasePage(p); } } } while(TregionNextBoundaryTag(-1, &boundary, &t, 0)); //STORAGE_MANAGER_TALLOC)) { } }
void HistoryDlg::actionDeleteEvent(QTreeWidgetItem *item) { HistoryDB *h = HistoryDB::instance(); QString sTime; h->deleteEvents(jid_,lookDate,QTime::fromString(item->text(1))); loadPage(lookDate,findText); }
static void _hSensorCalibration() { if (elementIndex == 0) { if (KEY4) { elementIndex = 1; lcdClear(); lcdSetPos(3, 18); lcdWriteString_P(strWait); lcdSetPos(3, 78); lcdWriteString_P(strSec); writeSoftkeys(_skCANCEL); _tStart = millis(); } } else if (elementIndex == 1) { lcdSetPos(3, 66); uint8_t sec = (millis() - _tStart) / 1000; lcdWriteChar((5-sec) + 48); if (sec >= 5) { sensorsCalibrate(); configSave(); lcdSetPos(3, 0); lcdWriteString_P(strCalSucc); writeSoftkeys(NULL); elementIndex = 2; } } else if (KEY4) loadPage(PAGE_MENU); }
std::list<Index*> IndexPage::find(BufferManager* manager, FilterParser* parser) { if (!isLoaded()) { loadPage(manager); } std::list<Index*> result; for (int x = 0; x < size; x++) { BSONObj* key = elements[x]->key; if (key->getString("_id").compare("c597-43e1-ae9b-6f5451b28295") == 0) { cout << "Hey!" << endl; } bool match = false; ExpressionResult* expresult = parser->eval(*key); if (expresult->type() == ExpressionResult::RT_BOOLEAN) { match = *expresult; } delete expresult; if (match) { result.push_back(elements[x]); } } for (int x = 0; x <= size; x++) { IndexPage* innerPage = pointers[x]; if (innerPage != NULL) { std::list<Index*> inner = innerPage->find(manager, parser); result.insert(result.begin(), inner.begin(), inner.end()); } } return result; }
void MainWindow::goToNextStep() { switch (m_currentAction) { case MainWindow::Welcome: m_currentAction = MainWindow::ReleaseNotes; setInstallationStep(MainWindow::Welcome, MainWindow::Done); break; case MainWindow::ReleaseNotes: m_currentAction = MainWindow::LicenseApproval; setInstallationStep(MainWindow::ReleaseNotes, MainWindow::Done); break; case MainWindow::LicenseApproval: m_currentAction = MainWindow::Language; setInstallationStep(MainWindow::LicenseApproval, MainWindow::Done); break; case MainWindow::Language: m_currentAction = MainWindow::CreateUser; setInstallationStep(MainWindow::Language, MainWindow::Done); break; case MainWindow::CreateUser: m_currentAction = MainWindow::Partition; setInstallationStep(MainWindow::CreateUser, MainWindow::Done); break; case MainWindow::Partition: m_currentAction = MainWindow::ReadyToInstall; setInstallationStep(MainWindow::Partition, MainWindow::Done); break; case MainWindow::ReadyToInstall: m_currentAction = MainWindow::InstallSystem; setInstallationStep(MainWindow::ReadyToInstall, MainWindow::Done); break; case MainWindow::InstallSystem: m_currentAction = MainWindow::Configuration; setInstallationStep(MainWindow::InstallSystem, MainWindow::Done); break; case MainWindow::Configuration: m_currentAction = MainWindow::FinishStep; setInstallationStep(MainWindow::Configuration, MainWindow::Done); break; case MainWindow::FinishStep: m_currentAction = MainWindow::FinishStep; setInstallationStep(MainWindow::FinishStep, MainWindow::Done); break; default: break; } loadPage(m_currentAction); }
void BrowserWindow::handleFileOpenTriggered() { QString file = QFileDialog::getOpenFileName(this, tr("Open Web Resource"), QString(), tr("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)")); if (file.isEmpty()) return; loadPage(file); }
//--------------------------------------------------------------------- Page* PagedWorldSection::loadOrCreatePage(const Vector3& worldPos) { PageID id = getPageID(worldPos); // this will create a Page instance no matter what, even if load fails // we force the load attempt to happen immediately (forceSynchronous) loadPage(id, true); return getPage(id); }
AsyncValue<Handler> Host::routeDynamicRequest(String path) { auto lp=loadPage(path); if(lp) { return Handler(&dynamicHandler,lp()); } requestRouterState* st=new requestRouterState(); lp.wait(st); return Future<Handler>(&st->cb); }
int BrowserMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: loadPage((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 1: slotHome(); break; case 2: save(); break; case 3: slotLoadProgress((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: slotUpdateStatusbar((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 5: slotUpdateWindowTitle((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 6: slotUpdateWindowTitle(); break; case 7: loadUrl((*reinterpret_cast< const QUrl(*)>(_a[1]))); break; case 8: slotPreferences(); break; case 9: slotFileNew(); break; case 10: slotFileOpen(); break; case 11: slotFilePrintPreview(); break; case 12: slotFilePrint(); break; case 13: slotPrivateBrowsing(); break; case 14: slotFileSaveAs(); break; case 15: slotEditFind(); break; case 16: slotEditFindNext(); break; case 17: slotEditFindPrevious(); break; case 18: slotShowBookmarksDialog(); break; case 19: slotAddBookmark(); break; case 20: slotViewZoomIn(); break; case 21: slotViewZoomOut(); break; case 22: slotViewResetZoom(); break; case 23: slotViewZoomTextOnly((*reinterpret_cast< bool(*)>(_a[1]))); break; case 24: slotViewToolbar(); break; case 25: slotViewBookmarksBar(); break; case 26: slotViewStatusbar(); break; case 27: slotViewPageSource(); break; case 28: slotViewFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break; case 29: slotWebSearch(); break; case 30: slotToggleInspector((*reinterpret_cast< bool(*)>(_a[1]))); break; case 31: slotAboutApplication(); break; case 32: slotDownloadManager(); break; case 33: slotSelectLineEdit(); break; case 34: slotAboutToShowBackMenu(); break; case 35: slotAboutToShowForwardMenu(); break; case 36: slotAboutToShowWindowMenu(); break; case 37: slotOpenActionUrl((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 38: slotShowWindow(); break; case 39: slotSwapFocus(); break; case 40: printRequested((*reinterpret_cast< QWebFrame*(*)>(_a[1]))); break; case 41: geometryChangeRequested((*reinterpret_cast< const QRect(*)>(_a[1]))); break; case 42: updateToolbarActionText((*reinterpret_cast< bool(*)>(_a[1]))); break; case 43: updateBookmarksToolbarActionText((*reinterpret_cast< bool(*)>(_a[1]))); break; default: ; } _id -= 44; } return _id; }
void UrlBar::handleKeyReleaseEvent(const XKeyReleasedEvent& event) { char normalKey; KeySym specialKey; XLookupString(const_cast<XKeyEvent*>(&event), &normalKey, sizeof(char), &specialKey, 0); switch (specialKey) { case XK_BackSpace: removeCharacter(); break; case XK_Delete: deleteCharacter(); break; case XK_Home: m_cursorPosition = 0; break; case XK_End: m_cursorPosition = m_url.length(); break; case XK_Left: if (m_cursorPosition) m_cursorPosition--; break; case XK_Right: if (m_cursorPosition < m_url.length()) m_cursorPosition++; break; case XK_Return: loadPage(); break; case XK_Insert: if (event.state & ControlMask) becomeClipboardOwner(); else if (event.state & ShiftMask) requestClipboardText(); break; default: if (event.state & ControlMask) { // while the Control key is pressed, character codes start from 1 (A=1, B=2, ...). switch (normalKey + 'A' - 1) { case 'C': becomeClipboardOwner(); break; case 'V': requestClipboardText(); break; } } else appendCharacter(normalKey); break; } drawUrlBar(); }
void FastQSPWindow::openFile(const QString &filename) { qspFilePath = filename; builder.clear(); if (gameIsOpen) autosave(); gameDirectory = QFileInfo(filename).absolutePath() + "/"; if (!QSPLoadGameWorld(filename.toStdWString().c_str(), &gameDirectory)) qCritical() << QString("Could not open file: ") << filename; if (QSPRestartGame(QSP_TRUE)) { gameMenu->setEnabled(true); builder.setGameDir(gameDirectory); netManager.setGameDirectory(gameDirectory); loadFonts(); QFile configFile(gameDirectory + QLatin1String("config.xml")); if (configFile.open(QFile::ReadOnly)) { QTextStream stream(&configFile); QString config = stream.readLine(); configFile.close(); QRegExp re; re.setMinimal(true); re.setPattern("width=\"(\\d+)\""); if (re.indexIn(config)) gameWidth = re.cap(1).toInt(); else gameWidth = 800; re.setPattern("height=\"(\\d+)\""); if (re.indexIn(config) > 0) gameHeight = re.cap(1).toInt(); else gameHeight = 600; aspectRatio = qreal(gameWidth) / qreal(gameHeight); re.setPattern("title=\"(.+)\""); if (re.indexIn(config) >= 0) setWindowTitle(re.cap(1)); else setWindowTitle("FastQSP"); re.setPattern("icon=\"(.+)\""); if (re.indexIn(config) >= 0) QApplication::setWindowIcon(QIcon(gameDirectory + re.cap(1))); } aspectRatio = qreal(gameWidth) / qreal(gameHeight); loadPage(); webView->resize(gameWidth, gameHeight); resize(gameWidth, gameHeight); gameIsOpen = true; saveDir = gameDirectory + "save/"; if (!saveDir.exists()) { saveDir.mkpath("."); } timer.restart(); } }
int TrecordType(int xid, recordid rid) { Page * p; p = loadPage(xid, rid.page); readlock(p->rwlatch,0); int ret; ret = stasis_record_type_read(xid, p, rid); unlock(p->rwlatch); releasePage(p); return ret; }
void FastQSPWindow::startQuickloading() { builder.clear(); QString filename = gameDirectory + "save/quicksave.sav"; QSPOpenSavedGame(filename.toStdWString().c_str(), true, ignoreCRCAction->isChecked()); // New save system // qspJack.loadGameStatus(gameDirectory + "save/quicksave.json"); loadPage(); savestatus->setVisible(false); }
char *HelpFindPrev( HelpSrchInfo *info ) { PageIndexEntry *entry; char *ret; if( info->page == 0 && info->entry == 0 ) return( NULL ); if( info->entry == 0 ) { info->page--; loadPage( info->hdl, info->page ); info->entry = pageHeader->num_entries - 1; } else { info->entry--; loadPage( info->hdl, info->page ); } entry = pageIndex; info->offset = entry[ info->entry ].entry_offset; ret = stringBlock + entry[ info->entry ].name_offset; return( ret ); }
BrowserWindow::BrowserWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags) , m_tabWidget(new TabWidget(this)) , m_progressBar(new QProgressBar(this)) , m_historyBackAction(nullptr) , m_historyForwardAction(nullptr) , m_stopAction(nullptr) , m_reloadAction(nullptr) , m_stopReloadAction(nullptr) , m_urlLineEdit(new UrlLineEdit(this)) { setToolButtonStyle(Qt::ToolButtonFollowStyle); setAttribute(Qt::WA_DeleteOnClose, true); QToolBar *toolbar = createToolBar(); addToolBar(toolbar); menuBar()->addMenu(createFileMenu(m_tabWidget)); menuBar()->addMenu(createViewMenu(toolbar)); menuBar()->addMenu(createWindowMenu(m_tabWidget)); menuBar()->addMenu(createHelpMenu()); QWidget *centralWidget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout; layout->setSpacing(0); layout->setMargin(0); addToolBarBreak(); m_progressBar->setMaximumHeight(1); m_progressBar->setTextVisible(false); m_progressBar->setStyleSheet(QStringLiteral("QProgressBar {border: 0px } QProgressBar::chunk { background-color: red; }")); layout->addWidget(m_progressBar); layout->addWidget(m_tabWidget); centralWidget->setLayout(layout); setCentralWidget(centralWidget); connect(m_tabWidget, &TabWidget::titleChanged, this, &BrowserWindow::handleWebViewTitleChanged); connect(m_tabWidget, &TabWidget::linkHovered, [this](const QString& url) { statusBar()->showMessage(url); }); connect(m_tabWidget, &TabWidget::loadProgress, this, &BrowserWindow::handleWebViewLoadProgress); connect(m_tabWidget, &TabWidget::urlChanged, this, &BrowserWindow::handleWebViewUrlChanged); connect(m_tabWidget, &TabWidget::iconChanged, this, &BrowserWindow::handleWebViewIconChanged); connect(m_tabWidget, &TabWidget::webActionEnabledChanged, this, &BrowserWindow::handleWebActionEnabledChanged); connect(m_urlLineEdit, &QLineEdit::returnPressed, this, [this]() { m_urlLineEdit->setFavIcon(QIcon(QStringLiteral(":defaulticon.png"))); loadPage(m_urlLineEdit->url()); }); m_urlLineEdit->setFavIcon(QIcon(QStringLiteral(":defaulticon.png"))); handleWebViewTitleChanged(tr("Qt Simple Browser")); m_tabWidget->createTab(); }
SillyThread::SillyThread(Poppler::Document* document, QObject* parent) : QThread(parent), m_document(document), m_pages() { m_pages.reserve(m_document->numPages()); for(int index = 0; index < m_document->numPages(); ++index) { m_pages.append(loadPage(m_document, index)); } }
void CHelpWidget::tryToLoadPage(QTreeWidgetItem *item, int) { if ( item ) { QString fileName = m_files[item]; if ( ! fileName.isNull() ) { loadPage(item->text(0), m_helpPath.path()+"/"+ fileName); } } }
void FastQSPWindow::loadGame(const QString &filename) { // qDebug() << "Loading game from" << filename; builder.clear(); // New save/load system // qspJack->loadGameStatus(filename); // loadPage(); if (!filename.isEmpty() && QSPOpenSavedGame(filename.toStdWString().c_str(), true, ignoreCRCAction->isChecked())) { loadPage(); } }
void Book::loadDirectory( string _folder ){ ofDirectory dir; int nFiles = dir.listDir(_folder); if(nFiles) { for(int i=0; i<dir.numFiles(); i++) { loadPage( _folder + "/" + dir.getFile(i).getFileName() ); } } else { ofLog(OF_LOG_ERROR, "Could not find folder " + _folder); } }
void menuLoop() { if (keys == 0) keys = keyboardRead(); if (KEY1 && !editMode) // BACK { if (menuPage > PAGE_MENU) loadPage(PAGE_MENU); else if (menuPage == PAGE_MENU) { configSave(); loadPage(PAGE_START); } } if (KEYMENU) keys = KEY_INIT; defaultHandler(); keys &= KEY_MENU; }
char *HelpFindNext( HelpSrchInfo *info ) { char *ret; PageIndexEntry *entry; unsigned pagecnt; pagecnt = info->hdl->header.datapagecnt + info->hdl->header.indexpagecnt; if( info->page == pagecnt ) return( NULL ); loadPage( info->hdl, info->page ); info->entry++; if( info->entry == pageHeader->num_entries ) { info->page++; if( info->page == pagecnt ) return( NULL ); loadPage( info->hdl, info->page ); info->entry = 0; } entry = pageIndex; info->offset = entry[ info->entry ].entry_offset; ret = stringBlock + entry[ info->entry ].name_offset; return( ret ); }
int insertKey(int offset, long long key, int* child_left_promoted, int* child_right_promoted, long long* key_promoted) { page_tree *curr_page; // pagina atual para busca page_tree *new_page; // pagina para split int pos = -1; // posicao em que a chave deveria ser inserida // trata o caso de arvore vazia if (offset == NIL) { *key_promoted = key; *child_right_promoted = NIL; *child_left_promoted = NIL; return PROMOTED; } curr_page = loadPage(offset); // carrega a pagina para inspecao if (pageSearch(curr_page, key, &pos) == SUCCESS) { fprintf(stderr, "Chave ja existe na arvore\n\n"); return ERROR; } int return_value = -1; int right_offset_child_promoted = -1; int left_offset_child_promoted = -1; long long key_promotion = -1; return_value = insertKey(curr_page->child[pos], key, &left_offset_child_promoted, &right_offset_child_promoted, &key_promotion); // verifica se nao eh necessaria mais nenhuma operacao na arvore // ou seja, a chave foi inserida mas nao ha promocao // ou entao a chave ja existia e foi retornado um erro if (return_value == NOT_PROMOTED || return_value == ERROR) { return return_value; } // verifica se a chave cabe na pagina atual if (curr_page->nKeys < ORDER-1) { pageInsert(curr_page, key_promotion, left_offset_child_promoted, right_offset_child_promoted); savePage(offset, curr_page); return NOT_PROMOTED; } // se a chave nao couber na pagina, realiza split //fprintf(stderr, "chamando split... offset vale %d e chave vale %lld\n", offset, key_promotion); split(key_promotion, right_offset_child_promoted, curr_page, key_promoted, child_left_promoted, child_right_promoted, &new_page); *child_left_promoted = offset; savePage(offset, curr_page); // salva a pagina atual savePage(*child_right_promoted, new_page); // salva a nova pagina apos split free(curr_page); free(new_page); return PROMOTED; }
static char *findEntry( HelpHdl hdl, const char *name, unsigned *entry_num ) { char *ret; unsigned pagecnt; unsigned basepage; int cmpret; pagecnt = hdl->header.datapagecnt + hdl->header.indexpagecnt; basepage = pageHeader->page_num; ret = doFindEntry( name, entry_num ); cmpret = stricmp( ret, name ); while( cmpret < 0 && pageHeader->page_num < pagecnt - 1 ) { loadPage( hdl, pageHeader->page_num + 1 ); ret = doFindEntry( name, entry_num ); cmpret = stricmp( ret, name ); } if( cmpret > 0 && pageHeader->page_num > basepage ) { loadPage( hdl, pageHeader->page_num - 1 ); ret = doFindEntry( name, entry_num ); } return( ret ); }