當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。