Пример #1
0
        static byte GetNumericOpcode(Instruction.Opcodes opcode)
        {
            switch (opcode)
            {
            case Instruction.Opcodes.Jump:
                return(0);

            case Instruction.Opcodes.Const:
                return(1);

            case Instruction.Opcodes.Prim0:
                return(2);

            case Instruction.Opcodes.Prim:
                return(3);

            case Instruction.Opcodes.Call:
                return(4);

            case Instruction.Opcodes.CallJ:
                return(5);

            case Instruction.Opcodes.Fjump:
                return(6);

            case Instruction.Opcodes.Lset:
                return(7);

            case Instruction.Opcodes.Pop:
                return(8);

            case Instruction.Opcodes.Lget:
                return(9);

            case Instruction.Opcodes.Fn:
                return(10);

            case Instruction.Opcodes.NewFrame:
                return(11);

            case Instruction.Opcodes.DropFrame:
                return(12);

            case Instruction.Opcodes.Args:
                return(13);

            case Instruction.Opcodes.Return:
                return(14);

            case Instruction.Opcodes.Block:
                return(15);

            case Instruction.Opcodes.PopBlock:
                return(16);

            case Instruction.Opcodes.BlockReturn:
                return(17);

            case Instruction.Opcodes.Context:
                return(18);

            case Instruction.Opcodes.Tjump:
                return(19);

            case Instruction.Opcodes.FileName:
                return(20);

            case Instruction.Opcodes.VmVersion:
                return(20);

            case Instruction.Opcodes.VmSourcesMd5:
                return(20);

            case Instruction.Opcodes.VmBytecodeMd5:
                return(20);

            case Instruction.Opcodes.Div:
                return(21);

            case Instruction.Opcodes.Mod:
                return(22);

            case Instruction.Opcodes.Neq:
                return(23);

            case Instruction.Opcodes.Lt:
                return(24);

            case Instruction.Opcodes.Add:
                return(25);

            case Instruction.Opcodes.Gref:
                return(26);

            case Instruction.Opcodes.Eq:
                return(27);

            case Instruction.Opcodes.Apush:
                return(28);

            case Instruction.Opcodes.GrefDot:
                return(29);

            case Instruction.Opcodes.Sub:
                return(30);

            case Instruction.Opcodes.Neg:
                return(31);

            case Instruction.Opcodes.Mul:
                return(32);

            case Instruction.Opcodes.Shl:
                return(33);

            case Instruction.Opcodes.Shr:
                return(34);

            case Instruction.Opcodes.Pow:
                return(35);

            case Instruction.Opcodes.Floor:
                return(36);

            case Instruction.Opcodes.Lte:
                return(37);

            case Instruction.Opcodes.Gt:
                return(38);

            case Instruction.Opcodes.Gte:
                return(39);

            case Instruction.Opcodes.Not:
                return(40);

            case Instruction.Opcodes.And:
                return(41);

            case Instruction.Opcodes.Ior:
                return(42);

            case Instruction.Opcodes.Xor:
                return(43);

            case Instruction.Opcodes.Keys:
                return(44);

            case Instruction.Opcodes.HasKey:
                return(45);

            case Instruction.Opcodes.Apop:
                return(46);

            case Instruction.Opcodes.SetIndexed:
                return(47);

            case Instruction.Opcodes.Len:
                return(48);

            case Instruction.Opcodes.IsString:
                return(49);

            case Instruction.Opcodes.IsHash:
                return(50);

            case Instruction.Opcodes.IsBool:
                return(51);

            case Instruction.Opcodes.IsArray:
                return(52);

            case Instruction.Opcodes.IsNumber:
                return(53);

            case Instruction.Opcodes.IsInteger:
                return(54);

            case Instruction.Opcodes.IsCallable:
                return(55);

            default:
                Utils.Panic();
                return(0);
            }
        }