private void InitializeGoalTemporaryVariables(PrologCodeTerm goal)
{
/* Free all registers */
PrologRegisterTable.Instance.FreeAllRegisters();
int reg = 0;
if (goal is PrologCodePredicate)
{
PrologCodePredicate g = (PrologCodePredicate)goal;
if (g.Arity > 0)
{
foreach (PrologCodeTerm var in g.Arguments)
{
if (var is PrologCodeVariable)
{
PrologVariableDictionaryEntry entry = _dictionary.GetVariable(((PrologCodeVariable)var).Name);
if (entry != null)
{
if (entry.IsTemporary && entry.TemporaryIndex == -1)
{
_dictionary.AllocateTemporaryVariable(entry, reg);
}
}
reg++;
}
}
}
}
}