Esempio n. 1
0
 internal VsaItem(VsaEngine engine, string name, VsaItemType type, VsaItemFlag flag)
 {
     this.engine = engine;
     this.name   = name;
     this.type   = type;
     this.flag   = flag;
 }
Esempio n. 2
0
 public virtual IVsaItem CreateItem
     (String name, VsaItemType itemType, VsaItemFlag itemFlag)
 {
     lock (this)
     {
         CheckForClosed();
         if (engine.IsRunning)
         {
             throw new VsaException(VsaError.EngineRunning);
         }
         if (itemType != VsaItemType.Code)
         {
             // We only support code items in this implementation.
             throw new VsaException(VsaError.ItemTypeNotSupported);
         }
         if (itemFlag == VsaItemFlag.Class)
         {
             // We don't support class flags.
             throw new VsaException(VsaError.ItemFlagNotSupported);
         }
         VsaItem.ValidateName(engine, name);
         VsaItem item = new VsaCodeItem(engine, name, itemFlag);
         itemList.Add(item);
         return(item);
     }
 }
Esempio n. 3
0
 internal VsaItem(VsaEngine engine, string name, VsaItemType type, VsaItemFlag flag)
 {
     this.engine = engine;
     this.name = name;
     this.type = type;
     this.flag = flag;
 }
Esempio n. 4
0
 internal VsaItem(VsaEngine engine, string itemName, VsaItemType type, VsaItemFlag flag){ 
   this.engine = engine;
   this.type = type;
   this.name = itemName;
   this.flag = flag;
   this.codebase = null;
   this.isDirty = true;
 }
Esempio n. 5
0
 internal VsaItem(VsaEngine engine, string itemName, VsaItemType type, VsaItemFlag flag)
 {
     this.engine   = engine;
     this.type     = type;
     this.name     = itemName;
     this.flag     = flag;
     this.codebase = null;
     this.isDirty  = true;
 }
Esempio n. 6
0
	// Constructor.
	internal VsaItem(VsaEngine engine, String name, VsaItemType type,
					 VsaItemFlag flag)
			{
				this.engine = engine;
				this.codebaseOption = null;
				this.isDirty = false;
				this.type = type;
				this.name = name;
				this.flag = flag;
			}
Esempio n. 7
0
 // Constructor.
 internal VsaItem(VsaEngine engine, String name, VsaItemType type,
                  VsaItemFlag flag)
 {
     this.engine         = engine;
     this.codebaseOption = null;
     this.isDirty        = false;
     this.type           = type;
     this.name           = name;
     this.flag           = flag;
 }
Esempio n. 8
0
        public virtual IVsaItem CreateItem(string name,
                                           VsaItemType itemType,
                                           VsaItemFlag itemFlag)
        {
            if (names.Contains(name))
            {
                throw new VsaException(VsaError.ItemNameInUse);
            }

            IVsaItem item = null;

            switch (itemType)
            {
            case VsaItemType.AppGlobal:
                if (itemFlag != VsaItemFlag.None)
                {
                    throw new VsaException(VsaError.ItemFlagNotSupported);
                }
                item = new VsaGlobalItem(engine, name, itemFlag);
                break;

            case VsaItemType.Code:
                item = new VsaCodeItem(engine, name, itemFlag);
                break;

            case VsaItemType.Reference:
                if (itemFlag != VsaItemFlag.None)
                {
                    throw new VsaException(VsaError.ItemFlagNotSupported);
                }
                item = new VsaReferenceItem(engine, name, itemFlag);
                break;
            }

            if (item != null)
            {
                items.Add(item);
                names.Add(name);
            }

            engine.IsDirty = true;

            return(item);
        }
Esempio n. 9
0
 internal VsaReferenceItem(VsaEngine engine, string name, VsaItemFlag flag)
     : base(engine, name, VsaItemType.Reference, flag)
 {
     this.dirty = true;
 }
Esempio n. 10
0
		internal VsaGlobalItem (VsaEngine engine, string name, VsaItemFlag flag)
			: base (engine, name, VsaItemType.AppGlobal, flag)
		{
			this.dirty = true;
		}
