internal override Opcode Eval(ProcessingContext context)
 {
     if (!context.LoadVariable(this.expr.Variable))
     {
         context.PushSequenceFrame();
         NodeSequence seq = context.CreateSequence();
         seq.Add(context.Processor.ContextNode);
         context.PushSequence(seq);
         int counterMarker = context.Processor.CounterMarker;
         try
         {
             this.expr.Eval(context);
         }
         catch (XPathNavigatorException exception)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception.Process(this));
         }
         catch (NavigatorInvalidBodyAccessException exception2)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception2.Process(this));
         }
         context.Processor.CounterMarker = counterMarker;
         context.PopSequenceFrame();
         context.PopSequenceFrame();
         context.LoadVariable(this.expr.Variable);
     }
     return base.next;
 }
예제 #2
0
        internal override Opcode Eval(ProcessingContext context)
        {
            if (!context.LoadVariable(this.expr.Variable))
            {
                context.PushSequenceFrame();
                NodeSequence seq = context.CreateSequence();
                seq.Add(context.Processor.ContextNode);
                context.PushSequence(seq);

                int marker = context.Processor.CounterMarker;
                try
                {
                    this.expr.Eval(context);
                }
                catch (XPathNavigatorException e)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(e.Process(this));
                }
                catch (NavigatorInvalidBodyAccessException e)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(e.Process(this));
                }
                context.Processor.CounterMarker = marker;
                context.PopSequenceFrame();
                context.PopSequenceFrame();

                context.LoadVariable(this.expr.Variable);
            }
            return(this.next);
        }
예제 #3
0
 internal override Opcode Eval(ProcessingContext context)
 {
     if (!context.LoadVariable(this.expr.Variable))
     {
         this.expr.Eval(context);
     }
     return(this.next);
 }
 internal override Opcode Eval(ProcessingContext context)
 {
     if (!context.LoadVariable(base.expr.Variable))
     {
         base.expr.Eval(context);
     }
     return base.next;
 }
예제 #5
0
        internal void Eval(ProcessingContext context)
        {
            int    count         = 0;
            int    counterMarker = context.Processor.CounterMarker;
            Opcode ops           = this.ops;

            if (!this.useSpecial)
            {
                while (ops != null)
                {
                    ops = ops.Eval(context);
                }
                count = context.Processor.ElapsedCount(counterMarker);
                context.SaveVariable(this.var, count);
            }
            else
            {
                ops.EvalSpecial(context);
                context.LoadVariable(this.var);
            }
        }
예제 #6
0
        internal void Eval(ProcessingContext context)
        {
            int count = 0, marker = context.Processor.CounterMarker;

            Opcode op = this.ops;

            if (this.useSpecial)
            {
                op.EvalSpecial(context);
                context.LoadVariable(this.var);
                //context.Processor.CounterMarker = marker;
                return;
            }

            while (op != null)
            {
                op = op.Eval(context);
            }

            count = context.Processor.ElapsedCount(marker);
            //context.Processor.CounterMarker = marker;
            context.SaveVariable(this.var, count);
        }
