eliminate instance of currying/partial application with constant value (a constant mailbox) is shell/shell.sml
This commit is contained in:
@@ -73,7 +73,7 @@ struct
|
|||||||
val buffer = LineGap.goToIdx (origIdx, buffer)
|
val buffer = LineGap.goToIdx (origIdx, buffer)
|
||||||
val searchList = SearchList.goToNum (origIdx, searchList)
|
val searchList = SearchList.goToNum (origIdx, searchList)
|
||||||
in
|
in
|
||||||
(* todo: probably change return type to (buffer * searchList) later *)
|
(* todo: probably change return type to (buffer * searchList) *)
|
||||||
AppWith.searchList (app, searchList, buffer, searchString)
|
AppWith.searchList (app, searchList, buffer, searchString)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,10 +3,14 @@ struct
|
|||||||
open CML
|
open CML
|
||||||
open InputMsg
|
open InputMsg
|
||||||
|
|
||||||
fun frameBufferSizeCallback inputMailbox (width, height) =
|
(* create mailboxes for CML communication *)
|
||||||
|
val inputMailbox = Mailbox.mailbox ()
|
||||||
|
val drawMailbox = Mailbox.mailbox ()
|
||||||
|
|
||||||
|
fun frameBufferSizeCallback (width, height) =
|
||||||
Mailbox.send (inputMailbox, RESIZE_EVENT (width, height))
|
Mailbox.send (inputMailbox, RESIZE_EVENT (width, height))
|
||||||
|
|
||||||
fun charCallback inputMailbox word =
|
fun charCallback word =
|
||||||
let
|
let
|
||||||
val word = Word32.toInt word
|
val word = Word32.toInt word
|
||||||
val chr = Char.chr word
|
val chr = Char.chr word
|
||||||
@@ -14,7 +18,7 @@ struct
|
|||||||
Mailbox.send (inputMailbox, CHAR_EVENT chr)
|
Mailbox.send (inputMailbox, CHAR_EVENT chr)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun keyCallback inputMailbox (key, scancode, action, mods) =
|
fun keyCallback (key, scancode, action, mods) =
|
||||||
let
|
let
|
||||||
open Input
|
open Input
|
||||||
in
|
in
|
||||||
@@ -24,17 +28,14 @@ struct
|
|||||||
()
|
()
|
||||||
end
|
end
|
||||||
|
|
||||||
fun registerCallbacks (inputMailbox, window) =
|
fun registerCallbacks window =
|
||||||
let
|
let
|
||||||
val resizeCallback = frameBufferSizeCallback inputMailbox
|
val () = Input.exportFramebufferSizeCallback frameBufferSizeCallback
|
||||||
val () = Input.exportFramebufferSizeCallback resizeCallback
|
|
||||||
val () = Input.setFramebufferSizeCallback window
|
val () = Input.setFramebufferSizeCallback window
|
||||||
|
|
||||||
val charCallback = charCallback inputMailbox
|
|
||||||
val () = Input.exportCharCallback charCallback
|
val () = Input.exportCharCallback charCallback
|
||||||
val () = Input.setCharCallback window
|
val () = Input.setCharCallback window
|
||||||
|
|
||||||
val keyCallback = keyCallback inputMailbox
|
|
||||||
val () = Input.exportKeyCallback keyCallback
|
val () = Input.exportKeyCallback keyCallback
|
||||||
val () = Input.setKeyCallback window
|
val () = Input.setKeyCallback window
|
||||||
in
|
in
|
||||||
@@ -66,11 +67,7 @@ struct
|
|||||||
(* todo: remove temp line below which tests search list *)
|
(* todo: remove temp line below which tests search list *)
|
||||||
val app = BuildSearchList.fromStart (app, 0, lineGap, "val ")
|
val app = BuildSearchList.fromStart (app, 0, lineGap, "val ")
|
||||||
|
|
||||||
(* create mailboxes for CML communication *)
|
val () = registerCallbacks window
|
||||||
val inputMailbox = Mailbox.mailbox ()
|
|
||||||
val drawMailbox = Mailbox.mailbox ()
|
|
||||||
|
|
||||||
val () = registerCallbacks (inputMailbox, window)
|
|
||||||
|
|
||||||
val _ = CML.spawn (fn () => GlDraw.loop (drawMailbox, window))
|
val _ = CML.spawn (fn () => GlDraw.loop (drawMailbox, window))
|
||||||
val _ = CML.spawn (fn () =>
|
val _ = CML.spawn (fn () =>
|
||||||
|
|||||||
Reference in New Issue
Block a user