Example #1
0
 internal RecordBuilder(RecordOutput output, XmlNameTable nameTable) {
     Debug.Assert(output != null);
     this.output    = output;
     this.nameTable = nameTable != null ? nameTable : new NameTable();
     this.atoms     = new OutKeywords(this.nameTable);
     this.scopeManager   = new OutputScopeManager(this.nameTable, this.atoms);
 }
Example #2
0
 internal RecordBuilder(RecordOutput output, XmlNameTable nameTable)
 {
     Debug.Assert(output != null);
     this.output       = output;
     this.nameTable    = nameTable != null ? nameTable : new NameTable();
     this.atoms        = new OutKeywords(this.nameTable);
     this.scopeManager = new OutputScopeManager(this.nameTable, this.atoms);
 }
Example #3
0
 internal RecordBuilder(RecordOutput output, XmlNameTable nameTable)
 {
     Debug.Assert(output != null);
     _output = output;
     _nameTable = nameTable != null ? nameTable : new NameTable();
     _atoms = new OutKeywords(_nameTable);
     _scopeManager = new OutputScopeManager(_nameTable, _atoms);
 }
Example #4
0
 /*
  * Writes rest of the struct (excluding type value).
  * As an optimization, this method is directly called by RTI
  * for the top level record so that we don't write out the byte
  * indicating that this is a struct (since top level records are
  * always structs).
  */
 /// <exception cref="System.IO.IOException"/>
 internal virtual void WriteRest(RecordOutput rout, string tag)
 {
     rout.WriteInt(typeInfos.Count, tag);
     foreach (FieldTypeInfo ti in typeInfos)
     {
         ti.Write(rout, tag);
     }
 }
Example #5
0
 /// <summary>Serialize the type information for a record</summary>
 /// <exception cref="System.IO.IOException"/>
 public override void Serialize(RecordOutput rout, string tag)
 {
     // write out any header, version info, here
     rout.StartRecord(this, tag);
     rout.WriteString(name, tag);
     sTid.WriteRest(rout, tag);
     rout.EndRecord(this, tag);
 }
Example #6
0
 internal RecordBuilder(RecordOutput output, XmlNameTable nameTable)
 {
     Debug.Assert(output != null);
     _output       = output;
     _nameTable    = nameTable != null ? nameTable : new NameTable();
     _atoms        = new OutKeywords(_nameTable);
     _scopeManager = new OutputScopeManager(_nameTable, _atoms);
 }
Example #7
0
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);
            switch (frame.State)
            {
            case Initialized:
                object value = processor.GetGlobalParameter(this.name);
                if (value != null)
                {
                    frame.SetVariable(this.varKey, value);
                    frame.Finished();
                    break;
                }
                if (this.varType == VariableType.LocalParameter)
                {
                    if ((value = processor.GetParameter(this.name)) != null)
                    {
                        frame.SetVariable(this.varKey, value);
                        frame.Finished();
                        break;
                    }
                }
                if (this.selectKey != Compiler.InvalidQueryKey)
                {
                    value = processor.RunQuery(frame, this.selectKey);
                    frame.SetVariable(this.varKey, value);
                    frame.Finished();
                }
                else
                {
                    if (this.containedActions == null)
                    {
                        frame.SetVariable(this.varKey, "");
                        frame.Finished();
                        break;
                    }
                    NavigatorOutput output = new NavigatorOutput();
                    processor.PushOutput(output);
                    processor.PushActionFrame(frame);
                    frame.State = ProcessingChildren;
                }
                break;

            case ProcessingChildren:
                RecordOutput recOutput = processor.PopOutput();
                Debug.Assert(recOutput is NavigatorOutput);
                frame.SetVariable(this.varKey, ((NavigatorOutput)recOutput).Navigator);
                frame.Finished();
                break;

            default:
                Debug.Fail("Invalid execution state inside VariableAction.Execute");
                break;
            }
        }
Example #8
0
        //
        // Builder stack
        //
        internal void PushOutput(RecordOutput output)
        {
            Debug.Assert(output != null);
            this.builder.OutputState = this.xsm.State;
            RecordBuilder lastBuilder = this.builder;

            this.builder      = new RecordBuilder(output, this.nameTable);
            this.builder.Next = lastBuilder;

            this.xsm.Reset();
        }
Example #9
0
        private void InitializeOutput(TextWriter writer)
        {
            RecordOutput recOutput = null;

            switch (this.output.Method)
            {
            case XsltOutput.OutputMethod.Text:
                recOutput = new TextOnlyOutput(this, writer);
                break;

            case XsltOutput.OutputMethod.Xml:
            case XsltOutput.OutputMethod.Html:
            case XsltOutput.OutputMethod.Other:
            case XsltOutput.OutputMethod.Unknown:
                recOutput = new TextOutput(this, writer);
                break;
            }
            this.builder = new RecordBuilder(recOutput, this.nameTable);
        }
        public void Execute(Stream stream)
        {
            RecordOutput recOutput = null;

            switch (this.output.Method)
            {
            case XsltOutput.OutputMethod.Text:
                recOutput = new TextOnlyOutput(this, stream);
                break;

            case XsltOutput.OutputMethod.Xml:
            case XsltOutput.OutputMethod.Html:
            case XsltOutput.OutputMethod.Other:
            case XsltOutput.OutputMethod.Unknown:
                recOutput = new TextOutput(this, stream);
                break;
            }
            this.builder = new RecordBuilder(recOutput, this.nameTable);
            Execute();
        }
