示例#1
0
 void AddNot()
 {
     MemoryStorage.Add("not", new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) =>
     {
         return((byte)(~stateMachine.SharedContext));
     })));
 }
示例#2
0
 void AddFalse()
 {
     MemoryStorage.Add("false", new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) =>
     {
         return((byte)(stateMachine.SharedContext = (byte)(stateMachine.SharedContext | CommandConstants.False)));
     })));
 }
示例#3
0
 void AddAndAll()
 {
     MemoryStorage.Add("andall", new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) =>
     {
         return((byte)(stateMachine.SharedContext = (byte)(stateMachine.SharedContext & CommandConstants.All)));
     })));
 }
示例#4
0
        void AddLoad(SharedKeyEnumerable <string> codeEnum)
        {
            var load = new LoadStateDirty <SavedSharedContextState <string, byte>, string, byte>();

            load.SourceStream = codeEnum;
            MemoryStorage.Add(nameof(load), load);
        }
示例#5
0
        void AddAlloc(SharedKeyEnumerable <string> codeEnum)
        {
            var alloc = new AllocateNamedSharedContextStateDirty <SavedSharedContextState <string, byte>, string, byte>();

            alloc.SourceStream = codeEnum;
            MemoryStorage.Add(nameof(alloc), alloc);
        }
示例#6
0
        void AddCopy(SharedKeyEnumerable <string> codeEnum)
        {
            var copy = new CopyStateDirty <SavedSharedContextState <string, byte>, string, byte>();

            copy.SourceStream = codeEnum;
            MemoryStorage.Add(nameof(copy), copy);
        }
示例#7
0
        void AddClear()
        {
            var clear = new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) =>
            {
                return((byte)(CommandConstants.None));
            }));

            MemoryStorage.Add(nameof(clear), clear);
        }
示例#8
0
 void AddPrint()
 {
     MemoryStorage.Add("print", new CommandStateDelegate <string, byte>((stateMachine) =>
     {
         var currentContext = stateMachine.SharedContext;
         System.Console.WriteLine(Convert.ToString(currentContext, 2));
         return(currentContext);
     }));
 }
示例#9
0
        void AddInterrupt()
        {
            var interrupt = new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) =>
            {
                return((byte)(stateMachine.SharedContext = (byte)(stateMachine.SharedContext | CommandConstants.Interrupt)));
            }));

            MemoryStorage.Add(nameof(interrupt), interrupt);
        }
示例#10
0
        void AddMov()
        {
            var mov = new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) =>
            {
                return((byte)(stateMachine.SharedContext = (byte)(stateMachine.SharedContext | CommandConstants.Move)));
            }));

            MemoryStorage.Add(nameof(mov), mov);
        }
示例#11
0
 void AddSaveLast()
 {
     MemoryStorage.Add("save_to_last_new", new CommandStateDelegate <string, byte>((stateMachine) =>
     {
         var currentContext = stateMachine.SharedContext;
         var tkey           = (MemoryStorage["newInstance"] as AllocateSharedContextStateDirty <SavedSharedContextState <string, byte>, string, byte>).NewKey;
         stateMachine.GetService.Get(tkey).Handle(stateMachine);
         return(currentContext);
     }));
 }
示例#12
0
        void AddNewInstance()
        {
            var newInstance = new AllocateSharedContextStateDirty <SavedSharedContextState <string, byte>, string, byte>();

            MemoryStorage.Add(nameof(newInstance), newInstance);
        }
示例#13
0
        void AddSave()
        {
            var save = new SavedSharedContextState <string, byte>();

            MemoryStorage.Add(nameof(save), save);
        }