Mercurial > urweb
comparison src/rpcify.sml @ 609:56aaa1941dad
First gimpy RPC
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 15 Feb 2009 10:32:50 -0500 |
parents | 330a7de47914 |
children | c5991cdb0c4b |
comparison
equal
deleted
inserted
replaced
608:330a7de47914 | 609:56aaa1941dad |
---|---|
96 val csids = whichIds csBasis | 96 val csids = whichIds csBasis |
97 | 97 |
98 val serverSide = sideish (ssBasis, ssids) | 98 val serverSide = sideish (ssBasis, ssids) |
99 val clientSide = sideish (csBasis, csids) | 99 val clientSide = sideish (csBasis, csids) |
100 | 100 |
101 val tfuncs = foldl | |
102 (fn ((d, _), tfuncs) => | |
103 let | |
104 fun doOne ((_, n, t, _, _), tfuncs) = | |
105 let | |
106 fun crawl ((t, _), args) = | |
107 case t of | |
108 CApp ((CFfi ("Basis", "transaction"), _), ran) => SOME (rev args, ran) | |
109 | TFun (arg, rest) => crawl (rest, arg :: args) | |
110 | _ => NONE | |
111 in | |
112 case crawl (t, []) of | |
113 NONE => tfuncs | |
114 | SOME sg => IM.insert (tfuncs, n, sg) | |
115 end | |
116 in | |
117 case d of | |
118 DVal vi => doOne (vi, tfuncs) | |
119 | DValRec vis => foldl doOne tfuncs vis | |
120 | _ => tfuncs | |
121 end) | |
122 IM.empty file | |
123 | |
101 fun exp (e, st) = | 124 fun exp (e, st) = |
102 case e of | 125 case e of |
103 EApp ( | 126 EApp ( |
104 (EApp | 127 (EApp |
105 ((EApp ((ECApp ((ECApp ((ECApp ((EFfi ("Basis", "bind"), loc), _), _), t1), _), t2), _), | 128 ((EApp ((ECApp ((ECApp ((ECApp ((EFfi ("Basis", "bind"), loc), _), _), t1), _), t2), _), |
128 val st = {cpsed = #cpsed st, | 151 val st = {cpsed = #cpsed st, |
129 cps_decls = #cps_decls st, | 152 cps_decls = #cps_decls st, |
130 | 153 |
131 exported = exported, | 154 exported = exported, |
132 export_decls = export_decls} | 155 export_decls = export_decls} |
156 | |
157 val ran = | |
158 case IM.find (tfuncs, n) of | |
159 NONE => raise Fail "Rpcify: Undetected transaction function" | |
160 | SOME (_, ran) => ran | |
133 in | 161 in |
134 (EServerCall (n, args, trans2), st) | 162 (EServerCall (n, args, trans2, ran), st) |
135 end | 163 end |
136 | _ => (e, st)) | 164 | _ => (e, st)) |
137 | _ => (e, st) | 165 | _ => (e, st) |
138 | 166 |
139 fun decl (d, st : state) = | 167 fun decl (d, st : state) = |