mirror of
https://github.com/urbit/shrub.git
synced 2024-12-11 11:02:25 +03:00
gall: clean up +mo-{boot, away, awed}
Also removes the superfluous +mo-baal and +mo-baba, most of the implementations of which can be replaced with simple stdlib functions.
This commit is contained in:
parent
45185774e5
commit
77b3eb6b4a
@ -264,21 +264,36 @@
|
|||||||
%_ mo-state
|
%_ mo-state
|
||||||
bum.mas (~(put by bum.mas) dude new-seat)
|
bum.mas (~(put by bum.mas) dude new-seat)
|
||||||
==
|
==
|
||||||
|
::
|
||||||
:: +mo-boot: sends an %exec to ford.
|
:: +mo-boot: sends an %exec to ford.
|
||||||
::
|
::
|
||||||
++ mo-boot :: create ship
|
++ mo-boot
|
||||||
|= {dap/dude byk/beak}
|
|= [=dude =beak]
|
||||||
^+ +>
|
^+ mo-state
|
||||||
%+ mo-pass [%sys %core dap (scot %p p.byk) q.byk (scot r.byk) ~]
|
::
|
||||||
^- note-arvo
|
=/ =path
|
||||||
[%f %build live=%.y [%core [[p q]:byk [%hoon dap %app ~]]]]
|
=/ ship (scot %p p.beak)
|
||||||
|
=/ desk q.beak
|
||||||
|
=/ case (scot r.beak)
|
||||||
|
/sys/core/[dude]/[ship]/[desk]/[case]
|
||||||
|
::
|
||||||
|
=/ =note-arvo
|
||||||
|
=/ disc [p q]:beak
|
||||||
|
=/ spur /hoon/[dude]/app
|
||||||
|
=/ schematic [%core disc spur]
|
||||||
|
[%f %build live=%.y schematic]
|
||||||
|
::
|
||||||
|
=/ pass [path note-arvo]
|
||||||
|
(mo-pass pass)
|
||||||
::
|
::
|
||||||
++ mo-away :: foreign request
|
:: +mo-away: handle a foreign request.
|
||||||
|
::
|
||||||
|
++ mo-away
|
||||||
~/ %mo-away
|
~/ %mo-away
|
||||||
|= {him/ship caz/cush} ::
|
|= [=ship =cush]
|
||||||
^+ +>
|
^+ mo-state
|
||||||
:: ~& [%mo-away him caz]
|
::
|
||||||
?: ?=($pump -.q.caz)
|
?: ?=(%pump -.q.cush)
|
||||||
::
|
::
|
||||||
:: you'd think this would send an ack for the diff
|
:: you'd think this would send an ack for the diff
|
||||||
:: that caused this pump. it would, but we already
|
:: that caused this pump. it would, but we already
|
||||||
@ -286,45 +301,54 @@
|
|||||||
:: we'd have to save the network duct and connect it
|
:: we'd have to save the network duct and connect it
|
||||||
:: to this returning pump.
|
:: to this returning pump.
|
||||||
::
|
::
|
||||||
+>
|
mo-state
|
||||||
?: ?=($peer-not -.q.caz)
|
::
|
||||||
:: short circuit error
|
?: ?=(%peer-not -.q.cush)
|
||||||
(mo-give %unto %reap (some p.q.caz))
|
=/ err (some p.q.cush)
|
||||||
=^ num +>.$ (mo-bale him)
|
(mo-give %unto %reap err)
|
||||||
=+ ^= roc ^- rook
|
::
|
||||||
?- -.q.caz
|
=^ num mo-state (mo-bale ship)
|
||||||
$poke [%m p.p.q.caz q.q.p.q.caz]
|
::
|
||||||
$pull [%u ~]
|
=/ =rook
|
||||||
$puff !!
|
?- -.q.cush
|
||||||
$punk !!
|
%poke [%m p.p.q.cush q.q.p.q.cush]
|
||||||
$peel [%l p.q.caz q.q.caz]
|
%pull [%u ~]
|
||||||
$peer [%s p.q.caz]
|
%puff !!
|
||||||
==
|
%punk !!
|
||||||
%+ mo-pass
|
%peel [%l p.q.cush q.q.cush]
|
||||||
[%sys %way -.q.caz ~]
|
%peer [%s p.q.cush]
|
||||||
`note-arvo`[%a %want him [%g %ge p.caz ~] [num roc]]
|
==
|
||||||
|
::
|
||||||
|
=/ action -.q.cush
|
||||||
|
=/ =path /sys/way/[action]
|
||||||
|
=/ note=note-arvo [%a %want ship [%g %ge p.cush ~] [num rook]]
|
||||||
|
::
|
||||||
|
(mo-pass path note)
|
||||||
::
|
::
|
||||||
++ mo-baal :: error convert a
|
:: +mo-awed: handle foreign response.
|
||||||
|= art/(unit ares)
|
|
||||||
^- ares
|
|
||||||
?~(art ~ ?~(u.art `[%blank ~] u.art))
|
|
||||||
::
|
::
|
||||||
++ mo-baba :: error convert b
|
++ mo-awed
|
||||||
|= ars/ares
|
|= [=whey art=(unit ares)]
|
||||||
^- (unit tang)
|
^+ mo-state
|
||||||
?~ ars ~
|
::
|
||||||
`[[%leaf (trip p.u.ars)] q.u.ars]
|
=/ =ares
|
||||||
::
|
=/ tanks [%blank ~]
|
||||||
++ mo-awed :: foreign response
|
=/ tang (some tanks)
|
||||||
|= {him/ship why/?($peer $peel $poke $pull) art/(unit ares)}
|
(fall art tang)
|
||||||
^+ +>
|
::
|
||||||
:: ~& [%mo-awed him why art]
|
=/ to-tang
|
||||||
=+ tug=(mo-baba (mo-baal art))
|
|= ars=(pair term tang)
|
||||||
?- why
|
^- tang
|
||||||
$peel (mo-give %unto %reap tug)
|
=/ tape (trip p.ars)
|
||||||
$peer (mo-give %unto %reap tug)
|
[[%leaf tape] q.ars]
|
||||||
$poke (mo-give %unto %coup tug)
|
::
|
||||||
$pull +>.$
|
=/ result (bind ares to-tang)
|
||||||
|
::
|
||||||
|
?- whey
|
||||||
|
%peel (mo-give %unto %reap result)
|
||||||
|
%peer (mo-give %unto %reap result)
|
||||||
|
%poke (mo-give %unto %coup result)
|
||||||
|
%pull mo-state
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ mo-bale :: assign outbone
|
++ mo-bale :: assign outbone
|
||||||
|
Loading…
Reference in New Issue
Block a user