diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-05-25 21:56:04 +0200 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-05-25 21:56:04 +0200 |
commit | 0140792c8111d2dd1cf9004f2e3e602ec34ed30a (patch) | |
tree | edce9a1f3f65d1ad107e9e9dd2d28797e653a67d /khb/khs_exec_seq.ml | |
parent | 8456506c0b9c8e78eec2cc464851cef36ca03398 (diff) | |
download | SystemeReseaux-Projet-0140792c8111d2dd1cf9004f2e3e602ec34ed30a.tar.gz SystemeReseaux-Projet-0140792c8111d2dd1cf9004f2e3e602ec34ed30a.zip |
Cleanup.
Diffstat (limited to 'khb/khs_exec_seq.ml')
-rw-r--r-- | khb/khs_exec_seq.ml | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/khb/khs_exec_seq.ml b/khb/khs_exec_seq.ml deleted file mode 100644 index 6e34767..0000000 --- a/khb/khs_exec_seq.ml +++ /dev/null @@ -1,62 +0,0 @@ -open Util -open Khs_ast -open Khs_exec - -let chans = Hashtbl.create 12 -let ch_id = - let p = ref 0 in - fun () -> p := !p + 1; !p - -let proc = ref [] -let proc_spawned = ref [] - -let spawn proc pos = - proc_spawned := - { proc with xpos = pos }::(!proc_spawned) - -let newchan proc = - let id = ch_id () in - Hashtbl.add chans id (Queue.create()); - Many (Smap.add (psep^"in") (VInt id) - (Smap.add (psep^"out") (VInt id) Smap.empty)) - -let proc_step proc = - match proc.xstatus with - | PSDone -> false - | PSExec | PSExecRecvd _ -> - exec_stmt proc; - true - | PSSend(c, kv) -> - proc.xstatus <- PSExec; - begin - if (int_of_kbval c) == 0 then - Format.printf "%s@." (kval_descr kv) - else - Queue.push kv (Hashtbl.find chans (int_of_kbval c)) - end; - true - | PSRecv(c) -> - let q = Hashtbl.find chans (int_of_kbval c) in - if not (Queue.is_empty q) then - proc.xstatus <- PSExecRecvd (Queue.pop q); - true - -let exec_program p = - let proc0 = { - xspawn = spawn; - xnewchan = newchan; - xprog = p; - xvals = Smap.empty; - xstatus = PSExec; - xpos = 0 - } in - proc0.xvals <- Smap.add framevar (VInt 0) proc0.xvals; - proc0.xvals <- Smap.add "stdout" (VInt 0) proc0.xvals; - proc := [ proc0 ]; - while List.length !proc > 0 do - proc := List.filter proc_step !proc; - proc := !proc_spawned @ !proc; - proc_spawned := []; - done - - |