shrub/app/hood.hoon

231 lines
11 KiB
Plaintext
Raw Normal View History

2018-02-13 00:43:24 +03:00
:: :: ::
2016-02-05 06:05:37 +03:00
:::: /hoon/hood/app :: ::
2015-05-11 21:05:14 +03:00
:: :: ::
/? 310 :: zuse version
/+ sole, :: libraries
2017-11-30 07:55:58 +03:00
:: XX these should really be separate apps, as
:: none of them interact with each other in
2017-11-30 07:55:58 +03:00
:: any fashion; however, to reduce boot-time
:: complexity and work around the current
:: non-functionality of end-to-end acknowledgments,
:: they have been bundled into :hood
::
:: |command handlers
hood-helm, hood-kiln, hood-drum, hood-write,
hood-womb
2015-05-11 21:05:14 +03:00
:: :: ::
:::: :: ::
2016-11-17 04:42:58 +03:00
:: :: ::
2017-11-29 23:40:44 +03:00
|%
2017-11-30 07:55:58 +03:00
++ hood-module
:: each hood module follows this general shape
2017-11-29 23:41:25 +03:00
=> |%
2017-11-30 07:55:58 +03:00
+= part [%module %0 pith]
2017-11-29 23:41:25 +03:00
+= pith ~
::
+= move [bone card]
2018-02-13 00:43:24 +03:00
+= card $% [%fake ~]
2017-11-29 23:41:25 +03:00
==
--
|= [bowl:gall own=part]
|_ moz=(list move)
++ abet [(flop moz) own]
--
2017-11-29 23:40:44 +03:00
--
2015-05-11 21:05:14 +03:00
:: :: ::
2017-11-30 07:55:58 +03:00
:::: :: :: state handling
2016-11-17 04:42:58 +03:00
:: :: ::
2017-09-27 23:47:34 +03:00
!:
2017-11-30 07:55:58 +03:00
=> |% ::
++ hood-old :: unified old-state
{?($0 $1) lac/(map @tas hood-part-old)} ::
2017-11-30 07:55:58 +03:00
++ hood-1 :: unified state
2016-05-02 21:56:00 +03:00
{$1 lac/(map @tas hood-part)} ::
2017-11-30 07:55:58 +03:00
++ hood-good :: extract specific
2018-01-23 04:15:34 +03:00
=+ hed=$:hood-head
|% +- $
|: paw=$:hood-part
?- hed
$drum ?>(?=($drum -.paw) `part:hood-drum`paw)
$helm ?>(?=($helm -.paw) `part:hood-helm`paw)
$kiln ?>(?=($kiln -.paw) `part:hood-kiln`paw)
$womb ?>(?=($womb -.paw) `part:hood-womb`paw)
$write ?>(?=($write -.paw) `part:hood-write`paw)
==
--
++ hood-head _-:$:hood-part :: initialize state
2015-05-12 23:10:22 +03:00
++ hood-make ::
2018-01-23 04:15:34 +03:00
=+ $:{our/@p hed/hood-head} ::
|% +- $
?- hed
$drum (make:hood-drum our)
$helm *part:hood-helm
$kiln *part:hood-kiln
$womb *part:hood-womb
$write *part:hood-write
==
--
2017-11-30 07:55:58 +03:00
++ hood-part-old hood-part :: old state for ++prep
++ hood-port :: state transition
2018-01-23 04:15:34 +03:00
|: paw=$:hood-part-old ^- hood-part ::
2016-11-14 06:15:19 +03:00
paw ::
:: ::
2017-11-30 07:55:58 +03:00
++ hood-part :: current module state
2017-11-30 00:29:35 +03:00
$% {$drum $2 pith-2:hood-drum} ::
{$helm $0 pith:hood-helm} ::
{$kiln $0 pith:hood-kiln} ::
{$womb $1 pith:hood-womb} ::
{$write $0 pith:hood-write} ::
2015-05-11 21:05:14 +03:00
== ::
-- ::
:: :: ::
2017-11-30 07:55:58 +03:00
:::: :: :: app proper
2015-05-11 21:05:14 +03:00
:: :: ::
=, gall
2017-11-30 07:55:58 +03:00
|_ $: hid/bowl :: gall environment
hood-1 :: module states
2015-05-11 21:05:14 +03:00
== ::
2015-12-21 00:16:39 +03:00
++ able :: find+make part
2018-01-23 04:15:34 +03:00
=+ hed=$:hood-head
|% +- $
=+ rep=(~(get by lac) hed)
=+ par=?^(rep u.rep `hood-part`(hood-make our.hid hed))
((hood-good hed) par)
--
2015-05-11 21:05:14 +03:00
::
++ ably :: save part
2018-01-23 04:15:34 +03:00
=+ $:{(list) hood-part}
|% +- $
[(flop +<-) %_(+> lac (~(put by lac) +<+< +<+))]
--
2015-05-11 21:05:14 +03:00
:: :: ::
2017-11-30 07:55:58 +03:00
:::: :: :: generic handling
2015-05-11 21:05:14 +03:00
:: :: ::
2016-05-02 21:56:00 +03:00
++ prep
2017-11-30 07:55:58 +03:00
|= old/(unit hood-old) ^- (quip _!! _+>)
:- ~
?~ old +>
+>(lac (~(run by lac.u.old) hood-port))
::
2017-11-30 07:55:58 +03:00
++ poke-hood-load :: recover lost brain
2016-04-19 01:15:35 +03:00
|= dat/hood-part
2017-11-30 00:29:35 +03:00
?> =(our.hid src.hid)
2016-04-19 01:15:35 +03:00
~& loaded+-.dat
[~ %_(+> lac (~(put by lac) -.dat dat))]
::
::
2017-11-30 07:55:58 +03:00
++ from-module :: create wrapper
2018-01-23 04:15:34 +03:00
=+ [%module ..$ _abet]:(hood-module)
|% +- $
=> .(+< [identity start finish]=+<)
=- [wrap=- $:start] :: usage (wrap handle-arm):from-foo
=+ handle=finish
|% +- $
|: +<.handle
=. +>.handle (start hid (able identity))
(ably (handle +<))
-- --
2015-05-17 22:39:03 +03:00
::
2017-11-30 07:55:58 +03:00
:: per-module interface wrappers
++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum))
++ from-helm (from-module %helm [..$ _abet]:(hood-helm))
++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln))
++ from-womb (from-module %womb [..$ _abet]:(hood-womb))
++ from-write (from-module %write [..$ _abet]:(hood-write))
2015-05-28 05:46:58 +03:00
::
:: :: ::
2017-11-30 07:55:58 +03:00
:::: :: :: switchboard
:: :: ::
++ coup-drum-phat (wrap take-coup-phat):from-drum
++ coup-helm-hi (wrap coup-hi):from-helm
++ coup-helm-ask (wrap coup-ask):from-helm
++ coup-kiln-fancy (wrap take-coup-fancy):from-kiln
++ coup-kiln-reload (wrap take-coup-reload):from-kiln
++ coup-kiln-spam (wrap take-coup-spam):from-kiln
++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum
2015-12-20 23:50:45 +03:00
++ init-helm |=({way/wire *} [~ +>])
2016-02-12 02:29:52 +03:00
++ made-write (wrap made):from-write
2015-09-17 02:40:53 +03:00
++ made-kiln (wrap take-made):from-kiln
++ mere-kiln (wrap take-mere):from-kiln
++ mere-kiln-sync (wrap take-mere-sync):from-kiln
2015-09-26 03:23:06 +03:00
++ wake-kiln-overload (wrap take-wake-overload):from-kiln
2015-09-17 02:40:53 +03:00
++ note-helm (wrap take-note):from-helm
++ onto-drum (wrap take-onto):from-drum
++ peer-drum (wrap peer):from-drum
2017-11-30 00:29:35 +03:00
++ peek-x-womb peek-x:(hood-womb hid (able %womb))
2016-04-27 00:29:07 +03:00
++ peer-scry-x-womb (wrap peer-scry-x):from-womb
++ poke-atom (wrap poke-atom):from-helm
2015-09-17 02:40:53 +03:00
++ poke-dill-belt (wrap poke-dill-belt):from-drum
2016-04-30 02:18:59 +03:00
++ poke-drum-put (wrap poke-put):from-drum
2015-09-17 02:40:53 +03:00
++ poke-drum-link (wrap poke-link):from-drum
2015-10-20 23:48:11 +03:00
++ poke-drum-unlink (wrap poke-unlink):from-drum
++ poke-drum-exit (wrap poke-exit):from-drum
2015-09-17 02:40:53 +03:00
++ poke-drum-start (wrap poke-start):from-drum
++ poke-helm-hi (wrap poke-hi):from-helm
2016-02-06 01:17:30 +03:00
++ poke-helm-init (wrap poke-init):from-helm :: XX used?
2016-04-13 03:48:55 +03:00
::++ poke-helm-invite (wrap poke-invite):from-helm
2015-09-17 02:40:53 +03:00
++ poke-helm-mass (wrap poke-mass):from-helm
++ poke-helm-reload (wrap poke-reload):from-helm
++ poke-helm-reload-desk (wrap poke-reload-desk):from-helm
++ poke-helm-reset (wrap poke-reset):from-helm
++ poke-helm-serve (wrap poke-serve):from-helm
2015-09-17 02:40:53 +03:00
++ poke-helm-send-hi (wrap poke-send-hi):from-helm
++ poke-helm-send-ask (wrap poke-send-ask):from-helm
2015-09-17 02:40:53 +03:00
++ poke-helm-verb (wrap poke-verb):from-helm
2017-05-16 23:56:54 +03:00
++ poke-helm-nuke (wrap poke-nuke):from-helm
2015-09-17 02:40:53 +03:00
++ poke-helm-begin (wrap poke-begin):from-helm
2016-04-11 05:23:29 +03:00
++ poke-helm-spawn (wrap poke-spawn):from-helm
++ poke-helm-tlon-add-fora (wrap poke-tlon-add-fora):from-helm
2017-12-12 23:23:00 +03:00
++ poke-helm-tlon-add-stream (wrap poke-tlon-add-stream):from-helm
++ poke-helm-tlon-init-stream (wrap poke-tlon-init-stream):from-helm
2015-09-17 02:40:53 +03:00
++ poke-hood-sync (wrap poke-sync):from-kiln
2016-02-26 02:19:44 +03:00
++ poke-hood-init-sync (wrap poke-init-sync):from-kiln
2017-01-12 18:50:35 +03:00
++ poke-kiln-commit (wrap poke-commit):from-kiln
2016-05-07 02:21:29 +03:00
++ poke-kiln-info (wrap poke-info):from-kiln
2015-09-17 02:40:53 +03:00
++ poke-kiln-label (wrap poke-label):from-kiln
++ poke-kiln-merge (wrap poke-merge):from-kiln
++ poke-kiln-cancel (wrap poke-cancel):from-kiln
++ poke-kiln-mount (wrap poke-mount):from-kiln
++ poke-kiln-rm (wrap poke-rm):from-kiln
++ poke-kiln-schedule (wrap poke-schedule):from-kiln
2016-01-07 01:08:46 +03:00
++ poke-kiln-track (wrap poke-track):from-kiln
2015-09-17 02:40:53 +03:00
++ poke-kiln-sync (wrap poke-sync):from-kiln
++ poke-kiln-syncs (wrap poke-syncs):from-kiln
2015-09-17 02:40:53 +03:00
++ poke-kiln-start-autoload (wrap poke-start-autoload):from-kiln
2017-05-25 02:04:27 +03:00
++ poke-kiln-wipe-ford (wrap poke-wipe-ford):from-kiln
2015-09-17 02:40:53 +03:00
++ poke-kiln-autoload (wrap poke-autoload):from-kiln
2015-09-26 03:23:06 +03:00
++ poke-kiln-overload (wrap poke-overload):from-kiln
2015-09-17 02:40:53 +03:00
++ poke-kiln-unmount (wrap poke-unmount):from-kiln
++ poke-kiln-unsync (wrap poke-unsync):from-kiln
2016-04-13 03:48:55 +03:00
++ poke-womb-invite (wrap poke-invite):from-womb
2016-04-19 01:15:35 +03:00
++ poke-womb-save (wrap poke-save):from-womb
2016-04-13 03:48:55 +03:00
++ poke-womb-obey (wrap poke-obey):from-womb
2016-08-12 03:35:14 +03:00
++ poke-womb-bonus (wrap poke-bonus):from-womb
2016-04-13 03:48:55 +03:00
++ poke-womb-claim (wrap poke-claim):from-womb
++ poke-womb-do-ticket (wrap poke-do-ticket):from-womb
++ poke-womb-do-claim (wrap poke-do-claim):from-womb
2016-04-13 03:48:55 +03:00
++ poke-womb-rekey (wrap poke-rekey):from-womb
++ poke-womb-report (wrap poke-report):from-womb
++ poke-womb-manage (wrap poke-manage):from-womb
++ poke-womb-recycle (wrap poke-recycle):from-womb
++ poke-womb-manage-old-key (wrap poke-manage-old-key):from-womb
++ poke-womb-release (wrap poke-release):from-womb
++ poke-womb-release-ships (wrap poke-release-ships):from-womb
2016-04-13 03:48:55 +03:00
++ poke-womb-reinvite (wrap poke-reinvite):from-womb
2016-04-30 02:18:59 +03:00
++ poke-womb-replay-log (wrap poke-replay-log):from-womb
++ poke-write-sec-atom (wrap poke-sec-atom):from-write
2016-02-12 02:29:52 +03:00
++ poke-write-paste (wrap poke-paste):from-write
++ poke-write-comment (wrap poke-comment):from-write
++ poke-write-fora-post (wrap poke-fora-post):from-write
++ poke-write-plan-info (wrap poke-plan-info):from-write
++ poke-write-plan-account (wrap poke-plan-account):from-write
2016-02-12 02:29:52 +03:00
++ poke-write-tree (wrap poke-tree):from-write
++ poke-write-wipe (wrap poke-wipe):from-write
2017-10-12 03:00:21 +03:00
++ poke-will (wrap poke-will):from-helm
2015-09-17 02:40:53 +03:00
++ quit-drum-phat (wrap quit-phat):from-drum
++ reap-drum-phat (wrap reap-phat):from-drum
++ woot-helm (wrap take-woot):from-helm
++ writ-kiln-autoload (wrap take-writ-autoload):from-kiln
++ writ-kiln-sync (wrap take-writ-sync):from-kiln
2015-05-11 21:05:14 +03:00
--