Merge upstream/master into comet-sizing

This commit is contained in:
Matilde Park 2019-08-12 09:43:01 -04:00
parent 11985ebb31
commit 5f4b7d136e
83 changed files with 1942 additions and 9882 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5debf91880c73d052429ca487555aa60aa2ee4f173c9f059e30b61372689910e
size 7118127
oid sha256:6c7ad5eec00d0d6a6857ea023c6102999a30d5c99de7411e474b9d1c14a3e7b4
size 9765203

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3637fc5590ee06dc2281ecd7efc05f56bc5a31de2b6be9da4262af3740e5a86d
size 4761228
oid sha256:6e828e89f4e6f2b39d4d8d62101f9c052253cdfa4e91abb8682678acd796f999
size 4707549

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:39ac7d52391426c31ff6b341536610a2704f8f5831c7d650357274c52b76d4a3
size 9847553
oid sha256:39dfca3234e5002df44f56479f4e352c7cb587932ada8ba9097ebffc691db78d
size 12252278

View File

@ -20,6 +20,11 @@ trap cleanup EXIT
herb ./pier -p hood -d "+hood/mount /=home="
until [ -d ./pier/home ]
do
sleep 1
done
# update :lens, :dojo and dependencies
#
# XX reduce this list
@ -54,6 +59,11 @@ sleep 10
herb ./pier -p hood -d '+hood/merge %stage our %home'
herb ./pier -p hood -d "+hood/mount /=stage="
until [ -d ./pier/stage ]
do
sleep 1
done
rm -rf ./pier/stage
cp -r $ARVO ./pier/stage
chmod -R u+rw ./pier/stage

View File

