Various fixes and improvements.

This commit is contained in:
C. Guy Yarvin 2013-11-07 16:34:44 -08:00
parent 2dc43c5759
commit 128c794593
8 changed files with 161 additions and 145 deletions

View File

@ -379,7 +379,7 @@
vix=(bex +((cut 0 [25 2] mag))) :: width of sender
tay=(cut 0 [27 5] mag) :: message type
==
?> =(6 vez)
?> =(7 vez)
?> =(chk (end 0 20 (mug bod)))
:+ [(end 3 wix bod) (cut 3 [wix vix] bod)]
(kins tay)
@ -399,7 +399,7 @@
=+ tay=(ksin q.kec)
%+ mix
%+ can 0
:~ [3 6]
:~ [3 7]
[20 (mug bod)]
[2 yax]
[2 qax]
@ -965,7 +965,7 @@
++ gnaw :: gnaw:am
|= [kay=cape ryn=lane pac=rock] :: process packet
^- [p=(list boon) q=fort]
?. =(6 (end 0 3 pac)) [~ fox]
?. =(7 (end 0 3 pac)) [~ fox]
=+ kec=(bite pac)
?: (goop p.p.kec) [~ fox]
?. (~(has by urb.ton.fox) q.p.kec)
@ -1184,7 +1184,7 @@
^+ +>
?- -.fud
%back
:: ~& [%back aut her ryn `@p`(mug dam)]
:: ~& [%back aut her ryn `@p`(mug dam)]
=. +> ?.(=(%full aut) +> cock) :: finish key exch
+>(..la (tuck p.fud q.fud r.fud))
::

View File

