Esempio n. 1
0
/**
	process_close : 'process -> void
	<doc>
	Close the process I/O.
	</doc>
**/
static value process_close( value vp ) {	
	val_check_kind(vp,k_process);
	free_process(vp);
	val_kind(vp) = NULL;
	val_gc(vp,NULL);
	return val_null;
}
Esempio n. 2
0
/**
	close : 'db -> void
	<doc>Closes the database.</doc>
**/
static value close( value v ) {
	val_check_kind(v,k_db);
	free_db(v);
	val_gc(v,NULL);
	val_kind(v) = NULL;
	return val_null;
}
Esempio n. 3
0
void * api_val_to_kind(value  arg1,vkind arg2)
{
	vkind k = (vkind)val_kind(arg1);
	if (k!=arg2)
		return 0;
	return val_data(arg1);
}
Esempio n. 4
0
static value ssl_close( value ssl ) {
	mbedtls_ssl_context *s;
	val_check_kind(ssl,k_ssl);
	s = val_ssl(ssl);
	mbedtls_ssl_free( s );
	val_kind(ssl) = NULL;
	return val_true;
}
Esempio n. 5
0
static value conf_close( value config ) {
	mbedtls_ssl_config *conf;
	val_check_kind(config,k_ssl_conf);
	conf = val_conf(config);
	mbedtls_ssl_config_free(conf);
	val_kind(config) = NULL;
	return val_true;
}
Esempio n. 6
0
/**
	close : 'connection -> void
	<doc>Close the connection. Any subsequent operation will fail on it</doc>
**/
static value close( value o ) {
	val_check_kind(o,k_connection);
	mysql_close(CNX(o)->m);
	val_data(o) = NULL;
	val_kind(o) = NULL;
	val_gc(o,NULL);
	return val_true;
}
Esempio n. 7
0
/**
	file_close : 'file -> void
	<doc>Close an file. Any other operations on this file will fail</doc> 
**/
static value file_close( value o ) {	
	fio *f;
	val_check_kind(o,k_file);
	f = val_file(o);
	fclose(f->io);
	val_kind(o) = NULL;
	return val_null;
}
Esempio n. 8
0
/**
	socket_close : 'socket -> void
	<doc>Close a socket. Any subsequent operation on this socket will fail</doc>
**/
static value socket_close( value o ) {
	val_check_kind(o,k_socket);
	POSIX_LABEL(close_again);
	if( closesocket(val_sock(o)) ) {
		HANDLE_EINTR(close_again);
	}
	val_kind(o) = NULL;
	return val_true;
}
Esempio n. 9
0
/**
        file_close : 'file -> void
        <doc>Close an file. Any other operations on this file will fail</doc>
**/
static value tmpfile_close( value o ) {
        fio *f;
	vkind k_file = kind_import("file");
        val_check_kind(o,k_file);
        f = val_file(o);
        fclose(f->io);

	// no longer needs garbage collection
	val_gc(o,NULL);
        val_kind(o) = NULL;
	return val_true;
}
Esempio n. 10
0
/**
	Free an allocated ENetEvent struct from neko
**/
static value free_enetevent( value e ) {
	val_check_kind(e,k_udprevent);

	ENetEvent *event = (ENetEvent *)val_data(e);
	if(e == NULL)
		neko_error();

	// enet_packet_destroy frees the packet itself.
#ifdef ENET_DEBUG
printf("*** free_enetevent freeing packet\n");
#endif
	if(event->packet != NULL)
		enet_packet_destroy (event->packet);
#ifdef ENET_DEBUG
//printf("*** free_enetevent freeing event\n");
#endif
	enet_free(event);
	val_gc(e,NULL);
	val_kind(e) = NULL;
#ifdef ENET_DEBUG
//printf("*** free_enetevent done.\n");
#endif
	return val_true;
}
Esempio n. 11
0
/**
	$iskind : any -> 'kind -> bool
	<doc>Tells if a value is of the given kind</doc>
**/
static value builtin_iskind( value v, value k ) {
	val_check_kind(k,neko_k_kind);
	return val_is_abstract(v) ? alloc_bool(val_kind(v) == (vkind)val_data(k)) : (val_data(k) == k_old_int32 ? alloc_bool(val_is_int32(v)) : val_false);
}
Esempio n. 12
0
/**
	$getkind : 'abstract -> 'kind
	<doc>Returns the kind value of the abstract</doc>
**/
static value builtin_getkind( value v ) {
	if( val_is_int32(v) )
		return alloc_abstract(neko_k_kind,k_old_int32);
	val_check(v,abstract);
	return alloc_abstract(neko_k_kind,val_kind(v));
}
Esempio n. 13
0
vkind api_val_kind(value  arg1)
{
	return (vkind)val_kind(arg1);
}
Esempio n. 14
0
static value os_winlog_destroy( value wnd ) {
	val_check_kind(wnd,k_winlog);
	sys_winlog_destroy(val_window(wnd)->p);
	val_kind(wnd) = NULL;
	return val_null;
}