Пример #1
0
 /// <summary>
 /// Queues an event if the event queue is below the maximum size
 /// </summary>
 /// <param name="postedEvent"></param>
 public void QueueEvent(PostedEvent postedEvent)
 {
     if (EventQueue.Count < MAX_EVENT_QUEUE_SIZE || AllowOverflow(postedEvent))
     {
         EventQueue.Enqueue(postedEvent);
     }
 }
Пример #2
0
        /// <summary>
        /// Resets the runtime state of this script putting IP back
        /// at the init state and clearing out the call and operand stack
        /// </summary>
        public void Reset()
        {
            MemInfo.MemoryUsed = 0;
            RunState           = Status.Running;
            GeneralEnable      = true;
            IP       = 0;
            LSLState = 0;
            TopFrame = null;
            Calls.Clear();
            Operands.Clear();
            EventQueue.Clear();
            NextWakeup           = 0;
            StateCapturedOn      = 0;
            TimerLastScheduledOn = 0;
            TimerInterval        = 0;
            RunningEvent         = null;
            PermsGranter         = String.Empty;
            GrantedPermsMask     = 0;
            ActiveListens.Clear();
            StartParameter = 0;

            //null out all globals
            for (int i = 0; i < Globals.Length; i++)
            {
                Globals[i] = null;
            }

            this.ResetRuntime();
        }
Пример #3
0
        private bool AllowOverflow(PostedEvent postedEvent)
        {
            if (OVERFLOWABLE_EVENTS.Contains(postedEvent.EventType))
            {
                return(true);
            }

            return(false);
        }
Пример #4
0
        /// <summary>
        /// Pushes the given args onto the stack and positions the function pointer
        /// </summary>
        /// <param name="info"></param>
        /// <param name="args"></param>
        public void DoEvent(EventInfo info, PostedEvent triggeringEvent, IList <object> args)
        {
            TopFrame = new StackFrame(info.ToFunctionInfo(), 0);
            Calls.Push(TopFrame);

            IP = info.Address;

            Debug.Assert(args.Count == info.NumberOfArguments);
            for (int i = 0; i < args.Count; i++)
            {
                TopFrame.Locals[i] = args[i];
            }

            RunState     = Status.Running;
            RunningEvent = triggeringEvent;

            MemInfo.AddCall(TopFrame);
        }
Пример #5
0
        private bool AllowOverflow(PostedEvent postedEvent)
        {
            if (OVERFLOWABLE_EVENTS.Contains(postedEvent.EventType))
            {
                return true;
            }

            return false;
        }
Пример #6
0
 /// <summary>
 /// Queues an event if the event queue is below the maximum size
 /// </summary>
 /// <param name="postedEvent"></param>
 public void QueueEvent(PostedEvent postedEvent)
 {
     if (EventQueue.Count < MAX_EVENT_QUEUE_SIZE || AllowOverflow(postedEvent))
     {
         EventQueue.Enqueue(postedEvent);
     }
 }
Пример #7
0
        /// <summary>
        /// Pushes the given args onto the stack and positions the function pointer
        /// </summary>
        /// <param name="info"></param>
        /// <param name="args"></param>
        public void DoEvent(EventInfo info, PostedEvent triggeringEvent, IList<object> args)
        {
            TopFrame = new StackFrame(info.ToFunctionInfo(), 0);
            Calls.Push(TopFrame);
            
            IP = info.Address;

            Debug.Assert(args.Count == info.NumberOfArguments);
            for (int i = 0; i < args.Count; i++)
            {
                TopFrame.Locals[i] = args[i];
            }

            RunState = Status.Running;
            RunningEvent = triggeringEvent;

            MemInfo.AddCall(TopFrame);
        }
Пример #8
0
        /// <summary>
        /// Resets the runtime state of this script putting IP back 
        /// at the init state and clearing out the call and operand stack
        /// </summary>
        public void Reset()
        {
            MemInfo.MemoryUsed = 0;
            RunState = Status.Running;
            GeneralEnable = true;
            IP = 0;
            LSLState = 0;
            TopFrame = null;
            Calls.Clear();
            Operands.Clear();
            EventQueue.Clear();
            NextWakeup = 0;
            StateCapturedOn = 0;
            TimerLastScheduledOn = 0;
            TimerInterval = 0;
            RunningEvent = null;
            PermsGranter = String.Empty;
            GrantedPermsMask = 0;
            ActiveListens.Clear();
            StartParameter = 0;

            //null out all globals
            for (int i = 0; i < Globals.Length; i++)
            {
                Globals[i] = null;
            }

            this.ResetRuntime();
        }