• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# KopiLua.CharPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: LuaOStr2d

 public static int LuaOStr2d(CharPtr s, out LuaNumberType result)
 {
     CharPtr endptr;
       result = lua_str2number(s, out endptr);
       if (endptr == s) return 0;  /* conversion failed */
       if (endptr[0] == 'x' || endptr[0] == 'X')  /* maybe an hexadecimal constant? */
     result = CastNum(strtoul(s, out endptr, 16));
       if (endptr[0] == '\0') return 1;  /* most common case */
       while (isspace(endptr[0])) endptr = endptr.next();
       if (endptr[0] != '\0') return 0;  /* invalid trailing characters? */
       return 1;
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:12,代码来源:lobject.cs


示例17: lua_pushvfstring

 public static CharPtr lua_pushvfstring(lua_State L, CharPtr fmt,
     object[] argp)
 {
     CharPtr ret;
       lua_lock(L);
       luaC_checkGC(L);
       ret = luaO_pushvfstring(L, fmt, argp);
       lua_unlock(L);
       return ret;
 }
开发者ID:rumkex,项目名称:LuaInterface,代码行数:10,代码来源:lapi.cs


示例18: lua_pushlstring

 public static void lua_pushlstring(lua_State L, CharPtr s, uint len)
 {
     lua_lock(L);
       luaC_checkGC(L);
       setsvalue2s(L, L.top, luaS_newlstr(L, s, len));
       api_incr_top(L);
       lua_unlock(L);
 }
开发者ID:rumkex,项目名称:LuaInterface,代码行数:8,代码来源:lapi.cs


示例19: luaU_header

        /*
        * make header
        */
        public static void luaU_header(CharPtr h)
        {
            h = new CharPtr(h);
             int x=1;
             memcpy(h, LUA_SIGNATURE, LUA_SIGNATURE.Length);
             h = h.add(LUA_SIGNATURE.Length);
             h[0] = (char)LUAC_VERSION;
             h.inc();
             h[0] = (char)LUAC_FORMAT;
             h.inc();
             //*h++=(char)*(char*)&x;				/* endianness */
             h[0] = (char)x;						/* endianness */
             h.inc();
             h[0] = (char)sizeof(int);
             h.inc();
             h[0] = (char)sizeof(uint);
             h.inc();
             h[0] = (char)sizeof(Instruction);
             h.inc();
             h[0] = (char)sizeof(lua_Number);
             h.inc();

              //(h++)[0] = ((lua_Number)0.5 == 0) ? 0 : 1;		/* is lua_Number integral? */
             h[0] = (char)0;	// always 0 on this build
        }
开发者ID:raymanyu,项目名称:kopilua,代码行数:28,代码来源:lundump.cs


示例20: os_date

		private static int os_date (lua_State L) {
		  CharPtr s = new CharPtr(luaL_optstring(L, 1, "%c"));
		  DateTime stm;
		  if (s[0] == '!') {  /* UTC? */
			stm = DateTime.UtcNow;
			s.inc();  /* skip `!' */
		  }
		  else
			  stm = DateTime.Now;
		  if (strcmp(s, "*t") == 0) {
			lua_createtable(L, 0, 9);  /* 9 = number of fields */
			setfield(L, "sec", stm.Second);
			setfield(L, "min", stm.Minute);
			setfield(L, "hour", stm.Hour);
			setfield(L, "day", stm.Day);
			setfield(L, "month", stm.Month);
			setfield(L, "year", stm.Year);
			setfield(L, "wday", (int)stm.DayOfWeek);
			setfield(L, "yday", stm.DayOfYear);
			setboolfield(L, "isdst", stm.IsDaylightSavingTime() ? 1 : 0);
		  }
		  else {
			  luaL_error(L, "strftime not implemented yet"); // todo: implement this - mjf
#if false
			CharPtr cc = new char[3];
			luaL_Buffer b;
			cc[0] = '%'; cc[2] = '\0';
			luaL_buffinit(L, b);
			for (; s[0] != 0; s.inc()) {
			  if (s[0] != '%' || s[1] == '\0')  /* no conversion specifier? */
				luaL_addchar(b, s[0]);
			  else {
				uint reslen;
				CharPtr buff = new char[200];  /* should be big enough for any conversion result */
				s.inc();
				cc[1] = s[0];
				reslen = strftime(buff, buff.Length, cc, stm);
				luaL_addlstring(b, buff, reslen);
			  }
			}
			luaL_pushresult(b);
#endif // #if 0
		  }
			return 1;
		}
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:45,代码来源:loslib.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# KopiLua.InstructionPtr类代码示例发布时间:2022-05-26
下一篇:
C# Models.Site类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap