comparison src/rpcify.sml @ 765:a28982de5645

Successfully influenced effectful-ness status of FFI func
author Adam Chlipala <adamc@hcoop.net>
date Sat, 02 May 2009 11:27:26 -0400
parents e0dd85ea58e1
children ed06e25c70ef
comparison
equal deleted inserted replaced
764:7f653298dd66 765:a28982de5645
44 if n = 0 then 44 if n = 0 then
45 e 45 e
46 else 46 else
47 multiLiftExpInExp (n - 1) (E.liftExpInExp 0 e) 47 multiLiftExpInExp (n - 1) (E.liftExpInExp 0 e)
48 48
49 val ssBasis = SS.addList (SS.empty,
50 ["requestHeader",
51 "query",
52 "dml",
53 "nextval",
54 "channel",
55 "subscribe",
56 "send"])
57
58 val csBasis = SS.addList (SS.empty,
59 ["get",
60 "set",
61 "alert",
62 "recv",
63 "sleep",
64 "spawn"])
65
66 type state = { 49 type state = {
67 cpsed : int IM.map, 50 cpsed : int IM.map,
68 cpsed_range : con IM.map, 51 cpsed_range : con IM.map,
69 cps_decls : (string * int * con * exp * string) list, 52 cps_decls : (string * int * con * exp * string) list,
70 53
78 let 61 let
79 fun sideish (basis, ssids) e = 62 fun sideish (basis, ssids) e =
80 U.Exp.exists {kind = fn _ => false, 63 U.Exp.exists {kind = fn _ => false,
81 con = fn _ => false, 64 con = fn _ => false,
82 exp = fn ENamed n => IS.member (ssids, n) 65 exp = fn ENamed n => IS.member (ssids, n)
83 | EFfi ("Basis", x) => SS.member (basis, x) 66 | EFfi x => basis x
84 | EFfiApp ("Basis", x, _) => SS.member (basis, x) 67 | EFfiApp (m, x, _) => basis (m, x)
85 | _ => false} 68 | _ => false}
86 (U.Exp.map {kind = fn x => x, 69 (U.Exp.map {kind = fn x => x,
87 con = fn x => x, 70 con = fn x => x,
88 exp = fn ERecord _ => ERecord [] 71 exp = fn ERecord _ => ERecord []
89 | x => x} e) 72 | x => x} e)
108 end 91 end
109 in 92 in
110 foldl decl IS.empty file 93 foldl decl IS.empty file
111 end 94 end
112 95
113 val ssids = whichIds ssBasis 96 val ssids = whichIds Settings.isServerOnly
114 val csids = whichIds csBasis 97 val csids = whichIds Settings.isClientOnly
115 98
116 fun sideish' (basis, ids) extra = 99 fun sideish' (basis, ids) extra =
117 sideish (basis, IM.foldli (fn (id, _, ids) => IS.add (ids, id)) ids extra) 100 sideish (basis, IM.foldli (fn (id, _, ids) => IS.add (ids, id)) ids extra)
118 101
119 val serverSide = sideish' (ssBasis, ssids) 102 val serverSide = sideish' (Settings.isServerOnly, ssids)
120 val clientSide = sideish' (csBasis, csids) 103 val clientSide = sideish' (Settings.isClientOnly, csids)
121 104
122 val tfuncs = foldl 105 val tfuncs = foldl
123 (fn ((d, _), tfuncs) => 106 (fn ((d, _), tfuncs) =>
124 let 107 let
125 fun doOne ((x, n, t, e, _), tfuncs) = 108 fun doOne ((x, n, t, e, _), tfuncs) =