Example #1
0
        public void Run(vThread from)
        {
            vArray array = from.getArg(0) as vArray;
            int    index = (int)from.getArg(1);

            from.stack.Push(array.array[index]);
        }
Example #2
0
        public void Run(vThread from)
        {
            int    len = (int)from.stack.Pop();
            vArray a   = new vArray(len, from);

            from.stack.Push(a);
        }
Example #3
0
        public void Run(vThread from)
        {
            vArray array = from.getArg(0) as vArray;
            object val   = from.stack.Pop();
            int    index = (int)from.getArg(1);

            array.array[index] = val;
        }
Example #4
0
        public void Run(vThread from)
        {
            char   c = (char)from.stack.Pop();
            string s = from.stack.Pop() as string;

            string[] arr = s.Split(c);

            vArray a = new vArray(arr.Length, from);

            a.array = arr;

            from.stack.Push(a);
        }
Example #5
0
        public void Run(vThread from)
        {
            string to = from.stack.Pop() as string;
            object f  = from.stack.Pop();
            object r  = 0;

            if (f is string)
            {
                if (to == "string")
                {
                    r = f as string;
                }
                else if (to == "int")
                {
                    r = Convert.ToInt32(f as string);
                }
                else if (to == "double")
                {
                    r = Convert.ToDouble(f as string);
                }
                else if (to == "bool")
                {
                    r = Convert.ToBoolean(f as string);
                }
                else if (to == "char")
                {
                    char[]   ca = (f as string).ToCharArray();
                    vArray   a  = new vArray(ca.Length, from);
                    object[] oa = new object[ca.Length];
                    for (int i = 0; i < ca.Length; i++)
                    {
                        oa[i] = (object)ca[i];
                    }
                    a.array = oa;
                    r       = a;
                }
            }
            else if (f is int)
            {
                if (to == "string")
                {
                    r = Convert.ToString((int)f);
                }
                else if (to == "int")
                {
                    r = (int)f;
                }
                else if (to == "double")
                {
                    r = Convert.ToDouble((int)f);
                }
                else if (to == "bool")
                {
                    r = Convert.ToBoolean((int)f);
                }
                else if (to == "char")
                {
                    r = (char)((int)f);
                }
            }
            else if (f is double)
            {
                if (to == "string")
                {
                    r = Convert.ToString((double)f);
                }
                else if (to == "int")
                {
                    r = Convert.ToInt32((double)f);
                }
                else if (to == "double")
                {
                    r = (double)f;
                }
                else if (to == "bool")
                {
                    r = Convert.ToBoolean((double)f);
                }
                else if (to == "char")
                {
                    r = (char)(Convert.ToInt32((double)f));
                }
            }
            else if (f is bool)
            {
                if (to == "string")
                {
                    r = Convert.ToString((bool)f);
                }
                else if (to == "int")
                {
                    r = Convert.ToInt32((bool)f);
                }
                else if (to == "double")
                {
                    r = Convert.ToDouble((bool)f);
                }
                else if (to == "bool")
                {
                    r = (bool)f;
                }
                else if (to == "char")
                {
                    r = Convert.ToChar((bool)f);
                }
            }
            else if (f is char)
            {
                if (to == "string")
                {
                    r = Convert.ToString((char)f);
                }
                else if (to == "int")
                {
                    r = Convert.ToInt32((char)f);
                }
                else if (to == "double")
                {
                    r = Convert.ToDouble((char)f);
                }
                else if (to == "bool")
                {
                    r = Convert.ToBoolean((char)f);
                }
                else if (to == "char")
                {
                    r = (char)f;
                }
            }
            else if (f is vArray)
            {
                if (to == "string")
                {
                    r = ((vArray)f).CSTring();
                }
                else if (to == "int")
                {
                    r = ((vArray)f).CInt();
                }
                else if (to == "double")
                {
                    r = ((vArray)f).CDouble();
                }
                else if (to == "bool")
                {
                    r = ((vArray)f).CBool();
                }
                else if (to == "char")
                {
                    r = ((vArray)f).CChar();
                }
            }
            from.stack.Push(r);
        }
