void MHSetData::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine); // Target
    MHParseNode *pContent = p->GetArgN(1);

    if (pContent->m_nNodeType == MHParseNode::PNSeq)
    {
        // Referenced content.
        m_fIsIncluded = false;
        m_fSizePresent = m_fCCPriorityPresent = false;
        m_Referenced.Initialise(pContent->GetSeqN(0), engine);

        if (pContent->GetSeqCount() > 1)
        {
            MHParseNode *pArg = pContent->GetSeqN(1);

            if (pArg->m_nNodeType == MHParseNode::PNTagged && pArg->GetTagNo() == C_NEW_CONTENT_SIZE)
            {
                MHParseNode *pVal = pArg->GetArgN(0);

                // It may be NULL as a place-holder
                if (pVal->m_nNodeType == MHParseNode::PNInt)
                {
                    m_fSizePresent = true;
                    m_ContentSize.Initialise(pVal, engine);
                }
            }
        }

        if (pContent->GetSeqCount() > 2)
        {
            MHParseNode *pArg = pContent->GetSeqN(2);

            if (pArg->m_nNodeType == MHParseNode::PNTagged && pArg->GetTagNo() == C_NEW_CONTENT_CACHE_PRIO)
            {
                MHParseNode *pVal = pArg->GetArgN(0);

                if (pVal->m_nNodeType == MHParseNode::PNInt)
                {
                    m_fCCPriorityPresent = true;
                    m_CCPriority.Initialise(pVal, engine);
                }
            }
        }
    }
    else
    {
        m_Included.Initialise(pContent, engine);
        m_fIsIncluded = true;
    }
}
Exemple #2
0
void MHPersistent::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine); // Target
    m_Succeeded.Initialise(p->GetArgN(1), engine);
    MHParseNode *pVarSeq = p->GetArgN(2);
    for (int i = 0; i < pVarSeq->GetSeqCount(); i++) {
        MHObjectRef *pVar = new MHObjectRef;
        m_Variables.Append(pVar);
        pVar->Initialise(pVarSeq->GetSeqN(i), engine);
    }
    m_FileName.Initialise(p->GetArgN(3), engine);
}
Exemple #3
0
void MHSetTimer::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine);
    m_TimerId.Initialise(p->GetArgN(1), engine); // The timer id
    if (p->GetArgCount() > 2) {
        MHParseNode *pNewTimer = p->GetArgN(2);
        m_TimerValue.Initialise(pNewTimer->GetSeqN(0), engine);
        if (pNewTimer->GetSeqCount() > 1) {
            m_TimerType = ST_TimerAbsolute; // May be absolute - depends on the value.
            m_AbsFlag.Initialise(pNewTimer->GetSeqN(1), engine);
        }
        else m_TimerType = ST_TimerRelative;
    }
}
// Actions.
void MHCall::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine); // Target
    m_Succeeded.Initialise(p->GetArgN(1), engine); // Call/fork succeeded flag
    // Arguments.
    MHParseNode *args = p->GetArgN(2);

    for (int i = 0; i < args->GetSeqCount(); i++)
    {
        MHParameter *pParm = new MHParameter;
        m_Parameters.Append(pParm);
        pParm->Initialise(args->GetSeqN(i), engine);
    }
}
Exemple #5
0
void MHTokenGroupItem::Initialise(MHParseNode *p, MHEngine *engine)
{
    // A pair consisting of an object reference and an optional action slot sequence.
    m_Object.Initialise(p->GetSeqN(0), engine);

    if (p->GetSeqCount() > 1)
    {
        MHParseNode *pSlots = p->GetSeqN(1);

        for (int i = 0; i < pSlots->GetSeqCount(); i++)
        {
            MHParseNode *pAct = pSlots->GetSeqN(i);
            MHActionSequence *pActions = new MHActionSequence;
            m_ActionSlots.Append(pActions);

            // The action slot entry may be NULL.
            if (pAct->m_nNodeType != MHParseNode::PNNull)
            {
                pActions->Initialise(pAct, engine);
            }
        }
    }
}