Merge branch 'master' into newbreach

Conflicts:
	urb/zod/arvo/ames.hoon
	v/sist.c
This commit is contained in:
Steve Dee 2014-04-21 19:06:16 -07:00
commit d50809b420
5 changed files with 383 additions and 35 deletions

View File

@ -380,7 +380,7 @@
vix=(bex +((cut 0 [25 2] mag))) :: width of sender
tay=(cut 0 [27 5] mag) :: message type
==
?> =(2 vez)
?> =(4 vez)
?> =(chk (end 0 20 (mug bod)))
:+ [(end 3 wix bod) (cut 3 [wix vix] bod)]
(kins tay)
@ -400,7 +400,7 @@
=+ tay=(ksin q.kec)
%+ mix
%+ can 0
:~ [3 2]
:~ [3 4]
[20 (mug bod)]
[2 yax]
[2 qax]
@ -979,7 +979,7 @@
++ gnaw :: gnaw:am
|= [kay=cape ryn=lane pac=rock] :: process packet
^- [p=(list boon) q=furt]
?. =(2 (end 0 3 pac)) [~ fox]
?. =(4 (end 0 3 pac)) [~ fox]
=+ kec=(bite pac)
?: (goop p.p.kec) [~ fox]
?. (~(has by urb.ton.fox) q.p.kec)

View File

@ -475,12 +475,12 @@
$(dal t.dal, nex (hunt nex doze:(un i.dal now ruf)))
::
++ load
|= new=vase
|= old=vase
^- vane
?. (~(nest ut -:!>(ruf)) & p.new)
?. (~(nest ut -:!>(ruf)) & p.old)
~& %clay-reset
..^$
..^$(ruf (raft q.new))
..^$(ruf (raft q.old))
::
++ raze
^- vane

View File

