本文整理汇总了C#中PValue.CallToString方法的典型用法代码示例。如果您正苦于以下问题:C# PValue.CallToString方法的具体用法?C# PValue.CallToString怎么用?C# PValue.CallToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PValue
的用法示例。
在下文中一共展示了PValue.CallToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LessThanOrEqual
public override bool LessThanOrEqual(
StackContext sctx,
PValue leftOperand,
PValue rightOperand,
out PValue result)
{
result =
StringComparer.Ordinal.Compare(
leftOperand.CallToString(sctx), rightOperand.CallToString(sctx)) <= 0;
return true;
}
示例2: Addition
public override bool Addition(
StackContext sctx, PValue leftOperand, PValue rightOperand, out PValue result)
{
var left = leftOperand.CallToString(sctx);
var right = rightOperand.CallToString(sctx);
result = System.String.Concat(left, right);
return true;
}
示例3: GreaterThan
public override bool GreaterThan(
StackContext sctx, PValue leftOperand, PValue rightOperand, out PValue result)
{
result =
StringComparer.Ordinal.Compare(
leftOperand.CallToString(sctx), rightOperand.CallToString(sctx)) > 0;
return true;
}
示例4: RunStatically
public static PValue RunStatically(StackContext sctx, PValue fpv, PValue[] iargs,
bool useIndirectCallAsFallback)
{
IStackAware f;
IMaybeStackAware m;
CilClosure cilClosure;
PFunction func = null;
PVariable[] sharedVars = null;
PValue result;
ReturnMode returnMode;
if ((cilClosure = fpv.Value as CilClosure) != null)
{
func = cilClosure.Function;
sharedVars = cilClosure.SharedVariables;
}
if ((func = func ?? fpv.Value as PFunction) != null && func.HasCilImplementation)
{
func.CilImplementation.Invoke(
func, CilFunctionContext.New(sctx, func), iargs, sharedVars ?? new PVariable[0],
out result, out returnMode);
}
else if ((f = fpv.Value as IStackAware) != null)
{
//Create stack context, let the engine execute it
var subCtx = f.CreateStackContext(sctx, iargs);
sctx.ParentEngine.Process(subCtx);
result = subCtx.ReturnValue;
returnMode = subCtx.ReturnMode;
}
else if ((m = fpv.Value as IMaybeStackAware) != null)
{
StackContext subCtx;
if (m.TryDefer(sctx, iargs, out subCtx, out result))
{
sctx.ParentEngine.Process(subCtx);
result = subCtx.ReturnValue;
returnMode = subCtx.ReturnMode;
}
else if (useIndirectCallAsFallback)
{
returnMode = ReturnMode.Exit;
}
else
{
throw new PrexoniteException(
string.Format(
"Invocation of {0} did not produce a valid return mode. " +
"Only Prexonite functions have a return mode.",
fpv.CallToString(sctx)));
}
}
else if (useIndirectCallAsFallback)
{
result = fpv.IndirectCall(sctx, iargs);
returnMode = ReturnMode.Exit;
}
else
{
throw new PrexoniteException(
"call\\sub\\perform requires its argument to be stack aware.");
}
return new PValueKeyValuePair(sctx.CreateNativePValue(returnMode), result);
}