Example #1
0
        private string Getter(string source)
        {
            var dest = DestinationSelecter.IsCommand(source);

            if (dest == SelfLanguageDestination.Ram)   //is a Ram source
            {
                return(HandleFromRam(source));
            }
            else if (dest == SelfLanguageDestination.Here)     //TODO
            {
                return(source.Replace("^", ""));
            }
            else if (dest == SelfLanguageDestination.Stack)     //Could be buggy cause of a R containing a -? keep the order this way
            {
                return(Convert.ToString(CommandStackCarry.Pop()));
            }
            else if (dest == SelfLanguageDestination.Number)
            {
                return(HandleFromMemory(Convert.ToInt32(source)));
            }
            else if (dest == SelfLanguageDestination.Compare)
            {
                return(Convert.ToString(Compare(source)));
            }
            else if (dest == SelfLanguageDestination.None)
            {
                throw new InvalidGetterException(string.Format("The get operation with the > {0} < source is not valid", source));
            }
            else
            {
                throw new NotImplementedException(); //HTF
            }
        }
Example #2
0
        private void Setter(string destination, string to_move)
        {
            var dest = DestinationSelecter.IsCommand(destination);

            if (dest == SelfLanguageDestination.Ram)
            {
                var dst   = destination.Split(':');
                var name  = dst.ElementAtOrDefault(1);
                var value = dst.ElementAtOrDefault(2);
                var type  = dst.ElementAtOrDefault(3);
                HandleToRam(string.Concat(name, ":", to_move, ":", type));
            }
            else if (dest == SelfLanguageDestination.Stack)
            {
                CommandStackCarry.Push(Convert.ToInt32(to_move));
            }
            else if (dest == SelfLanguageDestination.StackMultiChar)
            {
                to_move.ToList().ForEach((s) => CommandStackCarry.Push(Convert.ToInt32(s)));
            }
            else if (dest == SelfLanguageDestination.Number)
            {
                LoadInMemory(to_move, Convert.ToInt32(destination));
            }
            else if (dest == SelfLanguageDestination.None)
            {
                throw new InvalidMoveException(string.Format("The destination {0} is not well formed", destination));
            }
            else
            {
                throw new NotImplementedException(); //HTF
            }
        }
Example #3
0
 /// <summary>
 /// Set the CommandValueCarry
 /// </summary>
 /// <param name="i">Pointer</param>
 private void SetCarry(int i)
 {
     CommandStackCarry.Push(GetNFrom(i + 2));
 }
Example #4
0
 /// <summary>
 /// Write using the GenericLog a Log Object
 /// </summary>
 private void WriteValueCarry()
 {
     GenericLog(new Logging(Convert.ToString((char)CommandStackCarry.Pop()), _pointer));
 }