@ -1251,12 +1251,6 @@
%+ rap 3
^- (list ,@)
?- -.p.gos
%band ~[')' p.p.p.gos '(']
%crew ~['<' p.p.p.gos '>']
%dept ~['{' p.p.p.gos '}']
%fair ~['=' p.p.p.gos '=']
%holy ~['+' p.p.p.gos '+']
%home ~[']' p.p.p.gos '[']
%punk ~['"' p.p.gos '"']
?(%lord %lady)
=+ ^= nad
@ -1571,7 +1565,6 @@
$% [& p=hoon] :: transform
[| p=(list ,@tas)] :: alter
== ::
++ corp ,[p=@t q=govt] :: name issuer
++ chum ,@uvI :: hashed passcode
++ claw $: :: startup chain
joy=(unit coal) :: local context
@ -1941,15 +1934,9 @@
++ wand (list ,[p=life q=ring r=acro]) :: mace in action
++ what :: logical identity
$% [%anon ~] :: anonymous
[%band p=corp] :: creative )(
[%crew p=corp] :: business <>
[%dept p=corp] :: government <<>>
[%fair p=corp] :: nonprofit ><
[%holy p=corp] :: religious ||
[%home p=corp] :: family -()-
[%lady p=whom] :: female person ()
[%lord p=whom] :: male person []
[%punk p=@t] :: opaque handle ""
[%punk p=sect q=@t] :: opaque handle ""
== ::
++ whom ,[p=@ud q=govt r=sect s=name] :: year/govt/id
++ will (list deed) :: certificate

View File

@ -95,12 +95,6 @@
%+ (polo %text "Form: %" "lady" ~)
;~ pose
(jest %anon)
(jest %band)
(jest %crew)
(jest %dept)
(jest %fair)
(jest %holy)
(jest %home)
(jest %lady)
(jest %lord)
(jest %punk)
@ -112,15 +106,18 @@
%+ (polo %text "Handle: " ~ ~)
(boss 256 (plus alp))
|= [now=@da puc=@t]
(moss now tic tey lag [%duke %punk puc])
::
?(%band %crew %dept %fair %home %holy)
%- moon
|= [* gov=govt]
%+ (polo %text "Name: " ~ ~)
loon
|= [now=@da nam=@t]
(moss now tic tey lag [%duke (what fom `corp`[nam gov])])
%+ pogo (pond ^:@/===doc%/banner/txt)
%+ (polo %text "Banner: %" "blue" ~)
;~ pose
(jest %white)
(jest %blue)
(jest %red)
(jest %black)
(jest %orange)
==
|= [now=@da ban=@t]
=> .(ban (?(%white %blue %red %black %orange) ban))
(moss now tic tey lag [%duke %punk ban puc])
::
?(%lord %lady)
%+ pogo (pond ^:@/===doc%/person/txt)

View File

@ -1,10 +0,0 @@
!:
:: /=main=/bin/hupdate/hoon
::
=> .(-< `who=@p`-<)
|= *
|= ~
:_ ~
=+ bos=(sein who)
:~ [%xy /c [%pull bos %arvo ~[%arvo]]]
==

View File

@ -1,41 +0,0 @@
!:
:: /=main=/bin/solid/hoon
::
=> .(- [who=`@p`-< how=`path`->])
|= [est=time eny=@uw]
|= arg=*
=+ ^= lok ^- case
?: =(~ arg) [%da est]
?> =(~ +.arg)
((hard case) -.arg)
=+ cav=(scot (dime lok))
=+ top=`path`[(scot %p who) %arvo cav ~]
=+ 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]
[%a %ames]
[%b %behn]
[%c %clay]
[%d %dill]
[%e %eyre]
==
|- ^+ all
?~ vay all
=+ pax=(weld top `path`[q.i.vay ~])
=+ txt=((hard ,@) .^(%cx (weld pax `path`[%hoon ~])))
=+ sam=[est `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)
:_ ~ :_ ~
=+ pac=(jam [ken all])
~& %solid-finished
[%xx %save [%urbit %pill ~] pac]

View File

@ -122,7 +122,9 @@
(numb her now)
^- sect
?. &(?=(^ gos) ?=(%duke -.u.gos)) %white
?.(?=(?(%lord %lady) -.p.u.gos) %white r.p.p.u.gos)
?: ?=(?(%lord %lady) -.p.u.gos)
r.p.p.u.gos
?:(?=(%punk -.p.u.gos) p.p.u.gos %white)
&
now
==

View File

@ -2,33 +2,39 @@
:: /=main=/bin/tach/hoon
::
=> %= .
-
:- :* bud=(sein `@p`-<)
wak=@da
==
[who=`@p`-< how=`path`->]
::
+
=> +
=> ^/===/lib/pony
=> ^/===/lib/chat
=> |%
++ text (boss 256 (star ;~(pose (shim 32 126) (shim 128 255))))
++ mess
%+ cook |=(a=^mess a)
;~ pose
(stag %do ;~(pfix pat text))
(stag %qu text)
==
++ chat
%+ cook |=(a=^chat a)
;~ pose
(cold [%how ~] wut)
(cold [%who ~] tis)
(stag %all (stag %& mess))
(cold [%out ~] zap)
;~(pfix pam (stag %all (stag %& mess)))
;~(pfix bar (stag %all (stag %| mess)))
(stag %say ;~(plug ;~(pfix sig fed:ag) ;~(pfix ace mess)))
(stag %all (stag %& mess))
(stag %def mess)
==
::
++ expn
%- sear
:_ text
|= a=@t
^- (unit ,[p=@t q=tank])
=+ hun=(rush a wide:vast)
?~(a ~ [~ a (sell (slap seed u.hun))])
::
++ mess
%+ cook |=(a=^mess a)
;~ pose
(stag %do ;~(pfix pat text))
(stag %ex ;~(pfix hax expn))
(stag %qu text)
==
++ text (boss 256 (star ;~(pose (shim 32 126) (shim 128 255))))
--
|%
++ rend
@ -42,79 +48,149 @@
==
--
==
=> %= .
-
:- :* bud=(sein `@p`-<) :: chat server
oot=@ud :: outstanding, server
tod=*(map ,@p ,@ud) :: outstanding, friend
giz=*(list gift) :: stuff to send
sad=`sand`[%& &] :: default state
wak=@da :: next wakeup
dun=| :: done
==
[who=`@p`-< how=`path`->]
==
|= [est=time *]
|= ~
=. wak est
=. oot 1
|- ^- bowl
=< [init ~ hope vent]
=< abet:init
|%
++ abet `bowl`[(flop giz) ?:(dun ~ [~ hope vent(giz ~)])]
++ hope :: wait for events
^- (list slip)
:~ [/oy [%lq %oy]]
[/re [%ow ~]]
[/up [%up %text "; " ""]]
[/wa [%wa wak]]
[/ya [%lq %ya]]
=< apex
|% ++ apex ^- (list slip)
;: weld
buds
pals
regs
==
::
++ buds ^- (list slip)
?: =(0 oot) ~
[[/re [%ow ~]] ~]
::
++ pals ^- (list slip)
=| alx=(list slip)
|- ^+ alx
?~ tod alx
%= $
tod r.tod
alx %= $
tod l.tod
alx :_(alx [[%ra (scot %p p.n.tod) ~] [%ow ~]])
==
==
::
++ regs ^- (list slip)
:~ [/oy [%lq %oy]]
[/wa [%wa wak]]
[/ya [%lq %ya]]
^- slip
:- /up
:+ %up %text
:_ ""
%+ weld
?:(?=(& -.sad) ?:(p.sad "&" "|") (scow %p p.sad))
?:(?:(?=(& -.sad) !=(0 oot) (~(has by tod) p.sad)) "... " " ")
==
--
::
++ init (joke ~ [%who ~]) :: initial actions
++ joke :: send message
|= [hur=(unit ,@p) msg=*]
^+ +>
?~ hur
+>(oot +(oot), giz :_(giz [%sq bud %yo /re msg]))
%= +>
giz :_(giz [%sq u.hur %ya [%ra (scot %p u.hur) ~] msg])
tod =+ dut=(~(get by tod) u.hur)
(~(put by tod) u.hur ?~(dut 1 +(u.dut)))
==
::
++ init :: initial actions
^- (list gift)
:~ [%sq bud %yo /re `zing`[%who ~]]
++ nice :: got response
|= [hur=(unit ,@p) kay=cape]
^+ +>
=. +>
?~ hur
+>(oot (dec oot))
=+ dyt=(need (~(get by tod) u.hur))
%_ +>.$
tod
?: =(0 dyt)
(~(del by tod) u.hur)
(~(put by tod) u.hur (dec dyt))
==
?- kay
%good +>
%dead (show %leaf "server {(scow %p ?~(hur bud u.hur))} choked")
==
::
++ priv :: private message
|= [her=@p mes=^mess]
^- [(list gift) _+>]
:_ +>
:~ [%la (rend "> " (trip (numb her est)) mes)]
==
^+ +>
(show (rend "> " (trip (numb her est)) mes))
::
++ said :: server message
|= [her=@p duz=(list zong)]
^- [(list gift) _+>]
:_ +>
%+ turn duz
|= dum=zong
:- %la
^- tank
?- -.dum
%all (rend ?:(=(%white p.dum) "& " "| ") (trip q.q.dum) r.dum)
%new [%leaf "{(trip q.p.dum)} is in the building"]
%out [%leaf "{(trip q.p.dum)} has left the building"]
%who [%palm [" " "" "" ""] (turn p.dum |=(a=user [%leaf (trip q.a)]))]
^+ +>
?~ duz +>
%= $
duz t.duz
+>
%- show
?- -.i.duz
%all (rend ?:(=(%white p.i.duz) "& " "| ") (trip q.q.i.duz) r.i.duz)
%new [%leaf "{(trip q.p.i.duz)} is in the building"]
%out [%leaf "{(trip q.p.i.duz)} has left the building"]
%who [%rose ["," "" ""] (turn p.i.duz |=(a=user [%leaf (trip q.a)]))]
==
==
::
++ show |=(tan=tank %_(+> giz :_(giz [%la tan]))) :: print to screen
++ take :: alarm event
|- ^- [(list gift) _+]
:_ +(wak (add ~m1 wak))
:~ [%sq bud %yo /re [%ego est]]
==
|- ^+ +
=. wak (add ~m1 wak)
?.(=(0 oot) + (joke ~ `zing`[%ego est]))
::
++ toke :: user prompt
|= txt=@t
^- [(list gift) _+>]
:_ +>
^+ +>
=+ rey=(rush txt chat)
:_ ~
?~ rey
[%la %leaf "invalid command"]
(show %leaf "invalid input")
?+ -.u.rey
[%sq bud %yo /re `zing`u.rey]
%how [%la %leaf "help file goes here :-|"]
%say [%sq p.u.rey %ya /re `^mess`q.u.rey]
(joke ~ `zing`u.rey)
%def %- joke
?: ?=(& -.sad)
[~ `zing`[%all p.sad p.u.rey]]
[[~ p.sad] p.u.rey]
%how (show %leaf "help file goes here :-|")
%say (joke [~ p.u.rey] `^mess`q.u.rey)
==
::
++ vent :: handle event
|= [now=@da pax=path nut=note]
^- bowl
=. est now
=^ gaf +>
?+ pax [~ +>]
/oy ?>(?=(%lq -.nut) (said p.nut ((hard (list zong)) r.nut)))
/re ?>(?=(%ow -.nut) [~ +>])
/up ?>(?=(%up -.nut) (toke p.nut))
/wa ?>(?=(%wa -.nut) take)
/ya ?>(?=(%lq -.nut) (priv p.nut ((hard ^mess) r.nut)))
==
[gaf ~ hope ..$]
=< abet
?+ -.pax +>
%oy ?>(?=(%lq -.nut) (said p.nut ((hard (list zong)) r.nut)))
%re ?>(?=(%ow -.nut) (nice ~ p.nut))
%ra ?>(?=(%ow -.nut) (nice [~ (need (slaw %p i.t.pax))] p.nut))
%up ?>(?=(%up -.nut) (toke p.nut))
%wa ?>(?=(%wa -.nut) take)
%ya ?>(?=(%lq -.nut) (priv p.nut ((hard ^mess) r.nut)))
==
--

View File

@ -4,6 +4,7 @@
|%
++ chat :: user action
$% [%all p=? q=mess] :: broadcast
[%def p=mess] :: default
[%how ~] :: help
[%out ~] :: log out
[%say p=@p q=mess] :: private
@ -14,6 +15,10 @@
[%ex p=@t q=tank] :: expression
[%qu p=@t] :: quote
== ::
++ sand :: chat state
$% [& p=?] :: broadcast
[| p=@p] :: private
== ::
++ user ,[p=@p q=@t] :: downstream identity
++ zing :: client to server
$% [%all p=? q=mess] :: broadcast