The Labs \ Source Viewer \ SSCLI \ System.Xml.Xsl.XsltOld \ TemplateBaseAction

  1. //------------------------------------------------------------------------------
  2. // <copyright file="TemplateBaseAction.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Xml.Xsl.XsltOld
  16. {
  17.     using Res = System.Xml.Utils.Res;
  18.     using System;
  19.     using System.Diagnostics;
  20.     using System.Collections;
  21.     using System.Xml;
  22.     using System.Xml.XPath;
  23.     using System.Globalization;
  24.    
  25.     // RootAction and TemplateActions have a litle in common -- they are responsible for variable allocation
  26.     // TemplateBaseAction -- implenemts this shared behavior
  27.    
  28.     internal abstract class TemplateBaseAction : ContainerAction
  29.     {
  30.         protected int variableCount;
  31.         // space to allocate on frame for variables
  32.         private int variableFreeSlot;
  33.         // compile time counter responsiable for variable placement logic
  34.         public int AllocateVariableSlot()
  35.         {
  36.             // Variable placement logic. Optimized
  37.             int thisSlot = this.variableFreeSlot;
  38.             this.variableFreeSlot++;
  39.             if (this.variableCount < this.variableFreeSlot) {
  40.                 this.variableCount = this.variableFreeSlot;
  41.             }
  42.             return thisSlot;
  43.         }
  44.        
  45.         public void ReleaseVariableSlots(int n)
  46.         {
  47.             // This code does optimisation of variable placement. Comented out for this version
  48.             // Reuse of the variable disable the check that variable was assigned before the actual use
  49.             // this check has to be done in compile time n future.
  50.             // this.variableFreeSlot -= n;
  51.         }
  52.     }
  53. }

Developer Fusion