@ -17,7 +17,7 @@
kes=(map duct ,@ud) :: outgoing by duct
lor=(map duct dual) :: incoming by duct
== ::
++ coal :: console
++ clue :: console
$: ino=@ud :: input sequence
ono=@ud :: (lent out)
voy=(map ,@ud (list ,@ud)) :: waiters (q.rey)
@ -25,7 +25,7 @@
== ::
++ cyst :: client session
$: ced=cred :: credential
cow=(map ,@ud coal) :: consoles
cow=(map ,@ud clue) :: consoles
cug=(list ,@t) :: unacked cookies
lax=@da :: last used
rey=[p=@ud q=(map ,@ud pimp)] :: live requests
@ -592,6 +592,42 @@
=+ soc=(rush txt dim:ag)
?~(soc ~ [~ u.soc])
::
++ foal :: url from query
|= [nam=@t yaq=(map ,@t ,@t)]
^- (unit purl)
=+ uru=(~(get by yaq) %url)
?~ uru ~
(rush u.uru auri:epur)
::
++ fool :: domestic login get
|= quy=quay
^- (unit seam)
=+ yaq=(~(gas by *(map ,@t ,@t)) quy)
=+ pyl=(foal %url yaq)
?~ pyl ~
=+ wuh=(~(get by yaq) %who)
[~ %lon ?~(wuh ~ (rush u.wuh fed:ag)) u.pyl]
::
++ foom :: domestic login post
|= moh=moth
^- (unit seam)
?. ?& ?=(^ r.moh)
.= [~ 'application/x-www-form-urlencoded' ~]
(~(get by q.moh) 'content-type')
== ~
=+ yuq=(rush q.u.r.moh yquy:epur)
?~ yuq ~
=+ yaq=(~(gas by *(map ,@t ,@t)) u.yuq)
=+ pas=(~(get by yaq) %pas)
?~ pas ~
=+ pyl=(foal %url yaq)
?~ pyl ~
=+ ^= whu ^- (unit ,@p)
=+ sip=(~(get by yaq) %who)
?~(sip ~ (rush u.sip fed:ag))
?~ whu ~
[~ %log u.whu u.pyl u.pas]
::
++ flub :: console request
|= [paw=(list ,@t) muh=(unit moth)]
^- (unit seam)
@ -710,6 +746,19 @@
; call();
==
::
++ holt :: login redirect
|= [whu=(unit ship) pul=purl]
^- (unit seam)
:+ ~
%red
:: :+ [& q.p.pul r.p.pul]
%+ earl our
:+ [p.p.pul q.p.pul r.p.pul]
[~ /gul]
:- [%url (crip (urle (earn (earl our pul))))]
?~ whu ~
[%who (rsh 3 1 (scot %p u.whu))]~
::
++ holy :: structured request
|= [pul=purl moh=moth]
^- (unit seam)
@ -727,30 +776,57 @@
%put =(%t one) :: put
%trac | :: trace
==
?+ two ~
::
?+ two |
%e & :: stranger
%u p.p.pul :: guest
%i !=(~ aut.ced) :: neighbor
::%u p.p.pul :: guest
%u &
%i p.p.pul :: neighbor
::%o p.p.pul :: identified
%o &
:: %o =+ urb=(~(get by aut.ced) %$) :: owner
:: ?~(urb | (levy u.urb |=(a=@ =(our a))))
==
::
?= $? %p :: application
%c :: console
%f :: functional
%v :: version
%l :: login
%l :: local login
%m :: remote login
%n :: now
==
tri
::
!&(=(%c tri) !=(%o two))
=(3 (met 3 nep))
==
~
?- tri
?(%f %n) (funk nep p.q.pul paw r.pul)
%v (foin p.q.pul paw r.pul)
%c (flub paw ?.(=(%t one) ~ [~ moh]))
?(%p %c %l) !!
~& [%aut aut.ced]
?: &(=(%i two) =(~ aut.ced))
(holt ~ pul)
?: ?& =(%o two)
=+ urb=(~(get by aut.ced) %$)
~& [%urb urb]
?~(urb & !(levy u.urb |=(a=@ =(our (need (rush a fed:ag))))))
==
(holt [~ our] pul)
?+ one ~
%g
?+ tri ~
?(%f %n) (funk nep p.q.pul paw r.pul)
%v (foin p.q.pul paw r.pul)
%c (flub paw ~)
%l (fool r.pul)
==
::
%p
?+ tri ~
%l (foom moh)
==
::
%t
?+ tri ~
%c (flub paw [~ moh])
==
==
::
++ idle :: cancel request
@ -938,8 +1014,8 @@
?~(q.arc ~ [[u.one tex] ~])
=+ arc=(lend pax)
=+ ryx=(~(tap by r.arc) ~)
=- ?~(q.arc orx [tex orx])
^= orx
=- ?~(q.arc orz [tex orz])
^= orz
|- ^- (list path)
?~ ryx all
%= ^$
@ -1086,7 +1162,7 @@
?- -.som.pip
%con
:_ +>.$
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *coal))
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *clue))
=+ ^= obj
%- jobe
:~ sent/(jone ino.cal)
@ -1233,7 +1309,7 @@
[~ pip(pez [%fin %ham ham])]
::
%cog
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *coal))
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *clue))
?. (lth q.som.pip ono.cal)
:- [~ pip(pez %way)]
%= +>.$ cow
@ -1252,7 +1328,7 @@
[~ pip(pez [%fin %mid /text/json (tact (pojo jon))])]
::
%cop
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *coal))
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *clue))
?. =(q.som.pip ino.cal)
=. cow (~(put by cow) p.som.pip cal)
:_ +>.$
@ -1297,6 +1373,53 @@
:: & [%fin p.u.syt]
==
==
::
%lof !!
%lon
:_ +>.$
=+ rul=(earn q.som.pip)
=+ ruf=(earn (earl our q.som.pip(q.q /pul, r ~)))
=+ ^= ham
;html
;body
;form(method "post", action ruf)
;* ?^ p.som.pip
=+ nam=(trip (rsh 3 1 (scot %p u.p.som.pip)))
;= ;input(type "hidden", name "who", value nam);
==
;= ; vessel: ;{input(type "text", name "who")}
==
; password: ;{input(type "password", name "pas")}
;input(type "hidden", name "url", value rul);
;input(type "submit", value "submit");
==
==
==
[~ pip(pez [%fin %ham ham])]
::
%log
?. =(%foobar r.som.pip)
~& [%login-bad som.pip]
$(som.pip [%lon [~ p.som.pip] q.som.pip])
=+ tau=(~(get by aut.ced) %$)
=+ hoo=`@t`(rsh 3 1 (scot %p p.som.pip))
~& [%login-good hoo som.pip]
%= $
som.pip [%red q.som.pip]
aut.ced (~(put by aut.ced) %$ ?~(tau [hoo ~] [hoo u.tau]))
==
::
%red
:_ +>.$
:- ~
%= pip
pez
:- %fin
:- %raw
:+ 301
[%location (crip (earn p.som.pip))]~
~
==
==
::
[%err *]

