Created
September 28, 2014 02:18
-
-
Save tsloughter/e591f1cf07903aa440cd to your computer and use it in GitHub Desktop.
Erlang Nif Rust Bindings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* automatically generated by rust-bindgen */ | |
pub type ErlNifUInt64 = ::libc::c_ulong; | |
pub type ErlNifSInt64 = ::libc::c_long; | |
pub type ERL_NIF_TERM = ::libc::c_ulong; | |
pub type ERL_NIF_UINT = ERL_NIF_TERM; | |
pub enum Struct_enif_environment_t { } | |
pub type ErlNifEnv = Struct_enif_environment_t; | |
#[repr(C)] | |
pub struct ErlNifFunc { | |
pub name: *const ::libc::c_char, | |
pub arity: ::libc::c_uint, | |
pub fptr: ::std::option::Option<extern "C" fn | |
(arg1: *mut ErlNifEnv, | |
arg2: ::libc::c_int, | |
arg3: *const ERL_NIF_TERM) | |
-> ERL_NIF_TERM>, | |
} | |
#[repr(C)] | |
pub struct Struct_enif_entry_t { | |
pub major: ::libc::c_int, | |
pub minor: ::libc::c_int, | |
pub name: *const ::libc::c_char, | |
pub num_of_funcs: ::libc::c_int, | |
pub funcs: *mut ErlNifFunc, | |
pub load: ::std::option::Option<extern "C" fn | |
(arg1: *mut ErlNifEnv, | |
arg2: *mut *mut ::libc::c_void, | |
arg3: ERL_NIF_TERM) | |
-> ::libc::c_int>, | |
pub reload: ::std::option::Option<extern "C" fn | |
(arg1: *mut ErlNifEnv, | |
arg2: *mut *mut ::libc::c_void, | |
arg3: ERL_NIF_TERM) | |
-> ::libc::c_int>, | |
pub upgrade: ::std::option::Option<extern "C" fn | |
(arg1: *mut ErlNifEnv, | |
arg2: *mut *mut ::libc::c_void, | |
arg3: *mut *mut ::libc::c_void, | |
arg4: ERL_NIF_TERM) | |
-> ::libc::c_int>, | |
pub unload: ::std::option::Option<extern "C" fn | |
(arg1: *mut ErlNifEnv, | |
arg2: *mut ::libc::c_void)>, | |
pub vm_variant: *const ::libc::c_char, | |
} | |
pub type ErlNifEntry = Struct_enif_entry_t; | |
#[repr(C)] | |
pub struct ErlNifBinary { | |
pub size: size_t, | |
pub data: *mut ::libc::c_uchar, | |
pub bin_term: ERL_NIF_TERM, | |
pub ref_bin: *mut ::libc::c_void, | |
} | |
pub enum Struct_enif_resource_type_t { } | |
pub type ErlNifResourceType = Struct_enif_resource_type_t; | |
pub type ErlNifResourceDtor = ::libc::c_void; | |
pub type ErlNifResourceFlags = ::libc::c_uint; | |
pub static ERL_NIF_RT_CREATE: ::libc::c_uint = 1; | |
pub static ERL_NIF_RT_TAKEOVER: ::libc::c_uint = 2; | |
pub type ErlNifCharEncoding = ::libc::c_uint; | |
pub static ERL_NIF_LATIN1: ::libc::c_uint = 1; | |
#[repr(C)] | |
pub struct ErlNifPid { | |
pub pid: ERL_NIF_TERM, | |
} | |
pub type ErlNifSysInfo = ErlDrvSysInfo; | |
pub enum Struct_ErlDrvTid_ { } | |
pub type ErlNifTid = *mut Struct_ErlDrvTid_; | |
pub enum Struct_ErlDrvMutex_ { } | |
pub type ErlNifMutex = Struct_ErlDrvMutex_; | |
pub enum Struct_ErlDrvCond_ { } | |
pub type ErlNifCond = Struct_ErlDrvCond_; | |
pub enum Struct_ErlDrvRWLock_ { } | |
pub type ErlNifRWLock = Struct_ErlDrvRWLock_; | |
pub type ErlNifTSDKey = ::libc::c_int; | |
pub type ErlNifThreadOpts = ErlDrvThreadOpts; | |
#[repr(C)] | |
pub struct ErlNifMapIterator { | |
pub map: ERL_NIF_TERM, | |
pub t_limit: ERL_NIF_UINT, | |
pub idx: ERL_NIF_UINT, | |
pub ks: *mut ERL_NIF_TERM, | |
pub vs: *mut ERL_NIF_TERM, | |
pub __spare__: [*mut ::libc::c_void, ..2u], | |
} | |
pub type ErlNifMapIteratorEntry = ::libc::c_uint; | |
pub static ERL_NIF_MAP_ITERATOR_HEAD: ::libc::c_uint = 1; | |
pub static ERL_NIF_MAP_ITERATOR_TAIL: ::libc::c_uint = 2; | |
#[link(name = "erl_nif")] | |
extern "C" { | |
pub fn enif_priv_data(arg1: *mut ErlNifEnv) -> *mut ::libc::c_void; | |
pub fn enif_alloc(size: size_t) -> *mut ::libc::c_void; | |
pub fn enif_free(ptr: *mut ::libc::c_void); | |
pub fn enif_is_atom(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_is_binary(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_is_ref(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_inspect_binary(arg1: *mut ErlNifEnv, bin_term: ERL_NIF_TERM, | |
bin: *mut ErlNifBinary) -> ::libc::c_int; | |
pub fn enif_alloc_binary(size: size_t, bin: *mut ErlNifBinary) -> | |
::libc::c_int; | |
pub fn enif_realloc_binary(bin: *mut ErlNifBinary, size: size_t) -> | |
::libc::c_int; | |
pub fn enif_release_binary(bin: *mut ErlNifBinary); | |
pub fn enif_get_int(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM, | |
ip: *mut ::libc::c_int) -> ::libc::c_int; | |
pub fn enif_get_ulong(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM, | |
ip: *mut ::libc::c_ulong) -> ::libc::c_int; | |
pub fn enif_get_double(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM, | |
dp: *mut ::libc::c_double) -> ::libc::c_int; | |
pub fn enif_get_list_cell(env: *mut ErlNifEnv, term: ERL_NIF_TERM, | |
head: *mut ERL_NIF_TERM, | |
tail: *mut ERL_NIF_TERM) -> ::libc::c_int; | |
pub fn enif_get_tuple(env: *mut ErlNifEnv, tpl: ERL_NIF_TERM, | |
arity: *mut ::libc::c_int, | |
array: *mut *const ERL_NIF_TERM) -> ::libc::c_int; | |
pub fn enif_is_identical(lhs: ERL_NIF_TERM, rhs: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_compare(lhs: ERL_NIF_TERM, rhs: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_make_binary(env: *mut ErlNifEnv, bin: *mut ErlNifBinary) -> | |
ERL_NIF_TERM; | |
pub fn enif_make_badarg(env: *mut ErlNifEnv) -> ERL_NIF_TERM; | |
pub fn enif_make_int(env: *mut ErlNifEnv, i: ::libc::c_int) -> | |
ERL_NIF_TERM; | |
pub fn enif_make_ulong(env: *mut ErlNifEnv, i: ::libc::c_ulong) -> | |
ERL_NIF_TERM; | |
pub fn enif_make_double(env: *mut ErlNifEnv, d: ::libc::c_double) -> | |
ERL_NIF_TERM; | |
pub fn enif_make_atom(env: *mut ErlNifEnv, name: *const ::libc::c_char) -> | |
ERL_NIF_TERM; | |
pub fn enif_make_existing_atom(env: *mut ErlNifEnv, | |
name: *const ::libc::c_char, | |
atom: *mut ERL_NIF_TERM, | |
arg1: ErlNifCharEncoding) -> ::libc::c_int; | |
pub fn enif_make_tuple(env: *mut ErlNifEnv, cnt: ::libc::c_uint, ...) -> | |
ERL_NIF_TERM; | |
pub fn enif_make_list(env: *mut ErlNifEnv, cnt: ::libc::c_uint, ...) -> | |
ERL_NIF_TERM; | |
pub fn enif_make_list_cell(env: *mut ErlNifEnv, car: ERL_NIF_TERM, | |
cdr: ERL_NIF_TERM) -> ERL_NIF_TERM; | |
pub fn enif_make_string(env: *mut ErlNifEnv, | |
string: *const ::libc::c_char, | |
arg1: ErlNifCharEncoding) -> ERL_NIF_TERM; | |
pub fn enif_make_ref(env: *mut ErlNifEnv) -> ERL_NIF_TERM; | |
pub fn enif_mutex_create(name: *mut ::libc::c_char) -> *mut ErlNifMutex; | |
pub fn enif_mutex_destroy(mtx: *mut ErlNifMutex); | |
pub fn enif_mutex_trylock(mtx: *mut ErlNifMutex) -> ::libc::c_int; | |
pub fn enif_mutex_lock(mtx: *mut ErlNifMutex); | |
pub fn enif_mutex_unlock(mtx: *mut ErlNifMutex); | |
pub fn enif_cond_create(name: *mut ::libc::c_char) -> *mut ErlNifCond; | |
pub fn enif_cond_destroy(cnd: *mut ErlNifCond); | |
pub fn enif_cond_signal(cnd: *mut ErlNifCond); | |
pub fn enif_cond_broadcast(cnd: *mut ErlNifCond); | |
pub fn enif_cond_wait(cnd: *mut ErlNifCond, mtx: *mut ErlNifMutex); | |
pub fn enif_rwlock_create(name: *mut ::libc::c_char) -> *mut ErlNifRWLock; | |
pub fn enif_rwlock_destroy(rwlck: *mut ErlNifRWLock); | |
pub fn enif_rwlock_tryrlock(rwlck: *mut ErlNifRWLock) -> ::libc::c_int; | |
pub fn enif_rwlock_rlock(rwlck: *mut ErlNifRWLock); | |
pub fn enif_rwlock_runlock(rwlck: *mut ErlNifRWLock); | |
pub fn enif_rwlock_tryrwlock(rwlck: *mut ErlNifRWLock) -> ::libc::c_int; | |
pub fn enif_rwlock_rwlock(rwlck: *mut ErlNifRWLock); | |
pub fn enif_rwlock_rwunlock(rwlck: *mut ErlNifRWLock); | |
pub fn enif_tsd_key_create(name: *mut ::libc::c_char, | |
key: *mut ErlNifTSDKey) -> ::libc::c_int; | |
pub fn enif_tsd_key_destroy(key: ErlNifTSDKey); | |
pub fn enif_tsd_set(key: ErlNifTSDKey, data: *mut ::libc::c_void); | |
pub fn enif_tsd_get(key: ErlNifTSDKey) -> *mut ::libc::c_void; | |
pub fn enif_thread_opts_create(name: *mut ::libc::c_char) -> | |
*mut ErlNifThreadOpts; | |
pub fn enif_thread_opts_destroy(opts: *mut ErlNifThreadOpts); | |
pub fn enif_thread_create(name: *mut ::libc::c_char, tid: *mut ErlNifTid, | |
func: | |
::std::option::Option<extern "C" fn | |
(arg1: | |
*mut ::libc::c_void) | |
-> | |
*mut ::libc::c_void>, | |
args: *mut ::libc::c_void, | |
opts: *mut ErlNifThreadOpts) -> ::libc::c_int; | |
pub fn enif_thread_self() -> ErlNifTid; | |
pub fn enif_equal_tids(tid1: ErlNifTid, tid2: ErlNifTid) -> ::libc::c_int; | |
pub fn enif_thread_exit(resp: *mut ::libc::c_void); | |
pub fn enif_thread_join(arg1: ErlNifTid, respp: *mut *mut ::libc::c_void) | |
-> ::libc::c_int; | |
pub fn enif_realloc(ptr: *mut ::libc::c_void, size: size_t) -> | |
*mut ::libc::c_void; | |
pub fn enif_system_info(sip: *mut ErlNifSysInfo, si_size: size_t); | |
pub fn enif_fprintf(filep: *mut ::libc::c_void, | |
format: *const ::libc::c_char, ...) -> ::libc::c_int; | |
pub fn enif_inspect_iolist_as_binary(arg1: *mut ErlNifEnv, | |
term: ERL_NIF_TERM, | |
bin: *mut ErlNifBinary) -> | |
::libc::c_int; | |
pub fn enif_make_sub_binary(arg1: *mut ErlNifEnv, bin_term: ERL_NIF_TERM, | |
pos: size_t, size: size_t) -> ERL_NIF_TERM; | |
pub fn enif_get_string(arg1: *mut ErlNifEnv, list: ERL_NIF_TERM, | |
buf: *mut ::libc::c_char, len: ::libc::c_uint, | |
arg2: ErlNifCharEncoding) -> ::libc::c_int; | |
pub fn enif_get_atom(arg1: *mut ErlNifEnv, atom: ERL_NIF_TERM, | |
buf: *mut ::libc::c_char, len: ::libc::c_uint, | |
arg2: ErlNifCharEncoding) -> ::libc::c_int; | |
pub fn enif_is_fun(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_is_pid(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_is_port(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_get_uint(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM, | |
ip: *mut ::libc::c_uint) -> ::libc::c_int; | |
pub fn enif_get_long(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM, | |
ip: *mut ::libc::c_long) -> ::libc::c_int; | |
pub fn enif_make_uint(arg1: *mut ErlNifEnv, i: ::libc::c_uint) -> | |
ERL_NIF_TERM; | |
pub fn enif_make_long(arg1: *mut ErlNifEnv, i: ::libc::c_long) -> | |
ERL_NIF_TERM; | |
pub fn enif_make_tuple_from_array(arg1: *mut ErlNifEnv, | |
arr: *const ERL_NIF_TERM, | |
cnt: ::libc::c_uint) -> ERL_NIF_TERM; | |
pub fn enif_make_list_from_array(arg1: *mut ErlNifEnv, | |
arr: *const ERL_NIF_TERM, | |
cnt: ::libc::c_uint) -> ERL_NIF_TERM; | |
pub fn enif_is_empty_list(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_open_resource_type(arg1: *mut ErlNifEnv, | |
module_str: *const ::libc::c_char, | |
name_str: *const ::libc::c_char, | |
dtor: | |
::std::option::Option<extern "C" fn | |
(arg1: | |
*mut ErlNifEnv, | |
arg2: | |
*mut ::libc::c_void)>, | |
flags: ErlNifResourceFlags, | |
tried: *mut ErlNifResourceFlags) -> | |
*mut ErlNifResourceType; | |
pub fn enif_alloc_resource(_type: *mut ErlNifResourceType, size: size_t) | |
-> *mut ::libc::c_void; | |
pub fn enif_release_resource(obj: *mut ::libc::c_void); | |
pub fn enif_make_resource(arg1: *mut ErlNifEnv, obj: *mut ::libc::c_void) | |
-> ERL_NIF_TERM; | |
pub fn enif_get_resource(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM, | |
_type: *mut ErlNifResourceType, | |
objp: *mut *mut ::libc::c_void) -> ::libc::c_int; | |
pub fn enif_sizeof_resource(obj: *mut ::libc::c_void) -> size_t; | |
pub fn enif_make_new_binary(arg1: *mut ErlNifEnv, size: size_t, | |
termp: *mut ERL_NIF_TERM) -> | |
*mut ::libc::c_uchar; | |
pub fn enif_is_list(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_is_tuple(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_get_atom_length(arg1: *mut ErlNifEnv, atom: ERL_NIF_TERM, | |
len: *mut ::libc::c_uint, | |
arg2: ErlNifCharEncoding) -> ::libc::c_int; | |
pub fn enif_get_list_length(env: *mut ErlNifEnv, term: ERL_NIF_TERM, | |
len: *mut ::libc::c_uint) -> ::libc::c_int; | |
pub fn enif_make_atom_len(env: *mut ErlNifEnv, | |
name: *const ::libc::c_char, len: size_t) -> | |
ERL_NIF_TERM; | |
pub fn enif_make_existing_atom_len(env: *mut ErlNifEnv, | |
name: *const ::libc::c_char, | |
len: size_t, atom: *mut ERL_NIF_TERM, | |
arg1: ErlNifCharEncoding) -> | |
::libc::c_int; | |
pub fn enif_make_string_len(env: *mut ErlNifEnv, | |
string: *const ::libc::c_char, len: size_t, | |
arg1: ErlNifCharEncoding) -> ERL_NIF_TERM; | |
pub fn enif_alloc_env() -> *mut ErlNifEnv; | |
pub fn enif_free_env(env: *mut ErlNifEnv); | |
pub fn enif_clear_env(env: *mut ErlNifEnv); | |
pub fn enif_send(env: *mut ErlNifEnv, to_pid: *const ErlNifPid, | |
msg_env: *mut ErlNifEnv, msg: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_make_copy(dst_env: *mut ErlNifEnv, src_term: ERL_NIF_TERM) -> | |
ERL_NIF_TERM; | |
pub fn enif_self(caller_env: *mut ErlNifEnv, pid: *mut ErlNifPid) -> | |
*mut ErlNifPid; | |
pub fn enif_get_local_pid(env: *mut ErlNifEnv, arg1: ERL_NIF_TERM, | |
pid: *mut ErlNifPid) -> ::libc::c_int; | |
pub fn enif_keep_resource(obj: *mut ::libc::c_void); | |
pub fn enif_make_resource_binary(arg1: *mut ErlNifEnv, | |
obj: *mut ::libc::c_void, | |
data: *const ::libc::c_void, | |
size: size_t) -> ERL_NIF_TERM; | |
pub fn enif_is_exception(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_make_reverse_list(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM, | |
list: *mut ERL_NIF_TERM) -> ::libc::c_int; | |
pub fn enif_is_number(arg1: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_dlopen(lib: *const ::libc::c_char, | |
err_handler: | |
::std::option::Option<extern "C" fn | |
(arg1: | |
*mut ::libc::c_void, | |
arg2: | |
*const ::libc::c_char)>, | |
err_arg: *mut ::libc::c_void) -> *mut ::libc::c_void; | |
pub fn enif_dlsym(handle: *mut ::libc::c_void, | |
symbol: *const ::libc::c_char, | |
err_handler: | |
::std::option::Option<extern "C" fn | |
(arg1: | |
*mut ::libc::c_void, | |
arg2: | |
*const ::libc::c_char)>, | |
err_arg: *mut ::libc::c_void) -> *mut ::libc::c_void; | |
pub fn enif_consume_timeslice(arg1: *mut ErlNifEnv, | |
percent: ::libc::c_int) -> ::libc::c_int; | |
pub fn enif_is_map(env: *mut ErlNifEnv, term: ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_get_map_size(env: *mut ErlNifEnv, term: ERL_NIF_TERM, | |
size: *mut size_t) -> ::libc::c_int; | |
pub fn enif_make_new_map(env: *mut ErlNifEnv) -> ERL_NIF_TERM; | |
pub fn enif_make_map_put(env: *mut ErlNifEnv, map_in: ERL_NIF_TERM, | |
key: ERL_NIF_TERM, value: ERL_NIF_TERM, | |
map_out: *mut ERL_NIF_TERM) -> ::libc::c_int; | |
pub fn enif_get_map_value(env: *mut ErlNifEnv, map: ERL_NIF_TERM, | |
key: ERL_NIF_TERM, value: *mut ERL_NIF_TERM) -> | |
::libc::c_int; | |
pub fn enif_make_map_update(env: *mut ErlNifEnv, map_in: ERL_NIF_TERM, | |
key: ERL_NIF_TERM, value: ERL_NIF_TERM, | |
map_out: *mut ERL_NIF_TERM) -> ::libc::c_int; | |
pub fn enif_make_map_remove(env: *mut ErlNifEnv, map_in: ERL_NIF_TERM, | |
key: ERL_NIF_TERM, map_out: *mut ERL_NIF_TERM) | |
-> ::libc::c_int; | |
pub fn enif_map_iterator_create(env: *mut ErlNifEnv, map: ERL_NIF_TERM, | |
iter: *mut ErlNifMapIterator, | |
entry: ErlNifMapIteratorEntry) -> | |
::libc::c_int; | |
pub fn enif_map_iterator_destroy(env: *mut ErlNifEnv, | |
iter: *mut ErlNifMapIterator); | |
pub fn enif_map_iterator_is_head(env: *mut ErlNifEnv, | |
iter: *mut ErlNifMapIterator) -> | |
::libc::c_int; | |
pub fn enif_map_iterator_is_tail(env: *mut ErlNifEnv, | |
iter: *mut ErlNifMapIterator) -> | |
::libc::c_int; | |
pub fn enif_map_iterator_next(env: *mut ErlNifEnv, | |
iter: *mut ErlNifMapIterator) -> | |
::libc::c_int; | |
pub fn enif_map_iterator_prev(env: *mut ErlNifEnv, | |
iter: *mut ErlNifMapIterator) -> | |
::libc::c_int; | |
pub fn enif_map_iterator_get_pair(env: *mut ErlNifEnv, | |
iter: *mut ErlNifMapIterator, | |
key: *mut ERL_NIF_TERM, | |
value: *mut ERL_NIF_TERM) -> | |
::libc::c_int; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment