コード例 #1
0
ファイル: DMProc.cs プロジェクト: redmoogle/OpenDream
        public DreamThread Spawn()
        {
            var thread = new DreamThread();

            var state = new DMProcState(this, thread);

            thread.PushProcState(state);

            return(thread);
        }
コード例 #2
0
ファイル: DMProc.cs プロジェクト: redmoogle/OpenDream
        public DMProcState(DMProcState other, DreamThread thread)
            : base(thread)
        {
            if (other.EnumeratorStack.Count > 0)
            {
                throw new NotImplementedException();
            }

            _proc         = other._proc;
            Instance      = other.Instance;
            Usr           = other.Usr;
            ArgumentCount = other.ArgumentCount;
            _pc           = other._pc;

            _stack = _stackPool.Rent(other._stack.Length);
            Array.Copy(other._stack, _stack, _stack.Length);

            _localVariables = _dreamValuePool.Rent(256);
            Array.Copy(other._localVariables, _localVariables, 256);
        }