This commit is contained in:
Philip C Monk 2015-04-07 18:49:43 -04:00
commit 4f1049c5ec
89 changed files with 9161 additions and 6594 deletions

View File

@ -35,31 +35,31 @@
++ move ,[p=duct q=(mold note gift)] :: local move
++ note :: out request $->
$? $: %d :: to %dill
$% [%flog p=flog] ::
== == ::
$% [%flog p=flog] ::
== == ::
$: %a :: to %ames
$% [%kick p=@da] ::
== == ::
$% [%kick p=@da] ::
== == ::
$: %g :: to %gall
$% [%rote p=sack q=path r=*] ::
[%roth p=sack q=path r=*] ::
[%mess p=[@p %ye ~] q=@p r=cage] ::
== == ::
$% [%rote p=sack q=path r=*] ::
[%roth p=sack q=path r=*] ::
[%mess p=[@p %ye ~] q=@p r=cage] ::
== == ::
$: @tas :: to any
$% [%init p=@p] ::
[%want p=sock q=path r=*] ::
[%wart p=sock q=@tas r=path s=*] ::
$% [%init p=@p] ::
[%want p=sock q=path r=*] ::
[%wart p=sock q=@tas r=path s=*] ::
== == == ::
++ sign :: in result $<-
$? $: %a :: from %ames
$% [%went p=ship q=cape] ::
== == ::
$% [%went p=ship q=cape] ::
== == ::
$: %g :: from %gall
$% [%mean p=ares] ::
[%nice ~] ::
== == ::
$% [%mean p=ares] ::
[%nice ~] ::
== == ::
$: @tas ::
$% [%crud p=@tas q=(list tank)] :: by any
$% [%crud p=@tas q=(list tank)] :: by any
== == == ::
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@ -227,7 +227,7 @@
0w0 :: 55, ~tep, Curtis Yarvin (sator)
0w0 :: 56, ~bes, Curtis Yarvin (sator)
0w0 :: 57, ~dex, Jared Hance (aestas)
0w0 :: 58, ~sef, Curtis Yarvin (sator)
0w0 :: 58, ~sef, Owen Rescher (lex)
0w0 :: 59, ~wyc, Curtis Yarvin (sator)
0w0 :: 60, ~bur, Curtis Yarvin (sator)
0w0 :: 61, ~der, Curtis Yarvin (sator)
@ -370,7 +370,7 @@
0w0 :: 198, ~len, Tlon (gleba)
0w0 :: 199, ~ner, Tlon (gleba)
0wv.aixe9.7gG2w.7cJiy.i3Mg8 :: 200, ~lex, Michael Hartl (donum)
0w0 :: 201, ~rup, Tlon (gleba)
0w0 :: 201, ~rup, Owen Rescher (lex)
0w0 :: 202, ~ned, Tlon (gleba)
0w0 :: 203, ~lec, Tlon (gleba)
0w0 :: 204, ~ryd, Tlon (gleba)
@ -631,12 +631,12 @@
=^ gim ..weft wisp
:_ +>.$
^- (list rock)
=+ wit=(met ?:(fak.ton 18 13) q.gim)
=+ wit=(met ?:(fak.ton 16 13) q.gim)
?< =(0 wit)
?: =(1 wit)
=+ yup=(spit [our her] p.gim q.gim)
[yup ~]
=+ ruv=(rip ?:(fak.ton 18 13) q.gim)
=+ ruv=(rip ?:(fak.ton 16 13) q.gim)
=+ gom=(shaf %thug q.gim)
=+ inx=0
|- ^- (list rock)
@ -1409,7 +1409,7 @@
=+ [nix=0 rax=*(list ,@)]
|- ^- @
?: =(p.duv nix)
(can ?:(fak.ton.fox 18 13) (turn (flop rax) |=(a=@ [1 a])))
(can ?:(fak.ton.fox 16 13) (turn (flop rax) |=(a=@ [1 a])))
$(nix +(nix), rax [(need (~(get by q.duv) nix)) rax])
-- :: --la:ho:um:am
::
@ -1662,7 +1662,6 @@
?- -.bon
%beer
:_ fox(zac (~(put by zac.fox) p.bon `corn`[hen ~ ~ ~]))
:: ~& [%ames-clop p.bon hen]
:* [hen [%slip %c %init p.bon]]
[hen [%give %init p.bon]]
[hen [%slip %a %kick now]]
@ -1688,6 +1687,8 @@
%milk
:: ~& [%rx p.bon q.bon]
?> ?=([@ *] q.q.bon)
?: ?=(%e i.q.q.bon)
:_(fox [hen [%slip %e %wart p.bon %$ t.q.q.bon r.bon]]~)
?: ?=(%r i.q.q.bon)
?: ?=([%ta *] t.q.q.bon)
=+ wil=((hard (unit will)) r.bon)
@ -1696,7 +1697,7 @@
:+ (scot %p p.p.bon)
(scot %p q.p.bon)
q.q.bon
[hen %pass pax %g %rote p.bon /began 0 %m %will wil]~
[hen %pass pax %g %rote p.bon /helm 0 %m %will wil]~
?> ?=([@ @ *] t.q.q.bon)
:_ fox
=+ [cak=i.t.q.q.bon ven=i.t.t.q.q.bon]

File diff suppressed because it is too large Load Diff

758
arvo/doll.hoon Normal file
View File

@ -0,0 +1,758 @@
!:
:: dill (4d), terminal handling
::
|= pit=vase
=> |% :: interface tiles
++ gift :: out result <-$
$% [%bbye ~] :: reset prompt
[%blit p=(list blit)] :: terminal output
[%init p=@p] :: report install
[%logo @] :: logout
[%veer p=@ta q=path r=@t] :: install vane
[%vega p=path] :: reboot by path
[%verb ~] ::
== ::
++ kiss :: in request ->$
$% [%belt p=belt] :: terminal input
[%blew p=blew] :: terminal config
[%boot p=*] :: weird %dill boot
[%crud p=@tas q=(list tank)] :: error with trace
[%flog p=flog] :: wrapped error
[%flow p=*] :: forward compat
[%hail ~] :: terminal refresh
[%hook ~] :: this term hung up
[%harm ~] :: all terms hung up
[%init p=ship] :: after gall ready
[%noop ~] :: no operation
[%talk p=tank] ::
[%text p=tape] ::
== ::
++ flog :: sent to %dill
$% [%crud p=@tas q=(list tank)] ::
[%text p=tape] ::
== ::
++ mess :: message to terminal
$% [%term-ctrl p=(hypo ,%hail)] ::
[%term-in p=(hypo term-in)] ::
== ::
++ move ,[p=duct q=(mold note gift)] :: local move
++ note :: out request $->
$% $: %a ::
$% [%make p=(unit ,@t) q=@ud r=@ s=?] ::
[%sith p=@p q=@uw r=?] ::
== == ::
$: %c ::
$% [%warp p=sock q=riff] ::
== == ::
$: %d ::
$% [%crud p=@tas q=(list tank)] ::
[%text p=tape] ::
[%logo ~] ::
== == ::
$: %g ::
$% [%mess p=[p=ship q=path] q=ship r=mess] ::
[%nuke p=[p=ship q=path] q=ship] ::
[%show p=[p=ship q=path] q=ship r=path] ::
[%took p=[p=ship q=path] q=ship] ::
== == ::
$: %t ::
$% [%wait p=@da] ::
== == == ::
++ riff ,[p=desk q=(unit rave)] :: see %clay
++ sign :: in result $<-
$?
$: %c ::
$% [%writ p=riot] ::
== == ::
$: %g ::
$% [%logo p=@] ::
[%mean p=ares] ::
[%nice ~] ::
$: %rush ::
$% [%term-line q=term-line] ::
[%hymn q=manx] ::
== == ::
[%verb ~] ::
[%sage p=path q=*] ::
[%veer p=@ta q=path r=@t] ::
[%vega p=path] ::
== == ::
$: %t ::
$% [%wake ~] ::
== ==
$: @tas :: by any
$% [%crud p=@tas q=(list tank)] ::
[%init p=@p] ::
[%note p=@tD q=tank] ::
== == == ::
++ term-in ::
$: pax=path ::
$= jof ::
$% [%line p=cord] ::
[%res p=span] ::
[%cmd p=char] ::
[%type p=?] ::
== == ::
++ term-line ,[p=[p=cord q=prom r=cord] q=(list cord) r=(list tark)]
++ tark ?(tank [%stem p=@da q=tank r=tank]) ::
:::::::: :: dill tiles
++ bein :: terminal control
$: $: bul=@ud :: buffer length
bus=@ud :: cursor in buffer
but=(list ,@c) :: buffer text
buy=prom :: input style
== ::
$: hiz=@ud :: history depth
hux=path :: history path
hym=(map ,@ud (list ,@c)) :: history overlay
hyt=hist :: history object
hyr=(unit (list ,@c)) :: history search
== ::
$: pol=@ud :: length of prompt
pot=tape :: prompt text
== ::
== ::
++ blew ,[p=@ud q=@ud] :: columns rows
++ belt :: raw console input
$% [%aro p=?(%d %l %r %u)] :: arrow key
[%bac ~] :: true backspace
[%ctl p=@ud] :: control-key
[%del ~] :: true delete
[%met p=@ud] :: meta-key
[%ret ~] :: return
[%txt p=(list ,@c)] :: utf32 text
== ::
++ blit :: raw console output
$% [%bel ~] :: make a noise
[%clr ~] :: clear the screen
[%hop p=@ud] :: set cursor position
[%lin p=(list ,@c)] :: set current line
[%mor ~] :: newline
[%sag p=path q=*] :: save to jamfile
[%sav p=path q=@] :: save to file
== ::
++ blot :: kill ring
$: p=@ud :: length
q=@ud :: depth
r=(list (list ,@c)) :: kills
== ::
++ blur ,[p=@ud q=(unit bein) r=blot] :: columns, prompt
++ kyev ::
$: p=(set ?(%ctrl %shift %alt %meta)) ::
q=$|(cord [%act speck]) ::
== ::
++ speck ::
$? %ctrl %shift %alt %meta %entr %esc ::
%caps %uncap %pgup %pgdn %home %end ::
%baxp %del %ins %up %down %left ::
%right ::
== ::
++ yard :: terminal state
$: p=? :: verbose
q=blur :: display state
r=(map path hist) :: history
s=[p=? q=@da] :: typing?/last typed
== ::
:: XX LEGACY 12-16-2014
++ yord :: old terminal state
$: p=? :: verbose
q=blur :: display state
r=(map path hist) :: history
== ::
-- =>
|%
++ dy
|= [hen=duct our=ship now=@da def=(unit duct) dug=(map duct yard)]
=+ ^= yar ^- yard
=+ yur=(~(get by dug) hen)
?^ yur u.yur
?^ def (~(got by dug) u.def)
[& [80 ~ *blot] ~ | *@da]
=| mos=(list move)
|%
++ beep (curb [[%bel ~] ~]) :: send beep
++ curb :: send blits
|= wab=(list blit)
^+ +>
?~ wab +>
+>(mos [[hen [%give %blit (flop wab)]] mos])
::
++ wod :: word forward
|= bed=bein
^- @ud
?: =(bul.bed bus.bed)
bus.bed
?: =(' ' (snag bus.bed but.bed))
$(bus.bed +(bus.bed))
|-
^- @ud
?: =(bul.bed bus.bed)
bus.bed
?: =(' ' (snag bus.bed but.bed))
bus.bed
$(bus.bed +(bus.bed))
::
++ wob :: word backward
|= bed=bein
^- @ud
?: =(0 bus.bed)
bus.bed
?: =(' ' (snag (dec bus.bed) but.bed))
$(bus.bed (dec bus.bed))
|-
^- @ud
?: =(0 bus.bed)
bus.bed
?: =(' ' (snag (dec bus.bed) but.bed))
bus.bed
$(bus.bed (dec bus.bed))
::
++ edit :: change the bed
|= bed=bein
^+ +>
=. q.q.yar [~ bed]
?> ?=(^ q.q.yar)
%- curb
|- ^- (list blit)
?^ hyr.u.q.q.yar
=+ ris=:(weld "(reverse-i-search)'" (tufa u.hyr.u.q.q.yar) "': ")
%= $
pot.bed ris
pol.bed (lent ris)
hyr.u.q.q.yar ~
==
:~ [%hop (add pol.bed bus.bed)]
:- %lin
%+ weld pot.bed
?- buy.bed
%none but.bed
%text but.bed
%pass `(list ,@)`(runt [(lent but.bed) '*'] ~)
==
==
::
++ fume :: print tank, prefix
|= [pef=@tD tac=tank]
^+ +>
=+ wol=(~(win re tac) 2 p.q.yar)
%- furl
%+ turn wol
|= a=tape ^- tape
?> ?=([@ @ *] a)
[pef ' ' t.t.a]
::
++ furl :: print wall
|= wol=(list tape)
^+ +>
=. +>
%- curb
%- flop
|- ^- (list blit)
?~ wol ~
[[%lin (tuba i.wol)] [%mor ~] $(wol t.wol)]
?~ q.q.yar +>
(edit(q.q.yar ~) u.q.q.yar)
::
++ gore :: move in history
|= hup=@ud
^+ +>
=+ but=(goth hup)
=+ bul=(lent but)
%- edit
?> ?=(^ q.q.yar)
%= u.q.q.yar
hiz hup
hym %+ ~(put by hym.u.q.q.yar)
hiz.u.q.q.yar
but.u.q.q.yar
bus bul
bul bul
but but
==
::
++ goth :: extract history
|= hup=@ud
?> ?=(^ q.q.yar)
=+ byt=(~(get by hym.u.q.q.yar) hup)
?^ byt u.byt
(tuba (rip 3 (snag hup q.hyt.u.q.q.yar)))
::
++ kill :: add to kill ring
|= txt=(list ,@c)
^+ +>
=> ?. =(16 p.r.q.yar) .
.(p.r.q.yar 15, r.r.q.yar (scag 15 r.r.q.yar))
%= +>
p.r.q.yar +(p.r.q.yar)
q.r.q.yar 0
r.r.q.yar [txt r.r.q.yar]
==
::
++ look :: search in history
|= [hup=@ud txt=(list ,@c)]
^+ +>
=+ ^= beg
|= [a=(list ,@c) b=(list ,@c)] ^- ?
?~(a & ?~(b | &(=(i.a i.b) $(a t.a, b t.b))))
=+ ^= mid
|= [a=(list ,@c) b=(list ,@c)] ^- ?
?~(a & ?~(b | |((beg a b) $(b t.b))))
?> ?=(^ q.q.yar)
?: =(hup p.hyt.u.q.q.yar)
beep
=+ but=(goth hup)
?: (mid txt but)
(gore(hyr.u.q.q.yar [~ txt]) hup)
$(hup +(hup))
::
++ leap :: accept response
|= [tea=wire sih=sign]
^+ +>
?- -.+.sih
%crud :: error trace
=. q.+.sih [[%leaf (trip p.+.sih)] q.+.sih]
|- ^+ +>.^$
?~ q.+.sih +>.^$
(fume:$(q.+.sih t.q.+.sih) '!' `tank`i.q.+.sih)
::
%mean ~& %dill-mean +>.$
%nice +>.$
%note ?.(p.yar +>.$ (fume p.+.sih q.+.sih)) :: debug message
?(%rush %rust) :: XX reset prompt
=. mos :_(mos [hen %pass tea %g %took [our /terminal] our])
?> ?=(%term-line +>-.sih)
=. +>.$
=+ lis=(scag 1.000 r.q.sih)
=- (furl (zing (turn (flop lis) -)))
|= a=tark
^- wall
?+ -.a (~(win re a) 0 p.q.yar)
%stem
?: =(q.s.yar p.a) ~
~[(welp ~(ram re q.a) ~(ram re r.a))]
==
?. (levy r.q.sih |=(a=tark ?=(%stem -.a)))
+>.$ :: XX separate prompt/history messages
%- edit
=| bed=bein
=+ ^= hyt ^- hist
=+ hyt=(~(get by r.yar) /)
?~(hyt *hist u.hyt)
?: &(?=(^ q.q.yar) =(/ hux.u.q.q.yar))
=+ bun=(rip 5 (turf r.p.q.sih))
%= u.q.q.yar
bul ?~ r.p.q.sih bul.u.q.q.yar (lent bun)
bus ?~ r.p.q.sih bus.u.q.q.yar (lent bun)
but ?~ r.p.q.sih but.u.q.q.yar bun
hyt [+(p.hyt) [%$ q.hyt]]
pot (trip p.p.q.sih)
pol (met 3 p.p.q.sih)
buy q.p.q.sih
==
%_ bed
bul (met 3 r.p.q.sih)
bus (met 3 r.p.q.sih)
but (rip 3 r.p.q.sih)
buy q.p.q.sih
hux /
hiz 0
hyt [+(p.hyt) [%$ q.hyt]]
pot (trip p.p.q.sih)
pol (met 3 p.p.q.sih)
==
::
%sage :: write a jamfile
%= +>.$
mos :_(mos [hen [%give %blit [%sag p.+.sih q.+.sih] ~]])
==
?(%init %logo %veer %vega %verb) :: drop-throughs
+>(mos :_(mos [hen %give +.sih]))
%writ :: file exists
%_ +>.$
mos
:_ mos
[hen %pass /term-show %g %show [our /terminal] our /lines]
==
::
%wake
?: (lte (sub now ~s15) q.s.yar)
%_ +>.$
mos
:_ mos
[hen %pass /activity %t %wait (add q.s.yar ~s15)]
==
%_ +>.$
p.s.yar |
mos :_(mos (poke %term-in -:!>(*term-in) / %type %|))
==
==
::
++ lear :: handle request
|= kyz=kiss
^+ +>
?- -.kyz
%flog !!
%noop +>
%belt :: terminal input
=. +>.$
?. ?=(?(%bac %del %ret %txt) -.p.kyz) +>.$
?: p.s.yar +>.$(s.yar [& now])
%_ +>.$
s.yar [& now]
mos
:_ :_ mos
[hen %pass /activity %t %wait (add ?:(p.s.yar q.s.yar now) ~s15)]
(poke %term-in -:!>(*term-in) / %type %&)
==
?~ q.q.yar
%^ furl
"Downloading files from ticketing ship, please wait until"
"a prompt shows up. This could take several minutes."
~
?^ hyr.u.q.q.yar :: live search
?+ p.kyz $(hiz.u.q.q.yar 0, hyr.u.q.q.yar ~)
[%bac *]
?: =(~ u.hyr.u.q.q.yar)
(curb [[%bel ~] ~])
%- edit
%= u.q.q.yar
hyr [~ (scag (dec (lent u.hyr.u.q.q.yar)) u.hyr.u.q.q.yar)]
==
::
[%txt *] (look hiz.u.q.q.yar (weld u.hyr.u.q.q.yar p.p.kyz))
[%ctl %g] (edit u.q.q.yar(bul 0, bus 0, but ~, hiz 0, hyr ~))
[%ctl %r]
?: =(p.hyt.u.q.q.yar hiz.u.q.q.yar)
beep
(look +(hiz.u.q.q.yar) u.hyr.u.q.q.yar)
==
?- -.p.kyz
%aro :: arrow
?- p.p.kyz
%d :: down
?: =(0 hiz.u.q.q.yar)
beep
(gore (dec hiz.u.q.q.yar))
::
%l :: left
?: =(0 bus.u.q.q.yar)
beep
(edit u.q.q.yar(bus (dec bus.u.q.q.yar)))
::
%r :: right
?: =(bul.u.q.q.yar bus.u.q.q.yar)
beep
(edit u.q.q.yar(bus +(bus.u.q.q.yar)))
::
%u
=+ hup=+(hiz.u.q.q.yar)
?: =(hup p.hyt.u.q.q.yar)
beep
(gore hup)
==
::
%bac :: backspace
^+ +>.$
?: =(0 bus.u.q.q.yar)
(curb `(list blit)`[[%bel ~] ~])
%- edit
%= u.q.q.yar
bus (dec bus.u.q.q.yar)
bul (dec bul.u.q.q.yar)
but
%+ weld
(scag (dec bus.u.q.q.yar) but.u.q.q.yar)
(slag bus.u.q.q.yar but.u.q.q.yar)
==
::
%ctl :: control
?+ p.p.kyz
beep
%a (edit u.q.q.yar(bus 0))
%b $(kyz [%belt %aro %l])
%d ?: ?& =(0 bul.u.q.q.yar)
=(0 bus.u.q.q.yar)
==
+>.$(mos :_(mos (poke %term-in -:!>(*term-in) / %cmd %d)))
$(kyz [%belt %del ~])
%e (edit u.q.q.yar(bus bul.u.q.q.yar))
%f $(kyz [%belt %aro %r])
%g +>.$(mos :_(mos (poke %term-in -:!>(*term-in) / %cmd %g)))
%k ?: =(bul.u.q.q.yar bus.u.q.q.yar)
beep
=> .(+>.$ (kill (slag bus.u.q.q.yar but.u.q.q.yar)))
%- edit
?> ?=(^ q.q.yar)
%= u.q.q.yar
bul bus.u.q.q.yar
but (scag bus.u.q.q.yar but.u.q.q.yar)
==
%t ?: (lth bul.u.q.q.yar 2)
beep
=+ ^= pos
?: =(bul.u.q.q.yar bus.u.q.q.yar)
(sub bus.u.q.q.yar 2)
?: =(0 bus.u.q.q.yar)
bus.u.q.q.yar
(dec bus.u.q.q.yar)
%- edit
%= u.q.q.yar
bus (add 2 pos)
but %+ weld
%+ weld
(scag pos but.u.q.q.yar)
^- (list ,@c) :+
(snag +(pos) but.u.q.q.yar)
(snag pos but.u.q.q.yar)
~
(slag (add 2 pos) but.u.q.q.yar)
==
%l +>.$(mos :_(mos [hen %give %blit [[%clr ~] ~]]))
%n $(kyz [%belt %aro %d])
%o %_ +>.$
mos
:_ :_ mos
[hen %pass /term-show %g %nuke [our /terminal] our]
[hen %pass /term-show %g %show [our /terminal] our /lines]
==
%p $(kyz [%belt %aro %u])
%u ?: =(0 bus.u.q.q.yar)
beep
=> .(+>.$ (kill (scag bus.u.q.q.yar but.u.q.q.yar)))
%- edit
?> ?=(^ q.q.yar)
%= u.q.q.yar
bus 0
bul (sub bul.u.q.q.yar bus.u.q.q.yar)
but (slag bus.u.q.q.yar but.u.q.q.yar)
==
%r (edit u.q.q.yar(hyr [~ ~]))
%w ?: =(0 bus.u.q.q.yar)
beep
=+ bow=(wob u.q.q.yar)
=+ sow=(sub bus.u.q.q.yar bow)
=> .(+>.$ (kill (swag [bow sow] but.u.q.q.yar)))
%- edit
?> ?=(^ q.q.yar)
%= u.q.q.yar
bus bow
bul (sub bul.u.q.q.yar sow)
but %+ welp
(scag bow but.u.q.q.yar)
(slag bus.u.q.q.yar but.u.q.q.yar)
==
%x +>.$(mos :_(mos (poke %term-in -:!>(*term-in) / %cmd %x)))
%y ?: =(0 p.r.q.yar)
beep
$(kyz [%belt %txt (snag q.r.q.yar r.r.q.yar)])
==
::
%del :: delete
?: =(bul.u.q.q.yar bus.u.q.q.yar)
beep
%- edit
%= u.q.q.yar
bul (dec bul.u.q.q.yar)
but
%+ weld
(scag bus.u.q.q.yar but.u.q.q.yar)
(slag +(bus.u.q.q.yar) but.u.q.q.yar)
==
::
%met :: meta
?+ p.p.kyz
beep
%f
?: =(bul.u.q.q.yar bus.u.q.q.yar)
beep
(edit u.q.q.yar(bus (wod u.q.q.yar)))
::
%b
?: =(0 bus.u.q.q.yar)
beep
(edit u.q.q.yar(bus (wob u.q.q.yar)))
::
%y
?: =(0 p.r.q.yar)
beep
=+ dol=(snag q.r.q.yar r.r.q.yar)
=+ leo=(lent dol)
?. (gte bus.u.q.q.yar leo)
beep
=+ pey=(sub bus.u.q.q.yar leo)
?. =(dol (swag [pey leo] but.u.q.q.yar))
beep
=. q.r.q.yar ?:(=(p.r.q.yar +(q.r.q.yar)) 0 +(q.r.q.yar))
=+ ney=(snag q.r.q.yar r.r.q.yar)
=+ lye=(lent ney)
%- edit
%= u.q.q.yar
bus (sub (add bus.u.q.q.yar lye) leo)
bul (sub (add bul.u.q.q.yar lye) leo)
but %+ weld
(scag pey but.u.q.q.yar)
%+ weld
`(list ,@c)`ney :: XX weird fuse-loop
(slag bus.u.q.q.yar but.u.q.q.yar)
==
==
::
%ret :: return
?: =(%none buy.u.q.q.yar) beep
=+ jab=(rap 3 (tufa but.u.q.q.yar))
%= +>.$
q.q.yar ~
r.yar
?: |(=(%$ jab) =(%pass buy.u.q.q.yar))
r.yar
%+ ~(put by r.yar)
hux.u.q.q.yar
[p.hyt.u.q.q.yar [jab ?~(q.hyt.u.q.q.yar ~ +.q.hyt.u.q.q.yar)]]
::
mos
:* (poke %term-ctrl -:!>(%hail) %hail)
[hen %give [%bbye ~]]
(poke %term-in -:!>(*term-in) / %line jab)
[hen %give [%blit [[%mor ~] ~]]]
mos
==
==
::
%txt :: text keys
?: =(%none buy.u.q.q.yar) beep
=+ let=(lent p.p.kyz)
%- edit
%= u.q.q.yar
bus (add let bus.u.q.q.yar)
bul (add let bul.u.q.q.yar)
but
;: weld
(scag bus.u.q.q.yar but.u.q.q.yar)
p.p.kyz
(slag bus.u.q.q.yar but.u.q.q.yar)
==
==
==
::
%blew +>.$(p.q.yar p.p.kyz) :: window size
%boot
%= +>.$
mos
:_(mos [hen %pass ~ (note %a p.kyz)])
==
::
%crud :: error trace
=. q.kyz [[%leaf (trip p.kyz)] q.kyz]
|- ^+ +>.^$
?~ q.kyz +>.^$
(fume:$(q.kyz t.q.kyz) '!' `tank`i.q.kyz)
::
%flow
+>.$
::
%hail :: refresh
+>.$
::+>.$(mos :_(mos (poke %term-ctrl -:!>(%hail) %hail)))
::
%harm :: all terms hung up
=+ nug=((map duct yard) [[hen (~(get by dug) hen)] ~ ~])
^+ +>.$
%= +>.$
dug nug
::S mos :_(mos [hen %pass ~ %b kyz])
==
::
%hook :: this term hung up
~& %dill-hook-not-implemented
+>.$
::S +>.$(dug (~(del by dug) hen), mos :_(mos [hen %pass ~ %b kyz]))
::
%init
=. def `(fall def +.hen)
%= +>.$
our p.kyz
mos
:_ mos
[(need def) %pass / %c %warp [p.kyz p.kyz] %main `[%& %y [%ud 1] /]]
==
::
%talk (furl (~(win re p.kyz) 0 p.q.yar)) :: program output
%text $(kyz [%talk %leaf p.kyz]) :: simple message
==
::
++ poke
|= msg=mess
^- move
:^ hen %pass /term-mess
:^ %g %mess [our /terminal]
:- our msg
::
++ yerk :: complete core
^- [p=(list move) q=ship r=(unit duct) s=(map duct yard)]
:^ (flop mos) our def
(~(put by dug) hen yar)
--
--
=| $: %1 ::
our=ship ::
def=(unit duct) ::
dug=(map duct yard) ::
== ::
|= [now=@da eny=@ ski=sled] :: current invocation
|% :: poke/peek pattern
++ call :: handle request
|= $: hen=duct
hic=(hypo (hobo kiss))
==
^- [p=(list move) q=_..^$]
=> %= . :: XX temporary
q.hic
^- kiss
?: ?=(%soft -.q.hic)
:: ~& [%dill-call-soft (,@tas `*`-.p.q.hic)]
((hard kiss) p.q.hic)
?: (~(nest ut -:!>(*kiss)) | p.hic) q.hic
~& [%dill-call-flub (,@tas `*`-.q.hic)]
((hard kiss) q.hic)
==
?: ?=(%flog -.q.hic)
:_ ..^$
%+ turn (~(tap by dug) *(list ,[p=duct q=yard]))
|=([a=duct b=yard] [a %slip %d p.q.hic])
=+ res=yerk:(lear:(dy hen our now def dug) q.hic)
[-.res ..^$(our +<.res, dug +>+.res, def +>-.res)]
::
++ doze
|= [now=@da hen=duct]
^- (unit ,@da)
~
::
++ load :: XX LEGACY 12-16-2014
|= $= old
$% [%0 our=ship def=(unit duct) dug=(map duct yord)]
[%1 our=ship def=(unit duct) dug=(map duct yard)]
==
^+ ..^$
?- -.old
%1 %_(..^$ our our.old, def def.old, dug dug.old)
%0 %= $
old
%= old
- %1
dug (~(run by dug.old) |=(yor=yord [p q r | *@da]:yor))
==
==
==
::
++ scry
|= [fur=(unit (set monk)) ren=@tas his=ship syd=desk lot=coin tyl=path]
^- (unit (unit (pair mark ,*)))
[~ ~ [%tank >dug<]]
::
++ stay [%1 our def dug]
++ take :: process move
|= [tea=wire hen=duct hin=(hypo sign)]
^- [p=(list move) q=_..^$]
=+ res=yerk:(leap:(dy hen our now def dug) tea q.hin)
[-.res ..^$(our +<.res, dug +>+.res, def +>-.res)]
--

345
arvo/dull.hoon Normal file
View File

@ -0,0 +1,345 @@
!:
:: dill (4d), terminal handling
::
|= pit=vase
=> |% :: interface tiles
++ axle :: all dill state
$: %2 ::
ore=(unit ship) :: identity once set
hey=(unit duct) :: default duct
dug=(map duct axon) :: conversations
== ::
++ axon :: dill per duct
$: ram=term :: console program
wid=_80 :: terminal width
pos=@ud :: cursor position
see=(list ,@c) :: current line
== ::
-- ::
=> |% :: console protocol
++ console-action :: console to app
$% [%det console-change] :: edit prompt line
[%inn ~] :: enter session
[%out ~] :: exit session
[%ret ~] :: submit and clear
== ::
++ console-buffer (list ,@c) :: command state
++ console-change :: network change
$: ler=console-clock :: destination clock
haw=@uvH :: source hash
ted=console-edit :: state change
== ::
++ console-clock ,[own=@ud his=@ud] :: vector clock
++ console-edit :: shared state change
$% [%del p=@ud] :: delete one at
[%ins p=@ud q=@c] :: insert at
[%mor p=(list console-edit)] :: combination
[%nop ~] :: no-op
[%set p=console-buffer] :: discontinuity
== ::
++ console-effect :: app to console
$% [%bel ~] :: beep
[%blk p=@ud q=@c] :: blink/match char at
[%clr ~] :: clear screen
[%det console-change] :: edit input
[%nex ~] :: save and clear input
[%tan p=(list tank)] :: classic tank
:: [%taq p=tanq] :: modern tank
[%txt p=tape] :: text line
== ::
++ dill-belt :: console input
$% [%aro p=?(%d %l %r %u)] :: arrow key
[%bac ~] :: true backspace
[%cru p=@tas q=(list tank)] :: echo error
[%ctl p=@ud] :: control-key
[%del ~] :: true delete
[%met p=@ud] :: meta-key
[%ret ~] :: return
[%rez p=@ud q=@ud] :: resize, cols, rows
[%txt p=(list ,@c)] :: utf32 text
[%yow p=gill] :: connect to app
== ::
++ dill-blit :: console output
$% [%bel ~] :: make a noise
[%clr ~] :: clear the screen
[%hop p=@ud] :: set cursor position
[%pro p=(list ,@c)] :: show as cursor/line
[%out p=(list ,@c)] :: send output line
[%sag p=path q=*] :: save to jamfile
[%sav p=path q=@] :: save to file
== ::
++ gill ,@tas :: general contact
-- => ::
|% :: protocol below
++ blew ,[p=@ud q=@ud] :: columns rows
++ belt :: raw console input
$% [%aro p=?(%d %l %r %u)] :: arrow key
[%bac ~] :: true backspace
[%ctl p=@ud] :: control-key
[%del ~] :: true delete
[%met p=@ud] :: meta-key
[%ret ~] :: return
[%txt p=(list ,@c)] :: utf32 text
== ::
++ blit :: raw console output
$% [%bel ~] :: make a noise
[%clr ~] :: clear the screen
[%hop p=@ud] :: set cursor position
[%lin p=(list ,@c)] :: set current line
[%mor ~] :: newline
[%sag p=path q=*] :: save to jamfile
[%sav p=path q=@] :: save to file
== ::
++ flog :: sent to %dill
$% [%crud p=@tas q=(list tank)] ::
[%text p=tape] ::
[%veer p=@ta q=path r=@t] :: install vane
[%vega p=path] :: reboot by path
[%verb ~] :: verbose mode
== ::
++ gift :: out result <-$
$% [%bbye ~] :: reset prompt
[%blit p=(list blit)] :: terminal output
[%init p=@p] :: set owner
[%logo ~] :: logout
[%veer p=@ta q=path r=@t] :: install vane
[%vega p=path] :: reboot by path
[%verb ~] :: verbose mode
== ::
++ kiss :: in request ->$
$% [%belt p=belt] :: terminal input
[%blew p=blew] :: terminal config
[%boot p=*] :: weird %dill boot
[%crud p=@tas q=(list tank)] :: error with trace
[%flog p=flog] :: wrapped error
[%flow p=@tas q=(list gill)] :: terminal config
[%hail ~] :: terminal refresh
[%hook ~] :: this term hung up
[%harm ~] :: all terms hung up
[%init p=ship] :: after gall ready
[%noop ~] :: no operation
[%talk p=tank] ::
[%text p=tape] ::
[%veer p=@ta q=path r=@t] :: install vane
[%vega p=path] :: reboot by path
[%verb ~] :: verbose mode
== ::
-- => ::
|% :: protocol outward
++ mess ::
$% [%dill-belt p=(hypo dill-belt)] ::
== ::
++ move ,[p=duct q=(mold note gift)] :: local move
++ note-ames :: weird ames move
$% [%make p=(unit ,@t) q=@ud r=@ s=?] ::
[%sith p=@p q=@uw r=?] ::
== ::
++ note-dill :: note to self, odd
$% [%crud p=@tas q=(list tank)] ::
[%text p=tape] ::
[%veer p=@ta q=path r=@t] :: install vane
[%vega p=path] :: reboot by path
[%verb ~] :: verbose mode
== ::
++ note-gall :: outbound message
$% [%mess p=[ship q=path] q=ship r=mess] ::
[%nuke p=[p=ship q=path] q=ship] ::
[%show p=[p=ship q=path] q=ship r=path] ::
[%took p=[p=ship q=path] q=ship] ::
== ::
++ note ::
$% [%a note-ames] :: out request $->
[%d note-dill] ::
[%g note-gall] ::
== ::
++ riff ,[p=desk q=(unit rave)] :: see %clay
++ sign-ames ::
$% [%nice ~] ::
== ::
++ sign-clay ::
$% [%note p=@tD q=tank] ::
== ::
++ sign-gall ::
$% [%crud p=@tas q=(list tank)] ::
[%mean p=ares] ::
[%nice ~] ::
[%rush %dill-blit dill-blit] ::
== ::
++ sign-time ::
$% [%wake ~] ::
== ::
++ sign :: in result $<-
$% [%a sign-ames] ::
[%c sign-clay] ::
[%g sign-gall] ::
[%t sign-time] ::
== ::
:::::::: :: dill tiles
--
=| all=axle
|= [now=@da eny=@ ski=sled] :: current invocation
=> |%
++ as :: per cause
|_ $: [moz=(list move) hen=duct our=ship]
axon
==
++ abet :: resolve
^- [(list move) axle]
[(flop moz) all(dug (~(put by dug.all) hen +<+))]
::
++ call :: receive input
|= kyz=kiss
^+ +>
?+ -.kyz ~& [%strange-kiss -.kyz] +>
%flow +>
%belt (send `dill-belt`p.kyz)
%crud (send `dill-belt`[%cru p.kyz q.kyz])
%blew (send %rez p.p.kyz q.p.kyz)
%veer (dump kyz)
%vega (dump kyz)
%verb (dump kyz)
==
::
++ dump :: pass down to hey
|= git=gift
?> ?=(^ hey.all)
+>(moz [[u.hey.all %give git] moz])
::
++ done :: return gift
|= git=gift
+>(moz :_(moz [hen %give git]))
::
++ from :: receive belt
|= bit=dill-blit
^+ +>
?: ?=(%out -.bit)
%+ done %blit
:~ [%lin p.bit]
[%mor ~]
[%lin see]
[%hop pos]
==
?: ?=(%pro -.bit)
(done(see p.bit) %blit [[%lin p.bit] [%hop pos] ~])
?: ?=(%hop -.bit)
(done(pos p.bit) %blit [bit ~])
(done %blit [bit ~])
::
++ init :: initialize
|= gyl=(list gill)
^+ +>
=. moz :_(moz [hen %pass ~ %g %show [our [ram ~]] our ~])
|- ^+ +>.^$
?~ gyl +>.^$
$(gyl t.gyl, +>.^$ (send %yow i.gyl))
::
++ send :: send action
|= bet=dill-belt
%_ +>
moz
:_ moz
[hen %pass ~ %g %mess [our [ram ~]] our [%dill-belt -:!>(bet) bet]]
==
::
++ take :: receive
|= sih=sign
^+ +>
?- sih
[%a %nice *]
:: ~& [%take-nice-ames sih]
+>
::
[%c %note *]
(from %out (tuba ~(ram re q.+.sih)))
::
[%g %crud *]
(send %cru p.+.sih q.+.sih)
::
[%g %mean *]
+>(moz [[hen %give %logo ~] moz])
::
[%g %nice *]
:: ~& [%take-nice sih]
+>
::
[%g %rush %dill-blit *]
=. moz :_(moz `move`[hen %pass ~ %g %took [our [ram ~]] our])
(from +>+.sih)
::
[%t %wake *]
:: ~& %dill-wake
+>
==
--
::
++ ax :: make ++as
|= [hen=duct kyz=kiss] ::
?~ ore.all ~
=+ nux=(~(get by dug.all) hen)
?^ nux (some ~(. as [~ hen u.ore.all] u.nux))
?. ?=(%flow -.kyz) ~
%- some
%. q.kyz
~(init as [~ hen u.ore.all] [p.kyz 80 0 (tuba "<{(trip p.kyz)}>")])
--
|% :: poke/peek pattern
++ call :: handle request
|= $: hen=duct
hic=(hypo (hobo kiss))
==
^- [p=(list move) q=_..^$]
=> %= . :: XX temporary
q.hic
^- kiss
?: ?=(%soft -.q.hic)
:: ~& [%dill-call-soft (,@tas `*`-.p.q.hic)]
((hard kiss) p.q.hic)
?: (~(nest ut -:!>(*kiss)) | p.hic) q.hic
~& [%dill-call-flub (,@tas `*`-.q.hic)]
((hard kiss) q.hic)
==
?: ?=(%boot -.q.hic)
:_(..^$ [hen %pass ~ (note %a p.q.hic)]~)
?: ?=(%flog -.q.hic)
:_(..^$ ?~(hey.all ~ [u.hey.all %slip %d p.q.hic]~))
?: ?=(%init -.q.hic)
[~ ..^$(ore.all `p.q.hic)]
=. hey.all ?^(hey.all hey.all `hen)
=+ nus=(ax hen q.hic)
?~ nus
~& [%dill-no-flow q.hic]
[~ ..^$]
=^ moz all abet:(call:u.nus q.hic)
[moz ..^$]
::
++ doze
|= [now=@da hen=duct]
^- (unit ,@da)
~
::
++ load :: totally disabled
|= old=*
..^$(ore.all `~zod)
::
++ scry
|= [fur=(unit (set monk)) ren=@tas his=ship syd=desk lot=coin tyl=path]
^- (unit (unit (pair mark ,*)))
[~ ~]
::
++ stay all
::
++ take :: process move
|= [tea=wire hen=duct hin=(hypo sign)]
^- [p=(list move) q=_..^$]
?: =(~ ore.all)
~& [%take-back q.hin]
[~ ..^$]
?. (~(has by dug.all) hen)
~& [%take-weird-sign q.hin]
~& [%take-weird-hen hen]
[~ ..^$]
=+ our=?>(?=(^ ore.all) u.ore.all)
=^ moz all
abet:(~(take as [~ hen our] (~(got by dug.all) hen)) q.hin)
[moz ..^$]
--

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,8 @@
::
++ bead ,[p=(set beam) q=cage] :: computed result
++ gift :: out result <-$
$% [%made p=(each bead (list tank))] :: computed result
$% [%made p=@uvH q=(each cage tang)] :: computed result
[%news ~] :: fresh depends
== ::
++ heel path :: functional ending
++ hock :: standard label
@ -37,7 +38,7 @@
[%dub p=term q=horn] :: /= apply face
[%fan p=(list horn)] :: /. list
[%for p=path q=horn] :: /, descend
[%hel p=@ud q=horn] :: /% propogate heel
[%hel p=@ud q=horn] :: /% propagate heel
[%hub p=horn] :: /@ list by @ud
[%man p=(map span horn)] :: /* hetero map
[%nap p=horn] :: /_ homo map
@ -49,6 +50,7 @@
== ::
++ kiss :: in request ->$
$% [%exec p=@p q=(unit silk)] :: make / kill
[%wasp p=@p q=@uvH] :: depends query
== ::
++ move ,[p=duct q=(mold note gift)] :: local move
++ note :: out request $->
@ -88,6 +90,7 @@
++ baby :: state by ship
$: tad=[p=@ud q=(map ,@ud task)] :: tasks by number
dym=(map duct ,@ud) :: duct to task number
deh=deps :: depends by hash
jav=(map ,* calx) :: cache
== ::
++ bolt :: gonadic edge
@ -95,8 +98,8 @@
$: p=cafe :: cache
$= q ::
$% [%0 p=(set beam) q=a] :: depends/product
[%1 p=(set ,[p=care q=beam r=(list tank)])] :: blocks
[%2 p=(list tank)] :: error
[%1 p=(set ,[p=care q=beam r=tang])] :: blocks
[%2 p=(set beam) q=tang] :: depends/error
== ::
== ::
:: ::
@ -107,6 +110,7 @@
++ cafe :: live cache
$: p=(set calx) :: used
q=(map ,* calx) :: cache
r=deps :: dependencies
== ::
:: ::
++ calm :: cache metadata
@ -115,11 +119,13 @@
== ::
++ calx :: concrete cache line
$% [%hood p=calm q=(pair beam cage) r=hood] :: compile
[%bake p=calm q=(trel mark beam heel) r=(unit vase)]:: load
[%slit p=calm q=[p=type q=type] r=type] :: slam type
[%slim p=calm q=[p=type q=twig] r=(pair type nock)]:: mint
[%slap p=calm q=[p=vase q=twig] r=vase] :: compute
[%slam p=calm q=[p=vase q=vase] r=vase] :: compute
== ::
++ deps (map ,@uvH (set beam)) :: hashed depends
++ task :: problem in progress
$: nah=duct :: cause
kas=silk :: problem
@ -132,6 +138,7 @@
|= cax=calx
?+ sem !!
%hood ?>(?=(%hood -.cax) r.cax)
%bake ?>(?=(%bake -.cax) r.cax)
%slap ?>(?=(%slap -.cax) r.cax)
%slam ?>(?=(%slam -.cax) r.cax)
%slim ?>(?=(%slim -.cax) r.cax)
@ -154,15 +161,26 @@
++ chub :: cache merge
|= [a=cafe b=cafe] ::
^- cafe ::
[(grom p.a p.b) (grum q.a q.b)] ::
[(grom p.a p.b) (grum q.a q.b) (grum r.a r.b)] ::
:: ::
++ faun |=([a=cafe b=vase] (fine a `cage`noun/b)) :: vase to cage
++ feel |=([a=cafe b=cage] (fine a q.b)) :: cage to vase
++ fest |*([a=cafe b=*] (fine a [~ u=b])) :: bolt to unit
++ fest :: bolt to success
|= a=beam ::
|*([b=cafe c=*] (flag a (fine b [~ u=c]))) ::
:: ::
++ fine |* [a=cafe b=*] :: bolt from data
[p=`cafe`a q=[%0 p=*(set beam) q=b]] ::
++ flaw |=([a=cafe b=(list tank)] [p=a q=[%2 p=b]]) :: bolt from error
::
:: ::
++ flaw |= [a=cafe b=tang] :: bolt from error
[p=a q=[%2 p=*(set beam) q=b]] ::
++ flag :: beam into deps
|* [a=beam b=(bolt)] ::
?: ?=(%1 -.q.b) b
=. p.q.b (~(put in p.q.b) a)
b
:: ::
++ flue |=(a=cafe (fine a ~)) :: cafe to empty
++ grom :: merge sets
|* [one=(set) two=(set)]
^+ one
@ -184,6 +202,10 @@
=+ gib=(wox p.n.r.arc)
?~(gib rac [[u.gib p.n.r.arc] rac])
::
++ slob :: XX belongs in h/h
|= [cog=@tas typ=type]
(~(has in (sa (sloe typ))) cog)
::
++ za :: per event
=| $: $: $: our=ship :: computation owner
hen=duct :: event floor
@ -218,12 +240,12 @@
==
~(exec zo [num `task`[hen u.kus 0 ~]])
::
++ apel :: stateless
|= [hen=duct kus=silk]
^- (unit gift)
=+ num=0 :: XX
~(exit zo [num `task`[hen kus 0 ~]])
::
::++ apel :: stateless
:: |= [hen=duct kus=silk]
:: ^- (unit gift)
:: =+ num=0 :: XX
:: ~(exit zo [num `task`[hen kus 0 ~]])
::::
++ axon :: take
|= [num=@ud tik=@ud sih=sign]
^+ +>
@ -236,7 +258,45 @@
(~(resp zo [num u.tus]) tik p.+.sih)
==
::
++ axun :: take rev update
|= [dep=@uvH sih=sign]
^+ +>
?- -.+.sih
%writ
+>.$(mow :_(mow [hen %give %news ~]))
==
::
++ awap :: get next revision
~% %ford-w ..is ~
|= dep=@uvH
%_ +>.$
mow
%- welp :_ mow
%+ turn ~|(dep-missed/dep (~(tap in (~(got by deh.bay) dep))))
|= a=beam
:^ hen %pass [(scot %p our) (scot %uv dep) ~]
=- [%c [%warp [our p.a] q.a ~ [%& %y ud/+(`@ud`-) s.a]]]
?. ?=(%ud -.r.a)
;;(@ (need (need (ska %cw (tope -.a /)))))
?: =(0 p.r.a)
;;(@ (need (need (ska %cw (tope -.a(r da/now) /)))))
p.r.a
==
::
++ zo
~% %ford-z
..is
==
%fade fade
%fair fair
%fang fang
%lime lime
%lima lima
%link link
%lope lope
%make make
%meow meow
==
|_ [num=@ud task]
++ abet %_(..zo q.tad.bay (~(put by q.tad.bay) num +<+))
++ amok
@ -278,16 +338,16 @@
%1 hoc
%0
=^ cux p.hoc ((calk p.hoc) sem q.q.hoc)
?~ cux
=+ nuf=(cope hoc fun)
?- -.q.nuf
%2 nuf
%1 nuf
%0
:- p=(came p.nuf `calx`[sem `calm`[now p.q.nuf] q.q.hoc q.q.nuf])
q=q.nuf
==
[p=p.hoc q=[%0 p=p.q.hoc q=((calf sem) u.cux)]]
?^ cux
[p=p.hoc q=[%0 p=p.q.hoc q=((calf sem) u.cux)]]
=+ nuf=(cope hoc fun)
?- -.q.nuf
%2 nuf
%1 nuf
%0
:- p=(came p.nuf `calx`[sem `calm`[now p.q.nuf] q.q.hoc q.q.nuf])
q=q.nuf
==
==
::
++ coax :: bolt across
@ -315,19 +375,19 @@
++ cool :: error caption
|* [cyt=trap hoc=(bolt)]
?. ?=(%2 -.q.hoc) hoc
[p.hoc [%2 *cyt p.q.hoc]]
[p.hoc [%2 p.q.hoc *cyt q.q.hoc]]
::
++ cope :: bolt along
|* [hoc=(bolt) fun=(burg)]
?- -.q.hoc
%2 hoc
%1 hoc
%2 hoc
%0 =+ nuf=(fun p.hoc q.q.hoc)
:- p=p.nuf
^= q
?- -.q.nuf
%2 q.nuf
%1 q.nuf
%2 [%2 p=(grom `_p.q.nuf`p.q.hoc p.q.nuf) q=q.q.nuf]
%0 [%0 p=(grom `_p.q.nuf`p.q.hoc p.q.nuf) q=q.q.nuf]
== ==
::
@ -337,7 +397,7 @@
:- p=cof
^= q
?- -.ton
%2 [%2 p=p.ton]
%2 [%2 p=*(set beam) q=p.ton]
%0 [%0 p=*(set beam) q=(fun p.ton)]
%1 :: ~& [%coup-need ((list path) p.ton)]
=- ?- -.faw
@ -345,23 +405,24 @@
^= p
%- sa
%+ turn p.faw
|=(a=[care beam] [-.a +.a *(list tank)])
| [%2 p=p.faw]
|=(a=[care beam] [-.a +.a *tang])
| [%2 p=*(set beam) q=p.faw]
==
^= faw
|- ^- (each (list (pair care beam)) (list tank))
|- ^- (each (list (pair care beam)) tang)
?~ p.ton [%& ~]
=+ nex=$(p.ton t.p.ton)
=+ err=|=(a=tape [%| leaf/a ?:(?=(& -.nex) ~ p.nex)])
=+ pax=(path i.p.ton)
?~ pax [%| (smyt pax) ?:(?=(& -.nex) ~ p.nex)]
?~ pax (err "blocking empty")
?. ?=(%c (end 3 1 i.pax))
[%| leaf/"blocking not clay" (smyt pax) ?:(?=(& -.nex) ~ p.nex)]
(err "blocking not clay")
=+ ren=((soft care) (rsh 3 1 i.pax))
?~ ren
[%| leaf/"blocking not care" (smyt pax) ?:(?=(& -.nex) ~ p.nex)]
(err "blocking not care")
=+ zis=(tome t.pax)
?~ zis
[%| leaf/"blocking not beam" (smyt pax) ?:(?=(& -.nex) ~ p.nex)]
(err "blocking not beam")
?- -.nex
& [%& [u.ren u.zis] p.nex]
| nex
@ -370,7 +431,7 @@
::
++ cowl :: each to bolt
|= cof=cafe
|* [tod=(each ,* (list tank)) fun=$+(* *)]
|* [tod=(each ,* tang) fun=$+(* *)]
%+ (coup cof)
?- -.tod
%& [%0 p=p.tod]
@ -378,29 +439,41 @@
==
fun
::
++ coze :: pass dependencies
|* [hoc=(bolt) fon=$+((set beam) (burg))]
?+(-.q.hoc hoc %0 (cope hoc (fon p.q.hoc)))
::
++ dash :: process cache
|= cof=cafe
^+ +>
%_(+> jav.bay q.cof)
::
++ exit :: stateless exec
^- (unit gift)
=+ bot=(make [~ jav.bay] kas)
:: =. ..exec (dash p.bot)
?- -.q.bot
%0 `[%made %& p.q.bot q.q.bot]
%2 `[%made %| p.q.bot]
%1 ~
==
%_(+> jav.bay q.cof, deh.bay r.cof)
::
++ daze :: remember depends
|= dep=(set beam)
^+ [*@uvH deh.bay]
?~ dep [0v0 deh.bay]
=+ hap=(sham dep)
[hap (~(put by deh.bay) hap dep)]
::++ exit :: stateless exec
:: ^- (unit gift)
:: =+ bot=(make [~ jav.bay deh.bay] kas)
:: :: =. ..exec (dash p.bot)
:: ?- -.q.bot
:: %0 `[%made p.q.bot %& q.q.bot]
:: %2 `[%made p.q.bot %| q.q.bot]
:: %1 ~
:: ==
::::
++ exec :: execute app
^+ ..zo
?: !=(~ q.kig) ..zo
=+ bot=(make [~ jav.bay] kas)
=+ bot=(make [~ jav.bay deh.bay] kas)
=. ..exec (dash p.bot)
?- -.q.bot
%0 amok:(expo [%made %& p.q.bot q.q.bot])
%2 amok:(expo [%made %| p.q.bot])
%0 =^ dep deh.bay (daze p.q.bot)
amok:(expo [%made dep %& q.q.bot])
%2 =^ dep deh.bay (daze p.q.bot)
amok:(expo [%made dep %| q.q.bot])
%1 =+ zuk=(~(tap by p.q.bot) ~)
=< abet
|- ^+ ..exec
@ -422,6 +495,7 @@
%+ (clef %hood) (fine cof bem cay)
^- (burg (pair beam cage) hood)
|= [cof=cafe bum=beam cay=cage]
:: ~& fade/clef-miss/bem
=+ rul=(fair bem)
?. ?=(@ q.q.cay)
(flaw cof ~)
@ -431,23 +505,26 @@
(fine cof p.u.q.vex)
::
++ fang :: protocol door
|= [cof=cafe for=mark bek=beak]
|= [cof=cafe dep=(set beam) for=mark bek=beak]
^- (bolt vase)
=+ pax=/door/[for]/mar
=+ ^= bem ^- beam
:_ pax
?: &(=(p.bek our) =(q.bek %main)) bek
=+ oak=[our %main %da now]
?: &(=(p.bek our) =(q.bek %main) !=(r.bek [%da now]))
bek
=+ oak=-:(norm [our %main %da now] ~) :: XX at requested one
?: ?=([~ ~ *] (ska %cy (tope [oak pax])))
oak
bek
(cope (fade cof %hook bem) abut:(meow bem ~))
=^ deh r.cof (daze(deh.bay r.cof) dep) :: XX sanity
=+ arg=`spur`[%dep (scot %uv deh) ~]
(cope (fade cof %hook bem) abut:(meow bem arg))
::
++ fair :: hood parsing rule
|= bem=beam
=+ :* vez=(vang | (tope bem(r [%ud 0])))
voz=(vang | (tope bem))
==
==
=< hood
|%
++ case
@ -600,7 +677,7 @@
^- (bolt cage)
%+ cope
|- ^- (bolt (list (pair wing vase)))
?~ muy (fine cof ~)
?~ muy (flue cof)
%+ cope (make cof q.i.muy)
|= [cof=cafe cay=cage]
%+ cope ^$(muy t.muy)
@ -636,12 +713,13 @@
%+ cope (lend cof bem)
|= [cof=cafe arc=arch]
?^ q.arc
(cope (cope (liar cof bem) (lake for bek)) fest)
(cope (cope (liar cof bem) (lake for bek)) (fest (norm bem)))
?: (~(has by r.arc) %hook)
%+ cope (fade cof %hook bem)
|= [cof=cafe hyd=hood]
(cope (cope (abut:(meow bem arg) cof hyd) (lake for bek)) fest)
(fine cof ~)
%+ cope (cope (abut:(meow bem arg) cof hyd) (lake for bek))
(fest (norm bem))
(flue cof)
::
++ lake :: check/coerce
|= [for=mark bek=beak]
@ -651,15 +729,15 @@
?: ?=(?(%gate %core %door %hoon %hook) for)
:: ~& [%lake-easy for bek]
(fine cof sam)
%+ cope (fang cof for bek)
%+ cope (fang cof ~ for bek)
|= [cof=cafe tux=vase]
=+ bob=(slot 6 tux)
?: (~(nest ut p.bob) | p.sam)
(fine cof sam)
?. (slab %grab p.tux)
?. (slob %grab p.tux)
(flaw cof [%leaf "ford: no grab: {<[for bek]>}"]~)
=+ gab=(slap tux [%cnzy %grab])
?. (slab %noun p.gab)
?. (slob %noun p.gab)
(flaw cof [%leaf "ford: no noun: {<[for bek]>}"]~)
%+ cope (maul cof (slap gab [%cnzy %noun]) [%noun q.sam])
|= [cof=cafe pro=vase]
@ -714,21 +792,23 @@
++ lily :: translation targets
|= [cof=cafe for=mark bek=beak]
^- (bolt (list ,@tas))
=+ raf=(fang cof for bek)
=+ raf=(fang cof ~ for bek)
?: =(%2 -.q.raf) (fine p.raf ~)
%+ cope raf
|= [cof=cafe vax=vase]
%+ fine cof
%+ weld
^- (list ,@tas)
?. (slab %garb p.vax) ~
?. (slob %garb p.vax) ~
=+ gav=((soft (list ,@tas)) q:(slap vax [%cnzy %garb]))
?~(gav ~ u.gav)
?. (slab %grow p.vax) ~
?. (slob %grow p.vax) ~
=+ gow=(slap vax [%cnzy %grow])
(sloe p.gow)
::
++ lima :: load at depth
|= [cof=cafe for=mark bem=beam arg=heel]
%+ (clef %bake) [p=cof q=[%0 p=[bem `~] q=[for bem arg]]]
|= [cof=cafe for=mark bem=beam arg=heel]
^- (bolt (unit vase))
%+ cope (lend cof bem)
@ -737,16 +817,15 @@
?: (~(has by r.arc) for)
(lace cof for bem(s [for s.bem]) arg)
=+ haz=(turn (~(tap by r.arc) ~) |=([a=@tas b=~] a))
?~ haz (fine cof ~)
?~ haz (flue cof)
%+ cope (lion cof for -.bem haz)
|= [cof=cafe wuy=(unit (list ,@tas))]
?~ wuy (fine cof ~)
?> ?=(^ u.wuy)
%+ cope (make cof %bake i.u.wuy bem arg)
|= [cof=cafe hoc=cage]
%+ cope (lope cof i.u.wuy t.u.wuy -.bem q.hoc)
|= [cof=cafe wuy=(list ,@tas)]
?~ wuy (flue cof)
%+ coze (make cof %bake i.wuy bem arg)
|= dep=(set beam) |= [cof=cafe hoc=cage]
%+ cope (lope cof dep i.wuy t.wuy -.bem q.hoc)
|= [cof=cafe vax=vase]
(fine cof ~ vax)
((fest bem) cof vax)
::
++ lime :: load beam
|= [cof=cafe for=mark bem=beam arg=heel]
@ -756,27 +835,27 @@
|= [cof=cafe vux=(unit vase)]
?^ vux (fine cof u.vux)
?~ s.mob
(flaw cof (smyt (tope bem)) ~)
(flag (norm mob) (flaw cof (smyt (tope bem)) ~))
^$(s.mob t.s.mob, mer [i.s.mob mer])
::
++ link :: translate
|= [cof=cafe too=mark for=mark bek=beak vax=vase]
|= [cof=cafe dep=(set beam) too=mark for=mark bek=beak vax=vase]
^- (bolt vase)
?: =(too for) (fine cof vax)
?: |(=(%noun for) =(%$ for))
((lake too bek) cof vax)
%+ cope (fang cof for bek)
%+ cope (fang cof dep for bek)
|= [cof=cafe pro=vase]
?: &((slab %grow p.pro) (slab too p:(slap pro [%cnzy %grow])))
?: &((slob %grow p.pro) (slob too p:(slap pro [%cnzy %grow])))
%+ cope (keel cof pro [[%& 6]~ vax]~)
|= [cof=cafe pox=vase]
(maim cof pox [%tsgr [%cnzy %grow] [%cnzy too]])
%+ cope (fang cof too bek)
%+ cope (fang cof dep too bek)
|= [cof=cafe pro=vase]
=+ ^= zat ^- (unit vase)
?. (slab %grab p.pro) ~
?. (slob %grab p.pro) ~
=+ gab=(slap pro [%cnzy %grab])
?. (slab for p.gab) ~
?. (slob for p.gab) ~
`(slap gab [%cnzy for])
?~ zat
(flaw cof [%leaf "ford: no link: {<[for too]>}"]~)
@ -784,13 +863,13 @@
::
++ lion :: translation search
|= [cof=cafe too=@tas bek=beak fro=(list ,@tas)]
^- (bolt (unit (list ,@tas)))
^- (bolt (list ,@tas))
=| war=(set ,@tas)
=< -:(apex (fine cof fro))
|%
++ apex
|= rof=(bolt (list ,@tas))
^- [(bolt (unit (list ,@tas))) _+>]
^- [(bolt (list ,@tas)) _+>]
?. ?=(%0 -.q.rof) [rof +>.$]
?~ q.q.rof
[[p.rof [%0 p.q.rof ~]] +>.$]
@ -803,23 +882,23 @@
::
++ apse
|= [cof=cafe for=@tas]
^- [(bolt (unit (list ,@tas))) _+>]
^- [(bolt (list ,@tas)) _+>]
?: =(for too)
[(fine cof [~ too ~]) +>.$]
?: (~(has in war) for) [(fine cof ~) +>]
[(fine cof [too ~]) +>.$]
?: (~(has in war) for) [(flue cof) +>]
=. war (~(put in war) for)
=^ hoc +>.$ (apex (lily cof for bek))
:_ +>.$
%+ cope hoc
|= [cof=cafe ked=(unit (list ,@tas))]
(fine cof ?~(ked ~ [~ for u.ked]))
|= [cof=cafe ked=(list ,@tas)]
(fine cof ?~(ked ~ [for ked]))
--
::
++ lope :: translation pipe
|= [cof=cafe for=mark yaw=(list mark) bek=beak vax=vase]
|= [cof=cafe dep=(set beam) for=mark yaw=(list mark) bek=beak vax=vase]
^- (bolt vase)
?~ yaw (fine cof vax)
%+ cope (link cof i.yaw for bek vax)
%+ cope (link cof dep i.yaw for bek vax)
|= [cof=cafe yed=vase]
^$(cof cof, for i.yaw, yaw t.yaw, vax yed)
::
@ -845,7 +924,7 @@
++ make :: reduce silk
|= [cof=cafe kas=silk]
^- (bolt cage)
:: ~& [%make -.kas]
:: ~& [%make (,@tas -.kas)]
?- -.kas
^
%. [cof p.kas q.kas]
@ -860,6 +939,7 @@
==
::
%bake
:: ~& > (tope q.kas)
%+ cool |.(leaf/"ford: bake {<p.kas>} {<(tope q.kas)>}")
%+ cope (lima cof p.kas q.kas r.kas)
|= [cof=cafe vux=(unit vase)]
@ -893,16 +973,25 @@
::
%cast
%+ cool |.(leaf/"ford: cast {<p.kas>}")
%+ cope $(kas q.kas)
|= [cof=cafe cay=cage]
%+ cope (link cof p.kas p.cay [our %main %da now] q.cay)
%+ coze $(kas q.kas)
|= dep=(set beam) |= [cof=cafe cay=cage]
=+ bek=[our %main %da now] :: XX
:: VV ::
%+ cope (link cof dep p.kas p.cay bek q.cay)
|= [cof=cafe vax=vase]
(fine cof [p.kas vax])
::
:: %+ coze (lion cof p.kas bek [p.cay]~)
:: |= dep=(set beam) |= [cof=cafe wuy=(list ,@tas)]
:: ?~ wuy (flaw cof [%leaf "ford: no path: {<[p.cay p.kas]>}"]~)
:: %+ cope (lope cof dep i.wuy t.wuy bek q.cay)
:: |= [cof=cafe vax=vase]
:: (fine cof [p.kas vax])
::
%done [cof %0 p.kas q.kas]
%dude (cool |.(p.kas) $(kas q.kas))
%dune
?~ q.kas [cof [%2 [%leaf "no data"]~]]
?~ q.kas [cof [%2 p.kas [%leaf "no data"]~]]
$(kas [%done p.kas u.q.kas])
::
%mute (kale cof p.kas q.kas)
@ -954,12 +1043,27 @@
zeg=(set term) :: library guard
boy=(list twig) :: body stack
==
~% %meow ..meow
==
%able able
%ably ably
%abut abut
%apex apex
%body body
%chad chad
%chai chai
%chap chap
%head head
%hone hone
%neck neck
%wilt wilt
==
|%
++ able :: assemble preamble
^- twig
:+ %tsgr
?:(=(~ rop) [%$ 1] [%brcn (~(run by rop) |=([* a=twig] [%ash a]))])
[%tssg (turn (flop lot) |=(a=term q:(need (~(get by bil) a))))]
[%tssg (turn (flop lot) |=(a=term q:(~(got by bil) a)))]
::
++ ably :: naked structure
|= [cof=cafe for=mark hyd=hood] :: XX unused
@ -1022,7 +1126,7 @@
|=([a=[@ *] b=[@ *]] (lth -.a -.b))
%+ cope
|- ^- (bolt (list (pair ,@ vase)))
?~ poy (fine cof ~)
?~ poy (flue cof)
%+ cope $(poy t.poy)
|= [cof=cafe nex=(list (pair ,@ vase))]
%+ cope (chap(s.how [q.i.poy s.how]) cof bax hon)
@ -1041,7 +1145,7 @@
|= [cof=cafe arc=arch]
%+ cope
|- ^- (bolt (map ,@ vase))
?~ r.arc (fine cof ~)
?~ r.arc (flue cof)
%+ cope $(r.arc l.r.arc)
|= [cof=cafe lef=(map ,@ vase)]
%+ cope `(bolt (map ,@ vase))`^$(cof cof, r.arc r.r.arc)
@ -1076,7 +1180,7 @@
%fan
%+ cope
|- ^- (bolt (list vase))
?~ p.hon (fine cof ~)
?~ p.hon (flue cof)
%+ cope ^$(hon i.p.hon)
|= [cof=cafe vax=vase]
%+ cope ^$(cof cof, p.hon t.p.hon)
@ -1230,13 +1334,23 @@
==
--
::
++ norm :: normalize beam rev
|= bem=beam
%_ bem
r ?: ?=(%ud -.r.bem) r.bem
=+ num=(ska %cw (tope bem(s ~)))
?. ?=([~ ~ @u] num) r.bem :: XX
[%ud u.u.num]
==
::
++ resp
|= [tik=@ud rot=riot]
^+ ..zo
?> (~(has by q.kig) tik)
?~ rot
=+ `[ren=care bem=beam]`(~(got by q.kig) tik)
amok:(expo [%made %| (smyt ren (tope bem)) ~])
=^ dep deh.bay (daze ~) :: dependencies?
amok:(expo [%made dep %| (smyt ren (tope bem)) ~])
exec(q.kig (~(del by q.kig) tik))
--
--
@ -1247,21 +1361,24 @@
=* lex -
|= [now=@da eny=@ ski=sled] :: activate
^? :: opaque core
~% %ford-d +>+>+>+>+>+> ~
~% %ford-d ..is ~
|% ::
++ call :: request
|= [hen=duct hic=(hypo (hobo kiss))]
^- [p=(list move) q=_..^$]
=> .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic)))
=+ ska=(slod ski)
=+ ska=(slod ski) :: XX depends
=+ ^= our ^- @p
?- -.q.hic
%exec p.q.hic
%wasp p.q.hic
==
=+ ^= bay ^- baby
=+ buy=(~(get by pol.lex) our)
?~(buy *baby u.buy)
=^ mos bay
?: ?=(%wasp -.q.hic)
abet:(~(awap za [[our hen] [now eny ska] ~] bay) q.q.hic)
abet:(~(apex za [[our hen] [now eny ska] ~] bay) q.q.hic)
[mos ..^$(pol (~(put by pol) our bay))]
::
@ -1272,14 +1389,14 @@
::
++ load :: highly forgiving
|= old=*
=. old
?. ?=([%0 *] old) old :: remove at 1
:- %1
|- ^- *
?~ +.old ~
?> ?=([n=[p=* q=[tad=* dym=* jav=*]] l=* r=*] +.old)
:- [p.n.+.old [tad.q.n.+.old dym.q.n.+.old ~]]
[$(+.old l.+.old) $(+.old r.+.old)]
::=. old
:: ?. ?=([%0 *] old) old :: remove at 1
:: :- %1
:: |- ^- *
:: ?~ +.old ~
:: ?> ?=([n=[p=* q=[tad=* dym=* deh=* jav=*]] l=* r=*] +.old)
:: :- [p.n.+.old [tad.q.n.+.old dym.q.n.+.old deh.q.n.+.old ~]]
:: [$(+.old l.+.old) $(+.old r.+.old)]
=+ lox=((soft axle) old)
^+ ..^$
?~ lox
@ -1293,19 +1410,22 @@
[~ ~]
::
++ stay :: save w/o cache
`axle`+>-.$(pol (~(run by pol) |=(a=baby [tad.a dym.a ~])))
`axle`+>-.$(pol (~(run by pol) |=(a=baby [tad.a dym.a deh.a ~])))
::
++ take :: response
|= [tea=wire hen=duct hin=(hypo sign)]
^- [p=(list move) q=_..^$]
=+ ska=(slod ski)
?> ?=([@ @ @ ~] tea)
=+ :* our=(need (slaw %p i.tea))
num=(need (slaw %ud i.t.tea))
tik=(need (slaw %ud i.t.t.tea))
==
?. ?=([@ @ $|(~ [@ ~])] tea)
[~ ..^$] :: XX remove on breach
=+ our=(need (slaw %p i.tea))
=+ bay=(~(got by pol.lex) our)
=^ mos bay
?~ t.t.tea
abet:(~(axun za [[our hen] [now eny ska] ~] bay) (slav %uv i.t.tea) q.hin)
=+ :* num=(need (slaw %ud i.t.tea))
tik=(need (slaw %ud i.t.t.tea))
==
abet:(~(axon za [[our hen] [now eny ska] ~] bay) num tik q.hin)
[mos ..^$(pol (~(put by pol) our bay))]
--

View File

@ -19,7 +19,6 @@
[%meta p=vase] :: meta-gift
[%nice ~] :: message success
== ::
::++ hasp ,[p=ship q=term] :: app identity
++ hapt ,[p=ship q=path] :: app instance
++ hath ,[p=ship q=term] :: app identity
++ kiss :: in request ->$
@ -160,7 +159,7 @@
[%vega p=path] ::
== == ::
$: %f :: by %ford
$% [%made p=(each bead (list tank))] ::
$% [%made p=@uvH q=(each cage tang)] ::
== == == ::
++ toil (pair duct knob) :: work in progress
-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::
@ -362,7 +361,11 @@
:: ~& [%gape-took our imp hen]
[~ ..^^$]
=+ you=`ship`?-(-.kon %mess p.kon, %nuke p.kon, %show p.kon)
=+ mat=(~(got by pol.all) you)
=+ mut=(~(get by pol.all) you)
?~ mut
~& [%gape-lost you hen]
!!
=+ mat=u.mut
=+ sad==+(sad=(~(get by sap.mat) our) ?^(sad u.sad [.(p 1)]:*scad))
=^ num sad
=+ nym=(~(get by q.sad) hen)
@ -407,12 +410,12 @@
:_ ..^$
:_ ~
:- hen
?- -.p.+.sih
?- -.q.+.sih
%|
[%give %crud %gasp-crud p.p.+.sih]
[%give %crud %gasp-crud p.q.+.sih]
::
%&
=+ cay=`cage`q.p.p.+.sih
=+ cay=`cage`p.q.+.sih
?+ -.pax !!
%d [%give (best %rush cay)]
%f [%give (best %rust cay)]
@ -432,36 +435,17 @@
:_ ..^$
=+ rod=|=(ron=roon `note`[%a %wont [our you] [%q %gh imp] num ron])
?+ -.pax !!
%m ?: ?=(%a -.sih) ~
?+ -.sih ~& [%gall-gave-m -.sih] !!
%f
:_ ~ :- hen
?- -.p.+.sih
%| [%give %mean ~ %ford-fail p.p.+.sih]
%& [%pass [%r pax] %g %mess [our imp] you `cage`q.p.p.+.sih]
==
::
%g
:_ ~ :- hen
?- -.+.sih
%crud !!
%dumb !!
%gone !!
%init !!
%logo !!
%mean [%give %mean p.+.sih]
%nice [%give %nice ~]
%rush !!
%rust !!
%sage !!
%verb !!
%veer !!
%vega !!
==
==
%s ?+ -.sih !!
%z ?+ -.sih !!
%a :_ ~ :- hen
[%pass [%r pax] %g %took [our imp] you]
::
%f
:_ ~ :- hen
?- -.q.+.sih
%| [%give %mean ~ %ford-fail p.q.+.sih]
%& [%pass [%r pax] %g %mess [our imp] you `cage`p.q.+.sih]
==
::
%g
:_ ~ :- hen
?- -.+.sih
@ -508,7 +492,8 @@
^- move :- hen
:+ %pass
:* %r
?-(-.rok %m %m, %s %s, %u %s)
:: ?-(-.rok %m %m, %s %s, %u %s)
%z
(scot %p p.saq)
(scot %p q.saq)
(scot %ud num)
@ -571,8 +556,8 @@
::
++ able :: bone to duct
|= ost=bone ^- duct
?: =(0 ost)
[(away ~) ~]
:: ?: =(0 ost)
:: hun.mat
(~(got by r.zam.sat) ost)
::
++ away :: application path
@ -736,17 +721,18 @@
%_(+>.$ ped.sat pen, mow :(weld new old mow))
::
++ drum :: raw dependencies
|= dep=(set beam)
|= dep=@uvH
^+ +>
?> ?=(^ orm.sat)
%- drug
=+ ped=`(set (pair ship desk))`[[our %main] ~ ~]
=+ mav=(~(tap by dep) ~)
|- ^+ ped
?~ mav ped
?: =(r.i.mav [%da u.orm.sat])
$(mav t.mav, ped (~(put in ped) p.i.mav q.i.mav))
$(mav t.mav)
ped
::=+ mav=(~(tap by dep) ~)
::|- ^+ ped
::?~ mav ped
::?: =(r.i.mav [%da u.orm.sat])
:: $(mav t.mav, ped (~(put in ped) p.i.mav q.i.mav))
::$(mav t.mav)
::
++ ford :: exec to ford
|= [pax=path kas=silk]
@ -790,63 +776,56 @@
|= sih=sign
?> ?=(%f -.sih)
^- [(unit (list tank)) _+>]
?- -.p.+.sih
?- -.q.+.sih
& :- ~
%- obey:(morn (slot 3 q.q.p.p.+.sih))
(slot 2 q.q.p.p.+.sih)
| [`p.p.+.sih (give %crud %mack-made p.p.+.sih)]
%- obey:(morn (slot 3 q.p.q.+.sih))
(slot 2 q.p.q.+.sih)
| [`p.q.+.sih (give %crud %mack-made p.q.+.sih)]
==
::
++ meek :: apply peek
|= sih=sign
^- [(unit cage) _+>]
?> ?=(%f -.sih)
?- -.p.+.sih
& =+ vax=`vase`q.q.p.p.+.sih
?- -.q.+.sih
& =+ vax=`vase`q.p.q.+.sih
?. &(?=(^ q.vax) ?=(@ -.q.vax))
[~ (give %crud %peek-lame *(list tank))]
:: ~> %slog.[0 (skol p:(slot 3 vax))]
:- `[((hard mark) -.q.vax) (slot 3 vax)]
+>.$
| [~ (give %crud %meek-made p.p.+.sih)]
| [~ (give %crud %meek-made p.q.+.sih)]
==
::
++ mick :: apply w/depends
|= sih=sign
?> ?=(%f -.sih)
^- [(unit (set beam)) _+>]
?- -.p.+.sih
& :- `p.p.p.+.sih
%- obey:(morn (slot 3 q.q.p.p.+.sih))
(slot 2 q.q.p.p.+.sih)
| [~ (give %crud %mick-made p.p.+.sih)]
^- [[p=? q=@uvH] _+>]
:- [-.q.+.sih p.+.sih]
?- -.q.+.sih
& %- obey:(morn (slot 3 q.p.q.+.sih))
(slot 2 q.p.q.+.sih)
| (give %crud %mick-made p.q.+.sih)
==
::
++ muck :: apply part
|= sih=sign
^- [(unit (list tank)) _+>]
?> ?=(%f -.sih)
?- -.p.+.sih
& [~ (obey q.q.p.p.+.sih)]
| [`p.p.+.sih (give %crud %muck-made p.p.+.sih)]
?- -.q.+.sih
& [~ (obey q.p.q.+.sih)]
| [`p.q.+.sih (give %crud %muck-made p.q.+.sih)]
==
::
++ murk :: apply park
|= sih=sign
^- [(unit cage) _+>]
?> ?=(%f -.sih)
?- -.p.+.sih
& [`q.p.p.+.sih +>.$]
| [~ (give %crud %murk-made p.p.+.sih)]
?- -.q.+.sih
& [`p.q.+.sih +>.$]
| [~ (give %crud %murk-made p.q.+.sih)]
==
::
++ moar :: foreign take
|= $: pax=path
sih=sign
==
^+ +>
!!
::
++ more :: domestic take
|= $: pax=path :: internal position
hin=(hypo sign) :: typed event
@ -926,8 +905,8 @@
::
%prep
=^ gad +>.$ (mick q.hin)
?~ gad (drum ~)
deal:(drum u.gad)
?. p.gad (drum q.gad)
deal:(drum q.gad)
::
%pull
=^ gud +>.$ (mack q.hin)
@ -1164,10 +1143,9 @@
:: ~& [%yawn-told-has ost qol [our hen]]
=+ qul=?~(qol 1 +(u.qol))
=. qel.sat (~(put by qel.sat) ost qul)
:: XX turn me back on!
:: ?: =(10 qul)
:: ~& [%yawn-told-full ost our hen]
:: +>.$(qic.sat ~, vey.sat (~(put to vey.sat) hen %nuke p.kon))
?: =(10 qul)
~& [%yawn-told-full ost our hen]
+>.$(qic.sat ~, vey.sat (~(put to vey.sat) hen %nuke p.kon))
+>.$(qic.sat ~)
::
%load
@ -1209,8 +1187,10 @@
(goc p.q.kon /pock)
:(goc p.q.kon (rsh 3 ofs p.q.kon) /pock)
=+ hyp=?=(%pock (end 3 4 cog))
=+ ^- err=tape
?.(?=(?(%poke %pock) cog) <cog> "{<cog>} with mark {<p.q.kon>}")
?. (warm cog)
(give(qic.sat ~) %mean ~ %poke-find-fail ~)
(give(qic.sat ~) %mean ~ %poke-find-fail leaf/err ~)
?> ?=(^ huv.sat)
=+ ^= sam
;: slop
@ -1218,10 +1198,9 @@
[[%atom %p] p.kon]
?.(hyp q.q.kon (slop !>(p.q.q.kon) q.q.kon))
==
=+ err=?.(?=(?(%poke %pock) cog) <cog> "{<cog>} with mark <p.q.kon>")
:: ~& [%mess-poke cog]
%+ ford /s/poke
:+ %dude leaf/"poking {err}"
:+ %dude leaf/err
[%call (harm cog (conf (core u.huv.sat))) (cove %$ sam)]
::
%show
@ -1235,6 +1214,7 @@
=+ sam=!>([p.kon q.kon])
?> ?=(^ huv.sat)
(yawl [%peek (scot %p p.kon) q.kon] leaf/"peeking" u.huv.sat sam)
~& [%show-dumb app.sat imp q.kon]
(give(qic.sat ~) %dumb ~)
::
%sire

View File

@ -101,6 +101,11 @@
++ nail ,[p=hair q=tape] :: parsing input
++ numb ,@ :: just a number
++ pair |*([a=$+(* *) b=$+(* *)] ,[p=a q=b]) :: just a pair
++ wand |* a=(pole $+(* *)) :: hetero list
|= b=* ::
?~ a ~ ::
?@ b ~ ::
[i=(-.a -.b) t=$(a +.a, b +.b)] ::
++ pass ,@ :: public key
++ path (list span) :: filesys location
++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: line/column range
@ -156,7 +161,12 @@
p=[p=tape q=tape r=tape] :: mid open close
q=(list tank) ::
== ::
==
== ::
++ tanq :: modern tank
$? [~ p=(list tanq)] :: list of printables
[~ ~ p=tape] :: simple string
(pair ,@tas tanq) :: captioned
== ::
++ tape (list char) :: like a string
++ term ,@tas :: Hoon ASCII subset
++ tiki :: test case
@ -227,8 +237,8 @@
[%cndt p=twig q=twig] :: %-(q p)
[%cnhp p=twig q=tusk] :: slam p w/ sample q
[%cntr p=wing q=twig r=tram] :: pull p.q w/ changes
[%cnkt p=twig q=twig r=twig s=twig] :: slam p w/ %*(q r s)
[%cnls p=twig q=twig r=twig] :: slam p w/ %*(q r)
[%cnkt p=twig q=twig r=twig s=twig] :: slam p w/ :*(q r s)
[%cnls p=twig q=twig r=twig] :: slam p w/ :*(q r)
[%cnsg p=wing q=twig r=twig] :: pull p from q with r
[%cnts p=wing q=tram] :: eval. p w/ q changes
[%cnzy p=term] :: pulls limb p
@ -639,6 +649,7 @@
::
++ need :: demand
|* a=(unit)
~| %need
?~ a !!
u.a
::
@ -1151,6 +1162,30 @@
++ tos ~/ %tos :: fetch suffix
|=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
--
::
++ fa :: base58check
=+ key='123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
=+ ^- yek=@ux ~+
=- yek:(roll (trip key) -)
|= [a=char b=@ yek=_`@ux`(fil 3 256 0xff)]
[+(b) (mix yek (lsh 3 `@u`a (~(inv fe 3) b)))]
|%
++ cha |=(a=char `(unit ,@uF)`=+(b=(cut 3 [`@`a 1] yek) ?:(=(b 0xff) ~ `b)))
++ tok
|= a=@ux ^- @ux
=+ b=(pad a)
=- (~(net fe 5) (end 3 4 (shay 32 -)))
(shay (add b (met 3 a)) (lsh 3 b (swap 3 a)))
::
++ pad |=(a=@ =+(b=(met 3 a) ?:((gte b 21) 0 (sub 21 b))))
++ enc |=(a=@ux `@ux`(mix (lsh 3 4 a) (tok a)))
++ den
|= a=@ux ^- (unit ,@ux)
=+ b=(rsh 3 4 a)
?. =((tok b) (end 3 4 a))
~
`b
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cF, signed and modular ints ::
::
@ -2058,8 +2093,8 @@
::
+- get :: grab value by key
~/ %get
|* b=*
|- ^- ?(~ [~ u=_?>(?=(^ a) q.n.a)])
|= b=*
^- $|(~ [~ u=_?>(?=(^ a) q.n.a)])
?~ a
~
?: =(b p.n.a)
@ -2850,6 +2885,13 @@
:: section 2eI, parsing (external) ::
::
++ rash |*([naf=@ sab=_rule] (scan (trip naf) sab)) ::
++ rose |* [los=tape sab=_rule]
=+ vex=(sab [[1 1] los])
=+ len=(lent los)
?. =(+(len) q.p.vex) [%| p=(dec q.p.vex)]
?~ q.vex
[%& p=~]
[%& p=[~ u=p.u.q.vex]]
++ rush |*([naf=@ sab=_rule] (rust (trip naf) sab))
++ rust |* [los=tape sab=_rule]
=+ vex=((full sab) [[1 1] los])
@ -2953,6 +2995,7 @@
++ teff :: length utf8
|= a=@t ^- @
=+ b=(end 3 1 a)
~| %bad-utf8
?: =(0 b)
?>(=(0 a) 0)
?> |((gte b 32) =(10 b))
@ -3208,6 +3251,7 @@
++ ab
|%
++ bix (bass 16 (stun [2 2] six))
++ fem (sear |=(a=@ (cha:fa a)) aln)
++ hif (boss 256 ;~(plug tip tiq (easy ~)))
++ huf %+ cook
|=([a=@ b=@] (wred:un ~(zug mu ~(zag mu [a b]))))
@ -3262,11 +3306,15 @@
++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
++ dum (bass 10 (plus sid:ab))
++ fed ;~ pose
(bass 0x1.0000.0000.0000.0000 (most doh hyf:ab))
%+ bass 0x1.0000.0000.0000.0000
;~((glue doh) ;~(pose hyf:ab huf:ab) (more doh hyf:ab))
::
hyf:ab
huf:ab
hif:ab
tiq:ab
==
++ fim (sear den:fa (bass 58 (plus fem:ab)))
++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
++ lip =+ tod=(ape ted:ab)
(bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
@ -3276,6 +3324,7 @@
--
::
++ co
~% %co ..co ~
=< |_ lot=coin
++ rear |=(rom=tape =>(.(rex rom) rend))
++ rent `@ta`(rap 3 rend)
@ -3348,12 +3397,13 @@
(trip (tod:po (rsh 3 1 q.p.lot)))
rex
==
=+ [dyz=(met 5 q.p.lot) fin=|]
=+ [dyz=(met 5 q.p.lot) fin=| dub=&]
|- ^- tape
?: =(0 dyz)
rex
%= $
fin &
dub !dub
dyz (dec dyz)
q.p.lot (rsh 5 1 q.p.lot)
rex
@ -3365,7 +3415,7 @@
`tape`['-' ~]
(trip (tos:po (end 3 1 q.cog)))
(trip (tod:po (rsh 3 1 q.cog)))
`tape`?:(fin ['-' ?:(=(1 (end 0 1 dyz)) ~ ['-' ~])] ~)
`tape`?.(fin ~ ['-' ?.(dub ~ ['-' ~])])
rex
==
==
@ -3383,6 +3433,9 @@
==
::
%u
?: ?=(%c hay)
%+ welp ['0' 'c' (reap (pad:fa q.p.lot) '1')]
(c-co (enc:fa q.p.lot))
=- (weld p.gam ?:(=(0 q.p.lot) `tape`['0' ~] q.gam))
^= gam ^- [p=tape q=tape]
?+ hay [~ ((ox-co [10 3] |=(a=@ ~(d ne a))) q.p.lot)]
@ -3409,6 +3462,7 @@
=+ rex=*tape
=< |%
++ a-co |=(dat=@ ((d-co 1) dat))
++ c-co (em-co [58 1] |=([? b=@ c=tape] [~(c ne b) c]))
++ d-co |=(min=@ (em-co [10 min] |=([? b=@ c=tape] [~(d ne b) c])))
++ r-co
|= [syn=? nub=@ der=@ ign=(unit tape) ne=?]
@ -3473,6 +3527,7 @@
::
++ ne
|_ tig=@
++ c (cut 3 [tig 1] key:fa)
++ d (add tig '0')
++ x ?:((gte tig 10) (add tig 87) d)
++ v ?:((gte tig 10) (add tig 87) d)
@ -3487,12 +3542,14 @@
--
::
++ so
~% %so + ~
|%
++ bisk
;~ pose
;~ pfix (just '0')
;~ pose
(stag %ub ;~(pfix (just 'b') bay:ag))
(stag %uc ;~(pfix (just 'c') fim:ag))
(stag %ui ;~(pfix (just 'i') dim:ag))
(stag %ux ;~(pfix (just 'x') hex:ag))
(stag %uv ;~(pfix (just 'v') viz:ag))
@ -3555,6 +3612,7 @@
;~(pfix hep (stag %c (cook turf (cook woad urs:ab))))
==
++ nuck
~/ %nuck |= a=nail %. a
%+ knee *coin |. ~+
%- stew
^. stet ^. limo
@ -3638,7 +3696,10 @@
::
++ slay
|= txt=@ta ^- (unit coin)
=+ vex=((full nuck:so) [[1 1] (trip txt)])
=+ ^= vex
?: (gth 0x7fff.ffff txt) :: XX petty cache
~+ ((full nuck:so) [[1 1] (trip txt)])
((full nuck:so) [[1 1] (trip txt)])
?~ q.vex
~
[~ p.u.q.vex]
@ -3659,437 +3720,7 @@
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eM, regular-expressions ::
::
++ pars
|= [a=tape] :: parse tape to rege
^- (unit rege)
=+ foo=((full apex:rags) [[1 1] a])
?~ q.foo
~
[~ p.u.q.foo]
::
++ rags :: rege parsers
=> |%
++ nor ;~(less (mask "^$()|*?+.[\\") (shim 1 127)) :: non-control char
++ les ;~(less bas asp) :: not backslash
++ lep ;~(less (mask "-^[]\\") asp) :: charset non-control
++ asp (shim 32 126) :: printable ascii
++ alb ;~(less ser asp) :: charset literal char
++ mis ;~(less aln asp) :: non alphanumeric
--
|%
++ apex :: top level
%+ knee *rege |. ~+
;~ pose
;~((bend |=(a=[rege rege] (some [%eith a]))) mall ;~(pfix bar apex))
(stag %eith ;~(plug (easy %empt) ;~(pfix bar apex)))
(easy %empt)
==
::
++ mall
%+ knee *rege |. ~+
;~((bend |=(a=[rege rege] (some [%pair a]))) bets mall)
::
++ bets
%+ knee *rege |. ~+
|= tub=nail
=+ vex=(chun tub)
?~ q.vex
vex
=+ a=p.u.q.vex
%- ;~ pose
(cold [%eith %empt a] (jest '??'))
(cold [%manl a] (jest '*?'))
(cold [%plll a] (jest '+?'))
(cold [%eith a %empt] wut)
(cold [%mant a] tar)
(cold [%plls a] lus)
(stag %betl ;~(plug (easy a) ;~(sfix rang wut)))
(stag %betw ;~(plug (easy a) rang))
(stag %binl ;~(plug (easy a) (ifix [kel (jest ',}?')] dim:ag)))
(stag %bant ;~(plug (easy a) (ifix [kel (jest '}?')] dim:ag)))
(stag %bant ;~(plug (easy a) (ifix [kel ker] dim:ag)))
(stag %bint ;~(plug (easy a) (ifix [kel (jest ',}')] dim:ag)))
(easy a)
==
q.u.q.vex
::
++ ranc
|= [a=@ b=@]
^- @
?:((gth a b) 0 (con (bex a) $(a +(a))))
::
++ flap |=(a=@ (mix a (dec (bex 256))))
::
++ rang
%+ sear |=([a=@ b=@] ?:((lte a b) (some [a b]) ~))
(ifix [kel ker] ;~(plug dim:ag ;~(pfix com dim:ag)))
::
++ chun
%+ knee *rege |. ~+
;~ pose
(cold %ende buc)
(cold %sart ket)
(cold %dote dot)
%+ cook |=(a=(list char) (reel a |=([p=char q=rege] [%pair [%lite p] q])))
;~(pfix (jest '\\Q') cape)
|= tub=nail
=+ foo=;~(plug kel dim:ag ;~(pose ker (jest ',}') ;~(plug com dim:ag ker)))
=+ bar=(foo tub)
?~(q.bar (chad tub) (fail tub))
(cook |=([a=rege] [%capt a 0]) (ifix [pel per] apex))
%+ cook |=([a=rege] [%capt a 0])
(ifix [;~(plug (jest '(?P<') (plus aln) gar) per] apex)
(ifix [(jest '(?:') per] apex)
(stag %brac ;~(pfix sel seac))
==
::
++ seac
|= tub=nail
?~ q.tub
(fail tub)
?: =(i.q.tub '^')
(;~(pfix ket (cook flap sead)) tub)
(sead tub)
::
++ sead
%+ knee *@ |. ~+
;~ pose
|= tub=nail
?~ q.tub
(fail tub)
?. =(i.q.tub ']')
(fail tub)
?~ t.q.tub
(fail tub)
?: =(i.t.q.tub '-')
?~ t.t.q.tub
(fail tub)
?: =(i.t.t.q.tub ']')
(;~(pfix ser (cook |=(a=@ (con (bex ']') a)) sade)) tub)
(fail tub)
(;~(pfix ser (cook |=(a=@ (con (bex ']') a)) sade)) tub)
|= tub=nail
?~ q.tub
(fail tub)
?. =(i.q.tub '-')
(fail tub)
?~ t.q.tub
(fail tub)
?: =(i.t.q.tub '-')
?~ t.t.q.tub
(fail tub)
?: =(i.t.t.q.tub ']')
(;~(pfix hep (cook |=(a=@ (con (bex '-') a)) sade)) tub)
(fail tub)
(;~(pfix hep (cook |=(a=@ (con (bex '-') a)) sade)) tub)
(cook |=(a=[@ @] (con a)) ;~(plug seap sade))
==
::
++ sade
%+ knee *@ |. ~+
;~ pose
(cold (bex '-') (jest '-]'))
(cold 0 ser)
(cook |=([p=@ q=@] `@`(con p q)) ;~(plug seap sade))
==
::
++ seap
%+ knee *@ |. ~+
;~ pose
unid
%+ ifix (jest '[:')^(jest ':]')
;~(pose ;~(pfix ket (cook flap chas)) chas)
%+ sear |=([a=@ b=@] ?:((gth a b) ~ (some (ranc a b))))
;~(plug asp ;~(pfix hep alb))
|= tub=nail
?~ q.tub
(fail tub)
?~ t.q.tub
((cook bex les) tub)
?. =(i.t.q.tub '-')
((cook bex les) tub)
?~ t.t.q.tub
((cook bex les) tub)
?: =(i.t.t.q.tub ']')
((cook bex les) tub)
(fail tub)
;~(pfix bas escd)
==
::
++ cape
%+ knee *tape |. ~+
;~ pose
(cold ~ (jest '\\E'))
;~(plug next cape)
(cook |=(a=char (tape [a ~])) next)
(full (easy ~))
==
++ chas :: ascii character set
=- (sear ~(get by -) sym)
%- mo ^- (list ,[@tas @I])
:~ alnum/alnum alpha/alpha ascii/ascii blank/blank cntrl/cntrl
digit/digit graph/graph lower/lower print/print punct/punct
space/space upper/upper word/wordc xdigit/xdigit
==
:: Character sets
++ alnum :(con lower upper digit)
++ alpha :(con lower upper)
++ ascii (ranc 0 127)
++ blank (con (bex 32) (bex 9))
++ cntrl :(con (ranc 0 31) (bex 127))
++ digit (ranc '0' '9')
++ graph (ranc 33 126)
++ lower (ranc 'a' 'z')
++ print (ranc 32 126)
++ punct ;: con
(ranc '!' '/')
(ranc ':' '@')
(ranc '[' '`')
(ranc '{' '~')
==
++ space :(con (ranc 9 13) (bex ' '))
++ upper (ranc 'A' 'Z')
++ white :(con (bex ' ') (ranc 9 10) (ranc 12 13))
++ wordc :(con digit lower upper (bex '_'))
++ xdigit :(con (ranc 'a' 'f') (ranc 'A' 'F') digit)
::
++ chad
%+ knee *rege |. ~+
;~(pose (stag %lite nor) (stag %brac unid) ;~(pfix bas escp))
::
++ escd
%+ cook bex
;~ pose
(cold 0 (just '0'))
(sear ~(get by (mo a/7 t/9 n/10 v/11 f/12 r/13 ~)) low)
(sear |=(a=@ ?:((lth a 256) (some a) ~)) (bass 8 (stun [2 3] cit)))
;~(pfix (just 'x') (bass 16 (stun [2 2] hit)))
(ifix [(jest 'x{') ker] (bass 16 (stun [2 2] hit)))
mis
==
::
++ escp
;~ pose
(stag %lite escd)
(sear ~(get by (mo b/%boun w/[%brac wordc] z/%ende ~)) low)
=- (sear ~(get by (mo -)) hig)
~['A'^%sart 'B'^%bout 'C'^%dote 'Q'^%empt 'W'^[%brac (flap wordc)]]
==
::
++ unid
=+ cha=~(get by (mo d/digit s/white w/wordc ~))
;~ pfix bas
;~ pose
(sear cha low)
(cook flap (sear |=(a=@ (cha (add a 32))) hig))
== ==
--
::
++ ra :: regex engine
|_ a=rege
++ proc :: capture numbering
|= b=@
=- -(+ +>.$(a a))
^- [p=@ a=rege]
?- a
[%capt *] =+ foo=$(a p.a, b +(b))
[p.foo [%capt a.foo b]]
[%eith *] =+ foo=$(a p.a)
=+ bar=$(a q.a, b p.foo)
[p.bar [%eith a.foo a.bar]]
[%pair *] =+ foo=$(a p.a)
=+ bar=$(a q.a, b p.foo)
[p.bar [%pair a.foo a.bar]]
[%manl *] =+ foo=$(a p.a)
[p.foo [%manl a.foo]]
[%plll *] =+ foo=$(a p.a)
[p.foo [%plll a.foo]]
[%binl *] =+ foo=$(a p.a)
[p.foo [%binl a.foo q.a]]
[%betl *] =+ foo=$(a p.a)
[p.foo [%betl a.foo q.a r.a]]
[%mant *] =+ foo=$(a p.a)
[p.foo [%mant a.foo]]
[%plls *] =+ foo=$(a p.a)
[p.foo [%plls a.foo]]
[%bant *] =+ foo=$(a p.a)
[p.foo [%bant a.foo q.a]]
[%bint *] =+ foo=$(a p.a)
[p.foo [%bint a.foo q.a]]
[%betw *] =+ foo=$(a p.a)
[p.foo [%betw a.foo q.a r.a]]
* [b a]
==
::
++ cont
|= [a=(map ,@u tape) b=(map ,@u tape)]
(~(gas by *(map ,@u tape)) (weld (~(tap by a)) (~(tap by b))))
::
++ abor
|= [a=char b=(unit ,[tape (map ,@u tape)])]
^- (unit ,[tape (map ,@u tape)])
?~ b
b
[~ [[a -.u.b] +.u.b]]
::
++ matc
|= [b=tape c=tape]
^- (unit (map ,@u tape))
=+ foo=`(unit ,[tape (map ,@u tape)])`(deep b %empt c)
(bind foo |*(a=^ (~(put by +.a) 0 -.a)))
::
++ chet
|= [b=(unit ,[tape (map ,@u tape)]) c=tape d=tape]
^- (unit ,[tape (map ,@u tape)])
?~ b
b
?~ -.u.b
b
=+ bar=(deep (slag (lent -.u.b) c) %empt d)
?~ bar
bar
b
++ blak (some ["" *(map ,@u tape)])
++ word |=(a=char =((dis wordc:rags (bex a)) 0))
++ deep
|= [b=tape c=rege d=tape]
^- (unit ,[tape (map ,@u tape)])
?- a
%dote ?~(b ~ (some [[i.b ~] *(map ,@u tape)]))
%ende ?~(b blak ~)
%sart ?:(=(b d) blak ~)
%empt blak
%boun =+ ^= luc
?: =(b d)
&
=+ foo=(slag (dec (sub (lent d) (lent b))) d)
(word -.foo)
=+ cuc=?~(b & (word -.b))
?:(!=(luc cuc) blak ~)
%bout =+ ^= luc
?: =(b d)
&
=+ foo=(slag (dec (sub (lent d) (lent b))) d)
(word -.foo)
=+ cuc=?~(b & (word -.b))
?:(=(luc cuc) blak ~)
[%capt *] =+ foo=$(a p.a)
?~ foo
foo
=+ ft=u.foo
=+ bar=$(a c, b (slag (lent -.ft) b), c %empt)
?~ bar
bar
[~ [-.ft (~(put by +.ft) q.a -.ft)]]
[%lite *] ?~(b ~ ?:(=(i.b p.a) (some [[i.b ~] *(map ,@u tape)]) ~))
[%brac *] ?~ b
~
?. =((dis (bex `@`i.b) p.a) 0)
(some [[i.b ~] *(map ,@u tape)])
~
[%eith *] =+ foo=(chet(a c) $(a p.a) b d)
=+ bar=(chet(a c) $(a q.a) b d)
?~ foo
bar
?~ bar
foo
=+ ft=u.foo
=+ bt=u.bar
?: (gte (lent -.ft) (lent -.bt))
foo
bar
[%pair *] =+ foo=$(a p.a, c [%pair q.a c])
?~ foo
foo
=+ ft=u.foo
=+ bar=$(a q.a, b (slag (lent -.ft) b))
?~ bar
bar
=+ bt=u.bar
[~ [(weld -.ft -.bt) (cont +.ft +.bt)]]
[%manl *] =+ foo=$(a p.a)
?~ foo
blak
?~ -.u.foo
blak
$(a [%eith %empt [%pair p.a [%eith %empt a]]])
[%mant *] =+ foo=$(a p.a)
?~ foo
blak
=+ ft=u.foo
?~ -.ft
blak
$(a [%eith [%pair p.a [%eith a %empt]] %empt])
[%plls *] $(a [%pair p.a [%mant p.a]])
[%plll *] $(a [%pair p.a [%manl p.a]])
[%binl *] =+ min=?:(=(q.a 0) 0 (dec q.a))
?: =(q.a 0)
$(a [%manl p.a])
$(a [%pair p.a [%binl p.a min]])
[%bant *] ?: =(0 q.a)
blak
$(a [%pair p.a [%bant p.a (dec q.a)]])
[%bint *] =+ min=?:(=(q.a 0) 0 (dec q.a))
?: =(q.a 0)
$(a [%mant p.a])
$(a [%pair p.a [%bint p.a min]])
[%betw *] ?: =(0 r.a)
blak
?: =(q.a 0)
$(a [%eith [%pair p.a [%betw p.a 0 (dec r.a)]] %empt])
$(a [%pair p.a [%betw p.a (dec q.a) (dec r.a)]])
[%betl *] ?: =(0 r.a)
blak
?: =(q.a 0)
$(a [%eith %empt [%pair p.a [%betl p.a 0 (dec r.a)]]])
$(a [%pair p.a [%betl p.a (dec q.a) (dec r.a)]])
==
--
::
++ rexp :: Regex match
~/ %rexp
|= [a=tape b=tape]
^- (unit (unit (map ,@u tape)))
=+ ^= bar
|= [a=@ b=(map ,@u tape)]
?: =(a 0)
b
=+ c=(~(get by b) a)
?~ c
$(a (dec a), b (~(put by b) a ""))
$(a (dec a))
=+ par=(pars a)
?~ par ~
=+ poc=(~(proc ra u.par) 1)
=+ c=b
|-
=+ foo=(matc:poc c b)
?~ foo
?~ c
[~ ~]
$(c t.c)
[~ [~ (bar (dec p.poc) u.foo)]]
::
++ repg :: Global regex replace
~/ %repg
|= [a=tape b=tape c=tape]
^- (unit tape)
=+ par=(pars a)
?~ par ~
=+ poc=(~(proc ra u.par) 1)
=+ d=b
:- ~
|-
^- tape
=+ foo=(matc:poc d b)
?~ foo
?~ d
~
[i.d $(d t.d)]
=+ ft=(need (~(get by u.foo) 0))
?~ d
c
(weld c $(d `tape`(slag (lent ft) `tape`d)))
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eN, pseudo-cryptography ::
::
@ -5323,10 +4954,16 @@
++ shax :: sha-256
~/ %shax
|= ruz=@ ^- @
(shay [(met 3 ruz) ruz])
::
++ shay :: sha-256 with length
~/ %shay
|= [len=@u ruz=@] ^- @
~| %sha
=> .(ruz (cut 3 [0 len] ruz))
=+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
=+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
=+ ral=(lsh 0 3 (met 3 ruz))
=+ ral=(lsh 0 3 len)
=+ ^= ful
%+ can 0
:~ [ral ruz]
@ -6067,8 +5704,9 @@
::
++ seed :: hoon/hoon core vase
^- vase
~+
!;(*type ..seed)
!!
:: ~+ :: trimmed
:: !;(*type ..seed)
::
++ seem |=(toy=typo `type`toy) :: promote typo
++ seer |=(vix=vise `vase`vix) :: promote vise
@ -6165,7 +5803,9 @@
|= [sut=type ref=type]
^- [? worm]
?: (~(has in nes) [sut ref]) [& +>+<]
?. (~(nest ut sut) | ref) [| +>+<]
?. (~(nest ut sut) | ref)
:: ~& %nest-failed
[| +>+<]
[& +>+<(nes (~(put in nes) [sut ref]))]
::
++ nets :: typeless nest
@ -6174,6 +5814,14 @@
?: (~(has in nes) [sut ref]) [& +>+<]
=+ gat=|=([a=type b=type] (~(nest ut a) | b))
?. (,? .*(gat(+< [sut ref]) -.gat))
:: ~& %nets-failed
:: =+ tag=`*`skol
:: =+ foo=(tank .*(tag(+< ref) -.tag))
:: =+ bar=(skol sut)
:: ~& %nets-need
:: ~> %slog.[0 bar]
:: ~& %nets-have
:: ~> %slog.[0 foo]
[| +>+<.$]
[& +>+<.$(nes (~(put in nes) [sut ref]))]
::
@ -6458,12 +6106,13 @@
++ hock
|- ^- toga
?- gen
[^ *] [%2 $(gen p.gen) $(gen q.gen)]
[%cnts [@ ~] ~] i.p.gen
[%cnzy @] p.gen
[%cnzz [@ ~]] i.p.gen
[%zpcb *] $(gen q.gen)
* =+(neg=open ?:(=(gen neg) [%0 ~] $(gen neg)))
[@ *] =+(neg=open ?:(=(gen neg) [%0 ~] $(gen neg)))
[^ *] =+ toe=[$(gen p.gen) $(gen q.gen)]
?:(=(toe [[%0 ~] [%0 ~]]) [%0 ~] [%2 toe])
==
::
++ open
@ -6513,7 +6162,13 @@
[i.p.gen $(p.gen t.p.gen)]
::
[%cncb *] [%ktls [%cnzz p.gen] %cnts p.gen q.gen]
[%cncl *] [%cnsg [%$ ~] p.gen q.gen]
[%cncl *]
=+ rem=[%cnsg [%$ ~] p.gen q.gen]
?. ?=([%zpcb ^ %cnzz @ ~] p.gen) rem
=> .(p.gen `[@ ^ @ p=@tas ~]`p.gen)
:+ %sgzp [[%dtzz %tas 'slam'] [%dtzz %tas p.p.gen]]
rem
::
[%cndt *] [%cnhp q.gen [p.gen ~]]
[%cnkt *] [%cnhp p.gen q.gen r.gen s.gen ~]
[%cnls *] [%cnhp p.gen q.gen r.gen ~]
@ -7092,9 +6747,7 @@
[[%leaf (rip 3 -.lum)] $(lum +.lum)]
::
%type
=+ reb=(slap [p:!>(.) .(sut lum)] %cnzy %duck)
=+ cis=(tank q.reb)
?. =(cis q.reb) ~
=+ cis=((hard tank) .*(.(sut lum) !=(duck))) :: type bypass
:^ ~ %palm
[~ ~ ~ ~]
[[%leaf '#' 't' '/' ~] cis ~]
@ -7128,7 +6781,8 @@
~
:+ ~
%leaf
?+ p.q.ham ~(rend co [~ p.q.ham lum])
?+ (rash p.q.ham ;~(sfix (cook crip (star low)) (star hig)))
~(rend co [~ p.q.ham lum])
%$ ~(rend co [~ %ud lum])
%t (dash (rip 3 lum) '\'')
%tas ['%' ?.(=(0 lum) (rip 3 lum) ['$' ~])]
@ -8531,10 +8185,12 @@
?: (~(has in was) u.rev)
~|(%pray-loop !!)
=+ ruv=`path`(weld u.rev `path`[%hoon ~])
=+ txt=(,@ta .^(%cx ruv))
~| ruv
%+ rash txt
(ifix [gay gay] tall(was (~(put in was) u.rev), wer u.rev))
~& [%pray-disabled ruv]
!!
:: =+ txt=(,@ta .^(%cx ruv))
:: ~| ruv
:: %+ rash txt
:: (ifix [gay gay] tall(was (~(put in was) u.rev), wer u.rev, bug |))
::
++ prey
|= gun=(list twig) ^- (unit twig)
@ -8869,7 +8525,7 @@
;~ pose
(stag %wtzp ;~(pfix zap wide))
(stag %zpzp (cold ~ ;~(plug zap zap)))
(stag %zpcn (cold ~ ;~(plug zap cen)))
:: (stag %zpcn (cold ~ ;~(plug zap cen)))
==
:- '$'
rump
@ -8946,23 +8602,7 @@
(stag %bccm ;~(pfix com hill))
:- '^'
;~ pose
;~ pfix ket
;~ pose
;~ pfix col
%+ sear
|= [a=tile b=twig] :: XX shd be static
=+ rev=(plex b)
?~ rev ~
%- some
:+ %smsm a
[%dtkt %dtzz %$ %cx u.rev]
;~(plug hill rood)
==
(sear prey (most ket rood))
==
==
(stag %cnzz rope)
(stag %bczp (cold %cell ket))
==
:- '`'
;~ pfix tec
@ -8975,8 +8615,6 @@
(cook |=(a=twig [[%dtzz %n ~] a]) wide)
==
==
:- '#'
;~(pfix hax rupl)
:- '"'
%+ cook
|= a=(list (list beer))
@ -9105,10 +8743,10 @@
;~ pfix bar
%- stew
^. stet ^. limo
:~ ['_' (rune cab %brcb expu)]
:~ ['_' (rune cab %brcb expv)]
['%' (rune cen %brcn expe)]
['.' (rune dot %brdt expa)]
['/' (rune fas %brfs expu)]
['/' (rune fas %brfs expv)]
['-' (rune hep %brhp expa)]
['^' (rune ket %brkt expr)]
['+' (rune lus %brls expo)]
@ -9134,7 +8772,15 @@
==
:- '$'
;~ pose
(rune com %bccm expv)
;~ pfix buc
%- stew
^. stet ^. limo
:~
[',' (rune com %bccm expt)]
['*' (rune tar %bctr expt)]
['@' (rune pat %bcpt expu)]
==
==
(stag %bccm (noil tol))
==
:- ':'
@ -9363,9 +9009,9 @@
++ expq |.(;~(gunk rope loaf loaf)) :: wing and two twigs
++ expr |.(;~(gunk loaf wisp)) :: twig and core tail
++ exps |.((butt hank)) :: closed gapped twigs
:: expt
++ expu |.(;~(gunk lobe wisp)) :: tile, core tail
++ expv |.(lobe) :: tile
++ expt |.(lobe) :: tile
++ expu |.(;~(gunk rope lobe)) :: wing and tile
++ expv |.(;~(gunk lobe wisp)) :: tile, core tail
++ expw |.(;~(gunk lobe teak)) :: tile and tiki
++ expx |.((butt ;~(gunk teak race))) :: tiki, [tile twig]s
++ expy |.((butt ;~(gunk teak loaf race))) :: tiki twig [tile twig]s
@ -9431,11 +9077,12 @@
==
^- (unit twig)
?- -.vil
%tis [~ %ktts ~(hock ap ros) p.vil]
%col [~ %tsgl ros p.vil]
%pel [~ %cnts ~(rake ap ros) p.vil]
%pat [~ %bcpt ~(rake ap ros) p.vil]
%ket [~ ros p.vil]
%tis =+ tog=~(hock ap ros)
?:(=([%0 ~] tog) ~ [~ %ktts tog p.vil])
==
::
++ long
@ -10182,13 +9829,12 @@
|- ^- [p=(list ovum) q=(pair worm (list ,[p=@tas q=vase]))]
?~ mor [(flop ova) niz]
=^ nyx niz (jack lac i.mor)
$(ova (weld p.nyx ova), mor (weld q.nyx t.mor))
$(ova (weld p.nyx ova), mor (weld t.mor q.nyx))
--
--
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: Postface ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
!:
~& %post-start
=+ pit=`vase`!>(.) ::
=+ bud=pit :: becomes tang

View File

@ -508,8 +508,7 @@
::
++ moon :: mime type to text
|= myn=mite
%+ rap
3
%- crip
|- ^- tape
?~ myn ~
?: =(~ t.myn) (trip i.myn)
@ -631,7 +630,7 @@
::
++ poxo :: node to tape
=< |=(a=manx `tape`(apex a ~))
|_ unq=_`?`|
|_ _[unq=`?`| cot=`?`|] :: self-close all tags
++ apex :: top level
|= [mex=manx rez=tape]
^- tape
@ -645,8 +644,8 @@
%+ welp tam
=- ?~(att rez [' ' (attr att rez)])
^- rez=tape
::?~ c.mex
:: [' ' '/' '>' rez]
?: &(?=(~ c.mex) |(cot (clot man)))
[' ' '/' '>' rez]
:- '>'
(many c.mex :(weld "</" tam ">" rez))
:: ::
@ -680,16 +679,23 @@
==
==
::
++ name :: name to tape
|= man=mane ^- tape
?@ man (trip man)
(weld (trip -.man) `tape`[':' (trip +.man)])
::
++ many :: nodelist to tape
|= [lix=(list manx) rez=tape]
|- ^- tape
?~ lix rez
(apex i.lix $(lix t.lix))
::
++ name :: name to tape
|= man=mane ^- tape
?@ man (trip man)
(weld (trip -.man) `tape`[':' (trip +.man)])
::
++ clot ~+ :: self-closing tags
%~ has in
%- sa ^- (list term) :~
%area %base %br %col %command %embed %hr %img %input %keygen
%link %meta %param %source %track %wbr
==
--
::
++ poxa :: xml parser
@ -2065,14 +2071,15 @@
?~ rax
[~ ~]
?^ t.rax
[p.pok [i.rax q.pok]]:[pok=$(rax t.rax) .]
[p.pok [ire q.pok]]:[pok=$(rax t.rax) ire=i.rax]
=+ ^- raf=(like tape)
%. [1^1 (flop (trip i.rax))]
;~(sfix (plus ;~(less dot next)) dot)
;~(sfix (star ;~(less dot next)) dot)
?~ q.raf
[~ [i.rax ~]]
=+ `[ext=tape [@ @] fyl=tape]`u.q.raf
[[~ (crip (flop ext))] [(crip (flop fyl)) ~]]
:- ?:(=(~ ext) ~ [~ (crip (flop ext))])
?:(=(~ fyl) ~ [(crip (flop fyl)) ~])
::
++ fuel :: parse fcgi
|= [bem=beam but=path]
@ -2081,17 +2088,11 @@
=+ dyb=(slay i.t.but)
?> ?& ?=([~ %many *] dyb)
?=([* * *] p.u.dyb)
:: ?=([%$ %tas *] i.p.u.dyb)
?=([%many *] i.p.u.dyb)
?=([%$ %ta *] i.p.u.dyb)
?=([%blob *] i.t.p.u.dyb)
==
=+ ced=((hard cred) p.i.t.p.u.dyb)
:: =+ nep=q.p.i.p.u.dyb
=+ ^= nyp ^- path
%+ turn p.i.p.u.dyb
|= a=coin ^- @ta
?> ?=([%$ %ta @] a)
?>(((sane %ta) q.p.a) q.p.a)
=+ ^= gut ^- (list ,@t)
%+ turn t.t.p.u.dyb
|= a=coin ^- @t
@ -2106,7 +2107,6 @@
ced
bem
t.t.but
nyp
==
::
++ sifo :: 64-bit encode
@ -2122,7 +2122,57 @@
~
=+ d=(end 0 6 pad)
[(cut 3 [d 1] cha) $(pad (rsh 0 6 pad))]
(weld (flop (slag poc sif)) (trip (fil 3 poc '=')))
(weld (flop (slag poc sif)) (reap poc '='))
::
++ ofis :: XX broken
=- |=(a=cord (rash a fel))
=- fel=;~(sfix (boss 64 (plus siw)) (stun 0^2 tis))
^= siw
;~ pose
dit
(cook |=(a=@ (sub a (sub 'A' 10))) (shim 'A' 'Z'))
(cook |=(a=@ (sub a (sub 'a' 36))) (shim 'a' 'z'))
(cold 62 (just '+'))
(cold 63 (just '/'))
==
::
:: .= ~[p=~.ack q=~.~sarnel r=~..y]
:: (dray ~[p=%tas q=%p r=%f] %ack ~sarnel &)
++ dray :: load tuple into path
=- |* [a=[@tas (pole ,@tas)] b=*] ^- (paf a)
=> .(b `(tup a)`b)
?~ +.a [(scot -.a b) ~]
[(scot -.a -.b) `(paf +.a)`(..$ +.a +.b)]
:- paf=|*(a=(pole) ?~(a ,~ ,[(odo:raid -.a(. %ta)) (..$ +.a)]))
tup=|*([a=@tas b=(pole ,@tas)] =+(c=(odo:raid a) ?~(b c ,[c (..$ b)])))
::
:: .= [p=%ack q=~sarnel r=&]
:: (raid /ack/~sarnel/.y p=%tas q=%p r=%f ~)
++ raid :: demand path odors
=- |* [a=path b=[@tas (pole ,@tas)]]
?~ +.b `(odo -.b)`(slav -.b -.a)
[`(odo -.b)`(slav -.b -.a) (..$ +.a +.b)]
^= odo
|* a=@tas
|= b=*
=< a(. (. b)) :: preserve face
?+ a ,@
%c ,@c %da ,@da %dr ,@dr %f ,@f %if ,@if %is ,@is %p ,@p
%u ,@u %uc ,@uc %ub ,@ub %ui ,@ui %ux ,@ux %uv ,@uv %uw ,@uw
%s ,@s %t ,@t %ta ,@ta %tas ,@tas
==
::
++ read :: parse odored path
=< |*([a=path b=[@tas (pole ,@tas)]] ((+> b) a))
|* b=[@tas (pole ,@tas)]
|= a=path
?~ a ~
=+ hed=(slaw -.b i.a)
?~ +.b
^- (unit (odo:raid -.b))
?^(+.a ~ hed)
^- (unit ,[(odo:raid -.b) _(need *(..^$ +.b))])
(both hed ((..^$ +.b) +.a))
::
++ urle :: URL encode
|= tep=tape
@ -2162,9 +2212,14 @@
pul(q.q [(rsh 3 1 (scot %p who)) q.q.pul])
::
++ earn :: purl to tape
|^ |= pul=purl
^- tape
:(weld (head p.pul) "/" (body q.pul) (tail r.pul))
=< |=(pul=purl `tape`(apex ~ pul))
|%
++ apex
|= qur=quri
?- -.qur
%& (weld (head p.p.qur) `tape`['/' $(qur [%| +.p.qur])])
%| (weld (body p.qur) (tail q.qur))
==
::
++ body
|= pok=pork ^- tape
@ -2198,16 +2253,14 @@
:- '?'
|- ^- tape
?~ kay ~
;: weld
;: welp
(urle (trip p.i.kay))
"="
(urle (trip q.i.kay))
?~(q.i.kay ~ ['=' (urle (trip q.i.kay))])
?~(t.kay ~ `tape`['&' $(kay t.kay)])
==
--
::
++ epur :: url/header parser
=< |=(a=cord `(unit purl)`(rush a auri))
++ urlp :: url/header parser
|%
++ apat :: 2396 abs_path
%+ cook deft
@ -2243,7 +2296,7 @@
++ pesc ;~(pfix cen mes) :: 2396 escaped
++ pold (cold ' ' (just '+')) :: old space code
++ pque ;~(pose pcar fas wut) :: 3986 query char
++ pquo ;~(pose pure pesc pold) :: normal query char
++ pquo ;~(pose pure pesc pold fas wut) :: normal query char
++ pure ;~(pose aln hep dot cab sig) :: 2396 unreserved
++ psub ;~ pose :: 3986 sub-delims
zap buc pam soq pel per
@ -2306,6 +2359,8 @@
(stag %| ;~(plug apat yque))
==
--
++ epur :: url/header parser
=>(urlp |=(a=cord `(unit purl)`(rush a auri)))
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 3bH, names etc ::
@ -2611,22 +2666,22 @@
?~ two one
?:((lth u.one u.two) one two)
::
++ mojo :: compiling load
|= [pax=path src=*]
^- (each twig (list tank))
?. ?=(@ src)
[%| ~[[leaf/"musk: malformed: {<pax>}"]]]
=+ ^= mud
%- mule |.
((full vest) [1 1] (trip src))
?: ?=(| -.mud) mud
?~ q.p.mud
:~ %|
leaf/"musk: syntax error: {<pax>}"
leaf/"musk: line {<p.p.p.mud>}, column {<q.p.p.mud>}"
==
[%& p.u.q.p.mud]
::
:: ++ mojo :: compiling load
:: |= [pax=path src=*]
:: ^- (each twig (list tank))
:: ?. ?=(@ src)
:: [%| ~[[leaf/"musk: malformed: {<pax>}"]]]
:: =+ ^= mud
:: %- mule |.
:: ((full vest) [1 1] (trip src))
:: ?: ?=(| -.mud) mud
:: ?~ q.p.mud
:: :~ %|
:: leaf/"musk: syntax error: {<pax>}"
:: leaf/"musk: line {<p.p.p.mud>}, column {<q.p.p.mud>}"
:: ==
:: [%& p.u.q.p.mud]
:: ::
++ mole :: new to old sky
|= ska=$+(* (unit (unit)))
|= a=*
@ -2635,21 +2690,21 @@
?~ b ~
?~ u.b ~
[~ u.u.b]
::
++ much :: constructing load
|= [pax=path src=*]
^- gank
=+ moj=(mojo pax src)
?: ?=(| -.moj) moj
(mule |.((slap !>(+>.$) `twig`p.moj)))
::
++ musk :: compiling apply
|= [pax=path src=* sam=vase]
^- gank
=+ mud=(much pax src)
?: ?=(| -.mud) mud
(mule |.((slam p.mud sam)))
::
:: ::
:: ++ much :: constructing load
:: |= [pax=path src=*]
:: ^- gank
:: =+ moj=(mojo pax src)
:: ?: ?=(| -.moj) moj
:: (mule |.((slap !>(+>.$) `twig`p.moj)))
:: ::
:: ++ musk :: compiling apply
:: |= [pax=path src=* sam=vase]
:: ^- gank
:: =+ mud=(much pax src)
:: ?: ?=(| -.mud) mud
:: (mule |.((slam p.mud sam)))
:: ::
++ pack :: light path encoding
|= [a=term b=path] ^- span
%+ rap 3 :- (wack a)
@ -2824,7 +2879,6 @@
ced=cred :: client credentials
bem=beam :: original path
but=path :: ending
nyp=path :: request model
== ::
++ flap ,@uvH :: network packet id
++ flow :: packet connection
@ -3033,7 +3087,7 @@
$% [& q=soba] :: delta
[| p=@tas] :: label
== ::
++ octs ,[p=@ud q=@] :: octet-stream
++ octs ,[p=@ud q=@t] :: octet-stream
++ oryx ,@t :: CSRF secret
++ pact path :: routed path
++ pail ?(%none %warm %cold) :: connection status

View File

@ -1989,7 +1989,7 @@ try to get the aeon referred to by the starting case. If it doesn't
exist yet, then we can't do anything interesting with this subscription,
so we move on to the next one.
Otherwise, we try to get the aeon referrred to by the ending case. If it
Otherwise, we try to get the aeon referred to by the ending case. If it
doesn't exist yet, then we produce all the information we can. We call
`++lobes-at-path` at the given aeon and path to see if the requested
path has actually changed. If it hasn't, then we don't produce anything;

View File

@ -56,3 +56,8 @@ Unsubscribe from stream `[stream]` on a foreign Urbit.
urb.js
======
<hr>
</hr>
<list></list>

View File

@ -1,5 +1,273 @@
Eyre: Reference
===============
## State
Stored
- `++bolo`
- `++cyst`
- `++stem`
Runtime
- `perk`
+ `perk-auth`
- `pest`
- `even`
## Cores
- `++handle`
+ `++parse`
- `++as...`
- `++ya`
- `++ix`
Eyre: Commentary
================
Let us follow the loading of a simple cli app, as it bounces from
browser to server to browser and back.
## Initial request[#init]
An http request for `http://sampel-sipnym.urbit.org/cli` will be [redirected](dns)
to the `%eyre` on ~sampel-sipnym, and come in as a `%this` kiss.
From arvo, requests enter `++call`, which after some type reification are passed
along to `++apex:ye`. In the case of a `%this` kiss, its components are
parsed(see `++zest:epur`, `++eat-headers`) and handed off to `++handle`, wrapped
in `++emule` to produce a `++fail` page in case of error. `++apex:handle` will
`++process` the request to a `pest` or a `++done` core, and in the former case
`++resolve` the pest into an outgoing card.
XX it also seems to affect the current ship, test that serving ship name is consistently correct
The pest is produced by `++process`, which will first further `++parse` the
request, and if this does not make the response immediately obvious,
`++process-parsed` the resulting `perk`.
`++parse` produces the `perk`, by attempting to interpret the `pork`(url path)
[`++as-magic-filename`](#mage), `++as-beam`, and `++as-aux-request`. In this
case, `/cli` is parsed by the second case as a `%beam` query to `/=cli=`: a path
which starts with a valid ship name is expected to be a full clay(well, ford)
path, and one starting with a term implies the current serving ship and a case
of `0`, the current revision.
XX spur: when the desks are merged, `/cli` shall point to `/=main=/pub/cli`
The parsed `perk` generates a `%f %boil` note, `mark`ed as its extension(here
defaulting to `%urb`) and `wire`d with `~` to return unaltered to the client. It
goes on to `++resolve` by being passed to `++ford-get-beam`, which translates
the perk it into a `%boil` `++ford-req`, adding an `++fcgi` path-segment
containing query string and `++fcgi-cred:for-client` auth information.
`%ford`s translation of `/=cli=/hymn/hook` to a self-refreshing `%urb` html page
[deserves its own commentary](../ford/commentary), but we resume in `%eyre`
when the `%made` sign arrives in `++take`, and soon after `++axon:ye`. There the
`wire`, or rather the `whir` it has been verified to be, determines that the
response should be served immediately. However, as the mark is not `%mime`,
another trip to `%ford` is required to encode it, on the same wire; afterwards,
the value of the `%mime` cage is verified to be of the correct type, and finally
delivered back up the requesting duct as a succesful `%thou` HTTP response.
XX `%cast %mime` used to be in ford-get-beam, is there a reason it was removed?
## Back into the breach, or: auxilary requests
Now, it was mentioned that this result is self-refreshing: the `%urb`
translation door injects a `;script@"/~/on/{deps}.js"` into every page, `deps`
is a ford-readable hash of the set of resources that page construction depended
on.
This triggers another `%this` request. Its handling is identical to that of
`/cli` up until `++parse`, where it is seen not `++as-beam` but
`++as-aux-request`(auxillary requests starting with `/~/` or `/~~/`).
`/on/[hash]` is a long-`%poll`, which `++process-parsed`, for a `.js` mark,
answers with a direct `%js`. Its contents are the static `++poll:js`, which
initiates the long-polling loop, run against an injected `urb.js` of
`{poll:[hash]}`.
A `%js` `pest` is `resolve`d as a `text/javascript` success `%this`.
When `poll.js` is recieved by the client, it opens an `XMLHttpRequest` for
`/~/on/{window.urb.poll}.json`, bringing us back to `%poll:process`.
In the case of a non-`%js` `/~/on/`, `%poll:process-parsed` turns into a
`++new-dependency`, which stores the listening duct, and `pass-note`s a `%wasp`
with the deps-hash back to `%ford` whence it came. While this occured, the page
has loaded.
Some indeterminate amount of time afterwards, with dropped `/~/on/{...}.json`s
being retried upon expiring and also being stored, a `%news` sign arrives in
`++axon`, and the hash in question is retrieved from the wire, and the listening
long-polls retrieved by the hash. Each receives a 205 "Reload parent view" HTTP
response, which `poll.js` dutifully executes, and a fixed typo of markdown is
rendered.
## Authentication.
Now, while this accurately reflects the presentation of e.g. a markdown file,
`/cli` is an application front-end, and one that permits only owner access. Its
second script is `@"/~~/~/at/main/lib/urb.js"`, semantically equivalent to
`/~/as/own/~/at/main/lib/urb.js`, and handled as follows.
In `++as-aux-request`, `%as %own` becomes `%auth %get our` perk, which
`++process` passes to `++process-parsed` passes to `++process-auth`. There, a
`yac` "ya" core is built `++for-client`: a `++cookie-prefix`, which is just the
serving ship name, is used to get a `++session-from-cookies`, here nil as the
client has no cookie set. In lieu of a cookie, a `++new-ya` is constructed, with
a random token `hole` and a `++new-cyst` which fills out `cyst` session state
from request data.
Returning to `++process-auth`, `%get` checks if the yac is authenticated with
the requested credentials(`anon` requests are always granted), which for the
fresh new `cyst` is not the case (more on success [later](#auth-ok)). Unless
authentiacting as a [foreign ship](#xeno), the only thing left is to
`++show-login-page`, which detects that the requested resource is not `%html`,
and produces a `%red` pest. For `%js`, `%red`irections `++resolve` to
`++auth-redir:js`, a line of javascript which prepends `/~~` to the url path.
The owner-authenticated main page request similarly ends in `++show-login-page`,
which for the empty session is an `[%htme ++login-page:xml]`, `resolve`d to
`++give-html` with a 401 "unathorized".
The login page shows a simple prompt, and requests `/~/at/auth.js` to handle the
submission. And so we are, once again, attempting to divine if what we're doing
makes sense `++as-aux-request`.
To understand `/~/at`, there will first be a brief diversion to `~/auth.json`.
`auth.json`, perk `[%auth %json]`, in `++process-auth` serves `++stat-json:ya`,
containing such information as the serving ship, which identities are associated
with this session, and `oryx`, a CSRF token. An oryx must be present on all
stateful requests, in this case executing a log in. It also saves the new/old
session using `abet`.
XX explain `ixor` here and not [later](#ixor)?
`/~/at` is an alternate interface, which injects `auth.json` data into the
requested file. `/~/at/auth.js`, then, is a request for the built-in `auth:js`
(parsed to and processed from an `[%auth %js ~]` perk), with session data added
as `window.urb`. And indeed, ``[`%js /~/at/auth]`` is parsed to
``[%auth at [`%js /auth]``, which in `++process-auth` is re-`process`ed to
`[%js ++auth:js]`, which is `++resolve`d after an `++add-json` of
the relevant data. The yac cookies are also passed to `resolve`, which
`++add-cookies` injects into the `httr`.
It is at this point that there is first occasion for user input, namely the password.
The `auth:js` script sends a `PUT` request, also to `/~/auth.json`. In `parse`,
the first nontrivial `++check-oryx` occurs, `++grab-body` the request oryx and
ensuring it is recorded for the session. The request parsed with `++need-body`
to a `[%auth %try {password}]` perk. `%get:process-auth` checks it against
`++load-secret`, upon success updates the session with `++logon:ya`, and
serves a fresh `auth.json` which reflects the changed `user`. Upon recieving
this, the page is refreshed to retry the original request.
## Post-authentication: app communication. [#auth-ok]
Upon refresh, `/~~/cli` brings us for the third time to `%get:process-auth`, but
this time the cookie is set, and the `yac` fetched contains the serving ship as
authenticated. The `++handle` sample is updated to reflect the requesting ship,
and the `process` continues for the rest of the pork, once again serving the
ford page.
The `/~/on/[deps].json` poll starts anew, and `/~~/~/at/main/lib/urb.js` we now
know to serve the window.urb necessary to make requests, and the `urb.js`
standard library which extends it with a number of wrappers to them and other
useful functions.
---
One of those functions is `urb.bind`, which is used to subscribe to application
data. Userspace javascript sets `urb.appl` to `/tic`, and binds `lines` to a
`;pre;` text display, using a callback.
This triggers a `PUT` to `/~/is/{ixor}/cli/lines.json`, where `ixor` is a hash
of `oryx` that identifies the connection. `++as-aux-request`, an `%is` is a
`%subs` subscription update update, which for `%put` forwards to
`++add-subs:ix`, the ix core fetched `++for-view` by hashing the request
`++oryx-to-ixor`.
[#ixor] A view has all the state associated with a client that must be
remembered between events. In this case, this is what app/path the request duct
is associated with; but mainly, `++add-subs:ix` will `pass-note` to `%gall` so
it `%show`s the data on the path, current and future.
This will immediately(assuming the ship is local) result in a `%nice` by the
`/cli` app, returning `{ok:true}` `++nice-json` to `urb.bind`'s second callback
as `{ok:true}`. The initial `%rush` results also arrive, and in `++axon` are
converted to json using `++back`(ford `%cast` wrapper), and when `%made` get
passed to `++get-rush:ix`. There the source application/path are decoded by
duct, and then the full event goes to `++get-even`; `++add-even` inserts it to
the queue, and as there is no long poll it simply stays there.
Upon receipt, the client realizes the long-poll isn't actually running, so that
is started using `urb.poll`. At `/~/of/{ixor}`, perk
`[%view ixor ~ {sequence-number}]`, it is `process`ed by `++poll:ix` (the cyst
is retrieved by `++ire-ix` form global state, using the perk `ixor`): the
sequence number is in the past, so the previously recieved `%rush` is
`++give-even`. After deleting the previous message in the queue and invoking
`++pass-took` to signal `%gall` of this occurrence, the data is annotated with
the source app+path `++subs-to-json`, and returned to the polling duct.
On the client, the user callback receives the `/cli` history, and displays it on
the page. The `/~/of` long poll is continued, this time reaching `++poll:ix`
with the "pending" sequence number, and being stored in the `cyst` for its troubles.
---
Its next update proceeds idenitcally, but first it must be triggered, which
happens when the user enters "(add 2 2)\n", firing an `urb.send` from the event
handler. This sends a `POST` request to `/~/to/cli/json.json`, perk `%mess`,
`++process`ed to a `%g %mess`. Were the mark not `%json`, a `%ford` conversion
would occur first, and `%made:axon` would send the gall message proper. In
either case, eventually a `%mean` or `%nice` arrives, is encoded as json, and
sent to the client callback.
## A path not taken: magic filenames [#mage]
The `/robots.txt` and `/favicon.(ico|png)` files are static, and served
immediately when caught by a `++parse`.
XX index.html?
## A path not taken: foreign auth [#xeno]
While this example details a login `/~/as/own`, it is possible to be
authenticated as any ship on the network. A request for such seen in
`%get:process-auth` is passed to `++foreign-auth:ya`, which sends an
`%ames /lon` message to the ship in question. The foreign ship stores the
inquiry, calculates(the local) `++our-host` and responds with a `/hat`,
containing the redirection host, which is stored by `++foreign-hat`; it is later
used to send the client to a `/~/am` url on the foreign client, which acts as a
normal login page but later sends the client back. XX expand, basically the
status quo is you're logged in and `/~/as/foo` is ignored, just setting your
`urb.user` XX
## A path not taken: deauthentication
`/~/away`, perk `[%away ~]`, produces a static `++logout-page:xml`, which also
uses `/~/at/auth.js`, to send a `DELETE /~/auth.json`, perk `[%auth %del]`. This
executes `++logoff:ya` for the cookie session, resolving to `++abut` to wipe it
from memory.
## A path not taken: unsubscription
`DELETE /~/is/app/path/within` works much like `PUT /~/is/app/path/within`,
`++del-subs:ix` acting as reverse of `++add-subs` by deleting the duct binding
and sending `%g %nuke`.
XX unmentioned arms: abet, add-poll, adit, ames-gram, anon, ares-to-json, bolo, cyst, doze, even, ford-kill, get-mean, gift, give-json, give-thou, gram, hapt, hasp, host-to-ship, ix, ixor, js, kiss, load, mean-json, move, note, pass-note, perk, perk-auth, pest, poke-test, print-subs, render-tang, resp, root-beak, scry, ses-authed, ses-ya, sign, silk, sine, stay, stem, teba, titl, to-oryx, urb, wait-era, wake, whir, wush, xml, ya, ye
## Appendix A: DNS [#dns]
The `*.urbit.org` domain can be used to access destroyers and cruisers. In the
common case oh hosted ships, this is done by dynamic DNS directly to the hosting
instance. We do not speak of the uncommon case. When ports are blocked and
infrastructure crumbles around you, only imported martian networking can be
trusted: the `%get` and `%got` [gram]()s are used to proxy [`%this` requests]() and
[`%thou` responses]() respectively.

View File

@ -47,12 +47,12 @@ machine directly.
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/1/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/1/
#### What did you just do?
The code you just wrote is urbit's native programming langauge, hoon.
Generating HTML with hoon is similar to writing [jade](link) or other
Generating HTML with hoon is similar to writing [jade]() or other
similar HTML shorthand. In hoon, this shorthand is called [`++sail`]()
and it's a native part of the hoon language.
@ -62,7 +62,7 @@ our `;h1:` above, and are closed implicitly with a new line. Nodes with
no content are closed with another `;`, such as `;br;`.
You can find more information about `++sail` in our [rune library
documentation](link).
documentation]().
<hr>
</hr>
@ -90,7 +90,7 @@ documentation](link).
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/2/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/2/
### What's going on there?
@ -98,7 +98,7 @@ Clearly, the code `(add 2 2)` is generating `4`, and it's not too hard
to see why. `add` is one of the library functions that are a part of
`hoon.hoon`. Try replacing `(add 2 2)` with `(sub 2 (add 2 2))`. You can
find documentation for the full hoon library in the [library
reference](link).
reference]().
Since the product of `(add 2 2)` is a number, we need a few extra things
to have it print properly. In `++sail` we use `{` and `}` to do string
@ -140,7 +140,7 @@ we need to explicitly convert our types.
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/3/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/3/
#### How does that work?
@ -148,9 +148,9 @@ The first thing you should notice in this example is the `=+` at the top
of our file. `=+` is a rune. hoon is a programming with no reserved
words. We don't use `if` `this` or `function` at all. Instead, runes
have their own pronunciation. `=+` is pronounced 'tislus'. You can find
the table of pronunciation [here](link). In hoon you construct your
the table of pronunciation [here](). In hoon you construct your
programs using runes, which are two character ascii pairs. You can see
the whole set of runes in the [rune index](link).
the whole set of runes in the [rune index]().
`=+` pushes an expression on to our subject. The subject in hoon is
similar to `this` in other languages. hoon being a functional language
@ -168,7 +168,7 @@ Looking at the rendered page it's clear that we're assigning `a` to be
we're doing this in two different ways. Runes in hoon can have irregular
forms, and `^=` is one of them. The first two lines of our example are
doing the same thing, where `a=2` is simply the irregular form of
`^= a 2`. You can see the full list of irregular forms [here](link).
`^= a 2`. You can see the full list of irregular forms [here]().
Looking at the simple computation on the page, you can try changing the
values of `a` and `b` to any integers to produce similar results.
@ -212,7 +212,7 @@ values of `a` and `b` to any integers to produce similar results.
(and be sure to put two spaces between `++` and arm names)
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/4/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/4/
### What's happening?
@ -229,7 +229,7 @@ core. Gates only have one arm and are quite similar to a function in
other languages. We use `|=` to construct our gate. Runes in hoon are
generally categorized by their first character. `|` indicates a rune
having to do with cores. You can find all of the `|` runes in the [rune
library](link).
library]().
Our `++length` [gate]() takes two arguments, `s` and `e`. In hoon we
call the data passed in to a gate the 'sample'. Every `|=` has two
@ -241,7 +241,7 @@ computes the difference between `e` and `s`.
`@ud` is an odor. Odors aren't quite types, but they're similar. You'll
learn the difference by example as we progress, and you can always refer
to the [odor index](link).
to the [odor index]().
You probably also noticed our indentation. In general hoon has both tall
and wide forms. In tall form, hoon uses two spaces for indentation and
@ -282,7 +282,7 @@ margin. In wide form we use parenthesis just like almost everyone else.
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/5/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/5/
#### What's the difference?
@ -301,7 +301,7 @@ At a high level you can think of hoon as being composed of two things,
tiles and twigs. Twigs are the actual AST structures that get consumed
by the compiler. Tiles reduce to twigs and provide major affordances for
the programmer. If you're interested in learning about tiles more deeply
you can find an in-depth explanation in the [tile overview](link).
you can find an in-depth explanation in the [tile overview]().
It should suffice, for now, to say that we create tiles in the same way
that you would think of creating type definitions in another language.
@ -325,7 +325,7 @@ you're usually familiar with. We still separate our addressing with `.`,
but do it from the inside out. Given a tuple such as
`[a=1 b=[c=[d=2 e=3]]]` we can address the value of `e` with `e.c.b`.
You can read more about how faces work in the commentary on `++type`
[here](link).
[here]().
<hr>
</hr>
@ -362,11 +362,11 @@ You can read more about how faces work in the commentary on `++type`
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/6/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/6/
#### What is that doing?
We're printing a few members of the [fibonacci sequence](link) by
We're printing a few members of the [fibonacci sequence]() by
calling our arm `++fib` with a few values. The fibonacci sequence is a
fairly straight forward algorithm: `F(n-1) + F(n-2)` where `F(1) = 1`
and `F(2) = 1`. As is obvious from the formula, generating the fibonacci
@ -375,10 +375,10 @@ the code.
Our example here should look similar to the previous one. We build a
core with `|%` and add the arm `++fib`. `++fib` is a gate which takes
one argument `x`, an atom. Using [`?:`](link) we test if `x` is less
than `2` with the library function [`lte`](link) to handle our seed
one argument `x`, an atom. Using [`?:`]() we test if `x` is less
than `2` with the library function [`lte`]() to handle our seed
values of `F(1) = 1` and `F(2) = 1`. `?:` is a member of the [`?`
runes](link), related to true / false values, or loobeans. In hoon true
runes](), related to true / false values, or loobeans. In hoon true
and false are `0` and `1` respectively and take the odor `@f`. We tend
to say 'yes' and 'no' instead of 'true' and 'false' to keep track of the
switch. Our built-in function `lte` produces a loobean, so we evaluate
@ -389,7 +389,7 @@ We mentioned previously that a gate is a special kind of core with only
one arm, called `$`. Here we're using `$` to mimic the behavior of a
loop. You can read the expression `$(x (dec x))` as 'call the gate again
with `x` replaced by `(dec x)`. For more on how this works, check out
the documentation of [`%=`](link) and [`%-`](link). With that in mind it
the documentation of [`%=`]() and [`%-`](). With that in mind it
should be clear how the last line of `++fib` produces the member of the
sequence at a given value `x`.
@ -431,7 +431,7 @@ sequence at a given value `x`.
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/7/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/7/
http://ship-name.urbit.org/gin/del/main/pub/fab/guide/exercise/7/
Here we're putting our publishing framework, `%ford` to work a little
@ -447,19 +447,19 @@ They belong at the top of the file.
`/?` simply checks for compatibility. In this case the line means 'need
urbit 314 or below', or in hoon: `(lte zuse 314)`. `314` is the number
in the kelvin versioning system, which you can read about [here](link).
in the kelvin versioning system, which you can read about [here]().
`/=` is similar to the combination of `=+ =^`, or assignment. `/$`
calls a parsing function, which we specify as [`++fuel`](link) with the
[`++beam`](link) and [`++path`](link) of our current file.
calls a parsing function, which we specify as [`++fuel`]() with the
[`++beam`]() and [`++path`]() of our current file.
`/= gas /$ fuel` is a common way to open your page, since the
product of `++fuel` is useful when writing pages to the web. The use of
`++fuel` is not enforced — you can also write your own parser.
Our page is made up of two generated parts: who requested the page, the
location of the page and its revision. Both are parsed out of the `gas`
variable using some straightforward library functions, [`++ju`](link),
[`++spud`](link) and [`++scow`](link). You can follow those links to the
variable using some straightforward library functions, [`++ju`](),
[`++spud`]() and [`++scow`](). You can follow those links to the
library reference to learn more about them. You'll also notice our
addressing moving in the opposite direction as you may be used to.
`aut.ced.gas` pulls `aut` from inside `ced` from inside `gas`.
@ -468,13 +468,13 @@ Inside of the `;code` tag we also print (for our own reference) the
entire `gas`, so you can take a look at the contents. This can be a
helpful trick when debugging. To fully understand what gets put in
`gas`, we can take a look at `++fuel` and note that it produces a
[`++epic`](link), which also contains a [`++cred`](link). You can follow
[`++epic`](), which also contains a [`++cred`](). You can follow
those links to learn more about them.
When we try changing the url from `gen/main` to `gin/del/main` we're
When we try changing the url from `main` to `gin/del/main` we're
using some of the access methods from `%eyre` (the urbit webserver) to
pretend to be the urbit `~del`. You can find documentation on those
access methods in the `%eyre` commentary, [here](link).
access methods in the `%eyre` commentary, [here]().
Path and identity are useful, but there are some other parameters worth
checking out as well.
@ -510,8 +510,8 @@ checking out as well.
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/8/
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/8/?code=yes-i-do
http://ship-name.urbit.org/main/pub/fab/guide/exercise/8/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/8/?code=yes-i-do
This is a simple example, showing off another use of
`/= gas /$ fuel`. In this case we're just pulling out the value of
@ -519,10 +519,10 @@ the `code` query string parameter. You should be able to change that
value to any url-safe string and see it appear on the page.
We're using a few simple library functions to actually pull the value
out, [`++fall`](link) and [`get:by`](link). Query string parameters are
out, [`++fall`]() and [`get:by`](). Query string parameters are
stored in `qix.gas` as a `++map`, one of the main container constructs
used in hoon. We'll encounter a lot of maps along the way, and you can
learn more about them in the [map section](link) of the library doc.
learn more about them in the [map section]() of the library doc.
<hr>
</hr>
@ -569,7 +569,7 @@ learn more about them in the [map section](link) of the library doc.
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/9/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/9/
#### How are they getting combined?
@ -597,8 +597,9 @@ generating html, it's a `.hook`, and our source file is just a `.hoon`.
In order to find our file one level up we need two `%%` to get to
`/pub/fab/guide/exercise/9/`. Adding `lib` resolve to our neighboring
file. You can read more about how `%clay` paths are parsed in the
[`%clay` overview](link). It's also pretty easy to try them out using
`:cd` and `:ls` in your `%arvo` terminal.
[`%clay` overview](link). It's also pretty easy to try them out using
`/=main=`, `/=try`, `/try/a/b/c/d`, etc.
and `:ls` in your `%arvo` terminal.
<hr>
</hr>
@ -652,9 +653,9 @@ file. You can read more about how `%clay` paths are parsed in the
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/10/
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/10/?number=7
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/10/?number=12
http://ship-name.urbit.org/main/pub/fab/guide/exercise/10/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/10/?number=7
http://ship-name.urbit.org/main/pub/fab/guide/exercise/10/?number=12
As you can see by changing the URL, we're now passing our query string
parameter to our `++fib` script and printing the output. It's common to
@ -670,21 +671,21 @@ remaining computation. In short, you can read the code that produces
runes to write this in tall form. `%` runes are used for calling gates
or evaluating changes. `%+` 'slams' or calls a gate with two arguments,
and `%-` 'slams' or calls a gate with one argument. As usual, you can
find more about the `%` runes in the [`%` section](link) of the rune
find more about the `%` runes in the [`%` section]() of the rune
library.
To get a value out of our map of query string parameters `qix.gas` we
use a method from the [maps library](link) that produces a `++unit`.
use a method from the [maps library]() that produces a `++unit`.
`++unit`s are a common type in hoon used for optional values. A
[`++unit`](link) is either `~` or `[~ p=value]`. Since we need to
[`++unit`]() is either `~` or `[~ p=value]`. Since we need to
specify a value for `(fib arg)` even when someone doesn't enter the
query string we use [`++fall`](link), which produces either the value of
query string we use [`++fall`](), which produces either the value of
the unit, or the second argument if the `++unit` is null. Since our
`qix.gas` has string values in it we specify a string in our second
argument, `'0'`. As an aside, `'0'` is different from `"0"` in hoon. You
can read about the difference in [`++cord`](link) and [`++tape`](link).
can read about the difference in [`++cord`]() and [`++tape`]().
Our outermost call, to [`++slav`](link), casts our string to a `@ud`
Our outermost call, to [`++slav`](), casts our string to a `@ud`
which is the type expected by `++fib`. `++slav` takes the name of an
odor and a value, and tries to cast the value to that odor.
@ -742,9 +743,9 @@ odor and a value, and tries to cast the value to that odor.
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/11/
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/11/lib/1/
http://ship-name.urbit.org/gen/main/pub/fab/guide/exercise/11/lib/2/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/11/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/11/lib/1/
http://ship-name.urbit.org/main/pub/fab/guide/exercise/11/lib/2/
#### Experiment with it
@ -764,7 +765,7 @@ If we take the next few lines and write them as pseudo code in wide form
they might look something like this, `(/; [gate] (/@ /psal/))`. That
being the case, let's start at the bottom and move upwards since that's
how our data flows. In depth documentation on individual `++horn` runes
can be found in the [horn section of the rune library](link).
can be found in the [horn section of the rune library]().
`/psal/` loads our `psal` mark. Marks are like content types, and we
keep them in `/main/mar/`. You can open `/main/mar/psal/door.hook` to
@ -776,16 +777,16 @@ where `mark` exists in the `/main/mar/` directory. A `psal` is a partial
`/@` loads a list of files in numerical order from the previously
specified `++beam` using our mark, `psal`. `/@` has a few close
relatives. `/&`, for example, reads files by `@da` or absolute date. You
can see the rest in the [horn section of the library](link).
can see the rest in the [horn section of the library]().
`/;` takes the output from `/@` and `/psal/` and passes it to a twig. In
this case, a gate. Our `/@` actually produces a [`++list`](link) of
this case, a gate. Our `/@` actually produces a [`++list`]() of
pairs of `[@ manx]` where the `@` is the filename, and the `manx` is the
converted contents. We use [`++turn`](link), one of our `++list`
converted contents. We use [`++turn`](), one of our `++list`
operator functions, to iterate through the list and produce only a list
of `++manx`. This is the output assigned to `posts`.
Then, further down, we use [`;*`](link) to write the list to the page.
Then, further down, we use [`;*`]() to write the list to the page.
<hr>
</hr>
@ -800,7 +801,7 @@ Then, further down, we use [`;*`](link) to write the list to the page.
#### Try it
http://ship-name.urbit.org/gen/main/pub/fab/guide/
http://ship-name.urbit.org/main/pub/fab/guide/
#### Bring it all together

View File

@ -34,7 +34,7 @@ under the corresponding paths. You will need four files:
When everything is in place, try it:
http://localhost:8080/gen/main/pub/lead/
http://localhost:8080/main/pub/lead/
That URL should render a page and be self explanatory. Try adding names
to the leaderboard and incrementing their scores. It's also fun to open
@ -63,7 +63,7 @@ Our application-specific resources are stored in `/main/pub/lead/src/`.
`/main/pub/lead/src/main.js` updates the page and sends data.
We also use two utility scripts: `/gop/hart.js` and
`/gen/main/lib/urb.js`. These are the standard libraries for handling
`/main/lib/urb.js`. These are the standard libraries for handling
data transfer from a browser to Urbit, and are very frequently used.
`hart.js` handles the page heartbeat, making regular AJAX requests so we
can keep track of subscribers, and `urb.js` offers a more complete set

View File

@ -62,13 +62,13 @@ repeated child node `'repeat'`. [`++poxo`]() prints our result in XML.
;=
;% |=(a=marl (turn a |=(b=manx ;script(src (poxo b));)))
; /gep/hart.js
; /gen/main/lib/urb.js
; /main/lib/urb.js
; //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js
==
~[
[[%script [%src "/gep/hart.js
"] ~] ~]
[[%script [%src "/gen/main/lib/urb.js
[[%script [%src "/main/lib/urb.js
"] ~] ~]
[ [ %script
[%src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js
@ -83,10 +83,10 @@ repeated child node `'repeat'`. [`++poxo`]() prints our result in XML.
;=
;% |=(a=marl (turn a |=(b=manx ;script(src (poxo b));)))
; /gep/hart.js
; /gen/main/lib/urb.js
; /main/lib/urb.js
; //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js
==
"<script src="/gep/hart.js"></script><script src="/gen/main/lib/urb.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>"
"<script src="/gep/hart.js"></script><script src="/main/lib/urb.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>"
Here we go through a similar example, passing a list of urls for a
script tag to a gate that produces a `<script>` tag. Since we produce

View File

@ -35,7 +35,7 @@ module.exports = recl
dt = @ts - Number Date.now()
setPath: (href,hist) ->
if hist isnt false then history.pushState {}, "", "/gen/docs/tree"+href
if hist isnt false then history.pushState {}, "", window.tree.basepath href
TreeActions.setCurr href
goTo: (path) ->
@ -47,7 +47,7 @@ module.exports = recl
checkURL: ->
if @state.url isnt window.location.pathname
@setPath window.location.pathname.replace("/gen/docs/tree",""),false
@setPath (window.tree.fragpath window.location.pathname),false
setTitle: ->
title = $('#cont h1').first().text()
@ -86,7 +86,7 @@ module.exports = recl
@goTo @state.next
$('body').on 'click', 'a', (e) =>
href = $(e.target).closest('a').attr 'href'
href = $(e.target).closest('a').attr('href')
if href[0] is "/"
e.preventDefault()
e.stopPropagation()
@ -103,14 +103,15 @@ module.exports = recl
render: ->
parts = []
if @state.pare
parts.push (div {id:"up"},(a {key:"arow-up",href:@state.pare,className:"arow-up"},""))
href = window.tree.basepath @state.pare
parts.push (div {id:"up"},(a {key:"arow-up",href:href,className:"arow-up"},""))
if @state.prev or @state.next
_parts = []
if @state.prev
href = window.tree.basepath @state.prev
href = window.tree.basepath window.tree.basepath @state.prev
_parts.push (a {key:"arow-prev",href:href,className:"arow-prev"},"")
if @state.next
href = window.tree.basepath @state.next
href = window.tree.basepath window.tree.basepath @state.next
_parts.push (a {key:"arow-next",href:href,className:"arow-next"},"")
parts.push (div {id:"sides"}, _parts)
@ -128,7 +129,8 @@ module.exports = recl
c = "active"
ci = k
k++
(div {className:c}, (a {key:i+"-a",href:up+"/"+i,onClick:@_click}, i))
href = window.tree.basepath up+"/"+i
(div {className:c}, (a {key:i+"-a",href:href,onClick:@_click}, i))
offset = 0
if ci > 0 then offset = 0
s = {marginTop:((ci*-24)-offset)+"px"}
@ -145,4 +147,4 @@ module.exports = recl
delete obj.onMouseOver
delete obj.onMouseOut
div obj, parts
div obj, parts

View File

@ -1,4 +1,4 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/actions/TreeActions.coffee":[function(require,module,exports){
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var TreeDispatcher, TreePersistence;
TreeDispatcher = require('../dispatcher/Dispatcher.coffee');
@ -72,7 +72,7 @@ module.exports = {
},{"../dispatcher/Dispatcher.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/dispatcher/Dispatcher.coffee","../persistence/TreePersistence.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/persistence/TreePersistence.coffee"}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/AnchorComponent.coffee":[function(require,module,exports){
},{"../dispatcher/Dispatcher.coffee":7,"../persistence/TreePersistence.coffee":12}],2:[function(require,module,exports){
var TreeActions, TreeStore, a, div, recl, ref;
TreeStore = require('../stores/TreeStore.coffee');
@ -122,7 +122,7 @@ module.exports = recl({
},
setPath: function(href, hist) {
if (hist !== false) {
history.pushState({}, "", "/gen/docs/tree" + href);
history.pushState({}, "", window.tree.basepath(href));
}
return TreeActions.setCurr(href);
},
@ -138,7 +138,7 @@ module.exports = recl({
},
checkURL: function() {
if (this.state.url !== window.location.pathname) {
return this.setPath(window.location.pathname.replace("/gen/docs/tree", ""), false);
return this.setPath(window.tree.fragpath(window.location.pathname), false);
}
},
setTitle: function() {
@ -206,17 +206,18 @@ module.exports = recl({
var _parts, ci, curr, href, k, obj, offset, p, parts, s, sibs, up;
parts = [];
if (this.state.pare) {
href = window.tree.basepath(this.state.pare);
parts.push(div({
id: "up"
}, a({
key: "arow-up",
href: this.state.pare,
href: href,
className: "arow-up"
}, "")));
if (this.state.prev || this.state.next) {
_parts = [];
if (this.state.prev) {
href = window.tree.basepath(this.state.prev);
href = window.tree.basepath(window.tree.basepath(this.state.prev));
_parts.push(a({
key: "arow-prev",
href: href,
@ -224,7 +225,7 @@ module.exports = recl({
}, ""));
}
if (this.state.next) {
href = window.tree.basepath(this.state.next);
href = window.tree.basepath(window.tree.basepath(this.state.next));
_parts.push(a({
key: "arow-next",
href: href,
@ -252,11 +253,12 @@ module.exports = recl({
ci = k;
}
k++;
href = window.tree.basepath(up + "/" + i);
return div({
className: c
}, a({
key: i + "-a",
href: up + "/" + i,
href: href,
onClick: _this._click
}, i));
};
@ -291,7 +293,7 @@ module.exports = recl({
},{"../actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/stores/TreeStore.coffee"}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/BodyComponent.coffee":[function(require,module,exports){
},{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":13}],3:[function(require,module,exports){
var TreeActions, TreeStore, div, input, load, recl, ref, textarea;
TreeStore = require('../stores/TreeStore.coffee');
@ -356,7 +358,7 @@ module.exports = recl({
},{"../actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/stores/TreeStore.coffee","./LoadComponent.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/LoadComponent.coffee"}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/KidsComponent.coffee":[function(require,module,exports){
},{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":13,"./LoadComponent.coffee":6}],4:[function(require,module,exports){
var TreeActions, TreeStore, a, div, hr, li, recl, ref, ul;
TreeStore = require('../stores/TreeStore.coffee');
@ -423,7 +425,7 @@ module.exports = recl({
},{"../actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/stores/TreeStore.coffee"}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/ListComponent.coffee":[function(require,module,exports){
},{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":13}],5:[function(require,module,exports){
var TreeActions, TreeStore, a, div, h1, li, load, recl, ref, ul;
TreeStore = require('../stores/TreeStore.coffee');
@ -514,7 +516,7 @@ module.exports = recl({
},{"../actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/stores/TreeStore.coffee","./LoadComponent.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/LoadComponent.coffee"}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/LoadComponent.coffee":[function(require,module,exports){
},{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":13,"./LoadComponent.coffee":6}],6:[function(require,module,exports){
var div, input, recl, ref, textarea;
recl = React.createClass;
@ -552,7 +554,7 @@ module.exports = recl({
},{}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/dispatcher/Dispatcher.coffee":[function(require,module,exports){
},{}],7:[function(require,module,exports){
var Dispatcher;
Dispatcher = require('flux').Dispatcher;
@ -574,7 +576,7 @@ module.exports = _.extend(new Dispatcher(), {
},{"flux":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/node_modules/flux/index.js"}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/main.coffee":[function(require,module,exports){
},{"flux":9}],8:[function(require,module,exports){
var rend;
rend = React.render;
@ -732,7 +734,7 @@ $(function() {
},{"./actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/actions/TreeActions.coffee","./components/AnchorComponent.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/AnchorComponent.coffee","./components/BodyComponent.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/BodyComponent.coffee","./components/KidsComponent.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/KidsComponent.coffee","./components/ListComponent.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/components/ListComponent.coffee","./persistence/TreePersistence.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/persistence/TreePersistence.coffee"}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/node_modules/flux/index.js":[function(require,module,exports){
},{"./actions/TreeActions.coffee":1,"./components/AnchorComponent.coffee":2,"./components/BodyComponent.coffee":3,"./components/KidsComponent.coffee":4,"./components/ListComponent.coffee":5,"./persistence/TreePersistence.coffee":12}],9:[function(require,module,exports){
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
@ -744,7 +746,7 @@ $(function() {
module.exports.Dispatcher = require('./lib/Dispatcher')
},{"./lib/Dispatcher":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/node_modules/flux/lib/Dispatcher.js"}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/node_modules/flux/lib/Dispatcher.js":[function(require,module,exports){
},{"./lib/Dispatcher":10}],10:[function(require,module,exports){
/*
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
@ -996,7 +998,7 @@ var _prefix = 'ID_';
module.exports = Dispatcher;
},{"./invariant":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/node_modules/flux/lib/invariant.js"}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/node_modules/flux/lib/invariant.js":[function(require,module,exports){
},{"./invariant":11}],11:[function(require,module,exports){
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
@ -1051,7 +1053,7 @@ var invariant = function(condition, format, a, b, c, d, e, f) {
module.exports = invariant;
},{}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/persistence/TreePersistence.coffee":[function(require,module,exports){
},{}],12:[function(require,module,exports){
var TreeActions;
TreeActions = require('../actions/TreeActions.coffee');
@ -1073,7 +1075,7 @@ module.exports = {
},{"../actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/actions/TreeActions.coffee"}],"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/stores/TreeStore.coffee":[function(require,module,exports){
},{"../actions/TreeActions.coffee":1}],13:[function(require,module,exports){
var EventEmitter, MessageDispatcher, TreeStore, _cont, _curr, _load, _snip, _tree;
EventEmitter = require('events').EventEmitter;
@ -1284,7 +1286,7 @@ module.exports = TreeStore;
},{"../dispatcher/Dispatcher.coffee":"/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/dispatcher/Dispatcher.coffee","events":"/usr/local/lib/node_modules/watchify/node_modules/browserify/node_modules/events/events.js"}],"/usr/local/lib/node_modules/watchify/node_modules/browserify/node_modules/events/events.js":[function(require,module,exports){
},{"../dispatcher/Dispatcher.coffee":7,"events":14}],14:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@ -1344,10 +1346,8 @@ EventEmitter.prototype.emit = function(type) {
er = arguments[1];
if (er instanceof Error) {
throw er; // Unhandled 'error' event
} else {
throw TypeError('Uncaught, unspecified "error" event.');
}
return false;
throw TypeError('Uncaught, unspecified "error" event.');
}
}
@ -1589,4 +1589,4 @@ function isUndefined(arg) {
return arg === void 0;
}
},{}]},{},["/Users/galen/Documents/src/urbit-dev/urb/zod/docs/pub/tree/src/js/main.coffee"]);
},{}]},{},[8]);

View File

@ -0,0 +1,12 @@
# installing
`npm install`
# building
in `src/js/`:
`watchify -v -t coffeeify -o main.js main.coffee`
in `src/css/`:
`stylus -w main.styl`

View File

@ -17,11 +17,11 @@
;head
;title: urbit Tree
;meta(name "viewport", content "width=device-width, initial-scale=1");
;link(type "text/css", rel "stylesheet", href "/gen/docs/pub/tree/src/css/main.css");
;link(type "text/css", rel "stylesheet", href "/docs/pub/tree/src/css/main.css");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.js");
;script(type "text/javascript", src "/gen/docs/pub/tree/src/js/main.js");
;script(type "text/javascript", src "/docs/pub/tree/src/js/main.js");
==
;body
;script(type "text/javascript"):"""

View File

@ -33,7 +33,6 @@
[ust %pass / %c %plug our.hid %try (sein our.hid) %try]
[ust %give %nice ~]
==
::
++ pour
|= [ost=bone pax=path sih=*]
@ -45,4 +44,15 @@
%went ~
==
::
++ poke-will
|= [ost=bone you=ship wil=(unit will)]
:_ +>.$
?~ wil
[ust %give %mean ~ %rejected ~]~
:~ [ust %pass / %a %cash his mac u.wil]
[ust %pass / %c %plug our.hid %main (sein our.hid) %main]
[ust %pass / %c %plug our.hid %arvo (sein our.hid) %arvo]
[ust %pass / %c %plug our.hid %try (sein our.hid) %try]
[ust %give %nice ~]
==
--

View File

@ -221,12 +221,12 @@
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs".
"/jquery/2.1.1/jquery.min.js");
;script:'try{Typekit.load();}catch(e){}'
;link(rel "stylesheet", type "text/css", href "/gen/main/pub/src/chat/main.css");
;link(rel "stylesheet", type "text/css", href "/main/pub/src/chat/main.css");
==
;body
;div#c;
;script(type "text/javascript", src "/gen/main/lib/urb.js");
;script(type "text/javascript", src "/gen/main/pub/src/chat/main.js");
;script(type "text/javascript", src "/main/lib/urb.js");
;script(type "text/javascript", src "/main/pub/src/chat/main.js");
==
==
::

733
main/app/dojo/core.hook Normal file
View File

@ -0,0 +1,733 @@
:: :: ::
:::: /hook/core/dojo/app :: ::::
:: :: ::
/? 314 :: arvo kelvin
/- *sole :: console structures
/+ sole :: console library
:: :: ::
:::: :: ::::
!: :: ::
=> |% :: external structures
++ house :: all state
$: hoc=(map bone session) :: conversations
== ::
++ session :: per conversation
$: say=sole-share :: command-line state
syd=desk :: active desk
luc=(unit case) :: special case
poy=(unit dojo-project) :: working
var=(map term cage) :: variable state
old=(set term) :: used TLVs
== ::
++ dojo-command ::
$% [%flat p=path q=dojo-source] :: noun to unix atom
[%pill p=path q=dojo-source] :: noun to unix pill
:: [%tree p=path q=dojo-source] :: noun to unix tree
[%poke p=goal q=dojo-source] :: make and poke
[%show p=dojo-source] :: print
[%verb p=term q=dojo-source] :: store variable
== ::
++ dojo-source :: construction node
$: p=@ud :: assembly index
q=dojo-build :: general build
== ::
++ dojo-build :: one ford step
$% [%ex p=twig] :: hoon expression
[%di p=dojo-model] :: dialog
[%dv p=path] :: gate from source
[%fi p=dojo-filter q=dojo-source] :: filter
[%ge p=dojo-model] :: generator
[%sc p=dojo-model] :: script
[%tu p=(list dojo-source)] :: tuple
[%va p=term] :: dojo variable
== ::
++ dojo-filter :: pipeline filter
$% [%a p=twig] :: function gate
[%b p=mark] :: simple transmute
[%c p=dojo-model] :: formal filter
== ::
++ dojo-model :: data construction
$: p=dojo-server :: core source
q=dojo-config :: configuration
== ::
++ dojo-server :: numbered device
$: p=@ud :: assembly index
q=path :: gate path
== ::
++ dojo-config :: configuration
$: p=(list dojo-source) :: by order
q=(map term (unit dojo-source)) :: by keyword
== ::
++ dojo-project :: construction state
$: mad=dojo-command :: operation
num=@ud :: number of tasks
cud=(unit dojo-source) :: now solving
pux=(unit path) :: ford working
pro=(unit vase) :: prompting loop
per=(unit sole-edit) :: pending reverse
job=(map ,@ud dojo-build) :: problems
rez=(map ,@ud cage) :: results
== ::
++ bead ,[p=(set beam) q=cage] :: computed result
++ goal ,[p=ship q=term] :: flat application
++ gift :: out result <-$
$% [%mean p=ares] :: error
[%nice ~] :: acknowledge
[%rush %sole-effect sole-effect] ::
== ::
++ hapt ,[p=ship q=path] ::
++ move ,[p=bone q=(mold note gift)] ::
++ hood :: assembly plan
$: zus=@ud :: zuse kelvin
sur=(list hoot) :: structures
lib=(list hoof) :: libraries
fan=(list horn) :: resources
src=(list hoop) :: program
== ::
++ hoof (pair term (unit (pair case ship))) :: resource reference
++ hoot (pair bean hoof) :: structure gate/core
++ hoop :: source in hood
$% [%& p=twig] :: direct twig
[%| p=beam] :: resource location
== ::
++ horn :: resource tree
$% [%ape p=twig] :: /~ twig by hand
[%arg p=twig] :: /$ argument
[%day p=horn] :: /| list by @dr
[%dub p=term q=horn] :: /= apply face
[%fan p=(list horn)] :: /. list
[%for p=path q=horn] :: /, descend
[%hel p=@ud q=horn] :: /% propagate heel
[%hub p=horn] :: /@ list by @ud
[%man p=(map span horn)] :: /* hetero map
[%nap p=horn] :: /_ homo map
[%now p=horn] :: /& list by @da
[%saw p=twig q=horn] :: /; operate on
[%see p=beam q=horn] :: /: relative to
[%sic p=tile q=horn] :: /^ cast
[%toy p=mark] :: /mark/ static
== ::
++ silk :: construction layer
$& [p=silk q=silk] :: cons
$% [%bake p=mark q=beam r=path] :: local synthesis
[%boil p=mark q=beam r=path] :: general synthesis
[%call p=silk q=silk] :: slam
[%cast p=mark q=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
[%plan p=beam q=spur r=hood] :: structured assembly
[%reef ~] :: kernel reef
[%ride p=twig q=silk] :: silk thru twig
[%vale p=mark q=ship r=*] :: validate [our his]
== ::
++ note-ford :: note to ford
$% [%exec p=@p q=(unit silk)] :: make / kill
== ::
++ note-gall :: note to %gall
$% [%mess p=[p=ship q=path] q=ship r=cage] ::
== ::
++ sign-gall :: sign from %gall
$% [%mean p=ares] ::
[%nice ~] ::
== ::
++ sign-ford :: sign from ford
$% [%made p=@uvH q=(each cage tang)] :: computed result
== ::
++ note :: out request $->
$% [%f note-ford] ::
[%g note-gall] ::
== ::
++ sign :: in result $<-
$% [%f sign-ford] ::
[%g sign-gall] ::
== ::
-- ::
:: ::
:::: ::
:: ::
|_ $: hid=hide :: system state
house :: program state
== ::
++ he :: per session
|_ [[ost=bone moz=(list move)] session] ::
++ dp :: dojo parser
|%
++ dp-command :: ++dojo-command
%+ knee *dojo-command |. ~+
;~ pose
%+ stag %poke
;~ pfix col
%+ cook
|= [a=goal b=(each dojo-source (trel term path dojo-config))]
^- (pair goal dojo-source)
:- a
?- -.b
%& p.b
%| ?+ p.p.b !!
%di [0 %di [0 [%dog q.a q.p.b]] r.p.b]
%ge [0 %ge [0 [%cat q.a q.p.b]] r.p.b]
%sc [0 %sc [0 [%pig q.a q.p.b]] r.p.b]
==
==
;~ plug
dp-goal
;~ pose
(stag %& ;~(pfix ace dp-source))
%+ stag %|
;~ plug
;~ pose
(cold %di wut)
(cold %ge lus)
(cold %sc pam)
==
(most fas sym)
dp-config
==
==
==
==
::
%+ stag %verb
;~ pfix tis
;~(plug sym ;~(pfix ace dp-source))
==
::
%+ stag %flat
;~ pfix pat
;~(plug (most fas sym) ;~(pfix ace dp-source))
==
::
%+ stag %pill
;~ pfix dot
;~(plug (most fas sym) ;~(pfix ace dp-source))
==
::
(stag %show dp-source)
==
++ dp-source (stag 0 dp-build) :: ++dojo-source
++ dp-build :: ++dojo-build
%+ knee *dojo-build |. ~+
;~ pose
;~(pfix lus (stag %ge dp-model-cat))
;~(pfix wut (stag %di dp-model-dog))
;~(pfix pam (stag %sc dp-model-pig))
;~(pfix buc (stag %va sym))
(stag %ex dp-twig)
(ifix [sel ser] (stag %tu (most ace dp-source)))
==
::
++ dp-goal :: ++goal
%+ cook |=(a=goal a)
;~ pose
;~ plug
;~(pfix sig fed:ag)
;~(pfix fas sym)
==
(cook |=(a=term `goal`[our.hid a]) sym)
==
++ dp-model-cat ;~(plug dp-server-cat dp-config) :: ++dojo-model
++ dp-model-dog ;~(plug dp-server-dog dp-config) :: ++dojo-model
++ dp-model-pig ;~(plug dp-server-pig dp-config) :: ++dojo-model
++ dp-server-cat (stag 0 (stag %cat dp-device)) :: ++dojo-server
++ dp-server-dog (stag 0 (stag %dog dp-device)) :: ++dojo-server
++ dp-server-pig (stag 0 (stag %pig dp-device)) :: ++dojo-server
++ dp-twig wide:(vang & ~) :: ++twig
++ dp-device (most fas sym) :: ++dojo-device
++ dp-value :: ++dojo-source
%+ cook |=(a=dojo-source a)
%+ stag 0
;~ pose
(ifix [kel ker] (stag %tu (most ace dp-source)))
(stag %va ;~(pfix buc sym))
(stag %ex dp-twig)
==
::
++ dp-config :: ++dojo-config
%+ cook |=(a=dojo-config a)
;~ plug
(star ;~(pfix ace dp-value))
%+ cook
~(gas by *(map term (unit dojo-source)))
%+ more
;~(plug com ace)
;~ plug
;~(pfix tis sym)
;~ pose
;~(pfix ace (stag ~ dp-value))
(easy ~)
==
==
==
--
::
++ dy :: project work
|_ dojo-project ::
++ dy-abet +>(poy `+<) :: resolve
++ dy-amok +>(poy ~) :: terminate
++ dy-ford :: send work to ford
|= [pax=path kas=silk]
^+ +>+>
?> ?=(~ pux)
(he-pass(poy `+>+<(pux `pax)) pax %f %exec our.hid `kas)
::
++ dy-stop :: stop work
^+ +>
?~ pux +>
(he-pass(poy ~) u.pux %f %exec our.hid ~)
::
++ dy-slam :: call by ford
|= [pax=path gat=vase sam=vase]
^+ +>+>
(dy-ford pax %call [%done ~ %noun gat] [%done ~ %noun sam])
::
++ dy-rush :: send effects, abet
|= fec=sole-effect
^+ +>+>
(he-rush(poy `+>+<) fec)
::
++ dy-rash :: send effects, amok
|= fec=sole-effect
^+ +>+>
(he-rush(poy ~) fec)
::
++ dy-init-command :: ++dojo-command
|= mad=dojo-command
^+ [mad +>]
?- -.mad
%flat =^(src +>.$ (dy-init-source q.mad) [[%flat p.mad src] +>.$])
%pill =^(src +>.$ (dy-init-source q.mad) [[%pill p.mad src] +>.$])
%poke =^(src +>.$ (dy-init-source q.mad) [[%poke p.mad src] +>.$])
%show =^(src +>.$ (dy-init-source p.mad) [[%show src] +>.$])
%verb =^(src +>.$ (dy-init-source q.mad) [[%verb p.mad src] +>.$])
==
::
++ dy-init-source-unit :: (unit dojo-source)
|= urc=(unit dojo-source)
^+ [urc +>]
?~ urc [~ +>]
=^ src +> (dy-init-source u.urc)
[`src +>.$]
::
++ dy-init-source :: ++dojo-source
|= src=dojo-source
^+ [src +>]
=^ bul +> (dy-init-build q.src)
=: p.src num
q.src bul
==
[src +>.$(num +(num), job (~(put by job) num q.src))]
::
++ dy-init-build :: ++dojo-build
|= bul=dojo-build
^+ [bul +>]
?- -.bul
%ex [bul +>.$]
%di =^(mod +>.$ (dy-init-model p.bul) [[%di mod] +>.$])
%dv [bul +>.$]
%fi !!
%ge =^(mod +>.$ (dy-init-model p.bul) [[%ge mod] +>.$])
%sc !!
%tu =^ dof +>.$
|- ^+ [p.bul +>.^$]
?~ p.bul [~ +>.^$]
=^ dis +>.^$ (dy-init-source i.p.bul)
=^ mor +>.^$ $(p.bul t.p.bul)
[[dis mor] +>.^$]
[[%tu dof] +>.$]
%va [bul +>.$]
==
::
++ dy-init-model :: ++dojo-model
|= mol=dojo-model
^+ [mol +>]
=^ one +>.$ (dy-init-server p.mol)
=^ two +>.$ (dy-init-config q.mol)
[[one two] +>.$]
::
++ dy-init-server :: ++dojo-server
|= srv=dojo-server
=. p.srv num
[srv +>.$(num +(num), job (~(put by job) num [%dv q.srv]))]
::
++ dy-init-config :: prepare config
|= cig=dojo-config
^+ [cig +>]
=^ ord +>.$ (dy-init-ordered p.cig)
=^ key +>.$ (dy-init-named q.cig)
[[ord key] +>.$]
::
++ dy-init-ordered :: (list dojo-source)
|= ord=(list dojo-source)
^+ [ord +>]
?~ ord [~ +>.$]
=^ fir +>.$ (dy-init-source i.ord)
=^ mor +>.$ $(ord t.ord)
[[fir mor] +>.$]
::
++ dy-init-named :: (map @tas dojo-src)
|= key=(map term (unit dojo-source))
^+ [key +>.$]
?~ key [~ +>.$]
=^ top +>.$ (dy-init-source-unit q.n.key)
=^ lef +>.$ $(key l.key)
=^ rit +>.$ $(key r.key)
[[[p.n.key top] lef rit] +>.$]
::
++ dy-init :: full initialize
^+ .
=^(dam . (dy-init-command mad) +(mad dam))
::
++ dy-hand :: complete step
|= cag=cage
^+ +>+>
?> ?=(^ cud)
(dy-step(cud ~, rez (~(put by rez) p.u.cud cag)) +(p.u.cud))
::
++ dy-meal :: vase to cage
|= vax=vase
?. &(?=(@ -.q.vax) ((sane %tas) -.q.vax))
~& %dy-meal-cage
(dy-rash %bel ~)
(dy-hand -.q.vax (slot 3 vax))
::
++ dy-made-edit :: sole edit
|= cag=cage
^+ +>+>
?> ?=(^ per)
?: ?| ?=(^ q.q.cag)
=((lent buf.say) q.q.cag)
!&(?=(%del -.u.per) =(+(p.u.per) (lent buf.say)))
==
dy-abet(per ~)
=^ lic say (~(transmit cs say) u.per)
(dy-rush(per ~) %mor [%det lic] [%err q.q.cag] ~)
::
++ dy-done :: dialog submit
|= txt=tape
?> ?=(^ pro)
(dy-slam /dial u.pro !>(txt))
::
++ dy-over :: finish construction
^+ +>
?- -.mad
%poke
%- he-pass(poy ~)
:* /poke
%g
%mess
[p.p.mad [q.p.mad ~]]
our.hid
(~(got by rez) p.q.mad)
==
::
%flat
=+ out=q.q:(~(got by rez) p.q.mad)
?^ out
(dy-rash %tan [%leaf "not an atom"]~)
(dy-rash %sav p.mad out)
::
%pill
(dy-rash %sag p.mad q.q:(~(got by rez) p.q.mad))
::
%verb
dy-amok(var (~(put by var) p.mad (~(got by rez) p.q.mad)))
::
%show
(dy-rash %tan (sell q:(~(got by rez) p.p.mad)) ~)
==
::
++ dy-edit :: handle edit
|= cal=sole-change
^+ +>+>
=^ dat say (~(transceive cs say) cal)
?: |(?=(^ per) ?=(^ pux) ?=(~ pro))
~& %dy-edit-busy
=^ lic say (~(transmit cs say) dat)
(dy-rush %mor [%det lic] [%bel ~] ~)
(dy-slam(per `dat) /edit u.pro !>((tufa buf.say)))
::
++ dy-type :: sole action
|= act=sole-action
?- -.act
%det (dy-edit +.act)
%ret (dy-done (tufa buf.say))
==
::
++ dy-cage |=(num=@ud (~(got by rez) num)) :: known cage
++ dy-vase |=(num=@ud q:(dy-cage num)) :: known vase
++ dy-silk-vase |=(vax=vase [%done ~ %noun vax]) :: vase to silk
++ dy-silk-config :: configure
|= [cag=cage cig=dojo-config]
^- silk
:+ %ride [%cnzy %$]
:+ %mute [%done ~ cag]
^- (list (pair wing silk))
:* :- [[~ 12] ~]
(dy-silk-vase !>([now=lat.hid eny=eny.hid bec=he-beak]))
::
:- [[~ 26] ~]
%- dy-silk-vase
|- ^- vase
?~ p.cig !>(~)
(slop (dy-vase p.i.p.cig) $(p.cig t.p.cig))
::
%+ turn (~(tap by q.cig))
|= [a=term b=(unit dojo-source)]
^- (pair wing silk)
:- [a [~ 27] ~]
%- dy-silk-vase
?~(b !>([~ ~]) (dy-vase p.u.b))
==
::
++ dy-silk-init-modo :: init and config
|= [cag=cage cig=dojo-config]
^- silk
(dy-silk-config cag cig)
::
++ dy-silk-device :: device to silk
|= pax=path
^- silk
[%boil %gate [he-beak (flop pax)] ~]
::
++ dy-made-dial :: dialog product
|= cag=cage
^+ +>+>
?. ?=(^ q.q.cag)
(dy-rush %err q.q.cag)
=+ tan=((list tank) +2.q.q.cag)
=. +>+>.$ (he-rush %tan tan)
=+ vax=(spec (slot 3 q.cag))
?+ -.q.vax !!
%&
?~ +.q.vax
~& %dy-made-dial-abort
(dy-rash %bel ~)
(dy-meal (slot 7 vax))
::
%|
=< he-pone
%- dy-rush(pro `(slap (slot 7 vax) [%cnzy %q]))
=+ pom=(sole-prompt +<.q.vax)
[%pro pom(cad [':' ' ' cad.pom])]
==
::
++ dy-made-gent :: generator product
|= cag=cage
(dy-meal q.cag)
::
++ dy-make :: build step
^+ +>
?> ?=(^ cud)
%- dy-ford
^- (pair path silk)
?+ -.q.u.cud !!
%di [/dial (dy-silk-init-modo (dy-cage p.p.p.q.u.cud) q.p.q.u.cud)]
%ge [/gent (dy-silk-init-modo (dy-cage p.p.p.q.u.cud) q.p.q.u.cud)]
%dv [/hand (dy-silk-device p.q.u.cud)]
%ex [/hand [%ride p.q.u.cud [%reef ~]]]
%tu :- /hand
:+ %done ~
:- %noun
|- ^- vase
?~ p.q.u.cud !!
=+ hed=(dy-vase p.i.p.q.u.cud)
?~ t.p.q.u.cud hed
(slop hed $(p.q.u.cud t.p.q.u.cud))
==
::
++ dy-step :: advance project
|= nex=@ud
^+ +>+>
?> ?=(~ cud)
?: =(nex num)
dy-over
dy-make(cud `[nex (~(got by job) nex)])
--
::
++ he-dope :: sole user of ++dp
|= txt=tape ::
^- (each (unit dojo-command) hair) :: prefix/result
=+ vex=(dp-command:dp [1 1] txt) ::
?. =(+((lent txt)) q.p.vex) :: fully parsed
[%| p.p.vex (dec q.p.vex)] :: syntax error
[%& ?~(q.vex ~ `p.u.q.vex)] :: prefix/complete
::
++ he-duke :: ++he-dope variant
|= txt=tape
^- (each dojo-command ,@ud)
=+ foy=(he-dope txt)
?- -.foy
%| [%| q.p.foy]
%& ?~(p.foy [%| (lent txt)] [%& u.p.foy])
==
::
++ he-abet :: resolve
[(flop moz) %_(+> hoc (~(put by hoc) ost +<+))]
::
++ he-beak :: logical beam
^- beak
[our.hid syd ?^(luc u.luc [%da lat.hid])]
::
++ he-give :: emit gift
|= git=gift
^+ +>
%_(+> moz [[ost %give git] moz])
::
++ he-pass
|= [pax=path noy=note]
%_(+> moz [[ost %pass pax noy] moz])
::
++ he-rush :: emit update
|= fec=sole-effect
^+ +>
(he-give %rush %sole-effect fec)
::
++ he-stop :: abort work
^+ .
?~(poy . ~(dy-stop dy u.poy))
::
++ he-peer :: subscribe to
he-prom
::
++ he-pine :: restore prompt
^+ .
?^ poy .
he-prom:he-pone
::
++ he-pone :: clear prompt
^+ .
=^ cal say (~(transmit cs say) [%set ~])
(he-rush %mor [%det cal] ~)
::
++ he-prom :: send prompt
%- he-rush
:- %pro
[& %$ "> "]
::
++ he-made :: result from ford
|= [pax=path dep=@uvH rey=(each cage tang)]
^+ +>
?> ?=(^ poy)
=< he-pine
?- -.rey
%& %. p.rey
=+ dye=~(. dy u.poy(pux ~))
?+ pax !!
[%hand ~] dy-hand:dye
[%dial ~] dy-made-dial:dye
[%gent ~] dy-made-gent:dye
[%edit ~] dy-made-edit:dye
==
%| ~& [%he-made-fail pax]
(he-rush(poy ~) %tan p.rey)
==
::
++ he-like :: accept line
|= buf=(list ,@c)
=(%& -:(he-dope (tufa buf)))
::
++ he-stir :: apply change
|= cal=sole-change
^+ +>
:: ~& [%his-clock ler.cal]
:: ~& [%our-clock ven.say]
=^ dat say (~(transceive cs say) cal)
?. ?& ?=(%del -.dat)
=(+(p.dat) (lent buf.say))
==
+>.$
=+ foy=(he-dope (tufa buf.say))
?: ?=(%& -.foy) +>.$
:: ~& [%bad-change dat ted.cal]
=^ lic say (~(transmit cs say) dat)
:: ~& [%our-leg leg.say]
(he-rush %mor [%det lic] [%err q.p.foy] ~)
::
++ he-plan :: execute command
|= mad=dojo-command
^+ +>
?> ?=(~ poy)
he-pine:(dy-step:~(dy-init dy mad [0 ~ ~ ~ ~ ~ ~]) 0)
::
++ he-done :: parse command
|= txt=tape
^+ +>
?~ txt
%- he-rush
:~ %mor
[%txt "> "]
[%nex ~]
==
=+ doy=(he-duke txt)
?- -.doy
%| (he-rush [%err p.doy])
%&
=+ old=(weld "> " (tufa buf.say))
=^ cal say (~(transmit cs say) [%set ~])
%. p.doy
=< he-plan
%- he-rush
:~ %mor
[%txt old]
[%nex ~]
[%det cal]
==
==
::
++ he-type :: apply input
|= act=sole-action
^+ +>
?^ poy
he-pine:(~(dy-type dy u.poy) act)
?- -.act
%det (he-stir +.act)
%ret (he-done (tufa buf.say))
==
--
::
++ peer
|= [ost=bone her=ship pax=path]
^- [(list move) _+>]
~? !=(her our.hid) [%dojo-peer ost her pax]
?< (~(has by hoc) ost)
?> =(/sole pax)
:: ?> =(her our.hid)
=< he-abet
%~ he-peer he
:- [ost ~]
^- session
:* *sole-share :: say=sole-share
%main :: syd=desk
~ :: luc=(unit case)
~ :: poy=(unit dojo-project)
~ :: var=(map term cage)
~ :: old=(set term)
==
::
++ poke-sole-action
|= [ost=bone her=ship act=sole-action]
^- [(list move) _+>]
:: ~? !=(her our.hid) [%dojo-poke ost her]
he-abet:(~(he-type he [ost [ost %give %nice ~]~] (~(got by hoc) ost)) act)
::
++ pour
|= [ost=bone pax=path sih=sign]
^- [(list move) _+>]
:: ~& [%dojo-pour pax]
?- -.sih
%f
he-abet:(~(he-made he [[ost ~] (~(got by hoc) ost)]) pax +>.sih)
::
%g
[~ +>.$]
==
::
++ pull
|= ost=bone
^- [(list move) _+>]
=^ moz +>
he-abet:~(he-stop he [[ost ~] (~(got by hoc) ost)])
[moz +>.$(hoc (~(del by hoc) ost))]
--

172
main/app/helm/core.hook Normal file
View File

@ -0,0 +1,172 @@
:: :: ::
:::: /hook/core/helm/app :: ::
:: :: ::
/? 314 :: zuse version
/- *sole :: structures
/+ sole :: libraries
:: :: ::
:::: :: ::
!: :: ::
=> |% :: principal structures
++ helm-house :: all state
$: %0 :: state version
bur=(unit (pair ship mace)) :: requesting ticket
hoc=(map bone helm-session) :: consoles
== ::
++ helm-session ::
$: say=sole-share ::
mud=(unit (sole-dialog ,@ud)) ::
== ::
++ funk (pair ,@ ,@) ::
++ begs ,[his=@p tic=@p eny=@t ges=gens] :: begin data
++ helm-wish ::
$| $? %reset :: reset kernel
%verb :: verbose mode
== ::
$% [%reload p=(list term)] :: reload vanes
== ::
++ dill-flog :: sent to %dill
$% [%veer p=@ta q=path r=@t] :: install vane
[%vega p=path] :: reboot by path
[%verb ~] :: verbose mode
== ::
:: ::
++ gift :: out result <-$
$% [%mean p=ares] :: error
[%nice ~] :: acknowledge
[%rush %sole-effect sole-effect] :: effect
== ::
++ hapt ,[p=ship q=path] ::
++ move ,[p=bone q=(mold note gift)] ::
++ note-gall :: note to %gall
$% [%mess p=[p=ship q=path] q=ship r=cage] ::
[%show p=[p=ship q=path] q=ship r=path] ::
[%took p=[p=ship q=path] q=ship] ::
== ::
++ note-dill :: system command
$% [%flog p=dill-flog] ::
== ::
++ note :: out request $->
$% [%d note-dill] ::
[%g note-gall] ::
== ::
-- ::
:: ::
:::: ::
:: ::
|_ $: hid=hide :: system state
helm-house :: program state
== ::
++ he :: per session
|_ [[ost=bone moz=(list move)] helm-session] ::
++ he-abet :: resolve
[(flop moz) %_(+> hoc (~(put by hoc) ost +<+))] ::
:: ::
++ he-give :: emit gift
|= git=gift
%_(+> moz [[ost %give git] moz])
::
++ he-wish-reset
^+ .
=- %_(+ moz (weld zum moz))
^= zum %- flop ^- (list move)
=+ top=`path`/(scot %p our.hid)/arvo/(scot %da lat.hid)
:- [ost %pass /reset %d %flog %vega (weld top `path`/hoon)]
%+ turn
^- (list ,[p=@tas q=@tas])
:~ [%$ %zuse]
[%a %ames]
[%c %clay]
[%d %dill]
[%e %eyre]
[%f %ford]
[%g %gall]
[%t %time]
==
|= [p=@tas q=@tas]
=+ pax=`path`(welp top /[q])
=+ txt=((hard ,@) .^(%cx (welp pax /hoon)))
[ost %pass /reset %d %flog %veer p pax txt]
::
++ he-wish-reload
|= all=(list term)
%_ +>.$
moz
%- weld
:_ moz
%+ turn all
=+ ark=(arch .^(%cy /(scot %p our.hid)/arvo/(scot %da lat.hid)))
=+ van=(~(tap by r.ark))
|= nam=@tas
=. nam
?. =(1 (met 3 nam))
nam
=+ ^- zaz=(list ,[p=span ~])
(skim van |=([a=term ~] =(nam (end 3 1 a))))
?> ?=([[@ ~] ~] zaz)
`term`p.i.zaz
=+ tip=(end 3 1 nam)
=+ pax=[(scot %p our.hid) %arvo (scot %da lat.hid) nam %hoon ~]
:* ost
%pass
/reload
%d
%flog
[%veer ?:(=('z' tip) %$ tip) pax (,@ .^(%cx pax))]
==
==
::
++ he-wish-verb
%_ .
moz
:_ moz
[ost %pass /verb %d %flog %verb ~]
==
--
::
++ hake :: poke core
|= [ost=bone her=ship]
?> =(her our.hid)
~(. he [ost [ost %give %nice ~]~] (fall (~(get by hoc) ost) *helm-session))
::
++ poke-helm-reset
|= [ost=bone her=ship ~]
~& %poke-helm-reset
he-abet:he-wish-reset:(hake ost her)
::
++ poke-helm-verb
|= [ost=bone her=ship ~]
~& %poke-helm-verb
he-abet:he-wish-verb:(hake ost her)
::
++ poke-helm-reload
|= [ost=bone her=ship all=(list term)]
~& %poke-helm-reload
he-abet:(he-wish-reload:(hake ost her) all)
::
++ poke-helm-begin
|= [ost=bone you=ship begs]
~& %poke-helm-begin
?> ?=(~ bur)
=+ buz=(shax :(mix (jam ges) eny))
=+ loy=(bruw 2.048 buz)
:_ +>.$(bur `[his [0 sec:ex:loy]~])
:~ :* ost %pass /ticketing %a %want [our.hid (sein his)] /q/ta
his tic ges pub:ex:loy
==
[ost %give %nice ~]
==
::
++ poke-will
|= [ost=bone you=ship wil=(unit will)]
?> ?=(^ bur)
:_ +>.$(bur ~)
?~ wil
[ost %give %mean ~ %rejected ~]~
:~ [ost %pass / %a %cash p.u.bur q.u.bur u.wil]
[ost %pass / %c %plug our.hid %main (sein our.hid) %main]
[ost %pass / %c %plug our.hid %arvo (sein our.hid) %arvo]
[ost %pass / %c %plug our.hid %try (sein our.hid) %try]
[ost %give %nice ~]
==
--

View File

@ -1,46 +0,0 @@
:: Hi, send optional message to a ship
::
:::: /hook/core/hi/bin
::
/+ sh-utils
::
::::
::
|%
++ sign ::
$% $: %g ::
$% [%nice ~] ::
[%mean p=ares] ::
== == ==
++ flog :: sent to %dill
$% [%crud p=@tas q=(list tank)] ::
[%text p=tape] ::
== ::
--
!:
::::
::
|_ [hid=hide ~]
++ peer ,_`.
++ poke--args
|= [bone you=ship her=ship mes=?(~ [tex=tape ~])]
%. +<
%+ add-resp
=+ mez=[%txt !>(?~(mes '' (crip tex.mes)))]
[%pass /hi/(scot %p her) %g %mess [her /hi] you mez]
(add-nice ,_`+>.$)
::
++ poke-txt
%- add-nice
|= [ost=bone him=ship cor=@t]
:_ +>.$
[ost %pass /di %d %flog %text "< {<him>}: {(trip cor)}"]~
::
++ pour
|= [ost=bone pax=path sih=sign]
?> ?=([%hi @t ~] pax)
%. +<
=+ ack=?+(+<.sih "unsuccesful" %nice "succesful")
(add-exit (print +>.$ "hi {(trip i.t.pax)} {ack}"))
::
--

View File

@ -1,94 +0,0 @@
/- mess,user,users,zing,zong
!:
=> |%
++ axle
$% [%0 p=(map path ,[p=(list zong) q=(map ship ,?)])]
==
++ blitz
$% [%zong p=zong]
[%user p=user]
==
++ iron
$% [%zongs p=(list zong)]
[%users p=users]
==
++ gift
$% [%rush blitz]
[%rust iron]
[%mean ares]
[%nice ~]
==
++ move ,[p=bone q=(mold note gift)]
++ note ,[%c %info p=@p q=@tas r=nori] :: internal edit
--
|_ [hid=hide vat=axle]
++ grab
|= sta=path
(fall (~(get by p.vat) sta) *[p=(list zong) q=(map ship ,?)])
::
++ ident
|= you=ship
%- (hard ,@t)
.^(%a (scot %p our.hid) %name (scot %da lat.hid) (scot %p you) ~)
::
++ peer
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
?~ pax
[[ost %give %mean ~ %radio-bad-path ~]~ +>.$]
=+ ya=(grab t.pax)
?+ -.pax [~ +>.$]
%mensajes
[[ost %give %rust %zongs p.ya]~ +>.$]
%amigos
=. q.ya (~(put by q.ya) you %.y)
:_ +>.$(p.vat (~(put by p.vat) t.pax ya))
:_ (send pax %give %rush %user %in you (ident you))
:* ost %give %rust %users
%+ murn (~(tap by q.ya))
|= [shi=ship liv=?]
?. liv
~
(some [shi (ident shi)])
==
==
::
++ poke-zing
|= [ost=bone you=ship zig=zing]
^- [(list move) _+>]
=+ ya=(grab p.zig)
?. (~(has by q.ya) you)
[[ost %give %mean ~ %no-te-conozco ~]~ +>.$]
=+ zog=`zong`[%mess lat.hid you q.zig]
=. p.vat (~(put by p.vat) p.zig [[zog p.ya] q.ya])
:_ +>.$
:- [ost %give %nice ~]
(send mensajes/p.zig %give %rush %zong zog)
::
++ poke-bit
|= [ost=bone you=ship ~]
^- [(list move) _+>]
:_ +>.$
=+ paf=/(scot %p our.hid)/try/(scot %da lat.hid)/radio/backlog/jam
[ost %pass /jamfile %c %info our.hid (foal paf (jam +<+.+>.$))]~
::
++ pull
|= ost=bone
^- [(list move) _+>]
=+ ^- (unit ,[his=ship pax=path])
(~(get by sup.hid) ost)
?~ - ~& %strange-pull [~ +>.$]
?. ?=([%mensajes *] pax.u)
[~ +>.$]
=+ sta=(~(got by p.vat) t.pax.u)
=. q.sta %+ ~(put by q.sta) his.u %.n
=. p.vat %+ ~(put by p.vat) t.pax.u sta
[(send amigos/t.pax.u %give %rush %user %out his.u (ident his.u)) +>.$]
::
++ send
|= [pax=path msg=(mold note gift)]
^- (list move)
:: ~& [%radi-sub pus.hid]
%+ turn (~(tap in (~(get ju pus.hid) pax)))
|=(ost=bone [ost msg])
--

View File

@ -25,6 +25,6 @@
?> ?=([[@ ~] ~] zaz)
`term`p.i.zaz
=+ tip=(end 3 1 nam)
=+ pax=[(scot %p our.hid) %arvo (scot %da lat.hid) nam %hoon ~]
[%veer ?:(=('z' tip) %$ tip) pax (,@ .^(%cx pax))]
=+ pax=[(scot %p our.hid) %arvo (scot %da lat.hid) nam ~]
[%veer ?:(=('z' tip) %$ tip) pax (,@ .^(%cx (welp pax /hoon)))]
--

View File

@ -1,763 +0,0 @@
::
:::: /hook/core/rodeo/app
::
/? 314
/- *rodeo, *twitter
/+ rodeo
::
::::
::
!:
=> |% :: data structures
++ house ,[%1 house-1] :: full state
++ house-any :: app history
$% [%1 house-1] :: 1: rodeo
[%0 house-0] :: 0: initial version
== ::
++ house-1 ::
$: stories=(map span story) :: conversations
general=(set bone) :: meta-subscribe
outbox=(pair ,@ud (map ,@ud thought)) :: urbit outbox
folks=(map ship human) :: human identities
== ::
++ house-0 :: legacy state
%+ map path ::
,[p=(list zong) q=(map ship ,?)] ::
:: ::
++ zong :: legacy messages
$% $: %mess p=@da q=ship ::
$= r ::
$% [%do p=@t] ::
[%exp p=@t q=tank] ::
[%say p=@t] ::
== == == ::
++ story :: wire content
$: count=@ud :: (lent grams)
grams=(list telegram) :: all history
locals=(map ship (pair ,@da status)) :: local presence
remotes=(map partner atlas) :: remote presence
sequence=(map partner ,@ud) :: partners heard
shape=config :: configuration
known=(map serial ,@ud) :: messages heard
guests=(map bone river) :: message followers
viewers=(set bone) :: presence followers
owners=(set bone) :: config followers
== ::
++ river (pair point point) :: stream definition
++ point :: stream endpoint
$% [%ud p=@ud] :: by number
[%da p=@da] :: by date
== ::
++ gift :: result
$% [%rush %rodeo-report report] :: refresh
[%mean ares] :: cancel
[%nice ~] :: accept
== ::
++ sign :: response
$% $: %e :: from %eyre
$% [%thou p=httr] :: HTTP response
== == ::
$: %g :: application
$% [%mean p=ares] :: cancel
[%nice ~] :: acknowledge
[%rush p=silt] :: subs data
== == ::
$: %t ::
$% [%wake ~] :: timer wakeup
== == == ::
++ silt
$% [%rodeo-report p=report] :: refresh
[%twit-stat p=twit-stat] :: tweet reciept
[%twit-feed p=(list twit-stat)] :: tweet reciept
==
++ move ,[p=bone q=(mold note gift)] :: all actions
++ hapt ,[p=ship q=path] :: app instance
++ note :: requests
$% $: %c ::
$% [%info p=@p q=@tas r=nori] ::
== == ::
$: %e :: through %eyre
$% [%them p=(unit hiss)] :: HTTP request
== == ::
$: %g :: network
$% [%mess p=hapt q=ship r=cage] :: message
[%nuke p=hapt q=ship] :: cancel
[%show p=hapt q=ship r=path] :: subscribe
[%took p=hapt q=ship] :: acknowledge
== == ::
$: %t ::
$% [%wait p=@da] ::
== == == ::
--
|_ [hid=hide house]
++ ra :: transaction core
|_ [ost=bone moves=(list move)]
++ ra-abet :: resolve core
^- [(list move) _+>]
[(flop moves) +>]
::
++ ra-emil :: ra-emit move list
|= mol=(list move)
%_(+> moves (welp (flop mol) moves))
::
++ ra-emit :: emit a move
|= mov=move
%_(+> moves [mov moves])
::
++ ra-ever :: emit success
(ra-emit ost %give %nice ~)
::
++ ra-evil :: emit error
|= msg=cord
~& [%ra-evil msg]
(ra-emit ost %give %mean ~ msg ~)
::
++ ra-hiss :: emit http request
|= [pax=path hiz=hiss]
(ra-emit ost %pass pax %e %them ~ hiz)
::
++ ra-house :: emit partners
|= ost=bone
%+ ra-emit ost
:^ %give %rush %rodeo-report
:- %house
%- ~(gas in *(map span (pair posture cord)))
%+ turn (~(tap by stories))
|=([a=span b=story] [a p.cordon.shape.b caption.shape.b])
::
++ ra-homes :: update partners
=+ gel=general
|- ^+ +>
?~ gel +>
=. +> $(gel l.gel)
=. +> $(gel r.gel)
(ra-house n.gel)
::
++ ra-init :: initialize rodeo
=+ sir=(sein our.hid)
%+ ra-apply our.hid
:+ %design (main our.hid)
:- ~
:_ [%default ?:((gte our.hid 65.536) %brown %black) ~]
?:(=(sir our.hid) ~ [[%& sir (main sir)] ~ ~])
::
++ ra-apply :: apply command
|= [her=ship cod=command]
^+ +>
~& [%ra-apply cod]
?- -.cod
%design
?. =(her our.hid)
(ra-evil %rodeo-no-owner)
?~ q.cod
?. (~(has by stories) p.cod)
(ra-evil %rodeo-no-story)
=. +>.$ (ra-config p.cod *config)
ra-ever(stories (~(del by stories) p.cod))
=. +>.$ (ra-config p.cod u.q.cod)
ra-ever
::
%review ra-ever:(ra-think | her +.cod)
%publish ra-ever:(ra-think & her +.cod)
==
::
++ ra-config :: configure story
|= [man=span con=config]
^+ +>
=+ :- neu=(~(has by stories) man)
pur=(fall (~(get by stories) man) *story)
=. +>.$ pa-abet:(~(pa-reform pa man pur) con)
?:(neu +>.$ ra-homes)
::
++ ra-friend :: %friend response
|= [man=span tay=partner sih=sign]
^+ +>
=+ pur=(~(get by stories) man)
?~ pur ~& [%ra-friend-none man] +>.$
pa-abet:(~(pa-friend pa man u.pur) tay sih)
::
++ ra-twitter :: %twitter response
|= [[num=@ud man=span] sih=sign]
^+ +>
?+ sih ~|([%rodeo-bad-twitter sih] !!)
[%g ?(%nice %mean) ~]
+>
[%g %mean ^]
(ra-repeat num [%| %twitter man] sih)
[%g %rush %twit-stat *]
(ra-repeat num [%| %twitter man] [%g %nice ~])
==
::
++ ra-repeat :: %repeat response
|= [num=@ud pan=partner sih=sign]
=+ oot=(~(get by q.outbox) num)
?~ oot ~& [%ra-repeat-none num] +>.$
=. q.outbox (~(del by q.outbox) num)
=. q.u.oot
=+ olg=(~(got by q.u.oot) pan)
%+ ~(put by q.u.oot) pan
:- -.olg
?+ sih !!
[%g %mean *] ~&([%rodeo-repeat-rejected num pan sih] %rejected)
[%g %nice ~] %received
==
(ra-think | our.hid u.oot ~)
::
++ ra-cancel :: drop a bone
^+ .
=+ hep=(~(get by sup.hid) ost)
?~ hep +
?. ?=([@ @ *] q.u.hep)
+(general (~(del in general) ost))
=* man i.t.q.u.hep
=+ pur=(~(get by stories) man)
?~ pur +>
pa-abet:(pa-notify:~(pa-cancel pa man u.pur) p.u.hep %gone *human)
::
++ ra-human :: look up person
|= her=ship
^- [human _+>]
=^ who folks
=+ who=(~(get by folks) her)
?^ who [u.who folks]
=+ who=`human`[~ `(scot %p her)] :: XX do right
[who (~(put by folks) her who)]
[who +>.$]
::
++ ra-subscribe :: listen to
|= [her=ship pax=path]
^+ +>
:: ~& [%ra-subscribe her pax]
?: ?=(~ pax)
(ra-house(general (~(put in general) ost)) ost)
?. ?=([@ @ *] pax)
(ra-evil %rodeo-bad-path)
=+ ^= vab ^- (set ,@tas)
=| vab=(set ,@tas)
|- ^+ vab
?: =(0 i.pax) vab
$(i.pax (rsh 3 1 i.pax), vab (~(put in vab) (end 3 1 i.pax)))
=+ pur=(~(get by stories) i.t.pax)
?~ pur
~& [%bad-subscribe-story-c i.t.pax]
(ra-evil %rodeo-no-story)
=+ soy=~(. pa i.t.pax u.pur)
=. soy ?.((~(has in vab) %a) soy (pa-watch:soy her))
=. soy ?.((~(has in vab) %x) soy (pa-master:soy her))
=. soy ?.((~(has in vab) %f) soy (pa-listen:soy her t.t.pax))
=^ who +>.$ (ra-human her)
pa-abet:(pa-notify:soy her %hear who)
::
++ ra-think :: publish/review
|= [pub=? her=ship tiz=(list thought)]
^+ +>
?~ tiz +>
$(tiz t.tiz, +> (ra-consume pub her i.tiz))
::
++ ra-consume :: consume thought
|= [pub=? her=ship tip=thought]
=+ aud=(~(tap by q.tip) ~)
|- ^+ +>.^$
?~ aud +>.^$
$(aud t.aud, +>.^$ (ra-conduct pub her p.i.aud tip))
::
++ ra-conduct :: thought to partner
|= [pub=? her=ship tay=partner tip=thought]
^+ +>
:: ~& [%ra-conduct pub her tay]
?- -.tay
%& ?: pub
=. her our.hid :: XX security!
?: =(her p.p.tay)
(ra-record q.p.tay p.p.tay tip)
(ra-transmit p.tay tip)
?. =(our.hid p.p.tay)
+>
(ra-record q.p.tay her tip)
%| ?. pub +>
?- -.p.tay
%twitter
(ra-tweet p.p.tay tip)
== ==
::
++ ra-record :: add to story
|= [man=span gam=telegram]
^+ +>
=+ pur=(~(get by stories) man)
?~ pur
~& [%no-story man]
+>.$
pa-abet:(~(pa-learn pa man u.pur) gam)
::
++ ra-transmit :: send to neighbor
|= [cuz=station tip=thought]
^+ +>
=. +>
%+ ra-emit ost
:* %pass
/repeat/(scot %ud p.outbox)/(scot %p p.cuz)/[q.cuz]
%g
%mess
[p.cuz /rodeo]
our.hid
[%rodeo-command !>(`command`[%review tip ~])]
==
+>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tip))
::
++ ra-tweet :: send to /twit
|= [man=span tip=thought]
=* sta r.tip
?> ?=(%lin -.r.sta)
=. q.outbox (~(put by q.outbox) p.outbox tip)
%^ ra-emil(p.outbox +(p.outbox))
:* ost
%pass /twitter/stat/(scot %ud p.outbox)/[man]
%g %mess
[our.hid /twit] our.hid
[%twit-do !>(`twit-do`[man %post p.tip q.r.sta])]
==
:* ost
%pass /twitter/stat/(scot %ud p.outbox)/[man]
[%g %show [our.hid /twit] our.hid /post/(scot %uv p.tip)]
==
~
++ pa :: story core
|_ $: man=span
story
==
++ pa-abet
^+ +>
+>(stories (~(put by stories) man `story`+<+))
::
++ pa-admire :: accept from
|= her=ship
^- ?
::?- -.cordon.shape
:: %& (~(has in p.cordon.shape) her)
:: %| !(~(has in p.cordon.shape) her)
::==
&
::
++ pa-watch :: watch presence
|= her=ship
?. (pa-admire her)
(pa-sauce ost [[%mean ~ %rodeo-watch-unauthorized ~] ~])
=. viewers (~(put in viewers) ost)
(pa-display ost ~ ~)
::
++ pa-master :: hear config
|= her=ship
?. (pa-admire her)
(pa-sauce ost [[%mean ~ %rodeo-master-unauthorized ~] ~])
=. owners (~(put in owners) ost)
:: ~& [%pa-master her man shape]
(pa-sauce ost [[%rush %rodeo-report %config shape] ~])
::
++ pa-display :: update presence
|= vew=(set bone)
=+ ^= reg
:_ remotes
|- ^- atlas
?~ locals ~
[[p.n.locals q.q.n.locals] $(locals l.locals) $(locals r.locals)]
:: ~& [%pa-display man reg]
|- ^+ +>.^$
?~ vew +>.^$
=. +>.^$ $(vew l.vew)
=. +>.^$ $(vew r.vew)
(pa-sauce n.vew [[%rush %rodeo-report %group reg] ~])
::
++ pa-monitor :: update config
=+ owe=owners
|- ^+ +>
?~ owe +>
=. +> $(owe l.owe)
=. +> $(owe r.owe)
:: ~& [%pa-monitor man shape]
(pa-sauce n.owe [[%rush %rodeo-report %config shape] ~])
::
++ pa-friend :: subscribed update
|= [tay=partner sih=sign]
^+ +>
?+ sih ~|([%rodeo-bad-friend sih] !!)
[%g %nice ~]
+>.$
::
[%g %mean *]
?~ +>.sih
(pa-acquire [tay ~])
~& [%pa-friend-mean +>.sih]
pa-monitor(sources.shape (~(del in sources.shape) tay))
::
[%g %rush %twit-feed *]
%- pa-lesson
%+ turn p.p.sih |= twit-stat
^- telegram
:^ our.hid :: XX inaccurate
(shas %twit id)
`audience`[[tay [& ~ tay] %received] `~] :: current party?
^- statement
:+ now
~ :: XX hashtags
[%lin & txt]
[%g %rush %rodeo-report *]
:: ~& [%pa-friend-report +>+.sih]
?> ?=(& -.tay)
=. +> %+ pa-scrub ost
:_ ~
:- /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay]
[%g %took [p.p.tay /rodeo] our.hid]
?+ -.p.p.sih ~|([%rodeo-odd-friend sih] !!)
%config +>.$
%group (pa-remind tay +.p.p.sih)
%grams (pa-lesson q.+.p.p.sih)
==
==
::
++ pa-scrub :: pass forward
|= [ost=bone bub=(list (pair path note))]
%_ +>.$
moves
(welp (flop (turn bub |=(a=(pair path note) [ost %pass a]))) moves)
==
::
++ pa-sauce :: send backward
|= [ost=bone gub=(list gift)]
%_ +>.$
moves
(welp (flop (turn gub |=(a=gift [ost %give a]))) moves)
==
::
++ pa-abjure :: unsubscribe move
|= tal=(list partner)
%+ pa-scrub 0
%- zing
%+ turn tal
|= tay=partner
?- -.tay
%| ~& tweet-abjure/p.p.tay
!!
:: :~ :- /friend/nuke/[man]/twitter/[p.p.tay]
:: [%g %nuke [our.hid /twit] our.hid]
:: ==
::
%& :: ~& [%pa-abjure [our.hid man] [p.p.tay q.p.tay]]
:~ :- /friend/nuke/[man]/(scot %p p.p.tay)/[q.p.tay]
[%g %nuke [p.p.tay /rodeo] our.hid]
==
==
::
++ pa-acquire :: subscribe to
|= tal=(list partner)
%+ pa-scrub 0
%- zing
%+ turn tal
|= tay=partner
^- (list (pair path note))
=+ num=(fall (~(get by sequence) tay) 0)
?- -.tay
%| ~& tweet-acquire/p.p.tay
:~ :- /friend/show/[man]/twitter/[p.p.tay]
[%g %show [our.hid /twit] our.hid /user/[p.p.tay]]
==
::
%& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]]
:~ :- /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay]
[%g %show [p.p.tay /rodeo] our.hid /af/[q.p.tay]/(scot %ud num)]
==
==
::
++ pa-reform :: reconfigure, ugly
|= cof=config
=+ ^= dif ^- (pair (list partner) (list partner))
=+ old=`(list partner)`(~(tap in sources.shape) ~)
=+ new=`(list partner)`(~(tap in sources.cof) ~)
:- (skip new |=(a=partner (~(has in sources.shape) a)))
(skip old |=(a=partner (~(has in sources.cof) a)))
=. +>.$ (pa-acquire p.dif)
=. +>.$ (pa-abjure q.dif)
=. shape cof
pa-monitor
::
++ pa-cancel :: unsubscribe from
:: ~& [%pa-cancel ost]
%_ .
guests (~(del by guests) ost)
viewers (~(del in viewers) ost)
owners (~(del in owners) ost)
==
::
++ pa-notify :: local presence
|= [her=ship saz=status]
^+ +>
=+ ^= nol
?: =(%gone p.saz)
(~(del by locals) her)
(~(put by locals) her lat.hid saz)
?: =(nol locals) +>.$
(pa-display(locals nol) viewers)
::
++ pa-remind :: remote presence
|= [tay=partner loc=atlas rem=(map partner atlas)]
=+ ^= buk
=+ mer=(turn (~(tap by rem) ~) |=([* a=atlas] a))
|- ^- atlas
?~ mer loc
=. loc $(mer t.mer)
=+ dur=`(list (pair ship status))`(~(tap by i.mer) ~)
|- ^- atlas
?~ dur loc
=. loc $(dur t.dur)
=+ fuy=(~(get by loc) p.i.dur)
?~ fuy (~(put by loc) p.i.dur q.i.dur)
?: =(`presence`p.q.i.dur `presence`p.u.fuy)
loc
?- p.u.fuy
%gone (~(del by loc) p.i.dur q.i.dur)
%talk loc
%hear (~(put by loc) p.i.dur q.i.dur)
==
=+ gub=(~(get by remotes) tay)
:: ~& [%pa-remind tay gub buk]
?. |(?=(~ gub) !=(buk u.gub))
+>.$
=. remotes (~(put by remotes) tay buk)
(pa-display viewers)
::
++ pa-start :: start stream
|= riv=river
^+ +>
=- :: ~& [%pa-start riv lab]
=. +>.$ (pa-sauce ost [[%rush %rodeo-report %grams q.lab r.lab] ~])
?: p.lab
(pa-sauce ost [[%mean ~] ~])
+>.$(guests (~(put by guests) ost riv))
^= lab
=+ [end=count gaz=grams dun=| zeg=*(list telegram)]
|- ^- (trel ,? ,@ud (list telegram))
?~ gaz [dun end zeg]
?: ?- -.q.riv :: after the end
%ud (lte p.q.riv end)
%da (lte p.q.riv p.r.q.i.gaz)
==
$(end (dec end), gaz t.gaz)
?: ?- -.p.riv :: before the start
%ud (lth end p.p.riv)
%da (lth p.r.q.i.gaz p.p.riv)
==
[dun end zeg]
$(end (dec end), gaz t.gaz, zeg [i.gaz zeg])
::
++ pa-listen :: subscribe
|= [her=ship pax=path]
^+ +>
?. (pa-admire her)
(pa-sauce ost [[%mean ~ %rodeo-listen-unauthorized ~] ~])
=+ ^= ruv ^- (unit river)
?: ?=(~ pax)
`[[%ud count] [%da (dec (bex 128))]]
?: ?=([@ ~] pax)
=+ say=(slay i.pax)
?. ?=([~ %$ ?(%ud %da) @] say) ~
`[(point +>.say) [%da (dec (bex 128))]]
?. ?=([@ @ ~] pax) ~
=+ [say=(slay i.pax) den=(slay i.t.pax)]
?. ?=([~ %$ ?(%ud %da) @] say) ~
?. ?=([~ %$ ?(%ud %da) @] den) ~
`[(point +>.say) (point +>.den)]
:: ~& [%pa-listen her pax ruv]
?~ ruv
(pa-sauce ost [[%mean ~ %rodeo-malformed ~] ~])
(pa-start u.ruv)
::
++ pa-refresh :: update stream
|= [num=@ud gam=telegram]
~& [%pa-refresh man num gam guests]
=+ ^= moy
|- ^- (pair (list bone) (list move))
?~ guests [~ ~]
:: ~& [%pa-refresh num n.guests]
=+ lef=$(guests l.guests)
=+ rit=$(guests r.guests)
=+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)]
?: ?- -.q.q.n.guests :: after the end
%ud (lte p.q.q.n.guests num)
%da (lte p.q.q.n.guests p.r.q.gam)
==
[[p.n.guests p.old] [[p.n.guests %give %mean ~] q.old]]
?: ?- -.p.q.n.guests :: before the start
%ud (gth p.p.q.n.guests num)
%da (gth p.p.q.n.guests p.r.q.gam)
==
old
:- p.old
[[p.n.guests %give %rush %rodeo-report %grams num gam ~] q.old]
=. moves (welp q.moy moves)
|- ^+ +>.^$
?~ p.moy +>.^$
$(p.moy t.p.moy, guests (~(del by guests) i.p.moy))
::
++ pa-lesson :: learn multiple
|= gaz=(list telegram)
^+ +>
?~ gaz +>
$(gaz t.gaz, +> (pa-learn i.gaz))
::
++ pa-learn :: learn message
|= gam=telegram
^+ +>
?. (pa-admire p.gam)
~& %pa-admire-rejected
+>.$
=. q.q.gam
=+ ole=(~(get by q.q.gam) [%& our.hid man])
?~ ole q.q.gam
(~(put by q.q.gam) [%& our.hid man] -.u.ole %received)
=+ old=(~(get by known) p.q.gam)
?~ old
(pa-append gam)
(pa-revise u.old gam)
::
++ pa-append :: append new
|= gam=telegram
^+ +>
%+ %= pa-refresh
grams [gam grams]
count +(count)
known (~(put by known) p.q.gam count)
==
count
gam
::
++ pa-revise :: revise existing
|= [num=@ud gam=telegram]
=+ way=(sub count num)
=. grams (welp (scag (dec way) grams) [gam (slag way grams)])
(pa-refresh num gam)
--
--
++ peer
|= [ost=bone her=ship pax=path]
^- [(list move) _+>]
:: ~& [%rodeo-peer ost her pax]
ra-abet:(~(ra-subscribe ra ost ~) her pax)
::
++ poke-rodeo-command
|= [ost=bone her=ship cod=command]
^- [(list move) _+>]
:: ~& [%rodeo-poke-command her cod]
=^ moz +>.$ ra-abet:(~(ra-apply ra ost ~) her cod)
[moz +>.$]
::
++ pour
|= [ost=bone pax=path sih=*]
^- [(list move) _+>]
:: ~& sih=sih
=+ sih=((hard sign) sih)
:: ~& [%rodeo-pour ost pax sih]
?+ pax ~& [%rodeo-strange-path pax] !!
::
[%twitter *]
=- ra-abet:(~(ra-twitter ra ost ~) met sih)
^= met
?+ t.pax ~| [%rodeo-twitter-strange-path pax] !!
:: [%mine @ @ ~]
:: [i.t.pax i.t.t.t.pax]
[%stat @ @ ~]
[(slav %ud i.t.t.pax) i.t.t.t.pax]
==
::
[%friend *]
?> ?=([@ @ @ @ ~] t.pax)
?. =(%show i.t.pax)
~& [%pour-friend-nuke-nuke pax]
[~ +>.$]
=+ man=i.t.t.pax
=+ ?: ?=(%twitter i.t.t.t.pax)
tay=[%| i.t.t.t.pax i.t.t.t.t.pax]
tay=[%& (slav %p i.t.t.t.pax) i.t.t.t.t.pax]
ra-abet:(~(ra-friend ra ost ~) man tay sih)
::
[%repeat *]
?> ?=([@ @ @ ~] t.pax)
=+ [num her man]=[(slav %ud i.t.pax) (slav %p i.t.t.pax) i.t.t.t.pax]
ra-abet:(~(ra-repeat ra ost ~) num [%& her man] sih)
==
::
++ pull
|= ost=bone
^- [(list move) _+>]
~& [%rodeo-pull `*`ost]
ra-abet:~(ra-cancel ra ost ~)
::
++ poke-bit
|= [ost=bone you=ship ~]
^- [(list move) _+>]
:_ +>.$
=+ paf=/(scot %p our.hid)/try/(scot %da lat.hid)/rodeo/backlog/jam
[ost %pass /jamfile %c %info our.hid (foal paf (jam +<+.+>.$))]~
::
++ prep
|= old=(unit (unit house-any))
^- [(list move) _+>]
?> ?=(^ old)
=| moz=(list move)
|-
?~ u.old
=+ paf=/(scot %p our.hid)/try/(scot %da lat.hid)/rodeo/backlog/jam
?. ?=([%0 %0 %0] [.^(%cy paf)])
$(u.old (some ((hard house-any) (cue ((hard ,@) .^(%cx paf))))))
~& %rodeo-prep-new
ra-abet:~(ra-init ra 0 moz)
~& %rodeo-prep-old
:- moz
|-
?- -.u.u.old
%1 %_(+>.^^$ +<+ u.u.old)
%0 $(u.u.old [%1 (house-0-to-house-1 +.u.u.old)])
==
::
++ house-0-to-house-1
|= vat=house-0
^- house-1
=- :* stories=-
general=~
outbox=[0 ~]
folks=~
==
^- (map span story)
=- %- ~(run by -)
|= grams=(list telegram)
^- story
:* count=(lent grams)
grams=grams
locals=~
remotes=~
sequence=~
shape=[.(cordon [%black ~])]:*config
^= known %- mo ^- (list ,[serial @]) =< +
(roll grams |=([telegram a=@ b=(list ,[serial @])] [+(a) [a p.q] b]))
guests=~
viewers=~
owners=~
==
^- (map span (list telegram))
%- mo %+ turn (~(tap by vat))
|= [a=path b=(list zong) c=(map ship ,?)]
=+ ^= par
?: =(/ a) 'hub'
=+ (turn a |=(d=span leaf/(trip d)))
(crip ~(ram re %rose ["_" ~ ~] -))
:- par
=+ aud=`audience`[[[%& our.hid par] *envelope %received] `~]
=+ ^= spe
|= r=_r:*zong ^- speech
?- -.r
%say [%lin %& p.r]
%do [%lin %| p.r]
%exp [%fat [%tank q.r ~] [%exp p.r]]
==
%+ turn b
|= d=zong ^- telegram
[q.d (sham eny.hid d) aud p.d ~ (spe r.d)]
--

View File

@ -4,7 +4,7 @@
::
/? 314
/- term-line, kyev
/= pit /~ !>(.) :: kernel vase
/= pit /~ !>(+) :: kernel vase
::
:::: structures
::
@ -83,7 +83,7 @@
[%vega p=path] ::
== == == ::
--
!:
::
:::: parsers
::
|%
@ -129,9 +129,9 @@
==
::
++ expg (rais ;~(pfix ace expr(tol %1)) ;~(pfix gap expr))
++ expr (rais [wide tall]:(vang & pax))
++ loca %+ sear ;~(biff plex:(vang & pax) vabe) :: path in %clay
[;~(pose rood ;~(simu cen scat))]:(vang & pax)
++ expr (rais [wide tall]:(vang | pax))
++ loca %+ sear ;~(biff plex:(vang | pax) vabe) :: path in %clay
[;~(pose rood ;~(simu cen scat))]:(vang | pax)
++ vabe |=(a=path ?~((tome a) ~ (some a))) :: check valid beam
++ args :: task arguments
%^ rail
@ -143,7 +143,7 @@
::
--
--
!:
::
:::: per event
::
|%
@ -239,12 +239,17 @@
|= [paf=path gen=(unit twig)]
^+ +>
=+ fel=(file paf)
?~ fel
(chew-file paf '! none')
?^ gen
?^ fel
?~ gen
(blab (stray (crip ": {(spud paf)} {<(,@t u.fel)>}")))
%+ with u.gen |= new=vase
(chew-file paf (foal paf q.new))
(blab (stray (crip ": {(spud paf)} {<(,@t u.fel)>}")))
=+ ark=;;(arch .^(%cy paf))
?- r.ark
~ (chew-file paf '! none')
[^ ~ ~] $(paf (welp paf /[p.n.r.ark]))
* (chew-file paf '! many')
==
::
++ eat-help
|= app=term
@ -503,7 +508,7 @@
!>([%rush %term-line `term-line`[pro(r a) ~ ~]])
--
--
!:
::
:::: formal interface
::
|_ [hid=hide vat=axle]

650
main/app/sole/core.hook Normal file
View File

@ -0,0 +1,650 @@
:: :: ::
:::: /hook/core/sole/app :: ::
:: :: ::
/? 314 :: zuse version
/- *sole :: console structures
/+ sole :: console library
:: :: ::
:::: :: ::
!: :: ::
=> |% :: data structures
++ house :: all state
$: bin=(map bone source) :: input devices
== ::
++ source :: input device
$: edg=_79 :: terminal columns
off=@ud :: window offset
kil=(unit (list ,@c)) :: kill buffer
apt=(list gill) :: application ring
maz=master :: master window
feg=(map gill target) :: live applications
mir=(pair ,@ud (list ,@c)) :: mirrored terminal
== ::
++ master :: master buffer
$: liv=? :: master is live
tar=target :: master target
== ::
++ history :: past input
$: pos=@ud :: input position
num=@ud :: number of entries
lay=(map ,@ud (list ,@c)) :: editing overlay
old=(list (list ,@c)) :: entries proper
== ::
++ search :: reverse-i-search
$: pos=@ud :: search position
str=(list ,@c) :: search string
== ::
++ target :: application target
$: ris=(unit search) :: reverse-i-search
hit=history :: all past input
pom=sole-prompt :: static prompt
inp=sole-command :: input state
== ::
++ ukase :: master command
$% [%add p=(list gill)] :: add agents
[%del p=(list gill)] :: delete agents
== ::
++ gift :: out result <-$
$% [%mean p=ares] ::
[%nice ~] ::
[%rush %dill-blit dill-blit] ::
== ::
++ sign-gall :: sign from %gall
$% [%mean p=ares] ::
[%nice ~] ::
[%rush %sole-effect sole-effect] ::
== ::
++ sign :: in result $<-
$% [%g sign-gall] ::
== ::
++ move ,[p=bone q=(mold note gift)] ::
++ note-gall :: note to %gall
$% [%mess p=[p=ship q=path] q=ship r=cage] ::
[%nuke p=[p=ship q=path] q=ship] ::
[%show p=[p=ship q=path] q=ship r=path] ::
[%took p=[p=ship q=path] q=ship] ::
== ::
++ note :: out request $->
$% [%g note-gall] ::
== ::
-- ::
|_ $: hid=hide :: system state
house :: program state
== ::
++ sp
|% ++ sp-ukase
%+ knee *ukase |. ~+
;~ pose
(stag %add ;~(pfix lus sp-gills))
(stag %del ;~(pfix hep sp-gills))
==
::
++ sp-gills
;~ pose
(most ;~(plug com ace) sp-gill)
%+ cook
|= a=ship
[[a %dojo] [a %talk] ~]
;~(pfix sig fed:ag)
==
::
++ sp-gill
;~ pose
(stag our.hid sym)
;~ plug
;~(pfix sig fed:ag)
;~(pfix fas sym)
==
==
--
++ se :: per source
|_ $: [moz=(list move) biz=(list dill-blit)]
[her=ship ost=bone]
source
==
++ se-abet :: resolve
:_ %_(+> bin (~(put by bin) ost +<+>))
%+ welp (flop moz)
^- (list move)
?~ biz ~
[ost %give %rush %dill-blit ?~(t.biz i.biz [%mor (flop biz)])]~
::
++ se-belt :: handle input
|= bet=dill-belt
^+ +>
?: ?=(%rez -.bet)
+>(edg (dec p.bet))
?: ?=(%yow -.bet)
(se-link p.bet)
=+ gyl=?^(apt i.apt [~zod %$])
=+ taz=~(. ta [& liv.maz gyl] ?:(liv.maz tar.maz (~(got by feg) gyl)))
=< ta-abet
?- -.bet
%aro (ta-aro:taz p.bet)
%bac ta-bac:taz
%cru (ta-cru:taz p.bet q.bet)
%ctl (ta-ctl:taz p.bet)
%del ta-del:taz
%met (ta-met:taz p.bet)
%ret ta-ret:taz
%txt (ta-txt:taz p.bet)
==
::
++ se-drop :: passive drop
|= gyl=gill
^+ +>
=< se-prom
?> (~(has by feg) gyl)
%_ +>
feg (~(del by feg) gyl)
apt (skip apt |=(a=gill =(gyl a)))
liv.maz ?~(apt & liv.maz)
==
::
++ se-join :: add connection
|= gyl=gill
^+ +>
=< se-prom
?: (~(has by feg) gyl)
(se-blit %bel ~)
+>(liv.maz |, apt [gyl apt], feg (~(put by feg) gyl *target))
::
++ se-nuke :: active drop
|= gyl=gill
^+ +>
(se-drop:(se-send(liv.maz |) gyl %nuke [p.gyl ~[q.gyl]] her) gyl)
::
++ se-like :: act in master
|= kus=ukase
?- -.kus
%add
|- ^+ +>.^$
?~ p.kus +>.^$
$(p.kus t.p.kus, +>.^$ (se-link i.p.kus))
::
%del
|- ^+ +>.^$
?~ p.kus +>.^$
$(p.kus t.p.kus, +>.^$ (se-nuke i.p.kus))
==
::
++ se-prom :: set master prompt
^+ .
%_ .
cad.pom.tar.maz
^- tape
%+ welp
(scow %p our.hid)
=+ ^= mux
|- ^- tape
?~ apt ~
=+ ^= mor ^- tape
?~ t.apt ~
[',' ' ' $(apt t.apt)]
%+ welp
^- tape
=+ txt=(trip q.i.apt)
?: =(our.hid p.i.apt)
txt
:(welp "~" (scow %p p.i.apt) "/" txt)
mor
?~ mux
"# "
:(welp ":" mux "# ")
==
::
++ se-link :: connect to app
|= gyl=gill
^+ +>
%. gyl
=< se-join
(se-send gyl %show [p.gyl ~[q.gyl]] her /sole)
::
++ se-blit :: give output
|= bil=dill-blit
+>(biz [bil biz])
::
++ se-show :: show buffer, raw
|= lin=(pair ,@ud (list ,@c))
^+ +>
?: =(mir lin) +>
=. +> ?:(=(q.mir q.lin) +> (se-blit %pro q.lin))
=. +> ?:(=(p.mir p.lin) +> (se-blit %hop p.lin))
+>(mir lin)
::
++ se-just :: adjusted buffer
|= lin=(pair ,@ud (list ,@c))
^+ +>
=. off ?:((lth p.lin edg) 0 (sub p.lin edg))
(se-show (sub p.lin off) (scag edg (slag off q.lin)))
::
++ se-view :: flush buffer
?: liv.maz
(se-just ~(ta-vew ta [& & ~zod %$] tar.maz))
?~ apt
se-view(liv.maz &)
%- se-just
~(ta-vew ta [& | i.apt] (~(got by feg) i.apt))
::
++ se-kill :: kill a source
=+ tup=apt
|- ^+ +>
?~ tup +>(apt ~)
$(tup +.tup, +> (se-nuke i.tup))
::
++ se-emit :: emit move
|= mov=move
%_(+> moz [mov moz])
::
++ se-send :: send a message
|= [gyl=gill nog=note-gall]
(se-emit ost %pass [(scot %p her) (scot %p p.gyl) q.gyl ~] %g nog)
::
++ se-tame
|= gyl=gill
^+ ta
~(. ta [& %| gyl] (~(got by feg) gyl))
::
++ se-pour :: receive results
|= [gyl=gill sil=sign-gall]
^+ +>
?- -.sil
%mean
+>.$
::
%nice
+>.$
::
%rush
ta-abet:ta-rap:(ta-fec:(se-tame gyl) +>.sil)
==
::
++ ta :: per target
|_ $: $: liv=? :: don't delete
mav=? :: showing master
gyl=gill :: target app
== ::
target :: target state
== ::
++ ta-abet :: resolve
^+ ..ta
=. liv.maz mav
?: mav
?. liv
(se-blit `dill-blit`[%qit ~])
+>(tar.maz +<+)
?. liv
=. ..ta (se-nuke gyl)
..ta(liv.maz =(~ apt))
%_(+> feg (~(put by feg) gyl +<+))
::
++ ta-ant :: toggle master
^+ .
?: mav
?~ apt ta-bel
%_ .
mav |
+<+ (~(got by feg) gyl)
tar.maz +<+
==
%_ .
mav &
+<+ tar.maz
feg (~(put by feg) gyl +<+)
==
::
++ ta-act :: send action
|= act=sole-action
^+ +>
?: mav
+>.$
%_ +>
+>
(se-send gyl %mess [p.gyl ~[q.gyl]] her %sole-action !>(act))
==
::
++ ta-aro :: hear arrow
|= key=?(%d %l %r %u)
^+ +>
?- key
%d =. ris ~
?. =(num.hit pos.hit)
(ta-mov +(pos.hit))
?: =(0 (lent buf.say.inp))
ta-bel
(ta-hom:ta-nex %set ~)
%l ?^ ris ta-bel
?: =(0 pos.inp) ta-bel
+>(pos.inp (dec pos.inp))
%r ?^ ris ta-bel
?: =((lent buf.say.inp) pos.inp)
ta-bel
+>(pos.inp +(pos.inp))
%u =. ris ~
?:(=(0 pos.hit) ta-bel (ta-mov (dec pos.hit)))
==
::
++ ta-bel .(+> (se-blit %bel ~)) :: beep
++ ta-cat :: mass insert
|= [pos=@ud txt=(list ,@c)]
^- sole-edit
:- %mor
|- ^- (list sole-edit)
?~ txt ~
[[%ins pos i.txt] $(pos +(pos), txt t.txt)]
::
++ ta-cut :: mass delete
|= [pos=@ud num=@ud]
^- sole-edit
:- %mor
|-(?:(=(0 num) ~ [[%del pos] $(num (dec num))]))
::
++ ta-det :: send edit
|= ted=sole-edit
^+ +>
(ta-act %det [[his.ven.say.inp own.ven.say.inp] (sham buf.say.inp) ted])
::
++ ta-bac :: hear backspace
^+ .
?^ ris
?: =(~ str.u.ris)
ta-bel
.(str.u.ris (scag (dec (lent str.u.ris)) str.u.ris))
?: =(0 pos.inp)
.(+> (se-blit %bel ~))
=+ pre=(dec pos.inp)
(ta-hom(pos.inp pre) %del pre)
::
++ ta-ctl :: hear control
|= key=@ud
^+ +>
?+ key ta-bel
%a +>(pos.inp 0)
%b (ta-aro %l)
%c ta-bel(ris ~)
%d ?: &(=(0 pos.inp) =(0 (lent buf.say.inp)))
+>(liv |)
ta-del
%e +>(pos.inp (lent buf.say.inp))
%f (ta-aro %r)
%g ta-bel(ris ~)
%k =+ len=(lent buf.say.inp)
?: =(pos.inp len)
ta-bel
%- ta-hom(kil `(slag pos.inp buf.say.inp))
(ta-cut pos.inp (sub len pos.inp))
%l +>(+> (se-blit %clr ~))
%n (ta-aro %d)
%p (ta-aro %u)
%r ?~ ris
+>(ris `[pos.hit ~])
?: =(0 pos.u.ris)
ta-bel
(ta-ser ~)
%t =+ len=(lent buf.say.inp)
?: |(=(0 pos.inp) (lth len 2))
ta-bel
=+ sop=?:(=(len pos.inp) (dec pos.inp) pos.inp)
=. pos.inp +(sop)
%- ta-hom
:~ %mor
[%del sop]
[%ins (dec sop) (snag sop buf.say.inp)]
==
%u ?: =(0 pos.inp)
ta-bel
%- ta-hom(pos.inp 0, kil `(scag pos.inp buf.say.inp))
(ta-cut 0 pos.inp)
%v ta-ant
%x ?: =(~ apt) ta-bel
?: mav ta-bel
+>(apt (welp (slag 1 apt) [(snag 0 apt) ~]))
%y ?~ kil ta-bel
%- ta-hom(pos.inp (add pos.inp (lent u.kil)))
(ta-cat pos.inp u.kil)
==
::
++ ta-cru :: hear crud
|= [lab=@tas tac=(list tank)]
=. +>+> (se-blit %out (tuba (trip lab)))
(ta-tan tac)
::
++ ta-del :: hear delete
^+ .
?: =((lent buf.say.inp) pos.inp)
.(+> (se-blit %bel ~))
(ta-hom %del pos.inp)
::
++ ta-erl :: hear local error
|= pos=@ud
ta-bel(pos.inp (min pos (lent buf.say.inp)))
::
++ ta-err :: hear remote error
|= pos=@ud
(ta-erl (~(transpose cs say.inp) pos))
::
++ ta-fec :: apply effect
|= fec=sole-effect
^+ +>
?- -.fec
%bel ta-bel
%blk +>
%clr +>(+> (se-blit fec))
%det (ta-got +.fec)
%err (ta-err +.fec)
%mor |- ^+ +>.^$
?~ p.fec +>.^$
$(p.fec t.p.fec, +>.^$ ^$(fec i.p.fec))
%nex ta-nex
%pro (ta-pro +.fec)
%tan (ta-tan p.fec)
%sag +>(+> (se-blit fec))
%sav +>(+> (se-blit fec))
%txt $(fec [%tan [%leaf p.fec]~])
==
::
++ ta-rap :: send %took
.(+> (se-send gyl %took [p.gyl ~[q.gyl]] her))
::
++ ta-dog :: change cursor
|= ted=sole-edit
%_ +>
pos.inp
=+ len=(lent buf.say.inp)
%+ min len
|- ^- @ud
?- -.ted
%del ?:((gth pos.inp p.ted) (dec pos.inp) pos.inp)
%ins ?:((lte pos.inp p.ted) +(pos.inp) pos.inp)
%mor |- ^- @ud
?~ p.ted pos.inp
$(p.ted t.p.ted, pos.inp ^$(ted i.p.ted))
%nop pos.inp
%set len
==
==
::
++ ta-got :: apply change
|= cal=sole-change
=^ ted say.inp (~(receive cs say.inp) cal)
(ta-dog ted)
::
++ ta-hom :: local edit
|= ted=sole-edit
^+ +>
=. +> (ta-det ted)
=. +> (ta-dog(say.inp (~(commit cs say.inp) ted)) ted)
+>
::
++ ta-met :: meta key
|= key=@ud
~& [%ta-met key]
+>
::
++ ta-mov :: move in history
|= sop=@ud
^+ +>
?: =(sop pos.hit) +>
%+ %= ta-hom
pos.hit sop
lay.hit %+ ~(put by lay.hit)
pos.hit
buf.say.inp
==
%set
%- (bond |.((snag (sub num.hit +(sop)) old.hit)))
(~(get by lay.hit) sop)
::
++ ta-nex :: advance history
%_ .
num.hit +(num.hit)
pos.hit +(num.hit)
ris ~
lay.hit ~
old.hit [buf.say.inp old.hit]
==
::
++ ta-pro :: set prompt
|= pom=sole-prompt
+>(pom pom(cad :(welp (scow %p p.gyl) ":" (trip q.gyl) cad.pom)))
::
++ ta-ret :: hear return
?. mav
(ta-act %ret ~)
=+ txt=(tufa buf.say.inp)
=+ fey=(rose txt sp-ukase:sp)
?- -.fey
%| (ta-erl (lent (tuba (scag p.fey txt))))
%& ?~ p.fey
(ta-erl (lent buf.say.inp))
=. +>+> (se-like u.p.fey)
=. pom pom.tar.maz
(ta-hom:ta-nex %set ~)
==
::
++ ta-ser :: reverse search
|= ext=(list ,@c)
^+ +>
?: |(?=(~ ris) =(0 pos.u.ris)) ta-bel
=+ tot=(weld str.u.ris ext)
=+ dol=(slag (sub num.hit pos.u.ris) old.hit)
=+ sop=pos.u.ris
=+ ^= ser
=+ ^= beg
|= [a=(list ,@c) b=(list ,@c)] ^- ?
?~(a & ?~(b | &(=(i.a i.b) $(a t.a, b t.b))))
|= [a=(list ,@c) b=(list ,@c)] ^- ?
?~(a & ?~(b | |((beg a b) $(b t.b))))
=+ ^= sup
|- ^- (unit ,@ud)
?~ dol ~
?: (ser tot i.dol)
`sop
$(sop (dec sop), dol t.dol)
?~ sup ta-bel
(ta-mov(str.u.ris tot, pos.u.ris (dec u.sup)) (dec u.sup))
::
++ ta-tan :: print tanks
|= tac=(list tank)
=+ wol=`wall`(zing (turn tac |=(a=tank (~(win re a) [0 edg]))))
|- ^+ +>.^$
?~ wol +>.^$
$(wol t.wol, +>+>.^$ (se-blit %out (tuba i.wol)))
::
++ ta-txt :: hear text
|= txt=(list ,@c)
^+ +>
?^ ris
(ta-ser txt)
%- ta-hom(pos.inp (add (lent txt) pos.inp))
:- %mor
|- ^- (list sole-edit)
?~ txt ~
[[%ins pos.inp i.txt] $(pos.inp +(pos.inp), txt t.txt)]
::
++ ta-vew :: computed prompt
|- ^- (pair ,@ud (list ,@c))
?^ ris
%= $
ris ~
cad.pom
:(welp "(reverse-i-search)'" (tufa str.u.ris) "': ")
==
=- [(add pos.inp (lent p.vew)) (weld (tuba p.vew) q.vew)]
^= vew ^- (pair tape (list ,@c))
?: vis.pom [cad.pom buf.say.inp]
:- ;: welp
cad.pom
?~ buf.say.inp ~
;: welp
"<"
(scow %p (end 4 1 (sham buf.say.inp)))
"> "
==
==
=+ len=(lent buf.say.inp)
|- ^- (list ,@c)
?:(=(0 len) ~ [`@c`'*' $(len (dec len))])
--
--
++ peer
|= [ost=bone her=ship pax=path]
^- [(list move) _+>]
:: ~& [%sole-peer ost her pax]
?< (~(has by bin) ost)
:- [ost %give %rush %dill-blit %pro [`@c`0x23 `@c`0x20 ~]]~
%= +>
bin
%+ ~(put by bin) ost
^- source
:* 80
0
~
~
:* %&
*(unit search)
*history
`sole-prompt`[%& %sole "{(scow %p our.hid)}# "]
*sole-command
==
~
[0 ~]
==
==
::
++ poke-dill-belt
|= [ost=bone her=ship bet=dill-belt]
^- [(list move) _+>]
:: ~& [%sole-poke ost her bet]
=+ yog=(~(get by bin) ost)
?~ yog
~& [%sole-poke-stale ost]
[~ +>.$]
=< se-abet
=< se-view
(~(se-belt se [[ost %give %nice ~]~ ~] [her ost] u.yog) bet)
::
++ pour
|= [ost=bone pax=path sih=*]
^- [(list move) _+>]
=+ yog=(~(get by bin) ost)
?~ yog
~& [%sole-pour-stale ost pax]
[~ +>.$]
=+ sih=((hard sign) sih)
?> ?=([@ @ @ ~] pax)
=< se-abet
=< se-view
=+ gyl=[(slav %p i.t.pax) i.t.t.pax]
(~(se-pour se [~ ~] [(slav %p i.pax) ost] u.yog) gyl +.sih)
::
++ pull
|= ost=bone
^- [(list move) _+>]
:: ~& [%sole-pull ost]
=^ moz +>
=< se-abet
=< se-view
~(se-kill se [~ ~] [our.hid ost] (~(got by bin) ost))
[moz +>.$(bin (~(del by bin) ost))]
--

View File

@ -1,53 +0,0 @@
!:
::::
::
|_ [hid=hide ~]
++ peer ,_`.
++ poke-solid-args
|= [ost=bone you=ship ~]
:_ +>.$
=+ top=`path`/(scot %p our.hid)/arvo/(scot %da lat.hid)
=+ pax=`path`(weld top `path`[%hoon ~])
~& %solid-start
=+ gen=(reck pax)
~& %solid-parsed
=+ ken=q:(~(mint ut %noun) %noun gen)
~& %solid-compiled
=+ ^= all
=+ all=.*(0 ken)
=+ ^= vay ^- (list ,[p=@tas q=@tas])
:~ [%$ %zuse]
[%g %gall]
[%f %ford]
[%a %ames]
[%c %clay]
[%d %dill]
[%e %eyre]
[%t %time]
==
|- ^+ all
?~ vay all
=+ pax=(weld top `path`[q.i.vay ~])
=+ txt=((hard ,@) .^(%cx (weld pax `path`[%hoon ~])))
=+ sam=[lat.hid `ovum`[[%gold ~] [%veer p.i.vay pax txt]]]
~& [%solid-veer i.vay]
=+ gat=.*(all .*(all [0 42]))
=+ nex=+:.*([-.gat [sam +>.gat]] -.gat)
$(vay t.vay, all nex)
:~ [ost %give %sage [%urbit %pill ~] [ken all]]
[ost %pass / %g %cide %$]
[ost %give %nice ~]
==
:: ~& %solid-jamming
:: =+ pac=(jam [ken all])
:: ~& %solid-finished
:: =+ nax=/(scot %p our.hid)/try/(scot %da lat.hid)/urbit/pill
:: :* [ost %pass /cp %c %info our.hid (foal nax pac)]
:: [ost %give %nice ~]
:: %+ turn (~(tap by sup.hid))
:: |= [ost=bone *]
:: :^ ost %give %rush
:: :- %tang :_ ~
:: leaf/"done"
:: ==
--

File diff suppressed because it is too large Load Diff

28
main/app/tease/core.hook Normal file
View File

@ -0,0 +1,28 @@
:: :: ::
:::: /hook/core/tease/app :: ::
:: :: ::
/? 314 :: zuse version
/- *console :: console structures
/+ console :: console library
!: :: ::
:::: :: ::
:: :: ::
|_ [hid=hide ~]
++ peer ,_`.
++ poke--args
|= [ost=bone you=ship ~]
~& %tease
:_ +>.$
:~ :* 0 %pass ~
%g %show
[our.hid /seat] our.hid
/
==
:* 0 %pass ~
%g %mess
[our.hid /seat] our.hid
%dill-belt
!>(`dill-belt`[%yow %helm])
==
==
--

View File

@ -13,7 +13,7 @@
;head
;title: Hi
;script: window.urb = window.urb || \{};
;script@"/gen/main/lib/urb.js";
;script@"/~/at/main/lib/urb.js";
;script@"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js";
;script@"//cdnjs.cloudflare.com/ajax/libs/mousetrap/1.4.6/mousetrap.js";
;script@"//use.typekit.net/fkv0sjk.js";

View File

@ -1,3 +1,8 @@
urb.appl = urb.appl ||
window.location.pathname.match(/.*?app\/([a-z0-9-]+)/)[1]
urb.term = urb.term ||
{pax: location.pathname.replace(new RegExp(".*?app/"+urb.appl),'') || '/'}
function jpok(a,b){
var dat = {pax:urb.term.pax, act:{}}
dat.act[a] = b

View File

@ -6,7 +6,7 @@
:::: /hook/core/test/app
::
/? 314 :: need urbit 314
/= front /:/%%/front:/hymn/ :: load front page
:: /= front /:/%%/front:/hymn/ :: load front page
::
:::: structures
::
@ -297,7 +297,7 @@
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
~& [%test-peer hid]
?~ pax [[ost %give %rust %hymn front]~ +>.$]
?~ pax !! ::[[ost %give %rust %hymn front]~ +>.$]
?: ?=(%tests -.pax)
[[ost %give %rust %json tests-json:et]~ +>.$]
:_ +>.$ :_ ~
@ -308,7 +308,7 @@
++ poke-json :: browser message
|= [ost=bone you=ship jon=json]
^- [(list move) _+>]
~& [%test-poke hid]
~& [%test-poke hid you]
=+ tes=((of [%test so] ~):jo jon)
?~ tes [[ost %give %mean ~ %strange-json ~]~ +>.$]
=+ tst=(~(get by tests) +.u.tes)

10
main/cat/hello/gate.hook Normal file
View File

@ -0,0 +1,10 @@
::
:::: /hook/gate/hello/cat
::
/? 314
::
::::
!:
|= [* [[txt=@tas ~] ~]]
:- %noun
(crip (weld "hello, " (flop (trip txt))))

Binary file not shown.

View File

@ -0,0 +1,12 @@
::
:::: /hook/gate/reload/helm/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[arg=(list term) ~]
==
:- %helm-reload
arg

12
main/cat/ticket/gate.hook Normal file
View File

@ -0,0 +1,12 @@
::
:::: /hook/gate/ticket/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[[her=@p ~] ~]
==
:- %noun
((hard ,@p) .^(/a/(scot %p p.bec)/tick/(scot %da now)/(scot %p her)))

View File

@ -0,0 +1,43 @@
::
:::: /hook/gate/begin/helm/gun
::
/? 314
/- *sole
::
::::
!:
=> |%
++ begs ,[his=@p tic=@p yen=@t ges=gens]
--
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
^- (sole-result (cask begs))
%+ sole-lo
[%& %helm-begin "your ship: ~"]
%+ sole-go fed:ag
|= his=@p
%+ sole-lo
[%& %helm-ticket "your ticket: ~"]
%+ sole-go fed:ag
|= tic=@p
%+ sole-lo
[%& %helm-entropy "some entropy: "]
%+ sole-go (boss 256 (more gon qit))
|= yen=@t
%+ sole-so %helm-begin
:* his
tic
yen
::
^- gens
:- %en
=+ can=(clan his)
?- can
%czar [%czar ~]
%duke [%duke %anon ~]
%earl [%earl (scot %p his)]
%king [%king ?:(=(~doznec his) 'Urban Republic' (scot %p his))]
%pawn [%pawn ~]
==
==

View File

@ -0,0 +1,12 @@
::
:::: /hook/gate/reload/helm/gun
::
/? 314
/- *sole
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[arg=(list term) ~]
==
(sole-so %helm-reload arg)

View File

@ -0,0 +1,12 @@
::
:::: /hook/gate/reset/helm/gun
::
/? 314
/- *console
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
(console-so %helm-reset ~)

View File

@ -0,0 +1,13 @@
::
:::: /hook/gate/verb/helm/gun
::
/? 314
/- *sole
::
::::
!:
|= $: [now=@da eny=@ bec=beak]
[~ ~]
==
~& %helm-verb
(sole-so %helm-verb ~)

40
main/dog/solid/gate.hook Normal file
View File

@ -0,0 +1,40 @@
::
:::: /hook/gate/solid/gun
::
/? 314
/- *sole
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
%+ sole-so %noun
=+ top=`path`/(scot %p p.bec)/arvo/(scot %da now)
=+ pax=`path`(weld top `path`[%hoon ~])
~& %solid-start
=+ gen=(reck pax)
~& %solid-parsed
=+ ken=q:(~(mint ut %noun) %noun gen)
~& %solid-compiled
:- ken
=+ all=.*(0 ken)
=+ ^= vay ^- (list ,[p=@tas q=@tas])
:~ [%$ %zuse]
[%g %gall]
[%f %ford]
[%a %ames]
[%c %clay]
[%d %dill]
[%e %eyre]
[%t %time]
==
|- ^+ all
?~ vay all
=+ pax=(weld top `path`[q.i.vay ~])
=+ txt=((hard ,@) .^(%cx (weld pax `path`[%hoon ~])))
=+ sam=[now `ovum`[[%gold ~] [%veer p.i.vay pax txt]]]
~& [%solid-veer i.vay]
=+ gat=.*(all .*(all [0 42]))
=+ nex=+:.*([-.gat [sam +>.gat]] -.gat)
$(vay t.vay, all nex)

View File

@ -28,9 +28,7 @@
::
++ add-subs :: add gall subscription
|* [hat=[hapt ship path] ref=_,[(list) ^]]
=+ `[hapt ship path]`hat :: typecheck
%+ add-resp [%pass /show %g %show hat]
ref
(add-resp [%pass /show %g %show hat] ref)
::
++ args-into-gate :: poke--args from gate: output and exit
|* [con=[* [hide *] *] gat=_,[@ *]]

3
main/lib/shu/core.hook Normal file
View File

@ -0,0 +1,3 @@
:: Alias
/+ sh-utils
.

142
main/lib/sole/core.hook Normal file
View File

@ -0,0 +1,142 @@
::
:::: /hook/core/sole/lib
::
:: This file is in the public domain.
::
/? 310
/- *sole
!:
::::
::
|%
++ cs :: shared-state engine
|_ sole-share
++ abet +<
++ apply
|= ted=sole-edit
^+ +>
?- -.ted
%del +>.$(buf (weld (scag p.ted buf) (slag +(p.ted) buf)))
%ins +>.$(buf (weld (scag p.ted buf) `_buf`[q.ted (slag p.ted buf)]))
%mor |- ^+ +>.^$
?~ p.ted
+>.^$
$(p.ted t.p.ted, +>.^$ ^$(ted i.p.ted))
%nop +>.$
%set +>.$(buf p.ted)
==
::
::::
:: ++transmute: symmetric operational transformation.
::
:: for any sole state +>, obeys
::
:: =+ [x=(transmute a b) y=(transmute b a)]
:: .= (apply:(apply b) x)
:: (apply:(apply a) y)
::
++ transmute :: dex as after sin
|= [sin=sole-edit dex=sole-edit]
^- sole-edit
?: ?=(%mor -.sin)
|- ^- sole-edit
?~ p.sin dex
$(p.sin t.p.sin, dex ^$(sin i.p.sin))
::
?: ?=(%mor -.dex)
:- %mor
|- ^- (list sole-edit)
?~ p.dex ~
[^$(dex i.p.dex) $(p.dex t.p.dex)]
::
?: |(?=(%nop -.sin) ?=(%nop -.dex)) dex
?: ?=(%set -.sin) [%nop ~]
?: ?=(%set -.dex) dex
::
?- -.sin
%del
?- -.dex
%del ?: =(p.sin p.dex) [%nop ~]
?:((lth p.sin p.dex) dex(p (dec p.dex)) dex)
%ins ?:((lte p.sin p.dex) dex(p (dec p.dex)) dex)
==
::
%ins
?- -.dex
%del ?:((lte p.sin p.dex) dex(p +(p.dex)) dex)
%ins ?: =(p.sin p.dex)
?:((gth q.sin q.dex) dex dex(p +(p.dex)))
?:((lte p.sin p.dex) dex(p +(p.dex)) dex)
==
==
::
++ commit :: local change
|= ted=sole-edit
^- sole-share
abet:(apply(own.ven +(own.ven), leg [ted leg]) ted)
::
::::
:: ++inverse: inverse of change in context.
::
:: for any sole state +>, obeys
::
:: =(+> (apply:(apply a) (inverse a)))
::
++ inverse :: relative inverse
|= ted=sole-edit
^- sole-edit
=. ted ?.(?=([%mor * ~] ted) ted i.p.ted)
?- -.ted
%del [%ins p.ted (snag p.ted buf)]
%ins [%del p.ted]
%mor :- %mor
%- flop
|- ^- (list sole-edit)
?~ p.ted ~
:- ^$(ted i.p.ted)
$(p.ted t.p.ted, +>.^$ (apply i.p.ted))
%nop [%nop ~]
%set [%set buf]
==
::
++ receive :: naturalize event
|= sole-change
^- [sole-edit sole-share]
?> &(=(his.ler his.ven) (lte own.ler own.ven))
?> &(=(his.ler his.ven) (lte own.ler own.ven))
?> |(!=(own.ler own.ven) =(haw (sham buf)))
=. leg (scag (sub own.ven own.ler) leg)
:: ~? !=(own.ler own.ven) [%miss-leg leg]
=+ dat=(transmute [%mor leg] ted)
:: ~? !=(~ leg) [%transmute from/ted to/dat ~]
[dat abet:(apply(his.ven +(his.ven)) dat)]
::
++ remit :: conditional accept
|= [cal=sole-change ask=$+((list ,@c) ?)]
^- [(unit sole-change) sole-share]
=+ old=buf
=^ dat +>+<.$ (receive cal)
?: (ask buf)
[~ +>+<.$]
=^ lic +>+<.$ (transmit (inverse(buf old) dat))
[`lic +>+<.$]
::
++ transmit :: outgoing change
|= ted=sole-edit
^- [sole-change sole-share]
[[[his.ven own.ven] (sham buf) ted] (commit ted)]
::
++ transceive :: receive and invert
|= sole-change
^- [sole-edit sole-share]
=+ old=buf
=^ dat +>+<.$ (receive +<.$)
[(inverse(buf old) dat) +>+<.$]
::
++ transpose :: adjust position
|= pos=@ud
=+ dat=(transmute [%mor leg] [%ins pos `@c`0])
?> ?=(%ins -.dat)
p.dat
--
--

View File

@ -1,10 +1,10 @@
::
:::: /hook/core/rodeo/lib
:::: /hook/core/talk/lib
::
:: This file is in the public domain.
::
/? 314
/- *rodeo
/- *talk
::
::::
::

View File

@ -1,90 +1,257 @@
window.urb.seqn_u = 1
window.urb.dely = 0
window.urb.puls = false
window.urb.cabs = {}
if(!window.urb.appl) window.urb.appl = null
window.urb.req = function(method,url,params,json,cb) {
var xhr = new XMLHttpRequest()
method = method.toUpperCase()
if(method == "PUT" || method == "DELETE")
xhr.open("POST", url+"?"+method)
else xhr.open(method, url)
if(json)
xhr.setRequestHeader("content-type", "text/json")
if(!window.urb.oryx) throw "No CSRF token" // XX fetch auth.json
_data = {oryx: window.urb.oryx}
if(params.xyro) { _data.xyro = params.xyro; }
if(params.ship) { _data.ship = params.ship; }
if(params.path) { _data.path = params.path; }
if(params.appl) { _data.appl = params.appl; }
if(params.mark) { _data.mark = params.mark; }
if(params.wire) { _data.wire = params.wire; }
if(cb) {
xhr.onload = function() {
try {
err = null
res = {
status:this.status,
data: JSON.parse(this.responseText)
}
if(res.data.reload)
res.reload = res.data.reload
} catch(e) {
if(urb.wall || true) document.write(this.responseText) // XX
err = {
message:"Failed to parse JSON",
raw:this.responseText
}
res = null
}
cb(err,res)
}
xhr.onerror = function() {
cb({
status:this.status,
data:this.responseText
})
}
}
xhr.send(JSON.stringify(_data))
}
window.urb.reqq = []
window.urb.qreq = function(method,url,params,json,cb) {
walk = function() {
qobj = {}
qobj.oargs = window.urb.reqq[0]
qobj.nargs = [].slice.apply(qobj.oargs,[0,4])
qobj.nargs.push(function(){
if(this.oargs[4])
this.oargs[4].apply(window.urb,arguments)
window.urb.reqq.shift()
if(window.urb.reqq.length > 0)
walk()
}.bind(qobj))
window.urb.req.apply(this,qobj.nargs)
}
l = window.urb.reqq.length
window.urb.reqq.push(arguments);
if(l == 0) { walk() }
}
window.urb.gsig = function(params) {
var path = params.path
if(!path) path = ""
if(path[0] !== "/") path = "/"+path
return "~"+params.ship+"/"+
params.appl+
path.replace(/[^\x00-\x7F]/g, "")
}
window.urb.poll = function(params) {
if(!params) throw new Error("You must supply params to urb.poll.")
var url, $this
seqn = this.seqn_u
if(params.seqn) seqn = params.seqn()
url = "/~/of/"+this.ixor+"?poll="+seqn
this.puls = true
$this = this
this.req("get",url,params,true,function(err,res) {
if(res){
if(res.data.beat)
return $this.poll(params)
switch(res.data.type){
case "news":
return document.location.reload() // XX check autoreload
case "rush":
case "mean":
if(res.data.type == "mean")
err = res.data.data
var fn = $this.gsig(res.data.from)
if($this.cabs[fn])
$this.cabs[fn].call(this,err,
{status: res.status, data: res.data.data.json}) // XX non-json
break;
default:
throw new Error("Lost event %"+res.data.type)
}
}
dely = params.dely ? params.dely : $this.dely
if(err)
dely = dely+Math.ceil(dely*.02)
else {
$this.dely = 0
if(params.incs)
params.incs()
else
$this.seqn_u++
}
setTimeout(function() {
$this.poll(params)
},dely)
})
}
// if (window.urb.auto) { // need dependencies
// var tries = 0
// var cnt = 0
// var param = {
// type:"pol"
// }
// window.urb.poll(param)
// }
// window.urb.heartbeat = function() {
// this.poll({
// type:"heb",
// ship:this.ship,
// dely:30000,
// seqn:function() {
// return window.urb.seqn_h
// },
// incs:function() {
// window.urb.seqn_h = window.urb.seqn_h+1
// }
// },function() {
// console.log('heartbeat.')
// })
// }
// window.urb.heartbeat()
// // / // / // //
// end old %eyre code //
// // / // / // //
window.urb.seqn_s = 0
window.urb.send = function(params,cb) {
// TODO urb.send(data, [params/params.appl]?, cb?)
window.urb.send = function(params,cb) {
if(!params)
throw new Error("You must supply params to urb.send.")
if(!params.appl) {
if(!urb.appl)
throw new Error("You must specify an appl for urb.send.")
params.appl = urb.appl
if(!params.appl && !this.appl){
throw new Error("You must specify an appl for urb.send.")
}
if(!params.data) { params.data = {}; }
var method, perm, url, $this
type = params.type ? params.type : "mes"
perm = this.perms[type]
var url, $this
params.ship = params.ship ? params.ship : this.ship
params.appl = params.appl ? params.appl : this.appl
params.mark = params.mark ? params.mark : "json"
params.xyro = params.data ? params.data : {}
params.wire = params.wire ? params.wire : "/"
method = "put"
url = [perm,this.user,this.port,this.seqn_s]
url = "/"+url.join("/")
url = ["to",params.appl,params.mark]
url = "/~/"+url.join("/")
this.seqn_s++
$this = this
this.qreq(method,url,params,true,function(err,data) {
this.qreq('post',url,params,true,function(err,data) {
if(err) { $this.seqn_s--; }
if(cb) { cb.apply(this,arguments); }
})
}
window.urb.subscribe = function(params,cb) {
if(!cb)
throw new Error("You must supply a callback to urb.subscribe.")
if(!params)
throw new Error("You must supply params to urb.subscribe.")
if(!params.appl) {
if(!urb.appl)
throw new Error("You must specify an appl for urb.subscribe.")
params.appl = urb.appl
}
if(!params.path)
throw new Error("You must specify a path for urb.subscribe.")
window.urb.subscribe = function(params,cb) { // legacy interface
if(!params) throw new Error("You must supply params to urb.subscribe")
return window.urb.bind(params.path, params, cb, cb)
}
window.urb.bind = function(path, cb){ // or bind(path, params, cb, nicecb?)
var params, nicecb
if(arguments.length > 2)
{params = cb; cb = arguments[2], nicecb = arguments[3]}
else params = {}
params.path = path
if(params.path[0] !== "/") params.path = "/"+params.path
params.ship = params.ship ? params.ship : this.ship
params.appl = params.appl ? params.appl : this.appl
params.mark = params.mark ? params.mark : "json"
params.wire = params.wire ? params.wire : params.path
if(typeof path != "string")
throw new Error("You must specify a string path for urb.bind.")
if(!params.appl) throw new Error("You must specify an appl for urb.bind.")
if(!cb) throw new Error("You must supply a callback to urb.bind.")
var method, perm, url, $this
params.type = "sub"
if(params.mark !== "json")
throw new Error("Non-json subscriptions unimplemented.") // XX
url = "/~/is/"+this.gsig(params)+"."+params.mark
params.path = params.wire
this.cabs[this.gsig(params)] = cb
url = [this.perms["sub"],this.user,this.port]
url = "/"+url.join("/")
method = "put"
$this = this
this.qreq(method,url,params,true,function(err,data) {
if(cb) { cb.apply(this,[err,{status: data.status, data: data.data}])}
if(!err && $this.puls == 0) {
params.type = "pol"
$this.poll(params)
}
this.qreq("put",url,params,true,function(err,res) {
if(nicecb) { nicecb.apply(this,[err,{status: res.status, data: res.data}])}
// XX give raw data
//
if(!err && !$this.puls) $this.poll(params)
})
}
window.urb.unsubscribe = function(params,cb) {
if(!params)
throw new Error("You must supply params to urb.unsubscribe.")
if(!params.appl) {
if(!urb.appl)
throw new Error("You must specify an appl for urb.unsubscribe.")
params.appl = urb.appl
}
if(!params.path)
throw new Error("You must specify a path for urb.unsubscribe.")
if(!params) throw new Error("You must supply params to urb.unsubscribe.")
params.ship = params.ship ? params.ship : this.ship
params.appl = params.appl ? params.appl : this.appl
params.wire = params.wire ? params.wire : params.path
method = "put"
type = "uns"
url = [this.perms[type],this.user,this.port]
url = "/"+url.join("/")
if(!params.path) throw new Error("You must specify a path for urb.unsubscribe.")
if(!params.appl) throw new Error("You must specify an appl for urb.unsubscribe.")
if(!cb) throw new Error("You must supply a callback to urb.unsubscribe.")
var $this = this
this.req(method,url,params,true,function(err,data) {
cb(err,data)
url = "/~/is/"+this.gsig(params)+"/"
method = "delete"
this.req("delete",url,params,true,function(err,res) {
cb(err,res)
})
}

View File

@ -0,0 +1,13 @@
::
:::: /hook/door/console-action/mar
::
/? 314
/- *console
!:
|_ cod=console-action
::
++ grab :: convert from
|%
++ noun console-action :: clam from %noun
--
--

View File

@ -0,0 +1,14 @@
::
:::: /hook/door/console-effect/mar
::
/? 310
/- *console
!:
|_ cod=console-effect
::
++ grab :: convert from
|%
++ noun console-effect :: clam from %noun
--
--

View File

@ -9,6 +9,7 @@
++ html (crip (poxo own)) :: convert to %html
++ mime [/text/html (taco html)] :: convert to %mime
--
++ garb [%urb ~]
++ grab |% :: convert from
++ noun manx :: clam from %noun
-- --

View File

@ -9,10 +9,12 @@
::
++ grow :: convert to
|%
++ mime :: convert to %mime
[/text/json (taco (crip (pojo jon)))]
++ mime [/text/json (taco txt)] :: convert to %mime
++ txt (crip (pojo jon))
--
++ grab |% :: convert from
++ noun json :: clam from %noun
++ numb jone
++ time jode
-- --

View File

@ -4,4 +4,8 @@
/? 314
|_ mud=@t
++ garb [%down ~]
++ grow
|%
++ mime [text//x-markdown (taco mud)]
--
--

View File

@ -1,74 +0,0 @@
::
:::: /hook/door/radio-command/mar
::
/? 314
/- *radio
!:
|_ cod=command
::
++ grab :: convert from
|%
++ noun command :: clam from %noun
++ json
=> [jo ..command]
|= a=json ^- command
=- (need ((of -) a))
=< :~ publish/(ar thot)
review/(ar thot)
design/(ot party/so config/(mu conf) ~)
ping/auri
==
|%
++ as :: array as set
:: |*(a=fist (cu sa (ar a))) :: XX types
|* a=fist
%- cu :_ (ar a)
~(gas in *(set ,_(need *a)))
::
++ lake |*(a=_,* $+(json (unit a)))
++ peach
|* a=_[rule rule]
|= tub=nail
^- (like (each ,_(wonk (-.a)) ,_(wonk (+.a))))
%. tub
;~(pose (stag %& -.a) (stag %| +.a))
::
++ thot
^- $+(json (unit thought))
%- ot :~
serial/(ci (slat %uv) so)
audience/audi
statement/stam
==
::
++ audi (op stati (ci (soft delivery) so)) :: audience
++ auri (op stati (ci (soft presence) so))
::
++ stati
^- $+(nail (like station))
%+ peach
;~((glue fas) ;~(pfix sig fed:ag) urs:ab)
%+ sear (soft partner)
;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15}
::
++ stam
^- $+(json (unit statement))
=- (ot now/di speech/(of -) ~)
:~ own/so
say/so
exp/(cu |=(a=cord [a ~]) so)
inv/(ot ship/(su fed:ag) party/(su urs:ab) ~)
==
::
::
++ conf
^- $+(json (unit config))
%- ot :~
sources/(as (su stati))
:- %cordon
%+ cu |*(a=^ ?~(-.a a a)) :: XX do type stuff
(ot white/bu list/(as (su fed:ag)) ~)
==
--
-- --

View File

@ -1,92 +0,0 @@
::
:::: /hook/door/radio-report/mar
::
/? 314
/- *radio
!:
|_ rep=report
::
++ grab :: convert from
|%
++ noun report :: clam from %noun
--
++ grow
|%
++ mime [/text/json (taco (crip (pojo json)))]
++ json
=> +
|^ %+ joba -.rep
?- -.rep
%config ~! rep (conf +.rep)
%house [%a (turn (~(tap by +.rep)) joce)]
%grams (jobe num/(jone p.rep) tele/[%a (turn q.rep gram)] ~)
::%group (grop +.rep)
%group (jobe local/(grop p.rep) global/%.(q.rep (jome stan grop)) ~)
==
++ joce |=(a=span [%s a])
++ jope |=(a=ship (jape +:<a>)) ::[%s (crip +:(scow %p a))])
++ joke |=(a=tank [%s (role (turn (wash 0^80 a) crip))])
++ jode |=(a=time (jone (div (mul (sub a ~1970.1.1) 1.000) ~s1)))
:: ++ jase
:: |* a=,json
:: |= b=(set ,_+<.a) ^- json
:: ~! b
:: [%a (turn (~(tap in b)) a)]
::
++ jome :: stringify keys
|* [a=_cord b=_json]
|= c=(map ,_+<.a ,_+<.b)
(jobe (turn (~(tap by c)) (both a b)))
::
++ both :: cons two gates
|* [a=_,* b=_,*]
|=(c=_[+<.a +<.b] [(a -.c) (b +.c)])
::
::
++ grop (jome phon stas) :: (map ship status)
++ phon |=(a=ship (scot %p a))
++ stas |=(status (jobe presence/(joce p) human/(huma q) ~))
++ gram |=(telegram (jobe ship/(jope p) thought/(thot q) ~))
++ thot
|= thought
(jobe serial/(jape <p>) audience/(audi q) statement/(stam r) ~)
::
++ audi (jome stan joce)
++ stan
|= a=station ^- cord
%- crip
?~ -.a "{<p.p.a>}/{(trip q.p.a)}"
?- -.p.a
%twitter "{(trip -.p.a)}/{(trip p.p.a)}"
==
::
++ stam |=(statement (jobe time/(jode p) speech/(spec q) ~))
++ spec
|= a=speech
%+ joba -.a
?- -.a
?(%own %say) [%s p.a]
%exp (jobe code/[%s p.a] done/?~(q.a ~ (joke u.q.a)) ~)
%inv (jobe ship/(jope p.a) party/[%s q.a] ~)
==
::
++ huma
|= human
%^ jobe
hand/?~(hand ~ [%s u.hand])
:- %true
?~ true ~
=+ u.true
(jobe first/[%s p] middle/?~(q ~ [%s u.q]) last/[%s r] ~)
~
::
++ conf
|= config
%- jobe :~
sources/[%a (turn (~(tap in sources)) |=(a=station [%s (stan a)]))]
=- cordon/(jobe white/[%b -.cordon] list/[%a -] ~)
(turn (~(tap in p.cordon)) jope) :: XX jase
==
--
-- --

View File

@ -53,8 +53,8 @@
")"
==
++ react-snip-js (crip tape)
++ js react-snip-js :: convert to %js
++ mime [/text/javascript (taco js)] :: convert to %mime
:: ++ js react-snip-js :: convert to %js
++ mime [/text/javascript (taco react-snip-js)] :: convert to %mime
--
++ grab |% :: convert from
++ noun manx :: clam from %noun

View File

@ -53,8 +53,8 @@
")"
==
++ react-js (crip tape)
++ js react-js :: convert to %js
++ mime [/text/javascript (taco js)] :: convert to %mime
:: ++ js react-js :: convert to %js
++ mime [/text/javascript (taco react-js)] :: convert to %mime
--
++ grab |% :: convert from
++ noun manx :: clam from %noun

View File

@ -50,10 +50,14 @@
::
++ grow :: convert to
|%
++ psal own
++ hymn ;html:(head:title:"snip" body:"+{psal}") :: convert to %hymn
++ html (crip (poxo hymn)) :: convert to %html
++ mime [/text/html (taco html)] :: convert to %mime
++ mime
=< mime
|%
++ psal own
++ hymn ;html:(head:title:"snip" body:"+{psal}") :: convert to %hymn
++ html (crip (poxo hymn)) :: convert to %html
++ mime [/text/html (taco html)] :: convert to %mime
--
--
++ garb [%react-snip ~]
++ grab |% :: convert from

View File

@ -1,8 +1,8 @@
::
:::: /hook/door/rodeo-command/mar
:::: /hook/door/talk-command/mar
::
/? 314
/- *rodeo
/- *talk
!:
|_ cod=command
::

View File

@ -1,8 +1,8 @@
::
:::: /hook/door/rodeo-report/mar
:::: /hook/door/talk-report/mar
::
/? 314
/- *rodeo
/- *talk
!:
|_ rep=report
::
@ -17,7 +17,7 @@
=> +
|^ %+ joba -.rep
?- -.rep
%config ~! rep (conf +.rep)
%cabal (cabl +.rep)
%house a/(turn (~(tap by +.rep)) jose)
%grams (jobe num/(jone p.rep) tele/[%a (turn q.rep gram)] ~)
%group (jobe local/(grop p.rep) global/%.(q.rep (jome parn grop)) ~)
@ -67,12 +67,18 @@
::
++ parn
|= a=partner ^- cord
%- crip
?~ -.a "{<p.p.a>}/{(trip q.p.a)}"
?- -.p.a
%twitter "{(trip -.p.a)}/{(trip p.p.a)}"
?- -.a
%& (stat p.a)
%| %- crip
?- -.p.a
%twitter "{(trip -.p.a)}/{(trip p.p.a)}"
==
==
::
++ stat
|= a=station ^- cord
(crip "{<p.a>}/{(trip q.a)}")
::
++ stam
|= statement
(jobe date/(jode p) bouquet/(bouq q) speech/(spec r) ~)
@ -96,6 +102,13 @@
(jobe first/[%s p] middle/?~(q ~ [%s u.q]) last/[%s r] ~)
~
::
++ cabl
|= cabal
%- jobe :~
loc/(conf loc)
ham/((jome stat conf) ham)
==
::
++ conf
|= config
%- jobe :~

View File

@ -1,9 +1,17 @@
::
:::: /hoon/core/zing/mar
:::: /hoon/core/psal/mar
::
/? 314
!:
|_ tan=(list tank)
::
++ grow
|%
++ psal
=- ;pre:code:"{(trip (role (turn - crip)))}" :: XX
^- wall %- zing ^- (list wall)
(turn tan |=(a=tank (wash 0^160 a)))
--
++ grab :: convert from
|%
++ noun (list tank) :: clam from %noun

View File

@ -12,5 +12,6 @@
++ grow
|%
++ psal ;div: {(trip txt)}
++ mime [text//plain (taco txt)]
--
--

31
main/mar/urb/door.hook Normal file
View File

@ -0,0 +1,31 @@
::
:::: /hook/door/urb/mar
::
/? 314
/= dep /$ |=([^ but=path] `@uvH`?>(?=([%dep @ ~] but) (slav %uv i.t.but)))
!:
|_ own=manx
::
++ grow :: convert to
|%
++ html (crip (poxo own)) :: convert to %html
++ mime [/text/html (taco html)] :: convert to %mime
--
++ grab
|% :: convert from
++ noun manx :: clam from %noun
++ hymn :: inject into %hymn
|= old=manx
~| hymn//mal-formed
:: ~| old
?> ?=([[%html ~] [[%head ~] *] [[%body ~] ^] ~] old) :: XX static
:: =+ bek=(sa (turn (turn dep) |=(a=beam (tope a(s ~)))))
%_ old
c.i.c
:- ;meta(charset "utf-8", urb_injected "");
?~ dep c.i.c.old
:- ;script@"/~/on/{<dep>}.js";
c.i.c.old
==
--
--

View File

@ -14,13 +14,13 @@
;script:'''
try{Typekit.load();}catch(e){}
'''
;link(type "text/css", rel "stylesheet", href "/gen/main/pub/radio/src/main.css");
;link(type "text/css", rel "stylesheet", href "/main/pub/radio/src/main.css");
;script(type "text/javascript", src "/gop/hart.js");
;title: Radio
==
;body
;div#c;
;script(type "text/javascript", src "/gen/main/lib/urb.js");
;script(type "text/javascript", src "/gen/main/pub/radio/src/main.js");
;script(type "text/javascript", src "/main/lib/urb.js");
;script(type "text/javascript", src "/main/pub/radio/src/main.js");
==
==

View File

@ -5,7 +5,7 @@
;script(type "text/javascript", src "/gep/hart.js");
==
;body
;script(type "text/javascript", src "/gen/main/lib/urb.js");
;script(type "text/javascript", src "/gen/main/pub/src/radio/main.js");
;script(type "text/javascript", src "/main/lib/urb.js");
;script(type "text/javascript", src "/main/pub/src/radio/main.js");
==
==

View File

@ -2,22 +2,34 @@
::
:::: /hook/hymn/fab/chat/pub/
::
|%
++ cdnj
|= a=wall ^- marl
%+ turn a
|= lib=tape
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/{lib}");
--
::
::::
::
^- manx
;html
;head
;meta(charset "utf-8");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/react/0.12.1/react.js");
;script(type "text/javascript", src "/gen/main/pub/talk/src/js/dep/director.js");
;meta(name "viewport", content "width=432, initial-scale=1");
;link(type "text/css", rel "stylesheet", href "/gen/main/pub/talk/src/css/main.css");
;script(type "text/javascript", src "/gop/hart.js");
;* %- cdnj :~
"jquery/2.1.1/jquery.js"
"lodash.js/2.4.1/lodash.min.js"
"react/0.13.1/react.js"
==
:: remove /~~ for anon
;script(type "text/javascript", src "/~~/~/at/main/lib/urb.js");
;meta(name "viewport", content "width=device-width, height=device-height, ".
"initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0");
;link(type "text/css", rel "stylesheet", href "/main/pub/talk/src/css/main.css");
;title: Radio
==
;body
;div#c;
;script(type "text/javascript", src "/gen/main/lib/urb.js");
;script(type "text/javascript", src "/gen/main/pub/talk/src/js/main.js");
;script(type "text/javascript", src "/main/pub/talk/src/js/main.js");
==
==

View File

@ -69,4 +69,16 @@
src: url("http://storage.googleapis.com/urbit-extra/scp-medium.woff");
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: "scp";
src: url("http://storage.googleapis.com/urbit-extra/scp-bold.woff");
font-weight: 600;
font-style: normal;
}
@font-face {
font-family: "scp";
src: url("http://storage.googleapis.com/urbit-extra/scp-black.woff");
font-weight: 700;
font-style: normal;
}

View File

@ -70,10 +70,25 @@
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: "scp";
src: url("http://storage.googleapis.com/urbit-extra/scp-bold.woff");
font-weight: 600;
font-style: normal;
}
@font-face {
font-family: "scp";
src: url("http://storage.googleapis.com/urbit-extra/scp-black.woff");
font-weight: 700;
font-style: normal;
}
.iden,
.audi,
.time,
#length {
#length,
#where,
#who,
.station {
font-family: "scp";
}
.join-ctrl input {
@ -92,14 +107,22 @@ body {
.time {
font-size: 0.6rem;
letter-spacing: 0;
}
.time {
font-weight: 200;
}
#length {
font-weight: 500;
}
input.join,
.iden,
.audi,
#station {
font-size: 0.7rem;
}
.iden {
font-weight: 600;
}
html,
body {
font-size: 18px;
@ -113,124 +136,148 @@ body {
display: none;
}
#c {
top: 0;
background-color: #fff;
}
#stations-container {
position: absolute;
top: 1rem;
top: 0rem;
left: 50%;
width: 24rem;
margin-left: -12rem;
font-size: 4rem;
width: 58rem;
margin-left: -29rem;
margin-bottom: 12rem;
}
#station-container {
position: fixed;
top: 0;
left: 50%;
width: 28rem;
max-height: 2.6rem;
width: 58rem;
max-height: 2.7rem;
background-color: #fff;
border-bottom: 0.3rem solid #000;
padding-bottom: 1rem;
overflow: hidden;
margin-left: -14rem;
z-index: 10;
-webkit-transition: max-height 0.2s;
}
#station #station-container {
padding-top: 1rem;
background-color: #f5f5f5;
border-bottom: 3px solid #ededed;
transition: max-height 0.15s ease-out;
min-width: 30rem;
text-align: right;
}
#station-container:hover {
max-height: 12rem;
transition: max-height 0.25s ease-in;
}
#stations-container,
#messages-container {
vertical-align: top;
}
#messaging-container {
position: absolute;
top: 4rem;
left: 50%;
width: 24rem;
margin-left: -12rem;
margin-bottom: 4rem;
}
#station > div {
display: inline-block;
}
#station-meta {
margin-right: 1rem;
#writing-container {
bottom: 4rem;
margin-bottom: 1rem;
}
#sources-container {
width: 6rem;
float: right;
margin: 1rem -6rem 0 0;
#messages-container {
vertical-align: top;
margin-top: 4rem;
}
#members {
margin-left: 2rem;
}
#station .iden {
display: block;
}
.station {
.caret,
.circle {
display: inline-block;
width: 9rem;
margin-bottom: 0.3rem;
cursor: pointer;
font-weight: 200;
}
#stations .station {
display: block;
width: 24rem;
}
.station .name {
padding: 0.3rem;
.caret {
width: 0;
height: 0;
border-top: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid #000;
margin-top: 2px;
}
.station .name:hover {
background-color: #f5f5f5;
border-bottom: 6px solid #ededed;
.circle {
width: 6px;
height: 6px;
border: 3px solid #000;
border-radius: 6px;
margin-top: 2px;
}
.station > div {
#station-container #where .caret {
-webkit-transform: rotate(0deg);
-webkit-transform-origin: 0 50%;
-webkit-transition: -webkit-transform 0.2s;
}
#head {
width: 100%;
height: 4rem;
}
#station-container h1 {
font-weight: 500;
font-size: 0.6rem;
letter-spacing: 0.06rem;
display: inline-block;
line-height: 1.2rem;
}
.toggle {
width: 0.4rem;
height: 0.4rem;
border: 2px solid #000;
margin-right: 0.6rem;
#audience,
#who {
width: 34.6rem;
}
.toggle.active {
background-color: #000;
#stations,
#where {
width: 17.3rem;
}
#stations,
#audience,
#head > div {
display: inline-block;
text-align: right;
vertical-align: top;
}
#head > div {
height: 2rem;
margin-top: 1.5rem;
}
#where .caret {
border-left-color: #f00;
margin-left: 1rem;
}
#where > span,
#who > span {
vertical-align: top;
}
#who > span {
margin-left: 1rem;
}
#members > div {
display: block;
}
#members > div div {
display: inline-block;
vertical-align: bottom;
}
#members .audi {
margin-right: 0.3rem;
}
#members .iden {
min-width: 10rem;
}
.station div {
display: inline-block;
}
.station .remove {
display: none;
float: right;
margin-left: 1rem;
opacity: 0;
cursor: pointer;
width: 0.6rem;
margin-right: 0.6rem;
font-weight: 600;
color: #f00;
}
.station:hover .remove {
display: inline;
opacity: 1;
}
#sources-container .station {
font-family: "scp";
font-weight: 500;
text-transform: lowercase;
}
.sour-ctrl {
margin-bottom: 0.16rem;
}
.join-ctrl input,
.sour-ctrl input {
font-family: "scp";
border: none;
font-weight: 400;
text-align: right;
line-height: 1rem;
outline: none;
cursor: pointer;
}
.sour-ctrl input::-webkit-input-placeholder {
font-family: "bau";
font-family: "scp";
font-size: 1rem;
font-weight: 200;
font-weight: 600;
margin-left: 0.6rem;
color: #0003ff;
color: #000;
}
.sour-ctrl input:focus::-webkit-input-placeholder {
color: #fff;
}
.message {
padding-top: 0.3rem;
@ -245,8 +292,9 @@ body {
#messages .message:hover .time {
opacity: 1;
}
.time {
margin-right: 0.6rem;
#messages .message .ship,
#messages .message .audi > div {
cursor: pointer;
}
.member {
width: 12rem;
@ -255,55 +303,82 @@ body {
#messages {
height: auto;
}
.message.pending {
color: #ccc;
}
.message.say .mess {
font-style: italic;
}
.mess,
.iden,
.attr > div,
#station .member div,
#writing {
display: inline-block;
}
.iden > div {
display: inline;
}
.mess,
#writing,
#length {
vertical-align: top;
}
.attr > div {
max-width: 16rem;
}
.attr {
color: #d7d7d7;
text-align: right;
display: inline-block;
margin-right: 0.3rem;
min-width: 16rem;
}
.attr .iden {
color: #000;
margin-left: 0.3rem;
}
.attr > div {
.audi {
white-space: nowrap;
}
.audi > div {
margin-right: 0.3rem;
max-width: 8rem;
}
.iden > div {
max-width: 10rem;
}
.iden > div,
.audi > div {
display: inline-block;
background-color: #fff;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
-webkit-transition: max-width 0.2s;
}
.audi > div:last-child {
margin-right: 0;
}
.iden > div:hover,
.audi > div:hover {
position: relative;
max-width: 30rem;
-webkit-transition: max-width 0.2s;
}
.mess {
font-size: 0.9rem;
line-height: 1.6rem;
letter-spacing: 0.03rem;
word-wrap: break-word;
max-width: 31rem;
max-width: 30rem;
margin-left: 0.3rem;
}
.ship {
font-weight: 600;
#writing {
font-size: 0.9rem;
min-height: 1.6rem;
min-width: 1.3rem;
outline: none;
background-color: #eee;
padding: 0.3rem 0.1rem;
margin-left: 0.2rem;
margin-top: -0.3rem;
}
.ship.talk:before {
content: "...";
margin-left: -1.3rem;
margin-right: 0.3rem;
width: 1rem;
margin-top: -0.4rem;
vertical-align: middle;
display: inline-block;
line-height: 0.2rem;
letter-spacing: -0.1rem;
}
#writing-container {
bottom: 4rem;
margin-bottom: 1rem;
float: left;
#writing:focus {
background-color: #fff;
}
.writing {
padding-top: 0.3rem;
@ -313,60 +388,25 @@ body {
margin-left: 1rem;
margin-top: 1.2rem;
}
#writing {
font-size: 0.9rem;
min-height: 1.6rem;
line-height: 1.6rem;
min-width: 1.3rem;
padding: 0;
outline: none;
.writing .iden {
display: block;
text-align: right;
width: 100%;
}
.writing .iden .ship {
margin-right: 0.3rem;
}
#audi {
display: inline-block;
background-color: #eee;
}
#writing:focus {
background-color: #fff;
}
#station h1 {
display: inline-block;
margin: 0;
font-weight: 200;
font-size: 2rem;
text-transform: lowercase;
}
input.join {
font-size: 4rem;
background-color: #fff;
padding: 0.3rem 0.1rem;
margin-top: -0.3rem;
margin-right: -0.2rem;
outline: none;
width: 24rem;
overflow: hidden;
}
#station input.join {
font-family: "scp";
font-size: 0.7rem;
line-height: 1rem;
width: 12rem;
}
input.join::-webkit-input-placeholder {
color: #0003ff;
}
input.join:focus::-webkit-input-placeholder {
color: #fff;
}
.pending {
color: #ccc;
}
a.up {
height: 2rem;
margin-top: 0.6rem;
vertical-align: middle;
display: inline-block;
}
.arow-up {
display: inline-block;
margin: 0 0.5rem 0 0.5rem;
width: 0;
height: 0;
border-left: 9px solid transparent;
border-right: 9px solid transparent;
border-bottom: 9px solid #000;
.valid-false {
color: #ff2f2f;
}
#scrolling {
display: none;
@ -383,67 +423,92 @@ a.up {
font-size: 0.8rem;
text-transform: uppercase;
}
@media (max-width: 40rem) {
#c {
left: 0;
margin-left: 0;
width: 24rem;
@media only screen and (min-width: 1024px) {
#station-container:hover {
max-height: 30rem;
height: auto;
-webkit-transition: max-height 0.2s;
}
#messages-container,
#writing-container {
margin-left: 1rem;
}
#stations-container,
#station-container {
position: relative;
float: left;
}
#stations-container {
width: 8rem;
}
#station-container {
left: auto;
}
.station {
width: 5rem;
}
.attr {
display: block;
text-align: left;
width: 2rem;
margin-right: 1rem;
}
.message {
height: 1.6rem;
}
.stations,
.iden,
#station {
font-size: 0.5rem;
}
.station .remove {
display: inline;
font-size: 0.6rem;
line-height: 0.6rem;
}
.ship.talk:before {
margin-left: -0.3rem;
margin-right: 0;
}
.attr {
width: 4rem;
}
.iden > div {
display: block;
}
.attr > .time {
display: none;
}
.mess {
max-width: 12rem;
margin-bottom: 1rem;
}
#writing {
max-width: 12rem;
#station-container:hover #where .caret {
transform: rotate(90deg);
transform-origin: 0 50%;
-webkit-transform: rotate(90deg);
-webkit-transition: -webkit-transform 0.2s;
}
}
@media only screen and (max-width: 1170px) {
#station-container.open {
max-height: 30rem;
height: auto;
-webkit-transition: max-height 0.2s;
}
#station-container.open #where .caret {
transform: rotate(90deg);
transform-origin: 0 50%;
-webkit-transform: rotate(90deg);
-webkit-transition: -webkit-transform 0.2s;
}
#c,
#station-container {
width: 96%;
left: 0;
margin-left: 2%;
margin-right: 2%;
}
.mess,
#writing {
max-width: 40%;
line-height: 1.2rem;
}
.attr,
#stations,
#where {
width: 20%;
min-width: 20%;
}
#audience,
#who {
width: 60%;
}
#writing {
padding: 0.1rem;
}
#station-container.m-down,
#station-container.m-up {
position: absolute;
}
#station-container.m-down.m-fixed {
position: fixed;
top: 0;
}
}
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
.mess,
#writing {
max-width: 70%;
line-height: 1.2rem;
}
#stations,
#audience {
width: 96%;
}
#stations,
#audience,
.sour-ctrl input {
text-align: left;
}
#station {
cursor: pointer;
}
#station-container.open {
max-height: 30rem;
height: auto;
-webkit-transition: max-height 0.2s;
}
#station-container.open #where .caret {
transform: rotate(90deg);
transform-origin: 0 50%;
-webkit-transform: rotate(90deg);
-webkit-transition: -webkit-transform 0.2s;
}
}

View File

@ -1,9 +1,16 @@
//
// fonts first
//
@import 'fonts'
.iden
.audi
.time
#length
#where
#who
.station
font-family "scp"
.join-ctrl input
@ -22,18 +29,30 @@ body
.time
font-size .6rem
letter-spacing 0
.time
font-weight 200
#length
font-weight 500
input.join
.iden
.audi
#station
font-size .7rem
.iden
font-weight 600
html
body
font-size 18px
//
// containers
//
body
background-color #fefefe
padding 0
@ -43,125 +62,161 @@ body
display none
#c
top 0
background-color #fff
#stations-container
position absolute
top 1rem
top 0rem
left 50%
width 24rem
margin-left -12rem
font-size 4rem
width 58rem
margin-left -29rem
margin-bottom 12rem
#station-container
position fixed
top 0
left 50%
width 28rem
max-height 2.6rem
width 58rem
max-height 2.7rem
background-color white
border-bottom .3rem solid black
padding-bottom 1rem
overflow hidden
margin-left -14rem
z-index 10
-webkit-transition max-height .2s
#station #station-container
padding-top 1rem
background-color #f5f5f5
border-bottom 3px solid #ededed
transition max-height 0.15s ease-out
min-width 30rem
text-align right
#station-container:hover
max-height 12rem
transition max-height 0.25s ease-in
#stations-container
#messages-container
vertical-align top
#messaging-container
position absolute
top 4rem
left 50%
width 24rem
margin-left -12rem
margin-bottom 4rem
#station > div
display inline-block
#station-meta
margin-right 1rem
#writing-container
bottom 4rem
margin-bottom 1rem
#sources-container
width 6rem
float right
margin 1rem -6rem 0 0
#messages-container
vertical-align top
margin-top 4rem
#members
margin-left 2rem
//
// components
//
#station .iden
display block
.station
.caret
.circle
display inline-block
width 9rem
margin-bottom .3rem
cursor pointer
font-weight 200
#stations .station
display block
width 24rem
.station .name
padding .3rem
.caret
width 0
height 0
border-top 6px solid transparent
border-right 6px solid transparent
border-bottom 6px solid transparent
border-left 6px solid #000
margin-top 2px
.station .name:hover
background-color #f5f5f5
border-bottom 6px solid #ededed
.circle
width 6px
height 6px
border 3px solid black
border-radius 6px
margin-top 2px
.station > div
//
// station
//
#station-container #where .caret
-webkit-transform rotate(0deg)
-webkit-transform-origin 0 50%
-webkit-transition -webkit-transform .2s
#head
width 100%
height 4rem
#station-container h1
font-weight 500
font-size .6rem
letter-spacing .06rem
display inline-block
line-height 1.2rem
.toggle
width .4rem
height .4rem
border 2px solid #000
margin-right .6rem
#audience
#who
width 34.6rem
#stations
#where
width 17.3rem
#stations
#audience
#head > div
display inline-block
text-align right
vertical-align top
.toggle.active
background-color #000
#head > div
height 2rem
margin-top 1.5rem
#where .caret
border-left-color red
margin-left 1rem
#where > span
#who > span
vertical-align top
#who > span
margin-left 1rem
#members > div
display block
#members > div div
display inline-block
vertical-align bottom
#members .audi
margin-right .3rem
#members .iden
min-width 10rem
.station div
display inline-block
.station .remove
display none
float right
margin-left 1rem
opacity 0
cursor pointer
width .6rem
margin-right .6rem
font-weight 600
color #ff0000
.station:hover .remove
display inline
opacity 1
#sources-container .station
font-family "scp"
font-weight 500
text-transform lowercase
// hate this.
.sour-ctrl
margin-bottom .16rem
.join-ctrl input
// add source
.sour-ctrl input
font-family "scp"
border none
font-weight 400
text-align right
line-height 1rem
outline none
cursor pointer
.sour-ctrl input::-webkit-input-placeholder
font-family "bau"
font-family "scp"
font-size 1rem
font-weight 200
font-weight 600
margin-left .6rem
color #0003FF
color #000
.sour-ctrl input:focus::-webkit-input-placeholder
color white
//
// messages
//
.message
padding-top .3rem
@ -176,8 +231,9 @@ body
#messages .message:hover .time
opacity 1
.time
margin-right .6rem
#messages .message .ship
#messages .message .audi > div
cursor pointer
.member
width 12rem
@ -186,55 +242,86 @@ body
#messages
height auto
.message.pending
color #ccc
.message.say .mess
font-style italic
.mess
.iden
.attr > div
#station .member div
#writing
display inline-block
.iden > div
display inline
.mess
#writing
#length
vertical-align top
.attr > div
max-width 16rem
.attr
color #D7D7D7
text-align right
display inline-block
margin-right .3rem
min-width 16rem
.attr .iden
color #000
margin-left .3rem
.attr > div
.audi
white-space nowrap
.audi > div
margin-right .3rem
max-width 8rem
.iden > div
max-width 10rem
.iden > div
.audi > div
display inline-block
background-color white
overflow hidden
white-space nowrap
text-overflow ellipsis
-webkit-transition max-width .2s
.audi > div:last-child
margin-right 0
.iden > div:hover
.audi > div:hover
position relative
max-width 30rem
-webkit-transition max-width .2s
.mess
font-size .9rem
line-height 1.6rem
letter-spacing .03rem
word-wrap break-word
max-width 31rem
max-width 30rem
margin-left .3rem
.ship
font-weight 600
//
// writing
//
.ship.talk:before
content "..."
margin-left -1.3rem
margin-right .3rem
width 1rem
margin-top -.4rem
vertical-align middle
display inline-block
line-height .2rem
letter-spacing -.1rem
#writing
font-size .9rem
min-height 1.6rem
min-width 1.3rem
outline none
background-color #eee
padding .3rem .1rem
margin-left .2rem
margin-top -.3rem
#writing-container
bottom 4rem
margin-bottom 1rem
float left
#writing:focus
background-color #fff
.writing
padding-top .3rem
@ -244,60 +331,29 @@ body
margin-left 1rem
margin-top 1.2rem
#writing
font-size .9rem
min-height 1.6rem
line-height 1.6rem
min-width 1.3rem
padding 0
outline none
.writing .iden
display block
text-align right
width 100%
.writing .iden .ship
margin-right .3rem
#audi
display inline-block
background-color #eee
#writing:focus
background-color #fff
#station h1
display inline-block
margin 0
font-weight 200
font-size 2rem
text-transform lowercase
input.join
font-size 4rem
background-color #fff
padding .3rem .1rem
margin-top -.3rem
margin-right -.2rem
outline none
width 24rem
overflow hidden
#station input.join
font-family "scp"
font-size .7rem
line-height 1rem
width 12rem
.valid-false
color #ff2f2f
input.join::-webkit-input-placeholder
color #0003FF
input.join:focus::-webkit-input-placeholder
color #fff
.pending
color #ccc
a.up
height 2rem
margin-top .6rem
vertical-align middle
display inline-block
.arow-up
display inline-block
margin 0 .5rem 0 .5rem
width 0
height 0
border-left 9px solid transparent
border-right 9px solid transparent
border-bottom 9px solid #000
//
// scrolling
//
#scrolling
display none
@ -314,66 +370,4 @@ a.up
font-size .8rem
text-transform uppercase
@media (max-width: 40rem)
#c
left 0
margin-left 0
width 24rem
#messages-container
#writing-container
margin-left 1rem
#stations-container
#station-container
position relative
float left
#stations-container
width 8rem
#station-container
left auto
.station
width 5rem
.attr
display block
text-align left
width 2rem
margin-right 1rem
.message
height 1.6rem
.stations
.iden
#station
font-size .5rem
.station .remove
display inline
font-size .6rem
line-height .6rem
.ship.talk:before
margin-left -.3rem
margin-right 0
.attr
width 4rem
.iden > div
display block
.attr > .time
display none
.mess
max-width 12rem
margin-bottom 1rem
#writing
max-width 12rem
@import 'mobile'

View File

@ -0,0 +1,91 @@
/* computers --------*/
@media only screen and (min-width: 1024px)
#station-container:hover
max-height 30rem
height auto
-webkit-transition max-height .2s
#station-container:hover #where .caret
transform rotate(90deg)
transform-origin 0 50%
-webkit-transform rotate(90deg)
-webkit-transition -webkit-transform .2s
/* laptops / small screens ----------- */
@media only screen and (max-width: 1170px)
#station-container.open
max-height 30rem
height auto
-webkit-transition max-height .2s
#station-container.open #where .caret
transform rotate(90deg)
transform-origin 0 50%
-webkit-transform rotate(90deg)
-webkit-transition -webkit-transform .2s
#c
#station-container
width 96%
left 0
margin-left 2%
margin-right 2%
.mess
#writing
max-width 40%
line-height 1.2rem
.attr
#stations
#where
width 20%
min-width 20%
#audience
#who
width 60%
#writing
padding .1rem
#station-container.m-down
#station-container.m-up
position absolute
#station-container.m-down.m-fixed
position fixed
top 0
/* tablets + phones ----------- */
// @media only screen and (min-width: 320px) and (max-width: 1024px)
/* phones portrait and landscape ----------- */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px)
.mess
#writing
max-width 70%
line-height 1.2rem
#stations
#audience
width 96%
#stations
#audience
.sour-ctrl input
text-align left
#station
cursor pointer
#station-container.open
max-height 30rem
height auto
-webkit-transition max-height .2s
#station-container.open #where .caret
transform rotate(90deg)
transform-origin 0 50%
-webkit-transform rotate(90deg)
-webkit-transition -webkit-transform .2s

View File

@ -1,7 +1,5 @@
MessageDispatcher = require '../dispatcher/Dispatcher.coffee'
# hm
module.exports =
loadMessages: (grams,get) ->
MessageDispatcher.handleServerAction
@ -29,12 +27,11 @@ module.exports =
type:"messages-fetch"
window.chat.MessagePersistence.get station,start,end
sendMessage: (station,message,audience) ->
sendMessage: (message,audience) ->
serial = window.util.uuid32()
if station[0] isnt "~" then station = "~"+window.urb.ship+"/"+station
if audience.length is 0 then audience.push station
audience.push window.util.mainStationPath window.urb.user
audience = _.uniq audience
_audi = {}
for k,v of audience
@ -53,9 +50,13 @@ module.exports =
bouquet:[]
speech:
lin:
say:false
say:true
txt:message
date: Date.now()
if message[0] is "@"
_message.thought.statement.speech.lin.txt = _message.thought.statement.speech.lin.txt.slice(1).trim()
_message.thought.statement.speech.lin.say = false
MessageDispatcher.handleViewAction
type:"message-send"

View File

@ -17,6 +17,11 @@ module.exports =
type:"station-set-audience"
audience:audience
setValidAudience: (valid) ->
StationDispatcher.handleViewAction
type:"station-set-valid-audience"
valid:valid
toggleAudience: (station) ->
StationDispatcher.handleViewAction
type:"station-audience-toggle"
@ -53,11 +58,10 @@ module.exports =
type:"stations-load"
stations:stations
loadMembers: (station,members) ->
loadMembers: (members) ->
StationDispatcher.handleServerAction
type:"members-load"
members:members
station:station
createStation: (station) ->
StationDispatcher.handleViewAction

View File

@ -1,13 +1,13 @@
moment = require 'moment-timezone'
recl = React.createClass
[div,input,textarea] = [React.DOM.div,React.DOM.input,React.DOM.textarea]
[div,br,input,textarea] = [React.DOM.div,React.DOM.br,React.DOM.input,React.DOM.textarea]
MessageStore = require '../stores/MessageStore.coffee'
StationStore = require '../stores/StationStore.coffee'
MessageActions = require '../actions/MessageActions.coffee'
MessageStore = require '../stores/MessageStore.coffee'
StationActions = require '../actions/StationActions.coffee'
Member = require './MemberComponent.coffee'
StationStore = require '../stores/StationStore.coffee'
Member = require './MemberComponent.coffee'
Message = recl
lz: (n) -> if n<10 then "0#{n}" else "#{n}"
@ -19,24 +19,31 @@ Message = recl
s = @lz d.getSeconds()
"~#{h}.#{m}.#{s}"
_handleAudi: (e) ->
audi = _.map $(e.target).closest('.audi').find('div'), (div) -> return $(div).text()
@props._handleAudi audi
_handlePm: (e) ->
return if not @props._handlePm
user = $(e.target).closest('.iden').text().slice(1)
@props._handlePm user
render: ->
# pendingClass = if @props.pending isnt "received" then "pending" else ""
delivery = _.uniq _.pluck @props.thought.audience, "delivery"
pendingClass = if delivery.indexOf("received") isnt -1 then "received" else "pending"
if pendingClass is "pending"
console.log @props.thought
console.log delivery
klass = if delivery.indexOf("received") isnt -1 then " received" else " pending"
if @props.thought.statement.speech.lin.say is false then klass += " say"
name = if @props.name then @props.name else ""
audi = _.remove _.keys(@props.thought.audience), (stat) =>
stat isnt "~"+window.urb.ship+"/"+@props.station
audi = audi.join " "
audi = _.keys @props.thought.audience
audi = _.without audi,window.util.mainStationPath window.urb.user
audi = window.util.clipAudi audi
audi = audi.map (_audi) -> (div {}, _audi)
div {className:"message "+pendingClass}, [
div {className:"message #{klass}"}, [
(div {className:"attr"}, [
(Member {ship:@props.ship}, "")
div {className:"audi"}, "#{audi}"
div {onClick:@_handleAudi,className:"audi"}, audi
(div {onClick:@_handlePm}, (React.createElement Member,{ship:@props.ship}))
div {className:"time"}, @convTime @props.thought.statement.date
])
div {className:"mess"}, @props.thought.statement.speech.lin.txt
@ -51,7 +58,7 @@ module.exports = recl
last:MessageStore.getLast()
fetching:MessageStore.getFetching()
listening:MessageStore.getListening()
station:StationStore.getStation()
station:window.util.mainStation()
stations:StationStore.getStations()
configs:StationStore.getConfigs()
typing:MessageStore.getTyping()
@ -78,7 +85,8 @@ module.exports = recl
componentDidMount: ->
MessageStore.addChangeListener @_onChangeStore
StationStore.addChangeListener @_onChangeStore
if @state.station and @state.listening.indexOf(@state.station) is -1
if @state.station and
@state.listening.indexOf(@state.station) is -1
MessageActions.listenStation @state.station
checkMore = @checkMore
$(window).on 'scroll', checkMore
@ -87,9 +95,8 @@ module.exports = recl
componentDidUpdate: ->
$window = $(window)
if @lastLength
h = $('.message').height() * (@length-@lastLength)
st = $window.scrollTop()
$window.scrollTop st+h
st = $window.height()
$window.scrollTop st
@lastLength = null
else
if $('#writing-container').length > 0
@ -101,14 +108,22 @@ module.exports = recl
_onChangeStore: -> @setState @stateFromStore()
_handlePm: (user) ->
audi = [
window.util.mainStationPath(user)
window.util.mainStationPath(window.urb.user)
]
if user is window.urb.user then audi.pop()
StationActions.setAudience audi
_handleAudi: (audi) -> StationActions.setAudience audi
render: ->
station = @state.station
_station = "~"+window.urb.ship+"/"+station
sources = _.clone @state.configs[@state.station]?.sources ? []
sources.push _station
_messages = _.filter @state.messages, (_message) ->
audience = _.keys(_message.thought.audience)
_.intersection(sources,audience).length > 0
_messages = @state.messages
_messages = _.sortBy _messages, (_message) ->
_message.pending = _message.thought.audience[station]
_message.thought.statement.time
@ -122,5 +137,7 @@ module.exports = recl
messages = _messages.map (_message) =>
_message.station = @state.station
Message _message, ""
div {id: "messages"}, messages
_message._handlePm = @_handlePm
_message._handleAudi = @_handleAudi
React.createElement Message,_message
div {id: "messages"}, messages

View File

@ -1,15 +0,0 @@
recl = React.createClass
[div,input,textarea] = [React.DOM.div,React.DOM.input,React.DOM.textarea]
StationComponent = require './StationComponent.coffee'
MessagesComponent = require './MessagesComponent.coffee'
WritingComponent = require './WritingComponent.coffee'
module.exports = recl
render: ->
div {id:"d"}, "asdf"
# div {id:"d"}, [
# (div {id:'station-container'}, (StationComponent {}, ""))
# (div {id:'messages-container'}, (MessagesComponent {}, ""))
# (div {id:'writing-container'}, (WritingComponent {}, ""))
# ]

View File

@ -15,7 +15,7 @@ module.exports = recl
stateFromStore: -> {
audi:StationStore.getAudience()
members:StationStore.getMembers()
station:StationStore.getStation()
station:window.util.mainStation()
stations:StationStore.getStations()
configs:StationStore.getConfigs()
typing:StationStore.getTyping()
@ -35,14 +35,15 @@ module.exports = recl
componentWillUnmount: ->
StationStore.removeChangeListener @_onChangeStore
_toggleAudi: (e) ->
$e = $(e.target).closest('.station')
station = $e.find('.path').text()
StationActions.toggleAudience station
_onChangeStore: ->
@setState @stateFromStore()
_toggleOpen: (e) ->
if $(e.target).closest('.sour-ctrl').length > 0
return
$("#station-container").toggleClass 'open'
_keyUp: (e) ->
if e.keyCode is 13
v = @$input.val()
@ -51,51 +52,50 @@ module.exports = recl
_sources.push v
StationActions.setSources @state.station,_sources
@$input.val('')
@$input.blur()
_remove: (e) ->
e.stopPropagation()
e.preventDefault()
_station = $(e.target).attr "data-station"
_sources = _.clone @state.configs[@state.station].sources
_sources.slice _sources.indexOf(_station),1
_sources.splice _sources.indexOf(_station),1
StationActions.setSources @state.station,_sources
render: ->
parts = []
members = []
if @state.station and @state.members[@state.station]
members = _.map @state.members[@state.station], (state,member) ->
Member {ship:member,presence:state.presence}
if @state.station and @state.members
members = _.map @state.members, (stations,member) ->
audi = _.map stations,(presence,station) -> (div {className:"audi"}, station)
(div {}, [audi,(React.createElement Member, {ship:member})])
else
members = ""
sourceInput = [(input {className:"join",onKeyUp:@_keyUp,placeholder:"+"}, "")]
sourceCtrl = div {className:"sour-ctrl"}, sourceInput
sourceCtrl = div {className:"sour-ctrl"},sourceInput
sources = []
if @state.station and @state.configs[@state.station]
_remove = @_remove
_sources = _.clone @state.configs[@state.station].sources
_sources.push "twitter/hoontap"
sources = _.map _sources,(source) =>
toggleClass = "toggle "
if @state.audi.indexOf(source) isnt -1 then toggleClass += "active"
(div {className:"station",onClick:@_toggleAudi}, [
(div {className:toggleClass})
(div {className:"path"}, source),
(div {className:"remove",onClick:_remove,"data-station":source},"×")
(div {className:"station"}, [
(div {className:"remove",onClick:_remove,"data-station":source},"×"),
(div {className:"path"}, source)
])
else
sources = ""
sources = ""
station = []
station.push (a {className:"up",href:"\#/"}, [(div {className:"arow-up"}, "")])
station.push (h1 {},@state.station)
station.push (div {id:"members"},members)
head = (div {id:"head"},
[(div {id:"where"},["/talk",(div {className:"caret"},"")]),
(div {id:"who"},[(div {className:"circle"},""),"~#{window.urb.user}"])
]
)
parts.push (div {id:"station-container"}, (div {id:"station-meta"},station))
parts.push (div {id:"sources-container"}, [(div {class:"sources-list"},sources),sourceCtrl])
parts.push head
parts.push (div {id:"stations"}, [(h1 {}, "Listening to"),(div {},sources),sourceCtrl])
parts.push (div {id:"audience"}, (div {},[(h1 {}, "Talking to"),(div {id:"members"},members)]))
div {id:"station"},parts
div {id:"station",onClick:@_toggleOpen},parts

View File

@ -7,15 +7,15 @@ StationActions = require '../actions/StationActions.coffee'
module.exports = recl
stateFromStore: -> {
stations: StationStore.getStations()
station: StationStore.getStation()
station: "~zod/court"
}
getInitialState: -> @stateFromStore()
componentDidMount: ->
@$el = $(@getDOMNode())
@$add = $('#stations .add')
@$input = @$el.find('input')
@$el = $ @getDOMNode()
@$add = $ '#stations .add'
@$input = @$el.find 'input'
StationStore.addChangeListener @_onChangeStore
componentWillUnmount: ->

View File

@ -1,10 +1,11 @@
recl = React.createClass
[div,input,textarea] = [React.DOM.div,React.DOM.input,React.DOM.textarea]
[div,br,input,textarea] = [React.DOM.div,React.DOM.br,React.DOM.input,React.DOM.textarea]
MessageActions = require '../actions/MessageActions.coffee'
MessageStore = require '../stores/MessageStore.coffee'
StationActions = require '../actions/StationActions.coffee'
StationStore = require '../stores/StationStore.coffee'
Member = require './MemberComponent.coffee'
StationStore = require '../stores/StationStore.coffee'
Member = require './MemberComponent.coffee'
module.exports = recl
set: ->
@ -13,12 +14,16 @@ module.exports = recl
get: ->
if window.localStorage then window.localStorage.getItem 'writing'
stateFromStore: -> {
audi:StationStore.getAudience()
members:StationStore.getMembers()
typing:StationStore.getTyping()
station:StationStore.getStation()
}
stateFromStore: ->
s =
audi:StationStore.getAudience()
ludi:MessageStore.getLastAudience()
members:StationStore.getMembers()
typing:StationStore.getTyping()
valid:StationStore.getValidAudience()
s.audi = _.without s.audi, window.util.mainStationPath window.urb.user
s.ludi = _.without s.ludi, window.util.mainStationPath window.urb.user
s
getInitialState: -> @stateFromStore()
@ -35,16 +40,39 @@ module.exports = recl
@typing true
sendMessage: ->
MessageActions.sendMessage @state.station,@$writing.text(),@state.audi
if @_validateAudi() is false
$('#audi').focus()
return
if @state.audi.length is 0 and $('#audi').text().trim().length > 0
audi = @state.ludi
@_setAudi()
else
audi = @state.audi
audi = window.util.expandAudi audi
MessageActions.sendMessage @$writing.text().trim(),audi
@$length.text "0/69"
@$writing.text('')
@set()
@typing false
_keyDown: (e) ->
if e.keyCode is 13
_audiKeyDown: (e) ->
if e.keyCode is 13
e.preventDefault()
@sendMessage()
setTimeout () ->
$('#writing').focus()
,0
return false
_writingKeyUp: (e) ->
txt = @$writing.text()
@$length.toggleClass('valid-false',(txt.length > 62))
_writingKeyDown: (e) ->
if e.keyCode is 13
txt = @$writing.text()
e.preventDefault()
if txt.length > 0 and txt.length < 63
@sendMessage()
return false
@_input()
@set()
@ -58,15 +86,44 @@ module.exports = recl
for url in urls
length -= url.length
length += 10
@$length.text "#{length}/69"
if length >= 69
@$writing.text(@$writing.text().substr(0,69))
@cursorAtEnd()
e.preventDefault() if e
return false
@$length.text "#{length}/62"
_setFocus: -> @$writing.focus()
_validateAudiPart: (a) ->
if a[0] isnt "~"
return false
if a.indexOf("/") isnt -1
_a = a.split("/")
if _a[1].length is 0
return false
ship = _a[0]
else
ship = a
if ship.length < 3
return false
return true
_validateAudi: ->
v = $('#audi').text()
v = v.trim()
if v.length is 0
return true
v = v.split " "
for a in v
a = a.trim()
valid = @_validateAudiPart(a)
valid
_setAudi: ->
valid = @_validateAudi()
StationActions.setValidAudience valid
if valid is true
v = $('#audi').text()
v = v.split " "
v = window.util.expandAudi v
StationActions.setAudience v
getTime: ->
d = new Date()
seconds = d.getSeconds()
@ -85,6 +142,7 @@ module.exports = recl
componentDidMount: ->
window.util.sendMessage = @sendMessage
StationStore.addChangeListener @_onChangeStore
MessageStore.addChangeListener @_onChangeStore
@$el = $ @getDOMNode()
@$length = $('#length')
@$writing = $('#writing')
@ -108,12 +166,21 @@ module.exports = recl
ship = if iden then iden.ship else user
name = if iden then iden.name else ""
k = "writing"
k+= " hidden" if not @state?.station
audi = if @state.audi.length is 0 then @state.ludi else @state.audi
audi = window.util.clipAudi audi
div {className:k,onClick:@_setFocus}, [
k = "writing"
div {className:k}, [
(div {className:"attr"}, [
(Member iden, "")
(div {
id:"audi"
className:"audi valid-#{@state.valid}"
contentEditable:true
onKeyDown: @_audiKeyDown
onBlur:@_setAudi
}, audi.join(" "))
(React.createElement Member, iden)
(div {className:"time"}, @getTime())
])
(div {
@ -123,8 +190,9 @@ module.exports = recl
onBlur: @_blur
onInput: @_input
onPaste: @_input
onKeyDown: @_keyDown
onKeyDown: @_writingKeyDown
onKeyUp: @_writingKeyUp
onFocus: @cursorAtEnd
}, "")
div {id:"length"}, "0/69"
]
]

View File

@ -1,111 +1,186 @@
$(() ->
StationActions = require './actions/StationActions.coffee'
StationActions = require './actions/StationActions.coffee'
rend = React.render
rend = React.render
window.chat = {}
window.chat.MessagePersistence = require './persistence/MessagePersistence.coffee'
window.chat.StationPersistence = require './persistence/StationPersistence.coffee'
window.util =
mainStations: ["court","floor","porch"]
window.chat = {}
window.chat.MessagePersistence = require './persistence/MessagePersistence.coffee'
window.chat.StationPersistence = require './persistence/StationPersistence.coffee'
mainStationPath: (user) -> "~#{user}/#{window.util.mainStation(user)}"
window.util =
mainStation: ->
switch window.urb.user.length
when 3
return "court"
when 5
return "floor"
when 13
return "porch"
mainStation: (user) ->
if not user then user = window.urb.user
switch user.length
when 3
return "court"
when 6
return "floor"
when 13
return "porch"
create: (name) ->
window.chat.StationPersistence.createStation name, (err,res) ->
subscribe: (name) ->
window.chat.StationPersistence.addSource "main",window.urb.ship,["~zod/#{name}"]
uuid32: ->
str = "0v"
str += Math.ceil(Math.random()*8)+"."
for i in [0..5]
_str = Math.ceil(Math.random()*10000000).toString(32)
_str = ("00000"+_str).substr(-5,5)
str += _str+"."
str.slice(0,-1)
clipAudi: (audi) ->
audi = audi.join " "
ms = window.util.mainStationPath window.urb.user
regx = new RegExp "/#{ms}","g"
audi = audi.replace regx,""
audi.split " "
populate: (station,number) ->
c = 0
send = ->
if c < number
c++
else
console.log 'done'
return true
_audi = {}
_audi[station] = "pending"
_message =
serial:window.util.uuid32()
audience:_audi
statement:
speech:
say:"Message "+c
time: Date.now()
now: Date.now()
window.chat.MessagePersistence.sendMessage _message,send
send()
expandAudi: (audi) ->
audi = audi.join " "
ms = window.util.mainStationPath window.urb.user
if audi.indexOf(ms) is -1
if audi.length > 0
audi += " "
audi += "#{ms}"
audi.split " "
getScroll: ->
@writingPosition = $('#messaging-container').outerHeight(true)+$('#messaging-container').offset().top-$(window).height()
#@writingPosition = $('#writing-container').position().top-$(window).height()+$('#writing-container').outerHeight(true)
create: (name) ->
window.chat.StationPersistence.createStation name, (err,res) ->
subscribe: (name) ->
window.chat.StationPersistence.addSource "main",window.urb.ship,["~zod/#{name}"]
uuid32: ->
str = "0v"
str += Math.ceil(Math.random()*8)+"."
for i in [0..5]
_str = Math.ceil(Math.random()*10000000).toString(32)
_str = ("00000"+_str).substr(-5,5)
str += _str+"."
str.slice(0,-1)
setScroll: ->
window.util.getScroll()
$(window).scrollTop(window.util.writingPosition)
checkScroll: ->
if not window.util.writingPosition
window.util.getScroll()
if $(window).scrollTop() < window.util.writingPosition
$('body').addClass 'scrolling'
populate: (station,number) ->
c = 0
send = ->
if c < number
c++
else
$('body').removeClass 'scrolling'
console.log 'done'
return true
_audi = {}
_audi[station] = "pending"
_message =
serial:window.util.uuid32()
audience:_audi
statement:
speech:
say:"Message "+c
time: Date.now()
now: Date.now()
window.chat.MessagePersistence.sendMessage _message,send
send()
$(window).on 'scroll', window.util.checkScroll
getScroll: ->
@writingPosition = $('#c').outerHeight(true)+$('#c').offset().top-$(window).height()
window.chat.StationPersistence.listen()
setScroll: ->
window.util.getScroll()
$(window).scrollTop($("#c").height())
StationComponent = require './components/StationComponent.coffee'
StationsComponent = require './components/StationsComponent.coffee'
MessagesComponent = require './components/MessagesComponent.coffee'
WritingComponent = require './components/WritingComponent.coffee'
checkScroll: ->
if not window.util.writingPosition
window.util.getScroll()
if $(window).scrollTop() < window.util.writingPosition
$('body').addClass 'scrolling'
else
$('body').removeClass 'scrolling'
$c = $('#c')
# checkScroll = ->
# if $(window).scrollTop() > 20
# $('#nav').addClass 'scrolling'
# else
# $('#nav').removeClass 'scrolling'
# setInterval checkScroll, 500
clean = ->
React.unmountComponentAtNode $('#stations-container')[0]
React.unmountComponentAtNode $('#station-parts-container')[0]
React.unmountComponentAtNode $('#writing-container')[0]
React.unmountComponentAtNode $('#messages-container')[0]
so = {}
so.ls = $(window).scrollTop()
so.cs = $(window).scrollTop()
so.w = null
so.$d = $('#nav > div')
setSo = ->
so.$n = $('#station-container')
so.w = $(window).width()
so.h = $(window).height()
so.dh = $("#c").height()
so.nh = so.$n.outerHeight(true)
setSo()
setInterval setSo,200
routes =
'': ->
clean()
$c.html "<div id='stations-container'></div>"
rend (StationsComponent {}, ""),$('#stations-container')[0]
'/:station': (station) ->
clean()
StationActions.switchStation station
$c.html ""
$c.append("<div id='messaging-container'></div>")
$d = $('#messaging-container')
$d.append("<div id='messages-container'></div>")
$d.append("<div id='writing-container'></div>")
$d.append("<div id='station-parts-container'></div>")
$c.append("<div id='scrolling'>BOTTOM</div>")
rend (StationComponent {}, ""),$('#station-parts-container')[0]
rend (MessagesComponent {}, ""),$('#messages-container')[0]
rend (WritingComponent {}, ""),$('#writing-container')[0]
$(window).on 'resize', (e) ->
if so.w > 1170
so.$n.removeClass 'm-up m-down m-fixed'
router = Router routes
if not window.location.hash then window.location.hash = "/"
router.init()
)
ldy = 0
$(window).on 'scroll', (e) ->
so.cs = $(window).scrollTop()
if so.w > 1170
so.$n.removeClass 'm-up m-down m-fixed'
if so.w < 1170
dy = so.ls-so.cs
if so.cs <= 0
so.$n.removeClass 'm-up'
so.$n.addClass 'm-down m-fixed'
return
if so.cs+so.h > so.dh then return
if so.$n.hasClass 'm-fixed' and
so.w < 1024
so.$n.css left:-1*$(window).scrollLeft()
if dy > 0 and ldy > 0
if not so.$n.hasClass 'm-down'
so.$n.removeClass('m-up').addClass 'm-down'
top = so.cs-so.nh
if top < 0 then top = 0
so.$n.offset top:top
if so.$n.hasClass('m-down') and
not so.$n.hasClass('m-fixed') and
so.$n.offset().top >= so.cs
so.$n.addClass 'm-fixed'
so.$n.attr {style:''}
if dy < 0 and ldy < 0
if not so.$n.hasClass 'm-up'
so.$n.removeClass 'open'
so.$n.removeClass('m-down m-fixed').addClass 'm-up'
so.$n.attr {style:''}
top = so.cs
sto = so.$n.offset().top
if top < 0 then top = 0
if top > sto and top < sto+so.nh then top = sto
so.$n.offset top:top
ldy = dy
so.ls = so.cs
$(window).on 'scroll', window.util.checkScroll
window.chat.StationPersistence.listen()
StationComponent = require './components/StationComponent.coffee'
MessagesComponent = require './components/MessagesComponent.coffee'
WritingComponent = require './components/WritingComponent.coffee'
$c = $('#c')
clean = ->
React.unmountComponentAtNode $('#station-container')[0]
React.unmountComponentAtNode $('#messages-container')[0]
React.unmountComponentAtNode $('#writing-container')[0]
$c.append "<div id='station-container'></div>"
$c.append "<div id='messages-container'></div>"
$c.append "<div id='writing-container'></div>"
$c.append "<div id='scrolling'>BOTTOM</div>"
rend (React.createElement(StationComponent, {})),$('#station-container')[0]
rend (React.createElement(MessagesComponent, {})),$('#messages-container')[0]
rend (React.createElement(WritingComponent, {})),$('#writing-container')[0]
)

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,10 @@
{
"name": "urbit-radio",
"version": "0.0.0",
"repository": {
"type":"git",
"url":"https://github.com/urbit/urbit"
},
"description": "urbit radio frontend",
"main": "main.js",
"dependencies": {

View File

@ -2,11 +2,20 @@ MessageActions = require '../actions/MessageActions.coffee'
module.exports =
listenStation: (station,since) ->
$this = this
console.log 'listen station'
console.log arguments
window.urb.subscribe {
appl:"rodeo"
appl:"talk"
path:"/f/#{station}/#{since}"
}, (err,res) ->
console.log('m subscription updates')
if err or not res.data
console.log '/f/ err!'
console.log err
console.log res
$this.listenStation station,since
return
console.log('/f/')
console.log(res.data)
if res.data.ok is true
MessageActions.listeningStation station
@ -15,15 +24,19 @@ module.exports =
get: (station,start,end) ->
window.urb.subscribe {
appl:"rodeo"
appl:"talk"
path:"/f/#{station}/#{end}/#{start}"
}, (err,res) ->
console.log 'get'
console.log res
if err or not res.data
console.log '/f/ /e/s err'
console.log err
return
console.log '/f/ /e/s'
console.log res
if res.data?.grams?.tele
MessageActions.loadMessages res.data.grams,true
window.urb.unsubscribe {
appl:"rodeo"
appl:"talk"
path:"/f/#{station}/#{end}/#{start}"
}, (err,res) ->
console.log 'done'
@ -31,8 +44,8 @@ module.exports =
sendMessage: (message,cb) ->
window.urb.send {
appl:"rodeo"
mark:"rodeo-command"
appl:"talk"
mark:"talk-command"
data:
publish: [
message

View File

@ -3,8 +3,8 @@ StationActions = require '../actions/StationActions.coffee'
module.exports =
createStation: (name,cb) ->
window.urb.send {
appl:"rodeo"
mark:"rodeo-command"
appl:"talk"
mark:"talk-command"
data:
design:
party:name
@ -16,8 +16,8 @@ module.exports =
removeStation: (name,cb) ->
window.urb.send {
appl:"rodeo"
mark:"rodeo-command"
appl:"talk"
mark:"talk-command"
data:
design:
party:name
@ -26,8 +26,8 @@ module.exports =
setSources: (station,ship,sources) ->
send =
appl:"rodeo"
mark:"rodeo-command"
appl:"talk"
mark:"talk-command"
data:
design:
party:station
@ -36,39 +36,52 @@ module.exports =
caption:""
cordon:{posture:"white", list:[]}
window.urb.send send, (err,res) ->
console.log 'add source updates'
console.log 'talk-command'
console.log arguments
members: ->
window.urb.subscribe {
appl:"rodeo"
appl:"talk"
path:"/a/court"
}, (err,res) ->
console.log 'membership updates'
if err or not res
console.log '/a/ err'
console.log err
return
console.log '/a/'
console.log res.data
if res.data?.group?.global
StationActions.loadMembers res.data.group.global
listen: ->
window.urb.subscribe {
appl:"rodeo"
appl:"talk"
path:"/"
}, (err,res) ->
console.log 'house updates'
if err or not res.data
console.log '/ err'
console.log err
return
console.log '/'
console.log res.data
if res.data.house
StationActions.loadStations res.data.house
listenStation: (station) ->
window.urb.subscribe {
appl:"rodeo"
appl:"talk"
path:"/ax/#{station}"
}, (err,res) ->
console.log('station subscription updates')
if err or not res
console.log '/ax/ err'
console.log err
return
console.log('/ax/')
console.log(res.data)
if res.data.ok is true
StationActions.listeningStation station
if res.data.group?.local
StationActions.loadMembers station,res.data.group.local
if res.data.config
StationActions.loadConfig station,res.data.config
if res.data.group
res.data.group.global[window.util.mainStationPath(window.urb.user)] = res.data.group.local
StationActions.loadMembers res.data.group.global
if res.data.cabal?.loc
StationActions.loadConfig station,res.data.cabal.loc

View File

@ -33,6 +33,11 @@ MessageStore = _.merge new EventEmitter,{
getTyping: -> _typing
getLastAudience: ->
if _.keys(_messages).length is 0 then return []
messages = _.sortBy _messages, (_message) -> _message.thought.statement.time
_.keys messages[messages.length-1].thought.audience
setTyping: (state) -> _typing = state
setListening: (station) ->

View File

@ -1,14 +1,16 @@
EventEmitter = require('events').EventEmitter
EventEmitter = require('events').EventEmitter
StationDispatcher = require '../dispatcher/Dispatcher.coffee'
_audience = []
_members = {}
_stations = []
_listening = []
_station = null
_config = {}
_typing = {}
_audience = []
_members = {}
_stations = []
_listening = []
_station = null
_config = {}
_typing = {}
_validAudience = true
StationStore = _.merge new EventEmitter,{
removeChangeListener: (cb) -> @removeListener "change", cb
@ -21,6 +23,10 @@ StationStore = _.merge new EventEmitter,{
setAudience: (audience) -> _audience = audience
getValidAudience: -> _validAudience
setValidAudience: (valid) -> _validAudience = valid
toggleAudience: (station) ->
if _audience.indexOf(station) isnt -1
_audience.splice _audience.indexOf(station), 1
@ -35,14 +41,12 @@ StationStore = _.merge new EventEmitter,{
getMember: (ship) -> {ship:ship}
changeMember: (dir,name,ship) ->
if dir is "out"
_members = _.filter _members, (_member) ->
return (_member.ship isnt ship)
if dir is "in"
_members.push {name:name, ship:ship}
loadMembers: (station,members) -> _members[station] = members
loadMembers: (members) ->
_members = {}
for station,list of members
for member,presence of list
_members[member] = {} if not _members[member]
_members[member][station] = presence
getMembers: -> _members
@ -94,6 +98,10 @@ StationStore.dispatchToken = StationDispatcher.register (payload) ->
StationStore.setAudience action.audience
StationStore.emitChange()
break
when 'station-set-valid-audience'
StationStore.setValidAudience action.valid
StationStore.emitChange()
break
when 'station-switch'
StationStore.setAudience []
StationStore.setStation action.station
@ -103,7 +111,7 @@ StationStore.dispatchToken = StationDispatcher.register (payload) ->
StationStore.setListening action.station
StationStore.emitChange()
break
when "config-load"
when "config-load" #[name:'loadConfig', args:['station', 'config']]
StationStore.loadConfig action.station,action.config
StationStore.emitChange()
break
@ -111,7 +119,10 @@ StationStore.dispatchToken = StationDispatcher.register (payload) ->
StationStore.loadStations action.stations
StationStore.emitChange()
break
when "stations-leave"
when "stations-leave" # stations-leave:[{name:'loadStations' args:['stations']} ['unsetStation' 'station']]
# ...
# for command in actionVtable[action.type]
# StationStore[command[0]].apply(command[1..].map(argname -> action[argname]))
StationStore.loadStations action.stations
StationStore.unsetStation action.station
StationStore.emitChange()
@ -121,7 +132,7 @@ StationStore.dispatchToken = StationDispatcher.register (payload) ->
StationStore.emitChange()
break
when "members-load"
StationStore.loadMembers action.station,action.members
StationStore.loadMembers action.members
StationStore.emitChange()
break
when "typing-set"

View File

@ -1,45 +0,0 @@
::
:::: /hook/core/radio/sur
::
|%
++ audience (map station delivery) :: destination/state
++ atlas (map ship status) :: presence map
++ command :: effect on party
$% [%design (pair span (unit config))] :: configure/destroy
[%publish (list thought)] :: originate
[%review (list thought)] :: deliver
[%ping (map station presence)] :: declare status
== ::
++ config :: party configuration
$: sources=(set station) :: pulls from
cordon=(each (set ship) (set ship)) :: white/blacklist
== ::
++ cousin (pair ship span) :: domestic flow
++ delivery ?(%pending %received %rejected %released) :: delivery state
++ human :: human identifier
$: true=(unit (trel ,@t (unit ,@t) ,@t)) :: true name
hand=(unit ,@t) :: handle
== ::
++ partner :: foreign flow
$% [%twitter p=@t] :: twitter
== ::
++ presence ?(%hear %talk) :: status type
++ report :: unified rush/rust
$% [%house (set span)] :: meta-changes
[%grams (pair ,@ud (list telegram))] :: thoughts
[%group (pair atlas (map station atlas))] :: presence
[%config config] :: reconfigure
== ::
++ serial ,@uvH :: unique identity
++ station (each cousin partner) :: interlocutor
++ status (pair presence human) :: participant
++ speech :: party action
$% [%own p=@t] :: @ or /me
[%exp p=@t q=(unit tank)] :: program output
[%say p=@t] :: normal line
[%inv p=ship q=span] :: invite to
== ::
++ statement (pair ,@da speech) :: when this
++ telegram (pair ship thought) :: who which whom what
++ thought (trel serial audience statement) :: which whom what
--

116
main/sur/sole/core.hook Normal file
View File

@ -0,0 +1,116 @@
::
:::: /hook/core/sole/sur
!:
|%
++ sole-action :: sole to app
$% :: [%abo ~] :: reset interaction
[%det sole-change] :: command line edit
[%ret ~] :: submit and clear
== ::
++ sole-buffer (list ,@c) :: command state
++ sole-change :: network change
$: ler=sole-clock :: destination clock
haw=@uvH :: source hash
ted=sole-edit :: state change
== ::
++ sole-dialog :: standard dialog
|* out=$+(* *) :: output structure
$+(sole-input (sole-result out)) :: output function
:: ::
++ sole-result :: conditional result
|* out=$+(* *) :: output structure
$|(@ud (sole-product out)) :: error position
:: ::
++ sole-product :: success result
|* out=$+(* *) ::
%+ pair (list tank) ::
%+ each (unit out) :: ~ is abort
(pair sole-prompt (sole-dialog out)) :: ask and continue
:: ::
++ sole-so :: construct result
|* pro=* ::
[p=*(list tank) q=[%& p=[~ u=pro]]] ::
:: ::
++ sole-yo :: add output tank
|* [tan=tank res=(sole-result)] ::
?@ res res ::
[p=[i=tan t=p.res] q=q.res] ::
:: ::
++ sole-lo :: construct prompt
|* [pom=sole-prompt mor=(sole-dialog)] ::
[p=*(list tank) q=[%| p=pom q=mor]] ::
:: ::
++ sole-no :: empty result
[p=*(list tank) q=~] ::
:: ::
++ sole-go :: parse by rule
|* [sef=_rule fun=$+(* *)] ::
|= txt=sole-input ::
=+ vex=(sef [0 0] txt) ::
?: |(!=((lent txt) q.p.vex) ?=(~ q.vex)) ::
q.p.vex ::
(fun p.u.q.vex) ::
:: ::
++ sole-clock ,[own=@ud his=@ud] :: vector clock
++ sole-edit :: shared state change
$% [%del p=@ud] :: delete one at
[%ins p=@ud q=@c] :: insert at
[%mor p=(list sole-edit)] :: combination
[%nop ~] :: no-op
[%set p=sole-buffer] :: discontinuity
== ::
++ sole-effect :: app to sole
$% [%bel ~] :: beep
[%blk p=@ud q=@c] :: blink/match char at
[%clr ~] :: clear screen
[%det sole-change] :: edit command
[%err p=@ud] :: error point
[%mor p=(list sole-effect)] :: multiple effects
[%nex ~] :: save, clear command
[%pro sole-prompt] :: set prompt
[%sag p=path q=*] :: save to jamfile
[%sav p=path q=@] :: save to file
[%tan p=(list tank)] :: classic tank
:: [%taq p=tanq] :: modern tank
[%txt p=tape] :: text line
== ::
++ sole-command :: command state
$: pos=@ud :: cursor position
say=sole-share :: cursor
== ::
++ sole-prompt :: prompt definition
$: vis=? :: command visible
tag=term :: history mode
cad=tape :: caption
== ::
++ sole-input tape :: prompt input
++ sole-share :: symmetric state
$: ven=sole-clock :: our vector clock
leg=(list sole-edit) :: unmerged edits
buf=sole-buffer :: sole state
== ::
++ dill-belt :: sole input
$% [%aro p=?(%d %l %r %u)] :: arrow key
[%bac ~] :: true backspace
[%cru p=@tas q=(list tank)] :: echo error
[%ctl p=@ud] :: control-key
[%del ~] :: true delete
[%met p=@ud] :: meta-key
[%ret ~] :: return
[%rez p=@ud q=@ud] :: resize, cols, rows
[%txt p=(list ,@c)] :: utf32 text
[%yow p=gill] :: connect to app
== ::
++ dill-blit :: sole output
$% [%bel ~] :: make a noise
[%clr ~] :: clear the screen
[%hop p=@ud] :: set cursor position
[%mor p=(list dill-blit)] :: multiple blits
[%pro p=(list ,@c)] :: show as cursor/line
[%qit ~] :: close console
[%out p=(list ,@c)] :: send output line
[%sag p=path q=*] :: save to jamfile
[%sav p=path q=@] :: save to file
== ::
++ gill (pair ship term) :: general contact
--

View File

@ -1 +0,0 @@
,[~]

View File

@ -1,8 +1,7 @@
::
:::: /hook/core/rodeo/sur
:::: /hook/core/talk/sur
!:
|%
++ ache |*([a=$+(* *) b=$+(* *)] $%([| p=b] [& p=a])) :: PM 314
++ audience (map partner (pair envelope delivery)) :: destination/state
++ atlas (map ship status) :: presence map
++ bouquet (set flavor) :: complete aroma
@ -11,6 +10,10 @@
[%publish (list thought)] :: originate
[%review (list thought)] :: deliver
== ::
++ cabal :: metaconfiguration
$: loc=config :: local config
ham=(map station config) :: neighborhood configs
==
++ config :: party configuration
$: sources=(set partner) :: pulls from
caption=cord :: about
@ -34,32 +37,32 @@
$% [%twitter p=@t] :: twitter
== ::
++ posture :: security posture
$? %black :: public
%white :: private
%green :: readonly
%brown :: writeonly
$? %black :: channel
%white :: village
%green :: journal
%brown :: mailbox
== ::
++ presence ?(%gone %hear %talk) :: status type
++ register (pair atlas (map partner atlas)) :: ping me, ping srcs
++ report :: radio update
$% [%config config] :: reconfigure
++ shelf (map span (pair posture cord)) :: ship shape
++ report :: talk update
$% [%cabal cabal] :: config neighborhood
:: [%folder (list report)] :: multiple
[%grams (pair ,@ud (list telegram))] :: beginning, thoughts
[%group register] :: presence
[%house (map span (pair posture cord))] :: station set
[%house shelf] :: station set
== ::
++ speech :: narrative action
:: XX unify %own and %say to %lin
::
$% [%lan p=span q=@t] :: local announce
[%exp p=@t] :: hoon line
[%non ~] :: no content (yo)
[%ext p=@tas q=*] :: extended action
[%fat p=torso q=speech] :: attachment
:: [%inv p=station] :: invite to station
:: [%url p=purl]
[%ire p=serial q=speech] :: in-reply-to
[%lin p=? q=@t] :: no=@, text line
[%mor p=(list speech)] :: XX deleteme
[%mor p=(list speech)] :: multiplex
== ::
++ serial ,@uvH :: unique identity
++ partner (each station passport) :: interlocutor