@ -169,7 +169,7 @@
=. ..abet-pe
=/ sof ((soft unix-effect) i.effects)
?~ sof
~? aqua-debug=| [who=who %unknown-effect i.effects]
~? aqua-debug=& [who=who %unknown-effect i.effects]
..abet-pe
(publish-effect u.sof)
$(effects t.effects)
@ -366,7 +366,7 @@
%e %eyre
%f %ford
%g %gall
%j %ford
%j %jael
==
=/ pax
/(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/[vane]
@ -435,8 +435,9 @@
[%fake who.ae]
[%dawn u.keys.ae]
-.userspace-ova.pil
[//http/0v1n.2m9vh %born ~]
[//http/0v1n.2m9vh %live 8.080 `8.445]
[//http-client/0v1n.2m9vh %born ~]
[//http-server/0v1n.2m9vh %born ~]
[//http-server/0v1n.2m9vh %live 8.080 `8.445]
==
=. this abet-pe:initted
(pe who.ae)
@ -545,6 +546,17 @@
:^ ~ ~ %noun
`(list ship)`(turn ~(tap by piers) head)
::
::
::
++ peek-x-pill
|= pax=path
^- (unit (unit [%pill pill]))
=/ pill-size (met 3 (jam pil))
?: (lth pill-size 100)
~& [%no-pill size=pill-size]
[~ ~]
``pill+pil
::
:: Trivial scry for mock
::
++ scry |=([* *] ~)

View File

@ -1,28 +1,26 @@
/+ tapp, stdio
=, able:kale
=, able:jael
=> |%
+$ pending-udiffs (map number:block udiffs:point)
+$ config
$: url=@ta
from-number=number:block
==
+$ app-state
$: url=@ta
$: %2
url=@ta
=number:block
=pending-udiffs
blocks=(list block)
whos=(set ship)
==
+$ peek-data ~
+$ in-poke-data
$: %azimuth-tracker-poke
$% [%init ~]
[%listen whos=(set ship) =source:kale]
[%watch =config]
$% [%listen whos=(list ship) =source:jael]
[%watch url=@ta]
==
==
+$ out-poke-data ~
+$ in-peer-data ~
+$ out-peer-data ~
+$ out-peer-data
[%azimuth-udiff =ship =udiff:point]
++ tapp
%: ^tapp
app-state
@ -40,13 +38,23 @@
::
=> |%
++ topics
=> azimuth-events:azimuth
:_ ~
:~ broke-continuity
changed-keys
lost-sponsor
escape-accepted
==
|= ships=(set ship)
^- (list ?(@ux (list @ux)))
:: The first topic should be one of these event types
::
:- => azimuth-events:azimuth
:~ broke-continuity
changed-keys
lost-sponsor
escape-accepted
==
:: If we're looking for a specific set of ships, specify them as
:: the second topic. Otherwise don't specify the second topic so
:: we will match all ships.
::
?: =(~ ships)
~
[(turn ~(tap in ships) ,@) ~]
::
++ request-rpc
|= [url=@ta id=(unit @t) req=request:rpc:ethereum]
@ -77,7 +85,9 @@
=/ m (async:stdio ,(unit json))
^- form:m
?> ?=(%finished -.client-response)
=/ body=@t q.data:(need full-file.client-response)
?~ full-file.client-response
(pure:m ~)
=/ body=@t q.data.u.full-file.client-response
=/ jon=(unit json) (de-json:html body)
?~ jon
(pure:m ~)
@ -177,7 +187,7 @@
--
::
++ get-logs-by-hash
|= [url=@ta =hash:block]
|= [url=@ta whos=(set ship) =hash:block]
=/ m (async:stdio udiffs:point)
^- form:m
;< =json bind:m
@ -186,7 +196,7 @@
%eth-get-logs-by-hash
hash
~[azimuth:contracts:azimuth]
topics
(topics whos)
==
=/ event-logs=(list event-log:rpc:ethereum)
(parse-event-logs:rpc:ethereum json)
@ -194,7 +204,7 @@
(pure:m udiffs)
::
++ get-logs-by-range
|= [url=@ta =from=number:block =to=number:block]
|= [url=@ta whos=(set ship) =from=number:block =to=number:block]
=/ m (async:stdio udiffs:point)
^- form:m
;< =json bind:m
@ -204,7 +214,7 @@
`number+from-number
`number+to-number
~[azimuth:contracts:azimuth]
topics
(topics whos)
==
=/ event-logs=(list event-log:rpc:ethereum)
(parse-event-logs:rpc:ethereum json)
@ -253,8 +263,9 @@
=* loop $
?~ udiffs
(pure:m ~)
~& [%sending-event i.udiffs]
;< ~ bind:m (send-effect:stdio %new-event /ne i.udiffs)
=/ =path /(scot %p ship.i.udiffs)
;< ~ bind:m (give-result:stdio / %azimuth-udiff i.udiffs)
;< ~ bind:m (give-result:stdio path %azimuth-udiff i.udiffs)
loop(udiffs t.udiffs)
--
::
@ -262,44 +273,22 @@
::
=> |%
::
:: Subscribe to %sources from kale
::
++ init
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m
;< ~ bind:m (send-effect:stdio %sources /se ~)
(pure:m state)
::
:: Send %listen to kale
:: Send %listen to jael
::
++ listen
|= [state=app-state whos=(set ship) =source:kale]
|= [state=app-state whos=(list ship) =source:jael]
=/ m (async:stdio ,app-state)
^- form:m
;< ~ bind:m (send-effect:stdio %listen /lo whos source)
;< ~ bind:m (send-effect:stdio %listen /lo (silt whos) source)
(pure:m state)
::
:: Take %source from kale
::
++ take-source
|= [state=app-state whos=(set ship) =source:kale]
=/ m (async:stdio ,app-state)
^- form:m
?: ?=(%& -.source)
(pure:m state)
=/ a-purl=purl:eyre node.p.source
=. url.state (crip (en-purl:html a-purl))
(watch state url.state launch:contracts:azimuth)
::
:: Start watching a node
::
++ watch
|= [state=app-state =config]
++ start
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m
=: url.state url.config
number.state from-number.config
=: number.state 0
pending-udiffs.state *pending-udiffs
blocks.state *(list block)
==
@ -311,20 +300,18 @@
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m
~& [%get-updates number.state]
;< =latest=block bind:m (get-latest-block url.state)
;< =new=number:block bind:m (zoom state number.id.latest-block)
=. number.state new-number
;< =latest=block bind:m (get-latest-block url.state)
;< state=app-state bind:m (zoom state number.id.latest-block)
|- ^- form:m
=* walk-loop $
~& [%walk-loop number.state]
?: (gth number.state number.id.latest-block)
;< now=@da bind:m get-time:stdio
;< ~ bind:m (wait-effect:stdio (add now ~s10))
;< ~ bind:m (wait-effect:stdio (add now ~m5))
(pure:m state)
;< =block bind:m (get-block-by-number url.state number.state)
;< [=new=pending-udiffs new-blocks=(lest ^block)] bind:m
(take-block url.state pending-udiffs.state block blocks.state)
%- take-block
[url.state whos.state pending-udiffs.state block blocks.state]
=: pending-udiffs.state new-pending-udiffs
blocks.state new-blocks
number.state +(number.id.i.new-blocks)
@ -334,17 +321,14 @@
:: Process a block, detecting and handling reorgs
::
++ take-block
|= [url=@ta =a=pending-udiffs =block blocks=(list block)]
|= [url=@ta whos=(set ship) =a=pending-udiffs =block blocks=(list block)]
=/ m (async:stdio ,[pending-udiffs (lest ^block)])
^- form:m
~& [%taking id.block]
?: &(?=(^ blocks) !=(parent-hash.block hash.id.i.blocks))
~& %rewinding
(rewind url a-pending-udiffs block blocks)
;< =b=pending-udiffs bind:m
(release-old-events a-pending-udiffs number.id.block)
;< =new=udiffs:point bind:m (get-logs-by-hash url hash.id.block)
~? !=(~ new-udiffs) [%adding-diffs new-udiffs]
;< =new=udiffs:point bind:m (get-logs-by-hash url whos hash.id.block)
=. b-pending-udiffs (~(put by b-pending-udiffs) number.id.block new-udiffs)
(pure:m b-pending-udiffs block blocks)
::
@ -366,7 +350,6 @@
=/ m (async:stdio ,[^pending-udiffs (lest ^block)])
|- ^- form:m
=* loop $
~& [%wind block ?~(blocks ~ i.blocks)]
?~ blocks
(pure:m pending-udiffs block blocks)
?: =(parent-hash.block hash.id.i.blocks)
@ -394,15 +377,18 @@
::
++ zoom
|= [state=app-state =latest=number:block]
=/ m (async:stdio ,number:block)
=/ m (async:stdio ,app-state)
^- form:m
?: (lth latest-number (add number.state 500))
(pure:m latest-number)
=/ to-number=number:block (sub latest-number 500)
=/ zoom-margin=number:block 100
?: (lth latest-number (add number.state zoom-margin))
(pure:m state)
=/ to-number=number:block (sub latest-number zoom-margin)
;< =udiffs:point bind:m
(get-logs-by-range url.state number.state to-number)
(get-logs-by-range url.state whos.state number.state to-number)
;< ~ bind:m (jael-update udiffs)
(pure:m to-number)
=. number.state +(to-number)
=. blocks.state ~
(pure:m state)
--
::
:: Main
@ -415,9 +401,8 @@
=/ m tapp-async
^- form:m
?- +<.in-poke-data
%init (init state)
%listen (listen state +>.in-poke-data)
%watch (watch state +>.in-poke-data)
%listen (listen state +>.in-poke-data)
%watch (pure:m state(url url.in-poke-data))
==
::
++ handle-take
@ -425,9 +410,17 @@
=/ m tapp-async
^- form:m
?+ -.sign ~|([%strange-sign -.sign] !!)
%source (take-source state +.sign)
%wake (get-updates state)
==
::
++ handle-peer ~(handle-peer default-tapp bowl state)
++ handle-peer
|= =path
=/ m tapp-async
^- form:m
=/ who=(unit ship) ?~(path ~ `(slav %p i.path))
=. whos.state
?~ who
~
(~(put in whos.state) u.who)
(start state)
--

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,6 @@
[%vein wire]
[%look wire src=(each ship purl:eyre)]
[%wind wire p=@ud]
[%snap wire snapshot=snapshot:jael kick=?]
==
++ state
$: a/@
@ -28,8 +27,6 @@
%turf [ost.hid %turf /hi ~]~
%vein [ost.hid %vein /hi]~
[%wind @ud] [ost.hid %wind /hi +.val]~
[%snap * ?]
[ost.hid %snap /hi (snapshot:jael +<.val) +>.val]~
::
%look-ethnode
:_ ~

View File

@ -161,6 +161,7 @@
++ poke-helm-send-hi (wrap poke-send-hi):from-helm
++ poke-helm-verb (wrap poke-verb):from-helm
++ poke-helm-rekey (wrap poke-rekey):from-helm
++ poke-helm-moon (wrap poke-moon):from-helm
++ poke-helm-nuke (wrap poke-nuke):from-helm
++ poke-helm-automass (wrap poke-automass):from-helm
++ poke-helm-cancel-automass (wrap poke-cancel-automass):from-helm

View File

@ -61,6 +61,7 @@
++ manual-tests
^- (list (pair term [(list ship) _*form:(ph ,~)]))
=+ (ph-tests our.hid)
=+ ph-azimuth=(ph-azimuth our.hid)
=/ eth-node (spawn:ph-azimuth ~bud)
=/ m (ph ,~)
:~ :+ %boot-bud
@ -110,7 +111,49 @@
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
(raw-ship ~bud `(dawn:eth-node ~bud))
(raw-real-ship:eth-node ~bud)
(pure:m ~)
::
:+ %hi-az
~[~bud ~dev]
=. eth-node (spawn:eth-node ~dev)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > %dev-done
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > %bud-done
(send-hi ~bud ~dev)
(pure:m ~)
::
:+ %moon-az
~[~bud ~marbud ~linnup-torsyx ~linnup-torsyx-linnup-torsyx ~dev]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~linnup-torsyx)
=. eth-node (spawn:eth-node ~dev)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx)
~& > 'LINNUP DONE'
;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx-linnup-torsyx)
~& > 'MOON LINNUP DONE'
;< ~ bind:m (send-hi ~bud ~linnup-torsyx-linnup-torsyx)
~& > 'HI DOWN DONE'
;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~marbud)
~& > 'HI UP DONE'
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > 'DEV DONE'
;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~dev)
~& > 'HI OVER UP DONE'
;< ~ bind:m (send-hi ~dev ~linnup-torsyx-linnup-torsyx)
~& > 'HI OVER DOWN DONE'
(pure:m ~)
(pure:m ~)
::
:+ %breach-hi
@ -119,17 +162,24 @@
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > 'DEV DONE'
(send-hi ~bud ~dev)
~& > 'HI DONE'
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~dev ~bud)
~& > 'BREACH DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (send-hi-not-responding ~bud ~dev)
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
~& > 'HI NOT RESPONDING DONE'
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > 'REBOOT DEV DONE'
(wait-for-dojo ~bud "hi ~dev successful")
~& > 'DONE'
(pure:m ~)
::
:+ %breach-hi-cousin
@ -140,10 +190,10 @@
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-ship ~mardev `(dawn:eth-node ~mardev))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
;< ~ bind:m (raw-real-ship:eth-node ~dev)
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
;< ~ bind:m (raw-real-ship:eth-node ~mardev)
(send-hi ~marbud ~mardev)
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~mardev ~marbud)
@ -151,59 +201,111 @@
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (send-hi-not-responding ~marbud ~mardev)
;< ~ bind:m (raw-ship ~mardev `(dawn:eth-node ~mardev))
;< ~ bind:m (raw-real-ship:eth-node ~mardev)
(wait-for-dojo ~marbud "hi ~mardev successful")
(pure:m ~)
::
:+ %breach-sync
~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& %checking-file-touched
~& > 'TOUCH FILE DONE'
(check-file-touched ~marbud %home file)
~& %checked-file-touched
~& > 'TOUCH FILE CHECK DONE'
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~bud ~marbud)
~& > 'BREACH DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD RE DONE'
;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this"))
~& > 'THIS MERGE STARTED DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file)
~& > 'DONE DONE'
(pure:m ~)
::
:+ %breach-multiple
~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH DONE'
(check-file-touched ~marbud %home file)
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~bud ~marbud)
~& > 'BREACH-1 DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
(raw-ship ~bud `(dawn:eth-node ~bud))
(raw-real-ship:eth-node ~bud)
~& > 'BUD RE DONE'
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~marbud ~bud)
~& > 'BREACH-2 DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD RE DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file)
~& > 'DONE DONE'
(pure:m ~)
::
:+ %breach-sudden
~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH FILE DONE'
(check-file-touched ~marbud %home file)
~& > 'TOUCH FILE CHECK DONE'
=. eth-node (breach:eth-node ~bud)
~& > 'BREACH EXECUTED'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD RE DONE'
;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this"))
~& > 'THIS MERGE STARTED DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file)
~& > 'DONE DONE'
(pure:m ~)
==
::

View File

@ -2317,7 +2317,15 @@
url+(crip (apix:en-purl:html url.sep))
::
$exp
mor+~[txt+"# {(trip exp.sep)}" tan+res.sep]
=/ texp=tape ['>' ' ' (trip exp.sep)]
:- %mor
|- ^- (list sole-effect:sole-sur)
?: =("" texp) [tan+res.sep ~]
=/ newl (find "\0a" texp)
?~ newl [txt+texp $(texp "")]
=+ (trim u.newl texp)
:- txt+(scag u.newl texp)
$(texp [' ' ' ' (slag +(u.newl) texp)])
::
$ire
=+ num=(~(get by known) top.sep)
@ -2402,7 +2410,11 @@
==
::
$exp
:- (tr-chow wyd '#' ' ' (trip exp.sep))
=+ texp=(trip exp.sep)
=+ newline=(find "\0a" texp)
=? texp ?=(^ newline)
(weld (scag u.newline texp) " ...")
:- (tr-chow wyd '#' ' ' texp)
?~ res.sep ~
=- [' ' (tr-chow (dec wyd) ' ' -)]~
~(ram re (snag 0 `(list tank)`res.sep))

View File

@ -0,0 +1,9 @@
/+ pill
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
arg=~
~
==
:- %pill
.^(pill:pill %gx /(scot %p p.bec)/aqua/(scot %da now)/pill/noun)

View File

@ -1,14 +1,14 @@
=> |%
+$ src
$% [%ship =ship ~]
[%node url=@t ~]
[%app =term ~]
==
--
:- %say
|= [* [whos=(set ship) =src] ~]
=/ =source:kale
|= [* [whos=(list ship) =src] ~]
=/ =source:jael
?- -.src
%ship [%& ship.src]
%node [%| ~|(%parsing-url (need (de-purl:html url.src))) *@ud *@da]
%app [%| term.src]
==
[%azimuth-tracker-poke %listen whos source]

View File

@ -1,6 +1,6 @@
=> |%
+$ config
[url=@ta =from=number:block:able:kale]
[url=@ta =from=number:block:able:jael]
--
:- %say
|= [* config ~]

View File

@ -0,0 +1,33 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/hood/gen
::
/- *sole
/+ *generators
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[mon=@p ~]
=rift
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- %- slog :_ ~
leaf+"can't manage a moon from a {?:(?=($earl ran) "moon" "comet")}"
~
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- %- slog :_ ~
:- %leaf
"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
~
=/ =^rift
?. =(*^rift rift)
rift
+(.^(^rift j+/(scot %p our)/rift/(scot %da now)/(scot %p mon)))
`[mon *id:block:able:jael %rift rift]

View File

@ -0,0 +1,45 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/hood/gen
::
/- *sole
/+ *generators
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[mon=@p ~]
=life
public-key=pass
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- %- slog :_ ~
leaf+"can't manage a moon from a {?:(?=($earl ran) "moon" "comet")}"
~
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- %- slog :_ ~
:- %leaf
"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
~
=/ =^life
?. =(*^life life)
life
+(.^(^life j+/(scot %p our)/life/(scot %da now)/(scot %p mon)))
=/ =pass
?. =(*pass public-key)
public-key
=/ cub (pit:nu:crub:crypto 512 (shaz (jam mon life eny)))
=/ =seed:able:jael
[mon 1 sec:ex:cub ~]
%- %- slog
:~ leaf+"moon: {(scow %p mon)}"
leaf+(scow %uw (jam seed))
==
pub:ex:cub
`[mon *id:block:able:jael %keys life 1 pass]

View File

@ -0,0 +1,44 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/hood/gen
::
/- *sole
/+ *generators
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
arg=?(~ [mon=@p ~])
public-key=pass
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- %- slog :_ ~
leaf+"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}"
~
=/ mon=ship
?^ arg
mon.arg
(add our (lsh 5 1 (end 5 1 (shaz eny))))
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- %- slog :_ ~
:- %leaf
"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
~
=/ =pass
?. =(*pass public-key)
public-key
=/ cub (pit:nu:crub:crypto 512 (shaz (jam mon life=1 eny)))
=/ =seed:able:jael
[mon 1 sec:ex:cub ~]
%- %- slog
:~ leaf+"moon: {(scow %p mon)}"
leaf+(scow %uw (jam seed))
==
pub:ex:cub
`[mon *id:block:able:jael %keys 1 1 pass]

View File

@ -1,38 +0,0 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/gen
::
/? 310
/- *sole
/+ *generators
::
::::
::
:- %ask
|= $: [now=@da eny=@uvJ bec=beak]
arg=?(~ [mon=@p ~])
~
==
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- produce
:- %tang :_ ~
leaf+"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}"
=/ mon=ship
?^ arg
mon.arg
(add our (lsh 5 1 (end 5 1 (shaz eny))))
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- produce
:- %tang :_ ~
leaf+"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
=/ cub=acru:ames (pit:nu:crub:crypto 512 eny)
=/ lyf=life .^(@ud j+/(scot %p our)/life/(scot %da now)/(scot %p our))
=/ sig=oath:pki:jael
.^(@ j+/(scot %p our)/earl/(scot %da now)/(scot %p mon)/(scot %ud lyf)/(scot %ux pub:ex:cub))
=/ sed=seed:able:jael
[mon lyf sec:ex:cub `sig]
%+ print leaf+"moon: {(scow %p mon)}"
%- produce [%atom (scot %uw (jam sed))]

View File

@ -15,7 +15,8 @@
arg=$@(~ [top=path ~])
dub=_|
==
:- %noun
:- %pill
^- pill:pill
:: sys: root path to boot system, `/~me/[desk]/now/sys`
::
=/ sys=path

View File

@ -65,7 +65,7 @@
++ lank ::: tank as string arr
|= a/tank
^- json
a+(turn (wash [0 1.024] a) tape)
a+(turn (wash [0 80] a) tape)
::
++ dank ::: tank
|= a/tank
@ -577,7 +577,7 @@
:+ ~ u.exp
=+ res=((ot res+(ar dank) ~) a)
?^ res u.res
p:(mule |.([(sell (slap !>(..zuse) (ream u.exp)))]~)) ::TODO oldz
p:(mule |.([(sell (slap !>(..^zuse) (ream u.exp)))]~)) ::TODO oldz
::
++ atta ::: attache
^- $-(json (unit attache))

View File

@ -97,6 +97,7 @@
[%home %publish]
[%home %clock]
[%home %weather]
[%home %azimuth-tracker]
==
::
++ deft-fish :: default connects
@ -105,7 +106,7 @@
^- (list gill:gall)
[[our %talk] [our %dojo] ~]
::
++ make :: initial part
++ make :: initial part
|= our/ship
^- part
:* %drum

View File

@ -40,12 +40,13 @@
$% [%bonk wire ~] ::
{$conf wire dock $load ship term} ::
{$flog wire flog:dill} ::
[%mint wire p=ship q=safe:rights:jael]
{$nuke wire ship} ::
[%serve wire binding:eyre generator:eyre]
[%serve wire binding:eyre generator:eyre] ::
{$poke wire dock pear} ::
{$rest wire @da} ::
{$wait wire @da} ::
{$rekey wire life ring} ::
{$moon wire ship udiff:point:able:jael} ::
== ::
++ move (pair bone card) :: user-level move
++ pear :: poke fruit
@ -79,14 +80,14 @@
?. =(our who.u.sed)
~& [%wrong-private-key-ship who.u.sed]
+>.$
=/ lyf=life .^(@ud j+/(scot %p our)/life/(scot %da now)/(scot %p our))
?. =(+(lyf) lyf.u.sed)
~& [%wrong-private-key-life expected=+(lyf) actual=lyf.u.sed]
(emit %rekey / lyf.u.sed key.u.sed)
::
++ poke-moon :: rotate moon keys
|= sed=(unit [=ship =udiff:point:able:jael])
=< abet
?~ sed
+>.$
:: our new private key, as a +tree of +rite
::
=/ rit (sy [%jewel (my [lyf.u.sed key.u.sed] ~)] ~)
(emit %mint / our rit)
(emit %moon / u.sed)
::
++ poke-nuke :: initialize
|= him/ship =< abet

View File

@ -1,9 +1,10 @@
:: Mock Azimuth
::
/+ ph, ph-util, ph-philter
/+ ph, ph-util, ph-philter, ph-tests
=, ph
=, ph-util
=, ph-philter
|= our=ship
=> |%
+$ az-log [topics=(lest @) data=@t]
--
@ -30,22 +31,39 @@
|= pin=ph-input
^- output:n
=, enjs:format
=/ thus (extract-thus-to uf.pin 'http://localhost:8545')
?~ thus
=/ ask (extract-request uf.pin 'http://localhost:8545/')
?~ ask
[& ~ %wait ~]
?~ r.mot.u.thus
?~ body.request.u.ask
[& ~ %wait ~]
=/ req q.u.r.mot.u.thus
=/ req q.u.body.request.u.ask
|^ ^- output:n
=/ method (get-method req)
:: =; a ~& [%give-azimuth-response a] -
?: =(method 'eth_blockNumber')
:- | :_ [%wait ~]
%+ answer-request req
s+(crip (num-to-hex:ethereum latest-block))
?: =(method 'eth_getBlockByNumber')
:- | :_ [%wait ~]
%+ answer-request req
:- %o
=/ number (hex-to-num:ethereum (get-first-param req))
=/ hash (number-to-hash number)
=/ parent-hash (number-to-hash ?~(number number (dec number)))
%- malt
^- (list (pair term json))
:~ hash+s+(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash)))
number+s+(crip (num-to-hex:ethereum number))
'parentHash'^s+(crip (num-to-hex:ethereum parent-hash))
==
?: =(method 'eth_getLogs')
:- | :_ [%wait ~]
%+ answer-request req
%+ logs-to-json
?^ (get-param-obj-maybe req 'blockHash')
%- logs-by-hash
(get-param-obj req 'blockHash')
%+ logs-by-range
(get-param-obj req 'fromBlock')
(get-param-obj req 'toBlock')
?: =(method 'eth_newFilter')
@ -67,7 +85,7 @@
:+ |
%+ answer-request req
~| [eth-filters latest-block]
(logs-to-json from-block.u.fil latest-block)
(logs-by-range from-block.u.fil latest-block)
=. last-block.u.fil latest-block
[%cont ..stay]
?: =(method 'eth_getFilterChanges')
@ -77,16 +95,17 @@
~|(%no-filter-not-implemented !!)
:+ |
%+ answer-request req
(logs-to-json last-block.u.fil latest-block)
(logs-by-range last-block.u.fil latest-block)
=. all.eth-filters
%+ ~(put by all.eth-filters)
fil-id
u.fil(last-block latest-block)
[%cont ..stay]
~& [%ph-azimuth-miss req]
[& ~ %wait ~]
::
++ latest-block
(add launch:contracts:azimuth (lent logs))
(add launch:contracts:azimuth (dec (lent logs)))
::
++ get-id
|= req=@t
@ -110,6 +129,20 @@
?> ?=([* ~] array)
i.array
::
++ get-param-obj-maybe
|= [req=@t param=@t]
^- (unit @ud)
=, dejs-soft:format
=/ array
%. (need (de-json:html req))
(ot params+(ar (ot param^so ~)) ~)
?~ array
~
:- ~
?> ?=([* ~] u.array)
%- hex-to-num:ethereum
i.u.array
::
++ get-filter-id
|= req=@t
=, dejs:format
@ -120,6 +153,14 @@
?> ?=([* ~] id)
i.id
::
++ get-first-param
|= req=@t
=, dejs:format
=/ id
%. (need (de-json:html req))
(ot params+(at so bo ~) ~)
-.id
::
++ answer-request
|= [req=@t result=json]
^- (list ph-event)
@ -136,19 +177,42 @@
who.pin
//http-client/0v1n.2m9vh
%receive
num.u.thus
num.u.ask
[%start [200 ~] `(as-octs:mimes:html resp) &]
==
::
++ logs-to-json
++ number-to-hash
|= =number:block:able:jael
^- @
?: (lth number launch:contracts:azimuth)
(cat 3 0x5364 (sub launch:contracts:azimuth number))
(cat 3 0x5363 (sub number launch:contracts:azimuth))
::
++ hash-to-number
|= =hash:block:able:jael
(add launch:contracts:azimuth (div hash 0x1.0000))
::
++ logs-by-range
|= [from-block=@ud to-block=@ud]
%+ logs-to-json (max launch:contracts:azimuth from-block)
?: (lth to-block launch:contracts:azimuth)
~
%+ swag
?: (lth from-block launch:contracts:azimuth)
[0 +((sub to-block launch:contracts:azimuth))]
:- (sub from-block launch:contracts:azimuth)
+((sub to-block from-block))
logs
::
++ logs-by-hash
|= =hash:block:able:jael
=/ =number:block:able:jael (hash-to-number hash)
(logs-by-range number number)
::
++ logs-to-json
|= [count=@ud selected-logs=(list az-log)]
^- json
:- %a
=/ selected-logs
%+ swag
[(sub from-block launch:contracts:azimuth) (sub to-block from-block)]
logs
=/ count from-block
|- ^- (list json)
?~ selected-logs
~
@ -160,7 +224,8 @@
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 `@`0x5362)))
::
:+ 'blockHash' %s
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 `@`0x5363)))
=/ hash (number-to-hash count)
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash)))
::
:+ 'blockNumber' %s
(crip (num-to-hex:ethereum count))
@ -183,23 +248,60 @@
--
--
::
++ dawn
++ raw-real-ship
|= who=ship
=/ m (ph ,~)
^- form:m
?. =(%earl (clan:title who))
(raw-ship:(ph-tests our) who `(dawn who ~))
=/ spon=ship (^sein:title who)
=/ cub (pit:nu:crub:crypto 512 (shaz (jam who life=1 %entropy)))
=/ =seed:able:jael
[who 1 sec:ex:cub ~]
=/ =pass pub:ex:cub
=/ com=tape "|moon {(scow %p who)}, =public-key {(scow %uw pass)}"
;< ~ bind:m (just-events:(ph-tests our) (dojo spon com))
(raw-ship:(ph-tests our) who `(dawn who `seed))
::
++ dawn
|= [who=ship seed=(unit seed:able:jael)]
^- dawn-event
=/ lyfe lyfe:(~(got by lives) who)
:* [who lyfe sec:ex:(get-keys who lyfe) ~]
(^sein:title who)
=/ spon
=/ =ship (^sein:title who)
=/ spon-spon
?: ?=(%czar (clan:title ship))
[| ~zod]
[& (^sein:title ship)]
=/ life-rift ~|([ship lives] (~(got by lives) ship))
=/ =life lyfe.life-rift
=/ =rift rut.life-rift
=/ =pass
%^ pass-from-eth:azimuth
(as-octs:mimes:html (get-public ship life %crypt))
(as-octs:mimes:html (get-public ship life %auth))
1
:^ ship=ship
*[address address address address]:azimuth
`[life=life pass rift spon-spon ~]
~
=/ =seed:able:jael
?^ seed
u.seed
=/ life-rift (~(got by lives) who)
=/ =life lyfe.life-rift
[who life sec:ex:(get-keys who life) ~]
:* seed
spon
get-czars
~[~['arvo' 'netw' 'ork']]
0
`(need (de-purl:html 'http://localhost:8545'))
~
==
::
:: Should only do galaxies
::
++ get-czars
^- (map ship [life pass])
^- (map ship [rift life pass])
%- malt
%+ murn
~(tap by lives)
@ -207,7 +309,7 @@
?. =(%czar (clan:title who))
~
%- some
:+ who lyfe
:^ who rut lyfe
%^ pass-from-eth:azimuth
(as-octs:mimes:html (get-public who lyfe %crypt))
(as-octs:mimes:html (get-public who lyfe %auth))
@ -217,21 +319,17 @@
|= who=@p
?< (~(has by lives) who)
=. lives (~(put by lives) who [1 0])
%- add-logs
%+ welp
?: =(%czar (clan:title who))
~
~[(spawned:lo (^sein:title who) who)]
:~ (activated:lo who)
(owner-changed:lo who 0xdead.beef)
%- changed-keys:lo
:* who
(get-public who 1 %crypt)
(get-public who 1 %auth)
1
1
==
==
=. this-az
%- add-logs
:~ %- changed-keys:lo
:* who
(get-public who 1 %crypt)
(get-public who 1 %auth)
1
1
==
==
(spam-logs 30)
::
:: our: host ship
:: who: cycle keys
@ -303,9 +401,16 @@
=/ prev (~(got by lives) who)
=/ rut +(rut.prev)
=. lives (~(put by lives) who [lyfe.prev rut])
%- add-logs
:_ ~
(broke-continuity:lo who rut)
=. this-az
(add-logs (broke-continuity:lo who rut) ~)
(spam-logs 30)
::
++ spam-logs
|= n=@
?: =(n 0)
this-az
=. this-az ?:((~(has by lives) ~fes) (cycle-keys ~fes) (spawn ~fes))
$(n (dec n))
::
++ get-keys
|= [who=@p lyfe=life]
@ -326,11 +431,6 @@
++ lo
=, azimuth-events:azimuth
|%
++ activated
|= who=ship
^- az-log
[~[^activated who] '']
::
++ broke-continuity
|= [who=ship rut=rift]
^- az-log
@ -351,15 +451,5 @@
(render-hex-bytes:ethereum 32 `@`crypto)
(render-hex-bytes:ethereum 32 `@`lyfe)
==
::
++ owner-changed
|= [who=ship owner=@ux]
^- az-log
[~[^owner-changed who owner] '']
::
++ spawned
|= [par=ship who=ship]
^- az-log
[~[^spawned par who] '']
--
--

View File

@ -80,13 +80,12 @@
::
:: Check if given effect is an http request; extract
::
++ extract-thus-to
++ extract-request
|= [uf=unix-effect dest=@t]
^- (unit [num=@ud mot=moth:eyre])
?. ?=(%thus -.q.uf) ~
?~ q.q.uf ~
?. =(p.u.q.q.uf (rash dest auri:de-purl:html)) ~
`[p.q.uf q.u.q.q.uf]
^- (unit [num=@ud =request:http])
?. ?=(%request -.q.uf) ~
?. =(dest url.request.q.uf) ~
`[id.q.uf request.q.uf]
::
:: Scry into a running aqua ship
::

View File

@ -6,6 +6,26 @@
::
:: sys: full path to /sys directory
::
+$ pill
[boot-ova=* kernel-ova=(list unix-event) userspace-ova=(list unix-event)]
::
+$ unix-event
%+ pair wire
$% [%wack p=@]
[%whom p=ship]
[%boot $%([%fake p=ship] [%dawn p=dawn-event])]
unix-task
==
::
+$ dawn-event
$: =seed:able:jael
spon=[=ship point:azimuth]
czar=(map ship [=rift =life =pass])
turf=(list turf)
bloq=@ud
node=(unit purl:eyre)
==
::
++ module-ova
|= sys=path
^- (list [wire [%veer term path cord]])
@ -54,7 +74,7 @@
=/ directories
`(list path)`~[/app /gen /lib /mar /ren /sec /sur /sys /tests /web]
|= bas=path
^- ovum
^- unix-event
::
:: /app %gall applications
:: /gen :dojo generators
@ -71,7 +91,7 @@
|= :: sal: all spurs to load from
::
sal/(list spur)
^- ovum
^- unix-event
::
:: hav: all user files
::

View File

@ -255,7 +255,7 @@
:: XX if active clam contracts only to abort transaction?
::
:: ~& [%tapp-reset dap.bowl]
:: `this-tapp
:: `this-tapp
~| [%tapp-load-incompatible dap.bowl]
!!
::
@ -412,10 +412,10 @@
^- (quip move _this-tapp)
(take-async bowl `[wire %bound success binding])
::
:: Receive source update from kale
:: Receive source update from jael
::
++ source
|= [=wire whos=(set ship) =source:kale]
|= [=wire whos=(set ship) =source:jael]
^- (quip move _this-tapp)
=. waiting (~(put to waiting) ost.bowl [%take %source whos source])
?^ active

View File

@ -1,16 +0,0 @@
::
:::: /hoon/snap/mar
::
=, mimes:html
|_ snap/snapshot:jael
++ grow
|%
++ mime [/application/octet-stream (jam snap)]
--
++ grab
|%
++ noun snapshot:jael
++ mime |=([p=mite:eyre q=octs:eyre] (cue q.q))
--
++ grad %mime
--

View File

@ -10,12 +10,18 @@
:: Short names are simply the first letter of each word plus `s` if
:: it's a list.
::
/+ pill
=, pill-lib=pill
|%
++ ph-event
$% [%test-done p=?]
aqua-event
==
::
+$ unix-event unix-event:pill-lib
+$ dawn-event dawn-event:pill-lib
+$ pill pill:pill-lib
::
+$ aqua-event
$% [%init-ship who=ship keys=(unit dawn-event)]
[%pause-events who=ship]
@ -40,16 +46,6 @@
::
+$ unix-timed-event [tym=@da ue=unix-event]
::
+$ unix-event
%+ pair wire
$% [%wack p=@]
[%whom p=ship]
[%live p=@ud q=(unit @ud)]
[%barn ~]
[%boot $%([%fake p=ship] [%dawn p=dawn-event])]
unix-task
==
::
+$ unix-effect
%+ pair wire
$% [%blit p=(list blit:dill)]
@ -60,20 +56,8 @@
[%sleep ~]
[%restore ~]
[%init ~]
[%request id=@ud request=request:http]
==
+$ pill
[boot-ova=* kernel-ova=(list unix-event) userspace-ova=(list unix-event)]
::
+$ dawn-event
$: =seed:able:jael
spon=ship
czar=(map ship [=life =pass])
turf=(list turf)
bloq=@ud
node=(unit purl:eyre)
snap=(unit snapshot:jael)
==
::
+$ vane-move
%+ pair bone
$% [%peer wire dock path]

View File

@ -15,10 +15,10 @@
[%connect wire binding:eyre term]
[%http-response =http-event:http]
[%rule wire %turf %put turf]
[%source wire whos=(set ship) src=source:kale]
[%source wire whos=(set ship) src=source:jael]
[%sources wire ~]
[%new-event wire =ship =udiff:point:able:kale]
[%listen wire whos=(set ship) =source:kale]
[%new-event wire =ship =udiff:point:able:jael]
[%listen wire whos=(set ship) =source:jael]
==
::
:: Possible async responses
@ -30,7 +30,7 @@
[%reap =dock =path error=(unit tang)]
[%bound success=? =binding:eyre]
[%http-response response=client-response:iris]
[%source whos=(set ship) =source:kale]
[%source whos=(set ship) =source:jael]
==
::
:: Outstanding contracts

View File

@ -459,7 +459,7 @@
::
++ dint :: input routing
|= hap/path ^- @tas
?+ hap !!
?+ hap ~|([%bad-dint hap] !!)
{@ $ames *} %a
{@ $boat *} %c
{@ $newt *} %a

View File

@ -481,12 +481,12 @@
|* {a/(unit) b/(unit)}
?~ b a
?~ a b
?.(=(u.a u.b) ~>(%mean.[%leaf "mate"] !!) a)
?.(=(u.a u.b) ~>(%mean.'mate' !!) a)
::
++ need :: demand
~/ %need
|* a/(unit)
?~ a ~>(%mean.[%leaf "need"] !!)
?~ a ~>(%mean.'need' !!)
u.a
::
++ some :: lift (pure)
@ -8927,7 +8927,7 @@
* gen
==
::
++ rake ~>(%mean.[%leaf "rake-hoon"] (need reek))
++ rake ~>(%mean.'rake-hoon' (need reek))
++ reek
^- (unit wing)
?+ gen ~
@ -8941,7 +8941,7 @@
^- term
=+ wig=rake
?. ?=({@ ~} wig)
~>(%mean.[%leaf "rusk-hoon"] !!)
~>(%mean.'rusk-hoon' !!)
i.wig
--
::
@ -9089,7 +9089,7 @@
%void %void
%noun [%atom p.base.skin ~]
[%atom *] ?. (fitz p.base.skin p.ref)
~>(%mean.[%leaf "atom-mismatch"] !!)
~>(%mean.'atom-mismatch' !!)
:+ %atom
(max p.base.skin p.ref)
q.ref
@ -9134,7 +9134,7 @@
[%atom *] ?: &(?=(^ q.ref) !=(atom.skin u.q.ref))
%void
?. (fitz aura.skin p.ref)
~>(%mean.[%leaf "atom-mismatch"] !!)
~>(%mean.'atom-mismatch' !!)
:+ %atom
(max aura.skin p.ref)
`atom.skin
@ -9626,14 +9626,14 @@
++ play
^- type
=+ lug=(find %read hyp)
?: ?=(%| -.lug) ~>(%mean.[%leaf "hoon"] ?>(?=(~ rig) p.p.lug))
?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.p.lug))
(elbo p.lug rig)
::
++ mint
|= gol/type
^- (pair type nock)
=+ lug=(find %read hyp)
?: ?=(%| -.lug) ~>(%mean.[%leaf "hoon"] ?>(?=(~ rig) p.lug))
?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.lug))
=- ?>(?|(!vet (nest(sut gol) & p.-)) -)
(etco p.lug rig)
::
@ -9902,7 +9902,7 @@
:- %hold
?. ?=({$core *} p)
~_ (dunk %fire-type)
~>(%mean.[%leaf "fire-core"] !!)
~>(%mean.'fire-core' !!)
=+ dox=[%core q.q.p q.p(r.p %gold)]
?: ?=($dry -.q)
:: ~_ (dunk(sut [%cell q.q.p p.p]) %fire-dry)
@ -9934,7 +9934,7 @@
[%3 %0 axe]
(flan $(sut p.sut, axe (peg axe 2)) $(sut q.sut, axe (peg axe 3)))
::
{$core *} ~>(%mean.[%leaf "fish-core"] !!)
{$core *} ~>(%mean.'fish-core' !!)
{$face *} $(sut q.sut)
{$fork *} =+ yed=~(tap in p.sut)
|- ^- nock
@ -9942,7 +9942,7 @@
{$hint *} $(sut q.sut)
{$hold *}
?: (~(has in vot) sut)
~>(%mean.[%leaf "fish-loop"] !!)
~>(%mean.'fish-loop' !!)
=> %=(. vot (~(put in vot) sut))
$(sut repo)
==
@ -9980,7 +9980,7 @@
{$hint *} (hint p.sut $(sut q.sut))
{$hold *}
?: (~(has in bix) [sut ref])
~>(%mean.[%leaf "fuse-loop"] !!)
~>(%mean.'fuse-loop' !!)
$(sut repo, bix (~(put in bix) [sut ref]))
::
$noun ref
@ -10185,7 +10185,7 @@
|^ ^- {p/type q/nock}
?: ?&(=(%void sut) !?=({$dbug *} gen))
?. |(!vet ?=({$lost *} gen) ?=({$zpzp *} gen))
~>(%mean.[%leaf "mint-vain"] !!)
~>(%mean.'mint-vain' !!)
[%void %0 0]
?- gen
::
@ -10267,7 +10267,7 @@
{$wthx *}
:- (nice bool)
=+ fid=(find %read [[%& 1] q.gen])
~> %mean.[%leaf "mint-fragment"]
~> %mean.'mint-fragment'
?> &(?=(%& -.fid) ?=(%& -.q.p.fid))
(~(fish ar `type`p.q.p.fid `skin`p.gen) (tend p.p.fid))
::
@ -10294,7 +10294,7 @@
{$lost *}
?: vet
~_ (dunk(sut (play p.gen)) 'lost')
~>(%mean.[%leaf "mint-lost"] !!)
~>(%mean.'mint-lost' !!)
[%void [%0 0]]
::
{$zpmc *}
@ -10311,7 +10311,7 @@
=+ doz=~(open ap gen)
?: =(doz gen)
~_ (show [%c 'hoon'] [%q gen])
~>(%mean.[%leaf "mint-open"] !!)
~>(%mean.'mint-open' !!)
$(gen doz)
==
::
@ -10349,7 +10349,7 @@
|= {gol/type dox/type gen/hoon}
|^ ^- {p/type q/type}
?: =(%void sut)
~>(%mean.[%leaf "mull-none"] !!)
~>(%mean.'mull-none' !!)
?- gen
::
{^ *}
@ -10414,9 +10414,9 @@
:- %void
?: =(%void q.fex)
%void
~>(%mean.[%leaf "if-z"] (play(sut q.fex) q.gen))
~>(%mean.'if-z' (play(sut q.fex) q.gen))
?: =(%void q.fex)
~>(%mean.[%leaf "mull-bonk-b"] !!)
~>(%mean.'mull-bonk-b' !!)
$(sut p.fex, dox q.fex, gen q.gen)
=+ ^= ran ^- {p/type q/type}
=+ wux=[p=(lose p.gen) q=(lose(sut dox) p.gen)]
@ -10424,9 +10424,9 @@
:- %void
?: =(%void q.wux)
%void
~>(%mean.[%leaf "if-a"] (play(sut q.wux) r.gen))
~>(%mean.'if-a' (play(sut q.wux) r.gen))
?: =(%void q.wux)
~>(%mean.[%leaf "mull-bonk-c"] !!)
~>(%mean.'mull-bonk-c' !!)
$(sut p.wux, dox q.wux, gen r.gen)
[(nice (fork p.hiq p.ran ~)) (fork q.hiq q.ran ~)]
::
@ -10436,11 +10436,11 @@
q=(cove q:(mint(sut dox) %noun [%wing q.gen]))
=+ pov=[p=(fish(sut p.waz) p.syx) q=(fish(sut q.waz) q.syx)]
?. &(=(p.syx q.syx) =(p.pov q.pov))
~>(%mean.[%leaf "mull-bonk-a"] !!)
~>(%mean.'mull-bonk-a' !!)
(beth bool)
::
{$wthx *}
~> %mean.[%leaf "mull-bonk-x"]
~> %mean.'mull-bonk-x'
=+ :- =+ (find %read [[%& 1] q.gen])
?> &(?=(%& -.-) ?=(%& -.q.p.-))
new=[type=p.q.p.- axis=(tend p.p.-)]
@ -10456,7 +10456,7 @@
{$lost *}
?: vet
:: ~_ (dunk(sut (play p.gen)) 'also')
~>(%mean.[%leaf "mull-skip"] !!)
~>(%mean.'mull-skip' !!)
(beth %void)
::
{$zpts *} (beth %noun)
@ -10468,7 +10468,7 @@
{$zpvt *}
=+ [(feel p.gen) (feel(sut dox) p.gen)]
?. =(-< ->)
~>(%mean.[%leaf "mull-bonk-f"] !!)
~>(%mean.'mull-bonk-f' !!)
?: -<
$(gen q.gen)
$(gen r.gen)
@ -10478,7 +10478,7 @@
=+ doz=~(open ap gen)
?: =(doz gen)
~_ (show [%c 'hoon'] [%q gen])
~>(%mean.[%leaf "mull-open"] !!)
~>(%mean.'mull-open' !!)
$(gen doz)
==
::
@ -10559,6 +10559,7 @@
gil/(set {p/type q/type}) :: assume nest
==
=< dext
~% %nest-in ..$ ~
|%
++ deem
|= {mel/vair ram/vair}
@ -10595,12 +10596,16 @@
== == ==
::
++ dext
=< $
~% %nest-dext + ~
|.
^- ?
=- ?: - &
?. tel |
:: ~_ (dunk %need)
:: ~_ (dunk(sut ref) %have)
~>(%mean.[%leaf "nest-fail"] !!)
~> %mean.'nest-fail'
!!
?: =(sut ref) &
?- sut
$void sint
@ -10769,7 +10774,8 @@
* =+ doz=~(open ap gen)
?: =(doz gen)
~_ (show [%c 'hoon'] [%q gen])
~>(%mean.[%leaf "play-open"] !!)
~> %mean.'play-open'
!!
$(gen doz)
==
:: ::
@ -10997,7 +11003,7 @@
{$hint *} q.sut
{$hold *} (rest [[p.sut q.sut] ~])
$noun (fork [%atom %$ ~] [%cell %noun %noun] ~)
* ~>(%mean.[%leaf "repo-fltt"] !!)
* ~>(%mean.'repo-fltt' !!)
==
::
++ rest
@ -11005,7 +11011,7 @@
|= leg/(list {p/type q/hoon})
^- type
?: (lien leg |=({p/type q/hoon} (~(has in fan) [p q])))
~>(%mean.[%leaf "rest-loop"] !!)
~>(%mean.'rest-loop' !!)
=> .(fan (~(gas in fan) leg))
%- fork
%~ tap in
@ -14134,7 +14140,7 @@
:: %mean.[%leaf "need"]
::
:: XX I'm not sure if the `[%leaf "need"]` bit represents a literal
:: AST fragment or an expression that evaluates to `[%leaf "need"]. I'm
:: AST fragment or an expression that evaluates to `[%leaf "need"]`. I'm
:: going to assume the latter for now.
::
++ tiscol-to-plum
@ -15904,7 +15910,6 @@
|* tem=rule
%- star
;~ pose
whit
;~(pfix bas tem)
;~(less tem prn)
==

View File

@ -22,9 +22,9 @@
== ::
$: %j :: to %jael
$> $? %meet :: neighbor
%pubs :: view public keys
%public-keys :: view public keys
%turf :: view domains
%vein :: view private keys
%private-keys :: view private keys
== ::
task:able:jael ::
== ::
@ -37,9 +37,9 @@
$>(%wake gift:able:behn) :: timer activate
== ::
$: %j :: from %jael
$> $? %pubs :: public keys
$> $? %public-keys :: public keys
%turf :: bind to domains
%vein :: private keys
%private-keys :: private keys
== ::
gift:able:jael ::
== ::
@ -270,7 +270,7 @@
::
=/ bil=(unit deed)
=/ rac (clan:title our)
?. ?| ?=(?(%earl %pawn) rac)
?. ?| ?=(%pawn rac)
&(!?=(%czar rac) =(our seg))
==
~
@ -832,20 +832,6 @@
=* wed u.law
?> ^- ?
?- (clan:title her)
%earl
:: signed by parent
::
=/ seg (^sein:title her)
=/ yig
?: =(our seg)
sen:gus
cluy:(myx:gus seg)
?& =(lyf.yig life.wed)
?=(^ oath.wed)
.= (need (sure:as:cub.yig u.oath.wed))
(shaf %earl (sham [her life.wed pass.wed]))
==
::
%pawn
:: self-signed, life 1, address is fingerprint
::
@ -919,10 +905,7 @@
:: if :her is a comet, or a moon of a known ship, proceed
::
=/ =rank:title (clan:title her)
?: ?| ?=(%pawn rank)
?& ?=(%earl rank)
!=(~ lew.wod.dur:(myx:gus (sein-scry her)))
== ==
?: ?=(%pawn rank)
apse
:: otherwise, drop the packet
::
@ -1358,7 +1341,7 @@
?- -.bon
%beer
=/ =wire /pubs/(scot %p p.bon)
:_ fox [hen [%pass wire %j %pubs p.bon]]~
:_ fox [hen [%pass wire %j %public-keys (silt p.bon ~)]]~
::
%bock
:: ignore %turf if we haven't yet learned a unix duct
@ -1421,20 +1404,23 @@
::
%sake
=/ =wire /our/(scot %p our)
:_ fox [hen [%pass wire %j %vein ~]]~
:_ fox [hen [%pass wire %j %private-keys ~]]~
::
%wine
:_ fox
=+ fom=~(rend co %$ %p p.bon)
:~ :- hen
:+ %slip %d
:+ %flog %text
;: weld
"; "
fom
q.bon
==
==
[[(print hen p.bon q.bon) ~] fox]
==
::
++ print
|= [hen=duct who=ship =tape]
^- move
=+ fom=~(rend co %$ %p who)
:- hen
:+ %slip %d
:+ %flog %text
;: weld
"; "
fom
tape
==
::
++ knap
@ -1453,30 +1439,44 @@
%mack ?~ +>.sih $(sih [%g %nice ~]) :: XX using old code
$(sih [%g %mean `[%mack +>+.sih]])
::
%pubs
%public-keys
?. ?=([%pubs @ ~] tea)
~& [%strange-pubs tea]
[~ +>]
[~ +>.$]
?: ?& ?=(%diff -.public-keys-result.sih)
?=(%rift -.diff.public-keys-result.sih)
==
(sink hen [who [from to]:diff]:public-keys-result.sih)
?: ?& ?=(%diff -.public-keys-result.sih)
!?=(%keys -.diff.public-keys-result.sih)
==
[~ +>.$]
=/ her=ship (slav %p i.t.tea)
=/ gus (~(us go ton.fox) our)
=/ diz (myx:gus her)
?: =(0 life.sih)
:: this should clear lew.wod.dur.diz because it means
:: we no longer trust that their public key came to
:: us honestly (becuse of a %jael snapshot restore).
:: in practice, that crashes in ++cluy:las:as:go, so
:: we ignore for now.
~& [%ames-hear-empty-pub her]
[~ +>.$]
=/ ded=deed
[life.sih (~(got by pubs.sih) life.sih) oath=~]
=. lew.wod.dur.diz `ded
=/ ded=(unit deed)
?: ?=(%full -.public-keys-result.sih)
~| [her=her public-keys-result=public-keys-result.sih]
=/ a-point=(unit point:able:jael)
(~(get by points.public-keys-result.sih) her)
?~ a-point
~
=/ a-pass=pass pass:(~(got by keys.u.a-point) life.u.a-point)
`[life.u.a-point a-pass oath=~]
?> ?=(%keys -.diff.public-keys-result.sih)
?> =(her who.public-keys-result.sih)
=/ a-key-update=key-update:point:able:jael
to.diff.public-keys-result.sih
`[life.a-key-update pass.a-key-update oath=~]
?~ ded
[~ +>.$]
=. lew.wod.dur.diz `u.ded
=. ton.fox (~(su go ton.fox) (nux:gus diz))
[~ +>.$]
::
%unto [~ +>]
::
%vein
%private-keys
?. ?=([%our @ ~] tea)
~& [%strange-vein tea]
[~ +>]
@ -1521,6 +1521,17 @@
$(p.fuy t.p.fuy, out (weld (flop toe) out))
==
::
++ sink
|= [hen=duct who=ship from=rift to=rift]
^- [(list move) _+>]
?: =(our who)
[[(print hen who ", you have sunk") ~] +>.$]
::
=: hoc.ton.fox (~(del by hoc.ton.fox) who)
wab.zac.fox (~(del by wab.zac.fox) who)
==
[[(print hen who " has sunk") ~] +>.$]
::
++ knob
~/ %knob
|= [hen=duct kyz=task:able]
@ -1585,25 +1596,6 @@
fox(bad (~(del in bad.fox) p.kyz))
~& [%block p.kyz]
fox(bad (~(put in bad.fox) p.kyz))
::
%sunk
=* who p.kyz
=* lyf q.kyz
?: =(our who)
?: (lth lyf p:(head val.ton.fox))
:: replaying our old sinkage, ignore
:: XX review
::
[~ fox]
:: XX include some helpful instructions here
::
:_ fox
[%wine who ", you have sunk"]~
::
=: hoc.ton.fox (~(del by hoc.ton.fox) who)
wab.zac.fox (~(del by wab.zac.fox) who)
==
[[%wine who " has sunk"]~ fox]
::
%vega
:: re-initialize our cryptosuite B cores

View File

@ -497,6 +497,9 @@
%wipe ::
== ::
task:able:ford ::
== ::
$: %j :: by %jael
$>(%public-keys task:able:jael) ::
== == ::
++ riot (unit rant) :: response+complete
++ sign :: in result $<-
@ -524,6 +527,9 @@
$: %f :: by %ford
$>(%made gift:able:ford) ::
== ::
$: %j :: by %jael
$>(%public-keys gift:able:jael) ::
== ::
$: @tas :: by any
$>(%crud vane-task) :: XX strange
== == ::
@ -2402,7 +2408,6 @@
:: Must uni the old-lat into the new-lat so that if we recreate
:: the same blob hash, we use the old blob not the new one. Else
:: you get mutually recurring %delta blobs.
::
++ add-blobs
|= [new-blobs=(map path blob) old-lat=(map lobe blob)]
^- (map lobe blob)
@ -2632,22 +2637,24 @@
::
=* ruf |4.+6.^$
::
=+ ^- [hun=(unit duct) rede]
=+ ^- [mow=(list move) hun=(unit duct) rede]
?. =(our her)
:: no duct, foreign +rede or default
::
:- ~
:+ ?: (~(has by hoy.ruf) her)
~
[hun.rom.ruf %pass /sinks %j %public-keys (silt her ~)]~
~
=/ rus rus:(~(gut by hoy.ruf) her *rung)
%+ ~(gut by rus) syd
[lim=~2000.1.1 ref=`*rind qyx=~ dom=*dome per=~ pew=~]
:: administrative duct, domestic +rede
::
:- `hun.rom.ruf
:+ ~ `hun.rom.ruf
=/ jod (~(gut by dos.rom.ruf) syd *dojo)
[lim=now ref=~ [qyx dom per pew]:jod]
::
=* red=rede ->
=| mow/(list move)
=* red=rede ->+
|%
++ abet :: resolve
^- [(list move) raft]
@ -4107,7 +4114,7 @@
%boat
:_ ..^$
[hen %give %hill (turn ~(tap by mon.ruf) head)]~
::.
::
%cred
=. cez.ruf
?~ cew.req (~(del by cez.ruf) nom.req)
@ -4304,49 +4311,6 @@
=/ den ((de our now ski hen ruf) our des.req)
abet:(perm:den pax.req rit.req)
[mos ..^$]
::
%sunk
~& rift=[p.req q.req]
~& desks=(turn ~(tap by dos.rom.ruf) head)
~& hoy=(turn ~(tap by hoy.ruf) head)
::
?: =(our p.req)
[~ ..^$]
:: Cancel subscriptions
::
=/ foreign-desk=(unit rung)
(~(get by hoy.ruf) p.req)
?~ foreign-desk
~& [%never-heard-of-her p.req q.req]
[~ ..^$]
~& old-rift=rit.u.foreign-desk
?: (gte rit.u.foreign-desk q.req)
~& 'replaying sunk, so not clearing state'
[~ ..^$]
=/ cancel-ducts=(list duct)
%- zing ^- (list (list duct))
%+ turn ~(tap by rus.u.foreign-desk)
|= [=desk =rede]
^- (list duct) %- zing ^- (list (list duct))
%+ turn ~(tap by qyx.rede)
|= [=wove ducts=(set duct)]
:: ~& [%sunk-wove desk (print-wove wove) ducts]
~(tap in ducts)
=/ cancel-moves=(list move)
%+ turn cancel-ducts
|= =duct
[duct %slip %b %drip !>([%writ ~])]
:: Clear ford cache
::
=/ clear-ford-cache-moves=(list move)
:~ [hen %pass /clear/keep %f %keep 0 1]
[hen %pass /clear/wipe %f %wipe 100]
[hen %pass /clear/kep %f %keep 2.048 64]
==
:: delete local state of foreign desk
::
=. hoy.ruf (~(del by hoy.ruf) p.req)
[(weld clear-ford-cache-moves cancel-moves) ..^$]
::
%vega [~ ..^$]
::
@ -4446,30 +4410,30 @@
::
++ stay [%1 ruf]
++ take :: accept response
|= {tea/wire hen/duct hin/(hypo sign)}
|= [tea=wire hen=duct hin=(hypo sign)]
^+ [*(list move) ..^$]
?: ?=({$commit @ *} tea)
?: ?=([%commit @ *] tea)
=* syd i.t.tea
=^ mos ruf
=/ den ((de our now ski hen ruf) our syd)
abet:(take-commit:den q.hin)
[mos ..^$]
::
?: ?=({$merge @ *} tea)
?: ?=([%merge @ *] tea)
=* syd i.t.tea
=^ mos ruf
=/ den ((de our now ski hen ruf) our syd)
abet:(take-merge:den q.hin)
[mos ..^$]
::
?: ?=({$mount @ *} tea)
?: ?=([%mount @ *] tea)
=* syd i.t.tea
=^ mos ruf
=/ den ((de our now ski hen ruf) our syd)
abet:(take-mount:den q.hin)
[mos ..^$]
::
?: ?=({%foreign-request @ @ @ *} tea)
?: ?=([%foreign-request @ @ @ *] tea)
=/ her (slav %p i.t.tea)
=/ syd (slav %tas i.t.t.tea)
=/ inx (slav %ud i.t.t.t.tea)
@ -4478,7 +4442,7 @@
abet:(take-foreign-request:den inx q.hin)
[mos ..^$]
::
?: ?=({%foreign-update @ @ *} tea)
?: ?=([%foreign-update @ @ *] tea)
=/ her (slav %p i.t.tea)
=/ syd (slav %tas i.t.t.tea)
=^ mos ruf
@ -4486,8 +4450,8 @@
abet:(take-foreign-update:den q.hin)
[mos ..^$]
::
?: ?=({$blab care @ @ *} tea)
?> ?=($made +<.q.hin)
?: ?=([%blab care @ @ *] tea)
?> ?=(%made +<.q.hin)
?. ?=([%complete %success *] result.q.hin)
~| %blab-fail
~> %mean.|.((made-result-as-error:ford result.q.hin))
@ -4495,14 +4459,59 @@
:_ ..^$ :_ ~
:* hen %slip %b %drip !>
:* %writ ~
^- {care case @tas}
^- [care case @tas]
[i.t.tea ;;(case +>:(slay i.t.t.tea)) i.t.t.t.tea]
::
`path`t.t.t.t.tea
`cage`(result-to-cage:ford build-result.result.q.hin)
== ==
::
?: ?=([%sinks ~] tea)
?> ?=(%public-keys +<.q.hin)
?: ?=(%full -.public-keys-result.q.hin)
[~ ..^$]
?. ?=(%rift -.diff.public-keys-result.q.hin)
[~ ..^$]
=/ who who.public-keys-result.q.hin
=/ to-rift to.diff.public-keys-result.q.hin
::
?: =(our who)
[~ ..^$]
:: Cancel subscriptions
::
=/ foreign-desk=(unit rung)
(~(get by hoy.ruf) who)
?~ foreign-desk
[~ ..^$]
?: (gte rit.u.foreign-desk to-rift)
[~ ..^$]
=/ cancel-ducts=(list duct)
%- zing ^- (list (list duct))
%+ turn ~(tap by rus.u.foreign-desk)
|= [=desk =rede]
^- (list duct) %- zing ^- (list (list duct))
%+ turn ~(tap by qyx.rede)
|= [=wove ducts=(set duct)]
:: ~& [%sunk-wove desk (print-wove wove) ducts]
~(tap in ducts)
=/ cancel-moves=(list move)
%+ turn cancel-ducts
|= =duct
[duct %slip %b %drip !>([%writ ~])]
:: Clear ford cache
::
=/ clear-ford-cache-moves=(list move)
:~ [hen %pass /clear/keep %f %keep 0 1]
[hen %pass /clear/wipe %f %wipe 100]
[hen %pass /clear/kep %f %keep 2.048 64]
==
:: delete local state of foreign desk
::
=. hoy.ruf (~(del by hoy.ruf) who)
[(weld clear-ford-cache-moves cancel-moves) ..^$]
::
?- -.+.q.hin
%public-keys ~|([%public-keys-raw tea] !!)
%init-clad
~|(%clad-not-real !!)
::

View File

@ -297,7 +297,6 @@
[[151 %noun] %j our %sein da+now /(scot %p who)]
::
++ init :: initialize
~& [%dill-init our ram]
^+ .
=. moz
:_ moz
@ -305,7 +304,6 @@
.
::
++ mere :: continue init
~& [%dill-mere our ram]
^+ .
=/ myt (flop (fall tem ~))
=/ can (clan:title our)
@ -514,6 +512,8 @@
=/ boot
((soft $>($?(%dawn %fake) task:able:jael)) p.task)
?~ boot
~& %dill-no-boot
~& p.task
~| invalid-boot-event+hen !!
:_(..^$ [hen %pass / %j u.boot]~)
:: we are subsequently initialized. single-home
@ -539,10 +539,6 @@
=? p.task ?=([%crud %hax-heft ~] p.task) [%heft ~]
::
$(hen u.hey.all, wrapped-task p.task)
:: a %sunk notification from %jail comes in on an unfamiliar duct
::
?: ?=(%sunk -.task)
[~ ..^$]
:: a %vega notification on kernel upgrade comes in on an unfamiliar duct
::
?: ?=(%vega -.task)

View File

@ -374,6 +374,9 @@
#topborder {
border-top: 3px #fff solid;
}
#ship-name {
font-family: 'Source Code Pro', monospace, sans-serif;
}
h1 {
line-height: 77px;
font-size: 64px;
@ -425,7 +428,7 @@
;div#main
;div#inner
;h1#topborder:"Welcome"
;h1:"{(scow %p our)}"
;h1#ship-name:"{(scow %p our)}"
;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded")
;input(type "password", name "password", placeholder "passcode", autofocus "true");
;input(type "hidden", name "redirect", value redirect-str);

View File

@ -6168,12 +6168,6 @@
=^ moves state.ax cancel:this-event
::
[moves ford-gate]
::
:: %sunk: foreign ship has lost continutity
::
%sunk
::
[~ ford-gate]
::
:: %vega: learn of kernel upgrade
::

View File

@ -1334,21 +1334,18 @@
%keep `%f
%kill `%f
%look `%j
%listen `%k
%listen `%j
%merg `%c
%mint `%j
%mont `%c
%new-event `%k
%moon `%j
%nuke `%a
%ogre `%c
%perm `%c
%rest `%b
%snap `%j
%sources `%k
%rekey `%j
%wait `%b
%want `%a
%warp `%c
%wind `%j
%wipe `%f
::
%request `%i
@ -1381,8 +1378,6 @@
::
$init
[~ ..^$(sys.mast.all hen)]
::
$sunk [~ ..^$]
::
$vega [~ ..^$]
::

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -72,9 +72,9 @@
++ life @ud :: ship key revision
++ rift @ud :: ship continuity
++ mime {p/mite q/octs} :: mimetyped data
::
::
:: TODO: Rename to +mime once the current +mime and +mite are gone. The
::
:: TODO: Rename to +mime once the current +mime and +mite are gone. The
::
++ octs {p/@ud q/@t} :: octet-stream
++ sock {p/ship q/ship} :: outgoing [our his]
@ -203,9 +203,6 @@
:: boot completed (XX legacy)
::
[%init p=ship]
:: peer discontinuity
::
[%sunk p=ship q=rift]
:: kernel upgraded
::
[%vega ~]
@ -217,7 +214,7 @@
[%west p=ship q=path r=*]
==
:: ::::
:::: ++http ::
:::: ++http ::
:: ::::
:: http: shared representations of http concepts
::
@ -393,7 +390,6 @@
$>(%init vane-task) :: report install
{$kick p/@da} :: wake up
{$nuke p/@p} :: toggle auto-block
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade
{$wake ~} :: timer activate
$>(%wegh vane-task) :: report memory
@ -628,7 +624,6 @@
{$dirk des/desk} :: mark mount dirty
{$ogre pot/$@(desk beam)} :: delete mount point
{$perm des/desk pax/path rit/rite} :: change permissions
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade
{$warp wer/ship rif/riff} :: internal file req
{$werp who/ship wer/ship rif/riff} :: external file req
@ -795,7 +790,6 @@
$>(%init vane-task) :: after gall ready
{$lyra p/@t q/@t} :: upgrade kernel
{$noop ~} :: no operation
$>(%sunk vane-task) :: report death
{$talk p/tank} ::
{$text p/tape} ::
{$veer p/@ta q/path r/@t} :: install vane
@ -1182,9 +1176,6 @@
:: %kill: stop a build; send on same duct as original %build request
::
[%kill ~]
:: %sunk: receive a report that a foreign ship has lost continuity
::
$>(%sunk vane-task)
:: %vega: report kernel upgrade
::
$>(%vega vane-task)
@ -1879,7 +1870,6 @@
$% {$conf p/dock q/culm} :: configure app
$>(%init vane-task) :: set owner
{$deal p/sock q/cush} :: full transmission
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade
$>(%west vane-task) :: network request
$>(%wegh vane-task) :: report memory
@ -2061,257 +2051,48 @@
:: ::::
++ able ^?
=, pki
=, rights
|%
:: %jael has two general kinds of task: changes
:: and change subscriptions.
::
:: change tasks are designed to match high-level
:: operations - for instance, we have %burn, %mint,
:: and %move, not just a single delta operation.
:: more of these operations will probably be added,
:: and invariants enforced at transaction end.
::
:: subscriptions are also user-focused - for instance,
:: %vein sends all the information needed to maintain
:: the secure channel, both rights and certificates.
:: the security-critical tasks (%veil, %vein, %vine)
:: should probably be bound to a whitelisted duct set.
:: (all secrets are redacted from %vest gifts.)
::
:: %jael only talks to %ames and %behn. we send messages
:: through %ames and use %behn timers.
::
++ logs :: on-chain changes
%+ map event-id:ethereum-types :: per event log
diff-azimuth:azimuth-types :: the change
++ action :: balance change
%+ pair ship :: partner
%+ each bump :: &/liability change
bump :: |/asset change
+$ public-keys-result
$% [%full points=(map ship point)]
[%diff who=ship =diff:point]
==
:: ::
++ balance :: balance sheet
%+ pair ::
(map ship safe) :: liabilities
(map ship safe) :: assets
:: ::
++ vent-result :: %vent result
$% [%snap snap=snapshot:jael] :: restore snapshot
[%chain can=chain] :: get new events
== ::
:: ::
++ chain :: batch of changes
%+ each logs :: & all events
logs :: | new events
++ change :: urbit change
$% [%ethe can=chain] :: on-chain change
[%meet who=ship =life =pass] :: meet in new era
$: %rite :: rights change
rex/ship :: issuer
pal/ship :: issued to
del/bump :: change
== == ::
++ gift :: out result <-$
$% [%init p=ship] :: report install unix
[%mass p=mass] :: memory usage report
[%mack p=(unit tang)] :: message n/ack
[%pubs public] :: public keys
[%turf turf=(list turf)] :: domains
[%vest p=tally] :: balance update
[%vein =life vein=(map life ring)] :: private keys
[%vine p=(list change)] :: all raw changes
[%vent p=vent-result] :: ethereum changes
[%private-keys =life vein=(map life ring)] :: private keys
[%public-keys =public-keys-result] :: ethereum changes
== ::
:: ::
++ public :: public key state
$: life=life :: current key number
pubs=(map life pass) :: pubkeys by number
== ::
++ remote :: remote notification
%+ each safe :: &/addition
safe :: |/replacement
:: +seed: private boot parameters
::
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)]
::
++ tally :: balance update
%+ each balance :: complete
action :: change
::
+= task :: in request ->$
$~ [%vega ~] ::
$% [%burn p=ship q=safe] :: destroy rights
[%hail p=ship q=remote] :: remote update
$: %dawn :: boot from keys
$% $: %dawn :: boot from keys
=seed:able:jael :: identity params
spon=ship :: sponsor
czar=(map ship [=life =pass]) :: galaxy table
spon=[=ship point:azimuth-types] :: sponsor
czar=(map ship [=rift =life =pass]) :: galaxy table
turf=(list turf) :: domains
bloq=@ud :: block number
node=(unit purl:eyre) :: gateway url
snap=(unit snapshot) :: head start
== ::
[%fake =ship] :: fake boot
[%look src=(each ship purl:eyre)] :: set ethereum source
[%mint p=ship q=safe] :: create rights
[%move p=ship q=ship r=safe] :: transfer from=to
[%listen whos=(set ship) =source] :: set ethereum source
::TODO %next for generating/putting new private key
[%nuke ~] :: cancel tracker from
[%pubs =ship] :: view public keys
[%meet =ship =life =pass] :: met after breach
[%snap snap=snapshot kick=?] :: load snapshot
[%moon =ship =udiff:point] :: register moon keys
[%nuke whos=(set ship)] :: cancel tracker from
[%private-keys ~] :: sub to privates
[%public-keys ships=(set ship)] :: sub to publics
[%rekey =life =ring] :: update private keys
[%turf ~] :: view domains
$>(%vega vane-task) :: report upgrade
[%vein ~] :: view signing keys
[%vent ~] :: view ethereum events
[%vest ~] :: view public balance
[%vine ~] :: view secret history
$>(%wegh vane-task) :: memory usage request
$>(%west vane-task) :: remote request
[%wind p=@ud] :: rewind before block
== ::
-- ::
:: ::
:::: ::
:: ::
++ node-src :: ethereum node comms
$: node=purl:eyre :: node url
filter-id=@ud :: current filter
poll-timer=@da :: next filter poll
== ::
++ snapshot :: rewind point
=, azimuth-types ::
$: kyz=(map ship public:able) :: public key state
$= eth ::
$: dns=dnses :: on-chain dns state
pos=(map ship point) :: on-chain ship state
== ::
eth-bookmark
==
:: +eth-bookmark: cursor into the ethereum chain
::
++ eth-bookmark
$: heard=(set event-id:ethereum-types)
latest-block=@ud
==
:: +state-eth-node: state of a connection to an ethereum node
::
++ state-eth-node :: node config + meta
$: source=(each ship node-src) :: learning from
foreign-block=@ud :: node's latest block
eth-bookmark
== ::
:: ::
:::: ++pki:jael :: (1h2) certificates
:: ::::
++ pki ^?
|%
::TODO update to fit azimuth-style keys
:: the urbit meta-certificate (++will) is a sequence
:: of certificates (++cert). each cert in a will
:: revokes and replaces the previous cert. the
:: version number of a ship is a ++life.
::
:: the deed contains an ++arms, a definition
:: of cosmetic identity; a semi-trusted parent,
:: which signs the initial certificate and provides
:: routing services; and a dirty bit. if the dirty
:: bit is set, the new life of this ship may have
:: lost information that the old life had.
::
++ hand @uvH :: 128-bit hash
++ mind {who/ship lyf/life} :: key identifier
++ name (pair @ta @t) :: ascii / unicode
++ oath @ :: signature
-- :: pki
:: ::
:::: ++rights:jael :: (1h3) claims
:: ::::
++ rights ^?
=, pki
|%
:: %jael tracks promises (++rite) from ship to ship.
:: a rite may be any right, badge, asset, secret, etc.
:: un-shared secret or private asset is stored as a
:: rite from self to self.
::
:: each rite is really a class of rights, and often
:: has its own internal set or map structure.
::
:: present kinds of rite:
::
:: %apple: application secret for a web api.
:: %block: the promisee is banned.
:: %email: email tied to promissee's ship.
:: %final: ship/ticket pair, ready to launch.
:: %fungi: fungible, countable asset.
:: %guest: permission to adopt foreign child.
:: %hotel: block of unissued children.
:: %jewel: urbit private keys.
:: %login: user's login passcode.
:: %pword: password for a website/api.
:: %token: user access token for a web api.
:: %urban: symmetric key for urbit networking.
::
:: %fungi keys can be anything, but don't reuse
:: currency codes. codes for urbit invitations:
:: %ugl == galaxy, %usr == star, %upl == planet
::
:: you can think of [our her rite] as an rdf triple.
::
++ bill (pair @da @) :: expiring value
++ bump :: rights change
$: mor/safe :: add rights
les/safe :: lose rights
== ::
++ dorm (pair ship bloq) :: issuing group
++ pile (tree (pair @ @)) :: efficient ship set
++ rite :: urbit commitment
$% {$apple p/(map site @)} :: web api key
{$block ~} :: banned
{$email p/(set @t)} :: email addresses
{$final p/(map ship @pG)} :: ticketed ships
{$fungi p/(map term @ud)} :: fungibles
{$guest ~} :: refugee visa
{$hotel p/(map dorm pile)} :: reserved block
{$jewel p/(map life ring)} :: private keyring
{$login p/(set @pG)} :: login secret
{$pword p/(map site (map @t @t))} :: web passwd by user
{$token p/(map site (map @t @t))} :: app tokens by user
{$urban p/(map hand bill)} :: urbit symmetric keys
== ::
++ site (list @ta) :: [%com %yahoo %www ~]
++ safe (tree rite) :: rights set
-- :: rights
-- :: jael
:: ::::
:::: ++kale :: (1h) security
:: ::::
++ kale ^?
|%
:: ::
:::: ++able:kale :: (1h1) arvo moves
:: ::::
++ able ^?
=, pki
|%
:: %kale has two general kinds of task: changes
:: and change subscriptions.
::
:: change tasks are designed to match high-level
:: operations - for instance, we have %burn, %mint,
:: and %move, not just a single delta operation.
:: more of these operations will probably be added,
:: and invariants enforced at transaction end.
::
:: subscriptions are also user-focused - for instance,
:: %vein sends all the information needed to maintain
:: the secure channel, both rights and certificates.
:: the security-critical tasks (%veil, %vein, %vine)
:: should probably be bound to a whitelisted duct set.
:: (all secrets are redacted from %vest gifts.)
::
:: %kale only talks to %ames and itself.
::
++ block
=< block
@ -2378,13 +2159,17 @@
::
++ udiff-to-diff
|= [=a=udiff =a=point]
^- diff
^- (unit diff)
?- +<.a-udiff
%disavow ~|(%udiff-to-diff-disavow !!)
%rift [%rift rift.a-point rift.a-udiff]
%spon [%spon sponsor.a-point sponsor.a-udiff]
%spon `[%spon sponsor.a-point sponsor.a-udiff]
%rift
?: =(rift.a-udiff +(rift.a-point))
`[%rift rift.a-point rift.a-udiff]
~
::
%keys
:+ %keys
:^ ~ %keys
[life.a-point (~(gut by keys.a-point) life.a-point *[@ud pass])]
[life crypto-suite pass]:a-udiff
==
@ -2431,71 +2216,17 @@
a-point(sponsor to.diff)
==
--
::
+$ public-keys-result
$% [%full points=(map ship point)]
[%diff who=ship =diff:point]
==
:: ::
++ gift :: out result <-$
$% [%init p=ship] :: report install unix
[%mass p=mass] :: memory usage report
[%mack p=(unit tang)] :: message n/ack
[%source whos=(set ship) src=source] ::
[%turf turf=(list turf)] :: domains
[%private-keys =life vein=(map life ring)] :: private keys
[%public-keys =public-keys-result] :: ethereum changes
== ::
:: +seed: private boot parameters
::
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)]
::
+= task :: in request ->$
$~ [%vega ~] ::
$% $: %dawn :: boot from keys
=seed:able:kale :: identity params
spon=ship :: sponsor
czar=(map ship [=life =pass]) :: galaxy table
turf=(list turf) :: domains
bloq=@ud :: block number
node=(unit purl:eyre) :: gateway url
snap=(unit snapshot) :: head start
== ::
[%fake =ship] :: fake boot
[%listen whos=(set ship) =source] :: set ethereum source
::TODO %next for generating/putting new private key
[%nuke whos=(set ship)] :: cancel tracker from
[%private-keys ~] :: sub to privates
[%public-keys ships=(set ship)] :: sub to publics
[%sources ~]
[%meet =ship =life =pass] :: met after breach
[%snap snap=snapshot kick=?] :: load snapshot
[%turf ~] :: view domains
[%new-event =ship =udiff:point] :: update from app
$>(%vega vane-task) :: report upgrade
$>(%wegh vane-task) :: memory usage request
$>(%west vane-task) :: remote request
[%wind p=@ud] :: rewind before block
== ::
-- ::
:: ::
:::: ::
:: ::
+$ node-src :: ethereum node comms
$: node=purl:eyre :: node url
filter-id=@ud :: current filter
poll-timer=@da :: next filter poll
== ::
::
+$ source (each ship node-src)
+$ source (each ship term)
+$ source-id @udsourceid
+$ snapshot ~
::
:: +state-eth-node: state of a connection to an ethereum node
::
+$ state-eth-node :: node config + meta
$: yen=(set duct)
top-source-id=source-id
$: top-source-id=source-id
sources=(map source-id source)
sources-reverse=(map source source-id)
default-source=source-id
@ -2503,7 +2234,7 @@
ship-sources-reverse=(jug source-id ship)
== ::
:: ::
:::: ++pki:kale :: (1h2) certificates
:::: ++pki:jael :: (1h2) certificates
:: ::::
++ pki ^?
|%
@ -2525,7 +2256,7 @@
++ name (pair @ta @t) :: ascii / unicode
++ oath @ :: signature
-- :: pki
-- :: kale
-- :: jael
:: ::::
:::: ++xmas :: (1i) new network
:: ::::
@ -7732,7 +7463,6 @@
{$g gift:able:gall}
[%i gift:able:iris]
{$j gift:able:jael}
{$k gift:able:kale}
==
::
+$ unix-task :: input from unix
@ -7866,21 +7596,20 @@
:: # diffs
::
++ update
$% [%full ships=(map ship point) dns=dnses heard=events] ::TODO keys
$% [%full ships=(map ship point) dns=dnses heard=events]
[%difs dis=(list (pair event-id diff-azimuth))]
==
::
:: # constants
::
:: contract addresses
::TODO values below are for ropsten, update for mainnet
++ contracts
++ contracts mainnet-contracts
++ mainnet-contracts
|%
:: azimuth: data contract
::
++ azimuth 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb :: mainnet
:: ++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579 :: ropsten
:: ++ azimuth 0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381 :: local bridge
++ azimuth
0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb
::
++ linear-star-release
0x86cd.9cd0.992f.0423.1751.e376.1de4.5cec.ea5d.1801
@ -7897,6 +7626,17 @@
++ public 7.033.765
--
::
:: Testnet contract addresses
::
++ ropsten-contracts
|%
++ azimuth
0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579
::
++ launch 4.601.630
--
::
:: ++ azimuth 0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381 :: local bridge
:: hashes of ship event signatures
++ azimuth-events
|%
@ -9075,7 +8815,7 @@
`(cat 3 'gal-' (scot %ud gal))
:+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call 'getKeys(uint32)' [%uint gal]~)
(encode-call 'points(uint32)' [%uint gal]~)
[%number boq]
:: +point:give:dawn: Eth RPC for ship's contract state
::
@ -9136,7 +8876,7 @@
::
++ czar
|= rep=octs
^- (unit (map ship [=life =pass]))
^- (unit (map ship [=rift =life =pass]))
=/ jon=(unit json) (de-json:html q.rep)
?~ jon
~&([%czar-take-dawn %invalid-json] ~)
@ -9144,27 +8884,31 @@
((ar (ot id+so result+so ~)) u.jon)
?~ res
~&([%czar-take-dawn %invalid-response rep] ~)
=/ dat=(unit (list [who=ship enc=octs aut=octs sut=@ud rev=@ud]))
=/ dat=(unit (list [who=@p point:azimuth-types]))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%+ turn u.res
|= [id=@t result=@t]
^- [who=ship enc=octs aut=octs sut=@ud rev=@ud]
:- `@p`(slav %ud (rsh 3 4 id))
^- [who=ship point:azimuth-types]
=/ who `@p`(slav %ud (rsh 3 4 id))
:- who
%+ point-from-eth
who
:_ *deed:eth-noun
%+ decode-results
result
~[[%bytes-n 32] [%bytes-n 32] %uint %uint]
point:eth-type
?~ dat
~&([%bloq-take-dawn %invalid-galaxy-table] ~)
:- ~
%+ roll u.dat
|= $: [who=ship enc=octs aut=octs sut=@ud rev=@ud]
kyz=(map ship [=life =pass])
|= $: [who=ship =point:azimuth-types]
kyz=(map ship [=rift =life =pass])
==
^+ kyz
=/ pub=pass
(pass-from-eth enc aut sut)
(~(put by kyz) who [rev pub])
?~ net.point
kyz
(~(put by kyz) who [continuity-number life pass]:u.net.point)
:: +point:take:dawn: parse ship's contract state
::
++ point
@ -9229,56 +8973,6 @@
(~(put by tuf) q.i.dom p.i.dom)
$(dom t.dom)
--
:: |snap:dawn restore from snapshot
::
++ snap
!:
|%
:: +bloq:snap:dawn: extract block number
::
++ bloq
|= snap=snapshot:jael
^- (unit @ud)
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
latest-block.snap
:: +czar:snap:dawn: extract galaxy table
::
++ czar
|= snap=snapshot:jael
^- (unit (map ship [=life =pass]))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%- ~(gas by *(map ship [=life =pass]))
%+ turn (gulf 0 255)
|= gal=@
^- [ship [life pass]]
:- gal
~| czar-gal=gal
[life pass]:(need net:(~(got by pos.eth.snap) gal))
:: +point:snap:dawn: extract ship's contract state
::
++ point
|= [who=ship snap=snapshot:jael]
^- (unit point:azimuth)
(~(get by pos.eth.snap) who)
:: +turf:snap:dawn: extract network domains
::
++ turf
|= snap=snapshot:jael
^- (unit (list ^turf))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%+ murn
^- (list host:eyre)
%+ murn
^- (list @t)
~[pri sec ter]:dns.eth.snap
|= dom=@t
^- (unit host:eyre)
(rush dom thos:de-purl:html)
|=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a)))
--
:: +veri:dawn: validate keys, life, discontinuity, &c
::
++ veri
@ -9303,28 +8997,10 @@
[%& (^sein:title who.seed)]
::
%earl
:: a moon must be signed by the parent
::
?~ sig.seed
[%| %missing-sig]
:: the parent must be launched
::
?~ net.point
[%| %parent-not-keyed]
:: life must match parent's
::
?. =(lyf.seed life.u.net.point)
[%| %life-mismatch]
=/ loy (com:nu:crub:crypto pass.u.net.point)
=/ hax (shaf %earl (sham who.seed lyf.seed pub:ex:cub))
:: the signature must be valid
::
?. =((some hax) (sure:as:loy u.sig.seed))
[%| %invalid-sig]
:: XX revisit for rekey
::
?^ live
[%| %already-booted]
[%& (^sein:title who.seed)]
::
*

