urbit/pkg/arvo/app/hood.hoon

203 lines
9.5 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
2018-10-15 09:03:54 +03:00
hood-helm, hood-kiln, hood-drum, hood-write
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
=> |%
2018-06-02 00:31:10 +03:00
+$ part [%module %0 pith]
+$ pith ~
2017-11-29 23:41:25 +03:00
::
2018-06-02 00:31:10 +03:00
+$ move [bone card]
+$ 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
2018-05-27 22:15:15 +03:00
|@ ++ $
2018-01-23 04:15:34 +03:00
|: 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)
$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} ::
2018-05-27 22:15:15 +03:00
|@ ++ $
2019-01-18 08:37:34 +03:00
?- hed
2018-01-23 04:15:34 +03:00
$drum (make:hood-drum our)
$helm *part:hood-helm
$kiln *part:hood-kiln
$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} ::
{$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
2018-05-27 22:15:15 +03:00
|@ ++ $
2018-01-23 04:15:34 +03:00
=+ 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}
2018-05-27 22:15:15 +03:00
|@ ++ $
2018-01-23 04:15:34 +03:00
[(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-03-13 01:24:23 +03:00
|* _[identity=%module start=..$ finish=_abet]:(hood-module)
2015-06-04 01:16:32 +03:00
=- [wrap=- *start] :: usage (wrap handle-arm):from-foo
2015-12-20 23:50:45 +03:00
|* handle/_finish
2018-03-13 01:24:23 +03:00
|= a=_+<.handle
2015-06-04 01:16:32 +03:00
=. +>.handle (start hid (able identity))
2018-03-13 01:24:23 +03:00
(ably (handle a))
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-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-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 *} [~ +>])
++ mack-kiln (wrap mack):from-kiln
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
++ wake-helm-automass (wrap take-wake-automass):from-helm
2015-09-17 02:40:53 +03:00
++ onto-drum (wrap take-onto):from-drum
++ peer-drum (wrap peer):from-drum
++ poke-atom (wrap poke-atom):from-helm
2015-09-17 02:40:53 +03:00
++ poke-dill-belt (wrap poke-dill-belt):from-drum
2018-10-11 23:19:30 +03:00
++ poke-dill-blit (wrap poke-dill-blit):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-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-verb (wrap poke-verb):from-helm
++ poke-helm-rekey (wrap poke-rekey):from-helm
++ poke-helm-moon (wrap poke-moon):from-helm
2017-05-16 23:56:54 +03:00
++ poke-helm-nuke (wrap poke-nuke):from-helm
++ poke-helm-automass (wrap poke-automass):from-helm
2019-01-30 03:25:47 +03:00
++ poke-helm-cancel-automass (wrap poke-cancel-automass):from-helm
2019-02-16 12:34:38 +03:00
++ poke-helm-bonk (wrap poke-bonk):from-helm
2015-09-17 02:40:53 +03:00
++ poke-hood-sync (wrap poke-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
2018-06-22 07:00:07 +03:00
++ poke-kiln-keep-ford (wrap poke-keep-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
2019-08-12 16:51:12 +03:00
++ poke-kiln-wash-gall (wrap poke-wash-gall):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
++ poke-kiln-permission (wrap poke-permission):from-kiln
++ 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-tree (wrap poke-tree):from-write
++ poke-write-wipe (wrap poke-wipe):from-write
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
2019-04-30 20:40:38 +03:00
++ writ-kiln-find-ship (wrap take-writ-find-ship):from-kiln
2015-09-17 02:40:53 +03:00
++ writ-kiln-sync (wrap take-writ-sync):from-kiln
2018-10-11 01:26:51 +03:00
++ bound (wrap take-bound):from-helm
2015-05-11 21:05:14 +03:00
--