urbit/base/ape/hood/core.hook

145 lines
6.1 KiB
Plaintext
Raw Normal View History

2015-05-11 21:05:14 +03:00
:: :: ::
:::: /hook/core/hood/ape :: ::
:: :: ::
/? 314 :: zuse version
2015-05-14 22:24:43 +03:00
/+ sole, talk, helm, kiln, drum :: libraries
2015-05-11 21:05:14 +03:00
:: :: ::
:::: :: ::
!: :: ::
=> |% :: module boilerplate
++ hood-0 ::
,[%0 lac=(map ,@tas hood-part)] ::
2015-05-11 21:05:14 +03:00
++ hood-good ::
|* hed=hood-head ::
|= paw=hood-part ::
?- hed ::
2015-05-16 03:23:40 +03:00
%drum ?>(?=(%drum -.paw) `drum-part`paw) ::
2015-05-12 03:31:37 +03:00
%helm ?>(?=(%helm -.paw) `helm-part`paw) ::
%kiln ?>(?=(%kiln -.paw) `kiln-part`paw) ::
2015-05-11 21:05:14 +03:00
== ::
++ hood-head ,_-:*hood-part ::
2015-05-12 23:10:22 +03:00
++ hood-make ::
|* [our=@p hed=hood-head] ::
2015-05-11 21:05:14 +03:00
?- hed ::
%drum (drum-port our) ::
2015-05-12 23:10:22 +03:00
%helm *helm-part ::
%kiln *kiln-part ::
2015-05-11 21:05:14 +03:00
== ::
++ hood-part ::
$% [%drum %0 drum-pith] ::
[%helm %0 helm-pith] ::
[%kiln %0 kiln-pith] ::
2015-05-11 21:05:14 +03:00
== ::
-- ::
:: :: ::
:::: :: ::
:: :: ::
|_ $: hid=hide :: system state
hood-0 :: server state
2015-05-11 21:05:14 +03:00
== ::
++ able :: find/make part
|* hed=hood-head
=+ rep=(~(get by lac) hed)
=+ par=?^(rep u.rep `hood-part`(hood-make our.hid hed))
2015-05-12 23:10:22 +03:00
((hood-good hed) par)
2015-05-11 21:05:14 +03:00
::
++ ably :: save part
2015-05-12 03:31:37 +03:00
|* [moz=(list) rep=hood-part]
[(flop moz) %_(+> lac (~(put by lac) -.rep rep))]
2015-05-11 21:05:14 +03:00
:: :: ::
:::: :: ::
:: :: ::
2015-05-14 22:24:43 +03:00
++ coup-kiln-fancy ::
|= [then saw=(unit tang)]
(ably (take-coup-fancy:(kiln-work [hid ost src] (able %kiln)) way +<+))
::
++ coup-kiln-spam ::
|= [then saw=(unit tang)]
~? ?=(^ saw) [%kiln-spam-lame u.saw]
[~ +>]
::
++ coup-drum ::
|= [then saw=(unit tang)]
2015-05-16 03:23:40 +03:00
(ably (take-coup:(drum-work [hid ost src] (able %drum)) way +<+))
2015-05-14 22:24:43 +03:00
::
++ diff-sole-effect-drum
|= [then sole-effect]
(ably (diff-sole-effect:(drum-work [hid ost src] (able %drum)) way +<+))
::
2015-05-12 03:31:37 +03:00
++ poke-hood-begin ::
|= [from hood-begin]
(ably (poke-begin:(helm-work [hid +<-] (able %helm)) +<+))
2015-05-11 21:05:14 +03:00
::
2015-05-15 11:09:12 +03:00
++ poke-helm-init ::
2015-05-12 03:31:37 +03:00
|= [from hood-init]
(ably (poke-init:(helm-work [hid +<-] (able %helm)) +<+))
2015-05-11 21:05:14 +03:00
::
2015-05-14 22:24:43 +03:00
++ poke-hood-merge ::
|= [from hood-merge]
(ably (poke-merge:(kiln-work [hid +<-] (able %kiln)) +<+))
::
2015-05-12 03:31:37 +03:00
++ poke-hood-reload ::
|= [from hood-reload]
(ably (poke-reload:(helm-work [hid +<-] (able %helm)) +<+))
2015-05-11 21:05:14 +03:00
::
2015-05-12 03:31:37 +03:00
++ poke-hood-reset ::
2015-05-11 21:05:14 +03:00
|= [from ~]
2015-05-12 03:31:37 +03:00
(ably (poke-reset:(helm-work [hid +<-] (able %helm)) +<+))
2015-05-11 21:05:14 +03:00
::
2015-05-14 22:24:43 +03:00
++ poke-hood-sync ::
|= [from hood-sync]
(ably (poke-sync:(kiln-work [hid +<-] (able %kiln)) +<+))
::
++ poke-hood-unix ::
|= [from hood-unix]
(ably (poke-unix:(kiln-work [hid +<-] (able %kiln)) +<+))
::
2015-05-12 03:31:37 +03:00
++ poke-hood-verb ::
2015-05-11 21:05:14 +03:00
|= [from ~]
2015-05-12 03:31:37 +03:00
(ably (poke-verb:(helm-work [hid +<-] (able %helm)) +<+))
2015-05-11 21:05:14 +03:00
::
2015-05-17 22:39:03 +03:00
++ poke-hood-start ::
|= [from drum-start]
(ably (poke-start:(drum-work [hid +<-] (able %drum)) +<+))
::
++ poke-dill-belt
|= [from dill-belt]
(ably (poke-dill-belt:(drum-work [hid +<-] (able %drum)) +<+))
::
2015-05-11 21:05:14 +03:00
++ poke-will ::
|= [from (unit will)]
2015-05-12 03:31:37 +03:00
(ably (poke-will:(helm-work [hid +<-] (able %helm)) +<+))
::
++ mere-kiln ::
|= [then are=(each (set path) (pair term tang))]
(ably (take-mere:(kiln-work [hid ost src] (able %kiln)) way +<+))
::
++ made-kiln ::
|= [then @uvH (each gage tang)]
(ably (take-made:(kiln-work [hid ost src] (able %kiln)) way +<+))
::
2015-05-15 02:27:45 +03:00
++ note-helm ::
|= [then (pair ,@tD tank)]
(ably (take-note:(helm-work [hid ost src] (able %helm)) way +<+))
::
2015-05-17 22:39:03 +03:00
++ reap-drum
|= [then saw=(unit tang)]
(ably (reap:(drum-work [hid ost src] (able %drum)) way +<+))
::
++ onto-drum ::
|= [then saw=(each ,[term @tas @da] tang)]
(ably (take-onto:(drum-work [hid ost src] (able %drum)) way +<+))
2015-05-14 22:24:43 +03:00
::
++ peer-drum
|= [from pax=path]
(ably (peer:(drum-work [hid +<-] (able %drum)) +<+))
::
++ quit-drum
|= then
2015-05-16 03:23:40 +03:00
(ably (quit:(drum-work [hid ost src] (able %drum)) way))
2015-05-17 22:39:03 +03:00
::
++ went-helm ::
|= [then her=ship kay=cape]
(ably (take-went:(helm-work [hid ost src] (able %helm)) way +<+))
2015-05-11 21:05:14 +03:00
--