1 //------------------------------------------------------------------------------
2 // <copyright file="CopyCodeAction.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // <owner current="true" primary="true">[....]</owner>
6 //------------------------------------------------------------------------------
8 namespace System.Xml.Xsl.XsltOld {
9 using Res = System.Xml.Utils.Res;
11 using System.Diagnostics;
13 using System.Xml.XPath;
14 using System.Collections;
16 internal class CopyCodeAction : Action {
18 private const int Outputting = 2;
20 private ArrayList copyEvents; // Copy code action events
22 internal CopyCodeAction() {
23 this.copyEvents = new ArrayList();
26 internal void AddEvent(Event copyEvent) {
27 this.copyEvents.Add(copyEvent);
30 internal void AddEvents(ArrayList copyEvents) {
31 Debug.Assert(copyEvents != null);
32 this.copyEvents.AddRange(copyEvents);
35 internal override void ReplaceNamespaceAlias(Compiler compiler) {
36 int count = this.copyEvents.Count;
37 for(int i = 0; i< count; i++) {
38 ((Event) this.copyEvents[i]).ReplaceNamespaceAlias(compiler);
42 internal override void Execute(Processor processor, ActionFrame frame) {
43 Debug.Assert(processor != null && frame != null);
44 Debug.Assert(this.copyEvents != null && this.copyEvents.Count > 0);
46 switch (frame.State) {
49 frame.State = Outputting;
53 Debug.Assert(frame.State == Outputting);
55 while (processor.CanContinue) {
56 Debug.Assert(frame.Counter < this.copyEvents.Count);
57 Event copyEvent = (Event) this.copyEvents[frame.Counter];
59 if (copyEvent.Output(processor, frame) == false) {
60 // This event wasn't processed
64 if (frame.IncrementCounter() >= this.copyEvents.Count) {
71 Debug.Fail("Invalid CopyCodeAction execution state");
76 internal override DbgData GetDbgData(ActionFrame frame) {
77 Debug.Assert(frame.Counter < this.copyEvents.Count);
78 return ((Event)this.copyEvents[frame.Counter]).DbgData;