383 apply_transaction pos (fn x => f int x) state |
383 apply_transaction pos (fn x => f int x) state |
384 | apply_tr _ _ _ _ = raise UNDEF; |
384 | apply_tr _ _ _ _ = raise UNDEF; |
385 |
385 |
386 fun apply_union _ _ [] state = raise FAILURE (state, UNDEF) |
386 fun apply_union _ _ [] state = raise FAILURE (state, UNDEF) |
387 | apply_union int pos (tr :: trs) state = |
387 | apply_union int pos (tr :: trs) state = |
388 apply_tr int pos tr state |
388 apply_union int pos trs state |
389 handle UNDEF => apply_union int pos trs state |
389 handle UNDEF => apply_tr int pos tr state |
390 | FAILURE (alt_state, UNDEF) => apply_union int pos trs alt_state |
390 | FAILURE (alt_state, UNDEF) => apply_tr int pos tr alt_state |
391 | exn as FAILURE _ => raise exn |
391 | exn as FAILURE _ => raise exn |
392 | exn => raise FAILURE (state, exn); |
392 | exn => raise FAILURE (state, exn); |
393 |
393 |
394 in |
394 in |
395 |
395 |
435 ERROR (command_msg "Illegal application of " tr ^ " " ^ str_of_state state); |
435 ERROR (command_msg "Illegal application of " tr ^ " " ^ str_of_state state); |
436 |
436 |
437 |
437 |
438 (* modify transitions *) |
438 (* modify transitions *) |
439 |
439 |
440 fun name nm = map_transition (fn (_, pos, int_only, print, no_timing, trans) => |
440 fun name name = map_transition (fn (_, pos, int_only, print, no_timing, trans) => |
441 (nm, pos, int_only, print, no_timing, trans)); |
441 (name, pos, int_only, print, no_timing, trans)); |
442 |
442 |
443 fun position pos = map_transition (fn (name, _, int_only, print, no_timing, trans) => |
443 fun position pos = map_transition (fn (name, _, int_only, print, no_timing, trans) => |
444 (name, pos, int_only, print, no_timing, trans)); |
444 (name, pos, int_only, print, no_timing, trans)); |
445 |
445 |
446 fun interactive int_only = map_transition (fn (name, pos, _, print, no_timing, trans) => |
446 fun interactive int_only = map_transition (fn (name, pos, _, print, no_timing, trans) => |
448 |
448 |
449 val no_timing = map_transition (fn (name, pos, int_only, print, _, trans) => |
449 val no_timing = map_transition (fn (name, pos, int_only, print, _, trans) => |
450 (name, pos, int_only, print, true, trans)); |
450 (name, pos, int_only, print, true, trans)); |
451 |
451 |
452 fun add_trans tr = map_transition (fn (name, pos, int_only, print, no_timing, trans) => |
452 fun add_trans tr = map_transition (fn (name, pos, int_only, print, no_timing, trans) => |
453 (name, pos, int_only, print, no_timing, trans @ [tr])); |
453 (name, pos, int_only, print, no_timing, tr :: trans)); |
454 |
454 |
455 val reset_trans = map_transition (fn (name, pos, int_only, print, no_timing, _) => |
455 val reset_trans = map_transition (fn (name, pos, int_only, print, no_timing, _) => |
456 (name, pos, int_only, print, no_timing, [])); |
456 (name, pos, int_only, print, no_timing, [])); |
457 |
457 |
458 val print = map_transition (fn (name, pos, int_only, _, no_timing, trans) => |
458 val print = map_transition (fn (name, pos, int_only, _, no_timing, trans) => |