示例#1
0
 public WriteWork(PBTerm[] args, WriteWork next)
 {
     // assert args != null;
     // assert args.length > 0;
     i         = 0;
     this.args = args;
     this.next = next;
 }
示例#2
0
            /// <summary> Pop exhausted stack entries and return the resulting stack (which may
            /// be null).
            /// </summary>
            internal virtual WriteWork prune()
            {
                WriteWork tmp = this;

                while (tmp != null && tmp.i == tmp.args.Length)
                {
                    tmp = tmp.Next;
                }
                return(tmp);
            }
示例#3
0
        internal virtual void  writeTerm(PBTerm term)
        {
            WriteWork stack = new WriteWork(new [] { term }, null);

            do
            {
                PBTerm t = stack.bump();
                if (t != null)
                {
                    PBTerm[] args = t.fastWritePrefix(this);
                    if (args.Length > 0)
                    {
                        stack = stack.push(args);
                    }
                }
                else
                {
                    // top-most entry exhausted, pop it.
                    stack = stack.prune();
                }
            } while (stack != null);
        }