Exemplo n.º 1
0
/**
Cancels any outstanding request, based on the state of the active object.
*/
void CSsmSwpPolicyServer::CSsmSwpPolicyStepCompletion::DoCancel()
	{
	switch(iStep)
		{
		case EInitialize:
			{
			DEBUGPRINT1(_L("CSsmSwpPolicyStepCompletion: Cancelled the Initization of SwpPolicy"));
			iSwpPolicy->InitializeCancel();
			iMessagePtr.Complete(KErrCancel);
			break;
			}
		case EPrepareCommandList:
			{
			DEBUGPRINT1(_L("CSsmSwpPolicyStepCompletion: Cancelled the Preparation of the commandlist"));
			iSwpPolicy->PrepareCommandListCancel();
			iMessagePtr.Complete(KErrCancel);
			break;
			}
		case EHandleCleReturnValue:
			{
			DEBUGPRINT1(_L("CSsmSwpPolicyStepCompletion: Cancelled the HandleCleReturnValue"));
			iSwpPolicy->HandleCleReturnValueCancel();
			iMessagePtr.Complete(KErrCancel);
			break;
			}
		default:
			{
			break;
			}
		};
	}
Exemplo n.º 2
0
/**
Iterate through iSessionInfoArray to find an unused array element
If found, use it. Otherwise, Append() a new SSwpPolicySessionInfo.
This function is called during CSession construction.
*/
void CSsmSwpPolicyServer::RegisterSessionL(TInt& aSessionIndex)
	{
	const TInt count = iSessionInfoArray.Count();
	TBool slotFound = EFalse;
	
	for(TInt i = 0; i < count; ++i)
		{
		if(!iSessionInfoArray[i].iInUse)
			{
			DEBUGPRINT1(_L("CSsmSwpPolicyServer: Using the free slot of the sessionarray"));
			iSessionInfoArray[i].iInUse = ETrue;
			__ASSERT_ALWAYS(NULL, iSessionInfoArray[i].iSwpPolicy);
			aSessionIndex = i;
			slotFound = ETrue;
			break;
			}
		}
	
	if(!slotFound)
		{
		DEBUGPRINT1(_L("CSsmSwpPolicyServer: No free slot found, so appending a new member to the sessionarray"));
		SSwpPolicySessionInfo sessionInfo;
		sessionInfo.iInUse = ETrue;
		sessionInfo.iSwpPolicy = NULL;
		sessionInfo.iSsmSwpPolicyStepCompletion = NULL;
		iSessionInfoArray.AppendL(sessionInfo);
		// using count instead of iSessionInfoArray.Count()-1 as it is set before appending the element to the array,
		// and its value is equal to iSessionInfoArray.Count()-1
		aSessionIndex = count;
		}
	DEBUGPRINT2(_L("Registered SsmSwpPolicyCli in slot %d"), aSessionIndex);
	}
Exemplo n.º 3
0
cJSON*
jsonReadFile(std::string fname, std::string& err)
{
	std::ifstream f;
	err = "";

	f.open(fname.c_str());
	if ( ! f.good() ) {
		err = NosuchSnprintf("No config file: %s\n",fname.c_str());
		return NULL;
	}
	DEBUGPRINT(("Loading config=%s\n",fname.c_str()));
	std::string line;
	std::string jstr;
	while ( getline(f,line) ) {
		// Delete anything after a # (i.e. comments)
		std::string::size_type pound = line.find("#");
		if ( pound != line.npos ) {
			line = line.substr(0,pound);
		}
		if ( line.find_last_not_of(" \t\n") == line.npos ) {
			DEBUGPRINT1(("Ignoring blank/comment line=%s\n",line.c_str()));
			continue;
		}
		jstr += line;
	}
	f.close();
	cJSON* json = cJSON_Parse(jstr.c_str());
	if ( ! json ) {
		err = NosuchSnprintf("Unable to parse json for config!?  json= %s\n",jstr.c_str());
	}
	return json;
}
Exemplo n.º 4
0
/**
Cancels the HandleCleReturnValue, if any HandleCleReturnValue request is pending.
*/
void CSsmSwpPolicyServer::CallHandleCleReturnValueCancel(TInt aSessionIndex)
	{
	DEBUGPRINT1(_L("CSsmSwpPolicyServer: CallHandleCleReturnValueCancel"));
	__ASSERT_DEBUG(IN_RANGE(aSessionIndex, iSessionInfoArray.Count()), PanicNow(KSsmSwpPolicyBadIdx, KSsmSwpPolicySrvArrayIndexInvalid));
	__ASSERT_DEBUG(iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion != NULL, PanicNow(KSsmSwpPolicyServer, ESsmSwpPolicyServerError6));

	// CSsmSwpPolicyFrame checks whether initialize is called before cancelling the initialization, so no need to check
	// for valid iSsmSwpPolicyStepCompletion pointer.
	// iSessionInfoArray[aSessionIndex].iMessagePtr will be completed in CSsmSwpPolicyStepCompletion's DoCancel method.
	iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion->Cancel();
	
	DEBUGPRINT1(_L("CSsmSwpPolicyServer: Deleted the session info as HandleCleReturnValue is cancelled"));
	// In order to avoid the memory leak we have to delete the session info as this swp transition is cancelled, 
	// and the same session can be used for the next similar swp transition.
	DeleteSSwpPolicySessionInfo(aSessionIndex);
	}
Exemplo n.º 5
0
/**
Gets the dll handle to SwpPolicy and initializes the SwpPolicy
*/
void CSsmSwpPolicyServer::CallSetDllHandleAndInitializeL(const RMessage2& aMessage, const TInt aSessionIndex)
	{
	__ASSERT_DEBUG(IN_RANGE(aSessionIndex, iSessionInfoArray.Count()), PanicNow(KSsmSwpPolicyBadIdx, KSsmSwpPolicySrvArrayIndexInvalid));

	RLibrary library;
	// Sets the swp policy library handle.  Library is owned by the CSsmSwpRequestHandler.
	library.SetHandle(aMessage.Int0());

	DEBUGPRINT1(_L("CSsmSwpPolicyServer: SwpPolicy handle is set"));
	iSessionInfoArray[aSessionIndex].iSwpPolicy = reinterpret_cast<MSsmSwpPolicy*>(library.Lookup(1)());

	DEBUGPRINT1(_L("CSsmSwpPolicyServer: Create CSsmSwpPolicyStepCompletion active object"));
	iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion = CSsmSwpPolicyStepCompletion::NewL(iSessionInfoArray[aSessionIndex].iSwpPolicy, *this, aSessionIndex);

	// aMessage will be completed in CSsmSwpPolicyStepCompletion's RunL method,
	// when the Initialization of the swp policy is completed.
	iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion->StartInitialize(aMessage);
	}