View File

@ -409,12 +409,15 @@
++ woof (list $|(@ud [p=@ud q=@ud])) :: udon transform
++ wonk |*(veq=edge ?@(q.veq !! p.u.q.veq)) ::
:: ::
:: ::
++ map |* [a=_,* b=_,*] :: associative array
$|(~ [n=[p=a q=b] l=(map a b) r=(map a b)]) ::
++ qeu |* a=_,* ::
++ qeu |* a=_,* :: queue
$|(~ [n=a l=(qeu a) r=(qeu a)]) ::
++ set |* a=_,* ::
++ set |* a=_,* :: set
$|(~ [n=a l=(set a) r=(set a)]) ::
++ jar |*([a=_,* b=_,*] (map a (list b))) :: map of lists
++ jug |*([a=_,* b=_,*] (map a (set b))) :: map of sets
-- ::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: volume 2, Hoon libraries and compiler ::::::
@ -1394,6 +1397,32 @@
?@(r.a & ?&((vor p.n.a p.n.r.a) (hor p.n.a p.n.r.a)))
==
::
++ ja :: jar engine
|/ a=(jar)
+- get
|* b=*
=+ c=(~(get by a) b)
?~(c ~ u.c)
::
+- add :: XX slow
|* [b=* c=*]
=+ d=(get b)
(~(put by a) [d c])
--
::
++ ju :: jug engine
|/ a=(jug)
+- get
|* b=*
=+ c=(~(get by a) b)
?~(c ~ u.c)
::
+- put :: XX slow
|* [b=* c=*]
=+ d=(get b)
(~(put by a) (~(put in d) c))
--
::
++ by :: map engine
~/ %by
|/ a=(map)
@ -2137,8 +2166,9 @@
:: section 2eI, parsing (external) ::
::
++ rash |*([naf=@ sab=_rule] (scan (trip naf) sab))
++ rush |* [naf=@ sab=_rule]
=+ vex=((full sab) [[1 1] (trip naf)])
++ rush |*([naf=@ sab=_rule] (rust (trip naf) sab))
++ rust |* [los=tape sab=_rule]
=+ vex=((full sab) [[1 1] los])
?~(q.vex ~ [~ u=p.u.q.vex])
++ scan |* [los=tape sab=_rule]
=+ vex=((full sab) [[1 1] los])

View File

