2024-10-06 09:32:56 +01:00
|
|
|
structure UpdateThread =
|
|
|
|
|
struct
|
|
|
|
|
open CML
|
|
|
|
|
open MailboxType
|
2025-08-04 09:29:37 +01:00
|
|
|
open InputMsg
|
2024-10-06 09:32:56 +01:00
|
|
|
|
2025-09-10 01:41:59 +01:00
|
|
|
fun sendMsg msg =
|
2025-08-07 12:20:57 +01:00
|
|
|
case msg of
|
2025-09-10 01:41:59 +01:00
|
|
|
DRAW msg => DrawMailbox.append msg
|
2025-09-07 13:24:41 +01:00
|
|
|
| SEARCH (buffer, searchString, time) =>
|
2025-09-10 01:41:59 +01:00
|
|
|
Mailbox.send (SearchMailbox.mailbox, (buffer, searchString, time))
|
2024-10-06 09:32:56 +01:00
|
|
|
|
2025-09-10 01:41:59 +01:00
|
|
|
fun sendMsgs msgList =
|
2024-10-06 09:32:56 +01:00
|
|
|
case msgList of
|
2025-09-10 01:41:59 +01:00
|
|
|
hd :: tl => let val () = sendMsg hd in sendMsgs tl end
|
2024-10-06 09:32:56 +01:00
|
|
|
| [] => ()
|
|
|
|
|
|
2025-09-10 01:41:59 +01:00
|
|
|
fun update (app: AppType.app_type, inputMsg) =
|
2024-10-06 09:32:56 +01:00
|
|
|
let
|
2025-08-20 12:50:39 +01:00
|
|
|
val time = Time.now ()
|
2025-08-04 09:29:37 +01:00
|
|
|
|
2025-08-04 09:03:47 +01:00
|
|
|
val () = ExceptionLogger.addCommand inputMsg
|
2025-08-04 06:23:52 +01:00
|
|
|
|
2025-08-20 12:50:39 +01:00
|
|
|
val app = AppUpdate.update (app, inputMsg, time)
|
2025-08-06 00:16:50 +01:00
|
|
|
handle e => ExceptionLogger.log e
|
2025-08-03 13:14:28 +01:00
|
|
|
|
2025-09-10 01:41:59 +01:00
|
|
|
val () = sendMsgs (#msgs app)
|
2024-10-06 09:32:56 +01:00
|
|
|
in
|
2025-09-10 01:41:59 +01:00
|
|
|
app
|
2024-10-06 09:32:56 +01:00
|
|
|
end
|
|
|
|
|
end
|