void CCmdCifTest::TestCifL(CCommandInfoFile* aCif) { iCurrentCif = aCif; if (iVerbose) Printf(_L("Checking %S\r\n"), &aCif->CifFileName()); const TDesC& scriptData = aCif->SmokeTest(); if (scriptData.Length() == 0) { if (iVerbose) Printf(_L("Cif has no smoketest section\r\n")); TestCompleted(KErrNone); return; } iEnvForScript = CEnvironment::NewL(Env()); iEnvForScript->SetL(_L("Error"), _L("fshell -e 'echo \"Test failed, env is:\" && env && error'")); iEnvForScript->SetL(_L("Quiet"), _L(">/dev/null")); iEnvForScript->SetL(_L("Silent"), _L("2>&1 >/dev/null")); iEnvForScript->Remove(_L("Verbose")); // In case it's ended up in our parent env if (iVerbose) iEnvForScript->SetL(_L("Verbose"), 1); iFileName.Copy(aCif->CifFileName()); iFileName.Append(_L(":smoke-test")); TParsePtrC parse(iFileName); iEnvForScript->SetL(KScriptName, parse.NameAndExt()); iEnvForScript->SetL(KScriptPath, parse.DriveAndPath()); iEnvForScript->SetL(_L("0"), iFileName); iParser = CParser::NewL(CParser::EExportLineNumbers, scriptData, IoSession(), Stdin(), Stdout(), Stderr(), *iEnvForScript, gShell->CommandFactory(), this, aCif->GetSmokeTestStartingLineNumber()); iParser->Start(); }
/*----------------------------------------------------------------------+*/ SPC_fd_to_connector(SPC_Channel_Ptr channel, int fd) /*----------------------------------------------------------------------+*/ { if(Stdout(channel) == fd) return(STDOUT); if(Stdin(channel) == fd) return(STDIN); if(Stderr(channel) == fd) return(STDERR); return(ERROR); }
int main (int argc, char**argv) { // The worlds most useless user interface Widget top_level = XtVaAppInitialize (NULL, "buttontest", NULL, 0, &argc, argv, NULL, NULL); Widget button = XmCreatePushButton (top_level, "change", 0, 0); XtManageChild (button); XtAddCallback (button, XmNactivateCallback, ActivateCB, NULL); // A reactor beastie. ACE_XtReactor xreactor (XtWidgetToApplicationContext (top_level)); ACE_Reactor reactor (&xreactor); // Print a message when data is recv'd on stdin... ACE_Event_Handler *stdin_; ACE_NEW_RETURN (stdin_, Stdin (new Stdout (&reactor)), -1); reactor.register_handler (stdin_, ACE_Event_Handler::READ_MASK); // Print a message every 10 seconds. if (reactor.schedule_timer (stdin_, 0, ACE_Time_Value (10), ACE_Time_Value (10)) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); // Show the top_level widget. XtRealizeWidget (top_level); // Demonstrate Reactor/Xt event loop unification. XtAppMainLoop (XtWidgetToApplicationContext (top_level)); return 0; }
void CCmdUndertaker::DoRunL() { User::LeaveIfError(iUndertaker.Create()); if (iParanoid) { User::LeaveIfError(iMainThread.Open(RThread().Id())); User::LeaveIfError(iLock.CreateLocal()); iHandles.ReserveL(10); TFullName threadName(RThread().Name()); threadName.Append(_L("_worker")); LeaveIfErr(iWorkerThread.Create(threadName, &WorkerThreadFn, 8192, NULL, this), _L("Couldn't create worker thread")); #ifdef FSHELL_MEMORY_ACCESS_SUPPORT LoadMemoryAccessL(); LeaveIfErr(iMemAccess.SetThreadPriority(iWorkerThread, 31), _L("Couldn't set worker thread priority with memoryaccess")); #else iWorkerThread.SetPriority(EPriorityMuchMore); // Best we can do #endif iWorkerThread.Resume(); } else { User::LeaveIfError(Queue()); } if (Stdin().IsForeground() > 0) { Write(iAll ? _L("Waiting for any thread exit...\r\n") : _L("Waiting for panicked thread exit...\r\n")); } if (iParanoid) { // We've spawned off our worker thread, which is the client of the RUndertaker. We now wait for it to signal us back again. // It's easier to balance the requests if we don't go through the active scheduler (so long as nothing else signals this thread!) for (;;) { User::WaitForRequest(iMainThreadStat); if (iMainThreadStat.Int() != KErrNone) User::Leave(iMainThreadStat.Int()); iLock.Wait(); TInt handle = iHandles[0]; iHandles.Remove(0); iLock.Signal(); ProcessHandle(handle); } } }
retCode setupDebugChannels() { if (debuggerPort > 0 && debugInChnnl == Null) { if (debuggerListener == Null) { debuggerListener = listeningPort("star-debug", debuggerPort); showPkgFile = True; retCode ret = acceptConnection(debuggerListener, utf8Encoding, &debugInChnnl, &debugOutChnnl); if (ret != Ok) { syserr("fatal problem in establishing debugger connection"); } return ret; } } else if (debugInChnnl == Null) { debugInChnnl = Stdin(); debugOutChnnl = Stdout(); return Ok; } return Error; }
void CCmdCat::DoRunL() { if (iBinary) { if (iOptions.IsPresent(&iEncoding)) { PrintWarning(_L("--encoding overrides legacy --binary option")); } else { iEncoding = EBinary; } } if (iEncoding == EBinary || iEncoding == ELtkUtf8 || iFiles.Count() == 0) { iBuf16.CreateL(iBlockSize); } else { TUint charset; switch (iEncoding) { case EUtf8: charset = KCharacterSetIdentifierUtf8; break; case ELatin1: charset = KCharacterSetIdentifierIso88591; break; case EAuto: default: charset = 0; break; } TRAPL(iCharacterConverter = CCharacterConverter::NewL(iBlockSize, FsL(), charset), _L("Couldn't load charconv - try using --binary mode")); } iFileReader = CFileReader::NewL(iBlockSize, FsL(), iForce); if (iFiles.Count() > 0) { ReadNextFile(); } else { TInt err = KErrNone; while (err == KErrNone) { err = Stdin().Read(iBuf16); if (err == KErrNone) { Write(iBuf16); } } if (err == KErrEof) { err = KErrNone; } Complete(err); } }