@ -410,7 +410,120 @@
~|(%test-fail-seal !!)
msg
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 3bC, JSON and XML ::
:: section 3bC, UTC :: Gregorian only
::
++ dawn :: Jan 1 weekday
|= yer=@ud
=+ yet=(sub yer 1)
%- mod :_ 7
:(add 1 (mul 5 (mod yet 4)) (mul 4 (mod yet 100)) (mul 6 (mod yet 400)))
::
++ daws :: date weekday
|= yed=date
%- mod :_ 7
(add (dawn y.yed) (sub (yawn [y.yed m.yed d.t.yed]) (yawn y.yed 1 1)))
::
++ deal :: to leap sec time
|= yer=@da
=+ n=0
=+ yud=(yore yer)
|- ^- date
?: (gte yer (add (snag n lef:yu) ~s1))
(yore (year yud(s.t (add n s.t.yud))))
?: &((gte yer (snag n lef:yu)) (lth yer (add (snag n lef:yu) ~s1)))
yud(s.t (add +(n) s.t.yud))
?: =(+(n) (lent lef:yu))
(yore (year yud(s.t (add +(n) s.t.yud))))
$(n +(n))
::
++ lead :: from leap sec time
|= ley=date
=+ ler=(year ley)
=+ n=0
|- ^- @da
=+ led=(sub ler (mul n ~s1))
?: (gte ler (add (snag n les:yu) ~s1))
led
?: &((gte ler (snag n les:yu)) (lth ler (add (snag n les:yu) ~s1)))
?: =(s.t.ley 60)
(sub led ~s1)
led
?: =(+(n) (lent les:yu))
(sub led ~s1)
$(n +(n))
::
++ dust :: print UTC format
|= yed=date
^- tape
=+ wey=(daws yed)
;: weld
`tape`(snag wey (turn wik:yu |=(a=tape (scag 3 a))))
", " ~(rud at d.t.yed) " "
`tape`(snag (dec m.yed) (turn mon:yu |=(a=tape (scag 3 a))))
" " (scag 1 ~(rud at y.yed)) (slag 2 ~(rud at y.yed)) " "
~(rud at h.t.yed) ":" ~(rud at m.t.yed) ":" ~(rud at s.t.yed)
" " "+0000"
==
::
++ stud :: parse UTC format
|= cut=tape
^- date
=+ ^= tuc
%+ scan cut
;~ plug
;~(pfix (stun [5 5] next) dim:ag)
%+ cook
|= a=tape
=+ b=0
|- ^- @
?: =(a (snag b (turn mon:yu |=(a=tape (scag 3 a)))))
+(b)
$(b +(b))
(ifix [ace ace] (star alf))
;~(sfix dim:ag ace) ;~(sfix dim:ag col)
;~(sfix dim:ag col) dim:ag (cold ~ (star next))
==
[[%.y &3.tuc] &2.tuc &1.tuc &4.tuc &5.tuc &6.tuc ~]
::
++ yu :: UTC format constants
|%
++ mon ^- (list tape)
:~ "January" "February" "March" "April" "May" "June" "July"
"August" "September" "October" "November" "December"
==
::
++ wik ^- (list tape)
:~ "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday"
"Friday" "Saturday"
==
::
++ les ^- (list ,@da)
:~ ~2012.7.1 ~2009.1.1 ~2006.1.1 ~1999.1.1 ~1997.7.1 ~1996.1.1
~1994.7.1 ~1993.7.1 ~1992.7.1 ~1991.1.1 ~1990.1.1 ~1988.1.1
~1985.7.1 ~1983.7.1 ~1982.7.1 ~1981.7.1 ~1980.1.1 ~1979.1.1
~1978.1.1 ~1977.1.1 ~1976.1.1 ~1975.1.1 ~1974.1.1 ~1973.1.1
~1972.7.1
==
++ lef ^- (list ,@da)
:~ ~2012.6.30..23.59.59 ~2008.12.31..23.59.58
~2005.12.31..23.59.57 ~1998.12.31..23.59.56
~1997.6.30..23.59.55 ~1995.12.31..23.59.54
~1994.6.30..23.59.53 ~1993.6.30..23.59.52
~1992.6.30..23.59.51 ~1990.12.31..23.59.50
~1989.12.31..23.59.49 ~1987.12.31..23.59.48
~1985.6.30..23.59.47 ~1983.6.30..23.59.46
~1982.6.30..23.59.45 ~1981.6.30..23.59.44
~1979.12.31..23.59.43 ~1978.12.31..23.59.42
~1977.12.31..23.59.41 ~1976.12.31..23.59.40
~1975.12.31..23.59.39 ~1974.12.31..23.59.38
~1973.12.31..23.59.37 ~1972.12.31..23.59.36
~1972.6.30..23.59.35
==
--
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 3bD, JSON and XML ::
::
++ moon :: mime type to text
|= myn=mite
@ -648,7 +761,7 @@
%+ weld tam
`_tam`?~(att bod [' ' (xmla att bod)])
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 3bD, tree sync ::
:: section 3bE, tree sync ::
::
++ cure :: invert miso
|= mis=miso
@ -1092,7 +1205,7 @@
(durn (curl nyp))
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 3bE, names etc ::
:: section 3bF, names etc ::
::
++ clan :: ship to rank
|= who=ship ^- rank
@ -1121,7 +1234,7 @@
:- p.pok
[i.rax q.pok]
::
++ gist :: html with now
++ gist :: convenient html
|= yax=$+(epic marl)
%- give
|= piq=epic
@ -1175,6 +1288,86 @@
nep
==
::
++ urle :: URL encode
|= tep=tape
^- tape
?~ tep ~
=+ nex=$(tep t.tep)
?: ?| &((gte i.tep 'a') (lte i.tep 'z'))
&((gte i.tep 'A') (lte i.tep 'Z'))
&((gte i.tep '0') (lte i.tep '9'))
=('.' i.tep)
=('-' i.tep)
=('~' i.tep)
=('_' i.tep)
==
[i.tep nex]
['%' ~(x ne (rsh 0 4 i.tep)) ~(x ne (end 0 4 i.tep)) nex]
::
++ urld :: URL decode
|= tep=tape
^- (unit tape)
?~ tep [~ ~]
?: =('%' i.tep)
?. ?=([@ @ *] t.tep) ~
=+ nag=(mix i.t.tep (lsh 3 1 i.t.t.tep))
=+ val=(rush nag hex:ag)
?~ val ~
=+ nex=$(tep t.t.t.tep)
?~(nex ~ [~ [`@`u.val u.nex]])
=+ nex=$(tep t.tep)
?~(nex ~ [~ i.tep u.nex])
::
++ earl :: local purl to tape
|= [who=@p pul=purl]
^- purl
pul(q.q [(rsh 3 1 (scot %p who)) q.q.pul])
::
++ earn :: purl to tape
|= pul=purl
^- tape
=< apex
|%
++ apex
^- tape
:(weld head "/" body tail)
::
++ body
|- ^- tape
?~ q.q.pul
?~(p.q.pul ~ ['.' (trip u.p.q.pul)])
=+ seg=(trip i.q.q.pul)
?:(=(~ t.q.q.pul) seg (weld seg `tape`['/' $(q.q.pul t.q.q.pul)]))
::
++ head
^- tape
;: weld
?:(p.p.pul "https://" "http://")
::
?- -.r.p.pul
| (trip (rsh 3 1 (scot %if p.r.p.pul)))
& =+ rit=(flop p.r.p.pul)
|- ^- tape
?~(rit ~ (weld (trip i.rit) ?~(t.rit "" `tape`['.' $(rit t.rit)])))
==
::
?~(q.p.pul ~ `tape`[':' (trip (rsh 3 2 (scot %ui u.q.p.pul)))])
==
::
++ tail
^- tape
?: =(~ r.pul) ~
:- '?'
|- ^- tape
?~ r.pul ~
;: weld
(trip p.i.r.pul)
"="
(trip q.i.r.pul)
?~(t.r.pul ~ `tape`['&' $(r.pul t.r.pul)])
==
--
::
++ epur :: url/header parser
|%
++ apat (cook deft ;~(pfix fas (more fas smeg))) :: 2396 abs_path
@ -1695,7 +1888,7 @@
?. ?&(?=(%c dis) ?=(?(%v %w %x %y %z) rem)) ~
[~ rem (case p.u.ved) q.p.u.fal q.p.u.dyc tyl]
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 3bF, Arvo models ::
:: section 3bG, Arvo models ::
::
++ acro :: old asym cryptosuite
$_ ^? |% :: opaque object
@ -1785,7 +1978,6 @@
q=(list slip) :: requests
r=boar :: state
== ::
++ bell path :: label
++ bird :: packet in travel
$: gom=soap :: message identity
mup=@ud :: pktno in msg
@ -2317,7 +2509,10 @@
[%cop p=@ud q=@ud r=json] :: console put
[%det p=disc q=moat] :: load changes
[%fun p=term q=tube r=(list manx)] :: functional
:: [%log p=seal] :: login
[%lof p=ship q=hole] :: foreign auth
[%lon p=(unit ship) q=purl] :: domestic auth as/to
[%log p=ship q=purl r=@ta] :: password
[%red p=purl] :: redirect
== ::
++ seat :: functional path
$: dez=@ta :: desk