Example #6
0
 public void Run(vThread from)
 {
     int len = (int)from.stack.Pop();
     vArray a = new vArray(len, from);
     from.stack.Push(a);
 }
Example #7
0
        public void Run(vThread from)
        {
            string to = from.stack.Pop() as string;
            object f = from.stack.Pop();
            object r = 0;

            if (f is string)
            {
                if (to == "string")
                {
                    r = f as string;
                }
                else if (to == "int")
                {
                    r = Convert.ToInt32(f as string);
                }
                else if (to == "double")
                {
                    r = Convert.ToDouble(f as string);
                }
                else if (to == "bool")
                {
                    r = Convert.ToBoolean(f as string);
                }
                else if (to == "char")
                {
                    char[] ca = (f as string).ToCharArray();
                    vArray a = new vArray(ca.Length, from);
                    object[] oa = new object[ca.Length];
                    for (int i = 0; i < ca.Length; i++)
                    {
                        oa[i] = (object)ca[i];
                    }
                    a.array = oa;
                    r = a;
                }
            }
            else if (f is int)
            {
                if (to == "string")
                {
                    r = Convert.ToString((int)f);
                }
                else if (to == "int")
                {
                    r = (int)f;
                }
                else if (to == "double")
                {
                    r = Convert.ToDouble((int)f);
                }
                else if (to == "bool")
                {
                    r = Convert.ToBoolean((int)f);
                }
                else if (to == "char")
                {
                    r = (char)((int)f);
                }
            }
            else if (f is double)
            {
                if (to == "string")
                {
                    r = Convert.ToString((double)f);
                }
                else if (to == "int")
                {
                    r = Convert.ToInt32((double)f);
                }
                else if (to == "double")
                {
                    r = (double)f;
                }
                else if (to == "bool")
                {
                    r = Convert.ToBoolean((double)f);
                }
                else if (to == "char")
                {
                    r = (char)(Convert.ToInt32((double)f));
                }
            }
            else if (f is bool)
            {
                if (to == "string")
                {
                    r = Convert.ToString((bool)f);
                }
                else if (to == "int")
                {
                    r = Convert.ToInt32((bool)f);
                }
                else if (to == "double")
                {
                    r = Convert.ToDouble((bool)f);
                }
                else if (to == "bool")
                {
                    r = (bool)f;
                }
                else if (to == "char")
                {
                    r = Convert.ToChar((bool)f);
                }
            }
            else if (f is char)
            {
                if (to == "string")
                {
                    r = Convert.ToString((char)f);
                }
                else if (to == "int")
                {
                    r = Convert.ToInt32((char)f);
                }
                else if (to == "double")
                {
                    r = Convert.ToDouble((char)f);
                }
                else if (to == "bool")
                {
                    r = Convert.ToBoolean((char)f);
                }
                else if (to == "char")
                {
                    r = (char)f;
                }
            }
            else if (f is vArray)
            {
                if (to == "string")
                {
                    r = ((vArray)f).CSTring();
                }
                else if (to == "int")
                {
                    r = ((vArray)f).CInt();
                }
                else if (to == "double")
                {
                    r = ((vArray)f).CDouble();
                }
                else if (to == "bool")
                {
                    r = ((vArray)f).CBool();
                }
                else if (to == "char")
                {
                    r = ((vArray)f).CChar();
                }
            }
            from.stack.Push(r);
        }
Example #8
0
        public void Run(vThread from)
        {
            char c = (char)from.stack.Pop();
            string s = from.stack.Pop() as string;

            string[] arr = s.Split(c);

            vArray a = new vArray(arr.Length, from);
            a.array = arr;

            from.stack.Push(a);
        }