View File

@ -18,7 +18,7 @@
ames-gate
now=~1234.5.6
call-args=[duct type=*type %soft %init ~nul]
expected-moves=[[duct %pass wire %j %vein ~] [duct %pass / %j %turf ~] ~]
expected-moves=[[duct %pass wire %j %private-keys ~] [duct %pass / %j %turf ~] ~]
==
::
results1
@ -56,7 +56,7 @@
%: ames-take
ames-gate
now
take-args=[wire duct -:!>([%j %vein vein-data]) [%j %vein vein-data]]
take-args=[wire duct -:!>([%j %private-keys vein-data]) [%j %private-keys vein-data]]
expected-moves=~
==
::
@ -67,7 +67,7 @@
ames-gate
now
call-args=[duct type=*type %soft [%want ~nul /foo 1]]
:~ [duct %pass /pubs/~nul %j %pubs ~nul]
:~ [duct %pass /pubs/~nul %j %public-keys (silt ~nul ~)]
[duct %give %send *lane:ames pact1]
:: XX why ~s4 ??
::

View File

@ -208,12 +208,11 @@
%give
%response
%start
:- 404
:~ ['content-type' 'text/html']
['content-length' '156']
==
::
%+ complete-http-start-event
:- 404
['content-type' 'text/html']~
[~ (error-page:http-server-gate 404 %.n '/' ~)]
complete=%.y
== ==
==
::
@ -384,12 +383,11 @@
^= expected-move
:~ :* duct=~[/http-blah] %give %response
%start
:- 500
:~ ['content-type' 'text/html']
['content-length' '180']
==
::
%+ complete-http-start-event
:- 500
['content-type' 'text/html']~
[~ (internal-server-error:http-server-gate %.n '/' ~)]
complete=%.y
== == ==
::
;: weld
@ -736,14 +734,13 @@
==
^= expected-move
:~ :* duct=~[/http-blah] %give %response
:* %start
:- 200
:~ ['content-type' 'text/plain']
['content-length' '13']
==
`[13 'one two three']
%.y
== == == ==
%start
::
%+ complete-http-start-event
:- 200
['content-type' 'text/plain']~
`[13 'one two three']
== == ==
::
;: weld
results1
@ -870,11 +867,10 @@
%give
%response
%start
:- 403
:~ ['content-type' 'text/html']
['content-length' '182']
==
::
%+ complete-http-start-event
:- 403
['content-type' 'text/html']~
:- ~
%- error-page:http-server-gate :*
403
@ -882,8 +878,6 @@
'/~/channel/1234567890abcdef'
~
==
::
complete=%.y
== ==
==
::
@ -2050,12 +2044,11 @@
%give
%response
%start
:- 200
:~ ['content-type' 'text/html']
['content-length' '1752']
==
::
%+ complete-http-start-event
:- 200
['content-type' 'text/html']~
[~ (login-page:http-server-gate `'/~landscape/inner-path' ~nul)]
complete=%.y
== ==
==
:: a response post redirects back to the application, setting cookie
@ -2201,4 +2194,12 @@
:: This is the default code for a fakeship.
::
[~ ~ %noun !>(.~lidlut-tabwed-savheb-loslux)]
:: produce the body of a %start http-event with the correct content-length
::
++ complete-http-start-event
|= [response-header:http data=(unit octs)]
=- [[status-code -] data %.y]
?~ data headers
%+ weld headers
['content-length' (crip ((d-co:co 1) p.u.data))]~
--

View File

@ -1,159 +0,0 @@
/+ *test
::
/= jael-raw /: /===/sys/vane/jael
/!noun/
=/ type-spear -:!>(jael-raw)
::
=/ test-pit=vase !>(.)
=/ jael-gate (jael-raw test-pit)
::
|%
:: tests that booting into %jael inits other vanes
::
++ test-boot-dawn
:: +key ~nul
=/ key=ring
0w8O.k5Ry4.QsKQq.1k~uj.DBOU4.numfq.nXOwa.cSk7B.VcHVm.
-8~kX.3ALiG.rQjOi.HZ9hj.84b6G.P5pCZ.UtNtt.Lh9TE.2DQJ2
=/ url (de-purl:html 'http://localhost:8545')
=/ dan
[`seed:able:jael`[~nul 1 key ~] ~nul ~ [/org/urbit ~] 0 url ~]
::
=^ results1 jael-gate
=/ hen=duct
[/ /term/1 / ~]
%- jael-call
:* jael-gate
now=~1234.5.6
call-args=[hen type=*type %dawn dan]
:~ [hen %slip %a %init ~nul]
[hen %slip %c %init ~nul]
[hen %slip %g %init ~nul]
[hen %slip %d %init ~nul]
[hen %slip %e %init ~nul]
[hen %give %init ~nul]
[hen %pass /~nul/init %b %wait +(~1234.5.6)]
== ==
::
=^ results2 jael-gate
=/ wir=wire
/our/~nul/now/(scot %da (add ~s1 ~1234.5.6))
%- jael-call-with-comparator :*
jael-gate
now=(add ~s1 ~1234.5.6)
call-args=[duct=[/ /term/1 wir ~] type=*type %vein ~]
^= comparator
|= moves=(list move:jael-gate)
;: weld
%+ expect-eq
!> 1
!> (lent moves)
::
%+ expect-eq
!> [%give %vein 1 (my [1 key] ~)]
!> q:(head moves)
== ==
::
=^ results3 jael-gate
::
=/ request=request:http
%+ light-json-request:rpc:ethereum
(need url)
%+ request-to-json:rpc:ethereum
`'block number'
[%eth-block-number ~]
::
%- jael-take-with-comparator :*
jael-gate
now=(add ~s2 ~1234.5.6)
take-args=[wire=/~nul/init duct=[/ /term/1 ~] type=*type %b %wake ~]
^= comparator
|= moves=(list move:jael-gate)
?> ?=(^ moves)
?> ?=([* %pass * %i %request *] i.moves)
;: weld
%+ expect-eq
!> 1
!> (lent moves)
::
%+ expect-eq
!> request
!> request.q.q.i.moves
== ==
::
:(weld results1 results2 results3)
::
++ jael-call
|= $: jael-gate=_jael-gate
now=@da
call-args=[=duct wrapped-task=(hypo (hobo task:able:jael-gate))]
expected-moves=(list move:jael-gate)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- call:jael call-args
::
=/ output=tang
%+ expect-eq
!> expected-moves
!> moves
::
[output jael-gate]
::
++ jael-call-with-comparator
|= $: jael-gate=_jael-gate
now=@da
call-args=[=duct wrapped-task=(hypo (hobo task:able:jael-gate))]
move-comparator=$-((list move:jael-gate) tang)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- call:jael call-args
::
=/ output=tang (move-comparator moves)
::
[output jael-gate]
::
++ jael-take
|= $: jael-gate=_jael-gate
now=@da
take-args=[=wire =duct wrapped-task=(hypo sign:jael-gate)]
expected-moves=(list move:jael-gate)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- take:jael take-args
::
=/ output=tang
%+ expect-eq
!> expected-moves
!> moves
::
[output jael-gate]
::
++ jael-take-with-comparator
|= $: jael-gate=_jael-gate
now=@da
take-args=[=wire =duct wrapped-task=(hypo sign:jael-gate)]
move-comparator=$-((list move:jael-gate) tang)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- take:jael take-args
::
=/ output=tang (move-comparator moves)
::
[output jael-gate]
--

View File

@ -28,25 +28,6 @@
%- crip
%+ weld "0x"
(render-hex-bytes:ethereum 20 `@`azimuth:contracts:^azimuth)
:: snapshot
::
++ snap
=| =snapshot:jael
%_ snapshot
kyz ~
::
dns.eth
['urbit.org' 'urbit.org' '']
::
pos.eth
%- malt
:* ~zod^pot
~marzod^pot
(turn (gulf 1 255) |=(gal=@ gal^pot))
==
::
latest-block 4.230.000
==
::
++ test-give-bloq
=/ oct
@ -116,16 +97,34 @@
'3defb87516f42ce4327820b588002aa53e52527af8d23bee4aa215fa296bdf5f'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000002'
'"},{"id":"gal-1","jsonrpc":"2.0","result":"'
'0xb727e38d031162e50913b2e37a2e29d4ba457eff4f7fd4ac47dc68fcb54260d3'
'b8bfe4789483c171f7fa359438cdcc8d268d40fe08d6c1d8b36267748d2139f8'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000003'
'"},{"id":"gal-2","jsonrpc":"2.0","result":"'
'0x0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000004'
'"}]'
==
=/ kyz
@ -139,8 +138,8 @@
823.313.739.767.009.446.819.531.923.255.637.798.148.055.143.938.146
%+ expect-eq
!> :- ~
%- ~(gas by *(map ship [=life =pass]))
[[~zod 1 zod.kyz] [~nec 1 nec.kyz] [~bud 0 'b'] ~]
%- ~(gas by *(map ship [=rift =life =pass]))
[[~zod 2 1 zod.kyz] [~nec 3 1 nec.kyz] [~bud 4 1 'b'] ~]
!> (czar:take:dawn oct)
::
++ test-take-point
@ -186,26 +185,6 @@
!> [~ [/org/urbit ~]]
!> (turf:take:dawn oct)
::
++ test-snap-bloq
%+ expect-eq
!> [~ 4.230.000]
!> (bloq:snap:dawn snap)
::
++ test-snap-point
%+ expect-eq
!> [~ pot]
!> (point:snap:dawn ~zod snap)
::
++ test-snap-czar
%+ expect-eq
!> 256
!> ~(wyt by (need (czar:snap:dawn snap)))
::
++ test-snap-turf
%+ expect-eq
!> [~ `(list turf)`~[~['org' 'urbit'] ~['org' 'urbit']]]
!> (turf:snap:dawn snap)
::
++ test-veri-good
=/ sed [~zod 1 sec ~]
%+ expect-eq
@ -254,15 +233,6 @@
!> [%& (^sein:title who)]
!> (veri:dawn sed pot ~)
::
++ test-veri-earl-missing-sig
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
=/ sed
[who 1 sec:ex:cub ~]
%+ expect-eq
!> [%| %missing-sig]
!> (veri:dawn sed pot ~)
::
++ test-veri-earl-parent-not-keyed
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
@ -275,53 +245,6 @@
!> [%| %parent-not-keyed]
!> (veri:dawn sed =>(pot .(net ~)) ~)
::
++ test-veri-earl-life-mismatch
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
=/ sed
=/ sig
%- sign:as:(nol:nu:crub:crypto sec)
(shaf %earl (sham who 1 pub:ex:cub))
[who 2 sec:ex:cub `sig]
%+ expect-eq
!> [%| %life-mismatch]
!> (veri:dawn sed pot ~)
::
++ test-veri-earl-invalid-sig
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
;: weld
=/ sed
=/ sig
%- sign:as:cub
(shaf %earl (sham who 1 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%| %invalid-sig]
!> (veri:dawn sed pot ~)
::
=/ sed
=/ sig
%- sign:as:(nol:nu:crub:crypto sec)
(shaf %earl (sham who 2 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%| %invalid-sig]
!> (veri:dawn sed pot ~)
==
::
++ test-veri-earl-already-booted
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
=/ sed
=/ sig
%- sign:as:(nol:nu:crub:crypto sec)
(shaf %earl (sham who 1 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%| %already-booted]
!> (veri:dawn sed pot `[1 |])
::
++ test-veri-pawn-good
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who=ship `@`fig:ex:cub

View File

@ -88,6 +88,14 @@ h2 {
font-weight: bold;
}
.fs-italic {
font-style: italic;
}
.td-underline {
text-decoration: underline;
}
.bg-v-light-gray {
background-color: #f9f9f9;
}
@ -116,6 +124,16 @@ h2 {
-webkit-box-orient: vertical;
}
.clamp-message {
max-width: calc(100% - 36px - 1.5rem);
}
.clamp-attachment {
overflow: scroll;
max-height: 10em;
max-width: 100%;
}
.lh-16 {
line-height: 16px;
}

View File

@ -226,8 +226,8 @@ export class ChatScreen extends Component {
numPeers={peers.length} />
</div>
<div
className="overflow-y-scroll pt3 flex flex-column-reverse"
style={{ height: 'calc(100% - 157px)' }}
className="overflow-y-scroll pt3 pb2 flex flex-column-reverse"
style={{ height: 'calc(100% - 157px)', resize: 'vertical' }}
onScroll={this.onScroll}>
<div ref={ el => { this.scrollElement = el; }}></div>
{chatMessages}

View File

@ -54,7 +54,9 @@ export class ChatInput extends Component {
setTimeout(closure, 2000);*/
this.state = {
message: ""
message: '',
messageType: 'lin',
clipboard: null
};
this.textareaRef = React.createRef();
@ -100,22 +102,165 @@ export class ChatInput extends Component {
}
messageChange(event) {
this.setState({message: event.target.value});
const input = event.target.value;
const previous = this.state.message;
//NOTE dumb hack to work around paste event flow oddities
const pasted = (previous.length === 0 && input.length > 1);
if (input !== this.state.clipboard) {
this.setState({
message: input,
messageType: this.getSpeechType(input),
clipboard: (pasted ? input : null)
});
}
}
getSpeechType(input) {
if (input[0] === '#') {
return 'exp';
} else if (input.indexOf('\n') >= 0) {
return 'fat';
} else if (input[0] === '@') {
return 'lin@';
} else if (this.isUrl(input)) {
return 'url';
} else {
return 'lin';
}
}
getSpeechStyle(type, clipboard) {
switch (type) {
case 'lin@':
return 'fs-italic';
case 'url':
return 'td-underline';
case 'exp':
return 'code';
case 'fat':
if (clipboard) return 'code';
default:
return '';
}
}
isUrl(string) {
try {
const urlObject = new URL(string);
//NOTE we check for a host to ensure a url is actually being posted
// to combat false positives for things like "marzod: ur cool".
// this does mean you can't send "mailto:e@ma.il" as %url message,
// but the desirability of that seems questionable anyway.
return (urlObject.host !== '');
} catch (e) {
return false;
}
}
// turns select urls into arvo:// urls
//
// we detect app names from the url. if the app is known to handle requests
// for remote data (instead of serving only from the host) we transfor the
// url into a generic arvo:// one.
// the app name format is pretty distinct and rare to find in the non-urbit
// wild, but this could still result in false positives for older-school
// websites serving pages under /~user paths.
// we could match only on ship.arvo.network, but that would exclude those
// running on localhost or under a custom domain.
//
//
globalizeUrl(url) {
const urlObject = new URL(url);
const app = urlObject.pathname.split('/')[1];
if (app === '~chat' ||
app === '~publish') {
//TODO send proper url speeches once hall starts using a url type that
// supports non-http protocols.
return { lin: {
msg: 'arvo://' + url.slice(urlObject.origin.length),
pat: false
} };
} else {
return {url};
}
}
speechFromInput(content, type, clipboard) {
switch (type) {
case 'lin':
return { lin: {
msg: content,
pat: false
} };
//
case 'lin@':
return { lin: {
msg: content.slice(1),
pat: true
} };
//
case 'url':
return this.globalizeUrl(content);
//
case 'exp':
// remove leading #
content = content.slice(1);
// remove insignificant leading whitespace.
// aces might be relevant to style.
while (content[0] === '\n') {
content = content.slice(1);
}
return { exp: {
exp: content
} };
//
case 'fat':
// clipboard contents
if (clipboard !== null) {
return { fat: {
sep: { lin: { msg: '', pat: false } },
tac: { name: {
nom: 'clipboard',
tac: { text: content }
} }
} };
// long-form message
} else {
const lines = content.split('\n');
return { fat: {
sep: { lin: {
msg: lines[0],
pat: false
} },
tac: { name: {
nom: 'long-form',
tac: { text: lines.slice(1).join('\n') }
} },
} };
}
//
default:
throw new Error('Unimplemented speech type', type);
}
}
messageSubmit() {
const { props, state } = this;
if (state.message === '') {
return;
}
let message = {
uid: uuid(),
aut: window.ship,
wen: Date.now(),
aud: [props.station],
sep: {
lin: {
msg: state.message,
pat: false
}
}
sep: this.speechFromInput(
state.message,
state.messageType,
state.clipboard
)
};
props.api.hall(
@ -125,7 +270,8 @@ export class ChatInput extends Component {
);
this.setState({
message: ""
message: '',
messageType: 'lin'
});
}
@ -151,7 +297,7 @@ export class ChatInput extends Component {
}
return (
<div className="mt2 pa3 cf flex black bt b--black-30">
<div className="pa3 cf flex black bt b--black-30" style={{ flexGrow: 1 }}>
<div className="fl" style={{
marginTop: 4,
flexBasis: 32,
@ -159,9 +305,12 @@ export class ChatInput extends Component {
}}>
<Sigil ship={window.ship} size={32} />
</div>
<div className="fr h-100 flex" style={{ flexGrow: 1, height: 40 }}>
<input className="ml2 bn"
style={{ flexGrow: 1, height: 40 }}
<div className="fr h-100 flex" style={{ flexGrow: 1 }}>
<textarea
className={'ml2 mt2 mr2 bn ' +
this.getSpeechStyle(state.messageType, state.clipboard)
}
style={{ flexGrow: 1, height: 40, resize: 'none' }}
ref={this.textareaRef}
placeholder={props.placeholder}
value={state.message}

View File

@ -5,62 +5,168 @@ import moment from 'moment';
import _ from 'lodash';
export class Message extends Component {
renderMessage(content) {
renderSpeech(speech) {
if (_.has(speech, 'lin')) {
return this.renderLin(speech.lin.msg, speech.lin.pat);
} else if (_.has(speech, 'url')) {
return this.renderUrl(speech.url);
} else if (_.has(speech, 'exp')) {
return this.renderExp(speech.exp.exp, speech.exp.res);
} else if (_.has(speech, 'ire')) {
return this.renderSpeech(speech.ire.sep);
} else if (_.has(speech, 'app')) {
return this.renderSpeech(speech.app.sep);
} else if (_.has(speech, 'fat')) {
return this.renderFat(speech.fat.sep, speech.fat.tac);
} else {
return this.renderUnknown();
}
}
renderUnknown() {
return this.renderLin('<unknown message type>')
}
renderLin(content, action = false) {
if (content === '') {
return null;
}
//TODO remove once arvo:// urls are supported in url speeches
if (content.indexOf('arvo://') === 0) {
return this.renderUrl(content);
}
return (
<p className="body-regular-400 v-top">
<p className={`body-regular-400 v-top ${action ? 'fs-italic' : ''}`}>
{content}
</p>
);
}
renderContent() {
const { props } = this;
let content = _.get(
props.msg,
'sep.lin.msg',
'<unknown message type>'
);
renderUrl(url) {
try {
let url = new URL(content);
let imgMatch =
let urlObject = new URL(url);
let imgMatch =
/(jpg|img|png|gif|tiff|jpeg|JPG|IMG|PNG|TIFF|GIF|webp|WEBP|webm|WEBM)$/
.exec(
url.pathname
urlObject.pathname
);
if (imgMatch) {
return (
<img
src={content}
style={{
width:"50%",
maxWidth: '250px'
}}
></img>
)
return this.renderImageUrl(url);
} else {
let url = this.urlTransmogrifier(content);
return (
<a className="body-regular"
href={url}
target="_blank">{url}</a>
)
let localUrl = this.localizeUrl(url);
return this.renderAnchor(localUrl, url);
}
} catch(e) {
return this.renderMessage(content);
console.error('url render error', e);
return this.renderAnchor(url);
}
}
urlTransmogrifier(url) {
if (typeof url !== 'string') { throw 'Only transmogrify strings!'; }
const ship = window.ship;
if (url.indexOf('arvo://') === 0) {
return url.split('arvo://')[1];
renderImageUrl(url) {
return this.renderAnchor(url, (
<img
src={url}
style={{
width:"50%",
maxWidth: '250px'
}}
></img>
));
}
renderAnchor(href, content) {
content = content || href;
return (
<a className="body-regular"
href={href}
target="_blank">{content}</a>
);
}
renderExp(expression, result) {
return (<>
<p>
<pre className="clamp-attachment pa1 mt0 mb0 bg-light-gray">
{expression}
</pre>
<pre className="clamp-attachment pa1 mt0 mb0">
{result[0].join('\n')}
</pre>
</p>
</>);
}
renderFat(speech, attachment) {
return (<>
{this.renderSpeech(speech)}
{this.renderAttachment(attachment)}
</>);
}
renderAttachment(content, title = '') {
if (_.has(content, 'name')) {
return this.renderAttachment(content.name.tac, content.name.nom);
}
return (<details>
<summary className="inter fs-italic">{'Attached: ' + title}</summary>
{ _.has(content, 'text')
? (title === 'long-form')
? this.renderParagraphs(content.text.split('\n'))
: this.renderPlaintext(content.text)
: _.has(content, 'tank')
? this.renderPlaintext(content.tank.join('\n'))
: null
}
</details>);
}
renderParagraphs(paragraphs) {
return (<div className="clamp-attachment">
{paragraphs.map(p => (<p className="mt2">{p}</p>))}
</div>);
}
renderPlaintext(text) {
return (<pre className="clamp-attachment">{text}</pre>);
}
renderContent() {
const { props } = this;
try {
if (!_.has(props.msg, 'sep')) {
return this.renderUnknown();
}
return this.renderSpeech(props.msg.sep);
} catch (e) {
console.error('speech rendering error', e);
return this.renderUnknown();
}
}
renderAuthor() {
const msg = this.props.msg;
const ship = '~' + msg.aut;
if (_.has(msg, 'sep.app.app')) {
return `:${msg.sep.app.app} (${ship})`;
} else {
return ship;
}
}
//NOTE see also lib/chat-input's globalizeUrl
localizeUrl(url) {
if (typeof url !== 'string') { throw 'Only localize strings!'; }
const arvo = 'arvo://';
if (url.indexOf(arvo) === 0) {
// this application is being served by an urbit also, so /path will
// point to the arvo url as hosted by this same urbit.
return url.slice(arvo.length);
} else {
return url;
}
return url;
}
render() {
@ -82,10 +188,10 @@ export class Message extends Component {
<div className="fl mr2">
<Sigil ship={props.msg.aut} size={36} />
</div>
<div className="fr" style={{ flexGrow: 1, marginTop: -8 }}>
<div className="fr clamp-message" style={{ flexGrow: 1, marginTop: -8 }}>
<div className="hide-child">
<p className="v-top label-small-mono gray dib mr3">
~{props.msg.aut}
{this.renderAuthor()}
</p>
<p className="v-top label-small-mono gray dib">{timestamp}</p>
<p className="v-top label-small-mono ml2 gray dib child">
@ -105,12 +211,11 @@ export class Message extends Component {
minHeight: 'min-content'
}}>
<p className="child pl3 pr2 label-small-mono gray dib">{timestamp}</p>
<div className="fr" style={{ flexGrow: 1 }}>
<div className="fr clamp-message" style={{ flexGrow: 1 }}>
{this.renderContent()}
</div>
</div>
)
}
}
}

View File

@ -61,7 +61,7 @@ export class Root extends Component {
let internalStation = host + '/hall-internal-' + circle;
if (internalStation in state.configs) {
unreads[cir] =
unreads[cir] =
state.configs[internalStation].red <=
messages[cir][messages[cir].length - 1].num;
} else {
@ -87,6 +87,18 @@ export class Root extends Component {
inviteConfig = configs[`~${window.ship}/i`];
}
const renderChannelsSidebar = (props) => (
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
);
return (
<BrowserRouter>
<div>
@ -94,17 +106,7 @@ export class Root extends Component {
render={ (props) => {
return (
<Skeleton
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
sidebar={renderChannelsSidebar(props)}>
<div className="w-100 h-100 fr" style={{ flexGrow: 1 }}>
<div className="dt w-100 h-100">
<div className="dtc center v-mid w-100 h-100 bg-white">
@ -119,18 +121,8 @@ export class Root extends Component {
return (
<Skeleton
spinner={this.state.spinner}
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
<NewScreen
sidebar={renderChannelsSidebar(props)}>
<NewScreen
setSpinner={this.setSpinner}
api={api}
circles={circles}
@ -143,17 +135,7 @@ export class Root extends Component {
render={ (props) => {
return (
<Skeleton
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
sidebar={renderDefaultSidebar(props)}>
<LandingScreen
api={api}
configs={configs}
@ -164,24 +146,14 @@ export class Root extends Component {
}} />
<Route exact path="/~chat/:ship/:station"
render={ (props) => {
let station =
let station =
props.match.params.ship
+ "/" +
props.match.params.station;
let messages = state.messages[station] || [];
return (
<Skeleton
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
sidebar={renderChannelsSidebar(props) }>
<ChatScreen
api={api}
configs={configs}
@ -197,19 +169,9 @@ export class Root extends Component {
render={ (props) => {
return (
<Skeleton
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
sidebar={renderChannelsSidebar(props) }>
<MemberScreen
{...props}
{...props}
api={api}
peers={state.peers}
/>
@ -221,18 +183,8 @@ export class Root extends Component {
return (
<Skeleton
spinner={this.state.spinner}
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
<SettingsScreen
sidebar={renderChannelsSidebar(props) }>
<SettingsScreen
{...props}
setSpinner={this.setSpinner}
api={api}

View File

@ -83,6 +83,30 @@ export class Sidebar extends Component {
this.props.history.push('/~chat/new');
}
summarizeMessage(speech) {
const fallback = '...';
if (_.has(speech, 'lin')) {
return speech.lin.msg;
} else if (_.has(speech, 'url')) {
return speech.url;
} else if (_.has(speech, 'exp')) {
return '# ' + speech.exp.exp;
} else if (_.has(speech, 'ire')) {
return this.summarizeMessage(speech.ire.sep);
} else if (_.has(speech, 'app')) {
return this.summarizeMessage(speech.app.sep);
} else if (_.has(speech, 'fat')) {
const msg = this.summarizeMessage(speech.fat.sep);
if (msg !== '' && msg !== fallback) return msg;
return 'Attachment' +
(_.has(speech, 'fat.tac.name.nom')
? ': ' + speech.fat.tac.name.nom
: '');
} else {
return fallback;
}
}
render() {
const { props, state } = this;
let station = props.match.params.ship + '/' + props.match.params.station;
@ -93,7 +117,9 @@ export class Sidebar extends Component {
})
.map((cir) => {
let msg = props.messagePreviews[cir];
let content = _.get(msg, 'gam.sep.lin.msg', 'No messages yet');
let content = _.has(msg, 'gam.sep')
? this.summarizeMessage(msg.gam.sep)
: 'No messages yet';
let aut = !!msg ? msg.gam.aut : '';
let wen = !!msg ? msg.gam.wen : 0;
let datetime =

View File

@ -23,6 +23,12 @@ pre {
background-color: #f9f9f9;
}
code {
padding: 8px;
background-color: #f9f9f9;
white-space: pre-wrap;
}
a {
color: inherit;
text-decoration: inherit;

View File

@ -75,7 +75,6 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.can = c3n;
u3_Host.ops_u.dem = c3n;
u3_Host.ops_u.dry = c3n;
u3_Host.ops_u.etn = c3n;
u3_Host.ops_u.gab = c3n;
u3_Host.ops_u.git = c3n;
@ -95,7 +94,7 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.kno_w = DefaultKernel;
while ( -1 != (ch_i=getopt(argc, argv,
"G:J:B:K:A:H:I:w:u:e:E:f:F:k:m:p:LjabcCdgqstvxPDRS")) )
"G:J:B:K:A:H:I:w:u:e:E:f:F:k:p:LjabcCdgqsvxPDRS")) )
{
switch ( ch_i ) {
case 'J': {
@ -164,10 +163,6 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.key_c = strdup(optarg);
break;
}
case 'm': {
u3_Host.ops_u.sap_c = strdup(optarg);
break;
}
case 'p': {
if ( c3n == _main_readw(optarg, 65536, &arg_w) ) {
return c3n;
@ -192,7 +187,6 @@ _main_getopt(c3_i argc, c3_c** argv)
case 'v': { u3_Host.ops_u.veb = c3y; break; }
case 's': { u3_Host.ops_u.git = c3y; break; }
case 'S': { u3_Host.ops_u.has = c3y; break; }
case 't': { u3_Host.ops_u.etn = c3y; break; }
case '?': default: {
return c3n;
}
@ -298,24 +292,6 @@ _main_getopt(c3_i argc, c3_c** argv)
return c3n;
}
if ( u3_Host.ops_u.nuu != c3y && u3_Host.ops_u.sap_c != 0 ) {
fprintf(stderr, "-m only makes sense when bootstrapping a new instance\n");
return c3n;
}
if ( u3_Host.ops_u.fak_c != 0 && u3_Host.ops_u.sap_c != 0 ) {
fprintf(stderr, "-m and -F cannot be used together\n");
return c3n;
}
if ( u3_Host.ops_u.ets_c != 0 && u3_Host.ops_u.sap_c != 0 ) {
fprintf(stderr, "-m and -E cannot be used together\n");
return c3n;
}
if ( u3_Host.ops_u.can == c3y && u3_Host.ops_u.sap_c != 0 ) {
fprintf(stderr, "-m and -C cannot be used together\n");
return c3n;
}
if ( u3_Host.ops_u.can == c3y && u3_Host.ops_u.ets_c != 0 ) {
fprintf(stderr, "-C and -E cannot be used together\n");
return c3n;
@ -325,12 +301,6 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.eth_c = "http://eth-mainnet.urbit.org:8545";
}
if ( u3_Host.ops_u.sap_c == 0 && u3_Host.ops_u.can == c3n ) {
u3_Host.ops_u.sap_c =
"https://bootstrap.urbit.org/urbit-" URBIT_VERSION ".snap";
}
if ( u3_Host.ops_u.url_c != 0 && u3_Host.ops_u.pil_c != 0 ) {
fprintf(stderr, "-B and -u cannot be used together\n");
return c3n;

View File

@ -298,6 +298,7 @@
# define c3__delc c3_s4('d','e','l','c')
# define c3__delt c3_s4('d','e','l','t')
# define c3__dept c3_s4('d','e','p','t')
# define c3__dext c3_s4('d','e','x','t')
# define c3__dgdp c3_s4('d','g','d','p')
# define c3__dgkt c3_s4('d','g','k','t')
# define c3__dgnp c3_s4('d','g','n','p')

View File

@ -229,7 +229,6 @@
u3_noun u3gfu_busk(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_buss(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_bust(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_conk(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_crop(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_cull(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
u3_noun u3gfu_duck(u3_noun, u3_noun);

View File

@ -247,44 +247,4 @@
# define u3qfu_van_vet 118
# define u3qfu_van_fab 119
u3_noun u3qfu_burn(u3_noun, u3_noun);
u3_noun u3qfu_busk(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_buss(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_bust(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_conk(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_crop(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_cull(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
u3_noun u3qfu_duck(u3_noun, u3_noun);
u3_noun u3qfu_dung(u3_noun, u3_noun cap, u3_noun);
u3_noun u3qfu_dunq(u3_noun, const c3_c*, u3_noun);
void u3qfu_dump(u3_noun, const c3_c*, u3_noun);
u3_noun u3qfu_fond(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_find(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_finc(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_fink(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_fire(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_firm(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_fish(u3_noun, u3_noun, u3_atom);
u3_noun u3qfu_fuse(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_gain(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_heal(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_lose(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_mint(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_mull(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_nest(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_nost(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_orth(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_peek(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_peel(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_play(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_repo(u3_noun, u3_noun);
u3_noun u3qfu_rest(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_shep(u3_noun, const c3_c*, u3_noun, u3_noun);
u3_noun u3qfu_shew(u3_noun, u3_noun);
u3_noun u3qfu_sift(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_snub(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_tack(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_toss(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_wrap(u3_noun, u3_noun, u3_noun);
void u3qf_test(const c3_c*, u3_noun);

View File

@ -269,29 +269,17 @@
u3_noun u3wfp_open(u3_noun);
u3_noun u3wfp_rake(u3_noun);
u3_noun u3wfu_burn(u3_noun);
u3_noun u3wfu_busk(u3_noun);
u3_noun u3wfu_bust(u3_noun);
u3_noun u3wfu_conk(u3_noun);
u3_noun u3wfu_crop(u3_noun);
u3_noun u3wfu_cull(u3_noun);
u3_noun u3wfu_duck(u3_noun);
u3_noun u3wfu_find(u3_noun);
u3_noun u3wfu_fond(u3_noun);
u3_noun u3wfu_fink(u3_noun);
u3_noun u3wfu_fire(u3_noun);
u3_noun u3wfu_firm(u3_noun);
u3_noun u3wfu_fish(u3_noun);
u3_noun u3wfu_fuse(u3_noun);
u3_noun u3wfu_heal(u3_noun);
u3_noun u3wfu_mint(u3_noun);
u3_noun u3wfu_mull(u3_noun);
u3_noun u3wfu_nest(u3_noun);
u3_noun u3wfu_nest_dext(u3_noun);
u3_noun u3wfu_peek(u3_noun);
u3_noun u3wfu_peel(u3_noun);
u3_noun u3wfu_play(u3_noun);
u3_noun u3wfu_repo(u3_noun);
u3_noun u3wfu_rest(u3_noun);
u3_noun u3wfu_snub(u3_noun);
u3_noun u3wfu_toss(u3_noun);
u3_noun u3wfu_wrap(u3_noun);

View File

@ -249,7 +249,6 @@
u3_noun u3yfu_burn(u3_noun);
u3_noun u3yfu_busk(u3_noun);
u3_noun u3yfu_bust(u3_noun);
u3_noun u3yfu_conk(u3_noun);
u3_noun u3yfu_crop(u3_noun);
u3_noun u3yfu_cull(u3_noun);
u3_noun u3yfu_duck(u3_noun);

View File

@ -563,14 +563,12 @@
c3_w kno_w; // -K, kernel version
c3_c* key_c; // -k, private key file
c3_o net; // -L, local-only networking
c3_c* sap_c; // -m, eth snapshot url
c3_o pro; // -P, profile
c3_s por_s; // -p, ames port
c3_o qui; // -q, quiet
c3_o rep; // -R, report build info
c3_o has; // -S, Skip battery hashes
c3_o git; // -s, pill url from arvo git hash
c3_o etn; // -t, trust snapshot for pre-boot
c3_c* url_c; // -u, pill url
c3_o vno; // -V, replay without reboots
c3_o veb; // -v, verbose (inverse of -q)

View File

@ -1,101 +0,0 @@
/* j/6/ut.c
**
*/
#include "all.h"
#if 0
extern void
u3_pier_tank(c3_l tab_l, c3_w pri_w, u3_noun tac);
#endif
// duck: create a duck core for mean.
//
u3_noun
u3qfu_duck(u3_noun van,
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun ret = u3j_cook("u3qfu_duck-dune", u3k(von), "dune");
u3z(von);
return ret;
}
// dung: create a dunk core for mean (noun caption)
//
u3_noun
u3qfu_dung(u3_noun van,
u3_noun paz,
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun duq = u3j_cook("u3qfu_dung-dunk", u3k(von), "dunk");
u3_noun ret = u3i_molt(u3k(duq), u3x_sam, u3k(paz), 0);
u3z(duq);
u3z(von);
return ret;
}
// dunq: create a dunk core for mean
//
u3_noun
u3qfu_dunq(u3_noun van,
const c3_c* paz_c,
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun duq = u3j_cook("u3qfu_dunq-dunk", u3k(von), "dunk");
u3_noun paz = u3i_string(paz_c);
u3_noun ret = u3i_molt(u3k(duq), u3x_sam, u3k(paz), 0);
u3z(paz);
u3z(duq);
u3z(von);
return ret;
}
// dump: dump a type.
//
void
u3qfu_dump(u3_noun van,
const c3_c* paz_c,
u3_noun typ)
{
c3_c* pfix_c = u3r_string((c3y == u3du(typ)) ? u3h(typ) : typ);
c3_c ugh_c[1024];
sprintf(ugh_c, "%s: %s: 0x%8x:",
paz_c, pfix_c, u3r_mug(typ));
#if 0
u3_pier_tank(0, 0, u3n_kick_on(u3qfu_dunq(van, ugh_c, typ)));
#endif
}
// shew: create a show core for mean
//
u3_noun
u3qfu_shew(u3_noun van,
u3_noun mol)
{
u3_noun sho = u3j_cook("u3qfu_shew-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(sho);
u3z(mol);
return ret;
}
// shep: show with caption and style
//
u3_noun
u3qfu_shep(u3_noun van,
const c3_c* paz_c,
u3_noun sty,
u3_noun mol)
{
return u3qfu_shew(van,
u3nc(u3nc('c', u3i_string(paz_c)),
u3nc(u3k(sty), mol)));
}

View File

@ -1,93 +0,0 @@
/* j/6/ut_buss.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_cqfu_buss(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_cqfu_buss-buss", von, "buss");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(cog),
u3x_sam_3,
u3k(gen),
0));
}
static u3_noun
_cqfu_busk(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_cqfu_busk-busk", von, "busk");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(gen),
0));
}
/* boilerplate
*/
u3_noun
u3wfu_buss(u3_noun cor)
{
u3_noun sut, cog, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &cog,
u3x_sam_3, &gen,
u3x_con, &van,
0)) ||
(c3n == u3ud(cog)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_buss(van, sut, cog, gen);
}
}
u3_noun
u3qfu_buss(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun gen)
{
return _cqfu_buss(van, sut, cog, gen);
}
u3_noun
u3wfu_busk(u3_noun cor)
{
u3_noun sut, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &gen,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_busk(van, sut, gen);
}
}
u3_noun
u3qfu_busk(u3_noun van,
u3_noun sut,
u3_noun gen)
{
return _cqfu_busk(van, sut, gen);
}

View File

@ -1,88 +0,0 @@
/* j/6/ut_conk.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_cqfu_conk(u3_noun van,
u3_noun sut,
u3_noun got)
{
if ( c3y == u3ud(got) ) {
u3_noun ret = u3qf_face(u3k(got), sut);
return ret;
}
else switch ( u3h(got) ) {
default: return u3m_bail(c3__fail);
case 0: {
return u3k(sut);
}
case 1: {
u3_noun cok = _cqfu_conk(van, sut, u3t(u3t(got)));
u3_noun nux = u3k(u3h(u3t(got)));
u3_noun ret = u3qf_face(nux, cok);
u3z(nux);
u3z(cok);
return ret;
}
case 2: {
u3_noun vet = u3r_at(u3qfu_van_vet, van);
u3_noun hed, tal, deh, lat, ret;
if ( c3y == vet ) {
u3_noun cel = u3nt(c3__cell, c3__noun, c3__noun);
if ( c3n == u3qfu_nest(van, cel, c3y, sut) ) {
return u3m_bail(c3__fail);
}
u3z(cel);
}
hed = u3qfu_peek(van, sut, c3__both, 2);
tal = u3qfu_peek(van, sut, c3__both, 3);
deh = _cqfu_conk(van, hed, u3h(u3t(got)));
lat = _cqfu_conk(van, tal, u3t(u3t(got)));
ret = u3qf_cell(deh, lat);
u3z(lat);
u3z(deh);
u3z(tal);
u3z(hed);
return ret;
}
}
}
/* boilerplate
*/
u3_noun
u3wfu_conk(u3_noun cor)
{
u3_noun sut, got, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &got,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_conk(van, sut, got);
}
}
u3_noun
u3qfu_conk(u3_noun van,
u3_noun sut,
u3_noun got)
{
return _cqfu_conk(van, sut, got);
}

View File

@ -3,241 +3,6 @@
*/
#include "all.h"
/* logic
*/
static u3_noun
_crop_dext(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_crop_sint(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_crop_repo(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun rep = u3qfu_repo(van, sut);
u3_noun ret = _crop_dext(van, rep, ref, bix);
if ( c3y == u3r_sing(ret, rep) ) {
if ( c3__void == rep ) {
return c3__void;
} else {
u3z(rep);
u3z(ret);
return u3k(sut);
}
} else {
u3z(rep);
return ret;
}
}
static u3_noun
_crop_dext_fork(u3_noun van, u3_noun p_sut, u3_noun ref, u3_noun bix)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_crop_dext(van, u3h(p_sut), ref, bix),
_crop_dext_fork(van, u3t(p_sut), ref, bix));
}
}
static u3_noun
_crop_sint_fork(u3_noun van, u3_noun sut, u3_noun p_ref, u3_noun bix)
{
if ( u3_nul == p_ref ) {
return u3k(sut);
}
else {
u3_noun tuz = _crop_dext(van, sut, u3h(p_ref), bix);
u3_noun zat = _crop_sint_fork(van, tuz, u3t(p_ref), bix);
u3z(tuz);
return zat;
}
}
static u3_noun
_crop_dext(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun p_sut, q_sut, p_ref, q_ref;
if ( c3n == u3du(ref) ) {
switch ( ref ) {
case c3__void: return u3k(sut);
case c3__noun: return c3__void;
default: return u3m_bail(c3__fail);
}
}
if ( c3y == u3r_sing(sut, ref) ) {
return c3__void;
}
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: return _crop_repo(van, sut, ref, bix);
case c3__void: return c3__void;
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3__atom == u3h(ref) ) {
u3x_cell(u3t(ref), &p_ref, &q_ref);
if ( c3y == u3du(q_sut) ) {
if ( c3y == u3du(q_ref) ) {
if ( c3y == u3r_sing(q_sut, q_ref) ) {
return c3__void;
} else {
return u3k(sut);
}
} else {
return c3__void;
}
}
else {
if ( c3y == u3du(q_ref) ) {
return u3k(sut);
}
else return c3__void;
}
}
else if ( c3__cell == u3h(ref) ) {
return u3k(sut);
}
else return _crop_sint(van, sut, ref, bix);
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3__atom == u3h(ref) ) {
return u3k(sut);
}
else if ( c3__cell == u3h(ref) ) {
u3x_cell(u3t(ref), &p_ref, &q_ref);
if ( c3y == u3qfu_nest(van, p_ref, c3n, p_sut) )
{
u3_noun foz = _crop_dext(van, q_sut, q_ref, bix);
u3_noun ret = u3qf_cell(p_sut, foz);
u3z(foz);
return ret;
}
else return u3k(sut);
}
else return _crop_sint(van, sut, ref, bix);
}
case c3__core:
{
if ( (c3__atom == u3h(ref)) ||
(c3__cell == u3h(ref)) ) {
return u3k(sut);
}
else return _crop_sint(van, sut, ref, bix);
}
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun foz = _crop_dext(van, q_sut, ref, bix);
u3_noun ret = u3qf_hint(p_sut, foz);
u3z(foz);
return ret;
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun foz = _crop_dext(van, q_sut, ref, bix);
u3_noun ret = u3qf_face(p_sut, foz);
u3z(foz);
return ret;
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_crop_dext_fork(van, yed, ref, bix));
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( c3y == u3qdi_has(bix, hud) ) {
# if 0
u3_noun dun = u3qfu_dunq(van, "type", sut);
u3_noun niz = u3qfu_dunq(van, "over", ref);
u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
# endif
return u3m_error("crop-loop");
} else {
u3_noun bux = u3qdi_put(bix, hud);
u3_noun ret = _crop_repo(van, sut, ref, bux);
u3z(hud);
u3z(bux);
return ret;
}
}
}
}
static u3_noun
_crop_sint(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun p_ref, q_ref;
switch ( u3h(ref) ) {
default: return u3m_bail(c3__fail);
case c3__core:
case c3__hint:
case c3__face: u3x_cell(u3t(ref), &p_ref, &q_ref);
{
return _crop_dext(van, sut, q_ref, bix);
}
case c3__fork: p_ref = u3t(ref);
{
u3_noun yed = u3qdi_tap(p_ref);
u3_noun ret = _crop_sint_fork(van, sut, yed, bix);
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun rep = u3qfu_repo(van, ref);
u3_noun ret = _crop_dext(van, sut, rep, bix);
u3z(rep);
return ret;
}
}
}
static u3_noun
_cqfu_crop(u3_noun van,
u3_noun sut,
u3_noun ref)
{
return _crop_dext(van, sut, ref, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_crop(u3_noun cor)
{
@ -248,24 +13,16 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_crop(van, sut, ref);
}
}
u3_noun
u3qfu_crop(u3_noun van,
u3_noun sut,
u3_noun ref)
{
c3_m fun_m = 141 + c3__crop + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_crop(van, sut, ref);
return u3z_save_2(fun_m, sut, ref, pro);
c3_m fun_m = 141 + c3__crop + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
return u3z_save_2(fun_m, sut, ref, pro);
}
}
}

View File

@ -3,842 +3,6 @@
*/
#include "all.h"
static u3_noun
_find_buck(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil);
/* `u3qfu_felt_arm` is a helper function for
* u3qfu_felt. It handles the case in which the
* opal is for an arm, by creating a list of
* parent core types. These will be converted to
* a single `fork` type.
*/
static u3_noun
u3qfu_felt_arm(u3_noun lis)
{
if ( u3_nul == lis ) {
return u3_nul;
}
else {
u3_noun i_lis, t_lis, fot, typ;
u3x_cell(lis, &i_lis, &t_lis);
u3x_cell(i_lis, &typ, &fot);
if ( (c3n == u3du(typ)) ||
(c3__core != u3h(typ)) ) {
return u3m_error("felt-core");
}
else {
u3_noun p_typ, q_typ, pq_typ, qq_typ, rq_typ;
u3x_cell(u3t(typ), &p_typ, &q_typ);
u3x_trel(q_typ, &pq_typ, &qq_typ, &rq_typ);
u3_noun dox = u3nt(c3__core, u3k(qq_typ), u3k(q_typ));
return u3nc(dox, u3qfu_felt_arm(t_lis));
}
}
}
/* `u3qfu_felt` takes an opal, lap, and converts
* it to a type. The opal comes from the last
* limb of the wing processed by `+fond`. The
* type is used in +fond as the subject type of
* the next limb in the wing.
*/
static u3_noun
u3qfu_felt(u3_noun lap)
{
u3_noun lim, mil;
u3x_cell(lap, &lim, &mil);
if ( c3y == lim ) {
return u3k(mil);
}
else if ( c3n == lim ) {
u3_noun p_lap, q_lap, lis, hos;
u3x_cell(mil, &p_lap, &q_lap);
lis = u3qdi_tap(q_lap);
hos = u3qfu_felt_arm(lis);
u3z(lis);
return u3kf_fork(hos);
}
else {
u3m_bail(c3__exit);
}
}
static u3_noun
u3qfu_fund(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("u3qfu_fund-fund", von, "fund");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(way),
u3x_sam_3,
u3k(gen),
0));
}
static u3_noun
u3qfu_fine(u3_noun van,
u3_noun sut,
u3_noun tor)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("u3qfu_fine-fine", von, "fine");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(tor),
0));
}
static u3_noun
_find_buck_here(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( 0 == p_heg ) {
return u3nt
(c3y,
u3nt(u3_nul,
u3nc(u3_nul, u3k(axe)),
u3k(lon)),
u3nc(c3y, u3k(sut)));
}
else {
return u3nt
(c3n, c3y, u3qa_dec(p_heg));
}
}
static u3_noun
_find_buck_lose(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
return u3nt(c3n, c3y, u3k(p_heg));
}
static u3_noun
_find_buck_stop(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( u3_nul == q_heg ) {
return _find_buck_here(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
return _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
}
static u3_noun
_find_buck_cell(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut, q_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( u3_nul == q_heg ) {
return _find_buck_here(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun exa = u3qc_peg(axe, 2);
u3_noun hed = _find_buck(van, p_sut, way, p_heg, q_heg, exa, lon, gil);
u3z(exa);
if ( (u3_nul == hed) || (c3y == u3h(hed)) || (c3n == u3h(u3t(hed))) ) {
return hed;
}
else {
u3_noun exa = u3qc_peg(axe, 3);
u3_noun tal = _find_buck
(van, q_sut, way, u3t(u3t(hed)), q_heg, exa, lon, gil);
u3z(exa);
u3z(hed);
return tal;
}
}
}
}
static u3_noun
_find_buck_core(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut, q_sut, pq_sut, qq_sut, rq_sut, prq_sut, qrq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
u3x_trel(q_sut, &pq_sut, &qq_sut, &rq_sut);
u3x_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut);
u3x_cell(rq_sut, &prq_sut, &qrq_sut);
{
if ( u3_nul == q_heg ) {
return _find_buck_here(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun zem = u3qf_loot(u3t(q_heg), qrq_sut);
if ( (u3_nul != zem) && (0 != p_heg) ) {
u3_noun ped;
ped = u3qa_dec(p_heg);
u3z(p_heg); p_heg = ped;
u3z(zem);
zem = u3_nul;
}
if ( u3_nul != zem ) {
u3_noun u_zem = u3t(zem);
u3_noun pu_zem = u3h(u_zem);
u3_noun qu_zem = u3t(u_zem);
u3_noun zut;
u3_noun pro;
#if 1
if ( qpq_sut == c3__wet ) {
zut = u3nc(c3__wet, u3k(qu_zem));
}
else if ( qpq_sut == c3__dry ) {
zut = u3nc(c3__dry, u3k(qu_zem));
}
else u3m_bail(c3__fail);
#endif
pro = u3nt
(c3y,
u3nc(u3nc(u3_nul, u3k(axe)), u3k(lon)),
u3nt(c3n,
u3qc_peg(2, pu_zem),
u3nt(u3nc(u3k(sut), zut), u3_nul, u3_nul)));
u3z(zem);
return pro;
}
else {
u3_noun pec = u3qfu_peel(van, sut, way, rpq_sut);
u3_noun pro;
if ( c3n == u3h(pec) ) {
pro = _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else if ( c3y == u3t(pec) ) {
u3_noun exa = u3qc_peg(axe, 3);
pro = _find_buck(van, p_sut, way, p_heg, q_heg, exa, lon, gil);
u3z(exa);
}
else {
u3_noun sam = u3qfu_peek(van, p_sut, way, 2);
u3_noun exa = u3qc_peg(axe, 6);
pro = _find_buck(van, sam, way, p_heg, q_heg, exa, lon, gil);
u3z(exa);
u3z(sam);
}
u3z(pec);
return pro;
}
}
}
}
static u3_noun
_find_twin(u3_noun van,
u3_noun hax,
u3_noun yor)
{
if ( c3y == u3r_sing(hax, yor) ) {
return u3k(hax);
}
else if ( u3_nul == hax ) {
return u3k(yor);
}
else if ( u3_nul == yor ) {
return u3k(hax);
}
else if ( c3n == u3h(hax) ) {
if ( (c3n != u3h(yor)) ) {
return u3m_error("find-fork-a");
}
else {
u3_noun p_hax = u3t(hax); // (each @ud {span nock})
u3_noun p_yor = u3t(yor); // (each @ud {span nock})
if ( (c3n != u3h(p_hax)) || (c3n != u3h(p_yor)) ) {
return u3m_error("find-fork-b");
}
else {
u3_noun pp_hax = u3t(p_hax); // {span nock}
u3_noun pp_yor = u3t(p_yor); // {span nock}
u3_noun ppp_hax = u3h(pp_hax); // span
u3_noun ppp_yor = u3h(pp_yor); // span
u3_noun qpp_hax = u3t(pp_hax); // nock
u3_noun qpp_yor = u3t(pp_yor); // nock
if ( c3n == u3r_sing(qpp_hax, qpp_yor) ) {
return u3m_error("find-fork-c");
}
return u3nt(c3n,
c3n,
u3nc(
u3kf_fork(u3nt(u3k(ppp_hax), u3k(ppp_yor), u3_nul)),
u3k(qpp_hax)));
}
}
}
else {
if ( c3n == u3h(yor) ) {
return u3m_error("find-fork-d");
}
else {
u3_noun p_hax = u3t(hax); // {vein opal}
u3_noun p_yor = u3t(yor); // {vein opal}
u3_noun pp_hax = u3h(p_hax); // vein
u3_noun pp_yor = u3h(p_yor); // vein
u3_noun qp_hax = u3t(p_hax); // opal
u3_noun qp_yor = u3t(p_yor); // opal
if ( c3n == u3r_sing(pp_hax, pp_yor) ) {
return u3m_error("find-fork-e");
}
else {
if ( c3y == u3h(qp_hax) ) {
if ( c3y != u3h(qp_yor) ) {
return u3m_error("find-fork-f");
} else {
u3_noun pqp_hax = u3t(qp_hax); // type
u3_noun pqp_yor = u3t(qp_yor); // type
return
u3nt(c3y,
u3k(pp_hax),
u3nc(c3y, u3kf_fork
(u3nt(u3k(pqp_hax), u3k(pqp_yor), u3_nul))));
}
}
else if ( c3n != u3h(qp_yor) ) {
return u3m_error("find-fork-g");
} else {
u3_noun pqp_hax = u3h(u3t(qp_hax)); // axis
u3_noun pqp_yor = u3h(u3t(qp_yor)); // axis
u3_noun qqp_hax = u3t(u3t(qp_hax)); // (set {type foot})
u3_noun qqp_yor = u3t(u3t(qp_yor)); // (set {type foot})
if ( c3n == u3r_sing(pqp_hax, pqp_yor) ) {
return u3m_error("find-fork-h");
} else {
return
u3nt(c3y,
u3k(pp_hax),
u3nt(c3n, u3k(pqp_hax), u3qdi_uni(qqp_hax, qqp_yor)));
}
}
}
}
}
// error: { return u3m_error("find-fork"); }
}
static u3_noun
_find_buck_fork_twin(u3_noun van, u3_noun wiz)
{
if ( u3_nul == wiz ) {
return u3_nul;
}
else if ( u3_nul == u3t(wiz) ) {
return u3k(u3h(wiz));
}
else {
u3_noun hax = u3k(u3h(wiz));
u3_noun yor = _find_buck_fork_twin(van, u3t(wiz));
u3_noun fid = _find_twin(van, hax, yor);
u3z(hax);
u3z(yor);
return fid;
}
}
static u3_noun
_find_buck_fork_turn(u3_noun van,
u3_noun yed,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( u3_nul == yed ) {
return u3_nul;
}
else {
u3_noun fid = _find_buck(van, u3h(yed), way, p_heg, q_heg, axe, lon, gil);
return u3nc
(fid,
_find_buck_fork_turn
(van, u3t(yed), way, p_heg, q_heg, axe, lon, gil));
}
}
static u3_noun
_find_buck_fork(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut = u3t(sut);
u3_noun yed = u3qdi_tap(p_sut);
u3_noun wiz;
u3_noun ret;
wiz = _find_buck_fork_turn(van, yed, way, p_heg, q_heg, axe, lon, gil);
u3z(yed);
ret = _find_buck_fork_twin(van, wiz);
u3z(wiz);
return ret;
}
static u3_noun
_find_buck_face_next(u3_noun van,
u3_noun sut,
u3_noun q_sut,
u3_noun qp_sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( u3_nul == qp_sut ) {
u3_noun nol = u3nc(u3_nul, u3k(lon));
u3_noun ret = _find_buck(van, q_sut, way, p_heg, q_heg, axe, nol, gil);
u3z(nol);
return ret;
}
else {
u3_noun iqp_sut = u3h(qp_sut); // twig
u3_noun tiv = u3qfu_mint // (pair type nock)
(van, q_sut, c3__noun, iqp_sut);
u3_noun tqp_sut = u3t(qp_sut); // (list twig)
u3_noun p_tiv = u3h(tiv); // type
u3_noun q_tiv = u3t(tiv); // nock
u3_noun fid = _find_buck // pony
(van, p_tiv, way, p_heg, q_heg, 1, u3_nul, u3_nul);
if ( u3_nul == fid ) {
u3z(tiv);
return u3_nul;
}
else if ( (c3n == u3h(fid)) && (c3y == u3h(u3t(fid))) ) {
u3_noun ret;
ret = _find_buck_face_next
(van, sut, q_sut, tqp_sut, way, u3t(u3t(fid)), q_heg, axe, lon, gil);
u3z(fid);
u3z(tiv);
return ret;
}
else {
u3_noun tor; // port
u3_noun vat; // (pair type nock)
u3_noun ret;
u3_noun dog = u3nc(0, u3k(axe)); // nock
u3_noun cob = u3qf_comb(dog, q_tiv);
if ( c3y == u3h(fid) ) {
tor = u3nc(c3y, u3k(u3t(fid)));
} else {
tor = u3nc(c3n, u3k(u3t(u3t(fid))));
}
u3z(fid);
vat = u3qfu_fine(van, sut, tor);
u3z(tor);
ret = u3nt
(c3n,
c3n,
u3nc(u3k(u3h(vat)), u3qf_comb(cob, u3t(vat))));
u3z(vat);
u3z(dog);
u3z(cob);
u3z(tiv);
return ret;
}
}
}
static u3_noun
_find_buck_face(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut, q_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
if ( u3_nul == q_heg ) {
return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun uq_heg = u3t(q_heg); // term
if ( c3y == u3ud(p_sut) ) {
if ( c3y == u3r_sing(p_sut, uq_heg) ) {
return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
return _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
}
else {
u3_noun pp_sut = u3h(p_sut); // (map term {wain (unit twig)})
u3_noun qp_sut = u3t(p_sut); // (list (pair type nock))
u3_noun tyr = u3qdb_get(pp_sut, uq_heg); // (unit (unit twig))
if ( u3_nul == tyr ) {
return _find_buck_face_next
(van, sut, q_sut, qp_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun u_tyr = u3t(tyr); // (unit twig)
if ( u3_nul == u_tyr ) {
u3_noun nol = u3nc(u3_nul, u3k(lon));
u3_noun dep = u3qa_inc(p_heg);
u3_noun ret = _find_buck
(van, q_sut, way, dep, q_heg, axe, nol, gil);
u3z(dep);
u3z(nol);
u3z(tyr);
return ret;
}
else {
u3_noun uu_tyr = u3t(u_tyr);
u3_noun tor = u3qfu_fund(van, sut, way, uu_tyr);
if ( c3y == u3h(tor) ) {
u3_noun p_tor = u3t(tor); // (pair vein opal)
u3_noun pp_tor = u3h(p_tor); // vein
u3_noun qp_tor = u3t(p_tor); // opal
u3_noun nol = // vein
u3nt(u3_nul, u3nc(u3_nul, u3k(axe)), u3k(lon));
u3_noun ret;
ret = u3nt(c3y, u3qb_weld(pp_tor, nol), u3k(qp_tor));
u3z(nol);
u3z(tor);
u3z(tyr);
return ret;
}
else {
u3_noun p_tor = u3t(tor); // (pair type nock)
u3_noun pp_tor = u3h(p_tor); // type
u3_noun qp_tor = u3t(p_tor); // nock
u3_noun dog = u3nc(0, u3k(axe)); // nock
u3_noun ret;
ret = u3nt(c3n,
c3n,
u3nc(u3k(pp_tor), u3qf_comb(dog, qp_tor)));
u3z(dog);
u3z(tor);
u3z(tyr);
return ret;
}
}
}
}
}
}
static u3_noun
_find_buck(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
// u3l_log("noun\r\n");
return _find_buck_stop(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__void: {
// u3l_log("void\r\n");
// return _find_buck_stop(van, sut, way, p_heg, q_heg, axe, lon, gil);
return u3_nul;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom:
{
// u3l_log("atom\r\n");
return _find_buck_stop(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__cell:
{
// u3l_log("cell\r\n");
return _find_buck_cell(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__core:
{
// u3l_log("core\r\n");
return _find_buck_core(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__hint:
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _find_buck(van, fop, way, p_heg, q_heg, axe, lon, gil);
u3z(fop);
return pro;
}
case c3__face:
{
// u3l_log("face\r\n");
return _find_buck_face(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__fork:
{
// u3l_log("fork\r\n");
return _find_buck_fork(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__hold:
{
// u3l_log("hold\r\n");
if ( (c3y == u3qdi_has(gil, sut)) ) {
return u3_nul;
}
else {
u3_noun zoc = u3qdi_put(gil, sut);
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _find_buck(van, fop, way, p_heg, q_heg, axe, lon, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
static u3_noun
_find_limb(u3_noun van,
u3_noun sut, // type
u3_noun way, // ?(%read %rite %free %both)
u3_noun i_hyp, // limb
u3_noun p_mor) // palo
{
u3_noun pp_mor = u3h(p_mor); // vein
u3_noun qp_mor = u3t(p_mor); // opal
{
u3_noun ref = u3qfu_felt(qp_mor);
u3_noun lon = u3k(pp_mor);
u3_noun heg = (c3y == u3du(i_hyp))
? u3k(i_hyp)
: u3nq(c3n, 0, u3_nul, u3k(i_hyp));
u3_noun ret;
if ( c3y == u3h(heg) ) {
u3_noun p_heg = u3t(heg); // axis
if ( c3n == u3ud(p_heg) ) {
u3m_p("weird p_heg", p_heg);
return u3m_bail(c3__fail);
}
ret = u3nt
(c3y,
u3nc(u3nc(u3_nul, u3k(p_heg)), u3k(lon)),
u3nc(c3y, u3qfu_peek(van, ref, way, p_heg)));
}
else {
u3_noun p_heg = u3h(u3t(heg)); // @ud
u3_noun q_heg = u3t(u3t(heg)); // (unit term)
ret = _find_buck
(van, ref, way, p_heg, q_heg, 1, lon, u3_nul);
}
u3z(heg);
u3z(lon);
u3z(ref);
return ret;
}
}
static u3_noun
_find_pony(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
if ( u3_nul == hyp ) {
return u3nt(c3y, u3_nul, u3nc(c3y, u3k(sut)));
}
else {
u3_noun i_hyp = u3h(hyp);
u3_noun t_hyp = u3t(hyp);
u3_noun mor = _find_pony(van, sut, way, t_hyp);
if ( c3n == u3h(mor) ) {
u3_noun p_mor = u3t(mor);
if ( c3y == u3h(p_mor) ) {
return mor;
}
else {
u3_noun pp_mor = u3t(p_mor); // {span nock}
u3_noun ppp_mor = u3h(pp_mor); // span
u3_noun qpp_mor = u3t(pp_mor); // nock
u3_noun gen = u3nt(c3__wing, u3k(i_hyp), u3_nul);
u3_noun fex = u3qfu_mint(van, ppp_mor, c3__noun, gen);
u3_noun ret = u3nt(c3n,
c3n,
u3nc(u3k(u3h(fex)),
u3qf_comb(qpp_mor, u3t(fex))));
u3z(fex);
u3z(gen);
u3z(mor);
return ret;
}
}
else {
u3_noun p_mor = u3t(mor);
u3_noun ret = _find_limb(van, sut, way, i_hyp, p_mor);
u3z(mor);
return ret;
}
}
}
static u3_noun
_cqfu_fond(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
u3_noun taf;
taf = _find_pony(van, sut, way, hyp);
return taf;
}
static u3_noun
_cqfu_find(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
u3_noun taf = _find_pony(van, sut, way, hyp);
if ( u3_nul == taf ) {
goto error;
}
else {
if ( c3y == u3h(taf) ) {
u3_noun fat = u3nc(c3y, u3k(u3t(taf)));
u3z(taf);
return fat;
}
else {
if ( c3n == u3h(u3t(taf)) ) {
u3_noun fat = u3nc(c3n, u3k(u3t(u3t(u3t(taf)))));
u3z(taf);
return fat;
}
else {
goto error;
}
}
}
error: {
u3m_p("wing", hyp);
return u3m_error("find");
}
}
/* boilerplate
*/
u3_noun
u3wfu_find(u3_noun cor)
{
@ -852,31 +16,20 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_find(van, sut, way, hyp);
c3_m fun_m = 141 + c3__find + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
if ( u3_none != pro ) {
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
return u3z_save_3(fun_m, sut, way, hyp, pro);
}
}
}
u3_noun
u3qfu_find(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
c3_m fun_m = 141 + c3__find + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_find(van, sut, way, hyp);
return u3z_save_3(fun_m, sut, way, hyp, pro);
}
}
/* boilerplate
*/
u3_noun
u3wfu_fond(u3_noun cor)
{
@ -890,25 +43,17 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_fond(van, sut, way, hyp);
c3_m fun_m = 141 + c3__fond + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
if ( u3_none != pro ) {
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
return u3z_save_3(fun_m, sut, way, hyp, pro);
}
}
}
u3_noun
u3qfu_fond(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
c3_m fun_m = 141 + c3__fond + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_fond(van, sut, way, hyp);
return u3z_save_3(fun_m, sut, way, hyp, pro);
}
}

View File

@ -1,200 +0,0 @@
/* j/6/fire.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_fire_vet(u3_noun van)
{
// u3_noun vet = u3j_hook(u3k(van), "vet");
u3_noun vet = u3r_at(u3qfu_van_vet, van);
switch ( vet ) {
case c3n:
case c3y: return vet;
default: return u3m_bail(c3__fail);
}
}
static u3_noun
_fire_mull(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun gen)
{
u3_noun rib = u3r_at(u3qfu_van_rib, van);
u3_noun key = u3nt(u3k(sut),
u3k(dox),
u3k(gen));
u3_noun ret;
if ( c3n == _fire_vet(van) ) {
ret = c3y;
}
if ( c3y == u3qdi_has(rib, key) ) {
ret = c3y;
}
else {
u3_noun rob = u3qdi_put(rib, key);
u3_noun von = u3i_molt(u3k(van),
u3qfu_van_rib,
u3k(rob),
0);
u3_noun mul = u3qfu_mull(von, sut, c3__noun, dox, gen);
ret = c3y;
u3z(mul);
u3z(von);
u3z(rob);
}
u3z(key);
return ret;
}
static u3_noun
_fire_each(u3_noun van,
u3_noun vet,
u3_noun typ,
u3_noun gat)
{
u3_noun p_typ, q_typ, pq_typ, qq_typ, rq_typ;
u3_noun ppq_typ, qpq_typ, rpq_typ;
u3_noun h_gat, t_gat;
if ( (c3n == u3du(typ)) || (c3__core != u3h(typ)) ) {
return u3m_error("fire-core");
} else if
( (c3n == u3r_cell(u3t(typ), &p_typ, &q_typ)) ||
(c3n == u3r_trel(q_typ, &pq_typ, &qq_typ, &rq_typ)) ||
(c3n == u3r_trel(pq_typ, &ppq_typ, &qpq_typ, &rpq_typ)) ||
(c3n == u3r_cell(gat, &h_gat, &t_gat)) )
{
return u3m_bail(c3__fail);
} else {
u3_noun dox = u3nt(c3__core,
u3k(qq_typ),
u3nt(u3nt(u3k(ppq_typ), u3k(qpq_typ), c3__gold),
u3k(qq_typ),
u3k(rq_typ)));
if ( (c3__ash == u3h(gat)) || (c3__dry == u3h(gat)) ) {
if ( (c3y == vet) &&
(c3n == u3qfu_nest(van, qq_typ, c3y, p_typ)) )
{
#if 0
u3_noun dun = u3qfu_dunq(van, "need", qq_typ);
u3_noun niz = u3qfu_dunq(van, "have", p_typ);
u3t_push(u3nc(c3__mean, niz));
u3t_push(u3nc(c3__mean, dun));
#endif
return u3m_error("fire-dry");
}
else {
return u3nc(dox, u3k(t_gat));
}
}
else {
c3_assert(c3__wet == u3h(gat));
#if 0
u3_noun dun = u3qfu_dunq(van, "wild", typ);
u3_noun niz = u3qfu_dunq(van, "tame", dox);
u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
#endif
if ( (c3y == vet) &&
(c3n == _fire_mull(van, typ, dox, t_gat)) )
{
return u3m_error("fire-wet");
}
else {
u3z(dox);
#if 0
u3t_drop();
u3t_drop();
#endif
return u3nc(u3k(typ), u3k(t_gat));
}
}
}
}
static u3_noun
_fire_in(u3_noun van,
u3_noun vet,
u3_noun hag)
{
if ( u3_nul == hag ) {
return u3_nul;
}
else {
u3_noun i_hag = u3h(hag);
u3_noun t_hag = u3t(hag);
if ( c3n == u3du(i_hag) ) {
return u3m_bail(c3__fail);
} else {
return u3nc
(_fire_each(van, vet, u3h(i_hag), u3t(i_hag)),
_fire_in(van, vet, t_hag));
}
}
}
static u3_noun
_cqfu_fire(u3_noun van,
u3_noun sut,
u3_noun hag)
{
u3_noun vet = u3r_at(u3qfu_van_vet, van);
c3_assert(!"not live");
{
if ( (c3y == u3du(hag)) && (u3_nul == u3t(hag)) ) {
u3_noun i_hag = u3h(hag);
u3_noun pi_hag = u3h(i_hag);
u3_noun qi_hag = u3t(i_hag);
if ( (c3__wet == u3h(qi_hag)) ) {
u3_noun qqi_hag = u3t(qi_hag);
if ( c3y == u3du(qqi_hag) &&
(u3_nul == u3h(qqi_hag)) &&
(1 == u3t(qqi_hag)) )
{
return u3k(pi_hag);
}
}
}
}
return u3nc(c3__hold, _fire_in(van, vet, hag));
}
/* boilerplate
*/
u3_noun
u3wfu_fire(u3_noun cor)
{
u3_noun sut, hag, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &hag, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_fire(van, sut, hag);
}
}
u3_noun
u3qfu_fire(u3_noun van,
u3_noun sut,
u3_noun hag)
{
return _cqfu_fire(van, sut, hag);
}

View File

@ -3,149 +3,6 @@
*/
#include "all.h"
/* functions
*/
static u3_noun
_fish_in(u3_noun, u3_noun, u3_atom, u3_noun);
static u3_noun
_fish_fork(u3_noun van,
u3_noun p_sut,
u3_atom axe,
u3_noun vit)
{
if ( u3_nul == p_sut ) {
return u3nc(1, 1);
}
else {
u3_noun hed = _fish_in(van, u3h(p_sut), axe, vit);
u3_noun tal = _fish_fork(van, u3t(p_sut), axe, vit);
u3_noun pro = u3qf_flor(hed, tal);
u3z(hed);
u3z(tal);
return pro;
}
}
static u3_noun
_fish_in(u3_noun van,
u3_noun sut,
u3_atom axe,
u3_noun vit)
{
u3_noun p_sut, q_sut;
if ( c3y == u3ud(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
return u3nc(1, 0);
}
case c3__void: {
return u3nc(1, 1);
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
if ( c3n == u3du(q_sut) ) {
u3_noun ton = u3nt(3, 0, u3k(axe));
u3_noun pro = u3qf_flip(ton);
u3z(ton);
return pro;
} else {
return u3nt(5,
u3nc(1, u3k(u3t(q_sut))),
u3nc(0, u3k(axe)));
}
}
}
case c3__cell: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
u3_noun hut = u3nt(3, 0, u3k(axe));
u3_noun lef = u3qc_peg(axe, 2);
u3_noun rit = u3qc_peg(axe, 3);
u3_noun hed = _fish_in(van, p_sut, lef, vit);
u3_noun tal = _fish_in(van, q_sut, rit, vit);
u3_noun hob = u3qf_flan(hed, tal);
u3_noun vug = u3qf_flan(hut, hob);
u3z(hob);
u3z(tal);
u3z(hed);
u3z(rit);
u3z(lef);
u3z(hut);
return vug;
}
}
case c3__core: {
return u3m_error("fish-core");
}
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
return _fish_in(van, q_sut, axe, vit);
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = _fish_fork(van, yed, axe, vit);
u3z(yed);
return ret;
}
case c3__hold: {
p_sut = u3t(sut);
{
if ( (c3y == u3qdi_has(vit, sut)) ) {
// u3_noun dun = u3qfu_dunq(van, "type", sut);
u3_noun niz = u3qfu_shep
(van, "axis", 'd', u3k(axe));
// u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
return u3m_error("fish-loop");
} else {
u3_noun zoc = u3qdi_put(vit, sut);
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _fish_in(van, fop, axe, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
}
static u3_noun
_cqfu_fish(u3_noun van,
u3_noun sut,
u3_atom axe)
{
return _fish_in(van, sut, axe, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_fish(u3_noun cor)
{
@ -157,24 +14,16 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_fish(van, sut, axe);
}
}
u3_noun
u3qfu_fish(u3_noun van,
u3_noun sut,
u3_noun axe)
{
c3_m fun_m = 141 + c3__fish + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, axe);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_fish(van, sut, axe);
return u3z_save_2(fun_m, sut, axe, pro);
c3_m fun_m = 141 + c3__fish + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, axe);
if ( u3_none != pro ) {
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
return u3z_save_2(fun_m, sut, axe, pro);
}
}
}

View File

@ -3,185 +3,6 @@
*/
#include "all.h"
/* logic
*/
static u3_noun
_fuse_in(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_fuse_repo(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun rep = u3qfu_repo(van, sut);
u3_noun ret = _fuse_in(van, rep, ref, bix);
if ( c3y == u3r_sing(ret, rep) ) {
if ( c3__void == rep ) {
return c3__void;
} else {
u3z(rep);
u3z(ret);
return u3k(sut);
}
} else {
u3z(rep);
return ret;
}
}
static u3_noun
_fuse_in_fork(u3_noun van, u3_noun p_sut, u3_noun ref, u3_noun bix)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_fuse_in(van, u3h(p_sut), ref, bix),
_fuse_in_fork(van, u3t(p_sut), ref, bix));
}
}
static u3_noun
_fuse_in(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun p_sut, q_sut;
if ( c3y == u3r_sing(sut, ref) || (c3__noun == ref) ) {
return u3k(sut);
}
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun:
{
return u3k(ref);
}
case c3__void:
{
return c3__void;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3y == u3du(ref) ) {
if ( c3__atom == u3h(ref) ) {
u3_noun p_ref, q_ref;
u3x_cell(u3t(ref), &p_ref, &q_ref);
{
u3_noun foc = (c3y == u3qf_fitz(p_ref, p_sut))
? u3k(p_sut)
: u3k(p_ref);
if ( c3y == u3du(q_sut) ) {
if ( c3y == u3du(q_ref) ) {
if ( c3y == u3r_sing(q_ref, q_sut) ) {
return u3nt(c3__atom, foc, u3k(q_sut));
}
else {
u3z(foc);
return c3__void;
}
}
else {
return u3nt(c3__atom, foc, u3k(q_sut));
}
} else {
return u3nt(c3__atom, foc, u3k(q_ref));
}
}
}
else if ( c3__cell == u3h(ref) ) {
return c3__void;
}
}
return _fuse_in(van, ref, sut, bix);
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun p_ref, q_ref;
if ( c3y == u3r_pq(ref, c3__cell, &p_ref, &q_ref) ) {
u3_noun hed = _fuse_in(van, p_sut, p_ref, bix);
u3_noun tal = _fuse_in(van, q_sut, q_ref, bix);
u3_noun ret = u3qf_cell(hed, tal);
u3z(hed);
u3z(tal);
return ret;
}
else return _fuse_in(van, ref, sut, bix);
}
case c3__core:
{
return _fuse_repo(van, sut, ref, bix);
}
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun vot = _fuse_in(van, q_sut, ref, bix);
u3_noun ret = u3qf_hint(p_sut, vot);
u3z(vot);
return ret;
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun vot = _fuse_in(van, q_sut, ref, bix);
u3_noun ret = u3qf_face(p_sut, vot);
u3z(vot);
return ret;
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_fuse_in_fork(van, yed, ref, bix));
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( c3y == u3qdi_has(bix, hud) ) {
// u3_noun dun = u3qfu_dunq(van, "type", sut);
// u3_noun niz = u3qfu_dunq(van, "over", ref);
// u3t_push(u3nc(c3__mean, dun));
// u3t_push(u3nc(c3__mean, niz));
return u3m_error("fuse-loop");
} else {
u3_noun bux = u3qdi_put(bix, hud);
u3_noun ret = _fuse_repo(van, sut, ref, bux);
u3z(hud);
u3z(bux);
return ret;
}
}
}
}
static u3_noun
_cqfu_fuse(u3_noun van,
u3_noun sut,
u3_noun ref)
{
return _fuse_in(van, sut, ref, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_fuse(u3_noun cor)
{
@ -192,24 +13,16 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_fuse(van, sut, ref);
}
}
u3_noun
u3qfu_fuse(u3_noun van,
u3_noun sut,
u3_noun ref)
{
c3_m fun_m = 141 + c3__fuse + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_fuse(van, sut, ref);
return u3z_save_2(fun_m, sut, ref, pro);
c3_m fun_m = 141 + c3__fuse + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
return u3z_save_2(fun_m, sut, ref, pro);
}
}
}

View File

@ -1,16 +0,0 @@
/* j/6/gain.c
**
*/
#include "all.h"
u3_noun
u3qfu_gain(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("u3qfu_gain-gain", von, "gain");
return u3n_kick_on(u3i_molt(gat, u3x_sam, u3k(gen), 0));
}

View File

@ -1,16 +0,0 @@
/* j/6/lose.c
**
*/
#include "all.h"
u3_noun
u3qfu_lose(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("u3qfu_lose-lose", von, "lose");
return u3n_kick_on(u3i_molt(gat, u3x_sam, u3k(gen), 0));
}

View File

@ -3,869 +3,6 @@
*/
#include "all.h"
/* logic
*/
static u3_noun
_mint_in(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_mint_bean()
{
return u3kf_fork(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul));
}
static u3_noun
_mint_tend(u3_noun vit)
{
if ( u3_nul == vit ) {
return 1;
} else {
u3_noun nex = _mint_tend(u3t(vit));
if ( u3_nul == u3h(vit) ) {
return nex;
} else {
u3_noun boy = u3qc_peg(u3t(u3h(vit)), nex);
u3z(nex);
return boy;
}
}
}
static u3_noun
_mint_vet(u3_noun van)
{
// u3_noun vet = u3j_hook(u3k(van), "vet");
u3_noun vet = u3r_at(u3qfu_van_vet, van);
switch ( vet ) {
case c3n:
case c3y: return vet;
default: return u3m_bail(c3__fail);
}
}
static u3_noun
_mint_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
static u3_noun
_mint_mine(u3_noun van,
u3_noun sut,
u3_noun mel,
u3_noun nym,
u3_noun hud,
u3_noun dom)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "mine");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(mel),
u3x_sam_6,
u3k(nym),
u3x_sam_14,
u3k(hud),
u3x_sam_15,
u3k(dom),
0));
}
static u3_noun
_mint_burp(u3_noun van,
u3_noun sut)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
return u3j_hook(von, "burp");
}
static u3_noun
_mint_cond(u3_noun pex,
u3_noun yom,
u3_noun woq)
{
if ( 1 == u3h(pex) ) {
if ( 0 == u3t(pex) ) {
u3z(pex);
u3z(woq);
return yom;
}
else if ( 1 == u3t(pex) ) {
u3z(pex);
u3z(yom);
return woq;
}
}
return u3nq(6, pex, yom, woq);
}
static u3_noun
_mint_corn(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun mil = _mint_in(van, sut, c3__noun, gen);
u3_noun fol = u3k(u3t(mil));
u3z(mil);
return fol;
}
static u3_noun
_mint_nice(u3_noun van,
u3_noun gol,
u3_noun typ)
{
if ( (c3y == _mint_vet(van)) &&
(c3n == u3qfu_nest(van, gol, c3y, typ)) )
{
// u3_noun dun = u3qfu_dunq(van, "need", gol);
// u3_noun niz = u3qfu_dunq(van, "have", typ);
// u3t_push(u3nc(c3__mean, dun));
// u3t_push(u3nc(c3__mean, niz));
return u3m_error("mint-nice");
}
else return typ;
}
static u3_noun
_mint_cove(u3_noun nug)
{
if ( 0 == u3h(nug) ) {
return u3k(u3t(nug));
}
else if ( 11 == u3h(nug) ) {
return _mint_cove(u3t(u3t(nug)));
}
else {
return u3m_error("mint-cove");
}
}
static u3_noun
_mint_grow(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_atom mel,
u3_noun nym,
u3_noun hud,
u3_noun ruf,
u3_noun dom)
{
u3_noun dan = _mint_in(van, sut, c3__noun, ruf);
u3_noun p_dan = u3h(dan);
u3_noun q_dan = u3t(dan);
u3_noun pul = _mint_mine(van, p_dan, mel, nym, hud, dom);
u3_noun ret = u3nc(_mint_nice(van, gol, u3k(u3h(pul))),
u3qf_cons(u3t(pul), q_dan));
u3z(pul);
u3z(dan);
return ret;
}
static u3_noun
_mint_loc(u3_noun van,
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_cook("_mint_loc-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
u3z(sho);
return ret;
}
#if 1
static u3_noun
_mint_cnts(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun hyp,
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_mint_cnts-emin", von, "emin");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(gol),
u3x_sam_6,
u3k(hyp),
u3x_sam_7,
u3k(rig),
0));
}
#else
static u3_noun
_mint_edit(u3_noun van,
u3_noun sut,
u3_noun mew,
u3_noun p_lar,
u3_noun rag,
u3_noun hej)
{
while ( 1 ) {
if ( c3n == u3du(mew) ) {
u3_noun gim = u3qfu_fire(van, sut, rag);
u3_noun fol = u3qf_hike(p_lar, hej);
u3z(rag);
u3z(hej);
return u3nc(gim, fol);
} else {
u3_noun i_mew = u3h(mew);
u3_noun t_mew = u3t(mew);
u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew);
u3_noun zil = u3qfu_mint(van, sut, c3__noun, qi_mew);
u3_noun p_zil = u3h(zil);
u3_noun q_zil = u3t(zil);
u3_noun wip = u3qfu_toss(van, sut, pi_mew, p_zil, rag);
u3z(rag);
rag = u3k(u3t(wip));
hej = u3nc(u3nc(u3k(u3h(wip)),
u3k(q_zil)),
hej);
u3z(zil);
u3z(wip);
mew = t_mew;
}
}
}
static u3_noun
_mint_cnts_old(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun hyp,
u3_noun rig)
{
u3_noun lar = u3qfu_seek(van, sut, c3__read, hyp);
u3_noun p_lar = u3h(lar);
u3_noun q_lar = u3t(lar);
u3_noun pq_lar = u3h(q_lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun mew = rig;
u3_noun yom = _mint_edit(van, sut, mew, p_lar, u3k(qq_lar), u3_nul);
u3_noun p_yom = u3h(yom);
u3_noun q_yom = u3t(yom);
u3_noun ret = u3nc(_mint_nice(van, gol, u3k(p_yom)),
(0 == pq_lar) ? u3k(q_yom)
: u3nt(9, u3k(pq_lar), u3k(q_yom)));
u3z(yom);
u3z(lar);
return ret;
}
#endif
# define _mint_used()
static u3_noun
_mint_in(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun gen)
{
u3_noun p_gen, q_gen, r_gen;
u3_noun ret;
if ( (c3__void == sut) &&
!((c3y == u3du(gen)) && (c3__dbug == u3h(gen))) )
{
if ( (c3n == _mint_vet(van))
|| ((c3y == u3du(gen)) &&
((c3__zpfs == u3h(gen)) ||
(c3__zpsk == u3h(gen)) ||
(c3__lost == u3h(gen)) ||
(c3__fail == u3h(gen)) ||
(c3__zpzp == u3h(gen)))) )
{
return u3nt(c3__void, 0, 0);
}
else {
return u3m_error("mint-vain");
}
}
if ( c3n == u3du(gen) ) {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
ret = _mint_in(van, sut, gol, rex);
u3z(rex);
return ret;
}
else if ( c3y == u3du(u3h(gen)) ) {
_mint_used();
{
u3_noun hed = _mint_in(van, sut, c3__noun, u3h(gen));
u3_noun tal = _mint_in(van, sut, c3__noun, u3t(gen));
u3_noun typ = u3qf_cell(u3h(hed), u3h(tal));
ret = u3nc(_mint_nice(van, gol, typ),
u3qf_cons(u3t(hed),
u3t(tal)));
u3z(hed);
u3z(tal);
return ret;
}
} else switch ( u3h(gen) ) {
default: {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
if ( c3y == u3r_sing(rex, gen) ) {
#if 1
u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));
u3t_push(u3nc(c3__mean, zix));
return u3m_error("mint-open");
#else
u3_err("h", u3h(gen));
return u3m_bail(c3__fail);
#endif
}
ret = _mint_in(van, sut, gol, rex);
u3z(rex);
return ret;
}
case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun wam = u3qfu_play(van, sut, p_gen);
u3_noun dok = u3nc(c3__wing, u3k(q_gen));
u3_noun vol = _mint_corn(van, sut, dok);
u3_noun axe = _mint_cove(vol);
ret = u3nc(_mint_nice(van, gol, _mint_bean()),
u3qfu_fish(van, wam, axe));
u3z(axe);
u3z(vol);
u3z(wam);
u3z(dok);
return ret;
}
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mint_used();
{
u3_noun bol = _mint_bean();
u3_noun nor = _mint_in(van, sut, bol, p_gen);
u3_noun fex = u3qfu_gain(van, sut, p_gen);
u3_noun wux = u3qfu_lose(van, sut, p_gen);
u3_noun duy = (c3__void == fex)
? ( (c3__void == wux)
? u3nc(0, 0)
: u3nc(1, 1) )
: ( (c3__void == wux)
? u3nc(1, 0)
: u3k(u3t(nor)) );
u3_noun hiq = _mint_in(van, fex, gol, q_gen);
u3_noun ran = _mint_in(van, wux, gol, r_gen);
ret = u3nc(u3qf_forq(u3h(hiq),
u3h(ran)),
_mint_cond(duy,
u3k(u3t(hiq)),
u3k(u3t(ran))));
u3z(ran);
u3z(hiq);
u3z(nor);
u3z(wux);
u3z(fex);
u3z(bol);
return ret;
}
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hed = _mint_in(van, sut, c3__noun, p_gen);
u3_noun tal = _mint_in(van, sut, c3__noun, q_gen);
u3_noun typ = u3qf_cell(u3h(hed), u3h(tal));
ret = u3nc(_mint_nice(van, gol, typ),
u3qf_cons(u3t(hed),
u3t(tal)));
u3z(hed);
u3z(tal);
return ret;
}
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = _mint_nice(van, gol, _mint_bean());
u3_noun one = _mint_in(van, sut, c3__noun, p_gen);
u3_noun two = _mint_in(van, sut, c3__noun, q_gen);
u3_noun ret;
if ( (c3y == _mint_vet(van)) &&
(c3n == u3qfu_nest(van, u3h(one), c3n, u3h(two))) &&
(c3n == u3qfu_nest(van, u3h(two), c3y, u3h(one))) )
{
return u3m_error("nest");
}
ret = u3nc(typ, u3nt(5, u3k(u3t(one)), u3k(u3t(two))));
u3z(one);
u3z(two);
return ret;
}
case c3__dtwt: p_gen = u3t(gen);
_mint_used();
{
u3_noun typ = _mint_nice(van, gol, _mint_bean());
return u3nc(typ,
u3nc(3, _mint_corn(van, sut, p_gen)));
}
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun nog = u3nc(c3__kttr, u3k(p_gen));
u3_noun nef = _mint_in(van, sut, gol, nog);
u3_noun viz = _mint_in(van, sut, c3__noun, q_gen);
ret = u3nc(u3k(u3h(nef)),
u3nt(12, u3nc(1, u3nc(151, u3k(u3h(nef)))), u3k(u3t(viz))));
u3z(viz);
u3z(nef);
u3z(nog);
return ret;
}
case c3__dtls: p_gen = u3t(gen);
_mint_used();
{
u3_noun tom = u3nt(c3__atom, u3_blip, u3_nul);
u3_noun sam = _mint_in(van, sut, tom, p_gen);
ret = u3nc(_mint_nice(van, gol, tom),
u3nc(4, u3k(u3t(sam))));
u3z(sam);
return ret;
}
case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = u3qfu_play(van, sut, gen);
u3_noun ret = u3nc(_mint_nice(van, gol, typ),
u3nc(1, u3k(q_gen)));
return ret;
}
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun one = _mint_corn(van, sut, p_gen);
u3_noun two = _mint_corn(van, sut, q_gen);
return u3nc(_mint_nice(van, gol, c3__noun),
u3nt(2, one, two));
}
case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = u3qfu_play(van, sut, gen);
u3_noun ret = u3nc(_mint_nice(van, gol, typ),
u3nc(1, u3k(q_gen)));
return ret;
}
case c3__hand:
_mint_used();
{
return u3k(u3t(gen));
}
case c3__ktbr: p_gen = u3t(gen);
_mint_used();
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__iron);
u3_noun tyn = _mint_nice(van, gol, tyf);
u3_noun pro = u3nc(tyn, u3k(u3t(ryd)));
u3z(ryd);
return pro;
}
case c3__ktpd:
case c3__ktpm: p_gen = u3t(gen);
_mint_used();
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__zinc);
u3_noun tyn = _mint_nice(van, gol, tyf);
u3_noun pro = u3nc(tyn, u3k(u3t(ryd)));
u3z(ryd);
return pro;
}
case c3__ktwt: p_gen = u3t(gen);
_mint_used();
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__lead);
u3_noun tyn = _mint_nice(van, gol, tyf);
u3_noun pro = u3nc(tyn, u3k(u3t(ryd)));
u3z(ryd);
return pro;
}
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun ret = u3nc(u3qf_hint(hit, u3h(hum)),
u3k(u3t(hum)));
u3z(hum);
u3z(hit);
return ret;
}
case c3__tune: p_gen = u3t(gen);
_mint_used();
{
return u3nc(u3qf_face(p_gen, sut), u3nc(0, 1));
}
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun huz = u3qfu_play(van, sut, p_gen);
u3_noun hif = _mint_nice(van, gol, huz);
u3_noun zel = _mint_in(van, sut, hif, q_gen);
u3_noun ret = u3nc(hif, u3k(u3t(zel)));
u3z(zel);
return ret;
}
case c3__tsbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun fid = _mint_in(van, sut, c3__noun, p_gen);
u3_noun p_fid = u3h(fid);
u3_noun q_fid = u3t(fid);
if ( 0 == p_fid ) {
u3m_p("bad subject: p_gen", p_gen);
c3_assert(0);
}
u3_noun dov = _mint_in(van, p_fid, gol, q_gen);
u3_noun p_dov = u3h(dov);
u3_noun q_dov = u3t(dov);
ret = u3nc(u3k(p_dov),
u3qf_comb(q_fid, q_dov));
u3z(fid);
u3z(dov);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun boc = u3qfu_busk(van, sut, p_gen);
u3_noun ret = _mint_in(van, boc, gol, q_gen);
u3z(boc);
return ret;
}
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
return _mint_cnts(van, sut, gol, p_gen, q_gen);
}
case c3__brcn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mint_grow(van, sut, gol, c3__gold, p_gen, c3__dry, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brvt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mint_grow(van, sut, gol, c3__gold, p_gen, c3__wet, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = u3qfu_play(van, sut, p_gen);
u3_noun dug = u3qfu_duck(van, typ);
u3t_push(u3nc(c3__mean, dug));
{
ret = _mint_in(van, sut, gol, q_gen);
}
u3t_drop();
u3z(typ);
return ret;
}
case c3__sgbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun bez;
if ( c3y == u3ud(p_gen) ) {
bez = u3k(p_gen);
} else {
bez = u3nc(u3k(u3h(p_gen)),
_mint_corn(van, sut, u3t(p_gen)));
}
ret = u3nc(u3k(u3h(hum)),
u3nt(11, bez, u3k(u3t(hum))));
u3z(hum);
return ret;
}
case c3__zpts: p_gen = u3t(gen);
_mint_used();
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_vet, c3n, 0);
u3_noun sev = _mint_corn(von, sut, p_gen);
u3z(von);
return u3nc(c3__noun, u3nc(1, sev));
}
case c3__ktcn: p_gen = u3t(gen);
_mint_used();
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_fab, c3n, 0);
u3_noun ret = _mint_in(von, sut, gol, p_gen);
u3z(von);
return ret;
}
case c3__wthx: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hyp = u3nc(u3nc(c3y, 1), u3k(q_gen));
u3_noun fid = u3qfu_find(van, sut, c3__free, hyp);
if ( c3y != u3h(fid) ) {
return u3m_error("mint-fragment");
}
else {
u3_noun pp_fid = u3h(u3t(fid));
u3_noun qp_fid = u3t(u3t(fid));
if ( c3y != u3h(qp_fid) ) {
return u3m_error("mint-fragment");
}
else {
u3_noun pqp_fid = u3t(qp_fid);
u3_noun axe = _mint_tend(pp_fid);
u3_noun ret;
ret = u3nc(_mint_nice(van, gol, _mint_bean()),
u3qfr_fish(van, pqp_fid, p_gen, axe));
u3z(axe);
u3z(fid);
u3z(hyp);
return ret;
}
}
}
case c3__cold:
case c3__ktsg: p_gen = u3t(gen);
_mint_used();
{
c3_m fun_m = 141 + c3__blow;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, gol, p_gen);
if ( u3_none != pro ) {
return pro;
}
else {
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_mint_in-blow", von, "blow");
u3_noun pro;
pro = u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(gol),
u3x_sam_3,
u3k(p_gen),
0));
return u3z_save_4(fun_m, vrf, sut, gol, p_gen, pro);
}
}
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
return u3nc(_mint_nice(van,
gol,
u3qfu_play(van, sut, p_gen)),
u3nc(1, u3k(q_gen)));
}
case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
{
u3t_push(u3nc(c3__mean, _mint_loc(van, p_gen)));
{
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun bez = u3nt(c3__spot, 1, u3k(p_gen));
ret = u3nc(u3k(u3h(hum)), u3nt(11, bez, u3k(u3t(hum))));
u3z(hum);
}
u3t_drop();
return ret;
}
case c3__zpmc:
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun vos = _mint_in(van, sut, c3__noun, q_gen);
u3_noun zur = u3qfu_play(van, sut, p_gen);
u3_noun p_vos = u3h(vos);
u3_noun q_vos = u3t(vos);
u3_noun waz = u3nc(1, _mint_burp(van, p_vos));
// u3_noun waz = u3nc(1, u3k(p_vos));
u3_noun sif = u3k(zur);
u3_noun cig = u3qf_cell(sif, p_vos);
u3_noun ret;
ret = u3nc(_mint_nice(van, gol, cig),
u3qf_cons(waz, q_vos));
u3z(waz);
u3z(zur);
u3z(sif);
u3z(vos);
return ret;
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mint_used();
{
if ( c3y == _mint_feel(van, sut, p_gen) ) {
return _mint_in(van, sut, gol, q_gen);
} else {
return _mint_in(van, sut, gol, r_gen);
}
}
case c3__lost: p_gen = u3t(gen);
_mint_used();
{
if ( c3y == _mint_vet(van) ) {
u3_noun zur = u3qfu_play(van, sut, p_gen);
u3_noun dun = u3qfu_dunq(van, "lost", zur);
u3t_push(u3nc(c3__mean, dun));
return u3m_error("mint-lost");
}
else {
return u3nt(c3__void, 0, 0);
}
}
case c3__fail:
case c3__zpzp:
_mint_used();
{
return u3nt(c3__void, 0, 0);
}
}
}
static u3_noun
_cqfu_mint(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun gen)
{
return _mint_in(van, sut, gol, gen);
}
/* boilerplate
*/
u3_noun
u3wfu_mint(u3_noun cor)
{
@ -879,26 +16,17 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_mint(van, sut, gol, gen);
}
}
u3_noun
u3qfu_mint(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun gen)
{
c3_m fun_m = 141 + c3__mint;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, gol, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_mint(van, sut, gol, gen);
return u3z_save_4(fun_m, vrf, sut, gol, gen, pro);
c3_m fun_m = 141 + c3__mint;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, gol, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
return u3z_save_4(fun_m, vrf, sut, gol, gen, pro);
}
}
}

View File

@ -3,815 +3,6 @@
*/
#include "all.h"
/* functions
*/
static u3_noun
_mull_in(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_mull_bean()
{
return u3kf_fork(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul));
}
static u3_noun
_mull_loc(u3_noun van,
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_cook("_mull_loc-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
u3z(sho);
return ret;
}
static u3_noun
_mull_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
static u3_noun
_mull_tend(u3_noun vit)
{
if ( u3_nul == vit ) {
return 1;
} else {
u3_noun nex = _mull_tend(u3t(vit));
if ( u3_nul == u3h(vit) ) {
return nex;
} else {
u3_noun boy = u3qc_peg(u3t(u3h(vit)), nex);
u3z(nex);
return boy;
}
}
}
static u3_noun
_mull_cove(u3_noun nug)
{
if ( 0 == u3h(nug) ) {
return u3k(u3t(nug));
}
else if ( 11 == u3h(nug) ) {
return _mull_cove(u3t(u3t(nug)));
}
else {
return u3m_error("mull-cove");
}
}
static u3_noun
_mull_mile(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun mel,
u3_noun nym,
u3_noun hud,
u3_noun dom)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "mile");
// u3l_log("mile\r\n");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(dox),
u3x_sam_6,
u3k(mel),
u3x_sam_14,
u3k(nym),
u3x_sam_30,
u3k(hud),
u3x_sam_31,
u3k(dom),
0));
}
static u3_noun
_mull_doke(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun fug = u3qfu_mint(van, sut, c3__noun, gen);
u3_noun axe = _mull_cove(u3t(fug));
u3z(fug);
return axe;
}
static u3_noun
_mull_nice(u3_noun van,
u3_noun gol,
u3_noun typ)
{
if ( c3n == u3qfu_nest(van, gol, c3y, typ) ) {
// u3_noun dun = u3qfu_dunq(van, "need", gol);
// u3_noun niz = u3qfu_dunq(van, "have", typ);
// u3t_push(u3nc(c3__mean, dun));
// u3t_push(u3nc(c3__mean, niz));
return u3m_error("mull-nice");
}
else return typ;
}
static u3_noun
_mull_grow(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_atom mel,
u3_noun nym,
u3_noun hud,
u3_noun ruf,
u3_noun dom)
{
u3_noun dan = _mull_in(van, sut, c3__noun, dox, ruf);
u3_noun p_dan = u3h(dan);
u3_noun q_dan = u3t(dan);
u3_noun yaz = _mull_mile(van, p_dan, q_dan, mel, nym, hud, dom);
u3_noun p_yaz = u3h(yaz);
u3_noun q_yaz = u3t(yaz);
u3_noun ret = u3nc(_mull_nice(van, gol, u3k(p_yaz)), u3k(q_yaz));
u3z(yaz);
u3z(dan);
return ret;
}
static u3_noun
_mull_both(u3_noun van,
u3_noun gol,
u3_noun typ)
{
return u3nc(_mull_nice(van, gol, u3k(typ)),
typ);
}
#if 1
static u3_noun
_mull_cnts(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun hyp,
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_mull_cnts-emul", von, "emul");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(gol),
u3x_sam_6,
u3k(dox),
u3x_sam_14,
u3k(hyp),
u3x_sam_15,
u3k(rig),
0));
}
#else
static u3_noun
_mull_edit(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun mew,
u3_noun p_yom,
u3_noun q_yom)
{
while ( 1 ) {
if ( c3n == u3du(mew) ) {
return u3nc(p_yom, q_yom);
} else {
u3_noun i_mew = u3h(mew);
u3_noun t_mew = u3t(mew);
u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew);
u3_noun zil = _mull_in(van, sut, c3__noun, dox, qi_mew);
u3_noun p_zil = u3h(zil);
u3_noun q_zil = u3t(zil);
u3_noun cuf = u3qfu_toss(van, sut, pi_mew, p_zil, p_yom);
u3_noun dof = u3qfu_toss(van, sut, pi_mew, q_zil, q_yom);
if ( u3r_sing(u3h(cuf), u3h(dof)) ) {
u3m_error("mull-bonk-a");
}
u3z(p_yom);
p_yom = u3k(u3t(cuf));
u3z(q_yom);
q_yom = u3k(u3t(dof));
u3z(dof);
u3z(cuf);
u3z(zil);
mew = t_mew;
}
}
}
static u3_noun
_mull_cnts_old(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun hyp,
u3_noun rig)
{
u3_noun lar = u3qfu_seek(van, sut, c3__read, hyp);
u3_noun vug = u3qfu_seek(van, dox, c3__read, hyp);
u3_noun p_lar = u3h(lar);
u3_noun q_lar = u3t(lar);
u3_noun pq_lar = u3h(q_lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun p_vug = u3h(vug);
u3_noun q_vug = u3t(vug);
u3_noun pq_vug = u3h(q_vug);
u3_noun qq_vug = u3t(q_vug);
if ( c3a(u3r_sing(p_lar, p_vug), u3r_sing(pq_lar, pq_vug)) ) {
u3m_error("mull-bonk-e");
}
{
u3_noun mew = rig;
u3_noun yom = _mull_edit
(van, sut, dox, mew, u3k(qq_lar),
u3k(qq_vug));
u3_noun von = u3i_molt(u3k(van), u3qfu_van_vet, c3n, 0);
u3_noun p_ret = u3qfu_fire(van, sut, u3h(yom));
u3_noun q_ret = u3qfu_fire(von, sut, u3t(yom));
u3z(von);
u3z(yom);
u3z(vug);
u3z(lar);
return u3nc(_mull_nice(van, gol, p_ret), q_ret);
}
}
#endif
# define _mull_used()
static u3_noun
_mull_in(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
{
u3_noun p_gen, q_gen, r_gen;
u3_noun ret;
if ( c3n == u3du(gen) ) {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
ret = _mull_in(van, sut, gol, dox, rex);
u3z(rex);
return ret;
}
else if ( c3y == u3du(u3h(gen)) ) {
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, u3h(gen));
u3_noun tal = _mull_in(van, sut, c3__noun, dox, u3t(gen));
u3_noun dis = u3qf_cell(u3h(hed), u3h(tal));
u3_noun dat = u3qf_cell(u3t(hed), u3t(tal));
u3_noun ret = u3nc(_mull_nice(van, gol, dis), dat);
u3z(tal);
u3z(hed);
return ret;
}
}
else switch ( u3h(gen) ) {
default: {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
if ( c3y == u3r_sing(rex, gen) ) {
#if 1
u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));
u3t_push(u3nc(c3__mean, zix));
return u3m_error("mull-open");
#else
u3_err("h", u3h(gen));
return u3m_bail(c3__fail);
#endif
}
ret = _mull_in(van, sut, gol, dox, rex);
u3z(rex);
return ret;
}
case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_waz = u3qfu_play(van, sut, p_gen);
u3_noun q_waz = u3qfu_play(van, dox, p_gen);
u3_noun dok = u3nc(c3__wing, u3k(q_gen));
u3_noun p_syx = _mull_doke(van, sut, dok);
u3_noun q_syx = _mull_doke(van, dox, dok);
u3_noun p_pov = u3qfu_fish(van, p_waz, p_syx);
u3_noun q_pov = u3qfu_fish(van, q_waz, q_syx);
if ( (c3n == u3r_sing(p_syx, q_syx)) ||
(c3n == u3r_sing(p_pov, q_pov)) )
{
return u3m_error("mull-bonk-b");
}
u3z(p_waz); u3z(q_waz);
u3z(p_syx); u3z(q_syx);
u3z(p_pov); u3z(q_pov);
u3z(dok);
return _mull_both(van, gol, _mull_bean());
}
case c3__wthx: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hyp = u3nc(u3nc(c3y, 1), u3k(q_gen));
u3_noun fid = u3qfu_find(van, sut, c3__free, hyp);
u3_noun gax = u3qfu_find(van, dox, c3__free, hyp);
u3_noun old_type, old_axis;
u3_noun new_type, new_axis;
{
if ( c3y != u3h(fid) ) {
return u3m_error("mull-bonk-x");
}
else {
u3_noun pp_fid = u3h(u3t(fid));
u3_noun qp_fid = u3t(u3t(fid));
if ( c3y != u3h(qp_fid) ) {
return u3m_error("mull-bonk-x");
}
new_type = u3t(qp_fid);
new_axis = _mull_tend(pp_fid);
}
}
{
if ( c3y != u3h(gax) ) {
return u3m_error("mull-bonk-x");
}
else {
u3_noun pp_gax = u3h(u3t(gax));
u3_noun qp_gax = u3t(u3t(gax));
if ( c3y != u3h(qp_gax) ) {
return u3m_error("mull-bonk-x");
}
old_type = u3t(qp_gax);
old_axis = _mull_tend(pp_gax);
}
}
if ( c3n == u3r_sing(old_axis, new_axis) ) {
return u3m_error("mull-bonk-x");
}
else if ( c3n == u3qfu_nest(van, old_type, c3y, new_type) ) {
return u3m_error("mull-bonk-x");
}
u3z(old_axis);
u3z(new_axis);
u3z(gax);
u3z(fid);
return _mull_both(van, gol, _mull_bean());
}
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mull_used();
{
u3_noun bol = _mull_bean();
u3_noun nor = _mull_in(van, sut, bol, dox, p_gen);
u3_noun p_fex = u3qfu_gain(van, sut, p_gen);
u3_noun q_fex = u3qfu_gain(van, dox, p_gen);
u3_noun p_wux = u3qfu_lose(van, sut, p_gen);
u3_noun q_wux = u3qfu_lose(van, dox, p_gen);
u3_noun hiq, ran;
u3_noun dis, dat;
u3_noun ret;
if ( c3__void == p_fex ) {
hiq = u3nc(c3__void,
(c3__void == q_fex)
? c3__void
: u3qfu_play(van, q_fex, q_gen));
} else if ( c3__void == q_fex ) {
hiq = u3m_error("mull-bonk-c");
}
else hiq = _mull_in(van, p_fex, gol, q_fex, q_gen);
if ( c3__void == p_wux ) {
ran = u3nc(c3__void,
(c3__void == q_wux)
? c3__void
: u3qfu_play(van, q_wux, r_gen));
} else if ( c3__void == q_wux ) {
ran = u3m_error("mull-bonk-d");
}
else ran = _mull_in(van, p_wux, gol, q_wux, r_gen);
dis = u3qf_forq(u3h(hiq), u3h(ran));
dat = u3qf_forq(u3t(hiq), u3t(ran));
ret = u3nc(_mull_nice(van, gol, dis), dat);
u3z(ran);
u3z(hiq);
u3z(q_wux);
u3z(p_wux);
u3z(q_fex);
u3z(p_fex);
u3z(nor);
u3z(bol);
return ret;
}
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
u3_noun dis = u3qf_cell(u3h(hed), u3h(tal));
u3_noun dat = u3qf_cell(u3t(hed), u3t(tal));
u3_noun ret = u3nc(_mull_nice(van, gol, dis), dat);
u3z(tal);
u3z(hed);
return ret;
}
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
u3z(hed);
u3z(tal);
return _mull_both(van, gol, _mull_bean());
}
case c3__dtwt: p_gen = u3t(gen);
_mull_used();
{
u3_noun vay = _mull_in(van, sut, c3__noun, dox, p_gen);
u3z(vay);
return _mull_both(van, gol, _mull_bean());
}
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun nog = u3nc(c3__kttr, u3k(p_gen));
u3_noun vay = _mull_in(van, sut, c3__noun, dox, q_gen);
u3_noun ret;
u3z(vay);
ret = _mull_in(van, sut, gol, dox, nog);
u3z(nog);
return ret;
}
case c3__dtls: p_gen = u3t(gen);
_mull_used();
{
u3_noun wuq = u3nt(c3__atom, u3_blip, u3_nul);
u3_noun vay = _mull_in(van, sut, wuq, dox, p_gen);
u3z(vay);
return _mull_both(van, gol, wuq);
}
case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun typ = u3qfu_play(van, sut, gen);
return _mull_both(van, gol, typ);
}
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
u3z(hed);
u3z(tal);
return _mull_both(van, gol, c3__noun);
}
case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun typ = u3qfu_play(van, sut, gen);
return _mull_both(van, gol, typ);
}
case c3__hand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
return u3nc(u3k(p_gen), u3k(p_gen));
}
case c3__ktbr: p_gen = u3t(gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc(u3qfu_wrap(van,
u3h(vat),
c3__iron),
u3qfu_wrap(van,
u3t(vat),
c3__iron));
u3z(vat);
return pro;
}
case c3__ktpd:
case c3__ktpm: p_gen = u3t(gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc(u3qfu_wrap(van,
u3h(vat),
c3__zinc),
u3qfu_wrap(van,
u3t(vat),
c3__zinc));
u3z(vat);
return pro;
}
case c3__ktwt: p_gen = u3t(gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc(u3qfu_wrap(van,
u3h(vat),
c3__lead),
u3qfu_wrap(van,
u3t(vat),
c3__lead));
u3z(vat);
return pro;
}
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, q_gen);
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun hix = u3nc(u3k(dox), u3k(p_gen));
u3_noun ret = u3nc(u3qf_hint(hit, u3h(vat)),
u3qf_hint(hix, u3t(vat)));
u3z(hix);
u3z(hit);
u3z(vat);
return ret;
}
case c3__tune: p_gen = u3t(gen);
_mull_used();
{
return u3nc(u3qf_face(p_gen, sut),
u3qf_face(p_gen, dox));
}
case c3__ktsg: p_gen = u3t(gen);
_mull_used();
{
return _mull_in(van, sut, gol, dox, p_gen);
}
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_hif = _mull_nice(van, gol, u3qfu_play(van, sut, p_gen));
u3_noun q_hif = u3qfu_play(van, dox, p_gen);
u3_noun zel = _mull_in(van, sut, p_hif, dox, q_gen);
u3_noun ret = u3nc(p_hif, q_hif);
u3z(zel);
return ret;
}
case c3__tsbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun lem = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun p_lem = u3h(lem);
u3_noun q_lem = u3t(lem);
u3_noun ret = _mull_in(van, p_lem, gol, q_lem, q_gen);
u3z(lem);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun boc = u3qfu_busk(van, sut, p_gen);
u3_noun nuf = u3qfu_busk(van, dox, p_gen);
u3_noun ret = _mull_in(van, boc, gol, nuf, q_gen);
u3z(boc);
u3z(nuf);
return ret;
}
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
return _mull_cnts(van, sut, gol, dox, p_gen, q_gen);
}
case c3__brcn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mull_grow
(van, sut, gol, dox, c3__gold, p_gen, c3__dry, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brvt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mull_grow
(van, sut, gol, dox, c3__gold, p_gen, c3__wet, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun typ = u3qfu_play(van, sut, p_gen);
u3_noun dug = u3qfu_duck(van, typ);
u3_noun ret;
u3t_push(u3nc(c3__mean, dug));
{
ret = _mull_in(van, sut, gol, dox, q_gen);
}
u3t_drop();
u3z(typ);
return ret;
}
case c3__sgbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
return _mull_in(van, sut, gol, dox, q_gen);
}
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_ret = u3qfu_play(van, sut, p_gen);
u3_noun q_ret = u3qfu_play(van, sut, q_gen);
return u3nc(_mull_nice(van, gol, p_ret),
q_ret);
}
case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
{
u3_noun ret;
u3t_push(u3nc(c3__mean, _mull_loc(van, p_gen)));
{
ret = _mull_in(van, sut, gol, dox, q_gen);
}
u3t_drop();
return ret;
}
case c3__zpts: p_gen = u3t(gen);
_mull_used();
{
return _mull_both(van, gol, c3__noun);
}
case c3__ktcn: p_gen = u3t(gen);
_mull_used();
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_fab, c3n, 0);
u3_noun ret = _mull_in(von, sut, gol, dox, p_gen);
u3z(von);
return ret;
}
case c3__zpmc:
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_zur = u3qfu_play(van, sut, p_gen);
u3_noun q_zur = u3qfu_play (van, dox, p_gen);
u3_noun vos = _mull_in(van, sut, c3__noun, dox, q_gen);
u3_noun p_ret = u3qf_cell(p_zur, u3h(vos));
u3_noun q_ret = u3qf_cell(q_zur, u3t(vos));
u3z(vos);
u3z(q_zur);
u3z(p_zur);
return u3nc
(_mull_nice(van, gol, p_ret), q_ret);
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mull_used();
{
c3_o fes = _mull_feel(van, sut, p_gen);
c3_o fed = _mull_feel(van, dox, p_gen);
if ( fes != fed ) {
return u3m_error("mull-bonk-f");
}
else {
if ( c3y == fes ) {
return _mull_in(van, sut, gol, dox, q_gen);
} else {
return _mull_in(van, sut, gol, dox, r_gen);
}
}
}
case c3__lost:
case c3__fail:
case c3__zpzp:
_mull_used();
{
return u3nc(c3__void, c3__void);
}
}
}
static u3_noun
_cqfu_mull(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
{
return _mull_in(van, sut, gol, dox, gen);
}
/* boilerplate
*/
u3_noun
u3wfu_mull(u3_noun cor)
{
@ -826,27 +17,16 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_mull(van, sut, gol, dox, gen);
c3_m fun_m = 141 + c3__mull + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_4(fun_m, sut, gol, dox, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
return u3z_save_4(fun_m, sut, gol, dox, gen, pro);
}
}
}
u3_noun
u3qfu_mull(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
{
c3_m fun_m = 141 + c3__mull + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_4(fun_m, sut, gol, dox, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_mull(van, sut, gol, dox, gen);
return u3z_save_4(fun_m, sut, gol, dox, gen, pro);
}
}

View File

@ -3,405 +3,34 @@
*/
#include "all.h"
/* logic
*/
/* forward
*/
static u3_noun
_nest_sint(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_nest_dext(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_nest_deep(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun dab,
u3_noun hem,
u3_noun gil)
u3_noun
u3wfu_nest_dext(u3_noun dext_core)
{
if ( u3_nul == dab ) {
return u3r_sing(u3_nul, hem);
} else if ( u3_nul == hem ) {
return c3n;
} else {
u3_noun n_dab, l_dab, r_dab;
u3_noun n_hem, l_hem, r_hem;
u3_noun pn_hem, qn_hem, pn_dab, qn_dab;
u3_noun nest_in_core, nest_core;
u3_noun sut, ref, van, seg, reg, gil;
u3x_trel(dab, &n_dab, &l_dab, &r_dab);
u3x_trel(hem, &n_hem, &l_hem, &r_hem);
if ( (c3n == _nest_deep(van, sut, tel, ref, l_dab, l_hem, gil)) ||
(c3n == _nest_deep(van, sut, tel, ref, r_dab, r_hem, gil)) )
{
return c3n;
}
u3x_cell(n_dab, &pn_dab, &qn_dab);
u3x_cell(n_hem, &pn_hem, &qn_hem);
if ( c3n == u3r_sing(pn_dab, pn_hem) ) {
return c3n;
}
else {
u3_noun vis = u3qfu_play(van, sut, qn_dab);
u3_noun lon = u3qfu_play(van, ref, qn_hem);
u3_noun ret = _nest_dext(van, vis, tel, lon, u3_nul, u3_nul, gil);
u3z(vis);
u3z(lon);
return ret;
}
}
}
static u3_noun
_nest_dope(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun dom,
u3_noun vim,
u3_noun gil)
{
if ( u3_nul == dom ) {
return u3r_sing(u3_nul, vim);
} else if ( u3_nul == vim ) {
return c3n;
} else {
u3_noun n_dom, l_dom, r_dom;
u3_noun n_vim, l_vim, r_vim;
u3_noun pn_vim, qn_vim, pn_dom, qn_dom;
u3_noun pqn_vim, qqn_vim, pqn_dom, qqn_dom;
u3x_trel(dom, &n_dom, &l_dom, &r_dom);
u3x_trel(vim, &n_vim, &l_vim, &r_vim);
if ( (c3n == _nest_dope(van, sut, tel, ref, l_dom, l_vim, gil)) ||
(c3n == _nest_dope(van, sut, tel, ref, r_dom, r_vim, gil)) )
{
return c3n;
}
u3x_cell(n_dom, &pn_dom, &qn_dom);
u3x_cell(n_vim, &pn_vim, &qn_vim);
u3x_cell(qn_dom, &pqn_dom, &qqn_dom);
u3x_cell(qn_vim, &pqn_vim, &qqn_vim);
if ( c3n == u3r_sing(pn_dom, pn_vim) ) {
return c3n;
} else {
return _nest_deep(van, sut, tel, ref, qqn_dom, qqn_vim, gil);
}
}
}
static u3_noun
_nest_cong(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun gil)
{
u3_noun p_sut, q_sut, p_ref, q_ref;
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun pq_ref, qq_ref, rq_ref;
u3_noun prq_sut, qrq_sut, prq_ref, qrq_ref;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3_noun ppq_ref, qpq_ref, rpq_ref;
u3_noun ret;
u3x_trel(sut, 0, &p_sut, &q_sut);
u3x_trel(ref, 0, &p_ref, &q_ref);
u3x_trel(q_sut, &pq_sut, &qq_sut, &rq_sut);
u3x_trel(q_ref, &pq_ref, &qq_ref, &rq_ref);
u3x_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut);
u3x_trel(pq_ref, &ppq_ref, &qpq_ref, &rpq_ref);
u3x_cell(rq_sut, &prq_sut, &qrq_sut);
u3x_cell(rq_ref, &prq_ref, &qrq_ref);
if ( c3y == u3r_sing(q_sut, q_ref) ) {
return _nest_dext(van, p_sut, tel, p_ref, u3_nul, u3_nul, gil);
}
else if ( c3n == u3r_sing(qpq_sut, qpq_ref) ) {
return c3n;
}
else if ( (c3n == _nest_dext
(van, qq_sut, tel, p_sut, u3_nul, u3_nul, gil)) ||
(c3n == _nest_dext
(van, p_sut, tel, qq_sut, u3_nul, u3_nul, gil)) ||
(c3n == _nest_dext
(van, qq_ref, tel, p_ref, u3_nul, u3_nul, gil)) )
if ( (u3_none == (nest_in_core = u3r_at(3, dext_core))) ||
(c3n == u3r_mean(nest_in_core, u3x_sam_2, &seg,
u3x_sam_6, &reg,
u3x_sam_7, &gil,
7, &nest_core,
0)) ||
(c3n == u3r_mean(nest_core, u3x_sam_3, &ref,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return c3n;
}
else {
if ( (rpq_sut != rpq_ref) &&
(c3__lead != rpq_sut) &&
(c3__gold != rpq_ref) )
{
return c3n;
}
else if ( c3__wet == qpq_sut ) {
return u3r_sing(qrq_sut, qrq_ref);
}
else {
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( (c3y == u3qdi_has(gil, hud)) ) {
u3z(hud);
return c3y;
}
else {
u3_noun zoc = u3qdi_put(gil, hud);
u3_noun tus = u3nt(c3__core,
u3k(qq_sut),
u3nc(u3nt(u3k(ppq_sut), u3k(qpq_sut), c3__gold),
u3k(u3t(q_sut))));
u3_noun fer = u3nt(c3__core,
u3k(qq_ref),
u3nc(u3nt(u3k(ppq_ref), u3k(qpq_ref), c3__gold),
u3k(u3t(q_ref))));
ret = _nest_dope(van, tus, tel, fer, qrq_sut, qrq_ref, zoc);
u3z(fer);
u3z(tus);
u3z(zoc);
u3z(hud);
if ( c3n == ret ) {
return c3n;
}
else {
switch ( rpq_sut ) {
default: return u3m_bail(c3__fail);
case c3__gold: {
return
c3a(_nest_dext(van, qq_sut, tel, qq_ref, u3_nul, u3_nul, gil),
_nest_dext(van, qq_ref, tel, qq_sut, u3_nul, u3_nul, gil));
}
case c3__iron: {
u3_noun s_sam = u3qfu_peek(van, qq_sut, c3__rite, 2);
u3_noun r_sam = u3qfu_peek(van, qq_ref, c3__rite, 2);
u3_noun ret = _nest_dext
(van, r_sam, tel, s_sam, u3_nul, u3_nul, gil);
u3z(r_sam);
u3z(s_sam);
return ret;
}
case c3__lead: {
return c3y;
}
case c3__zinc: {
u3_noun s_pal = u3qfu_peek(van, qq_sut, c3__read, 2);
u3_noun r_pal = u3qfu_peek(van, qq_ref, c3__read, 2);
u3_noun ret = _nest_dext
(van, s_pal, tel, r_pal, u3_nul, u3_nul, gil);
u3z(r_pal);
u3z(s_pal);
return ret;
}
}
}
}
}
}
}
static u3_noun
_nest_dext_in(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
u3_noun p_sut, q_sut, p_ref, q_ref;
if ( (c3n == u3du(sut)) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
return c3y;
}
case c3__void: {
return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
}
else {
if ( c3y == u3r_pq(ref, c3__atom, &p_ref, &q_ref) ) {
if ( (c3n == u3qf_fitz(p_sut, p_ref)) ||
( (c3y == u3du(q_sut)) &&
( (c3n == u3du(q_ref)) ||
(c3n == u3r_sing(q_sut, q_ref)))) )
{
return c3n;
}
return c3y;
}
return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__cell: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
if ( c3y == u3r_pq(ref, c3__cell, &p_ref, &q_ref) ) {
return c3a(_nest_dext(van, p_sut, tel, p_ref, u3_nul, u3_nul, gil),
_nest_dext(van, q_sut, tel, q_ref, u3_nul, u3_nul, gil));
}
else return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__core: {
if ( c3n == u3r_trel(sut, 0, &p_sut, &q_sut) ) {
return u3m_bail(c3__fail);
} else {
if ( (c3y == u3r_pq(ref, c3__core, &p_ref, &q_ref)) ) {
return _nest_cong(van, sut, tel, ref, gil);
}
else return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
return _nest_dext(van, q_sut, tel, ref, seg, reg, gil);
}
}
case c3__fork: p_sut = u3t(sut);
{
if ( c3n == u3du(ref) ) switch ( ref ) {
default: return _nest_sint(van, sut, tel, ref, seg, reg, gil);
case c3__noun:
break;
}
else switch ( u3h(ref) ) {
default: return _nest_sint(van, sut, tel, ref, seg, reg, gil);
case c3__atom:
case c3__cell:
case c3__core:
break;
}
{
u3_noun dey = u3qdi_tap(p_sut);
u3_noun yed = dey;
while ( u3_nul != yed ) {
if ( c3y == _nest_dext(van, u3h(yed), c3n, ref, seg, reg, gil) ) {
u3z(dey);
return c3y;
} else {
yed = u3t(yed);
}
}
u3z(dey);
return c3n;
}
}
case c3__hold:
{
if ( c3y == u3qdi_has(seg, sut) ) {
return c3n;
}
else {
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( (c3y == u3qdi_has(gil, hud)) ) {
u3z(hud);
return c3y;
}
else {
u3_noun gus = u3qdi_put(seg, sut);
u3_noun zoc = u3qdi_put(gil, hud);
u3_noun fop = u3qfu_repo(van, sut);
u3_noun hiv = _nest_dext(van, fop, tel, ref, gus, reg, zoc);
u3z(hud);
u3z(fop);
u3z(zoc);
u3z(gus);
return hiv;
}
}
}
}
}
static u3_noun
_nest_dext_to(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
u3_noun tyn = _nest_dext_in(van, sut, tel, ref, seg, reg, gil);
if ( (c3y == tyn) || (c3n == tel) ) {
return tyn;
return u3m_bail(c3__fail);
} else {
#if 0
u3_noun dun = u3qfu_dunq(van, "need", sut);
u3_noun niz = u3qfu_dunq(van, "have", ref);
u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
#endif
return u3m_error("nest-fail");
}
}
static u3_noun
_nest_dext(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
if ( (c3y == u3r_sing(sut, ref)) ) {
return c3y;
}
{
c3_m fun_m = 141 + c3__nest + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
c3_m fun_m = 141 + c3__dext + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _nest_dext_to(van, sut, tel, ref, seg, reg, gil);
pro = u3n_nock_on(u3k(dext_core), u3k(u3x_at(u3x_bat, dext_core)));
if ( ((c3y == pro) && (u3_nul == reg)) ||
((c3n == pro) && (u3_nul == seg)) )
@ -413,107 +42,6 @@
}
}
static u3_noun
_nest_sint(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
u3_noun p_ref, q_ref;
if ( (c3n == u3du(ref)) ) {
switch ( ref ) {
default: return u3m_bail(c3__fail);
case c3__noun: return c3n;
case c3__void: return c3y;
}
}
else {
switch ( u3h(ref) ) {
default: {
return u3m_bail(c3__fail);
}
case c3__atom: return c3n;
case c3__cell: return c3n;
case c3__core: {
u3_noun gam = u3qfu_repo(van, ref);
u3_noun hiv = _nest_dext(van, sut, tel, gam, seg, reg, gil);
u3z(gam);
return hiv;
}
case c3__hint:
case c3__face: {
if ( c3n == u3r_trel(ref, 0, &p_ref, &q_ref) ) {
return u3m_bail(c3__fail);
} else {
return _nest_dext(van, sut, tel, q_ref, seg, reg, gil);
}
}
case c3__fork: p_ref = u3t(ref);
{
u3_noun dey = u3qdi_tap(p_ref);
u3_noun yed = dey;
while ( u3_nul != yed ) {
if ( c3n == _nest_dext(van, sut, c3n, u3h(yed), seg, reg, gil) ) {
u3z(dey);
return c3n;
} else {
yed = u3t(yed);
}
}
u3z(dey);
return c3y;
}
case c3__hold: {
if ( c3y == u3qdi_has(reg, ref) ) {
return c3y;
}
{
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( (c3y == u3qdi_has(gil, hud)) ) {
u3z(hud);
return c3y;
} else {
u3_noun gur = u3qdi_put(reg, ref);
u3_noun zoc = u3qdi_put(gil, hud);
u3_noun gam = u3qfu_repo(van, ref);
{
u3_noun hiv = _nest_dext(van, sut, tel, gam, seg, gur, zoc);
u3z(hud);
u3z(gam);
u3z(zoc);
u3z(gur);
return hiv;
}
}
}
}
}
}
}
static u3_noun
_cqfu_nest(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref)
{
return _nest_dext(van, sut, tel, ref, u3_nul, u3_nul, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_nest(u3_noun cor)
{
@ -528,33 +56,19 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_nest(van, sut, tel, ref);
c3_m fun_m = 141 + c3__nest;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, tel, ref);
if ( u3_none != pro ) {
// u3t_heck(c3__good);
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
// u3t_heck(c3__nest);
return u3z_save_4(fun_m, vrf, sut, tel, ref, pro);
}
}
}
u3_noun
u3qfu_nest(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref)
{
#if 1
c3_m fun_m = 141 + c3__nest;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, tel, ref);
if ( u3_none != pro ) {
// u3t_heck(c3__good);
return pro;
}
else {
pro = _cqfu_nest(van, sut, tel, ref);
// u3t_heck(c3__nest);
return u3z_save_4(fun_m, vrf, sut, tel, ref, pro);
}
#else
return _cqfu_nest(van, sut, tel, ref);
#endif
}

View File

@ -3,197 +3,6 @@
*/
#include "all.h"
/* logic
*/
static u3_noun
_cqfu_peek(u3_noun, u3_noun, u3_noun, u3_atom);
static u3_noun
_peek_in(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
static u3_noun
_peek_fork(u3_noun van, u3_noun p_sut, u3_noun way, u3_noun axe, u3_noun gil)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_peek_in(van, u3h(p_sut), way, axe, gil),
_peek_fork(van, u3t(p_sut), way, axe, gil));
}
}
static u3_noun
_peek_in(u3_noun van,
u3_noun sut,
u3_noun way,
u3_atom axe,
u3_noun gil)
{
u3_noun p_sut, q_sut;
u3_noun pro;
if ( (c3n == u3du(sut)) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
return c3__noun;
}
case c3__void: {
return c3__void;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: {
return c3__void;
}
case c3__cell: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
u3_atom tip = u3qc_cap(axe);
u3_atom tap = u3qc_mas(axe);
if ( 2 == tip ) {
pro = _cqfu_peek(van, p_sut, way, tap);
}
else {
pro = _cqfu_peek(van, q_sut, way, tap);
}
u3z(tap);
u3z(tip);
return pro;
}
}
case c3__core: {
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3_noun prq_sut, qrq_sut;
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ||
(c3n == u3r_trel(q_sut, &pq_sut, &qq_sut, &rq_sut)) ||
(c3n == u3r_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut)) ||
(c3n == u3r_cell(rq_sut, &prq_sut, &qrq_sut)) )
{
return u3m_bail(c3__fail);
} else {
u3_atom now = u3qc_cap(axe);
u3_atom lat = u3qc_mas(axe);
if ( 3 == now ) {
u3_noun pec = u3qfu_peel(van, sut, way, rpq_sut);
u3_noun sam = u3h(pec);
u3_noun con = u3t(pec);
u3_atom tow;
if ( 1 == lat ) {
tow = 1;
} else {
tow = u3qc_cap(lat);
}
if ( (c3y == c3a(sam, con)) ||
((c3y == sam) && (tow == 2)) ||
((c3y == con) && (tow == 3)) )
{
pro = _cqfu_peek(van, p_sut, way, lat);
}
else {
if ( way != c3__read ) {
return u3m_error("payload-block");
}
u3_noun typ;
{
u3_noun hed, tal;
if ( c3n == sam ) {
hed = c3__noun;
} else {
hed = _cqfu_peek(van, p_sut, way, 2);
}
if ( c3n == con ) {
tal = c3__noun;
} else {
tal = _cqfu_peek(van, p_sut, way, 3);
}
typ = u3qf_cell(hed, tal);
u3z(hed);
u3z(tal);
}
pro = _cqfu_peek(van, typ, way, lat);
u3z(typ);
}
u3z(pec);
u3z(tow);
}
else {
pro = c3__noun;
}
u3z(lat);
u3z(now);
return pro;
}
}
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
return _peek_in(van, q_sut, way, axe, gil);
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_peek_fork(van, yed, way, axe, gil));
u3z(yed);
return ret;
}
case c3__hold: {
if ( (c3y == u3qdi_has(gil, sut)) ) {
return c3__void;
}
else {
u3_noun zoc = u3qdi_put(gil, sut);
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _peek_in(van, fop, way, axe, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
static u3_noun
_cqfu_peek(u3_noun van,
u3_noun sut,
u3_noun way,
u3_atom axe)
{
if ( 1 == axe ) {
return u3k(sut);
}
else return _peek_in(van, sut, way, axe, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_peek(u3_noun cor)
{
@ -208,25 +17,16 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_peek(van, sut, way, axe);
}
}
u3_noun
u3qfu_peek(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun axe)
{
c3_m fun_m = 141 + c3__peek + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, axe);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_peek(van, sut, way, axe);
return u3z_save_3(fun_m, sut, way, axe, pro);
c3_m fun_m = 141 + c3__peek + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, axe);
if ( u3_none != pro ) {
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
return u3z_save_3(fun_m, sut, way, axe, pro);
}
}
}

View File

@ -1,55 +0,0 @@
/* j/6/ut_peel.c
**
*/
#include "all.h"
/* logic
*/
u3_noun
_cqfu_peel(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun met)
{
if ( c3__gold == met ) {
return u3nc(c3y, c3y);
}
else switch ( way ) {
default: return u3m_bail(c3__fail);
case c3__both: return u3nc(c3n, c3n);
case c3__free: return u3nc(c3y, c3y);
case c3__read: return u3nc(((met == c3__zinc) ? c3y : c3n), c3n);
case c3__rite: return u3nc(((met == c3__iron) ? c3y : c3n), c3n);
}
}
/* boilerplate
*/
u3_noun
u3wfu_peel(u3_noun cor)
{
u3_noun sut, way, met, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &met,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_peel(van, sut, way, met);
}
}
u3_noun
u3qfu_peel(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun met)
{
return _cqfu_peel(van, sut, way, met);
}

