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


C# System.TString类代码示例

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


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

示例1: PrintString

		//#define Sizeof(x)	((int)sizeof(x))
		//#define VOID(p)		((const void*)(p))

		public static void PrintString(TString ts)
		{
		 CharPtr s=GetStr(ts);
		 uint i,n=ts.tsv.len;
		 putchar('"');
		 for (i=0; i<n; i++)
		 {
		  int c=s[i];
		  switch (c)
		  {
		   case '"': printf("\\\""); break;
		   case '\\': printf("\\\\"); break;
		   case '\a': printf("\\a"); break;
		   case '\b': printf("\\b"); break;
		   case '\f': printf("\\f"); break;
		   case '\n': printf("\\n"); break;
		   case '\r': printf("\\r"); break;
		   case '\t': printf("\\t"); break;
		   case '\v': printf("\\v"); break;
		   default:	if (isprint((byte)c))
   					putchar(c);
				else
					printf("\\%03u",(byte)c);
				break;
		  }
		 }
		 putchar('"');
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:31,代码来源:print.cs

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

示例3: luaT_gettm

		/*
		** function to be used with macro "fasttm": optimized for absence of
		** tag methods
		*/
		public static TValue luaT_gettm (Table events, TMS event_, TString ename) {
		  /*const*/ TValue tm = luaH_getstr(events, ename);
		  LuaAssert(event_ <= TMS.TM_EQ);
		  if (TTIsNil(tm)) {  /* no tag method? */
			events.flags |= (byte)(1<<(int)event_);  /* cache this fact */
			return null;
		  }
		  else return tm;
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:13,代码来源:ltm.cs

示例4: StringMark

 public static void StringMark(TString s)
 {
     Reset2Bits(ref s.tsv.marked, WHITE0BIT, WHITE1BIT);
 }
开发者ID:NLua,项目名称:KopiLua,代码行数:4,代码来源:lgc.cs

示例5: singlevaraux

 private static expkind singlevaraux(FuncState fs, TString n, expdesc var, int base_)
 {
     if (fs == null) {  /* no more levels? */
     init_exp(var, expkind.VGLOBAL, NO_REG);  /* default is global variable */
     return expkind.VGLOBAL;
       }
       else {
     int v = searchvar(fs, n);  /* look up at current level */
     if (v >= 0) {
       init_exp(var, expkind.VLOCAL, v);
       if (base_==0)
         markupval(fs, v);  /* local will be used as an upval */
       return expkind.VLOCAL;
     }
     else {  /* not found at current level; try upper one */
       if (singlevaraux(fs.prev, n, var, 0) == expkind.VGLOBAL)
           return expkind.VGLOBAL;
       var.u.s.info = indexupvalue(fs, n, var);  /* else was LOCAL or UPVAL */
       var.k = expkind.VUPVAL;  /* upvalue in this level */
       return expkind.VUPVAL;
     }
       }
 }
开发者ID:niuniuzhu,项目名称:KopiLua,代码行数:23,代码来源:lparser.cs

示例6: LoadFunction

 private static Proto LoadFunction(LoadState S, TString p)
 {
     Proto f;
      if (++S.L.nCcalls > LUAI_MAXCCALLS) error(S,"code too deep");
      f=luaF_newproto(S.L);
      setptvalue2s(S.L,S.L.top,f); incr_top(S.L);
      f.source=LoadString(S); if (f.source==null) f.source=p;
      f.linedefined=LoadInt(S);
      f.lastlinedefined=LoadInt(S);
      f.nups=LoadByte(S);
      f.numparams=LoadByte(S);
      f.is_vararg=LoadByte(S);
      f.maxstacksize=LoadByte(S);
      LoadCode(S,f);
      LoadConstants(S,f);
      LoadDebug(S,f);
      IF (luaG_checkcode(f)==0 ? 1 : 0, "bad code");
      StkId.dec(ref S.L.top);
      S.L.nCcalls--;
      return f;
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:21,代码来源:lundump.cs

示例7: luaS_fix

		public static void luaS_fix(TString s)
		{
			lu_byte marked = s.tsv.marked;	// can't pass properties in as ref
			l_setbit(ref marked, FIXEDBIT);
			s.tsv.marked = marked;
		}
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:6,代码来源:lstring.cs

示例8: new_localvar

 private static void new_localvar(LexState ls, TString name, int n)
 {
     FuncState fs = ls.fs;
       luaY_checklimit(fs, fs.nactvar+n+1, LUAI_MAXVARS, "local variables");
       fs.actvar[fs.nactvar+n] = (ushort)registerlocalvar(ls, name);
 }
开发者ID:niuniuzhu,项目名称:KopiLua,代码行数:6,代码来源:lparser.cs

示例9: GetStr

 public static CharPtr GetStr(TString ts)
 {
     return ts.str;
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:4,代码来源:lobject.cs

示例10: setsvalue2s

 //#define setsvalue2s	setsvalue
 internal static void setsvalue2s(lua_State L, TValue obj, TString x)
 {
     setsvalue(L, obj, x);
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:5,代码来源:lobject.cs

示例11: fornum

 private static void fornum(LexState ls, TString varname, int line)
 {
     /* fornum . NAME = exp1,exp1[,exp1] forbody */
       FuncState fs = ls.fs;
       int base_ = fs.freereg;
       new_localvarliteral(ls, "(for index)", 0);
       new_localvarliteral(ls, "(for limit)", 1);
       new_localvarliteral(ls, "(for step)", 2);
       new_localvar(ls, varname, 3);
       checknext(ls, '=');
       exp1(ls);  /* initial value */
       checknext(ls, ',');
       exp1(ls);  /* limit */
       if (testnext(ls, ',') != 0)
     exp1(ls);  /* optional step */
       else {  /* default step = 1 */
     LuaKCodeABx(fs, OpCode.OP_LOADK, fs.freereg, LuaKNumberK(fs, 1));
     LuaKReserveRegs(fs, 1);
       }
       forbody(ls, base_, line, 1, 1);
 }
开发者ID:niuniuzhu,项目名称:KopiLua,代码行数:21,代码来源:lparser.cs

示例12: hashstr

 public static Node hashstr(Table t, TString str)
 {
     return hashpow2(t, str.tsv.hash);
 }
开发者ID:TrentSterling,项目名称:kopilua,代码行数:4,代码来源:ltable.cs

示例13: stringmark

 public static void stringmark(TString s)
 {
     reset2bits(ref s.tsv.marked, WHITE0BIT, WHITE1BIT);
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:4,代码来源:lgc.cs

示例14: luaH_setstr

 public static TValue luaH_setstr(lua_State L, Table t, TString key)
 {
     TValue p = luaH_getstr(t, key);
       if (p != luaO_nilobject)
     return (TValue)p;
       else {
     TValue k = new TValue();
     setsvalue(L, k, key);
     return newkey(L, t, k);
       }
 }
开发者ID:TrentSterling,项目名称:kopilua,代码行数:11,代码来源:ltable.cs

示例15: luaH_getstr

 /*
 ** search function for strings
 */
 public static TValue luaH_getstr(Table t, TString key)
 {
     Node n = hashstr(t, key);
       do {  /* check whether `key' is somewhere in the chain */
     if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key)
       return gval(n);  /* that's it */
     else n = gnext(n);
       } while (n != null);
       return luaO_nilobject;
 }
开发者ID:TrentSterling,项目名称:kopilua,代码行数:13,代码来源:ltable.cs


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