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

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

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

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

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

示例1: value

/**	socket_set_timeout : 'socket -> timout:number? -> void	<doc>Set the socket send and recv timeout in seconds to the given value (or null for blocking)</doc>**/static value socket_set_timeout( value o, value t ) {	SOCKET sock = val_sock(o);#ifdef NEKO_WINDOWS	int time;	if( val_is_null(t) )		time = 0;	else {		val_check(t,number);		time = (int)(val_number(t) * 1000);	}#else	struct timeval time;	if( val_is_null(t) ) {		time.tv_usec = 0;		time.tv_sec = 0;	} else {		val_check(t,number);		init_timeval(val_number(t),&time);	}#endif   gc_enter_blocking();	if( setsockopt(sock,SOL_SOCKET,SO_SNDTIMEO,(char*)&time,sizeof(time)) != 0 )   {      gc_exit_blocking();		return alloc_null();   }	if( setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(char*)&time,sizeof(time)) != 0 )   {      gc_exit_blocking();		return alloc_null();   }   gc_exit_blocking();	return alloc_bool(true);}
开发者ID:KTXSoftware,项目名称:Kha-haxelib,代码行数:38,


示例2: tls_set

/**	tls_set : 'tls -> any -> void	<doc>	Set the value of the TLS for the local thread.	</doc>**/static value tls_set( value v, value content ) {	vtls *t;	value *r;	val_check_kind(v,k_tls);	t = val_tls(v);#	ifdef NEKO_WINDOWS	r = (value*)TlsGetValue(t->tls);#	else	r = (value*)pthread_getspecific(t->key);#	endif	if( r == NULL ) {		if( val_is_null(content) )			return val_null;		r = alloc_root(1);#		ifdef NEKO_WINDOWS		TlsSetValue(t->tls,r);#		else		pthread_setspecific(t->key,r);#		endif	} else if( val_is_null(content) ) {		free_root(r);#		ifdef NEKO_WINDOWS		TlsSetValue(t->tls,NULL);#		else		pthread_setspecific(t->key,NULL);#		endif		return val_null;	}	*r = content;	return val_null;}
开发者ID:ConstNW,项目名称:neko,代码行数:37,


示例3: key_from_pem

static value key_from_pem(value data, value pub, value pass){	mbedtls_pk_context *pk;	int r, len;	value v;	unsigned char *buf;	val_check(data, string);	val_check(pub, bool);	if (!val_is_null(pass)) val_check(pass, string);	len = val_strlen(data)+1;	buf = (unsigned char *)alloc(len);	memcpy(buf, val_string(data), len-1);	buf[len-1] = '/0';	pk = (mbedtls_pk_context *)alloc(sizeof(mbedtls_pk_context));	mbedtls_pk_init(pk);	if( val_bool(pub) )		r = mbedtls_pk_parse_public_key( pk, buf, len );	else if( val_is_null(pass) )		r = mbedtls_pk_parse_key( pk, buf, len, NULL, 0 );	else		r = mbedtls_pk_parse_key( pk, buf, len, (const unsigned char*)val_string(pass), val_strlen(pass) );	if( r != 0 ){		mbedtls_pk_free(pk);		return ssl_error(r);	}	v = alloc_abstract(k_pkey,pk);	val_gc(v,free_pkey);	return v;}
开发者ID:jonasmalacofilho,项目名称:neko,代码行数:28,


示例4: value

/**	socket_set_timeout : 'socket -> timout:number? -> void	<doc>Set the socket send and recv timeout in seconds to the given value (or null for blocking)</doc>**/static value socket_set_timeout( value o, value t ) {#ifdef NEKO_WINDOWS	int time;	val_check_kind(o,k_socket);	if( val_is_null(t) )		time = 0;	else {		val_check(t,number);		time = (int)(val_number(t) * 1000);	}#else	struct timeval time;	val_check_kind(o,k_socket);	if( val_is_null(t) ) {		time.tv_usec = 0;		time.tv_sec = 0;	} else {		val_check(t,number);		init_timeval(val_number(t),&time);	}#endif	if( setsockopt(val_sock(o),SOL_SOCKET,SO_SNDTIMEO,(char*)&time,sizeof(time)) != 0 )		neko_error();	if( setsockopt(val_sock(o),SOL_SOCKET,SO_RCVTIMEO,(char*)&time,sizeof(time)) != 0 )		neko_error();	return val_true;}
开发者ID:motion-twin,项目名称:neko,代码行数:31,


示例5: conf_set_verify

static value conf_set_verify( value config, value b ) {	val_check_kind(config, k_ssl_conf);	if( !val_is_null(b) ) val_check(b, bool);	if( val_is_null(b) )		mbedtls_ssl_conf_authmode(val_conf(config), MBEDTLS_SSL_VERIFY_OPTIONAL);	else if( val_bool(b) )		mbedtls_ssl_conf_authmode(val_conf(config), MBEDTLS_SSL_VERIFY_REQUIRED);	else		mbedtls_ssl_conf_authmode(val_conf(config), MBEDTLS_SSL_VERIFY_NONE);	return val_true;}
开发者ID:jonasmalacofilho,项目名称:neko,代码行数:11,


示例6: socket_select

/**	socket_select : read : 'socket array -> write : 'socket array -> others : 'socket array -> timeout:number? -> 'socket array array	<doc>Perform the [select] operation. Timeout is in seconds or [null] if infinite</doc>**/static value socket_select( value rs, value ws, value es, value timeout ) {	struct timeval tval;	struct timeval *tt;	SOCKET n = 0;	fd_set rx, wx, ex;	fd_set *ra, *wa, *ea;	value r;	POSIX_LABEL(select_again);	ra = make_socket_array(rs,val_array_size(rs),&rx,&n);	wa = make_socket_array(ws,val_array_size(ws),&wx,&n);	ea = make_socket_array(es,val_array_size(es),&ex,&n);	if( ra == &INVALID || wa == &INVALID || ea == &INVALID )		neko_error();	if( val_is_null(timeout) )		tt = NULL;	else {		val_check(timeout,number);		tt = &tval;		init_timeval(val_number(timeout),tt);	}	if( select((int)(n+1),ra,wa,ea,tt) == SOCKET_ERROR ) {		HANDLE_EINTR(select_again);		neko_error();	}	r = alloc_array(3);	val_array_ptr(r)[0] = make_array_result(rs,ra);	val_array_ptr(r)[1] = make_array_result(ws,wa);	val_array_ptr(r)[2] = make_array_result(es,ea);	return r;}
开发者ID:motion-twin,项目名称:neko,代码行数:34,


示例7: report

static void report( neko_vm *vm, value exc, int isexc ) {	int i;	buffer b = alloc_buffer(NULL);	value st = neko_exc_stack(vm);	for(i=0;i<val_array_size(st);i++) {		value s = val_array_ptr(st)[i];		buffer_append(b,"Called from ");		if( val_is_null(s) )			buffer_append(b,"a C function");		else if( val_is_string(s) ) {			buffer_append(b,val_string(s));			buffer_append(b," (no debug available)");		} 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]) ) {			val_buffer(b,val_array_ptr(s)[0]);			buffer_append(b," line ");			val_buffer(b,val_array_ptr(s)[1]);		} else			val_buffer(b,s);		buffer_append_char(b,'/n');	}	if( isexc )		buffer_append(b,"Uncaught exception - ");	val_buffer(b,exc);#	ifdef NEKO_STANDALONE	neko_standalone_error(val_string(buffer_to_string(b)));#	else	fprintf(stderr,"%s/n",val_string(buffer_to_string(b)));#	endif}
开发者ID:robinp,项目名称:neko,代码行数:29,


示例8: val_id

AudioBuffer::AudioBuffer (value audioBuffer) {    if (!init) {        id_bitsPerSample = val_id ("bitsPerSample");        id_channels = val_id ("channels");        id_data = val_id ("data");        id_sampleRate = val_id ("sampleRate");        init = true;    }    if (!val_is_null (audioBuffer)) {        bitsPerSample = val_int (val_field (audioBuffer, id_bitsPerSample));        channels = val_int (val_field (audioBuffer, id_channels));        data = new ArrayBufferView (val_field (audioBuffer, id_data));        sampleRate = val_int (val_field (audioBuffer, id_sampleRate));    } else {        bitsPerSample = 0;        channels = 0;        data = new ArrayBufferView ();        sampleRate = 0;    }    mValue = audioBuffer;}
开发者ID:andresa88,项目名称:lime,代码行数:31,


示例9: hx_Logger_static_set_Int_Func

// DECL: static void set(Level level, void (*logFunction) (Level, const char*));void hx_Logger_static_set_Int_Func(value level, value _logFunction){    Logger::Level _level;    ValueToEnum(level, _level);    // Obtain a pointer to the callback wrapper.    //    void (*func) (Logger::Level, const char*) = NULL;    if (!val_is_null(_logFunction))        func = logFunction;    // Clear or set the GC root for the Haxe callback.    //    if (func == NULL && clbkLogFunction != NULL)    {        SAFE_DELETE(clbkLogFunction);        clbkLogFunction = NULL;    }    if (func != NULL)    {        if (clbkLogFunction == NULL)            clbkLogFunction = new AutoGCRoot(_logFunction);        else            clbkLogFunction->set(_logFunction);    }    Logger::set(_level, func);}
开发者ID:Amadren,项目名称:hx-gameplay,代码行数:31,


示例10: lime_image_data_util_copy_pixels

	value lime_image_data_util_copy_pixels (value *arg, int nargs) {				enum { image, sourceImage, sourceRect, destPoint, alphaImage, alphaPoint, mergeAlpha };				Image _image = Image (arg[image]);		Image _sourceImage = Image (arg[sourceImage]);		Rectangle _sourceRect = Rectangle (arg[sourceRect]);		Vector2 _destPoint = Vector2 (arg[destPoint]);				if (val_is_null (arg[alphaImage])) {						ImageDataUtil::CopyPixels (&_image, &_sourceImage, &_sourceRect, &_destPoint, 0, 0, val_bool (arg[mergeAlpha]));					} else {						Image _alphaImage = Image (arg[alphaImage]);			Vector2 _alphaPoint = Vector2 (arg[alphaPoint]);						ImageDataUtil::CopyPixels (&_image, &_sourceImage, &_sourceRect, &_destPoint, &_alphaImage, &_alphaPoint, val_bool (arg[mergeAlpha]));					}				return alloc_null ();			}
开发者ID:jarnik,项目名称:lime,代码行数:25,


示例11: inflate_end

/**	inflate_end : 'istream -> void	<doc>Close a decompression stream</doc>**/static value inflate_end( value s ) {	if (val_is_null(s))		return alloc_null();	val_check_kind(s,k_stream_inf);	free_stream_inf(s);	return alloc_null();}
开发者ID:delahee,项目名称:hxlibc,代码行数:11,


示例12: snow_assets_audio_read_bytes_pcm

    value snow_assets_audio_read_bytes_pcm( value _info, value _start, value _len ) {        QuickVec<unsigned char> buffer;        value _handle = property_value(_info, id_handle);        snow::assets::audio::PCM_file_source* pcm_source = snow::from_hx<snow::assets::audio::PCM_file_source>(_handle);        if( !val_is_null(_handle) && pcm_source ) {            bool complete = snow::assets::audio::read_bytes_pcm( pcm_source, buffer, val_int(_start), val_int(_len) );            ByteArray data(buffer);            value _object = alloc_empty_object();                alloc_field( _object, id_bytes, data.mValue );                alloc_field( _object, id_complete, alloc_bool(complete) );            return _object;        } else {            return alloc_null();        }    } DEFINE_PRIM(snow_assets_audio_read_bytes_pcm, 3);
开发者ID:RealyUniqueName,项目名称:snow,代码行数:28,


示例13: snow_iosrc_file_write

        value snow_iosrc_file_write(value _handle, value _data, value _size, value _num) {            snow::io::iosrc_file* iosrc = snow::from_hx<snow::io::iosrc_file>( _handle );            if( iosrc ) {                if(!val_is_null(_data)) {                    ByteArray data(_data);                    long size = val_int(_size);                    long num = val_int(_num);                    long len = size * num;                    if(data.Size() != len) {                        data.Resize(len);                    }                    int res = snow::io::write(iosrc->file_source, data.Bytes(), size, num);                    return alloc_int(res);                } //data != null            } //object from hx            return alloc_int(-1);        } DEFINE_PRIM(snow_iosrc_file_write, 4);
开发者ID:RealyUniqueName,项目名称:snow,代码行数:29,


示例14: enable_jit

/**	enable_jit : ?bool -> ?bool	<doc>Enable or disable the JIT. Calling enable_jit(null) tells if JIT is enabled or not</doc>**/static value enable_jit( value b ) {	if( val_is_null(b) )		return alloc_bool(neko_vm_jit(neko_vm_current(),-1));	val_check(b,bool);	neko_vm_jit(neko_vm_current(),val_bool(b));	return val_null;}
开发者ID:MattTuttle,项目名称:neko,代码行数:11,


示例15: AbstractToJObject

	bool AbstractToJObject (value inValue, jobject &outObject) {				JNIObject *jniobj = 0;				if (AbstractToObject (inValue, jniobj)) {						outObject = jniobj->GetJObject ();			return true;					}				static int id__jobject = -1;				if (id__jobject < 0) {						id__jobject = val_id ("__jobject");					}				value jobj = val_field (inValue, id__jobject);				if (val_is_null (jobj)) {						return false;					}				return AbstractToJObject (jobj, outObject);			}
开发者ID:restorer,项目名称:lime,代码行数:30,


示例16: snow_iosrc_file_write

        value snow_iosrc_file_write(value _handle, value _data, value _size, value _num) {            snow::io::iosrc_file* iosrc = snow::from_hx<snow::io::iosrc_file>( _handle );            if( iosrc ) {                if(!val_is_null(_data)) {                    const unsigned char* data = snow::bytes_from_hx(_data);                    long size = val_int(_size);                    long num = val_int(_num);                    long len = size * num;                    int res = snow::io::write(iosrc->file_source, data, size, num);                    return alloc_int(res);                } //data != null            } //object from hx            return alloc_int(-1);        } DEFINE_PRIM(snow_iosrc_file_write, 4);
开发者ID:kevinresol,项目名称:snow,代码行数:25,


示例17: snow_assets_audio_read_bytes_wav

    value snow_assets_audio_read_bytes_wav( value _info, value _start, value _len ) {        QuickVec<unsigned char> buffer;        value _handle = property_value(_info, id_handle);        snow::assets::audio::WAV_file_source* wav_source = snow::from_hx<snow::assets::audio::WAV_file_source>(_handle);        if( !val_is_null(_handle) && wav_source ) {            bool complete = snow::assets::audio::read_bytes_wav( wav_source, buffer, val_int(_start), val_int(_len) );            value data = snow::bytes_to_hx( &buffer[0], buffer.size() );            value _object = alloc_empty_object();                alloc_field( _object, id_bytes, data );                alloc_field( _object, id_complete, alloc_bool(complete) );            return _object;        } else {            return alloc_null();        }    } DEFINE_PRIM(snow_assets_audio_read_bytes_wav, 3);
开发者ID:kevinresol,项目名称:snow,代码行数:28,


示例18: lime_alc_create_context

	value lime_alc_create_context (value device, value attrlist) {				ALCdevice* alcDevice = (ALCdevice*)val_data (device);				ALCint* list = NULL;				if (val_is_null (attrlist) == false) {						int size = val_array_size (attrlist);			list = new ALCint[size];						for (int i = 0; i < size; ++i) {				list[i] = (ALCint)val_int( val_array_i (attrlist, i) );			}					}				ALCcontext* alcContext = alcCreateContext (alcDevice, list);				if (list != NULL) {			delete[] list;		}				return CFFIPointer (alcContext);			}
开发者ID:Leander1P,项目名称:lime,代码行数:26,


示例19: alloc_object

EXTERN value alloc_object( value cpy ) {	vobject *v;	if( cpy != NULL && !val_is_null(cpy) && !val_is_object(cpy) )		val_throw(alloc_string("$new")); // 'new' opcode simulate $new	v = (vobject*)gc_alloc(sizeof(vobject));	v->t = VAL_OBJECT;	if( cpy == NULL || val_is_null(cpy) ) {		v->proto = NULL;		otable_init(&v->table);	} else {		v->proto = ((vobject*)cpy)->proto;		otable_copy(&((vobject*)cpy)->table,&v->table);	}	return (value)v;}
开发者ID:MattTuttle,项目名称:neko,代码行数:16,


示例20: connect_mysql

/**	connect : { host => string, port => int, user => string, pass => string, socket => string? } -> 'connection	<doc>Connect to a database using the connection informations</doc>**/static value connect_mysql( value params  ) {	value host, port, user, pass, socket;	val_check(params,object);	host = val_field(params,val_id("host"));	port = val_field(params,val_id("port"));	user = val_field(params,val_id("user"));	pass = val_field(params,val_id("pass"));	socket = val_field(params,val_id("socket"));	val_check(host,string);	val_check(port,int);	val_check(user,string);	val_check(pass,string);	if( !val_is_string(socket) && !val_is_null(socket) )		neko_error();	{		connection *c = (connection*)alloc(sizeof(connection));				value v;		c->m = mysql_init(NULL);		c->conv_string = NULL;		c->conv_date = NULL;		c->conv_bytes = NULL;		if( mysql_real_connect(c->m,val_string(host),val_string(user),val_string(pass),NULL,val_int(port),val_is_null(socket)?NULL:val_string(socket),0) == NULL ) {			buffer b = alloc_buffer("Failed to connect to mysql server : ");			buffer_append(b,mysql_error(c->m));			mysql_close(c->m);			bfailure(b);		}		v = alloc_abstract(k_connection,c);		val_gc(v,free_connection);		return v;	}}
开发者ID:bsmr-haxe,项目名称:neko,代码行数:36,


示例21: dump_module

static void dump_module( value v, field f, void *p ) {	value vname;	const char *name;	if( !val_is_kind(v,neko_kind_module) )		return;	vname = val_field_name(f);	name = val_is_null(vname)?"???":val_string(vname);	((dump_param*)p)->callb( name, (neko_module*)val_data(v), &((dump_param*)p)->tot );}
开发者ID:angavrilov,项目名称:iphone-neko,代码行数:9,


示例22: cgi_set_main

/**	cgi_set_main : function:0? -> void	<doc>Set or disable the main entry point function</doc>**/static value cgi_set_main( value f ) {	if( val_is_null(f) ) {		CONTEXT()->main = NULL;		return val_true;	}	val_check_function(f,0);	CONTEXT()->main = f;	return val_true;}
开发者ID:HaxeFoundation,项目名称:neko,代码行数:13,


示例23: socket_set_keepalive

/**	socket_set_keepalive : 'socket -> bool -> time:int? -> interval:int? -> void	<doc>	Enable or disable TCP_KEEPALIVE flag for the socket	</doc>**/static value socket_set_keepalive( value o, value b, value time, value interval ) {	int val;	SOCKET s;	val_check_kind(o,k_socket);	val_check(b,bool);	if( !val_is_null(time) || !val_is_null(interval) ){		val_check(time,int);		val_check(interval,int);	}	s = val_sock(o);	if( !val_bool(b) ) {		val = 0;		if( setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *)&val, sizeof(val)) != 0 )			neko_error();	} else {		val = 1;		if( setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *)&val, sizeof(val)) != 0 )			neko_error();		if( !val_is_null(time) && !val_is_null(interval) ) {#			if defined(NEKO_WINDOWS)			u_long params[3] = { 1, (unsigned long)val_int(time)*1000, (unsigned long)val_int(interval)*1000 };			if( WSAIoctl(s, SIO_KEEPALIVE_VALS, &params, sizeof(params), NULL, 0, &val, NULL, NULL) != 0 )				neko_error();#			else#			if defined(TCP_KEEPIDLE)			val = val_int(time);			if( setsockopt(s, IPPROTO_TCP, TCP_KEEPIDLE, (void *)&val, sizeof(val)) != 0 )				neko_error();#			elif defined(TCP_KEEPALIVE)			val = val_int(time);			if( setsockopt(s, IPPROTO_TCP, TCP_KEEPALIVE, (void *)&val, sizeof(val)) != 0 )				neko_error();#			endif#			if defined(TCP_KEEPINTVL)			val = val_int(interval);			if( setsockopt(s, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&val, sizeof(val)) != 0 )				neko_error();#			endif#			endif		}	}	return val_null;}
开发者ID:motion-twin,项目名称:neko,代码行数:50,


示例24: gc_cairo_surface

	void gc_cairo_surface (value handle) {				if (!val_is_null (handle)) {						cairo_surface_t* surface = (cairo_surface_t*)val_data (handle);			cairo_surface_destroy (surface);					}			}
开发者ID:Gemioli,项目名称:lime,代码行数:10,


示例25: gc_cairo_pattern

	void gc_cairo_pattern (value handle) {				if (!val_is_null (handle)) {						cairo_pattern_t* pattern = (cairo_pattern_t*)val_data (handle);			cairo_pattern_destroy (pattern);					}			}
开发者ID:Gemioli,项目名称:lime,代码行数:10,


示例26: gc_cairo_font_options

	void gc_cairo_font_options (value handle) {				if (!val_is_null (handle)) {						cairo_font_options_t* options = (cairo_font_options_t*)val_data (handle);			cairo_font_options_destroy (options);					}			}
开发者ID:Gemioli,项目名称:lime,代码行数:10,


示例27: gc_cairo_font_face

	void gc_cairo_font_face (value handle) {				if (!val_is_null (handle)) {						cairo_font_face_t* face = (cairo_font_face_t*)val_data (handle);			cairo_font_face_destroy (face);					}			}
开发者ID:Gemioli,项目名称:lime,代码行数:10,


示例28: gc_cairo

	void gc_cairo (value handle) {				if (!val_is_null (handle)) {						cairo_t* cairo = (cairo_t*)val_data (handle);			cairo_destroy (cairo);					}			}
开发者ID:Gemioli,项目名称:lime,代码行数:10,


示例29: sni_callback

static int sni_callback( void *arg, mbedtls_ssl_context *ctx, const unsigned char *name, size_t len ){	if( name && arg ){	 	value ret = val_call1((value)arg, alloc_string((const char*)name)) ;		if( !val_is_null(ret) ){			// TODO authmode and ca			return mbedtls_ssl_set_hs_own_cert( ctx, val_cert(val_field(ret, val_id("cert"))), val_pkey(val_field(ret, val_id("key"))) );		}	}	return -1;}
开发者ID:jonasmalacofilho,项目名称:neko,代码行数:10,



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


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