From 10754dc172f7856e82d8c61f6f907bb29214db70 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 29 Nov 2017 12:14:58 -0800 Subject: [PATCH 1/9] move "XX moveme to lib/" // generator-bits to lib --- gen/cat.hoon | 5 ++--- gen/ls.hoon | 4 ++-- gen/ls/subdir.hoon | 25 --------------------- gen/cat/pretty.hoon => lib/pretty-file.hoon | 7 +++--- lib/show-dir.hoon | 22 ++++++++++++++++++ 5 files changed, 30 insertions(+), 33 deletions(-) delete mode 100644 gen/ls/subdir.hoon rename gen/cat/pretty.hoon => lib/pretty-file.hoon (80%) create mode 100644 lib/show-dir.hoon diff --git a/gen/cat.hoon b/gen/cat.hoon index 3049c8857b..5525cff820 100644 --- a/gen/cat.hoon +++ b/gen/cat.hoon @@ -3,8 +3,7 @@ :::: /hoon/cat/gen :: /? 310 -// /%%/ls/subdir -// /%/pretty +/+ pretty-file, show-dir :: :::: :: @@ -29,6 +28,6 @@ * =- [palm+[": " ``~]^-]~ :~ rose+[" " `~]^~[leaf+"*" (smyt pax)] - `tank`(subdir vane pax dir.ark) + `tank`(show-dir vane pax dir.ark) == == diff --git a/gen/ls.hoon b/gen/ls.hoon index c476c3c0f7..c03296b933 100644 --- a/gen/ls.hoon +++ b/gen/ls.hoon @@ -3,7 +3,7 @@ :::: /hoon/ls/gen :: /? 310 -// /%/subdir +/+ show-dir :: :::: :: @@ -11,4 +11,4 @@ :- %say |= {^ {arg/path $~} vane/?($g $c)} =+ lon=.^(arch (cat 3 vane %y) arg) -tang+[?~(dir.lon leaf+"~" (subdir vane arg dir.lon))]~ +tang+[?~(dir.lon leaf+"~" (show-dir vane arg dir.lon))]~ diff --git a/gen/ls/subdir.hoon b/gen/ls/subdir.hoon deleted file mode 100644 index 6bef2d4c8c..0000000000 --- a/gen/ls/subdir.hoon +++ /dev/null @@ -1,25 +0,0 @@ -:: Filesystem iterator XX move to lib/ -:: -:::: /hoon/subdir/ls/gen - :: -/? 310 -|% -++ subdir - |= {vane/?($g $c) pax/path des/(map @t $~)} - ^- tank - :+ %rose [" " `~] - %+ turn (sort ~(tap by des) aor) - |= {kid/@ta $~} - =+ paf=`path`/[kid] - =- :+ %rose ["/" ~ ?:(dir "/" ~)] - (turn paf |=(a/knot leaf+(trip a))) - |- ^- {dir/? paf/path} - =+ arf=.^(arch (cat 3 vane %y) (weld pax paf)) - ?^ fil.arf - [| paf] - ?~ dir.arf - [& paf] :: !! - ?. ?=({^ $~ $~} dir.arf) - [& paf] - $(paf (welp paf /[p.n.dir.arf])) --- diff --git a/gen/cat/pretty.hoon b/lib/pretty-file.hoon similarity index 80% rename from gen/cat/pretty.hoon rename to lib/pretty-file.hoon index ab2d648ec4..e35ff1f7c8 100644 --- a/gen/cat/pretty.hoon +++ b/lib/pretty-file.hoon @@ -1,9 +1,10 @@ -:: Pretty-printing util, should be in lib/ +:: Untyped best-guess printer :: -:::: /hoon/pretty/cat/gen +:::: /hoon/pretty-file/lib :: /? 310 :: +=< pretty-file |% ++ pretty-noun |= pri/* ^- tank @@ -21,8 +22,8 @@ :: ++ vale-cord |=(a/cord `?`(levy (trip a) |=(b/@ |((gte b 32) =(10 b))))) :: +++ wain-to-tang |=(a/wain (turn a |=(b/cord leaf+(trip b)))) ++ pretty-file - =+ wain-to-tang=|=(a/wain (turn a |=(b/cord leaf+(trip b)))) |= fyl/* ^- tang =+ `(unit wain)`?@(fyl `(to-wain:format fyl) ((soft wain) fyl)) ?^ - (wain-to-tang u) diff --git a/lib/show-dir.hoon b/lib/show-dir.hoon new file mode 100644 index 0000000000..1f32bcce4c --- /dev/null +++ b/lib/show-dir.hoon @@ -0,0 +1,22 @@ +:: Display directory contents +:: +:::: /hoon/show-dir/lib + :: +/? 310 +|= {vane/?($g $c) pax/path des/(map @t $~)} +^- tank +:+ %rose [" " `~] +%+ turn (sort ~(tap by des) aor) +|= {kid/@ta $~} +=+ paf=`path`/[kid] +=- :+ %rose ["/" ~ ?:(dir "/" ~)] + (turn paf |=(a/knot leaf+(trip a))) +|- ^- {dir/? paf/path} +=+ arf=.^(arch (cat 3 vane %y) (weld pax paf)) +?^ fil.arf + [| paf] +?~ dir.arf + [& paf] :: !! +?. ?=({^ $~ $~} dir.arf) + [& paf] +$(paf (welp paf /[p.n.dir.arf])) From 4041c82e02173edd0c43e76131fcf77477e5a9d7 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 29 Nov 2017 12:28:29 -0800 Subject: [PATCH 2/9] add +serving reader for |serve --- gen/serving.hoon | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gen/serving.hoon diff --git a/gen/serving.hoon b/gen/serving.hoon new file mode 100644 index 0000000000..a54ff98dac --- /dev/null +++ b/gen/serving.hoon @@ -0,0 +1,12 @@ +:: Eyre: show web base path +:: +:::: /hoon/serving/gen + :: +/? 310 +:: +:::: + :: +:- %say +|= [[now=time @ our=ship ^] ~ ~] +:- %noun +.^(path %e (en-beam:format [our %serv da+now] /)) From 3d744c8d7462bdc0033776b0c3ca770f7c370dd9 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 29 Nov 2017 12:40:44 -0800 Subject: [PATCH 3/9] namespace hood "libraries" --- app/hood.hoon | 21 +++++++++++++-------- lib/{ => hood}/drum.hoon | 2 +- lib/{ => hood}/helm.hoon | 2 +- lib/{ => hood}/kiln.hoon | 2 +- lib/{ => hood}/womb.hoon | 2 +- lib/{ => hood}/write.hoon | 2 +- 6 files changed, 18 insertions(+), 13 deletions(-) rename lib/{ => hood}/drum.hoon (99%) rename lib/{ => hood}/helm.hoon (99%) rename lib/{ => hood}/kiln.hoon (99%) rename lib/{ => hood}/womb.hoon (99%) rename lib/{ => hood}/write.hoon (99%) diff --git a/app/hood.hoon b/app/hood.hoon index 23a4ab3131..cfded66c9a 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -2,8 +2,13 @@ :::: /hoon/hood/app :: :: :: :: :: /? 310 :: zuse version -/+ sole, talk, helm, kiln, drum, write, womb :: libraries -[. helm kiln drum] +/+ sole, talk, :: libraries + hood-helm, hood-kiln, hood-drum, hood-write, hood-womb :: "libraries" +[. hood-helm hood-kiln hood-drum] +|% +++ womb hood-womb +++ write hood-write +-- :: :: :: :::: :: :: :: :: :: @@ -98,7 +103,7 @@ ++ coup-helm-ask (wrap coup-ask):from-helm ++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum ++ from-lib - |* _[%helm ..$ _abet]:(helm) + |* _[%helm ..$ _abet]:(hood-helm) => .(+< [identity start finish]=+<) =- [wrap=- *start] :: usage (wrap handle-arm):from-foo |* handle/_finish @@ -106,11 +111,11 @@ =. +>.handle (start hid (able identity)) (ably (handle +<)) :: -++ from-drum (from-lib %drum [..$ _se-abet]:(drum)) -++ from-helm (from-lib %helm [..$ _abet]:(helm)) -++ from-kiln (from-lib %kiln [..$ _abet]:(kiln)) -++ from-womb (from-lib %womb [..$ _abet]:(womb)) -++ from-write (from-lib %write [..$ _abet]:(write)) +++ from-drum (from-lib %drum [..$ _se-abet]:(hood-drum)) +++ from-helm (from-lib %helm [..$ _abet]:(hood-helm)) +++ from-kiln (from-lib %kiln [..$ _abet]:(hood-kiln)) +++ from-womb (from-lib %womb [..$ _abet]:(hood-womb)) +++ from-write (from-lib %write [..$ _abet]:(hood-write)) :: ++ init-helm |=({way/wire *} [~ +>]) ++ made-write (wrap made):from-write diff --git a/lib/drum.hoon b/lib/hood/drum.hoon similarity index 99% rename from lib/drum.hoon rename to lib/hood/drum.hoon index b6896cd144..2ca592e045 100644 --- a/lib/drum.hoon +++ b/lib/hood/drum.hoon @@ -1,5 +1,5 @@ :: :: :: -:::: /hoon/drum/lib :: :: +:::: /hoon/drum/hood/lib :: :: :: :: :: /? 310 :: version /- sole diff --git a/lib/helm.hoon b/lib/hood/helm.hoon similarity index 99% rename from lib/helm.hoon rename to lib/hood/helm.hoon index 5914f974a5..a811336eb7 100644 --- a/lib/helm.hoon +++ b/lib/hood/helm.hoon @@ -1,5 +1,5 @@ :: :: :: -:::: /hoon/helm/lib :: :: +:::: /hoon/helm/hood/lib :: :: :: :: :: /? 310 :: version /- sole diff --git a/lib/kiln.hoon b/lib/hood/kiln.hoon similarity index 99% rename from lib/kiln.hoon rename to lib/hood/kiln.hoon index c9c322a40d..f01aa9cce0 100644 --- a/lib/kiln.hoon +++ b/lib/hood/kiln.hoon @@ -1,5 +1,5 @@ :: :: :: -:::: /hoon/kiln/lib :: :: +:::: /hoon/kiln/hood/lib :: :: :: :: :: /? 310 :: version :: :: :: diff --git a/lib/womb.hoon b/lib/hood/womb.hoon similarity index 99% rename from lib/womb.hoon rename to lib/hood/womb.hoon index 647301fa37..1d26367f41 100644 --- a/lib/womb.hoon +++ b/lib/hood/womb.hoon @@ -1,5 +1,5 @@ :: :: :: -:::: /hoon/womb/lib :: :: +:::: /hoon/womb/hood/lib :: :: :: :: :: /? 310 :: version /+ talk, old-phon diff --git a/lib/write.hoon b/lib/hood/write.hoon similarity index 99% rename from lib/write.hoon rename to lib/hood/write.hoon index 5184c0df9b..2a706bc4af 100644 --- a/lib/write.hoon +++ b/lib/hood/write.hoon @@ -1,6 +1,6 @@ :: File writer module :: -:::: /hoon/write/lib +:::: /hoon/write/hood/lib :: /? 310 /- plan-diff, plan-acct From 2f91190a96a80c9ead27ad9dc96d6681b2b86bc3 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 29 Nov 2017 12:41:25 -0800 Subject: [PATCH 4/9] add example of hood plugin --- app/hood.hoon | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/hood.hoon b/app/hood.hoon index cfded66c9a..cca1a8c4aa 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -8,6 +8,20 @@ |% ++ womb hood-womb ++ write hood-write +:: +++ hood-sample + => |% + += part [%sample %0 pith] + += pith ~ + :: + += move [bone card] + += card $% [%fake _!!] + == + -- + |= [bowl:gall own=part] + |_ moz=(list move) + ++ abet [(flop moz) own] + -- -- :: :: :: :::: :: :: @@ -103,7 +117,7 @@ ++ coup-helm-ask (wrap coup-ask):from-helm ++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum ++ from-lib - |* _[%helm ..$ _abet]:(hood-helm) + |* _[%sample ..$ _abet]:(hood-sample) => .(+< [identity start finish]=+<) =- [wrap=- *start] :: usage (wrap handle-arm):from-foo |* handle/_finish From 3f06652142708a26bed53c8d2c8f53dfcb2c3d7f Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 29 Nov 2017 13:28:33 -0800 Subject: [PATCH 5/9] fix /+ womb references --- app/ask.hoon | 6 +++--- gen/hood/invite.hoon | 8 ++++---- gen/hood/load.hoon | 6 +++--- gen/hood/replay-womb-log.hoon | 4 ++-- gen/hood/transfer.hoon | 4 ++-- gen/womb/balance.hoon | 4 ++-- gen/womb/balances.hoon | 4 ++-- gen/womb/stats.hoon | 4 ++-- mar/womb/balance.hoon | 6 +++--- mar/womb/invite.hoon | 6 +++--- mar/womb/part.hoon | 6 +++--- mar/womb/replay-log.hoon | 6 +++--- mar/womb/stat-all.hoon | 10 +++++----- 13 files changed, 37 insertions(+), 37 deletions(-) diff --git a/app/ask.hoon b/app/ask.hoon index 1a4838cfc1..8d390342ca 100644 --- a/app/ask.hoon +++ b/app/ask.hoon @@ -2,12 +2,12 @@ :::: /hoon/ask/app :: /? 310 -/+ sole, womb, prey +/+ sole, hood-womb, prey [. sole] |% ++ card $% {$diff $sole-effect sole-effect} - {$poke wire {ship $hood} $womb-invite {cord:womb invite:womb}} + {$poke wire {ship $hood} $womb-invite {cord:hood-womb invite:hood-womb}} == ++ invited ?($new $sent $ignored) ++ email @t @@ -154,7 +154,7 @@ ^- card :^ %poke /invite/(scot %t ask) [(need wom) %hood] :- %womb-invite - ^- [cord:womb invite:womb] + ^- [cord:hood-womb invite:hood-womb] =+ inv=(scot %uv (end 7 1 eny.bow)) [inv [ask 1 0 "You have been invited to Urbit: {(trip inv)}" ""]] -- diff --git a/gen/hood/invite.hoon b/gen/hood/invite.hoon index a14d237e8c..ecb910f168 100644 --- a/gen/hood/invite.hoon +++ b/gen/hood/invite.hoon @@ -6,12 +6,12 @@ :: :::: :: -/+ womb -=* invite invite:womb -=* reference reference:womb +/+ hood-womb +=* invite invite:hood-womb +=* reference reference:hood-womb :- %say |= $: {now/@da eny/@uvJ bec/beak} - {{who/@t $~} ref/(unit (each ship mail:womb)) sta/@} + {{who/@t $~} ref/(unit (each ship mail:hood-womb)) sta/@} == :- %womb-invite ^- {cord reference invite} diff --git a/gen/hood/load.hoon b/gen/hood/load.hoon index 054c950d76..c82fba0593 100644 --- a/gen/hood/load.hoon +++ b/gen/hood/load.hoon @@ -3,7 +3,7 @@ :::: /hoon/load/hood/gen :: /? 310 -/+ womb, old-zuse +/+ hood-womb, old-zuse =, old-zuse :: :::: @@ -12,9 +12,9 @@ |= $: {now/@da eny/@uvJ byk/beak} {{dap/term pas/@uw $~} $~} == -^- {$hood-load ?(part:womb)} +^- {$hood-load ?(part:hood-womb)} ?+ dap ~|(unknown-backup+dap !!) $womb =+ dat=.^(@ %cx (tope byk /jam-crub/womb-part/bak/hood/app)) - [%hood-load ;;(part:womb (cue (dy:crub pas dat)))] + [%hood-load ;;(part:hood-womb (cue (dy:crub pas dat)))] == diff --git a/gen/hood/replay-womb-log.hoon b/gen/hood/replay-womb-log.hoon index 095d89165e..bcb26d2358 100644 --- a/gen/hood/replay-womb-log.hoon +++ b/gen/hood/replay-womb-log.hoon @@ -3,12 +3,12 @@ :::: /hoon/replay-womb-log/hood/gen :: /? 310 -/+ womb +/+ hood-womb :: :::: :: :- %say |= $: {now/@da eny/@uvJ bec/beak} - {log/(list {@uvJ transaction:womb}) $~} + {log/(list {@uvJ transaction:hood-womb}) $~} == [%womb-replay-log log] diff --git a/gen/hood/transfer.hoon b/gen/hood/transfer.hoon index d1b3a1feea..f09363a74e 100644 --- a/gen/hood/transfer.hoon +++ b/gen/hood/transfer.hoon @@ -3,7 +3,7 @@ :::: /hoon/transfer/hood/gen :: /? 310 -/+ womb +/+ hood-womb :: :::: :: @@ -13,5 +13,5 @@ == :- %womb-reinvite =+ [him=(scot %p p.bec) cas=(scot %da now) key=(scot %p pas)] -=+ [pla=planets sta=stars]:.^(balance:womb %gx /[him]/hood/[cas]/womb/balance/[key]) +=+ [pla=planets sta=stars]:.^(balance:hood-womb %gx /[him]/hood/[cas]/womb/balance/[key]) [pas who pla sta "Email updated, new passcode" "Email correction"] diff --git a/gen/womb/balance.hoon b/gen/womb/balance.hoon index 00c0cbd5f1..e5dabc8a6c 100644 --- a/gen/womb/balance.hoon +++ b/gen/womb/balance.hoon @@ -3,11 +3,11 @@ :::: /hoon/balance/womb/gen :: /? 310 -/+ womb +/+ hood-womb :- %say |= $: {now/@da eny/@uvJ bec/beak} {pas/@uvG $~} who/(unit @p) == -=- [%womb-balance .^(balance:womb %gx /[him]/hood/[cas]/womb/balance/[key]/womb-balance)] +=- [%womb-balance .^(balance:hood-womb %gx /[him]/hood/[cas]/womb/balance/[key]/womb-balance)] [him=(scot %p ?^(who u.who p.bec)) cas=(scot %da now) key=(scot %uv pas)] diff --git a/gen/womb/balances.hoon b/gen/womb/balances.hoon index 54165bf902..69644505ea 100644 --- a/gen/womb/balances.hoon +++ b/gen/womb/balances.hoon @@ -3,7 +3,7 @@ :::: /hoon/balance/womb/gen :: /? 310 -/+ womb +/+ hood-womb :- %say |= $: {now/@da eny/@uvJ bec/beak} $~ @@ -11,5 +11,5 @@ == :- %womb-balance-all =+ [him=(scot %p ?^(who u.who p.bec)) cas=(scot %da now)] -=/ balances =>(womb ,(set [passhash mail])) +=/ balances =>(hood-womb ,(set [passhash mail])) .^(balances %gx /[him]/hood/[cas]/womb/balance/womb-balance-all) diff --git a/gen/womb/stats.hoon b/gen/womb/stats.hoon index e4a3581bd1..81f0cc11c8 100644 --- a/gen/womb/stats.hoon +++ b/gen/womb/stats.hoon @@ -2,7 +2,7 @@ :::: /hoon/stats/womb/gen :: /? 310 -/+ womb +/+ hood-womb :- %say |= $: {now/@da eny/@uvJ bec/beak} $~ @@ -10,4 +10,4 @@ == :- %womb-stat-all =+ [him=(scot %p ?^(who u.who p.bec)) cas=(scot %da now)] -.^((map ship stat:womb) %gx /[him]/hood/[cas]/womb/stats/womb-stat-all) +.^((map ship stat:hood-womb) %gx /[him]/hood/[cas]/womb/stats/womb-stat-all) diff --git a/mar/womb/balance.hoon b/mar/womb/balance.hoon index 767ad7eeff..6d1fb72de0 100644 --- a/mar/womb/balance.hoon +++ b/mar/womb/balance.hoon @@ -2,16 +2,16 @@ :::: /hoon/stat-all/womb/mar :: /? 310 -/+ womb, old-zuse +/+ hood-womb, old-zuse :: :::: ~fyr :: =, old-zuse -|_ balance:womb +|_ balance:hood-womb :: ++ grab :: convert from |% - ++ noun balance:womb :: clam from %noun + ++ noun balance:hood-womb :: clam from %noun -- ++ grow |% diff --git a/mar/womb/invite.hoon b/mar/womb/invite.hoon index 0265b81b22..8b24518dc6 100644 --- a/mar/womb/invite.hoon +++ b/mar/womb/invite.hoon @@ -2,12 +2,12 @@ :::: /hoon/stat-all/womb/mar :: /? 310 -/+ womb, old-zuse +/+ hood-womb, old-zuse :: :::: ~fyr :: -=* invite invite:womb -=* reference reference:womb +=* invite invite:hood-womb +=* reference reference:hood-womb =, old-zuse |_ {cord reference invite} :: diff --git a/mar/womb/part.hoon b/mar/womb/part.hoon index 9168154aa3..f5564a8d64 100644 --- a/mar/womb/part.hoon +++ b/mar/womb/part.hoon @@ -2,11 +2,11 @@ :::: /hoon/part/womb/mar :: /? 310 -/+ womb -|_ all/part:womb +/+ hood-womb +|_ all/part:hood-womb ++ grad %jam ++ grow |% ++ jam (^jam all) -- ++ grab |% ++ jam |=(a/@ (noun (cue a))) - ++ noun part:womb + ++ noun part:hood-womb -- -- diff --git a/mar/womb/replay-log.hoon b/mar/womb/replay-log.hoon index d87fccf04d..577f725e04 100644 --- a/mar/womb/replay-log.hoon +++ b/mar/womb/replay-log.hoon @@ -2,9 +2,9 @@ :::: /hoon/replay-log/womb/mar :: /? 310 -/+ womb -|_ log/(list {@uvJ transaction:womb}) +/+ hood-womb +|_ log/(list {@uvJ transaction:hood-womb}) ++ grab |% - ++ noun (list {@uvJ transaction:womb}) + ++ noun (list {@uvJ transaction:hood-womb}) -- -- diff --git a/mar/womb/stat-all.hoon b/mar/womb/stat-all.hoon index caaccbd7d3..f57c78f648 100644 --- a/mar/womb/stat-all.hoon +++ b/mar/womb/stat-all.hoon @@ -2,28 +2,28 @@ :::: /hoon/stat-all/womb/mar :: /? 310 -/+ womb, old-zuse +/+ hood-womb, old-zuse :: :::: ~fyr :: =, old-zuse -|_ all/(map ship stat:womb) +|_ all/(map ship stat:hood-womb) :: ++ grab :: convert from |% - ++ noun (map ship stat:womb) :: clam from %noun + ++ noun (map ship stat:hood-womb) :: clam from %noun -- ++ grow |% ++ json %- jobe %+ turn ~(tap by all) - |= {a/ship b/stat:womb} ^- {cord ^json} + |= {a/ship b/stat:hood-womb} ^- {cord ^json} :- (crip +:) (jobe live+[%s p.b] dist+(json-dist q.b) ~) :: ++ json-dist - |= a/dist:womb + |= a/dist:hood-womb %+ joba -.a ?- -.a $free b+& From 760ae2f114081c6060458da7ce86ae856cac2c6b Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 29 Nov 2017 13:29:35 -0800 Subject: [PATCH 6/9] fully namespace drum/helm/kiln --- app/hood.hoon | 38 +++++++++++++++++--------------------- lib/hood/drum.hoon | 41 +++++++++++++++++++++-------------------- lib/hood/helm.hoon | 16 ++++++++-------- lib/hood/kiln.hoon | 16 ++++++++-------- 4 files changed, 54 insertions(+), 57 deletions(-) diff --git a/app/hood.hoon b/app/hood.hoon index cca1a8c4aa..34926b3ae3 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -4,11 +4,7 @@ /? 310 :: zuse version /+ sole, talk, :: libraries hood-helm, hood-kiln, hood-drum, hood-write, hood-womb :: "libraries" -[. hood-helm hood-kiln hood-drum] |% -++ womb hood-womb -++ write hood-write -:: ++ hood-sample => |% += part [%sample %0 pith] @@ -36,21 +32,21 @@ |* hed/hood-head :: |= paw/hood-part :: ?- hed :: - $drum ?>(?=($drum -.paw) `drum-part`paw) :: - $helm ?>(?=($helm -.paw) `helm-part`paw) :: - $kiln ?>(?=($kiln -.paw) `kiln-part`paw) :: - $womb ?>(?=($womb -.paw) `part:womb`paw) :: - $write ?>(?=($write -.paw) `part:write`paw) :: + $drum ?>(?=($drum -.paw) `part:hood-drum`paw) :: + $helm ?>(?=($helm -.paw) `part:hood-helm`paw) :: + $kiln ?>(?=($kiln -.paw) `part:hood-kiln`paw) :: + $womb ?>(?=($womb -.paw) `part:hood-womb`paw) :: + $write ?>(?=($write -.paw) `part:hood-write`paw) :: == :: ++ hood-head _-:*hood-part :: ++ hood-make :: |* {our/@p hed/hood-head} :: ?- hed :: - $drum (drum-make our) :: - $helm *helm-part :: - $kiln *kiln-part :: - $womb *part:womb :: - $write *part:write :: + $drum (make:hood-drum our) :: + $helm *part:hood-helm :: + $kiln *part:hood-kiln :: + $womb *part:hood-womb :: + $write *part:hood-write :: == :: ++ hood-part-old hood-part :: ++ hood-port :: @@ -58,11 +54,11 @@ paw :: :: :: ++ hood-part :: - $% {$drum $2 drum-pith-2} :: - {$helm $0 helm-pith} :: - {$kiln $0 kiln-pith} :: - {$womb $1 pith:womb} :: - {$write $0 pith:write} :: + $% {$drum $2 pith-2:hood-drum} :: + {$helm $0 pith:hood-helm} :: + {$kiln $0 pith:hood-kiln} :: + {$womb $1 pith:hood-womb} :: + {$write $0 pith:hood-write} :: == :: -- :: :: :: :: @@ -108,7 +104,7 @@ :: ++ poke-hood-load |= dat/hood-part - ?> =(our src) + ?> =(our.hid src.hid) ~& loaded+-.dat [~ %_(+> lac (~(put by lac) -.dat dat))] :: @@ -140,7 +136,7 @@ ++ note-helm (wrap take-note):from-helm ++ onto-drum (wrap take-onto):from-drum ++ peer-drum (wrap peer):from-drum -++ peek-x-womb peek-x:(womb hid (able %womb)) +++ peek-x-womb peek-x:(hood-womb hid (able %womb)) ++ peer-scry-x-womb (wrap peer-scry-x):from-womb ++ poke-atom (wrap poke-atom):from-helm ++ poke-dill-belt (wrap poke-dill-belt):from-drum diff --git a/lib/hood/drum.hoon b/lib/hood/drum.hoon index 2ca592e045..53f518c577 100644 --- a/lib/hood/drum.hoon +++ b/lib/hood/drum.hoon @@ -9,18 +9,18 @@ :::: :: :: :: :: :: |% :: :: -++ drum-part {$drum $2 drum-pith-2} :: -++ drum-part-old {$drum $1 drum-pith-1} :: +++ part {$drum $2 pith-2} :: +++ part-old {$drum $1 pith-1} :: :: :: -++ drum-pith-1 :: pre-style - %+ cork drum-pith-2 :: - |=(drum-pith-2 +<(bin *(map bone source-1))) :: +++ pith-1 :: pre-style + %+ cork pith-2 :: + |=(pith-2 +<(bin *(map bone source-1))) :: :: :: ++ source-1 :: %+ cork source :: |=(source +<(mir *(pair @ud (list @c)))) :: style-less mir :: :: -++ drum-pith-2 :: +++ pith-2 :: $: sys/(unit bone) :: local console eel/(set gill:gall) :: connect to ray/(set well:gall) :: @@ -92,9 +92,9 @@ [[(sein:title our) %talk] [our %dojo] ~] [[our %talk] [our %dojo] ~] :: -++ drum-make :: initial part +++ make :: initial part |= our/ship - ^- drum-part + ^- part :* %drum %2 ~ :: sys @@ -104,19 +104,20 @@ ~ :: bin == :: :: -++ drum-path :: encode path +:: +++ en-gill :: gill to wire |= gyl/gill:gall ^- wire [%drum %phat (scot %p p.gyl) q.gyl ~] :: -++ drum-phat :: decode path +++ de-gill :: gill from wire |= way/wire ^- gill:gall ?>(?=({@ @ $~} way) [(slav %p i.way) i.t.way]) -- :: :::: :: -|= {hid/bowl:gall drum-part} :: main drum work +|= {hid/bowl:gall part} :: main drum work =+ (fall (~(get by bin) ost.hid) *source) =* dev - => |% :: arvo structures @@ -140,7 +141,7 @@ ++ diff-sole-effect-phat :: app event |= {way/wire fec/sole-effect} =< se-abet =< se-view - =+ gyl=(drum-phat way) + =+ gyl=(de-gill way) ?: (se-aint gyl) +>.$ (se-diff gyl fec) :: @@ -182,7 +183,7 @@ ++ reap-phat :: ack connect |= {way/wire saw/(unit tang)} =< se-abet =< se-view - =+ gyl=(drum-phat way) + =+ gyl=(de-gill way) ?~ saw (se-join gyl) (se-dump:(se-drop & gyl) u.saw) @@ -191,7 +192,7 @@ |= {way/wire saw/(unit tang)} =< se-abet =< se-view ?~ saw +> - =+ gyl=(drum-phat way) + =+ gyl=(de-gill way) ?: (se-aint gyl) +>.$ %- se-dump:(se-drop & gyl) :_ u.saw @@ -213,15 +214,15 @@ ++ quit-phat :: |= way/wire =< se-abet =< se-view - =+ gyl=(drum-phat way) + =+ gyl=(de-gill way) ~& [%drum-quit src.hid ost.hid gyl] (se-drop %| gyl) :: :: :: :::: :: :: :: :: :: ++ se-abet :: resolve - ^- (quip move drum-part) - =* pith +>+>+<+ + ^- (quip move part) + =* pith +<+.$ ?. se-ably =. . se-adit [(flop moz) pith] @@ -449,16 +450,16 @@ :: ++ se-poke :: send a poke |= {gyl/gill:gall par/pear} - (se-emit [ost.hid %poke (drum-path gyl) gyl par]) + (se-emit [ost.hid %poke (en-gill gyl) gyl par]) :: ++ se-peer :: send a peer |= gyl/gill:gall %- se-emit(fug (~(put by fug) gyl ~)) - [ost.hid %peer (drum-path gyl) gyl /sole] + [ost.hid %peer (en-gill gyl) gyl /sole] :: ++ se-pull :: cancel subscription |= gyl/gill:gall - (se-emit [ost.hid %pull (drum-path gyl) gyl ~]) + (se-emit [ost.hid %pull (en-gill gyl) gyl ~]) :: ++ se-tame :: switch connection |= gyl/gill:gall diff --git a/lib/hood/helm.hoon b/lib/hood/helm.hoon index a811336eb7..bfef214267 100644 --- a/lib/hood/helm.hoon +++ b/lib/hood/helm.hoon @@ -9,12 +9,12 @@ :::: :: :: :: :: :: |% :: :: -++ helm-part {$helm $0 helm-pith} :: helm state -++ helm-pith :: helm content - $: bur/(unit (pair ship mace:ames)) :: requesting ticket - hoc/(map bone helm-session) :: consoles +++ part {$helm $0 pith} :: helm state +++ pith :: helm content + $: bur/(unit (pair ship mace:ames)) :: requesting ticket + hoc/(map bone session) :: consoles == :: -++ helm-session :: +++ session :: $: say/sole-share :: console state mud/(unit (sole-dialog @ud)) :: console dialog == :: @@ -43,8 +43,8 @@ :: :: :: :::: :: :: :: :: :: -|= {bowl:gall helm-part} :: main helm work -=+ sez=(fall (~(get by hoc) ost) *helm-session) +|= {bowl:gall part} :: main helm work +=+ sez=(fall (~(get by hoc) ost) *session) => |% :: arvo structures ++ card :: $% {$cash wire p/@p q/buck:ames} :: @@ -66,7 +66,7 @@ -- |_ moz/(list move) ++ abet :: resolve - [(flop moz) %_(+>+>+<+ hoc (~(put by hoc) ost sez))] + [(flop moz) %_(+<+.$ hoc (~(put by hoc) ost sez))] :: ++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card ++ emil :: return cards diff --git a/lib/hood/kiln.hoon b/lib/hood/kiln.hoon index f01aa9cce0..3d86f37ee7 100644 --- a/lib/hood/kiln.hoon +++ b/lib/hood/kiln.hoon @@ -9,9 +9,9 @@ =, space:userlib =, format |% :: :: -++ kiln-part {$kiln $0 kiln-pith} :: kiln state -++ kiln-pith :: - $: rem/(map desk kiln-desk) :: +++ part {$kiln $0 pith} :: kiln state +++ pith :: :: + $: rem/(map desk per-desk) :: syn/(map kiln-sync {let/@ud ust/bone}) :: autoload-on/? :: cur-hoon/@uvI :: @@ -19,7 +19,7 @@ cur-zuse/@uvI :: cur-vanes/(map @tas @uvI) :: == :: -++ kiln-desk :: per-desk state +++ per-desk :: per-desk state $: auto/? :: escalate on failure gem/germ :: strategy her/@p :: from ship @@ -56,7 +56,7 @@ :: :: :: :::: :: :: :: :: :: -|= {bowl:gall kiln-part} :: main kiln work +|= {bowl:gall part} :: main kiln work ?> =(src our) => |% :: arvo structures ++ card :: @@ -82,7 +82,7 @@ -- |_ moz/(list move) ++ abet :: resolve - [(flop moz) `kiln-part`+>+>->] + [(flop moz) `part`+<+.$] :: ++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card ++ emil :: return cards @@ -406,9 +406,9 @@ :: ++ work :: state machine |= syd/desk - =+ ^- kiln-desk + =+ ^- per-desk %+ fall (~(get by rem) syd) - =+ *kiln-desk + =+ *per-desk %_(- cas [%da now]) |% ++ abet :: resolve From 564d7ebf0c51e7bcf54ad23899aef4da96c609bd Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 29 Nov 2017 20:31:13 -0800 Subject: [PATCH 7/9] handle kiln coups in kiln --- app/hood.hoon | 25 ++++++------------------- lib/hood/kiln.hoon | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/hood.hoon b/app/hood.hoon index 34926b3ae3..cc82798c70 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -86,31 +86,18 @@ ?~ old +> +>(lac (~(run by lac.u.old) hood-port)) :: -++ coup-kiln-fancy (wrap take-coup-fancy):from-kiln -++ coup-kiln-spam :: - |= {way/wire saw/(unit tang)} - ~? ?=(^ saw) [%kiln-spam-lame u.saw] - [~ +>] -:: -++ coup-kiln-reload :: - |= {way/wire saw/(unit tang)} - ~? ?=(^ saw) [%kiln-reload-lame u.saw] - [~ +>] -:: -++ coup-kiln-overload :: - |= {way/wire saw/(unit tang)} - ~? ?=(^ saw) [%kiln-overload-lame u.saw] - [~ +>] -:: ++ poke-hood-load |= dat/hood-part ?> =(our.hid src.hid) ~& loaded+-.dat [~ %_(+> lac (~(put by lac) -.dat dat))] :: -++ coup-drum-phat (wrap take-coup-phat):from-drum -++ coup-helm-hi (wrap coup-hi):from-helm -++ coup-helm-ask (wrap coup-ask):from-helm +++ coup-drum-phat (wrap take-coup-phat):from-drum +++ coup-helm-hi (wrap coup-hi):from-helm +++ coup-helm-ask (wrap coup-ask):from-helm +++ coup-kiln-fancy (wrap take-coup-fancy):from-kiln +++ coup-kiln-reload (wrap take-coup-reload):from-kiln +++ coup-kiln-spam (wrap take-coup-spam):from-kiln ++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum ++ from-lib |* _[%sample ..$ _abet]:(hood-sample) diff --git a/lib/hood/kiln.hoon b/lib/hood/kiln.hoon index 3d86f37ee7..9f65d5257f 100644 --- a/lib/hood/kiln.hoon +++ b/lib/hood/kiln.hoon @@ -254,6 +254,11 @@ +>.$ =. cur-vanes (~(put by cur-vanes) syd new-vane) (emit [%poke /kiln/reload/[syd] [our %hood] %helm-reload ~[syd]]) + :: + ++ coup-reload + |= {way/wire saw/(unit tang)} + ~? ?=(^ saw) [%kiln-reload-lame u.saw] + +>.$ -- :: ++ poke-overload @@ -275,6 +280,15 @@ |= {way/wire saw/(unit tang)} abet:abet:(coup-fancy:(take way) saw) :: +++ take-coup-reload :: + |= {way/wire saw/(unit tang)} + abet:(coup-reload:autoload way saw) +:: +++ take-coup-spam :: + |= {way/wire saw/(unit tang)} + ~? ?=(^ saw) [%kiln-spam-lame u.saw] + abet +:: ++ take-mere-sync :: |= {way/wire mes/(each (set path) (pair term tang))} ?> ?=({@ @ @ *} way) From 63d8c83cea9ebbf585f32dde73e99b528b186e40 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 29 Nov 2017 20:33:15 -0800 Subject: [PATCH 8/9] separate out hood dsl implementation from main switchboard --- app/hood.hoon | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/hood.hoon b/app/hood.hoon index cc82798c70..36a401d37d 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -92,13 +92,7 @@ ~& loaded+-.dat [~ %_(+> lac (~(put by lac) -.dat dat))] :: -++ coup-drum-phat (wrap take-coup-phat):from-drum -++ coup-helm-hi (wrap coup-hi):from-helm -++ coup-helm-ask (wrap coup-ask):from-helm -++ coup-kiln-fancy (wrap take-coup-fancy):from-kiln -++ coup-kiln-reload (wrap take-coup-reload):from-kiln -++ coup-kiln-spam (wrap take-coup-spam):from-kiln -++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum +:: ++ from-lib |* _[%sample ..$ _abet]:(hood-sample) => .(+< [identity start finish]=+<) @@ -113,7 +107,16 @@ ++ from-kiln (from-lib %kiln [..$ _abet]:(hood-kiln)) ++ from-womb (from-lib %womb [..$ _abet]:(hood-womb)) ++ from-write (from-lib %write [..$ _abet]:(hood-write)) -:: +:: :: :: +:::: :: :: + :: :: :: +++ coup-drum-phat (wrap take-coup-phat):from-drum +++ coup-helm-hi (wrap coup-hi):from-helm +++ coup-helm-ask (wrap coup-ask):from-helm +++ coup-kiln-fancy (wrap take-coup-fancy):from-kiln +++ coup-kiln-reload (wrap take-coup-reload):from-kiln +++ coup-kiln-spam (wrap take-coup-spam):from-kiln +++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum ++ init-helm |=({way/wire *} [~ +>]) ++ made-write (wrap made):from-write ++ made-kiln (wrap take-made):from-kiln From deea2fd2bf152cdb239f41ab4f91768e17d27de3 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 29 Nov 2017 20:55:58 -0800 Subject: [PATCH 9/9] improve comment disdain --- app/hood.hoon | 69 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/app/hood.hoon b/app/hood.hoon index 36a401d37d..6411f92bbe 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -3,11 +3,24 @@ :: :: :: /? 310 :: zuse version /+ sole, talk, :: libraries - hood-helm, hood-kiln, hood-drum, hood-write, hood-womb :: "libraries" + :: XX these should really be separate apps, as + :: none of them interact with each other in + :: any fashion; however, to reduce boot-time + :: complexity and work around the current + :: non-functionality of end-to-end acknowledgments, + :: they have been bundled into :hood + :: + :: |command handlers + hood-helm, hood-kiln, hood-drum, hood-write, + hood-womb +:: :: :: +:::: :: :: + :: :: :: |% -++ hood-sample +++ hood-module + :: each hood module follows this general shape => |% - += part [%sample %0 pith] + += part [%module %0 pith] += pith ~ :: += move [bone card] @@ -20,15 +33,15 @@ -- -- :: :: :: -:::: :: :: +:::: :: :: state handling :: :: :: !: -=> |% :: module boilerplate - ++ hood-old :: +=> |% :: + ++ hood-old :: unified old-state {?($0 $1) lac/(map @tas hood-part-old)} :: - ++ hood-1 :: + ++ hood-1 :: unified state {$1 lac/(map @tas hood-part)} :: - ++ hood-good :: + ++ hood-good :: extract specific |* hed/hood-head :: |= paw/hood-part :: ?- hed :: @@ -37,8 +50,8 @@ $kiln ?>(?=($kiln -.paw) `part:hood-kiln`paw) :: $womb ?>(?=($womb -.paw) `part:hood-womb`paw) :: $write ?>(?=($write -.paw) `part:hood-write`paw) :: - == :: - ++ hood-head _-:*hood-part :: + == :: module name + ++ hood-head _-:*hood-part :: initialize state ++ hood-make :: |* {our/@p hed/hood-head} :: ?- hed :: @@ -48,12 +61,12 @@ $womb *part:hood-womb :: $write *part:hood-write :: == :: - ++ hood-part-old hood-part :: - ++ hood-port :: + ++ hood-part-old hood-part :: old state for ++prep + ++ hood-port :: state transition |= paw/hood-part-old ^- hood-part :: paw :: :: :: - ++ hood-part :: + ++ hood-part :: current module state $% {$drum $2 pith-2:hood-drum} :: {$helm $0 pith:hood-helm} :: {$kiln $0 pith:hood-kiln} :: @@ -62,11 +75,11 @@ == :: -- :: :: :: :: -:::: :: :: +:::: :: :: app proper :: :: :: =, gall -|_ $: hid/bowl :: system state - hood-1 :: server state +|_ $: hid/bowl :: gall environment + hood-1 :: module states == :: ++ able :: find+make part |* hed/hood-head @@ -78,23 +91,23 @@ |* {(list) hood-part} [(flop +<-) %_(+> lac (~(put by lac) +<+< +<+))] :: :: :: -:::: :: :: +:::: :: :: generic handling :: :: :: ++ prep - |= old/(unit hood-old) ^- (quip _!! _+>) :: + |= old/(unit hood-old) ^- (quip _!! _+>) :- ~ ?~ old +> +>(lac (~(run by lac.u.old) hood-port)) :: -++ poke-hood-load +++ poke-hood-load :: recover lost brain |= dat/hood-part ?> =(our.hid src.hid) ~& loaded+-.dat [~ %_(+> lac (~(put by lac) -.dat dat))] :: :: -++ from-lib - |* _[%sample ..$ _abet]:(hood-sample) +++ from-module :: create wrapper + |* _[%module ..$ _abet]:(hood-module) => .(+< [identity start finish]=+<) =- [wrap=- *start] :: usage (wrap handle-arm):from-foo |* handle/_finish @@ -102,13 +115,15 @@ =. +>.handle (start hid (able identity)) (ably (handle +<)) :: -++ from-drum (from-lib %drum [..$ _se-abet]:(hood-drum)) -++ from-helm (from-lib %helm [..$ _abet]:(hood-helm)) -++ from-kiln (from-lib %kiln [..$ _abet]:(hood-kiln)) -++ from-womb (from-lib %womb [..$ _abet]:(hood-womb)) -++ from-write (from-lib %write [..$ _abet]:(hood-write)) +:: per-module interface wrappers +++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum)) +++ from-helm (from-module %helm [..$ _abet]:(hood-helm)) +++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln)) +++ from-womb (from-module %womb [..$ _abet]:(hood-womb)) +++ from-write (from-module %write [..$ _abet]:(hood-write)) +:: :: :: :: -:::: :: :: +:::: :: :: switchboard :: :: :: ++ coup-drum-phat (wrap take-coup-phat):from-drum ++ coup-helm-hi (wrap coup-hi):from-helm