diff options
author | Sverker Eriksson <[email protected]> | 2009-12-09 13:54:24 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2009-12-09 13:54:24 +0000 |
commit | e2ecf7de626ecc2c60f9c8738c20820d21403d77 (patch) | |
tree | f82fee31dbd03cf242f4e4aad6d62dadc711838e /erts/emulator/test/nif_SUITE_data | |
parent | dd983db48113e78a919d7c6cf3cf3c944e935976 (diff) | |
download | otp-e2ecf7de626ecc2c60f9c8738c20820d21403d77.tar.gz otp-e2ecf7de626ecc2c60f9c8738c20820d21403d77.tar.bz2 otp-e2ecf7de626ecc2c60f9c8738c20820d21403d77.zip |
OTP-8304 Incompatible changes in the experimental NIF feature. Changed the
NIF function prototypes in order to allow more than 3 function
arguments. Also an incompatible change in the return value of
erlang:load_nif/2. Added support for references, floats and term
comparison in NIFs. Read more in the documentation of erl_nif and
erlang:load_nif/2.
Diffstat (limited to 'erts/emulator/test/nif_SUITE_data')
-rw-r--r-- | erts/emulator/test/nif_SUITE_data/nif_SUITE.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c index 0d5ed6e28f..4532062dce 100644 --- a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c +++ b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c @@ -289,6 +289,20 @@ static ERL_NIF_TERM compare(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) return enif_make_int(env, enif_compare(env,argv[0],argv[1])); } +static ERL_NIF_TERM many_args_100(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{ + int i, k; + if (argc == 100) { + for (i=1; i<=100; i++) { + if (!enif_get_int(env,argv[i-1],&k) || k!=i) { + goto badarg; + } + } + return enif_make_atom(env,"ok"); + } +badarg: + return enif_make_badarg(env); +} static ErlNifFunc nif_funcs[] = { @@ -300,7 +314,8 @@ static ErlNifFunc nif_funcs[] = {"type_test", 0, type_test}, {"tuple_2_list", 1, tuple_2_list}, {"is_identical",2,is_identical}, - {"compare",2,compare} + {"compare",2,compare}, + {"many_args_100", 100, many_args_100} }; ERL_NIF_INIT(nif_SUITE,nif_funcs,load,reload,upgrade,unload) |