예제 #7
0
        internal override void EvalSpecial(ProcessingContext context)
        {
            int marker = context.Processor.CounterMarker;

            if (!context.LoadVariable(this.var))
            {
                XPathMessageContext.HeaderFun.InvokeInternal(context, 0);
                context.SaveVariable(this.var, context.Processor.ElapsedCount(marker));
            }

            // WS, Microsoft, see if we can put this array in the processor to save
            //             an allocation.  Perhaps we can use the variables slot we're going to fill
            NodeSequence[] childSequences = new NodeSequence[this.children.Count];
            NodeSequence   seq            = context.Sequences[context.TopSequenceArg.basePtr].Sequence;

            for (int i = 0; i < this.children.Count; ++i)
            {
                childSequences[i] = context.CreateSequence();
                childSequences[i].StartNodeset();
            }

            // Perform the index
            SeekableXPathNavigator nav = seq[0].GetNavigator();

            if (nav.MoveToFirstChild())
            {
                do
                {
                    if (nav.NodeType == XPathNodeType.Element)
                    {
                        List <SubExpr> lst;
                        string         name = nav.LocalName;
                        string         ns   = nav.NamespaceURI;
                        Dictionary <string, List <SubExpr> > nextLookup;
                        if (this.nameLookup.TryGetValue(ns, out nextLookup))
                        {
                            if (nextLookup.TryGetValue(name, out lst))
                            {
                                for (int i = 0; i < lst.Count; ++i)
                                {
                                    childSequences[this.indexLookup[lst[i]].i].Add(nav);
                                }
                            }

                            if (nextLookup.TryGetValue(QueryDataModel.Wildcard, out lst))
                            {
                                for (int i = 0; i < lst.Count; ++i)
                                {
                                    childSequences[this.indexLookup[lst[i]].i].Add(nav);
                                }
                            }
                        }

                        if (this.nameLookup.TryGetValue(QueryDataModel.Wildcard, out nextLookup))
                        {
                            if (nextLookup.TryGetValue(QueryDataModel.Wildcard, out lst))
                            {
                                for (int i = 0; i < lst.Count; ++i)
                                {
                                    childSequences[this.indexLookup[lst[i]].i].Add(nav);
                                }
                            }
                        }
                    }
                } while (nav.MoveToNext());
            }

            int secondMarker = context.Processor.CounterMarker;

            for (int i = 0; i < this.children.Count; ++i)
            {
                if (this.children[i].useSpecial)
                {
                    childSequences[i].StopNodeset();
                    context.Processor.CounterMarker = secondMarker;
                    context.PushSequenceFrame();
                    context.PushSequence(childSequences[i]);
                    Opcode op = this.children[i].FirstOp.Next;
                    while (op != null)
                    {
                        op = op.Eval(context);
                    }
                    context.SaveVariable(this.children[i].var, context.Processor.ElapsedCount(marker));
                    context.PopSequenceFrame();
                }
                else
                {
                    context.ReleaseSequence(childSequences[i]);
                    //context.SetVariable(this.children[i].Variable, null, 0);
                }
            }

            context.Processor.CounterMarker = marker;
        }
 internal void Eval(ProcessingContext context)
 {
     int count = 0;
     int counterMarker = context.Processor.CounterMarker;
     Opcode ops = this.ops;
     if (!this.useSpecial)
     {
         while (ops != null)
         {
             ops = ops.Eval(context);
         }
         count = context.Processor.ElapsedCount(counterMarker);
         context.SaveVariable(this.var, count);
     }
     else
     {
         ops.EvalSpecial(context);
         context.LoadVariable(this.var);
     }
 }