Exemplo n.º 6
0
/**
This method is used to delete the session information once the swp transition is complete.
This is required as the same session can be used for more than one individual swp transition.
*/
void CSsmSwpPolicyServer::DeleteSSwpPolicySessionInfo(TInt aSessionIndex)
	{
	__ASSERT_DEBUG(IN_RANGE(aSessionIndex, iSessionInfoArray.Count()), PanicNow(KSsmSwpPolicyBadIdx, KSsmSwpPolicySrvArrayIndexInvalid));

	DEBUGPRINT1(_L("CSsmSwpPolicyServer: Deletes the SwpPolicySession information."));
	if(iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion)
		{
		delete iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion;
		iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion = NULL;
		}

	if(iSessionInfoArray[aSessionIndex].iSwpPolicy)
		{
		DEBUGPRINT1(_L("CSsmSwpPolicyServer: Releases the SwpPolicy"));
		(iSessionInfoArray[aSessionIndex].iSwpPolicy)->Release();
		iSessionInfoArray[aSessionIndex].iSwpPolicy = NULL;
		}
	}
Exemplo n.º 7
0
/** 
Mark a buffer as waiting for update and add to waiting list, return ETrue 
if rescheduled is needed (i.e. head of waiting list has changed and the list wasn't empty) */
TBool CRendererBufferManager::UpdateBuffer(TVideoFrameBuffer* aBuffer, const TTime& aTime)
	{
	Lock();
	
	TBool headChanged = EFalse;
	if (BufferUsedByClient(aBuffer))
		{
		aBuffer->SetBufferStatus(TVideoFrameBuffer::EWaiting);
		aBuffer->SetPresentationTime(aTime);
		
		// add buffer to waiting buffer list according to presentation time
		if (iWaitingBuffers.IsEmpty())
			{
			iWaitingBuffers.AddLast(*aBuffer);
			}
		else
			{
			TVideoFrameBuffer* buf = iWaitingBuffers.Last();
			if (aTime >= buf->PresentationTime())
				{
				iWaitingBuffers.AddLast(*aBuffer);
				}
			else
				{
				// client tried to insert a older frame, search for the right position to insert
				iWaitingBuffersIter.SetToFirst();
				while ((buf = iWaitingBuffersIter++) != NULL)
					{
					if (aTime < buf->PresentationTime())
						{
						// Found the slot
						if (iWaitingBuffers.IsFirst(buf))
							{
							iWaitingBuffers.AddFirst(*aBuffer);
							headChanged = ETrue;
							}
						else
							{
							aBuffer->DblQueLink().AddBefore(&(buf->DblQueLink()));
							}
						}
					}
				}
			}
		}
	else
		{
		DEBUGPRINT1(_L("CRendererBufferManager::UpdateBuffer receive buffer not usable by client"));
		__ASSERT_DEBUG(EFalse, User::Panic(_L("CRBM::UpdateBuf"), KErrBadHandle));
		}
	
	Unlock();
	
	return headChanged;
	}
void CSsmSwpPolicyResolver::DeRegisterSwpMappingL(TUint aSwpKey, const TDesC& aFilename)
	{
	SSMLOGLEAVEIFNULL(iSwpPolicyMap);
	DEBUGPRINT3(_L("CSsmSwpPolicyResolver::DeRegisterSwpMappingL swp %d file %S"), aSwpKey, &aFilename);
	if(aFilename.Length() > KMaxFileName)
		{
		DEBUGPRINT1(_L("Filename too long"));
		SSMLOGLEAVE(KErrArgument); //lint !e527 Suppress Unreachable. Lint is just confused by macro, warning goes away when code in macro gets expanded
		}
	iSwpPolicyMap->DeleteSwpMapL(aSwpKey);
	}
void CSsmStatePolicyFrame::ConstructL(TLibraryFunction aNewLFunc)
	{
	TFuncStateNewL newL = reinterpret_cast<TFuncStateNewL>( aNewLFunc );
	iStatePolicy = newL();
#ifdef _DEBUG
	if(!iStatePolicy)
		{
		DEBUGPRINT1(_L("First function in State Policy DLL didn't create a new instance"));
		}
#endif
	SSMLOGLEAVEIFNULL(iStatePolicy);
	}
Exemplo n.º 10
0
/**
Used to create a new server-side session.
@return A pointer to the new instance of CSession2.
@leave KErrNotSupported if versions are incompatible.
*/
EXPORT_C CSession2* CSsmSwpPolicyServer::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const
	{
	TVersion version(KSsmSwpPolicySrvVersionMajor, KSsmSwpPolicySrvVersionMinor, KSsmSwpPolicySrvVersionBuild);

	if(!User::QueryVersionSupported(version, aVersion))
		{
		DEBUGPRINT1(_L("CSsmSwpPolicyServer: Server version not supported"));
		User::Leave(KErrNotSupported);
		}

	CSsmSwpPolicyServer& mutatedSelf = const_cast< CSsmSwpPolicyServer& >(*this);
	return CSsmSwpPolicySession::NewL(mutatedSelf); 
	}
void CSsmCommandListResourceReaderImpl::CInitialiser::ParseFileL(CResourceFile* aResourceFile)
	{
	// read root resource
	RResourceReader rootReader;
	const TInt KRootResourceId = 1;
	rootReader.OpenLC(aResourceFile, KRootResourceId);
	const TSsmResourceVersion version = static_cast<TSsmResourceVersion>(rootReader.ReadInt16L());
	if (version != ESsmInitialVersion)
		{
		SSMLOGLEAVE(KErrNotSupported);
		}
	const TInt reserved1 = rootReader.ReadInt16L(); // skip SSM_COMMAND_LIST_ROOT.reserved1
	const TInt commandListMappingResourceId = rootReader.ReadInt32L();
	if (commandListMappingResourceId <= 0)
		{
		DEBUGPRINT1(_L("Command list resource file contains no mappings"));
		SSMLOGLEAVE(KErrNotFound);
		}
	CleanupStack::PopAndDestroy(&rootReader);

	// read mapping resource
	RResourceReader mappingReader;
	mappingReader.OpenLC(aResourceFile, commandListMappingResourceId);
	const TInt mappingCount = mappingReader.ReadInt16L();
	if (!mappingCount)
		{
		DEBUGPRINT1(_L("Command list resource file contains no mappings"));
		SSMLOGLEAVE(KErrNotFound);
		}
	for (TInt i = 0; i < mappingCount; i++)
		{
		// add each mapping to the pool
		TUint commandListId = mappingReader.ReadUint32L();
		TInt resourceId = mappingReader.ReadInt32L();
		TMapping mapping(commandListId, resourceId, aResourceFile);
		iResourcePool.AppendL(mapping);
		}
	CleanupStack::PopAndDestroy(&mappingReader);
	}
