core/src/commands.cpp
changeset 100 706c7a69e448
parent 95 b3ffff030d5c
child 101 048f57d1123c
equal deleted inserted replaced
99:a6fec624de6c 100:706c7a69e448
  3878 	{
  3878 	{
  3879 	if (aError.Error() < 0)
  3879 	if (aError.Error() < 0)
  3880 		{
  3880 		{
  3881 		aError.Report();
  3881 		aError.Report();
  3882 		}
  3882 		}
  3883 
  3883 	IterationComplete(aError.Error());
       
  3884 	}
       
  3885 
       
  3886 void CCmdTime::HandleParserExit(CParser&)
       
  3887 	{
       
  3888 	IterationComplete(KErrNone);
       
  3889 	}
       
  3890 
       
  3891 void CCmdTime::IterationComplete(TInt aError)
       
  3892 	{
  3884 	TUint32 countAfter = iFastCounter ? User::FastCounter() : User::NTickCount();
  3893 	TUint32 countAfter = iFastCounter ? User::FastCounter() : User::NTickCount();
  3885 	
  3894 	
  3886 	TUint64 difference;
  3895 	TUint64 difference;
  3887 	if (iFastCounter)
  3896 	if (iFastCounter)
  3888 		{
  3897 		{
  3936 		else
  3945 		else
  3937 			{
  3946 			{
  3938 			Printf(_L("%Lu\r\n"), difference);
  3947 			Printf(_L("%Lu\r\n"), difference);
  3939 			}
  3948 			}
  3940 		}
  3949 		}
  3941 	if (aError.Error() < 0 || iIteration == iRepeatCount)
  3950 	if (aError < 0 || iIteration == iRepeatCount)
  3942 		{
  3951 		{
  3943 		Complete(aError.Error());
  3952 		Complete(aError);
  3944 		}
  3953 		}
  3945 	else
  3954 	else
  3946 		{
  3955 		{
  3947 		// Rerun the fun
  3956 		// Rerun the fun
  3948 		TRAPD(err, NextIterationL());
  3957 		TRAPD(err, NextIterationL());
  4007 	aOptions.AppendIntL(iWaitTime, KOptWait);
  4016 	aOptions.AppendIntL(iWaitTime, KOptWait);
  4008 	}
  4017 	}
  4009 
  4018 
  4010 void CCmdRepeat::HandleParserComplete(CParser&, const TError& aError)
  4019 void CCmdRepeat::HandleParserComplete(CParser&, const TError& aError)
  4011 	{
  4020 	{
  4012 	TRAPD(err, HandleParserCompleteL(aError));
  4021 	if (aError.Error() < 0)
       
  4022 		{
       
  4023 		aError.Report();
       
  4024 		}
       
  4025 	TRAPD(err, HandleParserCompleteL(aError.Error()));
  4013 	if (err)
  4026 	if (err)
  4014 		{
  4027 		{
  4015 		Complete(err);
  4028 		Complete(err);
  4016 		}
  4029 		}
  4017 	}
  4030 	}
  4018 
  4031 
  4019 void CCmdRepeat::HandleParserCompleteL(const TError& aError)
  4032 void CCmdRepeat::HandleParserExit(CParser&)
  4020 	{
  4033 	{
  4021 	if (aError.Error() < 0)
  4034 	TRAPD(err, HandleParserCompleteL(KErrNone));
  4022 		{
  4035 	if (err)
  4023 		aError.Report();
  4036 		{
  4024 		}
  4037 		Complete(err);
  4025 
  4038 		}
  4026 	if (((aError.Error() == KErrNone) || iKeepGoing) && ((++iCount < iNumRepeats) || iForever))
  4039 	}
       
  4040 
       
  4041 void CCmdRepeat::HandleParserCompleteL(TInt aError)
       
  4042 	{
       
  4043 	if (((aError == KErrNone) || iKeepGoing) && ((++iCount < iNumRepeats) || iForever))
  4027 		{
  4044 		{
  4028 		delete iParser;
  4045 		delete iParser;
  4029 		iParser = NULL;
  4046 		iParser = NULL;
  4030 		if (iWaitTime) User::After(iWaitTime * 1000);
  4047 		if (iWaitTime) User::After(iWaitTime * 1000);
  4031 		CreateParserL();
  4048 		CreateParserL();
  4032 		}
  4049 		}
  4033 	else
  4050 	else
  4034 		{
  4051 		{
  4035 		Complete(aError.Error());
  4052 		Complete(aError);
  4036 		}
  4053 		}
  4037 	}
  4054 	}
  4038 
  4055 
  4039 void CCmdRepeat::CreateParserL()
  4056 void CCmdRepeat::CreateParserL()
  4040 	{
  4057 	{
  6181 		{
  6198 		{
  6182 		aError.Report();
  6199 		aError.Report();
  6183 		PrintError(err, _L("Aborted \"%S\" at line %d"), &aError.ScriptFileName(), aError.ScriptLineNumber());
  6200 		PrintError(err, _L("Aborted \"%S\" at line %d"), &aError.ScriptFileName(), aError.ScriptLineNumber());
  6184 		iLastError = err;
  6201 		iLastError = err;
  6185 		}
  6202 		}
  6186 
  6203 	IterationComplete(err);
  6187 	if ((err < 0) && !iKeepGoing)
  6204 	}
       
  6205 
       
  6206 void CCmdForEach::HandleParserExit(CParser&)
       
  6207 	{
       
  6208 	IterationComplete(KErrNone);
       
  6209 	}
       
  6210 
       
  6211 void CCmdForEach::IterationComplete(TInt aError)
       
  6212 	{
       
  6213 	if ((aError < 0) && !iKeepGoing)
  6188 		{
  6214 		{
  6189 		Complete(iLastError);
  6215 		Complete(iLastError);
  6190 		}
  6216 		}
  6191 	else
  6217 	else
  6192 		{
  6218 		{