41 _LIT(KNewLine3, "\r\n"); |
41 _LIT(KNewLine3, "\r\n"); |
42 _LIT(KNewLine4, "\n\r"); |
42 _LIT(KNewLine4, "\n\r"); |
43 _LIT(KSemicolon, ";"); |
43 _LIT(KSemicolon, ";"); |
44 _LIT(KDollar, "$"); |
44 _LIT(KDollar, "$"); |
45 |
45 |
|
46 |
|
47 void MParserObserver::HandleParserExit(CParser&) |
|
48 { |
|
49 CActiveScheduler::Stop(); |
|
50 } |
46 |
51 |
47 void MParserObserver::AboutToExecuteLine(const TDesC&, const TDesC&) |
52 void MParserObserver::AboutToExecuteLine(const TDesC&, const TDesC&) |
48 { |
53 { |
49 } |
54 } |
50 |
55 |
486 { |
491 { |
487 // Special case the handling of 'exit'. This allows the concept of 'local commands' (i.e. commands that run in either fshell's main |
492 // Special case the handling of 'exit'. This allows the concept of 'local commands' (i.e. commands that run in either fshell's main |
488 // thread or in the thread belonging to a 'source' or 'debug' command) to be dropped. That's a good thing, because local commands |
493 // thread or in the thread belonging to a 'source' or 'debug' command) to be dropped. That's a good thing, because local commands |
489 // can't synchronously interact with iosrv without risk of deadlock when two or more thread commands are run in a pipe-line. |
494 // can't synchronously interact with iosrv without risk of deadlock when two or more thread commands are run in a pipe-line. |
490 CleanupStack::PopAndDestroy(2, &pipeSections); |
495 CleanupStack::PopAndDestroy(2, &pipeSections); |
491 if (CActiveScheduler::Current()->StackDepth() > 0) |
496 iExitCallBack = new(ELeave) CAsyncCallBack(TCallBack(ExitCallBack, this), CActive::EPriorityStandard); |
492 { |
497 iExitCallBack->Call(); |
493 CActiveScheduler::Stop(); |
|
494 } |
|
495 else |
|
496 { |
|
497 // The active scheduler hasn't been started yet. Probably because someone is doing something crazy like 'fshell -e exit'. |
|
498 iExitCallBack = new(ELeave) CAsyncCallBack(TCallBack(ExitCallBack, this), CActive::EPriorityStandard); |
|
499 iExitCallBack->Call(); |
|
500 } |
|
501 } |
498 } |
502 else |
499 else |
503 { |
500 { |
504 pipeSection.iFullName.Set(iLexer2->Ptr() + offset, iLexer2->CurrentOffset() - offset); |
501 pipeSection.iFullName.Set(iLexer2->Ptr() + offset, iLexer2->CurrentOffset() - offset); |
505 User::LeaveIfError(pipeSections.Append(pipeSection)); |
502 User::LeaveIfError(pipeSections.Append(pipeSection)); |
817 CParser* self = static_cast<CParser*>(aSelf); |
814 CParser* self = static_cast<CParser*>(aSelf); |
818 self->CreateNextPipeLine(NULL); |
815 self->CreateNextPipeLine(NULL); |
819 return KErrNone; |
816 return KErrNone; |
820 } |
817 } |
821 |
818 |
822 TInt CParser::ExitCallBack(TAny*) |
819 TInt CParser::ExitCallBack(TAny* aSelf) |
823 { |
820 { |
824 CActiveScheduler::Stop(); |
821 CParser* self = static_cast<CParser*>(aSelf); |
|
822 self->iObserver->HandleParserExit(*self); |
825 return KErrNone; |
823 return KErrNone; |
826 } |
824 } |
827 |
825 |
828 void CParser::HandlePipeLineComplete(CPipeLine& aPipeLine, const TError& aError) |
826 void CParser::HandlePipeLineComplete(CPipeLine& aPipeLine, const TError& aError) |
829 { |
827 { |