Axiom.Compiler.Framework.PrologVariableDictionary.AllocateTemporaryVariable C# (CSharp) Метод

AllocateTemporaryVariable() публичный Метод

public AllocateTemporaryVariable ( PrologVariableDictionaryEntry entry, int reg ) : void
entry PrologVariableDictionaryEntry
reg int
Результат void
        public void AllocateTemporaryVariable(PrologVariableDictionaryEntry entry, int reg)
        {
            _registers.AllocateRegister(reg);
            entry.TemporaryIndex = reg;
        }

Usage Example

        /* Initialize temporary goal variables in the dictionary */
        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++;
                        }
                    }
                }
            }
        }
All Usage Examples Of Axiom.Compiler.Framework.PrologVariableDictionary::AllocateTemporaryVariable