Exemple #1
0
local Bool
tpossIsPending(TPoss tp, TForm t)
{
	Bool	result = false;

	if (tpossIsUnique(tp)) {
		TForm	S = tpossUnique(tp);

		tcSatPush(S, t);

		if (tfIsPending(S)) {
			tcNewSat(S, S, t, NULL);
			result = true;
		}
		if (tfIsPending(t)) {
			tcNewSat(t, S, t, NULL);
			result = true;
		}

		tcSatPop();
	}

	return result;
}
Exemple #2
0
TConst
tcAlloc(TConstTag tag, TForm owner, AbLogic known, AbSyn ab0, Length argc, va_list argp)
{
	TConst		tc;
	Length		i;

	assert(owner == NULL || tfIsPending(owner));

	tc = (TConst) stoAlloc((unsigned) OB_TConst,
			       sizeof(*tc) + argc * sizeof(TForm));

	tc->tag		= tag;
	tc->pos		= NULL;
	tc->parent	= NULL;
	tc->id		= NULL;
	tc->known       = known;
	tc->serial	= ++tcSerialNum;
	tc->owner	= owner;
	tc->ab0 	= ab0;
	tc->argc	= argc;
	tc->argv	= (argc ? (TForm *) (tc + 1) : NULL);

	for (i = 0; i < argc; i += 1)
		tcArgv(tc)[i] = va_arg(argp, TForm);

	for (i = 0; i < argc; i += 1) {
		AbSyn	abi = tfGetExpr(tcArgv(tc)[i]);
		if (abi && !sposIsNone(abPos(abi))) {
			tcPos(tc) = abi;
			break;
		}
	}

	assert(owner == NULL || tcParents);
	if (tcParents) tcSetParent(tc, car(tcParents));

	if (owner == NULL)
		tcParents = listCons(TConst)(tc, tcParents);
	else {
		if (DEBUG(tc)) {
			listPush(TConst, tc, tcList);
		}
		tcCount += 1;
	}

	return tc;
}