diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-02-15 09:27:36 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-02-15 09:27:36 -0500 |
commit | e27335a18e8f4b1cca2749e8d41863b3cbef9b62 (patch) | |
tree | ce010b2988315e7b327f46f1c2b0ee9fef759f4f /src/rpcify.sml | |
parent | f7db36644bdbde7b0ed48daffeb760bd5418bd2e (diff) |
Export RPC functions and push RPC calls through to Mono
Diffstat (limited to 'src/rpcify.sml')
-rw-r--r-- | src/rpcify.sml | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/src/rpcify.sml b/src/rpcify.sml index dec8dc18..09c44a7a 100644 --- a/src/rpcify.sml +++ b/src/rpcify.sml @@ -53,8 +53,11 @@ val csBasis = SS.addList (SS.empty, "alert"]) type state = { - exps : int IM.map, - decls : (string * int * con * exp * string) list + cpsed : int IM.map, + cps_decls : (string * int * con * exp * string) list, + + exported : IS.set, + export_decls : decl list } fun frob file = @@ -114,6 +117,19 @@ fun frob file = (0, [])) val (n, args) = getApp (trans1, []) + + val (exported, export_decls) = + if IS.member (#exported st, n) then + (#exported st, #export_decls st) + else + (IS.add (#exported st, n), + (DExport (Rpc, n), loc) :: #export_decls st) + + val st = {cpsed = #cpsed st, + cps_decls = #cps_decls st, + + exported = exported, + export_decls = export_decls} in (EServerCall (n, args, trans2), st) end @@ -128,19 +144,26 @@ fun frob file = decl = fn x => x} st d in - (case #decls st of - [] => [d] - | ds => - case d of - (DValRec vis, loc) => [(DValRec (ds @ vis), loc)] - | (_, loc) => [(DValRec ds, loc), d], - {decls = [], - exps = #exps st}) + (List.revAppend (case #cps_decls st of + [] => [d] + | ds => + case d of + (DValRec vis, loc) => [(DValRec (ds @ vis), loc)] + | (_, loc) => [d, (DValRec ds, loc)], + #export_decls st), + {cpsed = #cpsed st, + cps_decls = [], + + exported = #exported st, + export_decls = []}) end val (file, _) = ListUtil.foldlMapConcat decl - {decls = [], - exps = IM.empty} + {cpsed = IM.empty, + cps_decls = [], + + exported = IS.empty, + export_decls = []} file in file |