From 970ac7bdb0375bbce14c4969626c012b22c71afc Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Tue, 7 Apr 2015 13:31:09 -0700 Subject: [PATCH] Pass through mean --- arvo/eyre.hoon | 12 ++-- main/lib/console/core.hook | 142 +++++++++++++++++++++++++++++++++++++ main/lib/shu/core.hook | 3 + main/lib/urb.js | 2 + main/sur/talk/core.hook | 8 +-- 5 files changed, 158 insertions(+), 9 deletions(-) create mode 100644 main/lib/console/core.hook create mode 100644 main/lib/shu/core.hook diff --git a/arvo/eyre.hoon b/arvo/eyre.hoon index bb008c075..d2f7522a1 100644 --- a/arvo/eyre.hoon +++ b/arvo/eyre.hoon @@ -468,7 +468,10 @@ =. our ?~(hov our u.hov) :: XX ?- &2.sih %crud +>.$(mow [[hen %slip %d %flog +.sih] mow]) - %dumb (emule |.(~|(%gall-stub !!))) + %dumb + =. +> ?+(tee +> [%of ^] pop-duct:(ire-ix p.tee)) + (emule |.(~|(gall-dumb/tee !!))) + :: %went +>.$ %thou ?> ?=([%ay ^] tee) @@ -1102,13 +1105,11 @@ %mean ?~ p.b :: XX actually a yawn-told-full (get-even %mean [[(slav %p p.a) q.a] r.a] p.b) - =^ ned med ~(get to med) - (mean-json:abet(hen ned) 500 p.b) + (mean-json:pop-duct 500 p.b) :: %nice ?: =(~ med) ~& resp-lost/ire ..ix - =^ ned med ~(get to med) - (nice-json:abet(hen ned)) + (nice-json:pop-duct) == :: ++ get-even @@ -1138,6 +1139,7 @@ |= a=[p=hasp wire] (pass-note(hen `~) [%of ire (gsig a)] [%g %took [- + ~]:p.a him]) :: + ++ pop-duct =^(ned med ~(get to med) abet(hen ned)) ++ poll |= a=@u ^+ ..ix ?: =(a p.eve) diff --git a/main/lib/console/core.hook b/main/lib/console/core.hook new file mode 100644 index 000000000..6654549fb --- /dev/null +++ b/main/lib/console/core.hook @@ -0,0 +1,142 @@ +:: +:::: /hook/core/console/lib + :: + :: This file is in the public domain. + :: +/? 310 +/- *console +!: +:::: + :: +|% +++ cs :: shared-state engine + |_ console-share + ++ abet +< + ++ apply + |= ted=console-edit + ^+ +> + ?- -.ted + %del +>.$(buf (weld (scag p.ted buf) (slag +(p.ted) buf))) + %ins +>.$(buf (weld (scag p.ted buf) `_buf`[q.ted (slag p.ted buf)])) + %mor |- ^+ +>.^$ + ?~ p.ted + +>.^$ + $(p.ted t.p.ted, +>.^$ ^$(ted i.p.ted)) + %nop +>.$ + %set +>.$(buf p.ted) + == + :: + :::: + :: ++transmute: symmetric operational transformation. + :: + :: for any console state +>, obeys + :: + :: =+ [x=(transmute a b) y=(transmute b a)] + :: .= (apply:(apply b) x) + :: (apply:(apply a) y) + :: + ++ transmute :: dex as after sin + |= [sin=console-edit dex=console-edit] + ^- console-edit + ?: ?=(%mor -.sin) + |- ^- console-edit + ?~ p.sin dex + $(p.sin t.p.sin, dex ^$(sin i.p.sin)) + :: + ?: ?=(%mor -.dex) + :- %mor + |- ^- (list console-edit) + ?~ p.dex ~ + [^$(dex i.p.dex) $(p.dex t.p.dex)] + :: + ?: |(?=(%nop -.sin) ?=(%nop -.dex)) dex + ?: ?=(%set -.sin) [%nop ~] + ?: ?=(%set -.dex) dex + :: + ?- -.sin + %del + ?- -.dex + %del ?: =(p.sin p.dex) [%nop ~] + ?:((lth p.sin p.dex) dex(p (dec p.dex)) dex) + %ins ?:((lte p.sin p.dex) dex(p (dec p.dex)) dex) + == + :: + %ins + ?- -.dex + %del ?:((lte p.sin p.dex) dex(p +(p.dex)) dex) + %ins ?: =(p.sin p.dex) + ?:((gth q.sin q.dex) dex dex(p +(p.dex))) + ?:((lte p.sin p.dex) dex(p +(p.dex)) dex) + == + == + :: + ++ commit :: local change + |= ted=console-edit + ^- console-share + abet:(apply(own.ven +(own.ven), leg [ted leg]) ted) + :: + :::: + :: ++inverse: inverse of change in context. + :: + :: for any console state +>, obeys + :: + :: =(+> (apply:(apply a) (inverse a))) + :: + ++ inverse :: relative inverse + |= ted=console-edit + ^- console-edit + =. ted ?.(?=([%mor * ~] ted) ted i.p.ted) + ?- -.ted + %del [%ins p.ted (snag p.ted buf)] + %ins [%del p.ted] + %mor :- %mor + %- flop + |- ^- (list console-edit) + ?~ p.ted ~ + :- ^$(ted i.p.ted) + $(p.ted t.p.ted, +>.^$ (apply i.p.ted)) + %nop [%nop ~] + %set [%set buf] + == + :: + ++ receive :: naturalize event + |= console-change + ^- [console-edit console-share] + ?> &(=(his.ler his.ven) (lte own.ler own.ven)) + ?> &(=(his.ler his.ven) (lte own.ler own.ven)) + ?> |(!=(own.ler own.ven) =(haw (sham buf))) + =. leg (scag (sub own.ven own.ler) leg) + :: ~? !=(own.ler own.ven) [%miss-leg leg] + =+ dat=(transmute [%mor leg] ted) + :: ~? !=(~ leg) [%transmute from/ted to/dat ~] + [dat abet:(apply(his.ven +(his.ven)) dat)] + :: + ++ remit :: conditional accept + |= [cal=console-change ask=$+((list ,@c) ?)] + ^- [(unit console-change) console-share] + =+ old=buf + =^ dat +>+<.$ (receive cal) + ?: (ask buf) + [~ +>+<.$] + =^ lic +>+<.$ (transmit (inverse(buf old) dat)) + [`lic +>+<.$] + :: + ++ transmit :: outgoing change + |= ted=console-edit + ^- [console-change console-share] + [[[his.ven own.ven] (sham buf) ted] (commit ted)] + :: + ++ transceive :: receive and invert + |= console-change + ^- [console-edit console-share] + =+ old=buf + =^ dat +>+<.$ (receive +<.$) + [(inverse(buf old) dat) +>+<.$] + :: + ++ transpose :: adjust position + |= pos=@ud + =+ dat=(transmute [%mor leg] [%ins pos `@c`0]) + ?> ?=(%ins -.dat) + p.dat + -- +-- diff --git a/main/lib/shu/core.hook b/main/lib/shu/core.hook new file mode 100644 index 000000000..6628088aa --- /dev/null +++ b/main/lib/shu/core.hook @@ -0,0 +1,3 @@ +:: Alias +/+ sh-utils +. diff --git a/main/lib/urb.js b/main/lib/urb.js index e73bec60e..1a962110e 100644 --- a/main/lib/urb.js +++ b/main/lib/urb.js @@ -103,6 +103,8 @@ window.urb.poll = function(params) { return document.location.reload() // XX check autoreload case "rush": case "mean": + if(res.data.type) == "mean" + err = res.data.data var fn = $this.gsig(res.data.from) if($this.cabs[fn]) $this.cabs[fn].call(this,err, diff --git a/main/sur/talk/core.hook b/main/sur/talk/core.hook index 120855b4a..3384f3501 100644 --- a/main/sur/talk/core.hook +++ b/main/sur/talk/core.hook @@ -37,10 +37,10 @@ $% [%twitter p=@t] :: twitter == :: ++ posture :: security posture - $? %black :: channel - %white :: village - %green :: journal - %brown :: mailbox + $? %black :: public + %white :: private + %green :: readonly + %brown :: writeonly == :: ++ presence ?(%gone %hear %talk) :: status type ++ register (pair atlas (map partner atlas)) :: ping me, ping srcs