Esempio n. 11
0
 internal VsaCodeItem(VsaEngine engine, string name, VsaItemFlag flag)
     : base(engine, name, VsaItemType.Code, flag)
 {
     this.dirty = true;
 }
Esempio n. 12
0
 internal VsaCodeItem(VsaEngine engine, string name, VsaItemFlag flag)
     : base(engine, name, VsaItemType.Code, flag)
 {
     this.dirty = true;
 }
Esempio n. 13
0
        public virtual IVsaItem CreateItem(string name, 
            VsaItemType itemType,
            VsaItemFlag itemFlag)
        {
            if (names.Contains (name))
                 throw new VsaException (VsaError.ItemNameInUse);

              			IVsaItem item = null;

            switch (itemType) {
            case VsaItemType.AppGlobal:
                if (itemFlag != VsaItemFlag.None)
                    throw new VsaException (VsaError.ItemFlagNotSupported);
                item = new VsaGlobalItem (engine, name, itemFlag);
                break;

            case VsaItemType.Code:
                item = new VsaCodeItem (engine, name, itemFlag);
                break;

            case VsaItemType.Reference:
                if (itemFlag != VsaItemFlag.None)
                    throw new VsaException (VsaError.ItemFlagNotSupported);
                item = new VsaReferenceItem (engine, name, itemFlag);
                    break;
            }

            if (item != null) {
                items.Add (item);
                names.Add (name);
            }

            engine.IsDirty = true;

            return item;
        }
Esempio n. 14
0
	// Constructor.
	internal VsaCodeItem(VsaEngine engine, String name, VsaItemFlag flag)
			: base(engine, name, VsaItemType.Code, flag)
			{
				sourceText = null;
				parsed = null;
			}
Esempio n. 15
0
 internal VsaReferenceItem(VsaEngine engine, string name, VsaItemFlag flag)
     : base(engine, name, VsaItemType.Reference, flag)
 {
     this.dirty = true;
 }
Esempio n. 16
0
	public virtual IVsaItem CreateItem
				(String name, VsaItemType itemType, VsaItemFlag itemFlag)
			{
				lock(this)
				{
					CheckForClosed();
					if(engine.IsRunning)
					{
						throw new VsaException(VsaError.EngineRunning);
					}
					if(itemType != VsaItemType.Code)
					{
						// We only support code items in this implementation.
						throw new VsaException(VsaError.ItemTypeNotSupported);
					}
					if(itemFlag == VsaItemFlag.Class)
					{
						// We don't support class flags.
						throw new VsaException(VsaError.ItemFlagNotSupported);
					}
					VsaItem.ValidateName(engine, name);
					VsaItem item = new VsaCodeItem(engine, name, itemFlag);
					itemList.Add(item);
					return item;
				}
			}
Esempio n. 17
0
        public virtual IVsaItem CreateItem(string name, VsaItemType itemType, VsaItemFlag itemFlag)
        {
            if (this.isClosed)
            {
                throw new VsaException(VsaError.EngineClosed);
            }
            if (this.engine.IsRunning)
            {
                throw new VsaException(VsaError.EngineRunning);
            }
            this.TryObtainLock();
            try{
                // The name must be valid for all items except reference items (in which case we don't care)
                if (itemType != VsaItemType.Reference && !this.engine.IsValidIdentifier(name))
                {
                    throw new VsaException(VsaError.ItemNameInvalid);
                }
                // Make sure the name isn't already in use
                foreach (Object vsaItem in this.items)
                {
                    if (((VsaItem)vsaItem).Name.Equals(name))
                    {
                        throw new VsaException(VsaError.ItemNameInUse);
                    }
                }
                IVsaItem item = null;
                switch (itemType)
                {
                // IVsaReference
                case VsaItemType.Reference:
                    if (itemFlag != VsaItemFlag.None)
                    {
                        throw new VsaException(VsaError.ItemFlagNotSupported);
                    }
                    // create a wrapper around an assembly
                    item = new VsaReference((VsaEngine)this.engine, name);
                    break;

                //IVsaGlobalItem
                case VsaItemType.AppGlobal:
                    if (itemFlag != VsaItemFlag.None)
                    {
                        throw new VsaException(VsaError.ItemFlagNotSupported);
                    }
                    item = new VsaHostObject((VsaEngine)this.engine, name, VsaItemType.AppGlobal);
                    ((VsaHostObject)item).isVisible = true;
                    break;

                // IVsaCodeItem
                case VsaItemType.Code:
                    if (itemFlag == VsaItemFlag.Class)
                    {
                        throw new VsaException(VsaError.ItemFlagNotSupported);
                    }
                    item = new VsaStaticCode((VsaEngine)this.engine, name, itemFlag);
                    this.staticCodeBlockCount++;
                    break;
                }
                if (item != null)
                {
                    this.items.Add(item);
                }
                else
                {
                    throw new VsaException(VsaError.ItemTypeNotSupported);
                }
                ((VsaEngine)this.engine).IsDirty = true;
                return(item);
            }finally{
                this.ReleaseLock();
            }
        }
