From 43e866939acf1c236db39b694a8caa6b9069d4d5 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Tue, 13 Jan 2015 21:38:39 -0800 Subject: [PATCH] Printing improvements --- arvo/dill.hoon | 2 +- arvo/gall.hoon | 18 ++---------------- arvo/hoon.hoon | 28 +++++++++++++++++----------- arvo/zuse.hoon | 8 ++++++++ main/app/shell/core.hook | 4 ++-- main/app/terminal/core.hook | 13 ++++--------- main/mar/term-in/door.hook | 2 +- main/sur/term-in/gate.hook | 2 +- 8 files changed, 36 insertions(+), 41 deletions(-) diff --git a/arvo/dill.hoon b/arvo/dill.hoon index de03c36fb6..71fc7659f9 100644 --- a/arvo/dill.hoon +++ b/arvo/dill.hoon @@ -91,7 +91,7 @@ ++ term-in :: $: pax=path :: $= jof :: - $% [%line p=span] :: + $% [%line p=cord] :: [%res p=span] :: [%cmd p=char] :: [%type p=?] :: diff --git a/arvo/gall.hoon b/arvo/gall.hoon index 52c3894f8c..de522ddbf0 100644 --- a/arvo/gall.hoon +++ b/arvo/gall.hoon @@ -202,23 +202,12 @@ :- ?~(p.u.a ~ ?~(p.u.b ~ `(grom u.p.u.b u.p.u.a))) (grom q.u.b q.u.a) :: -++ lamp - |= con=(unit coin) - ^- (unit path) - ?: ?=([~ %$ %tas @] con) - (some [q.p.u.con]~) - ?. ?=([~ %many *] con) ~ - %- zl:jo - %+ turn p.u.con - |= tem=coin - ?.(?=([%$ %ta @] tem) ~ (some q.p.tem)) -:: ++ lump :: position |= pax=path ^- [p=hapt q=path] ?> ?=([@ @ *] pax) :- :- (slav %p i.pax) - (need (lamp (slay i.t.pax))) + (need (pick i.t.pax)) t.t.pax -- . == :: end preface @@ -574,10 +563,7 @@ :: ++ away :: application path |= pax=path ^- path - =+ ?: &(?=([@tas ~] imp) ((sane %tas) i.imp)) - imc=[%$ %tas i.imp] - imc=[%many (turn imp |=(a=span [%$ %ta a]))] - [%a (scot %p our) ~(rent co imc) pax] + [%a (scot %p our) ?~(imp %$ (pack imp)) pax] :: ++ bear :: write backward |= hen=duct diff --git a/arvo/hoon.hoon b/arvo/hoon.hoon index 84ab51cfb8..f1f0d97d18 100644 --- a/arvo/hoon.hoon +++ b/arvo/hoon.hoon @@ -3031,16 +3031,20 @@ :: ++ wick :: span format |= a=@ - ^- @ta + ^- (unit ,@ta) =+ b=(rip 3 a) - %+ rap 3 - |- ^- tape - ?~ b - ~ - ?: =('~' i.b) - ?~ t.b !! - [?:(=('~' i.t.b) '~' ?>(=('-' i.t.b) '_')) $(b t.t.b)] - [i.b $(b t.b)] + =- ?^(b ~ (some (rap 3 (flop c)))) + =| c=tape + |- ^- [b=tape c=tape] + ?~ b [~ c] + ?. =('~' i.b) + $(b t.b, c [i.b c]) + ?~ t.b [b ~] + ?- i.t.b + %'~' $(b t.t.b, c ['~' c]) + %'-' $(b t.t.b, c ['_' c]) + @ [b ~] + == :: ++ woad :: cord format |= a=@ta @@ -3313,7 +3317,7 @@ => ^+(. .(rex ?~(f.yug rex ['.' (s-co f.yug)]))) :- '~' ?: &(=(0 d.yug) =(0 m.yug) =(0 h.yug) =(0 s.yug)) - ['.' 's' '0' rex] + ['s' '0' rex] => ^+(. ?:(=(0 s.yug) . .(rex ['.' 's' (a-co s.yug)]))) => ^+(. ?:(=(0 m.yug) . .(rex ['.' 'm' (a-co m.yug)]))) => ^+(. ?:(=(0 h.yug) . .(rex ['.' 'h' (a-co h.yug)]))) @@ -3562,7 +3566,7 @@ :- '~' ;~(pfix sig ;~(pose twid (easy [~ %n 0]))) == ++ nusk - (sear |=(a=@ta (rush (wick a) nuck)) urt:ab) + :(sear |=(a=@ta (rush a nuck)) wick urt:ab) ++ perd ;~ pose (stag ~ zust) @@ -7090,6 +7094,8 @@ [%pear *] ?. =(lum q.q.ham) ~ + ?: ?=([%tas ~] +.q.ham) + [~ %leaf '%' '$' ~] =+ fox=~(rend co [~ p.q.ham q.q.ham]) [~ %leaf ?:(=(['~' ~] fox) fox ['%' fox])] :: diff --git a/arvo/zuse.hoon b/arvo/zuse.hoon index 622832da09..7628b17367 100644 --- a/arvo/zuse.hoon +++ b/arvo/zuse.hoon @@ -2668,6 +2668,14 @@ ?: ?=(| -.mud) mud (mule |.((slam p.mud sam))) :: +++ pack :: light path encoding + |= [a=term b=path] ^- span + %+ rap 3 :- (wack a) + (turn b |=(c=span (cat 3 '_' (wack c)))) +:: +++ pick :: light path decoding + |= a=span ^- (unit ,[p=term q=path]) + (rush a (most cab (sear wick urt:ab))) ++ saxo :: autocanon |= who=ship ^- (list ship) diff --git a/main/app/shell/core.hook b/main/app/shell/core.hook index 165a471184..3b070c21a9 100644 --- a/main/app/shell/core.hook +++ b/main/app/shell/core.hook @@ -141,7 +141,7 @@ :: -- -- -!: +:: :::: per event :: |% @@ -478,7 +478,7 @@ !>([%rush %term-line `term-line`[prompt [a]~ ~]]) -- -- -!: +:: :::: formal interface :: |_ [hid=hide vat=axle] diff --git a/main/app/terminal/core.hook b/main/app/terminal/core.hook index 319d825884..cbeff87d05 100644 --- a/main/app/terminal/core.hook +++ b/main/app/terminal/core.hook @@ -63,11 +63,6 @@ :: |% ++ aut %shell -++ encode - |= [a=term b=path] ^- span - (rap 3 a (turn b |=(c=span (cat 3 '_' c)))) -:: -++ decode |=(a=span `[p=term q=path]`(rash a (most cab sym))) ++ inject |= [a=[i=mane t=(list mane)] b=marl] |= man=manx @@ -80,7 +75,7 @@ ++ start-shell |= [our=ship imp=path ost=bone you=ship pax=path] ^- (list move) - =+ auc=(encode aut pax) + =+ auc=(pack aut pax) :- [ost %pass [%fork pax] %g %sire [aut auc]] [ost %pass [%resp pax] %g %show [our [auc imp]] you /out]~ -- @@ -91,7 +86,7 @@ ++ se |= [hid=hide ost=bone you=ship hiz=(map path term-line) pax=path] =+ tel=(fall (~(get by hiz) pax) *term-line) - =+ auc=(encode aut pax) + =+ auc=(pack aut pax) =^ mow tel ?: (~(has by cub.hid) auc) [~ tel] @@ -128,7 +123,7 @@ == :: ++ poke - |= jof=$%([%line p=span] [%res p=span] [%cmd p=char] [%type p=?]) + |= jof=$%([%line p=cord] [%res p=span] [%cmd p=char] [%type p=?]) ^+ +> ?- -.jof %res :: restart shell @@ -212,7 +207,7 @@ ^- (list move) %+ murn (~(tap by cub.hid)) |= [p=span q=term] - ?. =(pax q:(decode p)) ~ + ?. =(p auc) ~ %- some ^- move :^ ost %pass [-.mez pax] [%g %mess [our.hid p imp.hid] you mez] diff --git a/main/mar/term-in/door.hook b/main/mar/term-in/door.hook index 765db215ba..9f69f737dc 100644 --- a/main/mar/term-in/door.hook +++ b/main/mar/term-in/door.hook @@ -13,7 +13,7 @@ %- need %. jon => jo %^ ot - pax/(su ;~(pfix fas (more fas sym))) + pax/(su ;~(pose (cold ~ (full fas)) (plus ;~(pfix fas urs:ab)))) act/(of line/so res/so cmd/so ~) ~ ++ noun term-in :: clam from %noun diff --git a/main/sur/term-in/gate.hook b/main/sur/term-in/gate.hook index c0e0654e9d..d13ff357f9 100644 --- a/main/sur/term-in/gate.hook +++ b/main/sur/term-in/gate.hook @@ -1,6 +1,6 @@ $: pax=path :: $= jof :: -$% [%line p=span] :: +$% [%line p=cord] :: [%res p=span] :: [%cmd p=char] :: [%type p=?] ::