View File

@ -3,571 +3,6 @@
*/
#include "all.h"
/* logic
*/
# define _play_used()
static u3_noun
_play_in(u3_noun, u3_noun, u3_noun);
static u3_noun
_play_bean()
{
return u3kf_fork(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul));
}
static u3_noun
_play_rock(u3_noun odo, u3_noun bob)
{
if ( c3y == u3ud(bob) ) {
return u3nq(c3__atom, u3k(odo), u3_nul, u3k(bob));
}
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
_play_rock(odo, u3t(bob)));
}
static u3_noun
_play_sand(u3_noun odo, u3_noun bob)
{
if ( c3y == u3ud(bob) ) {
if ( 'n' == odo ) {
if ( (bob != 0) ) {
return u3m_bail(c3__exit);
} else {
return u3nq(c3__atom, odo, u3_nul, bob);
}
}
if ( 'f' == odo ) {
if ( (bob > 1) ) {
return u3m_bail(c3__exit);
} else {
return _play_bean();
}
}
return u3nt(c3__atom, u3k(odo), u3_nul);
}
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
_play_rock(odo, u3t(bob)));
}
static u3_noun
_play_core(u3_noun pac,
u3_noun con)
{
if ( (c3__void == pac) ) {
u3z(con);
return c3__void;
} else {
return u3nt(c3__core, pac, con);
}
}
static u3_noun
_play_loc(u3_noun van,
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_cook("_play_loc-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
u3z(sho);
return ret;
}
static u3_noun
_play_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
#if 0
static u3_noun
_play_loc_term(u3_noun van,
u3_noun loc)
{
u3_noun fop = u3kb_flop(u3k(u3h(loc)));
u3_noun nam = ((0 == fop) ? c3__none : u3k(u3h(fop)));
u3_noun lys = u3nt(u3k(u3h(u3t(loc))), u3k(u3t(u3t(loc))), u3_nul);
u3_noun rup = u3nc(nam, lys);
c3_c* pre_c = u3m_pretty(rup);
u3_noun pro = u3i_string(pre_c);
u3z(fop);
u3z(rup);
free(pre_c);
return pro;
}
#endif
#if 1
static u3_noun
_play_cnts(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_play_cnts-epla", von, "epla");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(hyp),
u3x_sam_3,
u3k(rig),
0));
}
#else
static u3_noun
_play_edit(u3_noun van,
u3_noun sut,
u3_noun mew,
u3_noun rag)
{
while ( 1 ) {
if ( c3n == u3du(mew) ) {
return rag;
} else {
u3_noun i_mew = u3h(mew);
u3_noun t_mew = u3t(mew);
u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew);
u3_noun laf = _play_in(van, sut, qi_mew);
u3_noun ruz = u3qfu_toss(van, sut, pi_mew, laf, rag);
u3z(laf);
u3z(rag);
rag = u3k(u3t(ruz));
u3z(ruz);
mew = t_mew;
}
}
}
static u3_noun
_play_cnts_old(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun rig)
{
u3_noun lar = u3qfu_seek(van, sut, c3__read, hyp);
u3_noun q_lar = u3t(lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun mew = rig;
u3_noun rag = _play_edit(van, sut, mew, u3k(qq_lar));
u3_noun ret = u3qfu_fire(van, sut, rag);
u3z(rag);
u3z(lar);
return ret;
}
#endif
static u3_noun
_play_grow(u3_noun van,
u3_noun sut,
u3_atom mel,
u3_noun nym,
u3_noun hud,
u3_noun ruf,
u3_noun dom)
{
u3_noun dan = _play_in(van, sut, ruf);
return _play_core(dan,
u3nt(u3nt(u3k(nym), u3k(hud), u3k(mel)),
u3k(dan),
u3nc(u3nc(u3nc(c3__full, u3_nul), u3_nul),
u3k(dom))));
}
static u3_noun
_play_in(u3_noun van,
u3_noun sut,
u3_noun gen);
static u3_noun
_play_x(u3_noun van,
u3_noun sut,
u3_noun gen)
{
#if 1
return _play_in(van, sut, gen);
#else
u3_noun zix = u3qfu_shep
(van, "gene", 'q', u3k(gen));
u3_noun ret;
u3t_push(u3nc(c3__mean, zix));
ret = _play_in(van, sut, gen);
u3t_drop();
return ret;
#endif
}
static u3_noun
_play_in(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun p_gen, q_gen, r_gen;
if ( c3n == u3du(gen) ) {
open: {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
u3_noun ret;
if ( c3y == u3r_sing(rex, gen) ) {
u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));
u3t_push(u3nc(c3__mean, zix));
return u3m_error("play-open-z");
}
ret = _play_x(van, sut, rex);
u3z(rex);
return ret;
}
}
else if ( c3y == u3du(u3h(gen)) ) {
_play_used();
{
u3_noun dis = _play_x(van, sut, u3h(gen));
u3_noun dat = _play_x(van, sut, u3t(gen));
u3_noun ret = u3qf_cell(dis, dat);
u3z(dis);
u3z(dat);
return ret;
}
}
else switch ( u3h(gen) ) {
default: goto open;
case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_bean();
}
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
{
u3_noun fex = u3qfu_gain(van, sut, p_gen);
u3_noun wux = u3qfu_lose(van, sut, p_gen);
u3_noun dez = (fex == c3__void) ? c3__void
: _play_x(van, fex, q_gen);
u3_noun doz = (wux == c3__void) ? c3__void
: _play_x(van, wux, r_gen);
u3_noun ret = u3qf_forq(dez, doz);
u3z(dez); u3z(doz);
u3z(fex); u3z(wux);
return ret;
}
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun dis = _play_x(van, sut, p_gen);
u3_noun dat = _play_x(van, sut, q_gen);
u3_noun ret = u3qf_cell(dis, dat);
u3z(dis);
u3z(dat);
return ret;
}
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun nog = u3nc(c3__kttr, u3k(p_gen));
u3_noun ret = _play_x(van, sut, nog);
u3z(nog);
return ret;
}
case c3__dtwt: p_gen = u3t(gen);
_play_used();
{
return _play_bean();
}
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_bean();
}
case c3__dtls: p_gen = u3t(gen);
_play_used();
{
return u3nt(c3__atom, u3_blip, u3_nul);
}
case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_rock(p_gen, q_gen);
}
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return c3__noun;
}
case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_sand(p_gen, q_gen);
}
case c3__hand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return u3k(p_gen);
}
case c3__ktbr: p_gen = u3t(gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun pro = u3qfu_wrap(van, boc, c3__iron);
u3z(boc);
return pro;
}
case c3__ktpd: p_gen = u3t(gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun pro = u3qfu_wrap(van, boc, c3__zinc);
u3z(boc);
return pro;
}
case c3__ktwt: p_gen = u3t(gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun pro = u3qfu_wrap(van, boc, c3__lead);
u3z(boc);
return pro;
}
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, q_gen);
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun ret = u3qf_hint(hit, boc);
u3z(hit);
u3z(boc);
return ret;
}
case c3__tune: p_gen = u3t(gen);
_play_used();
{
return u3qf_face(p_gen, sut);
}
case c3__ktsg: p_gen = u3t(gen);
_play_used();
{
return _play_x(van, sut, p_gen);
}
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_x(van, sut, p_gen);
}
case c3__tsbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun ret = _play_x(van, boc, q_gen);
u3z(boc);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = u3qfu_busk(van, sut, p_gen);
u3_noun ret = _play_x(van, boc, q_gen);
u3z(boc);
return ret;
}
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_cnts(van, sut, p_gen, q_gen);
}
case c3__brcn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow
(van, sut, c3__gold, p_gen, c3__dry, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brvt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow
(van, sut, c3__gold, p_gen, c3__wet, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun typ = u3qfu_play(van, sut, p_gen);
u3_noun dug = u3qfu_duck(van, typ);
u3_noun ret;
u3t_push(u3nc(c3__mean, dug));
{
ret = _play_x(van, sut, q_gen);
}
u3t_drop();
u3z(typ);
return ret;
}
case c3__sgbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_x(van, sut, q_gen);
}
case c3__zpts: p_gen = u3t(gen);
_play_used();
{
return c3__noun;
}
case c3__ktcn: p_gen = u3t(gen);
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_fab, c3n, 0);
u3_noun ret = _play_x(von, sut, p_gen);
u3z(von);
return ret;
}
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_x(van, sut, p_gen);
}
case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
{
u3_noun ret;
#if 0
{
u3_noun cog = _play_loc_term(van, p_gen);
u3t_heck(cog);
u3z(cog);
}
#endif
u3t_push(u3nc(c3__mean, _play_loc(van, p_gen)));
{
ret = _play_x(van, sut, q_gen);
}
u3t_drop();
return ret;
}
case c3__zpmc:
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun zur = _play_x(van, sut, p_gen);
u3_noun vos = _play_x(van, sut, q_gen);
u3_noun ret = u3qf_cell(zur, vos);
u3z(zur);
u3z(vos);
return ret;
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
{
if ( c3y == _play_feel(van, sut, p_gen) ) {
return _play_x(van, sut, q_gen);
} else {
return _play_x(van, sut, r_gen);
}
}
case c3__lost:
case c3__fail:
case c3__zpzp:
_play_used();
{
return c3__void;
}
}
}
static u3_noun
_cqfu_play(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_vet, c3n, 0);
u3_noun ret = _play_x(von, sut, gen);
u3z(von);
return ret;
}
/* boilerplate
*/
u3_noun
u3wfu_play(u3_noun cor)
{
@ -578,29 +13,17 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_play(van, sut, gen);
c3_m fun_m = 141 + c3__play;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_3(fun_m, vrf, sut, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
return u3z_save_3(fun_m, vrf, sut, gen, pro);
}
}
}
u3_noun
u3qfu_play(u3_noun van,
u3_noun sut,
u3_noun gen)
{
#if 1
c3_m fun_m = 141 + c3__play;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_3(fun_m, vrf, sut, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_play(van, sut, gen);
return u3z_save_3(fun_m, vrf, sut, gen, pro);
}
#else
return _cqfu_play(van, sut, gen);
#endif
}

