您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ use函数代码示例

51自学网 2021-06-03 09:22:39
  C++
这篇教程C++ use函数代码示例写得很实用,希望能帮到您。

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

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

示例1: program

LinkedShader::LinkedShader(Shader *vs, Shader *fs)		: program(0), dirtyUniforms(0) {	program = glCreateProgram();	glAttachShader(program, vs->shader);	glAttachShader(program, fs->shader);	glLinkProgram(program);	GLint linkStatus;	glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);	if (linkStatus != GL_TRUE) {		GLint bufLength = 0;		glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);		if (bufLength) {			char* buf = new char[bufLength];			glGetProgramInfoLog(program, bufLength, NULL, buf);			ERROR_LOG(G3D, "Could not link program:/n %s", buf);			ERROR_LOG(G3D, "VS:/n%s", vs->source().c_str());			ERROR_LOG(G3D, "FS:/n%s", fs->source().c_str());			delete [] buf;	// we're dead!		}		return;	}	INFO_LOG(G3D, "Linked shader: vs %i fs %i", (int)vs->shader, (int)fs->shader);	u_tex = glGetUniformLocation(program, "tex");	u_proj = glGetUniformLocation(program, "u_proj");	u_proj_through = glGetUniformLocation(program, "u_proj_through");	u_texenv = glGetUniformLocation(program, "u_texenv");	u_fogcolor = glGetUniformLocation(program, "u_fogcolor");	u_fogcoef = glGetUniformLocation(program, "u_fogcoef");	u_alphacolorref = glGetUniformLocation(program, "u_alphacolorref");	u_colormask = glGetUniformLocation(program, "u_colormask");	// Transform	u_view = glGetUniformLocation(program, "u_view");	u_world = glGetUniformLocation(program, "u_world");	u_texmtx = glGetUniformLocation(program, "u_texmtx");	for (int i = 0; i < 8; i++) {		char name[64];		sprintf(name, "u_bone%i", i);		u_bone[i] = glGetUniformLocation(program, name);	}	// Lighting, texturing	u_ambient = glGetUniformLocation(program, "u_ambient");	u_matambientalpha = glGetUniformLocation(program, "u_matambientalpha");	u_matdiffuse = glGetUniformLocation(program, "u_matdiffuse");	u_matspecular = glGetUniformLocation(program, "u_matspecular");	u_matemissive = glGetUniformLocation(program, "u_matemissive");	u_uvscaleoffset = glGetUniformLocation(program, "u_uvscaleoffset");	for (int i = 0; i < 4; i++) {		char temp[64];		sprintf(temp, "u_lightpos%i", i);		u_lightpos[i] = glGetUniformLocation(program, temp);		sprintf(temp, "u_lightdir%i", i);		u_lightdir[i] = glGetUniformLocation(program, temp);		sprintf(temp, "u_lightatt%i", i);		u_lightatt[i] = glGetUniformLocation(program, temp);		sprintf(temp, "u_lightangle%i", i);		u_lightangle[i] = glGetUniformLocation(program, temp);		sprintf(temp, "u_lightspotCoef%i", i);		u_lightspotCoef[i] = glGetUniformLocation(program, temp);		sprintf(temp, "u_lightambient%i", i);		u_lightambient[i] = glGetUniformLocation(program, temp);		sprintf(temp, "u_lightdiffuse%i", i);		u_lightdiffuse[i] = glGetUniformLocation(program, temp);		sprintf(temp, "u_lightspecular%i", i);		u_lightspecular[i] = glGetUniformLocation(program, temp);	}	a_position = glGetAttribLocation(program, "a_position");	a_color0 = glGetAttribLocation(program, "a_color0");	a_color1 = glGetAttribLocation(program, "a_color1");	a_texcoord = glGetAttribLocation(program, "a_texcoord");	a_normal = glGetAttribLocation(program, "a_normal");	a_weight0123 = glGetAttribLocation(program, "a_weight0123");	a_weight4567 = glGetAttribLocation(program, "a_weight4567");	glUseProgram(program);	// Default uniform values	glUniform1i(u_tex, 0);	// The rest, use the "dirty" mechanism.	dirtyUniforms = DIRTY_ALL;	use();}
开发者ID:ImandaSyachrul,项目名称:ppsspp,代码行数:88,


示例2: sysdatalog

SysDatalogPtr SysDatalogRepository::select(const SysDatalog& obj){	soci::row row;	SysDatalogPtr sysdatalog(new SysDatalog);	dataBase << "SELECT  sys_datalog.datalog_id as SysDatalog_datalog_id, sys_datalog.server_id as SysDatalog_server_id, sys_datalog.dbtable as SysDatalog_dbtable, sys_datalog.dbidx as SysDatalog_dbidx, sys_datalog.action as SysDatalog_action, sys_datalog.tstamp as SysDatalog_tstamp, sys_datalog.user as SysDatalog_user, sys_datalog.data as SysDatalog_data, sys_datalog.status as SysDatalog_status, sys_datalog.error as SysDatalog_error"	" FROM sys_datalog "	"WHERE sys_datalog.datalog_id = :SysDatalog_datalog_id AND sys_datalog.server_id = :SysDatalog_server_id", into(row), use(obj);	if(!dataBase.got_data())		sysdatalog.reset();	else		type_conversion<SysDatalog>::from_base(row, i_ok, *sysdatalog);	return sysdatalog;}
开发者ID:IAESB,项目名称:AddUserPosfix,代码行数:13,


示例3: f

voidf (v4i *x, v4i *y){  v4i const zz = *x < *y;  use (&zz);}
开发者ID:0day-ci,项目名称:gcc,代码行数:6,


示例4: allocateRegs

void BackEnd::genCodeImpl(IRUnit& unit, AsmInfo* asmInfo) {  ctr++;  auto regs = allocateRegs(unit);  assert(checkRegisters(unit, regs)); // calls checkCfg internally.  Timer _t(Timer::codeGen);  LiveRegs live_regs = computeLiveRegs(unit, regs);  CodegenState state(unit, regs, live_regs, asmInfo);  CodeBlock& mainCodeIn   = mcg->code.main();  CodeBlock& coldCodeIn   = mcg->code.cold();  CodeBlock* frozenCode   = &mcg->code.frozen();  CodeBlock mainCode;  CodeBlock coldCode;  bool relocate = false;  if (RuntimeOption::EvalJitRelocationSize &&      supportsRelocation() &&      coldCodeIn.canEmit(RuntimeOption::EvalJitRelocationSize * 3)) {    /*     * This is mainly to exercise the relocator, and ensure that its     * not broken by new non-relocatable code. Later, it will be     * used to do some peephole optimizations, such as reducing branch     * sizes.     * Allocate enough space that the relocated cold code doesn't     * overlap the emitted cold code.     */    static unsigned seed = 42;    auto off = rand_r(&seed) & (cacheLineSize() - 1);    coldCode.init(coldCodeIn.frontier() +                   RuntimeOption::EvalJitRelocationSize + off,                   RuntimeOption::EvalJitRelocationSize - off, "cgRelocCold");    mainCode.init(coldCode.frontier() +                  RuntimeOption::EvalJitRelocationSize + off,                  RuntimeOption::EvalJitRelocationSize - off, "cgRelocMain");    relocate = true;  } else {    /*     * Use separate code blocks, so that attempts to use the mcg's     * code blocks directly will fail (eg by overwriting the same     * memory being written through these locals).     */    coldCode.init(coldCodeIn.frontier(), coldCodeIn.available(),                  coldCodeIn.name().c_str());    mainCode.init(mainCodeIn.frontier(), mainCodeIn.available(),                  mainCodeIn.name().c_str());  }  if (frozenCode == &coldCodeIn) {    frozenCode = &coldCode;  }  auto frozenStart = frozenCode->frontier();  auto coldStart DEBUG_ONLY = coldCodeIn.frontier();  auto mainStart DEBUG_ONLY = mainCodeIn.frontier();  size_t hhir_count{0};  {    mcg->code.lock();    mcg->cgFixups().setBlocks(&mainCode, &coldCode, frozenCode);    SCOPE_EXIT {      mcg->cgFixups().setBlocks(nullptr, nullptr, nullptr);      mcg->code.unlock();    };    if (RuntimeOption::EvalHHIRGenerateAsserts) {      emitTraceCall(mainCode, unit.bcOff());    }    auto const linfo = layoutBlocks(unit);    auto main_start = mainCode.frontier();    auto cold_start = coldCode.frontier();    auto frozen_start = frozenCode->frontier();    Vasm vasm(&state.meta);    auto& vunit = vasm.unit();    // create the initial set of vasm numbered the same as hhir blocks.    for (uint32_t i = 0, n = unit.numBlocks(); i < n; ++i) {      state.labels[i] = vunit.makeBlock(AreaIndex::Main);    }    vunit.roots.push_back(state.labels[unit.entry()]);    vasm.main(mainCode);    vasm.cold(coldCode);    vasm.frozen(*frozenCode);    for (auto it = linfo.blocks.begin(); it != linfo.blocks.end(); ++it) {      auto block = *it;      auto v = block->hint() == Block::Hint::Unlikely ? vasm.cold() :               block->hint() == Block::Hint::Unused ? vasm.frozen() :               vasm.main();      FTRACE(6, "genBlock {} on {}/n", block->id(),             area_names[(unsigned)v.area()]);      auto b = state.labels[block];      vunit.blocks[b].area = v.area();      v.use(b);      hhir_count += genBlock(unit, v, vasm, state, block);      assert(v.closed());      assert(vasm.main().empty() || vasm.main().closed());      assert(vasm.cold().empty() || vasm.cold().closed());      assert(vasm.frozen().empty() || vasm.frozen().closed());    }//.........这里部分代码省略.........
开发者ID:Ruwan-Ranganath,项目名称:hhvm,代码行数:101,


示例5: crc32

static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_base){	unsigned char *p;	unsigned long size, c;	off_t base_offset;	unsigned shift;	void *data;	obj->idx.offset = consumed_bytes;	input_crc32 = crc32(0, Z_NULL, 0);	p = fill(1);	c = *p;	use(1);	obj->type = (c >> 4) & 7;	size = (c & 15);	shift = 4;	while (c & 0x80) {		p = fill(1);		c = *p;		use(1);		size += (c & 0x7f) << shift;		shift += 7;	}	obj->size = size;	switch (obj->type) {	case OBJ_REF_DELTA:		hashcpy(delta_base->sha1, fill(20));		use(20);		break;	case OBJ_OFS_DELTA:		memset(delta_base, 0, sizeof(*delta_base));		p = fill(1);		c = *p;		use(1);		base_offset = c & 127;		while (c & 128) {			base_offset += 1;			if (!base_offset || MSB(base_offset, 7))				bad_object(obj->idx.offset, "offset value overflow for delta base object");			p = fill(1);			c = *p;			use(1);			base_offset = (base_offset << 7) + (c & 127);		}		delta_base->offset = obj->idx.offset - base_offset;		if (delta_base->offset <= 0 || delta_base->offset >= obj->idx.offset)			bad_object(obj->idx.offset, "delta base offset is out of bound");		break;	case OBJ_COMMIT:	case OBJ_TREE:	case OBJ_BLOB:	case OBJ_TAG:		break;	default:		bad_object(obj->idx.offset, "unknown object type %d", obj->type);	}	obj->hdr_size = consumed_bytes - obj->idx.offset;	data = unpack_entry_data(obj->idx.offset, obj->size);	obj->idx.crc32 = input_crc32;	return data;}
开发者ID:meejah,项目名称:git,代码行数:64,


示例6: mailaccess

MailAccessPtr MailAccessRepository::select(const MailAccess& obj){	soci::row row;	MailAccessPtr mailaccess(new MailAccess);	dataBase << "SELECT  mail_access.access_id as MailAccess_access_id, mail_access.sys_userid as MailAccess_sys_userid, mail_access.sys_groupid as MailAccess_sys_groupid, mail_access.sys_perm_user as MailAccess_sys_perm_user, mail_access.sys_perm_group as MailAccess_sys_perm_group, mail_access.sys_perm_other as MailAccess_sys_perm_other, mail_access.server_id as MailAccess_server_id, mail_access.source as MailAccess_source, mail_access.access as MailAccess_access, mail_access.type as MailAccess_type, mail_access.active as MailAccess_active"	" FROM mail_access "	"WHERE mail_access.access_id = :MailAccess_access_id AND mail_access.server_id = :MailAccess_server_id", into(row), use(obj);	if(!dataBase.got_data())		mailaccess.reset();	else		type_conversion<MailAccess>::from_base(row, i_ok, *mailaccess);	return mailaccess;}
开发者ID:IAESB,项目名称:AddUserPosfix,代码行数:13,


示例7: mailcontentfilter

MailContentFilterPtr MailContentFilterRepository::select(const MailContentFilter& obj){	soci::row row;	MailContentFilterPtr mailcontentfilter(new MailContentFilter);	dataBase << "SELECT  mail_content_filter.content_filter_id as MailContentFilter_content_filter_id, mail_content_filter.sys_userid as MailContentFilter_sys_userid, mail_content_filter.sys_groupid as MailContentFilter_sys_groupid, mail_content_filter.sys_perm_user as MailContentFilter_sys_perm_user, mail_content_filter.sys_perm_group as MailContentFilter_sys_perm_group, mail_content_filter.sys_perm_other as MailContentFilter_sys_perm_other, mail_content_filter.server_id as MailContentFilter_server_id, mail_content_filter.type as MailContentFilter_type, mail_content_filter.pattern as MailContentFilter_pattern, mail_content_filter.data as MailContentFilter_data, mail_content_filter.action as MailContentFilter_action, mail_content_filter.active as MailContentFilter_active"	" FROM mail_content_filter "	"WHERE mail_content_filter.content_filter_id = :MailContentFilter_content_filter_id", into(row), use(obj);	if(!dataBase.got_data())		mailcontentfilter.reset();	else		type_conversion<MailContentFilter>::from_base(row, i_ok, *mailcontentfilter);	return mailcontentfilter;}
开发者ID:IAESB,项目名称:AddUserPosfix,代码行数:13,


示例8: use

// V-table should be defined with weak linkage.Test2b::Test2b() { use(typeid(Test2b)); }
开发者ID:Blizzard,项目名称:clang,代码行数:2,


示例9: amf3object

void plogin::process(){	obj2["data"] = amf3object();	amf3object & data2 = obj2["data"];	//errors:	//-5 = captcha	//-99 = general error	//-100 = holiday	string username = data["user"];	string password = data["pwd"];	if (gserver->maxplayers <= gserver->currentplayersonline + 1)	{		gserver->SendObject(req.conn, gserver->CreateError("server.LoginResponse", -99, "Servers are currently overloaded. Please try again later."));		return;	}	string newuser;	string newpass;	newuser = makesafe(username);	newpass = makesafe(password);	{		Session ses(gserver->accountpool->get());		Statement select(ses);		select << "SELECT COUNT(*) AS a FROM `account` WHERE `email`=?;", use(newuser);		select.execute();		RecordSet rs(select);		if (rs.value("a").convert<int32_t>() == 0)		{			//account does not exist - insert new row			try			{				Statement insert(ses);				insert << "INSERT INTO `account` (`name`, `email`, `ip`, `lastlogin`, `creation`, `password`, `status`, `reason`) VALUES ('null', ?, '', ?, ?, ?, 0, '');", use(newuser), use(unixtime()), use(unixtime()), use(newpass), now;			}			catch (Poco::Data::MySQL::StatementException * e)			{				gserver->consoleLogger->error(Poco::format("Account Create Exception: %s", e->displayText()));				return;			}		}	}	{		Session ses(gserver->accountpool->get());		Statement select(ses);		select << "SELECT * FROM `account` WHERE `email`=? AND `password`=?;", use(newuser), use(newpass);		select.execute();		RecordSet rs(select);		if (rs.rowCount() == 0)		{			//account doesn't exist or password is wrong			gserver->SendObject(req.conn, gserver->CreateError("server.LoginResponse", -2, "Incorrect account or password."));			return;		}		else		{			int32_t masteraccountid = rs.value("id").convert<int32_t>();			client = gserver->GetClientByParent(masteraccountid);			bool banned = false;			{				//are they banned? if so, globally or for this server?				Session ses2(gserver->serverpool->get());				Statement select2(ses2);				select2 << "SELECT * FROM `accounts` WHERE `parentid`=?;", use(masteraccountid);				select2.execute();				RecordSet rs2(select2);				if (rs.value("status").convert<int32_t>() == -99)					banned = true;				if (rs2.rowCount() > 0 && rs2.value("status").convert<int32_t>() == -99)					banned = true;				if (banned)				{					string errormsg = "You are banned. Reason: ";					errormsg += rs.value("reason").convert<string>().length() > 0 ? rs.value("reason").convert<string>() : rs2.value("reason").convert<string>();					gserver->SendObject(req.conn, gserver->CreateError("server.LoginResponse", -99, errormsg));					return;				}			}			//client = gserver->GetClientByParent(parentid);			if (client == 0)			{				client = gserver->NewClient();				client->masteraccountid = masteraccountid;				client->m_socknum = req.conn->uid;				client->socket = req.conn;				req.conn->client_ = client;//.........这里部分代码省略.........
开发者ID:Daizee,项目名称:spitfireiii,代码行数:101,


示例10: use

void OpenGLShader::use(){    use(nullptr);}
开发者ID:JonCG90,项目名称:GraphicsEngine,代码行数:4,


示例11: use

	void Event::play()	{		if(this->parent == NULL)			parent = Event::defaultParentEvent;		use(boost::any_cast<EnvirUseFunc>(this->at("play")));	}
开发者ID:ChadMcKinney,项目名称:libscpp,代码行数:6,


示例12: use

void LockQuery::lock() {	for (map<string, LockType>::iterator it = m_resources.begin(); it != m_resources.end(); ++it) {		*m_db << "insert into waiting(client_id, name) values(:id, :name)",			use(m_id, "id"),			use(it->first, "name");		for (;;) {			try {				transaction tr(*m_db);				LockTypeSet mySet;				*m_db << "select ex, pw, pr, cw, cr, nl from resources where eid = :eid and name = :name for update",				use(m_eid, "eid"),				use(it->first, "name"),				into(mySet[EX]),				into(mySet[PW]),				into(mySet[PR]),				into(mySet[CW]),				into(mySet[CR]),				into(mySet[NL]);				bool update = m_db->got_data();				LockTypeSet otherSet;				*m_db << "select ifnull(sum(ex), 0), ifnull(sum(pw), 0), ifnull(sum(pr), 0), ifnull(sum(cw), 0), ifnull(sum(cr), 0), ifnull(sum(nl), 0) from resources where eid != :eid and name = :name for update",				use(m_eid, "eid"),				use(it->first, "name"),				into(otherSet[EX]),				into(otherSet[PW]),				into(otherSet[PR]),				into(otherSet[CW]),				into(otherSet[CR]),				into(otherSet[NL]);				if (!m_db->got_data()) {					continue;				}				mySet += it->second;				if (LockTypeSet::compatible(mySet, otherSet)) {					if (update) {						*m_db << "update resources set ex = :ex, pw = :pw, pr = :pr, cw = :cw, cr = :cr, nl = :nl where eid = :eid and name = :name",							use(m_eid, "eid"),							use(it->first, "name"),							use(mySet[EX], "ex"),							use(mySet[PW], "pw"),							use(mySet[PR], "pr"),							use(mySet[CW], "cw"),							use(mySet[CR], "cr"),							use(mySet[NL], "nl");					} else {						*m_db << "insert into resources(eid, name, ex, pw, pr, cw, cr, nl) values(:eid, :name, :ex, :pw, :pr, :cw, :cr, :nl)",							use(m_eid, "eid"),							use(it->first, "name"),							use(mySet[EX], "ex"),							use(mySet[PW], "pw"),							use(mySet[PR], "pr"),							use(mySet[CW], "cw"),							use(mySet[CR], "cr"),							use(mySet[NL], "nl");					}					tr.commit();					break;				} else {					tr.rollback();					m_sync->wait();				}			} catch (...) {}		}		*m_db << "delete from waiting where client_id = :id and name = :name",			use(m_id, "id"),			use(it->first, "name");	}}
开发者ID:bobrofon,项目名称:nls,代码行数:73,


示例13: testSuppression

void testSuppression() {	use(*maybeNull());}
开发者ID:8l,项目名称:emscripten-fastcomp-clang,代码行数:3,


示例14: use

 ~reserved_memory() {     use(); }
开发者ID:fullstackenviormentss,项目名称:sbmt,代码行数:4,


示例15: main

int main (){  use (&v_char);  use (&v_signed_char);  use (&v_unsigned_char);  use (&v_short);  use (&v_signed_short);  use (&v_unsigned_short);  use (&v_int);  use (&v_signed_int);  use (&v_unsigned_int);  use (&v_long);  use (&v_signed_long);  use (&v_unsigned_long);  use (&v_long_long);  use (&v_signed_long_long);  use (&v_unsigned_long_long);  use (&v_float);  use (&v_double);  use (v_char_array);  use (v_signed_char_array);  use (v_unsigned_char_array);  use (v_short_array);  use (v_signed_short_array);  use (v_unsigned_short_array);  use (v_int_array);  use (v_signed_int_array);  use (v_unsigned_int_array);  use (v_long_array);  use (v_signed_long_array);  use (v_unsigned_long_array);  use (v_float_array);  use (v_double_array);  use (v_char_pointer);  use (v_signed_char_pointer);  use (v_unsigned_char_pointer);  use (v_short_pointer);  use (v_signed_short_pointer);  use (v_unsigned_short_pointer);  use (v_int_pointer);  use (v_signed_int_pointer);  use (v_unsigned_int_pointer);  use (v_long_pointer);  use (v_signed_long_pointer);  use (v_unsigned_long_pointer);  use (v_float_pointer);  use (v_double_pointer);  use (v_char_pointer_pointer);  use (v_signed_char_pointer_pointer);  use (v_unsigned_char_pointer_pointer);  use (v_short_pointer_pointer);  use (v_signed_short_pointer_pointer);  use (v_unsigned_short_pointer_pointer);  use (v_int_pointer_pointer);  use (v_signed_int_pointer_pointer);  use (v_unsigned_int_pointer_pointer);  use (v_long_pointer_pointer);  use (v_signed_long_pointer_pointer);  use (v_unsigned_long_pointer_pointer);  use (v_float_pointer_pointer);  use (v_double_pointer_pointer);  use (v_char_array_pointer);  use (v_signed_char_array_pointer);  use (v_unsigned_char_array_pointer);  use (v_short_array_pointer);  use (v_signed_short_array_pointer);  use (v_unsigned_short_array_pointer);  use (v_int_array_pointer);  use (v_signed_int_array_pointer);  use (v_unsigned_int_array_pointer);  use (v_long_array_pointer);  use (v_signed_long_array_pointer);  use (v_unsigned_long_array_pointer);  use (v_float_array_pointer);  use (v_double_array_pointer);//.........这里部分代码省略.........
开发者ID:bminor,项目名称:binutils-gdb,代码行数:101,


示例16: statement

//.........这里部分代码省略.........		       	while (t == CASE) {		       		static char stop[] = { IF, ID, 0 };		       		Tree p;		       		t = gettok();		       		p = constexpr(0);		       		if (generic(p->op) == CNST && isint(p->type)) {		       			if (swp) {		       				needconst++;		       				p = cast(p, swp->sym->type);		       				if (p->type->op == UNSIGNED)		       					p->u.v.i = extend(p->u.v.u, p->type);		       				needconst--;		       				caselabel(swp, p->u.v.i, lab);		       			}		       		} else		       			error("case label must be a constant integer expression/n");		       		test(':', stop);		       	}		       	statement(loop, swp, lev);		       } break;	case DEFAULT:  if (swp == NULL)		       	error("illegal default label/n");		       else if (swp->deflab)		       	error("extra default label/n");		       else {		       	swp->deflab = findlabel(swp->lab);		       	definelab(swp->deflab->u.l.label);		       }		       t = gettok();		       expect(':');		       statement(loop, swp, lev); break;	case RETURN:   {		       	Type rty = freturn(cfunc->type);		       	t = gettok();		       	definept(NULL);		       	if (t != ';')		       		if (rty == voidtype) {		       			error("extraneous return value/n");		       			expr(0);		       			retcode(NULL);		       		} else		       			retcode(expr(0));		       	else {		       		if (rty != voidtype)		       			warning("missing return value/n");		       		retcode(NULL);		       	}		       	branch(cfunc->u.f.label);		       } expect(';');					    break;	case '{':      compound(loop, swp, lev + 1); break;	case ';':      definept(NULL); t = gettok(); break;	case GOTO:     walk(NULL, 0, 0);		       definept(NULL);		       t = gettok();		       if (t == ID) {		       	Symbol p = lookup(token, stmtlabs);		       	if (p == NULL) {				p = install(token, &stmtlabs, 0, FUNC);				p->scope = LABELS;				p->u.l.label = genlabel(1);				p->src = src;			}		       	use(p, src);		       	branch(p->u.l.label);		       	t = gettok();		       } else		       	error("missing label in goto/n"); expect(';');					  break;	case ID:       if (getchr() == ':') {		       	stmtlabel();		       	statement(loop, swp, lev);		       	break;		       }	default:       definept(NULL);		       if (kind[t] != ID) {		       	error("unrecognized statement/n");		       	t = gettok();		       } else {		       	Tree e = expr0(0);		       	listnodes(e, 0, 0);		       	if (nodecount == 0 || nodecount > 200)		       		walk(NULL, 0, 0);		       	else if (glevel) walk(NULL, 0, 0);		       	deallocate(STMT);		       } expect(';');						break;	}	if (kind[t] != IF && kind[t] != ID	&& t != '}' && t != EOI) {		static char stop[] = { IF, ID, '}', 0 };		error("illegal statement termination/n");		skipto(0, stop);	}	refinc = ref;}
开发者ID:martijnvandijke,项目名称:Computation-2,代码行数:101,


示例17: toString

void SessionWrapper::execute(const v8::FunctionCallbackInfo<v8::Value>& args){	SessionHolder* pSessionHolder = Wrapper::unwrapNative<SessionHolder>(args);	Poco::Data::Session& session = pSessionHolder->session();	if (args.Length() > 0)	{		RecordSetHolder* pRecordSetHolder = new RecordSetHolder;		pRecordSetHolder->reserveBindings(static_cast<std::size_t>(args.Length() - 1));		try		{			Poco::Data::Statement statement = (session << toString(args[0]));			for (int i = 1; i < args.Length(); i++)			{				if (args[i]->IsString())				{					statement , use(pRecordSetHolder->bindValue(toString(args[i])));				}				else if (args[i]->IsBoolean())				{					statement , use(pRecordSetHolder->bindValue(args[i]->BooleanValue()));				}				else if (args[i]->IsInt32())				{					statement , use(pRecordSetHolder->bindValue(args[i]->Int32Value()));				}				else if (args[i]->IsUint32())				{					statement , use(pRecordSetHolder->bindValue(args[i]->Uint32Value()));				}				else if (args[i]->IsNumber())				{					statement , use(pRecordSetHolder->bindValue(args[i]->NumberValue()));				}#if POCO_VERSION > 0x01050000				else if (args[i]->IsDate())				{					v8::Local<v8::Date> jsDate = v8::Local<v8::Date>::Cast(args[i]);					double millis = jsDate->ValueOf();					Poco::Timestamp ts(static_cast<Poco::Timestamp::TimeVal>(millis*1000));					Poco::DateTime dateTime(ts);					statement , use(pRecordSetHolder->bindValue(dateTime));				}#endif				else				{					throw Poco::InvalidArgumentException(Poco::format("cannot convert argument %d to native type", i));				}			}			if (pSessionHolder->getPageSize() > 0)			{				statement , limit(pSessionHolder->getPageSize());			}			statement.execute();			pRecordSetHolder->assignStatement(statement);			pRecordSetHolder->updateRecordSet();			RecordSetWrapper wrapper;			v8::Persistent<v8::Object>& recordSetObject(wrapper.wrapNativePersistent(args.GetIsolate(), pRecordSetHolder));			args.GetReturnValue().Set(recordSetObject);		}		catch (Poco::Exception& exc)		{			delete pRecordSetHolder;			returnException(args, exc);		}	}}
开发者ID:JoneXie,项目名称:macchina.io,代码行数:66,


示例18: getGLProgram

void OpenGL1::onDraw(){    Size visibleSize = Director::getInstance()->getVisibleSize();        // add your codes here...    /*!     *  @author wuxingogo, 15-04-06 00:04:09     *     *  @brief  获得当前的着色器程序     *     *  @return nil     */    auto glProgram = getGLProgram();        glProgram->use();    /*!     *  @author wuxingogo, 15-04-06 00:04:17     *     *  @brief  set cocos2dx default shader     */    glProgram->setUniformsForBuiltins();        auto size = Director::getInstance()->getWinSize();    /*!     *  @author wuxingogo, 15-04-06 00:04:48     *     *  @brief  triangle vertex     */    float vertex[] = {        0,0,        size.width , 0,        size.width / 2, size.height    };    /*!     *  @author wuxingogo, 15-04-06 00:04:27     *     *  @brief  color vertex     */    float color[] = {        0,1,0,1,        1,0,0,1,        0,0,1,1    };    /*!     *  @author wuxingogo, 15-04-06 00:04:40     *     *  @brief  set addtive GL Enable, the color and vertex.     */    GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR);        glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertex);    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, 0, color);        glDrawArrays(GL_TRIANGLES, 0, 3);        CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 3);        CHECK_GL_ERROR_DEBUG();        }
开发者ID:TinySlik,项目名称:OpenGL-Cocos2dx-3.x,代码行数:61,


示例19: useHWTransform_

LinkedShader::LinkedShader(Shader *vs, Shader *fs, u32 vertType, bool useHWTransform, LinkedShader *previous)		: useHWTransform_(useHWTransform), program(0), dirtyUniforms(0) {	PROFILE_THIS_SCOPE("shaderlink");	program = glCreateProgram();	vs_ = vs;	glAttachShader(program, vs->shader);	glAttachShader(program, fs->shader);	// Bind attribute locations to fixed locations so that they're	// the same in all shaders. We use this later to minimize the calls to	// glEnableVertexAttribArray and glDisableVertexAttribArray.	glBindAttribLocation(program, ATTR_POSITION, "position");	glBindAttribLocation(program, ATTR_TEXCOORD, "texcoord");	glBindAttribLocation(program, ATTR_NORMAL, "normal");	glBindAttribLocation(program, ATTR_W1, "w1");	glBindAttribLocation(program, ATTR_W2, "w2");	glBindAttribLocation(program, ATTR_COLOR0, "color0");	glBindAttribLocation(program, ATTR_COLOR1, "color1");#ifndef USING_GLES2	if (gstate_c.featureFlags & GPU_SUPPORTS_DUALSOURCE_BLEND) {		// Dual source alpha		glBindFragDataLocationIndexed(program, 0, 0, "fragColor0");		glBindFragDataLocationIndexed(program, 0, 1, "fragColor1");	} else if (gl_extensions.VersionGEThan(3, 3, 0)) {		glBindFragDataLocation(program, 0, "fragColor0");	}#endif	glLinkProgram(program);	GLint linkStatus = GL_FALSE;	glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);	if (linkStatus != GL_TRUE) {		GLint bufLength = 0;		glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);		if (bufLength) {			char* buf = new char[bufLength];			glGetProgramInfoLog(program, bufLength, NULL, buf);#ifdef ANDROID			ELOG("Could not link program:/n %s", buf);#endif			ERROR_LOG(G3D, "Could not link program:/n %s", buf);			ERROR_LOG(G3D, "VS:/n%s", vs->source().c_str());			ERROR_LOG(G3D, "FS:/n%s", fs->source().c_str());			Reporting::ReportMessage("Error in shader program link: info: %s / fs: %s / vs: %s", buf, fs->source().c_str(), vs->source().c_str());#ifdef SHADERLOG			OutputDebugStringUTF8(buf);			OutputDebugStringUTF8(vs->source().c_str());			OutputDebugStringUTF8(fs->source().c_str());#endif			delete [] buf;	// we're dead!		}		// Prevent a buffer overflow.		numBones = 0;		return;	}	INFO_LOG(G3D, "Linked shader: vs %i fs %i", (int)vs->shader, (int)fs->shader);	u_tex = glGetUniformLocation(program, "tex");	u_proj = glGetUniformLocation(program, "u_proj");	u_proj_through = glGetUniformLocation(program, "u_proj_through");	u_texenv = glGetUniformLocation(program, "u_texenv");	u_fogcolor = glGetUniformLocation(program, "u_fogcolor");	u_fogcoef = glGetUniformLocation(program, "u_fogcoef");	u_alphacolorref = glGetUniformLocation(program, "u_alphacolorref");	u_alphacolormask = glGetUniformLocation(program, "u_alphacolormask");	u_stencilReplaceValue = glGetUniformLocation(program, "u_stencilReplaceValue");	u_testtex = glGetUniformLocation(program, "testtex");	u_fbotex = glGetUniformLocation(program, "fbotex");	u_blendFixA = glGetUniformLocation(program, "u_blendFixA");	u_blendFixB = glGetUniformLocation(program, "u_blendFixB");	u_fbotexSize = glGetUniformLocation(program, "u_fbotexSize");	// Transform	u_view = glGetUniformLocation(program, "u_view");	u_world = glGetUniformLocation(program, "u_world");	u_texmtx = glGetUniformLocation(program, "u_texmtx");	if (vertTypeGetWeightMask(vertType) != GE_VTYPE_WEIGHT_NONE)		numBones = TranslateNumBones(vertTypeGetNumBoneWeights(vertType));	else		numBones = 0;	u_depthRange = glGetUniformLocation(program, "u_depthRange");#ifdef USE_BONE_ARRAY	u_bone = glGetUniformLocation(program, "u_bone");#else	for (int i = 0; i < 8; i++) {		char name[10];		sprintf(name, "u_bone%i", i);		u_bone[i] = glGetUniformLocation(program, name);	}#endif	// Lighting, texturing	u_ambient = glGetUniformLocation(program, "u_ambient");	u_matambientalpha = glGetUniformLocation(program, "u_matambientalpha");//.........这里部分代码省略.........
开发者ID:jrancher,项目名称:ppsspp,代码行数:101,


示例20: f

void f() { use(&Child::Method); }
开发者ID:apurtell,项目名称:llvm-clang,代码行数:1,



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


C++ useFallbackContent函数代码示例
C++ usbnet_skb_return函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。