diff --git a/main/app/shell/core.hook b/main/app/shell/core.hook index d712bcf90f..0e75da762e 100644 --- a/main/app/shell/core.hook +++ b/main/app/shell/core.hook @@ -9,6 +9,14 @@ :::: structures :: |% :: +++ axle :: + $: pid=@u :: + pax=_`path`/=try= :: + act=(unit span) :: + pip=(map span span) :: + pop=(map span span) :: + var=(map term vase) :: + == :: ++ gift :: $% [%rush p=gilt] :: [%mean p=ares] :: @@ -23,6 +31,7 @@ $% [%term-line p=term-line] :: [%txt p=cord] :: == :: +++ glas $|(%out [%in p=cord]) :: ++ hapt ,[p=ship q=path] :: ++ move ,[p=bone q=(mold note gift)] :: ++ note :: @@ -119,184 +128,315 @@ -- -- !: -:::: program +:::: per event :: -|_ $: hid=hide - pid=@u - pax=_`path`/=try= - act=(unit span) - pip=(map span span) - pop=(map span span) - var=(map term vase) - == -:: -++ peer :: handle subscription - |= [ost=bone you=ship pax=path] - ^- [(list move) _+>] - ?~ pax `+>.$ - ?+ i.pax `+>.$ - %in :: to app - ?~ t.pax `+>.$ - ?. (~(has by cub.hid) i.t.pax) `+>.$ - ?: (~(has by pop) i.t.pax) `+>.$ - :_ +>.$(act `i.t.pax) - (print ost you ~) - %out :: to terminal - ?> ?=(~ t.pax) - :_ +>.$ - [ost %give %rush %term-line `term-line`[prompt ~ ~]]~ - == -:: -++ cubs :: tasks with open /in - %- sort :_ |=([a=span b=span] (lth (slav %ud a) (slav %ud b))) - ^- (list span) - %+ murn (~(tap by sup.hid)) - |= [@ @ a=path] - ?. ?& ?=([%in cord ~] a) - (~(has by cub.hid) i.t.a) - !(~(has by pop) i.t.a) - == - ~ - (some i.t.a) -:: -++ next-act :: rotate active task - =+ opt=[i=`(unit span)`~ t=(turn cubs |=(a=span `(unit span)`[~ a]))] - |- - ?~ t.opt ~ - ?: =(act i.opt) - i.t.opt - $(opt t.opt) -:: -++ poke-kyev :: handle key event - |= [ost=bone you=ship key=kyev] - ^- [(list move) _+>] - ?: ?=([~ @] key) (poke-txt ost you q.key) :: simple keypress - ?> ?=([[%ctrl ~ ~] @t] key) - ?+ q.key - :_ +>.$ - :- [ost %give %nice ~] - (print ost you leaf/"no command \\{(trip q.key)}" ~) - %x =. act next-act - :_ +>.$ - :- [ost %give %nice ~] - (print ost you ~) - %l =+ =- tak=rose/[" " "[" "]"]^(turn cubs -) - |= a=span - leaf/(trip (rap 3 (~(got by cub.hid) a) '(' a ')' ~)) - [[[ost give/nice/~] (print ost you tak ~)] +>.$] - == -:: -++ poke-txt :: handle command - |= [ost=bone you=ship txt=cord] - ^- [(list move) _+>] - ?: =('\\' (end 3 1 txt)) :: escaped ctrl-key - (poke-kyev ost you [%ctrl ~ ~] (rsh 3 1 txt)) - ?^ act :: pipe to child - :_ +>.$ - :- [ost %give %nice ~] - (spam /in/[u.act] %rush %txt txt) +|% +++ ve + |= [hid=hide ost=bone axle] + =* vat +<+> + =| mow=(list move) + |% + ++ abet + ^- [(list move) axle] + [(flop mow) vat] :: - =- :_ con - %+ welp (stash:con ost you txt) - ?~ tak - mof - %+ welp - (print:con ost you tak ~) - [[ost %give %nice ~] mof] - ^- [con=_+>.$ tak=$|(~ tank) mof=(list move)] - =+ pas=((full ~(parse from pax lat.hid)) [1 1] (trip txt)) - ?~ q.pas - [+>.$ leaf/"}>" ~] - =+ com=(wonk pas) - ^- [con=_+>.$ tak=$|(~ tank) mof=(list move)] - ?- -.com - %path - =. pax p.com - [+>.$ leaf/"=% {(spud p.com)}" ~] + ++ blab + |= mof=(list move) + +>.$(mow (welp mof mow)) :: - ?(%ins %mut %del) - :- +>.$ - =+ paf=[.(&3 '=')]:?+(-.com p.com %del p.com) - =- :- palm/[" " ~ ~ ~]^~[leaf/msg (dank:ut paf)] - (turn (drop tor) |=(a=toro [ost %pass writ/paf %c %info our.hid a])) - ^- [msg=tape tor=(unit toro)] - |- - ?- -.com - %ins - ?^ (file p.com) ["! exists" ~] - ["written" `(foal p.com q:(exec (fall q.com [%bczp atom/%t])))] - %mut - ?~ (file p.com) $(com [%del p.com]) - ["changed" `(foal p.com q:(exec q.com))] - %del - ?~ (file p.com) ["! none" ~] - ["written" `(fray p.com)] + ++ chew-file + |= [paf=path msg=tape tor=(unit toro)] + ^- (list move) + %+ welp + (print palm/[" " ~ ~ ~]^~[leaf/msg (dank:ut paf)]) + %+ turn (drop tor) + |=(a=toro [ost %pass writ/paf %c %info our.hid a]) + :: + ++ cubs :: tasks with open /in + %- sort :_ |=([a=span b=span] (lth (slav %ud a) (slav %ud b))) + ^- (list span) + %+ murn (~(tap by sup.hid)) + |= [@ @ a=path] + ?. ?& ?=([%in cord ~] a) + (~(has by cub.hid) i.t.a) + !(~(has by pop) i.t.a) + == + ~ + (some i.t.a) + :: + ++ eat + |= [you=ship com=coma] + ?- -.com + %path (eat-path +.com) + %ins (eat-ins +.com) + %mut (eat-mut +.com) + %del (eat-del +.com) + %run (eat-run you +.com) + %end (eat-end +.com) + %var (eat-var +.com) + %rvar (eat-rvar +.com) + %hoon (eat-hoon +.com) == :: - %run - =+ mof=(print ost you leaf/"+ :{(trip p.q.com)}" ~) + ++ eat-del + |= paf=path + ^+ +> + =. &3.paf '=' + %- blab + %+ chew-file paf + ?^ (file paf) ["! none" ~] + ["deleted" `(fray paf)] + :: + ++ eat-end + |= poc=(each ,@u cord) + ^+ +> + ?- -.poc + %& + =+ cil=(scot %ud p.poc) + =+ cin=(trip (~(got by cub.hid) cil)) + %+ blab + [ost %pass /child/[cil]/fork %g %cide cil] + (print leaf/"- :{cin}({(trip cil)})") + :: + %| + =+ ^- moz=(list move) + %+ murn (~(tap by cub.hid)) + |= [a=span b=term] + ?. =(b p.poc) ~ + %- some + [ost %pass /child/[a]/fork %g %cide a] + %- blab %+ welp moz + (print leaf/"-{<(lent moz)>} :{(trip p.poc)}") + == + :: + ++ eat-hoon + |= gen=twig + ^+ +> + (blab (print (sell (exec gen)))) + :: + ++ eat-ins + |= [paf=path gen=(unit twig)] + ^+ +> + =. &3.paf '=' + %- blab + %+ chew-file paf + ?^ (file paf) ["! exists" ~] + :- "written" + `(foal paf q:(exec (fall gen [%bczp atom/%t]))) + :: + ++ eat-mut + |= [paf=path gen=twig] + ^+ +> + =. &3.paf '=' + %- blab + %+ chew-file paf + ?^ (file paf) ["! none" ~] + ["changed" `(foal paf q:(exec gen))] + :: + ++ eat-path + |= paf=path + ^+ +> + =. pax paf + (blab (print leaf/"=% {(spud paf)}")) + :: + ++ eat-run + |= [you=ship mud=(list mand) mad=mand] + ^+ +> + =. +>.$ (blab (print leaf/"+ :{(trip p.mad)}")) =| inp=(unit span) - =< [+>.$ ~ mof] + =< +>.$ %+ reel - `(list mand)`(welp p.com q.com ~) + `(list mand)`(welp mud mad ~) =+ a=[app=*mand .] |. => a =+ cil=(scot %ud pid) - ::~& [%pipsqueak ] - %_ +> + %_ +> pid +(pid) pip ?~ inp pip (~(put by pip) cil u.inp) pop ?~ inp pop (~(put by pop) u.inp cil) inp `cil - mof + mow =+ yon=[our.hid cil imp.hid] =+ mez=[(cat 3 p.app '-args') (exec [%clsg q.app])] - =- (weld (flop -) mof) :: XX strange order + %- welp :_ mow ^- (list move) - :~ [ost %pass /child/[cil] %g %sire p.app cil] + :~ [ost %pass /child/[cil]/fork %g %sire p.app cil] [ost %pass /child/[cil]/out %g %show yon you /out] [ost %pass /child/[cil]/main %g %meta !>([%mess yon you mez])] == == :: - %end - ?: ?=(%& -.p.com) - =+ cil=(scot %ud p.p.com) - =+ cin=(trip (~(got by cub.hid) cil)) - :- +>.$ :- ~ - :_ (print ost you leaf/"- :{cin}({(trip cil)})" ~) - [ost %pass /child/[cil] %g %cide cil] - =* cil p.p.com - =- [+>.$ leaf/"-{<(lent moz)>} :{(trip cil)}" moz] - ^= moz - %+ murn (~(tap by cub.hid)) |= [a=span b=term] - ?. =(b cil) ~ - %- some - [ost %pass /child/[a] %g %cide a] + ++ eat-rvar + |= vor=term + ^+ +> + =+ mod=(~(has by var) vor) + =. var (~(del by var) vor) + (blab (print leaf/"{?:(mod "var gone" "no var")} {}")) :: - %var - =+ old=(~(get by var) p.com) - =+ new=(exec q.com) + ++ eat-var + |= [vor=term gen=twig] + ^+ +> + =+ old=(~(get by var) vor) + =+ new=(exec gen) =+ mod=?~(old "new var" ?:(=(new u.old) "same var" "changed")) - =. var (~(put by var) p.com new) - [+>.$ leaf/"{mod} {}" ~] + =. var (~(put by var) vor new) + (blab (print leaf/"{mod} {}")) :: - %rvar - =+ mod=(~(has by var) p.com) - =. var (~(del by var) p.com) - [+>.$ leaf/"{?:(mod "var gone" "no var")} {}" ~] + ++ exec + |= gen=twig + %- slap :_ gen + %+ roll (~(tap by var)) + =< .(q pit) + |= [[n=term v=vase] q=vase] + (slop [[%face n p.v] q.v] q) :: - %hoon - [+>.$ (sell (exec p.com)) ~] - == + ++ next-act :: rotate active task + =+ opt=[i=`(unit span)`~ t=(turn cubs |=(a=span `(unit span)`[~ a]))] + |- + ?~ t.opt ~ + ?: =(act i.opt) + i.t.opt + $(opt t.opt) + :: + ++ peer + |= [you=ship gal=glas] + ^+ +> + ?@ gal + %_ +>.$ + mow :_(mow [ost %give %rush %term-line prompt ~ ~]) + == + ?. (~(has by cub.hid) p.gal) +>.$ + ?: (~(has by pop) p.gal) +>.$ + =. act `p.gal + (blab ping) + :: + ++ ping (print-vase !>(*(list tank))) + ++ 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)}") + %x =. act next-act + (blab [ost %give %nice ~] ping) + %l =+ =- tak=rose/[" " "[" "]"]^(turn cubs -) + |= a=span + leaf/(trip (rap 3 (~(got by cub.hid) a) '(' a ')' ~)) + (blab [ost give/nice/~] (print tak)) + == + :: + ++ poke-txt :: handle command + |= [you=ship txt=cord] + ^+ +> + ?: =('\\' (end 3 1 txt)) :: escaped ctrl-key + (poke-kyev you [%ctrl ~ ~] (rsh 3 1 txt)) + ?^ 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 + (blab (print leaf/"}>")) + =+ com=(wonk pas) + => .(+>.$ (eat you com)) + =. +>.$ (blab (stash txt)) + +>.$(mow :_(mow [ost %give %nice ~])) + :: + ++ print |=(a=tank (print-vase !>(`(list tank)`[a ~]))) + ++ print-vase + |= tan=vase :: [p=p:!>(*(list tank)) q=*] + ^- (list move) + %^ spam /out %meta + :(slop !>(%rush) !>(%term-line) !>(prompt) !>(~) tan) + :: + ++ prompt + ^- @t + ?^ act + (rap 3 (~(got by cub.hid) u.act) '(' u.act ') ' ~) + ?. &(?=([@ @ @ *] pax) =('0' &3.pax)) + (rsh 3 1 (spat pax)) + (rap 3 &1.pax '/' &2.pax '=' ?~(|3.pax ~ [(spat |3.pax)]~)) + :: + ++ purr + |= [cil=span fom=?(%fork %out %main) typ=type sih=sign] + ^+ +> + ?< ?=(?(%sage %verb %veer %vega) +<.sih) + ?- fom + %fork + ?> ?=(%gone +<.sih) + %_ +>.$ + mow :_(mow [ost %give %nice ~]) + act ?:(=(act [~ cil]) ~ act) + == + :: + %main + ?> ?=(?(%nice %mean) +<.sih) + (blab [ost %give +.sih] ping) + :: + %out + ?. ?=(?(%rust %rush) +<.sih) +>.$ + %- blab + ?: (~(has by pip) cil) + (spam /in/(~(got by pip) cil) %meta (slot 3 typ sih)) + %- print-vase + ?+ p.sih + !>([(sell (slot 15 [typ sih]))]~) + %tang + (slot 15 [typ sih]) + %txt + ?^ q.sih !! :: move to vase space? + !>([leaf/(trip q.sih)]~) + == + == + :: + ++ 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]~ ~]]) + -- +-- +!: +:::: formal interface + :: +|_ [hid=hide vat=axle] +:: +++ peer :: handle subscription + |= [ost=bone you=ship pax=path] + ^- [(list move) _+>] + ?~ pax `+>.$ + ?. ?=(?(%in %out) i.pax) `+>.$ + =+ ^= gal + ?: ?=(%out i.pax) %out + [%in ?<(?=(~ t.pax) i.pax)] + =+ abet:(peer:(ve hid ost vat) you gal) + [-< +>.$(vat ->)] +:: +++ poke-kyev :: handle key event + |= [ost=bone you=ship key=kyev] + ^- [(list move) _+>] + =+ abet:(poke-kyev:(ve hid ost vat) you key) + [-< +>.$(vat ->)] +:: +++ poke-txt :: handle command + |= [ost=bone you=ship txt=cord] + ^- [(list move) _+>] + =+ abet:(poke-txt:(ve hid ost vat) you txt) + [-< +>.$(vat ->)] :: ++ purr |= [ost=bone pax=path typ=type sih=sign] ^- [(list move) _+>] - ::~& shel-purr/pax - :: ~& [%shell-pour -.sih (,@ta +<.sih)] - ::=+ sih=((hard sign) sih) ?: ?=(%sage +<.sih) :: vomit [[ost %give +.sih]~ +>.$] ?: ?=(%verb +<.sih) :: vomit @@ -306,74 +446,7 @@ ?: ?=(%vega +<.sih) :: vomit [[ost %give +.sih]~ +>.$] ?~ pax ~& %no-path !! - ?+ &1.pax ~& %strange-path !! - %print - `+>.$ - :: - %child - ?~ |1.pax ~& %no-child !! - ?~ |2.pax - ?> ?=(%gone +<.sih) - :- [ost %give %nice ~]~ - +>.$(act ?:(=(act [~ &2.pax]) ~ act)) - :_ +>.$ - ?+ &3.pax ~& %strange-child-path !! - %main - ?> ?=(?(%nice %mean) +<.sih) - :- [ost %give +.sih] - ::~& act - (print ost our.hid ~) - %out - ?. ?=(?(%rust %rush) +<.sih) ~ - ?: (~(has by pip) &2.pax) - :: ~& [%yay &2.pax ] - :: ~& [%spamming-to /in/(~(got by pip) &2.pax) (~(get ju pus.hid) /in/(~(got by pip) &2.pax))] - (spam /in/(~(got by pip) &2.pax) %meta (slot 3 typ sih)) - :: ~& [%nay &2.pax ] - %^ print-vase ost our.hid - ?+ p.sih - !>([(sell (slot 15 [typ sih]))]~) - %tang - (slot 15 [typ sih]) - %txt - ?^ q.sih !! :: move to vase space? - !>([leaf/(trip q.sih)]~) - == - == == -:: -++ stash - |= [a=bone b=ship c=cord] - ::~& shel-stash/[prompt c] - %^ spam /out %meta - !>([%rush %term-line `term-line`[prompt [c]~ ~]]) -:: -++ print |=([a=bone b=ship c=(list tank)] (print-vase a b !>(c))) -++ print-vase - |= [ost=bone you=ship tan=vase] :: [p=p:!>(*(list tank)) q=*] - ^- (list move) - ::~& shel-print/prompt - %^ spam /out %meta - :(slop !>(%rush) !>(%term-line) !>(prompt) !>(~) tan) -:: -++ prompt - ^- @t - ?^ act - (rap 3 (~(got by cub.hid) u.act) '(' u.act ') ' ~) - ?. &(?=([@ @ @ *] pax) =('0' &3.pax)) - (rsh 3 1 (spat pax)) - (rap 3 &1.pax '/' &2.pax '=' ?~(|3.pax ~ [(spat |3.pax)]~)) -++ exec - |= gen=twig - %- slap :_ gen - %+ roll (~(tap by var)) - =< .(q pit) - |= [[n=term v=vase] q=vase] - (slop [[%face n p.v] q.v] q) -:: -++ spam - |= [pax=path gip=gift] - ^- (list move) - %+ turn - (~(tap in (~(get ju pus.hid) pax))) - |=(a=bone [a %give gip]) + ?> ?=([%child span ?(%fork %out %main) ~] pax) + =+ abet:(purr:(ve hid ost vat) i.t.pax i.t.t.pax typ sih) + [-< +>.$(vat ->)] -- diff --git a/main/app/terminal/core.hook b/main/app/terminal/core.hook index 8e5d5c27d3..679311fedd 100644 --- a/main/app/terminal/core.hook +++ b/main/app/terminal/core.hook @@ -80,7 +80,7 @@ [ost %pass [%resp pax] %g %show [our [auc imp]] you /out]~ -- !: -:::: per-shell +:::: per shell :: |% ++ se @@ -216,7 +216,7 @@ -- -- !: -:::: public interface +:::: formal interface :: |_ [hid=hide axle] ++ peer