这篇教程C++ Dispatch函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Dispatch函数的典型用法代码示例。如果您正苦于以下问题:C++ Dispatch函数的具体用法?C++ Dispatch怎么用?C++ Dispatch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Dispatch函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: refvoidBenchmarkPlayback::InputExhausted(){ RefPtr<Benchmark> ref(mMainThreadState); Dispatch(NS_NewRunnableFunction([this, ref]() { MOZ_ASSERT(OnThread()); if (mFinished || mSampleIndex >= mSamples.Length()) { return; } mDecoder->Input(mSamples[mSampleIndex]); mSampleIndex++; if (mSampleIndex == mSamples.Length()) { if (ref->mParameters.mStopAtFrame) { mSampleIndex = 0; } else { mDecoder->Drain(); } } }));}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:20,
示例2: Monitor_Startvoid Monitor_Start(RingBuffer *inputBuffer){ dGuard(inputBuffer == NULL); OpenConsole(); PrintLogo(Console); while (1) { uint16_t read = ReadLineInto(inputBuffer); StreamWriter_WriteLine(Console, inputBuffer->Buffer, read); if (!Dispatch(inputBuffer, Console)) break; } StreamWriter_WriteLine(Console, "Bye.", 4); Stream_Close(Console); Console = NULL;}
开发者ID:obiwanjacobi,项目名称:Zalt,代码行数:20,
示例3: Decodeint Decode(int index, uint8_t bytes[]){ Instruction instruction = DecodeInstruction(bytes[index]); AddressingMode addressingMode = DecodeAddressingMode(bytes[index]); /* * Exceptions: * STX: * ZeroPageX -> ZeroPageY * LDX: * ZeroPageX -> ZeroPageY * AbsoluteX -> AbsoluteY */ if ((instruction == STX || instruction == LDX) && addressingMode == ZeroPageX) addressingMode = ZeroPageY; if (instruction == LDX && addressingMode == AbsoluteX) addressingMode = AbsoluteY; Dispatch(instruction, addressingMode, index, bytes); return FindInstructionLength(addressingMode);}
开发者ID:Charile1,项目名称:6502emu,代码行数:21,
示例4: MOZ_ASSERTvoidBenchmarkPlayback::InitDecoder(TrackInfo&& aInfo){ MOZ_ASSERT(OnThread()); RefPtr<PDMFactory> platform = new PDMFactory(); mDecoder = platform->CreateDecoder(aInfo, mDecoderTaskQueue, this); if (!mDecoder) { MainThreadShutdown(); return; } RefPtr<Benchmark> ref(mMainThreadState); mDecoder->Init()->Then( ref->Thread(), __func__, [this, ref](TrackInfo::TrackType aTrackType) { Dispatch(NS_NewRunnableFunction([this, ref]() { InputExhausted(); })); }, [this, ref](MediaDataDecoder::DecoderFailureReason aReason) { MainThreadShutdown(); });}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:21,
示例5: Dispatchvoid VSTPlugin::Create(VSTPlugin *plug){ h_dll=plug->h_dll; _pEffect=plug->_pEffect; _pEffect->user=this; Dispatch( effMainsChanged, 0, 1, NULL, 0.0f);// strcpy(_editName,plug->_editName); On current implementation, this replaces the right one. strcpy(_sProductName,plug->_sProductName); strcpy(_sVendorName,plug->_sVendorName); _sDllName = new char[strlen(plug->_sDllName)+1]; strcpy(_sDllName,plug->_sDllName); _isSynth=plug->_isSynth; _version=plug->_version; plug->instantiated=false; // We are "stoling" the plugin from the "plug" object so this // is just a "trick" so that when destructing the "plug", it // doesn't unload the Dll. instantiated=true;}
开发者ID:Angeldude,项目名称:pd,代码行数:21,
示例6: LOGvoidCacheStorageService::OnMemoryConsumptionChange(CacheMemoryConsumer* aConsumer, uint32_t aCurrentMemoryConsumption){ LOG(("CacheStorageService::OnMemoryConsumptionChange [consumer=%p, size=%u]", aConsumer, aCurrentMemoryConsumption)); uint32_t savedMemorySize = aConsumer->mReportedMemoryConsumption; if (savedMemorySize == aCurrentMemoryConsumption) return; // Exchange saved size with current one. aConsumer->mReportedMemoryConsumption = aCurrentMemoryConsumption; mMemorySize -= savedMemorySize; mMemorySize += aCurrentMemoryConsumption; LOG((" mMemorySize=%u (+%u,-%u)", uint32_t(mMemorySize), aCurrentMemoryConsumption, savedMemorySize)); // Bypass purging when memory has not grew up significantly if (aCurrentMemoryConsumption <= savedMemorySize) return; if (mPurging) { LOG((" already purging")); return; } if (mMemorySize <= CacheObserver::MemoryLimit()) return; // Throw the oldest data or whole entries away when over certain limits mPurging = true; // Must always dipatch, since this can be called under e.g. a CacheFile's lock. nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &CacheStorageService::PurgeOverMemoryLimit); Dispatch(event);}
开发者ID:at13,项目名称:mozilla-central,代码行数:40,
示例7: ProcessEvents bool ProcessEvents() { // process pending wx events first as they correspond to low-level events // which happened before, i.e. typically pending events were queued by a // previous call to Dispatch() and if we didn't process them now the next // call to it might enqueue them again (as happens with e.g. socket events // which would be generated as long as there is input available on socket // and this input is only removed from it when pending event handlers are // executed) if( wxTheApp ) { wxTheApp->ProcessPendingEvents(); // One of the pending event handlers could have decided to exit the // loop so check for the flag before trying to dispatch more events // (which could block indefinitely if no more are coming). if( m_shouldExit ) return false; } return Dispatch(); }
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:22,
示例8: refvoidBenchmarkPlayback::Output(MediaData* aData){ RefPtr<Benchmark> ref(mMainThreadState); Dispatch(NS_NewRunnableFunction([this, ref]() { mFrameCount++; if (mFrameCount == ref->mParameters.mStartupFrame) { mDecodeStartTime = TimeStamp::Now(); } int32_t frames = mFrameCount - ref->mParameters.mStartupFrame; TimeDuration elapsedTime = TimeStamp::Now() - mDecodeStartTime; if (!mFinished && (frames == ref->mParameters.mFramesToMeasure || elapsedTime >= ref->mParameters.mTimeout)) { uint32_t decodeFps = frames / elapsedTime.ToSeconds(); MainThreadShutdown(); ref->Dispatch(NS_NewRunnableFunction([ref, decodeFps]() { ref->ReturnResult(decodeFps); })); } }));}
开发者ID:devtools-html,项目名称:gecko-dev,代码行数:22,
示例9: SOCKET_LOGnsresultnsSocketTransportService::DetachSocket(SocketContext *listHead, SocketContext *sock){ SOCKET_LOG(("nsSocketTransportService::DetachSocket [handler=%p]/n", sock->mHandler)); MOZ_ASSERT((listHead == mActiveList) || (listHead == mIdleList), "DetachSocket invalid head"); // inform the handler that this socket is going away sock->mHandler->OnSocketDetached(sock->mFD); mSentBytesCount += sock->mHandler->ByteCountSent(); mReceivedBytesCount += sock->mHandler->ByteCountReceived(); // cleanup sock->mFD = nullptr; NS_RELEASE(sock->mHandler); if (listHead == mActiveList) RemoveFromPollList(sock); else RemoveFromIdleList(sock); // NOTE: sock is now an invalid pointer // // notify the first element on the pending socket queue... // nsCOMPtr<nsIRunnable> event; LinkedRunnableEvent *runnable = mPendingSocketQueue.getFirst(); if (runnable) { event = runnable->TakeEvent(); runnable->remove(); delete runnable; } if (event) { // move event from pending queue to dispatch queue return Dispatch(event, NS_DISPATCH_NORMAL); } return NS_OK;}
开发者ID:zbraniecki,项目名称:gecko-dev,代码行数:39,
示例10: sizeof void ConnectionHandler::DispatchIfCan() { if (reading_status_ == ReadingStatus::Length && socket_buffer_.used() >= sizeof(UInt32)) { UInt32Bytes length{}; socket_buffer_.read(length.bytes, sizeof(UInt32)); current_message_length = length.number; // set reading status to next reading_status_ = ReadingStatus::OpCode; } if (reading_status_ == ReadingStatus::OpCode && socket_buffer_.used() >= sizeof(UInt32)) { UInt32Bytes opcode{}; socket_buffer_.read(opcode.bytes, sizeof(UInt32)); // initialize current message with the opcode current_message_ = Message{opcode.number}; // set reading status to data reading_status_ = ReadingStatus::Data; } if (reading_status_ == ReadingStatus::Data && socket_buffer_.used() >= current_message_length) { // initialize the vector for the data current_message_.data_vector().clear(); current_message_.data_vector().resize(current_message_length); socket_buffer_.read(current_message_.data(), current_message_length); // dispatch message Dispatch(current_message_); // set reading status back to length reading_status_ = ReadingStatus::Length; // if there is data in the buffer and we read the whole // packet, launch socket readable once more if (socket_buffer_.used() > sizeof(UInt32)) { DispatchIfCan(); } } }
开发者ID:BeeeOn,项目名称:gateway-man-core,代码行数:39,
示例11: ASSERT_OWNING_THREADvoidLazyIdleThread::EnableIdleTimeout(){ ASSERT_OWNING_THREAD(); if (mIdleTimeoutEnabled) { return; } mIdleTimeoutEnabled = true; { MutexAutoLock lock(mMutex); MOZ_ASSERT(mPendingEventCount, "Mismatched calls to observer methods!"); --mPendingEventCount; } if (mThread) { nsCOMPtr<nsIRunnable> runnable(new nsRunnable()); if (NS_FAILED(Dispatch(runnable, NS_DISPATCH_NORMAL))) { NS_WARNING("Failed to dispatch!"); } }}
开发者ID:Tripleman,项目名称:mozilla-central,代码行数:23,
示例12: cairo_ps_surface_createvoid Shape::Render(const char *path){ if(geom_ == NULL) return; cairo_surface_t *surface = cairo_ps_surface_create(path, width_, height_); if(cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) { std::cout << cairo_status_to_string(cairo_surface_status(surface)) << std::endl; exit(1); return; } ctx_ = cairo_create(surface); OGREnvelope env; geom_->getEnvelope(&env); cairo_matrix_t mat; matrix_init(&mat, width_, height_, &env); cairo_set_matrix(ctx_, &mat); Dispatch(geom_); cairo_show_page(ctx_); cairo_destroy(ctx_); cairo_surface_destroy(surface);}
开发者ID:PoNote,项目名称:stateface,代码行数:23,
示例13: Dispatch//*=================================================================================//*原型: void ProcessRequest(SOCKET hSocket)//*功能: 处理客户机的请求//*参数: 无//*返回: 无//*说明: 先读入包头, 再读包数据, 然后再处理请求//*=================================================================================void TSmartOutThread::ProcessRequest(SOCKET hSocket, SOCKADDR_IN *psockAddr){ TSmartPacket Packet; try { if( ReadRequestPacket(hSocket, Packet) ) { if( CheckPacket(psockAddr, Packet) ) { Dispatch(hSocket, psockAddr, Packet); } } } catch(TException& e) { WriteLog(e.GetText()); } catch(...) { WriteLog("客户服务线程有未知异常!"); }}
开发者ID:Codiscope-Research,项目名称:ykt4sungard,代码行数:30,
示例14: whilebool wxGUIEventLoop::YieldFor(long eventsToProcess){#if wxUSE_THREADS if ( !wxThread::IsMain() ) return true; // can't process events from other threads#endif // wxUSE_THREADS m_isInsideYield = true; m_eventsToProcessInsideYield = eventsToProcess;#if wxUSE_LOG wxLog::Suspend();#endif // wxUSE_LOG // TODO: implement event filtering using the eventsToProcess mask // process all pending events: while ( Pending() ) Dispatch(); // handle timers, sockets etc. OnNextIteration(); // it's necessary to call ProcessIdle() to update the frames sizes which // might have been changed (it also will update other things set from // OnUpdateUI() which is a nice (and desired) side effect) while ( ProcessIdle() ) {}#if wxUSE_LOG wxLog::Resume();#endif // wxUSE_LOG m_isInsideYield = false; return true;}
开发者ID:beanhome,项目名称:dev,代码行数:36,
示例15: doSchedule/* doSchedule() will do a Task Switch to a high priority task * in ready state.It don't care wether OSCurTask are * Preemptable or not,or INVALID_TASK. * Note OSCurTsk also may be the highest priority Task in READY state. * in ready or running state*/void doSchedule(void){ /* The Situation that when the SEVERAL_TASKS_PER_PRIORITY Policy was adopted, * there may be a task or more with the same xPriority as OSCurTsk in the * ready state*/ if(OSCurTsk == OSHighRdyTsk) { /* higher priority task in ready or running state */ /* Search the table map to find OSHighPriority*/ OS_ENTER_CRITICAL();#if (cfgOS_TASK_PER_PRIORITY == SEVERAL_TASKS_PER_PRIORITY) if(listTskRdyIsEmpty(OSCurTcb->xPriority)) { /* if OSTskRdyListHead[xPriority] is Empty, */#endif /* Find out an Runnable Task */ OSHighRdyPrio = tableRdyMapFindHighPriority();#if (cfgOS_TASK_PER_PRIORITY == SEVERAL_TASKS_PER_PRIORITY) } /* if OSTcbRdyGrpList[xPriority] is not Empty, */#endif /* make the head task runnable */ /* Get The Tcb with the highest Priority*/ OSHighRdyTsk = listGetRdyTsk(OSHighRdyPrio); OSHighRdyTcb = &OSTcbTable[OSHighRdyTsk]; OS_EXIT_CRITICAL(); } Dispatch();}
开发者ID:1984c,项目名称:GaInOS,代码行数:29,
示例16: whilebool wxGUIEventLoop::YieldFor(long eventsToProcess){#if wxUSE_THREADS // Yielding from a non-gui thread needs to bail out, otherwise we end up // possibly sending events in the thread too. if ( !wxThread::IsMain() ) { return true; }#endif // wxUSE_THREADS m_isInsideYield = true; m_eventsToProcessInsideYield = eventsToProcess;#if wxUSE_LOG // disable log flushing from here because a call to wxYield() shouldn't // normally result in message boxes popping up &c wxLog::Suspend();#endif // wxUSE_LOG // process all pending events: while ( Pending() ) Dispatch(); // it's necessary to call ProcessIdle() to update the frames sizes which // might have been changed (it also will update other things set from // OnUpdateUI() which is a nice (and desired) side effect) while ( ProcessIdle() ) {}#if wxUSE_LOG wxLog::Resume();#endif // wxUSE_LOG m_isInsideYield = false; return true;}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:36,
示例17: main//.........这里部分代码省略......... InitRootWindow(screenInfo.screens[i]->root); InitCoreDevices(); InitInput(argc, argv); InitAndStartDevices(); ReserveClientIds(serverClient); dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);#ifdef PANORAMIX if (!noPanoramiXExtension) { if (!PanoramiXCreateConnectionBlock()) { FatalError("could not create connection block info"); } } else#endif { if (!CreateConnectionBlock()) { FatalError("could not create connection block info"); } }#ifdef XQUARTZ /* Let the other threads know the server is done with its init */ pthread_mutex_lock(&serverRunningMutex); serverRunning = TRUE; pthread_cond_broadcast(&serverRunningCond); pthread_mutex_unlock(&serverRunningMutex);#endif NotifyParentProcess(); Dispatch();#ifdef XQUARTZ /* Let the other threads know the server is no longer running */ pthread_mutex_lock(&serverRunningMutex); serverRunning = FALSE; pthread_mutex_unlock(&serverRunningMutex);#endif UndisplayDevices(); DisableAllDevices(); /* Now free up whatever must be freed */ if (screenIsSaved == SCREEN_SAVER_ON) dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); FreeScreenSaverTimer(); CloseDownExtensions();#ifdef PANORAMIX { Bool remember_it = noPanoramiXExtension; noPanoramiXExtension = TRUE; FreeAllResources(); noPanoramiXExtension = remember_it; }#else FreeAllResources();#endif CloseInput(); for (i = 0; i < screenInfo.numScreens; i++)
开发者ID:Agnesa,项目名称:xserver,代码行数:67,
示例18: switchbool EventDispatcher::DispatchSDLEvent(const SDL_Event &event){ switch (event.type) { case SDL_KEYDOWN: return Dispatch(KeyboardEvent(KeyboardEvent::KEY_DOWN, KeySym(event.key.keysym.sym, SDL_Keymod(event.key.keysym.mod)), event.key.repeat)); case SDL_KEYUP: return Dispatch(KeyboardEvent(KeyboardEvent::KEY_UP, KeySym(event.key.keysym.sym, SDL_Keymod(event.key.keysym.mod)), event.key.repeat)); case SDL_TEXTINPUT: Uint32 unicode; Text::utf8_decode_char(&unicode, event.text.text); return Dispatch(TextInputEvent(unicode)); case SDL_MOUSEWHEEL: return Dispatch(MouseWheelEvent(event.wheel.y > 0 ? MouseWheelEvent::WHEEL_UP : MouseWheelEvent::WHEEL_DOWN, m_lastMousePosition)); case SDL_MOUSEBUTTONDOWN: return Dispatch(MouseButtonEvent(MouseButtonEvent::BUTTON_DOWN, MouseButtonFromSDLButton(event.button.button), Point(event.button.x,event.button.y))); case SDL_MOUSEBUTTONUP: return Dispatch(MouseButtonEvent(MouseButtonEvent::BUTTON_UP, MouseButtonFromSDLButton(event.button.button), Point(event.button.x,event.button.y))); case SDL_MOUSEMOTION: return Dispatch(MouseMotionEvent(Point(event.motion.x,event.motion.y), Point(event.motion.xrel, event.motion.yrel))); case SDL_JOYAXISMOTION: // SDL joystick axis value is documented to have the range -32768 to 32767 // unfortunately this places the centre at -0.5, not at zero, which is clearly nuts... // so since that doesn't make any sense, we assume the range is *actually* -32767 to +32767, // and scale it accordingly, clamping the output so that if we *do* get -32768, it turns into -1 return Dispatch(JoystickAxisMotionEvent(event.jaxis.which, Clamp(event.jaxis.value * (1.0f / 32767.0f), -1.0f, 1.0f), event.jaxis.axis)); case SDL_JOYHATMOTION: return Dispatch(JoystickHatMotionEvent(event.jhat.which, JoystickHatMotionEvent::JoystickHatDirection(event.jhat.value), event.jhat.hat)); case SDL_JOYBUTTONDOWN: return Dispatch(JoystickButtonEvent(event.jbutton.which, JoystickButtonEvent::BUTTON_DOWN, event.jbutton.button)); case SDL_JOYBUTTONUP: return Dispatch(JoystickButtonEvent(event.jbutton.which, JoystickButtonEvent::BUTTON_UP, event.jbutton.button)); } return false;}
开发者ID:Ikesters,项目名称:pioneer,代码行数:45,
示例19: sys_Dispatchvoid sys_Dispatch(struct pt_regs * regs, LONG adjust){ struct ExecBase * SysBase = (struct ExecBase *)*(ULONG *)0x04; /* Hmm, interrupts are nesting, not a good idea... */// if(user_mode(regs)) {// return;// }#if 0 D(bug("In %s!!!/n",__FUNCTION__)); D(bug("lr_svc=%x, r0=%x, r1=%x, r2=%x, r9=%x, r12=%x, sp=%x, lr=%x, cpsr=%x/n", regs->lr_svc, regs->r0, regs->r1, regs->r2, regs->r9, regs->r12, regs->sp, regs->lr, regs->cpsr));#endif /* Check if a task switch is necessary */ /* 1. There has to be another task in the ready-list */ /* 2. The first task in the ready list hast to have the same or higher priority than the currently active task */ if( SysBase->TaskReady.lh_Head->ln_Succ != NULL /* ((BYTE)SysBase->ThisTask->tc_Node.ln_Pri <= (BYTE)((struct Task *)SysBase->TaskReady.lh_Head)->tc_Node.ln_Pri ) */ ) { /* Check if task switch is possible */ if( SysBase->TDNestCnt < 0 ) { if( SysBase->ThisTask->tc_State == TS_RUN ) { SysBase->ThisTask->tc_State = TS_READY; Reschedule(SysBase->ThisTask); SysBase->AttnResched |= 0x8000; } else if( SysBase->ThisTask->tc_State == TS_REMOVED ) SysBase->AttnResched |= 0x8000; } else SysBase->AttnResched |= 0x80; } /* Has an interrupt told us to dispatch when leaving */ if (SysBase->AttnResched & 0x8000) { SysBase->AttnResched &= ~0x8000; /* Save registers for this task (if there is one...) */ if (SysBase->ThisTask && SysBase->ThisTask->tc_State != TS_REMOVED) { regs->lr_svc -= adjust; // adjust is 0 or -4 SaveRegs(SysBase->ThisTask, regs); } /* Tell exec that we have actually switched tasks... */ Dispatch ();//D(bug("DISPATCHER: New task: %s/n",SysBase->ThisTask->tc_Node.ln_Name)); /* Get the registers of the old task */ RestoreRegs(SysBase->ThisTask, regs); regs->lr_svc += adjust; // adjust is 0 or -4 /* Make sure that the state of the interrupts is what the task expects. */ if (SysBase->IDNestCnt < 0) SC_ENABLE(regs); else SC_DISABLE(regs);#if 0 D(bug("after: lr_svc=%x, r0=%x, r1=%x, r2=%x, r9=%x, r12=%x, sp=%x, lr=%x, cpsr=%x (adjust=%d)/n", regs->lr_svc, regs->r0, regs->r1, regs->r2, regs->r9, regs->r12, regs->sp, regs->lr, regs->cpsr, adjust));#endif /* Ok, the next step is to either drop back to the new task, or give it its Exception() if it wants one... */ if (SysBase->ThisTask->tc_Flags & TF_EXCEPT) { Disable(); Exception(); Enable(); } } /* Leave the interrupt. *///.........这里部分代码省略.........
开发者ID:michalsc,项目名称:AROS,代码行数:101,
示例20: DoRun int DoRun() { // we must ensure that OnExit() is called even if an exception is thrown // from inside ProcessEvents() but we must call it from Exit() in normal // situations because it is supposed to be called synchronously, // wxModalEventLoop depends on this (so we can't just use ON_BLOCK_EXIT or // something similar here) #if wxUSE_EXCEPTIONS for( ; ; ) { try { #endif // wxUSE_EXCEPTIONS // this is the event loop itself for( ; ; ) { // generate and process idle events for as long as we don't // have anything else to do while ( !m_shouldExit && !Pending() && ProcessIdle() ) ; if ( m_shouldExit ) break; // a message came or no more idle processing to do, dispatch // all the pending events and call Dispatch() to wait for the // next message if ( !ProcessEvents() ) { // we got WM_QUIT break; } } // Process the remaining queued messages, both at the level of the // underlying toolkit level (Pending/Dispatch()) and wx level // (Has/ProcessPendingEvents()). // // We do run the risk of never exiting this loop if pending event // handlers endlessly generate new events but they shouldn't do // this in a well-behaved program and we shouldn't just discard the // events we already have, they might be important. for( ; ; ) { bool hasMoreEvents = false; if ( wxTheApp && wxTheApp->HasPendingEvents() ) { wxTheApp->ProcessPendingEvents(); hasMoreEvents = true; } if ( Pending() ) { Dispatch(); hasMoreEvents = true; } if ( !hasMoreEvents ) break; } #if wxUSE_EXCEPTIONS // exit the outer loop as well break; } catch ( ... ) { try { if ( !wxTheApp || !wxTheApp->OnExceptionInMainLoop() ) { OnExit(); break; } //else: continue running the event loop } catch ( ... ) { // OnException() throwed, possibly rethrowing the same // exception again: very good, but we still need OnExit() to // be called OnExit(); throw; } } } #endif // wxUSE_EXCEPTIONS return m_exitcode; }
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:91,
示例21: getenvint MakeMain::Run(int argc, char **argv, char **env){ char *p = getenv("MAKEFLAGS"); if (p) { Variable *v = new Variable("MAKEFLAGS", p, Variable::f_recursive, Variable::o_environ); *VariableContainer::Instance() += v; p = getenv("MAKEOVERRIDES"); if (p) { Variable *v = new Variable("MAKEOVERRIDES", p, Variable::f_recursive, Variable::o_environ); *VariableContainer::Instance() += v; } Eval r(v->GetValue(), false); std::string cmdLine = r.Evaluate(); Dispatch(cmdLine.c_str()); } if (!switchParser.Parse(&argc, argv) || help.GetValue() || help2.GetValue()) { Utils::banner(argv[0]); Utils::usage(argv[0], usageText); } if (dir.GetValue().size()) { cwd = OS::GetWorkingDir(); if (!OS::SetWorkingDir(dir.GetValue())) { std::cout << "Cannot set working dir to: " << dir.GetValue() << std::endl; return 2; } } if (printDir.GetValue()) { std::cout << OS::GetWorkingDir() << std::endl; } if (cancelKeep.GetValue()) { cancelKeep.SetValue(false); keepGoing.SetValue(false); } bool done = false; Eval::Init(); Eval::SetWarnings(warnUndef.GetValue()); while (!done && !Eval::GetErrCount()) { VariableContainer::Instance()->Clear(); RuleContainer::Instance()->Clear(); Include::Instance()->Clear(); Maker::ClearFirstGoal(); LoadEnvironment(env); LoadCmdDefines(); SetVariable("MAKE", argv[0], Variable::o_environ, false); Variable *v = VariableContainer::Instance()->Lookup("SHELL"); if (!v) { v = VariableContainer::Instance()->Lookup("COMSPEC"); if (!v) v = VariableContainer::Instance()->Lookup("ComSpec"); if (v) { std::string val = v->GetValue(); SetVariable("SHELL", val, Variable::o_environ, true); } } std::string goals; for (int i=1; i < argc; i++) { if (goals.size()) goals += " "; goals += argv[i]; } SetVariable("MAKECMDGOALS", goals, Variable::o_command_line, false); SetMakeFlags(); if (restarts) { std::strstream str; std::string temp; str << restarts; str >> temp; SetVariable("MAKE_RESTARTS", temp, Variable::o_command_line, false); } v = VariableContainer::Instance()->Lookup("MAKE_LEVEL"); if (!v) { SetVariable("MAKE_LEVEL", "0", Variable::o_environ, true); } else { std::strstream str; std::string temp; str << v->GetValue(); int n; str >> n; n++; str << n; str >> temp; v->SetValue(temp); } SetVariable(".FEATURES","second-expansion order-only target-specific", Variable::o_environ, false);//.........这里部分代码省略.........
开发者ID:doniexun,项目名称:OrangeC,代码行数:101,
示例22: Dispatch////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Dispatch command//#pragma comment(lib, "ComCtl32.lib")HRESULT Dispatch(PTSTR ptzCmd, CXT& XT){ // Get command ID UINT uCmd; PTSTR p = ptzCmd; for (uCmd = 0; uCmd < _NumOf(c_tzCmd); uCmd++) { if (UStrMatchI(p, c_tzCmd[uCmd]) >= CC_LEN) { // skip white space for (p += CC_LEN; (*p == ' ') || (*p == '/t'); p++); break; } } switch (uCmd) { case CMD_LOAD: return LOAD(p); case CMD_BATC: return BATC(p, XT); case CMD_IFEX: if (*p) { if (PTSTR ptzArg = UStrChr(p, CC_SEP)) { *ptzArg++ = 0; if (IFEX(p)) { Dispatch(ptzArg, XT); } return XT.hXVar; } else if (!IFEX(p)) { if (p = UStrStr(XT.ptzNext, TEXT("IFEX/r/n"))) { XT.ptzNext = p + CC_LEN + 2; return S_OK; } else if (p = UStrStr(XT.ptzNext, TEXT("IFEX/n"))) { XT.ptzNext = p + CC_LEN + 1; return S_OK; } else { XT.ptzNext = TEXT(""); return S_FALSE; } } } return S_OK; case CMD_ELSE: if (!g_bResult) Dispatch(p, XT); return XT.hXVar; case CMD_EVAL: return EVAL(p); case CMD_LINK: return LINK(p); case CMD_FILE: return FILe(p); case CMD_REGX: return REGX(p); case CMD_ENVI: return (*p == '$') ? ENVI(p + 1, TRUE) : ENVI(p); case CMD_SEND: return SEND(p); case CMD_WAIT: Sleep(UStrToInt(p)); return S_OK; case CMD_KILL: return KILL(p); case CMD_SHUT: return SHUT(p); case CMD_PLAY: return PLAY(p); case CMD_BEEP: return !MessageBeep(UStrToInt(p)); case CMD_MSGX: return MSGX(p);//.........这里部分代码省略.........
开发者ID:Yonsm,项目名称:CeleScript,代码行数:101,
示例23: runnableNS_IMETHODIMPWorkletThread::DispatchFromScript(nsIRunnable* aRunnable, uint32_t aFlags){ nsCOMPtr<nsIRunnable> runnable(aRunnable); return Dispatch(runnable.forget(), aFlags);}
开发者ID:heiher,项目名称:gecko-dev,代码行数:6,
示例24: mainintmain(int argc, char *argv[]){ int i, oldumask; argcGlobal = argc; argvGlobal = argv; configfilename = NULL; /* init stuff */ ProcessCmdLine(argc, argv); /* * Do this first thing, to get any options that only take effect at * startup time. It is read again each time the server resets. */ if (ReadConfigFile(configfilename) != FSSuccess) { FatalError("couldn't read config file/n"); } InitErrors(); /* make sure at least world write access is disabled */ if (((oldumask = umask(022)) & 002) == 002) (void)umask(oldumask); SetDaemonState(); SetUserId(); while (1) { serverGeneration++; OsInit(); if (serverGeneration == 1) { /* do first time init */ CreateSockets(OldListenCount, OldListen); InitProcVectors(); clients = (ClientPtr *) fsalloc(MAXCLIENTS * sizeof(ClientPtr)); if (!clients) FatalError("couldn't create client array/n"); for (i = MINCLIENT; i < MAXCLIENTS; i++) clients[i] = NullClient; /* make serverClient */ serverClient = (ClientPtr) fsalloc(sizeof(ClientRec)); if (!serverClient) FatalError("couldn't create server client/n"); } ResetSockets(); /* init per-cycle stuff */ InitClient(serverClient, SERVER_CLIENT, (pointer) 0); clients[SERVER_CLIENT] = serverClient; currentMaxClients = MINCLIENT; currentClient = serverClient; if (!InitClientResources(serverClient)) FatalError("couldn't init server resources/n"); InitAtoms(); InitFonts(); SetConfigValues(); if (!create_connection_block()) FatalError("couldn't create connection block/n");#ifdef DEBUG fprintf(stderr, "Entering Dispatch loop/n");#endif Dispatch();#ifdef DEBUG fprintf(stderr, "Leaving Dispatch loop/n");#endif /* clean up per-cycle stuff */ if ((dispatchException & DE_TERMINATE) || drone_server) break; fsfree(ConnectionInfo); /* note that we're parsing it again, for each time the server resets */ if (ReadConfigFile(configfilename) != FSSuccess) FatalError("couldn't read config file/n"); } CloseSockets(); CloseErrors(); exit(0);}
开发者ID:freedesktop-unofficial-mirror,项目名称:xorg__app__xfs,代码行数:87,
示例25: FLEXT_ASSERTbool VSTPlugin::Instance(const char *name,const char *subname){ bool ok = false; FLEXT_ASSERT(effect == NULL); try {/* if(!ok && dllname != name) { FreePlugin(); // freshly load plugin ok = NewPlugin(name) && InstPlugin(); }*/ ok = NewPlugin(name) && InstPlugin(); if(ok && subname && *subname && Dispatch(effGetPlugCategory) == kPlugCategShell) { // sub plugin-name given -> scan plugs long plugid; char tmp[64]; // Waves5 continues with the next plug after the last loaded // that's not what we want - workaround: swallow all remaining while((plugid = Dispatch(effShellGetNextPlugin,0,0,tmp))) {} // restart from the beginning while((plugid = Dispatch(effShellGetNextPlugin,0,0,tmp))) { // subplug needs a name FLEXT_LOG1("subplug %s",tmp); if(!strcmp(subname,tmp)) // found break; } // re-init with plugid set if(plugid) ok = InstPlugin(plugid); } if(ok) { //init plugin effect->user = this; ok = Dispatch(effOpen) == 0; } if(ok) { ok = Dispatch(effIdentify) == 'NvEf'; } if(ok) { *productname = 0; long ret = Dispatch(effGetProductString,0,0,productname); if(!*productname) { // no product name given by plugin -> extract it from the filename std::string str1(dllname); std::string::size_type slpos = str1.rfind('//'); if(slpos == std::string::npos) { slpos = str1.rfind('/'); if(slpos == std::string::npos) slpos = 0; else ++slpos; } else ++slpos; std::string str2 = str1.substr(slpos); int snip = str2.find('.'); if( snip != std::string::npos ) str1 = str2.substr(0,snip); else str1 = str2; strcpy(productname,str1.c_str()); } if(*productname) { char tmp[512]; sprintf(tmp,"vst~ - %s",productname); title = tmp; } else title = "vst~"; *vendorname = 0; Dispatch(effGetVendorString,0,0,vendorname); } } catch(std::exception &e) { flext::post("vst~ - caught exception while loading plugin: %s",e.what()); ok = false; } catch(...) { flext::post("vst~ - Caught exception while loading plugin"); ok = false; } if(!ok) Free(); return ok;//.........这里部分代码省略.........
开发者ID:Angeldude,项目名称:pd,代码行数:101,
示例26: CreateLiveEditorWorldvoid FLiveEditorManager::Tick(float DeltaTime){ //avoid multiple tick DOOM ( FTickableGameObject's get ticked once per UWorld that is active and Ticking ) float CurTime = GWorld->GetRealTimeSeconds(); if ( LastUpdateTime == CurTime ) { return; } LastUpdateTime = CurTime; if ( LiveEditorWorld == NULL ) { CreateLiveEditorWorld(); } RealWorld = GWorld; check( LiveEditorWorld != NULL ); GWorld = LiveEditorWorld; if ( ActiveBlueprints.Num() > 0 ) LiveEditorWorld->Tick( ELevelTick::LEVELTICK_All, DeltaTime ); // //update our ActiveBlueprints // int32 i = 0; while ( i < ActiveBlueprints.Num() ) { FActiveBlueprintRecord record = ActiveBlueprints[i]; ULiveEditorBlueprint *Instance = record.Blueprint.Get(); if ( Instance == NULL ) { ActiveBlueprints.RemoveAtSwap(i); //clean out the dead entry Activate( record.Name ); //try to ressurect the Blueprint (user has likely just recompiled it) continue; } Instance->Tick( DeltaTime ); ++i; } // // handle the actual MIDI messages // for( TMap< PmDeviceID, FLiveEditorDeviceInstance >::TIterator It(InputConnections); It; ++It ) { PmDeviceID DeviceID = (*It).Key; FLiveEditorDeviceInstance &DeviceInstance = (*It).Value; int NumRead = Pm_Read( DeviceInstance.Connection.MIDIStream, MIDIBuffer, DEFAULT_BUFFER_SIZE ); //needs to remain int (instead of int32) since numbers are derived from TPL that uses int if ( NumRead < 0 ) { continue; //error occurred, portmidi should handle this silently behind the scenes } else if ( NumRead > 0 ) { DeviceInstance.Data.LastInputTime = GWorld->GetTimeSeconds(); } //dispatch for ( int32 BufferIndex = 0; BufferIndex < NumRead; BufferIndex++ ) { PmMessage Msg = MIDIBuffer[BufferIndex].message; int Status = Pm_MessageStatus(Msg); //needs to remain int (instead of int32) since numbers are derived from TPL that uses int int Data1 = Pm_MessageData1(Msg); //needs to remain int (instead of int32) since numbers are derived from TPL that uses int int Data2 = Pm_MessageData2(Msg); //needs to remain int (instead of int32) since numbers are derived from TPL that uses int if ( ActiveWizard != NULL ) { ActiveWizard->ProcessMIDI( Status, Data1, Data2, DeviceID, DeviceInstance.Data ); } else { switch ( DeviceInstance.Data.ConfigState ) { case FLiveEditorDeviceData::UNCONFIGURED: break; case FLiveEditorDeviceData::CONFIGURED: Dispatch( Status, Data1, Data2, DeviceInstance.Data ); break; default: break; } } } } PieObjectCache.EvaluatePendingCreations(); GWorld = RealWorld; RealWorld = NULL;}
开发者ID:Codermay,项目名称:Unreal4,代码行数:90,
示例27: CreateSFMLWindowvoid GraphicsSystem::ApplyWindowChanges(){ CreateSFMLWindow(); Dispatch(Event(EvtWindowResize, WindowResizeEventData(m_Width, m_Height)));}
开发者ID:WhoBrokeTheBuild,项目名称:Dusk2D,代码行数:5,
注:本文中的Dispatch函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DispatchMessage函数代码示例 C++ Dismiss函数代码示例 |