From b3a5c4149183afe947e5b113a792e2968fd89e09 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Wed, 16 Apr 2014 17:49:41 -0700 Subject: [PATCH] Shell console. --- arvo/batz.hoon | 20 +++---- arvo/eyre.hoon | 102 ++++++++++++++++++++++++++------- try/syn/web/template/htmn.hoon | 2 +- 3 files changed, 91 insertions(+), 33 deletions(-) diff --git a/arvo/batz.hoon b/arvo/batz.hoon index 7cbdaf015f..21a573058e 100644 --- a/arvo/batz.hoon +++ b/arvo/batz.hoon @@ -1149,11 +1149,6 @@ |% :: poke/peek pattern ++ beat :: process move |= [wru=(unit writ) tea=wire hen=duct fav=curd] - =+ vaf=(card fav) - ?. =(vaf fav) - ~& [%fav fav] - ~& [%vaf vaf] - !! => .(fav ((hard card) fav)) ^- [p=(list move) q=vane] ?: ?=([%crud *] fav) @@ -1193,11 +1188,16 @@ wam (weld p.yub wam) dez.^^$ (~(put by dez.^^$) p.i.fiy [[q.i.fiy +.q.yub] +.dos]) == + |- ^- [p=(list move) q=vane] =+ dus=(~(get by dez) hen) ?~ dus ?+ -.fav ~& [%beat-none -.fav tea hen] ~|([%beat-none -.fav] !!) + :: + %hail + ?~ wru !! + $(dez (~(put by dez) hen [[q.u.wru (bard q.u.wru)] ~])) :: %init =+ bos=(sein p.fav) @@ -1207,10 +1207,10 @@ ?: =(bos p.fav) ~ :_ ~ [wru [/b hen] [%line (rap 3 ":{(scow %p bos)}/main=/bin/update")]] - ..^$(dez (~(put by dez) hen [[q.u.wru (bard q.u.wru)] ~])) + ..^^$(dez (~(put by dez) hen [[q.u.wru (bard q.u.wru)] ~])) :: ?(%loin %make %sith) - [[[wru [/a [%b tea] hen] fav] ~] ..^$] + [[[wru [/a [%b tea] hen] fav] ~] ..^^$] == ?> ?=(^ u.dus) ?+ -.fav @@ -1220,11 +1220,11 @@ ?~ wru =+ ade=(adit hen) =+ hem=`helm`?-(ade %lead [%lead p.i.u.dus], %iron %iron, %gold %gold) - [[[[~ hem p.i.u.dus] [[%b tea] hen] fav] ~] ..^$] + [[[[~ hem p.i.u.dus] [[%b tea] hen] fav] ~] ..^^$] =+ beg=`brat`[[p.i.u.dus bred] q.i.u.dus] =+ yub=(leap:((be beg) now eny sky) tea hen fav) :- p.yub - ..^$(dez (~(put by dez) hen [[p.i.u.dus +.q.yub] t.u.dus])) + ..^^$(dez (~(put by dez) hen [[p.i.u.dus +.q.yub] t.u.dus])) :: %init =+ bos=(sein p.fav) @@ -1236,7 +1236,7 @@ :_ ~ [wru [/b hen] [%line (rap 3 ":{(scow %p bos)}/main=/bin/update")]] == - ..^$(dez (~(put by dez) hen [[q.u.wru (bard q.u.wru)] u.dus])) + ..^^$(dez (~(put by dez) hen [[q.u.wru (bard q.u.wru)] u.dus])) :: %limn $(fav [%hail ~], dez (~(put by dez) hen (weld t.u.dus `brim`[i.u.dus ~]))) diff --git a/arvo/eyre.hoon b/arvo/eyre.hoon index 84a8e6196c..4fc0777c14 100644 --- a/arvo/eyre.hoon +++ b/arvo/eyre.hoon @@ -246,6 +246,12 @@ +.$ ?> ?=(^ wru) (gout q.u.wru i.t.tea (need (slaw %ud i.t.t.tea)) p.fav) + :: + ?(%helo %tell %text %talk %warn) + ?. ?=([%cons @ @ ~] tea) + +.$ + ?> ?=(^ wru) + (goat q.u.wru i.t.tea (need (slaw %ud i.t.t.tea)) fav) == :: ++ doss :: host to ship @@ -264,6 +270,14 @@ ^- httr [sas ~[content-type/'text/plain'] [~ (tact str)]] :: + ++ goat + |= [our=ship ses=hole num=@ud fav=card] + =+ suf=(~(get by own) our) + ?~ suf +>.$ + =+ cuz=(~(get by wup.u.suf) ses) + ?~ cuz +>.$ + abet:work:(~(dodo ya [our ses] u.suf u.cuz) num fav) + :: ++ gosh :: receive %pr response |= [him=ship num=@ud har=httr] ^+ +> @@ -558,7 +572,7 @@ =. cow (~(put by cow) con cal) ?~(yov +>.$ (dove ~[%a (jone ono.cal) (jone ino.cal) jon] yov)) :: - ++ dove :: console waiters + ++ dove :: console waiting |= [jon=json yov=(list ,@ud)] ^+ +> =+ noz=`pest`[%fin %mid /text/json (tact (pojo jon))] @@ -591,12 +605,10 @@ ?. &(?=(^ fee) ?=(^ fum)) ~ ?: |(?=(~ muh) ?=(~ r.u.muh)) [~ %cog u.fee u.fum] - ?. =([~ 'text/json'] (~(get by q.u.muh) 'content-type')) - ~& %flub-type + ?. =([~ 'text/json' ~] (~(get by q.u.muh) 'content-type')) ~ =+ jun=`(unit json)`(rush q.u.r.u.muh apex:poja) ?~ jun - ~& %flub-json ~ [~ %cop u.fee u.fum u.jun] :: @@ -1075,7 +1087,12 @@ %con :_ +>.$ =+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *coal)) - =+ obj=(jobe ~[sent/(jone ino.cal) recv/(jone ono.cal)]) + =+ ^= obj + %- jobe + :~ sent/(jone ino.cal) + recv/(jone ono.cal) + ownr/[%s (rsh 3 1 (scot %p our))] + == =+ sez=:/("seq={(pojo obj)}") =+ jqu="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" =+ ^= sac @@ -1095,9 +1112,10 @@ ; } ; console.log('sending') ; console.log(com) - ; $.ajax('/toc/0/'+seq.sent, { + ; $.ajax('/'+seq.ownr+'/toc/0/'+seq.sent, { ; type: 'PUT', - ; data: com, + ; contentType: 'text/json', + ; data: JSON.stringify(com), ; success: function(data,status,xhr) { ; seq.sent++ ; }, @@ -1110,14 +1128,17 @@ ; } ; ; recv = function() { - ; $.ajax('/goc/0/'+(seq.recv+1), { + ; $.ajax('/'+seq.ownr+'/goc/0/'+seq.recv, { ; type:'GET', ; success: function(data,status,xhr) { - ; if(data.lines !== undefined) - ; addLines(data.lines) - ; if(data.helo !== undefined) - ; changePrompt(data.helo) - ; seq.recv++ + ; console.log(data); + ; seq.recv = data[0]; + ; seq.send = data[1]; + ; msg = data[2]; + ; if(msg.text !== undefined) + ; addLines(msg.text) + ; if(msg.helo !== undefined) + ; changePrompt(msg.helo) ; recv() ; }, ; error: function(data,status,xhr) { @@ -1136,7 +1157,7 @@ ; } ; ; changePrompt = function(helo) { - ; $prompt.text(helo[1].q) + ; $prompt.text(helo.prod[1]); ; } ; ; ctrl = false @@ -1171,20 +1192,57 @@ =+ ^= ham ;html ;head - ;title: Dogs fucked the Pope! + ;title: urbit {}/{} ;script(type "text/javascript", src jqu); + ;style + ; body { + ; margin: 60px 120px; + ; font: normal 12px "Menlo" monospace; + ; background-color: #000; + ; color: #fff; + ; } + ; + ; #output { + ; + ; } + ; + ; #input .prompt { + ; display: inline-block; + ; margin-right: 12px; + ; } + ; + ; #input .line { + ; outline: none; + ; width: 80%; + ; border: 0; + ; background-color: transparent; + ; color: #fff; + ; font: normal 12px "Menlo" monospace; + ; } + == == ;body + ;div@output; + ;div@input + ;div/prompt; + ;input/line(type "text"); + == ;+ [-.sac `marl`[sez +.sac]] == == [~ pip(pez [%fin %ham ham])] :: %cog - :_ +>.$ =+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *coal)) ?. (lth q.som.pip ono.cal) - [~ pip(pez %way)] + :- [~ pip(pez %way)] + %= +>.$ cow + %+ ~(put by cow) + p.som.pip + =+ val=(~(get by voy.cal) q.som.pip) + cal(voy (~(put by voy.cal) q.som.pip ?~(val [num ~] [num u.val]))) + == + :_ +>.$ =+ ^= jon ^- json :~ %a (jone ono.cal) @@ -1203,18 +1261,18 @@ ?. ?=(%o -.r.som.pip) ~ =+ lin=(~(get by p.r.som.pip) %line) ?^ lin ?.(?=(%s -.u.lin) ~ [~ %line p.u.lin]) - =+ syc=(~(get by p.r.som.pip) %sync) + =+ syc=(~(get by p.r.som.pip) %hail) ?^ syc [~ %hail ~] =+ lig=(~(get by p.r.som.pip) %ling) ?^ lig [~ %ling ~] ~ :_ %_ +>.$ - cow (~(put by cow) p.som.pip cal) + cow (~(put by cow) p.som.pip cal(ino +(ino.cal))) mow ?~ fuv mow :_ mow :+ [~ %gold our] - [/b [%e %cons ses (scot %ud p.som.pip) ~] hen] + [/b [%e %cons ses (scot %ud p.som.pip) ~] ~ ~] u.fuv == [~ `pimp`pip(pez `pest`[%fin %raw 200 ~ ~])] @@ -1242,12 +1300,12 @@ == :: [%err *] - [~ +>.$(..ya (muff [%thou (loft `love`[%zap +.pez.pip])]))] + [~ +>.$(..ya (muff(hen hen.pip) [%thou (loft `love`[%zap +.pez.pip])]))] :: [%fin *] =+ har=(loft p.pez.pip) =. q.har (weld (turn cug |=(a=@t ['set-cookie' a])) q.har) - [~ +>.$(..ya (muff [%thou har]))] + [~ +>.$(..ya (muff(hen hen.pip) [%thou har]))] :: [%haz *] :_ +>.$ diff --git a/try/syn/web/template/htmn.hoon b/try/syn/web/template/htmn.hoon index c9b06a3402..2c15abdcbe 100644 --- a/try/syn/web/template/htmn.hoon +++ b/try/syn/web/template/htmn.hoon @@ -11,7 +11,7 @@ =+ foo=`manx`i/;"foobarz" =+ lam=`(list manx)`[lim lum lom ~] ;= - ;title: Hi foo! + ;title: Hi Galen! ; ;p: Hello, world. Goodbye! Hello! Typing... more typing... ;p:"Hello: pos is {}"