Example #11
0
        public void Execute(TextWriter writer)
        {
            RecordOutput recOutput = null;

            switch (_output.Method)
            {
            case XsltOutput.OutputMethod.Text:
                recOutput = new TextOnlyOutput(this, writer);
                break;

            case XsltOutput.OutputMethod.Xml:
            case XsltOutput.OutputMethod.Html:
            case XsltOutput.OutputMethod.Other:
            case XsltOutput.OutputMethod.Unknown:
                recOutput = new TextOutput(this, writer);
                break;
            }
            _builder = new RecordBuilder(recOutput, _nameTable);
            Execute();
        }
Example #12
0
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);
            object ParamValue;

            switch (frame.State)
            {
            case Initialized:
                if (this.selectKey != Compiler.InvalidQueryKey)
                {
                    ParamValue = processor.RunQuery(frame, this.selectKey);
                    processor.SetParameter(this.name, ParamValue);
                    frame.Finished();
                }
                else
                {
                    if (this.containedActions == null)
                    {
                        processor.SetParameter(this.name, string.Empty);
                        frame.Finished();
                        break;
                    }
                    NavigatorOutput output = new NavigatorOutput(baseUri);
                    processor.PushOutput(output);
                    processor.PushActionFrame(frame);
                    frame.State = ProcessingChildren;
                }
                break;

            case ProcessingChildren:
                RecordOutput recOutput = processor.PopOutput();
                Debug.Assert(recOutput is NavigatorOutput);
                processor.SetParameter(this.name, ((NavigatorOutput)recOutput).Navigator);
                frame.Finished();
                break;

            default:
                Debug.Fail("Invalid execution state inside VariableAction.Execute");
                break;
            }
        }
Example #13
0
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null && frame.State != ValueCalculated);
            object value = null;

            switch (frame.State)
            {
            case Initialized:
                if (IsGlobal)
                {
                    if (frame.GetVariable(this.varKey) != null)   // This var was calculated already
                    {
                        frame.Finished();
                        break;
                    }
                    // Mark that the variable is being computed to check for circular references
                    frame.SetVariable(this.varKey, BeingComputedMark);
                }
                // If this is a parameter, check whether the caller has passed the value
                if (this.varType == VariableType.GlobalParameter)
                {
                    value = processor.GetGlobalParameter(this.name);
                }
                else if (this.varType == VariableType.LocalParameter)
                {
                    value = processor.GetParameter(this.name);
                }
                if (value != null)
                {
                    goto case ValueCalculated;
                }

                // If value was not passed, check the 'select' attribute
                if (this.selectKey != Compiler.InvalidQueryKey)
                {
                    value = processor.RunQuery(frame, this.selectKey);
                    goto case ValueCalculated;
                }

                // If there is no 'select' attribute and the content is empty, use the empty string
                if (this.containedActions == null)
                {
                    value = string.Empty;
                    goto case ValueCalculated;
                }

                // RTF case
                NavigatorOutput output = new NavigatorOutput(this.baseUri);
                processor.PushOutput(output);
                processor.PushActionFrame(frame);
                frame.State = ProcessingChildren;
                break;

            case ProcessingChildren:
                RecordOutput recOutput = processor.PopOutput();
                Debug.Assert(recOutput is NavigatorOutput);
                value = ((NavigatorOutput)recOutput).Navigator;
                goto case ValueCalculated;

            case ValueCalculated:
                Debug.Assert(value != null);
                frame.SetVariable(this.varKey, value);
                frame.Finished();
                break;

            default:
                Debug.Fail("Invalid execution state inside VariableAction.Execute");
                break;
            }
        }
Example #14
0
 /// <exception cref="System.IO.IOException"/>
 internal override void Write(RecordOutput rout, string tag)
 {
     rout.WriteByte(typeVal, tag);
     WriteRest(rout, tag);
 }
Example #15
0
 /// <summary>Serialize the TypeID object</summary>
 /// <exception cref="System.IO.IOException"/>
 internal virtual void Write(RecordOutput rout, string tag)
 {
     rout.WriteByte(typeVal, tag);
 }
Example #16
0
 /// <summary>Serialize a record without a tag</summary>
 /// <param name="rout">Record output destination</param>
 /// <exception cref="System.IO.IOException"/>
 public virtual void Serialize(RecordOutput rout)
 {
     this.Serialize(rout, string.Empty);
 }
Example #17
0
        //
        // Builder stack
        //
        internal void PushOutput(RecordOutput output) {
            Debug.Assert(output != null);
            this.builder.OutputState = this.xsm.State;
            RecordBuilder lastBuilder = this.builder;
            this.builder      = new RecordBuilder(output, this.nameTable);
            this.builder.Next = lastBuilder;

            this.xsm.Reset();
        }
Example #18
0
 /// <exception cref="System.IO.IOException"/>
 internal virtual void Write(RecordOutput rout, string tag)
 {
     rout.WriteString(fieldID, tag);
     typeID.Write(rout, tag);
 }
Example #19
0
 /// <summary>Serialize a record with tag (ususally field name)</summary>
 /// <param name="rout">Record output destination</param>
 /// <param name="tag">record tag (Used only in tagged serialization e.g. XML)</param>
 /// <exception cref="System.IO.IOException"/>
 public abstract void Serialize(RecordOutput rout, string tag);
Example #20
0
 /// <exception cref="System.IO.IOException"/>
 internal override void Write(RecordOutput rout, string tag)
 {
     rout.WriteByte(typeVal, tag);
     typeIDElement.Write(rout, tag);
 }