NosuchException::NosuchException( const char *fmt, ...) {
	_msg = NosuchExceptionBuffer;
	va_list args;

	va_start(args, fmt);
	vsnprintf_s(_msg,EXCEPTION_BUFFER_SIZE,EXCEPTION_BUFFER_SIZE,fmt,args);

	size_t lng = strlen(_msg);
	if ( lng > 0 && _msg[lng-1] == '\n' )
		_msg[lng-1] = '\0';

	DEBUGPRINT1(("NosuchException constructor - %s",_msg));

	va_end(args);
}
Exemplo n.º 13
0
/**
Returns the commandlist to the client from swppolicy.
@return A pointer to commandlist.
*/
void CSsmSwpPolicyServer::CallCommandListL(const RMessage2& aMessage, TInt aSessionIndex)
	{
	DEBUGPRINT1(_L("CSsmSwpPolicyServer: CallCommandListL"));
	__ASSERT_DEBUG(IN_RANGE(aSessionIndex, iSessionInfoArray.Count()), PanicNow(KSsmSwpPolicyBadIdx, KSsmSwpPolicySrvArrayIndexInvalid));
	__ASSERT_DEBUG(iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion != NULL, PanicNow(KSsmSwpPolicyServer, ESsmSwpPolicyServerError4));
		// CommandList should be called only after preparing the command list, so the active object state should be EPrepareCommandList.
	__ASSERT_DEBUG(iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion->CurrentStep() == CSsmSwpPolicyServer::CSsmSwpPolicyStepCompletion::EPrepareCommandList, 
			PanicNow(KSsmSwpPolicyServer, ESsmSwpPolicySrvStepError3));
	
	// CSsmSwpPolicyFrame checks whether initialize is called before CallCommandList is called, so no need to check
	// for valid iSsmSwpPolicyStepCompletion pointer.
	// Sets the current step to CallCommandList
	iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion->SetCurrentStep(CSsmSwpPolicyServer::CSsmSwpPolicyStepCompletion::ECallCommandList);
	CSsmCommandList* ssmCmdList = (iSessionInfoArray[aSessionIndex].iSwpPolicy)->CommandList();
	CleanupStack::PushL(ssmCmdList);
	CBufFlat* buf = CBufFlat::NewL(KSsmSwpPolicyStreamBufMaxSize);
	CleanupStack::PushL(buf);
	
	RBufWriteStream writeStream(*buf);
	CleanupClosePushL(writeStream);
	
	DEBUGPRINT1(_L("CSsmSwpPolicyServer: Externalizes the commandlist"));
	ssmCmdList->ExternalizeL(writeStream);

	// Ensure any memory that might already have been allocated  is disposed of. 
	// Transfer the streamed cmd list from the CBuf.
	RBuf8 cmdListBuf;
	cmdListBuf.CreateL(buf->Size());
	CleanupClosePushL(cmdListBuf);	
	buf->Read(0, cmdListBuf);
	
	aMessage.WriteL(0, cmdListBuf);
	
	aMessage.Complete(KErrNone);
	CleanupStack::PopAndDestroy(4, ssmCmdList);	//	buf, writeStream and cmdListBuf
	}
Exemplo n.º 14
0
/**
Prepares the commandlist in swppolicy
*/
void CSsmSwpPolicyServer::CallPrepareCommandListL(const RMessage2& aMessage, TInt aSessionIndex)
	{
	DEBUGPRINT1(_L("CSsmSwpPolicyServer: Call SwpPolicy's PrepareCommandList "));
	__ASSERT_DEBUG(IN_RANGE(aSessionIndex, iSessionInfoArray.Count()), PanicNow(KSsmSwpPolicyBadIdx, KSsmSwpPolicySrvArrayIndexInvalid));
	__ASSERT_DEBUG(iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion != NULL, PanicNow(KSsmSwpPolicyServer, ESsmSwpPolicyServerError2));

	TSsmSwp ssmSwp(0,0);
	TPckg<TSsmSwp> swpBuf(ssmSwp);
    aMessage.ReadL(0, swpBuf);

	// CSsmSwpPolicyFrame checks whether initialize is called before CallHandleCleReturnValue is called, so no need to check
	// for valid iSsmSwpPolicyStepCompletion pointer.

	// aMessage will be completed in CSsmSwpPolicyStepCompletion's RunL method,
	// when the preparation of the commandlist is completed.
	iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion->StartPrepareCommandList(ssmSwp, aMessage);
	}
Exemplo n.º 15
0
static int getbufscale()
{
   char		*memsize_cptr;	/* character pointer to "memsize" */
   int		bufval,
		res;

   if ( (memsize_cptr = getenv("memsize")) == NULL)
   {
      bufval = MINMEMSIZE;
   }
   else
   {
      bufval = atoi(memsize_cptr);
      if (bufval < MINMEMSIZE)
         bufval = MINMEMSIZE;
   }
   DEBUGPRINT1("The system has %d MBytes of physical memory.\n", bufval);

   bufval /= 4;    /* convert to units of 4 Mbytes */

/***********************************
*  "bufval" must be a power of 2.  *
***********************************/

   if (bufval <= 1)
   {
      bufval = 1;
   }
   else
   {
      res = 1;
      while (res < bufval)
         res *= 2;
      if (res > bufval)
      {
         bufval = res/2;
      }
      else
      {
         bufval = res;
      }
   }

   return(bufval);
}
Exemplo n.º 16
0
void loadffglplugindef(std::string ffgldir, std::string dllnm)
{
	FFGLPluginDef *plugin = FFGLPluginDef::NewPluginDef();
	std::string dll_fname = ffgldir + "/" + dllnm;

	const char *dll = dll_fname.c_str();
	if (plugin->Load(dll) == FF_FAIL) {
		DEBUGPRINT(("Unable to load %s\n", dll));
	}
	else {
		plugin->m_dll = dllnm;
		plugin->name = plugin->GetPluginName();
		DEBUGPRINT1(("Loaded FFGL plugin file=%s name=%s", dll, plugin->name.c_str()));
		ffglplugindefs[nffglplugindefs] = plugin;
		nffglplugindefs++;
	}
	return;
}
Exemplo n.º 17
0
/**
Handles the value returned by Cle.
*/
void CSsmSwpPolicyServer::CallHandleCleReturnValueL(const RMessage2& aMessage, TInt aSessionIndex)
	{
	DEBUGPRINT1(_L("CSsmSwpPolicyServer: CallHandleCleReturnValueL"));
	__ASSERT_DEBUG(IN_RANGE(aSessionIndex, iSessionInfoArray.Count()), PanicNow(KSsmSwpPolicyBadIdx, KSsmSwpPolicySrvArrayIndexInvalid));
	__ASSERT_DEBUG(iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion != NULL, PanicNow(KSsmSwpPolicyServer, ESsmSwpPolicyServerError5));

	TSsmSwp ssmSwp(0,0);
	TPckg<TSsmSwp> swpBuf(ssmSwp);
	aMessage.ReadL(0, swpBuf);

	const TInt error = aMessage.Int1();
	const TInt severity = aMessage.Int2();

	// CSsmSwpPolicyFrame checks whether initialize is called before CallHandleCleReturnValue is called, so no need to check
	// for valid iSsmSwpPolicyStepCompletion pointer.

	// aMessage will be completed in CSsmSwpPolicyStepCompletion's RunL method,
	// when the cle's return value is handled by the swppolicy.
	(iSessionInfoArray[aSessionIndex].iSsmSwpPolicyStepCompletion)->StartHandleCleReturnValue(ssmSwp, error, severity, aMessage);
	}
