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

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

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

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

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

示例1: regexp_matched_pos

/**	regexp_matched_pos : 'regexp -> n:int -> { pos => int, len => int }	<doc>Return the [n]th matched block position by the regexp. If [n] is 0 then	return the whole matched substring position</doc>**/static value regexp_matched_pos( value o, value n ) {	pcredata *d;	int m;	val_check_kind(o,k_regexp);		d = PCRE(o);	val_check(n,int);	m = val_int(n);	if( m < 0 || m >= d->nmatchs || val_is_null(d->str) )		return alloc_null();	{		int start = d->matchs[m*2];		int len = d->matchs[m*2+1] - start;		value o = alloc_empty_object();		alloc_field(o,id_pos,alloc_int(start));		alloc_field(o,id_len,alloc_int(len));		return o;	}}
开发者ID:KTXSoftware,项目名称:Kha-haxelib,代码行数:23,


示例2: socket_send_char

/**	socket_send_char : 'socket -> int -> void	<doc>Send a character over a connected socket. Must be in the range 0..255</doc>**/static value socket_send_char( value o, value v ) {	int c;	unsigned char cc;        SOCKET sock = val_sock(o);	val_check(v,int);	c = val_int(v);	if( c < 0 || c > 255 )		return alloc_null();	cc = (unsigned char)c;	gc_enter_blocking();	POSIX_LABEL(send_char_again);	if( send(sock,(const char *)&cc,1,MSG_NOSIGNAL) == SOCKET_ERROR ) {		HANDLE_EINTR(send_char_again);		return block_error();	}	gc_exit_blocking();	return alloc_bool(true);}
开发者ID:flowplay,项目名称:hxcpp,代码行数:22,


示例3: lime_al_gen_buffers

value lime_al_gen_buffers (value n) {    int count = val_int (n);    ALuint* buffers = new ALuint[count];    alGenBuffers (count, buffers);    value result = alloc_array (count);    for (int i = 0; i < count; ++i) {        val_array_set_i (result, i, alloc_int (buffers[i]));    }    delete [] buffers;    return result;}
开发者ID:darkdarkdragon,项目名称:lime,代码行数:19,


示例4: lime_al_source_pausev

	void lime_al_source_pausev (int n, value sources) {				if (val_is_null (sources) == false) {						int size = val_array_size (sources);			ALuint* data = new ALuint[size];						for (int i = 0; i < size; ++i) {								data[i] = (ALuint)val_int( val_array_i (sources, i) );							}						alSourcePausev (n, data);						delete[] data;					}	}
开发者ID:Leander1P,项目名称:lime,代码行数:19,


示例5: wx_timer_create

value wx_timer_create(value inOwner,value inID){	wxEvtHandler *handler=0;   ValueToWX(inOwner,handler);	if (handler)	{      wxClientData *data = handler->GetClientObject();      if (data)      {         HaxeEventHandler *haxe = (HaxeEventHandler *)data;			handler = haxe;		}	}	wxTimer *timer = new wxTimer( handler, val_int(inID) );	return WXToDeletingValue(timer);}
开发者ID:TomByrne,项目名称:Waxe,代码行数:19,


示例6: builtin_hresize

/**	$hresize : 'hash -> int -> void	<doc>Resize an hashtable</doc>**/static value builtin_hresize( value vh, value size ) {	vhash *h;	hcell **cc;	int nsize;	int i;	val_check_kind(vh,k_hash);	val_check(size,int);	h = val_hdata(vh);	nsize = val_int(size);	if( nsize <= 0 )		nsize = HASH_DEF_SIZE;	cc = (hcell**)alloc(sizeof(hcell*)*nsize);	memset(cc,0,sizeof(hcell*)*nsize);	for(i=0;i<h->ncells;i++)		add_rec(cc,nsize,h->cells[i]);	h->cells = cc;	h->ncells = nsize;	return val_null;}
开发者ID:ConstNW,项目名称:neko,代码行数:23,


