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


C++ chr函数代码示例

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


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

示例1: LMSpostproc1

static
sais_index_type
LMSpostproc1(const void *T, sais_index_type *SA,
             sais_index_type n, sais_index_type m, int cs) {
  sais_index_type i, j, p, q, plen, qlen, name;
  sais_index_type c0, c1;
  sais_bool_type diff;

  /* compact all the sorted substrings into the first m items of SA
      2*m must be not larger than n (proveable) */
  assert(0 < n);
  for(i = 0; (p = SA[i]) < 0; ++i) { SA[i] = ~p; assert((i + 1) < n); }
  if(i < m) {
    for(j = i, ++i;; ++i) {
      assert(i < n);
      if((p = SA[i]) < 0) {
        SA[j++] = ~p; SA[i] = 0;
        if(j == m) { break; }
      }
    }
  }

  /* store the length of all substrings */
  i = n - 1; j = n - 1; c0 = chr(n - 1);
  do { c1 = c0; } while((0 <= --i) && ((c0 = chr(i)) >= c1));
  for(; 0 <= i;) {
    do { c1 = c0; } while((0 <= --i) && ((c0 = chr(i)) <= c1));
    if(0 <= i) {
      SA[m + ((i + 1) >> 1)] = j - i; j = i + 1;
      do { c1 = c0; } while((0 <= --i) && ((c0 = chr(i)) >= c1));
    }
  }
开发者ID:gitpan,项目名称:Code-DRY,代码行数:32,代码来源:salcpis.c

示例2: _vp

	render_textureCube::render_textureCube(device* _dev, uint size, pixel_format f, pixel_format df)
		: _vp(vec2(size)), textureCube(_dev, CD3D11_TEXTURE2D_DESC((DXGI_FORMAT)f, size, size, 6, 1,
		D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE))
	{
		//create shared dsv
		CD3D11_TEXTURE2D_DESC dd(
			(DXGI_FORMAT)detail::get_texture_format_for_depth(df)/*DXGI_FORMAT_R24G8_TYPELESS*/, size, size);
		dd.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
		ComPtr<ID3D11Texture2D> dst;
		chr(_dev->ddevice()->CreateTexture2D(&dd, nullptr, &dst));
		CD3D11_DEPTH_STENCIL_VIEW_DESC dsvd(dst.Get(), D3D11_DSV_DIMENSION_TEXTURE2D, (DXGI_FORMAT)df);
		chr(_dev->ddevice()->CreateDepthStencilView(dst.Get(), &dsvd, dsv.GetAddressOf()));

		//create each face's resources
		CD3D11_RENDER_TARGET_VIEW_DESC rtvd(D3D11_RTV_DIMENSION_TEXTURE2DARRAY,
			(DXGI_FORMAT)f);
		rtvd.Texture2DArray.ArraySize = 1;
		rtvd.Texture2DArray.MipSlice = 0;
		for (int i = 0; i < 6; ++i)
		{
			rtx[i] = nullptr; 
			rtvd.Texture2DArray.FirstArraySlice = i;
			chr(_dev->ddevice()->CreateRenderTargetView(texd.Get(), &rtvd, &rtv[i]));
		}
	}
开发者ID:andrew-pa,项目名称:libqeg,代码行数:25,代码来源:render_target_ex.cpp

示例3: CharMap_CellToChar

string CharMap_CellToChar(float c)
{
	if(c == 13)
		return chr(127);
	else if(c < 32)
		return chr(c);
	else
		return chr(c + 96);
}
开发者ID:ZeusInTraining,项目名称:edu2,代码行数:9,代码来源:charmap.c

示例4: nameSubstr

unsigned int nameSubstr(unsigned int *SA, 
  const unsigned char *s, unsigned int *s1, unsigned int n, 
  unsigned int m, unsigned int n1, int level) {
  unsigned int i, j, cur_t, succ_t;

  // init the name array buffer
  for(i=n1; i<n; i++) SA[i]=EMP;

  // scan to compute the interim s1
  unsigned int name, name_ctr=0;
  unsigned int pre_pos, pre_len=0;
  for(i=0; i<n1; i++) {
    bool diff=false;
    unsigned int len, pos=SA[i];

    len=getLengthOfLMS(s, n, level, pos);
    if(len!=pre_len) diff=true;
    else
      for(unsigned int d=0; d<len; d++)
        if(pos+d==n-1 || pre_pos+d==n-1 ||
           chr(pos+d)!=chr(pre_pos+d)) {
          diff=true; break;
        }

    if(diff) {
      name=i; name_ctr++;
      SA[name]=1; // a new name.
      pre_pos=pos; pre_len=len;
    }
    else
      SA[name]++; // count this name.

    SA[n1+pos/2]=name;
  }

  // compact the interim s1 sparsely stored 
  //   in SA[n1, n-1] into SA[m-n1, m-1].
  for(i=n-1, j=m-1; i>=n1; i--)
    if(SA[i]!=EMP) SA[j--]=SA[i];

  // rename each S-type character of the
  //   interim s1 as the end of its bucket
  //   to produce the final s1.
  succ_t=1;
  for(i=n1-1; i>0; i--) {
    int ch=s1[i], ch1=s1[i-1];
    cur_t=(ch1< ch || (ch1==ch && succ_t==1))?1:0;
    if(cur_t==1) {
      s1[i-1]+=SA[s1[i-1]]-1;
    }
    succ_t=cur_t;
  }

  return name_ctr;
}
开发者ID:pombredanne,项目名称:bgone,代码行数:55,代码来源:saca-k.cpp

示例5: chr

	shader::shader(ComPtr<ID3D11Device> device, datablob<byte>* vs_shaderData,
		datablob<byte>* ps_shaderData, const D3D11_INPUT_ELEMENT_DESC inputLayoutA[], int inputLayoutLength)
	{
		if (vs_shaderData != nullptr)
			chr(device->CreateVertexShader(vs_shaderData->data, vs_shaderData->length, nullptr, &vertexShader));
		else
			vertexShader = nullptr;
		chr(device->CreateInputLayout(inputLayoutA, inputLayoutLength, vs_shaderData->data, vs_shaderData->length, &inputLayout));
		if (ps_shaderData != nullptr)
			chr(device->CreatePixelShader(ps_shaderData->data, ps_shaderData->length, nullptr, &pixelShader));
		else
			pixelShader = nullptr;
	}
开发者ID:andrew-pa,项目名称:aldx,代码行数:13,代码来源:shader.cpp

示例6: number

static bool
number(struct scanner *s, int64_t *out, int *out_tok)
{
    bool is_float = false, is_hex = false;
    const char *start = s->s + s->pos;
    char *end;

    if (lit(s, "0x")) {
        while (is_xdigit(peek(s))) next(s);
        is_hex = true;
    }
    else {
        while (is_digit(peek(s))) next(s);
        is_float = chr(s, '.');
        while (is_digit(peek(s))) next(s);
    }
    if (s->s + s->pos == start)
        return false;

    errno = 0;
    if (is_hex)
        *out = strtoul(start, &end, 16);
    else if (is_float)
        *out = strtod(start, &end);
    else
        *out = strtoul(start, &end, 10);
    if (errno != 0 || s->s + s->pos != end)
        *out_tok = ERROR_TOK;
    else
        *out_tok = (is_float ? FLOAT : INTEGER);
    return true;
}
开发者ID:hardening,项目名称:libxkbcommon,代码行数:32,代码来源:scanner.c

示例7: RETURN_ERR

blargg_err_t Nes_Cart::load_ines( Auto_File_Reader in )
{
	RETURN_ERR( in.open() );
	
	ines_header_t h;
	RETURN_ERR( in->read( &h, sizeof h ) );
	
	if ( 0 != memcmp( h.signature, "NES\x1A", 4 ) )
		return not_ines_file;
	
	if ( h.zero [7] ) // handle header defaced by a fucking idiot's handle
		h.flags2 = 0;
	
	set_mapper( h.flags, h.flags2 );
	
	if ( h.flags & 0x04 ) // skip trainer
		RETURN_ERR( in->skip( 512 ) );
	
	RETURN_ERR( resize_prg( h.prg_count * 16 * 1024L ) );
	RETURN_ERR( resize_chr( h.chr_count * 8 * 1024L ) );
	
	RETURN_ERR( in->read( prg(), prg_size() ) );
	RETURN_ERR( in->read( chr(), chr_size() ) );
	
	return 0;
}
开发者ID:Bindernews,项目名称:HeadlessQuickNes,代码行数:26,代码来源:Nes_Cart.cpp

示例8: chr

// -----------------------------------------------------------------------------
// CNSPTestConsoleApp::GetStringFromConsole
// -----------------------------------------------------------------------------
// 
TKeyCode CNSPTestConsoleApp::GetStringFromConsoleL( TDes& aBuffer )
	{
    TKeyCode input = EKeyNull;
    const TInt startPos = iConsole->WhereX();
	iConsole->Write( aBuffer );
	
    do  {
    	input = iConsole->Getch();
    	
    	if ( ( EKeyBackspace == input || EKeyDelete == input ) &&
    		 startPos < iConsole->WhereX() ) // Backspace & Delete
            {
            iConsole->SetPos( iConsole->WhereX() - 1 );
            iConsole->ClearToEndOfLine();
            
            aBuffer.SetLength(  0 < aBuffer.Length() ?
            					aBuffer.Length() - 1 :
            					aBuffer.Length() );
            }
    	else{
    		TChar chr( input );
    		
    		if ( chr.IsPrint() )
    			{
    			aBuffer.Append( chr );
    			iConsole->Printf( _L("%c"), input );
    			}
    		}
    	}
    while ( EKeyEnter != input && EKeyEscape != input );
    
    return input;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:37,代码来源:nsptestconsoleapp.cpp

示例9: sys_shlfunc

sys_shlfunc()
#define sys_shl sys_shlfunc()
{register int st,i,v ;
  st=cre(1);
  fprintf ( bstdout, "Shell (0 to quit): ");
  read_str(st);
  while( len_str(st)==0 ){
    fprintf ( bstdout, "\n");
    fprintf ( bstdout, "Shell (0 to quit): ");
    read_str(st);
  }
  while( fst_str(st)!=ord('0') ){
    itr_str(st,i,v,cstr_shl[i-1]=chr(v));
    cstr_shl[len_str(st)]='\0';
    fprintf ( bstdout, "\n");
    system(cstr_shl);
    fprintf ( bstdout, "\n");
    fprintf ( bstdout, "Shell (0 to quit): ");
    read_str(st);
    while( len_str(st)==0 ){
      fprintf ( bstdout, "\n");
      fprintf ( bstdout, "Shell (0 to quit): ");
      read_str(st);
    }
  }
}
开发者ID:bendisposto,项目名称:BToolkit,代码行数:26,代码来源:shlmch.c

示例10: TEST_F

TEST_F(NodeTest, testPrioritySelector) {
	ai::PrioritySelector::Factory f;
	ai::TreeNodeFactoryContext ctx("testpriorityselector", "", ai::True::get());
	ai::TreeNodePtr node = f.create(&ctx);

	ai::Idle::Factory idleFac;
	ai::TreeNodeFactoryContext idleCtx1("testidle", "2", ai::True::get());
	ai::TreeNodePtr idle1 = idleFac.create(&idleCtx1);
	ai::TreeNodeFactoryContext idleCtx2("testidle2", "2", ai::True::get());
	ai::TreeNodePtr idle2 = idleFac.create(&idleCtx2);

	node->addChild(idle1);
	node->addChild(idle2);

	ai::AIPtr e(new ai::AI(node));
	ai::ICharacterPtr chr(new ai::ICharacter(1));
	e->setCharacter(chr);
	e->update(1, true);
	e->getBehaviour()->execute(e, 1);
	ASSERT_EQ(ai::RUNNING, idle1->getLastStatus(e));
	ASSERT_EQ(ai::UNKNOWN, idle2->getLastStatus(e));
	e->update(1, true);
	e->getBehaviour()->execute(e, 1);
	ASSERT_EQ(ai::RUNNING, idle1->getLastStatus(e));
	ASSERT_EQ(ai::UNKNOWN, idle2->getLastStatus(e));
	e->update(1, true);
	e->getBehaviour()->execute(e, 1);
	ASSERT_EQ(ai::FINISHED, idle1->getLastStatus(e));
	ASSERT_EQ(ai::UNKNOWN, idle2->getLastStatus(e));
}
开发者ID:mgerhardy,项目名称:simpleai,代码行数:30,代码来源:NodeTest.cpp

示例11: texture2d

	depth_render_texture2d::depth_render_texture2d(device* _dev, uvec2 size, pixel_format df)
		: texture2d(_dev, CD3D11_TEXTURE2D_DESC((DXGI_FORMAT)detail::get_texture_format_for_depth(df)/*DXGI_FORMAT_R24G8_TYPELESS*/, size.x, size.y, 1, 1, 
			D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE)), _vp(size)
	{
		CD3D11_DEPTH_STENCIL_VIEW_DESC dsvd(texd.Get(), D3D11_DSV_DIMENSION_TEXTURE2D, (DXGI_FORMAT)df /*DXGI_FORMAT_D24_UNORM_S8_UINT*/);
		chr(_dev->ddevice()->CreateDepthStencilView(texd.Get(), &dsvd, dsv.GetAddressOf()));
	}
开发者ID:andrew-pa,项目名称:libqeg,代码行数:7,代码来源:render_target_ex.cpp

示例12: list_as_chr

SEXP list_as_chr(SEXP x) {
  int n = Rf_length(x);
  CharacterVector chr(n);

  for (int i = 0; i != n; ++i) {
    SEXP elt = VECTOR_ELT(x, i);
    switch (TYPEOF(elt)) {
    case STRSXP:
      if (Rf_length(chr) == 1) {
        chr[i] = elt;
        continue;
      }
      break;
    case SYMSXP:
      chr[i] = PRINTNAME(elt);
      continue;
    default:
      break;
    }

    stop("corrupt grouped data frame");
  }

  return chr;
}
开发者ID:yutannihilation,项目名称:dplyr,代码行数:25,代码来源:utils.cpp

示例13: getCounts

/* find the start or end of each bucket */
static
void
getCounts(const void *T, sais_index_type *C, sais_index_type n, sais_index_type k, int cs) {
  sais_index_type i;
  for(i = 0; i < k; ++i) { C[i] = 0; }
  for(i = 0; i < n; ++i) { ++C[chr(i)]; }
}
开发者ID:gitpan,项目名称:Code-DRY,代码行数:8,代码来源:salcpis.c

示例14: create

static fs_node_t* create(char* filename, unsigned int type) {

	fs_node_t* curdir = 0;
	if(filename[0] == '/') {
		curdir = fs_root;
		filename++;
		
		if(filename[0] == 0) 
				return 0;
	}
	else curdir = current_task->cwd;
	
	
	char* s = str_dup(filename);
	int ret = 0;
	
	while(s) {
		if(chr(s, '/')) {
			char* p = chr(s, '/');
			*p = 0;
			p++;
			
			if(strcmp(s, ".") == 0) 
				curdir = curdir;
			else if(strcmp(s, "..") == 0) 
				curdir = curdir->parent == 0 ? curdir : curdir->parent;
			else {		
				fs_node_t* search = fs_finddir(curdir, s);
				if(!search) {
					ret = 0;
					break;
				}
					
				curdir = search;
			}
			
			s = p;
		}else {
			ret = fs_creat(curdir, s, type);
			break;
		}
	}
	
	kfree(s);
	return ret;
}
开发者ID:WareX97,项目名称:K2,代码行数:46,代码来源:open_close.c

示例15: getCounts

/*** start: sais.C-alphabet.c */
static
void
getCounts(const void *T, int *C, int n, int k, int cs) {
    int i;
    for(i = 0; i < k; ++i) { C[i] = 0; }
    for(i = 0; i < n; ++i) { ++C[chr(i)]; }
    /* C: number of occurrences of each symbol */
}
开发者ID:AlgoLab,项目名称:elementi-bioinformatica,代码行数:9,代码来源:sais.c


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