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


C# KopiLua.CharPtr类代码示例

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


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

示例1: newlstr

		public static TString newlstr (lua_State L, CharPtr str, uint l,
											   uint h) {
		  TString ts;
		  stringtable tb;
		  if (l+1 > MAX_SIZET /GetUnmanagedSize(typeof(char)))
		    luaM_toobig(L);
		  ts = new TString(new char[l+1]);
		  AddTotalBytes(L, (int)(l + 1) * GetUnmanagedSize(typeof(char)) + GetUnmanagedSize(typeof(TString)));
		  ts.tsv.len = l;
		  ts.tsv.hash = h;
		  ts.tsv.marked = luaC_white(G(L));
		  ts.tsv.tt = LUA_TSTRING;
		  ts.tsv.reserved = 0;
		  //memcpy(ts+1, str, l*GetUnmanagedSize(typeof(char)));
		  memcpy(ts.str.chars, str.chars, str.index, (int)l);
		  ts.str[l] = '\0';  /* ending 0 */
		  tb = G(L).strt;
		  h = (uint)lmod(h, tb.size);
		  ts.tsv.next = tb.hash[h];  /* chain new entry */
		  tb.hash[h] = obj2gco(ts);
		  tb.nuse++;
		  if ((tb.nuse > (int)tb.size) && (tb.size <= MAX_INT/2))
		    luaS_resize(L, tb.size*2);  /* too crowded */
		  return ts;
		}
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:25,代码来源:lstring.cs

示例2: GetBoolField

 private static int GetBoolField(LuaState L, CharPtr key)
 {
     int res;
       LuaGetField(L, -1, key);
       res = LuaIsNil(L, -1) ? -1 : LuaToBoolean(L, -1);
       LuaPop(L, 1);
       return res;
 }
开发者ID:GSharpDevs,项目名称:RunG,代码行数:8,代码来源:loslib.cs

示例3: getboolfield

 private static int getboolfield(lua_State L, CharPtr key)
 {
     int res;
       lua_getfield(L, -1, key);
       res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1);
       lua_pop(L, 1);
       return res;
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:8,代码来源:loslib.cs