示例7: host_reverse

/**	host_reverse : 'int32 -> string	<doc>Reverse the DNS of the given IP address.</doc>**/static value host_reverse( value host ) {	struct hostent *h;	unsigned int ip;	val_check(host,int);	ip = val_int(host);   gc_enter_blocking();#	if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(ANDROID) || defined(BLACKBERRY)	h = gethostbyaddr((char *)&ip,4,AF_INET);#	else	struct hostent htmp;	int errcode;	char buf[1024];	gethostbyaddr_r((char *)&ip,4,AF_INET,&htmp,buf,1024,&h,&errcode);#	endif   gc_exit_blocking();	if( h == NULL )		return alloc_null();	return alloc_string( h->h_name );}
开发者ID:KTXSoftware,项目名称:Kha-haxelib,代码行数:23,


示例8: builtin_sfind

/**	$sfind : src:string -> pos:int -> pat:string -> int?	<doc>	Return the first position starting at [pos] in [src] where [pat] was found.	Return null if not found. Error if [pos] is outside [src] bounds.	</doc>**/static value builtin_sfind( value src, value pos, value pat ) {	int p, l, l2;	const char *ptr;	val_check(src,string);	val_check(pos,int);	val_check(pat,string);	p = val_int(pos);	l = val_strlen(src);	l2 = val_strlen(pat);	if( p < 0 || p >= l )		neko_error();	ptr = val_string(src) + p;	while( l - p >= l2 ) {		if( memcmp(ptr,val_string(pat),l2) == 0 )			return alloc_int(p);		p++;		ptr++;	}	return val_null;}
开发者ID:ConstNW,项目名称:neko,代码行数:27,


示例9: regexp_matched

/**	regexp_matched : 'regexp -> n:int -> string?	<doc>Return the [n]th matched block by the regexp. If [n] is 0 then return 	the whole matched substring. If the [n]th matched block was optional and not matched, returns null</doc>**/static value regexp_matched( value o, value n ) {	pcredata *d;	int m;	val_check_kind(o,k_regexp);		d = PCRE(o);	val_check(n,int);	m = val_int(n);	if( m < 0 || m >= d->nmatchs || val_is_null(d->str) )		neko_error();	{		int start = d->matchs[m*2];		int len = d->matchs[m*2+1] - start;		value str;		if( start == -1 )			return val_null;		str = alloc_empty_string(len);		memcpy((char*)val_string(str),val_string(d->str)+start,len);		return str;	}}
开发者ID:angavrilov,项目名称:iphone-neko,代码行数:25,


示例10: lime_al_sourceiv

	void lime_al_sourceiv (int source, int param, value values) {				if (val_is_null (values) == false) {						int size = val_array_size (values);			ALint* data = new ALint[size];						for (int i = 0; i < size; ++i) {								data[i] = (ALint)val_int( val_array_i (values, i) );							}						alSourceiv (source, param, data);						delete[] data;					}			}
开发者ID:Leander1P,项目名称:lime,代码行数:20,


示例11: lime_al_source_queue_buffers

	void lime_al_source_queue_buffers (int source, int nb, value buffers) {				if (val_is_null (buffers) == false) {						int size = val_array_size (buffers);			ALuint* data = new ALuint[size];						for (int i = 0; i < size; ++i) {								data[i] = (ALuint)val_int( val_array_i (buffers, i) );							}						alSourceQueueBuffers (source, nb, data);						delete[] data;					}			}
开发者ID:Leander1P,项目名称:lime,代码行数:20,


示例12: lime_al_delete_buffers

	void lime_al_delete_buffers (int n, value buffers) {				if (val_is_null (buffers) == false) {						int size = val_array_size (buffers);			ALuint* data = new ALuint[size];						for (int i = 0; i < size; ++i) {								data[i] = (ALuint)val_int( val_array_i (buffers, i) );							}						alDeleteBuffers (n, data);						delete[] data;					}			}
开发者ID:Leander1P,项目名称:lime,代码行数:20,


示例13: sys_create_dir

/**	sys_create_dir : string -> mode:int -> void	<doc>Create a directory with the specified rights</doc>**/static value sys_create_dir( value path, value mode ) {	#ifdef EPPC	return alloc_bool(true);	#else	val_check(path,string);	val_check(mode,int);	gc_enter_blocking();#ifdef NEKO_WINDOWS	if( mkdir(val_string(path)) != 0 )#else	if( mkdir(val_string(path),val_int(mode)) != 0 )#endif	{		gc_exit_blocking();		return alloc_null();	}	gc_exit_blocking();	return alloc_bool(true);	#endif}
开发者ID:Draknek,项目名称:hxcpp,代码行数:24,


示例14: test_max

static void test_max(Tuple *tuples[]){    Sum *s_int = sum_max(0, Int, val_new_int(&res.defi));    Sum *s_real = sum_max(1, Real, val_new_real(&res.defd));    Sum *s_long = sum_max(2, Long, val_new_long(&res.defl));    calc(tuples, s_int, s_real, s_long);    if (res.max_int != val_int(sum_value(s_int)))        fail();    if (res.max_real != val_real(sum_value(s_real)))        fail();    if (res.max_long != val_long(sum_value(s_long)))        fail();    test_defs(s_int, s_real, s_long);    mem_free(s_int);    mem_free(s_real);    mem_free(s_long);}
开发者ID:bandilab,项目名称:bandicoot,代码行数:21,


示例15: populate_address

	// TODO: check if this is right	// sync with udpr_connect() belowstatic value populate_address(ENetAddress *a, value ip, value port) {	if(!val_is_null(ip))		val_check(ip,int32);	val_check(port,int);	if(!val_is_null(ip) && val_int32(ip) != 0) {		a->host = val_int32(ip);		//a->host = htonl(val_int32(ip));	}	else {#ifdef ENET_DEBUG		fprintf(stderr, "populate_address: null ip/n");#endif		a->host = ENET_HOST_ANY;	}	a->port = val_int(port); //htons(val_int(port))#ifdef ENET_DEBUG	fprintf(stderr, "populate_address: %x:%u from %x:%u/n", a->host, a->port, val_is_null(ip)?0:val_int32(ip),val_int(port));#endif	return val_true;}
开发者ID:Badcreature,项目名称:caffeine-hx,代码行数:23,


示例16: snow_iosrc_file_read

        value snow_iosrc_file_read(value _handle, value _dest, value _size, value _maxnum) {            snow::io::iosrc_file* iosrc = snow::from_hx<snow::io::iosrc_file>( _handle );            QuickVec<unsigned char> buffer;            if( iosrc ) {                if(!val_is_null(_dest)) {                    ByteArray dest(_dest);                    int res = snow::io::read(iosrc->file_source, dest.Bytes(), val_int(_size), val_int(_maxnum));                    return alloc_int(res);                }            } //object from hx            return alloc_int(-1);        } DEFINE_PRIM(snow_iosrc_file_read, 4);
开发者ID:RealyUniqueName,项目名称:snow,代码行数:21,


示例17: hx_zmq_getintsockopt

value hx_zmq_getintsockopt(value socket_handle_,value option_) {	val_check_kind(socket_handle_, k_zmq_socket_handle);	if (!val_is_int(option_)) {		val_throw(alloc_int(EINVAL));		return alloc_null();	}	int rc = 0;	int err = 0;	uint64_t optval = 0;	size_t optvallen = sizeof(optval);	rc = zmq_getsockopt(val_data(socket_handle_),val_int(option_),&optval, &optvallen);	err = zmq_errno();	if (rc != 0) {		val_throw(alloc_int(err));		return alloc_int(0);	}			return alloc_int(optval);}
开发者ID:boorik,项目名称:hxzmq,代码行数:21,


示例18: lime_system_get_directory

	value lime_system_get_directory (value type, value company, value title) {				const char* companyName = "";		const char* titleName = "";				if (!val_is_null (company)) companyName = val_string (company);		if (!val_is_null (title)) titleName = val_string (title);				const char* directory = System::GetDirectory ((SystemDirectory)val_int (type), companyName, titleName);				if (directory) {						return alloc_string (directory);					} else {						return alloc_null ();					}			}
开发者ID:jarnik,项目名称:lime,代码行数:21,


示例19: inflate_init

/**	inflate_init : window_size:int? -> 'istream	<doc>Open a decompression stream</doc>**/static value inflate_init( value wsize ) {	z_stream *z;	value s;	int err;	int wbits;	if( val_is_null(wsize) )		wbits = MAX_WBITS;	else {		val_check(wsize,int);		wbits = val_int(wsize);	}	z = (z_stream*)malloc(sizeof(z_stream) + sizeof(int));	memset(z,0,sizeof(z_stream));	val_flush(z) = Z_NO_FLUSH;	if( (err = inflateInit2(z,wbits)) != Z_OK ) {		free(z);		zlib_error(NULL,err);	}	s = alloc_abstract(k_stream_inf,z);	//val_gc(s,free_stream_inf);	return s;}
开发者ID:delahee,项目名称:hxlibc,代码行数:26,


示例20: hx_zmq_construct_socket

value hx_zmq_construct_socket (value context_handle,value type){	val_is_kind(context_handle,k_zmq_context_handle);	if (!val_is_int(type)) {		val_throw(alloc_int(EINVAL));		return alloc_null();	}			void *s = zmq_socket (val_data(context_handle),val_int(type));	int err = zmq_errno();		if (s == NULL) {		val_throw (alloc_int(err));		return alloc_null();	}		// See: http://nekovm.org/doc/ffi#abstracts_and_kinds	value v =  alloc_abstract(k_zmq_socket_handle,s);	val_gc(v,finalize_socket);		// finalize_socket is called when the abstract value is garbage collected	return v;	}
开发者ID:boorik,项目名称:hxzmq,代码行数:22,


示例21: udpr_bind

/**        socket_bind : host : int32 -> port:int -> connections:int -> incoming:int32 -> outgoing:int32 -> bool        <doc>Bind a UDPR socket for server usage on the given host and port, with max connections,        incoming bandwidth limited to bytes per second or 0 for unlimited, outgoing also. Host may be        val_type_null, in which case the binding is to ENET_HOST_ANY        </doc>**/static value udpr_bind( value ip, value port, value connections, value incoming, value outgoing ) {	ENetAddress address;	ENetHost *s;	val_check(connections,int);	val_check(incoming,int32);	val_check(outgoing,int32);	if(populate_address(& address, ip, port) != val_true)		neko_error();	s = enet_host_create(	&address,							(size_t)val_int(connections), 		/* number of clients and/or outgoing connections */							(enet_uint32)val_int32(incoming),	/* amount of incoming bandwidth in Bytes/sec */							(enet_uint32)val_int32(outgoing));	if(s == NULL)		neko_error();	value v = alloc_abstract(k_udprhost,s);	val_gc(v, destroy_enethost);#ifdef ENET_DEBUG	fprintf(stderr, "udpr_bind: complete/n");#endif	return v;}
开发者ID:Badcreature,项目名称:caffeine-hx,代码行数:29,


示例22: item_as

static const cst_val *asyl_in(const cst_item *syl){    /* Number of accented syllables since last major break */    const cst_item *ss,*p,*fs;    int c;    ss = item_as(syl,"Syllable");    fs = path_to_item(syl,"R:SylStructure.parent.R:Phrase.parent.daughter.R:SylStructure.daughter");    for (c=0, p=ss; 	 p && (c < CST_CONST_INT_MAX); 	 p=item_prev(p))    {	if (val_int(accented(p)) == 1)	    c++;	if (item_equal(p,fs))	    break;    }        return val_string_n(c);}
开发者ID:iPodLinux-Community,项目名称:Flite,代码行数:22,


示例23: end

void NekoCodeChunk::neko_dump(std::string const & indent) const {	for (const_iterator it = begin();		 it != end();		 ++it)		{			std::cout << indent << it->first << ": ";			print_neko_instruction((OPCODE) it->second.first, it->second.second, parameter_table[it->second.first]);			std::cout << "; // ";			{				int ppc = (int)((int_val *)it->first - m->code);				int idx = m->dbgidxs[ppc>>5].base + bitcount(m->dbgidxs[ppc>>5].bits >> (31 - (ppc & 31)));				value s = val_array_ptr(m->dbgtbl)[idx];				if( val_is_string(s) )					printf("%s",val_string(s));				else if( val_is_array(s) && val_array_size(s) == 2 && val_is_string(val_array_ptr(s)[0]) && val_is_int(val_array_ptr(s)[1]) )					printf("file %s line %d",val_string(val_array_ptr(s)[0]),val_int(val_array_ptr(s)[1]));				else					printf("???");			}			std::cout << std::endl;		}}
开发者ID:hellcoderz,项目名称:neko_llvm_jit,代码行数:23,


示例24: wxPanel

// -----------------------------------------------------------------------------// ObjectEditPanel class constructor// -----------------------------------------------------------------------------ObjectEditPanel::ObjectEditPanel(wxWindow* parent) : wxPanel(parent){	wxIntegerValidator<int>          val_int(nullptr, wxNUM_VAL_DEFAULT);	wxIntegerValidator<unsigned int> val_uint(nullptr, wxNUM_VAL_DEFAULT);	wxFloatingPointValidator<double> val_double(2, nullptr, wxNUM_VAL_DEFAULT);	auto                             tb_size = WxUtils::scaledSize(64, -1);	// Create controls	text_xoff_      = new wxTextCtrl(this, -1, "", wxDefaultPosition, tb_size, 0, val_int);	text_yoff_      = new wxTextCtrl(this, -1, "", wxDefaultPosition, tb_size, 0, val_int);	text_scalex_    = new wxTextCtrl(this, -1, "", wxDefaultPosition, tb_size, 0, val_uint);	text_scaley_    = new wxTextCtrl(this, -1, "", wxDefaultPosition, tb_size, 0, val_uint);	combo_rotation_ = new wxComboBox(this, -1, "", wxDefaultPosition, tb_size);	cb_mirror_x_    = new wxCheckBox(this, -1, "Mirror X");	cb_mirror_y_    = new wxCheckBox(this, -1, "Mirror Y");	btn_preview_    = new SIconButton(this, "eye", "Preview");	btn_cancel_     = new SIconButton(this, "close", "Cancel");	btn_apply_      = new SIconButton(this, "tick", "Apply");	// Init controls	combo_rotation_->Set(WxUtils::arrayString({ "0", "45", "90", "135", "180", "225", "270", "315" }));	combo_rotation_->SetValidator(val_double);	btn_preview_->SetDefault();	// Layout	setupLayout();	// Bind events	btn_preview_->Bind(wxEVT_BUTTON, &ObjectEditPanel::onBtnPreviewClicked, this);	btn_cancel_->Bind(wxEVT_BUTTON, [&](wxCommandEvent&) { KeyBind::pressBind("map_edit_cancel"); });	btn_apply_->Bind(wxEVT_BUTTON, [&](wxCommandEvent&) { KeyBind::pressBind("map_edit_accept"); });	cb_mirror_x_->Bind(wxEVT_CHECKBOX, &ObjectEditPanel::onBtnPreviewClicked, this);	cb_mirror_y_->Bind(wxEVT_CHECKBOX, &ObjectEditPanel::onBtnPreviewClicked, this);	// Init layout	wxWindowBase::Layout();}
开发者ID:SteelTitanium,项目名称:SLADE,代码行数:40,


示例25: readByte

value readByte(value a) {	int fd = val_int(a);	char buffer[2];	//---------------------------------------------	#if defined( TARGET_OSX ) || defined( TARGET_LINUX )		if(read(fd, buffer, 1) < 0){			return alloc_null();		}	#endif	//---------------------------------------------	//---------------------------------------------	#ifdef TARGET_WIN32		DWORD nRead;		if (!ReadFile((HANDLE)fd, buffer, 1, &nRead, 0)){			return alloc_null();		}	#endif	//---------------------------------------------		buffer[1] = '/0';	return alloc_int(buffer[0]);}
开发者ID:AlexHaxe,项目名称:hxSerial,代码行数:24,


示例26: val_int

	void Bytes::Set (value bytes) {				if (val_is_null (bytes)) {						_length = 0;			_data = 0;			_value = 0;					} else {						_value = bytes;			_length = val_int (val_field (bytes, id_length));						if (_length > 0) {								value b = val_field (bytes, id_b);								if (val_is_string (b)) {										_data = (unsigned char*)val_string (b);									} else {										_data = (unsigned char*)buffer_data (val_to_buffer (b));									}							} else {								_data = 0;							}					}			}
开发者ID:blue112,项目名称:lime,代码行数:36,


示例27: inflate_buffer

/**	inflate_buffer : 'istream -> src:string -> srcpos:int -> dst:string -> dstpos:int -> { done => bool, read => int, write => int }**/static value inflate_buffer( value s, value src, value srcpos, value dst, value dstpos ) {	z_stream *z;	int err;	value o;	val_check_kind(s,k_stream_inf);	val_check(srcpos,int);	buffer src_buf = val_to_buffer(src);	if (!src_buf)	   hx_failure("invalid source buffer");	buffer dst_buf = val_to_buffer(dst);	if (!dst_buf)	   hx_failure("invalid destination buffer");	int slen = buffer_size(src_buf);	int dlen = buffer_size(dst_buf);	val_check(dstpos,int);	z = val_stream(s);	if( val_int(srcpos) < 0 || val_int(dstpos) < 0 )		return alloc_null();	slen -= val_int(srcpos);	dlen -= val_int(dstpos);	if( slen < 0 || dlen < 0 )		return alloc_null();	z->next_in = (Bytef*)buffer_data(src_buf) + val_int(srcpos);	z->next_out = (Bytef*)buffer_data(dst_buf) + val_int(dstpos);	z->avail_in = slen;	z->avail_out = dlen;	if( (err = inflate(z,val_flush(z))) < 0 )		zlib_error(z,err);	z->next_in = NULL;	z->next_out = NULL;	o = alloc_empty_object();	alloc_field(o,id_done,alloc_bool(err == Z_STREAM_END));	alloc_field(o,id_read,alloc_int((int)(slen - z->avail_in)));	alloc_field(o,id_write,alloc_int((int)(dlen - z->avail_out)));	return o;}
开发者ID:delahee,项目名称:hxlibc,代码行数:43,


示例28: _SSL_set_mode

value _SSL_set_mode(value ssl, value op) {	long response = SSL_set_mode((SSL*) val_data(ssl), val_int(op));	return alloc_best_int(response);}
开发者ID:judu,项目名称:hxssl,代码行数:4,


示例29: _SSL_write

//int 	SSL_write(SSL *ssl,const void *buf,int num);value _SSL_write(value ssl, const value buf, value num) {	return alloc_int(SSL_write((SSL*) val_data(ssl), val_data(buf),			val_int(num)));}
开发者ID:judu,项目名称:hxssl,代码行数:5,


示例30: _SSL_read

//int 	SSL_read(SSL *ssl,void *buf,int num);value _SSL_read(value ssl, value buf, value num) {	return alloc_int(			SSL_read((SSL*) val_data(ssl), val_data(buf), val_int(num)));}
开发者ID:judu,项目名称:hxssl,代码行数:5,



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


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