void FSNewFunction2::decodeFromStream(FSInputStream* aStream)
    {
#ifdef _DEBUG
        aStream->startDecoding(className());
#endif
        FSActionObject::decodeFromStream(aStream);

        name = aStream->readString();
        
        int argumentCount = aStream->read(FSStream::UnsignedWord, 16);
        registerCount = aStream->read(FSStream::UnsignedWord, 8);
        optimizations = aStream->read(FSStream::UnsignedBit, 16);
        
#ifdef _DEBUG
        aStream->startDecoding("array");
#endif
        for (int i=argumentCount; i>0; i--)
            arguments.push_back(FSRegisterVariable(aStream));

#ifdef _DEBUG
        aStream->endDecoding("array");
#endif
            
        int actionsLength = aStream->read(FSStream::UnsignedWord, 16);
        
        /*
         * Update the decoded length of the tag since we are adding the array 
         * of actions to the object and it is separate in the Flash specification.
         */
        
        length += actionsLength;
        
#ifdef _DEBUG
        aStream->startDecoding("array");
#endif
		while (actionsLength > 0)
        {
            FSActionObject* anAction = FSMovie::actionFromStream(aStream);
            
            if (anAction != 0)
            {
                actionsLength -= anAction->getLength() + ((anAction->getType() >= 128) ? 3 : 1);
                actions.push_back(anAction);
            }
        }
        
#ifdef _DEBUG
        aStream->endDecoding("array");
        aStream->endDecoding(className());
#endif
    }
示例#2
0
	void FSExceptionHandler::decodeFromStream(FSInputStream* aStream)
	{
        aStream->startDecoding(className());
		FSActionObject::decodeFromStream(aStream);

		aStream->read(FSStream::UnsignedBit, 5);
		int containsVariable = aStream->read(FSStream::UnsignedBit, 1);
		int containsCatch = aStream->read(FSStream::UnsignedBit, 1);
		int containsFinal = aStream->read(FSStream::UnsignedBit, 1);

		int tryLength = aStream->read(FSStream::UnsignedWord, 16);
		int catchLength = aStream->read(FSStream::UnsignedWord, 16);
		int finalLength = aStream->read(FSStream::UnsignedWord, 16);

        if (containsVariable != 0)
        {
			const char* str = aStream->readString();
			variable = str;
			delete [] str;
        }
        else
        {
            registerNumber = aStream->read(FSStream::UnsignedWord, 8);
        }

#ifdef _DEBUG
        aStream->startDecoding("array");
#endif
		while (tryLength > 0)
        {
            FSActionObject* anAction = FSMovie::actionFromStream(aStream);
            
            if (anAction != 0)
            {
                tryLength -= anAction->getLength() + ((anAction->getType() >= 128) ? 3 : 1);
                tryActions.push_back(anAction);
            }
        }
#ifdef _DEBUG
        aStream->endDecoding("array");
#endif

#ifdef _DEBUG
        aStream->startDecoding("array");
#endif
		while (catchLength > 0)
        {
            FSActionObject* anAction = FSMovie::actionFromStream(aStream);
            
            if (anAction != 0)
            {
                catchLength -= anAction->getLength() + ((anAction->getType() >= 128) ? 3 : 1);
                catchActions.push_back(anAction);
            }
        }
#ifdef _DEBUG
        aStream->endDecoding("array");
#endif

#ifdef _DEBUG
        aStream->startDecoding("array");
#endif
		while (finalLength > 0)
        {
            FSActionObject* anAction = FSMovie::actionFromStream(aStream);
            
            if (anAction != 0)
            {
                finalLength -= anAction->getLength() + ((anAction->getType() >= 128) ? 3 : 1);
                finalActions.push_back(anAction);
            }
        }
#ifdef _DEBUG
        aStream->endDecoding("array");
#endif
		aStream->endDecoding(className());
	}