View File

@ -1,70 +0,0 @@
/* j/6/ut_repo.c
**
*/
#include "all.h"
/* logic
*/
u3_noun
u3qfu_repo(u3_noun van,
u3_noun sut)
{
u3_noun p_sut, q_sut;
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3k(sut);
case c3__noun: {
return u3kf_fork(u3nt(u3nt(c3__atom, u3_blip, u3_nul),
u3nt(c3__cell, c3__noun, c3__noun),
u3_nul));
}
}
else switch ( u3h(sut) ) {
default: {
u3m_p("head", u3h(sut));
return u3m_error("repo-flat");
}
case c3__core: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut) ) {
return u3m_bail(c3__fail);
} else {
return u3nt(c3__cell, c3__noun, u3k(p_sut));
}
}
case c3__hint:
case c3__face: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) {
return u3m_bail(c3__fail);
} else {
return u3k(q_sut);
}
}
case c3__hold: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) {
return u3m_bail(c3__fail);
} else {
u3_noun old = u3nc(u3nc(u3k(p_sut), u3k(q_sut)), u3_nul);
u3_noun ret;
ret = u3qfu_rest(van, sut, old);
u3z(old);
return ret;
}
}
}
}
u3_noun
u3wfu_repo(u3_noun cor)
{
u3_noun sut;
if ( u3_none == (sut = u3r_at(u3x_sam, cor)) ) {
return u3m_bail(c3__fail);
} else {
return u3qfu_repo(cor, sut);
}
}

