void LanguageMetadataParser::_parseLanguageMetadata() throw(LanguageException)
    {
        //on parse les règles
        _languageMetadataBuffer->reset();

        while (_languageMetadataBuffer->hasData())
        {
            _parseUnnecessaryCharacters();

            if (_languageMetadataBuffer->hasData())
            {
                if (! _parseComment())
                {
                    _parseRule();
                }
            }
        }

        //debug
        //======================================================
        /*LMRules::iterator itRules;
        LMRuleDefinition::iterator itExpression;

        for (itRules = _rules.begin(); itRules != _rules.end(); itRules++)
        {
            cout << itRules->first << " ::= ";
            for (itExpression = itRules->second.begin(); itExpression != itRules->second.end(); itExpression++)
            {
                if (itExpression == itRules->second.begin())
                {
                    cout << "\"" << (*itExpression) << "\"";
                }
                else
                {
                    cout << ", \"" << (*itExpression) << "\"";
                }
            }
            cout << ";" << endl;
        }*/
        //======================================================
    }
Esempio n. 2
0
HX_RESULT
MulticastRuleChain::_createMulticastRuleChain()
{
    HX_RESULT res = HXR_OK;
    IHXValues* props = 0;
    const char* propName = 0;   // here it represents the rule number
    ULONG32 propID = 0;
    MulticastACRule* rule = 0;
    int i = 0;

    // if we need to, make a default rule in the registry, so the rest of the
    // process can take place.
    _makeDefaultRule();

    res = m_registry->GetPropList("config.Multicast.ControlList", props,
        m_proc);

    /*
     * XXXAAK -- remember to change ServerRegistry::_getPropList()
     * to return NULL (IHXValues *) in case the property does not exist
     */
    if (SUCCEEDED(res) && props)
    {
        props->GetFirstPropertyULONG32(propName, propID);
        if (!propName || !propID)
        {
            res = HXR_FAIL;
            goto endInit;
        }

        // printf("creating rule chain\n");
        while(propName && propID)
        {
            // printf("rule %d detected\n", m_numRules);
            rule = _parseRule(propName, propID);
            if (rule)
                m_rules[m_numRules++] = rule;
            propName = 0;
            propID = 0;
            props->GetNextPropertyULONG32(propName, propID);
        }
        // printf("total %d rules\n", m_numRules);
        if (m_numRules)
        {
            ::qsort(m_rules, m_numRules, sizeof(MulticastACRule *),
                _mcastRuleCompare);
            m_beginIdx = m_numRules;
            m_endIdx = 0;
        }
    }
    else
    {
        // now that we are making a default, it shouldn't get here
        HX_ASSERT(!"ControlList missing...");
        res = HXR_FAIL;
    }

endInit:
    // printf("_createMulticastRuleChain() returns %lu\n", res);
    HX_RELEASE(props);
    return res;
}