mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 11:08:45 +03:00
Merge branch 'master' of https://github.com/urbit/urbit
This commit is contained in:
commit
383b75a47b
@ -492,7 +492,7 @@
|
|||||||
+>.$(hoc.saf (~(put by hoc.saf) her [[~31337.1.1 ~ wil] ~ *clot]))
|
+>.$(hoc.saf (~(put by hoc.saf) her [[~31337.1.1 ~ wil] ~ *clot]))
|
||||||
::
|
::
|
||||||
++ lax :: lax:as:go
|
++ lax :: lax:as:go
|
||||||
|_ [her=ship dur=door] :: per client
|
|_ [her=ship dur=dore] :: per client
|
||||||
++ cluy :: cluy:lax:as:go
|
++ cluy :: cluy:lax:as:go
|
||||||
^- [p=life q=gens r=acru] :: client crypto
|
^- [p=life q=gens r=acru] :: client crypto
|
||||||
?~ lew.wod.dur !!
|
?~ lew.wod.dur !!
|
||||||
@ -683,19 +683,19 @@
|
|||||||
-- :: --zuul:lax:as:go
|
-- :: --zuul:lax:as:go
|
||||||
-- :: --lax:as:go
|
-- :: --lax:as:go
|
||||||
::
|
::
|
||||||
++ gur :: default door
|
++ gur :: default dore
|
||||||
|= her=ship
|
|= her=ship
|
||||||
^- door
|
^- dore
|
||||||
=+ def=?.((lth her 256) ~ [~ %if ~2000.1.1 0 (mix her .0.0.1.0)])
|
=+ def=?.((lth her 256) ~ [~ %if ~2000.1.1 0 (mix her .0.0.1.0)])
|
||||||
[[~2100.1.1 def ~] ~ *clot]
|
[[~2100.1.1 def ~] ~ *clot]
|
||||||
::
|
::
|
||||||
++ myx :: door by ship
|
++ myx :: dore by ship
|
||||||
|= her=ship
|
|= her=ship
|
||||||
^+ lax
|
^+ lax
|
||||||
=+ fod=(~(get by hoc.saf) her)
|
=+ fod=(~(get by hoc.saf) her)
|
||||||
~(. lax [her ?~(fod (gur her) u.fod)])
|
~(. lax [her ?~(fod (gur her) u.fod)])
|
||||||
::
|
::
|
||||||
++ nux :: install door
|
++ nux :: install dore
|
||||||
|= new=_lax
|
|= new=_lax
|
||||||
^+ +>
|
^+ +>
|
||||||
+>(hoc.saf (~(put by hoc.saf) her.new dur.new))
|
+>(hoc.saf (~(put by hoc.saf) her.new dur.new))
|
||||||
|
312
arvo/eyre.hoon
312
arvo/eyre.hoon
@ -116,7 +116,7 @@
|
|||||||
cow=(map ,@ud clue) :: consoles
|
cow=(map ,@ud clue) :: consoles
|
||||||
cug=(list ,@t) :: unacked cookies
|
cug=(list ,@t) :: unacked cookies
|
||||||
lax=@da :: last used
|
lax=@da :: last used
|
||||||
sok=(map ,@ud (trel term ship sink)) :: live apps by reqno
|
sok=(map ,@ud (pair ship sink)) :: live apps by reqno
|
||||||
rey=[p=@ud q=(map ,@ud pimp)] :: live requests
|
rey=[p=@ud q=(map ,@ud pimp)] :: live requests
|
||||||
== ::
|
== ::
|
||||||
++ dual ,[p=@ud q=(each ,[p=ship q=hole] ship)] :: request handle
|
++ dual ,[p=@ud q=(each ,[p=ship q=hole] ship)] :: request handle
|
||||||
@ -148,12 +148,12 @@
|
|||||||
rem=[p=@ud q=(map ,@ud duct)] :: active requests
|
rem=[p=@ud q=(map ,@ud duct)] :: active requests
|
||||||
== ::
|
== ::
|
||||||
++ seam :: logical request
|
++ seam :: logical request
|
||||||
$% [%ape p=term q=ship r=@ud s=@ud t=@ud] :: subscribe pull
|
$% [%ape p=ship q=@ud r=@ud] :: subscribe pull
|
||||||
[%aph p=term q=ship r=@ud s=@ud t=json] :: app heartbeat
|
[%aph p=ship q=@ud r=@ud s=json] :: app heartbeat
|
||||||
[%apg p=term q=ship r=logo s=path] :: app get/start
|
[%apg p=term q=ship r=logo s=path] :: app get/start
|
||||||
[%apm p=term q=ship r=@ud s=@ud t=json] :: message send
|
[%apm p=ship q=@ud r=@ud s=hasp t=json] :: message send
|
||||||
[%aps p=term q=ship r=@ud s=@ud t=path] :: subscribe
|
[%aps p=ship q=@ud s=hasp t=path] :: subscribe
|
||||||
[%apu p=term q=ship r=@ud s=@ud] :: unsubscribe
|
[%apu p=ship q=@ud s=hasp t=path] :: unsubscribe
|
||||||
[%cog p=@ud q=@ud] :: console get
|
[%cog p=@ud q=@ud] :: console get
|
||||||
[%con p=@ud] :: console face
|
[%con p=@ud] :: console face
|
||||||
[%cop p=@ud q=@ud r=json] :: console put
|
[%cop p=@ud q=@ud r=json] :: console put
|
||||||
@ -169,13 +169,13 @@
|
|||||||
cah=(map cash vase) :: compilation cache
|
cah=(map cash vase) :: compilation cache
|
||||||
== ::
|
== ::
|
||||||
++ sink :: page push system
|
++ sink :: page push system
|
||||||
$: bet=[num=@ud tim=@da] :: heartbeat
|
$: bet=[wig=swig num=@ud tim=@da] :: heartbeat
|
||||||
meg=@ud :: message counter
|
meg=[wig=swig num=@ud] :: messages
|
||||||
haw=(map ,@ud swig) :: subscriptions
|
sub=[wig=swig num=@ud can=(map ,@ud stem)] :: subscriptions
|
||||||
== ::
|
== ::
|
||||||
|
++ stem ,[p=hasp q=path r=duct s=(unit ,@ud)] :: subscription
|
||||||
++ swig :: update channel
|
++ swig :: update channel
|
||||||
$: hen=duct :: channel duct
|
$: cnt=@ud :: updates produced
|
||||||
cnt=@ud :: updates produced
|
|
||||||
toy=@ud :: updates sent
|
toy=@ud :: updates sent
|
||||||
wan=(map ,@ud ,@ud) :: upno to reqno
|
wan=(map ,@ud ,@ud) :: upno to reqno
|
||||||
red=(map ,@ud (unit (each cage cage))) :: ready for pickup
|
red=(map ,@ud (unit (each cage cage))) :: ready for pickup
|
||||||
@ -196,6 +196,24 @@
|
|||||||
?~ u.mar ^$(cok t.cok)
|
?~ u.mar ^$(cok t.cok)
|
||||||
?:(=(nam p.i.u.mar) [~ q.i.u.mar] $(u.mar t.u.mar))
|
?:(=(nam p.i.u.mar) [~ q.i.u.mar] $(u.mar t.u.mar))
|
||||||
::
|
::
|
||||||
|
++ ecca :: [hasp path]
|
||||||
|
|= [orx=oryx moh=moth]
|
||||||
|
^- (unit ,[hasp path])
|
||||||
|
=+ jun=(ecci orx moh)
|
||||||
|
?~ jun ~
|
||||||
|
=+ ^- (unit ,[his=term app=term pax=term])
|
||||||
|
%. u.jun
|
||||||
|
%- ot:jo
|
||||||
|
~[[%ship so:jo] [%appl so:jo] [%path so:jo]]
|
||||||
|
?~ - ~
|
||||||
|
=+ his=(slaw %p (cat 3 '~' his.u))
|
||||||
|
?~ his ~
|
||||||
|
=+ ^= pax
|
||||||
|
%+ rush pax.u
|
||||||
|
;~(pfix fas (more fas (cook crip (plus ;~(pose low nud hep)))))
|
||||||
|
?~ pax ~
|
||||||
|
`[[u.his app.u] u.pax]
|
||||||
|
::
|
||||||
++ ecce :: JS from moth
|
++ ecce :: JS from moth
|
||||||
|= moh=moth
|
|= moh=moth
|
||||||
^- (unit json)
|
^- (unit json)
|
||||||
@ -224,6 +242,20 @@
|
|||||||
=+ zeb=(~(get by mah) cus)
|
=+ zeb=(~(get by mah) cus)
|
||||||
$(hed t.hed, mah (~(put by mah) cus ?~(zeb [q.i.hed ~] [q.i.hed u.zeb])))
|
$(hed t.hed, mah (~(put by mah) cus ?~(zeb [q.i.hed ~] [q.i.hed u.zeb])))
|
||||||
::
|
::
|
||||||
|
++ eccu :: [hasp json]
|
||||||
|
|= [orx=oryx moh=moth]
|
||||||
|
^- (unit ,[hasp json])
|
||||||
|
=+ jun=(ecci orx moh)
|
||||||
|
?~ jun ~
|
||||||
|
=+ ^- (unit ,[his=term app=term jon=json])
|
||||||
|
%. u.jun
|
||||||
|
%- ot:jo
|
||||||
|
~[[%ship so:jo] [%appl so:jo] [%data |=(json (some +<))]]
|
||||||
|
?~ - ~
|
||||||
|
=+ his=(slaw %p (cat 3 '~' his.u))
|
||||||
|
?~ his ~
|
||||||
|
`[[u.his app.u] jon.u]
|
||||||
|
::
|
||||||
++ lopo :: cage to love
|
++ lopo :: cage to love
|
||||||
|= cay=cage
|
|= cay=cage
|
||||||
^- love
|
^- love
|
||||||
@ -330,7 +362,7 @@
|
|||||||
+>.$(mow [[hen %slip %d %flog +.sih] mow])
|
+>.$(mow [[hen %slip %d %flog +.sih] mow])
|
||||||
::
|
::
|
||||||
?(%dumb %mean %nice %rush %rust)
|
?(%dumb %mean %nice %rush %rust)
|
||||||
?> ?=([%hoop @ @ @ @ ~] tea)
|
?> ?=([%hoop @ @ @ ?([%mess ~] [%show @ ~])] tea)
|
||||||
=+ ^= ouy
|
=+ ^= ouy
|
||||||
%- yolk:(gale (slav %p i.t.tea) i.t.t.tea)
|
%- yolk:(gale (slav %p i.t.tea) i.t.t.tea)
|
||||||
(slav %ud i.t.t.t.tea)
|
(slav %ud i.t.t.t.tea)
|
||||||
@ -338,13 +370,14 @@
|
|||||||
+>.$
|
+>.$
|
||||||
?: (lth ~m2 (sub now tim.bet.siq:beat:u.ouy))
|
?: (lth ~m2 (sub now tim.bet.siq:beat:u.ouy))
|
||||||
abet:work:amok:u.ouy
|
abet:work:amok:u.ouy
|
||||||
=+ woy=(yule:u.ouy (slav %ud i.t.t.t.t.tea))
|
=* mab t.t.t.t.tea
|
||||||
|
=+ woy=(yule:u.ouy ?+(i.mab !! %mess %meg, %show %sub))
|
||||||
=< abet =< work =< abet
|
=< abet =< work =< abet
|
||||||
?- -.+.sih
|
?- -.+.sih
|
||||||
%dumb
|
%dumb
|
||||||
dumb:woy
|
dumb:woy
|
||||||
%mean
|
%mean
|
||||||
=+ ^= jso
|
=+ ^= jon
|
||||||
%- jobe
|
%- jobe
|
||||||
:- [%ok %b |]
|
:- [%ok %b |]
|
||||||
?~ p.+.sih ~
|
?~ p.+.sih ~
|
||||||
@ -357,12 +390,44 @@
|
|||||||
|= [p=tank q=tape]
|
|= [p=tank q=tape]
|
||||||
:(weld q "\\n" ~(ram re p))
|
:(weld q "\\n" ~(ram re p))
|
||||||
~
|
~
|
||||||
(hear:woy ~ %& %json !>(jso))
|
?~ t.mab
|
||||||
|
(hear:woy ~ %& %json !>(jon))
|
||||||
|
=+ nap=(slav %ud i.t.mab)
|
||||||
|
=+ sem=(need (~(get by can.sub.siq:beat:u.ouy) nap))
|
||||||
|
=. jon
|
||||||
|
?. ?=(%show i.t.t.t.t.tea) jon
|
||||||
|
%- jobe
|
||||||
|
:~ [%ship %s (rsh 3 1 (scot %p p.p.sem))]
|
||||||
|
[%appl %s q.p.sem]
|
||||||
|
[%path %s (crip <q.sem>)]
|
||||||
|
[%data `json`jon]
|
||||||
|
==
|
||||||
|
=+ huq=``[%json !>(jon)]
|
||||||
|
?~ s.sem (hear:woy huq)
|
||||||
|
=+ yoo=abet:(busk:(yule:u.ouy %nil) u.s.sem 0 huq)
|
||||||
|
yoo(can.sub.siq (~(put by can.sub.siq.yoo) nap sem(s ~)))
|
||||||
%nice
|
%nice
|
||||||
|
?> ?=(%mess i.mab)
|
||||||
(hear:woy ~ %& %json !>((joba %ok %b &)))
|
(hear:woy ~ %& %json !>((joba %ok %b &)))
|
||||||
?(%rust %rush)
|
?(%rust %rush)
|
||||||
=+ cay=`cage`[p.+.sih (slot 3 (spec (slot 3 [typ +.sih])))]
|
?< ?=(~ t.mab)
|
||||||
(hear:woy ~ ?:(?=(%rust -.+.sih) [%& cay] [%| cay]))
|
=+ nap=(slav %ud i.t.mab)
|
||||||
|
=+ sem=(need (~(get by can.sub.siq:beat:u.ouy) nap))
|
||||||
|
=+ ^= cay ^- cage
|
||||||
|
?. ?=(%json p.+.sih)
|
||||||
|
[p.+.sih (slot 3 (spec (slot 3 [typ +.sih])))]
|
||||||
|
:- %json
|
||||||
|
!> ^- json
|
||||||
|
%- jobe
|
||||||
|
:~ [%ship %s (rsh 3 1 (scot %p p.p.sem))]
|
||||||
|
[%appl %s q.p.sem]
|
||||||
|
[%path %s (crip <q.sem>)]
|
||||||
|
[%data (json q.+.sih)]
|
||||||
|
==
|
||||||
|
=+ huq=`?:(?=(%rust -.+.sih) [%& cay] [%| cay])
|
||||||
|
?~ s.sem (hear:woy huq)
|
||||||
|
=+ yoo=abet:(busk:(yule:u.ouy %nil) u.s.sem 0 huq)
|
||||||
|
yoo(can.sub.siq (~(put by can.sub.siq.yoo) nap sem(s ~)))
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%made
|
%made
|
||||||
@ -1047,7 +1112,7 @@
|
|||||||
|
|
||||||
method = "put"
|
method = "put"
|
||||||
perm = "tih"
|
perm = "tih"
|
||||||
url = [perm,user,appl,port,heart.seqn]
|
url = [perm,user,port,heart.seqn]
|
||||||
url = "/"+url.join("/")
|
url = "/"+url.join("/")
|
||||||
|
|
||||||
$this = this
|
$this = this
|
||||||
@ -1069,47 +1134,17 @@
|
|||||||
}
|
}
|
||||||
heart.beat()
|
heart.beat()
|
||||||
'''
|
'''
|
||||||
++ duty :: reload script
|
|
||||||
;script
|
|
||||||
; var tries = 0;
|
|
||||||
; var cnt = 0;
|
|
||||||
; var next = "/gie/"+user+"/"+appl+"/"+port+"/0/"+(cnt + 1);
|
|
||||||
; call = function() {
|
|
||||||
; xhr = new XMLHttpRequest();
|
|
||||||
; xhr.open('GET', next, true);
|
|
||||||
; xhr.addEventListener('load', function() {
|
|
||||||
; if ( this.status >= 500 ) {
|
|
||||||
; return delay();
|
|
||||||
; }
|
|
||||||
; cnt++;
|
|
||||||
; if ( this.status >= 400 ) {
|
|
||||||
; document.alert("neighbor, please.");
|
|
||||||
; }
|
|
||||||
; document.location.reload();
|
|
||||||
; });
|
|
||||||
; xhr.addEventListener('error', delay);
|
|
||||||
; xhr.addEventListener('abort', delay);
|
|
||||||
; xhr.send();
|
|
||||||
; }
|
|
||||||
; delay = function() {
|
|
||||||
; setTimeout(call,1000*tries);
|
|
||||||
; tries++;
|
|
||||||
; }
|
|
||||||
; call();
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ fape :: dispatch %ape
|
++ fape :: dispatch %ape
|
||||||
|= [fur=(unit term) you=@p paw=path]
|
|= [fur=(unit term) you=@p paw=path]
|
||||||
^- (unit seam)
|
^- (unit seam)
|
||||||
?> ?=(~ fur)
|
?> ?=(~ fur)
|
||||||
?> ?=([@ @ @ @ ~] paw)
|
?> ?=([@ @ ~] paw)
|
||||||
:- ~
|
:- ~
|
||||||
:* %ape
|
:* %ape
|
||||||
(need ((sand %tas) i.paw))
|
|
||||||
you
|
you
|
||||||
|
(slav %ui (cat 3 '0i' i.paw))
|
||||||
(slav %ui (cat 3 '0i' i.t.paw))
|
(slav %ui (cat 3 '0i' i.t.paw))
|
||||||
(slav %ui (cat 3 '0i' i.t.t.paw))
|
|
||||||
(slav %ui (cat 3 '0i' i.t.t.t.paw))
|
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ fapg :: dispatch %apg
|
++ fapg :: dispatch %apg
|
||||||
@ -1129,13 +1164,12 @@
|
|||||||
|= [fur=(unit term) you=@p paw=path moh=moth]
|
|= [fur=(unit term) you=@p paw=path moh=moth]
|
||||||
^- (unit seam)
|
^- (unit seam)
|
||||||
?> ?=(~ fur)
|
?> ?=(~ fur)
|
||||||
?> ?=([@ @ @ ~] paw)
|
?> ?=([@ @ ~] paw)
|
||||||
:- ~
|
:- ~
|
||||||
:* %aph
|
:* %aph
|
||||||
(need ((sand %tas) i.paw))
|
|
||||||
you
|
you
|
||||||
|
(slav %ui (cat 3 '0i' i.paw))
|
||||||
(slav %ui (cat 3 '0i' i.t.paw))
|
(slav %ui (cat 3 '0i' i.t.paw))
|
||||||
(slav %ui (cat 3 '0i' i.t.t.paw))
|
|
||||||
(need (ecci orx.ced moh))
|
(need (ecci orx.ced moh))
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
@ -1143,42 +1177,37 @@
|
|||||||
|= [fur=(unit term) you=@p paw=path moh=moth]
|
|= [fur=(unit term) you=@p paw=path moh=moth]
|
||||||
^- (unit seam)
|
^- (unit seam)
|
||||||
?> ?=(~ fur)
|
?> ?=(~ fur)
|
||||||
?> ?=([@ @ @ ~] paw)
|
?> ?=([@ @ ~] paw)
|
||||||
:- ~
|
:- ~
|
||||||
:* %apm
|
:* %apm
|
||||||
(need ((sand %tas) i.paw))
|
|
||||||
you
|
you
|
||||||
|
(slav %ui (cat 3 '0i' i.paw))
|
||||||
(slav %ui (cat 3 '0i' i.t.paw))
|
(slav %ui (cat 3 '0i' i.t.paw))
|
||||||
(slav %ui (cat 3 '0i' i.t.t.paw))
|
(need (eccu orx.ced moh))
|
||||||
(need (ecci orx.ced moh))
|
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ faps :: dispatch %aps
|
++ faps :: dispatch %aps
|
||||||
|= [fur=(unit term) you=@p paw=path moh=moth]
|
|= [fur=(unit term) you=@p paw=path moh=moth]
|
||||||
^- (unit seam)
|
^- (unit seam)
|
||||||
?> ?=(~ fur)
|
?> ?=(~ fur)
|
||||||
?> ?=([@ @ @ *] paw)
|
?> ?=([@ ~] paw)
|
||||||
?> !=(~ (ecci orx.ced moh))
|
|
||||||
:- ~
|
:- ~
|
||||||
:* %aps
|
:* %aps
|
||||||
(need ((sand %tas) i.paw))
|
|
||||||
you
|
you
|
||||||
(slav %ui (cat 3 '0i' i.t.paw))
|
(slav %ui (cat 3 '0i' i.paw))
|
||||||
(slav %ui (cat 3 '0i' i.t.t.paw))
|
(need (ecca orx.ced moh))
|
||||||
(turn t.t.t.paw |=(a=@ `@ta`(need ((sand %ta) a))))
|
==
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ fapu :: dispatch %apu
|
++ fapu :: dispatch %apu
|
||||||
|= [fur=(unit term) you=@p paw=path]
|
|= [fur=(unit term) you=@p paw=path moh=moth]
|
||||||
^- (unit seam)
|
^- (unit seam)
|
||||||
?> ?=(~ fur)
|
?> ?=(~ fur)
|
||||||
?> ?=([@ @ @ ~] paw)
|
?> ?=([@ ~] paw)
|
||||||
:- ~
|
:- ~
|
||||||
:* %apu
|
:* %apu
|
||||||
(need ((sand %tas) i.paw))
|
|
||||||
you
|
you
|
||||||
(slav %ui (cat 3 '0i' i.t.paw))
|
(slav %ui (cat 3 '0i' i.paw))
|
||||||
(slav %ui (cat 3 '0i' i.t.t.paw))
|
(need (ecca orx.ced moh))
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ flea :: permissive decimal
|
++ flea :: permissive decimal
|
||||||
@ -1435,7 +1464,7 @@
|
|||||||
%l (foom moh)
|
%l (foom moh)
|
||||||
%m (fapm p.q.pul yun paw moh)
|
%m (fapm p.q.pul yun paw moh)
|
||||||
%s (faps p.q.pul yun paw moh)
|
%s (faps p.q.pul yun paw moh)
|
||||||
%u (fapu p.q.pul yun paw)
|
%u (fapu p.q.pul yun paw moh)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%t
|
%t
|
||||||
@ -1444,7 +1473,7 @@
|
|||||||
%h (faph p.q.pul yun paw moh)
|
%h (faph p.q.pul yun paw moh)
|
||||||
%m (fapm p.q.pul yun paw moh)
|
%m (fapm p.q.pul yun paw moh)
|
||||||
%s (faps p.q.pul yun paw moh)
|
%s (faps p.q.pul yun paw moh)
|
||||||
%u (fapu p.q.pul yun paw)
|
%u (fapu p.q.pul yun paw moh)
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
@ -1562,8 +1591,7 @@
|
|||||||
:: [%stream s.som.pip]
|
:: [%stream s.som.pip]
|
||||||
:: [%request t.som.pip]
|
:: [%request t.som.pip]
|
||||||
:: ==
|
:: ==
|
||||||
:- [~ pip(pez %way)]
|
[`(fall +< -(pez %way)) +>]:[pip (yoke num +.som.pip)]
|
||||||
(yoke num +.som.pip)
|
|
||||||
::
|
::
|
||||||
%apg :: simple get
|
%apg :: simple get
|
||||||
:: ~& :~ %eyre-apg
|
:: ~& :~ %eyre-apg
|
||||||
@ -1593,7 +1621,6 @@
|
|||||||
::
|
::
|
||||||
%apu :: unsubscribe
|
%apu :: unsubscribe
|
||||||
:: ~& [%wink-apu +.som.pip]
|
:: ~& [%wink-apu +.som.pip]
|
||||||
:- [~ pip(pez %way)]
|
|
||||||
(yoku num +.som.pip)
|
(yoku num +.som.pip)
|
||||||
::
|
::
|
||||||
%con
|
%con
|
||||||
@ -1979,41 +2006,49 @@
|
|||||||
$(+ sez)
|
$(+ sez)
|
||||||
::
|
::
|
||||||
++ yoke :: long poll
|
++ yoke :: long poll
|
||||||
|= [num=@ud app=term you=ship nap=@ud suq=@ud cnt=@ud]
|
|= [num=@ud you=ship nap=@ud cnt=@ud]
|
||||||
^+ +>
|
^- [(unit pimp) _+>]
|
||||||
=+ yon=(yolk nap)
|
=+ yon=(yolk nap)
|
||||||
?~ yon (bust 204 num)
|
?~ yon `(bust 204 num)
|
||||||
abet:(hire:(yule:u.yon suq) cnt num)
|
=. +>.$ abet:(hire:(yule %sub):u.yon cnt num)
|
||||||
|
:_ +>.$
|
||||||
|
=+ pup=(~(get by q.rey) num)
|
||||||
|
?~ pup ~
|
||||||
|
?. ?=(%sil -.som.u.pup) ~
|
||||||
|
`u.pup
|
||||||
::
|
::
|
||||||
++ yokg :: main call
|
++ yokg :: main call
|
||||||
|= [num=@ud app=term you=ship pax=path]
|
|= [num=@ud app=term you=ship pax=path]
|
||||||
^+ +>
|
^+ +>
|
||||||
?< (~(has by sok) num)
|
?< (~(has by sok) num)
|
||||||
abet:(~(self yo num app you [[*@ud now] *[@ud (map ,@ud swig)]]) pax)
|
abet:(~(self yo num you [-(tim.bet +)]:[*sink now]) app pax)
|
||||||
::
|
::
|
||||||
++ yokh :: heartbeat
|
++ yokh :: heartbeat
|
||||||
|= [num=@ud app=term you=ship nap=@ud cnt=@ud jon=json]
|
|= [num=@ud you=ship nap=@ud cnt=@ud jon=json]
|
||||||
^- [(unit pimp) _+>]
|
^- [(unit pimp) _+>]
|
||||||
=+ yon=(yolk nap)
|
=+ yon=(yolk nap)
|
||||||
?~ yon [~ (bust 204 num)]
|
?~ yon [~ (bust 204 num)]
|
||||||
[- abet:+]:(beat:u.yon cnt num jon)
|
[- abet:+]:(beat:u.yon cnt num jon)
|
||||||
::
|
::
|
||||||
++ yokm :: message
|
++ yokm :: message
|
||||||
|= [num=@ud app=term you=ship nap=@ud cnt=@ud jon=json]
|
|= [num=@ud you=ship nap=@ud cnt=@ud hap=hasp jon=json]
|
||||||
^+ +>
|
^+ +>
|
||||||
=+ yon=(yolk nap)
|
=+ yon=(yolk nap)
|
||||||
?~ yon (bust 204 num)
|
?~ yon (bust 204 num)
|
||||||
abet:(post:u.yon cnt num jon)
|
abet:(post:u.yon cnt num hap jon)
|
||||||
::
|
::
|
||||||
++ yoks :: subscribe
|
++ yoks :: subscribe
|
||||||
|= [num=@ud app=term you=ship nap=@ud suq=@ud pax=path]
|
|= [num=@ud you=ship nap=@ud hap=hasp pax=path]
|
||||||
=+ yon=(yolk nap)
|
=+ yon=(yolk nap)
|
||||||
?~ yon (bust 204 num)
|
?~ yon (bust 204 num)
|
||||||
abet:(scud:u.yon suq num pax)
|
abet:(scud:u.yon num hap pax)
|
||||||
::
|
::
|
||||||
++ yoku :: unsubscribe
|
++ yoku :: unsubscribe
|
||||||
|= [num=@ud app=term you=ship nap=@ud suq=@ud]
|
|= [num=@ud you=ship nap=@ud hap=hasp pax=path]
|
||||||
!!
|
^- [(unit pimp) _+>]
|
||||||
|
=+ yon=(yolk nap)
|
||||||
|
?~ yon [~ (bust 204 num)]
|
||||||
|
[- abet:+]:(scad:u.yon num hap pax)
|
||||||
::
|
::
|
||||||
++ yolk :: yo by instance
|
++ yolk :: yo by instance
|
||||||
|= nap=@ud
|
|= nap=@ud
|
||||||
@ -2023,18 +2058,17 @@
|
|||||||
::
|
::
|
||||||
++ yo :: app instance
|
++ yo :: app instance
|
||||||
|_ $: nap=@ud :: instance number
|
|_ $: nap=@ud :: instance number
|
||||||
app=term :: application name
|
|
||||||
you=ship :: client identity
|
you=ship :: client identity
|
||||||
siq=sink :: instance state
|
siq=sink :: instance state
|
||||||
==
|
==
|
||||||
++ abet :: resolve
|
++ abet :: resolve
|
||||||
%_ ..yo
|
%_ ..yo
|
||||||
sok (~(put by sok) nap [app you siq])
|
sok (~(put by sok) nap [you siq])
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ amok :: demolish
|
++ amok :: demolish
|
||||||
^+ ..yo
|
^+ ..yo
|
||||||
=+ wuh=(~(tap by haw.siq) ~)
|
=+ wuh=(~(tap by can.sub.siq))
|
||||||
|- ^+ ..yo
|
|- ^+ ..yo
|
||||||
?~ wuh
|
?~ wuh
|
||||||
%= ..yo
|
%= ..yo
|
||||||
@ -2043,7 +2077,7 @@
|
|||||||
%= $
|
%= $
|
||||||
wuh t.wuh
|
wuh t.wuh
|
||||||
..amok
|
..amok
|
||||||
(pass(hen hen.q.i.wuh) p.i.wuh `note`[%g %nuke [our app] you])
|
(pass(hen r.q.i.wuh) `p.i.wuh `note`[%g %nuke p.q.i.wuh you])
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ beat
|
++ beat
|
||||||
@ -2051,62 +2085,82 @@
|
|||||||
^- [(unit pimp) _+>]
|
^- [(unit pimp) _+>]
|
||||||
?. =(cnt num.bet.siq)
|
?. =(cnt num.bet.siq)
|
||||||
[~ +>.$(..yo (bust 204 num))]
|
[~ +>.$(..yo (bust 204 num))]
|
||||||
=. bet.siq [+(num.bet.siq) now]
|
=. bet.siq bet.siq(num +(num.bet.siq), tim now)
|
||||||
=. +>.$ (hire:(yule 2) cnt num)
|
=. +>.$ (hire:(yule %bet) cnt num)
|
||||||
=. +>.$ (hear:(yule 2) ~ %& %json !>((joba %a-ok %b %&)))
|
=. +>.$ (hear:(yule %bet) ~ %& %json !>((joba %a-ok %b %&)))
|
||||||
[`(need (~(get by q.rey) num)) +>.$]
|
[`(need (~(get by q.rey) num)) +>.$]
|
||||||
::
|
::
|
||||||
++ hoop :: request path
|
++ hoop :: request path
|
||||||
|= suq=@ud
|
|= can=(unit ,@ud)
|
||||||
^- path
|
^- path
|
||||||
:~ %hoop
|
:* %hoop
|
||||||
(scot %p our)
|
(scot %p our)
|
||||||
ses
|
ses
|
||||||
(scot %ud nap)
|
(scot %ud nap)
|
||||||
(scot %ud suq)
|
?~ can
|
||||||
|
[%mess ~]
|
||||||
|
[%show (scot %ud u.can) ~]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ pass :: pass
|
++ pass :: pass
|
||||||
|= [suq=@ud noh=note]
|
|= [can=(unit ,@ud) noh=note]
|
||||||
^+ +>
|
^+ +>
|
||||||
+>(mow [[hen %pass (hoop suq) noh] mow])
|
+>(mow [[hen %pass (hoop can) noh] mow])
|
||||||
::
|
::
|
||||||
++ post :: transmit
|
++ post :: transmit
|
||||||
|= [cnt=@ud num=@ud jon=json]
|
|= [cnt=@ud num=@ud hap=hasp jon=json]
|
||||||
^+ +>
|
^+ +>
|
||||||
=. +>.$
|
=. +>.$
|
||||||
?. =(cnt meg.siq) +>.$
|
?. =(cnt num.meg.siq) +>.$
|
||||||
%+ pass(meg.siq +(meg.siq))
|
%+ pass(num.meg.siq +(num.meg.siq)) ~
|
||||||
1
|
`note`[%g %mess hap you [%json !>(jon)]]
|
||||||
`note`[%g %mess [our app] you [%json !>(jon)]]
|
?. =(+(cnt) num.meg.siq)
|
||||||
?. =(+(cnt) meg.siq)
|
|
||||||
+>.$(..yo (bust 204 num))
|
+>.$(..yo (bust 204 num))
|
||||||
(hire:(yule 1) cnt num)
|
(hire:(yule %meg) cnt num)
|
||||||
|
::
|
||||||
|
++ scad
|
||||||
|
|= [num=@ud hap=hasp pax=path]
|
||||||
|
^- [(unit pimp) _+>]
|
||||||
|
=. +>.$
|
||||||
|
%+ ~(rep by can.sub.siq) +>.$
|
||||||
|
|= [p=[p=@ud q=stem] q=_+>.$]
|
||||||
|
?. =([hap pax] [p.q.p q.q.p]) q
|
||||||
|
=. q q(can.sub.siq (~(del by can.sub.siq:q) p.p))
|
||||||
|
([-(hen +)]:[pass:q r.q.p] `p.p %g %nuke hap you)
|
||||||
|
=+ huq=[~ %& %json !>((joba %ok %b %&))]
|
||||||
|
=. +>.$ abet:(busk:(yule %nil) num 0 huq)
|
||||||
|
[`(need (~(get by q.rey) num)) +>.$]
|
||||||
::
|
::
|
||||||
++ scud :: subscribe
|
++ scud :: subscribe
|
||||||
|= [suq=@ud num=@ud pax=path]
|
|= [num=@ud hap=hasp pax=path]
|
||||||
=. +>.$ (pass suq `note`[%g %show [our app] you pax])
|
=. can.sub.siq (~(put by can.sub.siq) num.sub.siq [hap pax hen `num])
|
||||||
(hire:(yule suq) 0 num)
|
=. +>.$ (pass `num.sub.siq `note`[%g %show hap you pax])
|
||||||
|
=. num.sub.siq +(num.sub.siq)
|
||||||
|
+>.$
|
||||||
::
|
::
|
||||||
++ self :: request main
|
++ self :: request main
|
||||||
|= pax=path
|
|= [app=term pax=path]
|
||||||
^+ +>
|
^+ +>
|
||||||
(hire:(yule:(pass 0 [%g %show [our app] you pax]) 0) 0 nap)
|
=. can.sub.siq (~(put by can.sub.siq) 0 [[our app] pax hen `nap])
|
||||||
|
=. num.sub.siq +(num.sub.siq)
|
||||||
|
(pass `0 [%g %show [our app] you pax])
|
||||||
::
|
::
|
||||||
++ yule :: swig state
|
++ yule
|
||||||
|= suq=@ud
|
|= pla=?(%bet %meg %sub %nil)
|
||||||
%~ . yu
|
%~ . yu :- pla
|
||||||
:- suq
|
=< wig
|
||||||
=+ wig=(~(get by haw.siq) suq)
|
?-(pla %bet bet.siq, %meg meg.siq, %sub sub.siq, %nil [wig=*swig ~])
|
||||||
?~ wig [-(hen +)]:[*swig hen] u.wig
|
|
||||||
::
|
::
|
||||||
++ yu :: swig state
|
++ yu :: swig state
|
||||||
|_ [suq=@ud wig=swig]
|
|_ [pla=?(%bet %meg %sub %nil) wig=swig]
|
||||||
++ abet :: resolve
|
++ abet
|
||||||
%_(..yu haw.siq (~(put by haw.siq) suq wig))
|
^+ ..yu
|
||||||
::
|
?- pla
|
||||||
++ amok
|
%bet %_(..yu wig.bet.siq wig)
|
||||||
%_(..yu haw.siq (~(del by haw.siq) suq))
|
%meg %_(..yu wig.meg.siq wig)
|
||||||
|
%sub %_(..yu wig.sub.siq wig)
|
||||||
|
%nil ..yu
|
||||||
|
==
|
||||||
::
|
::
|
||||||
++ busk :: seam result
|
++ busk :: seam result
|
||||||
|= $: num=@ud
|
|= $: num=@ud
|
||||||
@ -2116,7 +2170,8 @@
|
|||||||
^+ +>
|
^+ +>
|
||||||
=+ pup=(~(get by q.rey) num)
|
=+ pup=(~(get by q.rey) num)
|
||||||
?~ pup +>.$ :: XX a hack
|
?~ pup +>.$ :: XX a hack
|
||||||
=. wig ?. =(toy.wig cnt)
|
=. wig ?: ?=(%nil pla) wig
|
||||||
|
?. =(toy.wig cnt)
|
||||||
?>(=(toy.wig +(cnt)) wig)
|
?>(=(toy.wig +(cnt)) wig)
|
||||||
%= wig
|
%= wig
|
||||||
toy +(toy.wig)
|
toy +(toy.wig)
|
||||||
@ -2128,7 +2183,7 @@
|
|||||||
=+ pip=u.pup
|
=+ pip=u.pup
|
||||||
=+ ^= sip
|
=+ ^= sip
|
||||||
?. =(%apg -.som.pip) sip.pip
|
?. =(%apg -.som.pip) sip.pip
|
||||||
[duti duty sip.pip]
|
[duti sip.pip]
|
||||||
?~ huq +>.$(..yo (bust 404 num))
|
?~ huq +>.$(..yo (bust 404 num))
|
||||||
%= +>.$
|
%= +>.$
|
||||||
q.rey
|
q.rey
|
||||||
@ -2138,7 +2193,6 @@
|
|||||||
%= pip
|
%= pip
|
||||||
pez %new
|
pez %new
|
||||||
vaz :~ [%ship (quo (rsh 3 1 (scot %p our)))]
|
vaz :~ [%ship (quo (rsh 3 1 (scot %p our)))]
|
||||||
[%appl (quo app)]
|
|
||||||
[%port (trip (rsh 3 2 (scot %ui nap)))]
|
[%port (trip (rsh 3 2 (scot %ui nap)))]
|
||||||
[%auto "true"]
|
[%auto "true"]
|
||||||
[%oryx (quo orx.ced)]
|
[%oryx (quo orx.ced)]
|
||||||
@ -2161,13 +2215,13 @@
|
|||||||
^+ ..yu
|
^+ ..yu
|
||||||
=+ dum=(~(tap by wan.wig) ~)
|
=+ dum=(~(tap by wan.wig) ~)
|
||||||
|- ^+ ..yu
|
|- ^+ ..yu
|
||||||
?~ dum amok
|
?~ dum ..yu :: XX drop stream
|
||||||
$(dum t.dum, ..yo (bust 404 q.i.dum))
|
$(dum t.dum, ..yo (bust 404 q.i.dum))
|
||||||
::
|
::
|
||||||
++ hear :: produce
|
++ hear :: produce
|
||||||
|= huq=(unit (each cage cage))
|
|= huq=(unit (each cage cage))
|
||||||
^+ ..yu
|
^+ ..yu
|
||||||
=< abet
|
=< abet
|
||||||
=+ cnt=cnt.wig
|
=+ cnt=cnt.wig
|
||||||
=+ dul=(~(get by wan.wig) cnt)
|
=+ dul=(~(get by wan.wig) cnt)
|
||||||
:: ~& :~ %yu-hear
|
:: ~& :~ %yu-hear
|
||||||
|
364
arvo/ford.hoon
364
arvo/ford.hoon
@ -10,13 +10,25 @@
|
|||||||
++ gift :: out result <-$
|
++ gift :: out result <-$
|
||||||
$% [%made p=(each bead (list tank))] :: computed result
|
$% [%made p=(each bead (list tank))] :: computed result
|
||||||
== ::
|
== ::
|
||||||
|
++ heel path :: functional ending
|
||||||
|
++ hock :: standard label
|
||||||
|
$: [%c p=@ud] :: celsius version
|
||||||
|
[%k p=@ud] :: kelvin version
|
||||||
|
[%s p=@ud q=@ud r=@ud] :: semantic version
|
||||||
|
== ::
|
||||||
++ hood :: assembly plan
|
++ hood :: assembly plan
|
||||||
$: sys=$|(@ud [@ud @ud]) :: system kelvin
|
$: [how=beam rem=heel] :: beam and remainder
|
||||||
pro=(map term beam) :: protocols
|
zus=@ud :: zuse kelvin
|
||||||
lib=(map term beam) :: libraries
|
pro=(list hoof) :: protocols
|
||||||
:: res=(map term (trel horn beam path)) :: resource trees
|
lib=(list hoof) :: libraries
|
||||||
|
:: res=(map term (pair beam horn)) :: resources
|
||||||
src=(list hoop) :: program
|
src=(list hoop) :: program
|
||||||
== ::
|
== ::
|
||||||
|
++ hoof :: reference
|
||||||
|
$% [%here p=term] :: name
|
||||||
|
[%this p=term q=case] :: name, case
|
||||||
|
[%that p=term q=case r=ship] :: name, case, ship
|
||||||
|
== ::
|
||||||
++ hoop :: source in hood
|
++ hoop :: source in hood
|
||||||
$% [%code p=twig] :: direct twig
|
$% [%code p=twig] :: direct twig
|
||||||
[%cone p=beam] :: core from folder
|
[%cone p=beam] :: core from folder
|
||||||
@ -28,7 +40,7 @@
|
|||||||
$| ~ :: leaf
|
$| ~ :: leaf
|
||||||
$% [%day p=horn] :: list by time
|
$% [%day p=horn] :: list by time
|
||||||
[%fan p=(map term horn)] :: tuple
|
[%fan p=(map term horn)] :: tuple
|
||||||
[%for p=logo q=horn] :: leaf protocol
|
[%for p=logo q=horn] :: leaf mark
|
||||||
[%hub p=horn] :: list by number
|
[%hub p=horn] :: list by number
|
||||||
[%nap p=horn] :: soft map
|
[%nap p=horn] :: soft map
|
||||||
== ::
|
== ::
|
||||||
@ -60,7 +72,7 @@
|
|||||||
[%dude p=tank q=silk] :: error wrap
|
[%dude p=tank q=silk] :: error wrap
|
||||||
[%dune p=(set beam) q=(unit cage)] :: unit literal
|
[%dune p=(set beam) q=(unit cage)] :: unit literal
|
||||||
[%mute p=silk q=(list (pair wing silk))] :: mutant
|
[%mute p=silk q=(list (pair wing silk))] :: mutant
|
||||||
[%plan p=silk q=hood] :: structured build
|
[%plan p=beam q=spur r=hood] :: structured assembly
|
||||||
[%reef ~] :: kernel reef
|
[%reef ~] :: kernel reef
|
||||||
[%ride p=silk q=sill] :: obsolete old plan
|
[%ride p=silk q=sill] :: obsolete old plan
|
||||||
[%vale p=logo q=sack r=*] :: validate [our his]
|
[%vale p=logo q=sack r=*] :: validate [our his]
|
||||||
@ -110,9 +122,9 @@
|
|||||||
dep=(set beam) :: dependencies
|
dep=(set beam) :: dependencies
|
||||||
== ::
|
== ::
|
||||||
++ calx :: concrete cache line
|
++ calx :: concrete cache line
|
||||||
$% [%hood p=calm q=(pair path cage) r=hood] :: compile to hood
|
$% [%hood p=calm q=cage r=hood] :: compile to hood
|
||||||
[%slap p=calm q=[p=vase q=twig] r=vase] :: slap
|
[%slap p=calm q=[p=vase q=twig] r=vase] :: slap
|
||||||
[%twig p=calm q=(pair path cage) r=twig] :: compile to twig
|
[%twig p=calm q=cage r=twig] :: compile to twig
|
||||||
== ::
|
== ::
|
||||||
++ task :: problem in progress
|
++ task :: problem in progress
|
||||||
$: nah=duct :: cause
|
$: nah=duct :: cause
|
||||||
@ -125,6 +137,7 @@
|
|||||||
|* sem=* :: a typesystem hack
|
|* sem=* :: a typesystem hack
|
||||||
|= cax=calx
|
|= cax=calx
|
||||||
?+ sem !!
|
?+ sem !!
|
||||||
|
%hood ?>(?=(%hood -.cax) r.cax)
|
||||||
%twig ?>(?=(%twig -.cax) r.cax)
|
%twig ?>(?=(%twig -.cax) r.cax)
|
||||||
%slap ?>(?=(%slap -.cax) r.cax)
|
%slap ?>(?=(%slap -.cax) r.cax)
|
||||||
==
|
==
|
||||||
@ -366,32 +379,83 @@
|
|||||||
%_(+> mow :_(mow [hen %give gef]))
|
%_(+> mow :_(mow [hen %give gef]))
|
||||||
::
|
::
|
||||||
++ fade :: compile %hood
|
++ fade :: compile %hood
|
||||||
|= [cof=cafe kas=silk]
|
|= [cof=cafe bem=beam rem=heel]
|
||||||
^- (bolt hood)
|
^- (bolt hood)
|
||||||
%. [cof %hoon kas]
|
=+ rul=(fair bem rem)
|
||||||
(fado |=(a=path (ifix [gay gay] hall:(vang | a))))
|
%+ (clef %hood) (make cof [%bake %hoon bem rem])
|
||||||
|
^- (burg cage hood)
|
||||||
|
|= [cof=cafe cay=cage]
|
||||||
|
?. ?=(@ q.q.cay)
|
||||||
|
(flaw cof ~)
|
||||||
|
=+ vex=((full rul) [[1 1] (trip q.q.cay)])
|
||||||
|
?~ q.vex
|
||||||
|
(flaw cof [%leaf "syntax error: {<p.p.vex>} {<q.p.vex>}"] ~)
|
||||||
|
(fine cof p.u.q.vex)
|
||||||
::
|
::
|
||||||
++ fane :: compile %hoon
|
++ fane :: compile %hoon
|
||||||
|= [cof=cafe kas=silk]
|
|= [cof=cafe kas=silk]
|
||||||
^- (bolt twig)
|
^- (bolt twig)
|
||||||
%. [cof %hoon kas]
|
=+ pax=(home kas)
|
||||||
(fado |=(a=path (ifix [gay gay] tall:(vang | a))))
|
%+ (clef %twig) (make cof kas)
|
||||||
::
|
^- (burg cage twig)
|
||||||
++ fado :: compile by rule
|
|= [cof=cafe cay=cage]
|
||||||
|* lur=$+(path rule)
|
?. ?=(@ q.q.cay)
|
||||||
|= [cof=cafe for=logo kas=silk]
|
(flaw cof ~)
|
||||||
%+ (clef %twig) (maid cof kas)
|
=+ rul=(ifix [gay gay] tall:(vang | pax))
|
||||||
^- (burg (pair path cage) twig)
|
=+ vex=((full rul) [[1 1] (trip q.q.cay)])
|
||||||
|= [cof=cafe pay=(pair path cage)]
|
|
||||||
?. |(=(for p.q.pay) =(%noun p.q.pay))
|
|
||||||
(flaw cof [%leaf "source error: {<p.pay>} must be %{<(trip for)>}"])
|
|
||||||
?. ?=(@ q.q.q.pay)
|
|
||||||
(flaw cof [%leaf "source error: {<p.pay>} must be flat"]~)
|
|
||||||
=+ vex=((full (lur p.pay)) [[1 1] (trip q.q.q.pay)])
|
|
||||||
?~ q.vex
|
?~ q.vex
|
||||||
(flaw cof [%leaf "syntax error: {<p.p.vex>} {<q.p.vex>}"] ~)
|
(flaw cof [%leaf "syntax error: {<p.p.vex>} {<q.p.vex>}"] ~)
|
||||||
(fine cof p.u.q.vex)
|
(fine cof p.u.q.vex)
|
||||||
::
|
::
|
||||||
|
++ fair :: hood parsing rule
|
||||||
|
|= [bem=beam rem=heel]
|
||||||
|
=+ vez=(vang | (tope bem(s (weld rem s.bem))))
|
||||||
|
=< hood
|
||||||
|
|%
|
||||||
|
++ case
|
||||||
|
%- sear
|
||||||
|
:_ nuck:so
|
||||||
|
|= a=coin
|
||||||
|
?. ?=([%$ ?(%da %ud %tas) *] a) ~
|
||||||
|
[~ u=(^case a)]
|
||||||
|
::
|
||||||
|
++ hood
|
||||||
|
%+ ifix [gay gay]
|
||||||
|
%+ cook |=(a=^hood a)
|
||||||
|
%+ stag [bem rem]
|
||||||
|
;~ plug
|
||||||
|
;~ pose
|
||||||
|
(ifix [;~(plug pat wut gap) gap] dem)
|
||||||
|
(easy zuse)
|
||||||
|
==
|
||||||
|
hoos
|
||||||
|
hoos
|
||||||
|
(star hoop)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ hoof
|
||||||
|
%+ cook |=(a=^hoof a)
|
||||||
|
;~ pose
|
||||||
|
%+ stag %that
|
||||||
|
;~(plug sym ;~(pfix fas case) ;~(pfix ;~(plug fas sig) fed:ag))
|
||||||
|
::
|
||||||
|
(stag %this ;~(plug sym ;~(pfix fas case)))
|
||||||
|
(stag %here sym)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ hoos
|
||||||
|
%+ cook |=(a=(list ^hoof) a)
|
||||||
|
;~ pose
|
||||||
|
(ifix [;~(plug pat lus gap) gap] (most ;~(plug com ace) hoof))
|
||||||
|
(easy ~)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ hoop
|
||||||
|
%+ knee *^hoop |. ~+
|
||||||
|
%+ cook |=(a=^hoop a)
|
||||||
|
(stag %code tall:vez)
|
||||||
|
--
|
||||||
|
::
|
||||||
++ gush :: sill to twig
|
++ gush :: sill to twig
|
||||||
|= [cof=cafe sil=sill]
|
|= [cof=cafe sil=sill]
|
||||||
^- (bolt twig)
|
^- (bolt twig)
|
||||||
@ -449,20 +513,26 @@
|
|||||||
(fine cof p.cay vax)
|
(fine cof p.cay vax)
|
||||||
::
|
::
|
||||||
++ krab :: load to vase
|
++ krab :: load to vase
|
||||||
|= [cof=cafe for=logo how=logo bem=beam rem=spur]
|
|= [cof=cafe for=logo how=logo bem=beam rem=heel]
|
||||||
^- (bolt vase)
|
^- (bolt vase)
|
||||||
%+ cope (fane cof %bake how bem rem)
|
%+ cope (fane cof %bake how bem rem)
|
||||||
|= [cof=cafe gen=twig]
|
|= [cof=cafe gen=twig]
|
||||||
(maim cof pit gen)
|
(maim cof pit gen)
|
||||||
::
|
::
|
||||||
++ lace :: load and check
|
++ lace :: load and check
|
||||||
|= [cof=cafe for=logo bem=beam rem=spur]
|
|= [cof=cafe for=logo bem=beam rem=heel]
|
||||||
^- (bolt (unit vase))
|
^- (bolt (unit vase))
|
||||||
=+ bek=`beak`[p.bem q.bem r.bem]
|
=+ bek=`beak`[p.bem q.bem r.bem]
|
||||||
%+ cope (lend cof bem)
|
%+ cope (lend cof bem)
|
||||||
|= [cof=cafe arc=arch]
|
|= [cof=cafe arc=arch]
|
||||||
?^ q.arc
|
?^ q.arc
|
||||||
(cope (liar cof bem) (lake for bek))
|
(cope (liar cof bem) (lake for bek))
|
||||||
|
?: (~(has by r.arc) %hood)
|
||||||
|
%+ cope (fade cof bem rem)
|
||||||
|
|= [cof=cafe hyd=hood]
|
||||||
|
%+ cope (abut:(meow bem rem) cof hyd)
|
||||||
|
|= [cof=cafe vax=vase]
|
||||||
|
(fine cof ~ vax)
|
||||||
?: (~(has by r.arc) %hook)
|
?: (~(has by r.arc) %hook)
|
||||||
%+ cope (krab cof for %hook bem rem)
|
%+ cope (krab cof for %hook bem rem)
|
||||||
|= [cof=cafe vax=vase]
|
|= [cof=cafe vax=vase]
|
||||||
@ -478,7 +548,7 @@
|
|||||||
|= [for=logo bek=beak]
|
|= [for=logo bek=beak]
|
||||||
|= [cof=cafe sam=vase]
|
|= [cof=cafe sam=vase]
|
||||||
^- (bolt (unit vase))
|
^- (bolt (unit vase))
|
||||||
?: ?=(?(%gate %core %hoon %hook) for)
|
?: ?=(?(%gate %core %hoon %hook %hood) for)
|
||||||
(fine cof ~ sam)
|
(fine cof ~ sam)
|
||||||
%+ cope (make cof %boil %gate [[p.bek %main r.bek] /ref/[for]/sys] ~)
|
%+ cope (make cof %boil %gate [[p.bek %main r.bek] /ref/[for]/sys] ~)
|
||||||
|= [cof=cafe cay=cage]
|
|= [cof=cafe cay=cage]
|
||||||
@ -541,7 +611,7 @@
|
|||||||
(fine cof ?.(=(%hoon for) all [%hoot all]))
|
(fine cof ?.(=(%hoon for) all [%hoot all]))
|
||||||
::
|
::
|
||||||
++ lima :: load at depth
|
++ lima :: load at depth
|
||||||
|= [cof=cafe for=logo bem=beam rem=spur]
|
|= [cof=cafe for=logo bem=beam rem=heel]
|
||||||
^- (bolt (unit vase))
|
^- (bolt (unit vase))
|
||||||
%+ cope (lend cof bem)
|
%+ cope (lend cof bem)
|
||||||
|= [cof=cafe arc=arch]
|
|= [cof=cafe arc=arch]
|
||||||
@ -561,7 +631,7 @@
|
|||||||
(fine cof ~ vax)
|
(fine cof ~ vax)
|
||||||
::
|
::
|
||||||
++ lime :: load beam
|
++ lime :: load beam
|
||||||
|= [cof=cafe for=logo bem=beam rem=spur]
|
|= [cof=cafe for=logo bem=beam rem=heel]
|
||||||
=+ [mob=bem mer=(flop rem)]
|
=+ [mob=bem mer=(flop rem)]
|
||||||
|- ^- (bolt vase)
|
|- ^- (bolt vase)
|
||||||
%+ cope (lima cof for mob (flop mer))
|
%+ cope (lima cof for mob (flop mer))
|
||||||
@ -716,9 +786,9 @@
|
|||||||
::
|
::
|
||||||
%mute (kale cof p.kas q.kas)
|
%mute (kale cof p.kas q.kas)
|
||||||
%plan
|
%plan
|
||||||
%+ cope (main cof p.kas)
|
%+ cope (abut:(meow p.kas q.kas) cof r.kas)
|
||||||
|= [cof=cafe vax=vase]
|
|= [cof=cafe vax=vase]
|
||||||
(fine cof [%noun vax])
|
(fine cof %noun vax)
|
||||||
::
|
::
|
||||||
%reef (fine cof %noun pit)
|
%reef (fine cof %noun pit)
|
||||||
%ride
|
%ride
|
||||||
@ -751,150 +821,118 @@
|
|||||||
`vase`[p.top val]
|
`vase`[p.top val]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ plow :: true build
|
++ meow :: assemble
|
||||||
|= [cof=cafe pix=vase hyd=hood]
|
|= [how=beam rem=heel]
|
||||||
=| :* rop=(map term twig)
|
=| $: rop=(map term (pair hoof twig)) :: protocols known
|
||||||
bil=(map term (trel beam (set term) twig))
|
bil=(map term (pair hoof twig)) :: libraries known
|
||||||
ser=(map logo (map term vase)) :: XX update for horn
|
lot=(list term) :: library stack
|
||||||
|
zeg=(set term) :: library guard
|
||||||
|
boy=(list twig) :: body stack
|
||||||
==
|
==
|
||||||
=< apex
|
|
||||||
|%
|
|%
|
||||||
++ abet :: emit as vase
|
++ abut :: generate
|
||||||
|= [gen=twig rex=vase]
|
|= [cof=cafe hyd=hood]
|
||||||
^- (bolt vase)
|
%+ cope (apex cof hyd)
|
||||||
%+ cope acme
|
|= [cof=cafe sel=_..abut]
|
||||||
|= [cof=cafe lib=twig]
|
(maim cof pit able:sel)
|
||||||
%+ cope (maim cof pix [%tsgr able lib])
|
|
||||||
|= [cof=cafe vax=vase]
|
|
||||||
(maim cof ?~(ser vax (slop acta vax)) gen)
|
|
||||||
::
|
::
|
||||||
++ able :: assemble preamble
|
++ able :: assemble preamble
|
||||||
^- twig
|
^- twig
|
||||||
?~(rop [%$ 1] [%brcn (~(run by rop) |=(a=twig [%ash a]))])
|
:+ %tsgr
|
||||||
|
?:(=(~ rop) [%$ 1] [%brcn (~(run by rop) |=([* a=twig] [%ash a]))])
|
||||||
|
:+ %tsgr
|
||||||
|
[%tssg (turn (flop lot) |=(a=term q:(need (~(get by bil) a))))]
|
||||||
|
[%tssg (flop boy)]
|
||||||
::
|
::
|
||||||
++ acta :: assemble resources
|
++ apex :: build to body
|
||||||
^- vase
|
|= [cof=cafe hyd=hood]
|
||||||
=< apex
|
^- (bolt ,_..apex)
|
||||||
|%
|
%+ cope (body cof src.hyd)
|
||||||
++ apex
|
|= [cof=cafe sel=_..apex]
|
||||||
?~ ser !!
|
=. ..apex sel
|
||||||
=+ top=(ayah p.n.ser (axel q.n.ser))
|
%+ cope (neck cof lib.hyd)
|
||||||
?~ l.ser
|
|= [cof=cafe sel=_..apex]
|
||||||
?~(r.ser top (slop top apex(ser r.ser)))
|
=. ..apex sel
|
||||||
=+ lef=apex(ser l.ser)
|
%+ cope (head cof pro.hyd)
|
||||||
?~(r.ser (slop lef top) :(slop lef top apex(ser r.ser)))
|
|= [cof=cafe sel=_..apex]
|
||||||
::
|
(fine cof sel)
|
||||||
++ axel
|
|
||||||
|= ryz=(map term vase)
|
|
||||||
^= vax
|
|
||||||
|- ^- vase
|
|
||||||
?~ ryz !!
|
|
||||||
=+ top=(ayah n.ryz)
|
|
||||||
?~ l.ryz
|
|
||||||
?~(r.ryz top (slop top $(ryz r.ryz)))
|
|
||||||
=+ lef=$(ryz r.ryz)
|
|
||||||
?~(r.ryz (slop lef top) :(slop lef top $(ryz r.ryz)))
|
|
||||||
::
|
|
||||||
++ ayah
|
|
||||||
|= [cog=term vax=vase]
|
|
||||||
[[%face cog p.vax] q.vax]
|
|
||||||
--
|
|
||||||
::
|
::
|
||||||
++ acme :: libraries in order
|
++ body :: produce functions
|
||||||
^- (bolt twig)
|
|= [cof=cafe src=(list hoop)]
|
||||||
%- cope
|
^- (bolt _..body)
|
||||||
:_ |= [cof=cafe cus=(list twig)]
|
?~ src (fine cof ..body)
|
||||||
(fine cof [%tssg cus])
|
%+ cope (wilt cof i.src)
|
||||||
=+ kop=(turn (~(tap by bil) ~) |=([term *] -))
|
|= [cof=cafe sel=_..body]
|
||||||
=| [dun=(set term) cus=(list twig)]
|
^$(cof cof, src t.src, ..body sel)
|
||||||
|- ^- (bolt (list twig))
|
|
||||||
?~ kop (fine cof cus)
|
|
||||||
=+ cog=i.kop
|
|
||||||
?: (~(has in dun) cog) $(kop t.kop)
|
|
||||||
=+ liv=`(set term)`[cog ~ ~]
|
|
||||||
|- ^- (bolt (list twig))
|
|
||||||
=+ zic=(need (~(get by bil) cog))
|
|
||||||
=+ dez=`(list term)`(~(tap in q.zic) ~)
|
|
||||||
|- ^- (bolt (list twig))
|
|
||||||
?~ dez
|
|
||||||
^^$(cus [p.zic cus], dun (~(put in dun) cog), kop t.kop)
|
|
||||||
?: (~(has in dun) i.dez)
|
|
||||||
$(dez t.dez)
|
|
||||||
?: (~(has in liv) cog)
|
|
||||||
(flaw cof [%leaf "build error: {<cog>} depends on itself}"])
|
|
||||||
^$(cog i.dez, liv (~(put in liv) cog), kop [i.kop kop])
|
|
||||||
::
|
::
|
||||||
++ aloe :: process all
|
++ head :: consume protocols
|
||||||
^- (bolt (trel vase twig ,_..aloe))
|
|= [cof=cafe bir=(list hoof)]
|
||||||
%+ cope body
|
|- ^- (bolt ,_..head)
|
||||||
|= [cof=cafe cus=(list twig) sel=_..aloe]
|
?~ bir (fine cof ..head)
|
||||||
=. ..aloe sel(cof cof)
|
=+ cog=(heck i.bir)
|
||||||
%+ cope head
|
=+ byf=(~(get by rop) cog)
|
||||||
|= [cof=cafe sel=_..aloe]
|
?^ byf
|
||||||
=. ..aloe sel(cof cof)
|
?. =(`hoof`i.bir `hoof`p.u.byf)
|
||||||
%+ cope butt
|
(flaw cof [%leaf "protocol mismatch: {<~[cog p.u.byf i.bir]>}"]~)
|
||||||
|= [cof=cafe sel=_..aloe]
|
$(bir t.bir)
|
||||||
:: =. ..aloe sel(cof cof)
|
=+ bem=(hone %gate %pro i.bir)
|
||||||
:: %+ cope eyes
|
%+ cope (fade cof bem ~)
|
||||||
:: |= [cof=cafe pix=vase sel=_..aloe]
|
|= [cof=cafe hyd=hood]
|
||||||
:: (fine cof [%tssg (flop cus)] pix sel(cof cof))
|
%+ cope (apex(lot ~) cof hyd)
|
||||||
(fine cof [%tssg (flop cus)] !>(~) sel(cof cof))
|
|= [cof=cafe sel=_..neck]
|
||||||
|
=. ..head
|
||||||
|
%= sel
|
||||||
|
zeg zeg
|
||||||
|
rop (~(put by rop) cog [i.bir [%tssg (flop boy.sel)]])
|
||||||
|
==
|
||||||
|
^^$(cof cof, bir t.bir)
|
||||||
::
|
::
|
||||||
++ apex :: top level
|
++ heck :: hoof to name
|
||||||
^- (bolt vase)
|
|= huf=hoof ^- term
|
||||||
%+ cope aloe
|
?-(-.huf %here p.huf, %this p.huf, %that p.huf)
|
||||||
|= [cof=cafe cus=(list twig) sel=_..aloe]
|
|
||||||
(abet:sel(cof cof) cus)
|
|
||||||
::
|
::
|
||||||
++ body :: process body
|
++ hone :: plant hoof
|
||||||
=+ cus=(list twig)
|
|= [for=@tas way=@tas huf=hoof]
|
||||||
|- ^- (bolt (pair (list twig) ,_..body))
|
^- beam
|
||||||
?~ src.hyd
|
?- -.huf
|
||||||
(fine cof cus ..body)
|
%here how(s ~[for p.huf way])
|
||||||
%+ cope (wilt i.src.hyd)
|
%this [[p.how %main q.huf] ~[for p.huf way]]
|
||||||
|= [cof=cafe gen=twig sel=_..body]
|
%that [[r.huf %main q.huf] ~[for p.huf way]]
|
||||||
$(src.hyd t.src.hyd, cus [gen cus], ..body sel(cof cof))
|
|
||||||
::
|
|
||||||
++ butt :: process libraries
|
|
||||||
=+ bol=(~(tap by lib.hyd) ~)
|
|
||||||
|- ^- (bolt ,_..butt)
|
|
||||||
?~ bol ..butt
|
|
||||||
?. =+ olb=(~(get by bil) p.i.bol)
|
|
||||||
?~ olb &
|
|
||||||
=(`beam`p.u.olb `beam`q.i.bol)
|
|
||||||
(flaw cof [%leaf "build error: {<p.i.bol>} {<p.u.olb>} {<q.i.bol>}]~)
|
|
||||||
%+ cope (wine q.i.bol)
|
|
||||||
|= [cof=cafe gen=twig dep=(set term) dah=hood]
|
|
||||||
^$(olb
|
|
||||||
::
|
|
||||||
++ wilt :: process body entry
|
|
||||||
|= hop=hoop
|
|
||||||
^- (bolt ,[p=twig q=_..wilt])
|
|
||||||
?+ -.hop !!
|
|
||||||
%code (fine p.hop ..wilt)
|
|
||||||
%hoon (wine p.hop)
|
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ wind :: sub-hood, no deps
|
++ neck :: consume libraries
|
||||||
|= bem=beam
|
|= [cof=cafe bir=(list hoof)]
|
||||||
^- (bolt ,[p=twig r=_..wind])
|
^- (bolt ,_..neck)
|
||||||
%+ cope (fade cof %bake %hoon bem ~)
|
?~ bir (fine cof ..neck)
|
||||||
|= [cof=cafe dah=hood]
|
=+ cog=(heck i.bir)
|
||||||
%+ cope aloe(hyd dah)
|
?: (~(has in zeg) cog)
|
||||||
|= [cof=cafe cus=(list twig) sel=_..wind]
|
(flaw cof [%leaf "circular dependency: {<~[cog i.bir]>}"]~)
|
||||||
(fine [%tssg (flop cus)] sel(hyd hyd, cof cof))
|
=+ goz=(~(put in zeg) cog)
|
||||||
|
=+ byf=(~(get by bil) cog)
|
||||||
|
?^ byf
|
||||||
|
?. =(`hoof`i.bir `hoof`p.u.byf)
|
||||||
|
(flaw cof [%leaf "library mismatch: {<~[cog p.u.byf i.bir]>}"]~)
|
||||||
|
$(bir t.bir)
|
||||||
|
=+ bem=(hone %core %lib i.bir)
|
||||||
|
%+ cope (fade cof bem ~)
|
||||||
|
|= [cof=cafe hyd=hood]
|
||||||
|
%+ cope (apex(zeg goz, boy ~) cof hyd)
|
||||||
|
|= [cof=cafe sel=_..neck]
|
||||||
|
=. ..neck
|
||||||
|
%= sel
|
||||||
|
zeg zeg
|
||||||
|
lot [cog lot]
|
||||||
|
bil (~(put by bil) cog [i.bir [%tssg (flop boy.sel)]])
|
||||||
|
==
|
||||||
|
^^$(cof cof, bir t.bir)
|
||||||
::
|
::
|
||||||
++ wine :: sub-hood, deps
|
++ wilt :: process body entry
|
||||||
|= bem=beam
|
|= [cof=cafe hop=hoop]
|
||||||
^- (bolt ,[p=twig q=(set term) r=_..wind])
|
^- (bolt _..wilt)
|
||||||
%+ cope (fade cof %bake %hoon bem ~)
|
?+ -.hop !!
|
||||||
|= [cof=cafe dah=hood]
|
%code (fine cof ..wilt(boy [p.hop boy]))
|
||||||
%+ cope aloe(hyd dah, lib ~)
|
%hood (cope (fade cof p.hop ~) apex)
|
||||||
|= [cof=cafe cus=(list twig) sel=_..wind]
|
==
|
||||||
%^ fine
|
|
||||||
[%tssg (flop cus)]
|
|
||||||
lib.sel
|
|
||||||
sel(hyd hyd, lib (~(uni in lib.sel) lib), cof cof)
|
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ resp
|
++ resp
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
~% %k.164 ~ ~ ::
|
~% %k.164 ~ ~ ::
|
||||||
|% ::
|
|% ::
|
||||||
++ stub %164 :: version stub
|
++ hoon %164 :: version stub
|
||||||
-- ::
|
-- ::
|
||||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
:::::: :::::: volume 1, Hoon models ::::::
|
:::::: :::::: volume 1, Hoon models ::::::
|
||||||
@ -1221,7 +1221,7 @@
|
|||||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
:: section 2cG, floating point ::
|
:: section 2cG, floating point ::
|
||||||
::
|
::
|
||||||
++ rlyd |= red=@rd ^- [s=? h=@ f=@ e=(unit tape) n=?] !:
|
++ rlyd |= red=@rd ^- [s=? h=@ f=@ e=(unit tape) n=?]
|
||||||
~& [%rlyd `@ux`red]
|
~& [%rlyd `@ux`red]
|
||||||
=+ s=(sea:rd red)
|
=+ s=(sea:rd red)
|
||||||
=+ negexp==(1 (mod e.s 2))
|
=+ negexp==(1 (mod e.s 2))
|
||||||
@ -1229,7 +1229,7 @@
|
|||||||
++ rlyh |=(reh=@rh ~|(%real-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
|
++ rlyh |=(reh=@rh ~|(%real-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
|
||||||
++ rlyq |=(req=@rq ~|(%real-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
|
++ rlyq |=(req=@rq ~|(%real-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
|
||||||
++ rlys |=(res=@rs ~|(%real-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
|
++ rlys |=(res=@rs ~|(%real-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
|
||||||
++ ryld |= v=[syn=? hol=@ zer=@ fac=@ exp=(unit ,@)] ^- @rd !:
|
++ ryld |= v=[syn=? hol=@ zer=@ fac=@ exp=(unit ,@)] ^- @rd
|
||||||
?: &(=(hol.v 0) =(zer.v 0) =(fac.v 0))
|
?: &(=(hol.v 0) =(zer.v 0) =(fac.v 0))
|
||||||
(bit:rd (szer:vl:fl 1.023 52 syn.v))
|
(bit:rd (szer:vl:fl 1.023 52 syn.v))
|
||||||
?~ exp.v
|
?~ exp.v
|
||||||
@ -1242,7 +1242,7 @@
|
|||||||
:: Floating point operations for general floating points.
|
:: Floating point operations for general floating points.
|
||||||
:: [s=sign, e=unbiased exponent, f=fraction a=ari]
|
:: [s=sign, e=unbiased exponent, f=fraction a=ari]
|
||||||
:: Value of floating point = (-1)^s * 2^h * (1.f) = (-1)^s * 2^h * a
|
:: Value of floating point = (-1)^s * 2^h * (1.f) = (-1)^s * 2^h * a
|
||||||
++ fl !:
|
++ fl
|
||||||
|%
|
|%
|
||||||
:: ari, or arithmetic form = 1 + mantissa
|
:: ari, or arithmetic form = 1 + mantissa
|
||||||
:: passing around this is convenient because it preserves
|
:: passing around this is convenient because it preserves
|
||||||
@ -1432,10 +1432,9 @@
|
|||||||
?: (zer b p n) [~ "0"]
|
?: (zer b p n) [~ "0"]
|
||||||
~
|
~
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
||||||
::::::::::::
|
::::::::::::
|
||||||
++ add |= [b=@u p=@u n=[s=? e=@s a=@u] m=[s=? e=@s a=@u]] ^- [s=? e=@s a=@u]
|
++ add |= [b=@u p=@u n=[s=? e=@s a=@u] m=[s=? e=@s a=@u]]
|
||||||
|
^- [s=? e=@s a=@u]
|
||||||
=+ g=(gar:te:fl b n m)
|
=+ g=(gar:te:fl b n m)
|
||||||
?: ?=(^ g)
|
?: ?=(^ g)
|
||||||
u.g
|
u.g
|
||||||
@ -1457,7 +1456,8 @@
|
|||||||
=+ e2=(sum:si (sun:si dif2) e.n)
|
=+ e2=(sum:si (sun:si dif2) e.n)
|
||||||
(pro:te:fl b p [s=|(s.n s.m) e=e2 a=(lia p a3)])
|
(pro:te:fl b p [s=|(s.n s.m) e=e2 a=(lia p a3)])
|
||||||
|
|
||||||
++ sub |= [b=@u p=@u n=[s=? e=@s a=@u] m=[s=? e=@s a=@u]] ^- [s=? e=@s a=@u]
|
++ sub |= [b=@u p=@u n=[s=? e=@s a=@u] m=[s=? e=@s a=@u]]
|
||||||
|
^- [s=? e=@s a=@u]
|
||||||
=+ g=(gar:te:fl b n m)
|
=+ g=(gar:te:fl b n m)
|
||||||
?: ?=(^ g)
|
?: ?=(^ g)
|
||||||
u.g
|
u.g
|
||||||
@ -1522,9 +1522,8 @@
|
|||||||
++ gth |= [n=[s=? e=@s a=@u] m=[s=? e=@s a=@u]] ^- ?
|
++ gth |= [n=[s=? e=@s a=@u] m=[s=? e=@s a=@u]] ^- ?
|
||||||
(lte m n)
|
(lte m n)
|
||||||
--
|
--
|
||||||
|
::
|
||||||
:: Real interface for @rd
|
++ rd :: core for @rd
|
||||||
++ rd !:
|
|
||||||
~% %rd + ~
|
~% %rd + ~
|
||||||
|%
|
|%
|
||||||
:: Convert a sign/exp/ari cell into 64 bit atom
|
:: Convert a sign/exp/ari cell into 64 bit atom
|
||||||
@ -3561,18 +3560,22 @@
|
|||||||
(stag ~ zust)
|
(stag ~ zust)
|
||||||
(stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
|
(stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
|
||||||
==
|
==
|
||||||
++ royl !:
|
++ royl
|
||||||
=+ ^= zer
|
=+ ^= zer
|
||||||
(cook lent (star (just '0')))
|
(cook lent (star (just '0')))
|
||||||
=+ ^= vox
|
=+ ^= voy
|
||||||
|
%+ cook royl-cell
|
||||||
;~ plug
|
;~ plug
|
||||||
;~(pose (cold | hep) (easy &))
|
;~(pose (cold | hep) (easy &))
|
||||||
;~(plug dim:ag ;~(pose ;~(pfix dot ;~(plug zer dim:ag)) (easy [0 0])))
|
;~(plug dim:ag ;~(pose ;~(pfix dot ;~(plug zer dim:ag)) (easy [0 0])))
|
||||||
;~(pose ;~(pfix (just 'e') (cook some ;~(plug ;~(pose (cold | hep) (easy &)) dim:ag))) (easy ~))
|
;~ pose
|
||||||
|
;~ pfix
|
||||||
|
(just 'e')
|
||||||
|
(cook some ;~(plug ;~(pose (cold | hep) (easy &)) dim:ag))
|
||||||
|
==
|
||||||
|
(easy ~)
|
||||||
|
==
|
||||||
==
|
==
|
||||||
=+ ^= voy
|
|
||||||
::(cook |=([a=? b=[c=@ d=@ e=@] f=(unit ,@) g=?] [a c.b d.b e.b f]) vox)k
|
|
||||||
(cook royl-cell vox)
|
|
||||||
;~ pose
|
;~ pose
|
||||||
(stag %rh (cook rylh ;~(pfix ;~(plug sig sig) voy)))
|
(stag %rh (cook rylh ;~(pfix ;~(plug sig sig) voy)))
|
||||||
(stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) voy)))
|
(stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) voy)))
|
||||||
@ -6663,10 +6666,10 @@
|
|||||||
::
|
::
|
||||||
[%zpwt *]
|
[%zpwt *]
|
||||||
?: ?: ?=(@ p.gen)
|
?: ?: ?=(@ p.gen)
|
||||||
(lte stub p.gen)
|
(lte hoon p.gen)
|
||||||
&((lte stub p.p.gen) (gte stub q.p.gen))
|
&((lte hoon p.p.gen) (gte hoon q.p.gen))
|
||||||
q.gen
|
q.gen
|
||||||
~|([%stub-fail stub p.gen] !!)
|
~|([%hoon-fail hoon p.gen] !!)
|
||||||
::
|
::
|
||||||
* gen
|
* gen
|
||||||
==
|
==
|
||||||
@ -6748,7 +6751,7 @@
|
|||||||
[%fork *] $(sut p.sut)
|
[%fork *] $(sut p.sut)
|
||||||
[%hold *] ?: (~(has in gil) sut)
|
[%hold *] ?: (~(has in gil) sut)
|
||||||
~_ (dunk %type)
|
~_ (dunk %type)
|
||||||
~|(%burn-loop !!)
|
~|(%burn-loop !!)
|
||||||
$(sut repo, gil (~(put in gil) sut))
|
$(sut repo, gil (~(put in gil) sut))
|
||||||
%noun 0
|
%noun 0
|
||||||
%void ~|(%burn-void !!)
|
%void ~|(%burn-void !!)
|
||||||
@ -9452,7 +9455,6 @@
|
|||||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
:::::: :::::: volume 3, Arvo models and skeleton ::::::
|
:::::: :::::: volume 3, Arvo models and skeleton ::::::
|
||||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
!:
|
|
||||||
|%
|
|%
|
||||||
++ arch ,[p=@uvI q=(unit ,@uvI) r=(map ,@ta ,~)] :: fundamental node
|
++ arch ,[p=@uvI q=(unit ,@uvI) r=(map ,@ta ,~)] :: fundamental node
|
||||||
++ arvo (mold ,[p=term q=mill] mill) :: arvo card
|
++ arvo (mold ,[p=term q=mill] mill) :: arvo card
|
||||||
@ -9473,22 +9475,7 @@
|
|||||||
q=(set monk) :: authors
|
q=(set monk) :: authors
|
||||||
== ::
|
== ::
|
||||||
++ curd ,[p=@tas q=*] :: typeless card
|
++ curd ,[p=@tas q=*] :: typeless card
|
||||||
++ disk |*(a=$+(* *) (pair gene (hypo a))) :: global/local typed
|
|
||||||
++ duct (list wire) :: causal history
|
++ duct (list wire) :: causal history
|
||||||
++ gene :: global schema
|
|
||||||
$& [p=gene q=gene] :: autocons
|
|
||||||
$% [%at p=@tas] :: atom
|
|
||||||
[%gl p=glob] :: global objective
|
|
||||||
[%fa p=@tas q=gene] :: named
|
|
||||||
[%li p=gene] :: list
|
|
||||||
[%no ~] :: untyped
|
|
||||||
[%ma p=gene q=gene] :: map
|
|
||||||
[%se p=gene] :: set
|
|
||||||
[%sy p=@tas q=gene r=gene] :: symbolic declare
|
|
||||||
[%un p=gene] :: unit
|
|
||||||
[%va p=@tas] :: symbolic reference
|
|
||||||
== ::
|
|
||||||
++ glob ,[p=logo q=ship r=mark] :: global brand
|
|
||||||
++ herd (hypo curd) :: typed card
|
++ herd (hypo curd) :: typed card
|
||||||
++ hide :: standard app state
|
++ hide :: standard app state
|
||||||
$: $: our=ship :: owner/operator
|
$: $: our=ship :: owner/operator
|
||||||
@ -9519,7 +9506,6 @@
|
|||||||
++ z *(unit (unit cage)) :: current subtree
|
++ z *(unit (unit cage)) :: current subtree
|
||||||
-- ::
|
-- ::
|
||||||
++ logo ,@tas :: content type
|
++ logo ,@tas :: content type
|
||||||
++ mark ,@uvH :: type by core hash
|
|
||||||
++ mill (each vase milt) :: vase/metavase
|
++ mill (each vase milt) :: vase/metavase
|
||||||
++ milt ,[p=* q=*] :: metavase
|
++ milt ,[p=* q=*] :: metavase
|
||||||
++ monk (each ship khan) :: general identity
|
++ monk (each ship khan) :: general identity
|
||||||
@ -9547,7 +9533,7 @@
|
|||||||
== ::
|
== ::
|
||||||
++ wire path :: event pretext
|
++ wire path :: event pretext
|
||||||
::::: hacks
|
::::: hacks
|
||||||
++ slod !:
|
++ slod
|
||||||
|= sed=sled
|
|= sed=sled
|
||||||
^- slut
|
^- slut
|
||||||
|= raw=*
|
|= raw=*
|
||||||
@ -9570,27 +9556,10 @@
|
|||||||
?~ bop ~
|
?~ bop ~
|
||||||
?~ u.bop [~ ~]
|
?~ u.bop [~ ~]
|
||||||
[~ ~ q.q.u.u.bop]
|
[~ ~ q.q.u.u.bop]
|
||||||
::
|
|
||||||
++ slub !:
|
|
||||||
|= sul=slut
|
|
||||||
^- sled
|
|
||||||
|= [fur=(unit (set monk)) ron=term bed=beam]
|
|
||||||
^- (unit (unit cage))
|
|
||||||
=+ ^= pax ^- path
|
|
||||||
:* ron
|
|
||||||
(scot %p p.bed)
|
|
||||||
q.bed
|
|
||||||
(scot r.bed)
|
|
||||||
(flop s.bed)
|
|
||||||
==
|
|
||||||
=+ bop=(sul pax)
|
|
||||||
?~ bop ~
|
|
||||||
?~ u.bop [~ ~]
|
|
||||||
[~ ~ [%$ %noun u.u.bop]]
|
|
||||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
:: section 3bE, Arvo core ::
|
:: section 3bE, Arvo core ::
|
||||||
::
|
::
|
||||||
++ vent !: :: vane core
|
++ vent :: vane core
|
||||||
|= [lal=@tas vil=vile bud=vase ves=vase]
|
|= [lal=@tas vil=vile bud=vase ves=vase]
|
||||||
|%
|
|%
|
||||||
++ ruck :: update vase
|
++ ruck :: update vase
|
||||||
@ -9976,7 +9945,7 @@
|
|||||||
++ peek :: external inspect
|
++ peek :: external inspect
|
||||||
|= [now=@da hap=path]
|
|= [now=@da hap=path]
|
||||||
^- (unit)
|
^- (unit)
|
||||||
?~ hap [~ stub]
|
?~ hap [~ hoon]
|
||||||
=+ rob=((slod ~(beck (is vil eny bud fan) now)) hap)
|
=+ rob=((slod ~(beck (is vil eny bud fan) now)) hap)
|
||||||
?~ rob ~
|
?~ rob ~
|
||||||
?~ u.rob ~
|
?~ u.rob ~
|
||||||
@ -10004,9 +9973,9 @@
|
|||||||
=+ ^= nex
|
=+ ^= nex
|
||||||
=+ gat=.*(ken .*(ken [0 87]))
|
=+ gat=.*(ken .*(ken [0 87]))
|
||||||
(need ((hard (unit ,@)) .*([-.gat [[now ~] +>.gat]] -.gat)))
|
(need ((hard (unit ,@)) .*([-.gat [[now ~] +>.gat]] -.gat)))
|
||||||
~& [%vega-compiled stub nex]
|
~& [%vega-compiled hoon nex]
|
||||||
?> (lte nex stub)
|
?> (lte nex hoon)
|
||||||
=+ gat=.*(ken .*(ken [0 ?:(=(nex stub) 86 11)]))
|
=+ gat=.*(ken .*(ken [0 ?:(=(nex hoon) 86 11)]))
|
||||||
=+ sam=[eny ova fan]
|
=+ sam=[eny ova fan]
|
||||||
=+ raw=.*([-.gat [sam +>.gat]] -.gat)
|
=+ raw=.*([-.gat [sam +>.gat]] -.gat)
|
||||||
[[[~ %vega hap] ((list ovum) -.raw)] +.raw]
|
[[[~ %vega hap] ((list ovum) -.raw)] +.raw]
|
||||||
|
2011
arvo/zuse.hoon
2011
arvo/zuse.hoon
File diff suppressed because it is too large
Load Diff
@ -20,12 +20,12 @@
|
|||||||
=+ all=.*(0 ken)
|
=+ all=.*(0 ken)
|
||||||
=+ ^= vay ^- (list ,[p=@tas q=@tas])
|
=+ ^= vay ^- (list ,[p=@tas q=@tas])
|
||||||
:~ [%$ %zuse]
|
:~ [%$ %zuse]
|
||||||
|
[%f %ford]
|
||||||
[%a %ames]
|
[%a %ames]
|
||||||
[%b %batz]
|
[%b %batz]
|
||||||
[%c %clay]
|
[%c %clay]
|
||||||
[%d %dill]
|
[%d %dill]
|
||||||
[%e %eyre]
|
[%e %eyre]
|
||||||
[%f %ford]
|
|
||||||
[%g %gall]
|
[%g %gall]
|
||||||
==
|
==
|
||||||
|- ^+ all
|
|- ^+ all
|
||||||
|
36
main/doc/synth/down.hood
Normal file
36
main/doc/synth/down.hood
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/? 314
|
||||||
|
!:
|
||||||
|
:::::: /hoon/down/synth/doc
|
||||||
|
::
|
||||||
|
=>
|
||||||
|
:::::: models
|
||||||
|
|%
|
||||||
|
++ down
|
||||||
|
$& [p=down q=down]
|
||||||
|
$% [%$ p=tape]
|
||||||
|
[%code p=tape]
|
||||||
|
[%inco p=tape]
|
||||||
|
[%head p=@ud q=down]
|
||||||
|
[%link p=tape q=tape r=(unit tape)]
|
||||||
|
[%lord p=(list down)]
|
||||||
|
[%lund p=(list down)]
|
||||||
|
[%parg p=down]
|
||||||
|
[%quot p=down]
|
||||||
|
[%rong p=down]
|
||||||
|
[%emph p=down]
|
||||||
|
[%hrul ~]
|
||||||
|
[%html p=tape]
|
||||||
|
==
|
||||||
|
--
|
||||||
|
:::::: generator
|
||||||
|
::
|
||||||
|
~& [%hood-at %]
|
||||||
|
%- (fest /synth/doc %)
|
||||||
|
|= pic=epic
|
||||||
|
=+ unt=|=(a=cord (biff (~(get by qix.pic) a) |=(b=cord (slaw %ud b))))
|
||||||
|
=+ moo=(both (unt %foo) (unt %bar))
|
||||||
|
?~ moo [%$ "Hoop, world: usage: url?foo=x&bar=y"]
|
||||||
|
:* [%$ "Hoop, "]
|
||||||
|
[%emph %$ "world"]
|
||||||
|
[%$ ": {<-.u.moo>} plus {<+.u.moo>} is {<(add u.moo)>}."]
|
||||||
|
==
|
@ -1,10 +1,7 @@
|
|||||||
!:
|
!:
|
||||||
:::::: /hook/down/synth/doc
|
:::::: /hook/down/synth/doc
|
||||||
::
|
::
|
||||||
~& [%down-hook %path %]
|
|
||||||
%- (folk /down/synth/doc %)
|
%- (folk /down/synth/doc %)
|
||||||
|= [bem=beam but=path]
|
|= [bem=beam but=path]
|
||||||
~& [%down-hook-beam s.bem]
|
|
||||||
~& [%down-hook-butt but]
|
|
||||||
:+ %ride [%reef ~]
|
:+ %ride [%reef ~]
|
||||||
[%drag bem but]
|
[%drag bem but]
|
||||||
|
@ -23,14 +23,13 @@
|
|||||||
--
|
--
|
||||||
:::::: generator
|
:::::: generator
|
||||||
::
|
::
|
||||||
~& [%down-hoon %path %]
|
~& [%choon-at %]
|
||||||
%- (fest /synth/doc %)
|
%- (fest /synth/doc %)
|
||||||
|= pic=epic
|
|= pic=epic
|
||||||
~& [%down-hook-butt but.pic]
|
|
||||||
=+ unt=|=(a=cord (biff (~(get by qix.pic) a) |=(b=cord (slaw %ud b))))
|
=+ unt=|=(a=cord (biff (~(get by qix.pic) a) |=(b=cord (slaw %ud b))))
|
||||||
=+ moo=(both (unt %foo) (unt %bar))
|
=+ moo=(both (unt %foo) (unt %bar))
|
||||||
?~ moo [%$ "Hello, world: usage: url?foo=x&bar=y"]
|
?~ moo [%$ "Hm, world: usage: url?foo=x&bar=y"]
|
||||||
:* [%$ "Hello, "]
|
:* [%$ "Hm, "]
|
||||||
[%emph %$ "world"]
|
[%emph %$ "world"]
|
||||||
[%$ ": {<-.u.moo>} plus {<+.u.moo>} is {<(add u.moo)>}."]
|
[%$ ": {<-.u.moo>} plus {<+.u.moo>} is {<(add u.moo)>}."]
|
||||||
==
|
==
|
||||||
|
298
main/lib/urb.js
298
main/lib/urb.js
@ -1,113 +1,185 @@
|
|||||||
window.urb = {
|
window.urb = {
|
||||||
ship: ship,
|
ship: ship,
|
||||||
port: port,
|
port: port,
|
||||||
auto: auto,
|
auto: auto,
|
||||||
oryx: oryx,
|
oryx: oryx,
|
||||||
user: user,
|
user: user,
|
||||||
appl: appl,
|
seqn_h: 0,
|
||||||
seqn: 0,
|
seqn_u: 0,
|
||||||
seqp: 1,
|
seqn_s: 0,
|
||||||
seqs: 3,
|
dely: 0,
|
||||||
dely: 0,
|
puls: 0,
|
||||||
|
perms: {
|
||||||
req: function(method,url,data,json,cb) {
|
pol:"gie",
|
||||||
var xhr = new XMLHttpRequest()
|
sub:"tis",
|
||||||
xhr.open(method.toUpperCase(), url)
|
uns:"tiu",
|
||||||
if(json)
|
mes:"tim",
|
||||||
xhr.setRequestHeader("content-type", "text/json")
|
heb:"tih"
|
||||||
if(data)
|
},
|
||||||
xhr.send(JSON.stringify({oryx: oryx, xyro: data}))
|
cabs: {},
|
||||||
else
|
|
||||||
xhr.send({oryx: oryx})
|
req: function(method,url,params,json,cb) {
|
||||||
if(cb) {
|
var xhr = new XMLHttpRequest()
|
||||||
xhr.onload = function() {
|
xhr.open(method.toUpperCase(), url)
|
||||||
cb(null,{
|
if(json)
|
||||||
"status":this.status,
|
xhr.setRequestHeader("content-type", "text/json")
|
||||||
"data":JSON.parse(this.responseText)
|
|
||||||
})
|
_data = {}
|
||||||
}
|
if(params.data) { _data.data = params.data; }
|
||||||
xhr.onerror = function() {
|
if(params.ship) { _data.ship = params.ship; }
|
||||||
cb({
|
if(params.path) { _data.path = params.path; }
|
||||||
"status":this.status,
|
if(params.appl) { _data.appl = params.appl; }
|
||||||
"data":this.responseText
|
__data = {oryx: oryx, xyro: _data}
|
||||||
})
|
xhr.send(JSON.stringify(__data))
|
||||||
}
|
|
||||||
}
|
if(cb) {
|
||||||
},
|
xhr.onload = function() {
|
||||||
|
cb(null,{
|
||||||
subscribe: function(path,cb) {
|
"status":this.status,
|
||||||
if(!cb)
|
"data":JSON.parse(this.responseText)
|
||||||
throw new Error("You must supply a callback to urb.subscribe.")
|
})
|
||||||
|
}
|
||||||
var method, perm, url, $this
|
xhr.onerror = function() {
|
||||||
|
cb({
|
||||||
method = "put"
|
"status":this.status,
|
||||||
perm = "tis"
|
"data":this.responseText
|
||||||
url = [perm,this.user,this.appl,this.port]
|
})
|
||||||
if(path) {
|
}
|
||||||
url.push(this.seqs)
|
}
|
||||||
url.push(path)
|
},
|
||||||
}
|
|
||||||
console.log(url)
|
send: function(params,cb) {
|
||||||
url = "/"+url.join("/")
|
if(!params)
|
||||||
|
throw new Error("You must supply params to urb.send.")
|
||||||
|
if(!params.appl)
|
||||||
$this = this
|
throw new Error("You must specify an appl for urb.send.")
|
||||||
this.req(method,url,{},true,function(err,data) {
|
if(!params.data) { params.data = {}; }
|
||||||
cb.apply(this,arguments)
|
|
||||||
if(!err) { $this.poll($this.seqs++,cb); }
|
var method, perm, url, $this
|
||||||
})
|
|
||||||
},
|
type = params.type ? params.type : "mes"
|
||||||
|
perm = this.perms[type]
|
||||||
send: function(data,cb) {
|
|
||||||
if(!data) { data = {}; }
|
params.ship = params.ship ? params.ship : this.ship
|
||||||
if(!cb) { cb = function() {}; }
|
|
||||||
|
method = "put"
|
||||||
var method, perm, url, $this
|
url = [perm,this.user,this.port,this.seqn_s]
|
||||||
|
url = "/"+url.join("/")
|
||||||
method = "put"
|
|
||||||
perm = "tim"
|
this.seqn_s++
|
||||||
url = [perm,this.user,this.appl,this.port,this.seqn]
|
|
||||||
url = "/"+url.join("/")
|
$this = this
|
||||||
|
this.req(method,url,params,true,function(err,data) {
|
||||||
this.seqn++
|
if(err) { $this.seqn_s--; }
|
||||||
|
if(cb) { cb.apply(this,arguments); }
|
||||||
$this = this
|
})
|
||||||
this.req(method,url,data,true,function(err,data) {
|
},
|
||||||
if(err) { $this.seqn--; }
|
|
||||||
cb.apply(this,arguments)
|
subscribe: function(appl,path,ship,cb) {
|
||||||
})
|
if(!cb)
|
||||||
},
|
throw new Error("You must supply a callback to urb.subscribe.")
|
||||||
|
|
||||||
poll: function(stream,cb) {
|
var method, perm, url, $this
|
||||||
if(!stream)
|
|
||||||
throw new Error("You must supply a stream to urb.poll.")
|
ship = ship ? ship : this.ship
|
||||||
if(!cb)
|
|
||||||
throw new Error("You must supply a callback to urb.poll.")
|
method = "get"
|
||||||
|
params = {
|
||||||
var method, perm, url, $this
|
type:"sub",
|
||||||
|
appl:appl,
|
||||||
method = "get"
|
path:path,
|
||||||
perm = "gie"
|
ship:ship,
|
||||||
if(!stream) { return false; }
|
incs:function() {
|
||||||
url = [perm,this.user,this.appl,this.port,stream,this.seqp]
|
window.urb.seqn_u++
|
||||||
url = "/"+url.join("/")
|
}
|
||||||
console.log(url)
|
}
|
||||||
|
|
||||||
$this = this
|
this.cabs[appl+","+path.replace(/[^\x00-\x7F]/g, "")+","+ship] = cb
|
||||||
this.req(method,url,null,false,function(err,data) {
|
|
||||||
if(cb.apply(this,arguments) === false) { return; }
|
type = params.type ? params.type : "mes"
|
||||||
|
perm = this.perms[type]
|
||||||
if(err)
|
method = "put"
|
||||||
$this.dely += 1000
|
url = [perm,this.user,this.port]
|
||||||
else {
|
url = "/"+url.join("/")
|
||||||
$this.dely = 0
|
|
||||||
$this.seqp++
|
$this = this
|
||||||
}
|
this.req(method,url,params,true,function(err,data) {
|
||||||
|
if(cb) { cb.call(this,err,{status: data.status, data: data.data.data})}
|
||||||
setTimeout(function() {
|
if(!err && $this.puls == 0) {
|
||||||
$this.poll(stream,cb)
|
params.type = "pol"
|
||||||
},$this.dely)
|
$this.poll(params)
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
}
|
},
|
||||||
|
|
||||||
|
unsubscribe: function(appl,path,ship,cb) {
|
||||||
|
method = "put"
|
||||||
|
type = "uns"
|
||||||
|
perm = this.perms[type]
|
||||||
|
url = [perm,this.user,this.port]
|
||||||
|
url = "/"+url.join("/")
|
||||||
|
|
||||||
|
params = {
|
||||||
|
appl: appl,
|
||||||
|
path: path,
|
||||||
|
ship: ship
|
||||||
|
}
|
||||||
|
|
||||||
|
var $this = this
|
||||||
|
this.req(method,url,params,true,function(err,data) {
|
||||||
|
console.log('ok unsubscribed')
|
||||||
|
fn = appl+","+path.replace(/[^\x00-\x7F]/g, "")+","+ship
|
||||||
|
$this.cabs[fn]('subscription closed')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
heartbeat: function() {
|
||||||
|
this.poll({
|
||||||
|
type:"heb",
|
||||||
|
ship:this.ship,
|
||||||
|
incs:function() {
|
||||||
|
window.urb.seqn_h++
|
||||||
|
}
|
||||||
|
},function() {
|
||||||
|
console.log('heartbeat.')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
poll: function(params,cb) {
|
||||||
|
if(!params)
|
||||||
|
throw new Error("You must supply params to urb.poll.")
|
||||||
|
|
||||||
|
var method, perm, url, $this
|
||||||
|
|
||||||
|
method = "get"
|
||||||
|
type = params.type ? params.type : "pol"
|
||||||
|
perm = this.perms[type]
|
||||||
|
url = [perm,this.user,this.port,this.seqn_u]
|
||||||
|
url = "/"+url.join("/")
|
||||||
|
|
||||||
|
this.puls = 1
|
||||||
|
|
||||||
|
$this = this
|
||||||
|
this.req(method,url,params,false,function(err,data) {
|
||||||
|
if(cb) {
|
||||||
|
cb.call(this,err,{status: data.status, data: data.data.data})
|
||||||
|
} else {
|
||||||
|
fn = data.data.appl+","+data.data.path.replace(/[^\x00-\x7F]/g, "")
|
||||||
|
+","+data.data.ship
|
||||||
|
$this.cabs[fn].call(this,err,
|
||||||
|
{status: data.status, data: data.data.data})
|
||||||
|
}
|
||||||
|
|
||||||
|
if(err)
|
||||||
|
$this.dely += 1000
|
||||||
|
else {
|
||||||
|
$this.dely = 0
|
||||||
|
params.incs()
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
$this.poll(params,cb)
|
||||||
|
},$this.dely)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user