本文整理汇总了C#中expdesc类的典型用法代码示例。如果您正苦于以下问题:C# expdesc类的具体用法?C# expdesc怎么用?C# expdesc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
expdesc类属于命名空间,在下文中一共展示了expdesc类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Copy
public void Copy(expdesc e)
{
this.k = e.k;
this.u.Copy(e.u);
this.t = e.t;
this.f = e.f;
}
开发者ID:oathx,项目名称:Six,代码行数:7,代码来源:lparser.cs
示例2: GetCode
public static InstructionPtr GetCode(FuncState fs, expdesc e) {return new InstructionPtr(fs.f.code, e.u.s.info);}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:1,代码来源:lcode.cs
示例3: LuaKInfix
public static void LuaKInfix (FuncState fs, BinOpr op, expdesc v) {
switch (op) {
case BinOpr.OPR_AND: {
LuaKGoIfTrue(fs, v);
break;
}
case BinOpr.OPR_OR: {
LuaKGoIFalse(fs, v);
break;
}
case BinOpr.OPR_CONCAT: {
LuaKExp2NextReg(fs, v); /* operand must be on the `stack' */
break;
}
case BinOpr.OPR_ADD: case BinOpr.OPR_SUB: case BinOpr.OPR_MUL: case BinOpr.OPR_DIV:
case BinOpr.OPR_MOD: case BinOpr.OPR_POW: {
if ((IsNumeral(v)==0)) LuaKExp2RK(fs, v);
break;
}
default: {
LuaKExp2RK(fs, v);
break;
}
}
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:25,代码来源:lcode.cs
示例4: CodeComp
private static void CodeComp (FuncState fs, OpCode op, int cond, expdesc e1,
expdesc e2) {
int o1 = LuaKExp2RK(fs, e1);
int o2 = LuaKExp2RK(fs, e2);
FreeExp(fs, e2);
FreeExp(fs, e1);
if (cond == 0 && op != OpCode.OP_EQ) {
int temp; /* exchange args to replace by `<' or `<=' */
temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */
cond = 1;
}
e1.u.s.info = CondJump(fs, op, cond, o1, o2);
e1.k = expkind.VJMP;
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:14,代码来源:lcode.cs
示例5: ConstFolding
private static int ConstFolding (OpCode op, expdesc e1, expdesc e2) {
LuaNumberType v1, v2, r;
if ((IsNumeral(e1)==0) || (IsNumeral(e2)==0)) return 0;
v1 = e1.u.nval;
v2 = e2.u.nval;
switch (op) {
case OpCode.OP_ADD: r = luai_numadd(v1, v2); break;
case OpCode.OP_SUB: r = luai_numsub(v1, v2); break;
case OpCode.OP_MUL: r = luai_nummul(v1, v2); break;
case OpCode.OP_DIV:
if (v2 == 0) return 0; /* do not attempt to divide by 0 */
r = luai_numdiv(v1, v2); break;
case OpCode.OP_MOD:
if (v2 == 0) return 0; /* do not attempt to divide by 0 */
r = luai_nummod(v1, v2); break;
case OpCode.OP_POW: r = luai_numpow(v1, v2); break;
case OpCode.OP_UNM: r = luai_numunm(v1); break;
case OpCode.OP_LEN: return 0; /* no constant folding for 'len' */
default: LuaAssert(0); r = 0; break;
}
if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */
e1.u.nval = r;
return 1;
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:24,代码来源:lcode.cs
示例6: CodeNot
private static void CodeNot (FuncState fs, expdesc e) {
LuaKDischargeVars(fs, e);
switch (e.k) {
case expkind.VNIL: case expkind.VFALSE: {
e.k = expkind.VTRUE;
break;
}
case expkind.VK: case expkind.VKNUM: case expkind.VTRUE: {
e.k = expkind.VFALSE;
break;
}
case expkind.VJMP: {
InvertJump(fs, e);
break;
}
case expkind.VRELOCABLE:
case expkind.VNONRELOC: {
Discharge2AnyReg(fs, e);
FreeExp(fs, e);
e.u.s.info = LuaKCodeABC(fs, OpCode.OP_NOT, 0, e.u.s.info, 0);
e.k = expkind.VRELOCABLE;
break;
}
default: {
LuaAssert(0); /* cannot happen */
break;
}
}
/* interchange true and false lists */
{ int temp = e.f; e.f = e.t; e.t = temp; }
RemoveValues(fs, e.f);
RemoveValues(fs, e.t);
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:33,代码来源:lcode.cs
示例7: LuaKGoIfTrue
public static void LuaKGoIfTrue (FuncState fs, expdesc e) {
int pc; /* pc of last jump */
LuaKDischargeVars(fs, e);
switch (e.k) {
case expkind.VK: case expkind.VKNUM: case expkind.VTRUE: {
pc = NO_JUMP; /* always true; do nothing */
break;
}
case expkind.VJMP: {
InvertJump(fs, e);
pc = e.u.s.info;
break;
}
default: {
pc = JumpOnCond(fs, e, 0);
break;
}
}
LuaKConcat(fs, ref e.f, pc); /* insert last jump in `f' list */
LuaKPatchToHere(fs, e.t);
e.t = NO_JUMP;
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:22,代码来源:lcode.cs
示例8: InvertJump
private static void InvertJump (FuncState fs, expdesc e) {
InstructionPtr pc = GetJumpControl(fs, e.u.s.info);
LuaAssert(testTMode(GET_OPCODE(pc[0])) != 0 && GET_OPCODE(pc[0]) != OpCode.OP_TESTSET &&
GET_OPCODE(pc[0]) != OpCode.OP_TEST);
SETARG_A(pc, (GETARG_A(pc[0]) == 0) ? 1 : 0);
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:6,代码来源:lcode.cs
示例9: LuaKDischargeVars
public static void LuaKDischargeVars (FuncState fs, expdesc e) {
switch (e.k) {
case expkind.VLOCAL: {
e.k = expkind.VNONRELOC;
break;
}
case expkind.VUPVAL: {
e.u.s.info = LuaKCodeABC(fs, OpCode.OP_GETUPVAL, 0, e.u.s.info, 0);
e.k = expkind.VRELOCABLE;
break;
}
case expkind.VGLOBAL: {
e.u.s.info = LuaKCodeABx(fs, OpCode.OP_GETGLOBAL, 0, e.u.s.info);
e.k = expkind.VRELOCABLE;
break;
}
case expkind.VINDEXED: {
FreeReg(fs, e.u.s.aux);
FreeReg(fs, e.u.s.info);
e.u.s.info = LuaKCodeABC(fs, OpCode.OP_GETTABLE, 0, e.u.s.info, e.u.s.aux);
e.k = expkind.VRELOCABLE;
break;
}
case expkind.VVARARG:
case expkind.VCALL: {
LuaKSetOneRet(fs, e);
break;
}
default: break; /* there is one value available (somewhere) */
}
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:31,代码来源:lcode.cs
示例10: LuaKSetOneRet
public static void LuaKSetOneRet (FuncState fs, expdesc e) {
if (e.k == expkind.VCALL) { /* expression is an open function call? */
e.k = expkind.VNONRELOC;
e.u.s.info = GETARG_A(GetCode(fs, e));
}
else if (e.k == expkind.VVARARG) {
SETARG_B(GetCode(fs, e), 2);
e.k = expkind.VRELOCABLE; /* can relocate its simple result */
}
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:10,代码来源:lcode.cs
示例11: LuaKSetReturns
public static void LuaKSetReturns (FuncState fs, expdesc e, int nresults) {
if (e.k == expkind.VCALL) { /* expression is an open function call? */
SETARG_C(GetCode(fs, e), nresults+1);
}
else if (e.k == expkind.VVARARG) {
SETARG_B(GetCode(fs, e), nresults+1);
SETARG_A(GetCode(fs, e), fs.freereg);
LuaKReserveRegs(fs, 1);
}
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:10,代码来源:lcode.cs
示例12: FreeExp
private static void FreeExp (FuncState fs, expdesc e) {
if (e.k == expkind.VNONRELOC)
FreeReg(fs, e.u.s.info);
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:4,代码来源:lcode.cs
示例13: IsNumeral
private static int IsNumeral(expdesc e) {
return (e.k == expkind.VKNUM && e.t == NO_JUMP && e.f == NO_JUMP) ? 1 : 0;
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:3,代码来源:lcode.cs
示例14: HasJumps
public static bool HasJumps(expdesc e) {return e.t != e.f;}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:1,代码来源:lcode.cs
示例15: LuaKSetMultRet
public static void LuaKSetMultRet(FuncState fs, expdesc e) {LuaKSetReturns(fs, e, LUA_MULTRET);}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:1,代码来源:lcode.cs
示例16: LuaKStoreVar
public static void LuaKStoreVar (FuncState fs, expdesc var, expdesc ex) {
switch (var.k) {
case expkind.VLOCAL: {
FreeExp(fs, ex);
Exp2Reg(fs, ex, var.u.s.info);
return;
}
case expkind.VUPVAL: {
int e = LuaKExp2AnyReg(fs, ex);
LuaKCodeABC(fs, OpCode.OP_SETUPVAL, e, var.u.s.info, 0);
break;
}
case expkind.VGLOBAL: {
int e = LuaKExp2AnyReg(fs, ex);
LuaKCodeABx(fs, OpCode.OP_SETGLOBAL, e, var.u.s.info);
break;
}
case expkind.VINDEXED: {
int e = LuaKExp2RK(fs, ex);
LuaKCodeABC(fs, OpCode.OP_SETTABLE, var.u.s.info, var.u.s.aux, e);
break;
}
default: {
LuaAssert(0); /* invalid var kind to store */
break;
}
}
FreeExp(fs, ex);
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:29,代码来源:lcode.cs
示例17: LuaKSelf
public static void LuaKSelf (FuncState fs, expdesc e, expdesc key) {
int func;
LuaKExp2AnyReg(fs, e);
FreeExp(fs, e);
func = fs.freereg;
LuaKReserveRegs(fs, 2);
LuaKCodeABC(fs, OpCode.OP_SELF, func, e.u.s.info, LuaKExp2RK(fs, key));
FreeExp(fs, key);
e.u.s.info = func;
e.k = expkind.VNONRELOC;
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:11,代码来源:lcode.cs
示例18: Discharge2Reg
private static void Discharge2Reg (FuncState fs, expdesc e, int reg) {
LuaKDischargeVars(fs, e);
switch (e.k) {
case expkind.VNIL: {
LuaKNil(fs, reg, 1);
break;
}
case expkind.VFALSE: case expkind.VTRUE: {
LuaKCodeABC(fs, OpCode.OP_LOADBOOL, reg, (e.k == expkind.VTRUE) ? 1 : 0, 0);
break;
}
case expkind.VK: {
LuaKCodeABx(fs, OpCode.OP_LOADK, reg, e.u.s.info);
break;
}
case expkind.VKNUM: {
LuaKCodeABx(fs, OpCode.OP_LOADK, reg, LuaKNumberK(fs, e.u.nval));
break;
}
case expkind.VRELOCABLE: {
InstructionPtr pc = GetCode(fs, e);
SETARG_A(pc, reg);
break;
}
case expkind.VNONRELOC: {
if (reg != e.u.s.info)
LuaKCodeABC(fs, OpCode.OP_MOVE, reg, e.u.s.info, 0);
break;
}
default: {
LuaAssert(e.k == expkind.VVOID || e.k == expkind.VJMP);
return; /* nothing to do... */
}
}
e.u.s.info = reg;
e.k = expkind.VNONRELOC;
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:37,代码来源:lcode.cs
示例19: JumpOnCond
private static int JumpOnCond (FuncState fs, expdesc e, int cond) {
if (e.k == expkind.VRELOCABLE) {
InstructionPtr ie = GetCode(fs, e);
if (GET_OPCODE(ie) == OpCode.OP_NOT) {
fs.pc--; /* remove previous OpCode.OP_NOT */
return CondJump(fs, OpCode.OP_TEST, GETARG_B(ie), 0, (cond==0) ? 1 : 0);
}
/* else go through */
}
Discharge2AnyReg(fs, e);
FreeExp(fs, e);
return CondJump(fs, OpCode.OP_TESTSET, NO_REG, e.u.s.info, cond);
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:13,代码来源:lcode.cs
示例20: Discharge2AnyReg
private static void Discharge2AnyReg (FuncState fs, expdesc e) {
if (e.k != expkind.VNONRELOC) {
LuaKReserveRegs(fs, 1);
Discharge2Reg(fs, e, fs.freereg-1);
}
}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:6,代码来源:lcode.cs
注:本文中的expdesc类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论