Allow passing user signals to (signal) as keywords.

This commit is contained in:
Calvin Rose
2022-09-17 21:18:07 -05:00
parent bb8405a36e
commit 6a899968a9
3 changed files with 22 additions and 13 deletions
+12 -1
View File
@@ -124,7 +124,8 @@ void void_fn(void) {
printf("void fn ran\n");
}
EXPORTER void_fn_2(double y) {
EXPORTER
void void_fn_2(double y) {
printf("y = %f\n", y);
}
@@ -132,3 +133,13 @@ EXPORTER
void void_ret_fn(int x) {
printf("void fn ran: %d\n", x);
}
typedef struct {
int a, b;
float c, d;
} Split;
EXPORTER
float split_fn(Split s) {
return s.a * s.c + s.b * s.d;
}
+3
View File
@@ -45,6 +45,8 @@
j :double])
(ffi/defbind void-fn-2 :void [y :double])
(def split (ffi/struct :int :int :float :float))
(ffi/defbind split-fn :float [s split])
#
# Struct reading and writing
#
@@ -85,6 +87,7 @@
# Call functions
#
(tracev (split-fn [5 6 1.2 3.4]))
(tracev (void-fn-2 10.3))
(tracev (double-many 1 2 3 4 5 6))
(tracev (string/format "%.17g" (double-many 1 2 3 4 5 6)))