bool RegistryFactory::usingModule() { // Check if the registry is allowing a module's registrations. return (!locked() && module_uuid_ != 0); }
bool Application::unregisterUIEngine(const StringW& name) { AutoLock locked(Application_local->lock); return Application_local->uiEngineHash.remove(name); }
bool Application::unregisterEventLoop(const StringW& name) { AutoLock locked(Application_local->lock); return Application_local->eventLoopHash.remove(name); }
void GC::unlock(void) { assert(locked()); gc()->_lock_count--; }
MgDynShapeLock::~MgDynShapeLock() { if (locked()) { locker->unlockDynData(mode == 2); } }
bool Babar::can_fire() { return Keyboard::GetInstance()->key_down (k_fire) && (m_fire_phase > m_weapons_armory.get_current_weapon()->reload_time() && !locked() ); }
bool Babar::can_jump() const { return !can_go_down() && Keyboard::GetInstance()->key_down (k_jump) && m_ready_jump && !Keyboard::GetInstance()->key_down (k_down) && !locked(); }
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // ¥ ParseAndLink /*e*/ Static // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // Prepares the tnt basic code text handle passed as a runnable program. // if it throws the semi complete parse is held in sParsingProgram CProgram *CProgram::ParseAndLink( Handle inCode, bool &outContainsErrors, const StringPtr inProgramName) { Handle adoptedHandle=inCode; ThrowIfOSErr_(::HandToHand(&adoptedHandle)); // Append a CR to the handle. This is done as every statement has to be followed by a cr in the same way that every // statement in c has be followed by a ;. A lot of people miss out the trailing cr so add one now. // also append double null, as is required by parser Size sz=::GetHandleSize(adoptedHandle); ThrowIfOSErr_(::BetterSetHandleSize(adoptedHandle,sz+4,'\r')); (*adoptedHandle)[sz+2]=0; (*adoptedHandle)[sz+3]=0; // Convert mac line endings to unix line endings for full on parsing using flex buffer class CFlexBuffer::MacToUnixCR(*adoptedHandle,::GetHandleSize(adoptedHandle)); delete sParsingProgram; // semi complete program - probably from a failed parse sParsingProgram=0; // Preparse the code now to get a list of procedures CProcNode *procs=ExtractProcedures(adoptedHandle); sParsingProgram=new CProgram(adoptedHandle,procs); ThrowIfMemFull_(sParsingProgram); gLineno=1; { UHandleLocker locked(adoptedHandle,true); CFlexBuffer buff(*adoptedHandle,::GetHandleSize(adoptedHandle),&TBParser::AllocAndSwitchToBuffer,&TBParser::DeallocBuffer,&TBParser::GetCurrentLexOffset); if (basicparse()) ;//Throw_(-1); // misc error - if this happens find out why and reclassify the error code but it shouldn't happen // check for parsing scopes that have been left open, such as when an 'end proc' is missing STextRange loc(GetCurrentTokenLoc()); loc.line-=2; // drop the two added crs so that the line number for any generated msgs is correct sParsingProgram->CheckParsingScope(loc,1); // should only be the root scope left } outContainsErrors=sParsingProgram->GetErrors().CountElements() || sParsingProgram->mMiscErrorFlag; if (!outContainsErrors) // no errors, continue to link stage... sParsingProgram->Link(); // check for errors again outContainsErrors=sParsingProgram->GetErrors().CountElements() || sParsingProgram->mMiscErrorFlag; CProgram *result=0; result=sParsingProgram; sParsingProgram=0; basicin=0; // Finally store the name of the resource as the program name if (inProgramName[0]) LString::CopyPStr(inProgramName,result->mProgramName); return result; }
void AssetDownloadTask::weakHandleAssetParsed(std::tr1::weak_ptr<AssetDownloadTask> thus, Mesh::MeshdataPtr md){ std::tr1::shared_ptr<AssetDownloadTask> locked(thus.lock()); if (locked){ locked->handleAssetParsed(md); } }
uint Object::removeListener(Object* listener) { ObjectExtra* extra = _objectExtra; if (extra == &Object_extraNull) return 0; AutoLock locked(Object::_internalLock); uint result = 0; ObjectConnection* prev; ObjectConnection* conn; ObjectConnection* next; _Begin: { HashIterator<uint32_t, ObjectConnection*> it(extra->_forwardConnection); while (it.isValid()) { uint32_t key = it.getKey(); prev = NULL; conn = it.getItem(); do { next = conn->next; if (conn->listener == listener) { result++; if (listener) { size_t index = listener->_objectExtra->_backwardConnection.indexOf(conn); FOG_ASSERT(index != INVALID_INDEX); listener->_objectExtra->_backwardConnection.removeAt(index); } fog_delete(conn); if (prev) prev->next = next; else if (next) { extra->_forwardConnection.put(key, next); goto _Begin; } else { extra->_forwardConnection.remove(key); goto _Begin; } } prev = conn; conn = next; } while (conn); it.next(); } } return result; }
ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) { MutexGuard locked(lock); OwningPtr<ObjectImage> obj(createObjectImage(InputBuffer)); if (!obj) report_fatal_error("Unable to create object image from memory buffer!"); // Save information about our target Arch = (Triple::ArchType)obj->getArch(); IsTargetLittleEndian = obj->getObjectFile()->isLittleEndian(); // Symbols found in this object StringMap<SymbolLoc> LocalSymbols; // Used sections from the object file ObjSectionToIDMap LocalSections; // Common symbols requiring allocation, with their sizes and alignments CommonSymbolMap CommonSymbols; // Maximum required total memory to allocate all common symbols uint64_t CommonSize = 0; error_code err; // Parse symbols DEBUG(dbgs() << "Parse symbols:\n"); for (symbol_iterator i = obj->begin_symbols(), e = obj->end_symbols(); i != e; i.increment(err)) { Check(err); object::SymbolRef::Type SymType; StringRef Name; Check(i->getType(SymType)); Check(i->getName(Name)); uint32_t flags; Check(i->getFlags(flags)); bool isCommon = flags & SymbolRef::SF_Common; if (isCommon) { // Add the common symbols to a list. We'll allocate them all below. uint32_t Align; Check(i->getAlignment(Align)); uint64_t Size = 0; Check(i->getSize(Size)); CommonSize += Size + Align; CommonSymbols[*i] = CommonSymbolInfo(Size, Align); } else { if (SymType == object::SymbolRef::ST_Function || SymType == object::SymbolRef::ST_Data || SymType == object::SymbolRef::ST_Unknown) { uint64_t FileOffset; StringRef SectionData; bool IsCode; section_iterator si = obj->end_sections(); Check(i->getFileOffset(FileOffset)); Check(i->getSection(si)); if (si == obj->end_sections()) continue; Check(si->getContents(SectionData)); Check(si->isText(IsCode)); const uint8_t* SymPtr = (const uint8_t*)InputBuffer->getBufferStart() + (uintptr_t)FileOffset; uintptr_t SectOffset = (uintptr_t)(SymPtr - (const uint8_t*)SectionData.begin()); unsigned SectionID = findOrEmitSection(*obj, *si, IsCode, LocalSections); LocalSymbols[Name.data()] = SymbolLoc(SectionID, SectOffset); DEBUG(dbgs() << "\tFileOffset: " << format("%p", (uintptr_t)FileOffset) << " flags: " << flags << " SID: " << SectionID << " Offset: " << format("%p", SectOffset)); GlobalSymbolTable[Name] = SymbolLoc(SectionID, SectOffset); } } DEBUG(dbgs() << "\tType: " << SymType << " Name: " << Name << "\n"); } // Allocate common symbols if (CommonSize != 0) emitCommonSymbols(*obj, CommonSymbols, CommonSize, LocalSymbols); // Parse and process relocations DEBUG(dbgs() << "Parse relocations:\n"); for (section_iterator si = obj->begin_sections(), se = obj->end_sections(); si != se; si.increment(err)) { Check(err); bool isFirstRelocation = true; unsigned SectionID = 0; StubMap Stubs; section_iterator RelocatedSection = si->getRelocatedSection(); for (relocation_iterator i = si->begin_relocations(), e = si->end_relocations(); i != e; i.increment(err)) { Check(err); // If it's the first relocation in this section, find its SectionID if (isFirstRelocation) { SectionID = findOrEmitSection(*obj, *RelocatedSection, true, LocalSections); DEBUG(dbgs() << "\tSectionID: " << SectionID << "\n"); isFirstRelocation = false; } processRelocationRef(SectionID, *i, *obj, LocalSections, LocalSymbols, Stubs); } } // Give the subclasses a chance to tie-up any loose ends. finalizeLoad(LocalSections); return obj.take(); }
CWindowMain::CWindowMain(QWidget *parent) : QMainWindow(parent), m_executThread(NULL) { m_widgetBFGenerate = new CWidgetBFGenerate(this); m_widgetBFList = new CWidgetBFList(this); m_widgetBFView = new CWidgetBFView(this); m_widgetConsol = new CWidgetConsol(this); m_widgetConsol->setVisible(false); m_widgetPanelMode = new CWidgetPanelMode(this); m_widgetTreeSat = new CWidgetTreeSat(this); QWidget *wBFViewBFGenerate = new QWidget(); QVBoxLayout *boxBFViewBFGenerate = new QVBoxLayout(); boxBFViewBFGenerate->addWidget(m_widgetBFGenerate); boxBFViewBFGenerate->addWidget(m_widgetBFView); boxBFViewBFGenerate->setMargin(0); boxBFViewBFGenerate->setSpacing(0); boxBFViewBFGenerate->setStretch(1,100); wBFViewBFGenerate->setLayout(boxBFViewBFGenerate); QSplitter *spListBFTreeAlg = new QSplitter(Qt::Vertical); spListBFTreeAlg->addWidget(m_widgetBFList); spListBFTreeAlg->addWidget(m_widgetTreeSat); QSplitter *spTreeView = new QSplitter(Qt::Horizontal); spTreeView->addWidget(spListBFTreeAlg); spTreeView->addWidget(wBFViewBFGenerate); spTreeView->setStretchFactor(1,100); QSplitter *spMain = new QSplitter(Qt::Vertical); spMain->addWidget(spTreeView); spMain->addWidget(m_widgetConsol); spMain->setStretchFactor(0,100); QWidget *widgetCenter = new QWidget(this); setCentralWidget(widgetCenter); QHBoxLayout *hbox = new QHBoxLayout(); centralWidget()->setLayout(hbox); hbox->addWidget(m_widgetPanelMode); hbox->addWidget(spMain); hbox->setMargin(0); hbox->setSpacing(0); hbox->setStretch(1,100); m_actOpen = new QAction(QIcon(":/ico/main_open.png"),tr("&Открыть"),this); m_actOpen->setShortcut(QKeySequence::Open); connect(m_actOpen,SIGNAL(triggered()),this,SLOT(on_open())); m_actSave = new QAction(QIcon(":/ico/main_save.png"),tr("&Сохранить"),this); m_actSave->setShortcut(QKeySequence::Save); connect(m_actSave,SIGNAL(triggered()),this,SLOT(on_save())); m_actSaveAs = new QAction(QIcon(":/ico/main_save_as.png"),tr("&Сохранить как"),this); m_actSaveAs->setShortcut(QKeySequence::SaveAs); connect(m_actSaveAs,SIGNAL(triggered()),this,SLOT(on_save_as())); m_actQuit = new QAction(QIcon("://ico/main_quit.png"),tr("Выйти"),this); m_actQuit->setShortcut(QKeySequence::Close); m_actQuit->setStatusTip(tr("Выйти из приложения")); connect(m_actQuit, SIGNAL(triggered()), this, SLOT(close())); mainMenu = menuBar()->addMenu(tr("Файл")); mainMenu->addAction(m_actOpen); mainMenu->addAction(m_actSave); mainMenu->addAction(m_actSaveAs); mainMenu->addSeparator(); mainMenu->addAction(m_actQuit); mainMenu = menuBar()->addMenu(tr("Вид")); mainMenu->addAction(m_widgetBFGenerate->actVisible()); mainMenu->addAction(m_widgetConsol->actVisible()); // m_widgetPanelMode connect(m_widgetPanelMode,SIGNAL(run()), m_widgetTreeSat,SLOT(on_runChecked())); connect(m_widgetPanelMode,SIGNAL(run()), m_widgetBFGenerate,SLOT(on_resetTriggered())); connect(m_widgetPanelMode,SIGNAL(runLog()), m_widgetTreeSat,SLOT(on_runLogChecked())); connect(m_widgetPanelMode,SIGNAL(runLog()), m_widgetBFGenerate,SLOT(on_resetTriggered())); connect(m_widgetPanelMode,SIGNAL(terminate()), this,SIGNAL(terminated())); connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)), m_widgetBFList,SLOT(setVisible(bool))); connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)), m_widgetBFList,SLOT(on_disabledHide(bool))); connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)), m_widgetBFGenerate,SLOT(setVisible(bool))); connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)), m_widgetBFGenerate->actVisible(),SLOT(setChecked(bool))); connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)), m_widgetBFGenerate->actVisible(),SLOT(setEnabled(bool))); connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)), m_widgetTreeSat,SLOT(setVisible(bool))); connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)), m_widgetTreeSat,SLOT(on_disabledHide(bool))); // m_widgetBFView connect(m_widgetBFView,SIGNAL(message(QString)), this,SIGNAL(messageAppend(QString))); connect(m_widgetBFView,SIGNAL(getLogSelectSat(bool)), m_widgetTreeSat,SLOT(on_returnLogSelectSat(bool))); // m_widgetBFList connect(m_widgetBFList,SIGNAL(generate()), m_widgetBFGenerate,SLOT(on_generate())); connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)), m_widgetBFGenerate,SLOT(on_set(QString,CBoolFormula*))); connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)), m_widgetTreeSat,SLOT(on_set(QString,CBoolFormula*))); connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)), m_widgetBFView,SLOT(on_set(QString,CBoolFormula*))); connect(m_widgetBFList,SIGNAL(message(QString)), this,SIGNAL(messageAppend(QString))); // m_widgetBFGenerate connect(m_widgetBFGenerate,SIGNAL(append(QString,CBoolFormula*)), m_widgetBFList,SIGNAL(appendgen(QString,CBoolFormula*))); connect(m_widgetBFGenerate,SIGNAL(append(QString,CBoolFormula*)), m_widgetPanelMode,SLOT(on_resetTriggered())); connect(m_widgetBFGenerate,SIGNAL(execut(QList<CExecutObject*>)), this,SLOT(on_execut(QList<CExecutObject*>))); connect(m_widgetBFGenerate,SIGNAL(replace(QString,CBoolFormula*)), m_widgetBFList,SIGNAL(replace(QString,CBoolFormula*))); connect(m_widgetBFGenerate,SIGNAL(replace(QString,CBoolFormula*)), m_widgetPanelMode,SLOT(on_resetTriggered())); connect(m_widgetBFGenerate,SIGNAL(remove(QString)), m_widgetBFList,SIGNAL(remove(QString))); connect(m_widgetBFGenerate,SIGNAL(terminated()), this,SIGNAL(terminated())); // m_widgetTreeSat connect(m_widgetTreeSat,SIGNAL(execut(QList<CExecutObject*>)), this,SLOT(on_execut(QList<CExecutObject*>))); connect(m_widgetTreeSat,SIGNAL(logSelectSat(QString)), m_widgetBFView,SIGNAL(setText(QString))); // main connect(this,SIGNAL(messageAppend(QString)), m_widgetConsol,SLOT(messageAppend(QString))); connect(this,SIGNAL(messageSet(QString)), m_widgetConsol,SLOT(messageSet(QString))); connect(this,SIGNAL(executingOperation(QString)), m_widgetConsol,SLOT(executingOperation(QString))); connect(this,SIGNAL(append(QString,CBoolFormula*)), m_widgetBFList,SIGNAL(append(QString,CBoolFormula*))); connect(this,SIGNAL(locked()),m_widgetPanelMode,SLOT(on_locked())); connect(this,SIGNAL(unlocked()),m_widgetPanelMode,SLOT(on_unlocked())); connect(this,SIGNAL(locked()),m_widgetBFGenerate,SLOT(on_locked())); connect(this,SIGNAL(unlocked()),m_widgetBFGenerate,SLOT(on_unlocked())); connect(this,SIGNAL(updateView()),m_widgetBFView,SLOT(on_viewUpdate())); m_widgetPanelMode->on_checkedRand(); // set checked Random bool formula state for start application }
void WidgetInfoPanel::Create() { wxWindowUpdateLocker locked( this ); if ( !m_widget.extendedinfo.parsed ) { m_widget.GetFileInfos(); m_widget.GetImageInfos(); m_widget.DownloadImages(); } m_widget.extendedinfo.parsed = true; m_busy_notice->DeleteWindows(); m_busy_notice->Show( false ); // m_busy_notice->Destroy(); m_main_sizer = new wxBoxSizer( wxVERTICAL ); m_left_sizer = new wxBoxSizer( wxVERTICAL ); m_left_button_sizer = new wxBoxSizer( wxHORIZONTAL ); m_grid_sizer = new wxGridSizer( 2, 5, 5 ); wxStaticText* name_lbl = new wxStaticText( this, -1, _("Name") ); m_grid_sizer->Add( name_lbl ); wxStaticText* name = new wxStaticText( this, -1, m_widget.name ); m_grid_sizer->Add( name ); wxStaticText* author_lbl = new wxStaticText( this, -1, _("Author") ); m_grid_sizer->Add( author_lbl ); wxStaticText* author = new wxStaticText( this, -1, m_widget.author ); m_grid_sizer->Add( author ); wxStaticText* mods_lbl = new wxStaticText( this, -1, _("Suitable games") ); m_grid_sizer->Add( mods_lbl ); wxStaticText* mods = new wxStaticText( this, -1, m_widget.mods ); m_grid_sizer->Add( mods ); wxStaticText* rev_lbl = new wxStaticText( this, -1, _("Current version") ); m_grid_sizer->Add( rev_lbl ); wxStaticText* rev = new wxStaticText( this, -1, m_widget.rev ); m_grid_sizer->Add( rev ); wxStaticText* dl_lbl = new wxStaticText( this, -1, _("# downloaded") ); m_grid_sizer->Add( dl_lbl ); wxStaticText* dl = new wxStaticText( this, -1, TowxString( m_widget.num_downloads ) ); m_grid_sizer->Add( dl ); wxStaticText* publ_lbl = new wxStaticText( this, -1, _("Published on") ); m_grid_sizer->Add( publ_lbl ); wxStaticText* publ = new wxStaticText( this, -1, m_widget.date ); m_grid_sizer->Add( publ ); m_left_sizer->Add( m_grid_sizer, 0, wxEXPAND | wxALL, 5 ); m_download = new wxButton( this, BUT_DOWNLOAD, _("Download") ); // m_update = new wxButton( this, BUT_UPDATE, _("Update") ); m_remove = new wxButton( this, BUT_REMOVE, _("Remove") ); const int flag = wxALL; const int spc = 5; m_left_button_sizer->Add( m_download, 0, flag, spc ); // m_button_sizer->Add( m_update, 0, flag, spc ); m_left_button_sizer->Add( m_remove, 0, flag, spc ); m_left_sizer->Add( m_left_button_sizer, 0, wxALL, 0 ); m_right_sizer = new wxBoxSizer ( wxVERTICAL ); m_desc = new slHtmlWindow( this, CTL_DESC, wxDefaultPosition, wxDefaultSize, wxHW_NO_SELECTION|wxHW_SCROLLBAR_AUTO ); wxString ct = _T("<html><body>") + m_widget.description + _T("</body></html>") ;//content m_desc->SetPage( ct ); m_changelog = new wxTextCtrl( this, -1, _T( "" ), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY ); wxStringTokenizer tk( m_widget.changelog, _T("\r\n") ); while ( tk.HasMoreTokens() ) m_changelog->AppendText( tk.GetNextToken() ); m_ext_info = new SLNotebook( this, _T("m_ext_info"), -1, wxDefaultPosition, wxDefaultSize, wxAUI_NB_LEFT ); m_ext_info->SetArtProvider(new SLArtProvider); m_ext_info->AddPage( m_desc, _("Description") , true ); m_ext_info->AddPage( m_changelog, _("Changelog") , false ); if ( m_widget.GetImageFilenames().GetCount() > 0 ) { m_imageviewer = new ImageViewerPanel( m_widget.GetImageFilenames(), false, this, -1, 0); m_ext_info->AddPage( m_imageviewer, _("Screenshots") , false ); } m_right_sizer->Add( m_ext_info, 1, wxEXPAND, 5 ); wxStaticBoxSizer* top_box = new wxStaticBoxSizer ( wxVERTICAL, this ); top_box->Add( m_left_sizer ); m_main_sizer->Add( top_box, 0, wxLEFT | wxEXPAND, 5 ); m_main_sizer->Add( new wxStaticLine( this ), 0, wxEXPAND ); m_main_sizer->Add( m_right_sizer, 1, wxLEFT|wxEXPAND, 5 ); SetButtonStates(); SetSizer( m_main_sizer ); Layout(); }
void RegistryFactory::shutdownModule() { locked(true); module_uuid_ = 0; }
void Babar::update_pos() { if (locked() ) return; m_phase++; unsigned int coll; /* cas où le sprite descend */ for (int speed_y = m_speed.y ; speed_y > 0 ; speed_y -= BOX_SIZE) { check_unbind(); gCollision->update_babar_platforms(); coll = gCollision->get_matrix()->down_collision_type (position() ); if (binded() ) { coll |= m_bind->down_collision_type (m_rel_pos); } if (CollisionsManager::is_down_coll (coll) ) { speed_y = 0; m_speed.y = 0; if ( !binded() ) { m_last_pos = m_pos; } } else { move (0, BOX_SIZE); //~ if (position().y + position().h > (int)gStatic->StaticData_height()) //~ m_rel_pos.y = gStatic->StaticData_height() - m_pos.h; } } /* cas où le sprite monte */ for (int speed_y = m_speed.y ; speed_y < 0 ; speed_y += BOX_SIZE) { check_unbind(); gCollision->update_babar_platforms(); coll = gCollision->get_matrix()->up_collision_type (position() ); if (binded() ) { coll |= m_bind->up_collision_type (m_rel_pos); } if (CollisionsManager::is_up_coll (coll) ) { speed_y = 0; m_speed.y = 0; } else { move (0, -BOX_SIZE); } } /* cas où le sprite va � droite */ for (int speed_x = m_speed.x ; speed_x > 0 ; speed_x -= BOX_SIZE) { check_unbind(); gCollision->update_babar_platforms(); move (0, -BOX_SIZE); coll = gCollision->get_matrix()->right_collision_type (position() ); if (binded() ) { coll |= m_bind->right_collision_type (m_rel_pos); } if (CollisionsManager::is_right_coll (coll) ) { speed_x = 0; m_speed.x = 0; } else { move (+BOX_SIZE, 0); // On avance! } if (!is_on_something() ) // s'il n'y avait pas de pente montante, on revient move (0, BOX_SIZE); if (!is_on_something() ) // gestion de la pente descendante move (0, BOX_SIZE); if (!is_on_something() ) move (0, -BOX_SIZE); // ce n'était pas une pente descendante, on revient do_stay_in_level(); } /* cas où le sprite va � gauche */ for (int speed_x = m_speed.x ; speed_x < 0 ; speed_x += BOX_SIZE) { check_unbind(); gCollision->update_babar_platforms(); move (0, -BOX_SIZE); coll = gCollision->get_matrix()->left_collision_type (position() ); if (binded() ) { coll |= m_bind->left_collision_type (m_rel_pos); } if (CollisionsManager::is_left_coll (coll) ) { speed_x = 0; m_speed.x = 0; } else { move (-BOX_SIZE, 0); // On avance! } if (!is_on_something() ) // s'il n'y avait pas de pente montante, on revient move (0, BOX_SIZE); if (!is_on_something() ) // gestion de la pente descendante move (0, BOX_SIZE); if (!is_on_something() ) move (0, -BOX_SIZE); // ce n'était pas une pente descendante, on revient } do_stay_in_level(); }
void AssetDownloadTask::weakAssetFileDownloaded(std::tr1::weak_ptr<AssetDownloadTask> thus, std::tr1::shared_ptr<ChunkRequest> request, std::tr1::shared_ptr<const DenseData> response) { std::tr1::shared_ptr<AssetDownloadTask> locked(thus.lock()); if (locked){ locked->assetFileDownloaded(request,response); } }
void Babar::update_state() { if (locked() ) m_lock--; if (m_lock == 0) { unlock(); } if (!Keyboard::GetInstance()->time_pressed (k_jump) ) m_jump = false; if (m_jump) { if ( Keyboard::GetInstance()->time_pressed (k_jump) > 1 ) { m_ready_double_jump = true; if ( Keyboard::GetInstance()->time_pressed (k_jump) > JUMP_TIME) { m_jump = false; Keyboard::GetInstance()->disable_key (k_jump); } } } update_direction(); if ( CollisionsManager::is_down_coll (gCollision->get_matrix()->down_collision_type (position() ) ) ) { interrupt_jump(); } if (can_fire() ) { m_fire = true; gProj->add_proj (fire_old(), PLAYER1); m_fire_phase = 0; } else { m_fire = false; m_fire_phase++; } if (can_crouch() ) { crouch(); } else { /* si on se releve */ if ( m_crouch_time ) { interrupt_crouch(); } } if (can_jump() ) jump(); if (can_double_jump() ) double_jump(); if (can_go_down() ) go_down(); if (m_invincible > 0) { m_invincible --; if (!locked() ) { if ( m_invincible % 2) { m_spriteGrid->no_pic(); } else { m_spriteGrid->set_pic(); } } } m_weapons_armory.update(); if (Keyboard::GetInstance()->time_pressed (k_prev_weapon) == 1) m_weapons_armory.previous_weapon(); if (Keyboard::GetInstance()->time_pressed (k_next_weapon) == 1) m_weapons_armory.next_weapon(); switch (get_state() ) { case STATIC: m_spriteGrid->setPictures (0); break; case WALK: m_spriteGrid->setPictures (1, 0, 2, 0); break; case JUMP: m_spriteGrid->setPictures (1); break; case CROUCH: m_spriteGrid->setPictures (12); break; case CROUCH_WALKING: m_spriteGrid->setPictures (13, 12, 14, 12); break; default: m_spriteGrid->setPictures (0); break; } //m_spriteGrid->change_anim(get_state(), m_dir, Keyboard::GetInstance()->key_down(k_fire)); m_spriteGrid->set_pos (position() ); set_h (m_spriteGrid->h() ); set_w (m_spriteGrid->w() ); }
void TextContent::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) { if (!locked()) { emit requestBackgrounding(); } }
bool Babar::can_crouch() const { return Keyboard::GetInstance()->key_down (k_down) & !locked(); }
static void format_netlink(struct nlmsghdr *msg) { struct rtattr *tb[ACPI_GENL_ATTR_MAX + 1]; struct genlmsghdr *ghdr = NLMSG_DATA(msg); int len; struct rtattr *attrs; len = msg->nlmsg_len; /* if this message doesn't have the proper family ID, drop it */ if (msg->nlmsg_type != acpi_ids_getfamily()) { if (logevents) { acpid_log(LOG_INFO, "wrong netlink family ID.\n"); } return; } len -= NLMSG_LENGTH(GENL_HDRLEN); if (len < 0) { acpid_log(LOG_WARNING, "wrong netlink controller message len: %d\n", len); return; } attrs = (struct rtattr *)((char *)ghdr + GENL_HDRLEN); /* parse the attributes in this message */ parse_rtattr(tb, ACPI_GENL_ATTR_MAX, attrs, len); /* if there's an ACPI event attribute... */ if (tb[ACPI_GENL_ATTR_EVENT]) { /* get the actual event struct */ struct acpi_genl_event *event = RTA_DATA(tb[ACPI_GENL_ATTR_EVENT]); char buf[64]; /* format it */ snprintf(buf, sizeof(buf), "%s %s %08x %08x", event->device_class, event->bus_id, event->type, event->data); /* if we're locked, don't process the event */ if (locked()) { if (logevents) { acpid_log(LOG_INFO, "lockfile present, not processing " "netlink event \"%s\"\n", buf); } return; } if (logevents) acpid_log(LOG_INFO, "received netlink event \"%s\"\n", buf); /* send the event off to the handler */ acpid_handle_event(buf); if (logevents) acpid_log(LOG_INFO, "completed netlink event \"%s\"\n", buf); } }
MgDynShapeLock::~MgDynShapeLock() { if (locked()) { s_dynLock.unlock(m_mode == 2); } }
ObjectImage *RuntimeDyldImpl::loadObject(ObjectImage *InputObject) { MutexGuard locked(lock); std::unique_ptr<ObjectImage> Obj(InputObject); if (!Obj) return NULL; // Save information about our target Arch = (Triple::ArchType)Obj->getArch(); IsTargetLittleEndian = Obj->getObjectFile()->isLittleEndian(); // Compute the memory size required to load all sections to be loaded // and pass this information to the memory manager if (MemMgr->needsToReserveAllocationSpace()) { uint64_t CodeSize = 0, DataSizeRO = 0, DataSizeRW = 0; computeTotalAllocSize(*Obj, CodeSize, DataSizeRO, DataSizeRW); MemMgr->reserveAllocationSpace(CodeSize, DataSizeRO, DataSizeRW); } // Symbols found in this object StringMap<SymbolLoc> LocalSymbols; // Used sections from the object file ObjSectionToIDMap LocalSections; // Common symbols requiring allocation, with their sizes and alignments CommonSymbolMap CommonSymbols; // Maximum required total memory to allocate all common symbols uint64_t CommonSize = 0; // Parse symbols DEBUG(dbgs() << "Parse symbols:\n"); for (symbol_iterator I = Obj->begin_symbols(), E = Obj->end_symbols(); I != E; ++I) { object::SymbolRef::Type SymType; StringRef Name; Check(I->getType(SymType)); Check(I->getName(Name)); uint32_t Flags = I->getFlags(); bool IsCommon = Flags & SymbolRef::SF_Common; if (IsCommon) { // Add the common symbols to a list. We'll allocate them all below. uint32_t Align; Check(I->getAlignment(Align)); uint64_t Size = 0; Check(I->getSize(Size)); CommonSize += Size + Align; CommonSymbols[*I] = CommonSymbolInfo(Size, Align); } else { if (SymType == object::SymbolRef::ST_Function || SymType == object::SymbolRef::ST_Data || SymType == object::SymbolRef::ST_Unknown) { uint64_t FileOffset; StringRef SectionData; bool IsCode; section_iterator SI = Obj->end_sections(); Check(I->getFileOffset(FileOffset)); Check(I->getSection(SI)); if (SI == Obj->end_sections()) continue; Check(SI->getContents(SectionData)); Check(SI->isText(IsCode)); const uint8_t *SymPtr = (const uint8_t *)Obj->getData().data() + (uintptr_t)FileOffset; uintptr_t SectOffset = (uintptr_t)(SymPtr - (const uint8_t *)SectionData.begin()); unsigned SectionID = findOrEmitSection(*Obj, *SI, IsCode, LocalSections); LocalSymbols[Name.data()] = SymbolLoc(SectionID, SectOffset); DEBUG(dbgs() << "\tFileOffset: " << format("%p", (uintptr_t)FileOffset) << " flags: " << Flags << " SID: " << SectionID << " Offset: " << format("%p", SectOffset)); GlobalSymbolTable[Name] = SymbolLoc(SectionID, SectOffset); } } DEBUG(dbgs() << "\tType: " << SymType << " Name: " << Name << "\n"); } // Allocate common symbols if (CommonSize != 0) emitCommonSymbols(*Obj, CommonSymbols, CommonSize, LocalSymbols); // Parse and process relocations DEBUG(dbgs() << "Parse relocations:\n"); for (section_iterator SI = Obj->begin_sections(), SE = Obj->end_sections(); SI != SE; ++SI) { unsigned SectionID = 0; StubMap Stubs; section_iterator RelocatedSection = SI->getRelocatedSection(); if (SI->relocation_empty() && !ProcessAllSections) continue; bool IsCode = false; Check(RelocatedSection->isText(IsCode)); SectionID = findOrEmitSection(*Obj, *RelocatedSection, IsCode, LocalSections); DEBUG(dbgs() << "\tSectionID: " << SectionID << "\n"); for (relocation_iterator I = SI->relocation_begin(), E = SI->relocation_end(); I != E;) I = processRelocationRef(SectionID, I, *Obj, LocalSections, LocalSymbols, Stubs); } // Give the subclasses a chance to tie-up any loose ends. finalizeLoad(LocalSections); return Obj.release(); }
void WaitableEvent::Reset() { nbase::NAutoLock locked(&kernel_->lock_); kernel_->signaled_ = false; }
void lock() { if( locked() ) throw std::logic_error("object::lock bug"); m_lock = g_context; }
bool Application::registerUIEngine(const StringW& name, UIEngineConstructor ctor) { AutoLock locked(Application_local->lock); return Application_local->uiEngineHash.put(name, ctor); }
// Return `true` if this object is locked by another context. bool locked_by_other() const noexcept { return locked() && (! locked_by_self()); }
bool Application::registerEventLoop(const StringW& name, EventLoopConstructor ctor) { AutoLock locked(Application_local->lock); return Application_local->eventLoopHash.put(name, ctor); }
void semaphore::wait(){ if(locked()){ lock();unlock(); } }
void Mutex::setLocked() { m_isLocked = true; emit locked(); }
void PhoneSecurity::setLockStatusResult(const QString& type, bool valid ) { if ( type == lockKind[0] || type == lockKind[1] ) { emit locked(valid); } }