当前位置: 首页>>代码示例>>C#>>正文


C# Lib.OpCodeData类代码示例

本文整理汇总了C#中Muftec.Lib.OpCodeData的典型用法代码示例。如果您正苦于以下问题:C# OpCodeData类的具体用法?C# OpCodeData怎么用?C# OpCodeData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OpCodeData类属于Muftec.Lib命名空间,在下文中一共展示了OpCodeData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InStrReverse

        public static void InStrReverse(OpCodeData data)
        {
            var item2 = data.RuntimeStack.PopStr();
            var item1 = data.RuntimeStack.PopStr();

            data.RuntimeStack.Push(item1.LastIndexOf(item2));
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:7,代码来源:Strings.cs

示例2: Concatenate

        public static void Concatenate(OpCodeData data)
        {
            var item2 = data.RuntimeStack.PopStr();
            var item1 = data.RuntimeStack.PopStr();

            data.RuntimeStack.Push(String.Concat(item1, item2));
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:7,代码来源:Strings.cs

示例3: ArrayAppendItem

 public static void ArrayAppendItem(OpCodeData data)
 {
     var array = data.RuntimeStack.PopArray();
     var item = data.RuntimeStack.Pop();
     array.Add(item);
     data.RuntimeStack.Push(array);
 }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:7,代码来源:Arrays.cs

示例4: StackItemLReverse

        public static void StackItemLReverse(OpCodeData data)
        {
            var count = data.RuntimeStack.PopInt();
            if (count == 0) return;
            if (count < 0)
                throw new MuftecInvalidStackItemTypeException(data.RuntimeStack);

            // Take n items
            var popped = new List<MuftecStackItem>();

            for (var i = 0; i < count; i++)
            {
                var item = data.RuntimeStack.Pop();
                popped.Add(item);
            }

            // Push in reverse order
            foreach (var item in popped)
            {
                data.RuntimeStack.Push(item);
            }

            // Re-add count
            data.RuntimeStack.Push(count);
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:25,代码来源:StackOperations.cs

示例5: ArrayCompare

        public static void ArrayCompare(OpCodeData data)
        {
            var array2 = data.RuntimeStack.PopArray();
            var array1 = data.RuntimeStack.PopArray();

            data.RuntimeStack.Push(array1.SequenceEqual(array2));
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:7,代码来源:Arrays.cs

示例6: Atangent2

        public static void Atangent2(OpCodeData data)
        {
            var fx = data.RuntimeStack.PopFloat();
            var fy = data.RuntimeStack.PopFloat();

            data.RuntimeStack.Push(System.Math.Atan2(fy, fx));
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:7,代码来源:Float.cs

示例7: ArrayDeleteItem

        public static void ArrayDeleteItem(OpCodeData data)
        {
            var index = data.RuntimeStack.PopInt();
            var array = data.RuntimeStack.PopArray();

            array.RemoveAt(index);
            data.RuntimeStack.Push(array);
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:8,代码来源:Arrays.cs

示例8: ArrayDeleteRange

        public static void ArrayDeleteRange(OpCodeData data)
        {
            var index2 = data.RuntimeStack.PopInt();
            var index1 = data.RuntimeStack.PopInt();
            var array = data.RuntimeStack.PopArray().ToList();

            array.RemoveRange(index1, index2 - index1 + 1);
            data.RuntimeStack.Push(array);
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:9,代码来源:Arrays.cs

示例9: ReadLineTest

        public void ReadLineTest()
        {
            var runtimeStack = new Stack<MuftecStackItem>();
            var data = new OpCodeData(runtimeStack);
            InputOutput.ReadLine(data);

            var runtimeStackExpected = new Stack<MuftecStackItem>();
            runtimeStackExpected.Push(MuftecStackItem.Null);

            TestShared.CompareStacks(runtimeStack, runtimeStackExpected);
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:11,代码来源:InputOutputTest.cs

示例10: PrintTest

        public void PrintTest()
        {
            var runtimeStack = new Stack<MuftecStackItem>();
            var data = new OpCodeData(runtimeStack);
            runtimeStack.Push("Sample string");
            InputOutput.Print(data);

            var runtimeStackExpected = new Stack<MuftecStackItem>();

            TestShared.CompareStacks(runtimeStack, runtimeStackExpected);
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:11,代码来源:InputOutputTest.cs

示例11: StackItemDupN

        public static void StackItemDupN(OpCodeData data)
        {
            var count = data.RuntimeStack.PopInt();
            if (count == 0) return;
            if (count < 0)
                throw new MuftecInvalidStackItemTypeException(data.RuntimeStack);

            var topItems = data.RuntimeStack.Take(count).Reverse().ToList();
            foreach (var item in topItems)
            {
                data.RuntimeStack.Push(item);
            }
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:13,代码来源:StackOperations.cs

示例12: Explode

        public static void Explode(OpCodeData data)
        {
            var item2 = data.RuntimeStack.PopStr();
            var item1 = data.RuntimeStack.PopStr();
            var exploded = item1.Split(new[] { item2 }, StringSplitOptions.None);

            data.RuntimeStack.Push(exploded.Length);

            foreach (var s in exploded)
            {
                data.RuntimeStack.Push(s);
            }
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:13,代码来源:Strings.cs

示例13: ConcatenateTest

        public void ConcatenateTest()
        {
            var runtimeStack = new Stack<MuftecStackItem>();
            var data = new OpCodeData(runtimeStack);
            runtimeStack.Push("test");
            runtimeStack.Push("string");
            Strings.Concatenate(data);

            var runtimeStackExpected = new Stack<MuftecStackItem>();
            runtimeStackExpected.Push("teststring");

            TestShared.CompareStacks(runtimeStack, runtimeStackExpected);
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:13,代码来源:StringsTest.cs

示例14: StackDepthTest

        public void StackDepthTest()
        {
            var runtimeStack = new Stack<MuftecStackItem>();
            var data = new OpCodeData(runtimeStack);
            runtimeStack.Push("Alfredo");
            runtimeStack.Push(1.99);
            StackOperations.StackDepth(data);

            var runtimeStackExpected = new Stack<MuftecStackItem>();
            runtimeStackExpected.Push("Alfredo");
            runtimeStackExpected.Push(1.99);
            runtimeStackExpected.Push(2);

            TestShared.CompareStacks(runtimeStack, runtimeStackExpected);
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:15,代码来源:StackOperationsTest.cs

示例15: ArrayAppendItemTest

        public void ArrayAppendItemTest()
        {
            var runtimeStack = new Stack<MuftecStackItem>();
            var data = new OpCodeData(runtimeStack);
            runtimeStack.Push(6);
            Arrays.ArrayStart(data);
            runtimeStack.Push(5);
            Arrays.ArrayEnd(data);
            Arrays.ArrayMake(data);
            Arrays.ArrayAppendItem(data);

            var runtimeStackExpected = new Stack<MuftecStackItem>();
            runtimeStackExpected.Push(new MuftecList { 5, 6 });

            TestShared.CompareStacks(runtimeStack, runtimeStackExpected);
        }
开发者ID:AndrewNeo,项目名称:muftec,代码行数:16,代码来源:ArraysTest.cs


注:本文中的Muftec.Lib.OpCodeData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。