equal
deleted
inserted
replaced
26 val init_state: state |
26 val init_state: state |
27 val define_command: command_id -> string -> state -> state |
27 val define_command: command_id -> string -> state -> state |
28 val join_commands: state -> unit |
28 val join_commands: state -> unit |
29 val cancel_execution: state -> Future.task list |
29 val cancel_execution: state -> Future.task list |
30 val update_perspective: version_id -> version_id -> string -> command_id list -> state -> state |
30 val update_perspective: version_id -> version_id -> string -> command_id list -> state -> state |
31 val edit: version_id -> version_id -> edit list -> state -> |
31 val update: version_id -> version_id -> edit list -> state -> |
32 ((command_id * exec_id option) list * (string * command_id option) list) * state |
32 ((command_id * exec_id option) list * (string * command_id option) list) * state |
33 val execute: version_id -> state -> state |
33 val execute: version_id -> state -> state |
34 val state: unit -> state |
34 val state: unit -> state |
35 val change_state: (state -> state) -> unit |
35 val change_state: (state -> state) -> unit |
36 end; |
36 end; |
363 end; |
363 end; |
364 |
364 |
365 |
365 |
366 |
366 |
367 |
367 |
368 (** editing **) |
368 (** update **) |
369 |
369 |
370 (* perspective *) |
370 (* perspective *) |
371 |
371 |
372 fun update_perspective (old_id: version_id) (new_id: version_id) name perspective state = |
372 fun update_perspective (old_id: version_id) (new_id: version_id) name perspective state = |
373 let |
373 let |
375 val _ = Time.now (); (* FIXME odd workaround for polyml-5.4.0/x86_64 -- needed? *) |
375 val _ = Time.now (); (* FIXME odd workaround for polyml-5.4.0/x86_64 -- needed? *) |
376 val new_version = edit_nodes (name, Perspective perspective) old_version; |
376 val new_version = edit_nodes (name, Perspective perspective) old_version; |
377 in define_version new_id new_version state end; |
377 in define_version new_id new_version state end; |
378 |
378 |
379 |
379 |
380 (* edit *) |
380 (* edits *) |
381 |
381 |
382 local |
382 local |
383 |
383 |
384 fun init_theory deps name node = |
384 fun init_theory deps name node = |
385 let |
385 let |
415 |> pair command_id'; |
415 |> pair command_id'; |
416 in ((exec_id', exec') :: execs, exec') end; |
416 in ((exec_id', exec') :: execs, exec') end; |
417 |
417 |
418 in |
418 in |
419 |
419 |
420 fun edit (old_id: version_id) (new_id: version_id) edits state = |
420 fun update (old_id: version_id) (new_id: version_id) edits state = |
421 let |
421 let |
422 val old_version = the_version state old_id; |
422 val old_version = the_version state old_id; |
423 val _ = Time.now (); (* FIXME odd workaround for polyml-5.4.0/x86_64 *) |
423 val _ = Time.now (); (* FIXME odd workaround for polyml-5.4.0/x86_64 *) |
424 val new_version = fold edit_nodes edits old_version; |
424 val new_version = fold edit_nodes edits old_version; |
425 |
425 |
434 in |
434 in |
435 (case first_entry NONE (after_perspective node orf needs_update node0) node of |
435 (case first_entry NONE (after_perspective node orf needs_update node0) node of |
436 NONE => Future.value (([], [], []), set_touched false node) |
436 NONE => Future.value (([], [], []), set_touched false node) |
437 | SOME (entry as ((prev, id), _)) => |
437 | SOME (entry as ((prev, id), _)) => |
438 (singleton o Future.forks) |
438 (singleton o Future.forks) |
439 {name = "Document.edit", group = NONE, |
439 {name = "Document.update", group = NONE, |
440 deps = map (Future.task_of o #2) deps, pri = 0, interrupts = false} |
440 deps = map (Future.task_of o #2) deps, pri = 0, interrupts = false} |
441 (fn () => |
441 (fn () => |
442 let |
442 let |
443 val update_start = |
443 val update_start = |
444 Option.map (#2 o #1) (first_entry (SOME id) (needs_update node0) node); |
444 Option.map (#2 o #1) (first_entry (SOME id) (needs_update node0) node); |