예제 #9
0
        internal override void EvalSpecial(ProcessingContext context)
        {
            int counterMarker = context.Processor.CounterMarker;

            if (!context.LoadVariable(base.var))
            {
                XPathMessageContext.HeaderFun.InvokeInternal(context, 0);
                context.SaveVariable(base.var, context.Processor.ElapsedCount(counterMarker));
            }
            NodeSequence[] sequenceArray = new NodeSequence[base.children.Count];
            NodeSequence   sequence      = context.Sequences[context.TopSequenceArg.basePtr].Sequence;

            for (int i = 0; i < base.children.Count; i++)
            {
                sequenceArray[i] = context.CreateSequence();
                sequenceArray[i].StartNodeset();
            }
            SeekableXPathNavigator node = sequence[0].GetNavigator();

            if (node.MoveToFirstChild())
            {
                do
                {
                    if (node.NodeType == XPathNodeType.Element)
                    {
                        List <SubExpr> list;
                        Dictionary <string, List <SubExpr> > dictionary;
                        string localName    = node.LocalName;
                        string namespaceURI = node.NamespaceURI;
                        if (this.nameLookup.TryGetValue(namespaceURI, out dictionary))
                        {
                            if (dictionary.TryGetValue(localName, out list))
                            {
                                for (int k = 0; k < list.Count; k++)
                                {
                                    sequenceArray[this.indexLookup[list[k]].i].Add(node);
                                }
                            }
                            if (dictionary.TryGetValue(QueryDataModel.Wildcard, out list))
                            {
                                for (int m = 0; m < list.Count; m++)
                                {
                                    sequenceArray[this.indexLookup[list[m]].i].Add(node);
                                }
                            }
                        }
                        if (this.nameLookup.TryGetValue(QueryDataModel.Wildcard, out dictionary) && dictionary.TryGetValue(QueryDataModel.Wildcard, out list))
                        {
                            for (int n = 0; n < list.Count; n++)
                            {
                                sequenceArray[this.indexLookup[list[n]].i].Add(node);
                            }
                        }
                    }
                }while (node.MoveToNext());
            }
            int num6 = context.Processor.CounterMarker;

            for (int j = 0; j < base.children.Count; j++)
            {
                if (base.children[j].useSpecial)
                {
                    sequenceArray[j].StopNodeset();
                    context.Processor.CounterMarker = num6;
                    context.PushSequenceFrame();
                    context.PushSequence(sequenceArray[j]);
                    for (Opcode opcode = base.children[j].FirstOp.Next; opcode != null; opcode = opcode.Eval(context))
                    {
                    }
                    context.SaveVariable(base.children[j].var, context.Processor.ElapsedCount(counterMarker));
                    context.PopSequenceFrame();
                }
                else
                {
                    context.ReleaseSequence(sequenceArray[j]);
                }
            }
            context.Processor.CounterMarker = counterMarker;
        }
        internal override void EvalSpecial(ProcessingContext context)
        {
            int marker = context.Processor.CounterMarker;

            if (!context.LoadVariable(this.var))
            {
                XPathMessageContext.HeaderFun.InvokeInternal(context, 0);
                context.SaveVariable(this.var, context.Processor.ElapsedCount(marker));
            }

            // WS, [....], see if we can put this array in the processor to save
            //             an allocation.  Perhaps we can use the variables slot we're going to fill
            NodeSequence[] childSequences = new NodeSequence[this.children.Count];
            NodeSequence seq = context.Sequences[context.TopSequenceArg.basePtr].Sequence;
            for (int i = 0; i < this.children.Count; ++i)
            {
                childSequences[i] = context.CreateSequence();
                childSequences[i].StartNodeset();
            }

            // Perform the index
            SeekableXPathNavigator nav = seq[0].GetNavigator();
            if (nav.MoveToFirstChild())
            {
                do
                {
                    if (nav.NodeType == XPathNodeType.Element)
                    {
                        List<SubExpr> lst;
                        string name = nav.LocalName;
                        string ns = nav.NamespaceURI;
                        Dictionary<string, List<SubExpr>> nextLookup;
                        if (this.nameLookup.TryGetValue(ns, out nextLookup))
                        {
                            if (nextLookup.TryGetValue(name, out lst))
                            {
                                for (int i = 0; i < lst.Count; ++i)
                                {
                                    childSequences[this.indexLookup[lst[i]].i].Add(nav);
                                }
                            }

                            if (nextLookup.TryGetValue(QueryDataModel.Wildcard, out lst))
                            {
                                for (int i = 0; i < lst.Count; ++i)
                                {
                                    childSequences[this.indexLookup[lst[i]].i].Add(nav);
                                }
                            }
                        }

                        if (this.nameLookup.TryGetValue(QueryDataModel.Wildcard, out nextLookup))
                        {
                            if (nextLookup.TryGetValue(QueryDataModel.Wildcard, out lst))
                            {
                                for (int i = 0; i < lst.Count; ++i)
                                {
                                    childSequences[this.indexLookup[lst[i]].i].Add(nav);
                                }
                            }
                        }
                    }
                } while (nav.MoveToNext());
            }

            int secondMarker = context.Processor.CounterMarker;
            for (int i = 0; i < this.children.Count; ++i)
            {
                if (this.children[i].useSpecial)
                {
                    childSequences[i].StopNodeset();
                    context.Processor.CounterMarker = secondMarker;
                    context.PushSequenceFrame();
                    context.PushSequence(childSequences[i]);
                    Opcode op = this.children[i].FirstOp.Next;
                    while (op != null)
                    {
                        op = op.Eval(context);
                    }
                    context.SaveVariable(this.children[i].var, context.Processor.ElapsedCount(marker));
                    context.PopSequenceFrame();
                }
                else
                {
                    context.ReleaseSequence(childSequences[i]);
                    //context.SetVariable(this.children[i].Variable, null, 0);
                }
            }

            context.Processor.CounterMarker = marker;
        }
        internal void Eval(ProcessingContext context)
        {
            int count = 0, marker = context.Processor.CounterMarker;

            Opcode op = this.ops;
            if (this.useSpecial)
            {
                op.EvalSpecial(context);
                context.LoadVariable(this.var);
                //context.Processor.CounterMarker = marker;
                return;
            }

            while (op != null)
            {
                op = op.Eval(context);
            }

            count = context.Processor.ElapsedCount(marker);
            //context.Processor.CounterMarker = marker;
            context.SaveVariable(this.var, count);
        }
 internal override void EvalSpecial(ProcessingContext context)
 {
     int counterMarker = context.Processor.CounterMarker;
     if (!context.LoadVariable(base.var))
     {
         XPathMessageContext.HeaderFun.InvokeInternal(context, 0);
         context.SaveVariable(base.var, context.Processor.ElapsedCount(counterMarker));
     }
     NodeSequence[] sequenceArray = new NodeSequence[base.children.Count];
     NodeSequence sequence = context.Sequences[context.TopSequenceArg.basePtr].Sequence;
     for (int i = 0; i < base.children.Count; i++)
     {
         sequenceArray[i] = context.CreateSequence();
         sequenceArray[i].StartNodeset();
     }
     SeekableXPathNavigator node = sequence[0].GetNavigator();
     if (node.MoveToFirstChild())
     {
         do
         {
             if (node.NodeType == XPathNodeType.Element)
             {
                 List<SubExpr> list;
                 Dictionary<string, List<SubExpr>> dictionary;
                 string localName = node.LocalName;
                 string namespaceURI = node.NamespaceURI;
                 if (this.nameLookup.TryGetValue(namespaceURI, out dictionary))
                 {
                     if (dictionary.TryGetValue(localName, out list))
                     {
                         for (int k = 0; k < list.Count; k++)
                         {
                             sequenceArray[this.indexLookup[list[k]].i].Add(node);
                         }
                     }
                     if (dictionary.TryGetValue(QueryDataModel.Wildcard, out list))
                     {
                         for (int m = 0; m < list.Count; m++)
                         {
                             sequenceArray[this.indexLookup[list[m]].i].Add(node);
                         }
                     }
                 }
                 if (this.nameLookup.TryGetValue(QueryDataModel.Wildcard, out dictionary) && dictionary.TryGetValue(QueryDataModel.Wildcard, out list))
                 {
                     for (int n = 0; n < list.Count; n++)
                     {
                         sequenceArray[this.indexLookup[list[n]].i].Add(node);
                     }
                 }
             }
         }
         while (node.MoveToNext());
     }
     int num6 = context.Processor.CounterMarker;
     for (int j = 0; j < base.children.Count; j++)
     {
         if (base.children[j].useSpecial)
         {
             sequenceArray[j].StopNodeset();
             context.Processor.CounterMarker = num6;
             context.PushSequenceFrame();
             context.PushSequence(sequenceArray[j]);
             for (Opcode opcode = base.children[j].FirstOp.Next; opcode != null; opcode = opcode.Eval(context))
             {
             }
             context.SaveVariable(base.children[j].var, context.Processor.ElapsedCount(counterMarker));
             context.PopSequenceFrame();
         }
         else
         {
             context.ReleaseSequence(sequenceArray[j]);
         }
     }
     context.Processor.CounterMarker = counterMarker;
 }