本文整理汇总了C#中Frame.MarkSharedChain方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.MarkSharedChain方法的具体用法?C# Frame.MarkSharedChain怎么用?C# Frame.MarkSharedChain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame.MarkSharedChain方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CommonMEMap_C
internal static Frame CommonMEMap_C(Frame th)
{
ItemSource src = (ItemSource) th.lex0;
VarDeque outq = (VarDeque) th.lex1;
object fnc = th.lex2;
int tailmode = th.lexi0;
switch (th.ip) {
case 0:
Variable[] pen;
if (!src.TryGet(out pen, tailmode != 0)) {
P6opaque thunk = new P6opaque(Kernel.GatherIteratorMO);
th.coro_return = th;
th.MarkSharedChain();
thunk.slots[0] = Kernel.NewMuScalar(th);
thunk.slots[1] = Kernel.NewMuScalar(Kernel.AnyP);
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0] = outq;
lst.slots[1] = new VarDeque(Kernel.NewROScalar(thunk));
th.caller.resultSlot = Kernel.NewRWListVar(lst);
th.lexi0 = 1;
return th.Return();
}
if (pen == null) {
if (tailmode != 0)
return Kernel.Take(th, Kernel.NewROScalar(Kernel.EMPTYP));
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0] = outq;
lst.slots[1] = new VarDeque();
th.caller.resultSlot = Kernel.NewRWListVar(lst);
return th.Return();
}
th.lex3 = pen;
th.ip = 1;
goto case 1;
case 1:
th.ip = 2;
if (fnc is P6any) {
return ((P6any)fnc).Invoke(th, (Variable[])th.lex3, null);
} else if (fnc == null) {
th.resultSlot = MakeParcel((Variable[]) th.lex3);
goto case 2;
} else {
th.resultSlot = ((Func<Variable,Variable>)fnc).Invoke(
((Variable[])th.lex3)[0]);
goto case 2;
}
case 2:
if (tailmode != 0) {
th.ip = 0;
return Kernel.Take(th, (Variable)th.resultSlot);
} else {
outq.Push((Variable) th.resultSlot);
th.ip = 0;
goto case 0;
}
case 3:
th.lex0 = src = ItemSource.Empty;
th.ip = 0;
goto case 0;
default:
return Kernel.Die(th, "Invalid IP");
}
}
示例2: EndWith
// currently just used for protoregex
public Frame EndWith(Frame th, Cursor m)
{
if (st.pos > global.highwater)
global.IncHighwater(st.pos);
if ((flags & RETURN_ONE) != 0) {
return Kernel.Take(th, Kernel.NewROScalar(m));
} else {
th.MarkSharedChain();
flags |= RETURN_ONE;
VarDeque ks = new VarDeque();
ks.Push(Kernel.NewROScalar(m));
th.coro_return = th;
P6opaque it = new P6opaque(Kernel.GatherIteratorMO);
it.slots[0 /*frame*/] = Kernel.NewMuScalar(th);
it.slots[1 /*reify*/] = Kernel.NewMuScalar(Kernel.AnyP);
VarDeque iss = new VarDeque();
iss.Push(Kernel.NewROScalar(it));
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0 /*items*/] = ks;
lst.slots[1 /*rest*/ ] = iss;
th.caller.resultSlot = Kernel.NewRWListVar(lst);
}
return th.Return();
}
示例3: CommonGrep_C
internal static Frame CommonGrep_C(Frame th)
{
VarDeque src = (VarDeque) th.lex0;
VarDeque outq = (VarDeque) th.lex1;
Variable flt = (Variable) th.lex2;
int tailmode = th.lexi0;
switch (th.ip) {
case 0:
Variable pen = null;
while (pen == null) {
if (tailmode != 0) {
if (!Kernel.IterHasFlat(src, false)) break;
} else {
if (src.Count() == 0) break;
if (src[0].Fetch().mo.HasMRO(Kernel.IterCursorMO)) {
P6opaque thunk = new P6opaque(Kernel.GatherIteratorMO);
th.coro_return = th;
th.MarkSharedChain();
thunk.slots[0] = Kernel.NewMuScalar(th);
thunk.slots[1] = Kernel.NewMuScalar(Kernel.AnyP);
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0] = outq;
lst.slots[1] = new VarDeque(Kernel.NewROScalar(thunk));
th.caller.resultSlot = Kernel.NewRWListVar(lst);
th.lexi0 = 1;
return th.Return();
}
}
pen = src.Shift();
}
if (pen == null) {
if (tailmode != 0)
return Kernel.Take(th, Kernel.NewROScalar(Kernel.EMPTYP));
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0] = outq;
lst.slots[1] = new VarDeque();
th.caller.resultSlot = Kernel.NewRWListVar(lst);
return th.Return();
}
th.lex3 = pen;
th.ip = 1;
goto case 1;
case 1:
th.ip = 2;
return flt.Fetch().InvokeMethod(th, "ACCEPTS",
new Variable[] { flt, (Variable)th.lex3 }, null);
case 2:
Variable r = (Variable) th.resultSlot;
if (!r.Fetch().mo.mro_raw_Bool.Get(r)) {
th.ip = 0;
goto case 0;
}
if (tailmode != 0) {
th.ip = 0;
return Kernel.Take(th, (Variable)th.lex3);
} else {
outq.Push((Variable) th.lex3);
th.ip = 0;
goto case 0;
}
case 3:
th.lex0 = src = new VarDeque();
th.ip = 0;
goto case 0;
default:
return Kernel.Die(th, "Invalid IP");
}
}
示例4: EndWith
// currently just used for protoregex
public Frame EndWith(Frame th, Cursor m)
{
if (st.pos > global.highwater)
global.IncHighwater(st.pos);
if (return_one) {
return Kernel.Take(th, Kernel.NewROScalar(m));
} else {
th.MarkSharedChain();
return_one = true;
VarDeque ks = new VarDeque();
ks.Push(Kernel.NewROScalar(m));
th.lex = new Dictionary<string,object>();
th.lex["!return"] = null;
P6opaque it = new P6opaque(Kernel.GatherIteratorMO);
it.slots[0 /*frame*/] = Kernel.NewMuScalar(th);
it.slots[1 /*reify*/] = Kernel.NewMuScalar(Kernel.AnyP);
VarDeque iss = new VarDeque();
iss.Push(Kernel.NewROScalar(it));
P6opaque lst = new P6opaque(Kernel.ListMO);
lst.slots[0 /*items*/] = ks;
lst.slots[1 /*rest*/ ] = iss;
th.caller.resultSlot = Kernel.NewRWListVar(lst);
}
return th.caller;
}