mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-14 08:34:25 +03:00
Preliminary exec refactoring
This commit is contained in:
parent
fe2e46b3a2
commit
a1ad306da3
@ -10,13 +10,14 @@
|
||||
::
|
||||
|% ::
|
||||
++ axle ::
|
||||
$: %0 :: version
|
||||
$: %1 :: version
|
||||
tiv=? :: typing?
|
||||
wit=[p=@u q=(map ,@u coma)] :: waiting commands
|
||||
pid=@u :: next process id
|
||||
pax=_`path`/=try= :: working directory
|
||||
act=(unit span) :: active child
|
||||
pip=(map span span) :: pipe out->in
|
||||
pop=(map span span) :: pipe in->out
|
||||
pip=(jar span span) :: pipe out->in
|
||||
pop=(jar span span) :: pipe in->out
|
||||
pot=(map span ,[cord prom cord]) :: prompts
|
||||
var=(map term vase) :: variables
|
||||
== ::
|
||||
@ -114,9 +115,9 @@
|
||||
;~ pose
|
||||
(stag %run ;~(plug (star ;~(sfix (task(tol %0) bar) ace)) (task col)))
|
||||
(stag %end ;~(pfix col sem ;~(pose (stag %& dem) (stag %| sym))))
|
||||
(stag %del ;~(pfix hep ace loca))
|
||||
(stag %del ;~(pfix hep (plus ace) loca))
|
||||
(stag %mut ;~(pfix col (plus ace) ;~(plug loca (opts expg))))
|
||||
(stag %ins ;~(pfix lus ace ;~(plug loca (opts expg))))
|
||||
(stag %ins ;~(pfix lus (plus ace) ;~(plug loca (opts expg))))
|
||||
(stag %help ;~(pfix wut ace ;~(pfix col sym)))
|
||||
(stag %path (full ;~(sfix loca(pax paf) (star ace))))
|
||||
(stag %var ;~(plug ;~(pfix tis sym) expg))
|
||||
@ -141,7 +142,7 @@
|
||||
::
|
||||
--
|
||||
--
|
||||
::
|
||||
!:
|
||||
:::: per event
|
||||
::
|
||||
|%
|
||||
@ -160,6 +161,7 @@
|
||||
::
|
||||
++ chew-file
|
||||
|= [paf=path mor=$|(cord toro)]
|
||||
%- blab
|
||||
^- (list move)
|
||||
?@ mor
|
||||
(print palm/[" " ~ ~ ~]^~[leaf/(trip mor) (dank:ut paf)])
|
||||
@ -168,14 +170,9 @@
|
||||
++ 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)
|
||||
%+ murn (~(tap by cub.hid))
|
||||
|= [a=span @]
|
||||
?.(=([~ ~] (~(get by pop) a)) ~ (some a))
|
||||
::
|
||||
++ eat
|
||||
|= [you=ship com=coma]
|
||||
@ -196,7 +193,6 @@
|
||||
++ eat-del
|
||||
|= paf=path
|
||||
^+ +>
|
||||
%- blab
|
||||
%+ chew-file paf
|
||||
?~ (file paf) '! none'
|
||||
(fray paf)
|
||||
@ -227,26 +223,27 @@
|
||||
++ eat-hoon
|
||||
|= gen=twig
|
||||
^+ +>
|
||||
(blab (print (sell (exec gen))))
|
||||
%+ with gen |= rez=vase
|
||||
(blab (print (sell rez)))
|
||||
::
|
||||
++ eat-ins
|
||||
|= [paf=path gen=(unit twig)]
|
||||
^+ +>
|
||||
%- blab
|
||||
%+ chew-file paf
|
||||
?^ (file paf) '! exists'
|
||||
(foal paf q:(exec (fall gen [%bczp atom/%t])))
|
||||
?^ (file paf) (chew-file paf '! exists')
|
||||
%+ with (fall gen [%bczp atom/%t])
|
||||
|= new=vase
|
||||
(chew-file paf (foal paf q.new))
|
||||
::
|
||||
++ eat-mut
|
||||
|= [paf=path gen=(unit twig)]
|
||||
^+ +>
|
||||
%- blab
|
||||
=+ fel=(file paf)
|
||||
?~ fel
|
||||
(chew-file paf '! none')
|
||||
?^ gen
|
||||
(chew-file paf (foal paf q:(exec u.gen)))
|
||||
(stray (crip ": {(spud paf)} {<(,@t u.fel)>}"))
|
||||
?^ gen
|
||||
%+ with u.gen |= new=vase
|
||||
(chew-file paf (foal paf q.new))
|
||||
(blab (stray (crip ": {(spud paf)} {<(,@t u.fel)>}")))
|
||||
::
|
||||
++ eat-help
|
||||
|= app=term
|
||||
@ -277,25 +274,26 @@
|
||||
?. =- (~(has by r:(arch -)) %core)
|
||||
.^(%cy /(scot %p our.hid)/main/(scot %da lat.hid)/app/[p.mad])
|
||||
(blab (print leaf/"app {<p.mad>} does not exist"))
|
||||
=| inp=(unit span)
|
||||
=< +>.$
|
||||
%+ reel
|
||||
`(list mand)`(welp mud mad ~)
|
||||
=+ a=[app=*mand .]
|
||||
|.
|
||||
=> a
|
||||
=+ liz=`(list mand)`(welp mud mad ~)
|
||||
%+ with [%clsg (turn liz |=(mand [%clsg q]))]
|
||||
|= arg=vase
|
||||
=| inp=(unit span)
|
||||
|-
|
||||
?~ liz ..eat-run
|
||||
=+ cil=(scot %ud pid)
|
||||
%_ +>
|
||||
%_ $
|
||||
liz t.liz
|
||||
arg (slot 3 arg)
|
||||
pid +(pid)
|
||||
pip ?~ inp pip (~(put by pip) cil u.inp)
|
||||
pop ?~ inp pop (~(put by pop) u.inp cil)
|
||||
pip ?~ inp pip (~(add ja pip) cil u.inp)
|
||||
pop ?~ inp pop (~(add ja pop) u.inp cil)
|
||||
inp `cil
|
||||
mow
|
||||
=+ yon=[our.hid cil imp.hid]
|
||||
=+ mez=[(cat 3 p.app '-args') (exec [%clsg q.app])]
|
||||
=+ mez=[(cat 3 p.i.liz '-args') (slot 2 arg)]
|
||||
%- welp :_ mow
|
||||
^- (list move)
|
||||
:~ [ost %pass /child/[cil]/fork %g %sire p.app cil]
|
||||
:~ [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])]
|
||||
==
|
||||
@ -311,14 +309,15 @@
|
||||
++ eat-var
|
||||
|= [vor=term gen=twig]
|
||||
^+ +>
|
||||
%+ with gen |= new=vase
|
||||
=+ old=(~(get by var) vor)
|
||||
=+ new=(exec gen)
|
||||
=+ mod=?~(old "new var" ?:(=(new u.old) "same var" "changed"))
|
||||
=. var (~(put by var) vor new)
|
||||
(blab (print leaf/"{mod} {<vor>}"))
|
||||
::
|
||||
++ exec
|
||||
|= gen=twig
|
||||
++ with
|
||||
|= [gen=twig coz=$+(vase _..with)]
|
||||
%- coz
|
||||
%- slap :_ gen
|
||||
%+ slop
|
||||
%+ slop [[%face %our p] q]:!>(our.hid)
|
||||
@ -363,7 +362,9 @@
|
||||
(blab [ost %give %rush %type %|] ~)
|
||||
?. (~(has by cub.hid) p.gal) +>.$
|
||||
?: (~(has by pop) p.gal) +>.$
|
||||
=. act `p.gal
|
||||
=: act `p.gal
|
||||
pop (~(put by pop) p.gal ~) :: .=(~ standard-in)
|
||||
==
|
||||
(blab ping)
|
||||
::
|
||||
++ ping (print-vase !>(*(list tank)))
|
||||
@ -443,10 +444,10 @@
|
||||
?- fom
|
||||
%fork
|
||||
?> ?=(%gone +<.sih)
|
||||
%_ +>.$
|
||||
mow :_(mow [ost %give %nice ~])
|
||||
act ?:(=(act [~ cil]) ~ act)
|
||||
==
|
||||
=. mow :_(mow [ost %give %nice ~])
|
||||
?. =(act [~ cil]) +>.$
|
||||
~& gone/[cil (~(got by cub.hid) cil)]
|
||||
(blab(act ~) ping)
|
||||
::
|
||||
%main
|
||||
?> ?=(?(%nice %mean) +<.sih)
|
||||
@ -459,12 +460,16 @@
|
||||
%out
|
||||
?. ?=(?(%rust %rush) +<.sih) +>.$
|
||||
?: ?=(%prompt p.sih)
|
||||
?: (~(has by pip) cil) +>.$
|
||||
?^ (~(get ja pip) cil) +>.$
|
||||
=. pot (~(put by pot) cil (,[cord prom cord] q.sih))
|
||||
(blab ping)
|
||||
%- blab
|
||||
?: (~(has by pip) cil)
|
||||
(spam /in/(~(got by pip) cil) %meta (slot 3 typ sih))
|
||||
=+ inp=(~(get ja pip) cil)
|
||||
|-
|
||||
?~ inp ~
|
||||
%+ weld $(inp t.inp)
|
||||
(spam /in/[i.inp] %meta (slot 3 typ sih))
|
||||
%- print-vase
|
||||
?+ p.sih
|
||||
!>([(sell (slot 15 [typ sih]))]~)
|
||||
@ -494,7 +499,7 @@
|
||||
!>([%rush %term-line `term-line`[pro(r a) ~ ~]])
|
||||
--
|
||||
--
|
||||
::
|
||||
!:
|
||||
:::: formal interface
|
||||
::
|
||||
|_ [hid=hide vat=axle]
|
||||
|
@ -119,7 +119,7 @@
|
||||
?- gal
|
||||
%term [ost %give %rust %hymn page] :: hymn front end
|
||||
%lines [ost %give %rust %term-line tel] :: term-line output
|
||||
==
|
||||
==
|
||||
==
|
||||
::
|
||||
++ poke
|
||||
|
Loading…
Reference in New Issue
Block a user