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


C# FuncState类代码示例

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


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

示例1: 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

示例2: LuaKCode

		private static int LuaKCode (FuncState fs, int i, int line) {			
		  Proto f = fs.f;
		  DischargeJPC(fs);  /* `pc' will change */
		  /* put new instruction in code array */
		  LuaMGrowVector(fs.L, ref f.code, fs.pc, ref f.sizecode,
						  MAXINT, "code size overflow");
		  f.code[fs.pc] = (uint)i;
		  /* save corresponding line information */
		  LuaMGrowVector(fs.L, ref f.lineinfo, fs.pc, ref f.sizelineinfo,
						  MAXINT, "code size overflow");
		  f.lineinfo[fs.pc] = line;		  
		  return fs.pc++;
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:13,代码来源:lcode.cs

示例3: LuaKCodeABx

		public static int LuaKCodeABx (FuncState fs, OpCode o, int a, int bc) {			
		  LuaAssert(getOpMode(o) == OpMode.iABx || getOpMode(o) == OpMode.iAsBx);
		  LuaAssert(getCMode(o) == OpArgMask.OpArgN);
		  return LuaKCode(fs, CREATE_ABx(o, a, bc), fs.ls.lastline);
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:5,代码来源:lcode.cs

示例4: LuaKPrefix

		public static void LuaKPrefix (FuncState fs, UnOpr op, expdesc e) {
		  expdesc e2 = new expdesc();
		  e2.t = e2.f = NO_JUMP; e2.k = expkind.VKNUM; e2.u.nval = 0;
		  switch (op) {
			case UnOpr.OPR_MINUS: {
			  if (IsNumeral(e)==0)
				LuaKExp2AnyReg(fs, e);  /* cannot operate on non-numeric constants */
			  CodeArith(fs, OpCode.OP_UNM, e, e2);
			  break;
			}
			case UnOpr.OPR_NOT: CodeNot(fs, e); break;
			case UnOpr.OPR_LEN: {
			  LuaKExp2AnyReg(fs, e);  /* cannot operate on constants */
			  CodeArith(fs, OpCode.OP_LEN, e, e2);
			  break;
			}
			default: LuaAssert(0); break;
		  }
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:19,代码来源:lcode.cs

示例5: LuaKPosFix

		public static void LuaKPosFix (FuncState fs, BinOpr op, expdesc e1, expdesc e2) {
		  switch (op) {
			case BinOpr.OPR_AND: {
			  LuaAssert(e1.t == NO_JUMP);  /* list must be closed */
			  LuaKDischargeVars(fs, e2);
			  LuaKConcat(fs, ref e2.f, e1.f);
			  e1.Copy(e2);
			  break;
			}
			case BinOpr.OPR_OR: {
			  LuaAssert(e1.f == NO_JUMP);  /* list must be closed */
			  LuaKDischargeVars(fs, e2);
			  LuaKConcat(fs, ref e2.t, e1.t);
			  e1.Copy(e2);
			  break;
			}
			case BinOpr.OPR_CONCAT: {
			  LuaKExp2Val(fs, e2);
			  if (e2.k == expkind.VRELOCABLE && GET_OPCODE(GetCode(fs, e2)) == OpCode.OP_CONCAT) {
				LuaAssert(e1.u.s.info == GETARG_B(GetCode(fs, e2))-1);
				FreeExp(fs, e1);
				SETARG_B(GetCode(fs, e2), e1.u.s.info);
				e1.k = expkind.VRELOCABLE; e1.u.s.info = e2.u.s.info;
			  }
			  else {
				LuaKExp2NextReg(fs, e2);  /* operand must be on the 'stack' */
				CodeArith(fs, OpCode.OP_CONCAT, e1, e2);
			  }
			  break;
			}
			case BinOpr.OPR_ADD: CodeArith(fs, OpCode.OP_ADD, e1, e2); break;
			case BinOpr.OPR_SUB: CodeArith(fs, OpCode.OP_SUB, e1, e2); break;
			case BinOpr.OPR_MUL: CodeArith(fs, OpCode.OP_MUL, e1, e2); break;
			case BinOpr.OPR_DIV: CodeArith(fs, OpCode.OP_DIV, e1, e2); break;
			case BinOpr.OPR_MOD: CodeArith(fs, OpCode.OP_MOD, e1, e2); break;
			case BinOpr.OPR_POW: CodeArith(fs, OpCode.OP_POW, e1, e2); break;
			case BinOpr.OPR_EQ: CodeComp(fs, OpCode.OP_EQ, 1, e1, e2); break;
			case BinOpr.OPR_NE: CodeComp(fs, OpCode.OP_EQ, 0, e1, e2); break;
			case BinOpr.OPR_LT: CodeComp(fs, OpCode.OP_LT, 1, e1, e2); break;
			case BinOpr.OPR_LE: CodeComp(fs, OpCode.OP_LE, 1, e1, e2); break;
			case BinOpr.OPR_GT: CodeComp(fs, OpCode.OP_LT, 0, e1, e2); break;
			case BinOpr.OPR_GE: CodeComp(fs, OpCode.OP_LE, 0, e1, e2); break;
			default: LuaAssert(0); break;
		  }
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:45,代码来源: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: CodeArith

		private static void CodeArith (FuncState fs, OpCode op, expdesc e1, expdesc e2) {
		  if (ConstFolding(op, e1, e2) != 0)
			return;
		  else {
			int o2 = (op != OpCode.OP_UNM && op != OpCode.OP_LEN) ? LuaKExp2RK(fs, e2) : 0;
			int o1 = LuaKExp2RK(fs, e1);
			if (o1 > o2) {
			  FreeExp(fs, e1);
			  FreeExp(fs, e2);
			}
			else {
			  FreeExp(fs, e2);
			  FreeExp(fs, e1);
			}
			e1.u.s.info = LuaKCodeABC(fs, op, 0, o1, o2);
			e1.k = expkind.VRELOCABLE;
		  }
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:18,代码来源:lcode.cs

示例8: Exp2Reg

		private static void Exp2Reg (FuncState fs, expdesc e, int reg) {
		  Discharge2Reg(fs, e, reg);
		  if (e.k == expkind.VJMP)
			LuaKConcat(fs, ref e.t, e.u.s.info);  /* put this jump in `t' list */
		  if (HasJumps(e)) {
			int final;  /* position after whole expression */
			int p_f = NO_JUMP;  /* position of an eventual LOAD false */
			int p_t = NO_JUMP;  /* position of an eventual LOAD true */
			if (NeedValue(fs, e.t)!=0 || NeedValue(fs, e.f)!=0) {
			  int fj = (e.k == expkind.VJMP) ? NO_JUMP : LuaKJump(fs);
			  p_f = CodeLabel(fs, reg, 0, 1);
			  p_t = CodeLabel(fs, reg, 1, 0);
			  LuaKPatchToHere(fs, fj);
			}
			final = LuaKGetLabel(fs);
			PatchListAux(fs, e.f, final, reg, p_f);
			PatchListAux(fs, e.t, final, reg, p_t);
		  }
		  e.f = e.t = NO_JUMP;
		  e.u.s.info = reg;
		  e.k = expkind.VNONRELOC;
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:22,代码来源:lcode.cs

示例9: LuaKExp2NextReg

		public static void LuaKExp2NextReg (FuncState fs, expdesc e) {
		  LuaKDischargeVars(fs, e);
		  FreeExp(fs, e);
		  LuaKReserveRegs(fs, 1);
		  Exp2Reg(fs, e, fs.freereg - 1);
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:6,代码来源:lcode.cs

示例10: 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

示例11: 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

示例12: CodeLabel

		private static int CodeLabel (FuncState fs, int A, int b, int jump) {
		  LuaKGetLabel(fs);  /* those instructions may be jump targets */
		  return LuaKCodeABC(fs, OpCode.OP_LOADBOOL, A, b, jump);
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:4,代码来源:lcode.cs

示例13: 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

示例14: 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

示例15: 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


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