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


C# SObject.isFlonum方法代码示例

本文整理汇总了C#中SObject.isFlonum方法的典型用法代码示例。如果您正苦于以下问题:C# SObject.isFlonum方法的具体用法?C# SObject.isFlonum怎么用?C# SObject.isFlonum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SObject的用法示例。


在下文中一共展示了SObject.isFlonum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: op1_flonump

 public static SObject op1_flonump(SObject arg) {
     return Factory.makeBoolean(arg.isFlonum());
 }
开发者ID:justinethier,项目名称:larceny,代码行数:3,代码来源:ClassicOps.cs

示例2: datum2foreign


//.........这里部分代码省略.........
                case 0: // object
                {
                    if (obj is SFixnum || obj is ForeignBox) {
                        return obj;
                    } else {
                        Exn.error ("datum->foreign (object) expected F");
                        return Factory.Impossible;
                    }
                }
                case 1: // schemeobject
                {
                    return Factory.makeForeignBox (obj);
                }
                case 2: // string
                {
                    if (obj is SByteVL) {
                        string value = ((SByteVL)obj).asString();
                        return Factory.makeForeignBox (value);
                    } else {
                        Exn.error ("datum->foreign (string) expected string");
                        return Factory.Impossible;
                    }
                }
                case 3: // symbol
                {
                    Exn.error
                     ("datum->foreign (symbol) not implemented in runtime");
                    return Factory.Impossible;
                }
                case 4: // bytes
                {
                    if (obj is SByteVL) {
                        return Factory.makeForeignBox
                                (((SByteVL)obj).elements);
                    } else {
                        Exn.error
                         ("datum->foreign (bytes) expected bytevector");
                        return Factory.Impossible;
                    }
                }
                case 5: // int
                {
                    if (obj is SFixnum) {
                        return obj;
                    } else if (obj.isBignum()) {
                        SByteVL n = (SByteVL)obj;
                        if (Number.getBignumLength(n) == 1) {
                            uint magn = (uint)(Number.bignumRef(n, 1) << 16)
                                      + (uint)Number.bignumRef(n, 0);
                            int val = magn;
                            if (! (Number.getBignumSign(n)))
                                magn = - magn;
                            return Factory.makeForeignBox (val);
                        }
                    }
                    Exn.error("datum->foreign (int) expected small integer");
                    return Factory.Impossible;
                }
                case 6: // float
                {
                    if (obj.isFlonum()) {
                        double value = ((SByteVL)obj).unsafeAsDouble(0);
                        return Factory.makeForeignBox ((float)value);
                    } else {
                        Exn.error("datum->foreign (float) expected flonum");
                        return Factory.Impossible;
                    }
                }
                case 7: // double
                {
                    if (obj.isFlonum()) {
                        double value = ((SByteVL)obj).unsafeAsDouble(0);
                        return Factory.makeForeignBox (value);
                    } else {
                        Exn.error("datum->foreign (float) expected flonum");
                        return Factory.Impossible;
                    }
                }
                case 8: // void
                {
                    Exn.error("datum->foreign (void) not allowed");
                    return Factory.Impossible;
                }
                case 9: // message filter
                {
                    if (obj is Procedure)
                        return Factory.makeForeignBox
                                (new FFI_message_filter ((Procedure) obj));
                    else {
                        Exn.error
                         ("datum->foreign (message filter) expected procedure");
                        return Factory.Impossible;
                        }
                }
#endif

            }
            Exn.error("datum->foreign: unknown conversion");
            return Factory.Impossible;
        }
开发者ID:justinethier,项目名称:larceny,代码行数:101,代码来源:FFI.cs


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