mall: add lame handling

This commit is contained in:
Philip Monk 2019-08-29 12:57:33 -07:00
parent 449935739d
commit f8171138c3
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC

View File

@ -209,6 +209,10 @@
|~ path |~ path
*step *step
:: ::
++ handle-pull
|~ path
*step
::
++ handle-peek ++ handle-peek
|~ path |~ path
*(unit (unit cage)) *(unit (unit cage))
@ -221,8 +225,8 @@
|~ [wire sign=vase] |~ [wire sign=vase]
*step *step
:: ::
++ handle-pull ++ handle-lame
|~ path |~ [term tang]
*step *step
-- --
:: +blocked: blocked tasks :: +blocked: blocked tasks
@ -324,18 +328,6 @@
:: ::
=/ =move [hen [%give gift]] =/ =move [hen [%give gift]]
mo-core(moves [move moves]) mo-core(moves [move moves])
:: +mo-contains-valid-bowl: check that a vase contains a valid bowl.
::
++ mo-contains-valid-bowl
~/ %mo-contains-valid-bowl
|= =vase
^- ?
::
=/ maybe-vase (slew 12 vase)
?~ maybe-vase
%.n
=/ =type p.u.maybe-vase
(~(nest ut type) %.n -:!>(*bowl))
:: +mo-receive-core: receives an app core built by %ford. :: +mo-receive-core: receives an app core built by %ford.
:: ::
:: Presuming we receive a good core, we first check to see if the agent :: Presuming we receive a good core, we first check to see if the agent
@ -375,11 +367,11 @@
=. app (ap-reinstall:app result-vase) =. app (ap-reinstall:app result-vase)
ap-abet:app ap-abet:app
:: ::
?. (mo-contains-valid-bowl result-vase) =/ maybe-new-agent !<(agent vase)
=/ err [[%leaf "{<term>}: bogus core"] ~] ?~ maybe-new-agent
=/ err [[%leaf "{<term>}: not valid agent"] ~]
(mo-give %onto %.n err) (mo-give %onto %.n err)
:: =. mo-core (mo-new-agent term beak u.maybe-new-agent)
=. mo-core (mo-new-agent term beak result-vase)
=/ old mo-core =/ old mo-core
=/ wag =/ wag
=/ =routes [disclosing=~ attributing=our] =/ =routes [disclosing=~ attributing=our]
@ -402,13 +394,13 @@
:: new one with the provided name, beak, and state (held in a vase). :: new one with the provided name, beak, and state (held in a vase).
:: ::
++ mo-new-agent ++ mo-new-agent
|= [=term =beak =vase] |= [=term =beak =agent]
^+ mo-core ^+ mo-core
:: ::
=/ =ducts =/ =ducts
:+ bone=1 :+ bone=1
bone-map=[[[~ ~] 0] ~ ~] bone-map=[[[~ ~] 0] ~ ~]
duct-map=[[0 [~ ~]] ~ ~] duct-map=[[0 [~ ~]] ~ ~]
:: ::
=/ running-agent =/ running-agent
=/ default-agent *running-agent =/ default-agent *running-agent
@ -416,7 +408,7 @@
control-duct hen control-duct hen
beak beak beak beak
running-state vase running-state vase
agent !<(agent vase) agent agent
state !>(~) state !>(~)
ducts ducts ducts ducts
== ==
@ -1308,8 +1300,12 @@
|= =vase |= =vase
^+ ap-core ^+ ap-core
:: ::
=/ maybe-agent !<(agent vase)
?~ maybe-agent
(ap-lame %new-core-not-agent ~)
::
=/ prep =/ prep
=/ =agent !<(agent vase) =/ =agent u.maybe-agent
=/ installed ap-install(agent.current-agent agent) =/ installed ap-install(agent.current-agent agent)
=/ running (some state.current-agent) =/ running (some state.current-agent)
(installed running) (installed running)
@ -1356,27 +1352,14 @@
ap-core ap-core
:: +ap-lame: pour error. :: +ap-lame: pour error.
:: ::
:: !! wat do
++ ap-lame ++ ap-lame
|= [=term =tang] |= [=term =tang]
^+ ap-core ^+ ap-core
:: ::
=^ maybe-arm ap-core (ap-find-arm /lame)
=/ form |=(=tank [%rose [~ "! " ~] tank ~]) =/ form |=(=tank [%rose [~ "! " ~] tank ~])
?~ maybe-arm =^ maybe-tang ap-core
=/ tang [>%ap-lame agent-name term< (turn tang form)] %+ ap-ingest ~ |.
~> %slog.`rose+[" " "[" "]"]^(flop tang) (handle-lame:ap-agent-core term (turn tang form))
ap-core
::
=/ arm u.maybe-arm
=/ =vase !>([term tang])
=^ maybe-tang ap-core (ap-call q.arm vase)
?^ maybe-tang
=/ tang u.maybe-tang
=/ etc (flop [>%ap-lame-lame< (turn tang form)])
~> %slog.`rose+[" " "[" "]"]^(welp etc [%leaf "." (flop tang)])
ap-core
::
ap-core ap-core
:: +ap-generic-take: generic take. :: +ap-generic-take: generic take.
:: ::