urbit/base/fap/shell/core.hook

570 lines
19 KiB
Plaintext
Raw Normal View History

2014-09-26 04:10:17 +04:00
:: Shell
2014-09-12 06:11:03 +04:00
::
2014-09-26 04:10:17 +04:00
:::: /hook/core/shell/app
2014-09-12 06:11:03 +04:00
::
/? 314
2014-10-10 01:58:47 +04:00
/- term-line, kyev
2015-02-13 00:04:33 +03:00
/= pit /~ !>(+) :: kernel vase
2014-09-12 06:11:03 +04:00
::
:::: structures
!:
2014-09-12 06:11:03 +04:00
|% ::
++ axle ::
2015-01-16 02:48:08 +03:00
$: %1 :: version
2015-01-05 23:00:40 +03:00
tiv=? :: typing?
2015-01-16 02:48:08 +03:00
wit=[p=@u q=(map ,@u coma)] :: waiting commands
2014-12-17 02:46:30 +03:00
pid=@u :: next process id
2015-04-30 22:34:36 +03:00
pax=_`path`/=base=/try :: working directory
2014-11-01 03:53:11 +03:00
act=(unit span) :: active child
2015-01-16 02:48:08 +03:00
pip=(jar span span) :: pipe out->in
pop=(jar span span) :: pipe in->out
2014-11-19 04:17:11 +03:00
pot=(map span ,[cord prom cord]) :: prompts
2014-11-01 03:53:11 +03:00
var=(map term vase) :: variables
2014-10-31 04:54:54 +03:00
== ::
2014-09-12 06:11:03 +04:00
++ gift ::
$% [%rush p=gilt] ::
[%init p=@p] ::
2014-11-20 01:18:37 +03:00
[%logo p=@] ::
2014-09-27 05:01:17 +04:00
[%mean p=ares] ::
2014-09-12 06:11:03 +04:00
[%nice ~] ::
2014-10-01 01:53:37 +04:00
[%meta p=vase] ::
2014-10-22 06:59:05 +04:00
[%sage p=path q=*] ::
2014-10-24 02:56:06 +04:00
[%verb ~] ::
2014-10-04 02:31:16 +04:00
[%veer p=@ta q=path r=@t] ::
[%vega p=path] ::
2014-09-12 06:11:03 +04:00
== ::
++ gilt ::
$% [%term-line p=term-line] ::
[%txt p=cord] ::
2014-12-17 02:29:07 +03:00
[%type p=?] ::
== ::
2014-12-17 02:29:07 +03:00
++ glas ?(%out [%in p=cord] [%active p=cord]) ::
2014-09-12 06:11:03 +04:00
++ hapt ,[p=ship q=path] ::
++ move ,[p=bone q=(mold note gift)] ::
++ note ::
2014-10-14 05:27:54 +04:00
$% $: %c ::
$% [%info p=@p q=toro] ::
== == ::
$: %g ::
2014-09-23 02:20:47 +04:00
$% [%cide p=span] ::
[%show p=hapt q=ship r=path] ::
[%sire p=term q=span] ::
2014-09-23 05:00:25 +04:00
[%mess p=hapt q=ship r=cage] ::
2014-09-25 04:37:29 +04:00
[%meta p=vase] ::
2014-11-25 01:00:13 +03:00
[%nuke p=hapt q=ship] ::
2015-01-20 01:02:00 +03:00
[%took p=hapt q=ship] ::
2014-09-12 06:11:03 +04:00
== == == ::
2014-10-10 02:57:24 +04:00
++ mand ,[p=term q=(list twig)] :: name and arguments
2014-09-23 05:00:25 +04:00
++ coma ::
$% [%run p=(list mand) q=mand] :: pipe into
2014-10-10 02:57:24 +04:00
[%end p=(each ,@u cord)] :: kill pid/name
[%path p=path] :: chdir
2014-10-14 05:27:54 +04:00
[%del p=path] :: rm file
[%ins p=path q=(unit twig)] :: add file
[%mut p=path q=(unit twig)] :: change file
2014-10-10 02:57:24 +04:00
[%hoon p=twig] :: eval expression
2014-10-31 00:57:47 +03:00
[%comt ~] :: comment
2014-10-10 02:57:24 +04:00
[%var p=term q=twig] :: set variable
[%rvar p=term] :: unset variable
[%help p=term] :: info about command
2014-09-23 05:00:25 +04:00
== ::
2014-09-12 06:11:03 +04:00
++ sign ::
$% $: %g ::
2014-09-23 02:20:47 +04:00
$% [%gone p=hapt] ::
[%init p=@p] ::
[%dumb ~] ::
2014-09-12 06:11:03 +04:00
[%mean p=ares] ::
2014-09-23 02:20:47 +04:00
[%nice ~] ::
2014-09-26 04:54:51 +04:00
[%rush p=mark q=*] ::
[%rust p=mark q=*] ::
2014-10-22 06:59:05 +04:00
[%sage p=path q=*] ::
2014-10-24 02:56:06 +04:00
[%verb ~] ::
2014-10-04 02:31:16 +04:00
[%veer p=@ta q=path r=@t] ::
[%vega p=path] ::
2014-09-12 06:11:03 +04:00
== == == ::
--
2015-02-06 08:00:35 +03:00
::
:::: parsers
!:
|%
++ maybe |*(fel=_rule (cook |*(a=(unit) (fall a ~)) (opts fel)))
2014-10-10 02:57:24 +04:00
++ opts :: parse unit
|* fel=_rule
;~ pose
(cook some fel)
(easy ~)
==
::
2014-10-10 02:57:24 +04:00
++ from :: parse door
=+ tol=`?(0 1 2)`%2 :: wide, tallish, tall
|_ [pax=path lat=time]
2014-10-10 02:57:24 +04:00
++ rail :: build from wide/tall
|* [wid=_rule wif=_rule tal=_rule]
?~ tol wid
2014-10-17 02:12:34 +04:00
=- ;~(pose wif wid)
^= wif
?: ?=(1 tol) wif
;~(pose tal wif)
::
2014-10-14 05:27:54 +04:00
++ rais |*([wid=_rule tal=_rule] (rail wid wid tal))
::
2014-10-10 02:57:24 +04:00
++ parse :: top level
^- $+(nail (like coma))
=+ paf=pax
2014-10-10 01:58:47 +04:00
=. pax ?.(&(?=([@ @ @ *] pax) =('0' &3.pax)) pax pax(&3 (scot da/lat)))
2014-10-24 00:22:01 +04:00
%+ ifix [(star ace) gaw]
;~ pose
2014-10-10 02:57:24 +04:00
(stag %run ;~(plug (star ;~(sfix (task(tol %0) bar) ace)) (task col)))
2014-10-31 00:57:47 +03:00
(stag %end ;~(pfix col sem ;~(pose (stag %& dem) (stag %| sym))))
2015-01-16 02:48:08 +03:00
(stag %del ;~(pfix hep (plus ace) loca))
(stag %mut ;~(pfix col (plus ace) ;~(plug loca (opts expg))))
2015-01-16 02:48:08 +03:00
(stag %ins ;~(pfix lus (plus ace) ;~(plug loca (opts expg))))
(stag %help ;~(pfix wut ace ;~(pfix col sym)))
2014-10-22 06:04:27 +04:00
(stag %path (full ;~(sfix loca(pax paf) (star ace))))
2014-10-14 05:27:54 +04:00
(stag %var ;~(plug ;~(pfix tis sym) expg))
(stag %rvar ;~(pfix ;~(plug tis tis) sym))
2014-10-14 05:27:54 +04:00
(stag %hoon expr)
2014-10-31 00:57:47 +03:00
(stag %comt ;~(pfix col col (cold ~ (star prn))))
2014-11-12 03:50:49 +03:00
(stag %comt (easy ~))
2014-10-10 02:57:24 +04:00
==
::
2014-10-14 05:27:54 +04:00
++ expg (rais ;~(pfix ace expr(tol %1)) ;~(pfix gap expr))
2015-02-06 08:00:35 +03:00
++ expr (rais [wide tall]:(vang | pax))
++ loca %+ sear ;~(biff plex:(vang | pax) vabe) :: path in %clay
[;~(pose rood ;~(simu cen scat))]:(vang | pax)
++ vabe |=(a=path ?~((tome a) ~ (some a))) :: check valid beam
2014-10-10 02:57:24 +04:00
++ args :: task arguments
%^ rail
2014-10-14 05:27:54 +04:00
(ifix sel^ser (most ace expr))
(plus ;~(pfix ace expr))
;~(sfix (plus ;~(pfix gap expr)) ;~(plug gap duz))
::
2014-10-10 02:57:24 +04:00
++ task |*(fel=_rule ;~(pfix fel ;~(plug sym (maybe args))))
::
--
--
2015-02-06 08:00:35 +03:00
::
2014-10-31 04:54:54 +03:00
:::: per event
!:
2014-10-31 04:54:54 +03:00
|%
++ ve
|= [hid=hide ost=bone axle]
=* vat +<+>
=| mow=(list move)
|%
++ abet
^- [(list move) axle]
[(flop mow) vat]
::
++ blab
|= mof=(list move)
2015-01-20 00:54:49 +03:00
+>.$(mow (welp (flop mof) mow))
2014-10-31 04:54:54 +03:00
::
++ chew-file
2015-01-09 00:15:04 +03:00
|= [paf=path mor=$|(cord toro)]
2015-01-16 02:48:08 +03:00
%- blab
2014-10-31 04:54:54 +03:00
^- (list move)
2015-01-09 00:15:04 +03:00
?@ mor
(print palm/[" " ~ ~ ~]^~[leaf/(trip mor) (dank:ut paf)])
[ost %pass writ/paf %c %info our.hid mor]~
2014-10-31 04:54:54 +03:00
::
++ cubs :: tasks with open /in
%- sort :_ |=([a=span b=span] (lth (slav %ud a) (slav %ud b)))
^- (list span)
2015-01-16 02:48:08 +03:00
%+ murn (~(tap by cub.hid))
|= [a=span @]
?.(=([~ ~] (~(get by pop) a)) ~ (some a))
2014-10-31 04:54:54 +03:00
::
++ eat
|= [you=ship com=coma]
?- -.com
%comt +>.$
%del (eat-del +.com)
%end (eat-end +.com)
%hoon (eat-hoon +.com)
2014-10-31 04:54:54 +03:00
%ins (eat-ins +.com)
%mut (eat-mut +.com)
%help (eat-help +.com)
%path (eat-path +.com)
2014-10-31 04:54:54 +03:00
%run (eat-run you +.com)
%rvar (eat-rvar +.com)
%var (eat-var +.com)
2014-10-01 01:53:37 +04:00
==
2014-10-31 04:54:54 +03:00
::
++ eat-del
|= paf=path
^+ +>
%+ chew-file paf
2015-01-09 00:15:04 +03:00
?~ (file paf) '! none'
(fray paf)
2014-10-31 04:54:54 +03:00
::
2014-11-01 03:53:11 +03:00
++ eat-end :: XX clean up state
2014-10-31 04:54:54 +03:00
|= poc=(each ,@u cord)
^+ +>
?- -.poc
%&
=+ cil=(scot %ud p.poc)
=+ cin=(trip (~(got by cub.hid) cil))
2014-11-25 01:00:13 +03:00
%- blab
%+ welp
(kill cil)
2014-10-31 04:54:54 +03:00
(print leaf/"- :{cin}({(trip cil)})")
::
%|
=+ ^- moz=(list move)
2014-11-25 01:00:13 +03:00
%- zing
%+ turn (~(tap by cub.hid))
2014-10-31 04:54:54 +03:00
|= [a=span b=term]
?. =(b p.poc) ~
2014-11-25 01:00:13 +03:00
(kill a)
2014-10-31 04:54:54 +03:00
%- blab %+ welp moz
(print leaf/"-{<(lent moz)>} :{(trip p.poc)}")
2014-10-14 05:27:54 +04:00
==
2014-09-23 02:20:47 +04:00
::
2014-10-31 04:54:54 +03:00
++ eat-hoon
|= gen=twig
^+ +>
2015-01-16 02:48:08 +03:00
%+ with gen |= rez=vase
(blab (print (sell rez)))
2014-10-31 04:54:54 +03:00
::
++ eat-ins
|= [paf=path gen=(unit twig)]
^+ +>
2015-01-16 02:48:08 +03:00
?^ (file paf) (chew-file paf '! exists')
%+ with (fall gen [%bczp atom/%t])
|= new=vase
=+ for=((hard mark) -:(flop paf))
(chew-file paf (foal paf for new))
2014-10-31 04:54:54 +03:00
::
++ eat-mut
|= [paf=path gen=(unit twig)]
2014-10-31 04:54:54 +03:00
^+ +>
=+ fel=(file paf)
2015-02-13 00:04:33 +03:00
?^ fel
?~ gen
(blab (stray (crip ": {(spud paf)} {<(,@t u.fel)>}")))
2015-01-16 02:48:08 +03:00
%+ with u.gen |= new=vase
=+ for=((hard mark) -:(flop paf))
(chew-file paf (foal paf for new))
2015-02-13 00:04:33 +03:00
=+ ark=;;(arch .^(%cy paf))
?- r.ark
~ (chew-file paf '! none')
[^ ~ ~] $(paf (welp paf /[p.n.r.ark]))
* (chew-file paf '! many')
==
2014-10-31 04:54:54 +03:00
::
++ eat-help
|= app=term
^+ +>
%- blab %- print
^- tank
=+ rup=/(scot %p our.hid)/main/(scot %da lat.hid)
=+ paf=`path`(welp rup /app/[app]/core/hook)
=+ src=(file paf)
?. ?=([~ @t] src)
leaf/"app {<app>} does not exist"
=+ cot=;~(pfix col col (plus ace) (star prn))
=+ led=(cot 1^1 (trip u.src))
?^ q.led
leaf/":: {(wonk led)}"
palm/[" " ``~]^~[leaf/"no leading comment in" >paf<]
::
2014-10-31 04:54:54 +03:00
++ eat-path
|= paf=path
^+ +>
=. pax paf
(blab (print leaf/"=% {(spud paf)}"))
::
++ eat-run
|= [you=ship mud=(list mand) mad=mand]
^+ +>
2014-11-05 23:35:36 +03:00
:: =. +>.$ (blab (print leaf/"+ :{(trip p.mad)}"))
?. =- (~(has by r:(arch -)) %core)
2014-11-23 04:17:21 +03:00
.^(%cy /(scot %p our.hid)/main/(scot %da lat.hid)/app/[p.mad])
(blab (print leaf/"app {<p.mad>} does not exist"))
2015-01-16 02:48:08 +03:00
=+ liz=`(list mand)`(welp mud mad ~)
%+ with [%clsg (turn liz |=(mand [%clsg q]))]
|= arg=vase
=| inp=(unit span)
|-
?~ liz ..eat-run
2014-09-26 04:10:17 +04:00
=+ cil=(scot %ud pid)
2015-01-16 02:48:08 +03:00
%_ $
liz t.liz
arg (slot 3 arg)
2014-10-10 00:05:21 +04:00
pid +(pid)
2015-01-16 02:48:08 +03:00
pip ?~ inp pip (~(add ja pip) cil u.inp)
pop ?~ inp pop (~(add ja pop) u.inp cil)
inp `cil
2014-10-31 04:54:54 +03:00
mow
=< mow :: XX side effects?
2015-01-20 00:54:49 +03:00
%- blab
=+ yon=[our.hid cil imp.hid]
2015-01-16 02:48:08 +03:00
=+ mez=[(cat 3 p.i.liz '-args') (slot 2 arg)]
^- (list move)
2015-01-16 02:48:08 +03:00
:~ [ost %pass /child/[cil]/fork %g %sire p.i.liz cil]
[ost %pass /child/[cil]/out %g %show yon you /out]
[ost %pass /child/[cil]/main %g %meta !>([%mess yon you mez])]
==
2014-09-23 02:20:47 +04:00
==
::
2014-10-31 04:54:54 +03:00
++ eat-rvar
|= vor=term
^+ +>
=+ mod=(~(has by var) vor)
=. var (~(del by var) vor)
(blab (print leaf/"{?:(mod "var gone" "no var")} {<vor>}"))
::
++ eat-var
|= [vor=term gen=twig]
^+ +>
2015-01-16 02:48:08 +03:00
%+ with gen |= new=vase
2014-10-31 04:54:54 +03:00
=+ old=(~(get by var) vor)
2014-10-10 02:33:00 +04:00
=+ mod=?~(old "new var" ?:(=(new u.old) "same var" "changed"))
2014-10-31 04:54:54 +03:00
=. var (~(put by var) vor new)
(blab (print leaf/"{mod} {<vor>}"))
2014-10-02 04:46:24 +04:00
::
2015-01-16 02:48:08 +03:00
++ with
|= [gen=twig coz=$+(vase _..with)]
%- coz
2014-10-31 04:54:54 +03:00
%- slap :_ gen
%+ slop
%+ slop [[%face %our p] q]:!>(our.hid)
%+ slop [[%face %tym p] q]:!>(lat.hid)
[[%face %eny p] q]:!>(eny.hid)
2014-10-31 04:54:54 +03:00
%+ roll (~(tap by var))
=< .(q pit)
|= [[n=term v=vase] q=vase]
(slop [[%face n p.v] q.v] q)
2014-09-25 04:37:29 +04:00
::
2014-11-25 01:00:13 +03:00
++ kill
|= cil=span
^- (list move)
2014-11-25 02:02:14 +03:00
:~ [ost %pass /child/[cil]/fork %g %cide cil]
::[ost %pass /child/[cil]/out %g %nuke [our.hid cil imp.hid] our.hid]
2014-11-25 01:00:13 +03:00
==
::
2014-10-31 04:54:54 +03:00
++ next-act :: rotate active task
2014-12-17 02:46:30 +03:00
=+ ^- nex=(unit span)
=+ opt=[i=`(unit span)`~ t=(turn cubs |=(a=span `(unit span)`[~ a]))]
|-
?~ t.opt ~
?: =(act i.opt)
i.t.opt
$(opt t.opt)
?. tiv +(act nex)
%- blab(act nex)
%+ weld
?~ nex ~
(spam /active/[u.nex] %rush %type %&)
?~ act ~
(spam /active/[u.act] %rush %type %|)
2014-10-31 04:54:54 +03:00
::
++ peer
|= [you=ship gal=glas]
^+ +>
?@ gal
%_ +>.$
mow :_(mow [ost %give %rush %term-line prompt ~ ~])
==
2014-12-17 02:29:07 +03:00
?: ?=(%active -.gal)
(blab [ost %give %rush %type %|] ~)
2014-10-31 04:54:54 +03:00
?. (~(has by cub.hid) p.gal) +>.$
?: (~(has by pop) p.gal) +>.$
2015-01-16 02:48:08 +03:00
=: act `p.gal
pop (~(put by pop) p.gal ~) :: .=(~ standard-in)
==
2014-10-31 04:54:54 +03:00
(blab ping)
::
2015-01-20 00:54:49 +03:00
++ ping (print-vase !>(*tang))
2014-10-31 04:54:54 +03:00
++ poke-kyev
|= [you=ship key=kyev]
^+ +>
?: ?=([~ @] key) (poke-txt you q.key) :: simple keypress ?
?> ?=([[%ctrl ~ ~] @t] key)
?+ q.key
%+ blab
[ost %give %nice ~]
(print leaf/"no command \\{(trip q.key)}")
2014-11-20 01:18:37 +03:00
%d ?~ act
%^ blab
[ost %give %nice ~]
[ost %give %logo ~]
~
2014-12-17 02:46:30 +03:00
(eat-end:next-act %& (slav %ud u.act))
%g =+ =- tak=rose/[" " "[" "]"]^(turn (~(tap by cub.hid)) -)
=+ c=(sa cubs)
|= [a=span b=term]
:- %leaf
=+ (trip (rap 3 b '(' a ')' ~))
?.((~(has in c) a) - ?.(=([~ a] act) ['+' -] ['*' -]))
2015-01-20 00:54:49 +03:00
(blab [ost %give %nice ~] (print tak))
2014-12-17 02:46:30 +03:00
%x =. +>.$ next-act
2014-11-24 22:01:58 +03:00
(blab [ost %give %nice ~] ping)
2014-10-31 04:54:54 +03:00
==
::
++ poke-txt :: handle command
|= [you=ship txt=cord]
^+ +>
?^ act :: pipe to child
%+ blab
[ost %give %nice ~]
(spam /in/[u.act] %rush %txt txt)
=+ pas=((full ~(parse from pax lat.hid)) [1 1] (trip txt))
?~ q.pas
2015-01-16 06:10:37 +03:00
=- (blab (weld (stray txt) (print leaf/-)))
"<syntax error at {<`[@ @]`p.pas>}>"
2014-10-31 04:54:54 +03:00
=+ com=(wonk pas)
=> .(+>.$ (eat you com))
=. +>.$ (blab (stash txt))
+>.$(mow :_(mow [ost %give %nice ~]))
2014-09-23 03:06:55 +04:00
::
2014-12-17 02:29:07 +03:00
++ poke-type
|= [you=ship tiv=?]
^+ +>
2014-12-17 02:46:30 +03:00
=. tiv tiv
2014-12-17 02:29:07 +03:00
?^ act
%+ blab
[ost %give %nice ~]
(spam /active/[u.act] %rush %type tiv)
(blab [ost %give %nice ~] ~)
::
2015-01-20 00:54:49 +03:00
++ print |=(a=tank (print-vase !>(`tang`[a ~])))
2014-10-31 04:54:54 +03:00
++ print-vase
2015-01-20 00:54:49 +03:00
|= tan=vase :: [p=p:!>(*tang) q=*]
2014-10-31 04:54:54 +03:00
^- (list move)
%^ spam /out %meta
:(slop !>(%rush) !>(%term-line) !>(prompt) !>(~) tan)
::
++ prompt
^- [p=cord q=prom r=cord]
2014-10-31 04:54:54 +03:00
?^ act
2014-11-01 03:53:11 +03:00
=+ por=(~(get by pot) u.act)
?^ por u.por
2014-11-19 04:17:11 +03:00
[(rap 3 (~(got by cub.hid) u.act) '(' u.act ') ' ~) %text '']
:_ [%text '']
2014-10-31 04:54:54 +03:00
?. &(?=([@ @ @ *] pax) =('0' &3.pax))
2014-11-24 02:26:17 +03:00
(rsh 3 1 (cat 3 (spat pax) '> '))
2014-11-05 23:35:36 +03:00
(rap 3 &1.pax '/' &2.pax '=' ?~(|3.pax ~['> '] ~[(spat |3.pax) '> ']))
2014-10-31 04:54:54 +03:00
::
++ purr
|= [cil=span fom=?(%fork %out %main) typ=type sih=sign]
^+ +>
?< ?=(?(%init %sage %verb %veer %vega) +<.sih)
2014-10-31 04:54:54 +03:00
?- fom
%fork
2014-09-23 02:20:47 +04:00
?> ?=(%gone +<.sih)
2015-01-16 02:48:08 +03:00
=. mow :_(mow [ost %give %nice ~])
?. =(act [~ cil]) +>.$
2015-01-16 06:10:37 +03:00
=. act ~
(blab ping)
2014-10-31 04:54:54 +03:00
::
2014-09-23 05:00:25 +04:00
%main
?> ?=(?(%nice %mean) +<.sih)
%+ blab
[ost %give +.sih]
?. ?=(%mean +<.sih)
ping
(welp ping (kill cil))
2014-10-31 04:54:54 +03:00
::
2014-09-27 05:01:17 +04:00
%out
2014-10-31 04:54:54 +03:00
?. ?=(?(%rust %rush) +<.sih) +>.$
2015-01-20 03:07:31 +03:00
=> .(+<.sih %rush)
2014-11-05 23:35:36 +03:00
?: ?=(%prompt p.sih)
2015-01-16 02:48:08 +03:00
?^ (~(get ja pip) cil) +>.$
2014-11-19 04:17:11 +03:00
=. pot (~(put by pot) cil (,[cord prom cord] q.sih))
2014-11-05 23:35:36 +03:00
(blab ping)
2014-10-31 04:54:54 +03:00
%- blab
?: (~(has by pip) cil)
2015-01-16 02:48:08 +03:00
=+ inp=(~(get ja pip) cil)
|-
?~ inp ~
%+ weld $(inp t.inp)
(spam /in/[i.inp] %meta (slot 3 typ sih))
2014-10-31 04:54:54 +03:00
%- print-vase
2014-09-26 04:54:51 +04:00
?+ p.sih
2014-10-01 01:07:40 +04:00
!>([(sell (slot 15 [typ sih]))]~)
2015-01-20 00:54:49 +03:00
%tang (slam !>(flop) p:!>(*tang) q.sih)
%txt
?^ q.sih !! :: move to vase space?
!>([leaf/(trip q.sih)]~)
2014-10-31 04:54:54 +03:00
==
2014-09-23 02:20:47 +04:00
==
2014-10-31 04:54:54 +03:00
::
++ spam
|= [pax=path gip=gift]
^- (list move)
%+ turn
(~(tap in (~(get ju pus.hid) pax)))
|=(a=bone [a %give gip])
::
++ stash
|= a=cord
%^ spam /out %meta
!>([%rush %term-line `term-line`[prompt [a]~ ~]])
::
++ stray
|= a=cord
%^ spam /out %meta
=+ pro=prompt
!>([%rush %term-line `term-line`[pro(r a) ~ ~]])
2014-10-31 04:54:54 +03:00
--
--
2015-02-06 08:00:35 +03:00
::
2014-10-31 04:54:54 +03:00
:::: formal interface
!:
2014-10-31 04:54:54 +03:00
|_ [hid=hide vat=axle]
2014-09-23 02:20:47 +04:00
::
2014-10-31 04:54:54 +03:00
++ peer :: handle subscription
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
?~ pax `+>.$
2014-12-17 02:29:07 +03:00
?. ?=(?(%in %out %active) i.pax) `+>.$
2014-10-31 04:54:54 +03:00
=+ ^= gal
?: ?=(%out i.pax) %out
2014-12-17 02:29:07 +03:00
?: ?=(%in i.pax) [%in ?<(?=(~ t.pax) i.t.pax)]
[%active ?<(?=(~ t.pax) i.t.pax)]
2014-10-31 04:54:54 +03:00
=+ abet:(peer:(ve hid ost vat) you gal)
[-< +>.$(vat ->)]
2014-10-03 03:00:57 +04:00
::
2014-10-31 04:54:54 +03:00
++ poke-kyev :: handle key event
|= [ost=bone you=ship key=kyev]
^- [(list move) _+>]
=+ abet:(poke-kyev:(ve hid ost vat) you key)
[-< +>.$(vat ->)]
2014-10-01 01:53:37 +04:00
::
2014-10-31 04:54:54 +03:00
++ poke-txt :: handle command
|= [ost=bone you=ship txt=cord]
^- [(list move) _+>]
=+ abet:(poke-txt:(ve hid ost vat) you txt)
[-< +>.$(vat ->)]
2014-10-02 04:42:59 +04:00
::
2014-12-17 02:29:07 +03:00
++ poke-type :: handle command
|= [ost=bone you=ship tiv=?]
^- [(list move) _+>]
=+ abet:(poke-type:(ve hid ost vat) you tiv)
[-< +>.$(vat ->)]
::
2014-10-31 04:54:54 +03:00
++ purr
|= [ost=bone pax=path typ=type sih=sign]
^- [(list move) _+>]
?: ?=(%init +<.sih) :: vomit
[[ost %give +.sih]~ +>.$]
?: ?=(%dumb +<.sih) :: sleep
[~ +>.$]
2014-10-31 04:54:54 +03:00
?: ?=(%sage +<.sih) :: vomit
[[ost %give +.sih]~ +>.$]
?: ?=(%verb +<.sih) :: vomit
[[ost %give +.sih]~ +>.$]
?: ?=(%veer +<.sih) :: vomit
[[ost %give +.sih]~ +>.$]
?: ?=(%vega +<.sih) :: vomit
[[ost %give +.sih]~ +>.$]
?~ pax ~& %no-path !!
?> ?=([%child span ?(%fork %out %main) ~] pax)
2015-01-20 01:02:00 +03:00
=^ moz vat abet:(purr:(ve hid ost vat) i.t.pax i.t.t.pax typ sih)
:_ +>.$
?. ?=(%rush +<.sih) moz
[[ost %pass pax %g %took [our.hid i.t.pax imp.hid] our.hid] moz]
2014-09-12 06:11:03 +04:00
--