HCoop
/
hcoop
/
debian
/
mlton.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Backport from sid to buster
[hcoop/debian/mlton.git]
/
doc
/
examples
/
ffi
/
ffi-import.c
1
#include
"export.h"
2
3
Int32 FFI_INT
=
13
;
4
Word32 FFI_WORD
=
0xFF
;
5
Bool FFI_BOOL
=
1
;
6
Real64 FFI_REAL
=
3.14159
;
7
8
Char8
ffi
(
Pointer a1
,
Int32 a1len
,
Pointer a2
,
Pointer a3
,
Int32 n
) {
9
double
*
ds
= (
double
*)
a1
;
10
int
*
pi
= (
int
*)
a2
;
11
char
*
pc
= (
char
*)
a3
;
12
int
i
;
13
double
sum
;
14
15
sum
=
0.0
;
16
for
(
i
=
0
;
i
<
a1len
; ++
i
) {
17
sum
+=
ds
[
i
];
18
ds
[
i
] +=
n
;
19
}
20
*
pi
= (
int
)
sum
;
21
*
pc
=
'c'
;
22
return
'c'
;
23
}