View File

@ -3,84 +3,6 @@
*/
#include "all.h"
/* logic
*/
static u3_noun
_rest_in_list(u3_noun van,
u3_noun leg)
{
if ( u3_nul == leg ) {
return u3_nul;
} else {
u3_noun i_leg = u3h(leg);
u3_noun t_leg = u3t(leg);
return u3nc(u3qfu_play(van, u3h(i_leg), u3t(i_leg)),
_rest_in_list(van, t_leg));
}
}
static u3_noun
_rest_in_stil(u3_noun van,
u3_noun gar)
{
u3_noun gun = u3qdi_gas(u3_nul, gar);
u3_noun yed = u3qdi_tap(gun);
u3z(gun);
return yed;
}
static u3_noun
_rest_in(u3_noun van,
u3_noun leg)
{
u3_noun gar = _rest_in_list(van, leg);
u3_noun yed = _rest_in_stil(van, gar);
u3_noun fub = u3qf_fork(yed);
u3z(gar);
u3z(yed);
return fub;
}
static u3_noun
_rest_hit_fan(u3_noun fan,
u3_noun leg)
{
if ( u3_nul == leg ) {
return c3n;
} else {
return c3o(u3qdi_has(fan, u3h(leg)),
_rest_hit_fan(fan, u3t(leg)));
}
}
static u3_noun
_cqfu_rest(u3_noun van,
u3_noun sut,
u3_noun leg)
{
u3_noun fan = u3r_at(u3qfu_van_fan, van);
if ( c3y == _rest_hit_fan(fan, leg) ) {
return u3m_error("rest-loop");
}
else {
u3_noun naf = u3qdi_gas(fan, leg);
u3_noun nav = u3i_molt(u3k(van), u3qfu_van_fan, u3k(naf), 0);
u3_noun mez = _rest_in(nav, leg);
u3z(naf);
u3z(nav);
return mez;
}
}
/* boilerplate
*/
u3_noun
u3wfu_rest(u3_noun cor)
{
@ -91,24 +13,16 @@
{
return u3m_bail(c3__fail);
} else {
return _cqfu_rest(van, sut, leg);
}
}
u3_noun
u3qfu_rest(u3_noun van,
u3_noun sut,
u3_noun leg)
{
c3_m fun_m = 141 + c3__rest + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, leg);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_rest(van, sut, leg);
return u3z_save_2(fun_m, sut, leg, pro);
c3_m fun_m = 141 + c3__rest + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, leg);
if ( u3_none != pro ) {
return pro;
}
else {
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
return u3z_save_2(fun_m, sut, leg, pro);
}
}
}

