add app poking to stdio

This commit is contained in:
Philip Monk 2019-05-28 13:23:06 -07:00
parent 2fd87c815b
commit 9d1e8601e3
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
5 changed files with 66 additions and 9 deletions

View File

@ -13,7 +13,11 @@
$: top-comments=(list tape)
==
+$ command cord
++ tapp (^tapp state command)
+$ poke-data
$% [%noun cord]
==
++ tapp (^tapp state command poke-data)
++ stdio (^stdio poke-data)
--
=>
|%

30
app/sitter.hoon Normal file
View File

@ -0,0 +1,30 @@
/+ tapp, stdio
=>
|%
+$ subscription-state
$: her=ship
app=term
==
+$ state
$: subscription=(unit subscription-state)
==
+$ command cord
+$ poke-data
$% [%noun cord]
==
++ tapp (^tapp state command poke-data)
++ stdio (^stdio poke-data)
--
=, trad=trad:tapp
=, tapp-trad=tapp-trad:tapp
=, stdio
%- create-tapp:tapp
^- tapp-core:tapp
|_ [=bowl:gall state]
++ handle-command
|= =command
=/ m tapp-trad
^- form:m
;< ~ bind:m (poke-app [our.bowl %baby] %noun 'print')
(pure:m subscription)
--

View File

@ -12,6 +12,8 @@
::
/- tapp-sur=tapp
/+ trad
|* poke-data=mold
=/ tapp-sur (tapp-sur poke-data)
=, card=card:tapp-sur
=, sign=sign:tapp-sur
=, contract=contract:tapp-sur
@ -36,6 +38,15 @@
|= trad-input
[~ ~ (silt [add contract]~) %done ~]
::
:: Send effect
::
++ send-effect
|= =card
=/ m (trad ,~)
^- form:m
|= trad-input
[~ [card]~ ~ %done ~]
::
:: ----
::
:: HTTP requests
@ -181,4 +192,14 @@
?. ?=(%cont -.next.c-res)
c-res
c-res(self.next ..loop(computation self.next.c-res))
::
:: ----
::
:: Apps
::
++ poke-app
|= [[her=ship app=term] =poke-data]
=/ m (trad ,~)
^- form:m
(send-effect %poke / [her app] poke-data)
--

View File

@ -1,11 +1,11 @@
/- tapp
/- tapp-sur=tapp
/+ trad
=, card=card:tapp
=, sign=sign:tapp
=, contract=contract:tapp
=, trad-lib=trad
|* [state-type=mold command-type=mold]
|* [state-type=mold command-type=mold poke-data=mold]
|%
++ tapp-sur (^tapp-sur poke-data)
++ card card:tapp-sur
++ sign sign:tapp-sur
++ contract contract:tapp-sur
::
:: The form of a tapp
::
@ -17,7 +17,7 @@
*form:tapp-trad
--
::
++ trad-lib (^trad-lib sign card contract)
++ trad-lib (^trad sign card contract)
++ trad trad:trad-lib
::
+$ move (pair bone card)
@ -34,7 +34,7 @@
++ prep
|= old-state=*
^- (quip move _this-tapp)
~& %tapp-loaded
~& [%tapp-loaded dap.bowl]
=/ old ((soft tapp-state) old-state)
?~ old
`this-tapp

View File

@ -1,3 +1,4 @@
|* poke-data=mold
|%
::
:: Possible async calls
@ -7,6 +8,7 @@
[%them wire ~]
[%wait wire @da]
[%rest wire @da]
[%poke wire dock poke-data]
==
::
:: Possible async responses