Exemplo n.º 18
0
Region::Region(Palette* p, int i) {

	spritelist = new VizSpriteList();
	DEBUGPRINT1(("Region constructor i=%d spritelist=%ld",i,(long)spritelist));

	id = i;
	name = "";
	setTypeAndSid(UNKNOWN, 0, 0);

	_disableNotes = false;

	_palette = p;
	_lastScheduled = -1;
	_chording = false;

	NosuchLockInit(&_region_mutex,"region");

	_latestNoteTime = 0;
	x_min = 0.000f;  // Used to be 0.001f, not sure why
	y_min = 0.000f;  // Used to be 0.001f, not sure why
	x_max = 1.000f;  // Used to be 0.999f, not sure why
	y_max = 1.000f;  // Used to be 0.999f, not sure why
	_channel = -1;

	_regionParams = new AllVizParams(true);  // loads defaults
	// _regionSpecificParams = NULL;

	PaletteHost* ph = p->paletteHost();
	// _graphicBehaviour = ph->makeGraphicBehaviour(this);
	_graphicBehaviour = new GraphicBehaviour(this);
	_musicBehaviour = new MusicBehaviour(this);

	numalive = 0;
	debugcount = 0;
	last_tm = 0;
	leftover_tm = 0;
	// fire_period = 10;  // milliseconds
	fire_period = 1;  // milliseconds
	onoff = 0;
}
/** 
Determines if an incoming startup state transition request should be accepted or rejected.
Clients calling this API should posess 'ECapabilityPowerMgmt', else the API will return ENotAllowed.

@param aRequest Contains information about the new request
@param aCurrent Contains NULL or the first accepted but not yet completed transition request
@param aQueued Contains NULL or a second accepted but not yet started transition request
@param aMessage Message sent by SSM server, used to check if the client has 'ECapabilityPowerMgmt'

@return one of the TResponse value
@see MSsmStatePolicy::TransitionAllowed
@see MSsmStatePolicy::TResponse
*/
MSsmStatePolicy::TResponse CGsaStatePolicyStartup::TransitionAllowed(const TSsmStateTransition& aRequest, TSsmStateTransition const* aCurrent, 
																TSsmStateTransition const* aQueued, const RMessagePtr2& aMessage)
	{
	TResponse response = ENotAllowed;
	if (!aMessage.HasCapability(ECapabilityPowerMgmt))
		{
		DEBUGPRINT1(_L ("Startup Policy : Capability Check Failed."));
		return response;
		}

	//Check if the requested transition is supported from current state
	if(TransitionSupported(aRequest.State()))
		{
		if((NULL == aCurrent) && (NULL == aQueued))
			{
			// SsmServer is idle
			response = EDefinitelyAllowed;
			}
		else if((aRequest.State().MainState() == ESsmFail) || (aRequest.State().MainState() == ESsmShutdown))
			{
			// Going into failed state or shutdown state will override anything currently ongoing or queued
			response = EReplaceCurrentClearQueue;
			}
		}

#ifdef _DEBUG
	TSsmStateName name = aRequest.State().Name();
	if(ENotAllowed == response)
		{
		DEBUGPRINT3(_L("Startup Policy : Transition (Requested State: %S) is not allowed (Response: %d)."), &name, response);
		}
	else
		{
		DEBUGPRINT3(_L("Startup Policy : Transition (Requested State %S) is allowed (Response %d)."), &name, response);		
		}
#endif
	return response;
	}
Exemplo n.º 20
0
DWORD FFGLPluginDef::InitPluginLibrary()
{
    DWORD rval = FF_FAIL;

    if (m_mainfunc==NULL) {
		DEBUGPRINT(("HEY!  m_mainfunc is NULL in InitPluginLibrary!?"));
        return rval;
	}

    //initialize the plugin
    rval = m_mainfunc(FF_INITIALISE,0,0).ivalue;
    if (rval!=FF_SUCCESS)
        return rval;

    //get the parameter names
    m_numparams = (int)m_mainfunc(FF_GETNUMPARAMETERS, 0, 0).ivalue;

    m_paramdefs = new FFGLParameterDef[m_numparams];
	// DEBUGPRINT(("----- MALLOC new FFGLParameterDef"));
    int n;
    for (n=0; n<m_numparams; n++) {

        plugMainUnion u = m_mainfunc(FF_GETPARAMETERNAME,(DWORD)n,0);

        if (u.ivalue!=FF_FAIL && u.svalue!=NULL) {
            //create a temporary copy as a cstring w/null termination
            char newParamName[32];

            const char *c = u.svalue;
            char *t = newParamName;

            //FreeFrame spec defines parameter names to be 16 characters long MAX
            int numChars = 0;
            while (*c && numChars<16) {
                *t = *c;
                t++;
                c++;
                numChars++;
            }

            //make sure there's a null at the end
            *t = 0;

            FFGLParameterDef* p;
            p = SetParameterName(n, newParamName);
            u = m_mainfunc(FF_GETPARAMETERTYPE,(DWORD)n,0);
            p->type = u.ivalue;
	        u = m_mainfunc(FF_GETPARAMETERDEFAULT,(DWORD)n,0);
            if ( p->type != FF_TYPE_TEXT ) {
                p->default_float_val = u.fvalue;
	            DEBUGPRINT1(("Float Parameter n=%d s=%s type=%d default=%lf\n",
	                     n,p->name.c_str(),p->type,p->default_float_val));
            } else {
                p->default_string_val = CopyFFString16(u.svalue);
	            DEBUGPRINT1(("String Parameter n=%d s=%s",n,p->name.c_str()));
            }
			p->num = n;
        }
        else
        {
            SetParameterName(n, "Untitled");
        }
    }

    return FF_SUCCESS;
}
Exemplo n.º 21
0
/** 
Current RunL() implemenation doesn't leave, so RunError will never be called.
*/
TInt CSsmSwpPolicyServer::CSsmSwpPolicyStepCompletion::RunError()
	{
	DEBUGPRINT1(_L("CSsmSwpPolicyStepCompletion: RunError"));
	return KErrNone;
	}
