Esempio n. 1
0
errorCode cloneProtoGrammar(ProtoGrammar* src, ProtoGrammar* dest)
{
	errorCode tmp_err_code = UNEXPECTED_ERROR;
	ProtoRuleEntry* pRuleEntry;
	Index i;
	Index j;

	tmp_err_code = createProtoGrammar(src->count, dest);
	if(tmp_err_code != ERR_OK)
		return tmp_err_code;

	dest->contentIndex = src->contentIndex;
	for (i = 0; i < src->count; i++)
	{
		tmp_err_code = addProtoRule(dest, src->rule[i].count, &pRuleEntry);
		if(tmp_err_code != ERR_OK)
			return tmp_err_code;

		for (j = 0; j < src->rule[i].count; j++)
		{
			tmp_err_code = addProduction(pRuleEntry, src->rule[i].prod[j].eventType, src->rule[i].prod[j].typeId, src->rule[i].prod[j].qnameId, src->rule[i].prod[j].nonTermID);
			if(tmp_err_code != ERR_OK)
				return tmp_err_code;
		}
	}

	return ERR_OK;
}
Esempio n. 2
0
errorCode cloneProtoGrammar(ProtoGrammar* src, ProtoGrammar* dest)
{
	errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
	ProtoRuleEntry* pRuleEntry;
	Index i;
	Index j;

	TRY(createProtoGrammar(src->count, dest));

	dest->contentIndex = src->contentIndex;
	for (i = 0; i < src->count; i++)
	{
		TRY(addProtoRule(dest, src->rule[i].count, &pRuleEntry));

		for (j = 0; j < src->rule[i].count; j++)
		{
			TRY(addProduction(pRuleEntry, GET_PROD_EXI_EVENT(src->rule[i].prod[j].content), src->rule[i].prod[j].typeId, src->rule[i].prod[j].qnameId, GET_PROD_NON_TERM(src->rule[i].prod[j].content)));
		}
	}

	return EXIP_OK;
}