View File

@ -1,21 +0,0 @@
/* j/6/tack.c
**
*/
#include "all.h"
u3_noun
u3qfu_tack(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun mur)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("u3qfu_tack-tack", von, "tack");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(hyp),
u3x_sam_3,
u3k(mur),
0));
}

View File

@ -1,97 +0,0 @@
/* j/6/toss.c
**
*/
#include "all.h"
/* internals
*/
static u3_noun
_toss_in(u3_noun van,
u3_noun sut,
u3_noun peh,
u3_noun mur,
u3_noun men)
{
if ( c3n == u3du(men) ) {
return u3nc(u3_nul, u3_nul);
}
else {
u3_noun i_men = u3h(men);
u3_noun pi_men = u3h(i_men);
u3_noun qi_men = u3t(i_men);
u3_noun t_men = u3t(men);
u3_noun geq = u3qfu_tack(van, pi_men, peh, mur);
u3_noun p_geq = u3h(geq);
u3_noun q_geq = u3t(geq);
u3_noun mox = _toss_in(van, sut, peh, mur, t_men);
u3_noun p_mox = u3h(mox);
u3_noun q_mox = u3t(mox);
u3_noun ret;
ret = u3nc(
( (u3_nul == p_mox)
? u3nc(u3_nul, u3k(p_geq))
: (c3n == u3r_sing(p_geq, u3t(p_mox)))
? u3m_bail(c3__exit)
: u3k(p_mox) ),
u3nc(u3nc(u3k(q_geq), u3k(qi_men)), u3k(q_mox)));
u3z(mox);
u3z(geq);
return ret;
}
}
/* functions
*/
u3_noun
_cqfu_toss(u3_noun van,
u3_noun sut,
u3_noun peh,
u3_noun mur,
u3_noun men)
{
u3_noun wib = _toss_in(van, sut, peh, mur, men);
u3_noun p_wib = u3h(wib);
u3_noun q_wib = u3t(wib);
if ( u3_nul == p_wib ) {
return u3m_bail(c3__exit);
} else {
u3_noun ret = u3nc(u3k(u3t(p_wib)), u3k(q_wib));
u3z(wib);
return ret;
}
}
/* boilerplate
*/
u3_noun
u3wfu_toss(u3_noun cor)
{
u3_noun van, sut, peh, mur, men;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &peh,
u3x_sam_6, &mur,
u3x_sam_7, &men,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_toss(van, sut, peh, mur, men);
}
}
u3_noun
u3qfu_toss(u3_noun van,
u3_noun sut,
u3_noun peh,
u3_noun mur,
u3_noun men)
{
return _cqfu_toss(van, sut, peh, mur, men);
}