Esempio n. 18
0
    public virtual IVsaItem CreateItem(string name, VsaItemType itemType, VsaItemFlag itemFlag){
      if (this.isClosed)
        throw new VsaException(VsaError.EngineClosed);
      if (this.engine.IsRunning)
        throw new VsaException(VsaError.EngineRunning);
      this.TryObtainLock();
      try{
        // The name must be valid for all items except reference items (in which case we don't care)
        if (itemType != VsaItemType.Reference && !this.engine.IsValidIdentifier(name))
          throw new VsaException(VsaError.ItemNameInvalid);
        // Make sure the name isn't already in use
        foreach (Object vsaItem in this.items){
          if (((VsaItem)vsaItem).Name.Equals(name))
            throw new VsaException(VsaError.ItemNameInUse);
        }
        IVsaItem item = null;
        switch (itemType){
          // IVsaReference
          case VsaItemType.Reference:
            if (itemFlag != VsaItemFlag.None)
              throw new VsaException(VsaError.ItemFlagNotSupported);
            // create a wrapper around an assembly
            item = new VsaReference((VsaEngine)this.engine, name);
            break;

          //IVsaGlobalItem
          case VsaItemType.AppGlobal:
            if (itemFlag != VsaItemFlag.None)
              throw new VsaException(VsaError.ItemFlagNotSupported);
            item = new VsaHostObject((VsaEngine)this.engine, name, VsaItemType.AppGlobal);
            ((VsaHostObject)item).isVisible = true;
            break;

          // IVsaCodeItem
          case VsaItemType.Code:
            if (itemFlag == VsaItemFlag.Class)
              throw new VsaException(VsaError.ItemFlagNotSupported);
            item = new VsaStaticCode((VsaEngine)this.engine, name, itemFlag);
            this.staticCodeBlockCount++;
            break;
        }
        if (item != null){
          this.items.Add(item);
        }else{
          throw new VsaException(VsaError.ItemTypeNotSupported);
        }
        ((VsaEngine)this.engine).IsDirty = true;
        return item;
      }finally{
        this.ReleaseLock();
      }
    }
Esempio n. 19
0
 internal VsaGlobalItem(VsaEngine engine, string name, VsaItemFlag flag)
     : base(engine, name, VsaItemType.AppGlobal, flag)
 {
     this.dirty = true;
 }
Esempio n. 20
0
 internal VsaStaticCode(VsaEngine engine, string itemName, VsaItemFlag flag)
     : base(engine, itemName, VsaItemType.Code, flag)
 {
     this.compiledClass = null;
     this.codeContext   = new Context(new DocumentContext(this), "");
 }
Esempio n. 21
0
 // Constructor.
 internal VsaCodeItem(VsaEngine engine, String name, VsaItemFlag flag)
     : base(engine, name, VsaItemType.Code, flag)
 {
     sourceText = null;
     parsed     = null;
 }
 internal VsaStaticCode(VsaEngine engine, string itemName, VsaItemFlag flag)
   : base(engine, itemName, VsaItemType.Code, flag) {
   this.compiledClass = null;
   this.codeContext = new Context(new DocumentContext(this), "");
 }