summaryrefslogtreecommitdiffstats
path: root/testsuite/tests/callback/callbackprim.c
diff options
context:
space:
mode:
authorXavier Clerc <xavier.clerc@inria.fr>2010-01-25 14:04:18 +0000
committerXavier Clerc <xavier.clerc@inria.fr>2010-01-25 14:04:18 +0000
commitc0b3c352795a74c6827b9247378f8f8b0ff571a8 (patch)
treee5cc418e0f0ce90c9fe077f7523a7c2e7a4c1a01 /testsuite/tests/callback/callbackprim.c
parenteb4d79aa50fa3ab201dbe45451e9682cba6c52a2 (diff)
Tests moved to 'callback'
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9570 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'testsuite/tests/callback/callbackprim.c')
-rw-r--r--testsuite/tests/callback/callbackprim.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/testsuite/tests/callback/callbackprim.c b/testsuite/tests/callback/callbackprim.c
new file mode 100644
index 000000000..f1a4ccfa1
--- /dev/null
+++ b/testsuite/tests/callback/callbackprim.c
@@ -0,0 +1,54 @@
+#include "mlvalues.h"
+#include "memory.h"
+#include "callback.h"
+
+value mycallback1(value fun, value arg)
+{
+ value res;
+ res = callback(fun, arg);
+ return res;
+}
+
+value mycallback2(value fun, value arg1, value arg2)
+{
+ value res;
+ res = callback2(fun, arg1, arg2);
+ return res;
+}
+
+value mycallback3(value fun, value arg1, value arg2, value arg3)
+{
+ value res;
+ res = callback3(fun, arg1, arg2, arg3);
+ return res;
+}
+
+value mycallback4(value fun, value arg1, value arg2, value arg3, value arg4)
+{
+ value args[4];
+ value res;
+ args[0] = arg1;
+ args[1] = arg2;
+ args[2] = arg3;
+ args[3] = arg4;
+ res = callbackN(fun, 4, args);
+ return res;
+}
+
+value mypushroot(value v, value fun, value arg)
+{
+ Begin_root(v)
+ callback(fun, arg);
+ End_roots();
+ return v;
+}
+
+value mycamlparam (value v, value fun, value arg)
+{
+ CAMLparam3 (v, fun, arg);
+ CAMLlocal2 (x, y);
+ x = v;
+ y = callback (fun, arg);
+ v = x;
+ CAMLreturn (v);
+}