Exemplo n.º 22
0
/** Implementation of MStartupCommand interface.
This function retrieves the DLL name and ordinal number from its 
CSystemStartupDllInfo data member. It attempts to load the DLL 
and call the specified function. 

@see MStartupCommand.
*/
void CDllStarter::Execute(TRequestStatus& aStatus)
	{
	aStatus = KRequestPending; 
	DEBUGPRINT1(_L("SysStart: CDllStarter::Execute"));
	
	// Find the name of the DLL to be loaded from the information 
	// already retrieved from the SSC file.
	TFileName dllName =iDllInfo->DllName();
	_LIT(KExtension, ".dll");
	dllName.Append(KExtension);
    
    // Initialise variables
    _LIT(KSysBin, "z:\\sys\\bin\\");
	RLibrary lib;
	TInt err = KErrGeneral; 
	TBool dllLoaded = EFalse; 
	
	TUint8 ordinal = iDllInfo->Ordinal();
 
	// The DLL may not be found or the DLL function may return an error 
	// code. The number of times to re-attempt is specified in the SSC file.
	TInt attemptsRequired = iDllInfo->NoOfRetries() + 1; 
  
 	while ((err != KErrNone)   && (attemptsRequired-- >0))
	 	{
		// Search for and load the DLL. 	 
       	if ((err = lib.Load(dllName, KSysBin)) == KErrNone)
 			{ 
 			DEBUGPRINT2(_L("SysStart: dll loaded - %S"), &dllName);
 			dllLoaded = ETrue;		 
 			}
 		else
			{
			DEBUGPRINT3(_L("SysStart: Unable to load DLL - %S, error - %d"), &dllName, err);
			}
			
  		// Call the function in the Dll
  		if (dllLoaded)
  			{	
  			// Identify the function to be called according to the ordinal 
 			// number specified in the SSC file.
 			TLibraryFunction ordinalfunction = lib.Lookup(ordinal);
 				
 			if (ordinalfunction != NULL)
 				{	
 				Dllfunctiontype getDllFunction = reinterpret_cast<Dllfunctiontype>(ordinalfunction);
  		 		DEBUGPRINT2(_L("SysStart: Calling function at ordinal %d."), ordinal);
  		 		err = (*getDllFunction)(iDllInfo->DllBuffer());
 				}
 			else
 				{
 				DEBUGPRINT2(_L("Sysstart: No function at specified ordinal %d"), ordinal);
 				err = KErrNotFound;
 				// No function exists at the ordinal specified so 
 				// there is no point in re-attempting execution.
 				attemptsRequired = 0;
 				}
  			}
	 	}
 	
				 	
	// Take action on error condition
	if (err != KErrNone) 
		{	
 		// Check required behaviour on failure specified in SSC
 		if (iDllInfo->FailOnError())
 			{ 
			err = RestartSys::RestartSystem();
			if (KErrNone != err)
				{
				DEBUGPRINT2(_L("Sysstart: Restart System Call failed with error %d"), err);
 				PanicNow(KPanicDllStarter, ERestartSystemCallFailed);
				}
			User::After(5000000); // required by RestartSys API, see comments in RestartSys::RestartSystem()
 			}			 
		}
 
 	lib.Close();
  
	TRequestStatus* requestStatus = &aStatus;
	User::RequestComplete(requestStatus, err);
	}
