forked from miking-lang/miking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtppl-ext.ext-ocaml.mc
63 lines (60 loc) · 2.72 KB
/
rtppl-ext.ext-ocaml.mc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
include "map.mc"
include "ocaml/ast.mc"
let tyts_ = tytuple_ [tyint_, tyunknown_]
let impl = lam arg : {expr : String, ty : Type }.
[ { expr = arg.expr, ty = arg.ty, libraries = ["rtppl-support"], cLibraries = [] } ]
let timespec = otytuple_ [tyint_, tyint_]
let readDistTy = lam ty. otyarray_ (otytuple_ [tyfloat_, ty])
let writeDistTy = lam ty. otytuple_ [otyarray_ ty, otyarray_ tyfloat_]
let rtpplExtMap =
use OCamlTypeAst in
mapFromSeq cmpString [
( "setSigintHandler"
, impl { expr = "Rtppl.set_signal_handler Sys.sigint"
, ty = tyarrow_ (tyarrow_ tyint_ otyunit_) otyunit_ } ),
( "getMonotonicTime"
, impl { expr = "Rtppl.get_monotonic_time"
, ty = tyarrow_ otyunit_ timespec} ),
( "getWallClockTime"
, impl { expr = "Rtppl.get_wall_clock_time"
, ty = tyarrow_ otyunit_ timespec} ),
( "getProcessCpuTime"
, impl { expr = "Rtppl.get_process_cpu_time"
, ty = tyarrow_ otyunit_ timespec} ),
( "clockNanosleep"
, impl { expr = "Rtppl.clock_nanosleep"
, ty = tyarrow_ timespec otyunit_ } ),
( "rtpplSetMaxPriority"
, impl { expr = "Rtppl.set_max_priority"
, ty = tyarrow_ otyunit_ tyint_ } ),
( "rtpplSetPriority"
, impl { expr = "Rtppl.set_priority"
, ty = tyarrow_ tyint_ tyint_ } ),
( "rtpplOpenFileDescriptor"
, impl { expr = "Rtppl.open_file_descriptor"
, ty = tyarrow_ otystring_ tyint_ } ),
( "rtpplCloseFileDescriptor"
, impl { expr = "Rtppl.close_file_descriptor"
, ty = tyarrow_ tyint_ otyunit_ } ),
( "rtpplReadFloat"
, impl { expr = "Rtppl.read_float"
, ty = tyarrow_ tyint_ (otyarray_ (otytuple_ [timespec, tyfloat_])) } ),
( "rtpplWriteFloat"
, impl { expr = "Rtppl.write_float"
, ty = tyarrows_ [tyint_, otytuple_ [timespec, tyfloat_], otyunit_] } ),
( "rtpplReadDistFloat"
, impl { expr = "Rtppl.read_dist_float"
, ty = tyarrow_ tyint_ (otyarray_ (otytuple_ [timespec, readDistTy tyfloat_])) } ),
( "rtpplWriteDistFloat"
, impl { expr = "Rtppl.write_dist_float"
, ty = tyarrows_ [tyint_, otytuple_ [timespec, writeDistTy tyfloat_], otyunit_] } ),
( "rtpplReadDistFloatRecord"
, impl { expr = "Rtppl.read_dist_float_record"
, ty = tyarrows_ [tyint_, tyint_, otyarray_ (otytuple_ [timespec, readDistTy tyunknown_])] } ),
( "rtpplWriteDistFloatRecord"
, impl { expr = "Rtppl.write_dist_float_record"
, ty = tyarrows_ [tyint_, tyint_, otytuple_ [timespec, writeDistTy tyunknown_], otyunit_] } ),
( "rtpplBatchedInference"
, impl { expr = "Rtppl.rtppl_batched_inference"
, ty = tyarrows_ [tyarrow_ otyunit_ tyunknown_, timespec, otylist_ tyunknown_] } )
]