Example #1
0
        public VAL GetValData()
        {
            VALL L = new VALL();

            L.Add(new VAL(ty.FullName));
            L.Add(new VAL(this));
            return(new VAL(L));
        }
Example #2
0
        //Add Association
        public VALL Add(string key, VAL val)
        {
            VALL L = new VALL();

            L.Add(new VAL(key));
            L.Add(val);
            list.Add(new VAL(L));
            return(this);
        }
Example #3
0
        private void Callback(object sender, EventArgs e)
        {
            VALL L = new VALL();

            L.Add(VAL.NewHostType(sender));
            L.Add(VAL.NewHostType(e));
            VAL arguments = new VAL(L);

            ret = CPU.ExternalUserFuncCall(func, instance, arguments, context);
        }
Example #4
0
        private Computer()
        {
            ds1 = new Memory();
            ds2 = new Memory();

            register("object", typeof(object));
            register("bool", typeof(bool));

            register("sbyte", typeof(sbyte));
            register("byte", typeof(byte));
            register("short", typeof(short));
            register("ushort", typeof(ushort));
            register("int", typeof(int));
            register("uint", typeof(uint));
            register("long", typeof(long));
            register("ulong", typeof(ulong));

            register("double", typeof(double));
            register("float", typeof(float));
            register("decimal", typeof(decimal));

            register("char", typeof(char));
            register("string", typeof(string));



            VALL L = new VALL();

            L.Add("VOID", new VAL((int)VALTYPE.voidcon));
            L.Add("NULL", new VAL((int)VALTYPE.nullcon));
            L.Add("BOOL", new VAL((int)VALTYPE.boolcon));
            L.Add("INT", new VAL((int)VALTYPE.intcon));
            L.Add("DOUBLE", new VAL((int)VALTYPE.doublecon));
            L.Add("STRING", new VAL((int)VALTYPE.stringcon));
            L.Add("LIST", new VAL((int)VALTYPE.listcon));
            L.Add("FUNCTION", new VAL((int)VALTYPE.funccon));
            L.Add("CLASS", new VAL((int)VALTYPE.classcon));
            L.Add("HOST", new VAL((int)VALTYPE.hostcon));

            ds1.Add("TYPE", new VAL(L));


            //HostType.Register(new Type[]
            //{
            //    typeof(DateTime),
            //    typeof(string),
            //    typeof(System.Reflection.Assembly),
            //    typeof(Tie.HostType)
            //}, true);
        }
Example #5
0
        private void paramsArray(int argc1, int argc2)
        {
            int diff = argc1 - argc2;

            VAL retAddr = SS.Pop();

            VALL L1 = new VALL();

            for (int i = 0; i < argc2 - 1; i++)
            {
                L1.Insert(SS.Pop());
            }

            VALL L2 = new VALL();

            for (int i = 0; i <= diff; i++)
            {
                L2.Add(SS.Pop());
            }
            SS.Push(new VAL(L2));

            for (int i = 0; i < argc2 - 1; i++)
            {
                SS.Push(L1[i]);
            }

            SS.Push(retAddr);

            CS[retAddr.Intcon].operand.Addr += diff;
        }
Example #6
0
        public VALL Slice(int start, int stop, int step)
        {
            VALL L = new VALL();

            for (int i = start; i <= Pos(stop); i += step)
            {
                L.Add(VAL.Clone(list[i]));
            }
            return(L);
        }
Example #7
0
        private VALL SysFuncBeginParameter()
        {
            int  count = SysFuncBegin();
            VALL L     = new VALL();

            for (int i = 0; i < count; i++)
            {
                L.Add(SysFuncParam(i));
            }

            return(L);
        }
Example #8
0
        public static VAL OperatorOverloading(Operator opr, VAL v1, VAL v2, bool silent)
        {
            VALL L = new VALL();

            L.Add(v1);

            if ((object)v2 != null)
            {
                L.Add(v2);
            }

            HostFunction hFunc = new HostFunction(v1.value, opr.ToString(), L);

            if (silent)
            {
                return(hFunc.RunFunctionSilently(null));
            }
            else
            {
                return(hFunc.RunFunction(null));
            }
        }
Example #9
0
        internal static VAL Assemble(Memory memory)
        {
            VALL L = new VALL();

            foreach (KeyValuePair <string, VAL> pair in memory.ds)
            {
                //if (pair.Value.ty == VALTYPE.funccon || pair.Value.ty == VALTYPE.classcon)
                //    continue;

                L.Add(pair.Key, pair.Value);
            }
            return(new VAL(L));
        }