Exemplo n.º 23
0
void bootup(char *modeptr, int enumber)
/*****************************/
{
    char	 autodir[MAXPATH];
    char         parampath[MAXPATH];
    char         plotname[STR64];
    char         mstr[MAXPATH];
    char         rtautocmd[2 * MAXPATH + 20];
    char	 estring[5];
    extern char  PlotterName[];
    extern char  PrinterName[];
    int do_rt = 0;
    int lval;
    endian_tester et;

    (void) modeptr;
    et.my_int = 0x0a0b0c0d;
    BigEndian = (et.my_bytes[0] == 0x0a) ? 1:0;
    psg_pid = 0;		/* set pids to zero */

    if ( !Bnmr )
       disp_status("BOOTUP  ");

/*  May 18, 1987.  Addition to read the system global parameters.
    If a problem occurs, the program exits immediately, for this
    should not happen.  The CONPAR file is on the distribution tape.	*/

    strcpy(parampath,systemdir);
#ifdef UNIX
    strcat(parampath,"/conpar");
#else 
    strcat(parampath,"conpar");
#endif 
    if (P_read(SYSTEMGLOBAL,parampath)) 
    {
	fprintf(stderr,"problem loading system global parameters from %s\n",
		parampath);
	exit(1);
    }
    openVnmrInfo(systemdir);

/*  If automation mode, use value of autodir to establish path to experiment  */

    if (mode_of_vnmr == AUTOMATION)
    {
      getAutoDir(autodir, MAXPATH);
      if (strlen(autodir) == 0)
      {
	  fprintf( stderr, "unable to access 'autodir' parameter\n" );
	  exit(1);
      }
    }

    /* setup signal handlers to catch these signals */
    if (Wissun())		/* Only do this if using SUN console */
    {
        set_acqi_signal();
    }
    else if (mode_of_vnmr == FOREGROUND) /* Only creat a Vnmr socket if foreground */
    {

	setupVnmrAsync(AcqSocketIsRead);
    }

#ifndef VNMRJ
    if (Wishds())
	last_line = 19;
    else
#endif
	last_line = 20;

    /* load parameters in global file */
    /* moved 9 lines to read GLOBAL before EXP, this way we can use
       curexpdir to restart Vnmr in the last exp used. May 17, 1997 */

    strcpy(parampath,userdir);
    strcat(parampath,"/global");
    if (P_read(GLOBAL,parampath)) 
	Werrprintf("problem loading global parameters");
#ifdef VNMRJ
   // set curexpdir based on jcurwin of viewport 1
   jcurwin_init(curexpdir);
#endif

     // load unshared globalX for viewport X if foreground
     if (!Bnmr)
     {
        sprintf(parampath,"%s/global%d",userdir,VnmrJViewId);
        /* Don't complain if unshared globals are missing */
        P_read(GLOBAL,parampath);
     }

    // set OperatorName 
    if ( (P_getstring(GLOBAL,"operator",OperatorName,1,MAXSTR) != 0) ||
         ( ! strcmp(OperatorName, "") ) )
	strcpy(OperatorName, UserName);

/*  If lock fails, and program is running in foreground mode, set
    current experiment to be EXP0, which doesn't exist.  The user
    can then join another experiment or use other techniques to
    unlock the desired experiment.

    If running in any other mode, exit immediately with an error
    message.							*/

/* May 19, 1997. Use curexpdir to set the enumber, check if directory
   still exists, if not make it exp1. Only done if FOREGROUND Vnmr.
   Acqproc, autoproc, and other procs determine enumber themselves.
   Note that curexpdir is overwritten below, when we read exp parameters */

#ifdef VNMRJ
   jviewport_init();
   P_setstring(GLOBAL,"curexp",curexpdir,1);
#else 
   P_getstring(GLOBAL,"curexp",curexpdir,1,MAXPATH);
#endif 
   if (mode_of_vnmr == FOREGROUND)
   {
      enumber = expdir_to_expnum(curexpdir);
      if (enumber == 0)
         lval = -1;
      else if ( ! access(curexpdir,F_OK))
        lval = lockExperiment( enumber, FOREGROUND);
      else
        lval = -1;
   }
#ifdef SUN
   else if (mode_of_vnmr == ACQUISITION)
      lval = (enumber == 0) ? -2 :checkAcqLock( enumber );
   else if ( Bnmr && (enumber == 0) )
      lval = -2;
   else
#endif
      lval = lockExperiment( enumber, mode_of_vnmr );

    if (lval != 0)
    {
        if ((mode_of_vnmr != FOREGROUND) && (lval != -2) )
        {
	    fprintf( stderr, "unable to lock experiment %d\n", enumber);
	    exit(1);
	}
        if (enumber == 0)
        {
#ifdef VNMRJ
           if (VnmrJViewId != 1)
           {
	      P_getstring(GLOBAL, "jviewportlabel", mstr, VnmrJViewId, MAXPATH);
	      Werrprintf( "No experiment selected for the %s viewport.",mstr);
           }
           jcurwin_setexp( "0" , -1 );
#else 
           if (lval != -2)
	      Werrprintf( "No experiment selected.");
#endif 
        }
        else
        {
#ifdef VNMRJ
           if (VnmrJViewId == 1)
	      Werrprintf( "Unable to lock experiment %d", enumber );
           else
           {
	      P_getstring(GLOBAL, "jviewportlabel", mstr, VnmrJViewId, MAXPATH);
	      Werrprintf( "Unable to lock experiment %d for the %s viewport.",enumber, mstr);
           }
           jcurwin_setexp( "0", -1 );
#else 
	   Werrprintf( "Unable to lock experiment %d", enumber );
#endif 
        }
        strcpy( curexpdir, userdir );
#ifdef UNIX
        strcat( curexpdir, "/exp0" );
#else 
	vms_fname_cat( curexpdir, "[.exp0]" );
#endif 
#ifdef VNMRJ
        if (mode_of_vnmr != AUTOMATION)
        { 
           sprintf(mstr,"exp0 %s",curexpdir);
           writelineToVnmrJ("expn",mstr);
        }
#endif
    }

/*  Only read in parameters if the target experiment was locked.  */

    else
    {
	if (mode_of_vnmr == AUTOMATION)
	  strcpy( curexpdir, &autodir[ 0 ] );
	else
          strcpy( curexpdir, userdir );

	sprintf(estring, "%d", enumber);
#ifdef UNIX
        strcat(curexpdir, "/exp");
	strcat(curexpdir, estring);
#else 
        vms_fname_cat(curexpdir, "[.exp");
        vms_fname_cat(curexpdir, estring);
        vms_fname_cat(curexpdir, "]");
#endif 

        if (mode_of_vnmr == AUTOMATION)
        {
	    lval = strlen( &datadir[ 0 ] );
	    if (lval > MAXPATH-8)
	    {
	        fprintf(stderr, "data pathname too long in automation mode");
	        exit(1);
	    }
            else if (lval > 1)
            {
                int ex;

                sprintf(rtautocmd, "cp %s.fid/sampleinfo %s/sampleinfo",
                        datadir,curexpdir);
                system(rtautocmd);
                ex = 0;
                /* Wait up to 0.5 secs for fid to appear */
                while ( access(rtautocmd,R_OK) && (ex < 50) )
                {
                   struct timespec timer;

                   timer.tv_sec=0;
                   timer.tv_nsec = 10000000;   /* 10 msec */
#ifdef __INTERIX
				   usleep(timer.tv_nsec/1000);
#else
                   nanosleep( &timer, NULL);
#endif
                   ex++;
                }
	        sprintf( &rtautocmd[ 0 ], "%s('%s','nodg')\n",
                         (acqStartUseRtp) ? "RTP" : "RT", &datadir[ 0 ] );
                do_rt = 1; /* do the rt command after reading global tree */
            }
            else  /* read curpar parameters only from the automation exp */
            {
                D_getparfilepath(CURRENT, parampath, curexpdir);
                if (P_read(CURRENT,parampath))
                {  /* if no parameters in current experiment */
                   strcpy(parampath,systemdir);
#ifdef UNIX
                   strcat(parampath,"/stdpar/H1.par/procpar");
#else 
                   vms_fname_cat(parampath,"[.stdpar.H1_par]procpar");
#endif 
                   if (P_read(CURRENT,parampath))
	              Werrprintf("problem loading current parameters");
                }
                P_copy(CURRENT,PROCESSED);
            }
        }
	else       /* if (mode_of_vnmr != AUTOMATION) */
        {
           /* load parameters in curexp/curpar file */
           D_getparfilepath(CURRENT, parampath, curexpdir);
           if (P_read(CURRENT,parampath))
	       Werrprintf("problem loading current parameters from \"%s\"",
                           parampath);
           /* load parameters in curexp/procpar file */
           D_getparfilepath(PROCESSED, parampath, curexpdir);
           if (P_read(PROCESSED,parampath))
	       Werrprintf("problem loading processed parameters from \"%s\"",
                           parampath);
#ifdef VNMRJ
	   sprintf(mstr,"exp%s %s",estring,curexpdir);
	   writelineToVnmrJ("expn",mstr);
#endif 
        }
    }


    /* May 17, 1997. We read GLOBAL parameters earlier */
    setGlobalPars();
#ifdef VNMRJ
    if (!Bnmr)
       saveViewPortAddr();
#endif 
    bufferscale = getbufscale();	/* obtain the value for bufferscale */
    finddatainfo();
    DEBUGPRINT1("bufferscale set to %d\n", bufferscale);
    D_init();				/* initialize the data file handler;
					   bufferscale must be known before
					   D_init() is called.		    */

    /* setAppdirs needs to happen after operator is set in setGlobalPars but before
     * any macros are called
     */
#ifdef VNMRJ
    if (VnmrJViewId == 1)
#endif 
    {
       setAppdirs();
    }

    specIndex = 1;
    if (mode_of_vnmr == AUTOMATION)
    {
      if (do_rt)
      {
        turnOffFixpar();
        execString( &rtautocmd[ 0 ] );
      }
      else
      {
        Werrprintf( "Spectrometer in automation mode" );
      }
    }
    else if (enumber || (mode_of_vnmr != BACKGROUND) )
    {
       disp_expno();
    }
    init_proc2d();
    strcpy(dconi_runstring,"dcon\n");

    /* Assign some function pointers for the */
    /* graphics module                       */
    set_bootup_gfcn_ptrs();
    if (Bnmr)
       init_colors();  /* set default colors for graphics and plotters */

    set_automount_dir();

    /*  Set up plotting parameters */
    /*  If there is trouble setting plottin parameters (ie plotting device
        doesn't exist or devicetable/devicenames is bad, set to "none" device */
    if (P_getstring(GLOBAL,"plotter" ,plotname, 1,32))
    {  P_setstring(GLOBAL,"plotter","none",0);
       strcpy(PlotterName,"none");
    }
    if (!setPlotterName(plotname))
    {  P_setstring(GLOBAL,"plotter","none",0);
       strcpy(PlotterName,"none");
    }

    /*  Set up printing parameters */
    /*  If there is trouble setting printing parameters (ie printing device
        doesn't exist or devicetable/devicenames is bad, set to "none" device */
    if (P_getstring(GLOBAL,"printer" ,plotname, 1,32))
    {  P_setstring(GLOBAL,"printer","none",0);
       strcpy(PrinterName,"none");
    }
    if (!setPrinterName(plotname))
    {  P_setstring(GLOBAL,"Printer","none",0);
       strcpy(PrinterName,"none");
    }

#ifdef SUN
/*
 *  Set up signal handler to exit VNMR
 *  The function nmr_quit will be called when Vnmr exits
 */
    set_nmr_quit_signal();
#endif 
    check_datastation();

#ifdef VNMRJ
    writelineToVnmrJ("bootup","");
    /* create a frame for graphics display */
    frame_update("init", "");
#endif 

/*  The extra space in the first Wscrprintf is essential for
    the scrollable text subwindow to work correctly.			*/

/* ---  print revision ID and Date, Compiled within revdate.c --- */
    P_setstring( SYSTEMGLOBAL, "rev", &RevID[ 0 ], 1);
    P_setstring( SYSTEMGLOBAL, "revdate", &RevDate[ 0 ], 1);
    if (!Bnmr) /* only execute the bootup macro if we are in forground */
    {
	Wscrprintf("\n              %s\n",RevID);
        Wscrprintf("              %s\n",RevDate);

        Wscrprintf("              %s\n\n",Copyright);
        if (strlen(PlotterName) > 0)
           Wscrprintf( "              Plotting Device is set to %s\n",PlotterName);
        else
           Wscrprintf( "              Plotting Device is set to ''\n");
        if (strlen(PrinterName) > 0)
           Wscrprintf( "              Printing Device is set to %s\n\n",PrinterName);
        else
           Wscrprintf( "              Printing Device is set to ''\n\n");

        disp_current_seq();
        if (Wissun())
           sendTripleEscToMaster( 'C',"bootup(0)");
        else
	   execString("bootup(0)\n");
        disp_status("        ");
    }
    else if (enumber)
    {
	execString("bootup(1)\n");
    }

    p11_init();
}
/**
Determines the next sub state transition.
@param aCurrentTransition Contains the last executed state
@param aReason Contains the reason as given by the request
@param aError Contains the completion code from the last executed sub-state transition
@param aSeverity Contains the severity of the failed command in case the sub-state transition ended with an error
@param aNextState The next System State to head for, if there is one
@panic EInvalidStartupstate if the current state is not startup
@return 	ETrue if aNextState contains another System State to head for, or 
		EFalse if there is no further transitions to do.
@see MSsmStatePolicy::GetNextState
*/
TBool CGsaStatePolicyStartup::GetNextState(TSsmState aCurrentTransition, TInt /*aReason*/, TInt aError, TInt /*aSeverity*/, TSsmState& aNextState)
	{
	__ASSERT_ALWAYS(aCurrentTransition.MainState() == ESsmStartup, PanicNow(KPanicGsaStartupState, EInvalidStartupState));

	if (KErrNone != aError)	// Handle CLE error here
		{
		if (iLaunchSysStart)	// 'sysstart.exe' was launched unsuccessfully so launch 'sysagt2srv.exe' and 'wserv.exe'
			{
			iLaunchSysStart = EFalse;
			iLaunchSysAgt2SrvAndWServ = ETrue;
			DEBUGPRINT2(_L("Startup Policy : sysstart.exe launched with error : %d"), aError);
			aNextState = TSsmState(ESsmStartup, ESsmStartupSubStateCriticalDynamic);
			return ETrue;
			}

#ifdef __WINS__	// on emulator
			{
			DEBUGPRINT2(_L("Startup Policy : CLE returned with (error : %d), Panic on Emulator"), aError);
			DEBUGPRINT1(_L("Startup Policy : Emulator (__WINS__) does not support a re-start, so Fail Policy is not invoked."));
			PanicNow(KPanicGsaStartupState, EEmulatorPowerOff);
			}
#else	// on hardware/device
			{
			TInt resetLimit = -1;
			TInt bootCount = -1;
			TRAPD( err, GetStartupCountAndMaxbootLimitL(bootCount, resetLimit) );
			if (bootCount < resetLimit && KErrNone == err)
				{
				aNextState = TSsmState(ESsmFail, ESsmFailSubStateRestart);
				}
			else	// Maximum allowed boot attempts has been made. Device needs a poweroff. Probable candidate for a reset/reflash.
				{
				aNextState = TSsmState(ESsmFail, ESsmFailSubStatePowerOff);
				}
	#ifdef _DEBUG
			TSsmStateName name = aNextState.Name();
			DEBUGPRINT3(_L("Startup Policy : CLE returned with (error : %d) so moving to Fail State : %S."), aError, &name);
	#endif
			return ETrue;
			}
#endif
		}
	else if(iLaunchSysStart || iLaunchSysAgt2SrvAndWServ)	// If either sysstart or sysagt2srv and wserv was launched and CLE did not return an error
		{
		if (iLaunchSysStart)
			{
			iLaunchSysStart = EFalse;
			DEBUGPRINT1(_L("Startup Policy : sysstart.exe launched successfully."));
			}
		if (iLaunchSysAgt2SrvAndWServ)
			{
			iLaunchSysAgt2SrvAndWServ = EFalse;
			DEBUGPRINT1(_L("Startup Policy : sysagt2srv.exe and wserv.exe launched successfully."));
			}
		aNextState = TSsmState(ESsmNormal, KSsmAnySubState);	// move to Normal state
		return ETrue;
		}
	else	// have to move one with the next substates in this state
		{
		// Get the sub states from resource reader only once
		if (!iSubStatesCount)
			{
			// Get sub states list from resource reader
			TRAPD(err, iCommandListResourceReader->GetCommandListIdsL(iSubStates));
			if (err)
				{
				DEBUGPRINT2(_L("Startup Policy : Command list ids prepared with error: %d"), err);
				}
			else
				{
				iSubStatesCount = iSubStates.Count();
				}
			}

		TInt index = iSubStates.Find(iRequestedSubState);

		if (KErrNotFound == index)
			{
			DEBUGPRINT2(_L("Startup Policy : SubState for transition not found: %d"), index);
			PanicNow(KPanicGsaStartupState, ESubStateIndexNotFound);
			}
		else if (index == (iSubStatesCount - 1))	// transition complete, move to Normal state
			{
			TInt retVal = EFalse;
			// moving to next state as the transition is completed for ESsmStartup
			if (iSubStatesCount && (iRequestedSubState == iSubStates[iSubStatesCount-1]))
				{
				aNextState = TSsmState(ESsmNormal, KSsmAnySubState);
				retVal = ETrue;
				}
			return retVal;
			}
		else		// there is a substate available for transition, moved ahead
			{
			iRequestedSubState = iSubStates[++index];
			aNextState = TSsmState(ESsmStartup, iRequestedSubState);
#ifdef _DEBUG
			TSsmStateName name = aNextState.Name();
			DEBUGPRINT2(_L("Startup Policy : Transition to next state is : %S"), &name);
#endif				
			return ETrue;
			}
		}
	return EFalse;
	} //lint !e1746 Suppress parameter 'aCurrentTransition' could be made const reference