示例4: DumpBlock

 private static void DumpBlock(CharPtr b, uint size, DumpState D)
 {
     if (D.status==0)
      {
       LuaUnlock(D.L);
       D.status=D.writer(D.L,b,size,D.data);
       LuaLock(D.L);
      }
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:9,代码来源:ldump.cs

示例5: TreatStackOption

		private static void TreatStackOption (LuaState L, LuaState L1, CharPtr fname) {
		  if (L == L1) {
			LuaPushValue(L, -2);
			LuaRemove(L, -3);
		  }
		  else
			LuaXMove(L1, L, 1);
		  LuaSetField(L, -2, fname);
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:9,代码来源:ldblib.cs

示例6: treatstackoption

 private static void treatstackoption (lua_State L, lua_State L1, CharPtr fname) {
     if (L == L1) {
         lua_pushvalue(L, -2);
         lua_remove(L, -3);
     }
     else
         lua_xmove(L1, L, 1);
     lua_setfield(L, -2, fname);
 }
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:9,代码来源:ldblib.cs

示例7: LuaXLexError

 public static void LuaXLexError(LexState ls, CharPtr msg, int token)
 {
     CharPtr buff = new char[MAXSRC];
     LuaOChunkID(buff, GetStr(ls.source), MAXSRC);
     msg = LuaOPushFString(ls.L, "%s:%d: %s", buff, ls.linenumber, msg);
     if (token != 0)
         LuaOPushFString(ls.L, "%s near " + LUA_QS, msg, TextToken(ls, token));
     LuaDThrow(ls.L, LUA_ERRSYNTAX);
 }
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:9,代码来源:llex.cs

示例8: OSPushResult

		private static int OSPushResult (LuaState L, int i, CharPtr filename) {
		  int en = errno();  /* calls to Lua API may change this value */
		  if (i != 0) {
			LuaPushBoolean(L, 1);
			return 1;
		  }
		  else {
			LuaPushNil(L);
			LuaPushFString(L, "%s: %s", filename, strerror(en));
			LuaPushInteger(L, en);
			return 3;
		  }
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:13,代码来源:loslib.cs

示例9: os_pushresult

		private static int os_pushresult (lua_State L, int i, CharPtr filename) {
		  int en = errno();  /* calls to Lua API may change this value */
		  if (i != 0) {
			lua_pushboolean(L, 1);
			return 1;
		  }
		  else {
			lua_pushnil(L);
			lua_pushfstring(L, "%s: %s", filename, strerror(en));
			lua_pushinteger(L, en);
			return 3;
		  }
		}
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:13,代码来源:loslib.cs

示例10: GetField

 private static int GetField(LuaState L, CharPtr key, int d)
 {
     int res;
       LuaGetField(L, -1, key);
       if (LuaIsNumber(L, -1) != 0)
     res = (int)LuaToInteger(L, -1);
       else {
     if (d < 0)
       return LuaLError(L, "field " + LUA_QS + " missing in date table", key);
     res = d;
       }
       LuaPop(L, 1);
       return res;
 }
开发者ID:GSharpDevs,项目名称:RunG,代码行数:14,代码来源:loslib.cs

示例11: getfield

 private static int getfield(lua_State L, CharPtr key, int d)
 {
     int res;
       lua_getfield(L, -1, key);
       if (lua_isnumber(L, -1) != 0)
     res = (int)lua_tointeger(L, -1);
       else {
     if (d < 0)
       return luaL_error(L, "field " + LUA_QS + " missing in date table", key);
     res = d;
       }
       lua_pop(L, 1);
       return res;
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:14,代码来源:loslib.cs

示例12: luaS_newlstr

 public static TString luaS_newlstr(lua_State L, CharPtr str, uint l)
 {
     GCObject o;
       uint h = (uint)l;  /* seed */
       uint step = (l>>5)+1;  /* if string is too long, don't hash all its chars */
       uint l1;
       for (l1=l; l1>=step; l1-=step)  /* compute hash */
     h = h ^ ((h<<5)+(h>>2)+(byte)str[l1-1]);
       for (o = G(L).strt.hash[lmod(h, G(L).strt.size)];
        o != null;
        o = o.gch.next) {
     TString ts = rawgco2ts(o);
     if (ts.tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) {
       /* string may be dead */
       if (isdead(G(L), o)) changewhite(o);
       return ts;
     }
       }
       //return newlstr(L, str, l, h);  /* not found */
       TString res = newlstr(L, str, l, h);
       return res;
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:22,代码来源:lstring.cs

示例13: lua_getfield

 public static void lua_getfield(lua_State L, int idx, CharPtr k)
 {
     StkId t;
       TValue key = new TValue();
       lua_lock(L);
       t = index2adr(L, idx);
       api_checkvalidindex(L, t);
       setsvalue(L, key, luaS_new(L, k));
       luaV_gettable(L, t, key, L.top);
       api_incr_top(L);
       lua_unlock(L);
 }
开发者ID:rumkex,项目名称:LuaInterface,代码行数:12,代码来源:lapi.cs

示例14: luaZ_read

 public static uint luaZ_read(ZIO z, CharPtr b, uint n)
 {
     b = new CharPtr(b);
     while (n != 0)
     {
         uint m;
         if (luaZ_lookahead(z) == EOZ)
             return n;  // return number of missing bytes
         m = (n <= z.n) ? n : z.n;  // min. between n and z.n
         memcpy(b, z.p, m);
         z.n -= m;
         z.p += m;
         b = b + m;
         n -= m;
     }
     return 0;
 }
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:17,代码来源:lzio.cs

示例15: luaS_newliteral

		public static TString luaS_newliteral(lua_State L, CharPtr s) { return luaS_newlstr(L, s, (uint)strlen(s)); }
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:1,代码来源:lstring.cs


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