shrub/sys/vane/gall.hoon

1390 lines
48 KiB
Plaintext
Raw Normal View History

2017-10-30 20:48:56 +03:00
:: :: %gall, agent execution
2016-11-24 07:25:07 +03:00
!? 163
::::
|= pit/vase
=, gall
2015-05-10 01:55:05 +03:00
=> =~
2016-11-24 07:25:07 +03:00
|% :::::::::::::::::::::::::::::::::::::::::::::::::::::: rest of arvo
::::::::::::::::::::::::::::::::::::::::::::::::::::::
++ volt ?($low $high) :: voltage
2015-12-20 23:50:45 +03:00
++ torc $@(?($iron $gold) {$lead p/ship}) :: security control
2016-11-24 07:25:07 +03:00
++ roon :: reverse ames msg
$% {$d p/mark q/*} :: diff (diff)
2018-03-19 07:18:20 +03:00
{$x ~} ::
2016-11-24 07:25:07 +03:00
== ::
++ rook :: forward ames msg
$% {$m p/mark q/*} :: message
{$l p/mark q/path} :: "peel" subscribe
2016-11-24 07:25:07 +03:00
{$s p/path} :: subscribe
2018-03-19 07:18:20 +03:00
{$u ~} :: cancel+unsubscribe
2016-11-24 07:25:07 +03:00
== ::
-- ::
|% :::::::::::::::::::::::::::::::::::::::::::::::::::::: local arvo
::::::::::::::::::::::::::::::::::::::::::::::::::::::
++ cote :: ++ap note
2015-12-20 23:50:45 +03:00
$% {$meta p/@tas q/vase} ::
{$send p/ship q/cush} ::
2016-11-24 07:25:07 +03:00
{$hiss p/(unit knot) q/mark r/cage} ::
== ::
++ cove (pair bone (wind cote cuft)) :: internal move
++ move {p/duct q/(wind note-arvo gift-arvo)} :: typed move
2016-11-24 07:25:07 +03:00
-- ::
|% :::::::::::::::::::::::::::::::::::::::::::::::::::::: %gall state
::::::::::::::::::::::::::::::::::::::::::::::::::::::
2018-02-22 17:19:17 +03:00
++ axle-n ?(axle) :: upgrade path
2016-11-04 04:35:47 +03:00
:::::::::::::::::::::::::::::::::::::::::::::::::::::: state proper
::::::::::::::::::::::::::::::::::::::::::::::::::::::
2016-11-24 07:25:07 +03:00
++ axle :: all state
2018-02-22 17:19:17 +03:00
$: $0 :: state version
2018-12-13 04:34:25 +03:00
=mast :: apps by ship
2016-11-24 07:25:07 +03:00
== ::
++ gest :: subscriber data
$: sup/bitt :: incoming subscribers
neb/boat :: outgoing subscribers
qel/(map bone @ud) :: queue meter
== ::
++ mast :: ship state
$: mak/* :: (deprecated)
sys/duct :: system duct
2015-12-20 23:50:45 +03:00
sap/(map ship scad) :: foreign contacts
2016-11-24 07:25:07 +03:00
bum/(map dude seat) :: running agents
wub/(map dude sofa) :: waiting queue
== ::
++ ffuc :: new cuff
$: p/(unit (set ship)) :: disclosing to
q/ship :: attributed to
== ::
++ prey (pair volt ffuc) :: privilege
2015-05-10 01:55:05 +03:00
++ scad :: foreign connection
2015-12-20 23:50:45 +03:00
$: p/@ud :: index
q/(map duct @ud) :: by duct
r/(map @ud duct) :: by index
2015-05-10 01:55:05 +03:00
== ::
2016-11-24 07:25:07 +03:00
++ scar :: opaque input
$: p/@ud :: bone sequence
q/(map duct bone) :: by duct
r/(map bone duct) :: by bone
2016-11-04 04:35:47 +03:00
== ::
:: ::
:: XX a hack, required to break a subscription loop ::
:: which arises when an invalid mark crashes a diff. ::
:: See usage in ap-misvale. ::
++ misvale-data (set wire) :: subscrs w/ bad marks
2016-11-24 07:25:07 +03:00
++ seat :: agent state
2016-11-04 04:35:47 +03:00
$: misvale/misvale-data :: bad reqs
vel/worm :: cache
arms=(map [term path] (unit (pair @ud term))) :: ap-find cache
2015-12-20 23:50:45 +03:00
mom/duct :: control duct
2016-11-24 07:25:07 +03:00
liv/? :: unstopped
toc/torc :: privilege
tyc/stic :: statistics
ged/gest :: subscribers
hav/vase :: running state
byk/beak :: update control
pyl/(map bone mark) :: req'd translations
zam/scar :: opaque ducts
== ::
++ sofa :: queue for blocked
2015-12-20 23:50:45 +03:00
$: kys/(qeu (trel duct prey club)) :: queued kisses
2016-11-24 07:25:07 +03:00
== ::
++ stic :: statistics
$: act/@ud :: change number
eny/@uvJ :: entropy
lat/@da :: time
== ::
-- ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::: vane header
::::::::::::::::::::::::::::::::::::::::::::::::::::::
. ==
=| all/axle :: all vane state
2018-12-06 00:41:21 +03:00
|= $: our=ship :: identity
now=@da :: urban time
eny=@uvJ :: entropy
ska=sley :: activate
2016-11-24 07:25:07 +03:00
== :: opaque core
~% %gall-top ..is ~
|% :::::::::::::::::::::::::::::::::::::::::::::::::::::: state machine
::::::::::::::::::::::::::::::::::::::::::::::::::::::
++ mo
2018-12-13 04:34:25 +03:00
~% %gall-mo +> ~
=* mas mast.all
|_ $: hen=duct
moz=(list move)
2016-11-24 07:25:07 +03:00
==
++ mo-abed :: initialize
2018-12-13 04:34:25 +03:00
|= =duct
2016-11-24 07:25:07 +03:00
^+ +>
2018-12-13 04:34:25 +03:00
+>(hen duct)
2016-11-24 07:25:07 +03:00
::
2015-05-10 01:55:05 +03:00
++ mo-abet :: resolve to
2016-11-24 07:25:07 +03:00
^+ [*(list move) +>+]
2018-12-13 04:34:25 +03:00
:_ +>+
2016-11-24 07:25:07 +03:00
%- flop
%+ turn moz
|= a/move
?. ?=($pass -.q.a) a
2018-12-14 03:26:05 +03:00
[p.a %pass p.q.a q.q.a]
2016-11-24 07:25:07 +03:00
::
++ mo-conf :: configure
|= {dap/dude lum/culm}
(mo-boot dap p.p.lum q.p.lum da+now)
2016-11-24 07:25:07 +03:00
::
++ mo-pass :: standard pass
|= {pax/path noh/note-arvo}
%_(+> moz :_(moz [hen %pass pax noh]))
::
++ mo-give
|= git/gift:able
%_(+> moz :_(moz [hen %give git]))
::
++ mo-okay :: valid agent core
~/ %mo-okay
2016-11-24 07:25:07 +03:00
|= vax/vase
^- ?
=+ bol=(slew 12 vax)
?~ bol |
(~(nest ut p.u.bol) %| -:!>(*bowl))
:: +mo-receive-core: receives an app core built by ford-turbo
2016-11-24 07:25:07 +03:00
::
++ mo-receive-core
~/ %mo-receive-core
|= [dap=dude byk=beak made-result=made-result:ford]
2016-11-24 07:25:07 +03:00
^+ +>
::
?: ?=([%incomplete *] made-result)
(mo-give %onto %| tang.made-result)
::
=/ build-result build-result.made-result
::
?: ?=([%error *] build-result)
(mo-give %onto %| message.build-result)
::
=/ result-cage=cage (result-to-cage:ford build-result)
::
2018-12-13 04:34:25 +03:00
=/ app-data=(unit seat) (~(get by bum.mas) dap)
?^ app-data
:: update the path
::
2018-12-13 04:34:25 +03:00
=. bum.mas (~(put by bum.mas) dap u.app-data(byk byk))
:: magic update string from +mo-boon, "complete old boot"
::
ap-abet:(ap-peep:(ap-abed:ap dap [%high [~ our]]) q.result-cage)
:: first install of the app
::
?. (mo-okay q.result-cage)
(mo-give %onto %| [%leaf "{<dap>}: bogus core"]~)
=. +>.$ (mo-born dap byk q.result-cage)
=+ old=+>.$
=+ wag=(ap-prop:(ap-abed:ap dap [%high [~ our]]) ~)
?^ -.wag
=. +>.$ old
(mo-give %onto %| u.-.wag)
=. +>.$ ap-abet:+.wag
(mo-give:(mo-claw dap) %onto %& dap %boot now)
2016-11-24 07:25:07 +03:00
::
++ mo-born :: new seat
|= {dap/dude byk/beak hav/vase}
=+ sat=*seat
%_ +>.$
2018-12-13 04:34:25 +03:00
bum.mas
%+ ~(put by bum.mas) dap
2016-11-24 07:25:07 +03:00
%_ sat
mom hen
byk byk
hav hav
p.zam 1
q.zam [[[~ ~] 0] ~ ~]
r.zam [[0 [~ ~]] ~ ~]
==
==
:: +mo-boot: sends an %exec to ford.
2016-11-24 07:25:07 +03:00
::
++ mo-boot :: create ship
|= {dap/dude byk/beak}
2016-11-24 07:25:07 +03:00
^+ +>
%+ mo-pass [%sys %core dap (scot %p p.byk) q.byk (scot r.byk) ~]
2016-11-24 07:25:07 +03:00
^- note-arvo
2018-12-13 09:34:12 +03:00
[%f %build live=%.y [%core [[p q]:byk [%hoon dap %app ~]]]]
2016-11-24 07:25:07 +03:00
::
++ mo-away :: foreign request
~/ %mo-away
2015-12-20 23:50:45 +03:00
|= {him/ship caz/cush} ::
2016-11-24 07:25:07 +03:00
^+ +>
:: ~& [%mo-away him caz]
?: ?=($pump -.q.caz)
::
:: you'd think this would send an ack for the diff
:: that caused this pump. it would, but we already
:: sent it when we got the diff in ++mo-cyst. then
:: we'd have to save the network duct and connect it
:: to this returning pump.
::
+>
2016-11-08 01:15:56 +03:00
?: ?=($peer-not -.q.caz)
:: short circuit error
(mo-give %unto %reap (some p.q.caz))
2015-05-10 01:55:05 +03:00
=^ num +>.$ (mo-bale him)
2016-11-24 07:25:07 +03:00
=+ ^= roc ^- rook
?- -.q.caz
$poke [%m p.p.q.caz q.q.p.q.caz]
$pull [%u ~]
$puff !!
$punk !!
$peel [%l p.q.caz q.q.caz]
2016-11-24 07:25:07 +03:00
$peer [%s p.q.caz]
==
2015-05-10 01:55:05 +03:00
%+ mo-pass
[%sys %way -.q.caz ~]
2018-12-12 23:34:18 +03:00
`note-arvo`[%a %want him [%g %ge p.caz ~] [num roc]]
2016-11-24 07:25:07 +03:00
::
++ mo-baal :: error convert a
|= art/(unit ares)
^- ares
?~(art ~ ?~(u.art `[%blank ~] u.art))
::
++ mo-baba :: error convert b
|= ars/ares
^- (unit tang)
?~ ars ~
`[[%leaf (trip p.u.ars)] q.u.ars]
::
++ mo-awed :: foreign response
|= {him/ship why/?($peer $peel $poke $pull) art/(unit ares)}
2016-11-24 07:25:07 +03:00
^+ +>
:: ~& [%mo-awed him why art]
=+ tug=(mo-baba (mo-baal art))
?- why
$peel (mo-give %unto %reap tug)
2016-11-24 07:25:07 +03:00
$peer (mo-give %unto %reap tug)
$poke (mo-give %unto %coup tug)
$pull +>.$
==
::
2015-05-10 01:55:05 +03:00
++ mo-bale :: assign outbone
2015-12-20 23:50:45 +03:00
|= him/ship
2015-12-15 01:21:10 +03:00
^- {@ud _+>}
2018-12-13 04:34:25 +03:00
=+ sad=(fall (~(get by sap.mas) him) `scad`[1 ~ ~])
2015-05-10 01:55:05 +03:00
=+ nom=(~(get by q.sad) hen)
?^ nom [u.nom +>.$]
:- p.sad
%_ +>.$
2018-12-13 04:34:25 +03:00
sap.mas
%+ ~(put by sap.mas) him
2015-05-10 01:55:05 +03:00
%_ sad
p +(p.sad)
q (~(put by q.sad) hen p.sad)
r (~(put by r.sad) p.sad hen)
==
==
::
++ mo-ball :: outbone by index
2015-12-20 23:50:45 +03:00
|= {him/ship num/@ud}
2015-05-10 01:55:05 +03:00
^- duct
2018-12-13 04:34:25 +03:00
(~(got by r:(~(got by sap.mas) him)) num)
2015-05-10 01:55:05 +03:00
::
2016-11-24 07:25:07 +03:00
++ mo-come :: handle locally
|= {her/ship caz/cush}
^+ +>
=+ pry=`prey`[%high [~ her]]
(mo-club p.caz pry q.caz)
::
++ mo-coup :: back from mo-away
|= {dap/dude him/ship cup/ares}
%^ mo-give %unto %coup
?~ cup ~
[~ `tang`[[%leaf (trip p.u.cup)] q.u.cup]]
::
++ mo-chew :: reverse build path
|= pax/path
^- beak
2018-03-19 07:18:20 +03:00
?> ?=({@ @ @ ~} pax)
2016-11-24 07:25:07 +03:00
[(slav %p i.pax) i.t.pax da+(slav %da i.t.t.pax)]
::
++ mo-cyst :: take in /sys
~/ %mo-cyst
2016-11-24 07:25:07 +03:00
|= {pax/path sih/sign-arvo}
^+ +>
?+ -.pax !!
$core
?> ?=([%f %made *] sih)
2018-03-19 07:18:20 +03:00
?> ?=({@ @ @ @ ~} t.pax)
(mo-receive-core i.t.pax (mo-chew t.t.pax) result.sih)
2016-11-24 07:25:07 +03:00
::
%pel :: translated peer
2018-03-19 07:18:20 +03:00
?> ?=({@ ~} t.pax)
2016-11-24 07:25:07 +03:00
=+ mar=i.t.pax
?> ?=([%f %made *] sih)
::
?: ?=([%incomplete *] result.sih)
(mo-give %unto %coup `tang.result.sih)
::
=/ build-result build-result.result.sih
::
?: ?=([%error *] build-result)
(mo-give %unto %coup `message.build-result)
::
(mo-give %unto %diff (result-to-cage:ford build-result))
2016-11-24 07:25:07 +03:00
::
$red :: diff ack
2018-03-19 07:18:20 +03:00
?> ?=({@ @ @ ~} t.pax)
2015-12-07 20:23:58 +03:00
?. ?=({$a $woot *} sih)
2015-09-01 20:38:21 +03:00
~& [%red-went pax]
+>.$
2016-11-24 07:25:07 +03:00
=+ :* him=(slav %p i.t.pax)
dap=i.t.t.pax
2015-05-10 01:55:05 +03:00
num=(slav %ud i.t.t.t.pax)
2016-11-24 07:25:07 +03:00
==
=> .(pax `path`[%req t.pax])
2015-05-10 01:55:05 +03:00
?~ q.+>.sih
(mo-pass [%sys pax] %g %deal [him our] dap %pump ~)
2018-08-03 21:05:32 +03:00
:: should not happen (XX wat mean?)
::
%- ?. ?=([~ ~ %mack *] q.+>.sih)
~& [%diff-bad-ack q.+>.sih]
same
~& [%diff-bad-ack %mack]
(slog (flop q.,.+>.q.+>.sih))
2015-05-10 01:55:05 +03:00
=. +>.$ (mo-pass [%sys pax] %g %deal [him our] dap %pull ~)
2018-12-12 23:34:18 +03:00
(mo-pass [%sys pax] %a %want him [%g %gh dap ~] [num %x ~])
2015-05-10 01:55:05 +03:00
::
%rep :: reverse request
2018-03-19 07:18:20 +03:00
?> ?=({@ @ @ ~} t.pax)
?> ?=([%f %made *] sih)
2015-05-10 01:55:05 +03:00
=+ :* him=(slav %p i.t.pax)
dap=i.t.t.pax
num=(slav %ud i.t.t.t.pax)
==
::
?: ?=([%incomplete *] result.sih)
:: "XX should crash"
(mo-give %mack `tang.result.sih)
::
=/ build-result build-result.result.sih
::
?: ?=([%error *] build-result)
:: "XX should crash"
(mo-give %mack `message.build-result)
::
:: "XX pump should ack"
=. +>.$ (mo-give %mack ~)
=* result-cage (result-to-cage:ford build-result)
(mo-give(hen (mo-ball him num)) %unto %diff result-cage)
2016-11-24 07:25:07 +03:00
::
$req :: inbound request
2018-03-19 07:18:20 +03:00
?> ?=({@ @ @ ~} t.pax)
2016-11-24 07:25:07 +03:00
=+ :* him=(slav %p i.t.pax)
dap=i.t.t.pax
2015-05-10 01:55:05 +03:00
num=(slav %ud i.t.t.t.pax)
2016-11-24 07:25:07 +03:00
==
?: ?=({$f $made *} sih)
?: ?=([%incomplete *] result.sih)
:: "XX should crash"
(mo-give %mack `tang.result.sih)
::
=/ build-result build-result.result.sih
::
?: ?=([%error *] build-result)
:: "XX should crash"
(mo-give %mack `message.build-result)
=/ cay/cage (result-to-cage:ford build-result)
(mo-pass [%sys pax] %g %deal [him our] i.t.t.pax %poke cay)
2016-11-24 07:25:07 +03:00
?: ?=({$a $woot *} sih) +>.$ :: quit ack, boring
?> ?=({$g $unto *} sih)
=+ cuf=`cuft`+>.sih
?- -.cuf
$coup (mo-give %mack p.cuf)
2015-12-07 20:23:58 +03:00
$diff %+ mo-pass [%sys %red t.pax]
2018-12-12 23:34:18 +03:00
[%a %want him [%g %gh dap ~] [num %d p.p.cuf q.q.p.cuf]]
2015-12-07 20:23:58 +03:00
$quit %+ mo-pass [%sys pax]
2018-12-12 23:34:18 +03:00
[%a %want him [%g %gh dap ~] [num %x ~]]
2016-11-24 07:25:07 +03:00
$reap (mo-give %mack p.cuf)
==
2016-11-24 07:25:07 +03:00
::
%val :: inbound validate
2018-03-19 07:18:20 +03:00
?> ?=({@ @ ~} t.pax)
2016-11-24 07:25:07 +03:00
=+ [him=(slav %p i.t.pax) dap=i.t.t.pax]
?> ?=([%f %made *] sih)
::
?: ?=([%incomplete *] result.sih)
(mo-give %unto %coup `tang.result.sih)
::
=/ build-result build-result.result.sih
::
?: ?=([%error *] build-result)
(mo-give %unto %coup `message.build-result)
::
=* result-cage (result-to-cage:ford build-result)
(mo-clip dap `prey`[%high ~ him] [%poke result-cage])
2016-11-24 07:25:07 +03:00
::
$way :: outbound request
?> ?=({$a $woot *} sih)
2018-03-19 07:18:20 +03:00
?> ?=({@ ~} t.pax)
2015-05-10 01:55:05 +03:00
%- mo-awed
:* `ship`p.+>.sih
;;(?($peer $peel $poke $pull) i.t.pax)
2015-05-10 01:55:05 +03:00
+>+.sih
2016-11-24 07:25:07 +03:00
==
==
::
++ mo-cook :: take in /use
~/ %mo-cook
2016-11-24 07:25:07 +03:00
|= {pax/path hin/(hypo sign-arvo)}
^+ +>
?. ?=({@ @ $?($inn $out $cay) *} pax)
~& [%mo-cook-bad-pax pax]
!!
=+ dap=`@tas`i.pax
=+ pry=`prey`[%high [~ (slav %p i.t.pax)]]
2015-05-10 01:55:05 +03:00
=+ pap=(ap-abed:ap dap pry)
2016-11-24 07:25:07 +03:00
=+ vax=(slot 3 `vase`hin)
?- i.t.t.pax
$inn ap-abet:(ap-pour:pap t.t.t.pax (slot 3 `vase`hin))
2016-11-24 07:25:07 +03:00
$cay ?. ?=({$e $sigh *} q.hin)
~& [%mo-cook-weird q.hin]
~& [%mo-cook-weird-path pax]
+>.$
ap-abet:(ap-purr:pap +<.q.hin t.t.t.pax +>.q.hin)
::
$out ?. ?=({$g $unto *} q.hin)
2016-11-24 07:25:07 +03:00
~& [%mo-cook-weird q.hin]
~& [%mo-cook-weird-path pax]
+>.$
ap-abet:(ap-pout:pap t.t.t.pax +>.q.hin)
==
::
++ mo-claw :: clear queue
|= dap/dude
^+ +>
2018-12-13 04:34:25 +03:00
?. (~(has by bum.mas) dap) +>
=+ suf=(~(get by wub.mas) dap)
2016-11-24 07:25:07 +03:00
?~ suf +>.$
|- ^+ +>.^$
?: =(~ kys.u.suf)
2018-12-13 04:34:25 +03:00
+>.^$(wub.mas (~(del by wub.mas) dap))
2016-11-24 07:25:07 +03:00
=^ lep kys.u.suf [p q]:~(get to kys.u.suf)
$(moz :_(moz [p.lep %slip %g %deal [q.q.q.lep our] dap r.lep]))
:: $(+>.^$ (mo-clip(hen p.lep) dap q.lep r.lep))
::
++ mo-beak :: build beak
|= dap/dude
=- ?.(=(p our) - -(r [%da now])) :: soft dependencies
^- beak
2018-12-13 04:34:25 +03:00
byk:(~(got by bum.mas) dap)
2016-11-24 07:25:07 +03:00
::
++ mo-peek
~/ %mo-peek
2016-11-24 07:25:07 +03:00
|= {dap/dude pry/prey ren/@tas tyl/path}
^- (unit (unit cage))
(ap-peek:(ap-abed:ap dap pry) ren tyl)
::
++ mo-clip :: apply club
|= {dap/dude pry/prey cub/club}
?: ?=($puff -.cub)
%+ mo-pass
[%sys %val (scot %p q.q.pry) dap ~]
2018-12-13 09:34:12 +03:00
[%f %build live=%.n [%vale [p q]:(mo-beak dap) +.cub]]
2016-11-24 07:25:07 +03:00
?: ?=($punk -.cub)
%+ mo-pass
[%sys %val (scot %p q.q.pry) dap ~]
2018-12-13 09:34:12 +03:00
:* %f %build live=%.n
^- schematic:ford
[%cast [p q]:(mo-beak dap) p.cub [%$ q.cub]]
==
2016-11-08 01:15:56 +03:00
?: ?=($peer-not -.cub)
(mo-give %unto %reap (some p.cub))
2016-11-24 07:25:07 +03:00
ap-abet:(ap-club:(ap-abed:ap dap pry) cub)
::
++ mo-club :: local action
|= {dap/dude pry/prey cub/club}
^+ +>
2018-12-13 04:34:25 +03:00
?: |(!(~(has by bum.mas) dap) (~(has by wub.mas) dap))
2016-11-24 07:25:07 +03:00
~& >> [%mo-not-running dap -.cub]
:: ~& [%mo-club-qeu dap cub]
2018-12-13 04:34:25 +03:00
=+ syf=(fall (~(get by wub.mas) dap) *sofa)
+>.$(wub.mas (~(put by wub.mas) dap syf(kys (~(put to kys.syf) [hen pry cub]))))
2016-11-24 07:25:07 +03:00
(mo-clip dap pry cub)
::
++ mo-gawk :: ames forward
|= {him/@p dap/dude num/@ud rok/rook}
2015-12-07 20:23:58 +03:00
=. +> ?.(?=($u -.rok) +> (mo-give %mack ~))
2015-05-10 01:55:05 +03:00
%+ mo-pass
[%sys %req (scot %p him) dap (scot %ud num) ~]
2016-11-24 07:25:07 +03:00
^- note-arvo
?- -.rok
:: %m [%f %exec our ~ (mo-beak dap) %vale p.rok q.rok]
$m [%g %deal [him our] dap %puff p.rok q.rok]
$l [%g %deal [him our] dap %peel p.rok q.rok]
2016-11-24 07:25:07 +03:00
$s [%g %deal [him our] dap %peer p.rok]
$u [%g %deal [him our] dap %pull ~]
==
::
2015-05-10 01:55:05 +03:00
++ mo-gawd :: ames backward
2015-12-20 23:50:45 +03:00
|= {him/@p dap/dude num/@ud ron/roon}
?- -.ron
$d
%+ mo-pass
[%sys %rep (scot %p him) dap (scot %ud num) ~]
2018-12-13 09:34:12 +03:00
[%f %build live=%.n [%vale [p q]:(mo-beak dap) p.ron q.ron]]
::
$x =. +> (mo-give %mack ~) :: XX should crash
(mo-give(hen (mo-ball him num)) %unto %quit ~)
2015-05-10 01:55:05 +03:00
==
2016-11-24 07:25:07 +03:00
::
++ ap :: agent engine
~% %gall-ap +> ~
|_ $: $: dap/dude
pry/prey
ost/bone
zip/(list cove)
dub/(list (each suss tang))
==
seat
==
::
++ ap-abed :: initialize
~/ %ap-abed
2016-11-24 07:25:07 +03:00
|= {dap/dude pry/prey}
^+ +>
=: ^dap dap
^pry pry
2018-12-13 04:34:25 +03:00
+>+<+ `seat`(~(got by bum.mas) dap)
2016-11-24 07:25:07 +03:00
==
=+ unt=(~(get by q.zam) hen)
=: act.tyc +(act.tyc)
eny.tyc (shaz (mix (add dap act.tyc) eny))
lat.tyc now
==
?^ unt
+>.$(ost u.unt)
%= +>.$
ost p.zam
p.zam +(p.zam)
q.zam (~(put by q.zam) hen p.zam)
r.zam (~(put by r.zam) p.zam hen)
==
::
++ ap-abet :: resolve
^+ +>
=> ap-abut
%_ +>
2018-12-13 04:34:25 +03:00
bum.mas (~(put by bum.mas) dap +<+)
2016-11-24 07:25:07 +03:00
moz :(weld (turn zip ap-aver) (turn dub ap-avid) moz)
==
::
++ ap-abut :: track queue
^+ .
=+ [pyz=zip ful=*(set bone)]
|- ^+ +>
?^ pyz
?. ?=({$give $diff *} q.i.pyz)
$(pyz t.pyz)
=^ vad +> ap-fill(ost p.i.pyz)
$(pyz t.pyz, ful ?:(vad ful (~(put in ful) p.i.pyz)))
=+ ded=~(tap in ful)
2016-11-24 07:25:07 +03:00
|- ^+ +>.^$
?~ ded +>.^$
=> %*(. $(ded t.ded) ost i.ded)
=+ tib=(~(get by sup.ged) ost)
?~ tib ~&([%ap-abut-bad-bone dap ost] ..ap-kill)
ap-kill(q.q.pry p.u.tib)
::
++ ap-aver :: cove to move
~/ %ap-aver
2016-11-24 07:25:07 +03:00
|= cov/cove
2015-05-10 01:55:05 +03:00
^- move
2016-11-24 07:25:07 +03:00
:- (~(got by r.zam) p.cov)
?- -.q.cov
?($slip $sick) !!
$give
2016-11-24 07:25:07 +03:00
?< =(0 p.cov)
?. ?=($diff -.p.q.cov)
[%give %unto p.q.cov]
=+ cay=`cage`p.p.q.cov
=+ mar=(fall (~(get by pyl) p.cov) p.cay)
?: =(mar p.cay) [%give %unto p.q.cov]
:+ %pass
[%sys %pel dap ~]
2018-12-13 09:34:12 +03:00
[%f %build live=%.n [%cast [p q]:(mo-beak dap) mar [%$ cay]]]
2016-11-24 07:25:07 +03:00
::
$pass
:+ %pass `path`[%use dap p.q.cov]
?- -.q.q.cov
$hiss `note-arvo`[%e %hiss +.q.q.cov]
$send `note-arvo`[%g %deal [our p.q.q.cov] q.q.q.cov]
$meta `note-arvo`[`@tas`p.q.q.cov %meta `vase`q.q.q.cov]
==
==
::
++ ap-avid :: onto results
|=(a/(each suss tang) [hen %give %onto a])
::
++ ap-call :: call into server
~/ %ap-call
|= {cog/term arg/vase}
^- {(unit tang) _+>}
2015-06-25 02:57:17 +03:00
=. +> ap-bowl
2016-11-24 07:25:07 +03:00
=^ arm +>.$ (ap-farm cog)
2018-03-19 06:54:47 +03:00
?: ?=(%| -.arm) [`p.arm +>.$]
2016-11-24 07:25:07 +03:00
=^ zem +>.$ (ap-slam cog p.arm arg)
2018-03-19 06:54:47 +03:00
?: ?=(%| -.zem) [`p.zem +>.$]
2015-05-10 01:55:05 +03:00
(ap-sake p.zem)
2016-11-24 07:25:07 +03:00
::
++ ap-peek
~/ %ap-peek
2016-11-24 07:25:07 +03:00
|= {ren/@tas tyl/path}
^- (unit (unit cage))
=+ ?. ?=($x ren)
[mar=%$ tyl=tyl]
=+ `path`(flop tyl)
?> ?=(^ -)
[mar=i tyl=(flop t)]
=^ cug +>.$ (ap-find %peek ren tyl)
2016-11-24 07:25:07 +03:00
?~ cug
((slog leaf+"peek find fail" >tyl< >mar< ~) [~ ~])
=^ arm +>.$ (ap-farm q.u.cug)
2018-03-19 06:54:47 +03:00
?: ?=(%| -.arm) ((slog leaf+"peek farm fail" p.arm) [~ ~])
=^ zem +>.$ (ap-slam q.u.cug p.arm !>((slag p.u.cug `path`[ren tyl])))
2018-03-19 06:54:47 +03:00
?: ?=(%| -.zem) ((slog leaf+"peek slam fail" p.zem) [~ ~])
2016-11-24 07:25:07 +03:00
?+ q.p.zem ((slog leaf+"peek bad result" ~) [~ ~])
2018-03-19 07:18:20 +03:00
~ ~
{~ ~} [~ ~]
{~ ~ ^}
2018-03-29 21:03:14 +03:00
=+ caz=(sped (slot 7 p.zem))
2016-11-24 07:25:07 +03:00
?. &(?=({p/@ *} q.caz) ((sane %tas) p.q.caz))
((slog leaf+"scry: malformed cage" ~) [~ ~])
?. =(mar p.q.caz)
[~ ~]
``[p.q.caz (slot 3 caz)]
==
::
++ ap-club :: apply effect
|= cub/club
^+ +>
?- -.cub
$peel (ap-peel +.cub)
$poke (ap-poke +.cub)
$peer (ap-peer +.cub)
$puff !!
$punk !!
2016-11-08 01:15:56 +03:00
$peer-not !!
2016-11-24 07:25:07 +03:00
$pull ap-pull
$pump ap-fall
==
::
++ ap-diff :: pour a diff
~/ %ap-diff
2016-11-24 07:25:07 +03:00
|= {her/ship pax/path cag/cage}
2018-03-29 21:03:14 +03:00
:: =. q.cag (sped q.cag)
=^ cug +>.$ (ap-find [%diff p.cag +.pax])
2016-11-24 07:25:07 +03:00
?~ cug
%. [| her +.pax]
ap-pump:(ap-lame %diff (ap-suck "diff: no {<`path`[p.cag +.pax]>}"))
=+ ^= arg ^- vase
%- slop
?: =(0 p.u.cug)
[!>(`path`+.pax) !>(cag)]
[!>((slag (dec p.u.cug) `path`+.pax)) q.cag]
=^ cam +>.$ (ap-call q.u.cug arg)
2015-05-10 01:55:05 +03:00
?^ cam
2016-11-24 07:25:07 +03:00
(ap-pump:(ap-lame q.u.cug u.cam) | her pax)
(ap-pump & her pax)
::
++ ap-pump :: update subscription
~/ %ap-pump
2016-11-24 07:25:07 +03:00
|= {oak/? her/ship pax/path}
=+ way=[(scot %p her) %out pax]
?: oak
(ap-pass way %send her -.pax %pump ~)
(ap-pass:(ap-give %quit ~) way %send her -.pax %pull ~)
::
++ ap-fall :: drop from queue
^+ .
?. (~(has by sup.ged) ost) .
=+ soy=(~(get by qel.ged) ost)
2018-03-19 07:18:20 +03:00
?: |(?=(~ soy) =(0 u.soy))
2016-11-24 07:25:07 +03:00
:: ~& [%ap-fill-under [our dap] q.q.pry ost]
+
=. u.soy (dec u.soy)
:: ~& [%ap-fill-sub [[our dap] q.q.pry ost] u.soy]
2015-05-10 01:55:05 +03:00
?: =(0 u.soy)
2016-11-24 07:25:07 +03:00
+(qel.ged (~(del by qel.ged) ost))
+(qel.ged (~(put by qel.ged) ost u.soy))
::
++ ap-farm :: produce arm
~/ %ap-farm
|= cog/term
^- {(each vase tang) _+>}
=+ pyz=(mule |.((~(mint wa vel) p.hav [%limb cog])))
2018-03-19 06:54:47 +03:00
?: ?=(%| -.pyz)
2016-11-24 07:25:07 +03:00
:_(+>.$ [%| +.pyz])
:_ +>.$(vel `worm`+>.pyz)
=+ ton=(mock [q.hav q.+<.pyz] ap-sled)
?- -.ton
$0 [%& p.+<.pyz p.ton]
$1 [%| (turn p.ton |=(a/* (smyt (path a))))]
$2 [%| p.ton]
==
::
++ ap-fill :: add to queue
^- {? _.}
=+ suy=(fall (~(get by qel.ged) ost) 0)
?: =(20 suy)
~& [%ap-fill-full [our dap] q.q.pry ost]
2016-11-24 07:25:07 +03:00
[%| +]
:: ~? !=(20 suy) [%ap-fill-add [[our dap] q.q.pry ost] +(suy)]
[%& +(qel.ged (~(put by qel.ged) ost +(suy)))]
::
++ ap-find :: general arm
~/ %ap-find
2016-11-24 07:25:07 +03:00
|= {cog/term pax/path}
^- [(unit (pair @ud term)) _+>]
:: check cache
?^ maybe-result=(~(get by arms) [cog pax])
[u.maybe-result +>.$]
::
=/ result=(unit (pair @ud term))
=+ dep=0
|- ^- (unit (pair @ud term))
=+ ^= spu
?~ pax ~
$(pax t.pax, dep +(dep), cog (ap-hype cog i.pax))
?^ spu spu
?.((ap-fond cog) ~ `[dep cog])
::
=. arms (~(put by arms) [cog pax] result)
[result +>.$]
2016-11-24 07:25:07 +03:00
::
++ ap-fond :: check for arm
~/ %ap-fond
2016-11-24 07:25:07 +03:00
|= cog/term
^- ?
(slob cog p.hav)
::
++ ap-give :: return result
|= cit/cuft
^+ +>
+>(zip :_(zip [ost %give cit]))
::
++ ap-bowl :: set up bowl
%_ .
+12.q.hav
^- bowl
:* :* our :: host
q.q.pry :: guest
dap :: agent
== ::
:* wex=~ :: outgoing
sup=sup.ged :: incoming
== ::
:* ost=ost :: cause
act=act.tyc :: tick
eny=eny.tyc :: nonce
now=lat.tyc :: time
byk=byk :: source
== == ::
==
::
++ ap-hype :: hyphenate
~/ %ap-hype
2016-11-24 07:25:07 +03:00
|=({a/term b/term} `term`(cat 3 a (cat 3 '-' b)))
::
++ ap-move :: process each move
~/ %ap-move
|= vax/vase
^- {(each cove tang) _+>}
?@ q.vax :_(+>.$ [%| (ap-suck "move: invalid move (atom)")])
?^ -.q.vax :_(+>.$ [%| (ap-suck "move: invalid move (bone)")])
?@ +.q.vax :_(+>.$ [%| (ap-suck "move: invalid move (card)")])
=+ hun=(~(get by r.zam) -.q.vax)
?. &((~(has by r.zam) -.q.vax) !=(0 -.q.vax))
2018-06-01 03:14:39 +03:00
~& [q-vax+q.vax has-by-r-zam+(~(has by r.zam) -.q.vax)]
2016-11-24 07:25:07 +03:00
:_(+>.$ [%| (ap-suck "move: invalid card (bone {<-.q.vax>})")])
=^ pec vel (~(spot wa vel) 3 vax)
=^ cav vel (~(slot wa vel) 3 pec)
2015-05-10 01:55:05 +03:00
?+ +<.q.vax
2016-11-24 07:25:07 +03:00
(ap-move-pass -.q.vax +<.q.vax cav)
$diff (ap-move-diff -.q.vax cav)
$hiss (ap-move-hiss -.q.vax cav)
$peel (ap-move-peel -.q.vax cav)
$peer (ap-move-peer -.q.vax cav)
$pull (ap-move-pull -.q.vax cav)
$poke (ap-move-poke -.q.vax cav)
$send (ap-move-send -.q.vax cav)
$quit (ap-move-quit -.q.vax cav)
==
::
++ ap-move-quit :: give quit move
~/ %quit
2016-11-24 07:25:07 +03:00
|= {sto/bone vax/vase}
^- {(each cove tang) _+>}
:_ +>(sup.ged (~(del by sup.ged) sto))
2016-11-24 07:25:07 +03:00
?^ q.vax [%| (ap-suck "quit: improper give")]
[%& `cove`[sto %give `cuft`[%quit ~]]]
::
++ ap-move-diff :: give diff move
~/ %diff
2016-11-24 07:25:07 +03:00
|= {sto/bone vax/vase}
^- {(each cove tang) _+>}
2018-03-29 21:03:14 +03:00
=^ pec vel (~(sped wa vel) vax)
2016-11-24 07:25:07 +03:00
?. &(?=(^ q.pec) ?=(@ -.q.pec) ((sane %tas) -.q.pec))
:_(+>.$ [%| (ap-suck "diff: improper give")])
=^ tel vel (~(slot wa vel) 3 pec)
:_(+>.$ [%& sto %give %diff `cage`[-.q.pec tel]])
::
++ ap-move-hiss :: pass %hiss
~/ %hiss
2016-11-24 07:25:07 +03:00
|= {sto/bone vax/vase}
^- {(each cove tang) _+>}
?. &(?=({p/* q/* r/@ s/{p/@ *}} q.vax) ((sane %tas) r.q.vax))
=+ args="[%hiss wire (unit knot) mark cage]"
:_(+>.$ [%| (ap-suck "hiss: bad hiss ask.{args}")])
=^ gaw vel (~(slot wa vel) 15 vax)
?. &(?=({p/@ *} q.gaw) ((sane %tas) p.q.gaw))
:_(+>.$ [%| (ap-suck "hiss: malformed cage")])
=^ paw vel (~(stop wa vel) 3 gaw)
=+ usr=((soft (unit knot)) q.q.vax)
?. &(?=(^ usr) ?~(u.usr & ((sane %ta) u.u.usr)))
:_(+>.$ [%| (ap-suck "hiss: malformed (unit knot)")])
=+ pux=((soft path) p.q.vax)
?. &(?=(^ pux) (levy u.pux (sane %ta)))
:_(+>.$ [%| (ap-suck "hiss: malformed path")])
:_ +>.$
:^ %& sto %pass
:- [(scot %p q.q.pry) %cay u.pux]
~! *cote
=- ~! - `cote`-
[%hiss u.usr r.q.vax [p.q.gaw paw]]
::
++ ap-move-mess :: extract path, target
~/ %mess
2016-11-24 07:25:07 +03:00
|= vax/vase
^- {(each (trel path ship term) tang) _+>}
:_ +>.$
?. ?& ?=({p/* {q/@ r/@} s/*} q.vax)
(gte 1 (met 7 q.q.vax))
==
[%| (ap-suck "mess: malformed target")]
=+ pux=((soft path) p.q.vax)
?. &(?=(^ pux) (levy u.pux (sane %ta)))
[%| (ap-suck "mess: malformed path")]
[%& [(scot %p q.q.vax) %out r.q.vax u.pux] q.q.vax r.q.vax]
::
2015-05-10 01:55:05 +03:00
++ ap-move-pass :: pass general move
~/ %pass
2016-11-24 07:25:07 +03:00
|= {sto/bone wut/* vax/vase}
^- {(each cove tang) _+>}
?. &(?=(@ wut) ((sane %tas) wut))
:_(+>.$ [%| (ap-suck "pass: malformed card")])
=+ pux=((soft path) -.q.vax)
?. &(?=(^ pux) (levy u.pux (sane %ta)))
:_(+>.$ [%| (ap-suck "pass: malformed path")])
=+ huj=(ap-vain wut)
?~ huj :_(+>.$ [%| (ap-suck "move: unknown note {(trip wut)}")])
=^ tel vel (~(slot wa vel) 3 vax)
:_ +>.$
:^ %& sto %pass
:- [(scot %p q.q.pry) %inn u.pux]
[%meta u.huj (slop (ap-term %tas wut) tel)]
::
++ ap-move-poke :: pass %poke
~/ %poke
2016-11-24 07:25:07 +03:00
|= {sto/bone vax/vase}
^- {(each cove tang) _+>}
=^ yep +>.$ (ap-move-mess vax)
2018-03-19 06:54:47 +03:00
?: ?=(%| -.yep) :_(+>.$ yep)
2016-11-24 07:25:07 +03:00
=^ gaw vel (~(slot wa vel) 7 vax)
?. &(?=({p/@ q/*} q.gaw) ((sane %tas) p.q.gaw))
:_(+>.$ [%| (ap-suck "poke: malformed cage")])
=^ paw vel (~(stop wa vel) 3 gaw)
:_ +>.$
:^ %& sto %pass
:- p.p.yep
[%send q.p.yep r.p.yep %poke p.q.gaw paw]
::
++ ap-move-peel :: pass %peel
~/ %peel
2016-11-24 07:25:07 +03:00
|= {sto/bone vax/vase}
^- {(each cove tang) _+>}
=^ yep +>.$ (ap-move-mess vax)
:_ +>.$
2018-03-19 06:54:47 +03:00
?: ?=(%| -.yep) yep
2016-11-24 07:25:07 +03:00
=+ mar=((soft mark) +>-.q.vax)
?~ mar
[%| (ap-suck "peel: malformed mark")]
=+ pux=((soft path) +>+.q.vax)
?. &(?=(^ pux) (levy u.pux (sane %ta)))
[%| (ap-suck "peel: malformed path")]
2016-11-08 01:17:06 +03:00
?: (~(has in misvale) p.p.yep)
2016-11-15 02:44:50 +03:00
=/ err [leaf+"peel: misvalidation encountered"]~
2016-11-08 01:17:06 +03:00
:^ %& sto %pass
:- p.p.yep
[%send q.p.yep r.p.yep %peer-not err]
2016-11-24 07:25:07 +03:00
:^ %& sto %pass
:- p.p.yep
[%send q.p.yep r.p.yep %peel u.mar u.pux]
::
++ ap-move-peer :: pass %peer
~/ %peer
2016-11-24 07:25:07 +03:00
|= {sto/bone vax/vase}
^- {(each cove tang) _+>}
=^ yep +>.$ (ap-move-mess vax)
:_ +>.$
2018-03-19 06:54:47 +03:00
?: ?=(%| -.yep) yep
2016-11-24 07:25:07 +03:00
=+ pux=((soft path) +>.q.vax)
?. &(?=(^ pux) (levy u.pux (sane %ta)))
[%| (ap-suck "peer: malformed path")]
2016-11-08 01:17:06 +03:00
?: (~(has in misvale) p.p.yep)
2016-11-15 02:44:50 +03:00
=/ err [leaf+"peer: misvalidation encountered"]~
2016-11-08 01:17:06 +03:00
:^ %& sto %pass
:- p.p.yep
[%send q.p.yep r.p.yep %peer-not err]
2016-11-24 07:25:07 +03:00
:^ %& sto %pass
:- p.p.yep
[%send q.p.yep r.p.yep %peer u.pux]
::
++ ap-move-pull :: pass %pull
~/ %pull
2016-11-24 07:25:07 +03:00
|= {sto/bone vax/vase}
^- {(each cove tang) _+>}
=^ yep +>.$ (ap-move-mess vax)
:_ +>.$
2018-03-19 06:54:47 +03:00
?: ?=(%| -.yep) yep
2016-11-24 07:25:07 +03:00
?. =(~ +>.q.vax)
[%| (ap-suck "pull: malformed card")]
:^ %& sto %pass
:- p.p.yep
[%send q.p.yep r.p.yep %pull ~]
::
++ ap-move-send :: pass gall action
~/ %send
2016-11-24 07:25:07 +03:00
|= {sto/bone vax/vase}
^- {(each cove tang) _+>}
?. ?& ?=({p/* {q/@ r/@} {s/@ t/*}} q.vax)
(gte 1 (met 7 q.q.vax))
((sane %tas) r.q.vax)
==
:_(+>.$ [%| (ap-suck "send: improper ask.[%send wire gill club]")])
=+ pux=((soft path) p.q.vax)
?. &(?=(^ pux) (levy u.pux (sane %ta)))
:_(+>.$ [%| (ap-suck "send: malformed path")])
?: ?=($poke s.q.vax)
=^ gav vel (~(spot wa vel) 7 vax)
?> =(%poke -.q.gav)
?. ?& ?=({p/@ q/*} t.q.vax)
((sane %tas) p.t.q.vax)
==
:_(+>.$ [%| (ap-suck "send: malformed poke")])
=^ vig vel (~(spot wa vel) 3 gav)
=^ geb vel (~(slot wa vel) 3 vig)
:_ +>.$
:^ %& sto %pass
:- [(scot %p q.q.vax) %out r.q.vax u.pux]
^- cote
:: ~& [%ap-move-send `path`[(scot %p q.q.vax) %out r.q.vax u.pux]]
[%send q.q.vax r.q.vax %poke p.t.q.vax geb]
:_ +>.$
=+ cob=((soft club) [s t]:q.vax)
?~ cob
[%| (ap-suck "send: malformed club")]
:^ %& sto %pass
:- [(scot %p q.q.vax) %out r.q.vax u.pux]
:: ~& [%ap-move-send `path`[(scot %p q.q.vax) %out r.q.vax u.pux]]
[%send q.q.vax r.q.vax u.cob]
::
++ ap-pass :: request action
|= {pax/path coh/cote}
^+ +>
+>(zip :_(zip [ost %pass pax coh]))
::
++ ap-peep :: reinstall
~/ %ap-peep
2016-11-24 07:25:07 +03:00
|= vax/vase
^+ +>
2017-01-13 03:58:20 +03:00
=+ pep=(ap-prep(hav vax) `hav)
?~ -.pep
+.pep
(ap-lame %prep-failed u.-.pep)
2016-11-24 07:25:07 +03:00
::
++ ap-peel
|= {mar/mark pax/path}
=. pyl (~(put by pyl) ost mar)
(ap-peer pax)
::
++ ap-peer :: apply %peer
~/ %ap-peer
2016-11-24 07:25:07 +03:00
|= pax/path
^+ +>
2016-11-02 02:26:36 +03:00
=. sup.ged (~(put by sup.ged) ost [q.q.pry pax])
=^ cug +>.$ (ap-find %peer pax)
2016-11-24 07:25:07 +03:00
?~ cug +>.$
=+ old=zip
=. zip ~
2015-05-10 01:55:05 +03:00
=^ cam +>.$
2016-11-24 07:25:07 +03:00
%+ ap-call q.u.cug
!>(`path`(slag p.u.cug pax))
=. zip (weld zip `(list cove)`[[ost %give %reap cam] old])
?^(cam ap-pule +>.$)
::
++ ap-poke :: apply %poke
~/ %ap-poke
2016-11-24 07:25:07 +03:00
|= cag/cage
^+ +>
=^ cug +>.$ (ap-find %poke p.cag ~)
2016-11-24 07:25:07 +03:00
?~ cug
(ap-give %coup `(ap-suck "no poke arm for {(trip p.cag)}"))
:: ~& [%ap-poke dap p.cag cug]
=^ tur +>.$
%+ ap-call q.u.cug
?. =(0 p.u.cug) q.cag
(slop (ap-term %tas p.cag) q.cag)
(ap-give %coup tur)
::
++ ap-lame :: pour error
|= {wut/@tas why/tang}
^+ +>
=^ cug +>.$ (ap-find /lame)
2016-11-24 07:25:07 +03:00
?~ cug
=. why [>%ap-lame dap wut< (turn why |=(a/tank rose+[~ "! " ~]^[a]~))]
~> %slog.`rose+[" " "[" "]"]^(flop why)
+>.$
=^ cam +>.$
%+ ap-call q.u.cug
!>([wut why])
?^ cam
=. why [>%ap-lame-lame< (turn u.cam |=(a/tank rose+[~ "! " ~]^[a]~))]
~> %slog.`rose+[" " "[" "]"]^(welp (flop why) leaf+"." (flop u.cam))
+>.$
+>.$
::
2016-11-04 04:35:47 +03:00
++ ap-misvale :: broken vale
|= wir/wire
2016-11-08 01:17:06 +03:00
~& [%ap-blocking-misvale wir]
2016-11-04 04:35:47 +03:00
+>(misvale (~(put in misvale) wir))
::
2016-11-24 07:25:07 +03:00
++ ap-pour :: generic take
~/ %ap-pour
2016-11-24 07:25:07 +03:00
|= {pax/path vax/vase}
^+ +>
?. &(?=({@ *} q.vax) ((sane %tas) -.q.vax))
(ap-lame %pour (ap-suck "pour: malformed card"))
=^ cug +>.$ (ap-find [-.q.vax pax])
2016-11-24 07:25:07 +03:00
?~ cug
(ap-lame -.q.vax (ap-suck "pour: no {(trip -.q.vax)}: {<pax>}"))
=^ tel vel (~(slot wa vel) 3 vax)
=^ cam +>.$
%+ ap-call q.u.cug
%+ slop
!>(`path`(slag p.u.cug pax))
tel
?^ cam (ap-lame -.q.vax u.cam)
+>.$
::
++ ap-purr :: unwrap take
~/ %ap-purr
2016-11-24 07:25:07 +03:00
|= {wha/term pax/path cag/cage}
^+ +>
=^ cug +>.$ (ap-find [wha p.cag pax])
2016-11-24 07:25:07 +03:00
?~ cug
(ap-lame wha (ap-suck "{(trip wha)}: no {<`path`[p.cag pax]>}"))
=+ ^= arg ^- vase
%- slop
?: =(0 p.u.cug)
[!>(`path`pax) !>(cag)]
[!>((slag (dec p.u.cug) `path`pax)) q.cag]
=^ cam +>.$ (ap-call q.u.cug arg)
?^ cam (ap-lame q.u.cug u.cam)
+>.$
::
++ ap-pout :: specific take
|= {pax/path cuf/cuft}
^+ +>
?- -.cuf
$coup (ap-take q.q.pry %coup +.pax `!>(p.cuf))
$diff (ap-diff q.q.pry pax p.cuf)
$quit (ap-take q.q.pry %quit +.pax ~)
$reap (ap-take q.q.pry %reap +.pax `!>(p.cuf))
==
::
++ ap-prep :: install
|= vux/(unit vase)
2017-01-13 03:58:20 +03:00
^- {(unit tang) _+>}
2016-11-24 07:25:07 +03:00
=^ gac +>.$ (ap-prop vux)
2017-01-13 03:58:20 +03:00
:- gac
2016-11-24 07:25:07 +03:00
%= +>.$
misvale
2016-11-08 04:08:12 +03:00
~? !=(misvale *misvale-data) misvale-drop+misvale
*misvale-data :: new app might mean new marks
::
arms
~
::
2016-11-24 07:25:07 +03:00
dub
:_(dub ?~(gac [%& dap ?~(vux %boot %bump) now] [%| u.gac]))
==
::
++ ap-prop :: install
~/ %ap-prop
2016-11-24 07:25:07 +03:00
|= vux/(unit vase)
^- {(unit tang) _+>}
2016-08-12 03:12:39 +03:00
?. (ap-fond %prep)
2016-11-24 07:25:07 +03:00
?~ vux
`+>.$
=+ [new=p:(slot 13 hav) old=p:(slot 13 u.vux)]
?. (~(nest ut p:(slot 13 hav)) %| p:(slot 13 u.vux))
:_(+>.$ `(ap-suck "prep mismatch"))
`+>.$(+13.q.hav +13.q.u.vux)
=^ tur +>.$
%+ ap-call %prep
?~(vux !>(~) (slop !>(~) (slot 13 u.vux)))
2017-01-13 03:58:20 +03:00
?~ tur
`+>.$
2017-01-13 03:58:20 +03:00
:_(+>.$ `u.tur)
2016-11-24 07:25:07 +03:00
::
++ ap-pule :: silent delete
=+ wim=(~(get by sup.ged) ost)
?~ wim +
%_ +
sup.ged (~(del by sup.ged) ost)
qel.ged (~(del by qel.ged) ost)
==
::
++ ap-pull :: load delete
=+ wim=(~(get by sup.ged) ost)
?~ wim + :: ~&(%ap-pull-none +)
=: sup.ged (~(del by sup.ged) ost)
qel.ged (~(del by qel.ged) ost)
==
=^ cug ..ap-pull (ap-find %pull q.u.wim)
2016-11-24 07:25:07 +03:00
?~ cug +>
2015-05-10 01:55:05 +03:00
=^ cam +>
2016-11-24 07:25:07 +03:00
%+ ap-call q.u.cug
!>((slag p.u.cug q.u.wim))
?^ cam (ap-lame q.u.cug u.cam)
+>+
::
++ ap-kill :: queue kill
:: ~& [%ap-kill dap ost]
(ap-give:ap-pull %quit ~)
::
++ ap-take :: non-diff gall take
~/ %ap-take
2016-11-24 07:25:07 +03:00
|= {her/ship cog/term pax/path vux/(unit vase)}
^+ +>
=^ cug +>.$ (ap-find cog pax)
2016-11-24 07:25:07 +03:00
?~ cug
:: ~& [%ap-take-none cog pax]
+>.$
2015-05-10 01:55:05 +03:00
=^ cam +>.$
2016-11-24 07:25:07 +03:00
%+ ap-call q.u.cug
=+ den=!>((slag p.u.cug pax))
?~(vux den (slop den u.vux))
?^ cam (ap-lame q.u.cug u.cam)
+>.$
::
++ ap-safe :: process move list
~/ %ap-safe
2016-11-24 07:25:07 +03:00
|= vax/vase
^- {(each (list cove) tang) _+>}
?~ q.vax :_(+>.$ [%& ~])
?@ q.vax :_(+>.$ [%| (ap-suck "move: malformed list")])
=^ hed vel (~(slot wa vel) 2 vax)
=^ sud +>.$ (ap-move hed)
2018-03-19 06:54:47 +03:00
?: ?=(%| -.sud) :_(+>.$ sud)
2016-11-24 07:25:07 +03:00
=^ tel vel (~(slot wa vel) 3 vax)
=^ res +>.$ $(vax tel)
:_ +>.$
2018-03-19 06:54:47 +03:00
?: ?=(%| -.res) res
2016-11-24 07:25:07 +03:00
[%& p.sud p.res]
::
++ ap-sake :: handle result
~/ %ap-sake
2016-11-24 07:25:07 +03:00
|= vax/vase
^- {(unit tang) _+>}
?: ?=(@ q.vax)
[`(ap-suck "sake: invalid product (atom)") +>.$]
=^ hed vel (~(slot wa vel) 2 vax)
=^ muz +>.$ (ap-safe hed)
2018-03-19 06:54:47 +03:00
?: ?=(%| -.muz) [`p.muz +>.$]
2016-11-24 07:25:07 +03:00
=^ tel vel (~(slot wa vel) 3 vax)
=^ sav +>.$ (ap-save tel)
2018-03-19 06:54:47 +03:00
?: ?=(%| -.sav) [`p.sav +>.$]
2016-11-24 07:25:07 +03:00
:- ~
%_ +>.$
zip (weld (flop p.muz) zip)
2015-05-10 01:55:05 +03:00
hav p.sav
2016-11-24 07:25:07 +03:00
==
::
++ ap-save :: verify core
~/ %ap-save
2016-11-24 07:25:07 +03:00
|= vax/vase
^- {(each vase tang) _+>}
=^ gud vel (~(nest wa vel) p.hav p.vax)
:_ +>.$
?. gud
[%| (ap-suck "invalid core")]
[%& vax]
::
++ ap-slam :: virtual slam
~/ %ap-slam
|= {cog/term gat/vase arg/vase}
^- {(each vase tang) _+>}
=+ ^= wyz %- mule |.
2017-09-19 01:32:35 +03:00
(~(mint wa vel) [%cell p.gat p.arg] [%cnsg [%$ ~] [%$ 2] [%$ 3] ~])
2018-03-19 06:54:47 +03:00
?: ?=(%| -.wyz)
2016-11-24 07:25:07 +03:00
%- =+ sam=(~(peek ut p.gat) %free 6)
(slog >%ap-slam-mismatch< ~(duck ut p.arg) ~(duck ut sam) ~)
:_(+>.$ [%| (ap-suck "call: {<cog>}: type mismatch")])
:_ +>.$(vel +>.wyz)
=+ [typ nok]=+<.wyz
=+ ton=(mock [[q.gat q.arg] nok] ap-sled)
?- -.ton
$0 [%& typ p.ton]
$1 [%| (turn p.ton |=(a/* (smyt (path a))))]
$2 [%| p.ton]
==
::
++ ap-sled (sloy ska) :: namespace view
++ ap-suck :: standard tang
|= msg/tape
^- tang
[%leaf (weld "gall: {<dap>}: " msg)]~
::
++ ap-term :: atomic vase
2015-12-20 23:50:45 +03:00
|= {a/@tas b/@}
2016-11-24 07:25:07 +03:00
^- vase
[[%atom a `b] b]
::
++ ap-vain :: card to vane
|= sep/@tas
^- (unit @tas)
?+ sep ~& [%ap-vain sep]
~
2018-06-22 07:00:07 +03:00
$build `%f
2016-11-24 07:25:07 +03:00
$cash `%a
$conf `%g
2018-01-25 19:22:29 +03:00
$cred `%c
$crew `%c
2018-02-13 22:12:30 +03:00
$crow `%c
2016-11-24 07:25:07 +03:00
$deal `%g
$dirk `%c
2016-11-24 07:25:07 +03:00
$drop `%c
2018-06-22 07:00:07 +03:00
$flog `%d
2016-11-24 07:25:07 +03:00
$info `%c
2018-06-22 07:00:07 +03:00
$keep `%f
$kill `%f
2018-10-24 19:18:04 +03:00
$look `%j
2016-11-24 07:25:07 +03:00
$merg `%c
$mint `%j
2016-11-24 07:25:07 +03:00
$mont `%c
2017-05-16 23:56:54 +03:00
$nuke `%a
2016-11-24 07:25:07 +03:00
$ogre `%c
2018-01-25 19:22:29 +03:00
$perm `%c
$rule `%e
2016-11-24 07:25:07 +03:00
$serv `%e
$them `%e
$wait `%b
$want `%a
$warp `%c
2018-05-15 06:48:29 +03:00
$well `%e
$well `%e
2018-10-30 21:41:35 +03:00
$wind `%j
2018-06-22 07:00:07 +03:00
$wipe `%f
2016-11-24 07:25:07 +03:00
==
--
--
++ call :: request
~% %gall-call +> ~
|= {hen/duct hic/(hypo (hobo task:able))}
^+ [*(list move) ..^$]
2016-11-24 07:25:07 +03:00
=> .(q.hic ?.(?=($soft -.q.hic) q.hic ((hard task:able) p.q.hic)))
?- -.q.hic
$conf
2018-12-13 04:34:25 +03:00
?. =(our p.p.q.hic)
2016-11-24 07:25:07 +03:00
~& [%gall-not-ours p.p.q.hic]
[~ ..^$]
2018-12-13 01:14:47 +03:00
mo-abet:(mo-conf:(mo-abed:mo hen) q.p.q.hic q.q.hic)
2016-11-24 07:25:07 +03:00
::
$deal
=< mo-abet
2018-12-13 04:34:25 +03:00
?. =(our q.p.q.hic) :: either to us
?> =(our p.p.q.hic) :: or from us
2018-12-13 01:14:47 +03:00
(mo-away:(mo-abed:mo hen) q.p.q.hic q.q.hic)
(mo-come:(mo-abed:mo hen) p.p.q.hic q.q.hic)
2016-11-24 07:25:07 +03:00
::
$init
2018-12-13 04:34:25 +03:00
[~ ..^$(sys.mast.all hen)]
::
$sunk [~ ..^$]
2016-11-24 07:25:07 +03:00
::
$west
2018-03-19 07:18:20 +03:00
?> ?=({?($ge $gh) @ ~} q.q.hic)
=* dap i.t.q.q.hic
=* him p.q.hic
2015-12-07 20:23:58 +03:00
?: ?=($ge i.q.q.hic)
=+ mes=((hard {@ud rook}) r.q.hic)
2015-06-23 00:02:27 +03:00
=< mo-abet
2018-12-13 01:14:47 +03:00
(mo-gawk:(mo-abed:mo hen) him dap mes)
=+ mes=((hard {@ud roon}) r.q.hic)
2016-11-24 07:25:07 +03:00
=< mo-abet
2018-12-13 01:14:47 +03:00
(mo-gawd:(mo-abed:mo hen) him dap mes)
2016-11-24 07:25:07 +03:00
::
$wegh
2018-12-13 04:34:25 +03:00
=/ =mass
=* mas mast.all
:+ (scot %p our) %|
:~ [%foreign [%& sap.mast.all]]
:+ %blocked %|
(sort ~(tap by (~(run by wub.mast.all) |=(sofa [%& +<]))) aor)
:+ %active %|
(sort ~(tap by (~(run by bum.mast.all) |=(seat [%& +<]))) aor)
==
=/ =move [hen %give %mass %gall %| [mass ~]]
[[move ~] ..^$]
2016-11-24 07:25:07 +03:00
==
::
++ load :: recreate vane
|= old/axle-n
^+ ..^$
?- -.old
2018-02-22 17:19:17 +03:00
$0 ..^$(all old)
2016-11-24 07:25:07 +03:00
==
::
++ scry
~/ %gall-scry
2017-12-20 02:16:40 +03:00
|= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path}
2016-11-24 07:25:07 +03:00
^- (unit (unit cage))
2018-03-19 06:54:47 +03:00
?. ?=(%& -.why) ~
2017-12-20 02:16:40 +03:00
=* his p.why
2016-11-24 07:25:07 +03:00
?: ?& =(%u ren)
=(~ tyl)
=([%$ %da now] lot)
2018-12-13 04:34:25 +03:00
=(our his)
(~(has by bum.mast.all) syd)
2016-11-24 07:25:07 +03:00
==
``[%null !>(~)]
2018-12-13 04:34:25 +03:00
?. =(our his)
2016-11-24 07:25:07 +03:00
~
?. =([%$ %da now] lot)
~
2018-12-13 04:34:25 +03:00
?. (~(has by bum.mast.all) syd)
2016-11-24 07:25:07 +03:00
[~ ~]
?. ?=(^ tyl)
~
2018-12-13 04:34:25 +03:00
(mo-peek:mo-abed:mo syd high+`his ren tyl)
2016-11-24 07:25:07 +03:00
::
++ stay :: save w+o cache
`axle`all
::
++ take :: response
~/ %gall-take
2016-11-24 07:25:07 +03:00
|= {tea/wire hen/duct hin/(hypo sign-arvo)}
^+ [*(list move) ..^$]
2016-11-24 07:25:07 +03:00
~| [%gall-take tea]
2018-12-14 03:26:05 +03:00
?> ?=([?($sys $use) *] tea)
2018-12-13 01:14:47 +03:00
=+ mow=(mo-abed:mo hen)
2018-12-14 03:26:05 +03:00
?- i.tea
$sys mo-abet:(mo-cyst:mow t.tea q.hin)
$use mo-abet:(mo-cook:mow t.tea hin)
==
2016-11-24 07:25:07 +03:00
--