void CSsmCommandListResourceReaderImpl::CInitialiser::DoInitialiseFirstStepL()
	{
	if (!iResourcePool.IsEmpty())
		{
		// already initialised, don't count this as an error
		iAction = EIdle;
		return;
		}

	// get list of command list resource filenames
	TFileName path(iPath);
	_LIT(KStar, "*");
	path.Append(KStar);
	const TUid KUidResourceFile = {0x101f4a6b};
	__ASSERT_ALWAYS(iResourceFileEntries == NULL, PanicNow(KPanicCmdResourceReader, ENonNullResourceFileEntries));
	// The error cannot be KErrPathNotFound as fallback will be used if there is not startup path
	// Even if there are no resource files, this succeeds
	// User::LeaveIfError handles other error conditions
	User::LeaveIfError(iFs.GetDir(path, TUidType(KUidResourceFile, TUid::Uid(KUidSsmCommandListResourceFile)), ESortNone, iResourceFileEntries));
	iEntryIndex = iResourceFileEntries->Count();

#ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
#ifdef __WINS__
	if(!IsExtendedFolderDisabled())
	    {
	    TFileName extPath(iPath);
	    extPath.Replace(iPath.Length() - 1, 1, KExtendedCommandListPath);
	    iExtendedPath.CreateL(extPath);
	    DEBUGPRINT2(_L("Extended list path is %S"), &extPath);

	    extPath.Append(KStar);
	    const TInt extErr = (iFs.GetDir(extPath, TUidType(KUidResourceFile, TUid::Uid(KUidSsmCommandListResourceFile)), ESortNone, iExtendedResourceFileEntries));
	    if (KErrNone == extErr)
	        {
	        iExtendedEntryIndex = iExtendedResourceFileEntries->Count();
	        DEBUGPRINT2(_L("Number of resource files in extended folder : %d"), iExtendedEntryIndex);
	        }	    
	    }
#endif //__WINS__

	DEBUGPRINT2(_L("Number of resource files in ROM Drive : %d"),iEntryIndex );
	// Now, get list of command list resource filenames from system drive too
	TFileName sysPath(iSystemDrivePath);
	sysPath.Append(KStar);
	TInt err = (iFs.GetDir(sysPath, TUidType(KUidResourceFile, TUid::Uid(KUidSsmCommandListResourceFile)), ESortNone, iRssFileEntriesInSysDrive));
	if (KErrNone == err)
		{
		iSysDriveEntryIndex = iRssFileEntriesInSysDrive->Count();
		DEBUGPRINT2(_L("Number of resource files in System Drive : %d"),iSysDriveEntryIndex );
		}
	// all other error conditions are ignored as there is no compulsion for resource files to be present on system drive
	else if(KErrPathNotFound == err)
		{
		//the path for SCLs on system drive does not exist
		DEBUGPRINT1(_L("System Drive does not contain command lists"));
		}
	if(iEntryIndex == 0 && iSysDriveEntryIndex == 0)
		{
		DEBUGPRINT3(_L("Command list resource file directories (%S) and (%S) do not contain any command list resource files"), &path, &sysPath);
		SSMLOGLEAVE(KErrNotFound);
		}
#else
	if (iEntryIndex == 0)
		{
		DEBUGPRINT2(_L("Command list resource file directory (%S) does not contain any command list resource files"), &path);
		SSMLOGLEAVE(KErrNotFound);
		}
#endif
	iAction = EInitialiseNextStep;
	}