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


C# ElaValue类代码示例

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


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

示例1: AddField

 public ElaRecord AddField(string field, ElaValue value, ElaRecord rec)
 {
     var fieldList = new List<ElaRecordField>();
     fieldList.AddRange(rec);
     fieldList.Add(new ElaRecordField(field, value));
     return new ElaRecord(fieldList.ToArray());
 }
开发者ID:rizwan3d,项目名称:elalang,代码行数:7,代码来源:RecordModule.cs

示例2: CallPoint

 internal CallPoint(int modHandle, EvalStack stack, ElaValue[] locals, FastList<ElaValue[]> captures)
 {
     ModuleHandle = modHandle;
     Locals = locals;
     Captures = captures;
     Stack = stack;
 }
开发者ID:rizwan3d,项目名称:elalang,代码行数:7,代码来源:CallPoint.cs

示例3: Divide

        internal override ElaValue Divide(ElaValue left, ElaValue right, ExecutionContext ctx)
        {
            if (right.TypeId != ElaMachine.REA)
            {
                if (right.TypeId == ElaMachine.DBL)
                    return new ElaValue(left.DirectGetSingle() / right.Ref.AsDouble());
                else if (right.TypeId == ElaMachine.INT)
                    return new ElaValue(left.DirectGetSingle() / right.I4);
                else if (right.TypeId == ElaMachine.LNG)
                    return new ElaValue(left.DirectGetSingle() / right.Ref.AsLong());
                else
                {
                    NoOverloadBinary(TCF.SINGLE, right, "divide", ctx);
                    return Default();
                }
            }

            if (right.DirectGetSingle() == 0)
            {
                ctx.DivideByZero(left);
                return Default();
            }

            return new ElaValue(left.DirectGetSingle() / right.DirectGetSingle());
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:25,代码来源:SingleInstance.cs

示例4: Force

        internal ElaValue Force()
        {
            if (Value.Ref == null)
            {
                var fun = Function;

                while (fun != null)
                {
                    Value = fun.CallWithThrow(
                        fun.LastParameter.Ref != null ? fun.LastParameter :
                        new ElaValue(ElaUnit.Instance));

                    if (Value.Ref is ElaLazy)
                    {
                        var la = (ElaLazy)Value.Ref;

                        if (la.Value.Ref == null && la.Function != null)
                            fun = la.Function;
                        else
                        {
                            Value = la.Value;
                            fun = null;
                        }
                    }
                    else
                        fun = null;
                }
            }

            return Value;
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:31,代码来源:ElaLazy.cs

示例5: Quot

        internal override ElaValue Quot(ElaValue left, ElaValue right, ExecutionContext ctx)
        {
            if (right.TypeId != ElaMachine.LNG)
            {
                if (right.TypeId == ElaMachine.INT)
                {
                    if (right.I4 == 0)
                    {
                        ctx.DivideByZero(left);
                        return Default();
                    }

                    return new ElaValue(left.Ref.AsLong() / right.I4);
                }
                else
                {
                    ctx.NoOverload(left.GetTypeName() + "->" + left.GetTypeName() + "->*", left.GetTypeName() + "->" + right.GetTypeName() + "->*", "quot");
                    return Default();
                }
            }

            var r = right.Ref.AsLong();

            if (r == 0)
            {
                ctx.DivideByZero(left);
                return Default();
            }

            return new ElaValue(left.Ref.AsLong() / right.Ref.AsLong());
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:31,代码来源:ElaLong.cs

示例6: AvlTree

 internal AvlTree(ElaValue key, ElaValue value, AvlTree left, AvlTree right)
 {
     Key = key;
     Value = value;
     Left = left;
     Right = right;
     TreeHeight = 1 + Math.Max(Height(left), Height(right));
 }
开发者ID:rizwan3d,项目名称:elalang,代码行数:8,代码来源:AvlTree.cs

示例7: GetValue

        public ElaVariant GetValue(ElaValue key, ElaMap map)
        {
            if (map.Tree.IsEmpty)
                return ElaVariant.None();

            var res = map.Tree.Search(key);
            return res.IsEmpty ? ElaVariant.None() : ElaVariant.Some(res.Value);
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:8,代码来源:MapModule.cs

示例8: Convert

        protected override ElaValue Convert(ElaValue @this, ElaTypeInfo type, ExecutionContext ctx)
        {
            if (type.ReflectedTypeCode == ElaTypeCode.String)
                return new ElaValue(Value.ToString());

            ctx.ConversionFailed(@this, type.ReflectedTypeName);
            return Default();
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:8,代码来源:ElaGuid.cs

示例9: False

        internal override bool False(ElaValue @this, ExecutionContext ctx)
        {
            var ret = Force(ctx);

            if (ctx.Failed)
                return false;

            return ret.Ref.False(ret, ctx);
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:9,代码来源:ElaLazy.cs

示例10: Get

        public ElaVariant Get(ElaValue key, ElaMutableMap map)
        {
            var val = default(ElaValue);

            if (!map.Map.TryGetValue(key, out val))
                return ElaVariant.None();

            return ElaVariant.Some(val);
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:9,代码来源:MutableMapModule.cs

示例11: Lesser

        internal override bool Lesser(ElaValue left, ElaValue right, ExecutionContext ctx)
        {
            if (right.TypeId != ElaMachine.STR)
            {
                NoOverloadBinary(TCF.STRING, right, "lesser", ctx);
                return false;
            }

            return left.DirectGetString().CompareTo(right.DirectGetString()) > 0;
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:10,代码来源:StringInstance.cs

示例12: Equal

        internal override bool Equal(ElaValue left, ElaValue right, ExecutionContext ctx)
        {
            if (right.TypeId != ElaMachine.STR)
            {
                NoOverloadBinary(TCF.STRING, right, "equal", ctx);
                return false;
            }

            return left.DirectGetString() == right.DirectGetString();
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:10,代码来源:StringInstance.cs

示例13: Equal

        internal override bool Equal(ElaValue left, ElaValue right, ExecutionContext ctx)
        {
            if (right.TypeId != ElaMachine.UNI)
            {
                NoOverloadBinary(TCF.UNIT, right, "equal", ctx);
                return false;
            }

            return left.Ref == right.Ref;
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:10,代码来源:UnitInstance.cs

示例14: LesserEqual

        internal override bool LesserEqual(ElaValue left, ElaValue right, ExecutionContext ctx)
        {
            if (right.TypeId != ElaMachine.CHR)
            {
                NoOverloadBinary(TCF.CHAR, right, "lesserequal", ctx);
                return false;
            }

            return left.I4 <= right.I4;
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:10,代码来源:CharInstance.cs

示例15: Greater

        internal override bool Greater(ElaValue left, ElaValue right, ExecutionContext ctx)
        {
            if (right.TypeId != ElaMachine.CHR)
            {
                NoOverloadBinary(TCF.CHAR, right, "greater", ctx);
                return false;
            }

            return left.I4 > right.I4;
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:10,代码来源:CharInstance.cs


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