aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-22 11:58:20 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-22 11:58:20 -0800
commita08da7bd41166a40bb5d63396540e37d8caa7fd7 (patch)
tree9d8666dcdcecea05439fe9f5596badda940f45e5 /system
parentbc4dbe116101b2424ed6a318037711218e86279a (diff)
add EM_ASM_ which allows sending values without returning anything
Diffstat (limited to 'system')
-rw-r--r--system/include/emscripten/emscripten.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h
index b92d920c..852a8e0d 100644
--- a/system/include/emscripten/emscripten.h
+++ b/system/include/emscripten/emscripten.h
@@ -40,10 +40,15 @@ extern "C" {
#define EM_ASM(...) emscripten_asm_const(#__VA_ARGS__)
/*
- * Input-output versions of EM_ASM. EM_ASM_INT receives arguments of
- * either int or double type and returns an int; EM_ASM_DOUBLE
- * receives similar arguments (int or double) but returns a double.
- * Arguments arrive as $0, $1 etc; output value should be returned:
+ * Input-output versions of EM_ASM.
+ *
+ * EM_ASM_ (an extra _ is added) allows sending values (ints
+ * or doubles) into the code. If you also want a return value,
+ * EM_ASM_INT receives arguments (of int or double type)
+ * and returns an int; EM_ASM_DOUBLE does the same and returns
+ * a double.
+ *
+ * Arguments arrive as $0, $1 etc. The output value should be returned:
*
* int x = EM_ASM_INT({
* console.log('I received: ' + [$0, $1]);
@@ -54,6 +59,7 @@ extern "C" {
* (int or double) but *not* to pass any values, you can use
* EM_ASM_INT_V and EM_ASM_DOUBLE_V respectively.
*/
+#define EM_ASM_(code, ...) emscripten_asm_const_int(#code, __VA_ARGS__)
#define EM_ASM_INT(code, ...) emscripten_asm_const_int(#code, __VA_ARGS__)
#define EM_ASM_DOUBLE(code, ...) emscripten_asm_const_double(#code, __VA_ARGS__)
#define EM_ASM_INT_V(code) emscripten_asm_const_int(#code)