author | wenzelm |
Fri, 26 Aug 2011 16:06:58 +0200 | |
changeset 44481 | bb42bc831570 |
parent 44479 | 9a04e7502e22 |
child 44484 | 470f2ee5950e |
permissions | -rw-r--r-- |
36676 | 1 |
/* Title: Pure/System/session.scala |
2 |
Author: Makarius |
|
38221 | 3 |
Options: :folding=explicit:collapseFolds=1: |
36676 | 4 |
|
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
5 |
Main Isabelle/Scala session, potentially with running prover process. |
36676 | 6 |
*/ |
34777
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
7 |
|
34871
e596a0b71f3c
incorporate "proofdocument" part into main Isabelle/Pure.jar -- except for html_panel.scala, which depends on external library (Lobo/Cobra browser);
wenzelm
parents:
34859
diff
changeset
|
8 |
package isabelle |
34777
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
9 |
|
43520
cec9b95fa35d
explicit import java.lang.System to prevent odd scope problems;
wenzelm
parents:
43443
diff
changeset
|
10 |
import java.lang.System |
34777
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
11 |
|
34820
a8ba6cde13e9
basic setup for synchronous / modal (!) prover startup;
wenzelm
parents:
34819
diff
changeset
|
12 |
import scala.actors.TIMEOUT |
38226
9d8848d70b0a
maintain editor history independently of Swing thread, which is potentially a bottle-neck or might be unavailable (e.g. in batch mode);
wenzelm
parents:
38222
diff
changeset
|
13 |
import scala.actors.Actor |
34777
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
14 |
import scala.actors.Actor._ |
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
15 |
|
34815
6bae73cd8e33
unified Command and Command_State, eliminated separate Accumulator;
wenzelm
parents:
34813
diff
changeset
|
16 |
|
34791 | 17 |
object Session |
18 |
{ |
|
43716 | 19 |
/* file store */ |
43645 | 20 |
|
21 |
abstract class File_Store |
|
22 |
{ |
|
44163 | 23 |
def append(master_dir: String, path: Path): String |
24 |
def require(file: String): Unit |
|
43645 | 25 |
} |
26 |
||
27 |
||
34813
f0107bc96961
more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents:
34810
diff
changeset
|
28 |
/* events */ |
f0107bc96961
more explicit modeling of Command and Command_State as Session.Entity;
wenzelm
parents:
34810
diff
changeset
|
29 |
|
43716 | 30 |
//{{{ |
34791 | 31 |
case object Global_Settings |
37849 | 32 |
case object Perspective |
38849
2f198d107aef
session_actor: await state assigment of previous change before signalling current change, and avoid crash in overrun situations;
wenzelm
parents:
38848
diff
changeset
|
33 |
case object Assignment |
38360 | 34 |
case class Commands_Changed(set: Set[Command]) |
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
35 |
|
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
36 |
sealed abstract class Phase |
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
37 |
case object Inactive extends Phase |
39701 | 38 |
case object Startup extends Phase // transient |
39 |
case object Failed extends Phase |
|
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
40 |
case object Ready extends Phase |
39701 | 41 |
case object Shutdown extends Phase // transient |
43716 | 42 |
//}}} |
34791 | 43 |
} |
44 |
||
34777
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
45 |
|
43661
39fdbd814c7f
quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents:
43660
diff
changeset
|
46 |
class Session(val file_store: Session.File_Store) |
34777
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
47 |
{ |
37849 | 48 |
/* real time parameters */ // FIXME properties or settings (!?) |
49 |
||
43716 | 50 |
val input_delay = Time.seconds(0.3) // user input (e.g. text edits, cursor movement) |
51 |
val output_delay = Time.seconds(0.1) // prover output (markup, common messages) |
|
52 |
val update_delay = Time.seconds(0.5) // GUI layout updates |
|
37849 | 53 |
|
54 |
||
34809 | 55 |
/* pervasive event buses */ |
56 |
||
57 |
val global_settings = new Event_Bus[Session.Global_Settings.type] |
|
37849 | 58 |
val perspective = new Event_Bus[Session.Perspective.type] |
38849
2f198d107aef
session_actor: await state assigment of previous change before signalling current change, and avoid crash in overrun situations;
wenzelm
parents:
38848
diff
changeset
|
59 |
val assignments = new Event_Bus[Session.Assignment.type] |
43716 | 60 |
val commands_changed = new Event_Bus[Session.Commands_Changed] |
61 |
val phase_changed = new Event_Bus[Session.Phase] |
|
43721
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43720
diff
changeset
|
62 |
val raw_messages = new Event_Bus[Isabelle_Process.Message] |
43716 | 63 |
|
34809 | 64 |
|
65 |
||
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
66 |
/** buffered command changes (delay_first discipline) **/ |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
67 |
|
43716 | 68 |
//{{{ |
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
69 |
private case object Stop |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
70 |
|
39572 | 71 |
private val (_, command_change_buffer) = |
72 |
Simple_Thread.actor("command_change_buffer", daemon = true) |
|
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
73 |
{ |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
74 |
var changed: Set[Command] = Set() |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
75 |
var flush_time: Option[Long] = None |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
76 |
|
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
77 |
def flush_timeout: Long = |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
78 |
flush_time match { |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
79 |
case None => 5000L |
40848
8662b9b1f123
more abstract/uniform handling of time, preferring seconds as Double;
wenzelm
parents:
40566
diff
changeset
|
80 |
case Some(time) => (time - System.currentTimeMillis()) max 0 |
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
81 |
} |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
82 |
|
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
83 |
def flush() |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
84 |
{ |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
85 |
if (!changed.isEmpty) commands_changed.event(Session.Commands_Changed(changed)) |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
86 |
changed = Set() |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
87 |
flush_time = None |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
88 |
} |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
89 |
|
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
90 |
def invoke() |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
91 |
{ |
40848
8662b9b1f123
more abstract/uniform handling of time, preferring seconds as Double;
wenzelm
parents:
40566
diff
changeset
|
92 |
val now = System.currentTimeMillis() |
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
93 |
flush_time match { |
40848
8662b9b1f123
more abstract/uniform handling of time, preferring seconds as Double;
wenzelm
parents:
40566
diff
changeset
|
94 |
case None => flush_time = Some(now + output_delay.ms) |
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
95 |
case Some(time) => if (now >= time) flush() |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
96 |
} |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
97 |
} |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
98 |
|
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
99 |
var finished = false |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
100 |
while (!finished) { |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
101 |
receiveWithin(flush_timeout) { |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
102 |
case command: Command => changed += command; invoke() |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
103 |
case TIMEOUT => flush() |
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
104 |
case Stop => finished = true; reply(()) |
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
105 |
case bad => System.err.println("command_change_buffer: ignoring bad message " + bad) |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
106 |
} |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
107 |
} |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
108 |
} |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
109 |
//}}} |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
110 |
|
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
111 |
|
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
112 |
|
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
113 |
/** main protocol actor **/ |
34809 | 114 |
|
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
115 |
/* global state */ |
43644 | 116 |
|
43716 | 117 |
@volatile var verbose: Boolean = false |
118 |
||
119 |
@volatile private var loaded_theories: Set[String] = Set() |
|
43673
29eb1cd29961
Thy_Info.dependencies: ignore already loaded theories, according to initial prover session status;
wenzelm
parents:
43662
diff
changeset
|
120 |
|
43695
5130dfe1b7be
simplified Symbol based on lazy Symbol.Interpretation -- reduced odd "functorial style";
wenzelm
parents:
43673
diff
changeset
|
121 |
@volatile private var syntax = new Outer_Syntax |
38569 | 122 |
def current_syntax(): Outer_Syntax = syntax |
34809 | 123 |
|
39626
a5d0bcfb95a3
manage persistent syslog via Session, not Isabelle_Process;
wenzelm
parents:
39625
diff
changeset
|
124 |
@volatile private var reverse_syslog = List[XML.Elem]() |
39629 | 125 |
def syslog(): String = reverse_syslog.reverse.map(msg => XML.content(msg).mkString).mkString("\n") |
39626
a5d0bcfb95a3
manage persistent syslog via Session, not Isabelle_Process;
wenzelm
parents:
39625
diff
changeset
|
126 |
|
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
127 |
@volatile private var _phase: Session.Phase = Session.Inactive |
39633 | 128 |
private def phase_=(new_phase: Session.Phase) |
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
129 |
{ |
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
130 |
_phase = new_phase |
39701 | 131 |
phase_changed.event(new_phase) |
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
132 |
} |
43716 | 133 |
def phase = _phase |
43553 | 134 |
def is_ready: Boolean = phase == Session.Ready |
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
135 |
|
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
136 |
private val global_state = new Volatile(Document.State.init) |
43719 | 137 |
def current_state(): Document.State = global_state() |
34816
d33312514220
maintain generic session entities -- cover commands, states, etc. (but not yet documents);
wenzelm
parents:
34815
diff
changeset
|
138 |
|
43716 | 139 |
def snapshot(name: String, pending_edits: List[Text.Edit]): Document.Snapshot = |
43719 | 140 |
global_state().snapshot(name, pending_edits) |
43716 | 141 |
|
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
142 |
|
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
143 |
/* theory files */ |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
144 |
|
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
145 |
val thy_load = new Thy_Load |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
146 |
{ |
43673
29eb1cd29961
Thy_Info.dependencies: ignore already loaded theories, according to initial prover session status;
wenzelm
parents:
43662
diff
changeset
|
147 |
override def is_loaded(name: String): Boolean = |
29eb1cd29961
Thy_Info.dependencies: ignore already loaded theories, according to initial prover session status;
wenzelm
parents:
43662
diff
changeset
|
148 |
loaded_theories.contains(name) |
29eb1cd29961
Thy_Info.dependencies: ignore already loaded theories, according to initial prover session status;
wenzelm
parents:
43662
diff
changeset
|
149 |
|
44159 | 150 |
override def check_thy(dir: Path, name: String): (String, Thy_Header) = |
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
151 |
{ |
43661
39fdbd814c7f
quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents:
43660
diff
changeset
|
152 |
val file = Isabelle_System.platform_file(dir + Thy_Header.thy_path(name)) |
43652 | 153 |
if (!file.exists || !file.isFile) error("No such file: " + quote(file.toString)) |
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
154 |
val text = Standard_System.read_file(file) |
43661
39fdbd814c7f
quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents:
43660
diff
changeset
|
155 |
val header = Thy_Header.read(text) |
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
156 |
(text, header) |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
157 |
} |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
158 |
} |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
159 |
|
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
160 |
val thy_info = new Thy_Info(thy_load) |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
161 |
|
44442
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
162 |
def header_edit(name: String, master_dir: String, |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
163 |
header: Document.Node_Header): Document.Edit_Text = |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
164 |
{ |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
165 |
def norm_import(s: String): String = |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
166 |
{ |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
167 |
val thy_name = Thy_Header.base_name(s) |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
168 |
if (thy_load.is_loaded(thy_name)) thy_name |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
169 |
else file_store.append(master_dir, Thy_Header.thy_path(Path.explode(s))) |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
170 |
} |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
171 |
def norm_use(s: String): String = |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
172 |
file_store.append(master_dir, Path.explode(s)) |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
173 |
|
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
174 |
val header1: Document.Node_Header = |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
175 |
header match { |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
176 |
case Exn.Res(Thy_Header(thy_name, _, _)) |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
177 |
if (thy_load.is_loaded(thy_name)) => |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
178 |
Exn.Exn(ERROR("Attempt to update loaded theory " + quote(thy_name))) |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
179 |
case _ => Document.Node.norm_header(norm_import, norm_use, header) |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
180 |
} |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
181 |
(name, Document.Node.Header(header1)) |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
182 |
} |
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
183 |
|
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
184 |
|
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
185 |
/* actor messages */ |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43649
diff
changeset
|
186 |
|
43716 | 187 |
private case class Start(timeout: Time, args: List[String]) |
188 |
private case object Interrupt |
|
44385
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
189 |
private case class Init_Node(name: String, master_dir: String, |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
190 |
header: Document.Node_Header, perspective: Text.Perspective, text: String) |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
191 |
private case class Edit_Node(name: String, master_dir: String, |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
192 |
header: Document.Node_Header, perspective: Text.Perspective, edits: List[Text.Edit]) |
43722 | 193 |
private case class Change_Node( |
194 |
name: String, |
|
195 |
doc_edits: List[Document.Edit_Command], |
|
196 |
previous: Document.Version, |
|
197 |
version: Document.Version) |
|
41534 | 198 |
|
39572 | 199 |
private val (_, session_actor) = Simple_Thread.actor("session_actor", daemon = true) |
38639
f642faca303e
main session actor as independent thread, to avoid starvation via regular worker pool;
wenzelm
parents:
38569
diff
changeset
|
200 |
{ |
43648 | 201 |
val this_actor = self |
43649 | 202 |
var prover: Option[Isabelle_Process with Isar_Document] = None |
34809 | 203 |
|
204 |
||
44436
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
205 |
/* perspective */ |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
206 |
|
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
207 |
def update_perspective(name: String, text_perspective: Text.Perspective) |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
208 |
{ |
44475 | 209 |
val previous = global_state().tip_version |
44436
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
210 |
val (perspective, version) = Thy_Syntax.edit_perspective(previous, name, text_perspective) |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
211 |
|
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
212 |
val text_edits: List[Document.Edit_Text] = |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
213 |
List((name, Document.Node.Perspective(text_perspective))) |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
214 |
val change = |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
215 |
global_state.change_yield( |
44446 | 216 |
_.continue_history(Future.value(previous), text_edits, Future.value(version))) |
44436
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
217 |
|
44477 | 218 |
val assignment = global_state().the_assignment(previous).check_finished |
44479
9a04e7502e22
refined document state assignment: observe perspective, more explicit assignment message;
wenzelm
parents:
44477
diff
changeset
|
219 |
global_state.change(_.define_version(version, assignment)) |
44476
e8a87398f35d
propagate information about last command with exec state assignment through document model;
wenzelm
parents:
44475
diff
changeset
|
220 |
global_state.change_yield(_.assign(version.id, Document.no_assign)) |
44436
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
221 |
|
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
222 |
prover.get.update_perspective(previous.id, version.id, name, perspective) |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
223 |
} |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
224 |
|
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
225 |
|
43716 | 226 |
/* incoming edits */ |
227 |
||
44182 | 228 |
def handle_edits(name: String, master_dir: String, |
44384 | 229 |
header: Document.Node_Header, edits: List[Document.Node.Edit[Text.Edit, Text.Perspective]]) |
43716 | 230 |
//{{{ |
231 |
{ |
|
232 |
val syntax = current_syntax() |
|
43719 | 233 |
val previous = global_state().history.tip.version |
44185 | 234 |
|
44442
cb18e4f09053
clarified norm_header/header_edit -- disallow update of loaded theories;
wenzelm
parents:
44436
diff
changeset
|
235 |
val text_edits = header_edit(name, master_dir, header) :: edits.map(edit => (name, edit)) |
44185 | 236 |
val result = Future.fork { Thy_Syntax.text_edits(syntax, previous.join, text_edits) } |
43722 | 237 |
val change = |
44446 | 238 |
global_state.change_yield(_.continue_history(previous, text_edits, result.map(_._2))) |
43716 | 239 |
|
43722 | 240 |
result.map { |
44157
a21d3e1e64fd
uniform treatment of header edits as document edits;
wenzelm
parents:
44156
diff
changeset
|
241 |
case (doc_edits, _) => |
43722 | 242 |
assignments.await { global_state().is_assigned(previous.get_finished) } |
44157
a21d3e1e64fd
uniform treatment of header edits as document edits;
wenzelm
parents:
44156
diff
changeset
|
243 |
this_actor ! Change_Node(name, doc_edits, previous.join, change.version.join) |
43722 | 244 |
} |
43716 | 245 |
} |
246 |
//}}} |
|
247 |
||
248 |
||
44436
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
249 |
/* exec state assignment */ |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
250 |
|
44476
e8a87398f35d
propagate information about last command with exec state assignment through document model;
wenzelm
parents:
44475
diff
changeset
|
251 |
def handle_assign(id: Document.Version_ID, assign: Document.Assign) |
44436
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
252 |
//{{{ |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
253 |
{ |
44476
e8a87398f35d
propagate information about last command with exec state assignment through document model;
wenzelm
parents:
44475
diff
changeset
|
254 |
val cmds = global_state.change_yield(_.assign(id, assign)) |
44436
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
255 |
for (cmd <- cmds) command_change_buffer ! cmd |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
256 |
assignments.event(Session.Assignment) |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
257 |
} |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
258 |
//}}} |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
259 |
|
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
260 |
|
43716 | 261 |
/* resulting changes */ |
34809 | 262 |
|
43722 | 263 |
def handle_change(change: Change_Node) |
38221 | 264 |
//{{{ |
34809 | 265 |
{ |
43722 | 266 |
val previous = change.previous |
267 |
val version = change.version |
|
268 |
val name = change.name |
|
269 |
val doc_edits = change.doc_edits |
|
38366
fea82d1add74
simplified/clarified Change: transition prev --edits--> result, based on futures;
wenzelm
parents:
38365
diff
changeset
|
270 |
|
44383 | 271 |
def id_command(command: Command) |
43720 | 272 |
{ |
273 |
if (global_state().lookup_command(command.id).isEmpty) { |
|
274 |
global_state.change(_.define_command(command)) |
|
275 |
prover.get.define_command(command.id, Symbol.encode(command.source)) |
|
276 |
} |
|
277 |
} |
|
44383 | 278 |
doc_edits foreach { |
279 |
case (_, edit) => |
|
280 |
edit foreach { case (c1, c2) => c1 foreach id_command; c2 foreach id_command } |
|
281 |
} |
|
43722 | 282 |
|
44479
9a04e7502e22
refined document state assignment: observe perspective, more explicit assignment message;
wenzelm
parents:
44477
diff
changeset
|
283 |
val assignment = global_state().the_assignment(previous).check_finished |
9a04e7502e22
refined document state assignment: observe perspective, more explicit assignment message;
wenzelm
parents:
44477
diff
changeset
|
284 |
global_state.change(_.define_version(version, assignment)) |
44481 | 285 |
prover.get.update(previous.id, version.id, doc_edits) |
34809 | 286 |
} |
38221 | 287 |
//}}} |
34809 | 288 |
|
289 |
||
290 |
/* prover results */ |
|
291 |
||
292 |
def handle_result(result: Isabelle_Process.Result) |
|
38221 | 293 |
//{{{ |
34809 | 294 |
{ |
43716 | 295 |
def bad_result(result: Isabelle_Process.Result) |
296 |
{ |
|
297 |
if (verbose) |
|
298 |
System.err.println("Ignoring prover result: " + result.message.toString) |
|
299 |
} |
|
300 |
||
38722
ba31936497c2
organized markup properties via apply/unapply patterns;
wenzelm
parents:
38639
diff
changeset
|
301 |
result.properties match { |
43748 | 302 |
case Position.Id(state_id) if !result.is_raw => |
38370
8b15d0f98962
explicit Document.State value, instead of individual state variables in Session, Command, Document;
wenzelm
parents:
38366
diff
changeset
|
303 |
try { |
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
304 |
val st = global_state.change_yield(_.accumulate(state_id, result.message)) |
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
305 |
command_change_buffer ! st.command |
38370
8b15d0f98962
explicit Document.State value, instead of individual state variables in Session, Command, Document;
wenzelm
parents:
38366
diff
changeset
|
306 |
} |
43748 | 307 |
catch { |
308 |
case _: Document.State.Fail => bad_result(result) |
|
309 |
} |
|
310 |
case Markup.Invoke_Scala(name, id) if result.is_raw => |
|
311 |
Future.fork { |
|
312 |
val arg = XML.content(result.body).mkString |
|
313 |
val (tag, res) = Invoke_Scala.method(name, arg) |
|
314 |
prover.get.invoke_scala(id, tag, res) |
|
315 |
} |
|
44298
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
44225
diff
changeset
|
316 |
case Markup.Cancel_Scala(id) => |
b8f8488704e2
Future.promise: explicit abort operation (like uninterruptible future job);
wenzelm
parents:
44225
diff
changeset
|
317 |
System.err.println("cancel_scala " + id) // FIXME cancel JVM task |
38722
ba31936497c2
organized markup properties via apply/unapply patterns;
wenzelm
parents:
38639
diff
changeset
|
318 |
case _ => |
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
319 |
if (result.is_syslog) { |
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
320 |
reverse_syslog ::= result.message |
40533
e38e80686ce5
somewhat adhoc replacement for 'thus' and 'hence';
wenzelm
parents:
40479
diff
changeset
|
321 |
if (result.is_ready) { |
43716 | 322 |
// FIXME move to ML side (!?) |
40533
e38e80686ce5
somewhat adhoc replacement for 'thus' and 'hence';
wenzelm
parents:
40479
diff
changeset
|
323 |
syntax += ("hence", Keyword.PRF_ASM_GOAL, "then have") |
e38e80686ce5
somewhat adhoc replacement for 'thus' and 'hence';
wenzelm
parents:
40479
diff
changeset
|
324 |
syntax += ("thus", Keyword.PRF_ASM_GOAL, "then show") |
e38e80686ce5
somewhat adhoc replacement for 'thus' and 'hence';
wenzelm
parents:
40479
diff
changeset
|
325 |
phase = Session.Ready |
e38e80686ce5
somewhat adhoc replacement for 'thus' and 'hence';
wenzelm
parents:
40479
diff
changeset
|
326 |
} |
39701 | 327 |
else if (result.is_exit && phase == Session.Startup) phase = Session.Failed |
39696 | 328 |
else if (result.is_exit) phase = Session.Inactive |
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
329 |
} |
39626
a5d0bcfb95a3
manage persistent syslog via Session, not Isabelle_Process;
wenzelm
parents:
39625
diff
changeset
|
330 |
else if (result.is_stdout) { } |
39625 | 331 |
else if (result.is_status) { |
38370
8b15d0f98962
explicit Document.State value, instead of individual state variables in Session, Command, Document;
wenzelm
parents:
38366
diff
changeset
|
332 |
result.body match { |
44476
e8a87398f35d
propagate information about last command with exec state assignment through document model;
wenzelm
parents:
44475
diff
changeset
|
333 |
case List(Isar_Document.Assign(id, assign)) => |
e8a87398f35d
propagate information about last command with exec state assignment through document model;
wenzelm
parents:
44475
diff
changeset
|
334 |
try { handle_assign(id, assign) } |
38414
49f1f657adc2
more basic Markup.parse_int/print_int (using signed_string_of_int) (ML);
wenzelm
parents:
38413
diff
changeset
|
335 |
catch { case _: Document.State.Fail => bad_result(result) } |
38370
8b15d0f98962
explicit Document.State value, instead of individual state variables in Session, Command, Document;
wenzelm
parents:
38366
diff
changeset
|
336 |
case List(Keyword.Command_Decl(name, kind)) => syntax += (name, kind) |
8b15d0f98962
explicit Document.State value, instead of individual state variables in Session, Command, Document;
wenzelm
parents:
38366
diff
changeset
|
337 |
case List(Keyword.Keyword_Decl(name)) => syntax += name |
43673
29eb1cd29961
Thy_Info.dependencies: ignore already loaded theories, according to initial prover session status;
wenzelm
parents:
43662
diff
changeset
|
338 |
case List(Thy_Info.Loaded_Theory(name)) => loaded_theories += name |
39625 | 339 |
case _ => bad_result(result) |
38370
8b15d0f98962
explicit Document.State value, instead of individual state variables in Session, Command, Document;
wenzelm
parents:
38366
diff
changeset
|
340 |
} |
8b15d0f98962
explicit Document.State value, instead of individual state variables in Session, Command, Document;
wenzelm
parents:
38366
diff
changeset
|
341 |
} |
39625 | 342 |
else bad_result(result) |
43748 | 343 |
} |
34809 | 344 |
} |
38221 | 345 |
//}}} |
34809 | 346 |
|
34820
a8ba6cde13e9
basic setup for synchronous / modal (!) prover startup;
wenzelm
parents:
34819
diff
changeset
|
347 |
|
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
348 |
/* main loop */ |
34809 | 349 |
|
43716 | 350 |
//{{{ |
38639
f642faca303e
main session actor as independent thread, to avoid starvation via regular worker pool;
wenzelm
parents:
38569
diff
changeset
|
351 |
var finished = false |
f642faca303e
main session actor as independent thread, to avoid starvation via regular worker pool;
wenzelm
parents:
38569
diff
changeset
|
352 |
while (!finished) { |
f642faca303e
main session actor as independent thread, to avoid starvation via regular worker pool;
wenzelm
parents:
38569
diff
changeset
|
353 |
receive { |
43649 | 354 |
case Start(timeout, args) if prover.isEmpty => |
39701 | 355 |
if (phase == Session.Inactive || phase == Session.Failed) { |
356 |
phase = Session.Startup |
|
43661
39fdbd814c7f
quasi-static Isabelle_System -- reduced tendency towards "functorial style";
wenzelm
parents:
43660
diff
changeset
|
357 |
prover = Some(new Isabelle_Process(timeout, this_actor, args:_*) with Isar_Document) |
39701 | 358 |
} |
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
359 |
|
39701 | 360 |
case Stop => |
361 |
if (phase == Session.Ready) { |
|
362 |
global_state.change(_ => Document.State.init) // FIXME event bus!? |
|
363 |
phase = Session.Shutdown |
|
43649 | 364 |
prover.get.terminate |
43717 | 365 |
prover = None |
39701 | 366 |
phase = Session.Inactive |
367 |
} |
|
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
368 |
finished = true |
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
369 |
reply(()) |
38850
5c3e5c548f12
session_actor: ignore spurious TIMEOUT (again) -- probably stemming from earlier use of receiveWithin;
wenzelm
parents:
38849
diff
changeset
|
370 |
|
43717 | 371 |
case Interrupt if prover.isDefined => |
372 |
prover.get.interrupt |
|
43716 | 373 |
|
44385
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
374 |
case Init_Node(name, master_dir, header, perspective, text) if prover.isDefined => |
43716 | 375 |
// FIXME compare with existing node |
44182 | 376 |
handle_edits(name, master_dir, header, |
44385
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
377 |
List(Document.Node.Clear(), |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
378 |
Document.Node.Edits(List(Text.Edit.insert(0, text))), |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
379 |
Document.Node.Perspective(perspective))) |
43716 | 380 |
reply(()) |
381 |
||
44385
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
382 |
case Edit_Node(name, master_dir, header, perspective, text_edits) if prover.isDefined => |
44479
9a04e7502e22
refined document state assignment: observe perspective, more explicit assignment message;
wenzelm
parents:
44477
diff
changeset
|
383 |
// FIXME |
9a04e7502e22
refined document state assignment: observe perspective, more explicit assignment message;
wenzelm
parents:
44477
diff
changeset
|
384 |
// if (text_edits.isEmpty && global_state().tip_stable) |
9a04e7502e22
refined document state assignment: observe perspective, more explicit assignment message;
wenzelm
parents:
44477
diff
changeset
|
385 |
// update_perspective(name, perspective) |
9a04e7502e22
refined document state assignment: observe perspective, more explicit assignment message;
wenzelm
parents:
44477
diff
changeset
|
386 |
// else |
44436
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
387 |
handle_edits(name, master_dir, header, |
546adfa8a6fc
update_perspective without actual edits, bypassing the full state assignment protocol;
wenzelm
parents:
44385
diff
changeset
|
388 |
List(Document.Node.Edits(text_edits), Document.Node.Perspective(perspective))) |
43718 | 389 |
reply(()) |
390 |
||
43722 | 391 |
case change: Change_Node if prover.isDefined => |
392 |
handle_change(change) |
|
43716 | 393 |
|
43721
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43720
diff
changeset
|
394 |
case input: Isabelle_Process.Input => |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43720
diff
changeset
|
395 |
raw_messages.event(input) |
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43720
diff
changeset
|
396 |
|
43716 | 397 |
case result: Isabelle_Process.Result => |
398 |
handle_result(result) |
|
43721
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents:
43720
diff
changeset
|
399 |
raw_messages.event(result) |
43716 | 400 |
|
43717 | 401 |
case bad => System.err.println("session_actor: ignoring bad message " + bad) |
34777
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
402 |
} |
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
403 |
} |
43716 | 404 |
//}}} |
34777
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
405 |
} |
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
406 |
|
34809 | 407 |
|
43716 | 408 |
/* actions */ |
34809 | 409 |
|
40848
8662b9b1f123
more abstract/uniform handling of time, preferring seconds as Double;
wenzelm
parents:
40566
diff
changeset
|
410 |
def start(timeout: Time, args: List[String]) { session_actor ! Start(timeout, args) } |
34820
a8ba6cde13e9
basic setup for synchronous / modal (!) prover startup;
wenzelm
parents:
34819
diff
changeset
|
411 |
|
39630
44181423183a
explicit Session.Phase indication with associated event bus;
wenzelm
parents:
39629
diff
changeset
|
412 |
def stop() { command_change_buffer !? Stop; session_actor !? Stop } |
38841
4df7b76249a0
include Document.History in Document.State -- just one universal session state maintained by main actor;
wenzelm
parents:
38722
diff
changeset
|
413 |
|
43716 | 414 |
def interrupt() { session_actor ! Interrupt } |
43648 | 415 |
|
44385
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
416 |
// FIXME simplify signature |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
417 |
def init_node(name: String, master_dir: String, |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
418 |
header: Document.Node_Header, perspective: Text.Perspective, text: String) |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
419 |
{ session_actor !? Init_Node(name, master_dir, header, perspective, text) } |
38221 | 420 |
|
44385
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
421 |
// FIXME simplify signature |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
422 |
def edit_node(name: String, master_dir: String, header: Document.Node_Header, |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
423 |
perspective: Text.Perspective, edits: List[Text.Edit]) |
e7fdb008aa7d
propagate editor perspective through document model;
wenzelm
parents:
44384
diff
changeset
|
424 |
{ session_actor !? Edit_Node(name, master_dir, header, perspective, edits) } |
34777
91d6089cef88
class Session models full session, with or without prover process (cf. heaps, browser_info);
wenzelm
parents:
diff
changeset
|
425 |
} |