• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SimpleForth.Forth类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Main

        static void Main(string[] args)
        {
            try
            {
#if false
                using (MemoryBlock mb = new MemoryBlock((UIntPtr)0x20000))
                {
                    Console.WriteLine("Is64Bit = " + MemoryBlock.Is64Bit);
                    Console.WriteLine("mb.Location = " + mb.Location);
                    Console.WriteLine("mb.Size = " + mb.Size);

                    Marshal.WriteByte(mb.Location, (byte)32);
                    byte b = Marshal.ReadByte(mb.Location);
                    System.Diagnostics.Debug.Assert(b == (byte)32);

                    mb.Security = MemoryBlockSecurity.ReadOnly;

                    byte b2 = Marshal.ReadByte(mb.Location);
                    Marshal.WriteByte(mb.Location, (byte)64);
                }
#endif
                Console.SetBufferSize(120, 60);
                Console.SetWindowSize(120, 60);
                Console.WriteLine("Sunlit World Forth in C#");
                Console.WriteLine("Copyright (c) 2007 by Edward Kiser");
                Console.WriteLine("All Rights Reserved");
                if (MemoryBlock.Is64Bit) Console.WriteLine("[Running in 64-bit Mode]");
                using (MemoryBlock mb = new MemoryBlock((UIntPtr)0x20000))
                {
                    mb.Security = MemoryBlockSecurity.ExecuteReadWrite;
                    Forth f = new Forth();
                    f.ByteMemory = new MemoryAccessor(mb.Location, mb.Size);
                    f.LoadX86Asm();
                    bool done = false;
                    f.Execute("also forth definitions previous");
                    f.Define("bye", delegate(Forth g) { done = true; });
                    f.Execute("vocabulary user  also user definitions");
                    while (!done)
                    {
                        if (f.IsCompiling) Console.WriteLine("ok (compiling)"); else Console.WriteLine("ok");
                        string x = Console.ReadLine();
                        f.Execute(x);
                    }
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine();
                Console.WriteLine("***** Exception! *****");
                Console.WriteLine();
                Console.WriteLine(exc);
            }
            Console.WriteLine("Press a key...");
            Console.ReadKey();
        }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:55,代码来源:Program.cs


示例2: Hex

 public static void Hex(Forth f)
 {
     f.numericBase = 16;
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:4,代码来源:Forth.cs


示例3: Run

 public void Run(Forth f)
 {
     f.rStack.Push(0);
     while(true)
     {
         int pos = f.rStack.Pop();
         if (pos < 0 || pos >= components.Count) break;
         int posNext = pos + 1;
         f.rStack.Push(posNext);
         components[pos](f);
     }
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:12,代码来源:Forth.cs


示例4: Allot

 public static void Allot(Forth f)
 {
     long amt = f.PopInt64();
     if (amt > (long)(f.memory.Length - f.here)) throw new ArgumentOutOfRangeException("Attempt to allot more memory than is available");
     f.here += (int)amt;
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例5: Comma

 public static void Comma(Forth f)
 {
     object v = f.dStack.Pop();
     f.memory[f.here] = v;
     f.here++;
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例6: Bang

 public static void Bang(Forth f)
 {
     long index = f.PopInt64();
     object v = f.dStack.Pop();
     f.memory[(int)index] = v;
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例7: Unused

 public static void Unused(Forth f)
 {
     f.PushInt64((long)(f.memory.Length - f.here));
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:4,代码来源:Forth.cs


示例8: IsExecutionToken

 public static void IsExecutionToken(Forth f)
 {
     bool b = (f.dStack.Top is ExecutionToken);
     f.dStack.Pop();
     f.PushBool(b);
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例9: Not

 public static void Not(Forth f)
 {
     bool b = f.PopBool();
     f.PushBool(!b);
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:5,代码来源:Forth.cs


示例10: IsNotLessThanUnsigned

 public static void IsNotLessThanUnsigned(Forth f)
 {
     ulong b = f.PopUInt64();
     ulong a = f.PopUInt64();
     f.PushBool(a >= b);
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例11: IsNotGreaterThanUnsigned

 public static void IsNotGreaterThanUnsigned(Forth f)
 {
     ulong b = f.PopUInt64();
     ulong a = f.PopUInt64();
     f.PushBool(a <= b);
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例12: IsNotLessThan

 public static void IsNotLessThan(Forth f)
 {
     long b = f.PopInt64();
     long a = f.PopInt64();
     f.PushBool(a >= b);
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例13: IsNotGreaterThan

 public static void IsNotGreaterThan(Forth f)
 {
     long b = f.PopInt64();
     long a = f.PopInt64();
     f.PushBool(a <= b);
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例14: DoesNotEqual

 public static void DoesNotEqual(Forth f)
 {
     ulong b = f.PopUInt64();
     ulong a = f.PopUInt64();
     f.PushBool(a != b);
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例15: Equals

 public static void Equals(Forth f)
 {
     ulong b = f.PopUInt64();
     ulong a = f.PopUInt64();
     f.PushBool(a == b);
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例16: IsNull

 public static void IsNull(Forth f)
 {
     bool b = (f.dStack.Top == null);
     f.dStack.Pop();
     f.dStack.Push(b);
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例17: IsLong

 public static void IsLong(Forth f)
 {
     bool b = (f.dStack.Top is long);
     f.dStack.Pop();
     f.PushBool(b);
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例18: Dot

 public static void Dot(Forth f)
 {
     object obj = f.dStack.Pop();
     Console.Write(Convert.ToString(obj));
     Console.Write(" ");
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:6,代码来源:Forth.cs


示例19: Here

 public static void Here(Forth f)
 {
     f.PushInt64((long)(f.here));
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:4,代码来源:Forth.cs


示例20: UnsignedDot

 public static void UnsignedDot(Forth f)
 {
     object obj = f.dStack.Pop();
     if (obj is long)
     {
         long l = (long)obj;
         ulong u = unchecked((ulong)l);
         obj = u;
     }
     Console.Write(Convert.ToString(obj));
     Console.Write(" ");
 }
开发者ID:Sunlighter,项目名称:SimpleForth,代码行数:12,代码来源:Forth.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SimpleInjector.Container类代码示例发布时间:2022-05-26
下一篇:
C# SimpleCalculator.Parse类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap