diff options
author | Björn-Egil Dahlberg <[email protected]> | 2013-11-08 15:34:05 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-01-29 11:08:40 +0100 |
commit | e0eb6d5bafcebc1c24b0a538e50a1d55a3724f01 (patch) | |
tree | 5fddadbcc6100f4200e2e5d10fa7a505896736f5 /erts/emulator/beam/erl_nif.h | |
parent | 1a234c9eba8ac2c78f97e5f3e33521b8cc5d3748 (diff) | |
download | otp-e0eb6d5bafcebc1c24b0a538e50a1d55a3724f01.tar.gz otp-e0eb6d5bafcebc1c24b0a538e50a1d55a3724f01.tar.bz2 otp-e0eb6d5bafcebc1c24b0a538e50a1d55a3724f01.zip |
erts: Add NIFs for Maps
- int enif_is_map(ErlNifEnv* env, ERL_NIF_TERM map)
- int enif_get_map_size(ErlNifEnv *env, ERL_NIF_TERM, int*)
- ERL_NIF_TERM enif_make_new_map(ErlNifEnv *env)
- int enif_make_map_put(ErlNifEnv *env, ERL_NIF_TERM map_in, ERL_NIF_TERM key, ERL_NIF_TERM value, ERL_NIF_TERM* map_out)
- int enif_get_map_value(ErlNifEnv *env, ERL_NIF_TERM map, ERL_NIF_TERM key, ERL_NIF_TERM* value)
- int enif_find_map_value(ErlNifEnv *env, ERL_NIF_TERM map, ERL_NIF_TERM key, ERL_NIF_TERM* value)
- int enif_make_map_update(ErlNifEnv *env, ERL_NIF_TERM map_in, ERL_NIF_TERM key, ERL_NIF_TERM value, ERL_NIF_TERM* map_out)
- int enif_make_map_remove(ErlNifEnv *env, ERL_NIF_TERM map_in, ERL_NIF_TERM key, ERL_NIF_TERM* map_out)
- int enif_map_iterator_create(ErlNifEnv *env, ERL_NIF_TERM map, ErlNifMapIterator *iter)
- void enif_map_iterator_destroy(ErlNifEnv *env, ErlNifMapIterator *iter)
- int enif_map_iterator_next(ErlNifEnv *env, ErlNifMapIterator *iter)
- int enif_map_iterator_get_pair(ErlNifEnv *env, ErlNifMapIterator *iter, ERL_NIF_TERM *key, ERL_NIF_TERM *value)
Diffstat (limited to 'erts/emulator/beam/erl_nif.h')
-rw-r--r-- | erts/emulator/beam/erl_nif.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_nif.h b/erts/emulator/beam/erl_nif.h index fb3c359ec9..3c1e13f8a4 100644 --- a/erts/emulator/beam/erl_nif.h +++ b/erts/emulator/beam/erl_nif.h @@ -38,14 +38,11 @@ ** 2.2: R14B03 enif_is_exception ** 2.3: R15 enif_make_reverse_list, enif_is_number ** 2.4: R16 enif_consume_timeslice -** 2.5: R17 dirty schedulers +** 2.5: R17 Maps API additions +** R17 dirty schedulers */ #define ERL_NIF_MAJOR_VERSION 2 -#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT #define ERL_NIF_MINOR_VERSION 5 -#else -#define ERL_NIF_MINOR_VERSION 4 -#endif #include <stdlib.h> @@ -168,6 +165,7 @@ typedef int ErlNifTSDKey; typedef ErlDrvThreadOpts ErlNifThreadOpts; +<<<<<<< HEAD #ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT typedef enum { @@ -175,6 +173,24 @@ typedef enum ERL_NIF_DIRTY_JOB_IO_BOUND = 2 }ErlNifDirtyTaskFlags; #endif +======= +typedef struct +{ + /* use a lot of memory, structure may change */ + ERL_NIF_TERM map; + ErlNifUInt64 h_limit; + ErlNifUInt64 t_limit; + ErlNifUInt64 idx; + ERL_NIF_TERM *ks; + ERL_NIF_TERM *vs; +} ErlNifMapIterator; + +typedef enum { + ERL_NIF_MAP_ITERATOR_HEAD = 1, + ERL_NIF_MAP_ITERATOR_TAIL = 2 +} ErlNifMapIteratorEntry; + +>>>>>>> erts: Add NIFs for Maps #if (defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_)) # define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) RET_TYPE (*NAME) ARGS |