예제 #1
0
파일: BNF.cpp 프로젝트: aaalexandrov/Alex
void CBNFParser::CNonTerminal::AddToHash(CHash<CRule const *> &hashRules) const
{
	CHash<CRule const *>::TIter it = hashRules.Find(this);
	if (!it) {
		hashRules.Add(this);
		for (int i = 0; i < MAX_CHILD_RULES && m_pChildren[i]; ++i)
			m_pChildren[i]->AddToHash(hashRules);
	}
}
예제 #2
0
ENDI * GetEndiInfo(EUI64 * pId)
{
    ENDI   *pEndi;
    int         nIndex;

    nIndex = g_EndListHash.Find(pId, sizeof(EUI64));
    if (nIndex == -1)
    {
        pEndi = (ENDI *) MALLOC(sizeof(ENDI));
        memset(pEndi, 0, sizeof(ENDI));
        memcpy(&pEndi->id, pId, sizeof(EUI64));
        pEndi->stream.pszBuffer = (char *)MALLOC(1024);
        memset(pEndi->stream.pszBuffer, 0, 1024);

        pEndi->position = (int)g_EndiList.AddTail(pEndi);

        g_EndListHash.Update(pId, sizeof(EUI64), pEndi->position);

        return pEndi;
    }

    pEndi = g_EndiList.Get((POSITION)nIndex);
    return pEndi;
}