Ejemplo n.º 1
0
        // whereTerm != null : for persistent predicates only
        // put the predicate definition (if found) into the TermNode if it is not already there
        public bool FindPredicateDefinition(PredicateStorage predicateStorage, Term whereTerm)
        {
            if (predDescr == null) predDescr = predicateStorage[term.KbKey];

              if (predDescr == null) return false;

            #if arg1index
              Term arg;

              if (predDescr.IsFirstArgIndexed)
              {
            if ((arg = term.Arg (0)).IsVar)
              nextClause = predDescr.FirstArgVarClause ();
            else // not a variable
            {
              nextClause = predDescr.FirstArgNonvarClause (arg.Functor);
              // check whether there is an indexed var clause
              if (nextClause == null) nextClause = predDescr.FirstArgVarClause ();
              // if the above failed, the entire predicate fails (no unification possible)
              if (nextClause == null) nextClause = ClauseNode.FAIL; // "fail."
            }

            if (nextClause == null)
              nextClause = predDescr.GetClauseList (term, whereTerm); // GetClauseList: in PredicateStorage
              }
              else // not indexed
            #endif
              nextClause = predDescr.GetClauseList(term, whereTerm); // GetClauseList: in PredicateStorage

              return true;
        }
Ejemplo n.º 2
0
 private void Initialize()
 {
     ps = (PredicateStorage)parser_arg[0];
       Add1000Operators();
       terminalTable.Remove("module");            // will be temporarily set after an initial ':-' only
       terminalTable.Remove("persistent");        // ...
       terminalTable.Remove("undef_pred_action"); // ...
 }
Ejemplo n.º 3
0
 public bool FindPredicateDefinition(PredicateStorage predicateStorage)
 {
     return FindPredicateDefinition(predicateStorage, null);
 }