mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-03 14:37:05 +03:00
Merge nextbreach into soqdoqblok
This commit is contained in:
commit
766afec656
@ -1,4 +1,4 @@
|
||||
!:
|
||||
::
|
||||
:: dill (4d), terminal handling
|
||||
::
|
||||
|= pit=vase
|
||||
|
112
arvo/eyre.hoon
112
arvo/eyre.hoon
@ -4,6 +4,7 @@
|
||||
|= pit=vase
|
||||
=> =~
|
||||
|% :: interfaces
|
||||
++ bead ,[p=(set beam) q=cage] :: computed result
|
||||
++ chop ,[p=@ud q=@da] :: see
|
||||
++ gift :: out result <-$
|
||||
$% [%thou p=httr] :: raw http response
|
||||
@ -41,9 +42,10 @@
|
||||
++ riff ,[p=desk q=(unit rave)] :: see %clay
|
||||
++ sign :: in result $-<
|
||||
$% [%crud p=@tas q=(list tank)] :: by any
|
||||
[%dumb p=chop] :: by %gall
|
||||
[%helo p=path q=prod] :: by %batz
|
||||
[%made p=(each bead (list tank))] :: by %ford
|
||||
[%rasp p=cage] :: by %gall
|
||||
[%rasp p=chop q=(unit cage)] :: by %gall
|
||||
[%rush p=chop q=cage] :: by %gall
|
||||
[%rust p=chop q=cage] :: by %gall
|
||||
[%talk p=tank] :: by %batz
|
||||
@ -141,7 +143,7 @@
|
||||
$: cnt=@ud :: updates produced
|
||||
toy=@ud :: updates sent
|
||||
wan=(map ,@ud ,@ud) :: upno to reqno
|
||||
red=(map ,@ud (each cage cage)) :: ready for pickup
|
||||
red=(map ,@ud (unit (each cage cage))) :: ready for pickup
|
||||
== ::
|
||||
-- ::
|
||||
|%
|
||||
@ -209,8 +211,8 @@
|
||||
?+ -.luv luv
|
||||
%mid
|
||||
=+ str=(trip q.q.luv)
|
||||
=+ scr=|-(^-(tape ?~(mog "<head>" (xmlt & i.mog $(mog t.mog)))))
|
||||
=+ rep=(need (repg "<head>" str scr))
|
||||
=+ scr=|-(^-(tape ?~(mog ~ (xmlt & i.mog $(mog t.mog)))))
|
||||
=+ rep=(need (repg "<head>" str (weld "<head>" scr)))
|
||||
[%mid p.luv (tact rep)]
|
||||
==
|
||||
++ lofe :: variables in head
|
||||
@ -279,6 +281,15 @@
|
||||
?- -.sin
|
||||
%crud
|
||||
+>.$(mow [[hen %slip %d %flog sin] mow])
|
||||
::
|
||||
%dumb
|
||||
?> ?=([%hoop @ @ @ @ ~] tea)
|
||||
=+ ^= ouy
|
||||
%- yolk:(gale (need (slaw %p i.t.tea)) i.t.t.tea)
|
||||
(need (slaw %ud i.t.t.t.tea))
|
||||
?~ ouy
|
||||
+>.$
|
||||
abet:work:abet:dumb:(yule:u.ouy i.t.t.t.t.tea)
|
||||
::
|
||||
%made
|
||||
?. ?=([%honk @ @ @ ~] tea)
|
||||
@ -293,7 +304,11 @@
|
||||
(need (slaw %ud i.t.t.t.tea))
|
||||
?~ ouy
|
||||
+>.$
|
||||
abet:work:abet:abet:(hear:(yule:u.ouy i.t.t.t.t.tea) %& p.sin)
|
||||
=+ woy=(yule:u.ouy i.t.t.t.t.tea)
|
||||
=< abet =< work =< abet
|
||||
?~ q.sin
|
||||
dumb:woy
|
||||
(hear:woy `[%& u.q.sin])
|
||||
::
|
||||
?(%rush %rust)
|
||||
=+ heq=?:(?=(%rust -.sin) [%& q.sin] [%| q.sin])
|
||||
@ -303,7 +318,7 @@
|
||||
(need (slaw %ud i.t.t.t.tea))
|
||||
?~ ouy
|
||||
+>.$
|
||||
abet:work:abet:abet:(hear:(yule:u.ouy i.t.t.t.t.tea) heq)
|
||||
abet:work:abet:(hear:(yule:u.ouy i.t.t.t.t.tea) `heq)
|
||||
::
|
||||
%thou :: remote return
|
||||
?> ?=([@ @ *] tea)
|
||||
@ -1013,13 +1028,13 @@
|
||||
++ fapg :: dispatch %apg
|
||||
|= [fur=(unit term) you=@p paw=path]
|
||||
^- (unit seam)
|
||||
?> ?=(^ fur)
|
||||
=+ for=?^(fur u.fur %html)
|
||||
?> ?=(^ paw)
|
||||
:- ~
|
||||
:* %apg
|
||||
(need ((sand %tas) i.paw))
|
||||
you
|
||||
u.fur
|
||||
for
|
||||
(turn t.paw |=(a=@ `@ta`(need ((sand %ta) a))))
|
||||
==
|
||||
::
|
||||
@ -1337,13 +1352,22 @@
|
||||
+>.$(..ya (hone our num ses))
|
||||
+>.$
|
||||
::
|
||||
++ busc :: seam result code
|
||||
|= som=seam
|
||||
^- @ud
|
||||
?.(?=(%sil -.som) 200 p.som) :: 203 means a diff
|
||||
++ bush :: error response
|
||||
|= [cod=@ud msg=@t num=@ud]
|
||||
^+ +>
|
||||
=+ pup=(~(get by q.rey) num)
|
||||
?~ pup +>.$
|
||||
%= +>.$
|
||||
q.rey
|
||||
%+ ~(put by q.rey) num
|
||||
%= u.pup
|
||||
pez
|
||||
`pest`[%fin %raw cod ~[content-type/'text/plain'] `(taco msg)]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ bust
|
||||
|= num=@ud
|
||||
++ bust :: no-content response
|
||||
|= [cod=@ud num=@ud]
|
||||
^+ +>
|
||||
=+ pup=(~(get by q.rey) num)
|
||||
?~ pup +>.$
|
||||
@ -1351,7 +1375,7 @@
|
||||
%= +>.$
|
||||
q.rey
|
||||
%+ ~(put by q.rey) num
|
||||
u.pup(pez [%fin %raw 204 *mess `*octs])
|
||||
u.pup(pez [%fin %raw cod *mess `*octs])
|
||||
==
|
||||
::
|
||||
++ inch :: function built
|
||||
@ -1846,8 +1870,8 @@
|
||||
|= [num=@ud app=term you=ship nap=@ud suc=term cnt=@ud]
|
||||
^+ +>
|
||||
=+ yon=(yolk nap)
|
||||
?~ yon (bust num)
|
||||
abet:abet:(hire:(yule:u.yon suc) cnt num)
|
||||
?~ yon (bust 204 num)
|
||||
abet:(hire:(yule:u.yon suc) cnt num)
|
||||
::
|
||||
++ yokg :: main call
|
||||
|= [num=@ud app=term you=ship pax=path]
|
||||
@ -1859,13 +1883,13 @@
|
||||
|= [num=@ud app=term you=ship nap=@ud cnt=@ud jon=json]
|
||||
^+ +>
|
||||
=+ yon=(yolk nap)
|
||||
?~ yon (bust num)
|
||||
?~ yon (bust 204 num)
|
||||
abet:(post:u.yon cnt num jon)
|
||||
::
|
||||
++ yoks :: subscribe
|
||||
|= [num=@ud app=term you=ship nap=@ud suc=term pax=path]
|
||||
=+ yon=(yolk nap)
|
||||
?~ yon (bust num)
|
||||
?~ yon (bust 204 num)
|
||||
abet:(scud:u.yon suc num pax)
|
||||
::
|
||||
++ yoku :: unsubscribe
|
||||
@ -1918,18 +1942,18 @@
|
||||
%post
|
||||
`note`[%mess [our app] you [%json !>(jon)]]
|
||||
?. =(+(cnt) meg.siq)
|
||||
+>.$(..yo (bust num))
|
||||
abet:(hire:(yule %post) cnt num)
|
||||
+>.$(..yo (bust 204 num))
|
||||
(hire:(yule %post) cnt num)
|
||||
::
|
||||
++ scud :: subscribe
|
||||
|= [suc=term num=@ud pax=path]
|
||||
=. +>.$ (toss suc `note`[%show [our app] you pax])
|
||||
abet:(hire:(yule suc) 0 num)
|
||||
(hire:(yule suc) 0 num)
|
||||
::
|
||||
++ self :: request main
|
||||
|= pax=path
|
||||
^+ +>
|
||||
abet:(hire:(yule:(toss %self [%show [our app] you pax]) %self) 0 nap)
|
||||
(hire:(yule:(toss %self [%show [our app] you pax]) %self) 0 nap)
|
||||
::
|
||||
++ toss :: toss to gall
|
||||
|= [suc=term noh=note]
|
||||
@ -1951,7 +1975,7 @@
|
||||
++ busk :: seam result
|
||||
|= $: num=@ud
|
||||
cnt=@ud
|
||||
heq=(each cage cage)
|
||||
huq=(unit (each cage cage))
|
||||
==
|
||||
^+ +>
|
||||
=+ pup=(~(get by q.rey) num)
|
||||
@ -1980,19 +2004,28 @@
|
||||
suc
|
||||
(rsh 3 2 (scot %ui +(cnt)))
|
||||
==
|
||||
?~ huq +>.$(..yo (bust 404 num))
|
||||
%= +>.$
|
||||
q.rey
|
||||
%+ ~(put by q.rey) num
|
||||
^- pimp
|
||||
%= pip
|
||||
pez %new
|
||||
vaz [%instance (trip (rsh 3 2 (scot %ui nap)))]~
|
||||
vaz :~ [%ship :(weld "\"" (trip (rsh 3 1 (scot %p our))) "\"")]
|
||||
[%port (trip (rsh 3 2 (scot %ui nap)))]
|
||||
[%auto "true"]
|
||||
[%oryx "oryx"]
|
||||
:- %user
|
||||
:: ?: =(our you)
|
||||
:: "null"
|
||||
:(weld "\"" (trip (rsh 3 1 (scot %p you))) "\"")
|
||||
==
|
||||
sip sip
|
||||
som ^- seam
|
||||
:+ %sil
|
||||
?:(-.heq 200 203)
|
||||
?:(-.u.huq 200 203)
|
||||
=+ bek=`beak`[our %main [%da now]]
|
||||
=+ don=`silk`[%done ~ `cage`p.heq]
|
||||
=+ don=`silk`[%done ~ `cage`p.u.huq]
|
||||
^- silk
|
||||
:^ %cast %mime bek
|
||||
?~ fur.pip don
|
||||
@ -2000,9 +2033,17 @@
|
||||
==
|
||||
==
|
||||
::
|
||||
++ dumb :: reset
|
||||
^+ ..yu
|
||||
=+ dum=(~(tap by wan.wig) ~)
|
||||
|- ^+ ..yu
|
||||
?~ dum amok
|
||||
$(dum t.dum, ..yo (bust 404 q.i.dum))
|
||||
::
|
||||
++ hear :: produce
|
||||
|= heq=(each cage cage)
|
||||
^+ +>
|
||||
|= huq=(unit (each cage cage))
|
||||
^+ ..yu
|
||||
=< abet
|
||||
=+ cnt=cnt.wig
|
||||
=+ dul=(~(get by wan.wig) cnt)
|
||||
:: ~& :~ %yu-hear
|
||||
@ -2012,13 +2053,14 @@
|
||||
:: ==
|
||||
=: cnt.wig +(cnt.wig)
|
||||
wan.wig ?~(dul wan.wig (~(del by wan.wig) cnt.wig))
|
||||
red.wig (~(put by red.wig) cnt.wig heq)
|
||||
red.wig (~(put by red.wig) cnt.wig huq)
|
||||
==
|
||||
?~(dul +>.$ (busk u.dul cnt heq))
|
||||
?~(dul +>.$ (busk u.dul cnt huq))
|
||||
::
|
||||
++ hire :: consume
|
||||
|= [cnt=@ud num=@ud]
|
||||
^+ +>
|
||||
^+ ..yu
|
||||
=< abet
|
||||
:: ~& :~ %yu-hire
|
||||
:: [%instance nap]
|
||||
:: [%produced cnt.wig]
|
||||
@ -2028,16 +2070,16 @@
|
||||
:: ==
|
||||
?: |((lth +(cnt) toy.wig) (gth cnt toy.wig))
|
||||
~& [%hire-improper [%request cnt] [%dispatched toy.wig]]
|
||||
+>.$(..yo (bust num))
|
||||
+>.$(..yo (bust 204 num))
|
||||
?: (gte cnt cnt.wig)
|
||||
:: ~& %hire-wait
|
||||
=+ old=(~(get by wan.wig) cnt)
|
||||
=. wan.wig (~(put by wan.wig) cnt num)
|
||||
+>.$(..yo ?~(old ..yo (bust u.old)))
|
||||
+>.$(..yo ?~(old ..yo (bust 204 u.old)))
|
||||
=+ rud=(~(get by red.wig) cnt)
|
||||
?~ rud
|
||||
:: ~& %hire-bust
|
||||
+>.$(..yo (bust num))
|
||||
+>.$(..yo (bust 204 num))
|
||||
:: ~& %hire-send
|
||||
(busk num cnt u.rud)
|
||||
--
|
||||
|
@ -5,6 +5,7 @@
|
||||
=> =~
|
||||
:: structures
|
||||
|%
|
||||
++ bead ,[p=(set beam) q=cage] :: computed result
|
||||
++ gift :: out result <-$
|
||||
$% [%made p=(each bead (list tank))] :: computed result
|
||||
== ::
|
||||
@ -591,9 +592,14 @@
|
||||
(fine cof [p.kas vax])
|
||||
::
|
||||
%done [cof %0 p.kas q.kas]
|
||||
%dune
|
||||
?~ q.kas (flaw cof [%leaf "not ready"]~)
|
||||
[cof %0 p.kas u.q.kas]
|
||||
%dude
|
||||
=+ dog=$(kas q.kas)
|
||||
?. ?=(%2 -.q.dog) dog
|
||||
dog(p.q [p.kas p.q.dog])
|
||||
::
|
||||
%dune
|
||||
?~ q.kas [cof [%2 [%leaf "no data"]~]]
|
||||
$(kas [%done p.kas u.q.kas])
|
||||
::
|
||||
%mute (kale cof p.kas q.kas)
|
||||
%pass
|
||||
|
360
arvo/gall.hoon
360
arvo/gall.hoon
@ -8,17 +8,17 @@
|
||||
$: %0 :: state version
|
||||
pol=(map ship mast) :: apps by ship
|
||||
== ::
|
||||
++ bead ,[p=(set beam) q=cage] :: computed result
|
||||
++ bone ,@ud :: opaque duct
|
||||
++ chop ,[p=@ud q=@da] :: revision/date
|
||||
++ gift :: out result <-$
|
||||
$% [%back p=?] :: %mess ack good/bad
|
||||
[%crud p=@tas q=(list tank)] :: error
|
||||
[%rasp p=cage] :: reaction message
|
||||
[%rump p=chop] :: updates stop
|
||||
[%crud p=@tas q=(list tank)] :: physical error
|
||||
[%dumb p=chop] :: close duct
|
||||
[%rasp p=chop q=(unit cage)] :: reaction message
|
||||
[%rush p=chop q=cage] :: difference
|
||||
[%rust p=chop q=cage] :: full update
|
||||
[%meta p=vase] :: meta-gift
|
||||
|
||||
== ::
|
||||
++ hasp ,[p=ship q=term] :: app identity
|
||||
++ kiss :: in request ->$
|
||||
@ -29,8 +29,9 @@
|
||||
[%nuke p=hasp] :: clear duct
|
||||
== ::
|
||||
++ knob :: pending action
|
||||
$% [%boot ~] :: boot/reboot
|
||||
$% [%boot ~] :: begin boot
|
||||
[%crud p=@tas q=(list tank)] :: error
|
||||
[%load p=cage] :: continue boot
|
||||
[%mess p=ship q=cage] :: message
|
||||
[%show p=ship q=path] :: subscribe
|
||||
[%nuke ~] :: clear duct
|
||||
@ -60,12 +61,15 @@
|
||||
++ seat :: the living app
|
||||
$: huv=(unit vase) :: application vase
|
||||
qic=(unit toil) :: current project
|
||||
oot=(map duct (set path)) :: live fords
|
||||
onz=(unit (pair duct path)) :: live fords
|
||||
vey=(qeu toil) :: pending projects
|
||||
nuc=(set duct) :: nuked ducts
|
||||
tik=@ud :: build number
|
||||
act=@ud :: action number
|
||||
lat=@da :: last change
|
||||
orm=(unit ,@da) :: build date
|
||||
sup=(map bone (pair ship path)) :: subscribers
|
||||
peq=(map bone ,@uvI) :: peekers
|
||||
ped=(set (pair ship desk)) :: active depends
|
||||
zam=scar :: opaque ducts
|
||||
== ::
|
||||
@ -345,7 +349,7 @@
|
||||
^- silk
|
||||
[%done ~ cay]
|
||||
::
|
||||
++ deal :: advance tick
|
||||
++ deal :: reboot
|
||||
^+ .
|
||||
=. tik.sat +(tik.sat)
|
||||
=+ pys=(~(tap by sup.sat) ~)
|
||||
@ -371,7 +375,7 @@
|
||||
|=(a=(pair ship desk) (~(has in ped.sat) a))
|
||||
|= a=(pair ship desk)
|
||||
:- hun.mat
|
||||
:^ %toss %c (away %s %drug (scot %p p.a) q.a ~)
|
||||
:^ %toss %c (away %w %drug (scot %p p.a) q.a ~)
|
||||
[%warp [our p.a] q.a ~ %| [%da now] [%da (add now ~d1000)]]
|
||||
=+ ^= old ^- (list move)
|
||||
%+ turn
|
||||
@ -379,7 +383,7 @@
|
||||
|=(a=(pair ship desk) (~(has in pen) a))
|
||||
|= a=(pair ship desk)
|
||||
:- hun.mat
|
||||
:^ %toss %c (away %s %drug (scot %p p.a) q.a ~)
|
||||
:^ %toss %c (away %w %drug (scot %p p.a) q.a ~)
|
||||
[%warp [our p.a] q.a ~]
|
||||
%_(+>.$ ped.sat pen, mow :(weld new old mow))
|
||||
::
|
||||
@ -398,29 +402,16 @@
|
||||
::
|
||||
++ ford :: exec to ford
|
||||
|= [pax=path kas=silk]
|
||||
(gawk %f [%s pax] [%exec our `kas])
|
||||
::
|
||||
++ gawk :: toss a note
|
||||
|= [lal=term pax=path noy=note]
|
||||
^+ +>
|
||||
%_ +>
|
||||
mow [[hen %toss lal (away pax) noy] mow]
|
||||
oot.sat =+ vut=(~(get by oot.sat) hen)
|
||||
=+ vit=?^(vut u.vut *(set path))
|
||||
?< (~(has in vit) pax)
|
||||
(~(put by oot.sat) hen (~(put in vit) pax))
|
||||
mow :_(mow [hen %toss %f (away pax) [%exec our `kas]])
|
||||
onz.sat `[hen pax]
|
||||
==
|
||||
::
|
||||
++ give :: give a gift
|
||||
|= gip=gift
|
||||
%_(+> mow [[hen %give gip] mow])
|
||||
::
|
||||
++ gone %_(. qic.sat ~) :: done work
|
||||
++ game :: invoke core
|
||||
|= [[arm=term pax=path] vax=vase sam=vase]
|
||||
%+ ford pax
|
||||
[%call (harm arm (conf (core vax))) (cove %$ sam)]
|
||||
::
|
||||
++ harm :: arm as silk
|
||||
|= [arm=term kas=silk]
|
||||
^- silk
|
||||
@ -431,23 +422,112 @@
|
||||
:+ %boil %core
|
||||
[[our %main [%da now]] app %app ~]
|
||||
::
|
||||
++ mack :: apply standard
|
||||
|= qin=sign
|
||||
?> ?=(%made -.qin)
|
||||
^- [(unit (list tank)) _+>]
|
||||
?- -.p.qin
|
||||
& :- ~
|
||||
%- obey:(morn (slot 3 q.q.p.p.qin))
|
||||
(slot 2 q.q.p.p.qin)
|
||||
| [`p.p.qin (give %crud %made p.p.qin)]
|
||||
==
|
||||
::
|
||||
++ meek :: apply peek
|
||||
|= qin=sign
|
||||
^- [(unit cage) _+>]
|
||||
?> ?=(%made -.qin)
|
||||
?- -.p.qin
|
||||
& =+ vax=`vase`q.q.p.p.qin
|
||||
?. &(?=(^ q.vax) ?=(@ -.q.vax))
|
||||
[~ (give %crud %peek-lame *(list tank))]
|
||||
:- `[((hard logo) -.q.vax) (slot 3 vax)]
|
||||
+>.$
|
||||
| [~ (give %crud %made p.p.qin)]
|
||||
==
|
||||
::
|
||||
++ mick :: apply w/depends
|
||||
|= qin=sign
|
||||
?> ?=(%made -.qin)
|
||||
^- [(unit (set beam)) _+>]
|
||||
?- -.p.qin
|
||||
& :- `p.p.p.qin
|
||||
%- obey:(morn (slot 3 q.q.p.p.qin))
|
||||
(slot 2 q.q.p.p.qin)
|
||||
| [~ (give %crud %made p.p.qin)]
|
||||
==
|
||||
::
|
||||
++ murk :: apply park
|
||||
|= qin=sign
|
||||
^- [(unit cage) _+>]
|
||||
?> ?=(%made -.qin)
|
||||
?- -.p.qin
|
||||
& [`q.p.p.qin +>.$]
|
||||
| [~ (give %crud %made p.p.qin)]
|
||||
==
|
||||
::
|
||||
++ more :: accept result
|
||||
|= $: pax=path :: internal position
|
||||
hin=(hypo sign) :: typed event
|
||||
==
|
||||
^+ +>
|
||||
:: ~& [%more pax -.q.hin]
|
||||
=. oot.sat
|
||||
?: ?=([%s %drug *] pax) oot.sat
|
||||
=+ vut=(~(get by oot.sat) hen)
|
||||
?~ vut
|
||||
~& [%more-lost-a our app hen] !!
|
||||
?. (~(has in u.vut) pax)
|
||||
~& [%more-lost our app hen pax] !!
|
||||
?: =(~ u.vut)
|
||||
(~(del by oot.sat) hen)
|
||||
(~(put by oot.sat) hen (~(del in u.vut) pax))
|
||||
?: ?=([%u *] pax)
|
||||
?+ -.pax !!
|
||||
%s :: core operation
|
||||
?> ?& ?=([@ *] t.pax)
|
||||
!=(~ qic.sat)
|
||||
=(`[hen pax] onz.sat)
|
||||
==
|
||||
=: onz.sat ~
|
||||
qic.sat ~
|
||||
==
|
||||
?+ i.t.pax !!
|
||||
%park
|
||||
=^ gyd +>.$ (murk q.hin)
|
||||
?~ gyd
|
||||
+>.$
|
||||
(quen %load u.gyd)
|
||||
::
|
||||
%peek
|
||||
?> ?=([@ *] t.t.pax)
|
||||
=+ you=(need (slaw %p i.t.t.pax))
|
||||
=^ gyd +>.$ (meek q.hin)
|
||||
?~ gyd
|
||||
(give [%dumb [tik.sat lat.sat]])
|
||||
=+ kee=[you t.t.t.pax]
|
||||
=+ ash=(sham q.q.u.gyd)
|
||||
?: =(`ash (~(get by peq.sat) ost))
|
||||
+>.$
|
||||
%- %= give
|
||||
peq.sat (~(put by peq.sat) ost ash)
|
||||
sup.sat (~(put by sup.sat) ost kee)
|
||||
==
|
||||
[%rust [tik.sat lat.sat] u.gyd]
|
||||
::
|
||||
%peer
|
||||
?> ?=([@ *] t.t.pax)
|
||||
=+ you=(need (slaw %p i.t.t.pax))
|
||||
=^ gud +>.$ (mack q.hin)
|
||||
?^ gud
|
||||
(give [%dumb [tik.sat lat.sat]])
|
||||
+>.$(sup.sat (~(put by sup.sat) ost [you t.t.t.pax]))
|
||||
::
|
||||
%poke
|
||||
=^ gud +>.$ (mack q.hin)
|
||||
?^ gud (give %rasp [tik.sat lat.sat] ~)
|
||||
+>.$
|
||||
::
|
||||
%prep
|
||||
=^ gad +>.$ (mick q.hin)
|
||||
?~ gad (drum ~)
|
||||
deal:(drum u.gad)
|
||||
::
|
||||
%pull
|
||||
=^ gud +>.$ (mack q.hin)
|
||||
?^ gud +>.$
|
||||
+>.$(sup.sat (~(del by sup.sat) ost))
|
||||
==
|
||||
::
|
||||
%u :: user request
|
||||
?. ?=(%ruse -.q.hin)
|
||||
~& [%more-card -.q.hin pax] !!
|
||||
%_ +>.$
|
||||
@ -455,21 +535,11 @@
|
||||
%- ~(put to vey.sat)
|
||||
[hen [%take t.pax (spec (slot 3 hin))]]
|
||||
==
|
||||
?> ?=([%s @ *] pax)
|
||||
?+ i.t.pax !!
|
||||
%boot
|
||||
?> ?=([~ * %boot ~] qic.sat)
|
||||
?> ?=(%made -.q.hin)
|
||||
?- -.p.q.hin
|
||||
& ~& [%boot-good our app tik.sat]
|
||||
deal:(drum:(morn:gone q.q.p.p.q.hin) p.p.p.q.hin)
|
||||
| ~& [%boot-lost our app tik.sat]
|
||||
(drum:(mort:gone p.p.q.hin) ~)
|
||||
==
|
||||
::
|
||||
%drug
|
||||
?> ?=(%writ -.q.hin)
|
||||
?> ?=([@ @ ~] t.t.pax)
|
||||
%w :: autoboot
|
||||
?> ?& ?=([%drug @ @ ~] t.pax)
|
||||
?=(%writ -.q.hin)
|
||||
==
|
||||
=+ :* our=(need (slaw %p i.t.t.pax))
|
||||
syd=(need ((sand %tas) i.t.t.t.pax))
|
||||
==
|
||||
@ -477,66 +547,53 @@
|
||||
?~ p.q.hin
|
||||
+>.$
|
||||
+>.$(vey.sat (~(put to vey.sat) hen %boot ~))
|
||||
::
|
||||
%step
|
||||
?> ?=(%made -.q.hin)
|
||||
?- -.p.q.hin
|
||||
& :: ~& %step-good
|
||||
%- obey:(morn:gone (slot 3 q.q.p.p.q.hin))
|
||||
(slot 2 q.q.p.p.q.hin)
|
||||
| :: ~& %step-fail
|
||||
(give %crud %made p.p.q.hin)
|
||||
==
|
||||
::
|
||||
%show
|
||||
?> ?=(%made -.q.hin)
|
||||
?> ?=([@ *] t.t.pax)
|
||||
=+ you=(need (slaw %p i.t.t.pax))
|
||||
?- -.p.q.hin
|
||||
& =. sup.sat (~(put by sup.sat) ost you t.t.t.pax)
|
||||
%- obey:(morn:gone (slot 3 q.q.p.p.q.hin))
|
||||
(slot 2 q.q.p.p.q.hin)
|
||||
| :: ~& %step-fail
|
||||
(give %crud %made p.p.q.hin)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ morn :: successful boot
|
||||
++ morn :: install core
|
||||
|= vax=vase
|
||||
^+ +>
|
||||
%_(+> huv.sat `vax)
|
||||
=+ new=?~(huv.sat & !=(+>+.q.vax +>+.q.u.huv.sat))
|
||||
=. huv.sat `vax
|
||||
?. new +>.$
|
||||
=: act.sat +(act.sat)
|
||||
lat.sat now
|
||||
==
|
||||
=+ pex=(~(tap by peq.sat) ~)
|
||||
|- ^+ +>.^$
|
||||
?~ pex +>.^$
|
||||
~& [%morn-peek p.i.pex (need (~(get by sup.sat) p.i.pex))]
|
||||
%= $
|
||||
pex t.pex
|
||||
+>.^$ %- quem(hen (need (~(get by r.zam.sat) p.i.pex)))
|
||||
[%show (need (~(get by sup.sat) p.i.pex))]
|
||||
==
|
||||
::
|
||||
++ mort :: failed boot
|
||||
|= tan=(list tank)
|
||||
(give %crud %boot-lost tan)
|
||||
::
|
||||
++ nile [%done ~ [%$ [%cube 0 [%atom %n]] ~]] :: null silk
|
||||
++ obey :: process result
|
||||
++ obey :: process app moves
|
||||
|= vax=vase
|
||||
%_(+> mow (weld (flop (said vax)) mow))
|
||||
::
|
||||
++ quem :: queue action
|
||||
|= kon=knob :: content
|
||||
^+ +>
|
||||
?. ?=(%nuke -.kon)
|
||||
+>.$(vey.sat (~(put to vey.sat) hen kon))
|
||||
?: (~(has in nuc.sat) hen)
|
||||
~& [%quem-renuke hen]
|
||||
+>.$
|
||||
=+ vut=(~(get by oot.sat) hen)
|
||||
=+ ^= ded ^- (list path)
|
||||
?~(vut ~ (~(tap by u.vut) ~))
|
||||
|- ^+ +>.^$
|
||||
?~ ded
|
||||
%= +>.^$
|
||||
qic.sat ?.(&(?=(^ qic.sat) =(hen p.u.qic.sat)) qic.sat ~)
|
||||
nuc.sat (~(put in nuc.sat) hen)
|
||||
vey.sat (~(put to vey.sat) hen kon)
|
||||
==
|
||||
%= $
|
||||
ded t.ded
|
||||
mow [[hen [%toss %f (away i.ded) [%exec our ~]]] mow]
|
||||
==
|
||||
=. +> ?. ?=(%nuke -.kon) +>
|
||||
?. &(?=(^ onz.sat) =(hen p.u.onz.sat)) +>
|
||||
%= +>
|
||||
onz.sat ~
|
||||
mow
|
||||
:_(mow [hen %toss %f (away q.u.onz.sat) [%exec our ~]])
|
||||
==
|
||||
+>.$(vey.sat (~(put to vey.sat) hen kon))
|
||||
::
|
||||
++ quen :: push on front
|
||||
|= kon=knob
|
||||
^+ +>
|
||||
=+ yov=(~(tap by vey.sat) ~) :: XX ++pun
|
||||
+>.$(vey.sat (~(gas to *(qeu toil)) `_yov`[[hen kon] yov]))
|
||||
::
|
||||
++ said
|
||||
|= vud=vase
|
||||
@ -555,22 +612,25 @@
|
||||
|= vig=vase
|
||||
^- gift
|
||||
?+ q.vig [%meta vig]
|
||||
[%dumb *] [%dumb [tik.sat lat.sat]]
|
||||
[%rasp *]
|
||||
:+ %rasp
|
||||
((hard lode) +<.q.vig)
|
||||
(slot 7 vig)
|
||||
=+ sec=(spec (slot 3 vig))
|
||||
:+ %rasp [tik.sat lat.sat]
|
||||
:+ ~
|
||||
((hard logo) -.q.sec)
|
||||
(slot 3 sec)
|
||||
::
|
||||
[%rush *]
|
||||
:^ %rush
|
||||
[tik.sat now]
|
||||
((hard lode) +<.q.vig)
|
||||
(slot 7 vig)
|
||||
=+ sec=(spec (slot 3 vig))
|
||||
:+ %rush [tik.sat lat.sat]
|
||||
:- ((hard logo) -.q.sec)
|
||||
(slot 3 sec)
|
||||
::
|
||||
[%rust *]
|
||||
:^ %rust
|
||||
[tik.sat now]
|
||||
((hard lode) +<.q.vig)
|
||||
(slot 7 vig)
|
||||
=+ sec=(spec (slot 3 vig))
|
||||
:+ %rust [tik.sat lat.sat]
|
||||
:- ((hard logo) -.q.sec)
|
||||
(slot 3 sec)
|
||||
==
|
||||
::
|
||||
++ sump
|
||||
@ -587,13 +647,14 @@
|
||||
::
|
||||
[%give p=[p=@tas q=*]]
|
||||
[%give (sumo (spec (slot 3 caq)))]
|
||||
::
|
||||
[%slip p=@tas q=[p=@tas q=*]]
|
||||
:+ %slip
|
||||
(need ((sand %tas) ((hard ,@) p.q.caq)))
|
||||
[%meta (spec (slot 7 caq))]
|
||||
==
|
||||
::
|
||||
++ warm :: vase has arm
|
||||
|= cog=@tas
|
||||
^- ?
|
||||
?~ huv.sat |
|
||||
!=(~ q:(~(fino ut p.u.huv.sat) 0 %free cog))
|
||||
::
|
||||
++ work :: eat queue
|
||||
|- ^+ +
|
||||
?: |(?=(^ qic.sat) =(~ vey.sat)) +.$ :: nothing to do
|
||||
@ -601,6 +662,12 @@
|
||||
?: (~(has in nuc.sat) p.yev) $
|
||||
work:(yawn:(bing p.yev) q.yev)
|
||||
::
|
||||
++ yawl :: invoke core
|
||||
|= [[arm=term pax=path] vax=vase sam=vase]
|
||||
^+ +>
|
||||
%+ ford [%s arm pax]
|
||||
[%call (harm arm (conf (core vax))) (cove %$ sam)]
|
||||
::
|
||||
++ yawn :: start event
|
||||
|= kon=knob
|
||||
^+ +>
|
||||
@ -609,43 +676,64 @@
|
||||
?- -.kon
|
||||
%boot
|
||||
=. orm.sat `now
|
||||
%+ ford /boot
|
||||
%+ ford /s/park
|
||||
^- silk
|
||||
:+ %call
|
||||
(harm %prep (conf home))
|
||||
?~ huv.sat
|
||||
nile
|
||||
[nile (harm %save (conf (core u.huv.sat)))]
|
||||
:- home
|
||||
?~ huv.sat nile
|
||||
?: =(~ q.u.huv.sat) nile
|
||||
:- nile
|
||||
?. (warm %park)
|
||||
[%done ~ %$ (slot 13 u.huv.sat)]
|
||||
(harm %park (conf (core u.huv.sat)))
|
||||
::
|
||||
%load
|
||||
=+ [hom=(slot 2 q.p.kon) old=(slot 3 q.p.kon)]
|
||||
%+ ford /s/prep
|
||||
?. (warm(huv.sat `hom) %prep)
|
||||
:- nile
|
||||
?: =(~ q.old)
|
||||
(core hom)
|
||||
:+ %mute `silk`(core hom)
|
||||
:~ [[%$ 13]~ (cave (slot 3 old))]
|
||||
==
|
||||
[%call (harm %prep (conf (core hom))) [nile (cave old)]]
|
||||
::
|
||||
%crud
|
||||
?~ huv.sat
|
||||
~& [%crud-none our app]
|
||||
gone:(give %crud p.kon q.kon)
|
||||
%^ game [%pain /step] u.huv.sat
|
||||
!>([ost use p.kon])
|
||||
(give(qic.sat ~) %crud p.kon q.kon)
|
||||
::
|
||||
%nuke
|
||||
:: ~& %yawn-nuke
|
||||
gone :: send unsubscribe
|
||||
?. (warm %pull)
|
||||
+>.$(qic.sat ~)
|
||||
?> ?=(^ huv.sat)
|
||||
(yawl [%pull ~] u.huv.sat [[%atom %ud] ost])
|
||||
::
|
||||
%mess
|
||||
?~ huv.sat
|
||||
~& [%mess-none our app]
|
||||
gone:(give %back |)
|
||||
%^ game [%poke /step] u.huv.sat
|
||||
:(slop [[%atom %ud] ost] [[%atom %p] p.kon] q.q.kon)
|
||||
=+ ^= cog ^- term
|
||||
?: |(?=(^ p.q.kon) =(%$ p.q.kon))
|
||||
%poke
|
||||
(cat 3 'poke-' p.q.kon)
|
||||
?. (warm cog)
|
||||
(give(qic.sat ~) %rasp [tik.sat lat.sat] ~)
|
||||
?> ?=(^ huv.sat)
|
||||
=+ sam=:(slop [[%atom %ud] ost] [[%atom %p] p.kon] q.q.kon)
|
||||
~& [%mess-poke cog]
|
||||
%+ ford /s/poke
|
||||
[%call (harm cog (conf (core u.huv.sat))) (cove %$ sam)]
|
||||
::
|
||||
%show
|
||||
?~ huv.sat
|
||||
~& [%show-none our app]
|
||||
gone
|
||||
%^ game [%peer [%show (scot %p p.kon) q.kon]] u.huv.sat
|
||||
!>([ost p.kon q.kon])
|
||||
?: (warm %peer)
|
||||
=+ sam=!>([ost p.kon q.kon])
|
||||
?> ?=(^ huv.sat)
|
||||
=. peq.sat (~(del by peq.sat) ost)
|
||||
(yawl [%peer (scot %p p.kon) q.kon] u.huv.sat sam)
|
||||
?: (warm %peek)
|
||||
=+ sam=!>([p.kon q.kon])
|
||||
?> ?=(^ huv.sat)
|
||||
(yawl [%peek (scot %p p.kon) q.kon] u.huv.sat sam)
|
||||
(give(qic.sat ~) %dumb [tik.sat lat.sat])
|
||||
::
|
||||
%take
|
||||
?> ?=(^ huv.sat)
|
||||
%^ game [%peck /step] u.huv.sat
|
||||
:(slop [[%atom %ud] ost] !>((ride use say)) !>(p.kon) q.kon)
|
||||
!!
|
||||
==
|
||||
--
|
||||
--
|
||||
|
@ -100,6 +100,7 @@
|
||||
++ mart (list ,[n=mane v=tape]) :: XML attributes
|
||||
++ marx $|(@tas [n=mane a=mart]) :: XML tag
|
||||
++ metl ?(%gold %iron %zinc %lead) :: core variance
|
||||
++ noun ,*
|
||||
++ null ,~ :: null, nil, etc
|
||||
++ odor ,@ta :: atom format
|
||||
++ tarp ,[d=@ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time
|
||||
@ -1917,6 +1918,12 @@
|
||||
b
|
||||
$(a r.a, b [n.a $(a l.a)])
|
||||
::
|
||||
+- tur :: turn
|
||||
|* b=$+([* *] *)
|
||||
|-
|
||||
?~ a ~
|
||||
[n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
|
||||
::
|
||||
+- uni :: union
|
||||
~/ %uni
|
||||
|* b=_a
|
||||
@ -1984,7 +1991,7 @@
|
||||
=+ b=get(+< l.a)
|
||||
bal(+< ^+(a [p.b q.b r.a]))
|
||||
::
|
||||
+- put :: insert new head
|
||||
+- put :: insert new tail
|
||||
|* b=*
|
||||
|- ^+ a
|
||||
?~ a
|
||||
@ -9236,12 +9243,13 @@
|
||||
++ glob ,[p=logo q=ship r=mark] :: global brand
|
||||
++ herd (hypo curd) :: typed card
|
||||
++ hide :: standard app state
|
||||
$: own=[p=ship q=@tas] :: static identity
|
||||
$: $: our=ship :: owner/operator
|
||||
app=@tas :: app identity
|
||||
== ::
|
||||
sup=(map bone (pair ship path)) :: subscription set
|
||||
$= seq :: dynamic sequence
|
||||
$: tik=@ud :: boot number
|
||||
num=@ud :: action number
|
||||
eny=@ :: entropy
|
||||
act=@ud :: action number
|
||||
eny=@uvI :: entropy
|
||||
lat=@da :: date of last tick
|
||||
== == ::
|
||||
++ hilt ?(0 1 2) :: lead iron gold
|
||||
|
@ -2023,7 +2023,6 @@
|
||||
raz=(map path race) :: statements inbound
|
||||
ryl=(map path rill) :: statements outbound
|
||||
== ::
|
||||
++ bead ,[p=(set beam) q=cage] :: computed result
|
||||
++ beam ,[[p=ship q=desk r=case] s=path] :: global name
|
||||
++ beak ,[p=ship q=desk r=case] :: garnish with beak
|
||||
++ bird :: packet in travel
|
||||
@ -2410,6 +2409,7 @@
|
||||
[%call p=silk q=silk] :: slam
|
||||
[%cast p=logo q=beak r=silk] :: translate
|
||||
[%done p=(set beam) q=cage] :: literal
|
||||
[%dude p=tank q=silk] :: error wrap
|
||||
[%dune p=(set beam) q=(unit cage)] :: unit literal
|
||||
[%mute p=silk q=(list (pair wing silk))] :: mutant
|
||||
[%pass p=silk q=sill] :: twig construction
|
||||
|
@ -1,38 +1,103 @@
|
||||
!:
|
||||
=> |%
|
||||
++ foobug-state
|
||||
$% [%0 bug=@ud]
|
||||
++ axle
|
||||
$% [%0 p=@ud]
|
||||
==
|
||||
++ gilt
|
||||
$% [%json p=json]
|
||||
[%hymn p=manx]
|
||||
==
|
||||
++ gift
|
||||
$% [%rust gilt]
|
||||
[%rasp gilt]
|
||||
==
|
||||
++ move ,[p=bone q=[%give p=gift]]
|
||||
--
|
||||
|= *
|
||||
|_ [hid=hide foo=foobug-state]
|
||||
++ prep
|
||||
|= old=(unit foobug-state)
|
||||
?~ old +>
|
||||
~& [%prep-hid hid]
|
||||
+>(foo u.old)
|
||||
::
|
||||
++ save
|
||||
^- foobug-state
|
||||
foo(bug +(bug.foo))
|
||||
::
|
||||
++ peer
|
||||
|= [ost=bone you=ship pax=path]
|
||||
~& [%peer [ost you pax]]
|
||||
:_ +> :_ ~
|
||||
:+ ost %give
|
||||
:- %rust
|
||||
:- %html
|
||||
%- crip
|
||||
%+ xmlt |
|
||||
:_ ~
|
||||
|_ [hid=hide vat=axle]
|
||||
++ page
|
||||
^- manx
|
||||
;html
|
||||
;head
|
||||
;title: Hi, everyone!
|
||||
;title: Foobug!
|
||||
==
|
||||
;body
|
||||
;p: Hello, world (instance {<bug.foo>})
|
||||
;body
|
||||
;p: Word: {<p.vat>}.
|
||||
;button(onclick "goof()"): Goof!
|
||||
;script
|
||||
; var c = 0;
|
||||
; var d = 1;
|
||||
; var x = 0;
|
||||
;
|
||||
; function pickup() {
|
||||
; xhr = new XMLHttpRequest();
|
||||
;
|
||||
; console.log("WTF???");
|
||||
; xhr.open("GET", "/zod/goe/foobug/"+port+"/frog/"+d);
|
||||
; xhr.onload = function() {
|
||||
; console.log("pickup");
|
||||
; console.log(this)
|
||||
; change(JSON.parse(this.responseText))
|
||||
; update();
|
||||
; d++;
|
||||
; pickup();
|
||||
; }
|
||||
; xhr.send();
|
||||
; }
|
||||
;
|
||||
; function dude() {
|
||||
; xhr = new XMLHttpRequest();
|
||||
;
|
||||
; xhr.open("POST", "/zod/pos/foobug/"+port+"/frog/goof");
|
||||
; xhr.setRequestHeader("content-type", "text/json")
|
||||
; xhr.onload = function() {
|
||||
; console.log("dude");
|
||||
; console.log(this)
|
||||
; change(JSON.parse(this.responseText))
|
||||
; update();
|
||||
; pickup();
|
||||
; }
|
||||
; xhr.send("{\"a\":1}")
|
||||
; }
|
||||
; dude();
|
||||
;
|
||||
; function change(jon) {
|
||||
; x = jon.x;
|
||||
; }
|
||||
;
|
||||
; function update() {
|
||||
; document.getElementsByTagName("p")[0].innerHTML = "WORD: " + x;
|
||||
; }
|
||||
;
|
||||
; function goof() {
|
||||
; xhr = new XMLHttpRequest();
|
||||
; xhr.onload = function() {
|
||||
; console.log("hi");
|
||||
; console.log(arguments)
|
||||
; c++
|
||||
; }
|
||||
; xhr.open("POST",
|
||||
; "/zod/pom/foobug/"+port+"/"+c)
|
||||
; xhr.setRequestHeader("content-type", "text/json")
|
||||
; xhr.send("{\"a\":1}")
|
||||
; }
|
||||
==
|
||||
==
|
||||
==
|
||||
::
|
||||
++ peer
|
||||
|= [ost=bone you=ship pax=path]
|
||||
^- [(list move) _+>]
|
||||
?: =(~ pax)
|
||||
[[ost %give %rust %hymn page]~ +>]
|
||||
:_ +>
|
||||
[ost %give %rust %json `json`(joba %x [%n (rsh 3 2 (scot %ui p.vat))])]~
|
||||
::
|
||||
++ poke-json
|
||||
|= [ost=bone you=ship jon=json]
|
||||
^- [(list move) _+>]
|
||||
~& [%poke [%state p.vat] ost you jon]
|
||||
:_ +>(p.vat +(p.vat))
|
||||
:~ [ost %give %rasp %json jon]
|
||||
==
|
||||
--
|
||||
|
44
main/app/philbug/app.js
Normal file
44
main/app/philbug/app.js
Normal file
@ -0,0 +1,44 @@
|
||||
|
||||
window.onload = function() {
|
||||
data = {}
|
||||
|
||||
change = function(_data) {
|
||||
for(i in _data) {
|
||||
data[i] = _data[i]
|
||||
}
|
||||
}
|
||||
|
||||
update = function() {
|
||||
for (var i in data) {
|
||||
if ($('#'+i).length < 1) {
|
||||
var e = document.createElement('tr')
|
||||
e.id = i
|
||||
$('#cont tbody').append(e)
|
||||
}
|
||||
$('#'+i).html("<td>~"+i+"</td><td>"+data[i]+"</td>")
|
||||
}
|
||||
$('#cont tbody').append([].sort.call($('#cont tr'), function (a, b) {
|
||||
return parseInt(b.childNodes[1].innerText) -
|
||||
parseInt(a.childNodes[1].innerText)
|
||||
}))
|
||||
}
|
||||
|
||||
goof = function(e) {
|
||||
d = $.map($(".sel"), function(el) {return el.id})
|
||||
window.urb.send(d)
|
||||
}
|
||||
|
||||
window.urb.subscribe("frog","goof", function(err,res) {
|
||||
if(err)
|
||||
return console.log('cannot connect to frog/goof')
|
||||
change(res.data)
|
||||
update()
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
$('#cont').on('click', 'tr', function (e) {
|
||||
if (!e.ctrlKey) { $('.sel').removeClass('sel') }
|
||||
$(this).addClass('sel')
|
||||
})
|
||||
}
|
101
main/app/philbug/core.hoon
Normal file
101
main/app/philbug/core.hoon
Normal file
@ -0,0 +1,101 @@
|
||||
!:
|
||||
=> |%
|
||||
++ axle
|
||||
$% [%0 p=(map ,@p ,@ud)]
|
||||
==
|
||||
++ gilt
|
||||
$% [%json p=json]
|
||||
[%hymn p=manx]
|
||||
==
|
||||
++ gift
|
||||
$% [%rust gilt]
|
||||
[%rasp gilt]
|
||||
==
|
||||
++ move ,[p=bone q=[%give p=gift]]
|
||||
--
|
||||
|= *
|
||||
|_ [hid=hide vat=axle]
|
||||
++ incl
|
||||
|= wal=wall
|
||||
%+ turn wal
|
||||
|= tape ;script(type "text/javascript", src +<);
|
||||
::
|
||||
++ root
|
||||
/(scot %p our.hid)/main/(scot %da lat.hid)/app/[app.hid]
|
||||
::
|
||||
++ page
|
||||
^- manx
|
||||
;html
|
||||
;head
|
||||
;title: Foobug!
|
||||
;style
|
||||
; .sel {background: lightgray}
|
||||
; #cont {border-collapse: collapse}
|
||||
==
|
||||
;* %- incl :~
|
||||
"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"
|
||||
==
|
||||
;script ;- (trip ;;(,@ .^(%cx (welp root /urb/js))))
|
||||
==
|
||||
;script ;- (trip ;;(,@ .^(%cx (welp root /app/js))))
|
||||
==
|
||||
==
|
||||
;body
|
||||
;p: Hello.
|
||||
;table#cont ;tbody
|
||||
;* %+ turn
|
||||
%+ sort (~(tap by p.vat) ~)
|
||||
|= [p=[u=@p n=@ud] q=[u=@p n=@ud]] (gth n.p n.q)
|
||||
|= [u=@p n=@ud]
|
||||
;tr(id (slag 1 <u>)):(td:(-<u>) td:(-<n>))
|
||||
== ==
|
||||
;p: Select a ship
|
||||
;button(onclick "goof()"): Give 5 points
|
||||
==
|
||||
==
|
||||
::
|
||||
++ peer
|
||||
|= [ost=bone you=ship pax=path]
|
||||
^- [(list move) _+>]
|
||||
?: =(~ pax)
|
||||
=. p.vat (~(put by p.vat) you (fall (~(get by p.vat) you) _@ud))
|
||||
[[ost %give %rust %hymn page]~ +>]
|
||||
:_ +>
|
||||
~[(send-vat ost (turn (~(tap by p.vat)) |=([p=@p q=@ud] p)))]
|
||||
::
|
||||
++ poke-json
|
||||
|= [ost=bone you=ship jon=json]
|
||||
^- [(list move) _+>]
|
||||
~& [%poke [%state p.vat] ost you]
|
||||
=+ j=(,[%a p=(list ,[%s p=@t])] jon)
|
||||
=. p.vat
|
||||
%- ~(tur by p.vat)
|
||||
|= [u=@p n=@ud]
|
||||
?. (lien p.j |=([%s p=@t] =((slav %p (cat 3 '~' p)) u)))
|
||||
n
|
||||
(add 5 n)
|
||||
:_ +>+
|
||||
:- [ost %give %rasp %json jon]
|
||||
%+ turn
|
||||
^- (list bone)
|
||||
%+ ~(rep by sup.hid) *(list bone)
|
||||
|= [p=[p=bone q=[ship path]] q=(list bone)] ^- (list bone)
|
||||
?. =(/goof +.q.p) q
|
||||
[p.p q]
|
||||
|= o=bone
|
||||
%+ send-vat o
|
||||
%+ turn p.j
|
||||
|= [%s p=@t]
|
||||
(slav %p (cat 3 '~' p))
|
||||
++ send-vat
|
||||
|= [o=bone l=(list ,@p)]
|
||||
:* o %give %rust %json %o
|
||||
^- (map ,@t jval)
|
||||
%- mo
|
||||
%+ turn l
|
||||
|= p=@p
|
||||
:- (rsh 3 1 (scot %p p)) :- %n
|
||||
%^ rsh 3 2
|
||||
(scot %ui (fall (~(get by p.vat) p) _@ud))
|
||||
==
|
||||
--
|
111
main/app/philbug/urb.js
Normal file
111
main/app/philbug/urb.js
Normal file
@ -0,0 +1,111 @@
|
||||
window.urb = {
|
||||
ship: ship,
|
||||
port: port,
|
||||
auto: auto,
|
||||
oryx: oryx,
|
||||
user: user,
|
||||
appn: "foobug",
|
||||
seqn: 0,
|
||||
seqp: 1,
|
||||
dely: 0,
|
||||
|
||||
req: function(method,url,data,json,cb) {
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.open(method.toUpperCase(), url)
|
||||
if(json)
|
||||
xhr.setRequestHeader("content-type", "text/json")
|
||||
if(data)
|
||||
xhr.send(JSON.stringify(data))
|
||||
else
|
||||
xhr.send()
|
||||
if(cb) {
|
||||
xhr.onload = function() {
|
||||
cb(null,{
|
||||
"status":this.status,
|
||||
"data":JSON.parse(this.responseText)
|
||||
})
|
||||
}
|
||||
xhr.onerror = function() {
|
||||
cb({
|
||||
"status":this.status,
|
||||
"data":this.responseText
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
subscribe: function(stream,path,cb) {
|
||||
if(!cb)
|
||||
throw new Error("You must supply a callback to urb.subscribe.")
|
||||
|
||||
var method, perm, url, $this
|
||||
|
||||
method = "post"
|
||||
perm = "pis"
|
||||
url = [this.ship,perm,this.user,this.appn,this.port]
|
||||
if(stream) {
|
||||
url.push(stream)
|
||||
if(path)
|
||||
url.push(path)
|
||||
}
|
||||
url = "/"+url.join("/")
|
||||
|
||||
|
||||
$this = this
|
||||
this.req(method,url,{},true,function(err,data) {
|
||||
cb.apply(this,arguments)
|
||||
if(!err) { $this.poll(stream,cb); }
|
||||
})
|
||||
},
|
||||
|
||||
send: function(data,cb) {
|
||||
if(!data) { data = {}; }
|
||||
if(!cb) { cb = function() {}; }
|
||||
|
||||
var method, perm, url, $this
|
||||
|
||||
method = "post"
|
||||
perm = "pim"
|
||||
url = [this.ship,perm,this.user,this.appn,this.port,this.seqn]
|
||||
url = "/"+url.join("/")
|
||||
|
||||
this.seqn++
|
||||
|
||||
$this = this
|
||||
this.req(method,url,data,true,function(err,data) {
|
||||
if(err) { $this.seqn--; }
|
||||
cb.apply(this,arguments)
|
||||
})
|
||||
},
|
||||
|
||||
poll: function(stream,cb) {
|
||||
if(!stream)
|
||||
throw new Error("You must supply a stream to urb.poll.")
|
||||
if(!cb)
|
||||
throw new Error("You must supply a callback to urb.poll.")
|
||||
|
||||
var method, perm, url, $this
|
||||
|
||||
method = "get"
|
||||
perm = "gie"
|
||||
if(!stream) { return false; }
|
||||
url = [this.ship,perm,this.user,this.appn,this.port,stream,this.seqp]
|
||||
url = "/"+url.join("/")
|
||||
|
||||
$this = this
|
||||
this.req(method,url,null,false,function(err,data) {
|
||||
if(cb.apply(this,arguments) === false) { return; }
|
||||
|
||||
if(err)
|
||||
$this.dely += 1000
|
||||
else {
|
||||
$this.dely = 0
|
||||
$this.seqp++
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
$this.poll(stream,cb)
|
||||
},$this.dely)
|
||||
})
|
||||
}
|
||||
}
|
1
main/sys/hymn/ref/gate.hoon
Normal file
1
main/sys/hymn/ref/gate.hoon
Normal file
@ -0,0 +1 @@
|
||||
manx
|
3
main/sys/hymn/tan/html/gate.hoon
Normal file
3
main/sys/hymn/tan/html/gate.hoon
Normal file
@ -0,0 +1,3 @@
|
||||
|= *
|
||||
|= man=manx
|
||||
(crip (xmlt | man ~))
|
4
main/sys/hymn/tan/mime/gate.hoon
Normal file
4
main/sys/hymn/tan/mime/gate.hoon
Normal file
@ -0,0 +1,4 @@
|
||||
|= *
|
||||
|= man=manx
|
||||
=+ htm=(crip (xmlt | man ~))
|
||||
[/text/html (met 3 htm) htm]
|
Loading…
Reference in New Issue
Block a user