Пример #1
0
 private IErlObject ioProcessPutChars(ErlAtom encoding,
                                      ErlString str, IErlObject replyAs)
 {
     Node.IoOutput(encoding, str);
     return(s_ReplyPattern.Subst(
                new ErlVarBind {
         { RA, replyAs }, { R, ConstAtoms.Ok }
     }));
 }
Пример #2
0
        /// <summary>
        /// Perform pattern match on this Erlang term, storing matched variables
        /// found in the pattern into the binding.
        /// </summary>
        public bool Match(IErlObject pattern, ErlVarBind binding)
        {
            if (binding == null)
            {
                return(false);
            }
            IErlObject value = binding[Name];

            if (value != null)
            {
                return(checkType(value) ? value.Match(pattern, binding) : false);
            }
            if (!checkType(pattern))
            {
                return(false);
            }
            IErlObject term = null;

            binding[Name] = pattern.Subst(ref term, binding) ? term : pattern;
            return(true);
        }
Пример #3
0
        /// <summary>
        /// Substibute all variables in the given object using provided binding
        /// and return the resulting object
        /// </summary>
        public static IErlObject Subst(this IErlObject o, ErlVarBind binding)
        {
            IErlObject term = null;

            return(o.Subst(ref term, binding) ? term : o);
        }
Пример #4
0
 /// <summary>
 /// Perform pattern match on this Erlang term, storing matched variables
 /// found in the pattern into the binding.
 /// </summary>
 public bool Match(IErlObject pattern, ErlVarBind binding)
 {
     if (binding == null)
         return false;
     IErlObject value = binding[Name];
     if (value != null)
         return checkType(value) ? value.Match(pattern, binding) : false;
     if (!checkType(pattern))
         return false;
     IErlObject term = null;
     binding[Name] = pattern.Subst(ref term, binding) ? term : pattern;
     return true;
 }