예제 #1
0
// Generic function to handle all infix operators but the last one in the precedence hierarchy. : '(' E ')'
Condition* InfixOperator(const char** str, Condition(*nextPart(const char**)), int(*operators)(const char**))
{
	Condition* t = nextPart(str);
	Condition* t1;
	Condition* mid;
	int op;

	while ((op = operators(str)))
	{
		scan(str);

		t1 = nextPart(str);

		if (t1 == 0)
		{
			if(t)
				freeTree(t);
			return 0;
		}

		mid = (Condition*)FCEU_dmalloc(sizeof(Condition));
		if (!mid)
			return NULL;
		memset(mid, 0, sizeof(Condition));

		mid->lhs = t;
		mid->rhs = t1;
		mid->op = op;

		t = mid;
	}

	return t;
}
예제 #2
0
bool Intro::doIntro(bool floppyIntro) {

	if (!SkyEngine::isCDVersion())
		floppyIntro = true;

	_skyMusic->loadSection(0);
	_skySound->loadSection(0);

	if (!escDelay(3000))
		return false;
	if (floppyIntro)
		_skyMusic->startMusic(1);

	uint16 *seqData = _mainIntroSeq;
	while (*seqData != SEQEND) {
		if (!nextPart(seqData))
			return false;
	}
	if (floppyIntro)
		seqData = _floppyIntroSeq;
	else
		seqData = _cdIntroSeq;

	while (*seqData != SEQEND) {
		if (!nextPart(seqData))
			return false;
	}
	return true;
}
예제 #3
0
void Snake::update() {
    byte nextIndex = (headIndex + 1) % length;

    //Serial.print("nextIndex: ");
// Serial.println(nextIndex);

    // Turn off the tail
    xyz tail = snakeParts[nextIndex];
    ledOff(tail.x, tail.y, tail.z);

    // Replace the tail with the head and turn it on
    xyz next = nextPart();
    snakeParts[nextIndex] = next;
    ledOn(next.x, next.y, next.z);

    headIndex = nextIndex;
}
예제 #4
0
/**
Parses the status response.
@param aAttribute.The status data item.(MESSAGES/UIDNEXT/RECENT/UIDVALIDITY/UNSEEN)
@param aValue. The value corrosponding a particular status data item.
*/
void CImapStatus::ParseStatusAttributeL(const TDesC8& aAttribute, const TDesC8& aValue )
// Parse response of the form (MESSAGES 899 UIDNEXT 8874)...
	{
	TPtrC8 nextPart(aAttribute);
	TLex8 desToInt(aValue);
	TInt tempVal = 0;
	
	if(desToInt.Val(tempVal) != KErrNone)
		{
		CorruptDataL();
		}
	
	// From RFC3501 section 9
	//	
	// status-att = "MESSAGES" / "RECENT" / "UIDNEXT" / "UIDVALIDITY" / "UNSEEN"
		
	if(nextPart.CompareF(KImapTxtMessages) == 0)
		{					
		iFolderInfo.SetMessages(tempVal);
		}
	else if(nextPart.CompareF(KImapTxtRecent) == 0)
		{
		iFolderInfo.SetRecent(tempVal);					
		}
	else if(nextPart.CompareF(KImapTxtUidNext) == 0)
		{
		iFolderInfo.SetUidNext(tempVal);					
		}
	else if(nextPart.CompareF(KImapTxtUidValidity) == 0)
		{					
		iFolderInfo.SetUidValidity(tempVal);
		}
	else if(nextPart.CompareF(KImapTxtUnseen) == 0)
		{					
		iFolderInfo.SetUnseen(tempVal);
		}			
	}