View File

@ -1,97 +0,0 @@
/* j/6/wrap.c
**
*/
#include "all.h"
static u3_noun _cqfu_wrap(u3_noun, u3_noun, u3_noun);
static u3_noun
_wrap_fork(u3_noun van, u3_noun p_sut, u3_noun yoz)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_cqfu_wrap(van, u3h(p_sut), yoz),
_wrap_fork(van, u3t(p_sut), yoz));
}
}
static u3_noun
_cqfu_wrap(u3_noun van,
u3_noun sut,
u3_noun yoz)
{
u3_noun p_sut, q_sut;
if ( c3n == u3du(sut) ) {
return u3m_error("wrap-type");
}
else switch ( u3h(sut) ) {
default: return u3m_error("wrap-type");
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
if ( c3n == u3r_trel(q_sut, &pq_sut, &qq_sut, &rq_sut) ) {
return u3m_bail(c3__fail);
}
if ( c3n == u3r_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut) ) {
return u3m_bail(c3__fail);
}
else if ( (c3__gold != rpq_sut) &&
(c3__lead != yoz) ) {
return u3m_error("wrap-metal");
}
else {
return u3nt(c3__core,
u3k(p_sut),
u3nt(u3nt(u3k(ppq_sut), u3k(qpq_sut), u3k(yoz)),
u3k(qq_sut),
u3k(rq_sut)));
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_wrap_fork(van, yed, yoz));
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _cqfu_wrap(van, fop, yoz);
u3z(fop);
return pro;
}
}
}
/* boilerplate
*/
u3_noun
u3wfu_wrap(u3_noun cor)
{
u3_noun sut, yoz, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &yoz, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_wrap(van, sut, yoz);
}
}
u3_noun
u3qfu_wrap(u3_noun van,
u3_noun sut,
u3_noun yoz)
{
return _cqfu_wrap(van, sut, yoz);
}

View File

@ -425,10 +425,6 @@ static c3_c* _141_pen_loot_ha[] = {
"d83e5e47f712870aba815d79943d287cbefdc00640409464b30bf755115d4a1a",
0
};
// XX no longer hinted in +ut
//
static u3j_harm _141_pen__ut_fire_a[] = {{".2", u3wfu_fire}, {}};
static c3_c* _141_pen__ut_fire_ha[] = {0};
static u3j_harm _141_pen__ut_fond_a[] = {{".2", u3wfu_fond}, {}};
static c3_c* _141_pen__ut_fond_ha[] = {
"0da0cc79c938eb06515a5cc24a17b82cd60a50c0f1a02e2c68e5d1cf71c96054",
@ -455,10 +451,20 @@ static c3_c* _141_pen_loot_ha[] = {
0
};
static u3j_harm _141_pen__ut_nest_a[] = {{".2", u3wfu_nest}, {}};
static c3_c* _141_pen__ut_nest_ha[] = {
"a55b695cdba00e7fa8f2c74a332880c877701555b2909b5b3028aea5839d62cd",
0
};
static c3_c* _141_pen__ut_nest_ha[] = {0};
static u3j_harm _141_pen__ut_nest_dext_a[] = {{".2", u3wfu_nest_dext}, {}};
static c3_c* _141_pen__ut_nest_dext_ha[] = {0};
static u3j_core _141_pen__ut_nest_in_d[] =
{
{ "nest-dext", 3, _141_pen__ut_nest_dext_a, 0, _141_pen__ut_nest_dext_ha },
{}
};
static c3_c* _141_pen__ut_nest_in_ha[] = {0};
static u3j_core _141_pen__ut_nest_d[] =
{
{ "nest-in", 7, 0, _141_pen__ut_nest_in_d, _141_pen__ut_nest_in_ha },
{}
};
static u3j_harm _141_pen__ut_peek_a[] = {{".2", u3wfu_peek}, {}};
static c3_c* _141_pen__ut_peek_ha[] = {
"904ff7359e89d1886f884c4409f104269cdb8dfb4683f116ff00bc98a4720df7",
@ -474,36 +480,19 @@ static c3_c* _141_pen_loot_ha[] = {
"2e2d15f3efca0a4bf8ce08cca48c54d1d5a7204e2b0525137f59c3e7b037d2fd",
0
};
static u3j_harm _141_pen__ut_toss_a[] = {{".2", u3wfu_toss}, {}};
static c3_c* _141_pen__ut_toss_ha[] = {
"2a77e7e2693231d3f6b4bbc2a4c961691702da1fdddaa8f15f06e9ad437c9416",
0
};
static u3j_harm _141_pen__ut_wrap_a[] = {{".2", u3wfu_wrap}, {}};
static c3_c* _141_pen__ut_wrap_ha[] = {
"128f42e2e3a299c2890f0b68e0301885620bae8491dd0a36cde7a94023eb4226",
0
};
static u3j_core _141_pen__ut_d[] =
{
{ "crop", 7, _141_pen__ut_crop_a, 0, _141_pen__ut_crop_ha },
{ "fond", 7, _141_pen__ut_fond_a, 0, _141_pen__ut_fond_ha },
{ "fire", 7, _141_pen__ut_fire_a, 0, _141_pen__ut_fire_ha },
{ "fish", 7, _141_pen__ut_fish_a, 0, _141_pen__ut_fish_ha },
{ "fuse", 7, _141_pen__ut_fuse_a, 0, _141_pen__ut_fuse_ha },
{ "mint", 7, _141_pen__ut_mint_a, 0, _141_pen__ut_mint_ha },
{ "mull", 7, _141_pen__ut_mull_a, 0, _141_pen__ut_mull_ha },
{ "nest", 7, _141_pen__ut_nest_a, 0, _141_pen__ut_nest_ha },
{ "nest", 7, _141_pen__ut_nest_a, _141_pen__ut_nest_d, _141_pen__ut_nest_ha },
{ "peek", 7, _141_pen__ut_peek_a, 0, _141_pen__ut_peek_ha },
{ "play", 7, _141_pen__ut_play_a, 0, _141_pen__ut_play_ha },
{ "rest", 7, _141_pen__ut_rest_a, 0, _141_pen__ut_rest_ha },
{ "toss", 7, _141_pen__ut_toss_a, 0, _141_pen__ut_toss_ha },
{ "wrap", 7, _141_pen__ut_wrap_a, 0, _141_pen__ut_wrap_ha },
{}
};
static u3j_harm _141_pen__ut_a[] =
{ {"repo", u3wfu_repo},
{}
};
@ -597,7 +586,7 @@ static u3j_core _141_pen_d[] =
// { "ap", 7, _141_pen__ap_a, 0, _141_pen__ap_ha },
// { "al", 7, _141_pen__al_a, 0, _141_pen__al_ha },
{ "ut", 15, _141_pen__ut_a, _141_pen__ut_d, _141_pen__ut_ha, _141_pen__ut_ho },
{ "ut", 15, 0, _141_pen__ut_d, _141_pen__ut_ha, _141_pen__ut_ho },
{}
};
static c3_c* _141_pen_ha[] = {

View File

@ -300,33 +300,11 @@ _dawn_turf(c3_c* dns_c)
u3_noun
u3_dawn_vent(u3_noun seed)
{
u3_noun url, bok, pon, zar, tuf, sap;
u3_noun url, bok, pos, pon, zar, tuf;
u3_noun ship = u3h(seed);
u3_noun rank = u3do("clan:title", u3k(ship));
// load snapshot from file
//
if ( 0 != u3_Host.ops_u.ets_c ) {
u3l_log("boot: loading azimuth snapshot\r\n");
u3_noun raw_snap = u3ke_cue(u3m_file(u3_Host.ops_u.ets_c));
sap = u3nc(u3_nul, raw_snap);
}
// load snapshot from HTTP URL
//
else if ( 0 != u3_Host.ops_u.sap_c ) {
u3l_log("boot: downloading azimuth snapshot from %s\r\n",
u3_Host.ops_u.sap_c);
u3_noun raw_snap = _dawn_get_jam(u3_Host.ops_u.sap_c);
sap = u3nc(u3_nul, raw_snap);
}
// no snapshot
//
else {
u3l_log("boot: no azimuth snapshot specified\n");
sap = u3_nul;
}
url = _dawn_purl(rank);
// XX require https?
@ -337,14 +315,7 @@ u3_dawn_vent(u3_noun seed)
// pin block number
//
if ( c3y == u3_Host.ops_u.etn ) {
u3l_log("boot: extracting block from snapshot\r\n");
bok = _dawn_need_unit(u3do("bloq:snap:dawn", u3k(u3t(sap))),
"boot: failed to extract "
"block from snapshot");
}
else {
{
u3l_log("boot: retrieving latest block\r\n");
u3_noun oct = u3v_wish("bloq:give:dawn");
@ -360,14 +331,7 @@ u3_dawn_vent(u3_noun seed)
//
u3_noun pot;
if ( c3y == u3_Host.ops_u.etn ) {
u3l_log("boot: extracting public keys from snapshot\r\n");
pot = _dawn_need_unit(u3dc("point:snap:dawn", u3k(ship), u3k(u3t(sap))),
"boot: failed to extract "
"public keys from snapshot");
}
else if ( c3__pawn == rank ) {
if ( c3__pawn == rank ) {
// irrelevant, just bunt +point
//
pot = u3v_wish("*point:azimuth");
@ -428,21 +392,14 @@ u3_dawn_vent(u3_noun seed)
// produced by +veri:dawn to avoid coupling to +point structure
// XX reconsider
//
pon = u3k(u3t(sas));
pos = u3k(u3t(sas));
u3z(pot); u3z(liv); u3z(sas);
}
// (map ship [=life =pass]): galaxy table
//
if ( c3y == u3_Host.ops_u.etn ) {
u3l_log("boot: extracting galaxy table from snapshot\r\n");
zar = _dawn_need_unit(u3do("czar:snap:dawn", u3k(u3t(sap))),
"boot: failed to extract "
"galaxy table from snapshot");
}
else {
{
u3l_log("boot: retrieving galaxy table\r\n");
u3_noun oct = u3do("czar:give:dawn", u3k(bok));
@ -458,13 +415,6 @@ u3_dawn_vent(u3_noun seed)
if ( 0 != u3_Host.ops_u.dns_c ) {
tuf = _dawn_turf(u3_Host.ops_u.dns_c);
}
else if ( c3y == u3_Host.ops_u.etn ) {
u3l_log("boot: extracting network domains from snapshot\r\n");
tuf = _dawn_need_unit(u3do("turf:snap:dawn", u3k(u3t(sap))),
"boot: failed to extract "
"network domains from snapshot");
}
else {
u3l_log("boot: retrieving network domains\r\n");
@ -476,11 +426,24 @@ u3_dawn_vent(u3_noun seed)
u3z(oct); u3z(fut);
}
{
u3l_log("boot: retrieving sponsor keys\r\n");
u3_noun oct = u3dc("point:give:dawn", u3k(bok), u3k(pos));
u3_noun luh = _dawn_eth_rpc(url_c, u3k(oct));
pon = _dawn_need_unit(u3dc("point:take:dawn", u3k(pos), u3k(luh)),
"boot: failed to retrieve sponsor keys");
pon = u3nc(pos, pon);
u3z(oct); u3z(luh);
}
u3z(rank);
// [%dawn seed sponsor galaxies domains block eth-url snap]
//
return u3nc(c3__dawn, u3nq(seed, pon, zar, u3nq(tuf, bok, url, sap)));
return u3nc(c3__dawn, u3nq(seed, pon, zar, u3nt(tuf, bok, url)));
}
/* _dawn_come(): mine a comet under a list of stars

View File

@ -20,7 +20,7 @@ fail=0
for f in $(find "$pkg/" -type f)
do
if egrep "(ford|warn): " $f >/dev/null
if egrep "((FAILED|CRASHED)|(ford|warn):) " $f >/dev/null
then
if [[ $fail -eq 0 ]]
then