shrub/pkg/arvo/sys/vane/gall.hoon

2415 lines
53 KiB
Plaintext
Raw Normal View History

!: :: %gall, agent execution
2016-11-24 07:25:07 +03:00
!? 163
!:
2016-11-24 07:25:07 +03:00
::::
|= pit=vase
=, gall
2015-05-10 01:55:05 +03:00
=> =~
2019-05-05 03:23:22 +03:00
::
:: (rest of arvo)
::
|%
::
:: +coke: cook.
::
++ coke
$? %inn
%out
%cay
==
::
:: +volt: voltage.
::
++ volt ?(%low %high)
::
:: +torc: security control.
::
++ torc $@(?(%iron %gold) [%lead p=ship])
::
:: +roon: reverse ames message.
::
++ roon
$%
:: diff (diff)
::
[%d p=mark q=*]
[%x ~]
==
::
:: +rook: forward ames message.
::
++ rook
$%
:: message
::
[%m p=mark q=*]
:: "peel" subscribe
::
[%l p=mark q=path]
:: subscribe
::
[%s p=path]
:: cancel+unsubscribe
::
[%u ~]
==
::
:: +whey: foreign response.
::
++ whey
$? %peer
%peel
%poke
%pull
==
::
--
::
:: (local arvo)
::
|%
::
:: +cote: +ap note.
::
++ cote
$% [%meta p=@tas q=vase]
[%send p=ship q=cush]
[%hiss p=(unit knot) q=mark r=cage]
==
::
:: +cove: internal move.
::
++ cove (pair bone (wind cote cuft))
::
:: +move: typed moved.
::
++ move (pair duct (wind note-arvo gift-arvo))
--
::
:: (%gall state)
::
|%
::
:: +axle-n: upgrade path.
::
++ axle-n ?(axle)
::
:: +axle: all state.
::
++ axle
$:
:: state version
::
%0
:: apps by ship
::
=mast
==
::
:: +gest: subscriber data.
::
++ gest
$:
:: incoming subscribers
::
sup=bitt
:: outgoing subscribers
::
neb=boat
:: queue meter
::
qel=(map bone @ud)
==
::
:: +mast: ship state.
::
++ mast
$:
:: (deprecated)
::
mak=*
:: system duct
::
sys=duct
:: foreign contacts
::
sap=(map ship scad)
:: running agents
::
bum=(map dude seat)
:: waiting queue
::
wub=(map dude sofa)
==
::
:: +ffuc: new cuff.
::
++ ffuc
$:
:: disclosing to
::
p=(unit (set ship))
:: attributed to
::
q=ship
==
::
:: +prey: privilege.
::
++ prey (pair volt ffuc)
::
:: +scad: foreign connections.
::
++ scad
$:
:: index
::
p=@ud
:: by duct
::
q=(map duct @ud)
:: by index
::
r=(map @ud duct)
==
::
:: +scar: opaque input.
::
++ scar
$:
:: bone sequence
::
p=@ud
:: by duct
::
q=(map duct bone)
:: by bone
::
r=(map bone duct)
==
::
:: +misvale-data: subscribers with bad marks.
::
:: 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)
::
:: +seat: agent state.
::
++ seat
$:
:: bad reqs
::
misvale=misvale-data
:: cache
::
vel=worm
:: ap-find cache
::
arms=(map [term path] (unit (pair @ud term)))
:: control duct
::
mom=duct
:: unstopped
::
liv=?
:: privilege
::
toc=torc
:: statistics
::
tyc=stic
:: subscribers
::
ged=gest
:: running state
::
hav=vase
:: update control
::
byk=beak
:: req'd translations
::
pyl=(map bone mark)
:: opaque ducts
::
zam=scar
==
::
:: +sofa: blocked kisses.
::
++ sofa (qeu (trel duct prey club))
::
:: +stic: statistics.
::
++ stic
$:
:: change number
::
act=@ud
:: entropy
::
eny=@uvJ
:: time
::
lat=@da
==
--
::
:: (vane header)
::
2016-11-24 07:25:07 +03:00
. ==
2019-05-05 03:23:22 +03:00
::
:: (all vane state)
::
=| all=axle
|= $:
:: identity
::
our=ship
:: urban time
::
now=@da
:: entropy
::
eny=@uvJ
:: activate
::
ska=sley
==
::
:: (opaque core)
::
2016-11-24 07:25:07 +03:00
~% %gall-top ..is ~
2019-04-27 09:08:29 +03:00
::
2019-05-05 03:23:22 +03:00
:: (state machine)
2019-04-27 09:08:29 +03:00
::
|%
::
2019-05-03 01:53:27 +03:00
:: +gall-payload: gall payload.
::
++ gall-payload +
::
:: +mo: move handling.
::
2016-11-24 07:25:07 +03:00
++ mo
2018-12-13 04:34:25 +03:00
~% %gall-mo +> ~
2019-04-11 23:09:44 +03:00
::
=* bowl-type -:!>(*bowl)
::
2019-05-05 03:23:22 +03:00
|_
$:
hen=duct
moves=(list move)
==
2019-04-11 23:13:17 +03:00
::
++ mo-state .
::
:: +mo-abed: initialise engine with the provided duct.
::
++ mo-abed
2018-12-13 04:34:25 +03:00
|= =duct
2019-04-11 23:16:24 +03:00
^+ mo-state
::
mo-state(hen duct)
2016-11-24 07:25:07 +03:00
::
2019-04-11 23:16:24 +03:00
:: +mo-abet: resolve moves.
::
++ mo-abet
2019-05-03 01:53:27 +03:00
^- [(list move) _gall-payload]
2019-04-11 23:16:24 +03:00
::
2019-04-25 20:39:32 +03:00
=/ resolved (flop moves)
2019-05-03 01:53:27 +03:00
[resolved gall-payload]
2016-11-24 07:25:07 +03:00
::
:: +mo-boot: pass a %build move to ford.
2016-11-24 07:25:07 +03:00
::
++ mo-boot
|= [=dude =ship =desk]
^+ mo-state
::
=/ =case [%da now]
::
=/ =path
=/ ship (scot %p ship)
=/ case (scot case)
/sys/core/[dude]/[ship]/[desk]/[case]
::
=/ =note-arvo
=/ disc [ship desk]
=/ spur /hoon/[dude]/app
=/ schematic [%core disc spur]
[%f %build live=%.y schematic]
::
=/ pass [path note-arvo]
(mo-pass pass)
::
2019-04-25 20:39:32 +03:00
:: +mo-pass: prepend a standard %pass move to the move state.
::
++ mo-pass
|= pass=(pair path note-arvo)
^+ mo-state
::
2019-04-25 20:39:32 +03:00
=/ =move [hen %pass pass]
mo-state(moves [move moves])
::
2019-04-25 20:39:32 +03:00
:: +mo-give: prepend a standard %give move to the move state.
2016-11-24 07:25:07 +03:00
::
++ mo-give
2019-04-25 20:39:32 +03:00
|= =gift:able
^+ mo-state
::
2019-04-25 20:39:32 +03:00
=/ =move [hen %give gift]
mo-state(moves [move moves])
2016-11-24 07:25:07 +03:00
::
:: +mo-okay: check that a vase contains a valid bowl.
::
++ mo-okay
~/ %mo-okay
|= =vase
2016-11-24 07:25:07 +03:00
^- ?
::
2019-04-25 20:39:32 +03:00
=/ val (slew 12 vase)
?~ val
%.n
::
2019-04-25 20:39:32 +03:00
=/ bowl p.u.val
(~(nest ut bowl) %.n bowl-type)
2016-11-24 07:25:07 +03:00
::
:: +mo-receive-core: receives an app core built by ford.
::
++ mo-receive-core
~/ %mo-receive-core
2019-04-24 20:53:35 +03:00
|= [=dude =beak =made-result:ford]
^+ mo-state
::
?: ?=([%incomplete *] made-result)
(mo-give %onto %.n tang.made-result)
::
=/ build-result build-result.made-result
::
?: ?=([%error *] build-result)
(mo-give %onto %.n message.build-result)
::
=/ =cage (result-to-cage:ford build-result)
=/ result-vase q.cage
::
2019-05-05 03:23:22 +03:00
=/ app-data=(unit seat) (~(get by bum.mast.all) dude)
?^ app-data
:: update the path
::
=/ updated u.app-data(byk beak)
2019-05-05 03:23:22 +03:00
=. bum.mast.all (~(put by bum.mast.all) dude updated)
:: magic update string from the old +mo-boon, "complete old boot"
::
2019-04-27 07:54:35 +03:00
=/ =prey [%high [~ our]]
=/ abedded (ap-abed:ap dude prey)
=/ peeped (ap-peep:abedded result-vase)
ap-abet:peeped
:: first install of the app
::
?. (mo-okay result-vase)
2019-04-27 07:54:35 +03:00
=/ err [[%leaf "{<dude>}: bogus core"] ~]
(mo-give %onto %.n err)
::
=. mo-state (mo-born dude beak result-vase)
::
=/ old mo-state
2019-04-27 07:54:35 +03:00
::
=/ wag
=/ =prey [%high [~ our]]
=/ abedded (ap-abed:ap dude prey)
(ap-prop:abedded ~)
::
?^ -.wag
=. mo-state old
(mo-give %onto %.n u.-.wag)
2019-04-27 07:54:35 +03:00
::
=. mo-state ap-abet:+.wag
2019-04-27 07:54:35 +03:00
::
=/ clawed (mo-claw dude)
(mo-give:clawed %onto %.y dude %boot now)
2016-11-24 07:25:07 +03:00
::
:: +mo-born: create a new seat.
::
++ mo-born
|= [=dude =beak =vase]
^+ mo-state
::
=| =seat
::
=/ =scar
=/ bone 1
2019-04-30 23:51:00 +03:00
=/ bone-duct [[[~ ~] 0] ~ ~]
=/ duct-bone [[0 [~ ~]] ~ ~]
[p=bone q=bone-duct r=duct-bone]
::
=/ new-seat
%_ seat
2016-11-24 07:25:07 +03:00
mom hen
byk beak
hav vase
zam scar
2016-11-24 07:25:07 +03:00
==
::
%_ mo-state
2019-05-05 03:23:22 +03:00
bum.mast.all (~(put by bum.mast.all) dude new-seat)
2016-11-24 07:25:07 +03:00
==
::
:: +mo-away: handle a foreign request.
2016-11-24 07:25:07 +03:00
::
++ mo-away
~/ %mo-away
|= [=ship =cush]
^+ mo-state
::
2019-04-27 07:54:35 +03:00
=/ =dude p.cush
=/ =club q.cush
::
?: ?=(%pump -.club)
2016-11-24 07:25:07 +03:00
::
:: 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.
::
mo-state
::
2019-04-27 07:54:35 +03:00
?: ?=(%peer-not -.club)
=/ =tang p.club
=/ err (some tang)
(mo-give %unto %reap err)
::
2019-04-27 07:54:35 +03:00
=^ bone mo-state (mo-bale ship)
::
=/ =rook
2019-04-27 07:54:35 +03:00
?- -.club
%poke [%m p.p.club q.q.p.club]
%pull [%u ~]
%puff !!
%punk !!
2019-04-27 07:54:35 +03:00
%peel [%l club]
%peer [%s p.club]
==
::
2019-04-27 07:54:35 +03:00
=/ action -.club
=/ =path /sys/way/[action]
2019-04-27 07:54:35 +03:00
=/ =note-arvo [%a %want ship [%g %ge dude ~] [bone rook]]
::
2019-04-27 07:54:35 +03:00
(mo-pass path note-arvo)
2016-11-24 07:25:07 +03:00
::
:: +mo-awed: handle foreign response.
2016-11-24 07:25:07 +03:00
::
++ mo-awed
|= [=whey art=(unit ares)]
^+ mo-state
::
=/ =ares
=/ tanks [%blank ~]
=/ tang (some tanks)
(fall art tang)
::
=/ to-tang
|= ars=(pair term tang)
^- tang
=/ tape (trip p.ars)
[[%leaf tape] q.ars]
::
=/ result (bind ares to-tang)
::
?- whey
%peel (mo-give %unto %reap result)
%peer (mo-give %unto %reap result)
%poke (mo-give %unto %coup result)
%pull mo-state
2016-11-24 07:25:07 +03:00
==
::
:: +mo-bale: assign an out bone.
::
++ mo-bale
|= =ship
2019-04-27 07:54:35 +03:00
^- [bone _mo-state]
::
=/ =scad
=/ default [1 ~ ~]
2019-05-05 03:23:22 +03:00
=/ existing (~(get by sap.mast.all) ship)
(fall existing default)
::
=/ nom (~(get by q.scad) hen)
::
?^ nom
[u.nom mo-state]
::
=/ index p.scad
::
=/ contacts
%_ scad
p +(index)
q (~(put by q.scad) hen index)
r (~(put by r.scad) index hen)
2015-05-10 01:55:05 +03:00
==
::
2019-04-27 07:54:35 +03:00
=/ next
%_ mo-state
2019-05-05 03:23:22 +03:00
sap.mast.all (~(put by sap.mast.all) ship contacts)
==
::
2019-04-27 07:54:35 +03:00
[index next]
2015-05-10 01:55:05 +03:00
::
:: +mo-ball: retrieve an out bone by index.
::
++ mo-ball
|= [=ship index=@ud]
2015-05-10 01:55:05 +03:00
^- duct
::
2019-05-05 03:23:22 +03:00
=/ conns (~(got by sap.mast.all) ship)
=/ duct r:conns
(~(got by duct) index)
2015-05-10 01:55:05 +03:00
::
:: +mo-cyst-core: receive a core.
::
++ mo-cyst-core
|= [=path =sign-arvo]
^+ mo-state
::
?> ?=([%f %made *] sign-arvo)
?> ?=([@ @ @ @ @ ~] path)
::
2019-04-24 21:49:51 +03:00
=/ beak-path t.t.path
::
=/ =beak
2019-04-24 21:49:51 +03:00
=/ ship (slav %p i.beak-path)
=/ desk i.t.beak-path
=/ case [%da (slav %da i.t.t.beak-path)]
[p=ship q=desk r=case]
::
2019-04-24 21:49:51 +03:00
(mo-receive-core i.t.path beak result.sign-arvo)
::
:: +mo-cyst-pel: translated peer.
::
++ mo-cyst-pel
|= [=path =sign-arvo]
^+ mo-state
::
?> ?=([%f %made *] sign-arvo)
?> ?=([@ @ ~] path)
::
?: ?=([%incomplete *] result.sign-arvo)
=/ err (some tang.result.sign-arvo)
(mo-give %unto %coup err)
::
=/ build-result build-result.result.sign-arvo
::
?: ?=([%error *] build-result)
=/ err (some message.build-result)
(mo-give %unto %coup err)
::
=/ =cage (result-to-cage:ford build-result)
(mo-give %unto %diff cage)
::
:: +mo-cyst-red: diff ack.
::
++ mo-cyst-red
|= [=path =sign-arvo]
^+ mo-state
::
?> ?=([@ @ @ @ ~] path)
::
?. ?=([%a %woot *] sign-arvo)
~& [%red-want path]
mo-state
::
=/ him (slav %p i.t.path)
=/ dap i.t.t.path
=/ num (slav %ud i.t.t.t.path)
::
2019-04-27 07:54:35 +03:00
=/ =coop q.+>.sign-arvo
::
=/ sys-path
=/ pax [%req t.path]
[%sys pax]
::
2019-04-27 07:54:35 +03:00
?~ coop
=/ =note-arvo [%g %deal [him our] dap %pump ~]
(mo-pass sys-path note-arvo)
::
=/ gall-move [%g %deal [him our] dap %pull ~]
=/ ames-move [%a %want him [%g %gh dap ~] [num %x ~]]
::
=. mo-state (mo-pass sys-path gall-move)
=. mo-state (mo-pass sys-path ames-move)
::
2019-04-27 07:54:35 +03:00
?. ?=([~ ~ %mack *] coop)
~& [%diff-bad-ack coop]
mo-state
~& [%diff-bad-ack %mack]
2019-05-03 01:53:27 +03:00
=/ slaw (slog (flop q.,.+>.coop)) :: FIXME kill this lark
(slaw mo-state)
::
:: +mo-cyst-rep: reverse request.
::
++ mo-cyst-rep
|= [=path =sign-arvo]
^+ mo-state
::
?> ?=([@ @ @ @ ~] path)
?> ?=([%f %made *] sign-arvo)
::
=/ him (slav %p i.t.path)
=/ dap i.t.t.path
=/ num (slav %ud i.t.t.t.path)
::
?: ?=([%incomplete *] result.sign-arvo)
=/ err (some tang.result.sign-arvo)
(mo-give %mack err)
::
=/ build-result build-result.result.sign-arvo
::
?: ?=([%error *] build-result)
:: "XX should crash"
=/ err (some message.build-result)
(mo-give %mack err)
::
:: "XX pump should ack"
=. mo-state (mo-give %mack ~)
::
=/ duct (mo-ball him num)
=/ initialised (mo-abed duct)
::
=/ =cage (result-to-cage:ford build-result)
=/ move [%unto %diff cage]
::
(mo-give:initialised move)
::
:: +mo-cyst-req: inbound request.
::
++ mo-cyst-req
|= [=path =sign-arvo]
^+ mo-state
::
?> ?=([@ @ @ @ ~] path)
::
=/ him (slav %p i.t.path)
=/ dap i.t.t.path
=/ num (slav %ud i.t.t.t.path)
::
?: ?=([%f %made *] sign-arvo)
?: ?=([%incomplete *] result.sign-arvo)
=/ err (some tang.result.sign-arvo)
(mo-give %mack err)
::
=/ build-result build-result.result.sign-arvo
::
?: ?=([%error *] build-result)
=/ err (some message.build-result)
(mo-give %mack err)
::
=/ =cage (result-to-cage:ford build-result)
=/ sys-path [%sys path]
=/ =note-arvo [%g %deal [him our] i.t.t.path %poke cage]
::
(mo-pass sys-path note-arvo)
::
?: ?=([%a %woot *] sign-arvo)
mo-state
::
?> ?=([%g %unto *] sign-arvo)
::
=/ =cuft +>.sign-arvo
::
?- -.cuft
::
%coup
::
(mo-give %mack p.cuft)
::
%diff
::
=/ sys-path [%sys %red t.path]
=/ note [%a %want him [%g %gh dap ~] [num %d p.p.cuft q.q.p.cuft]]
(mo-pass sys-path note)
::
%quit
::
=/ sys-path [%sys path]
=/ note [%a %want him [%g %gh dap ~] [num %x ~]]
(mo-pass sys-path note)
::
%reap
::
(mo-give %mack p.cuft)
==
::
:: +mo-cyst-val: inbound validate.
::
++ mo-cyst-val
|= [=path =sign-arvo]
^+ mo-state
2016-11-24 07:25:07 +03:00
::
?> ?=([%f %made *] sign-arvo)
?> ?=([@ @ @ ~] path)
::
=/ him (slav %p i.t.path)
=/ dap i.t.t.path
::
?: ?=([%incomplete *] result.sign-arvo)
=/ err (some tang.result.sign-arvo)
(mo-give %unto %coup err)
::
=/ build-result build-result.result.sign-arvo
::
?: ?=([%error *] build-result)
=/ err (some message.build-result)
(mo-give %unto %coup err)
::
=/ =prey [%high ~ him]
=/ =cage (result-to-cage:ford build-result)
=/ =club [%poke cage]
(mo-clip dap prey club)
::
:: +mo-cyst-way: outbound request.
::
++ mo-cyst-way
|= [=path =sign-arvo]
^+ mo-state
::
?> ?=([%a %woot *] sign-arvo)
?> ?=([@ @ ~] path)
::
2019-05-05 03:23:22 +03:00
=/ why (whey i.t.path)
=/ art +>+.sign-arvo
::
(mo-awed why art)
::
:: +mo-cyst: take in /sys.
::
++ mo-cyst
~/ %mo-cyst
2019-04-27 07:54:35 +03:00
|= [=path =sign-arvo]
^+ mo-state
::
2019-04-27 07:54:35 +03:00
?+ -.path !!
%core (mo-cyst-core path sign-arvo)
%pel (mo-cyst-pel path sign-arvo)
%red (mo-cyst-red path sign-arvo)
%rep (mo-cyst-rep path sign-arvo)
%req (mo-cyst-req path sign-arvo)
%val (mo-cyst-val path sign-arvo)
%way (mo-cyst-way path sign-arvo)
2016-11-24 07:25:07 +03:00
==
::
2019-04-11 23:29:43 +03:00
:: +mo-cook: take in /use.
::
++ mo-cook
~/ %mo-cook
2019-04-11 23:29:43 +03:00
|= [=path hin=(hypo sign-arvo)]
^+ mo-state
::
?. ?=([@ @ coke *] path)
~& [%mo-cook-bad-path path]
2016-11-24 07:25:07 +03:00
!!
2019-04-11 23:29:43 +03:00
::
2019-05-03 01:53:27 +03:00
=/ initialised
2019-04-11 23:29:43 +03:00
=/ =term i.path
=/ =ffuc [~ (slav %p i.t.path)]
=/ =prey [%high ffuc]
(ap-abed:ap term prey)
::
=/ vax
=/ =vase hin
(slot 3 vase)
::
?- i.t.t.path
::
%inn
::
2019-05-03 01:53:27 +03:00
=/ poured (ap-pour:initialised t.t.t.path vax)
2019-04-11 23:29:43 +03:00
ap-abet:poured
::
%cay
::
?. ?=([%e %sigh *] q.hin)
~& [%mo-cook-weird q.hin]
~& [%mo-cook-weird-path path]
mo-state
2019-05-03 01:53:27 +03:00
=/ purred (ap-purr:initialised +<.q.hin t.t.t.path +>.q.hin)
2019-04-11 23:29:43 +03:00
ap-abet:purred
::
%out
::
?. ?=([%g %unto *] q.hin)
~& [%mo-cook-weird q.hin]
~& [%mo-cook-weird-path path]
mo-state
2019-05-03 01:53:27 +03:00
=/ pouted (ap-pout:initialised t.t.t.path +>.q.hin)
2019-04-11 23:29:43 +03:00
ap-abet:pouted
2016-11-24 07:25:07 +03:00
==
::
2019-04-11 23:30:44 +03:00
:: +mo-claw: clear queue.
::
++ mo-claw
|= =dude
^+ mo-state
::
2019-05-05 03:23:22 +03:00
?. (~(has by bum.mast.all) dude)
2019-04-11 23:30:44 +03:00
mo-state
::
2019-05-05 03:23:22 +03:00
=/ maybe-sofa (~(get by wub.mast.all) dude)
2019-04-27 07:54:35 +03:00
::
?~ maybe-sofa
2019-04-11 23:30:44 +03:00
mo-state
::
2019-04-27 07:54:35 +03:00
=/ =sofa u.maybe-sofa
::
2019-05-03 01:53:27 +03:00
|- ^+ mo-state
2019-04-27 07:54:35 +03:00
?: =(~ sofa)
2019-04-11 23:30:44 +03:00
%_ mo-state
2019-05-05 03:23:22 +03:00
wub.mast.all (~(del by wub.mast.all) dude)
2019-04-11 23:30:44 +03:00
==
::
2019-04-27 07:54:35 +03:00
=^ cushion sofa [p q]:~(get to sofa)
=/ =duct p.cushion
=/ =prey q.cushion
=/ =club r.cushion
2019-04-11 23:30:44 +03:00
::
2019-04-27 07:54:35 +03:00
=/ move [duct %slip %g %deal [q.q.prey our] dude club]
2019-04-11 23:30:44 +03:00
$(moves [move moves])
::
:: +mo-beak: build beak.
2016-11-24 07:25:07 +03:00
::
2019-04-11 23:30:44 +03:00
++ mo-beak
|= =dude
2016-11-24 07:25:07 +03:00
^- beak
2019-05-05 03:23:22 +03:00
?~ app-data=(~(get by bum.mast.all) dude)
::
2019-04-11 23:30:44 +03:00
:: XX this fallback is necessary, as .dude could be either the source
:: or the destination app. ie, it might not exist locally ...
::
[our %home %da now]
byk.u.app-data
2016-11-24 07:25:07 +03:00
::
++ mo-peek
~/ %mo-peek
|= [=dude =prey =term =path]
2016-11-24 07:25:07 +03:00
^- (unit (unit cage))
::
2019-05-03 01:53:27 +03:00
=/ initialised (ap-abed:ap dude prey)
(ap-peek:initialised term path)
::
:: +mo-clip: apply club.
::
++ mo-clip
|= [=dude =prey =club]
^+ mo-state
::
=/ =path
=/ ship (scot %p q.q.prey)
/sys/val/[ship]/[dude]
::
2019-04-27 07:54:35 +03:00
=/ ship-info
=/ beak (mo-beak dude)
[p q]:beak
::
?: ?=(%puff -.club)
2019-04-27 07:54:35 +03:00
=/ =schematic:ford [%vale ship-info +.club]
=/ =note-arvo [%f %build live=%.n schematic]
(mo-pass path note-arvo)
::
?: ?=(%punk -.club)
2019-04-27 07:54:35 +03:00
=/ =schematic:ford [%cast ship-info p.club [%$ q.club]]
=/ =note-arvo [%f %build live=%.n schematic]
(mo-pass path note-arvo)
::
?: ?=(%peer-not -.club)
=/ err (some p.club)
(mo-give %unto %reap err)
::
2019-05-03 01:53:27 +03:00
=/ initialised (ap-abed:ap dude prey)
=/ applied (ap-club:initialised club)
ap-abet:applied
::
2019-04-27 07:54:35 +03:00
:: +mo-come: handle locally.
::
2019-04-25 20:39:32 +03:00
++ mo-come
|= [=ship =cush]
^+ mo-state
::
2019-04-25 20:39:32 +03:00
=/ =prey [%high [~ ship]]
=/ =dude p.cush
=/ =club q.cush
::
2019-05-05 03:23:22 +03:00
=/ is-running (~(has by bum.mast.all) dude)
=/ is-waiting (~(has by wub.mast.all) dude)
2019-04-26 08:16:46 +03:00
::
?: |(!is-running is-waiting)
::
=/ =sofa
2019-05-05 03:23:22 +03:00
=/ waiting (~(get by wub.mast.all) dude)
2019-05-03 01:53:27 +03:00
=/ kisses (fall waiting *sofa)
=/ kiss [hen prey club]
2019-04-26 08:16:46 +03:00
(~(put to kisses) kiss)
::
%_ mo-state
2019-05-05 03:23:22 +03:00
wub.mast.all (~(put by wub.mast.all) dude sofa)
==
::
(mo-clip dude prey club)
::
:: +mo-gawk: ames forward.
2016-11-24 07:25:07 +03:00
::
++ mo-gawk
2019-04-27 07:54:35 +03:00
|= [=ship =dude =bone =rook]
^+ mo-state
::
=. mo-state
?. ?=(%u -.rook)
mo-state
(mo-give %mack ~)
::
=/ =path
2019-04-27 07:54:35 +03:00
=/ him (scot %p ship)
=/ num (scot %ud bone)
/sys/req/[him]/[dude]/[num]
::
=/ =note-arvo
?- -.rook
2019-04-27 07:54:35 +03:00
%m [%g %deal [ship our] dude %puff p.rook q.rook]
%l [%g %deal [ship our] dude %peel p.rook q.rook]
%s [%g %deal [ship our] dude %peer p.rook]
%u [%g %deal [ship our] dude %pull ~]
==
::
(mo-pass path note-arvo)
::
:: +mo-gawd: ames backward.
::
++ mo-gawd
2019-04-27 07:54:35 +03:00
|= [=ship =dude =bone =roon]
^+ mo-state
::
?- -.roon
::
%d
2019-05-03 01:53:27 +03:00
::
=/ =path
2019-04-27 07:54:35 +03:00
=/ him (scot %p ship)
=/ num (scot %ud bone)
/sys/rep/[him]/[dude]/[num]
::
=/ =note-arvo
=/ beak (mo-beak dude)
=/ info [p q]:beak
2019-04-27 07:54:35 +03:00
=/ =schematic:ford [%vale info p.roon q.roon]
[%f %build live=%.n schematic]
::
(mo-pass path note-arvo)
::
%x
2019-05-03 01:53:27 +03:00
::
:: XX should crash
=. mo-state (mo-give %mack ~)
::
=/ initialised
=/ out (mo-ball ship bone)
(mo-abed out)
::
2019-05-03 01:53:27 +03:00
(mo-give:initialised %unto %quit ~)
2015-05-10 01:55:05 +03:00
==
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:05:43 +03:00
:: +ap: agent engine
::
++ ap
2016-11-24 07:25:07 +03:00
~% %gall-ap +> ~
2019-04-27 09:08:29 +03:00
::
|_ $: dap=dude
pry=prey
ost=bone
zip=(list cove)
dub=(list (each suss tang))
sat=seat
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:05:43 +03:00
++ ap-state .
::
:: +ap-abed: initialise the provided app with the supplied privilege.
2019-04-27 08:05:43 +03:00
::
++ ap-abed
~/ %ap-abed
2019-04-27 09:08:29 +03:00
|= [=dude =prey]
2019-04-27 08:05:43 +03:00
^+ ap-state
::
=/ =seat
2019-05-05 03:23:22 +03:00
=/ sitting (~(got by bum.mast.all) dude)
=/ =stic
=/ stat tyc.sitting
=/ nact +(act.stat)
=/ trop (shaz (mix (add dude nact) eny))
[act=nact eny=trop lat=now]
sitting(tyc stic)
2019-04-27 09:08:29 +03:00
::
=/ bone p.zam.seat
=/ bone-duct q.zam.seat
=/ duct-bone r.zam.seat
2019-04-27 09:08:29 +03:00
::
=/ maybe-bone (~(get by bone-duct) hen)
::
?^ maybe-bone
=/ bone u.maybe-bone
ap-state(dap dude, pry prey, sat seat, ost bone)
2019-04-27 09:08:29 +03:00
::
=/ =scar
=/ bone +(bone)
=/ bone-duct (~(put by bone-duct) hen bone)
=/ duct-bone (~(put by duct-bone) bone hen)
[p=bone q=bone-duct r=duct-bone]
2019-04-27 09:08:29 +03:00
::
2019-04-27 08:05:43 +03:00
%= ap-state
ost bone
zam.sat scar
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:05:43 +03:00
:: +ap-abet: resolve moves.
::
++ ap-abet
^+ mo-state
::
2016-11-24 07:25:07 +03:00
=> ap-abut
2019-04-27 08:05:43 +03:00
%_ mo-state
2019-05-05 03:23:22 +03:00
bum.mast.all (~(put by bum.mast.all) dap sat)
2019-05-03 01:53:27 +03:00
moves :(weld (turn zip ap-aver) (turn dub ap-avid) moves)
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:42:04 +03:00
:: +ap-abut: track queue.
::
++ ap-abut
^+ ap-state
::
=/ coves zip
=/ bones *(set bone)
::
|- ^+ ap-state
?^ coves
?. ?=([%give %diff *] q.i.coves)
$(coves t.coves)
::
=^ added ap-state ap-fill(ost p.i.coves)
::
=/ ribs
?: added
bones
(~(put in bones) p.i.coves)
::
$(coves t.coves, bones ribs)
::
=/ boned ~(tap in bones)
2019-04-27 09:08:29 +03:00
::
|- ^+ ap-state
?~ boned
ap-state
=> %*(. $(boned t.boned) ost i.boned) :: FIXME
2019-04-27 09:08:29 +03:00
::
=/ tib (~(get by sup.ged.sat) ost)
::
?~ tib
~& [%ap-abut-bad-bone dap ost]
..ap-kill
2016-11-24 07:25:07 +03:00
ap-kill(q.q.pry p.u.tib)
::
2019-04-27 08:42:04 +03:00
:: +ap-aver: cove to move.
::
++ ap-aver
~/ %ap-aver
|= =cove
2019-01-18 08:37:34 +03:00
^- move
2019-04-27 08:42:04 +03:00
::
:- (~(got by r.zam.sat) p.cove)
?- -.q.cove
::
%slip !!
::
%sick !!
::
2019-04-27 09:08:29 +03:00
%give
::
?< =(0 p.cove)
?. ?=(%diff -.p.q.cove)
[%give %unto p.q.cove]
2019-04-27 09:08:29 +03:00
::
=/ =cage p.p.q.cove
=/ =mark ((~(gut by pyl.sat) p.cove p.cage)
2019-04-27 09:08:29 +03:00
::
?: =(mark p.cage)
[%give %unto p.q.cove]
::
=/ =path /sys/pel/[dap]
=/ =schematic:ford
=/ =beak (mo-beak dap)
[%cast [p q]:beak mark [%$ cage]]
::
=/ =note-arvo [%f %build live=%.n schematic]
[%pass path note-arvo]
::
2019-04-27 09:08:29 +03:00
%pass
::
=/ =path /sys/pel/[dap]
=/ =schematic:ford
=/ =beak (mo-beak dap)
[%cast [p q]:beak mark [%$ cage]]
::
=/ =note-arvo [%f %build live=%.n schematic]
[%pass path note-arvo]
::
%pass
::
=/ =path [%use dap p.q.cove]
=/ =note-arvo
?- -.q.q.cove
2019-05-03 01:53:27 +03:00
%send
=/ =sock [our p.q.q.cove]
=/ =cush [q.q.q.cove]
[%g %deal sock cush]
::
%meta
=/ =term p.q.q.cove
=/ =vase q.q.q.cove
[term %meta vase]
==
[%pass path note-arvo]
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:42:04 +03:00
:: +ap-avid: onto results.
::
++ ap-avid
2019-04-27 09:08:29 +03:00
|= a=(each suss tang)
^- move
::
[hen %give %onto a]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-call: call into server.
::
++ ap-call
2016-11-24 07:25:07 +03:00
~/ %ap-call
2019-05-03 01:53:27 +03:00
|= [=term =vase]
2019-04-27 08:42:04 +03:00
^- [(unit tang) _ap-state]
::
=. ap-state ap-bowl
2019-05-03 01:53:27 +03:00
=^ arm ap-state (ap-farm term)
::
?: ?=(%| -.arm)
[(some p.arm) ap-state]
::
=^ zem ap-state (ap-slam term p.arm vase)
::
?: ?=(%| -.zem)
[(some p.zem) ap-state]
2019-01-18 08:37:34 +03:00
(ap-sake p.zem)
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-peek: peek.
::
2016-11-24 07:25:07 +03:00
++ ap-peek
~/ %ap-peek
2019-04-27 08:42:04 +03:00
|= [ren=@tas tyl=path]
2016-11-24 07:25:07 +03:00
^- (unit (unit cage))
2019-04-27 08:42:04 +03:00
::
2019-05-03 01:53:27 +03:00
=+
?. ?=(%x ren)
[mark=%$ tyl=tyl]
=/ =path (flop tyl)
?> ?=(^ path)
[mark=i.path tyl=(flop t.path)]
::
2019-04-27 08:42:04 +03:00
=^ cug ap-state (ap-find %peek ren tyl)
2019-05-03 01:53:27 +03:00
::
2016-11-24 07:25:07 +03:00
?~ cug
2019-05-03 01:53:27 +03:00
=/ =tank [%leaf "peek find fail"]
((slog tank >tyl< >mark< ~) [~ ~])
::
2019-04-27 08:42:04 +03:00
=^ arm ap-state (ap-farm q.u.cug)
2019-05-03 01:53:27 +03:00
::
?: ?=(%| -.arm)
=/ =tank [%leaf "peek farm fail"]
((slog tank p.arm) [~ ~])
::
=/ slammed
=/ =path [ren tyl]
=/ =vase !>((slag p.u.cug path))
(ap-slam q.u.cug p.arm vase)
::
=^ zem ap-state slammed
::
?: ?=(%| -.zem)
=/ =tank [%leaf "peek slam fail"]
((slog tank p.zem) [~ ~])
::
=/ err
=/ =tank [%leaf "peek bad result"]
((slog tank ~) [~ ~])
::
?+ q.p.zem err
~ ~
::
[~ ~] [~ ~]
::
[~ ~ ^]
=/ =vase (sped (slot 7 p.zem))
::
?. ?=([p=@ *] q.vase)
=/ =tank [%leaf "scry: malformed cage"]
((slog tank ~) [~ ~])
::
?. ((sane %as) p.q.vase)
=/ =tank [%leaf "scry: malformed cage"]
((slog tank ~) [~ ~])
::
?. =(mark p.q.vase)
[~ ~]
::
=/ =cage [p.q.vase (slot 3 vase)]
(some (some cage))
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:42:04 +03:00
:: +ap-club: apply effect.
::
++ ap-club
2019-05-03 01:53:27 +03:00
|= =club
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
?- -.club
%peel (ap-peel +.club)
%poke (ap-poke +.club)
%peer (ap-peer +.club)
%puff !!
%punk !!
%peer-not !!
%pull ap-pull
%pump ap-fall
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:42:04 +03:00
:: +ap-diff: pour a diff.
::
++ ap-diff
~/ %ap-diff
2019-05-03 01:53:27 +03:00
|= [=ship pax=path =cage]
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=/ diff [%diff p.cage +.pax]
::
=^ cug ap-state (ap-find diff)
::
2016-11-24 07:25:07 +03:00
?~ cug
2019-05-03 01:53:27 +03:00
=/ target [%.n ship +.pax]
::
=/ =tang
=/ why "diff: no {<`path`[p.cage +.pax]>}"
(ap-suck why)
::
=/ lame (ap-lame %diff tang)
(ap-pump:lame target)
::
=/ =vase
=/ target
2016-11-24 07:25:07 +03:00
?: =(0 p.u.cug)
2019-05-03 01:53:27 +03:00
=/ vas (ap-cage cage)
[!>(`path`+.pax) vas]
[!>((slag (dec p.u.cug) `path`+.pax)) q.cage]
(slop target)
::
=^ cam ap-state (ap-call q.u.cug vase)
::
2019-01-18 08:37:34 +03:00
?^ cam
2019-05-03 01:53:27 +03:00
=/ lame (ap-lame q.u.cug u.cam)
(ap-pump:lame %.n ship pax)
(ap-pump %.y ship pax)
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-cage: cage to tagged vase.
::
++ ap-cage
2019-05-29 01:37:42 +03:00
|= cag/cage
^- vase
(slop `vase`[[%atom %tas `p.cag] p.cag] q.cag)
::
2019-04-27 08:42:04 +03:00
:: +ap-pump: update subscription.
::
++ ap-pump
~/ %ap-pump
2019-05-03 01:53:27 +03:00
|= [is-ok=? =ship =path]
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=/ way [(scot %p ship) %out path]
::
?: is-ok
(ap-pass way %send ship -.path %pump ~)
::
=/ give (ap-give %quit ~)
(ap-pass:give way %send ship -.path %pull ~)
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-fail: drop from queue.
::
++ ap-fall
^+ ap-state
::
2019-05-03 01:53:27 +03:00
?. (~(has by sup.ged.sat) ost)
ap-state
::
=/ soy (~(get by qel.ged.sat) ost)
::
2019-01-18 08:37:34 +03:00
?: |(?=(~ soy) =(0 u.soy))
2019-05-03 01:53:27 +03:00
ap-state
::
2016-11-24 07:25:07 +03:00
=. u.soy (dec u.soy)
2019-05-03 01:53:27 +03:00
::
2019-01-18 08:37:34 +03:00
?: =(0 u.soy)
2019-05-03 01:53:27 +03:00
ap-state(qel.ged.sat (~(del by qel.ged.sat) ost))
ap-state(qel.ged.sat (~(put by qel.ged.sat) ost u.soy))
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-farm: produce arm.
::
++ ap-farm
2016-11-24 07:25:07 +03:00
~/ %ap-farm
2019-05-03 01:53:27 +03:00
|= =term
2019-04-27 08:42:04 +03:00
^- [(each vase tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
=/ pyz (mule |.((~(mint wa vel.sat) p.hav.sat [%limb term]))) :: FIXME
::
?: ?=(%.n -.pyz)
=/ =tang +.pyz
[[%.n tang] ap-state]
::
=/ this=(each vase tang)
=/ ton (mock [q.hav.sat q.+<.pyz] ap-sled)
?- -.ton
%0 [%.y p.+<.pyz p.ton]
%1 [%.n (turn p.ton |=(a/* (smyt (path a))))]
%2 [%.n p.ton]
==
::
=/ =worm +>.pyz
=/ next ap-state(vel.sat worm)
[this next]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-fill: add to queue.
::
++ ap-fill
^- [? _ap-state]
2019-05-03 01:53:27 +03:00
=/ suy (~(gut by qel.ged.sat) ost 0)
2019-06-04 01:23:29 +03:00
=/ subscriber=(unit (pair ship path))
(~(get by sup.ged.sat) ost)
2019-05-03 01:53:27 +03:00
::
2019-06-04 01:23:29 +03:00
?: ?& =(20 suy)
?| ?=(~ subscriber)
!=(our p.u.subscriber)
==
==
~& [%gall-pulling-20 ost (~(get by sup.ged.sat) ost) (~(get by r.zam.sat) ost)]
2019-05-03 01:53:27 +03:00
[%.n ..ap-fill]
[%.y ..ap-fill(qel.ged.sat (~(put by qel.ged.sat) ost +(suy)))]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-find: general arm.
::
++ ap-find
~/ %ap-find
2019-05-03 01:53:27 +03:00
|= [=term =path]
^- [(unit (pair @ud @tas)) _ap-state]
:: check cache
2019-05-03 01:53:27 +03:00
::
=/ maybe-result (~(get by arms.sat) [term path])
?^ maybe-result
2019-04-27 08:42:04 +03:00
[u.maybe-result ap-state]
::
2019-05-03 01:53:27 +03:00
=/ result
=/ dep 0
|- ^- (unit (pair @ud @tas))
=/ spu
?~ path
~
=/ hyped (cat 3 term (cat 3 '-' i.path))
$(path t.path, dep +(dep), term hyped)
::
?^ spu
spu
::
?. (ap-fond term)
~
(some [dep term])
::
=. arms.sat (~(put by arms.sat) [term path] result)
::
2019-04-27 08:42:04 +03:00
[result ap-state]
::
:: +ap-fond: check for arm.
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
++ ap-fond
~/ %ap-fond
2019-05-03 01:53:27 +03:00
|= =term
2016-11-24 07:25:07 +03:00
^- ?
2019-04-27 08:42:04 +03:00
::
2019-05-03 01:53:27 +03:00
(slob term p.hav.sat)
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-give: return result.
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
++ ap-give
2019-05-03 01:53:27 +03:00
|= =cuft
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=/ coves [[ost %give cuft] zip]
ap-state(zip coves)
2019-04-27 08:42:04 +03:00
::
:: +ap-bowl: set up bowl.
::
++ ap-bowl
2019-05-03 01:53:27 +03:00
^+ ap-state
:: FIXME
2019-04-27 08:42:04 +03:00
%_ ap-state
+12.q.hav.sat
2016-11-24 07:25:07 +03:00
^- bowl
:* :* our :: host
q.q.pry :: guest
dap :: agent
== ::
:* wex=~ :: outgoing
sup=sup.ged.sat :: incoming
2016-11-24 07:25:07 +03:00
== ::
:* ost=ost :: cause
act=act.tyc.sat :: tick
eny=eny.tyc.sat :: nonce
now=lat.tyc.sat :: time
byk=byk.sat :: source
2016-11-24 07:25:07 +03:00
== == ::
==
::
2019-04-27 08:42:04 +03:00
:: +ap-move: process each move.
::
++ ap-move
2016-11-24 07:25:07 +03:00
~/ %ap-move
2019-05-03 01:53:27 +03:00
|= =vase
2019-04-27 08:42:04 +03:00
^- [(each cove tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
?@ q.vase
=/ =tang (ap-suck "move: invalid move (atom)")
[[%.n tang] ap-state]
::
?^ -.q.vase
=/ =tang (ap-suck "move: invalid move (bone)")
[[%.n tang] ap-state]
::
?@ +.q.vase
=/ =tang (ap-suck "move: invalid move(card)")
[[%.n tang] ap-state]
::
=/ hun (~(get by r.zam.sat) -.q.vase)
::
?. &((~(has by r.zam.sat) -.q.vase) !=(0 -.q.vase))
~& [q-vase+q.vase has-by-r-zam+(~(has by r.zam.sat) -.q.vase)]
=/ =tang (ap-suck "move: invalid card (bone {<-.q.vase>})")
[[%.n tang] ap-state]
::
=^ pec vel.sat (~(spot wa vel.sat) 3 vase)
=^ cav vel.sat (~(slot wa vel.sat) 3 pec)
2019-05-03 01:53:27 +03:00
::
?+ +<.q.vase
(ap-move-pass -.q.vase +<.q.vase cav)
%diff (ap-move-diff -.q.vase cav)
%hiss (ap-move-hiss -.q.vase cav)
%peel (ap-move-peel -.q.vase cav)
%peer (ap-move-peer -.q.vase cav)
%pull (ap-move-pull -.q.vase cav)
%poke (ap-move-poke -.q.vase cav)
%send (ap-move-send -.q.vase cav)
%quit (ap-move-quit -.q.vase cav)
%http-response (ap-move-http-response -.q.vax cav)
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:42:04 +03:00
:: +ap-move-quit: give quit move.
::
++ ap-move-quit
~/ %quit
2019-05-03 01:53:27 +03:00
|= [=bone =vase]
2019-04-27 08:42:04 +03:00
^- [(each cove tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
=/ that=(each cove tang)
?^ q.vase
=/ =tang (ap-suck "quit: improper give")
[%.n tang]
=/ =cuft [%quit ~]
=/ =cove [bone %give cuft]
[%.y p=cove]
::
=/ next
=/ incoming (~(del by sup.ged.sat) bone)
ap-state(sup.ged.sat incoming)
::
[that next]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-move-diff: give diff move.
::
++ ap-move-diff
~/ %diff
2019-05-03 01:53:27 +03:00
|= [=bone =vase]
2019-04-27 08:42:04 +03:00
^- [(each cove tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
=^ pec vel.sat (~(sped wa vel.sat) vase)
::
?. &(?=(^ q.pec) ?=(@ -.q.pec) ((sane %tas) -.q.pec)) :: FIXME
=/ =tang (ap-suck "diff: improper give")
[[%.n tang] ap-state]
::
=^ tel vel.sat (~(slot wa vel.sat) 3 pec)
2019-05-03 01:53:27 +03:00
::
=/ =cove
=/ =cage [-.q.pec tel]
[bone %give %diff cage]
::
[[%.y p=cove] ap-state]
2016-11-24 07:25:07 +03:00
::
::
2019-04-27 08:42:04 +03:00
:: TODO: Magic vase validation. I have no idea how malformed
:: checking works.
::
2019-04-27 08:42:04 +03:00
:: This should be moved into +cote
::
2019-04-27 08:42:04 +03:00
:_ ap-state
[%& sto %give %http-response ;;(http-event:http q.vax)]
::
2019-04-27 08:42:04 +03:00
::
:: +ap-move-mess: extract path, target.
::
++ ap-move-mess
~/ %mess
2019-05-03 01:53:27 +03:00
|= =vase
2019-04-27 08:42:04 +03:00
^- [(each (trel path ship term) tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
=/ that=(each (trel path ship term) tang)
?. ?& ?=([p=* [q=@ r=@] s=*] q.vase)
(gte 1 (met 7 q.q.vase))
==
=/ =tang (ap-suck "mess: malformed target")
[%.n tang]
::
=/ pux ((soft path) p.q.vase)
::
?. &(?=(^ pux) (levy u.pux (sane %ta)))
=/ =tang (ap-suck "mess: malformed path")
[%.n tang]
::
=/ =path [(scot %p q.q.vase) %out r.q.vase u.pux]
=/ =ship q.q.vase
=/ =term r.q.vase
[%.y path ship term]
::
[that ap-state]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-move-pass: pass general move.
::
++ ap-move-pass
~/ %pass
2019-05-03 01:53:27 +03:00
|= [=bone =noun =vase]
2019-04-27 08:42:04 +03:00
^- [(each cove tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
?. &(?=(@ noun) ((sane %tas) noun))
=/ =tang (ap-suck "pass: malformed card")
[[%.n tang] ap-state]
::
=/ pux ((soft path) -.q.vase)
::
2016-11-24 07:25:07 +03:00
?. &(?=(^ pux) (levy u.pux (sane %ta)))
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "pass: malformed path")
~& [%bad-path pux]
2019-05-03 01:53:27 +03:00
[[%.n tang] ap-state]
::
=/ huj (ap-vain noun)
::
?~ huj
=/ =tang (ap-suck "move: unknown note {(trip noun)}")
[[%.n tang] ap-state]
::
=^ tel vel.sat (~(slot wa vel.sat) 3 vase)
::
2019-04-27 08:42:04 +03:00
:_ ap-state
2019-05-03 01:53:27 +03:00
:^ %.y bone %pass
2016-11-24 07:25:07 +03:00
:- [(scot %p q.q.pry) %inn u.pux]
2019-05-03 01:53:27 +03:00
[%meta u.huj (slop (ap-term %tas noun) tel)]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-move-poke: pass %poke.
::
++ ap-move-poke
~/ %poke
2019-04-27 08:42:04 +03:00
|= [sto=bone vax=vase]
^- [(each cove tang) _ap-state]
::
=^ yep ap-state (ap-move-mess vax)
2019-05-03 01:53:27 +03:00
::
?: ?=(%.n -.yep)
[yep ap-state]
::
=^ gaw vel.sat (~(slot wa vel.sat) 7 vax)
2019-05-03 01:53:27 +03:00
::
2019-04-27 08:42:04 +03:00
?. &(?=([p=@ q=*] q.gaw) ((sane %tas) p.q.gaw))
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "poke: malformed cage")
[[%.n tang] ap-state]
::
=^ paw vel.sat (~(stop wa vel.sat) 3 gaw)
2019-05-03 01:53:27 +03:00
::
2019-04-27 08:42:04 +03:00
:_ ap-state
2019-05-03 01:53:27 +03:00
:^ %.y sto %pass
2016-11-24 07:25:07 +03:00
:- p.p.yep
[%send q.p.yep r.p.yep %poke p.q.gaw paw]
::
2019-04-27 08:42:04 +03:00
:: +ap-move-peel: pass %peel.
::
++ ap-move-peel
~/ %peel
2019-05-03 01:53:27 +03:00
|= [=bone =vase]
2019-04-27 08:42:04 +03:00
^- [(each cove tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
=^ yep ap-state (ap-move-mess vase)
::
:: FIXME invert
2019-04-27 08:42:04 +03:00
:_ ap-state
2019-05-03 01:53:27 +03:00
?: ?=(%.n -.yep)
yep
::
=/ mar ((soft mark) +>-.q.vase)
::
2016-11-24 07:25:07 +03:00
?~ mar
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "peel: malformed mark")
[%.n tang]
::
=/ pux ((soft path) +>+.q.vase)
::
2016-11-24 07:25:07 +03:00
?. &(?=(^ pux) (levy u.pux (sane %ta)))
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "peel: malformed path")
[%.n tang]
::
?: (~(has in misvale.sat) p.p.yep)
2016-11-15 02:44:50 +03:00
=/ err [leaf+"peel: misvalidation encountered"]~
2019-05-03 01:53:27 +03:00
:^ %.y bone %pass
2016-11-08 01:17:06 +03:00
:- p.p.yep
[%send q.p.yep r.p.yep %peer-not err]
2019-05-03 01:53:27 +03:00
::
:^ %.y bone %pass
2016-11-24 07:25:07 +03:00
:- p.p.yep
[%send q.p.yep r.p.yep %peel u.mar u.pux]
::
2019-04-27 08:42:04 +03:00
:: +ap-move-peer: pass %peer.
::
++ ap-move-peer
~/ %peer
2019-05-03 01:53:27 +03:00
|= [=bone =vase]
2019-04-27 08:42:04 +03:00
^- [(each cove tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
=^ yep ap-state (ap-move-mess vase)
::
2019-04-27 08:42:04 +03:00
:_ ap-state
2019-05-03 01:53:27 +03:00
?: ?=(%.n -.yep)
yep
::
=/ pux ((soft path) +>.q.vase)
::
2016-11-24 07:25:07 +03:00
?. &(?=(^ pux) (levy u.pux (sane %ta)))
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "peer: malformed path")
[%.n tang]
::
?: (~(has in misvale.sat) p.p.yep)
2016-11-15 02:44:50 +03:00
=/ err [leaf+"peer: misvalidation encountered"]~
2019-05-03 01:53:27 +03:00
:^ %& bone %pass
2016-11-08 01:17:06 +03:00
:- p.p.yep
[%send q.p.yep r.p.yep %peer-not err]
2019-05-03 01:53:27 +03:00
::
:^ %& bone %pass
2016-11-24 07:25:07 +03:00
:- p.p.yep
[%send q.p.yep r.p.yep %peer u.pux]
::
2019-04-27 08:42:04 +03:00
:: +ap-move-pull: pass %pull.
::
++ ap-move-pull
~/ %pull
2019-05-03 01:53:27 +03:00
|= [=bone =vase]
2019-04-27 08:42:04 +03:00
^- [(each cove tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
=^ yep ap-state (ap-move-mess vase)
::
2019-04-27 08:42:04 +03:00
:_ ap-state
2019-05-03 01:53:27 +03:00
?: ?=(%.n -.yep)
yep
::
?. =(~ +>.q.vase)
=/ =tang (ap-suck "pull: malformed card")
[%.n tang]
::
:^ %.y bone %pass
2016-11-24 07:25:07 +03:00
:- p.p.yep
[%send q.p.yep r.p.yep %pull ~]
::
2019-04-27 08:42:04 +03:00
:: +ap-move-send: pass gall action.
::
++ ap-move-send
~/ %send
2019-05-03 01:53:27 +03:00
|= [=bone =vase]
2019-04-27 08:42:04 +03:00
^- [(each cove tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
?. ?& ?=([p=* [q=@ r=@] [s=@ t=*]] q.vase)
(gte 1 (met 7 q.q.vase))
((sane %tas) r.q.vase)
2016-11-24 07:25:07 +03:00
==
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "send: improper ask.[%send wire gill club]")
:_(ap-state [%.n tang])
::
=/ pux ((soft path) p.q.vase)
::
2016-11-24 07:25:07 +03:00
?. &(?=(^ pux) (levy u.pux (sane %ta)))
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "send: malformed path")
[[%.n tang] ap-state]
::
?: ?=($poke s.q.vase)
=^ gav vel.sat (~(spot wa vel.sat) 7 vase)
::
2016-11-24 07:25:07 +03:00
?> =(%poke -.q.gav)
2019-05-03 01:53:27 +03:00
::
?. ?& ?=([p=@ q=*] t.q.vase)
((sane %tas) p.t.q.vase)
2016-11-24 07:25:07 +03:00
==
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "send: malformed poke")
[[%.n tang] ap-state]
::
=^ vig vel.sat (~(spot wa vel.sat) 3 gav)
=^ geb vel.sat (~(slot wa vel.sat) 3 vig)
2019-05-03 01:53:27 +03:00
::
2019-04-27 08:42:04 +03:00
:_ ap-state
2019-05-03 01:53:27 +03:00
:^ %.y bone %pass
:- [(scot %p q.q.vase) %out r.q.vase u.pux]
2016-11-24 07:25:07 +03:00
^- cote
2019-05-03 01:53:27 +03:00
[%send q.q.vase r.q.vase %poke p.t.q.vase geb]
::
2019-04-27 08:42:04 +03:00
:_ ap-state
2019-05-03 01:53:27 +03:00
=/ cob ((soft club) [s t]:q.vase)
2016-11-24 07:25:07 +03:00
?~ cob
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "send: malformed club")
[%.n tang]
:^ %& bone %pass
:- [(scot %p q.q.vase) %out r.q.vase u.pux]
[%send q.q.vase r.q.vase u.cob]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-pass: request action.
::
++ ap-pass
2019-05-03 01:53:27 +03:00
|= [=path =cote]
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=/ =cove [ost %pass path cote]
ap-state(zip [cove zip])
2019-04-27 08:42:04 +03:00
::
:: +ap-peep: reinstall.
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
++ ap-peep
~/ %ap-peep
2019-05-03 01:53:27 +03:00
|= =vase
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=/ pep (ap-prep(hav.sat vase) (some hav.sat))
2017-01-13 03:58:20 +03:00
?~ -.pep
+.pep
(ap-lame %prep-failed u.-.pep)
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-peel: apply %peel.
::
2016-11-24 07:25:07 +03:00
++ ap-peel
2019-05-03 01:53:27 +03:00
|= [=mark =path]
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=. pyl.sat (~(put by pyl.sat) ost mark)
::
(ap-peer path)
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-peer: apply %peer.
::
++ ap-peer
~/ %ap-peer
2019-04-27 08:42:04 +03:00
|= pax=path
^+ ap-state
::
=. sup.ged.sat (~(put by sup.ged.sat) ost [q.q.pry pax])
2019-04-27 08:42:04 +03:00
=^ cug ap-state (ap-find %peer pax)
2019-05-03 01:53:27 +03:00
::
?~ cug
ap-state
::
=/ old zip
::
2016-11-24 07:25:07 +03:00
=. zip ~
2019-04-27 08:42:04 +03:00
=^ cam ap-state
2019-05-03 01:53:27 +03:00
:: FIXME
2016-11-24 07:25:07 +03:00
%+ ap-call q.u.cug
!>(`path`(slag p.u.cug pax))
2019-05-03 01:53:27 +03:00
::
2016-11-24 07:25:07 +03:00
=. zip (weld zip `(list cove)`[[ost %give %reap cam] old])
2019-05-03 01:53:27 +03:00
::
?^ cam
ap-pule
ap-state
2019-04-27 08:42:04 +03:00
::
:: +ap-poke: apply %poke.
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
++ ap-poke
~/ %ap-poke
2019-05-03 01:53:27 +03:00
|= =cage
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=^ cug ap-state (ap-find %poke p.cage ~)
::
2016-11-24 07:25:07 +03:00
?~ cug
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "no poke arm for {(trip p.cage)}")
(ap-give %coup (some tang))
::
2019-04-27 08:42:04 +03:00
=^ tur ap-state
2019-05-03 01:53:27 +03:00
:: FIXME
2016-11-24 07:25:07 +03:00
%+ ap-call q.u.cug
2019-05-03 01:53:27 +03:00
?. =(0 p.u.cug) q.cage
(slop (ap-term %tas p.cage) q.cage)
2016-11-24 07:25:07 +03:00
(ap-give %coup tur)
::
2019-04-27 08:42:04 +03:00
:: +ap-lame: pour error.
::
++ ap-lame
2019-05-03 01:53:27 +03:00
|= [=term =tang]
2019-04-27 08:42:04 +03:00
^+ ap-state
::
=^ cug ap-state (ap-find /lame)
2019-05-03 01:53:27 +03:00
::
:: FIXME
2016-11-24 07:25:07 +03:00
?~ cug
2019-05-03 01:53:27 +03:00
=. tang [>%ap-lame dap term< (turn tang |=(a=tank rose+[~ "! " ~]^[a]~))]
~> %slog.`rose+[" " "[" "]"]^(flop tang)
2019-04-27 08:42:04 +03:00
ap-state
2019-05-03 01:53:27 +03:00
::
2019-04-27 08:42:04 +03:00
=^ cam ap-state
2016-11-24 07:25:07 +03:00
%+ ap-call q.u.cug
2019-05-03 01:53:27 +03:00
!>([term tang])
::
2016-11-24 07:25:07 +03:00
?^ cam
2019-05-03 01:53:27 +03:00
=. tang [>%ap-lame-lame< (turn u.cam |=(a/tank rose+[~ "! " ~]^[a]~))]
~> %slog.`rose+[" " "[" "]"]^(welp (flop tang) leaf+"." (flop u.cam))
2019-04-27 08:42:04 +03:00
ap-state
2019-05-03 01:53:27 +03:00
::
2019-04-27 08:42:04 +03:00
ap-state
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-misvale: broken vale.
::
++ ap-misvale
2019-05-03 01:53:27 +03:00
|= =wire
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
~& [%ap-blocking-misvale wire]
=/ misvaled (~(put in misvale.sat) wire)
ap-state(misvale.sat misvaled)
2019-04-27 08:42:04 +03:00
::
:: +ap-pour: generic take.
2016-11-04 04:35:47 +03:00
::
2019-04-27 08:42:04 +03:00
++ ap-pour
~/ %ap-pour
2019-05-03 01:53:27 +03:00
|= [pax=path =vase]
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
?. &(?=([@ *] q.vase) ((sane %tas) -.q.vase))
=/ =tang (ap-suck "pour: malformed card")
(ap-lame %pour tang)
::
=^ cug ap-state (ap-find [-.q.vase pax])
::
2016-11-24 07:25:07 +03:00
?~ cug
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "pour: no {(trip -.q.vase)}: {<pax>}")
(ap-lame -.q.vase tang)
::
=^ tel vel.sat (~(slot wa vel.sat) 3 vase)
2019-04-27 08:42:04 +03:00
=^ cam ap-state
2016-11-24 07:25:07 +03:00
%+ ap-call q.u.cug
%+ slop
!>(`path`(slag p.u.cug pax))
tel
2019-05-03 01:53:27 +03:00
::
?^ cam
(ap-lame -.q.vase u.cam)
2019-04-27 08:42:04 +03:00
ap-state
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-purr: unwrap take.
::
++ ap-purr
~/ %ap-purr
2019-05-03 01:53:27 +03:00
|= [=term pax=path =cage]
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=^ cug ap-state (ap-find [term p.cage pax])
2016-11-24 07:25:07 +03:00
?~ cug
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "{(trip term)}: no {<`path`[p.cage pax]>}")
(ap-lame term tang)
::
=/ =vase
%- slop
?: =(0 p.u.cug)
=/ vas (ap-cage cage)
[!>(`path`pax) vas]
[!>((slag (dec p.u.cug) `path`pax)) q.cage]
::
=^ cam ap-state (ap-call q.u.cug vase)
::
?^ cam
(ap-lame q.u.cug u.cam)
2019-04-27 08:42:04 +03:00
ap-state
::
:: +ap-pout: specific take.
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
++ ap-pout
2019-05-03 01:53:27 +03:00
|= [=path =cuft]
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
?- -.cuft
%coup (ap-take %coup +.path (some !>(p.cuft)))
%diff (ap-diff q.q.pry path p.cuft)
%quit (ap-take %quit +.path ~)
%reap (ap-take %reap +.path (some !>(p.cuft)))
%http-response !!
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:42:04 +03:00
:: +ap-prep: install.
::
++ ap-prep
|= vux=(unit vase)
^- [(unit tang) _ap-state]
::
=^ gac ap-state (ap-prop vux)
2019-05-03 01:53:27 +03:00
::
2017-01-13 03:58:20 +03:00
:- gac
2019-04-27 08:42:04 +03:00
%= ap-state
misvale.sat
~? !=(misvale.sat *misvale-data) misvale-drop+misvale.sat
*misvale-data :: new app might mean new marks
::
arms.sat
~
::
2016-11-24 07:25:07 +03:00
dub
:_(dub ?~(gac [%& dap ?~(vux %boot %bump) now] [%| u.gac]))
==
::
2019-04-27 08:42:04 +03:00
:: +ap-prop: install.
::
++ ap-prop
~/ %ap-prop
2019-04-27 08:42:04 +03:00
|= vux=(unit vase)
^- [(unit tang) _ap-state]
::
2019-01-18 08:37:34 +03:00
?. (ap-fond %prep)
2016-11-24 07:25:07 +03:00
?~ vux
2019-05-03 01:53:27 +03:00
(some ap-state)
::
=+ [new=p:(slot 13 hav.sat) old=p:(slot 13 u.vux)]
2019-05-03 01:53:27 +03:00
::
?. (~(nest ut p:(slot 13 hav.sat)) %| p:(slot 13 u.vux))
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "prep mismatch")
:_(ap-state (some tang))
(some ap-state(+13.q.hav.sat +13.q.u.vux))
::
2019-04-27 08:42:04 +03:00
=^ tur ap-state
2016-11-24 07:25:07 +03:00
%+ ap-call %prep
?~(vux !>(~) (slop !>(~) (slot 13 u.vux)))
2019-05-03 01:53:27 +03:00
::
2019-01-18 08:37:34 +03:00
?~ tur
2019-05-03 01:53:27 +03:00
(some ap-state)
:_(ap-state (some u.tur))
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-pule: silent delete.
::
++ ap-pule
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=/ wim (~(get by sup.ged.sat) ost)
?~ wim
ap-state
::
2019-04-27 08:42:04 +03:00
%_ ap-state
sup.ged.sat (~(del by sup.ged.sat) ost)
qel.ged.sat (~(del by qel.ged.sat) ost)
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:42:04 +03:00
:: +ap-pull: load delete.
::
++ ap-pull
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=/ wim (~(get by sup.ged.sat) ost)
?~ wim
ap-state
::
=: sup.ged.sat (~(del by sup.ged.sat) ost)
qel.ged.sat (~(del by qel.ged.sat) ost)
2019-05-03 01:53:27 +03:00
==
::
=^ cug ..ap-pull (ap-find %pull q.u.wim)
2019-05-03 01:53:27 +03:00
::
?~ cug
ap-state
::
2019-04-27 08:42:04 +03:00
=^ cam ap-state
2016-11-24 07:25:07 +03:00
%+ ap-call q.u.cug
!>((slag p.u.cug q.u.wim))
2019-05-03 01:53:27 +03:00
::
?^ cam
(ap-lame q.u.cug u.cam)
2019-04-27 08:42:04 +03:00
ap-state
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-kill: queue kill.
::
++ ap-kill
^+ ap-state
2016-11-24 07:25:07 +03:00
(ap-give:ap-pull %quit ~)
::
2019-04-27 08:42:04 +03:00
:: +ap-take: non-diff gall take.
::
++ ap-take
~/ %ap-take
2019-05-03 01:53:27 +03:00
|= [=term =path vux=(unit vase)]
2019-04-27 08:42:04 +03:00
^+ ap-state
::
2019-05-03 01:53:27 +03:00
=^ cug ap-state (ap-find term path)
::
2016-11-24 07:25:07 +03:00
?~ cug
2019-04-27 08:42:04 +03:00
ap-state
2019-05-03 01:53:27 +03:00
::
2019-04-27 08:42:04 +03:00
=^ cam ap-state
2016-11-24 07:25:07 +03:00
%+ ap-call q.u.cug
2019-05-03 01:53:27 +03:00
=+ den=!>((slag p.u.cug path))
2016-11-24 07:25:07 +03:00
?~(vux den (slop den u.vux))
2019-05-03 01:53:27 +03:00
::
?^ cam
(ap-lame q.u.cug u.cam)
2019-04-27 08:42:04 +03:00
ap-state
::
:: +ap-safe: process move list.
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
++ ap-safe
~/ %ap-safe
2019-05-03 01:53:27 +03:00
|= =vase
2019-04-27 08:42:04 +03:00
^- [(each (list cove) tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
?~ q.vase
[[%.y p=~] ap-state]
::
?@ q.vase
=/ =tang (ap-suck "move: malformed list")
[[%.n tang] ap-state]
::
=^ hed vel.sat (~(slot wa vel.sat) 2 vase)
2019-04-27 08:42:04 +03:00
=^ sud ap-state (ap-move hed)
2019-05-03 01:53:27 +03:00
::
?: ?=(%| -.sud)
[sud ap-state]
::
=^ tel vel.sat (~(slot wa vel.sat) 3 vase)
=^ res ap-state $(vase tel)
::
=/ that
?: ?=(%.n -.res)
res
[%.y p.sud p.res]
::
[that ap-state]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-sake: handle result.
::
++ ap-sake
~/ %ap-sake
2019-05-03 01:53:27 +03:00
|= =vase
2019-04-27 08:42:04 +03:00
^- [(unit tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
?: ?=(@ q.vase)
=/ =tang (ap-suck "sake: invalid product (atom)")
[(some tang) ap-state]
::
=^ hed vel.sat (~(slot wa vel.sat) 2 vase)
2019-04-27 08:42:04 +03:00
=^ muz ap-state (ap-safe hed)
2019-05-03 01:53:27 +03:00
::
?: ?=(%.n -.muz)
[(some p.muz) ap-state]
::
=^ tel vel.sat (~(slot wa vel.sat) 3 vase)
2019-04-27 08:42:04 +03:00
=^ sav ap-state (ap-save tel)
2019-05-03 01:53:27 +03:00
::
?: ?=(%.n -.sav)
[(some p.sav) ap-state]
::
2016-11-24 07:25:07 +03:00
:- ~
2019-04-27 08:42:04 +03:00
%_ ap-state
2016-11-24 07:25:07 +03:00
zip (weld (flop p.muz) zip)
hav.sat p.sav
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:42:04 +03:00
:: +ap-save: verify core.
::
++ ap-save
~/ %ap-save
2019-04-27 08:42:04 +03:00
|= vax=vase
^- [(each vase tang) _ap-state]
::
=^ gud vel.sat (~(nest wa vel.sat) p.hav.sat p.vax)
2019-05-03 01:53:27 +03:00
::
2019-04-27 08:42:04 +03:00
:_ ap-state
2016-11-24 07:25:07 +03:00
?. gud
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "invalid core")
[%.n tang]
[%.y vax]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-slam: virtual slam.
::
++ ap-slam
2016-11-24 07:25:07 +03:00
~/ %ap-slam
2019-04-27 08:42:04 +03:00
|= [cog=term gat=vase arg=vase]
^- [(each vase tang) _ap-state]
::
2019-05-03 01:53:27 +03:00
=/ wyz
%- mule |.
(~(mint wa vel.sat) [%cell p.gat p.arg] [%cnsg [%$ ~] [%$ 2] [%$ 3] ~])
::
?: ?=(%.n -.wyz)
%- =/ sam (~(peek ut p.gat) %free 6)
2016-11-24 07:25:07 +03:00
(slog >%ap-slam-mismatch< ~(duck ut p.arg) ~(duck ut sam) ~)
2019-05-03 01:53:27 +03:00
=/ =tang (ap-suck "call: {<cog>}: type mismatch")
[[%.n tang] ap-state]
::
:_ ap-state(vel.sat +>.wyz)
2016-11-24 07:25:07 +03:00
=+ [typ nok]=+<.wyz
2019-05-03 01:53:27 +03:00
=/ ton (mock [[q.gat q.arg] nok] ap-sled)
2016-11-24 07:25:07 +03:00
?- -.ton
2019-05-03 01:53:27 +03:00
%0 [%.y typ p.ton]
%1 [%.n (turn p.ton |=(a/* (smyt (path a))))]
%2 [%.n p.ton]
2016-11-24 07:25:07 +03:00
==
::
2019-04-27 08:42:04 +03:00
:: +ap-sled: namespace view.
::
++ ap-sled (sloy ska)
::
:: +ap-suck: standard tang.
::
++ ap-suck
2019-05-03 01:53:27 +03:00
|= =tape
2016-11-24 07:25:07 +03:00
^- tang
2019-04-27 08:42:04 +03:00
::
2019-05-03 01:53:27 +03:00
=/ =tank [%leaf (weld "gall: {<dap>}: " tape)]
[tank ~]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-term: atomic vase.
::
++ ap-term
2019-05-03 01:53:27 +03:00
|= [=term =atom]
2016-11-24 07:25:07 +03:00
^- vase
2019-04-27 08:42:04 +03:00
::
2019-05-03 01:53:27 +03:00
=/ =type [%atom term (some atom)]
[p=type q=atom]
2016-11-24 07:25:07 +03:00
::
2019-04-27 08:42:04 +03:00
:: +ap-vain: card to vane.
::
++ ap-vain
2019-05-03 01:53:27 +03:00
|= =term
2016-11-24 07:25:07 +03:00
^- (unit @tas)
2019-04-27 08:42:04 +03:00
::
2019-05-03 01:53:27 +03:00
?+ term ~& [%ap-vain term]
2016-11-24 07:25:07 +03:00
~
%bonk `%a
2019-02-02 04:00:15 +03:00
%build `%f
%cash `%a
%conf `%g
%cred `%c
%crew `%c
%crow `%c
%deal `%g
%dirk `%c
%drop `%c
%flog `%d
%info `%c
%keep `%f
%kill `%f
%look `%j
2019-08-07 01:42:37 +03:00
%listen `%j
2019-02-02 04:00:15 +03:00
%merg `%c
%mont `%c
%moon `%j
2019-02-02 04:00:15 +03:00
%nuke `%a
%ogre `%c
%perm `%c
%rest `%b
2019-08-08 01:15:25 +03:00
%rekey `%j
2019-02-02 04:00:15 +03:00
%wait `%b
%want `%a
%warp `%c
2019-08-11 00:24:31 +03:00
%wash `%g
2019-02-02 04:00:15 +03:00
%wipe `%f
::
2019-07-04 03:08:23 +03:00
%request `%i
%cancel-request `%i
2019-07-04 02:01:45 +03:00
%serve `%e
%connect `%e
%disconnect `%e
%rule `%e
2016-11-24 07:25:07 +03:00
==
--
--
2019-05-03 01:53:27 +03:00
::
:: +call: request.
::
++ call
2016-11-24 07:25:07 +03:00
~% %gall-call +> ~
2019-05-03 01:53:27 +03:00
|= [=duct hic=(hypo (hobo task:able))]
^- [(list move) _gall-payload]
2019-04-11 23:34:30 +03:00
::
2019-05-09 22:46:19 +03:00
=> .(q.hic ?.(?=($soft -.q.hic) q.hic ;;(task:able p.q.hic)))
2019-04-11 23:34:30 +03:00
::
2019-05-03 01:53:27 +03:00
=/ initialised (mo-abed:mo duct)
::
2016-11-24 07:25:07 +03:00
?- -.q.hic
2019-04-11 23:34:30 +03:00
::
%conf
::
2019-05-03 01:53:27 +03:00
=/ =dock p.q.hic
=/ =ship p.dock
?. =(our ship)
~& [%gall-not-ours ship]
[~ gall-payload]
2019-04-11 23:34:30 +03:00
::
2019-05-03 01:53:27 +03:00
=/ booted (mo-boot:initialised q.dock q.q.hic)
mo-abet:booted
2019-04-11 23:34:30 +03:00
::
%deal
::
2016-11-24 07:25:07 +03:00
=< mo-abet
2019-05-03 01:53:27 +03:00
:: either to us
::
?. =(our q.p.q.hic)
:: or from us
::
?> =(our p.p.q.hic)
(mo-away:initialised q.p.q.hic q.q.hic)
(mo-come:initialised p.p.q.hic q.q.hic)
2019-04-11 23:34:30 +03:00
::
%init
::
2019-05-05 03:23:22 +03:00
=/ payload gall-payload(sys.mast.all duct)
[~ payload]
2019-04-11 23:34:30 +03:00
::
2019-05-03 01:53:27 +03:00
%sunk
2019-04-11 23:34:30 +03:00
::
2019-05-03 01:53:27 +03:00
[~ gall-payload]
2019-04-11 23:34:30 +03:00
::
2019-05-03 01:53:27 +03:00
%vega
2019-04-11 23:34:30 +03:00
::
2019-05-03 01:53:27 +03:00
[~ gall-payload]
2019-04-11 23:34:30 +03:00
::
%west
::
2019-05-03 01:53:27 +03:00
?> ?=([?(%ge %gh) @ ~] q.q.hic)
=* dap i.t.q.q.hic
=* him p.q.hic
2019-05-03 01:53:27 +03:00
::
?: ?=(%ge i.q.q.hic)
2019-05-05 03:23:22 +03:00
=/ mes ;;((pair @ud rook) r.q.hic)
2015-06-23 00:02:27 +03:00
=< mo-abet
2019-05-03 01:53:27 +03:00
(mo-gawk:initialised him dap mes)
::
2019-05-05 03:23:22 +03:00
=/ mes ;;((pair @ud roon) r.q.hic)
2016-11-24 07:25:07 +03:00
=< mo-abet
2019-05-03 01:53:27 +03:00
(mo-gawd:initialised him dap mes)
2019-08-11 00:24:31 +03:00
::
%wash
=. bum.mast.all (~(run by bum.mast.all) |=(=seat seat(vel *worm)))
[~ ..^$]
2016-11-24 07:25:07 +03:00
::
$wegh
2018-12-13 04:34:25 +03:00
=/ =mass
2019-05-03 01:53:27 +03:00
:+ %gall %.n
:~ foreign+&+sap.mast.all
2019-05-03 01:53:27 +03:00
:+ %blocked %.n
(sort ~(tap by (~(run by wub.mast.all) |=(sofa [%.y +<]))) aor)
:+ %active %.n
(sort ~(tap by (~(run by bum.mast.all) |=(seat [%.y +<]))) aor)
[%dot %.y all]
2018-12-13 04:34:25 +03:00
==
2019-05-03 01:53:27 +03:00
=/ =move [duct %give %mass mass]
[[move ~] gall-payload]
2016-11-24 07:25:07 +03:00
==
::
2019-05-03 01:53:27 +03:00
:: +load: recreate vane.
::
++ load
|= old=axle-n
^+ gall-payload
?- -.old
2019-05-05 03:23:22 +03:00
%0 gall-payload(all old)
2016-11-24 07:25:07 +03:00
==
::
2019-05-03 01:53:27 +03:00
:: +scry: standard scry.
::
2016-11-24 07:25:07 +03:00
++ scry
~/ %gall-scry
2019-05-05 03:23:22 +03:00
|= [fur=(unit (set monk)) =term =shop =desk =coin =path]
2016-11-24 07:25:07 +03:00
^- (unit (unit cage))
2019-05-05 03:23:22 +03:00
?. ?=(%.y -.shop)
2019-05-03 01:53:27 +03:00
~
::
2019-05-05 03:23:22 +03:00
=/ =ship p.shop
2019-05-03 01:53:27 +03:00
::
2019-05-05 03:23:22 +03:00
?: ?& =(%u term)
=(~ path)
=([%$ %da now] coin)
=(our ship)
2016-11-24 07:25:07 +03:00
==
2019-05-05 03:23:22 +03:00
=/ =vase !>((~(has by bum.mast.all) desk))
=/ =cage [%noun vase]
(some (some cage))
2019-05-03 01:53:27 +03:00
::
2019-05-05 03:23:22 +03:00
?. =(our ship)
2016-11-24 07:25:07 +03:00
~
2019-05-03 01:53:27 +03:00
::
2019-05-05 03:23:22 +03:00
?. =([%$ %da now] coin)
2016-11-24 07:25:07 +03:00
~
2019-05-03 01:53:27 +03:00
::
2019-05-05 03:23:22 +03:00
?. (~(has by bum.mast.all) desk)
(some ~)
2019-05-03 01:53:27 +03:00
::
2019-05-05 03:23:22 +03:00
?. ?=(^ path)
2016-11-24 07:25:07 +03:00
~
2019-05-03 01:53:27 +03:00
::
2019-05-05 03:23:22 +03:00
=/ initialised mo-abed:mo
=/ =prey [%high [p=~ q=ship]]
(mo-peek:initialised desk prey term path)
2016-11-24 07:25:07 +03:00
::
2019-05-03 01:53:27 +03:00
:: +stay: save without cache.
::
++ stay
^- axle
all
::
:: +take: response.
2016-11-24 07:25:07 +03:00
::
2019-05-03 01:53:27 +03:00
++ take
~/ %gall-take
2019-05-05 03:23:22 +03:00
|= [=wire =duct hin=(hypo sign-arvo)]
^- [(list move) _gall-payload]
::
~| [%gall-take wire]
::
?> ?=([?(%sys %use) *] wire)
=/ initialised (mo-abed:mo duct)
?- i.wire
::
%sys
::
=/ syssed (mo-cyst:initialised t.wire q.hin)
mo-abet:syssed
::
%use
::
=/ cooked (mo-cook:initialised t.wire hin)
mo-abet:cooked
==
2016-11-24 07:25:07 +03:00
--