238 |
fun shutdown () = OS.Process.exit OS.Process.success |
fun shutdown () = OS.Process.exit OS.Process.success |
239 |
fun say_ok () = Say.say ["SLAVE: ok\n"] |
fun say_ok () = Say.say ["SLAVE: ok\n"] |
240 |
fun say_error () = Say.say ["SLAVE: error\n"] |
fun say_error () = Say.say ["SLAVE: error\n"] |
241 |
|
fun say_pong () = Say.say ["SLAVE: pong\n"] |
242 |
|
|
243 |
val touch = HostMachDepVC.Interact.useStream o TextIO.openString |
val touch = HostMachDepVC.Interact.useStream o TextIO.openString |
244 |
|
|
249 |
else case String.tokens Char.isSpace line of |
else case String.tokens Char.isSpace line of |
250 |
["cm", d, f] => do_cm (d, f) |
["cm", d, f] => do_cm (d, f) |
251 |
| ["cmb", archos, d, db] => do_cmb (archos, d, db) |
| ["cmb", archos, d, db] => do_cmb (archos, d, db) |
252 |
|
| ["ping"] => (say_pong (); waitForStart ()) |
253 |
|
| ["finish"] => (say_ok (); waitForStart ()) |
254 |
| ["shutdown"] => shutdown () |
| ["shutdown"] => shutdown () |
255 |
| _ => (say_error (); waitForStart ()) |
| _ => (say_error (); waitForStart ()) |
256 |
end handle _ => (say_error (); waitForStart ()) |
end handle _ => (say_error (); waitForStart ()) |
310 |
end handle _ => (say_error (); loop ()) |
end handle _ => (say_error (); loop ()) |
311 |
end |
end |
312 |
| ["cm", d, f] => do_cm (d, f) |
| ["cm", d, f] => do_cm (d, f) |
313 |
|
| ["cmb", archos, d, db] => do_cmb (archos, d, db) |
314 |
| ["finish"] => (say_ok (); waitForStart ()) |
| ["finish"] => (say_ok (); waitForStart ()) |
315 |
|
| ["ping"] => (say_pong (); loop ()) |
316 |
| ["shutdown"] => shutdown () |
| ["shutdown"] => shutdown () |
317 |
| _ => (say_error (); loop ()) |
| _ => (say_error (); loop ()) |
318 |
end handle _ => (say_error (); loop ()) |
end handle _ => (say_error (); loop ()) |
320 |
loop () |
loop () |
321 |
end |
end |
322 |
in |
in |
323 |
|
ignore (Signals.setHandler (Signals.sigINT, Signals.IGNORE)); |
324 |
say_ok (); (* announce readiness *) |
say_ok (); (* announce readiness *) |
325 |
waitForStart () handle _ => (); |
waitForStart () handle _ => (); |
326 |
OS.Process.exit OS.Process.failure |
OS.Process.exit OS.Process.failure |