urbit/base/ape/helm/core.hook
2015-05-06 19:31:54 -07:00

184 lines
6.6 KiB
Plaintext

:: :: ::
:::: /hook/core/helm/ape :: ::
:: :: ::
/? 314 :: zuse version
/- *sole :: structures
/+ sole :: libraries
:: :: ::
:::: :: ::
!: :: ::
=> |% :: principal structures
++ helm-house :: all state
$: %0 :: state version
bur=(unit (pair ship mace)) :: requesting ticket
hoc=(map bone helm-session) :: consoles
== ::
++ helm-session ::
$: say=sole-share ::
mud=(unit (sole-dialog ,@ud)) ::
== ::
++ funk (pair ,@ ,@) ::
++ begs ,[his=@p tic=@p eny=@t ges=gens] :: begin data
++ suss ,[term @tas @da] :: config report
++ helm-wish ::
$| $? %reset :: reset kernel
%verb :: verbose mode
== ::
$% [%reload p=(list term)] :: reload vanes
== ::
++ dill :: sent to %dill
$% [%crud p=term q=(list tank)] :: fat report
[%text p=tape] :: thin report
[%veer p=@ta q=path r=@t] :: install vane
[%vega p=path] :: reboot by path
[%verb ~] :: verbose mode
== ::
++ card ::
$% [%cash wire p=@p q=buck] ::
[%conf wire dock %load ship term] ::
[%flog wire dill] ::
[%plug wire @p @tas @p @tas] ::
[%want wire sock path *] :: send message
== ::
++ move (pair bone card) :: user-level move
-- ::
:: ::
:::: ::
:: ::
|_ $: hid=hide :: system state
helm-house :: program state
== ::
++ he :: per session
|_ [[ost=bone moz=(list move)] helm-session] ::
++ he-abet :: resolve
[(flop moz) %_(+> hoc (~(put by hoc) ost +<+))] ::
:: ::
++ he-wish-start
|= dap=term
%_(+> moz :_(moz [ost %conf /start [our.hid dap] %load our.hid %main]))
::
++ he-wish-reset
^+ .
=- %_(+ moz (weld zum moz))
^= zum %- flop ^- (list move)
=+ top=`path`/(scot %p our.hid)/arvo/(scot %da lat.hid)
:- [ost %flog /reset %vega (weld top `path`/hoon)]
%+ turn
^- (list ,[p=@tas q=@tas])
:~ [%$ %zuse]
[%a %ames]
[%c %clay]
[%d %dill]
[%e %eyre]
[%f %ford]
[%g %gall]
[%t %time]
==
|= [p=@tas q=@tas]
=+ way=`path`(welp top /[q])
=+ txt=((hard ,@) .^(%cx (welp way /hoon)))
[ost %flog /reset %veer p way txt]
::
++ he-wish-reload
|= all=(list term)
%_ +>.$
moz
%- weld
:_ moz
%+ turn all
=+ ark=(arch .^(%cy /(scot %p our.hid)/arvo/(scot %da lat.hid)))
=+ van=(~(tap by r.ark))
|= nam=@tas
=. nam
?. =(1 (met 3 nam))
nam
=+ ^- zaz=(list ,[p=span ~])
(skim van |=([a=term ~] =(nam (end 3 1 a))))
?> ?=([[@ ~] ~] zaz)
`term`p.i.zaz
=+ tip=(end 3 1 nam)
=+ way=[(scot %p our.hid) %arvo (scot %da lat.hid) nam %hoon ~]
=+ fil=(,@ .^(%cx way))
:* ost
%flog
/reload
[%veer ?:(=('z' tip) %$ tip) way (,@ .^(%cx way))]
==
==
::
++ he-wish-verb
%_ .
moz
:_ moz
[ost %flog /verb %verb ~]
==
++ he-wish-init
|= him=ship
%_ +>.$
moz
:_ moz
[ost %flog /init %crud %hax-init leaf/(scow %p him) ~]
==
--
::
++ hake :: poke core
|= [ost=bone src=ship]
?> =(src our.hid)
~(. he [ost ~] (fall (~(get by hoc) ost) *helm-session))
::
++ poke-helm-reset
|= [from ~]
~& %poke-helm-reset
he-abet:he-wish-reset:(hake ost src)
::
++ poke-helm-verb
|= [from ~]
~& %poke-helm-verb
he-abet:he-wish-verb:(hake ost src)
::
++ poke-helm-init
|= [from him=ship]
~& %poke-helm-init
he-abet:(he-wish-init:(hake ost src) him)
::
++ poke-helm-reload
|= [from all=(list term)]
he-abet:(he-wish-reload:(hake ost src) all)
::
++ poke-helm-start
|= [from dap=term]
he-abet:(he-wish-start:(hake ost src) dap)
::
++ poke-helm-begin
|= [from begs]
~& %behn-helm-begin
?> ?=(~ bur)
=+ buz=(shax :(mix (jam ges) eny))
=+ loy=(bruw 2.048 buz)
:_ +>.$(bur `[his [0 sec:ex:loy]~])
:~ :* ost %want /ticketing [our.hid (sein his)] /q/ta
his tic ges pub:ex:loy
==
==
::
++ poke-will
|= [from wil=(unit will)]
?> ?=(^ bur)
:_ +>.$(bur ~)
?~ wil
!!
:~ [ost %cash ~ p.u.bur q.u.bur u.wil]
[ost %plug ~ our.hid %main (sein our.hid) %main]
[ost %plug ~ our.hid %arvo (sein our.hid) %arvo]
[ost %plug ~ our.hid %try (sein our.hid) %try]
==
::
++ onto
|= [then saw=(each suss tang)]
:_ +> :_ ~
?- -.saw
%| [ost %pass ~ %flog %crud `@tas`-.way `tang`p.saw]
%& [ost %pass ~ %flog %text "<{<p.saw>}>"]
==
--