From e2ecf7de626ecc2c60f9c8738c20820d21403d77 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 9 Dec 2009 13:54:24 +0000 Subject: 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. --- erts/emulator/test/nif_SUITE_data/nif_SUITE.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'erts/emulator/test/nif_SUITE_data') 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) -- cgit v1.2.3