shrub/pkg/arvo/lib/verb.hoon

99 lines
2.2 KiB
Plaintext
Raw Normal View History

2019-11-09 02:18:29 +03:00
:: Print what your agent is doing.
::
2019-11-19 07:36:21 +03:00
|= [loud=? =agent:gall]
^- agent:gall
|_ =bowl:gall
2019-11-09 02:18:29 +03:00
+* this .
ag ~(. agent bowl)
::
++ on-init
2019-11-19 07:36:21 +03:00
^- (quip card:agent:gall agent:gall)
2019-11-09 06:32:21 +03:00
=> ?. loud .
%- (slog leaf+"{<dap.bowl>}: on-init" ~)
.
2019-11-09 02:18:29 +03:00
=^ cards agent on-init:ag
[cards this]
::
++ on-save
^- vase
2019-11-09 06:32:21 +03:00
=> ?. loud .
%- (slog leaf+"{<dap.bowl>}: on-save" ~)
.
2019-11-09 02:18:29 +03:00
on-save:ag
::
++ on-load
|= old-state=vase
2019-11-19 07:36:21 +03:00
^- (quip card:agent:gall agent:gall)
2019-11-09 06:32:21 +03:00
=> ?. loud .
%- (slog leaf+"{<dap.bowl>}: on-load" ~)
.
2019-11-09 02:18:29 +03:00
=^ cards agent (on-load:ag old-state)
[cards this]
::
++ on-poke
|= [=mark =vase]
2019-11-19 07:36:21 +03:00
^- (quip card:agent:gall agent:gall)
2019-11-09 06:32:21 +03:00
=> ?. loud .
%- (slog leaf+"{<dap.bowl>}: on-poke with mark {<mark>}" ~)
.
?: ?=(%verb mark)
`this(loud !loud)
2019-11-09 02:18:29 +03:00
=^ cards agent (on-poke:ag mark vase)
[cards this]
::
++ on-watch
|= =path
2019-11-19 07:36:21 +03:00
^- (quip card:agent:gall agent:gall)
2019-11-09 06:32:21 +03:00
=> ?. loud .
%- (slog leaf+"{<dap.bowl>}: on-watch on path {<path>}" ~)
.
2019-11-09 02:18:29 +03:00
=^ cards agent (on-watch:ag path)
[cards this]
::
++ on-leave
|= =path
2019-11-19 07:36:21 +03:00
^- (quip card:agent:gall agent:gall)
2019-11-09 06:32:21 +03:00
=> ?. loud .
%- (slog leaf+"{<dap.bowl>}: on-leave on path {<path>}" ~)
.
2019-11-09 02:18:29 +03:00
=^ cards agent (on-leave:ag path)
[cards this]
::
++ on-peek
|= =path
^- (unit (unit cage))
2019-11-09 06:32:21 +03:00
=> ?. loud .
%- (slog leaf+"{<dap.bowl>}: on-peek on path {<path>}" ~)
.
2019-11-09 02:18:29 +03:00
(on-peek:ag path)
::
++ on-agent
2019-11-19 07:36:21 +03:00
|= [=wire =sign:agent:gall]
^- (quip card:agent:gall agent:gall)
2019-11-09 06:32:21 +03:00
=> ?. loud .
%- (slog leaf+"{<dap.bowl>}: on-agent on wire {<wire>}, {<-.sign>}" ~)
.
=^ cards agent (on-agent:ag wire sign)
2019-11-09 02:18:29 +03:00
[cards this]
::
++ on-arvo
|= [=wire =sign-arvo]
2019-11-19 07:36:21 +03:00
^- (quip card:agent:gall agent:gall)
2019-11-09 06:32:21 +03:00
=> ?. loud .
%- %+ slog
leaf+"{<dap.bowl>}: on-arvo on wire {<wire>}, {<[- +<]:sign-arvo>}"
~
.
2019-11-09 02:18:29 +03:00
=^ cards agent (on-arvo:ag wire sign-arvo)
[cards this]
::
++ on-fail
|= [=term =tang]
2019-11-19 07:36:21 +03:00
^- (quip card:agent:gall agent:gall)
2019-11-09 06:32:21 +03:00
=> ?. loud .
%- (slog leaf+"{<dap.bowl>}: on-fail with term {<term>}" ~)
.
2019-11-09 02:18:29 +03:00
=^ cards agent (on-fail:ag term tang)
[cards this]
--