mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 16:51:42 +03:00
Merge branch 'release/next-vere' into jb/leaky
* release/next-vere: (104 commits) vere: adds backwards-compatibility TODO comments for terminal inputs vere: adds backwards-compatibility to blit handling under -t u3: replaces spurious bloq-size bail:exit's in +rap and +rep jets build: patch windows uv_pipe impl to allow null writes build: update pmnsh to support cachix text/x-nix-narinfo responses vere: renames terminal streams for clarity, removes unused uv_tcp_t vere: refactors _term_it_send_csi() vere: suppress null writes in term.c vere: use memset to wipe hashmaps pill: all webterm: simpler TermState webterm: clean up component state derivation webterm: fix broken api interactions herm: close old-style subscriptions webterm: include @urbit/api/term files herm: accept old /view/* wires hood, pill: clean up merge artifacts webterm: improve container handling webterm: factor logic out into functions webterm: more idiomatic array type definitions ...
This commit is contained in:
commit
2897d3a764
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8c497bba51152dc3e54463a9f33c02876345419457a2f0ce2f15810db9daac72
|
||||
size 5041231
|
||||
oid sha256:f70a6e20ac6fd7dfb620f7ace725c5b031d040c0fe97caab251233ba31bc9819
|
||||
size 5155717
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5c6ad04e9c83caf6667ef12f4ba9627e9d409381fc4cd151dd2964faed105f8a
|
||||
size 1148833
|
||||
oid sha256:c871af4da5d779a2ccc8a8187ca06e2ccf19a984db9bede7f2d721fa43525210
|
||||
size 1259429
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3cc76dec0e5110e35647a8a7341c5c1648d33eab636c067b4ce5893d13af86d8
|
||||
size 6755088
|
||||
oid sha256:5f97a6c105b89973b6f7ee2bace9f0aff018efb65db7a3b90948761abb8c6b18
|
||||
size 6876039
|
||||
|
@ -1,7 +1,13 @@
|
||||
:: herm: stand-in for term.c with http interface
|
||||
::
|
||||
/- herm
|
||||
/+ default-agent, dbug, verb
|
||||
=, jael
|
||||
:: keep relevant mark conversions in cache for performance
|
||||
::
|
||||
/$ bj %blit %json
|
||||
/$ jb %json %belt
|
||||
/$ jt %json %herm-task
|
||||
::
|
||||
|%
|
||||
+$ state-0 [%0 ~]
|
||||
--
|
||||
@ -12,17 +18,9 @@
|
||||
%- agent:dbug
|
||||
^- agent:gall
|
||||
=> |%
|
||||
++ request-tube
|
||||
|= [bowl:gall from=mark to=mark next=?]
|
||||
^- card:agent:gall
|
||||
:* %pass /tube/[from]/[to]
|
||||
%arvo %c %warp
|
||||
our q.byk ~
|
||||
::
|
||||
?: next
|
||||
[%next %c da+now /[from]/[to]]
|
||||
[%sing %c da+now /[from]/[to]]
|
||||
==
|
||||
++ pass-session
|
||||
|= [ses=@tas tas=session-task:dill]
|
||||
[%pass /dill/[ses] %arvo %d %shot ses tas]
|
||||
--
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
@ -30,14 +28,7 @@
|
||||
::
|
||||
++ on-init
|
||||
^- (quip card:agent:gall _this)
|
||||
:_ this
|
||||
:: set up dill session subscription,
|
||||
:: and ensure the tubes we use are in cache
|
||||
::
|
||||
:~ [%pass [%view %$ ~] %arvo %d %view ~]
|
||||
(request-tube bowl %blit %json |)
|
||||
(request-tube bowl %json %belt |)
|
||||
==
|
||||
[~ this]
|
||||
::
|
||||
++ on-save !>([%0 ~])
|
||||
++ on-load
|
||||
@ -48,54 +39,70 @@
|
||||
++ on-watch
|
||||
|= =path
|
||||
^- (quip card:agent:gall _this)
|
||||
?> ?=([%session @ ~] path)
|
||||
:_ this
|
||||
:: scry prompt and cursor position out of dill for initial response
|
||||
::
|
||||
=/ base=^path
|
||||
/dx/(scot %p our.bowl)//(scot %da now.bowl)/sessions
|
||||
:~ [%give %fact ~ %blit !>(.^(blit:dill (weld base //line)))]
|
||||
[%give %fact ~ %blit !>(`blit:dill`hop+.^(@ud (weld base //cursor)))]
|
||||
?> ?=([%session @ ~] path)
|
||||
=* ses i.t.path
|
||||
:~ :: subscribe to the requested session
|
||||
::
|
||||
::NOTE multiple views do not result in multiple subscriptions
|
||||
:: because they go over the same wire/duct
|
||||
::
|
||||
(pass-session ses %view ~)
|
||||
:: tell session to refresh, so new client knows what's on screen
|
||||
::TODO should client be responsible for this?
|
||||
::
|
||||
(pass-session ses %hail ~)
|
||||
==
|
||||
::
|
||||
++ on-arvo
|
||||
|= [=wire =sign-arvo]
|
||||
^- (quip card:agent:gall _this)
|
||||
~| wire
|
||||
?+ wire !!
|
||||
:: pass on dill blits for the session
|
||||
::
|
||||
[%view %$ ~]
|
||||
[%dill @ ~]
|
||||
=* ses i.t.wire
|
||||
?. ?=([%dill %blit *] sign-arvo)
|
||||
~| [%unexpected-sign [- +<]:sign-arvo]
|
||||
!!
|
||||
:_ this
|
||||
%+ turn p.sign-arvo
|
||||
|= =blit:dill
|
||||
[%give %fact [%session %$ ~]~ %blit !>(blit)]
|
||||
[%give %fact [%session ses ~]~ %blit !>(blit)]
|
||||
::
|
||||
:: ensure the tubes we need remain in cache
|
||||
:: clean up old-style subscriptions
|
||||
::
|
||||
[%tube @ @ ~]
|
||||
=* from i.t.wire
|
||||
=* to i.t.t.wire
|
||||
?. ?=([%clay %writ *] sign-arvo)
|
||||
~| [%unexpected-sign [- +<]:sign-arvo]
|
||||
!!
|
||||
[%view @ ~]
|
||||
=* ses i.t.wire
|
||||
:_ this
|
||||
[(request-tube bowl from to &)]~
|
||||
[%pass wire %arvo %d %shot ses %flee ~]~
|
||||
==
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
^- (quip card:agent:gall _this)
|
||||
?. ?=(%belt mark)
|
||||
~| [%unexpected-mark mark]
|
||||
!!
|
||||
:_ this
|
||||
[%pass [%belt %$ ~] %arvo %d %belt !<(belt:dill vase)]~
|
||||
:_ ~
|
||||
?+ mark ~|([%unexpected-mark mark] !!)
|
||||
%belt (pass-session %$ %belt !<(belt:dill vase))
|
||||
%herm-task (pass-session !<(task:herm vase))
|
||||
==
|
||||
::
|
||||
++ on-peek
|
||||
|= =path
|
||||
^- (unit (unit cage))
|
||||
?+ path ~
|
||||
[%x %sessions ~]
|
||||
:+ ~ ~
|
||||
:- %json
|
||||
!> ^- json
|
||||
=- a+(turn ~(tap in -) (lead %s))
|
||||
.^((set @tas) %dy /(scot %p our.bowl)//(scot %da now.bowl)/sessions)
|
||||
==
|
||||
::
|
||||
++ on-leave on-leave:def
|
||||
++ on-peek on-peek:def
|
||||
::
|
||||
++ on-agent on-agent:def
|
||||
++ on-fail on-fail:def
|
||||
--
|
||||
|
@ -2,7 +2,7 @@
|
||||
/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln
|
||||
|%
|
||||
+$ state
|
||||
$: %15
|
||||
$: %16
|
||||
drum=state:drum
|
||||
helm=state:helm
|
||||
kiln=state:kiln
|
||||
@ -10,14 +10,15 @@
|
||||
+$ any-state
|
||||
$% state
|
||||
[ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)]
|
||||
[%7 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%8 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%9 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%10 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%11 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%12 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%13 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%14 drum=state:drum helm=state:helm kiln=state:kiln]
|
||||
[%7 drum=any-state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%8 drum=any-state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%9 drum=any-state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%10 drum=any-state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%11 drum=any-state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%12 drum=any-state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%13 drum=any-state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%14 drum=any-state:drum helm=state:helm kiln=state:kiln]
|
||||
[%15 drum=any-state:drum helm=state:helm kiln=state:kiln]
|
||||
==
|
||||
+$ any-state-tuple
|
||||
$: drum=any-state:drum
|
||||
@ -83,8 +84,7 @@
|
||||
::
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%atom poke-helm(mark %helm-atom)
|
||||
%dill-belt poke-drum(mark %drum-dill-belt)
|
||||
%dill-blit poke-drum(mark %drum-dill-blit)
|
||||
%dill-poke poke-drum
|
||||
%hood-sync poke-kiln(mark %kiln-sync)
|
||||
%write-sec-atom poke-helm(mark %helm-write-sec-atom)
|
||||
==
|
||||
@ -97,7 +97,7 @@
|
||||
|= =path
|
||||
^- step:agent:gall
|
||||
?+ path (on-watch:def +<)
|
||||
[%drum *] =^(c drum.state (peer:drum-core +<) [c this])
|
||||
[%dill *] =^(c drum.state (peer:drum-core +<) [c this])
|
||||
==
|
||||
::
|
||||
++ on-agent
|
||||
@ -114,7 +114,6 @@
|
||||
|= [=wire syn=sign-arvo]
|
||||
^- step:agent:gall
|
||||
?+ wire ~|([%hood-bad-wire wire] !!)
|
||||
[%drum *] =^(c drum.state (take-arvo:drum-core t.wire syn) [c this])
|
||||
[%helm *] =^(c helm.state (take-arvo:helm-core t.wire syn) [c this])
|
||||
[%kiln *] =^(c kiln.state (take-arvo:kiln-core t.wire syn) [c this])
|
||||
==
|
||||
|
@ -5,8 +5,8 @@
|
||||
:- %aqua-events
|
||||
%+ turn
|
||||
^- (list unix-event)
|
||||
:~ [/d/term/1 %belt %ctl `@c`%e]
|
||||
[/d/term/1 %belt %ctl `@c`%u]
|
||||
:~ [/d/term/1 %belt %mod %ctl `@c`%e]
|
||||
[/d/term/1 %belt %mod %ctl `@c`%u]
|
||||
[/d/term/1 %belt %txt ((list @c) command)]
|
||||
[/d/term/1 %belt %ret ~]
|
||||
==
|
||||
|
93
pkg/arvo/lib/dill.hoon
Normal file
93
pkg/arvo/lib/dill.hoon
Normal file
@ -0,0 +1,93 @@
|
||||
:: dill: utilities for dill's data structures
|
||||
::
|
||||
=, dill
|
||||
|%
|
||||
++ enjs
|
||||
|%
|
||||
++ blit
|
||||
|= =blit:dill
|
||||
^- json
|
||||
=, enjs:format
|
||||
%+ frond -.blit
|
||||
?- -.blit
|
||||
%bel b+&
|
||||
%clr b+&
|
||||
%hop ?@ p.blit (numb p.blit)
|
||||
(pairs 'r'^(numb r.p.blit) 'c'^(numb c.p.blit) ~)
|
||||
%put a+(turn p.blit |=(c=@c s+(tuft c)))
|
||||
%nel b+&
|
||||
%url s+p.blit
|
||||
%wyp b+&
|
||||
::
|
||||
%sag
|
||||
%- pairs
|
||||
:~ 'path'^(path p.blit)
|
||||
'file'^s+(en:base64:mimes:html (as-octs:mimes:html (jam q.blit)))
|
||||
==
|
||||
::
|
||||
%sav
|
||||
%- pairs
|
||||
:~ 'path'^(path p.blit)
|
||||
'file'^s+(en:base64:mimes:html (as-octs:mimes:html q.blit))
|
||||
==
|
||||
::
|
||||
%klr
|
||||
:- %a
|
||||
%+ turn p.blit
|
||||
|= [=stye text=(list @c)]
|
||||
%- pairs
|
||||
:~ 'text'^a+(turn text |=(c=@c s+(tuft c)))
|
||||
::
|
||||
:- 'stye'
|
||||
%- pairs
|
||||
|^ :~ 'back'^(color p.q.stye)
|
||||
'fore'^(color q.q.stye)
|
||||
'deco'^a+(turn ~(tap in p.stye) |=(d=deco ?~(d ~ s+d)))
|
||||
==
|
||||
++ color
|
||||
|= =tint
|
||||
?@ tint ?~(tint ~ s+tint)
|
||||
=, tint
|
||||
(pairs r+(numb r) g+(numb g) b+(numb b) ~)
|
||||
--
|
||||
==
|
||||
==
|
||||
--
|
||||
::
|
||||
++ dejs
|
||||
|%
|
||||
++ belt
|
||||
|= jon=json
|
||||
^- belt:dill
|
||||
?: ?=([%s *] jon)
|
||||
(taft p.jon)
|
||||
=, dejs:format
|
||||
%. jon
|
||||
%- of
|
||||
|^ :* mod+(ot 'mod'^mod 'key'^bot ~)
|
||||
txt+(ar (cu taft so))
|
||||
bol
|
||||
==
|
||||
::
|
||||
++ bol
|
||||
:~ aro+(su (perk %d %l %r %u ~))
|
||||
bac+ul
|
||||
del+ul
|
||||
hit+(ot 'r'^ni 'c'^ni ~)
|
||||
ret+ul
|
||||
==
|
||||
::
|
||||
++ bot
|
||||
|= j=json
|
||||
^- bolt:dill
|
||||
?+ j !!
|
||||
[%s *] (taft p.j)
|
||||
[%o *] ((of bol) j)
|
||||
==
|
||||
::
|
||||
++ mod
|
||||
|= j=json
|
||||
((su (perk %ctl %met %hyp ~)) j)
|
||||
--
|
||||
--
|
||||
--
|
@ -1,14 +1,14 @@
|
||||
/- *sole
|
||||
/+ sole
|
||||
|%
|
||||
+$ any-state $%(state)
|
||||
+$ state [%2 pith-2]
|
||||
+$ any-state $%(state state-2)
|
||||
+$ state [%3 pith]
|
||||
::
|
||||
++ pith-2 ::
|
||||
++ pith ::
|
||||
$: eel=(set gill:gall) :: connect to
|
||||
ray=(set well:gall) ::
|
||||
fur=(map dude:gall (unit server)) :: servers
|
||||
bin=(map bone source) :: terminals
|
||||
bin=(map @ source) :: terminals
|
||||
== ::
|
||||
:: ::
|
||||
++ server :: running server
|
||||
@ -49,6 +49,42 @@
|
||||
pom=sole-prompt :: static prompt
|
||||
inp=sole-command :: input state
|
||||
== ::
|
||||
::
|
||||
::
|
||||
+$ state-2 [%2 pith-2]
|
||||
::
|
||||
+$ pith-2
|
||||
$: eel=(set gill:gall)
|
||||
ray=(set well:gall)
|
||||
fur=(map dude:gall (unit server))
|
||||
bin=(map bone source-2)
|
||||
==
|
||||
::
|
||||
+$ source-2
|
||||
$: edg=_80
|
||||
off=@ud
|
||||
kil=kill
|
||||
inx=@ud
|
||||
fug=(map gill:gall (unit target-2))
|
||||
mir=(pair @ud stub)
|
||||
==
|
||||
::
|
||||
+$ target-2
|
||||
$: $= blt
|
||||
%+ pair
|
||||
(unit dill-belt-2)
|
||||
(unit dill-belt-2)
|
||||
ris=(unit search)
|
||||
hit=history
|
||||
pom=sole-prompt
|
||||
inp=sole-command
|
||||
==
|
||||
::
|
||||
+$ dill-belt-2
|
||||
$% [%ctl p=@c]
|
||||
[%met p=@c]
|
||||
dill-belt:dill
|
||||
==
|
||||
--
|
||||
:: :: ::
|
||||
:::: :: ::
|
||||
@ -121,26 +157,34 @@
|
||||
++ en-gill :: gill to wire
|
||||
|= gyl=gill:gall
|
||||
^- wire
|
||||
::TODO include session?
|
||||
[%drum %phat (scot %p p.gyl) q.gyl ~]
|
||||
::
|
||||
++ de-gill :: gill from wire
|
||||
|= way=wire ^- gill:gall
|
||||
?>(?=([@ @ ~] way) [(slav %p i.way) i.t.way])
|
||||
--
|
||||
:: TODO: remove .ost
|
||||
::
|
||||
|= [hid=bowl:gall state]
|
||||
=* sat +<+
|
||||
=/ ost 0
|
||||
=+ (~(gut by bin) ost *source)
|
||||
=/ ses=@tas %$
|
||||
=+ (~(gut by bin) ses *source)
|
||||
=* dev -
|
||||
=| moz=(list card:agent:gall)
|
||||
=| biz=(list dill-blit:dill)
|
||||
|%
|
||||
++ this .
|
||||
++ klr klr:format
|
||||
+$ state ^state :: proxy
|
||||
+$ any-state ^any-state :: proxy
|
||||
++ on-init se-abet:this(eel (deft-fish our.hid))
|
||||
::
|
||||
++ prep
|
||||
|= s=@tas
|
||||
=. ses ses
|
||||
=. dev (~(gut by bin) ses *source)
|
||||
this
|
||||
::
|
||||
++ diff-sole-effect-phat :: app event
|
||||
|= [way=wire fec=sole-effect]
|
||||
=< se-abet =< se-view
|
||||
@ -150,6 +194,8 @@
|
||||
::
|
||||
++ peer ::
|
||||
|= pax=path
|
||||
=? this ?=([%dill @ ~] pax)
|
||||
(prep i.t.pax)
|
||||
~| [%drum-unauthorized our+our.hid src+src.hid] :: ourself
|
||||
?> (team:title our.hid src.hid) :: or our own moon
|
||||
=< se-abet =< se-view
|
||||
@ -166,15 +212,15 @@
|
||||
=. ray (deft-apes our.hid lit)
|
||||
[~ sat]
|
||||
::
|
||||
++ poke-dill
|
||||
|= [ses=@tas bet=dill-belt:dill]
|
||||
(poke-dill-belt:(prep ses) bet)
|
||||
::
|
||||
++ poke-dill-belt :: terminal event
|
||||
|= bet=dill-belt:dill
|
||||
=< se-abet =< se-view
|
||||
(se-belt bet)
|
||||
::
|
||||
++ poke-dill-blit :: terminal output
|
||||
|= bit=dill-blit:dill
|
||||
se-abet:(se-blit-sys bit)
|
||||
::
|
||||
++ poke-start :: start app
|
||||
|= wel=well:gall
|
||||
=< se-abet =< se-view
|
||||
@ -206,8 +252,7 @@
|
||||
++ poke
|
||||
|= [=mark =vase]
|
||||
?+ mark ~|([%poke-drum-bad-mark mark] !!)
|
||||
%drum-dill-belt =;(f (f !<(_+<.f vase)) poke-dill-belt)
|
||||
%drum-dill-blit =;(f (f !<(_+<.f vase)) poke-dill-blit)
|
||||
%dill-poke =;(f (f !<(_+<.f vase)) poke-dill)
|
||||
%drum-exit =;(f (f !<(_+<.f vase)) poke-exit)
|
||||
%drum-link =;(f (f !<(_+<.f vase)) poke-link)
|
||||
%drum-put =;(f (f !<(_+<.f vase)) poke-put)
|
||||
@ -218,53 +263,89 @@
|
||||
==
|
||||
::
|
||||
++ on-load
|
||||
|= [hood-version=@ud old=any-state]
|
||||
=< se-abet =< se-view
|
||||
=. sat old
|
||||
=. dev (~(gut by bin) ost *source)
|
||||
=? ..on-load (lte hood-version %4)
|
||||
~> %slog.0^leaf+"drum: starting os1 agents"
|
||||
=> (se-born | %home %s3-store)
|
||||
=> (se-born | %home %contact-view)
|
||||
=> (se-born | %home %contact-hook)
|
||||
=> (se-born | %home %contact-store)
|
||||
=> (se-born | %home %metadata-hook)
|
||||
=> (se-born | %home %metadata-store)
|
||||
=> (se-born | %home %goad)
|
||||
~> %slog.0^leaf+"drum: resubscribing to %dojo and %chat-cli"
|
||||
=> (se-drop:(se-pull our.hid %dojo) | our.hid %dojo)
|
||||
(se-drop:(se-pull our.hid %chat-cli) | our.hid %chat-cli)
|
||||
=? ..on-load (lte hood-version %5)
|
||||
(se-born | %home %file-server)
|
||||
=? ..on-load (lte hood-version %7)
|
||||
(se-born | %home %glob)
|
||||
=? ..on-load (lte hood-version %8)
|
||||
=> (se-born | %home %group-push-hook)
|
||||
(se-born | %home %group-pull-hook)
|
||||
=? ..on-load (lte hood-version %9)
|
||||
(se-born | %home %graph-store)
|
||||
=? ..on-load (lte hood-version %10)
|
||||
=> (se-born | %home %graph-push-hook)
|
||||
(se-born | %home %graph-pull-hook)
|
||||
=? ..on-load (lte hood-version %11)
|
||||
=> (se-born | %home %hark-graph-hook)
|
||||
=> (se-born | %home %hark-group-hook)
|
||||
=> (se-born | %home %hark-chat-hook)
|
||||
=> (se-born | %home %hark-store)
|
||||
=> (se-born | %home %observe-hook)
|
||||
=> (se-born | %home %metadata-pull-hook)
|
||||
=> (se-born | %home %metadata-push-hook)
|
||||
(se-born | %home %herm)
|
||||
=? ..on-load (lte hood-version %12)
|
||||
=> (se-born | %home %contact-push-hook)
|
||||
=> (se-born | %home %contact-pull-hook)
|
||||
=> (se-born | %home %settings-store)
|
||||
(se-born | %home %group-view)
|
||||
=? ..on-load (lte hood-version %13)
|
||||
(se-born | %home %dm-hook)
|
||||
=? ..on-load (lte hood-version %15)
|
||||
(se-born | %home %notify)
|
||||
..on-load
|
||||
|^ |= [hood-version=@ud old=any-state]
|
||||
=< se-abet =< se-view
|
||||
=. sat (load-state old)
|
||||
=. dev (~(gut by bin) ses *source)
|
||||
(load-apps hood-version)
|
||||
::
|
||||
++ load-state
|
||||
|= old=any-state
|
||||
^- state
|
||||
?- -.old
|
||||
%3 old
|
||||
%2 [%3 (pith-2-to-3 +.old)]
|
||||
==
|
||||
::
|
||||
++ pith-2-to-3
|
||||
|= p=pith-2
|
||||
^- pith
|
||||
p(bin (~(run by bin.p) source-2-to-3))
|
||||
::
|
||||
++ source-2-to-3
|
||||
|= s=source-2
|
||||
^- source
|
||||
s(fug (~(run by fug.s) |=(t=(unit target-2) (bind t target-2-to-3))))
|
||||
::
|
||||
++ target-2-to-3
|
||||
|= t=target-2
|
||||
^- target
|
||||
:_ +.t
|
||||
:- (bind p.blt.t belt-2-to-3)
|
||||
(bind q.blt.t belt-2-to-3)
|
||||
::
|
||||
++ belt-2-to-3
|
||||
|= b=dill-belt-2
|
||||
^- dill-belt:dill
|
||||
?. ?=(?(%ctl %met) -.b) b
|
||||
[%mod -.b p.b]
|
||||
::
|
||||
++ load-apps
|
||||
|= hood-version=@ud
|
||||
=? ..on-load (lte hood-version %4)
|
||||
~> %slog.0^leaf+"drum: starting os1 agents"
|
||||
=> (se-born | %home %s3-store)
|
||||
=> (se-born | %home %contact-view)
|
||||
=> (se-born | %home %contact-hook)
|
||||
=> (se-born | %home %contact-store)
|
||||
=> (se-born | %home %metadata-hook)
|
||||
=> (se-born | %home %metadata-store)
|
||||
=> (se-born | %home %goad)
|
||||
~> %slog.0^leaf+"drum: resubscribing to %dojo and %chat-cli"
|
||||
=> (se-drop:(se-pull our.hid %dojo) | our.hid %dojo)
|
||||
(se-drop:(se-pull our.hid %chat-cli) | our.hid %chat-cli)
|
||||
=? ..on-load (lte hood-version %5)
|
||||
(se-born | %home %file-server)
|
||||
=? ..on-load (lte hood-version %7)
|
||||
(se-born | %home %glob)
|
||||
=? ..on-load (lte hood-version %8)
|
||||
=> (se-born | %home %group-push-hook)
|
||||
(se-born | %home %group-pull-hook)
|
||||
=? ..on-load (lte hood-version %9)
|
||||
(se-born | %home %graph-store)
|
||||
=? ..on-load (lte hood-version %10)
|
||||
=> (se-born | %home %graph-push-hook)
|
||||
(se-born | %home %graph-pull-hook)
|
||||
=? ..on-load (lte hood-version %11)
|
||||
=> (se-born | %home %hark-graph-hook)
|
||||
=> (se-born | %home %hark-group-hook)
|
||||
=> (se-born | %home %hark-chat-hook)
|
||||
=> (se-born | %home %hark-store)
|
||||
=> (se-born | %home %observe-hook)
|
||||
=> (se-born | %home %metadata-pull-hook)
|
||||
=> (se-born | %home %metadata-push-hook)
|
||||
(se-born | %home %herm)
|
||||
=? ..on-load (lte hood-version %12)
|
||||
=> (se-born | %home %contact-push-hook)
|
||||
=> (se-born | %home %contact-pull-hook)
|
||||
=> (se-born | %home %settings-store)
|
||||
(se-born | %home %group-view)
|
||||
=? ..on-load (lte hood-version %13)
|
||||
(se-born | %home %dm-hook)
|
||||
=? ..on-load (lte hood-version %15)
|
||||
(se-born | %home %notify)
|
||||
..on-load
|
||||
--
|
||||
::
|
||||
++ reap-phat :: ack connect
|
||||
|= [way=wire saw=(unit tang)]
|
||||
@ -277,12 +358,6 @@
|
||||
::
|
||||
(se-drop & gyl)
|
||||
::
|
||||
++ take-arvo
|
||||
|= [=wire =sign-arvo]
|
||||
%+ take-onto wire
|
||||
?> ?=(%onto +<.sign-arvo)
|
||||
+>.sign-arvo
|
||||
::
|
||||
++ take-coup-phat :: ack poke
|
||||
|= [way=wire saw=(unit tang)]
|
||||
=< se-abet =< se-view
|
||||
@ -293,19 +368,6 @@
|
||||
:_ u.saw
|
||||
>[%drum-coup-fail src.hid gyl]<
|
||||
::
|
||||
++ take-onto :: ack start
|
||||
|= [way=wire saw=(each suss:gall tang)]
|
||||
=< se-abet =< se-view
|
||||
?> ?=([@ @ ~] way)
|
||||
?> (~(has by fur) i.t.way)
|
||||
=/ wel=well:gall [i.way i.t.way]
|
||||
?- saw
|
||||
[%| *] (se-dump p.saw)
|
||||
[%& *] ?> =(q.wel p.p.saw)
|
||||
:: =. +>.$ (se-text "live {<p.saw>}")
|
||||
+>.$(fur (~(put by fur) q.wel `[p.wel %da r.p.saw]))
|
||||
==
|
||||
::
|
||||
++ take-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
?+ wire ~|([%drum-bad-take-agent wire -.sign] !!)
|
||||
@ -333,12 +395,13 @@
|
||||
++ se-abet :: resolve
|
||||
^- (quip card:agent:gall state)
|
||||
=. . se-subze:se-adze:se-subit:se-adit
|
||||
:_ sat(bin (~(put by bin) ost dev))
|
||||
:_ sat(bin (~(put by bin) ses dev))
|
||||
^- (list card:agent:gall)
|
||||
?~ biz (flop moz)
|
||||
:_ (flop moz)
|
||||
=/ =dill-blit:dill ?~(t.biz i.biz [%mor (flop biz)])
|
||||
[%give %fact ~[/drum] %dill-blit !>(dill-blit)]
|
||||
::TODO remove /drum after dill cleans up
|
||||
[%give %fact ~[/drum /dill/[ses]] %dill-blit !>(dill-blit)]
|
||||
::
|
||||
++ se-adit :: update servers
|
||||
^+ this
|
||||
@ -423,14 +486,14 @@
|
||||
(se-peer gil)
|
||||
::
|
||||
++ se-subze :: downdate connections
|
||||
=< .(dev (~(got by bin) ost))
|
||||
=. bin (~(put by bin) ost dev)
|
||||
=< .(dev (~(got by bin) ses))
|
||||
=. bin (~(put by bin) ses dev)
|
||||
^+ .
|
||||
%- ~(rep by bin)
|
||||
=< .(con +>)
|
||||
|: $:,[[ost=bone dev=source] con=_.] ^+ con
|
||||
=+ xeno=se-subze-local:%_(con ost ost, dev dev)
|
||||
xeno(ost ost.con, dev dev.con, bin (~(put by bin) ost dev.xeno))
|
||||
|: $:,[[ses=@tas dev=source] con=_.] ^+ con
|
||||
=+ xeno=se-subze-local:%_(con ses ses, dev dev)
|
||||
xeno(ses ses.con, dev dev.con, bin (~(put by bin) ses dev.xeno))
|
||||
::
|
||||
++ se-subze-local
|
||||
^+ .
|
||||
@ -445,7 +508,7 @@
|
||||
++ se-aint :: ignore result
|
||||
|= gyl=gill:gall
|
||||
^- ?
|
||||
?. (~(has by bin) ost) &
|
||||
?. (~(has by bin) ses) &
|
||||
=+ gyr=(~(get by fug) gyl)
|
||||
|(?=(~ gyr) ?=(~ u.gyr))
|
||||
::
|
||||
@ -554,6 +617,21 @@
|
||||
leaf+(weld (scag (sub edg 3) tape) "...")
|
||||
leaf+tape
|
||||
::
|
||||
++ se-blin :: print and newline
|
||||
|= $= lin
|
||||
$~ [%put ~]
|
||||
$>(?(%put %klr) dill-blit:dill)
|
||||
^+ +>
|
||||
:: newline means we need to redraw the prompt,
|
||||
:: so update the prompt mirror accordingly.
|
||||
::
|
||||
=. mir [0 ~]
|
||||
::TODO doing hops and wyps conditionally based on the mirror state seems
|
||||
:: better, but doesn't cover edge cases. results in dojo's ">=" being
|
||||
:: rendered alongside the prompt in scrollback, for example.
|
||||
:: figure out a way to make that work!
|
||||
(se-blit %mor [%hop 0] [%wyp ~] lin [%nel ~] ~)
|
||||
::
|
||||
++ se-dump :: print tanks
|
||||
|= tac=(list tank)
|
||||
^+ +>
|
||||
@ -564,7 +642,7 @@
|
||||
?. ((sane %t) (crip i.wol)) :: XX upstream validation
|
||||
~& bad-text+<`*`i.wol>
|
||||
$(wol t.wol)
|
||||
$(wol t.wol, +>.^$ (se-blit %out (tuba i.wol)))
|
||||
$(wol t.wol, +>.^$ (se-blin %put (tuba i.wol)))
|
||||
::
|
||||
++ se-join :: confirm connection
|
||||
|= gyl=gill:gall
|
||||
@ -597,15 +675,16 @@
|
||||
::
|
||||
++ se-blit-sys :: output to system
|
||||
|= bil=dill-blit:dill ^+ +>
|
||||
(se-emit %give %fact ~[/drum] %dill-blit !>(bil))
|
||||
::TODO remove /drum after dill cleans up
|
||||
(se-emit %give %fact ~[/drum /dill/[ses]] %dill-blit !>(bil))
|
||||
::
|
||||
++ se-show :: show buffer, raw
|
||||
|= lin=(pair @ud stub)
|
||||
^+ +>
|
||||
?: =(mir lin) +>
|
||||
=. +> ?:(=(p.mir p.lin) +> (se-blit %hop p.lin))
|
||||
=. +> ?:(=(q.mir q.lin) +> (se-blit %pom q.lin))
|
||||
+>(mir lin)
|
||||
%- se-blit(mir lin)
|
||||
?: =(q.mir q.lin) [%hop p.lin]
|
||||
mor+[[%hop 0] [%wyp ~] [%klr q.lin] [%hop p.lin] ~]
|
||||
::
|
||||
++ se-just :: adjusted buffer
|
||||
|= [pom=stub lin=(pair @ud (list @c))]
|
||||
@ -643,7 +722,7 @@
|
||||
?. ((sane %t) (crip txt)) :: XX upstream validation
|
||||
~& bad-text+<`*`txt>
|
||||
+>
|
||||
(se-blit %out (tuba txt))
|
||||
(se-blin %put (tuba txt))
|
||||
::
|
||||
++ se-poke :: send a poke
|
||||
|= [gyl=gill:gall par=cage]
|
||||
@ -651,6 +730,7 @@
|
||||
::
|
||||
++ se-peer :: send a peer
|
||||
|= gyl=gill:gall
|
||||
::TODO include session
|
||||
=/ =path /sole/(cat 3 'drum_' (scot %p our.hid))
|
||||
%- se-emit(fug (~(put by fug) gyl ~))
|
||||
[%pass (en-gill gyl) %agent gyl %watch path]
|
||||
@ -711,13 +791,19 @@
|
||||
?< ?=([?(%cru %hey %rez %yow) *] bet) :: target-specific
|
||||
=. blt [q.blt `bet] :: remember belt
|
||||
?- bet
|
||||
@ (ta-txt bet ~)
|
||||
[%aro *] (ta-aro p.bet)
|
||||
[%bac *] ta-bac
|
||||
[%ctl *] (ta-ctl p.bet)
|
||||
[%del *] ta-del
|
||||
[%met *] (ta-met p.bet)
|
||||
[%hit *] (ta-hit +.bet)
|
||||
[%ret *] ta-ret
|
||||
[%txt *] (ta-txt p.bet)
|
||||
::
|
||||
[%mod *]
|
||||
?+ mod.bet $(bet key.bet)
|
||||
%ctl (ta-ctl key.bet)
|
||||
%met (ta-met key.bet)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ ta-det :: send edit
|
||||
@ -741,7 +827,7 @@
|
||||
(ta-hom %del (dec pos.inp))
|
||||
::
|
||||
++ ta-ctl :: hear control
|
||||
|= key=@ud
|
||||
|= key=bolt:dill
|
||||
^+ +>
|
||||
=. ris ?.(?=(?(%g %r) key) ~ ris)
|
||||
?+ key ta-bel
|
||||
@ -762,7 +848,7 @@
|
||||
?: =(pos.inp len)
|
||||
ta-bel
|
||||
(ta-kil %r [pos.inp (sub len pos.inp)])
|
||||
%l +>(..ta (se-blit %clr ~))
|
||||
%l +>(..ta (se-blit(q.mir ~) %clr ~))
|
||||
%n (ta-aro %d)
|
||||
%p (ta-aro %u)
|
||||
%r ?~ ris
|
||||
@ -795,6 +881,15 @@
|
||||
ta-bel
|
||||
(ta-hom %del pos.inp)
|
||||
::
|
||||
++ ta-hit :: hear click
|
||||
|= [r=@ud c=@ud]
|
||||
^+ +>
|
||||
?. =(0 r) +>
|
||||
=/ pol=@ud
|
||||
(lent-char:klr (make:klr cad.pom))
|
||||
?: (lth c pol) +>.$
|
||||
+>.$(pos.inp (min (sub c pol) (lent buf.say.inp)))
|
||||
::
|
||||
++ ta-erl :: hear local error
|
||||
|= pos=@ud
|
||||
ta-bel(pos.inp (min pos (lent buf.say.inp)))
|
||||
@ -806,14 +901,13 @@
|
||||
++ ta-fec :: apply effect
|
||||
|= fec=sole-effect
|
||||
^+ +>
|
||||
?- fec
|
||||
?+ fec +>(..ta (se-blit fec))
|
||||
[%bel *] ta-bel
|
||||
[%blk *] +>
|
||||
[%bye *] +>(..ta (se-klin gyl))
|
||||
[%clr *] +>(..ta (se-blit fec))
|
||||
[%det *] (ta-got +.fec)
|
||||
[%err *] (ta-err p.fec)
|
||||
[%klr *] +>(..ta (se-blit %klr (make:klr p.fec)))
|
||||
[%klr *] +>(..ta (se-blin %klr (make:klr p.fec)))
|
||||
[%mor *] |- ^+ +>.^$
|
||||
?~ p.fec +>.^$
|
||||
$(p.fec t.p.fec, +>.^$ ^$(fec i.p.fec))
|
||||
@ -821,10 +915,8 @@
|
||||
[%pro *] (ta-pro +.fec)
|
||||
[%tab *] +>(..ta (se-tab p.fec))
|
||||
[%tan *] +>(..ta (se-dump p.fec))
|
||||
[%sag *] +>(..ta (se-blit fec))
|
||||
[%sav *] +>(..ta (se-blit fec))
|
||||
[%txt *] +>(..ta (se-text p.fec))
|
||||
[%url *] +>(..ta (se-blit fec))
|
||||
[%url *] +>(..ta (se-text:(se-blit fec) (trip p.fec)))
|
||||
==
|
||||
::
|
||||
++ ta-dog :: change cursor
|
||||
@ -876,8 +968,8 @@
|
||||
kil
|
||||
?. ?& ?=(^ old.kil)
|
||||
?=(^ p.blt)
|
||||
?| ?=([%ctl ?(%k %u %w)] u.p.blt)
|
||||
?=([%met ?(%d %bac)] u.p.blt)
|
||||
?| ?=([%mod %ctl ?(%k %u %w)] u.p.blt)
|
||||
?=([%mod %met ?(%d [%bac ~])] u.p.blt)
|
||||
== ==
|
||||
%= kil :: prepend
|
||||
num +(num.kil)
|
||||
@ -894,17 +986,18 @@
|
||||
==
|
||||
::
|
||||
++ ta-met :: meta key
|
||||
|= key=@ud
|
||||
|= key=bolt:dill
|
||||
^+ +>
|
||||
=. ris ~
|
||||
?+ key ta-bel
|
||||
%dot ?. &(?=(^ old.hit) ?=(^ i.old.hit)) :: last "arg" from hist
|
||||
%'.' ?. &(?=(^ old.hit) ?=(^ i.old.hit)) :: last "arg" from hist
|
||||
ta-bel
|
||||
=+ old=`(list @c)`i.old.hit
|
||||
=+ sop=(ta-jump(buf.say.inp old) %l %ace (lent old))
|
||||
(ta-hom (cat:edit pos.inp (slag sop old)))
|
||||
::
|
||||
%bac ?: =(0 pos.inp) :: kill left-word
|
||||
[%bac ~]
|
||||
?: =(0 pos.inp) :: kill left-word
|
||||
ta-bel
|
||||
=+ sop=(ta-pos %l %edg pos.inp)
|
||||
(ta-kil %l [(sub pos.inp sop) sop])
|
||||
@ -960,8 +1053,8 @@
|
||||
::
|
||||
%y ?. ?& ?=(^ old.kil) :: rotate & yank
|
||||
?=(^ p.blt)
|
||||
?| ?=([%ctl %y] u.p.blt)
|
||||
?=([%met %y] u.p.blt)
|
||||
?| ?=([%mod %ctl %y] u.p.blt)
|
||||
?=([%mod %met %y] u.p.blt)
|
||||
== ==
|
||||
ta-bel
|
||||
=+ las=(lent ta-yan)
|
||||
@ -1139,82 +1232,4 @@
|
||||
?: |(?=(~ a) (alnm i.a)) i
|
||||
$(i +(i), a t.a)
|
||||
--
|
||||
::
|
||||
++ klr :: styx/stub engine
|
||||
=, dill
|
||||
|%
|
||||
++ make :: stub from styx
|
||||
|= a=styx ^- stub
|
||||
=| b=stye
|
||||
%+ reel
|
||||
|- ^- stub
|
||||
%- zing %+ turn a
|
||||
|= a=$@(@t (pair styl styx))
|
||||
?@ a [b (tuba (trip a))]~
|
||||
^$(a q.a, b (styd p.a b))
|
||||
::
|
||||
|= [a=(pair stye (list @c)) b=stub]
|
||||
?~ b [a ~]
|
||||
?. =(p.a p.i.b) [a b]
|
||||
[[p.a (weld q.a q.i.b)] t.b]
|
||||
::
|
||||
++ styd :: stye from styl
|
||||
|= [a=styl b=stye] ^+ b :: with inheritance
|
||||
:+ ?~ p.a p.b
|
||||
?~ u.p.a ~
|
||||
(~(put in p.b) u.p.a)
|
||||
(fall p.q.a p.q.b)
|
||||
(fall q.q.a q.q.b)
|
||||
::
|
||||
++ lent-char
|
||||
|= a=stub ^- @
|
||||
(roll (lnts-char a) add)
|
||||
::
|
||||
++ lnts-char :: stub pair tail lengths
|
||||
|= a=stub ^- (list @)
|
||||
%+ turn a
|
||||
|= a=(pair stye (list @c))
|
||||
(lent q.a)
|
||||
::
|
||||
++ brek :: index + incl-len of
|
||||
|= [a=@ b=(list @)] :: stub pair w= idx a
|
||||
=| [c=@ i=@]
|
||||
|- ^- (unit (pair @ @))
|
||||
?~ b ~
|
||||
=. c (add c i.b)
|
||||
?: (gte c a)
|
||||
`[i c]
|
||||
$(i +(i), b t.b)
|
||||
::
|
||||
++ slag :: slag stub, keep stye
|
||||
|= [a=@ b=stub]
|
||||
^- stub
|
||||
=+ c=(lnts-char b)
|
||||
=+ i=(brek a c)
|
||||
?~ i b
|
||||
=+ r=(^slag +(p.u.i) b)
|
||||
?: =(a q.u.i)
|
||||
r
|
||||
=+ n=(snag p.u.i b)
|
||||
:_ r :- p.n
|
||||
(^slag (sub (snag p.u.i c) (sub q.u.i a)) q.n)
|
||||
::
|
||||
++ scag :: scag stub, keep stye
|
||||
|= [a=@ b=stub]
|
||||
^- stub
|
||||
=+ c=(lnts-char b)
|
||||
=+ i=(brek a c)
|
||||
?~ i b
|
||||
?: =(a q.u.i)
|
||||
(^scag +(p.u.i) b)
|
||||
%+ welp
|
||||
(^scag p.u.i b)
|
||||
=+ n=(snag p.u.i b)
|
||||
:_ ~ :- p.n
|
||||
(^scag (sub (snag p.u.i c) (sub q.u.i a)) q.n)
|
||||
::
|
||||
++ swag :: swag stub, keep stye
|
||||
|= [[a=@ b=@] c=stub]
|
||||
(scag b (slag a c))
|
||||
--
|
||||
--
|
||||
|
@ -28,8 +28,8 @@
|
||||
%+ send-events-to who
|
||||
^- (list unix-event)
|
||||
:~
|
||||
[/d/term/1 %belt %ctl `@c`%e]
|
||||
[/d/term/1 %belt %ctl `@c`%u]
|
||||
[/d/term/1 %belt %mod %ctl `@c`%e]
|
||||
[/d/term/1 %belt %mod %ctl `@c`%u]
|
||||
[/d/term/1 %belt %txt ((list @c) what)]
|
||||
[/d/term/1 %belt %ret ~]
|
||||
==
|
||||
@ -40,7 +40,7 @@
|
||||
|= [who=ship what=term]
|
||||
^- (list ph-event)
|
||||
%+ send-events-to who
|
||||
:~ [/d/term/1 %belt %ctl (,@c what)]
|
||||
:~ [/d/term/1 %belt %mod %ctl (,@c what)]
|
||||
==
|
||||
::
|
||||
:: Inject a file into a ship
|
||||
@ -67,7 +67,7 @@
|
||||
::
|
||||
%+ lien p.q.uf
|
||||
|= =blit:dill
|
||||
?. ?=(%lin -.blit)
|
||||
?. ?=(%put -.blit)
|
||||
|
|
||||
!=(~ (find what p.blit))
|
||||
==
|
||||
|
@ -1,5 +1,7 @@
|
||||
:: belt: runtime belt structure
|
||||
::
|
||||
/+ dill
|
||||
::
|
||||
|_ =belt:dill
|
||||
++ grad %noun
|
||||
:: +grab: convert from
|
||||
@ -7,18 +9,7 @@
|
||||
++ grab
|
||||
|%
|
||||
++ noun belt:dill
|
||||
++ json
|
||||
^- $-(^json belt:dill)
|
||||
=, dejs:format
|
||||
%- of
|
||||
:~ aro+(su (perk %d %l %r %u ~))
|
||||
bac+ul
|
||||
ctl+(cu taft so)
|
||||
del+ul
|
||||
met+(cu taft so)
|
||||
ret+ul
|
||||
txt+(ar (cu taft so))
|
||||
==
|
||||
++ json belt:dejs:dill
|
||||
--
|
||||
:: +grow: convert to
|
||||
::
|
||||
|
@ -1,5 +1,7 @@
|
||||
:: blit: runtime blit structure
|
||||
::
|
||||
/+ dill
|
||||
::
|
||||
|_ =blit:dill
|
||||
++ grad %noun
|
||||
:: +grab: convert from
|
||||
@ -13,49 +15,6 @@
|
||||
++ grow
|
||||
|%
|
||||
++ noun blit
|
||||
++ json
|
||||
^- ^json
|
||||
=, enjs:format
|
||||
%+ frond -.blit
|
||||
?- -.blit
|
||||
%bel b+&
|
||||
%clr b+&
|
||||
%hop (numb p.blit)
|
||||
%lin a+(turn p.blit |=(c=@c s+(tuft c)))
|
||||
%mor b+&
|
||||
%url s+p.blit
|
||||
::
|
||||
%sag
|
||||
%- pairs
|
||||
:~ 'path'^(path p.blit)
|
||||
'file'^s+(en:base64:mimes:html (as-octs:mimes:html (jam q.blit)))
|
||||
==
|
||||
::
|
||||
%sav
|
||||
%- pairs
|
||||
:~ 'path'^(path p.blit)
|
||||
'file'^s+(en:base64:mimes:html (as-octs:mimes:html q.blit))
|
||||
==
|
||||
::
|
||||
%klr
|
||||
:- %a
|
||||
%+ turn p.blit
|
||||
|= [=stye text=(list @c)]
|
||||
%- pairs
|
||||
:~ 'text'^a+(turn text |=(c=@c s+(tuft c)))
|
||||
::
|
||||
:- 'stye'
|
||||
%- pairs
|
||||
|^ :~ 'back'^(color p.q.stye)
|
||||
'fore'^(color q.q.stye)
|
||||
'deco'^a+(turn ~(tap in p.stye) |=(d=deco ?~(d ~ s+d)))
|
||||
==
|
||||
++ color
|
||||
|= =tint
|
||||
?@ tint ?~(tint ~ s+tint)
|
||||
s+(crip ((x-co:co 6) (rep 3 ~[b g r]:tint)))
|
||||
--
|
||||
==
|
||||
==
|
||||
++ json (blit:enjs:dill blit)
|
||||
--
|
||||
--
|
||||
|
@ -45,8 +45,8 @@
|
||||
=+ cha=(tuba (trip q.kev))
|
||||
?> ?=([@ ~] cha) :: of a single character
|
||||
?+ mod !! :: modified by one buckykey
|
||||
[%ctrl ~ ~] [%ctl i.cha]
|
||||
[%alt ~ ~] [%met i.cha]
|
||||
[%ctrl ~ ~] [%mod %ctl i.cha]
|
||||
[%alt ~ ~] [%mod %met i.cha]
|
||||
==
|
||||
?@ q.kev
|
||||
[%txt (tuba (trip q.kev))]
|
||||
|
@ -19,8 +19,10 @@
|
||||
^- ^json
|
||||
?+ -.dib ~|(unsupported-blit+-.dib !!)
|
||||
%mor [%a (turn p.dib |=(a=dill-blit:dill json(dib a)))]
|
||||
%hop (frond %hop (numb p.dib))
|
||||
?(%pro %out) (frond -.dib (tape (tufa p.dib)))
|
||||
%hop %+ frond %hop
|
||||
?@ p.dib (numb p.dib)
|
||||
(pairs 'r'^(numb r.p.dib) 'c'^(numb c.p.dib) ~)
|
||||
%put (frond -.dib (tape (tufa p.dib)))
|
||||
?(%bel %clr) (frond %act %s -.dib)
|
||||
==
|
||||
--
|
||||
|
46
pkg/arvo/mar/herm/task.hoon
Normal file
46
pkg/arvo/mar/herm/task.hoon
Normal file
@ -0,0 +1,46 @@
|
||||
:: task: herm task for passthrough to dill
|
||||
::
|
||||
/- herm
|
||||
/+ dill
|
||||
::
|
||||
|_ =task:herm
|
||||
++ grad %noun
|
||||
:: +grab: convert from
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun task:herm
|
||||
::
|
||||
++ json
|
||||
|= jon=^json
|
||||
^+ task
|
||||
~| jon
|
||||
?> ?=([%o *] jon)
|
||||
=+ ses=(~(got by p.jon) 'session')
|
||||
?> ?=([%s *] ses)
|
||||
:- ?: =('' p.ses) %$
|
||||
(slav %tas p.ses)
|
||||
=. p.jon (~(del by p.jon) 'session')
|
||||
%. jon
|
||||
=, dejs:format
|
||||
|^ task
|
||||
++ task
|
||||
%- of
|
||||
:~ belt+belt:dejs:^dill
|
||||
blew+(ot 'w'^ni 'h'^ni ~)
|
||||
hail+ul
|
||||
open+(ot 'term'^(se %tas) 'apps'^(ar gill) ~)
|
||||
shut+ul
|
||||
==
|
||||
::
|
||||
++ gill
|
||||
(ot 'who'^(se %p) 'app'^(se %tas) ~)
|
||||
--
|
||||
--
|
||||
:: +grow: convert to
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ noun task
|
||||
--
|
||||
--
|
9
pkg/arvo/sur/herm.hoon
Normal file
9
pkg/arvo/sur/herm.hoon
Normal file
@ -0,0 +1,9 @@
|
||||
:: herm: stand-in for term.c with http interface
|
||||
::
|
||||
|%
|
||||
+$ task
|
||||
$~ [%$ %hail ~]
|
||||
$: session=@tas
|
||||
task=$>(?(%open %shut %belt %blew %hail) session-task:dill)
|
||||
==
|
||||
--
|
@ -741,7 +741,6 @@
|
||||
[%hill p=(list @tas)] :: mount points
|
||||
[%done error=(unit error:ames)] :: ames message (n)ack
|
||||
[%mere p=(each (set path) (pair term tang))] :: merge result
|
||||
[%note p=@tD q=tank] :: debug message
|
||||
[%ogre p=@tas] :: delete mount point
|
||||
[%rule red=dict wit=dict] :: node r+w permissions
|
||||
[%writ p=riot] :: response
|
||||
@ -1031,9 +1030,7 @@
|
||||
++ dill ^?
|
||||
|%
|
||||
+$ gift :: out result <-$
|
||||
$% [%bbye ~] :: reset prompt
|
||||
[%blit p=(list blit)] :: terminal output
|
||||
[%burl p=@t] :: activate url
|
||||
$% [%blit p=(list blit)] :: terminal output
|
||||
[%logo ~] :: logout
|
||||
[%meld ~] :: unify memory
|
||||
[%pack ~] :: compact memory
|
||||
@ -1041,29 +1038,32 @@
|
||||
== ::
|
||||
+$ task :: in request ->$
|
||||
$~ [%vega ~] ::
|
||||
$% [%belt p=belt] :: terminal input
|
||||
[%blew p=blew] :: terminal config
|
||||
[%boot lit=? p=*] :: weird %dill boot
|
||||
$% [%boot lit=? p=*] :: weird %dill boot
|
||||
[%crop p=@ud] :: trim kernel state
|
||||
[%crud p=@tas q=(list tank)] :: print error
|
||||
[%flee session=~] :: unwatch session
|
||||
[%flog p=flog] :: wrapped error
|
||||
[%flow p=@tas q=(list gill:gall)] :: terminal config
|
||||
[%hail ~] :: terminal refresh
|
||||
[%heft ~] :: memory report
|
||||
[%hook ~] :: this term hung up
|
||||
[%harm ~] :: all terms hung up
|
||||
$>(%init vane-task) :: after gall ready
|
||||
[%meld ~] :: unify memory
|
||||
[%noop ~] :: no operation
|
||||
[%pack ~] :: compact memory
|
||||
[%talk p=tank] ::
|
||||
[%text p=tape] ::
|
||||
[%view session=~] :: watch session blits
|
||||
[%shot ses=@tas task=session-task] :: task for session
|
||||
[%talk p=(list tank)] :: print tanks
|
||||
[%text p=tape] :: print tape
|
||||
$>(%trim vane-task) :: trim state
|
||||
$>(%vega vane-task) :: report upgrade
|
||||
[%verb ~] :: verbose mode
|
||||
[%knob tag=term level=?(%hush %soft %loud)] :: error verbosity
|
||||
session-task :: for default session
|
||||
== ::
|
||||
:: ::
|
||||
+$ session-task :: session request
|
||||
$% [%belt p=belt] :: terminal input
|
||||
[%blew p=blew] :: terminal config
|
||||
[%flee ~] :: unwatch session
|
||||
[%hail ~] :: terminal refresh
|
||||
[%open p=dude:gall q=(list gill:gall)] :: setup session
|
||||
[%shut ~] :: close session
|
||||
[%view ~] :: watch session blits
|
||||
== ::
|
||||
::
|
||||
:::: :: (1d2)
|
||||
@ -1071,14 +1071,10 @@
|
||||
+$ blew [p=@ud q=@ud] :: columns rows
|
||||
+$ belt :: client input
|
||||
$? bolt :: simple input
|
||||
$% [%mod mod=?(%ctl %met %hyp) key=bolt] :: w/ modifier
|
||||
[%mod mod=?(%ctl %met %hyp) key=bolt] :: w/ modifier
|
||||
[%txt p=(list @c)] :: utf32 text
|
||||
::TODO consider moving %hey, %rez, %yow here ::
|
||||
::TMP forward backwards-compatibility ::
|
||||
:: ::
|
||||
[%ctl p=@c] ::
|
||||
[%met p=@c] ::
|
||||
== == ::
|
||||
== ::
|
||||
+$ bolt :: simple input
|
||||
$@ @c :: simple keystroke
|
||||
$% [%aro p=?(%d %l %r %u)] :: arrow key
|
||||
@ -1087,43 +1083,29 @@
|
||||
[%hit r=@ud c=@ud] :: mouse click
|
||||
[%ret ~] :: return
|
||||
== ::
|
||||
+$ blit :: old blit
|
||||
+$ blit :: client output
|
||||
$% [%bel ~] :: make a noise
|
||||
[%clr ~] :: clear the screen
|
||||
[%hop p=@ud] :: set cursor position
|
||||
[%klr p=stub] :: set styled line
|
||||
[%lin p=(list @c)] :: set current line
|
||||
[%mor ~] :: newline
|
||||
[%hop p=$@(@ud [r=@ud c=@ud])] :: set cursor col/pos
|
||||
[%klr p=stub] :: put styled
|
||||
[%put p=(list @c)] :: put text at cursor
|
||||
[%nel ~] :: newline
|
||||
[%sag p=path q=*] :: save to jamfile
|
||||
[%sav p=path q=@] :: save to file
|
||||
[%url p=@t] :: activate url
|
||||
[%wyp ~] :: wipe cursor line
|
||||
== ::
|
||||
+$ dill-belt :: new belt
|
||||
$% [%aro p=?(%d %l %r %u)] :: arrow key
|
||||
[%bac ~] :: true backspace
|
||||
+$ dill-belt :: arvo input
|
||||
$% belt :: client input
|
||||
[%cru p=@tas q=(list tank)] :: echo error
|
||||
[%ctl p=@] :: control-key
|
||||
[%del ~] :: true delete
|
||||
[%hey ~] :: refresh
|
||||
[%met p=@] :: meta-key
|
||||
[%ret ~] :: return
|
||||
[%rez p=@ud q=@ud] :: resize, cols, rows
|
||||
[%txt p=(list @c)] :: utf32 text
|
||||
[%yow p=gill:gall] :: connect to app
|
||||
== ::
|
||||
+$ dill-blit :: new blit
|
||||
$% [%bel ~] :: make a noise
|
||||
[%clr ~] :: clear the screen
|
||||
[%hop p=@ud] :: set cursor position
|
||||
[%klr p=stub] :: styled text
|
||||
+$ dill-blit :: arvo output
|
||||
$% blit :: client output
|
||||
[%mor p=(list dill-blit)] :: multiple blits
|
||||
[%pom p=stub] :: styled prompt
|
||||
[%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
|
||||
[%url p=@t] :: activate url
|
||||
== ::
|
||||
+$ flog :: sent to %dill
|
||||
$% [%crop p=@ud] :: trim kernel state
|
||||
@ -1134,6 +1116,11 @@
|
||||
[%text p=tape] ::
|
||||
[%verb ~] :: verbose mode
|
||||
== ::
|
||||
:: ::
|
||||
+$ poke :: dill to userspace
|
||||
$: ses=@tas :: target session
|
||||
dill-belt :: input
|
||||
== ::
|
||||
-- ::dill
|
||||
:: ::::
|
||||
:::: ++eyre :: (1e) http-server
|
||||
@ -1634,7 +1621,6 @@
|
||||
+$ gift :: outgoing result
|
||||
$% [%boon payload=*] :: ames response
|
||||
[%done error=(unit error:ames)] :: ames message (n)ack
|
||||
[%onto p=(each suss tang)] :: about agent
|
||||
[%unto p=sign:agent] ::
|
||||
== ::
|
||||
+$ task :: incoming request
|
||||
@ -2163,9 +2149,6 @@
|
||||
:: %ames: hear packet
|
||||
::
|
||||
$>(%hear task:ames)
|
||||
:: %dill: hangup
|
||||
::
|
||||
$>(%hook task:dill)
|
||||
:: %clay: external edit
|
||||
::
|
||||
$>(%into task:clay)
|
||||
@ -2181,6 +2164,9 @@
|
||||
:: %eyre: starts handling an backdoor http request
|
||||
::
|
||||
$>(%request-local task:eyre)
|
||||
:: %dill: close session
|
||||
::
|
||||
$>(%shut task:dill)
|
||||
:: %behn: wakeup
|
||||
::
|
||||
$>(%wake task:behn)
|
||||
|
@ -319,7 +319,10 @@
|
||||
task ::
|
||||
== ::
|
||||
$: %d :: to %dill
|
||||
$>(%flog task:dill) ::
|
||||
$> $? %flog ::
|
||||
%text ::
|
||||
== ::
|
||||
task:dill ::
|
||||
== ::
|
||||
$: %g :: to %gall
|
||||
$>(%deal task:gall) ::
|
||||
@ -343,7 +346,6 @@
|
||||
== == ::
|
||||
$: %clay ::
|
||||
$> $? %mere ::
|
||||
%note ::
|
||||
%writ ::
|
||||
== ::
|
||||
gift ::
|
||||
@ -1890,7 +1892,8 @@
|
||||
|= [prefix=@tD paths=(set path)]
|
||||
%+ turn ~(tap in paths)
|
||||
|= =path
|
||||
[u.hun %give %note prefix (path-to-tank path)]
|
||||
^- move
|
||||
[u.hun %pass /note %d %text prefix ' ' ~(ram re (path-to-tank path))]
|
||||
::
|
||||
++ path-to-tank
|
||||
|= =path
|
||||
@ -4788,7 +4791,6 @@
|
||||
q.p.p.+.hin
|
||||
[~ ..^$]
|
||||
::
|
||||
%note [[hen %give +.hin]~ ..^$]
|
||||
%wake
|
||||
:: TODO: handle behn errors
|
||||
::
|
||||
|
@ -8,27 +8,25 @@
|
||||
-- ::
|
||||
=> |% :: console protocol
|
||||
+$ axle ::
|
||||
$: %4 ::TODO replace ducts with session ids ::
|
||||
$: %5 ::
|
||||
hey=(unit duct) :: default duct
|
||||
dug=(map duct axon) :: conversations
|
||||
eye=(jug duct duct) :: outside listeners
|
||||
dug=(map @tas axon) :: conversations
|
||||
eye=(jug @tas duct) :: outside listeners
|
||||
lit=? :: boot in lite mode
|
||||
$= veb :: vane verbosities
|
||||
$~ (~(put by *(map @tas log-level)) %hole %soft) :: quiet packet crashes
|
||||
(map @tas log-level) ::
|
||||
== ::
|
||||
+$ axon :: dill per duct
|
||||
+$ axon :: dill session
|
||||
$: ram=term :: console program
|
||||
tem=(unit (list dill-belt)) :: pending, reverse
|
||||
wid=_80 :: terminal width
|
||||
pos=@ud :: cursor position
|
||||
see=$%([%lin (list @c)] [%klr stub]) :: current line
|
||||
== ::
|
||||
+$ log-level ?(%hush %soft %loud) :: none, line, full
|
||||
-- => ::
|
||||
|% :: protocol outward
|
||||
+$ mess ::
|
||||
$% [%dill-belt p=(hypo dill-belt)] ::
|
||||
$% [%dill-poke p=(hypo poke)] ::
|
||||
== ::
|
||||
+$ move [p=duct q=(wind note gift)] :: local move
|
||||
+$ note :: out request $->
|
||||
@ -72,7 +70,6 @@
|
||||
== == ::
|
||||
$: %clay ::
|
||||
$> $? %mere ::
|
||||
%note ::
|
||||
%writ ::
|
||||
== ::
|
||||
gift:clay ::
|
||||
@ -81,10 +78,7 @@
|
||||
$>(%blit gift:dill) ::
|
||||
== ::
|
||||
$: %gall ::
|
||||
$> $? %onto ::
|
||||
%unto ::
|
||||
== ::
|
||||
gift:gall ::
|
||||
$>(%unto gift:gall) ::
|
||||
== == ::
|
||||
:::::::: :: dill tiles
|
||||
--
|
||||
@ -94,39 +88,27 @@
|
||||
|%
|
||||
++ as :: per cause
|
||||
=| moz=(list move)
|
||||
|_ [hen=duct axon]
|
||||
|_ [hen=duct ses=@tas axon]
|
||||
++ abet :: resolve
|
||||
^- [(list move) axle]
|
||||
[(flop moz) all(dug (~(put by dug.all) hen +<+))]
|
||||
[(flop moz) all(dug (~(put by dug.all) ses +<+>))]
|
||||
::
|
||||
++ call :: receive input
|
||||
|= kyz=task
|
||||
^+ +>
|
||||
?+ -.kyz ~& [%strange-kiss -.kyz] +>
|
||||
%flow +>
|
||||
%harm +>
|
||||
%hail (send %hey ~)
|
||||
%text (from %out (tuba p.kyz))
|
||||
%belt (send `dill-belt`p.kyz)
|
||||
%talk (talk p.kyz)
|
||||
%text (fore (tuba p.kyz) ~)
|
||||
%crud :: (send `dill-belt`[%cru p.kyz q.kyz])
|
||||
(crud p.kyz q.kyz)
|
||||
%blew (send %rez p.p.kyz q.p.kyz)
|
||||
%blew (send(wid p.p.kyz) %rez p.p.kyz q.p.kyz)
|
||||
%heft (pass /whey %$ whey/~)
|
||||
%meld (dump kyz)
|
||||
%pack (dump kyz)
|
||||
%crop (dump trim+p.kyz)
|
||||
%verb (pass /verb %$ kyz)
|
||||
::
|
||||
%belt
|
||||
%- send
|
||||
::TMP forwards compatibility with next-dill
|
||||
::
|
||||
?@ p.kyz [%txt p.kyz ~]
|
||||
?: ?=(%hit -.p.kyz) [%txt ~]
|
||||
?. ?=(%mod -.p.kyz) p.kyz
|
||||
=/ =@c
|
||||
?@ key.p.kyz key.p.kyz
|
||||
?:(?=(?(%bac %del %ret) -.key.p.kyz) `@`-.key.p.kyz ~-)
|
||||
?:(?=(%met mod.p.kyz) [%met c] [%ctl c])
|
||||
==
|
||||
::
|
||||
++ crud
|
||||
@ -136,30 +118,30 @@
|
||||
=/ lev=log-level (~(gut by veb.all) err %loud)
|
||||
:: apply log level for this error tag
|
||||
::
|
||||
=/ =wall
|
||||
?- lev
|
||||
%hush ~
|
||||
%soft ~["crud: %{(trip err)} event failed"]
|
||||
%loud :- "crud: %{(trip err)} event failed"
|
||||
%- zing
|
||||
%+ turn (flop tac)
|
||||
|=(a=tank (~(win re a) [0 wid]))
|
||||
==
|
||||
|- ^+ +>.^$
|
||||
?~ wall +>.^$
|
||||
$(wall t.wall, +>.^$ (from %out (tuba i.wall)))
|
||||
?- lev
|
||||
%hush +>.$
|
||||
%soft (fore (tuba "crud: %{(trip err)} event failed") ~)
|
||||
%loud (talk leaf+"crud: %{(trip err)} event failed" (flop tac))
|
||||
==
|
||||
::
|
||||
++ talk
|
||||
|= tac=(list tank)
|
||||
%- fore
|
||||
%- zing
|
||||
%+ turn tac
|
||||
|= a=tank
|
||||
(turn (~(win re a) [0 wid]) tuba)
|
||||
::
|
||||
++ dump :: pass down to hey
|
||||
|= git=gift
|
||||
?> ?=(^ hey.all)
|
||||
+>(moz [[u.hey.all %give git] moz])
|
||||
::
|
||||
++ done :: return gift
|
||||
++ done :: gift to viewers
|
||||
|= git=gift
|
||||
=- +>.$(moz (weld - moz))
|
||||
%+ turn
|
||||
:- hen
|
||||
~(tap in (~(get ju eye.all) hen))
|
||||
~(tap in (~(get ju eye.all) ses))
|
||||
|=(=duct [duct %give git])
|
||||
::
|
||||
++ deal :: pass to %gall
|
||||
@ -170,6 +152,30 @@
|
||||
|= [=wire =note]
|
||||
+>(moz :_(moz [hen %pass wire note]))
|
||||
::
|
||||
++ fore :: send dill output
|
||||
::NOTE there are still implicit assumptions
|
||||
:: about the underlying console app's
|
||||
:: semantics here. specifically, trailing
|
||||
:: newlines are important to not getting
|
||||
:: overwritten by the drum prompt, and a
|
||||
:: bottom-of-screen cursor position gives
|
||||
:: nicest results. a more agnostic solution
|
||||
:: will need to replace this arm, someday.
|
||||
:: perhaps +send this to .ram instead?
|
||||
::
|
||||
|= liz=(list (list @c))
|
||||
~? !=(%$ ses) [%d %foreing-in-session ses]
|
||||
^+ +>
|
||||
=. +>
|
||||
=| biz=(list blit)
|
||||
|- ^+ +>.^$
|
||||
?~ liz (done %blit [%hop 0] [%wyp ~] biz)
|
||||
$(liz t.liz, biz (welp biz [%put i.liz] [%nel ~] ~))
|
||||
:: since dill is acting on its own accord,
|
||||
:: we %hey the term app so it may clean up.
|
||||
::
|
||||
(send %hey ~)
|
||||
::
|
||||
++ from :: receive blit
|
||||
|= bit=dill-blit
|
||||
^+ +>
|
||||
@ -177,34 +183,6 @@
|
||||
|- ^+ +>.^$
|
||||
?~ p.bit +>.^$
|
||||
$(p.bit t.p.bit, +>.^$ ^$(bit i.p.bit))
|
||||
?: ?=(%out -.bit)
|
||||
%+ done %blit
|
||||
:~ [%lin p.bit]
|
||||
[%mor ~]
|
||||
see
|
||||
[%hop pos]
|
||||
==
|
||||
?: ?=(%klr -.bit)
|
||||
%+ done %blit
|
||||
:~ [%klr p.bit]
|
||||
[%mor ~]
|
||||
see
|
||||
[%hop pos]
|
||||
==
|
||||
?: ?=(%pro -.bit)
|
||||
=. see [%lin p.bit]
|
||||
(done %blit [see [%hop pos] ~])
|
||||
?: ?=(%pom -.bit)
|
||||
::NOTE treat "styled prompt" without style as plain prompt,
|
||||
:: to allow rendering by older runtimes
|
||||
::TODO remove me once v0.10.9+ has high/guaranteed adoption
|
||||
::
|
||||
?: (levy p.bit (cork head |*(s=stye =(*stye s))))
|
||||
$(bit [%pro (zing (turn p.bit tail))])
|
||||
=. see [%klr p.bit]
|
||||
(done %blit [see [%hop pos] ~])
|
||||
?: ?=(%hop -.bit)
|
||||
(done(pos p.bit) %blit [bit ~])
|
||||
?: ?=(%qit -.bit)
|
||||
(dump %logo ~)
|
||||
(done %blit [bit ~])
|
||||
@ -241,18 +219,33 @@
|
||||
=. tem `(turn gyl |=(a=gill [%yow a]))
|
||||
(pass / [%c %warp our %home `[%sing %y [%ud 1] /]])
|
||||
::
|
||||
++ open
|
||||
|= gyl=(list gill)
|
||||
=. +> (pass / %g %conf ram)
|
||||
=. +> peer
|
||||
%+ roll gyl
|
||||
|= [g=gill _..open]
|
||||
(send [%yow g])
|
||||
::
|
||||
++ shut
|
||||
::TODO send a %bye blit?
|
||||
pull(eye.all (~(del by eye.all) ses))
|
||||
::
|
||||
++ send :: send action
|
||||
|= bet=dill-belt
|
||||
^+ +>
|
||||
?^ tem
|
||||
+>(tem `[bet u.tem])
|
||||
(deal / [%poke [%dill-belt -:!>(bet) bet]])
|
||||
(deal /send/[ses] [%poke [%dill-poke !>([ses bet])]])
|
||||
::
|
||||
++ hood-set-boot-apps
|
||||
(deal / [%poke %drum-set-boot-apps !>(lit.all)])
|
||||
::
|
||||
++ peer
|
||||
(deal / [%watch /drum])
|
||||
(deal /peer/[ses] %watch /dill/[ses])
|
||||
::
|
||||
++ pull
|
||||
(deal /peer/[ses] %leave ~)
|
||||
::
|
||||
++ show :: permit reads on desk
|
||||
|= des=desk
|
||||
@ -266,13 +259,6 @@
|
||||
|= [tea=wire sih=sign]
|
||||
^+ +>
|
||||
?- sih
|
||||
[%gall %onto *]
|
||||
:: ~& [%take-gall-onto +>.sih]
|
||||
?- -.+>.sih
|
||||
%| (crud %onto p.p.+>.sih)
|
||||
%& (done %blit [%lin (tuba "{<p.p.sih>}")]~)
|
||||
==
|
||||
::
|
||||
[%gall %unto *]
|
||||
:: ~& [%take-gall-unto +>.sih]
|
||||
?- -.+>.sih
|
||||
@ -288,9 +274,6 @@
|
||||
+>.$
|
||||
(from ;;(dill-blit q.q.cage.p.+>.sih))
|
||||
==
|
||||
::
|
||||
[%clay %note *]
|
||||
(from %out (tuba p.sih ' ' ~(ram re q.sih)))
|
||||
::
|
||||
[?(%behn %clay) %writ *]
|
||||
init
|
||||
@ -305,12 +288,20 @@
|
||||
==
|
||||
--
|
||||
::
|
||||
++ ax :: make ++as
|
||||
|= hen=duct
|
||||
++ ax :: make ++as from name
|
||||
|= [hen=duct ses=@tas]
|
||||
^- (unit _as)
|
||||
=/ nux (~(get by dug.all) hen)
|
||||
=/ nux (~(get by dug.all) ses)
|
||||
?~ nux ~
|
||||
(some ~(. as hen u.nux))
|
||||
(some ~(. as hen ses u.nux))
|
||||
::
|
||||
++ aw :: make ++as from wire
|
||||
|= [hen=duct wir=wire]
|
||||
^- (unit _as)
|
||||
%+ ax hen
|
||||
?+ wir %$
|
||||
[?(%peer %send) @ *] i.t.wir
|
||||
==
|
||||
--
|
||||
|% :: poke+peek pattern
|
||||
++ call :: handle request
|
||||
@ -321,7 +312,10 @@
|
||||
^+ [*(list move) ..^$]
|
||||
~| wrapped-task
|
||||
=/ task=task ((harden task) wrapped-task)
|
||||
:: unwrap session tasks, default to session %$
|
||||
::
|
||||
=^ ses=@tas task
|
||||
?:(?=(%shot -.task) +.task [%$ task])
|
||||
:: error notifications "downcast" to %crud
|
||||
::
|
||||
=? task ?=(^ dud)
|
||||
@ -351,10 +345,11 @@
|
||||
::
|
||||
=* duc (need hey.all)
|
||||
=/ app %hood
|
||||
=/ see (tuba "<awaiting {(trip app)}, this may take a minute>")
|
||||
=/ zon=axon [app input=[~ ~] width=80 cursor=(lent see) lin+see]
|
||||
=/ say (tuba "<awaiting {(trip app)}, this may take a minute>")
|
||||
=/ zon=axon [app input=[~ ~] width=80]
|
||||
::
|
||||
=^ moz all abet:(~(into as duc zon) ~)
|
||||
=^ moz all abet:(~(into as duc %$ zon) ~)
|
||||
=. eye.all (~(put ju eye.all) %$ duc)
|
||||
[moz ..^$]
|
||||
:: %flog tasks are unwrapped and sent back to us on our default duct
|
||||
::
|
||||
@ -375,35 +370,55 @@
|
||||
?: ?=(%knob -.task)
|
||||
=. veb.all (~(put by veb.all) tag.task level.task)
|
||||
[~ ..^$]
|
||||
:: %open opens a new dill session
|
||||
::
|
||||
?: ?=(%open -.task)
|
||||
?: (~(has by dug.all) ses)
|
||||
::TODO should we allow, and just send the %yow blits?
|
||||
~| [%cannot-open-existing ses]
|
||||
!!
|
||||
=/ zon=axon [p.task ~ width=80]
|
||||
=^ moz all abet:(~(open as hen ses zon) q.task)
|
||||
=. eye.all (~(put ju eye.all) ses hen)
|
||||
[moz ..^$]
|
||||
:: %shut closes an existing dill session
|
||||
::
|
||||
?: ?=(%shut -.task)
|
||||
?: =(%$ ses)
|
||||
~| %cannot-shut-default-session
|
||||
!!
|
||||
=/ nus
|
||||
~| [%no-session ses]
|
||||
(need (ax hen ses))
|
||||
=^ moz all abet:shut:nus
|
||||
[moz ..^$]
|
||||
:: %view opens a subscription to the target session, on the current duct
|
||||
::
|
||||
?: ?=(%view -.task)
|
||||
:: crash on viewing non-existent session
|
||||
=/ nus
|
||||
:: crash on viewing non-existent session
|
||||
::
|
||||
~| [%no-session ses]
|
||||
(need (ax hen ses))
|
||||
:: register the viewer and send a %hey so they get the full screen
|
||||
::
|
||||
~| [%no-session session.task]
|
||||
?> =(~ session.task)
|
||||
=/ session (need hey.all)
|
||||
=/ =axon (~(got by dug.all) session)
|
||||
:: register the viewer and send them the prompt line
|
||||
::
|
||||
:- [hen %give %blit [see.axon]~]~
|
||||
..^$(eye.all (~(put ju eye.all) session hen))
|
||||
=^ moz all
|
||||
abet:(send:nus %hey ~)
|
||||
:- moz
|
||||
..^$(eye.all (~(put ju eye.all) ses hen))
|
||||
:: %flee closes a subscription to the target session, from the current duct
|
||||
::
|
||||
?: ?=(%flee -.task)
|
||||
:- ~
|
||||
~| [%no-session session.task]
|
||||
?> =(~ session.task)
|
||||
=/ session (need hey.all)
|
||||
..^$(eye.all (~(del ju eye.all) session hen))
|
||||
..^$(eye.all (~(del ju eye.all) ses hen))
|
||||
::
|
||||
=/ nus (ax hen)
|
||||
=? nus &(?=(~ nus) ?=(^ hey.all))
|
||||
::TODO allow specifying target session in task
|
||||
(ax u.hey.all)
|
||||
=/ nus
|
||||
(ax hen ses)
|
||||
?~ nus
|
||||
:: :hen is an unrecognized duct
|
||||
:: session :ses does not exist
|
||||
:: could be before %boot (or %boot failed)
|
||||
::
|
||||
~& [%dill-call-no-flow hen -.task]
|
||||
~& [%dill-call-no-session ses hen -.task]
|
||||
=/ tan ?:(?=(%crud -.task) q.task ~)
|
||||
[((slog (flop tan)) ~) ..^$]
|
||||
::
|
||||
@ -411,8 +426,63 @@
|
||||
[moz ..^$]
|
||||
::
|
||||
++ load :: import old state
|
||||
|= old=axle
|
||||
..^$(all old)
|
||||
=< |= old=any-axle
|
||||
?- -.old
|
||||
%5 ..^$(all old)
|
||||
%4 $(old (axle-4-to-5 old))
|
||||
==
|
||||
|%
|
||||
+$ any-axle $%(axle axle-4)
|
||||
::
|
||||
+$ axle-4
|
||||
$: %4
|
||||
hey=(unit duct)
|
||||
dug=(map duct axon-4)
|
||||
eye=(jug duct duct)
|
||||
lit=?
|
||||
veb=(map @tas log-level)
|
||||
==
|
||||
::
|
||||
+$ axon-4
|
||||
$: ram=term
|
||||
tem=(unit (list dill-belt-4))
|
||||
wid=_80
|
||||
pos=$@(@ud [@ud @ud])
|
||||
see=$%([%lin (list @c)] [%klr stub])
|
||||
==
|
||||
::
|
||||
+$ dill-belt-4
|
||||
$% [%ctl p=@c]
|
||||
[%met p=@c]
|
||||
dill-belt
|
||||
==
|
||||
::
|
||||
++ axle-4-to-5
|
||||
|= axle-4
|
||||
^- axle
|
||||
:- %5
|
||||
=- [hey nug nay lit veb]
|
||||
%+ roll ~(tap by dug)
|
||||
|= [[=duct =axon-4] nug=(map @tas axon) nay=(jug @tas duct)]
|
||||
=/ ses=@tas
|
||||
~| [%unexpected-duct duct]
|
||||
?>(=([//term/1]~ duct) %$)
|
||||
:- (~(put by nug) ses (axon-4-to-5 axon-4))
|
||||
%+ ~(put by nay) ses
|
||||
(~(put in (~(get ju eye) duct)) duct)
|
||||
::
|
||||
++ axon-4-to-5
|
||||
|= axon-4
|
||||
^- axon
|
||||
=; tem [ram tem wid]
|
||||
?~ tem ~
|
||||
%- some
|
||||
%+ turn u.tem
|
||||
|= b=dill-belt-4
|
||||
^- dill-belt
|
||||
?. ?=(?(%ctl %met) -.b) b
|
||||
[%mod -.b p.b]
|
||||
--
|
||||
::
|
||||
++ scry
|
||||
^- roon
|
||||
@ -441,19 +511,12 @@
|
||||
=(%$ syd)
|
||||
==
|
||||
~
|
||||
:: /dx/sessions//line blit current line (prompt) of default session
|
||||
:: /dx/sessions//cursor @ud current cursor position of default session
|
||||
::TODO support asking for specific sessions once session ids are real
|
||||
:: /dy/sessions (set @tas) all existing sessions
|
||||
:: /du/sessions/[ses] ? does session ses exist?
|
||||
::
|
||||
?. ?=(%x ren) ~
|
||||
?+ tyl ~
|
||||
[%sessions %$ *]
|
||||
?~ hey.all [~ ~]
|
||||
?~ session=(~(get by dug.all) u.hey.all) [~ ~]
|
||||
?+ t.t.tyl ~
|
||||
[%line ~] ``blit+!>(`blit`see.u.session)
|
||||
[%cursor ~] ``atom+!>(pos.u.session)
|
||||
==
|
||||
?+ [ren tyl] ~
|
||||
[%y %sessions ~] ``noun+!>(~(key by dug.all))
|
||||
[%u %sessions @ ~] ``noun+!>((~(has by dug.all) (snag 1 tyl)))
|
||||
==
|
||||
::
|
||||
++ stay all
|
||||
@ -464,12 +527,11 @@
|
||||
?^ dud
|
||||
~|(%dill-take-dud (mean tang.u.dud))
|
||||
::
|
||||
=/ nus (ax hen)
|
||||
=/ nus (aw hen tea)
|
||||
?~ nus
|
||||
:: :hen is an unrecognized duct
|
||||
:: could be before %boot (or %boot failed)
|
||||
:: :tea points to an unrecognized session
|
||||
::
|
||||
~& [%dill-take-no-flow hen -.hin +<.hin]
|
||||
~& [%dill-take-no-session tea -.hin +<.hin]
|
||||
[~ ..^$]
|
||||
=^ moz all abet:(take:u.nus tea hin)
|
||||
[moz ..^$]
|
||||
|
@ -266,12 +266,22 @@
|
||||
:: +mo-abet: finalize, reversing moves
|
||||
:: +mo-pass: prepend a standard %pass to the current list of moves
|
||||
:: +mo-give: prepend a standard %give to the current list of moves
|
||||
:: +mo-talk: build task to print config report or failure trace
|
||||
::
|
||||
++ mo-core .
|
||||
++ mo-abed |=(hun=duct mo-core(hen hun))
|
||||
++ mo-abet [(flop moves) gall-payload]
|
||||
++ mo-pass |=(p=[wire note-arvo] mo-core(moves [[hen pass+p] moves]))
|
||||
++ mo-give |=(g=gift mo-core(moves [[hen give+g] moves]))
|
||||
++ mo-talk
|
||||
|= rup=(each suss tang)
|
||||
^- [wire note-arvo]
|
||||
:+ /sys/say %d
|
||||
^- task:dill
|
||||
?- -.rup
|
||||
%& [%text "gall: {(t q)}ed %{(t p)}":[t=trip p.rup]]
|
||||
%| [%talk leaf+"gall: failed" (flop p.rup)]
|
||||
==
|
||||
:: +mo-boot: ask %ford to build us a core for the specified agent.
|
||||
::
|
||||
++ mo-boot
|
||||
@ -349,12 +359,12 @@
|
||||
=/ ap-core +.wag
|
||||
?^ maybe-tang
|
||||
=. mo-core old
|
||||
(mo-give %onto %.n u.maybe-tang)
|
||||
(mo-pass (mo-talk %.n u.maybe-tang))
|
||||
::
|
||||
=. mo-core ap-abet:ap-core
|
||||
=. mo-core (mo-clear-queue dap)
|
||||
=/ =suss [dap %boot now]
|
||||
(mo-give %onto [%.y suss])
|
||||
(mo-pass (mo-talk %.y suss))
|
||||
:: +mo-subscribe-to-agent-builds: request agent update notices
|
||||
::
|
||||
:: Also subscribe to our own source path, in case we get reloaded
|
||||
@ -544,7 +554,7 @@
|
||||
++ fail
|
||||
|= =tang
|
||||
^+ mo-core
|
||||
=. mo-core (mo-give %onto |+tang)
|
||||
=. mo-core (mo-pass (mo-talk |+tang))
|
||||
=/ =case [%da tim]
|
||||
=/ =wire /sys/cor/[dap]/[her]/[desk]/(scot case)
|
||||
(mo-pass wire %c %warp p.beak desk ~ %next %a case /app/[dap]/hoon)
|
||||
@ -1019,8 +1029,8 @@
|
||||
::
|
||||
=/ running (~(put by yokes.state) agent-name current-agent)
|
||||
=/ moves
|
||||
=/ giver |=(report=(each suss tang) [hen %give %onto report])
|
||||
=/ from-suss (turn agent-config giver)
|
||||
=/ talker |=(report=(each suss tang) [hen %pass (mo-talk report)])
|
||||
=/ from-suss (turn agent-config talker)
|
||||
:(weld agent-moves from-suss moves)
|
||||
::
|
||||
%_ mo-core
|
||||
|
@ -107,11 +107,8 @@
|
||||
$>(%wake gift:behn) ::
|
||||
== ::
|
||||
$: %gall ::
|
||||
$> $? %onto ::
|
||||
%unto ::
|
||||
== ::
|
||||
gift:gall ::
|
||||
==
|
||||
$>(%unto gift:gall) ::
|
||||
== ::
|
||||
== ::
|
||||
-- ::
|
||||
:: ::::
|
||||
@ -557,10 +554,6 @@
|
||||
=/ ships (~(get ju ship-sources-reverse.etn) source-id)
|
||||
%- curd =< abet
|
||||
(sources:~(feel su hen now pki etn) ships source)
|
||||
::
|
||||
[%gall %onto *]
|
||||
~& [%jael-onto tea hin]
|
||||
+>.$
|
||||
::
|
||||
[%gall %unto *]
|
||||
?- +>-.hin
|
||||
|
@ -3728,6 +3728,107 @@
|
||||
~
|
||||
(some (~(run by lum) need))
|
||||
-- ::dejs-soft
|
||||
::
|
||||
++ klr :: styx/stub engine
|
||||
=, dill
|
||||
|%
|
||||
++ make :: stub from styx
|
||||
|= a=styx ^- stub
|
||||
=| b=stye
|
||||
%+ reel
|
||||
|- ^- stub
|
||||
%- zing %+ turn a
|
||||
|= a=$@(@t (pair styl styx))
|
||||
?@ a [b (tuba (trip a))]~
|
||||
^$(a q.a, b (styd p.a b))
|
||||
::
|
||||
|= [a=(pair stye (list @c)) b=stub]
|
||||
?~ b [a ~]
|
||||
?. =(p.a p.i.b) [a b]
|
||||
[[p.a (weld q.a q.i.b)] t.b]
|
||||
::
|
||||
++ styd :: stye from styl
|
||||
|= [a=styl b=stye] ^+ b :: with inheritance
|
||||
:+ ?~ p.a p.b
|
||||
?~ u.p.a ~
|
||||
(~(put in p.b) u.p.a)
|
||||
(fall p.q.a p.q.b)
|
||||
(fall q.q.a q.q.b)
|
||||
::
|
||||
++ lent-char
|
||||
|= a=stub ^- @
|
||||
(roll (lnts-char a) add)
|
||||
::
|
||||
++ lnts-char :: stub text lengths
|
||||
|= a=stub ^- (list @)
|
||||
%+ turn a
|
||||
|= a=(pair stye (list @c))
|
||||
(lent q.a)
|
||||
::
|
||||
++ brek :: index + incl-len of
|
||||
|= [a=@ b=(list @)] :: stub pair w/ idx a
|
||||
=| [c=@ i=@]
|
||||
|- ^- (unit (pair @ @))
|
||||
?~ b ~
|
||||
=. c (add c i.b)
|
||||
?: (gte c a)
|
||||
`[i c]
|
||||
$(i +(i), b t.b)
|
||||
::
|
||||
++ pact :: condense stub
|
||||
|= a=stub
|
||||
^- stub
|
||||
?~ a ~
|
||||
?~ t.a a
|
||||
?. =(p.i.a p.i.t.a) [i.a $(a t.a)]
|
||||
=. q.i.t.a (weld q.i.a q.i.t.a)
|
||||
$(a t.a)
|
||||
::
|
||||
++ slag :: slag stub
|
||||
|= [a=@ b=stub]
|
||||
^- stub
|
||||
=+ c=(lnts-char b)
|
||||
=+ i=(brek a c)
|
||||
?~ i ~
|
||||
=+ r=(^slag +(p.u.i) b)
|
||||
?: =(a q.u.i)
|
||||
r
|
||||
=+ n=(snag p.u.i b)
|
||||
:_ r :- p.n
|
||||
(^slag (sub (snag p.u.i c) (sub q.u.i a)) q.n)
|
||||
::
|
||||
++ scag :: scag stub
|
||||
|= [a=@ b=stub]
|
||||
^- stub
|
||||
=+ c=(lnts-char b)
|
||||
=+ i=(brek a c)
|
||||
?~ i b
|
||||
?: =(a q.u.i)
|
||||
(^scag +(p.u.i) b)
|
||||
%+ welp
|
||||
(^scag p.u.i b)
|
||||
=+ n=(snag p.u.i b)
|
||||
:_ ~ :- p.n
|
||||
(^scag (sub (snag p.u.i c) (sub q.u.i a)) q.n)
|
||||
::
|
||||
++ swag :: swag stub
|
||||
|= [[a=@ b=@] c=stub]
|
||||
(scag b (slag a c))
|
||||
::
|
||||
++ wail :: overlay stub
|
||||
|= [a=stub b=@ c=stub d=@c]
|
||||
^- stub
|
||||
;: weld
|
||||
(scag b a)
|
||||
::
|
||||
=+ e=(lent-char a)
|
||||
?: (lte b e) ~
|
||||
[*stye (reap (sub b e) d)]~
|
||||
::
|
||||
c
|
||||
(slag (add b (lent-char c)) a)
|
||||
==
|
||||
-- :: klr
|
||||
--
|
||||
:: ::
|
||||
:::: ++differ :: (2d) hunt-mcilroy
|
||||
|
@ -17,15 +17,16 @@
|
||||
%+ roll blits
|
||||
|= [b=blit:dill line=tape]
|
||||
?- -.b
|
||||
%lin (tape p.b)
|
||||
%put (tape p.b)
|
||||
%klr (tape (zing (turn p.b tail)))
|
||||
%mor ~& "{<who>}: {line}" ""
|
||||
%nel ~& "{<who>}: {line}" ""
|
||||
%hop line
|
||||
%bel line
|
||||
%clr ""
|
||||
%sag ~& [%save-jamfile-to p.b] line
|
||||
%sav ~& [%save-file-to p.b] line
|
||||
%url ~& [%activate-url p.b] line
|
||||
%wyp ""
|
||||
==
|
||||
~? !=(~ last-line) last-line
|
||||
~
|
||||
|
@ -119,15 +119,25 @@ deriveNoun ''BehnEf
|
||||
data Blit
|
||||
= Bel ()
|
||||
| Clr ()
|
||||
| Hop Word64
|
||||
| Hop HopTarget
|
||||
| Klr Stub
|
||||
| Lin [Char]
|
||||
| Mor ()
|
||||
| Put [Char]
|
||||
| Nel ()
|
||||
| Sag Path Noun
|
||||
| Sav Path Atom
|
||||
| Url Cord
|
||||
| Wyp ()
|
||||
--TMP backwards compatibility
|
||||
| Lin [Char]
|
||||
| Mor ()
|
||||
deriving (Eq, Ord)
|
||||
|
||||
--NOTE bottom-left-0-based coordinates
|
||||
data HopTarget
|
||||
= Col Word64
|
||||
| Roc Word64 Word64 -- row, col
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
data Deco
|
||||
= DecoBl
|
||||
| DecoBr
|
||||
@ -205,18 +215,33 @@ instance FromNoun Tint where
|
||||
"w" -> pure TintW
|
||||
t -> fail ("invalid: " <> unpack t)
|
||||
|
||||
instance FromNoun HopTarget where
|
||||
parseNoun = \case
|
||||
A c -> pure $ Col (fromIntegral c)
|
||||
C (A r) (A c) -> pure $ Roc (fromIntegral r) (fromIntegral c)
|
||||
n -> fail ("invalid hop target: " <> show n)
|
||||
|
||||
instance ToNoun HopTarget where
|
||||
toNoun = \case
|
||||
Col c -> A (fromIntegral c)
|
||||
Roc r c -> C (A (fromIntegral r)) (A (fromIntegral c))
|
||||
|
||||
-- Manual instance to not save the noun/atom in Sag/Sav, because these can be
|
||||
-- megabytes and makes king hang.
|
||||
instance Show Blit where
|
||||
show (Bel ()) = "Bel ()"
|
||||
show (Clr ()) = "Clr ()"
|
||||
show (Hop x) = "Hop " ++ (show x)
|
||||
show (Hop t) = "Hop " ++ (show t)
|
||||
show (Klr s) = "Klr " ++ (show s)
|
||||
show (Lin c) = "Lin " ++ (show c)
|
||||
show (Mor ()) = "Mor ()"
|
||||
show (Put c) = "Put " ++ (show c)
|
||||
show (Nel ()) = "Nel ()"
|
||||
show (Sag path _) = "Sag " ++ (show path)
|
||||
show (Sav path _) = "Sav " ++ (show path)
|
||||
show (Url c) = "Url " ++ (show c)
|
||||
show (Wyp ()) = "Wyp ()"
|
||||
--
|
||||
show (Lin c) = "Lin " ++ (show c)
|
||||
show (Mor ()) = "Mor ()"
|
||||
|
||||
{-|
|
||||
%blip -- TODO
|
||||
|
@ -20,6 +20,7 @@ import Urbit.Arvo.Common (ReOrg(..), reorgThroughNoun)
|
||||
|
||||
import qualified Crypto.Sign.Ed25519 as Ed
|
||||
import qualified Data.ByteString as BS
|
||||
import qualified Data.Char as C
|
||||
import qualified Data.ByteString.Char8 as C
|
||||
import qualified Network.HTTP.Types.Method as H
|
||||
|
||||
@ -318,19 +319,52 @@ data LegacyBootEvent
|
||||
| Dawn Dawn
|
||||
deriving (Eq, Show)
|
||||
|
||||
data ArrowKey = D | L | R | U
|
||||
data Bolt
|
||||
= Key Char
|
||||
| Aro ArrowKey
|
||||
| Bac ()
|
||||
| Del ()
|
||||
| Hit Word64 Word64
|
||||
| Ret ()
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
data Belt
|
||||
= Aro ArrowKey
|
||||
| Bac ()
|
||||
| Ctl Cord
|
||||
| Del ()
|
||||
| Met Cord
|
||||
| Ret ()
|
||||
= Bol Bolt
|
||||
| Mod Modifier Bolt
|
||||
| Txt Tour
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
data ArrowKey = D | L | R | U
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
data Modifier = Ctl | Met | Hyp
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
--NOTE required to get the above declarations into reify's type environment
|
||||
-- see also ghc/ghc#9813
|
||||
$(pure [])
|
||||
|
||||
instance FromNoun Bolt where
|
||||
parseNoun = \case
|
||||
A c -> pure $ Key $ C.chr $ fromIntegral c
|
||||
C (A 7955819) _ -> fail "%key not valid bolt tag"
|
||||
n -> $(deriveFromNounFunc ''Bolt) n
|
||||
|
||||
instance FromNoun Belt where
|
||||
parseNoun = \case
|
||||
C (A 7106402) _ -> fail "%bol not valid belt tag"
|
||||
n -> Bol <$> parseNoun n <|> $(deriveFromNounFunc ''Belt) n
|
||||
|
||||
instance ToNoun Bolt where
|
||||
toNoun = \case
|
||||
Key c -> A $ fromIntegral $ C.ord c
|
||||
n -> $(deriveToNounFunc ''Bolt) n
|
||||
|
||||
instance ToNoun Belt where
|
||||
toNoun = \case
|
||||
Bol b -> toNoun b
|
||||
n -> $(deriveToNounFunc ''Belt) n
|
||||
|
||||
data TermEv
|
||||
= TermEvBelt (UD, ()) Belt
|
||||
| TermEvBlew (UD, ()) Word Word
|
||||
@ -341,7 +375,7 @@ data TermEv
|
||||
|
||||
deriveNoun ''LegacyBootEvent
|
||||
deriveNoun ''ArrowKey
|
||||
deriveNoun ''Belt
|
||||
deriveNoun ''Modifier
|
||||
deriveNoun ''TermEv
|
||||
|
||||
|
||||
@ -392,27 +426,23 @@ instance FromNoun Ev where
|
||||
-- Short Event Names -----------------------------------------------------------
|
||||
|
||||
{-
|
||||
In the case of the user hitting enter, the cause is technically a
|
||||
terminal event, but we don't display any name because the cause is
|
||||
really the user.
|
||||
In the case of user input, the cause is technically a terminal event,
|
||||
but we don't display any name because the cause is really the user.
|
||||
-}
|
||||
getSpinnerNameForEvent :: Ev -> Maybe Text
|
||||
getSpinnerNameForEvent = \case
|
||||
EvBlip b -> case b of
|
||||
BlipEvAmes _ -> Just "ames"
|
||||
BlipEvArvo _ -> Just "arvo"
|
||||
BlipEvBehn _ -> Just "behn"
|
||||
BlipEvBoat _ -> Just "boat"
|
||||
BlipEvHttpClient _ -> Just "iris"
|
||||
BlipEvHttpServer _ -> Just "eyre"
|
||||
BlipEvJael _ -> Just "jael"
|
||||
BlipEvNewt _ -> Just "newt"
|
||||
BlipEvSync _ -> Just "clay"
|
||||
BlipEvTerm t | isRet t -> Nothing
|
||||
BlipEvTerm t -> Just "term"
|
||||
where
|
||||
isRet (TermEvBelt _ (Ret ())) = True
|
||||
isRet _ = False
|
||||
BlipEvAmes _ -> Just "ames"
|
||||
BlipEvArvo _ -> Just "arvo"
|
||||
BlipEvBehn _ -> Just "behn"
|
||||
BlipEvBoat _ -> Just "boat"
|
||||
BlipEvHttpClient _ -> Just "iris"
|
||||
BlipEvHttpServer _ -> Just "eyre"
|
||||
BlipEvJael _ -> Just "jael"
|
||||
BlipEvNewt _ -> Just "newt"
|
||||
BlipEvSync _ -> Just "clay"
|
||||
BlipEvTerm (TermEvBelt _ _) -> Nothing
|
||||
BlipEvTerm t -> Just "term"
|
||||
|
||||
summarizeEvent :: Ev -> Text
|
||||
summarizeEvent ev =
|
||||
|
@ -333,7 +333,7 @@ pier (serf, log) vSlog startedSig injected = do
|
||||
io $ readTVarIO siteSlog >>= ($ s)
|
||||
logOther "serf" (display $ T.strip $ tankToText tank)
|
||||
|
||||
let err = atomically . Term.trace muxed . (<> "\r\n")
|
||||
let err = atomically . Term.trace muxed
|
||||
(bootEvents, startDrivers) <- do
|
||||
env <- ask
|
||||
siz <- atomically $ Term.curDemuxSize demux
|
||||
|
@ -45,8 +45,8 @@ import qualified Urbit.Vere.Term.Render as T
|
||||
|
||||
-- | All stateful data in the printing to stdOutput.
|
||||
data LineState = LineState
|
||||
{ lsLine :: Text
|
||||
, lsCurPos :: Int
|
||||
{ lsLine :: [(Stye, [Char])]
|
||||
, lsCurPos :: CurPos
|
||||
, lsSpinTimer :: Maybe (Async ())
|
||||
, lsSpinCause :: Maybe Text
|
||||
, lsSpinFirstRender :: Bool
|
||||
@ -54,11 +54,19 @@ data LineState = LineState
|
||||
, lsPrevEndTime :: Wen
|
||||
}
|
||||
|
||||
data CurPos = CurPos
|
||||
{ row :: Int
|
||||
, col :: Int
|
||||
}
|
||||
|
||||
-- | A record used in reading data from stdInput.
|
||||
data ReadData = ReadData
|
||||
{ rdBuf :: Ptr Word8
|
||||
, rdEscape :: Bool
|
||||
, rdBracket :: Bool
|
||||
, rdMouse :: Bool
|
||||
, rdMouseBut :: Word8
|
||||
, rdMouseCol :: Word8
|
||||
, rdUTF8 :: ByteString
|
||||
, rdUTF8width :: Int
|
||||
}
|
||||
@ -165,7 +173,8 @@ leftBracket, rightBracket :: Text
|
||||
leftBracket = "«"
|
||||
rightBracket = "»"
|
||||
|
||||
_spin_cool_us, _spin_warm_us, _spin_rate_us, _spin_idle_us :: Integral i => i
|
||||
_spin_fast_us, _spin_cool_us, _spin_warm_us, _spin_rate_us, _spin_idle_us :: Integral i => i
|
||||
_spin_fast_us = 100000
|
||||
_spin_cool_us = 500000
|
||||
_spin_warm_us = 50000
|
||||
_spin_rate_us = 250000
|
||||
@ -201,6 +210,9 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
-- to the muxing client.
|
||||
putTMVar tsSizeChange ts)
|
||||
|
||||
-- start mouse reporting
|
||||
putStr "\x1b[?9h"
|
||||
|
||||
pWriterThread <- asyncBound
|
||||
(writeTerminal tsWriteQueue spinnerMVar tsizeTVar)
|
||||
|
||||
@ -217,7 +229,7 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
|
||||
tsReadQueue <- newTQueueIO
|
||||
pReaderThread <- asyncBound
|
||||
(readTerminal tsReadQueue tsWriteQueue (bell tsWriteQueue))
|
||||
(readTerminal tsReadQueue tsWriteQueue tsizeTVar (bell tsWriteQueue))
|
||||
|
||||
let client = Client { take = Just <$> asum
|
||||
[ readTQueue tsReadQueue <&> ClientTakeBelt,
|
||||
@ -238,6 +250,9 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
-- at shutdown, just leak the file descriptor.
|
||||
cancel pWriterThread
|
||||
|
||||
-- stop mouse reporting
|
||||
putStr "\x1b[?9l"
|
||||
|
||||
-- inject one final newline, as we're usually on the prompt.
|
||||
putStr "\r\n"
|
||||
|
||||
@ -266,31 +281,50 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
|
||||
-- Writes data to the terminal. Both the terminal reading, normal logging,
|
||||
-- and effect handling can all emit bytes which go to the terminal.
|
||||
--TODO blanks, traces and slogs should only be written into the default
|
||||
-- terminal session.
|
||||
writeTerminal :: TQueue [Term.Ev] -> TMVar () -> TVar TermSize -> RIO e ()
|
||||
writeTerminal q spinner termSizeVar = do
|
||||
currentTime <- io $ now
|
||||
loop (LineState "" 0 Nothing Nothing True 0 currentTime)
|
||||
loop
|
||||
termSizeVar
|
||||
(LineState [] (CurPos 0 0) Nothing Nothing True 0 currentTime)
|
||||
where
|
||||
writeBlank :: LineState -> RIO e LineState
|
||||
writeBlank ls = putStr "\r\n" $> ls
|
||||
writeBlank ls = do
|
||||
TermSize _ height <- readTVarIO termSizeVar
|
||||
--NOTE hijack creates a blank line
|
||||
T.hijack (fromIntegral height) $ pure ()
|
||||
pure ls
|
||||
|
||||
writeTrace :: LineState -> Text -> RIO e LineState
|
||||
writeTrace ls p = do
|
||||
putStr "\r"
|
||||
T.clearLine
|
||||
putStr p
|
||||
termRefreshLine ls
|
||||
TermSize _ height <- readTVarIO termSizeVar
|
||||
T.hijack (fromIntegral height) $ putStr p
|
||||
pure ls
|
||||
|
||||
writeSlog :: LineState -> (Atom, Tank) -> RIO e LineState
|
||||
writeSlog ls slog = do
|
||||
putStr "\r"
|
||||
T.clearLine
|
||||
TermSize width _ <- atomically $ readTVar termSizeVar
|
||||
-- TODO: Ignoring priority for now. Priority changes the color of,
|
||||
-- and adds a prefix of '>' to, the output.
|
||||
let lines = fmap unTape $ wash (WashCfg 0 width) $ tankTree $ snd slog
|
||||
forM lines $ \line -> putStr (line <> "\r\n")
|
||||
termRefreshLine ls
|
||||
TermSize width height <- readTVarIO termSizeVar
|
||||
T.hijack (fromIntegral height) do
|
||||
let lines = fmap (pref . unTape) $
|
||||
wash (WashCfg 0 width) $ tankTree $ snd slog
|
||||
T.putCsi 'm' styl
|
||||
forM (intersperse "\n" lines) $ \line -> putStr line
|
||||
T.putCsi 'm' [0]
|
||||
pure ls
|
||||
where
|
||||
prio = fromIntegral $ fst slog
|
||||
maxp = 3
|
||||
styl
|
||||
| prio == 3 = [31]
|
||||
| prio == 2 = [33]
|
||||
| prio == 1 = [32]
|
||||
| otherwise = [90]
|
||||
pref
|
||||
| prio > 0 && prio <= maxp =
|
||||
((replicate prio '>' ++ replicate (1 + maxp - prio) ' ') ++)
|
||||
| otherwise = id
|
||||
|
||||
{-
|
||||
Figure out how long to wait to show the spinner. When we
|
||||
@ -305,7 +339,7 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
|
||||
current <- io $ now
|
||||
delay <- pure $ case mTxt of
|
||||
Nothing -> 0
|
||||
Nothing -> _spin_fast_us
|
||||
Just _ ->
|
||||
if (gap current lsPrevEndTime ^. microSecs) < _spin_idle_us
|
||||
then _spin_warm_us
|
||||
@ -326,34 +360,41 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
maybe (pure ()) cancel lsSpinTimer
|
||||
-- We do a final flush of the spinner mvar to ensure we don't
|
||||
-- have a lingering signal which will redisplay the spinner after
|
||||
-- we call termRefreshLine below.
|
||||
-- we call termRestoreLine below.
|
||||
atomically $ tryTakeTMVar spinner
|
||||
|
||||
-- If we ever actually ran the spinner display callback, we need
|
||||
-- to force a redisplay of the command prompt.
|
||||
ls <- if not lsSpinFirstRender || True
|
||||
then termRefreshLine ls
|
||||
else pure ls
|
||||
if not lsSpinFirstRender
|
||||
then termRestoreLine ls termSizeVar
|
||||
else pure ()
|
||||
|
||||
endTime <- io $ now
|
||||
pure $ ls { lsSpinTimer = Nothing, lsPrevEndTime = endTime }
|
||||
|
||||
execEv :: LineState -> Term.Ev -> RIO e LineState
|
||||
execEv ls = \case
|
||||
Term.Blits bs -> foldM writeBlit ls bs
|
||||
Term.Blits bs -> foldM (writeBlit termSizeVar) ls bs
|
||||
Term.Trace p -> writeTrace ls (unCord p)
|
||||
Term.Slog s -> writeSlog ls s
|
||||
Term.Blank -> writeBlank ls
|
||||
Term.Spinr (Just txt) -> doSpin ls (unCord <$> txt)
|
||||
Term.Spinr Nothing -> unspin ls
|
||||
|
||||
-- TODO What does this do?
|
||||
spin :: LineState -> RIO e LineState
|
||||
spin ls@LineState{..} = do
|
||||
spin :: TVar TermSize -> LineState -> RIO e LineState
|
||||
spin ts ls@LineState{..} = do
|
||||
let spinner = (spinners !! lsSpinFrame) ++ case lsSpinCause of
|
||||
Nothing -> ""
|
||||
Just str -> leftBracket ++ str ++ rightBracket
|
||||
|
||||
--NOTE even after first render, because cursor might have moved...
|
||||
if row lsCurPos > 0
|
||||
then do
|
||||
TermSize _ h <- readTVarIO ts
|
||||
T.cursorMove (fromIntegral h - 1) 0
|
||||
else
|
||||
T.cursorRestore
|
||||
|
||||
putStr (spinner <> pack (ANSI.cursorBackwardCode (length spinner)))
|
||||
|
||||
let newFrame = (lsSpinFrame + 1) `mod` length spinners
|
||||
@ -362,28 +403,35 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
, lsSpinFrame = newFrame
|
||||
}
|
||||
|
||||
loop :: LineState -> RIO e ()
|
||||
loop ls = do
|
||||
loop :: TVar TermSize -> LineState -> RIO e ()
|
||||
loop ts ls = do
|
||||
join $ atomically $ asum
|
||||
[ readTQueue q >>= pure . (foldM execEv ls >=> loop)
|
||||
, takeTMVar spinner >> pure (spin ls >>= loop)
|
||||
[ readTQueue q >>= pure . (foldM execEv ls >=> loop ts)
|
||||
, takeTMVar spinner >> pure (spin ts ls >>= loop ts)
|
||||
]
|
||||
|
||||
-- Writes an individual blit to the screen
|
||||
writeBlit :: LineState -> Blit -> RIO e LineState
|
||||
writeBlit ls = \case
|
||||
writeBlit :: TVar TermSize -> LineState -> Blit -> RIO e LineState
|
||||
writeBlit ts ls = \case
|
||||
Bel () -> T.soundBell $> ls
|
||||
Clr () -> do T.clearScreen
|
||||
termRefreshLine ls
|
||||
Hop w -> termShowCursor ls (fromIntegral w)
|
||||
Klr s -> do ls2 <- termShowClear ls
|
||||
termShowStub ls2 s
|
||||
Lin c -> do ls2 <- termShowClear ls
|
||||
termShowLine ls2 (pack c)
|
||||
Mor () -> termShowMore ls
|
||||
T.cursorRestore
|
||||
pure ls
|
||||
Hop t -> case t of
|
||||
Col c -> termShowCursor ls ts 0 (fromIntegral c)
|
||||
Roc r c -> termShowCursor ls ts (fromIntegral r) (fromIntegral c)
|
||||
Klr s -> termShowStub ls s
|
||||
Put c -> termShowLine ls (pack c)
|
||||
Nel () -> termShowNewline ls
|
||||
Sag path noun -> pure ls
|
||||
Sav path atom -> pure ls
|
||||
Url url -> pure ls
|
||||
Wyp () -> termShowClear ls
|
||||
--
|
||||
Lin c -> do termShowCursor ls ts 0 0
|
||||
termShowClear ls
|
||||
termShowLine ls (pack c)
|
||||
Mor () -> termShowNewline ls
|
||||
|
||||
termRenderDeco :: Deco -> Char
|
||||
termRenderDeco = \case
|
||||
@ -428,55 +476,88 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
|
||||
styled = mconcat [escape, styles, "m", tape, escape, "0m"]
|
||||
|
||||
-- Displays and sets styled text as the current line
|
||||
bareStub :: [Char] -> [(Stye, [Char])]
|
||||
bareStub c = [(Stye (setToHoonSet mempty) TintNull TintNull, c)]
|
||||
|
||||
-- overwrite substring of base with put, starting at index
|
||||
overwriteStub :: [(Stye, [Char])] -> Int -> [(Stye, [Char])] -> [(Stye, [Char])]
|
||||
overwriteStub base index put =
|
||||
scagStub index base
|
||||
++ ( let l = lentStub base in
|
||||
if index <= l then []
|
||||
else bareStub $ take (index - l) [' ',' '..]
|
||||
)
|
||||
++ put
|
||||
++ slagStub (index + lentStub put) base
|
||||
where
|
||||
lentStub :: [(Stye, [Char])] -> Int
|
||||
lentStub s = sum $ map (length . snd) s
|
||||
|
||||
scagStub :: Int -> [(Stye, [Char])] -> [(Stye, [Char])]
|
||||
scagStub 0 _ = []
|
||||
scagStub _ [] = []
|
||||
scagStub i ((y,c):s) =
|
||||
(y, take i c) : scagStub (i - min i (length c)) s
|
||||
|
||||
slagStub :: Int -> [(Stye, [Char])] -> [(Stye, [Char])]
|
||||
slagStub 0 s = s
|
||||
slagStub _ [] = []
|
||||
slagStub i ((y,c):s)
|
||||
| i > l = slagStub (i - l) s
|
||||
| otherwise = (y, drop i c) : s
|
||||
where l = length c
|
||||
|
||||
-- Displays styled text at the cursor
|
||||
termShowStub :: LineState -> Stub -> RIO e LineState
|
||||
termShowStub ls (Stub s) = do
|
||||
let visualLength = sum $ fmap (length . snd) s
|
||||
let outText = pack $ mconcat $ fmap (uncurry termRenderStubSegment) s
|
||||
putStr outText
|
||||
pure ls { lsLine = outText, lsCurPos = visualLength }
|
||||
termShowStub ls@LineState{lsCurPos, lsLine} (Stub s) = do
|
||||
putStr $ pack $ mconcat $ fmap (uncurry termRenderStubSegment) s
|
||||
T.cursorRestore
|
||||
case row lsCurPos of
|
||||
0 -> pure ls { lsLine = overwriteStub lsLine (col lsCurPos) s }
|
||||
_ -> pure ls
|
||||
|
||||
-- Moves the cursor to the requested position
|
||||
termShowCursor :: LineState -> Int -> RIO e LineState
|
||||
termShowCursor ls@LineState{..} {-line pos)-} newPos = do
|
||||
if newPos < lsCurPos then do
|
||||
T.cursorLeft (lsCurPos - newPos)
|
||||
pure ls { lsCurPos = newPos }
|
||||
else if newPos > lsCurPos then do
|
||||
T.cursorRight (newPos - lsCurPos)
|
||||
pure ls { lsCurPos = newPos }
|
||||
else
|
||||
pure ls
|
||||
|
||||
-- Moves the cursor left without any mutation of the LineState. Used only
|
||||
-- in cursor spinning.
|
||||
_termSpinnerMoveLeft :: Int -> RIO e ()
|
||||
_termSpinnerMoveLeft = T.cursorLeft
|
||||
termShowCursor :: LineState -> TVar TermSize -> Int -> Int -> RIO e LineState
|
||||
termShowCursor ls ts row col = do
|
||||
TermSize _ h <- readTVarIO ts
|
||||
T.cursorMove (max 0 (fromIntegral h - row - 1)) col
|
||||
T.cursorSave
|
||||
pure ls { lsCurPos = CurPos row col }
|
||||
|
||||
-- Displays and sets the current line
|
||||
termShowLine :: LineState -> Text -> RIO e LineState
|
||||
termShowLine ls newStr = do
|
||||
termShowLine ls@LineState{lsCurPos, lsLine} newStr = do
|
||||
putStr newStr
|
||||
pure ls { lsLine = newStr, lsCurPos = (length newStr) }
|
||||
T.cursorRestore
|
||||
case row lsCurPos of
|
||||
0 -> pure ls { lsLine = overwriteStub lsLine (col lsCurPos) (bareStub $ unpack newStr) }
|
||||
_ -> pure ls
|
||||
|
||||
termShowClear :: LineState -> RIO e LineState
|
||||
termShowClear ls = do
|
||||
termShowClear ls@LineState{lsCurPos} = do
|
||||
putStr "\r"
|
||||
T.clearLine
|
||||
pure ls { lsLine = "", lsCurPos = 0 }
|
||||
T.cursorRestore
|
||||
case row lsCurPos of
|
||||
0 -> pure ls { lsLine = [] }
|
||||
_ -> pure ls
|
||||
|
||||
-- New Current Line
|
||||
termShowMore :: LineState -> RIO e LineState
|
||||
termShowMore ls = do
|
||||
termShowNewline :: LineState -> RIO e LineState
|
||||
termShowNewline ls@LineState{lsCurPos} = do
|
||||
putStr "\r\n"
|
||||
pure ls { lsLine = "", lsCurPos = 0 }
|
||||
case row lsCurPos of
|
||||
0 -> pure ls { lsLine = [], lsCurPos = lsCurPos { col = 0 } }
|
||||
r -> pure ls { lsCurPos = CurPos (r-1) 0 }
|
||||
|
||||
-- Redraw the current LineState, maintaining the current curpos
|
||||
termRefreshLine :: LineState -> RIO e LineState
|
||||
termRefreshLine ls@LineState{lsCurPos,lsLine} = do
|
||||
ls <- termShowClear ls
|
||||
ls <- termShowLine ls lsLine
|
||||
termShowCursor ls lsCurPos
|
||||
-- Redraw the bottom LineState, maintaining the current curpos
|
||||
termRestoreLine :: LineState -> TVar TermSize -> RIO e ()
|
||||
termRestoreLine ls@LineState{lsLine} ts = do
|
||||
TermSize _ h <- readTVarIO ts
|
||||
T.cursorMove (fromIntegral h - 1) 0
|
||||
T.clearLine
|
||||
putStr $ pack $ mconcat $ fmap (uncurry termRenderStubSegment) lsLine
|
||||
T.cursorRestore
|
||||
|
||||
-- ring my bell
|
||||
bell :: TQueue [Term.Ev] -> RIO e ()
|
||||
@ -491,9 +572,14 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
-- A better way to do this would be to get some sort of epoll on stdInput,
|
||||
-- since that's kinda closer to what libuv does?
|
||||
readTerminal :: forall e. HasLogFunc e
|
||||
=> TQueue Belt -> TQueue [Term.Ev] -> (RIO e ()) -> RIO e ()
|
||||
readTerminal rq wq bell =
|
||||
rioAllocaBytes 1 $ \ buf -> loop (ReadData buf False False mempty 0)
|
||||
=> TQueue Belt
|
||||
-> TQueue [Term.Ev]
|
||||
-> TVar TermSize
|
||||
-> RIO e ()
|
||||
-> RIO e ()
|
||||
readTerminal rq wq ts bell =
|
||||
rioAllocaBytes 1 $ \ buf
|
||||
-> loop (ReadData buf False False False 0 0 mempty 0)
|
||||
where
|
||||
loop :: ReadData -> RIO e ()
|
||||
loop rd@ReadData{..} = do
|
||||
@ -513,26 +599,41 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
if rdEscape then
|
||||
if rdBracket then do
|
||||
case c of
|
||||
'A' -> sendBelt $ Aro U
|
||||
'B' -> sendBelt $ Aro D
|
||||
'C' -> sendBelt $ Aro R
|
||||
'D' -> sendBelt $ Aro L
|
||||
'A' -> sendBelt $ Bol $ Aro U
|
||||
'B' -> sendBelt $ Bol $ Aro D
|
||||
'C' -> sendBelt $ Bol $ Aro R
|
||||
'D' -> sendBelt $ Bol $ Aro L
|
||||
'M' -> pure ()
|
||||
_ -> bell
|
||||
loop rd { rdEscape = False, rdBracket = False}
|
||||
rd <- case c of
|
||||
'M' -> pure rd { rdMouse = True }
|
||||
_ -> pure rd
|
||||
loop rd { rdEscape = False, rdBracket = False }
|
||||
else if isAsciiLower c then do
|
||||
sendBelt $ Met $ Cord $ pack [c]
|
||||
loop rd { rdEscape = False }
|
||||
else if c == '.' then do
|
||||
sendBelt $ Met $ Cord "dot"
|
||||
sendBelt $ Mod Met $ Key c
|
||||
loop rd { rdEscape = False }
|
||||
else if w == 8 || w == 127 then do
|
||||
sendBelt $ Met $ Cord "bac"
|
||||
sendBelt $ Mod Met $ Bac ()
|
||||
loop rd { rdEscape = False }
|
||||
else if c == '[' || c == '0' then do
|
||||
loop rd { rdBracket = True }
|
||||
else do
|
||||
bell
|
||||
loop rd { rdEscape = False }
|
||||
else if rdMouse then
|
||||
if rdMouseBut == 0 then do
|
||||
loop rd { rdMouseBut = w - 31 }
|
||||
else if rdMouseCol == 0 then do
|
||||
loop rd { rdMouseCol = w - 32 }
|
||||
else do
|
||||
if rdMouseBut == 1 then do
|
||||
let rdMouseRow = w - 32
|
||||
TermSize _ h <- readTVarIO ts
|
||||
sendBelt $ Bol $ Hit
|
||||
(fromIntegral h - fromIntegral rdMouseRow)
|
||||
(fromIntegral rdMouseCol - 1)
|
||||
else do pure ()
|
||||
loop rd { rdMouse = False, rdMouseBut = 0, rdMouseCol = 0 }
|
||||
else if rdUTF8width /= 0 then do
|
||||
-- continue reading into the utf8 accumulation buffer
|
||||
rd@ReadData{..} <- pure rd { rdUTF8 = snoc rdUTF8 w }
|
||||
@ -543,31 +644,31 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
error "empty utf8 accumulation buffer"
|
||||
Just (c, bytes) | bytes /= rdUTF8width ->
|
||||
error "utf8 character size mismatch?!"
|
||||
Just (c, bytes) -> sendBelt $ Txt $ Tour $ [c]
|
||||
Just (c, bytes) -> sendBelt $ Bol $ Key c
|
||||
loop rd { rdUTF8 = mempty, rdUTF8width = 0 }
|
||||
else if w >= 32 && w < 127 then do
|
||||
sendBelt $ Txt $ Tour $ [c]
|
||||
sendBelt $ Bol $ Key c
|
||||
loop rd
|
||||
else if w == 0 then do
|
||||
bell
|
||||
loop rd
|
||||
else if w == 8 || w == 127 then do
|
||||
sendBelt $ Bac ()
|
||||
sendBelt $ Bol $ Bac ()
|
||||
loop rd
|
||||
else if w == 13 then do
|
||||
sendBelt $ Ret ()
|
||||
sendBelt $ Bol $ Ret ()
|
||||
loop rd
|
||||
else if w == 3 then do
|
||||
-- ETX (^C)
|
||||
logInfo $ "Ctrl-c interrupt"
|
||||
atomically $ do
|
||||
writeTQueue wq [Term.Trace "interrupt\r\n"]
|
||||
writeTQueue rq $ Ctl $ Cord "c"
|
||||
writeTQueue wq [Term.Trace "interrupt"]
|
||||
writeTQueue rq $ Mod Ctl $ Key 'c'
|
||||
loop rd
|
||||
else if w <= 26 then do
|
||||
case pack [BS.w2c (w + 97 - 1)] of
|
||||
"d" -> atomically doneSignal
|
||||
c -> do sendBelt $ Ctl $ Cord c
|
||||
case BS.w2c (w + 97 - 1) of
|
||||
'd' -> atomically doneSignal
|
||||
c -> do sendBelt $ Mod Ctl $ Key c
|
||||
loop rd
|
||||
else if w == 27 then do
|
||||
loop rd { rdEscape = True }
|
||||
@ -644,7 +745,7 @@ term env (tsize, Client{..}) plan stat serfSIGINT = runTerm
|
||||
atomically take >>= \case
|
||||
Nothing -> pure ()
|
||||
Just (ClientTakeBelt b) -> do
|
||||
when (b == Ctl (Cord "c")) $ do
|
||||
when (b == Mod Ctl (Key 'c')) $ do
|
||||
io serfSIGINT
|
||||
let beltEv = EvBlip $ BlipEvTerm $ TermEvBelt (UD 1, ()) $ b
|
||||
let beltFailed _ = pure ()
|
||||
|
@ -22,7 +22,7 @@ import Urbit.TermSize
|
||||
Input Event for terminal driver:
|
||||
|
||||
%blits -- list of blits from arvo.
|
||||
%trace -- stderr line from runtime.
|
||||
%trace -- stderr line from runtime (without trailing newline).
|
||||
%slog -- nock worker logging with priority
|
||||
%blank -- print a blank line
|
||||
%spinr -- Start or stop the spinner
|
||||
|
@ -39,11 +39,11 @@ data Ev
|
||||
= EvLine Text
|
||||
| EvSlog (Atom, Tank)
|
||||
| EvSpin SpinnerState
|
||||
| EvMove Word
|
||||
| EvMove (Word, Word)
|
||||
| EvBell
|
||||
| EvDraw
|
||||
| EvEdit Text
|
||||
| EvMore
|
||||
| EvNewl
|
||||
deriving (Show)
|
||||
|
||||
data Ef
|
||||
@ -62,7 +62,7 @@ data History
|
||||
data St = St
|
||||
{ sHistory :: !(Seq History)
|
||||
, sLine :: !Text
|
||||
, sCurPos :: !Word
|
||||
, sCurPos :: !(Word, Word)
|
||||
, sSpinner :: !SpinnerState
|
||||
}
|
||||
deriving (Show)
|
||||
@ -70,10 +70,10 @@ data St = St
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
init :: St
|
||||
init = St mempty "" 0 Nothing
|
||||
init = St mempty "" (0, 0) Nothing
|
||||
|
||||
{-|
|
||||
When we process `EvMore`, we need to append a newline to the end of
|
||||
When we process `EvNewl`, we need to append a newline to the end of
|
||||
the current line. During normal play, the ENTER key inserts the
|
||||
newline for us, so we need to recreate that newline when we rebuild
|
||||
the state for a new terminal connection.
|
||||
@ -83,15 +83,17 @@ step st@St{..} = \case
|
||||
EvLine t -> st & recordText t
|
||||
EvSlog s -> st & recordSlog s
|
||||
EvSpin s -> st { sSpinner = s }
|
||||
EvMove w -> st { sCurPos = min w (word $ length sLine) }
|
||||
EvEdit t -> st { sLine = t, sCurPos = word (length t) }
|
||||
EvMore -> st { sLine = "", sCurPos = 0 } & recordText (sLine <> "\n")
|
||||
EvMove p -> st { sCurPos = p }
|
||||
EvBell -> st
|
||||
EvDraw -> st
|
||||
EvEdit t | (0, _) <- sCurPos -> st { sLine = t }
|
||||
| otherwise -> st
|
||||
EvNewl | (0, _) <- sCurPos ->
|
||||
st { sLine = "", sCurPos = (0, 0) }
|
||||
& recordText (sLine <> "\n")
|
||||
| otherwise ->
|
||||
st { sCurPos = (fst sCurPos - 1, 0) }
|
||||
where
|
||||
word :: Integral i => i -> Word
|
||||
word = fromIntegral
|
||||
|
||||
recordText :: Text -> St -> St
|
||||
recordText !t st@St{..} = st {
|
||||
sHistory = trim (sHistory |> (HistoryText t))
|
||||
@ -111,8 +113,10 @@ drawState :: St -> [Ev]
|
||||
drawState St{..} = hist <> out <> cur <> spin
|
||||
where
|
||||
hist = drawHistory <$> toList sHistory
|
||||
out = if null sLine then [] else [EvEdit sLine]
|
||||
cur = if 0 == sCurPos then [] else [EvMove $ fromIntegral $ sCurPos]
|
||||
out | null sLine = []
|
||||
| otherwise = [EvEdit sLine]
|
||||
cur | (0, _) <- sCurPos = []
|
||||
| otherwise = [EvMove sCurPos]
|
||||
spin = maybe [] (singleton . EvSpin . Just) sSpinner
|
||||
|
||||
drawHistory (HistoryText t) = EvLine t
|
||||
@ -123,12 +127,13 @@ drawState St{..} = hist <> out <> cur <> spin
|
||||
|
||||
fromBlit :: Arvo.Blit -> Maybe Ev
|
||||
fromBlit = \case
|
||||
Arvo.Hop w -> Just $ EvMove $ fromIntegral w
|
||||
Arvo.Bel () -> Just EvBell
|
||||
Arvo.Clr () -> Just EvDraw
|
||||
Arvo.Lin s -> Just $ EvEdit (pack s)
|
||||
Arvo.Mor () -> Just EvMore
|
||||
_ -> Nothing
|
||||
Arvo.Hop (Arvo.Col c) -> Just $ EvMove (0, fromIntegral c)
|
||||
Arvo.Hop (Arvo.Roc r c) -> Just $ EvMove (fromIntegral r, fromIntegral c)
|
||||
Arvo.Bel () -> Just EvBell
|
||||
Arvo.Clr () -> Just EvDraw
|
||||
Arvo.Put s -> Just $ EvEdit (pack s)
|
||||
Arvo.Nel () -> Just EvNewl
|
||||
_ -> Nothing
|
||||
|
||||
toCause :: Maybe Cord -> SpinnerCause
|
||||
toCause Nothing = User
|
||||
@ -148,12 +153,12 @@ fromTermEv = \case
|
||||
|
||||
toTermEv :: Ev -> Term.Ev
|
||||
toTermEv = \case
|
||||
EvLine "" -> Term.Blank
|
||||
EvLine t -> Term.Trace (Cord t)
|
||||
EvSlog s -> Term.Slog s
|
||||
EvSpin s -> Term.Spinr (fromCause <$> s)
|
||||
EvMove w -> Term.Blits [Arvo.Hop $ fromIntegral w]
|
||||
EvBell -> Term.Blits [Arvo.Bel ()]
|
||||
EvDraw -> Term.Blits [Arvo.Clr ()]
|
||||
EvEdit t -> Term.Blits [Arvo.Lin $ unpack t]
|
||||
EvMore -> Term.Blits [Arvo.Mor ()]
|
||||
EvLine "" -> Term.Blank
|
||||
EvLine t -> Term.Trace (Cord t)
|
||||
EvSlog s -> Term.Slog s
|
||||
EvSpin s -> Term.Spinr (fromCause <$> s)
|
||||
EvMove (r, c) -> Term.Blits [Arvo.Hop $ Arvo.Roc (fromIntegral r) (fromIntegral c)]
|
||||
EvBell -> Term.Blits [Arvo.Bel ()]
|
||||
EvDraw -> Term.Blits [Arvo.Clr ()]
|
||||
EvEdit t -> Term.Blits [Arvo.Put $ unpack t]
|
||||
EvNewl -> Term.Blits [Arvo.Nel ()]
|
||||
|
@ -4,9 +4,12 @@
|
||||
module Urbit.Vere.Term.Render
|
||||
( clearScreen
|
||||
, clearLine
|
||||
, cursorRight
|
||||
, cursorLeft
|
||||
, soundBell
|
||||
, cursorMove
|
||||
, cursorSave
|
||||
, cursorRestore
|
||||
, putCsi
|
||||
, hijack
|
||||
) where
|
||||
|
||||
import ClassyPrelude
|
||||
@ -25,8 +28,27 @@ clearLine = liftIO $ ANSI.clearLine
|
||||
soundBell :: MonadIO m => m ()
|
||||
soundBell = liftIO $ putStr "\a"
|
||||
|
||||
cursorLeft :: MonadIO m => Int -> m ()
|
||||
cursorLeft = liftIO . ANSI.cursorBackward
|
||||
--NOTE top-left-0-based coordinates
|
||||
cursorMove :: MonadIO m => Int -> Int -> m ()
|
||||
cursorMove r c = liftIO $ ANSI.setCursorPosition r c
|
||||
|
||||
cursorRight :: MonadIO m => Int -> m ()
|
||||
cursorRight = liftIO . ANSI.cursorForward
|
||||
cursorSave :: MonadIO m => m ()
|
||||
cursorSave = liftIO ANSI.saveCursor
|
||||
|
||||
cursorRestore :: MonadIO m => m ()
|
||||
cursorRestore = liftIO ANSI.restoreCursor
|
||||
|
||||
putCsi :: MonadIO m => Char -> [Int] -> m ()
|
||||
putCsi c a = liftIO do
|
||||
putStr "\x1b["
|
||||
putStr $ pack $ mconcat $ intersperse ";" (fmap show a)
|
||||
putStr $ pack [c]
|
||||
|
||||
hijack :: MonadIO m => Int -> IO () -> m ()
|
||||
hijack h d = liftIO do
|
||||
putCsi 'r' [1, h-1] -- set scroll region to exclude bottom line
|
||||
putCsi 'S' [1] -- scroll up one line
|
||||
cursorMove (h-2) 0 -- move cursor to empty space
|
||||
d
|
||||
putCsi 'r' [] -- reset scroll region
|
||||
cursorRestore -- restory cursor position
|
||||
|
57289
pkg/interface/package-lock.json
generated
57289
pkg/interface/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -53,6 +53,8 @@
|
||||
"suncalc": "^1.8.0",
|
||||
"unist-util-visit": "^3.0.0",
|
||||
"urbit-ob": "^5.0.1",
|
||||
"xterm": "^4.10.0",
|
||||
"xterm-addon-fit": "^0.5.0",
|
||||
"workbox-core": "^6.0.2",
|
||||
"workbox-precaching": "^6.0.2",
|
||||
"workbox-recipes": "^6.0.2",
|
||||
|
File diff suppressed because one or more lines are too long
1
pkg/interface/src/logic/lib/bel.ts
Normal file
1
pkg/interface/src/logic/lib/bel.ts
Normal file
File diff suppressed because one or more lines are too long
21
pkg/interface/src/logic/state/term.ts
Normal file
21
pkg/interface/src/logic/state/term.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { Terminal } from 'xterm';
|
||||
import { FitAddon } from 'xterm-addon-fit';
|
||||
|
||||
import { createState } from "./base";
|
||||
|
||||
type Session = { term: Terminal, fit: FitAddon };
|
||||
type Sessions = { [id: string]: Session; }
|
||||
|
||||
export interface TermState {
|
||||
sessions: Sessions,
|
||||
selected: string,
|
||||
slogstream: null | EventSource,
|
||||
};
|
||||
|
||||
const useTermState = createState<TermState>('Term', {
|
||||
sessions: {},
|
||||
selected: '', // empty string is default session
|
||||
slogstream: null,
|
||||
}, ['sessions', 'slogstream']); //TODO consider persisting
|
||||
|
||||
export default useTermState;
|
@ -1,50 +0,0 @@
|
||||
import _ from 'lodash';
|
||||
|
||||
export default class Api {
|
||||
ship: any;
|
||||
channel: any;
|
||||
bindPaths: any[];
|
||||
constructor(ship, channel) {
|
||||
this.ship = ship;
|
||||
this.channel = channel;
|
||||
this.bindPaths = [];
|
||||
}
|
||||
|
||||
bind(path, method, ship = this.ship, appl = 'herm', success, fail) {
|
||||
this.bindPaths = _.uniq([...this.bindPaths, path]);
|
||||
|
||||
(window as any).subscriptionId = this.channel.subscribe(ship, appl, path,
|
||||
(err) => {
|
||||
fail(err);
|
||||
},
|
||||
(event) => {
|
||||
success({
|
||||
data: event,
|
||||
from: {
|
||||
ship,
|
||||
path
|
||||
}
|
||||
});
|
||||
},
|
||||
(err) => {
|
||||
fail(err);
|
||||
});
|
||||
}
|
||||
|
||||
belt(belt) {
|
||||
return this.action('herm', 'belt', belt);
|
||||
}
|
||||
|
||||
action(appl, mark, data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.channel.poke(window.ship, appl, mark, data,
|
||||
(json) => {
|
||||
resolve(json);
|
||||
},
|
||||
(err) => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,100 +1,444 @@
|
||||
import { Box, Col } from '@tlon/indigo-react';
|
||||
import React, { Component } from 'react';
|
||||
import React, {
|
||||
useEffect,
|
||||
useRef,
|
||||
useCallback
|
||||
} from 'react';
|
||||
import Helmet from 'react-helmet';
|
||||
import { Route } from 'react-router-dom';
|
||||
import withState from '~/logic/lib/withState';
|
||||
import useHarkState from '~/logic/state/hark';
|
||||
import Api from './api';
|
||||
import { History } from './components/history';
|
||||
import { Input } from './components/input';
|
||||
import './css/custom.css';
|
||||
import Store from './store';
|
||||
import Subscription from './subscription';
|
||||
|
||||
class TermApp extends Component<any, any> {
|
||||
store: Store;
|
||||
api: any;
|
||||
subscription: any;
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.store = new Store();
|
||||
this.store.setStateHandler(this.setState.bind(this));
|
||||
import useTermState from '~/logic/state/term';
|
||||
import { useDark } from '~/logic/state/join';
|
||||
|
||||
this.state = this.store.state;
|
||||
}
|
||||
import { Terminal, ITerminalOptions, ITheme } from 'xterm';
|
||||
import { FitAddon } from 'xterm-addon-fit';
|
||||
import { saveAs } from 'file-saver';
|
||||
|
||||
resetControllers() {
|
||||
this.api = null;
|
||||
this.subscription = null;
|
||||
}
|
||||
import { Box, Col } from '@tlon/indigo-react';
|
||||
|
||||
componentDidMount() {
|
||||
this.resetControllers();
|
||||
// eslint-disable-next-line new-cap
|
||||
const channel = new (window as any).channel();
|
||||
this.api = new Api(this.props.ship, channel);
|
||||
this.store.api = this.api;
|
||||
import '../../../../node_modules/xterm/css/xterm.css';
|
||||
import api from '~/logic/api/index';
|
||||
import {
|
||||
Belt, Blit, Stye, Stub, Tint, Deco,
|
||||
pokeTask, pokeBelt
|
||||
} from '@urbit/api/term';
|
||||
|
||||
this.subscription = new Subscription(this.store, this.api, channel);
|
||||
this.subscription.start();
|
||||
}
|
||||
import bel from '~/logic/lib/bel';
|
||||
|
||||
componentWillUnmount() {
|
||||
this.subscription.delete();
|
||||
this.store.clear();
|
||||
this.resetControllers();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<Helmet defer={false}>
|
||||
<title>{ this.props.notificationsCount ? `(${String(this.props.notificationsCount) }) `: '' }Landscape</title>
|
||||
</Helmet>
|
||||
<Box
|
||||
height='100%'
|
||||
>
|
||||
<Route
|
||||
exact
|
||||
path="/~term/"
|
||||
render={(props) => {
|
||||
return (
|
||||
<Box
|
||||
width='100%'
|
||||
height='100%'
|
||||
display='flex'
|
||||
>
|
||||
<Col
|
||||
p={3}
|
||||
backgroundColor='white'
|
||||
width='100%'
|
||||
minHeight={0}
|
||||
minWidth={0}
|
||||
color='lightGray'
|
||||
borderRadius={2}
|
||||
mx={['0','3']}
|
||||
mb={['0','3']}
|
||||
border={['0','1']}
|
||||
cursor='text'
|
||||
>
|
||||
{/* @ts-ignore declare props in later pass */}
|
||||
<History log={this.state.lines.slice(0, -1)} />
|
||||
<Input
|
||||
ship={this.props.ship}
|
||||
cursor={this.state.cursor}
|
||||
api={this.api}
|
||||
store={this.store}
|
||||
line={this.state.lines.slice(-1)[0]}
|
||||
/>
|
||||
</Col>
|
||||
</Box>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
type TermAppProps = {
|
||||
ship: string;
|
||||
notificationsCount: number;
|
||||
}
|
||||
|
||||
export default withState(TermApp, [[useHarkState]]);
|
||||
const makeTheme = (dark: boolean): ITheme => {
|
||||
let fg, bg: string;
|
||||
if (dark) {
|
||||
fg = 'white';
|
||||
bg = 'black';
|
||||
} else {
|
||||
fg = 'black';
|
||||
bg = 'white';
|
||||
}
|
||||
// TODO indigo colors.
|
||||
// we can't pluck these from ThemeContext because they have transparency.
|
||||
// technically xterm supports transparency, but it degrades performance.
|
||||
return {
|
||||
foreground: fg,
|
||||
background: bg,
|
||||
brightBlack: '#7f7f7f', // NOTE slogs
|
||||
cursor: fg
|
||||
};
|
||||
};
|
||||
|
||||
const termConfig: ITerminalOptions = {
|
||||
logLevel: 'warn',
|
||||
//
|
||||
convertEol: true,
|
||||
//
|
||||
rows: 24,
|
||||
cols: 80,
|
||||
scrollback: 10000,
|
||||
//
|
||||
fontFamily: '"Source Code Pro","Roboto mono","Courier New",monospace',
|
||||
// NOTE theme colors configured dynamically
|
||||
//
|
||||
bellStyle: 'sound',
|
||||
bellSound: bel,
|
||||
//
|
||||
// allows text selection by holding modifier (option, or shift)
|
||||
macOptionClickForcesSelection: true
|
||||
};
|
||||
|
||||
const csi = (cmd: string, ...args: number[]) => {
|
||||
return '\x1b[' + args.join(';') + cmd;
|
||||
};
|
||||
|
||||
const tint = (t: Tint) => {
|
||||
switch (t) {
|
||||
case null: return '9';
|
||||
case 'k': return '0';
|
||||
case 'r': return '1';
|
||||
case 'g': return '2';
|
||||
case 'y': return '3';
|
||||
case 'b': return '4';
|
||||
case 'm': return '5';
|
||||
case 'c': return '6';
|
||||
case 'w': return '7';
|
||||
default: return `8;2;${t.r%256};${t.g%256};${t.b%256}`;
|
||||
}
|
||||
};
|
||||
|
||||
const stye = (s: Stye) => {
|
||||
let out = '';
|
||||
|
||||
// text decorations
|
||||
//
|
||||
if (s.deco.length > 0) {
|
||||
out += s.deco.reduce((decs: number[], deco: Deco) => {
|
||||
/* eslint-disable max-statements-per-line */
|
||||
switch (deco) {
|
||||
case null: decs.push(0); return decs;
|
||||
case 'br': decs.push(1); return decs;
|
||||
case 'un': decs.push(4); return decs;
|
||||
case 'bl': decs.push(5); return decs;
|
||||
default: console.log('weird deco', deco); return decs;
|
||||
}
|
||||
}, []).join(';');
|
||||
}
|
||||
|
||||
// background color
|
||||
//
|
||||
if (s.back !== null) {
|
||||
if (out !== '') {
|
||||
out += ';';
|
||||
}
|
||||
out += '4';
|
||||
out += tint(s.back);
|
||||
}
|
||||
|
||||
// foreground color
|
||||
//
|
||||
if (s.fore !== null) {
|
||||
if (out !== '') {
|
||||
out += ';';
|
||||
}
|
||||
out += '3';
|
||||
out += tint(s.fore);
|
||||
}
|
||||
|
||||
if (out === '') {
|
||||
return out;
|
||||
}
|
||||
return '\x1b[' + out + 'm';
|
||||
};
|
||||
|
||||
const showBlit = (term: Terminal, blit: Blit) => {
|
||||
let out = '';
|
||||
|
||||
if ('bel' in blit) {
|
||||
out += '\x07';
|
||||
} else if ('clr' in blit) {
|
||||
term.clear();
|
||||
out += csi('u');
|
||||
} else if ('hop' in blit) {
|
||||
if (typeof blit.hop === 'number') {
|
||||
out += csi('H', term.rows, blit.hop + 1);
|
||||
} else {
|
||||
out += csi('H', term.rows - blit.hop.r, blit.hop.c + 1);
|
||||
}
|
||||
out += csi('s'); // save cursor position
|
||||
} else if ('put' in blit) {
|
||||
out += blit.put.join('');
|
||||
out += csi('u');
|
||||
} else if ('klr' in blit) {
|
||||
out += blit.klr.reduce((lin: string, p: Stub) => {
|
||||
lin += stye(p.stye);
|
||||
lin += p.text.join('');
|
||||
lin += csi('m', 0);
|
||||
return lin;
|
||||
}, '');
|
||||
out += csi('u');
|
||||
} else if ('nel' in blit) {
|
||||
out += '\n';
|
||||
} else if ('sag' in blit || 'sav' in blit) {
|
||||
const sav = ('sag' in blit) ? blit.sag : blit.sav;
|
||||
const name = sav.path.split('/').slice(-2).join('.');
|
||||
const buff = Buffer.from(sav.file, 'base64');
|
||||
const blob = new Blob([buff], { type: 'application/octet-stream' });
|
||||
saveAs(blob, name);
|
||||
} else if ('url' in blit) {
|
||||
window.open(blit.url);
|
||||
} else if ('wyp' in blit) {
|
||||
out += '\r' + csi('K');
|
||||
out += csi('u');
|
||||
} else {
|
||||
console.log('weird blit', blit);
|
||||
}
|
||||
|
||||
term.write(out);
|
||||
};
|
||||
|
||||
// NOTE should generally only be passed the default terminal session
|
||||
const showSlog = (term: Terminal, slog: string) => {
|
||||
// set scroll region to exclude the bottom line,
|
||||
// scroll up one line,
|
||||
// move cursor to start of the newly created whitespace,
|
||||
// set text to grey,
|
||||
// print the slog,
|
||||
// restore color, scroll region, and cursor.
|
||||
//
|
||||
term.write(csi('r', 1, term.rows - 1)
|
||||
+ csi('S', 1)
|
||||
+ csi('H', term.rows - 1, 1)
|
||||
+ csi('m', 90)
|
||||
+ slog
|
||||
+ csi('m', 0)
|
||||
+ csi('r')
|
||||
+ csi('u'));
|
||||
};
|
||||
|
||||
const readInput = (term: Terminal, e: string): Belt[] => {
|
||||
const belts: Belt[] = [];
|
||||
let strap = '';
|
||||
|
||||
while (e.length > 0) {
|
||||
let c = e.charCodeAt(0);
|
||||
|
||||
// text input
|
||||
//
|
||||
if (c >= 32 && c !== 127) {
|
||||
strap += e[0];
|
||||
e = e.slice(1);
|
||||
continue;
|
||||
} else if ('' !== strap) {
|
||||
belts.push({ txt: strap.split('') });
|
||||
strap = '';
|
||||
}
|
||||
|
||||
// special keys/characters
|
||||
//
|
||||
if (0 === c) {
|
||||
term.write('\x07'); // bel
|
||||
} else if (8 === c || 127 === c) {
|
||||
belts.push({ bac: null });
|
||||
} else if (13 === c) {
|
||||
belts.push({ ret: null });
|
||||
} else if (c <= 26) {
|
||||
belts.push({ mod: { mod: 'ctl', key: String.fromCharCode(96 + c) } });
|
||||
}
|
||||
|
||||
// escape sequences
|
||||
//
|
||||
if (27 === c) { // ESC
|
||||
e = e.slice(1);
|
||||
c = e.charCodeAt(0);
|
||||
if (91 === c || 79 === c) { // [ or O
|
||||
e = e.slice(1);
|
||||
c = e.charCodeAt(0);
|
||||
/* eslint-disable max-statements-per-line */
|
||||
switch (c) {
|
||||
case 65: belts.push({ aro: 'u' }); break;
|
||||
case 66: belts.push({ aro: 'd' }); break;
|
||||
case 67: belts.push({ aro: 'r' }); break;
|
||||
case 68: belts.push({ aro: 'l' }); break;
|
||||
//
|
||||
case 77: {
|
||||
const m = e.charCodeAt(1) - 31;
|
||||
if (1 === m) {
|
||||
const c = e.charCodeAt(2) - 32;
|
||||
const r = e.charCodeAt(3) - 32;
|
||||
belts.push({ hit: { r: term.rows - r, c: c - 1 } });
|
||||
}
|
||||
e = e.slice(3);
|
||||
break;
|
||||
}
|
||||
//
|
||||
default: term.write('\x07'); break; // bel
|
||||
}
|
||||
} else if (c >= 97 && c <= 122) { // a <= c <= z
|
||||
belts.push({ mod: { mod: 'met', key: e[0] } });
|
||||
} else if (c === 46) { // .
|
||||
belts.push({ mod: { mod: 'met', key: '.' } });
|
||||
} else if (c === 8 || c === 127) {
|
||||
belts.push({ mod: { mod: 'met', key: { bac: null } } });
|
||||
} else {
|
||||
term.write('\x07'); break; // bel
|
||||
}
|
||||
}
|
||||
|
||||
e = e.slice(1);
|
||||
}
|
||||
if ('' !== strap) {
|
||||
belts.push({ txt: strap.split('') });
|
||||
strap = '';
|
||||
}
|
||||
return belts;
|
||||
};
|
||||
|
||||
export default function TermApp(props: TermAppProps) {
|
||||
const container = useRef<HTMLDivElement>(null);
|
||||
// TODO allow switching of selected
|
||||
const { sessions, selected, slogstream, set } = useTermState();
|
||||
const session = sessions[selected];
|
||||
const dark = useDark();
|
||||
|
||||
const setupSlog = useCallback(() => {
|
||||
console.log('slog: setting up...');
|
||||
let available = false;
|
||||
const slog = new EventSource('/~_~/slog', { withCredentials: true });
|
||||
|
||||
slog.onopen = (e) => {
|
||||
console.log('slog: opened stream');
|
||||
available = true;
|
||||
};
|
||||
|
||||
slog.onmessage = (e) => {
|
||||
const session = useTermState.getState().sessions[''];
|
||||
if (!session) {
|
||||
console.log('default session mia!', 'slog:', slog);
|
||||
return;
|
||||
}
|
||||
showSlog(session.term, e.data);
|
||||
};
|
||||
|
||||
slog.onerror = (e) => {
|
||||
console.error('slog: eventsource error:', e);
|
||||
if (available) {
|
||||
window.setTimeout(() => {
|
||||
if (slog.readyState !== EventSource.CLOSED) {
|
||||
return;
|
||||
}
|
||||
console.log('slog: reconnecting...');
|
||||
setupSlog();
|
||||
}, 10000);
|
||||
}
|
||||
};
|
||||
|
||||
set((state) => {
|
||||
state.slogstream = slog;
|
||||
});
|
||||
}, [sessions]);
|
||||
|
||||
const onInput = useCallback((ses: string, e: string) => {
|
||||
const term = useTermState.getState().sessions[ses].term;
|
||||
const belts = readInput(term, e);
|
||||
belts.map((b) => { // NOTE passing api.poke(pokeBelt makes `this` undefined!
|
||||
api.poke(pokeBelt(ses, b));
|
||||
});
|
||||
}, [sessions]);
|
||||
|
||||
const onResize = useCallback(() => {
|
||||
// TODO debounce, if it ever becomes a problem
|
||||
session?.fit.fit();
|
||||
}, [session]);
|
||||
|
||||
// on-init, open slogstream
|
||||
//
|
||||
useEffect(() => {
|
||||
if (!slogstream) {
|
||||
setupSlog();
|
||||
}
|
||||
window.addEventListener('resize', onResize);
|
||||
return () => {
|
||||
// TODO clean up subs?
|
||||
window.removeEventListener('resize', onResize);
|
||||
};
|
||||
}, [onResize, setupSlog]);
|
||||
|
||||
// on dark mode change, change terminals' theme
|
||||
//
|
||||
useEffect(() => {
|
||||
const theme = makeTheme(dark);
|
||||
for (const ses in sessions) {
|
||||
sessions[ses].term.setOption('theme', theme);
|
||||
}
|
||||
if (container.current) {
|
||||
container.current.style.backgroundColor = theme.background || '';
|
||||
}
|
||||
}, [dark, sessions]);
|
||||
|
||||
// on selected change, maybe setup the term, or put it into the container
|
||||
//
|
||||
useEffect(() => {
|
||||
let ses = session;
|
||||
// initialize terminal
|
||||
//
|
||||
if (!ses) {
|
||||
// set up terminal
|
||||
//
|
||||
const term = new Terminal(termConfig);
|
||||
term.setOption('theme', makeTheme(dark));
|
||||
const fit = new FitAddon();
|
||||
term.loadAddon(fit);
|
||||
|
||||
// start mouse reporting
|
||||
//
|
||||
term.write(csi('?9h'));
|
||||
|
||||
// set up event handlers
|
||||
//
|
||||
term.onData(e => onInput(selected, e));
|
||||
term.onBinary(e => onInput(selected, e));
|
||||
term.onResize((e) => {
|
||||
api.poke(pokeTask(selected, { blew: { w: e.cols, h: e.rows } }));
|
||||
});
|
||||
|
||||
ses = { term, fit };
|
||||
|
||||
// open subscription
|
||||
//
|
||||
api.subscribe({ app: 'herm', path: '/session/'+selected,
|
||||
event: (e) => {
|
||||
const ses = useTermState.getState().sessions[selected];
|
||||
if (!ses) {
|
||||
console.log('on blit: no such session', selected, sessions, useTermState.getState().sessions);
|
||||
return;
|
||||
}
|
||||
showBlit(ses.term, e);
|
||||
},
|
||||
quit: () => { // quit
|
||||
// TODO show user a message
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (container.current && !container.current.contains(ses.term.element || null)) {
|
||||
ses.term.open(container.current);
|
||||
ses.fit.fit();
|
||||
ses.term.focus();
|
||||
}
|
||||
|
||||
set((state) => {
|
||||
state.sessions[selected] = ses;
|
||||
});
|
||||
|
||||
return () => {
|
||||
// TODO unload term from container
|
||||
// but term.dispose is too powerful? maybe just empty the container?
|
||||
};
|
||||
}, [set, session, container]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Helmet defer={false}>
|
||||
<title>{ props.notificationsCount ? `(${String(props.notificationsCount) }) `: '' }Landscape</title>
|
||||
</Helmet>
|
||||
<Box
|
||||
width='100%'
|
||||
height='100%'
|
||||
px={['0','3']}
|
||||
pb={['0','3']}
|
||||
display='flex'
|
||||
>
|
||||
<Col
|
||||
width='100%'
|
||||
minHeight='0'
|
||||
color='washedGray'
|
||||
borderRadius={['0','2']}
|
||||
border={['0','1']}
|
||||
p='1'
|
||||
ref={container}
|
||||
>
|
||||
</Col>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
import { Box } from '@tlon/indigo-react';
|
||||
import React, { Component } from 'react';
|
||||
import Line from './line';
|
||||
|
||||
export class History extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Box
|
||||
height='100%'
|
||||
minHeight={0}
|
||||
minWidth={0}
|
||||
display='flex'
|
||||
flexDirection='column-reverse'
|
||||
overflowY='scroll'
|
||||
style={{ resize: 'none' }}
|
||||
>
|
||||
<Box
|
||||
mt='auto'
|
||||
>
|
||||
{/* @ts-ignore declare props in later pass */}
|
||||
{this.props.log.map((line, i) => {
|
||||
// @ts-ignore react memo not passing props
|
||||
return <Line key={i} line={line} />;
|
||||
})}
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default History;
|
@ -1,66 +0,0 @@
|
||||
import { Text } from '@tlon/indigo-react';
|
||||
import React from 'react';
|
||||
// @ts-ignore line isn't in props?
|
||||
export default React.memo(({ line }) => {
|
||||
// line body to jsx
|
||||
// NOTE lines are lists of characters that might span multiple codepoints
|
||||
//
|
||||
let text = '';
|
||||
if (line.lin) {
|
||||
text = line.lin.join('');
|
||||
} else if (line.klr) {
|
||||
text = line.klr.map((part, i) => {
|
||||
const prop = part.stye.deco.reduce((prop, deco) => {
|
||||
switch (deco) {
|
||||
case null: return prop;
|
||||
case 'br': return { bold: true, ...prop };
|
||||
case 'bl': return { className: 'blink', ...prop };
|
||||
case 'un': return { style: { textDecoration: 'underline' }, ...prop };
|
||||
default: console.log('weird deco', deco); return prop;
|
||||
}
|
||||
}, {});
|
||||
switch (part.stye.fore) {
|
||||
case null: break;
|
||||
case 'r': prop.color = 'red'; break;
|
||||
case 'g': prop.color = 'green'; break;
|
||||
case 'b': prop.color = 'blue'; break;
|
||||
case 'c': prop.color = 'cyan'; break;
|
||||
case 'm': prop.color = 'purple'; break;
|
||||
case 'y': prop.color = 'yellow'; break;
|
||||
case 'k': prop.color = 'black'; break;
|
||||
case 'w': prop.color = 'white'; break;
|
||||
default: prop.color = '#' + part.stye.fore;
|
||||
}
|
||||
switch (part.stye.back) {
|
||||
case null: break;
|
||||
case 'r': prop.backgroundColor = 'red'; break;
|
||||
case 'g': prop.backgroundColor = 'green'; break;
|
||||
case 'b': prop.backgroundColor = 'blue'; break;
|
||||
case 'c': prop.backgroundColor = 'cyan'; break;
|
||||
case 'm': prop.backgroundColor = 'purple'; break;
|
||||
case 'y': prop.backgroundColor = 'yellow'; break;
|
||||
case 'k': prop.backgroundColor = 'black'; break;
|
||||
case 'w': prop.backgroundColor = 'white'; break;
|
||||
default: prop.backgroundColor = '#' + part.stye.back;
|
||||
}
|
||||
if (Object.keys(prop).length === 0) {
|
||||
return part.text;
|
||||
} else {
|
||||
return (<Text mono fontSize='inherit' key={i} {...prop}>
|
||||
{part.text.join('')}
|
||||
</Text>);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// render line
|
||||
//
|
||||
return (
|
||||
<Text mono display='flex'
|
||||
fontSize={0}
|
||||
style={{ overflowWrap: 'break-word', whiteSpace: 'pre-wrap' }}
|
||||
>
|
||||
{text}
|
||||
</Text>
|
||||
);
|
||||
});
|
@ -1,16 +0,0 @@
|
||||
input#term {
|
||||
background-color: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.blink {
|
||||
animation: 4s ease-in-out infinite opacity_blink;
|
||||
}
|
||||
|
||||
@keyframes opacity_blink {
|
||||
0% { opacity: 0; }
|
||||
10% { opacity: 1; }
|
||||
80% { opacity: 1; }
|
||||
90% { opacity: 0; }
|
||||
100% { opacity: 0; }
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
import { saveAs } from 'file-saver';
|
||||
import bel from '../../../logic/lib/bel';
|
||||
|
||||
export default class Store {
|
||||
state: any;
|
||||
api: any;
|
||||
setState: any;
|
||||
constructor() {
|
||||
this.state = this.initialState();
|
||||
}
|
||||
|
||||
initialState() {
|
||||
return {
|
||||
lines: [''],
|
||||
cursor: 0
|
||||
};
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.setState(this.initialState());
|
||||
}
|
||||
|
||||
handleEvent(data) {
|
||||
// process slogs
|
||||
//
|
||||
if (data.slog) {
|
||||
this.state.lines.splice(this.state.lines.length-1, 0, { lin: [data.slog] });
|
||||
this.setState({ lines: this.state.lines });
|
||||
return;
|
||||
}
|
||||
|
||||
// process blits
|
||||
//
|
||||
const blit = data.data;
|
||||
switch (Object.keys(blit)[0]) {
|
||||
case 'bel':
|
||||
bel.play();
|
||||
break;
|
||||
case 'clr':
|
||||
this.state.lines = this.state.lines.slice(-1);
|
||||
this.setState({ lines: this.state.lines });
|
||||
break;
|
||||
case 'hop':
|
||||
// since lines are lists of characters that might span multiple
|
||||
// codepoints, we need to calculate the byte-wise cursor position
|
||||
// to avoid incorrect cursor rendering.
|
||||
//
|
||||
const line = this.state.lines[this.state.lines.length - 1];
|
||||
let hops;
|
||||
if (line.lin) {
|
||||
hops = line.lin.slice(0, blit.hop);
|
||||
} else if (line.klr) {
|
||||
hops = line.klr.reduce((h, p) => {
|
||||
if (h.length >= blit.hop)
|
||||
return h;
|
||||
return [...h, ...p.text.slice(0, blit.hop - h.length)];
|
||||
}, []);
|
||||
}
|
||||
this.setState({ cursor: hops.join('').length });
|
||||
break;
|
||||
case 'lin':
|
||||
this.state.lines[this.state.lines.length - 1] = blit;
|
||||
this.setState({ lines: this.state.lines });
|
||||
break;
|
||||
case 'klr':
|
||||
this.state.lines[this.state.lines.length - 1] = blit;
|
||||
this.setState({ lines: this.state.lines });
|
||||
break;
|
||||
case 'mor':
|
||||
this.state.lines.push('');
|
||||
this.setState({ lines: this.state.lines });
|
||||
break;
|
||||
case 'sag':
|
||||
blit.sav = blit.sag;
|
||||
break;
|
||||
case 'sav':
|
||||
const name = blit.sav.path.split('/').slice(-2).join('.');
|
||||
const buff = new Buffer(blit.sav.file, 'base64');
|
||||
const blob = new Blob([buff], { type: 'application/octet-stream' });
|
||||
saveAs(blob, name);
|
||||
break;
|
||||
case 'url':
|
||||
// TODO too invasive? just print as <a>?
|
||||
window.open(blit.url);
|
||||
break;
|
||||
default: console.log('weird blit', blit);
|
||||
}
|
||||
}
|
||||
|
||||
setStateHandler(setState) {
|
||||
this.setState = setState;
|
||||
}
|
||||
}
|
||||
|
@ -1,87 +0,0 @@
|
||||
export default class Subscription {
|
||||
store: any;
|
||||
api: any;
|
||||
channel: any;
|
||||
firstRoundComplete: boolean;
|
||||
constructor(store, api, channel) {
|
||||
this.store = store;
|
||||
this.api = api;
|
||||
this.channel = channel;
|
||||
|
||||
this.channel.setOnChannelError(this.onChannelError.bind(this));
|
||||
this.firstRoundComplete = false;
|
||||
}
|
||||
|
||||
start() {
|
||||
if (this.api.ship) {
|
||||
this.firstRound();
|
||||
} else {
|
||||
console.error('~~~ ERROR: Must set api.ship before operation ~~~');
|
||||
}
|
||||
this.setupSlog();
|
||||
}
|
||||
|
||||
setupSlog() {
|
||||
let available = false;
|
||||
const slog = new EventSource('/~_~/slog', { withCredentials: true });
|
||||
|
||||
slog.onopen = (e) => {
|
||||
console.log('slog: opened stream');
|
||||
available = true;
|
||||
};
|
||||
|
||||
slog.onmessage = (e) => {
|
||||
this.handleEvent({ slog: e.data });
|
||||
};
|
||||
|
||||
slog.onerror = (e) => {
|
||||
console.error('slog: eventsource error:', e);
|
||||
if (available) {
|
||||
window.setTimeout(() => {
|
||||
if (slog.readyState !== EventSource.CLOSED)
|
||||
return;
|
||||
console.log('slog: reconnecting...');
|
||||
this.setupSlog();
|
||||
}, 10000);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
delete() {
|
||||
this.channel.delete();
|
||||
}
|
||||
|
||||
onChannelError(err) {
|
||||
console.error('event source error: ', err);
|
||||
console.log('initiating new channel');
|
||||
this.firstRoundComplete = false;
|
||||
setTimeout(() => {
|
||||
this.store.handleEvent({
|
||||
data: { clear : true }
|
||||
});
|
||||
|
||||
this.start();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
subscribe(path, app) {
|
||||
this.api.bind(path, 'PUT', this.api.ship, app,
|
||||
this.handleEvent.bind(this),
|
||||
(err) => {
|
||||
console.log(err);
|
||||
this.subscribe(path, app);
|
||||
},
|
||||
() => {
|
||||
this.subscribe(path, app);
|
||||
});
|
||||
}
|
||||
|
||||
firstRound() {
|
||||
this.subscribe('/session/', 'herm');
|
||||
}
|
||||
|
||||
handleEvent(diff) {
|
||||
this.store.handleEvent(diff);
|
||||
}
|
||||
}
|
||||
|
2
pkg/npm/api/term/index.ts
Normal file
2
pkg/npm/api/term/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
22
pkg/npm/api/term/lib.ts
Normal file
22
pkg/npm/api/term/lib.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import _ from 'lodash';
|
||||
|
||||
import { Scry } from '../lib'
|
||||
import { Poke } from '../lib/types';
|
||||
import { Belt, Task, SessionTask } from './types';
|
||||
|
||||
export const pokeTask = (session: string, task: Task): Poke<SessionTask> => ({
|
||||
app: 'herm',
|
||||
mark: 'herm-task',
|
||||
json: { session, ...task }
|
||||
});
|
||||
|
||||
export const pokeBelt = (
|
||||
session: string,
|
||||
belt: Belt
|
||||
): Poke<SessionTask> => pokeTask(session, { belt });
|
||||
|
||||
//NOTE scry will return string[]
|
||||
export const scrySessions = (): Scry => ({
|
||||
app: 'herm',
|
||||
path: `/sessions`
|
||||
});
|
60
pkg/npm/api/term/types.ts
Normal file
60
pkg/npm/api/term/types.ts
Normal file
@ -0,0 +1,60 @@
|
||||
// outputs
|
||||
//
|
||||
|
||||
export type TermUpdate =
|
||||
| Blit;
|
||||
|
||||
export type Tint =
|
||||
| null
|
||||
| 'r' | 'g' | 'b' | 'c' | 'm' | 'y' | 'k' | 'w'
|
||||
| { r: number, g: number, b: number };
|
||||
|
||||
export type Deco = null | 'br' | 'un' | 'bl';
|
||||
|
||||
export type Stye = {
|
||||
deco: Deco[],
|
||||
back: Tint,
|
||||
fore: Tint
|
||||
};
|
||||
|
||||
export type Stub = {
|
||||
stye: Stye,
|
||||
text: string[]
|
||||
}
|
||||
|
||||
export type Blit =
|
||||
| { bel: null } // make a noise
|
||||
| { clr: null } // clear the screen
|
||||
| { hop: number | { r: number, c: number } } // set cursor col/pos
|
||||
| { klr: Stub[] } // put styled
|
||||
| { put: string[] } // put text at cursor
|
||||
| { nel: null } // newline
|
||||
| { sag: { path: string, file: string } } // save to jamfile
|
||||
| { sav: { path: string, file: string } } // save to file
|
||||
| { url: string } // activate url
|
||||
| { wyp: null } // wipe cursor line
|
||||
|
||||
// inputs
|
||||
//
|
||||
|
||||
export type Bolt =
|
||||
| string
|
||||
| { aro: 'd' | 'l' | 'r' | 'u' }
|
||||
| { bac: null }
|
||||
| { del: null }
|
||||
| { hit: { r: number, c: number } }
|
||||
| { ret: null }
|
||||
|
||||
export type Belt =
|
||||
| Bolt
|
||||
| { mod: { mod: 'ctl' | 'met' | 'hyp', key: Bolt } }
|
||||
| { txt: Array<string> };
|
||||
|
||||
export type Task =
|
||||
| { belt: Belt }
|
||||
| { blew: { w: number, h: number } }
|
||||
| { flow: { term: string, apps: Array<{ who: string, app: string }> } }
|
||||
| { hail: null }
|
||||
| { hook: null }
|
||||
|
||||
export type SessionTask = { session: string } & Task
|
@ -126,10 +126,10 @@ u3_ptty_init(uv_loop_t* lup_u, const c3_c** err_c)
|
||||
uty_u->wsz_f = _ttyf_get_winsize;
|
||||
}
|
||||
} else {
|
||||
if ( 0 == (e = uv_pipe_init(lup_u, &uty_u->pin_u.pop_u, 0)) &&
|
||||
0 == (e = uv_pipe_init(lup_u, &uty_u->pop_u.pop_u, 0)) &&
|
||||
0 == (e = uv_pipe_open(&uty_u->pin_u.pop_u, 0)) &&
|
||||
0 == (e = uv_pipe_open(&uty_u->pop_u.pop_u, 1)) )
|
||||
if ( 0 == (e = uv_pipe_init(lup_u, &uty_u->pin_u.pip_u, 0)) &&
|
||||
0 == (e = uv_pipe_init(lup_u, &uty_u->pop_u.pip_u, 0)) &&
|
||||
0 == (e = uv_pipe_open(&uty_u->pin_u.pip_u, 0)) &&
|
||||
0 == (e = uv_pipe_open(&uty_u->pop_u.pip_u, 1)) )
|
||||
{
|
||||
fprintf(stderr, "vere: running interactive in a terminal emulator is experimental\r\n"
|
||||
" use -t to disable interactivity or use native Windows console\r\n") ;
|
||||
|
@ -15,6 +15,14 @@ index 0f2bb869b..f81245ec6 100644
|
||||
if (err == ERROR_ACCESS_DENIED) {
|
||||
/*
|
||||
* SetNamedPipeHandleState can fail if the handle doesn't have either
|
||||
@@ -1054,7 +1054,6 @@ static DWORD WINAPI uv_pipe_writefile_thread_proc(void* parameter) {
|
||||
assert(req != NULL);
|
||||
assert(req->type == UV_WRITE);
|
||||
assert(handle->type == UV_NAMED_PIPE);
|
||||
- assert(req->write_buffer.base);
|
||||
|
||||
result = WriteFile(handle->handle,
|
||||
req->write_buffer.base,
|
||||
diff --git a/src/win/tty.c b/src/win/tty.c
|
||||
index c359d5601..1b9d4f853 100644
|
||||
--- a/src/win/tty.c
|
||||
|
@ -61,7 +61,7 @@ buildnixdep () {
|
||||
narinfo="$cache/${hash}.narinfo"
|
||||
if curl -fLI "$narinfo"
|
||||
then
|
||||
url="$cache/$(curl -fL -H "Accept: application/json" "$narinfo"|jq -r '.url')"
|
||||
url="$cache/$(curl -fL "$narinfo"|while IFS=: read k v; do if [ "$k" == "URL" ]; then echo $v; fi; done)"
|
||||
echo Found $url
|
||||
strip=0
|
||||
hash=
|
||||
|
@ -147,10 +147,10 @@ u3_ptty_init(uv_loop_t* lup_u, const c3_c** err_c)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uv_pipe_init(lup_u, &uty_u->pin_u.pop_u, 0);
|
||||
uv_pipe_init(lup_u, &uty_u->pop_u.pop_u, 0);
|
||||
uv_pipe_open(&uty_u->pin_u.pop_u, 0);
|
||||
uv_pipe_open(&uty_u->pop_u.pop_u, 1);
|
||||
uv_pipe_init(lup_u, &uty_u->pin_u.pip_u, 0);
|
||||
uv_pipe_init(lup_u, &uty_u->pop_u.pip_u, 0);
|
||||
uv_pipe_open(&uty_u->pin_u.pip_u, 0);
|
||||
uv_pipe_open(&uty_u->pop_u.pip_u, 1);
|
||||
|
||||
// Load old terminal state to restore.
|
||||
//
|
||||
@ -167,6 +167,9 @@ u3_ptty_init(uv_loop_t* lup_u, const c3_c** err_c)
|
||||
|
||||
// Construct raw termios configuration.
|
||||
//
|
||||
// makes input available per-character, does not echo input,
|
||||
// disables special input pre-processing, output post-processing.
|
||||
//
|
||||
{
|
||||
pty_u->raw_u = pty_u->bak_u;
|
||||
|
||||
|
2
pkg/urbit/configure
vendored
2
pkg/urbit/configure
vendored
@ -195,7 +195,7 @@ for citem in $compat; do
|
||||
done
|
||||
|
||||
cat >config.mk <<EOF
|
||||
CFLAGS := $CFLAGS -funsigned-char -ffast-math -fcommon -std=gnu99
|
||||
CFLAGS := $CFLAGS -funsigned-char -ffast-math -fcommon -std=gnu99 -Wno-format-zero-length
|
||||
LDFLAGS := $LDFLAGS
|
||||
CC := ${CC-cc}
|
||||
compat := $compat
|
||||
|
@ -645,7 +645,7 @@ main(c3_i argc,
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGPROF);
|
||||
if ( 0 != pthread_sigmask(SIG_BLOCK, &set, NULL) ) {
|
||||
u3l_log("boot: thread mask SIGPROF: %s\r\n", strerror(errno));
|
||||
u3l_log("boot: thread mask SIGPROF: %s", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -782,7 +782,7 @@ main(c3_i argc,
|
||||
// initialize curl
|
||||
//
|
||||
if ( 0 != curl_global_init(CURL_GLOBAL_DEFAULT) ) {
|
||||
u3l_log("boot: curl initialization failed\r\n");
|
||||
u3l_log("boot: curl initialization failed");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -603,6 +603,7 @@
|
||||
# define c3__just c3_s4('j','u','s','t')
|
||||
# define c3__keep c3_s4('k','e','e','p')
|
||||
# define c3__kern c3_s4('k','e','r','n')
|
||||
# define c3__key c3_s3('k','e','y')
|
||||
# define c3__kgo c3_s3('k','g','o')
|
||||
# define c3__kick c3_s4('k','i','c','k')
|
||||
# define c3__king c3_s4('k','i','n','g')
|
||||
@ -770,6 +771,7 @@
|
||||
# define c3__ne c3_s2('n','e')
|
||||
# define c3__need c3_s4('n','e','e','d')
|
||||
# define c3__neft c3_s4('n','e','f','t')
|
||||
# define c3__nel c3_s3('n','e','l')
|
||||
# define c3__nest c3_s4('n','e','s','t')
|
||||
# define c3__netd c3_s4('n','e','t','d')
|
||||
# define c3__new c3_s3('n','e','w')
|
||||
@ -1268,6 +1270,7 @@
|
||||
# define c3__wtsg c3_s4('w','t','s','g')
|
||||
# define c3__wtts c3_s4('w','t','t','s')
|
||||
# define c3__wtzp c3_s4('w','t','z','p')
|
||||
# define c3__wyp c3_s3('w','y','p')
|
||||
# define c3__wyrd c3_s4('w','y','r','d')
|
||||
# define c3__yew c3_s3('y','a','w')
|
||||
# define c3__yell c3_s4('y','e','l','l')
|
||||
|
@ -40,7 +40,6 @@ typedef uint32_t ur_mug;
|
||||
#define ur_pail_max 10
|
||||
|
||||
typedef struct ur_pail32_s {
|
||||
uint8_t fill;
|
||||
ur_nref refs[ur_pail_max];
|
||||
uint32_t vals[ur_pail_max];
|
||||
} ur_pail32_t;
|
||||
@ -48,11 +47,11 @@ typedef struct ur_pail32_s {
|
||||
typedef struct ur_dict32_s {
|
||||
uint64_t prev;
|
||||
uint64_t size;
|
||||
uint8_t *fills;
|
||||
ur_pail32_t *buckets;
|
||||
} ur_dict32_t;
|
||||
|
||||
typedef struct ur_pail64_s {
|
||||
uint8_t fill;
|
||||
ur_nref refs[ur_pail_max];
|
||||
uint64_t vals[ur_pail_max];
|
||||
} ur_pail64_t;
|
||||
@ -60,17 +59,18 @@ typedef struct ur_pail64_s {
|
||||
typedef struct ur_dict64_s {
|
||||
uint64_t prev;
|
||||
uint64_t size;
|
||||
uint8_t *fills;
|
||||
ur_pail64_t *buckets;
|
||||
} ur_dict64_t;
|
||||
|
||||
typedef struct ur_pail_s {
|
||||
uint8_t fill;
|
||||
ur_nref refs[ur_pail_max];
|
||||
} ur_pail_t;
|
||||
|
||||
typedef struct ur_dict_s {
|
||||
uint64_t prev;
|
||||
uint64_t size;
|
||||
uint8_t *fills;
|
||||
ur_pail_t *buckets;
|
||||
} ur_dict_t;
|
||||
|
||||
|
@ -145,16 +145,17 @@
|
||||
} siz;
|
||||
|
||||
struct {
|
||||
c3_y* lin_y; // current line (utf8)
|
||||
c3_w byt_w; // utf8 line-length
|
||||
c3_w wor_w; // utf32 line-length
|
||||
c3_w sap_w; // escape chars in line
|
||||
c3_w cus_w; // cursor position
|
||||
u3_noun lin; // bottom line (stub)
|
||||
c3_w rus_w; // cursor position (row)
|
||||
c3_w cus_w; // cursor position (column)
|
||||
} mir;
|
||||
|
||||
struct { // escape code control
|
||||
c3_o ape; // escape received
|
||||
c3_o bra; // bracket or O received
|
||||
c3_o mou; // M (for mouse event) received
|
||||
c3_y ton_y; // mouse button
|
||||
c3_y col_y; // column coordinate
|
||||
} esc;
|
||||
|
||||
struct {
|
||||
@ -180,30 +181,22 @@
|
||||
struct _u3_usig* nex_u;
|
||||
} u3_usig;
|
||||
|
||||
/* u2_utfo: unix terminfo strings.
|
||||
/* u2_utfo: terminal escape sequences
|
||||
*/
|
||||
typedef struct {
|
||||
// disabled, currently unused
|
||||
uv_buf_t mon_u; // mouse reporting on
|
||||
uv_buf_t mof_u; // mouse reporting off
|
||||
//
|
||||
// struct {
|
||||
// uv_buf_t kcuu1_u; // key_up
|
||||
// uv_buf_t kcud1_u; // key_down
|
||||
// uv_buf_t kcub1_u; // key_back
|
||||
// uv_buf_t kcuf1_u; // key_forward
|
||||
// } inn;
|
||||
struct {
|
||||
uv_buf_t clear_u; // clear_screen
|
||||
uv_buf_t el_u; // clr_bol clear to beginning
|
||||
// uv_buf_t el1_u; // clr_eol clear to end
|
||||
uv_buf_t ed_u; // clear to end of screen
|
||||
uv_buf_t bel_u; // bel sound bell
|
||||
uv_buf_t cub1_u; // parm_left
|
||||
uv_buf_t cuf1_u; // parm_right
|
||||
uv_buf_t cuu1_u; // parm_up
|
||||
uv_buf_t cud1_u; // parm_down
|
||||
// uv_buf_t cub_u; // parm_left_cursor #num
|
||||
// uv_buf_t cuf_u; // parm_right_cursor #num
|
||||
} out;
|
||||
uv_buf_t reg_u; // restore scroll region
|
||||
//
|
||||
uv_buf_t suc_u; // save cursor position
|
||||
uv_buf_t ruc_u; // restore cursor position
|
||||
uv_buf_t cub_u; // move cursor left one column
|
||||
//
|
||||
uv_buf_t clr_u; // clear screen
|
||||
uv_buf_t cel_u; // clear to end of line
|
||||
//
|
||||
uv_buf_t bel_u; // bel sound bell
|
||||
} u3_utfo;
|
||||
|
||||
#if 0
|
||||
@ -229,9 +222,8 @@
|
||||
/* u3_ustm: uv stream.
|
||||
*/
|
||||
typedef union _u3_ustm {
|
||||
uv_pipe_t pop_u;
|
||||
uv_tcp_t wax_u;
|
||||
uv_tty_t tty_u;
|
||||
uv_pipe_t pip_u;
|
||||
uv_tty_t tty_u;
|
||||
} u3_ustm;
|
||||
|
||||
/* u3_ttyf: simple unix tty function.
|
||||
@ -254,7 +246,7 @@
|
||||
c3_l* row_l); // return tty window size
|
||||
c3_i fid_i; // file descriptor
|
||||
c3_w tid_l; // terminal identity number
|
||||
u3_utfo ufo_u; // terminfo strings
|
||||
u3_utfo ufo_u; // escape sequences
|
||||
u3_utat tat_u; // control state
|
||||
struct _u3_auto* car_u; // driver hack
|
||||
} u3_utty;
|
||||
@ -1114,7 +1106,7 @@
|
||||
/* u3_term_io_loja(): release console from cooked print.
|
||||
*/
|
||||
void
|
||||
u3_term_io_loja(int x);
|
||||
u3_term_io_loja(int x, FILE* f);
|
||||
|
||||
/* u3_term_log_init(): initialize terminal for logging
|
||||
*/
|
||||
|
@ -11,7 +11,7 @@
|
||||
u3_noun b)
|
||||
{
|
||||
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
|
||||
return u3m_bail(c3__exit);
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
else {
|
||||
c3_g a_g = a;
|
||||
|
@ -98,7 +98,7 @@ _block_rep(u3_atom a,
|
||||
u3_noun b)
|
||||
{
|
||||
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
|
||||
return u3m_bail(c3__exit);
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
else {
|
||||
c3_g a_g = a;
|
||||
@ -169,7 +169,7 @@ u3qc_rep(u3_atom a,
|
||||
return _bit_rep(b, c);
|
||||
}
|
||||
|
||||
u3l_log("rep: stub\r\n");
|
||||
u3l_log("rep: stub");
|
||||
return u3_none;
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ u3qc_rip(u3_atom a,
|
||||
return _bit_rip(b, c);
|
||||
}
|
||||
|
||||
u3l_log("rip: stub\r\n");
|
||||
u3l_log("rip: stub");
|
||||
return u3_none;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
||||
}
|
||||
else {
|
||||
ret = u3_none;
|
||||
u3l_log("argon2-error: %s\r\n", err_c);
|
||||
u3l_log("argon2-error: %s", err_c);
|
||||
}
|
||||
|
||||
u3a_free(out_y);
|
||||
|
@ -14,14 +14,14 @@ u3qe_jam(u3_atom a)
|
||||
siz_w = u3a_count_noun(u3h(som));
|
||||
tot_w += siz_w;
|
||||
if ( 0 == siz_w ) {
|
||||
u3l_log("item: B/0\r\n");
|
||||
u3l_log("item: B/0");
|
||||
}
|
||||
else {
|
||||
u3a_print_memory(stderr, "item", siz_w);
|
||||
}
|
||||
}
|
||||
if ( u3_blip != som ) {
|
||||
u3l_log("forgot to terminate list!\r\n");
|
||||
u3l_log("forgot to terminate list!");
|
||||
}
|
||||
c3_w mem_w = u3h_count(u3R->cax.har_p);
|
||||
|
||||
@ -31,7 +31,7 @@ u3qe_jam(u3_atom a)
|
||||
u3a_print_memory(stderr, "total", tot_w);
|
||||
u3a_print_memory(stderr, "memoization cache", mem_w);
|
||||
u3h_root* har_u = u3to(u3h_root, u3R->cax.har_p);
|
||||
u3l_log("memoization entries: %d\r\n", har_u->use_w);
|
||||
u3l_log("memoization entries: %d", har_u->use_w);
|
||||
u3a_print_memory(stderr, "unused free", u3a_open(u3R));
|
||||
return tot_w;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
// Sanity check: crash if decoding more bits than available
|
||||
if ( c3y == u3qa_gth(x, m)) {
|
||||
// u3l_log("[%%rub-hard %d %d %d]\r\n", a, x, m);
|
||||
// u3l_log("[%%rub-hard %d %d %d]", a, x, m);
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ u3je_secp_init()
|
||||
sec_u = malloc(urcrypt_secp_prealloc_size());
|
||||
|
||||
if ( 0 != urcrypt_secp_init(sec_u, ent_y) ) {
|
||||
u3l_log("u3e_secp_init failed\r\n");
|
||||
u3l_log("u3e_secp_init failed");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
(u3_nul == u3h(hr_con)) &&
|
||||
(u3_nul == u3t(hr_con)) )
|
||||
{
|
||||
u3l_log("old core\r\n");
|
||||
u3l_log("old core");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
u3r_trel(dab, &n_dab, &l_dab, &r_dab);
|
||||
if ( c3n == u3du(n_dab) ) {
|
||||
// return u3m_bail(c3__fail);
|
||||
u3l_log("bad look\r\n");
|
||||
u3l_log("bad look");
|
||||
return u3m_bail(c3__exit) ;
|
||||
}
|
||||
else {
|
||||
|
@ -433,7 +433,7 @@ _ca_willoc(c3_w len_w, c3_w ald_w, c3_w alp_w)
|
||||
sel_w += 1;
|
||||
}
|
||||
|
||||
// u3l_log("walloc %d: *pfr_p %x\n", len_w, u3R->all.fre_p[sel_w]);
|
||||
// u3l_log("walloc %d: *pfr_p %x", len_w, u3R->all.fre_p[sel_w]);
|
||||
while ( 1 ) {
|
||||
u3p(u3a_fbox) *pfr_p = &u3R->all.fre_p[sel_w];
|
||||
|
||||
@ -568,7 +568,7 @@ u3a_walloc(c3_w len_w)
|
||||
u3a_botox(ptr_v) == (u3a_box*)(void *)0x200dfe3e4 ) {
|
||||
static int xuc_i;
|
||||
|
||||
u3l_log("xuc_i %d\r\n", xuc_i);
|
||||
u3l_log("xuc_i %d", xuc_i);
|
||||
if ( 1 == xuc_i ) {
|
||||
u3a_box* box_u = u3a_botox(ptr_v);
|
||||
|
||||
@ -684,7 +684,7 @@ u3a_malloc(size_t len_i)
|
||||
if ( u3a_botox(out_w) == (u3a_box*)(void *)0x3bdd1c80) {
|
||||
static int xuc_i = 0;
|
||||
|
||||
u3l_log("xuc_i %d\r\n", xuc_i);
|
||||
u3l_log("xuc_i %d", xuc_i);
|
||||
// if ( 1 == xuc_i ) { abort(); }
|
||||
xuc_i++;
|
||||
}
|
||||
@ -917,7 +917,7 @@ u3a_free(void* tox_v)
|
||||
c3_w pad_w = tox_w[-1];
|
||||
c3_w* org_w = tox_w - (pad_w + 1);
|
||||
|
||||
// u3l_log("free %p %p\r\n", org_w, tox_w);
|
||||
// u3l_log("free %p %p", org_w, tox_w);
|
||||
u3a_wfree(org_w);
|
||||
}
|
||||
|
||||
@ -1065,7 +1065,7 @@ _ca_take_atom(u3a_atom* old_u)
|
||||
u3_noun new = u3a_to_pug(u3a_outa(new_u));
|
||||
|
||||
#ifdef VERBOSE_TAKE
|
||||
u3l_log("%s: atom %p to %p\r\n", ( c3y == u3a_is_north(u3R) )
|
||||
u3l_log("%s: atom %p to %p", ( c3y == u3a_is_north(u3R) )
|
||||
? "north"
|
||||
: "south",
|
||||
old_u,
|
||||
@ -1103,7 +1103,7 @@ _ca_take_cell(u3a_cell* old_u, u3_noun hed, u3_noun tel)
|
||||
u3_cell new = u3a_to_pom(u3a_outa(new_u));
|
||||
|
||||
#ifdef VERBOSE_TAKE
|
||||
u3l_log("%s: cell %p to %p\r\n", ( c3y == u3a_is_north(u3R) )
|
||||
u3l_log("%s: cell %p to %p", ( c3y == u3a_is_north(u3R) )
|
||||
? "north"
|
||||
: "south",
|
||||
old_u,
|
||||
@ -1162,7 +1162,7 @@ _ca_take_next_north(u3a_pile* pil_u, u3_noun veb)
|
||||
c3_assert( c3y == u3a_north_is_normal(u3R, nov) );
|
||||
|
||||
#ifdef VERBOSE_TAKE
|
||||
u3l_log("north: %p is already %p\r\n", veb_u, u3a_to_ptr(nov));
|
||||
u3l_log("north: %p is already %p", veb_u, u3a_to_ptr(nov));
|
||||
#endif
|
||||
|
||||
_me_gain_use(nov); // bypass branches in u3k()
|
||||
@ -1218,7 +1218,7 @@ _ca_take_next_south(u3a_pile* pil_u, u3_noun veb)
|
||||
c3_assert( c3y == u3a_south_is_normal(u3R, nov) );
|
||||
|
||||
#ifdef VERBOSE_TAKE
|
||||
u3l_log("south: %p is already %p\r\n", veb_u, u3a_to_ptr(nov));
|
||||
u3l_log("south: %p is already %p", veb_u, u3a_to_ptr(nov));
|
||||
#endif
|
||||
|
||||
_me_gain_use(nov); // bypass branches in u3k()
|
||||
|
@ -63,7 +63,7 @@ u3e_check(c3_c* cap_c)
|
||||
}
|
||||
sum_w += mug_w;
|
||||
}
|
||||
u3l_log("%s: sum %x (%x, %x)\r\n", cap_c, sum_w, nor_w, sou_w);
|
||||
u3l_log("%s: sum %x (%x, %x)", cap_c, sum_w, nor_w, sou_w);
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ u3e_fault(void* adr_v, c3_i ser_i)
|
||||
|
||||
#if 0
|
||||
if ( pag_w == 131041 ) {
|
||||
u3l_log("dirty page %d (at %p); unprotecting %p to %p\r\n",
|
||||
u3l_log("dirty page %d (at %p); unprotecting %p to %p",
|
||||
pag_w,
|
||||
adr_v,
|
||||
(u3_Loom + (pag_w << u3a_page)),
|
||||
@ -341,7 +341,7 @@ _ce_patch_verify(u3_ce_patch* pat_u)
|
||||
}
|
||||
#if 0
|
||||
else {
|
||||
u3l_log("verify: patch %d/%d, %x\r\n", pag_w, i_w, mug_w);
|
||||
u3l_log("verify: patch %d/%d, %x", pag_w, i_w, mug_w);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -458,7 +458,7 @@ _ce_patch_save_page(u3_ce_patch* pat_u,
|
||||
(1 << u3a_page));
|
||||
|
||||
#if 0
|
||||
u3l_log("protect a: page %d\r\n", pag_w);
|
||||
u3l_log("protect a: page %d", pag_w);
|
||||
#endif
|
||||
_ce_patch_write_page(pat_u, pgc_w, mem_w);
|
||||
|
||||
@ -484,7 +484,7 @@ _ce_patch_junk_page(u3_ce_patch* pat_u,
|
||||
c3_w blk_w = (pag_w >> 5);
|
||||
c3_w bit_w = (pag_w & 31);
|
||||
|
||||
// u3l_log("protect b: page %d\r\n", pag_w);
|
||||
// u3l_log("protect b: page %d", pag_w);
|
||||
if ( -1 == mprotect(u3_Loom + (pag_w << u3a_page),
|
||||
(1 << (u3a_page + 2)),
|
||||
PROT_READ) )
|
||||
@ -688,7 +688,7 @@ _ce_patch_apply(u3_ce_patch* pat_u)
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
u3l_log("apply: %d, %x\n", pag_w, u3r_mug_words(mem_w, (1 << u3a_page)));
|
||||
u3l_log("apply: %d, %x", pag_w, u3r_mug_words(mem_w, (1 << u3a_page)));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -713,7 +713,7 @@ _ce_image_blit(u3e_image* img_u,
|
||||
c3_w off_w = (ptr_w - u3_Loom);
|
||||
c3_w pag_w = (off_w >> u3a_page);
|
||||
|
||||
u3l_log("blit: page %d, mug %x\r\n", pag_w,
|
||||
u3l_log("blit: page %d, mug %x", pag_w,
|
||||
u3r_mug_words(ptr_w, (1 << u3a_page)));
|
||||
}
|
||||
#endif
|
||||
@ -868,17 +868,17 @@ u3e_live(c3_o nuu_o, c3_c* dir_c)
|
||||
-(1 << u3a_page));
|
||||
|
||||
if ( 0 != mprotect((void *)u3_Loom, u3a_bytes, PROT_READ) ) {
|
||||
u3l_log("loom: live mprotect: %s\r\n", strerror(errno));
|
||||
u3l_log("loom: live mprotect: %s", strerror(errno));
|
||||
c3_assert(0);
|
||||
}
|
||||
|
||||
u3l_log("boot: protected loom\r\n");
|
||||
u3l_log("boot: protected loom");
|
||||
}
|
||||
|
||||
/* If the images were empty, we are logically booting.
|
||||
*/
|
||||
if ( (0 == u3P.nor_u.pgs_w) && (0 == u3P.sou_u.pgs_w) ) {
|
||||
u3l_log("live: logical boot\r\n");
|
||||
u3l_log("live: logical boot");
|
||||
nuu_o = c3y;
|
||||
}
|
||||
else {
|
||||
|
@ -75,7 +75,7 @@ _cj_hash(c3_c* has_c)
|
||||
{
|
||||
c3_w i_w, len_w = strlen(has_c);
|
||||
if ( 64 != len_w ) {
|
||||
u3l_log("bash not 64 characters: %s\r\n", has_c);
|
||||
u3l_log("bash not 64 characters: %s", has_c);
|
||||
c3_assert(0);
|
||||
}
|
||||
c3_assert( 64 == len_w );
|
||||
@ -236,18 +236,18 @@ _cj_axis(u3_noun fol)
|
||||
(0 != p_fol) ||
|
||||
(!_(u3a_is_cat(q_fol))) )
|
||||
{
|
||||
u3l_log("axis: bad a\r\n");
|
||||
u3l_log("axis: bad a");
|
||||
return 0;
|
||||
}
|
||||
return q_fol;
|
||||
}
|
||||
else {
|
||||
if ( 9 != p_fol )
|
||||
{ u3l_log("axis: bad b\r\n"); return 0; }
|
||||
{ u3l_log("axis: bad b"); return 0; }
|
||||
if ( !_(u3a_is_cat(q_fol)) )
|
||||
{ u3l_log("axis: bad c\r\n"); return 0; }
|
||||
{ u3l_log("axis: bad c"); return 0; }
|
||||
if ( !_(u3du(r_fol)) || (0 != u3h(r_fol)) || (1 != u3t(r_fol)) )
|
||||
{ u3l_log("axis: bad d\r\n"); return 0; }
|
||||
{ u3l_log("axis: bad d"); return 0; }
|
||||
|
||||
return q_fol;
|
||||
}
|
||||
@ -278,7 +278,7 @@ _cj_warm_hump(c3_l jax_l, u3_noun huc)
|
||||
((1 << 31) & (axe_l = (c3_w)axe_d)) ||
|
||||
(axe_l < 2) )
|
||||
{
|
||||
u3l_log("jets: activate: bad fcs %s\r\n", jet_u->fcs_c);
|
||||
u3l_log("jets: activate: bad fcs %s", jet_u->fcs_c);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -286,7 +286,7 @@ _cj_warm_hump(c3_l jax_l, u3_noun huc)
|
||||
u3_noun fol = u3kdb_get(u3k(huc), nam);
|
||||
|
||||
if ( u3_none == fol ) {
|
||||
u3l_log("jets: activate: bad fcs %s\r\n", jet_u->fcs_c);
|
||||
u3l_log("jets: activate: bad fcs %s", jet_u->fcs_c);
|
||||
}
|
||||
else {
|
||||
axe_l = _cj_axis(fol);
|
||||
@ -781,7 +781,7 @@ _cj_hot_mean(c3_l par_l, u3_noun nam)
|
||||
while ( (cop_u = &dev_u[i_l])->cos_c ) {
|
||||
if ( _(u3r_sing_c(cop_u->cos_c, nam)) ) {
|
||||
#if 0
|
||||
u3l_log("hot: bound jet %d/%s/%s/\r\n",
|
||||
u3l_log("hot: bound jet %d/%s/%s/",
|
||||
cop_u->jax_l,
|
||||
cop_u->cos_c,
|
||||
par_u ? par_u->cos_c : "~");
|
||||
@ -893,7 +893,7 @@ _cj_kick_z(u3_noun cor, u3j_core* cop_u, u3j_harm* ham_u, u3_atom axe)
|
||||
ham_u->liv = c3y;
|
||||
|
||||
if ( c3n == u3r_sing(ame, pro) ) {
|
||||
u3l_log("test: %s %s: mismatch: good %x, bad %x\r\n",
|
||||
u3l_log("test: %s %s: mismatch: good %x, bad %x",
|
||||
cop_u->cos_c,
|
||||
(!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c,
|
||||
u3r_mug(ame),
|
||||
@ -905,7 +905,7 @@ _cj_kick_z(u3_noun cor, u3j_core* cop_u, u3j_harm* ham_u, u3_atom axe)
|
||||
else {
|
||||
|
||||
#if 0
|
||||
u3l_log("test: %s %s\r\n",
|
||||
u3l_log("test: %s %s",
|
||||
cop_u->cos_c,
|
||||
(!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c);
|
||||
#endif
|
||||
@ -928,13 +928,13 @@ _cj_hook_in(u3_noun cor,
|
||||
u3_noun roc, tem, got, pat, nam, huc;
|
||||
|
||||
if ( c3n == u3du(cor) ) {
|
||||
u3l_log("_cj_hook_in failure: c3n == u3du(cor)\r\n");
|
||||
u3l_log("_cj_hook_in failure: c3n == u3du(cor)");
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
|
||||
loc = _cj_spot(cor, NULL);
|
||||
if ( u3_none == loc ) {
|
||||
u3l_log("_cj_hook_in failure: u3_none == loc\r\n");
|
||||
u3l_log("_cj_hook_in failure: u3_none == loc");
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
|
||||
@ -999,7 +999,7 @@ _cj_hook_in(u3_noun cor,
|
||||
else {
|
||||
u3_noun sat = u3t(pat);
|
||||
if ( c3y == u3h(sat) ) {
|
||||
u3l_log("_cj_hook_in failure: c3y == u3h(sat)\r\n");
|
||||
u3l_log("_cj_hook_in failure: c3y == u3h(sat)");
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
else {
|
||||
@ -1687,7 +1687,7 @@ u3j_gate_prep(u3j_site* sit_u, u3_noun cor)
|
||||
pay = u3qc_cap(pax),
|
||||
pam = u3qc_mas(pax);
|
||||
if ( 3 != pay || 2 == pam || (3 != pam && 3 != u3qc_cap(pam)) ) {
|
||||
u3l_log("u3j_gate_prep(): parent axis includes sample\r\n");
|
||||
u3l_log("u3j_gate_prep(): parent axis includes sample");
|
||||
u3m_p("axis", pax);
|
||||
u3_weak act = _cj_find_warm(loc);
|
||||
c3_assert( u3_none != act );
|
||||
@ -1758,12 +1758,12 @@ _cj_minx(u3_noun cey, u3_noun cor)
|
||||
|
||||
par = u3r_at(axe, cor);
|
||||
if ( u3_none == par || c3n == u3du(par) ) {
|
||||
u3l_log("fund: %s is bogus\r\n", u3r_string(nam));
|
||||
u3l_log("fund: %s is bogus", u3r_string(nam));
|
||||
return u3_none;
|
||||
}
|
||||
pel = _cj_spot(par, NULL);
|
||||
if ( u3_none == pel ) {
|
||||
u3l_log("fund: in %s, parent %x not found at %d\r\n",
|
||||
u3l_log("fund: in %s, parent %x not found at %d",
|
||||
u3r_string(nam),
|
||||
u3r_mug(u3h(par)),
|
||||
axe);
|
||||
@ -1822,7 +1822,7 @@ _cj_mine(u3_noun cey, u3_noun cor, u3_noun bas)
|
||||
jax_l = _cj_hot_mean(par_l, nam);
|
||||
#if 0
|
||||
u3m_p("new jet", bal);
|
||||
u3l_log(" bat %x, jax %d\r\n", u3r_mug(bat), jax_l);
|
||||
u3l_log(" bat %x, jax %d", u3r_mug(bat), jax_l);
|
||||
#endif
|
||||
|
||||
if ( !(u3C.wag_w & u3o_hashless) ) {
|
||||
@ -1840,7 +1840,7 @@ _cj_mine(u3_noun cey, u3_noun cor, u3_noun bas)
|
||||
for ( i_w = 32; i_w > 0; ) {
|
||||
u3l_log("%02x", dig_y[--i_w]);
|
||||
}
|
||||
u3l_log("\r\n");
|
||||
u3l_log("");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1870,7 +1870,7 @@ _cj_mine(u3_noun cey, u3_noun cor, u3_noun bas)
|
||||
|
||||
if ( c3n == hav_o ) {
|
||||
u3m_p("unregistered battery", bal);
|
||||
u3l_log("hash: %x\r\n", bas);
|
||||
u3l_log("hash: %x", bas);
|
||||
}
|
||||
u3z(bas);
|
||||
}
|
||||
@ -2093,7 +2093,7 @@ _cj_ream(u3_noun all)
|
||||
act = u3nq(jax_l, hap, bal, _cj_jit(jax_l, bat));
|
||||
#if 0
|
||||
u3m_p("old jet", bal);
|
||||
u3l_log(" bat %x, jax %d\r\n", u3r_mug(bat), jax_l);
|
||||
u3l_log(" bat %x, jax %d", u3r_mug(bat), jax_l);
|
||||
#endif
|
||||
u3h_put(u3R->jed.war_p, loc, act);
|
||||
}
|
||||
@ -2132,7 +2132,7 @@ _cj_ream(u3_noun all)
|
||||
act = u3nq(jax_l, hap, bal, _cj_jit(jax_l, bat));
|
||||
#if 0
|
||||
u3m_p("old jet", bal);
|
||||
u3l_log(" bat %x, jax %d\r\n", u3r_mug(bat), jax_l);
|
||||
u3l_log(" bat %x, jax %d", u3r_mug(bat), jax_l);
|
||||
#endif
|
||||
u3h_put(u3R->jed.war_p, loc, act);
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ u3l_log(const char* format, ...)
|
||||
// this process did not set a logging function, fallback to stderr
|
||||
//
|
||||
vfprintf(stderr, format, myargs);
|
||||
fprintf(stderr, "\r\n");
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
va_end(myargs);
|
||||
|
@ -318,7 +318,7 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
|
||||
|
||||
while ( rod_u->kid_p ) {
|
||||
#if 0
|
||||
u3l_log("collecting %d frames\r\n",
|
||||
u3l_log("collecting %d frames",
|
||||
u3kb_lent((u3to(u3_road, rod_u->kid_p)->bug.tax));
|
||||
#endif
|
||||
tax = u3kb_weld(_cm_stack_recover(u3to(u3_road, rod_u->kid_p)), tax);
|
||||
@ -372,7 +372,7 @@ _cm_signal_deep(c3_w mil_w)
|
||||
itm_u.it_value.tv_usec = 1000 * (mil_w % 1000);
|
||||
|
||||
if ( rsignal_setitimer(ITIMER_VIRTUAL, &itm_u, 0) ) {
|
||||
u3l_log("loom: set timer failed %s\r\n", strerror(errno));
|
||||
u3l_log("loom: set timer failed %s", strerror(errno));
|
||||
}
|
||||
else {
|
||||
rsignal_install_handler(SIGVTALRM, _cm_signal_handle_alrm);
|
||||
@ -405,7 +405,7 @@ _cm_signal_done()
|
||||
timerclear(&itm_u.it_value);
|
||||
|
||||
if ( rsignal_setitimer(ITIMER_VIRTUAL, &itm_u, 0) ) {
|
||||
u3l_log("loom: clear timer failed %s\r\n", strerror(errno));
|
||||
u3l_log("loom: clear timer failed %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -437,7 +437,7 @@ u3m_file(c3_c* pas_c)
|
||||
c3_y* pad_y;
|
||||
|
||||
if ( (fid_i < 0) || (fstat(fid_i, &buf_b) < 0) ) {
|
||||
u3l_log("%s: %s\r\n", pas_c, strerror(errno));
|
||||
u3l_log("%s: %s", pas_c, strerror(errno));
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
fln_w = buf_b.st_size;
|
||||
@ -632,7 +632,7 @@ u3m_dump(void)
|
||||
fre_u = fre_u->nex_u;
|
||||
}
|
||||
}
|
||||
u3l_log("dump: hat_w %x, fre_w %x, allocated %x\n",
|
||||
u3l_log("dump: hat_w %x, fre_w %x, allocated %x",
|
||||
hat_w, fre_w, (hat_w - fre_w));
|
||||
|
||||
if ( 0 != (hat_w - fre_w) ) {
|
||||
@ -644,14 +644,14 @@ u3m_dump(void)
|
||||
|
||||
if ( 0 != box_u->use_w ) {
|
||||
#ifdef U3_MEMORY_DEBUG
|
||||
// u3l_log("live %d words, code %x\n", box_u->siz_w, box_u->cod_w);
|
||||
// u3l_log("live %d words, code %x", box_u->siz_w, box_u->cod_w);
|
||||
#endif
|
||||
mem_w += box_u->siz_w;
|
||||
}
|
||||
box_w += box_u->siz_w;
|
||||
}
|
||||
|
||||
u3l_log("second count: %x\n", mem_w);
|
||||
u3l_log("second count: %x", mem_w);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1548,7 +1548,7 @@ u3m_p(const c3_c* cap_c, u3_noun som)
|
||||
{
|
||||
c3_c* pre_c = u3m_pretty(som);
|
||||
|
||||
u3l_log("%s: %s\r\n", cap_c, pre_c);
|
||||
u3l_log("%s: %s", cap_c, pre_c);
|
||||
c3_free(pre_c);
|
||||
}
|
||||
|
||||
@ -1609,7 +1609,7 @@ _cm_limits(void)
|
||||
rlm.rlim_cur = c3_min(rlm.rlim_max, (65536 << 10));
|
||||
|
||||
if ( 0 != setrlimit(RLIMIT_STACK, &rlm) ) {
|
||||
u3l_log("boot: stack size: %s\r\n", strerror(errno));
|
||||
u3l_log("boot: stack size: %s", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -1628,7 +1628,7 @@ _cm_limits(void)
|
||||
// no exit, not a critical limit
|
||||
//
|
||||
if ( 0 != setrlimit(RLIMIT_NOFILE, &rlm) ) {
|
||||
u3l_log("boot: open file limit: %s\r\n", strerror(errno));
|
||||
u3l_log("boot: open file limit: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1642,7 +1642,7 @@ _cm_limits(void)
|
||||
// no exit, not a critical limit
|
||||
//
|
||||
if ( 0 != setrlimit(RLIMIT_CORE, &rlm) ) {
|
||||
u3l_log("boot: core limit: %s\r\n", strerror(errno));
|
||||
u3l_log("boot: core limit: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
# endif
|
||||
@ -1665,7 +1665,7 @@ _cm_signals(void)
|
||||
// access and stack overflow exceptions. It calls u3e_fault directly.
|
||||
# else
|
||||
if ( 0 != sigsegv_install_handler(u3e_fault) ) {
|
||||
u3l_log("boot: sigsegv install failed\n");
|
||||
u3l_log("boot: sigsegv install failed");
|
||||
exit(1);
|
||||
}
|
||||
# endif
|
||||
@ -1681,7 +1681,7 @@ _cm_signals(void)
|
||||
sigaddset(&set, SIGPROF);
|
||||
|
||||
if ( 0 != pthread_sigmask(SIG_BLOCK, &set, NULL) ) {
|
||||
u3l_log("boot: thread mask SIGPROF: %s\r\n", strerror(errno));
|
||||
u3l_log("boot: thread mask SIGPROF: %s", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -1737,17 +1737,17 @@ u3m_init(void)
|
||||
MAP_ANON | MAP_PRIVATE,
|
||||
-1, 0);
|
||||
|
||||
u3l_log("boot: mapping %dMB failed\r\n", (len_w / (1024 * 1024)));
|
||||
u3l_log("boot: mapping %dMB failed", (len_w / (1024 * 1024)));
|
||||
u3l_log("see urbit.org/using/install/#about-swap-space"
|
||||
" for adding swap space\r\n");
|
||||
if ( -1 != (c3_ps)dyn_v ) {
|
||||
u3l_log("if porting to a new platform, try U3_OS_LoomBase %p\r\n",
|
||||
if ( -1 != (c3_ps)map_v ) {
|
||||
u3l_log("if porting to a new platform, try U3_OS_LoomBase %p",
|
||||
dyn_v);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
u3l_log("loom: mapped %dMB\r\n", len_w >> 20);
|
||||
u3l_log("loom: mapped %dMB", len_w >> 20);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1788,7 +1788,7 @@ u3m_boot(c3_c* dir_c)
|
||||
*/
|
||||
{
|
||||
c3_w len_w = u3j_boot(nuu_o);
|
||||
u3l_log("boot: installed %d jets\r\n", len_w);
|
||||
u3l_log("boot: installed %d jets", len_w);
|
||||
}
|
||||
|
||||
/* Reactivate jets on old kernel.
|
||||
|
@ -44,7 +44,7 @@ _n_hint(u3_noun zep,
|
||||
low_i = 1;
|
||||
if ( 0 == (u3R->pro.nox_d % 65536ULL) ) {
|
||||
if ( c3__spot == zep ) {
|
||||
u3l_log("spot %d/%d : %d/%d\r\n",
|
||||
u3l_log("spot %d/%d : %d/%d",
|
||||
u3h(u3h(u3t(hod))),
|
||||
u3t(u3h(u3t(hod))),
|
||||
u3h(u3t(u3t(hod))),
|
||||
|
@ -167,7 +167,7 @@ _t_samp_process(u3_road* rod_u)
|
||||
pef = t_pef;
|
||||
}
|
||||
|
||||
// u3l_log("sample: stack length %d\r\n", u3kb_lent(u3k(pal)));
|
||||
// u3l_log("sample: stack length %d", u3kb_lent(u3k(pal)));
|
||||
return pal;
|
||||
}
|
||||
}
|
||||
@ -540,7 +540,7 @@ u3t_boot(void)
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGPROF);
|
||||
if ( 0 != pthread_sigmask(SIG_UNBLOCK, &set, NULL) ) {
|
||||
u3l_log("trace: thread mask SIGPROF: %s\r\n", strerror(errno));
|
||||
u3l_log("trace: thread mask SIGPROF: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -569,7 +569,7 @@ u3t_boff(void)
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGPROF);
|
||||
if ( 0 != pthread_sigmask(SIG_BLOCK, &set, NULL) ) {
|
||||
u3l_log("trace: thread mask SIGPROF: %s\r\n", strerror(errno));
|
||||
u3l_log("trace: thread mask SIGPROF: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,9 +60,9 @@ _cv_lite(u3_noun pil)
|
||||
eve = tal;
|
||||
}
|
||||
|
||||
u3l_log("lite: arvo formula %x\r\n", u3r_mug(pil));
|
||||
u3l_log("lite: arvo formula %x", u3r_mug(pil));
|
||||
pro = u3v_life(u3k(eve));
|
||||
u3l_log("lite: core %x\r\n", u3r_mug(pro));
|
||||
u3l_log("lite: core %x", u3r_mug(pro));
|
||||
|
||||
u3z(pil);
|
||||
return pro;
|
||||
@ -89,7 +89,7 @@ u3v_boot_lite(u3_noun pil)
|
||||
u3z(pro);
|
||||
}
|
||||
|
||||
u3l_log("lite: final state %x\r\n", u3r_mug(u3A->roc));
|
||||
u3l_log("lite: final state %x", u3r_mug(u3A->roc));
|
||||
|
||||
return c3y;
|
||||
}
|
||||
@ -209,7 +209,7 @@ _cv_mole(u3_noun fot,
|
||||
(0 != q_uco) ||
|
||||
(c3n == u3r_sing(fot, r_uco)) )
|
||||
{
|
||||
u3l_log("strange mole %s\n", u3r_string(san)));
|
||||
u3l_log("strange mole %s", u3r_string(san)));
|
||||
|
||||
u3z(fot); u3z(uco); return c3n;
|
||||
}
|
||||
|
@ -33,15 +33,17 @@ void
|
||||
ur_dict32_grow(ur_root_t *r, ur_dict32_t *dict, uint64_t prev, uint64_t size)
|
||||
{
|
||||
ur_pail32_t *buckets, *old_buckets = dict->buckets;
|
||||
uint8_t *fills, *old_fills = dict->fills;
|
||||
uint64_t old_size = dict->size;
|
||||
uint64_t i, next = prev + size;
|
||||
|
||||
buckets = _oom("dict32_grow", calloc(next, sizeof(*buckets)));
|
||||
fills = _oom("dict32_grow", calloc(next, sizeof(*fills)));
|
||||
|
||||
if ( old_buckets ) {
|
||||
for ( i = 0; i < old_size; i++ ) {
|
||||
ur_pail32_t *old_bucket = &(old_buckets[i]);
|
||||
uint8_t j, old_fill = old_bucket->fill;
|
||||
uint8_t j, old_fill = old_fills[i];
|
||||
|
||||
for ( j = 0; j < old_fill; j++ ) {
|
||||
uint32_t val = old_bucket->vals[j];
|
||||
@ -50,24 +52,27 @@ ur_dict32_grow(ur_root_t *r, ur_dict32_t *dict, uint64_t prev, uint64_t size)
|
||||
|
||||
uint64_t idx = ( mug % next );
|
||||
ur_pail32_t *bucket = &(buckets[idx]);
|
||||
uint8_t new_fill = bucket->fill;
|
||||
uint8_t new_fill = fills[idx];
|
||||
|
||||
if ( ur_pail_max == new_fill ) {
|
||||
free(buckets);
|
||||
free(fills);
|
||||
return ur_dict32_grow(r, dict, size, next);
|
||||
}
|
||||
|
||||
bucket->refs[new_fill] = ref;
|
||||
bucket->vals[new_fill] = val;
|
||||
bucket->fill = 1 + new_fill;
|
||||
fills[idx] = 1 + new_fill;
|
||||
}
|
||||
}
|
||||
|
||||
free(old_buckets);
|
||||
free(old_fills);
|
||||
}
|
||||
|
||||
dict->prev = size;
|
||||
dict->size = next;
|
||||
dict->fills = fills;
|
||||
dict->buckets = buckets;
|
||||
}
|
||||
|
||||
@ -78,7 +83,7 @@ ur_dict32_get(ur_root_t *r, ur_dict32_t *dict, ur_nref ref, uint32_t *out)
|
||||
uint64_t idx = ( mug % dict->size );
|
||||
|
||||
ur_pail32_t *bucket = &(dict->buckets[idx]);
|
||||
uint8_t i, fill = bucket->fill;
|
||||
uint8_t i, fill = dict->fills[idx];
|
||||
|
||||
for ( i = 0; i < fill; i++ ) {
|
||||
if ( ref == bucket->refs[i] ) {
|
||||
@ -98,7 +103,7 @@ ur_dict32_put(ur_root_t *r, ur_dict32_t *dict, ur_nref ref, uint32_t val)
|
||||
while ( 1 ) {
|
||||
uint64_t idx = ( mug % dict->size );
|
||||
ur_pail32_t *bucket = &(dict->buckets[idx]);
|
||||
uint8_t i, fill = bucket->fill;
|
||||
uint8_t i, fill = dict->fills[idx];
|
||||
|
||||
for ( i = 0; i < fill; i++ ) {
|
||||
if ( ref == bucket->refs[i] ) {
|
||||
@ -114,7 +119,7 @@ ur_dict32_put(ur_root_t *r, ur_dict32_t *dict, ur_nref ref, uint32_t val)
|
||||
|
||||
bucket->refs[fill] = ref;
|
||||
bucket->vals[fill] = val;
|
||||
bucket->fill = 1 + fill;
|
||||
dict->fills[idx] = 1 + fill;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -122,27 +127,27 @@ ur_dict32_put(ur_root_t *r, ur_dict32_t *dict, ur_nref ref, uint32_t val)
|
||||
void
|
||||
ur_dict32_wipe(ur_dict32_t *dict)
|
||||
{
|
||||
ur_pail32_t *buckets = dict->buckets;
|
||||
uint64_t i, size = dict->size;
|
||||
uint8_t *fills = dict->fills;
|
||||
uint64_t size = dict->size;
|
||||
|
||||
for ( i = 0; i < size; i++ ) {
|
||||
buckets[i].fill = 0;
|
||||
}
|
||||
memset(fills, 0, sizeof(*fills) * size);
|
||||
}
|
||||
|
||||
void
|
||||
ur_dict64_grow(ur_root_t *r, ur_dict64_t *dict, uint64_t prev, uint64_t size)
|
||||
{
|
||||
ur_pail64_t *buckets, *old_buckets = dict->buckets;
|
||||
uint8_t *fills, *old_fills = dict->fills;
|
||||
uint64_t old_size = dict->size;
|
||||
uint64_t i, next = prev + size;
|
||||
|
||||
buckets = _oom("dict64_grow", calloc(next, sizeof(*buckets)));
|
||||
fills = _oom("dict64_grow", calloc(next, sizeof(*fills)));
|
||||
|
||||
if ( old_buckets ) {
|
||||
for ( i = 0; i < old_size; i++ ) {
|
||||
ur_pail64_t *old_bucket = &(old_buckets[i]);
|
||||
uint8_t j, old_fill = old_bucket->fill;
|
||||
uint8_t j, old_fill = old_fills[i];
|
||||
|
||||
for ( j = 0; j < old_fill; j++ ) {
|
||||
uint64_t val = old_bucket->vals[j];
|
||||
@ -151,24 +156,27 @@ ur_dict64_grow(ur_root_t *r, ur_dict64_t *dict, uint64_t prev, uint64_t size)
|
||||
|
||||
uint64_t idx = ( mug % next );
|
||||
ur_pail64_t *bucket = &(buckets[idx]);
|
||||
uint8_t new_fill = bucket->fill;
|
||||
uint8_t new_fill = fills[idx];
|
||||
|
||||
if ( ur_pail_max == new_fill ) {
|
||||
free(buckets);
|
||||
free(fills);
|
||||
return ur_dict64_grow(r, dict, size, next);
|
||||
}
|
||||
|
||||
bucket->refs[new_fill] = ref;
|
||||
bucket->vals[new_fill] = val;
|
||||
bucket->fill = 1 + new_fill;
|
||||
fills[idx] = 1 + new_fill;
|
||||
}
|
||||
}
|
||||
|
||||
free(old_buckets);
|
||||
free(old_fills);
|
||||
}
|
||||
|
||||
dict->prev = size;
|
||||
dict->size = next;
|
||||
dict->fills = fills;
|
||||
dict->buckets = buckets;
|
||||
}
|
||||
|
||||
@ -179,7 +187,7 @@ ur_dict64_get(ur_root_t *r, ur_dict64_t *dict, ur_nref ref, uint64_t *out)
|
||||
uint64_t idx = ( mug % dict->size );
|
||||
|
||||
ur_pail64_t *bucket = &(dict->buckets[idx]);
|
||||
uint8_t i, fill = bucket->fill;
|
||||
uint8_t i, fill = dict->fills[idx];
|
||||
|
||||
for ( i = 0; i < fill; i++ ) {
|
||||
if ( ref == bucket->refs[i] ) {
|
||||
@ -199,7 +207,7 @@ ur_dict64_put(ur_root_t *r, ur_dict64_t *dict, ur_nref ref, uint64_t val)
|
||||
while ( 1 ) {
|
||||
uint64_t idx = ( mug % dict->size );
|
||||
ur_pail64_t *bucket = &(dict->buckets[idx]);
|
||||
uint8_t i, fill = bucket->fill;
|
||||
uint8_t i, fill = dict->fills[idx];
|
||||
|
||||
for ( i = 0; i < fill; i++ ) {
|
||||
if ( ref == bucket->refs[i] ) {
|
||||
@ -215,7 +223,7 @@ ur_dict64_put(ur_root_t *r, ur_dict64_t *dict, ur_nref ref, uint64_t val)
|
||||
|
||||
bucket->refs[fill] = ref;
|
||||
bucket->vals[fill] = val;
|
||||
bucket->fill = 1 + fill;
|
||||
dict->fills[idx] = 1 + fill;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -223,27 +231,27 @@ ur_dict64_put(ur_root_t *r, ur_dict64_t *dict, ur_nref ref, uint64_t val)
|
||||
void
|
||||
ur_dict64_wipe(ur_dict64_t *dict)
|
||||
{
|
||||
ur_pail64_t *buckets = dict->buckets;
|
||||
uint64_t i, size = dict->size;
|
||||
uint8_t *fills = dict->fills;
|
||||
uint64_t size = dict->size;
|
||||
|
||||
for ( i = 0; i < size; i++ ) {
|
||||
buckets[i].fill = 0;
|
||||
}
|
||||
memset(fills, 0, sizeof(*fills) * size);
|
||||
}
|
||||
|
||||
void
|
||||
ur_dict_grow(ur_root_t *r, ur_dict_t *dict, uint64_t prev, uint64_t size)
|
||||
{
|
||||
ur_pail_t *buckets, *old_buckets = dict->buckets;
|
||||
uint8_t *fills, *old_fills = dict->fills;
|
||||
uint64_t old_size = dict->size;
|
||||
uint64_t i, next = prev + size;
|
||||
|
||||
buckets = _oom("dict_grow", calloc(next, sizeof(*buckets)));
|
||||
fills = _oom("dict_grow", calloc(next, sizeof(*fills)));
|
||||
|
||||
if ( old_buckets ) {
|
||||
for ( i = 0; i < old_size; i++ ) {
|
||||
ur_pail_t *old_bucket = &(old_buckets[i]);
|
||||
uint8_t j, old_fill = old_bucket->fill;
|
||||
uint8_t j, old_fill = old_fills[i];
|
||||
|
||||
for ( j = 0; j < old_fill; j++ ) {
|
||||
ur_nref ref = old_bucket->refs[j];
|
||||
@ -251,23 +259,26 @@ ur_dict_grow(ur_root_t *r, ur_dict_t *dict, uint64_t prev, uint64_t size)
|
||||
|
||||
uint64_t idx = ( mug % next );
|
||||
ur_pail_t *bucket = &(buckets[idx]);
|
||||
uint8_t new_fill = bucket->fill;
|
||||
uint8_t new_fill = fills[idx];
|
||||
|
||||
if ( ur_pail_max == new_fill ) {
|
||||
free(buckets);
|
||||
free(fills);
|
||||
return ur_dict_grow(r, dict, size, next);
|
||||
}
|
||||
|
||||
bucket->refs[new_fill] = ref;
|
||||
bucket->fill = 1 + new_fill;
|
||||
fills[idx] = 1 + new_fill;
|
||||
}
|
||||
}
|
||||
|
||||
free(old_buckets);
|
||||
free(old_fills);
|
||||
}
|
||||
|
||||
dict->prev = size;
|
||||
dict->size = next;
|
||||
dict->fills = fills;
|
||||
dict->buckets = buckets;
|
||||
}
|
||||
|
||||
@ -278,7 +289,7 @@ ur_dict_get(ur_root_t *r, ur_dict_t *dict, ur_nref ref)
|
||||
uint64_t idx = ( mug % dict->size );
|
||||
|
||||
ur_pail_t *bucket = &(dict->buckets[idx]);
|
||||
uint8_t i, fill = bucket->fill;
|
||||
uint8_t i, fill = dict->fills[idx];
|
||||
|
||||
for ( i = 0; i < fill; i++ ) {
|
||||
if ( ref == bucket->refs[i] ) {
|
||||
@ -297,7 +308,7 @@ ur_dict_put(ur_root_t *r, ur_dict_t *dict, ur_nref ref)
|
||||
while ( 1 ) {
|
||||
uint64_t idx = ( mug % dict->size );
|
||||
ur_pail_t *bucket = &(dict->buckets[idx]);
|
||||
uint8_t i, fill = bucket->fill;
|
||||
uint8_t i, fill = dict->fills[idx];
|
||||
|
||||
for ( i = 0; i < fill; i++ ) {
|
||||
if ( ref == bucket->refs[i] ) {
|
||||
@ -311,7 +322,7 @@ ur_dict_put(ur_root_t *r, ur_dict_t *dict, ur_nref ref)
|
||||
}
|
||||
|
||||
bucket->refs[fill] = ref;
|
||||
bucket->fill = 1 + fill;
|
||||
dict->fills[idx] = 1 + fill;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -319,18 +330,17 @@ ur_dict_put(ur_root_t *r, ur_dict_t *dict, ur_nref ref)
|
||||
void
|
||||
ur_dict_wipe(ur_dict_t *dict)
|
||||
{
|
||||
ur_pail_t *buckets = dict->buckets;
|
||||
uint64_t i, size = dict->size;
|
||||
uint8_t *fills = dict -> fills;
|
||||
uint64_t size = dict->size;
|
||||
|
||||
for ( i = 0; i < size; i++ ) {
|
||||
buckets[i].fill = 0;
|
||||
}
|
||||
memset(fills, 0, sizeof(*fills) * size);
|
||||
}
|
||||
|
||||
void
|
||||
ur_dict_free(ur_dict_t *dict)
|
||||
{
|
||||
free(dict->buckets);
|
||||
free(dict->fills);
|
||||
dict->buckets = 0;
|
||||
}
|
||||
|
||||
@ -613,7 +623,7 @@ ur_coin_bytes_unsafe(ur_root_t *r, uint64_t len, uint8_t *byt)
|
||||
while ( 1 ) {
|
||||
uint64_t idx = ( mug % dict->size );
|
||||
ur_pail_t *bucket = &(dict->buckets[idx]);
|
||||
uint8_t i, b_fill = bucket->fill;
|
||||
uint8_t i, b_fill = dict->fills[idx];
|
||||
ur_nref tom;
|
||||
|
||||
for ( i = 0; i < b_fill; i++ ) {
|
||||
@ -642,7 +652,7 @@ ur_coin_bytes_unsafe(ur_root_t *r, uint64_t len, uint8_t *byt)
|
||||
tom = _coin_unsafe(atoms, mug, len, byt);
|
||||
|
||||
bucket->refs[b_fill] = tom;
|
||||
bucket->fill = 1 + b_fill;
|
||||
dict->fills[idx] = 1 + b_fill;
|
||||
|
||||
return tom;
|
||||
}
|
||||
@ -712,7 +722,7 @@ ur_cons(ur_root_t *r, ur_nref hed, ur_nref tal)
|
||||
while ( 1 ) {
|
||||
uint64_t idx = ( mug % dict->size );
|
||||
ur_pail_t *bucket = &(dict->buckets[idx]);
|
||||
uint8_t i, b_fill = bucket->fill;
|
||||
uint8_t i, b_fill = dict->fills[idx];
|
||||
ur_nref cel;
|
||||
|
||||
for ( i = 0; i < b_fill; i++ ) {
|
||||
@ -737,7 +747,7 @@ ur_cons(ur_root_t *r, ur_nref hed, ur_nref tal)
|
||||
cel = _cons_unsafe(cells, mug, hed, tal);
|
||||
|
||||
bucket->refs[b_fill] = cel;
|
||||
bucket->fill = 1 + b_fill;
|
||||
dict->fills[idx] = 1 + b_fill;
|
||||
|
||||
return cel;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ u3_auto_bail_slog(u3_ovum* egg_u, u3_noun lud)
|
||||
c3_w len_w = 1;
|
||||
|
||||
while ( u3_nul != dul ) {
|
||||
u3l_log("%s: bail %u\r\n", car_c, len_w++);
|
||||
u3l_log("%s: bail %u", car_c, len_w++);
|
||||
u3_pier_punt_goof(car_c, u3k(u3h(dul)));
|
||||
|
||||
dul = u3t(dul);
|
||||
@ -240,7 +240,7 @@ _auto_kick_lost(u3_noun pax, u3_noun fav)
|
||||
c3_c* tag_c = u3r_string(u3h(fav));
|
||||
c3_c* pax_c = u3r_string(tox);
|
||||
|
||||
u3l_log("kick: lost %%%s on %s\n", tag_c, pax_c);
|
||||
u3l_log("kick: lost %%%s on %s", tag_c, pax_c);
|
||||
|
||||
c3_free(pax_c);
|
||||
c3_free(tag_c);
|
||||
@ -360,12 +360,12 @@ u3_auto_info(u3_auto* car_u)
|
||||
{
|
||||
u3_auto* nex_u;
|
||||
|
||||
u3l_log(" drivers:\n");
|
||||
u3l_log(" drivers:");
|
||||
|
||||
while ( car_u ) {
|
||||
nex_u = car_u->nex_u;
|
||||
|
||||
u3l_log(" %.*s: live=%s, queue=%u\n",
|
||||
u3l_log(" %.*s: live=%s, queue=%u",
|
||||
u3r_met(3, car_u->nam_m),
|
||||
(c3_c*)&car_u->nam_m,
|
||||
( c3y == car_u->liv_o ) ? "&" : "|",
|
||||
|
@ -71,7 +71,7 @@ _dawn_post_json(c3_c* url_c, uv_buf_t lod_u)
|
||||
uv_buf_t buf_u = uv_buf_init(c3_malloc(1), 0);
|
||||
|
||||
if ( !(curl = curl_easy_init()) ) {
|
||||
u3l_log("failed to initialize libcurl\n");
|
||||
u3l_log("failed to initialize libcurl");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -95,12 +95,12 @@ _dawn_post_json(c3_c* url_c, uv_buf_t lod_u)
|
||||
|
||||
// XX retry?
|
||||
if ( CURLE_OK != result ) {
|
||||
u3l_log("failed to fetch %s: %s\n",
|
||||
u3l_log("failed to fetch %s: %s",
|
||||
url_c, curl_easy_strerror(result));
|
||||
exit(1);
|
||||
}
|
||||
if ( 300 <= cod_l ) {
|
||||
u3l_log("error fetching %s: HTTP %ld\n", url_c, cod_l);
|
||||
u3l_log("error fetching %s: HTTP %ld", url_c, cod_l);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ _dawn_get_jam(c3_c* url_c)
|
||||
uv_buf_t buf_u = uv_buf_init(c3_malloc(1), 0);
|
||||
|
||||
if ( !(curl = curl_easy_init()) ) {
|
||||
u3l_log("failed to initialize libcurl\n");
|
||||
u3l_log("failed to initialize libcurl");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -138,12 +138,12 @@ _dawn_get_jam(c3_c* url_c)
|
||||
|
||||
// XX retry?
|
||||
if ( CURLE_OK != result ) {
|
||||
u3l_log("failed to fetch %s: %s\n",
|
||||
u3l_log("failed to fetch %s: %s",
|
||||
url_c, curl_easy_strerror(result));
|
||||
exit(1);
|
||||
}
|
||||
if ( 300 <= cod_l ) {
|
||||
u3l_log("error fetching %s: HTTP %ld\n", url_c, cod_l);
|
||||
u3l_log("error fetching %s: HTTP %ld", url_c, cod_l);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ _dawn_fail(u3_noun who, u3_noun rac, u3_noun sas)
|
||||
}
|
||||
}
|
||||
|
||||
u3l_log("boot: invalid keys for %s '%s'\r\n", rac_c, how_c);
|
||||
u3l_log("boot: invalid keys for %s '%s'", rac_c, how_c);
|
||||
|
||||
// XX deconstruct sas, print helpful error messages
|
||||
while ( u3_nul != sas ) {
|
||||
@ -226,7 +226,7 @@ static u3_noun
|
||||
_dawn_need_unit(u3_noun nit, c3_c* msg_c)
|
||||
{
|
||||
if ( u3_nul == nit ) {
|
||||
u3l_log("%s\r\n", msg_c);
|
||||
u3l_log("%s", msg_c);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
@ -245,7 +245,7 @@ _dawn_purl(u3_noun rac)
|
||||
|
||||
if ( 0 == u3_Host.ops_u.eth_c ) {
|
||||
if ( c3__czar == rac ) {
|
||||
u3l_log("boot: galaxy requires ethereum gateway via -e\r\n");
|
||||
u3l_log("boot: galaxy requires ethereum gateway via -e");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ _dawn_purl(u3_noun rac)
|
||||
|
||||
if ( u3_nul == rul ) {
|
||||
if ( c3__czar == rac ) {
|
||||
u3l_log("boot: galaxy requires ethereum gateway via -e\r\n");
|
||||
u3l_log("boot: galaxy requires ethereum gateway via -e");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -292,11 +292,11 @@ _dawn_turf(c3_c* dns_c)
|
||||
u3_noun rul = u3dc("rush", u3k(dns), u3k(par));
|
||||
|
||||
if ( (u3_nul == rul) || (c3n == u3h(u3t(rul))) ) {
|
||||
u3l_log("boot: invalid domain specified with -H %s\r\n", dns_c);
|
||||
u3l_log("boot: invalid domain specified with -H %s", dns_c);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
u3l_log("boot: overriding network domains with %s\r\n", dns_c);
|
||||
u3l_log("boot: overriding network domains with %s", dns_c);
|
||||
u3_noun dom = u3t(u3t(rul));
|
||||
tuf = u3nc(u3k(dom), u3_nul);
|
||||
}
|
||||
@ -345,7 +345,7 @@ u3_dawn_vent(u3_noun ship, u3_noun feed)
|
||||
// pin block number
|
||||
//
|
||||
{
|
||||
u3l_log("boot: retrieving latest block\r\n");
|
||||
u3l_log("boot: retrieving latest block");
|
||||
|
||||
u3_noun oct = u3v_wish("bloq:give:dawn");
|
||||
u3_noun kob = _dawn_eth_rpc(url_c, u3k(oct));
|
||||
@ -369,7 +369,7 @@ u3_dawn_vent(u3_noun ship, u3_noun feed)
|
||||
pot = u3v_wish("*point:azimuth");
|
||||
}
|
||||
else {
|
||||
u3l_log("boot: retrieving %s's public keys\r\n",
|
||||
u3l_log("boot: retrieving %s's public keys",
|
||||
u3_Host.ops_u.who_c);
|
||||
|
||||
{
|
||||
@ -388,7 +388,7 @@ u3_dawn_vent(u3_noun ship, u3_noun feed)
|
||||
u3_noun liv = u3_nul;
|
||||
// u3_noun liv = _dawn_get_json(parent, /some/url)
|
||||
|
||||
u3l_log("boot: verifying keys\r\n");
|
||||
u3l_log("boot: verifying keys");
|
||||
|
||||
// (each seed (lest error=@tas))
|
||||
//
|
||||
@ -400,7 +400,7 @@ u3_dawn_vent(u3_noun ship, u3_noun feed)
|
||||
return u3_none;
|
||||
}
|
||||
|
||||
u3l_log("boot: getting sponsor\r\n");
|
||||
u3l_log("boot: getting sponsor");
|
||||
pos = _dawn_sponsor(u3k(ship), u3k(rank), u3k(pot));
|
||||
u3z(pot); u3z(liv);
|
||||
}
|
||||
@ -409,7 +409,7 @@ u3_dawn_vent(u3_noun ship, u3_noun feed)
|
||||
// (map ship [=life =pass]): galaxy table
|
||||
//
|
||||
{
|
||||
u3l_log("boot: retrieving galaxy table\r\n");
|
||||
u3l_log("boot: retrieving galaxy table");
|
||||
|
||||
u3_noun oct = u3do("czar:give:dawn", u3k(bok));
|
||||
u3_noun raz = _dawn_eth_rpc(url_c, u3k(oct));
|
||||
@ -425,7 +425,7 @@ u3_dawn_vent(u3_noun ship, u3_noun feed)
|
||||
tuf = _dawn_turf(u3_Host.ops_u.dns_c);
|
||||
}
|
||||
else {
|
||||
u3l_log("boot: retrieving network domains\r\n");
|
||||
u3l_log("boot: retrieving network domains");
|
||||
|
||||
u3_noun oct = u3do("turf:give:dawn", u3k(bok));
|
||||
u3_noun fut = _dawn_eth_rpc(url_c, u3k(oct));
|
||||
@ -443,7 +443,7 @@ u3_dawn_vent(u3_noun ship, u3_noun feed)
|
||||
{
|
||||
u3_noun who = u3dc("scot", 'p', u3k(pos));
|
||||
c3_c* who_c = u3r_string(who);
|
||||
u3l_log("boot: retrieving keys for sponsor %s\r\n", who_c);
|
||||
u3l_log("boot: retrieving keys for sponsor %s", who_c);
|
||||
u3z(who);
|
||||
c3_free(who_c);
|
||||
}
|
||||
@ -495,8 +495,8 @@ _dawn_come(u3_noun stars)
|
||||
c3_rand(eny_w);
|
||||
eny = u3i_words(16, eny_w);
|
||||
|
||||
u3l_log("boot: mining a comet. May take up to an hour.\r\n");
|
||||
u3l_log("If you want to boot faster, get an Urbit identity.\r\n");
|
||||
u3l_log("boot: mining a comet. May take up to an hour.");
|
||||
u3l_log("If you want to boot faster, get an Urbit identity.");
|
||||
|
||||
seed = u3dc("come:dawn", u3k(stars), u3k(eny));
|
||||
u3z(eny);
|
||||
@ -506,7 +506,7 @@ _dawn_come(u3_noun stars)
|
||||
u3_noun who = u3dc("scot", 'p', u3k(u3h(seed)));
|
||||
c3_c* who_c = u3r_string(who);
|
||||
|
||||
u3l_log("boot: found comet %s\r\n", who_c);
|
||||
u3l_log("boot: found comet %s", who_c);
|
||||
|
||||
// enable to print and save comet private key for future reuse
|
||||
//
|
||||
@ -515,7 +515,7 @@ _dawn_come(u3_noun stars)
|
||||
u3_noun key = u3dc("scot", c3__uw, u3qe_jam(seed));
|
||||
c3_c* key_c = u3r_string(key);
|
||||
|
||||
u3l_log("boot: comet private key\n %s\n", key_c);
|
||||
u3l_log("boot: comet private key\n %s", key_c);
|
||||
|
||||
{
|
||||
c3_c pat_c[64];
|
||||
|
@ -242,7 +242,7 @@ u3_disk_plan(u3_disk* log_u, u3_fact* tac_u)
|
||||
{
|
||||
c3_assert( (1ULL + log_u->sen_d) == tac_u->eve_d );
|
||||
log_u->sen_d++;
|
||||
|
||||
|
||||
if ( !log_u->put_u.ent_u ) {
|
||||
c3_assert( !log_u->put_u.ext_u );
|
||||
log_u->put_u.ent_u = log_u->put_u.ext_u = tac_u;
|
||||
@ -649,7 +649,7 @@ u3_disk_exit(u3_disk* log_u)
|
||||
void
|
||||
u3_disk_info(u3_disk* log_u)
|
||||
{
|
||||
u3l_log(" disk: live=%s, event=%" PRIu64 "\n",
|
||||
u3l_log(" disk: live=%s, event=%" PRIu64,
|
||||
( c3y == log_u->liv_o ) ? "&" : "|",
|
||||
log_u->dun_d);
|
||||
|
||||
@ -657,7 +657,7 @@ u3_disk_info(u3_disk* log_u)
|
||||
u3_read* red_u = log_u->red_u;
|
||||
|
||||
while ( red_u ) {
|
||||
u3l_log(" read: %" PRIu64 "-%" PRIu64 "\n",
|
||||
u3l_log(" read: %" PRIu64 "-%" PRIu64,
|
||||
red_u->eve_d,
|
||||
(red_u->eve_d + red_u->len_d) - 1);
|
||||
}
|
||||
@ -665,12 +665,12 @@ u3_disk_info(u3_disk* log_u)
|
||||
|
||||
if ( log_u->put_u.ext_u ) {
|
||||
if ( log_u->put_u.ext_u != log_u->put_u.ent_u ) {
|
||||
u3l_log(" save: %" PRIu64 "-%" PRIu64 "\n",
|
||||
u3l_log(" save: %" PRIu64 "-%" PRIu64,
|
||||
log_u->put_u.ext_u->eve_d,
|
||||
log_u->put_u.ent_u->eve_d);
|
||||
}
|
||||
else {
|
||||
u3l_log(" save: %" PRIu64 "\n", log_u->put_u.ext_u->eve_d);
|
||||
u3l_log(" save: %" PRIu64, log_u->put_u.ext_u->eve_d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ static void
|
||||
_foil_fail(const c3_c* why_c, c3_i err_i)
|
||||
{
|
||||
if ( err_i ) {
|
||||
u3l_log("%s: error: %s\r\n", why_c, uv_strerror(err_i));
|
||||
u3l_log("%s: error: %s", why_c, uv_strerror(err_i));
|
||||
c3_assert(0);
|
||||
} else {
|
||||
u3l_log("%s: file error\r\n", why_c);
|
||||
u3l_log("%s: file error", why_c);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ _ames_send_cb(uv_udp_send_t* req_u, c3_i sas_i)
|
||||
u3_ames* sam_u = pac_u->sam_u;
|
||||
|
||||
if ( sas_i && (c3y == sam_u->fig_u.net_o) ) {
|
||||
u3l_log("ames: send fail: %s\n", uv_strerror(sas_i));
|
||||
u3l_log("ames: send fail: %s", uv_strerror(sas_i));
|
||||
sam_u->fig_u.net_o = c3n;
|
||||
}
|
||||
else {
|
||||
@ -379,7 +379,7 @@ _ames_send(u3_pact* pac_u)
|
||||
|
||||
if ( sas_i ) {
|
||||
if ( c3y == sam_u->fig_u.net_o ) {
|
||||
u3l_log("ames: send fail: %s\n", uv_strerror(sas_i));
|
||||
u3l_log("ames: send fail: %s", uv_strerror(sas_i));
|
||||
sam_u->fig_u.net_o = c3n;
|
||||
}
|
||||
|
||||
@ -516,7 +516,7 @@ _ames_czar_gone(u3_pact* pac_u, time_t now)
|
||||
u3_ames* sam_u = pac_u->sam_u;
|
||||
|
||||
if ( c3y == sam_u->imp_o[pac_u->imp_y] ) {
|
||||
u3l_log("ames: czar at %s: not found (b)\n", pac_u->dns_c);
|
||||
u3l_log("ames: czar at %s: not found (b)", pac_u->dns_c);
|
||||
sam_u->imp_o[pac_u->imp_y] = c3n;
|
||||
}
|
||||
|
||||
@ -546,7 +546,7 @@ _ames_czar_here(u3_pact* pac_u, time_t now, struct sockaddr_in* add_u)
|
||||
u3_noun nam = u3dc("scot", c3__if, u3i_word(pip_w));
|
||||
c3_c* nam_c = u3r_string(nam);
|
||||
|
||||
u3l_log("ames: czar %s: ip %s\n", pac_u->dns_c, nam_c);
|
||||
u3l_log("ames: czar %s: ip %s", pac_u->dns_c, nam_c);
|
||||
|
||||
c3_free(nam_c);
|
||||
u3z(nam);
|
||||
@ -611,7 +611,7 @@ _ames_czar(u3_pact* pac_u)
|
||||
if ( !sam_u->dns_c ) {
|
||||
u3_noun nam = u3dc("scot", 'p', pac_u->imp_y);
|
||||
c3_c* nam_c = u3r_string(nam);
|
||||
u3l_log("ames: no galaxy domain for %s, no-op\r\n", nam_c);
|
||||
u3l_log("ames: no galaxy domain for %s, no-op", nam_c);
|
||||
|
||||
c3_free(nam_c);
|
||||
u3z(nam);
|
||||
@ -656,7 +656,7 @@ _ames_czar(u3_pact* pac_u)
|
||||
}
|
||||
|
||||
if ( 255 <= sas_i ) {
|
||||
u3l_log("ames: czar: galaxy domain %s truncated\n", sam_u->dns_c);
|
||||
u3l_log("ames: czar: galaxy domain %s truncated", sam_u->dns_c);
|
||||
_ames_pact_free(pac_u);
|
||||
return;
|
||||
}
|
||||
@ -669,7 +669,7 @@ _ames_czar(u3_pact* pac_u)
|
||||
_ames_czar_cb,
|
||||
pac_u->dns_c, 0, 0)) )
|
||||
{
|
||||
u3l_log("ames: %s\n", uv_strerror(sas_i));
|
||||
u3l_log("ames: %s", uv_strerror(sas_i));
|
||||
_ames_czar_gone(pac_u, now);
|
||||
return;
|
||||
}
|
||||
@ -684,7 +684,7 @@ static void
|
||||
_ames_ef_send(u3_ames* sam_u, u3_noun lan, u3_noun pac)
|
||||
{
|
||||
if ( c3n == sam_u->car_u.liv_o ) {
|
||||
u3l_log("ames: not yet live, dropping outbound\r\n");
|
||||
u3l_log("ames: not yet live, dropping outbound");
|
||||
u3z(lan); u3z(pac);
|
||||
return;
|
||||
}
|
||||
@ -754,7 +754,7 @@ _ames_cap_queue(u3_ames* sam_u)
|
||||
sam_u->sat_u.dop_d++;
|
||||
|
||||
if ( u3C.wag_w & u3o_verbose ) {
|
||||
u3l_log("ames: packet dropped (%" PRIu64 " total)\n", sam_u->sat_u.dop_d);
|
||||
u3l_log("ames: packet dropped (%" PRIu64 " total)", sam_u->sat_u.dop_d);
|
||||
}
|
||||
}
|
||||
|
||||
@ -764,7 +764,7 @@ _ames_cap_queue(u3_ames* sam_u)
|
||||
if ( (sam_u->sat_u.dop_d && (0 == (sam_u->sat_u.dop_d % 1000)))
|
||||
&& !(u3C.wag_w & u3o_verbose) )
|
||||
{
|
||||
u3l_log("ames: packet dropped (%" PRIu64 " total)\n", sam_u->sat_u.dop_d);
|
||||
u3l_log("ames: packet dropped (%" PRIu64 " total)", sam_u->sat_u.dop_d);
|
||||
}
|
||||
}
|
||||
|
||||
@ -782,7 +782,7 @@ _ames_punt_goof(u3_noun lud)
|
||||
c3_w len_w = 1;
|
||||
|
||||
while ( u3_nul != dul ) {
|
||||
u3l_log("ames: bail %u\r\n", len_w++);
|
||||
u3l_log("ames: bail %u", len_w++);
|
||||
u3_pier_punt_goof("ames", u3k(u3h(dul)));
|
||||
dul = u3t(dul);
|
||||
}
|
||||
@ -803,13 +803,13 @@ _ames_hear_bail(u3_ovum* egg_u, u3_noun lud)
|
||||
|| (0 == (sam_u->sat_u.fal_d % 1000)) )
|
||||
{
|
||||
_ames_punt_goof(lud);
|
||||
u3l_log("ames: packet failed (%" PRIu64 " total)\n\n", sam_u->sat_u.fal_d);
|
||||
u3l_log("ames: packet failed (%" PRIu64 " total)", sam_u->sat_u.fal_d);
|
||||
}
|
||||
else {
|
||||
u3z(lud);
|
||||
|
||||
if ( 0 == (sam_u->sat_u.fal_d % 1000) ) {
|
||||
u3l_log("ames: packet failed (%" PRIu64 " total)\n\n", sam_u->sat_u.fal_d);
|
||||
u3l_log("ames: packet failed (%" PRIu64 " total)", sam_u->sat_u.fal_d);
|
||||
}
|
||||
}
|
||||
|
||||
@ -843,7 +843,7 @@ _ames_forward(u3_panc* pac_u, u3_noun las)
|
||||
|
||||
sam_u->sat_u.fow_d++;
|
||||
if ( 0 == (sam_u->sat_u.fow_d % 1000000) ) {
|
||||
u3l_log("ames: forwarded %" PRIu64 " total\n", sam_u->sat_u.fow_d);
|
||||
u3l_log("ames: forwarded %" PRIu64 " total", sam_u->sat_u.fow_d);
|
||||
}
|
||||
|
||||
if ( u3C.wag_w & u3o_verbose ) {
|
||||
@ -853,7 +853,7 @@ _ames_forward(u3_panc* pac_u, u3_noun las)
|
||||
c3_c* rec_c = u3r_string(rec);
|
||||
c3_y* pip_y = (c3_y*)&pac_u->ore_u.pip_w;
|
||||
|
||||
u3l_log("ames: forwarding for %s to %s from %d.%d.%d.%d:%d\n",
|
||||
u3l_log("ames: forwarding for %s to %s from %d.%d.%d.%d:%d",
|
||||
sen_c, rec_c,
|
||||
pip_y[0], pip_y[1], pip_y[2], pip_y[3],
|
||||
pac_u->ore_u.por_s);
|
||||
@ -872,7 +872,7 @@ _ames_forward(u3_panc* pac_u, u3_noun las)
|
||||
// validate lane and skip self if galaxy
|
||||
//
|
||||
if ( c3n == u3r_cell(lan, &tag, &dat) ) {
|
||||
u3l_log("ames: bogus lane\n");
|
||||
u3l_log("ames: bogus lane");
|
||||
u3m_p("lan", lan);
|
||||
}
|
||||
else {
|
||||
@ -887,7 +887,7 @@ _ames_forward(u3_panc* pac_u, u3_noun las)
|
||||
{
|
||||
sen_o = c3n;
|
||||
if ( u3C.wag_w & u3o_verbose ) {
|
||||
u3l_log("ames: forward skipping self\n");
|
||||
u3l_log("ames: forward skipping self");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -920,7 +920,7 @@ _ames_lane_scry_cb(void* vod_p, u3_noun nun)
|
||||
//
|
||||
if ( u3_none == las ) {
|
||||
if ( 5 < ++sam_u->sat_u.saw_d ) {
|
||||
u3l_log("ames: giving up scry\n");
|
||||
u3l_log("ames: giving up scry");
|
||||
sam_u->fig_u.see_o = c3n;
|
||||
}
|
||||
_ames_put_packet(sam_u, _ames_serialize_packet(pac_u, c3n), pac_u->ore_u);
|
||||
@ -984,7 +984,7 @@ _ames_try_forward(u3_ames* sam_u,
|
||||
if ( (u3_none == lac) && (1000 < sam_u->sat_u.foq_d) ) {
|
||||
sam_u->sat_u.fod_d++;
|
||||
if ( 0 == (sam_u->sat_u.fod_d % 10000) ) {
|
||||
u3l_log("ames: dropped %" PRIu64 " forwards total\n",
|
||||
u3l_log("ames: dropped %" PRIu64 " forwards total",
|
||||
sam_u->sat_u.fod_d);
|
||||
}
|
||||
|
||||
@ -1088,7 +1088,7 @@ _ames_hear(u3_ames* sam_u,
|
||||
{
|
||||
sam_u->sat_u.hed_d++;
|
||||
if ( 0 == (sam_u->sat_u.hed_d % 100000) ) {
|
||||
u3l_log("ames: %" PRIu64 " dropped, failed to read header\n",
|
||||
u3l_log("ames: %" PRIu64 " dropped, failed to read header",
|
||||
sam_u->sat_u.hed_d);
|
||||
}
|
||||
|
||||
@ -1105,7 +1105,7 @@ _ames_hear(u3_ames* sam_u,
|
||||
{
|
||||
sam_u->sat_u.vet_d++;
|
||||
if ( 0 == (sam_u->sat_u.vet_d % 100000) ) {
|
||||
u3l_log("ames: %" PRIu64 " dropped for version mismatch\n",
|
||||
u3l_log("ames: %" PRIu64 " dropped for version mismatch",
|
||||
sam_u->sat_u.vet_d);
|
||||
}
|
||||
|
||||
@ -1122,7 +1122,7 @@ _ames_hear(u3_ames* sam_u,
|
||||
if ( (c3n == _ames_sift_body(&hed_u, &bod_u, bod_w, bod_y)) ) {
|
||||
sam_u->sat_u.bod_d++;
|
||||
if ( 0 == (sam_u->sat_u.bod_d % 100) ) {
|
||||
u3l_log("ames: %" PRIu64 " dropped, failed to read body\n",
|
||||
u3l_log("ames: %" PRIu64 " dropped, failed to read body",
|
||||
sam_u->sat_u.bod_d);
|
||||
}
|
||||
|
||||
@ -1135,7 +1135,7 @@ _ames_hear(u3_ames* sam_u,
|
||||
if ( bod_u.mug_l != hed_u.mug_l ) {
|
||||
sam_u->sat_u.mut_d++;
|
||||
if ( 0 == (sam_u->sat_u.mut_d % 100000) ) {
|
||||
u3l_log("ames: %" PRIu64 " dropped for invalid mug\n",
|
||||
u3l_log("ames: %" PRIu64 " dropped for invalid mug",
|
||||
sam_u->sat_u.mut_d);
|
||||
}
|
||||
|
||||
@ -1183,7 +1183,7 @@ _ames_recv_cb(uv_udp_t* wax_u,
|
||||
{
|
||||
if ( 0 > nrd_i ) {
|
||||
if ( u3C.wag_w & u3o_verbose ) {
|
||||
u3l_log("ames: recv: fail: %s\n", uv_strerror(nrd_i));
|
||||
u3l_log("ames: recv: fail: %s", uv_strerror(nrd_i));
|
||||
}
|
||||
c3_free(buf_u->base);
|
||||
}
|
||||
@ -1192,7 +1192,7 @@ _ames_recv_cb(uv_udp_t* wax_u,
|
||||
}
|
||||
else if ( flg_i & UV_UDP_PARTIAL ) {
|
||||
if ( u3C.wag_w & u3o_verbose ) {
|
||||
u3l_log("ames: recv: fail: message truncated\n");
|
||||
u3l_log("ames: recv: fail: message truncated");
|
||||
}
|
||||
c3_free(buf_u->base);
|
||||
}
|
||||
@ -1228,8 +1228,8 @@ _ames_io_start(u3_ames* sam_u)
|
||||
por_s = zar_s;
|
||||
}
|
||||
else if ( por_s != zar_s ) {
|
||||
u3l_log("ames: czar: overriding port %d with -p %d\n", zar_s, por_s);
|
||||
u3l_log("ames: czar: WARNING: %d required for discoverability\n", zar_s);
|
||||
u3l_log("ames: czar: overriding port %d with -p %d", zar_s, por_s);
|
||||
u3l_log("ames: czar: WARNING: %d required for discoverability", zar_s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1248,12 +1248,12 @@ _ames_io_start(u3_ames* sam_u)
|
||||
if ( (ret_i = uv_udp_bind(&sam_u->wax_u,
|
||||
(const struct sockaddr*)&add_u, 0)) != 0 )
|
||||
{
|
||||
u3l_log("ames: bind: %s\n", uv_strerror(ret_i));
|
||||
u3l_log("ames: bind: %s", uv_strerror(ret_i));
|
||||
|
||||
if ( (c3__czar == rac) &&
|
||||
(UV_EADDRINUSE == ret_i) )
|
||||
{
|
||||
u3l_log(" ...perhaps you've got two copies of vere running?\n");
|
||||
u3l_log(" ...perhaps you've got two copies of vere running?");
|
||||
}
|
||||
|
||||
// XX revise
|
||||
@ -1268,10 +1268,10 @@ _ames_io_start(u3_ames* sam_u)
|
||||
}
|
||||
|
||||
if ( c3y == u3_Host.ops_u.net ) {
|
||||
u3l_log("ames: live on %d\n", sam_u->pir_u->por_s);
|
||||
u3l_log("ames: live on %d", sam_u->pir_u->por_s);
|
||||
}
|
||||
else {
|
||||
u3l_log("ames: live on %d (localhost only)\n", sam_u->pir_u->por_s);
|
||||
u3l_log("ames: live on %d (localhost only)", sam_u->pir_u->por_s);
|
||||
}
|
||||
|
||||
uv_udp_recv_start(&sam_u->wax_u, _ames_alloc, _ames_recv_cb);
|
||||
@ -1302,7 +1302,7 @@ _ames_ef_turf(u3_ames* sam_u, u3_noun tuf)
|
||||
u3z(tuf);
|
||||
}
|
||||
else if ( (c3n == sam_u->pir_u->fak_o) && (0 == sam_u->dns_c) ) {
|
||||
u3l_log("ames: turf: no domains\n");
|
||||
u3l_log("ames: turf: no domains");
|
||||
}
|
||||
|
||||
// XX is this ever necessary?
|
||||
@ -1446,7 +1446,7 @@ _ames_io_kick(u3_auto* car_u, u3_noun wir, u3_noun cad)
|
||||
ret_o = c3n;
|
||||
}
|
||||
else {
|
||||
u3l_log("kick: strange send\r\n");
|
||||
u3l_log("kick: strange send");
|
||||
ret_o = _ames_kick_newt(sam_u, u3k(tag), u3k(dat));
|
||||
}
|
||||
} break;
|
||||
@ -1497,21 +1497,21 @@ _ames_io_info(u3_auto* car_u)
|
||||
|
||||
# define FLAG(a) ( (c3y == a) ? "&" : "|" )
|
||||
|
||||
u3l_log(" config:\n");
|
||||
u3l_log(" filtering: %s\n", FLAG(sam_u->fig_u.fit_o));
|
||||
u3l_log(" can send: %s\n", FLAG(sam_u->fig_u.net_o));
|
||||
u3l_log(" can scry: %s\n", FLAG(sam_u->fig_u.see_o));
|
||||
u3l_log(" counters:\n");
|
||||
u3l_log(" dropped: %" PRIu64 "\n", sam_u->sat_u.dop_d);
|
||||
u3l_log(" forwards dropped: %" PRIu64 "\n", sam_u->sat_u.fod_d);
|
||||
u3l_log(" forwards pending: %" PRIu64 "\n", sam_u->sat_u.foq_d);
|
||||
u3l_log(" forwarded: %" PRIu64 "\n", sam_u->sat_u.fow_d);
|
||||
u3l_log(" filtered (hed): %" PRIu64 "\n", sam_u->sat_u.hed_d);
|
||||
u3l_log(" filtered (ver): %" PRIu64 "\n", sam_u->sat_u.vet_d);
|
||||
u3l_log(" filtered (mug): %" PRIu64 "\n", sam_u->sat_u.mut_d);
|
||||
u3l_log(" filtered (bod): %" PRIu64 "\n", sam_u->sat_u.bod_d);
|
||||
u3l_log(" crashed: %" PRIu64 "\n", sam_u->sat_u.fal_d);
|
||||
u3l_log(" cached lanes: %u\n", u3h_wyt(sam_u->lax_p));
|
||||
u3l_log(" config:");
|
||||
u3l_log(" filtering: %s", FLAG(sam_u->fig_u.fit_o));
|
||||
u3l_log(" can send: %s", FLAG(sam_u->fig_u.net_o));
|
||||
u3l_log(" can scry: %s", FLAG(sam_u->fig_u.see_o));
|
||||
u3l_log(" counters:");
|
||||
u3l_log(" dropped: %" PRIu64, sam_u->sat_u.dop_d);
|
||||
u3l_log(" forwards dropped: %" PRIu64, sam_u->sat_u.fod_d);
|
||||
u3l_log(" forwards pending: %" PRIu64, sam_u->sat_u.foq_d);
|
||||
u3l_log(" forwarded: %" PRIu64, sam_u->sat_u.fow_d);
|
||||
u3l_log(" filtered (hed): %" PRIu64, sam_u->sat_u.hed_d);
|
||||
u3l_log(" filtered (ver): %" PRIu64, sam_u->sat_u.vet_d);
|
||||
u3l_log(" filtered (mug): %" PRIu64, sam_u->sat_u.mut_d);
|
||||
u3l_log(" filtered (bod): %" PRIu64, sam_u->sat_u.bod_d);
|
||||
u3l_log(" crashed: %" PRIu64, sam_u->sat_u.fal_d);
|
||||
u3l_log(" cached lanes: %u", u3h_wyt(sam_u->lax_p));
|
||||
}
|
||||
|
||||
/* u3_ames_io_init(): initialize ames I/O.
|
||||
|
@ -48,7 +48,7 @@ _behn_wake_bail(u3_ovum* egg_u, u3_noun lud)
|
||||
u3_auto_bail_slog(egg_u, lud);
|
||||
u3_ovum_free(egg_u);
|
||||
|
||||
u3l_log("behn: timer failed; queue blocked\n");
|
||||
u3l_log("behn: timer failed; queue blocked");
|
||||
|
||||
// XX review, add flag to continue?
|
||||
//
|
||||
@ -149,7 +149,7 @@ _behn_born_bail(u3_ovum* egg_u, u3_noun lud)
|
||||
u3_auto_bail_slog(egg_u, lud);
|
||||
u3_ovum_free(egg_u);
|
||||
|
||||
u3l_log("behn: initialization failed\n");
|
||||
u3l_log("behn: initialization failed");
|
||||
|
||||
// XX review, add flag to continue?
|
||||
//
|
||||
|
@ -558,7 +558,7 @@ _cttp_creq_new(u3_cttp* ctp_u, c3_l num_l, u3_noun hes)
|
||||
|
||||
if ( c3n == u3r_du(unit_pul) ) {
|
||||
c3_c* url_c = u3r_string(url);
|
||||
u3l_log("cttp: unable to parse url:\n %s\n", url_c);
|
||||
u3l_log("cttp: unable to parse url:\n %s", url_c);
|
||||
c3_free(url_c);
|
||||
u3z(hes);
|
||||
return 0;
|
||||
@ -735,7 +735,7 @@ _cttp_creq_fail(u3_creq* ceq_u, const c3_c* err_c)
|
||||
// XX anything other than a 504?
|
||||
c3_w cod_w = 504;
|
||||
|
||||
u3l_log("http: fail (%d, %d): %s\r\n", ceq_u->num_l, cod_w, err_c);
|
||||
u3l_log("http: fail (%d, %d): %s", ceq_u->num_l, cod_w, err_c);
|
||||
|
||||
// XX include err_c as response body?
|
||||
_cttp_http_client_receive(ceq_u, cod_w, u3_nul, u3_nul);
|
||||
@ -1003,7 +1003,7 @@ _cttp_ef_http_client(u3_cttp* ctp_u, u3_noun tag, u3_noun dat)
|
||||
if ( (c3n == u3r_cell(dat, &num, &req))
|
||||
|| (c3n == u3r_safe_word(num, &num_l)) )
|
||||
{
|
||||
u3l_log("cttp: strange request\n");
|
||||
u3l_log("cttp: strange request");
|
||||
ret_o = c3n;
|
||||
}
|
||||
else if ( (ceq_u = _cttp_creq_new(ctp_u, num_l, u3k(req))) ) {
|
||||
@ -1018,7 +1018,7 @@ _cttp_ef_http_client(u3_cttp* ctp_u, u3_noun tag, u3_noun dat)
|
||||
c3_l num_l;
|
||||
|
||||
if ( c3n == u3r_safe_word(dat, &num_l) ) {
|
||||
u3l_log("cttp: strange cancel-request\n");
|
||||
u3l_log("cttp: strange cancel-request");
|
||||
ret_o = c3n;
|
||||
}
|
||||
else if ( (ceq_u =_cttp_creq_find(ctp_u, num_l)) ) {
|
||||
@ -1032,7 +1032,7 @@ _cttp_ef_http_client(u3_cttp* ctp_u, u3_noun tag, u3_noun dat)
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3l_log("cttp: strange effect (unknown type)\n");
|
||||
u3l_log("cttp: strange effect (unknown type)");
|
||||
ret_o = c3n;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ static void
|
||||
_fore_inject_bail(u3_ovum* egg_u, u3_noun lud)
|
||||
{
|
||||
u3_auto_bail_slog(egg_u, lud);
|
||||
u3l_log("pier: injected event failed\n");
|
||||
u3l_log("pier: injected event failed");
|
||||
|
||||
u3_ovum_free(egg_u);
|
||||
}
|
||||
@ -21,7 +21,7 @@ static void
|
||||
_fore_import_bail(u3_ovum* egg_u, u3_noun lud)
|
||||
{
|
||||
u3_auto_bail_slog(egg_u, lud);
|
||||
u3l_log("pier: import failed\n");
|
||||
u3l_log("pier: import failed");
|
||||
|
||||
u3_ovum_free(egg_u);
|
||||
}
|
||||
@ -37,20 +37,20 @@ _fore_inject(u3_auto* car_u, c3_c* pax_c)
|
||||
u3_noun riw, cad, tar, wir;
|
||||
|
||||
if ( c3n == u3r_cell(ovo, &riw, &cad) ) {
|
||||
u3l_log("pier: invalid ovum in -I\n");
|
||||
u3l_log("pier: invalid ovum in -I");
|
||||
}
|
||||
else if ( (c3n == u3a_is_cell(cad))
|
||||
|| (c3n == u3a_is_atom(u3h(cad))) )
|
||||
{
|
||||
u3l_log("pier: invalid card in -I ovum\n");
|
||||
u3l_log("pier: invalid card in -I ovum");
|
||||
}
|
||||
else if ( c3n == u3r_cell(riw, &tar, &wir) ) {
|
||||
u3l_log("pier: invalid wire in -I ovum\n");
|
||||
u3l_log("pier: invalid wire in -I ovum");
|
||||
}
|
||||
else if ( (c3n == u3a_is_atom(tar))
|
||||
|| (1 < u3r_met(3, tar)) )
|
||||
{
|
||||
u3l_log("pier: invalid target in -I wire\n");
|
||||
u3l_log("pier: invalid target in -I wire");
|
||||
}
|
||||
else {
|
||||
{
|
||||
@ -58,7 +58,7 @@ _fore_inject(u3_auto* car_u, c3_c* pax_c)
|
||||
u3_noun ser = u3do("spat", u3k(riw));
|
||||
c3_c* wir_c = u3r_string(ser);
|
||||
|
||||
u3l_log("pier: injecting %%%s event on %s\n", tag_c, wir_c);
|
||||
u3l_log("pier: injecting %%%s event on %s", tag_c, wir_c);
|
||||
|
||||
c3_free(tag_c);
|
||||
c3_free(wir_c);
|
||||
|
@ -30,7 +30,7 @@ _hind_io_kick(u3_auto* car_u, u3_noun wir, u3_noun cad)
|
||||
|
||||
case c3__exit: {
|
||||
ret_o = c3y;
|
||||
u3l_log("<<<goodbye>>>\n");
|
||||
u3l_log("<<<goodbye>>>");
|
||||
u3_pier_exit(car_u->pir_u);
|
||||
} break;
|
||||
|
||||
@ -44,7 +44,7 @@ _hind_io_kick(u3_auto* car_u, u3_noun wir, u3_noun cad)
|
||||
|
||||
case c3__vega: {
|
||||
ret_o = c3y;
|
||||
u3l_log("<<<reset>>>\n");
|
||||
u3l_log("<<<reset>>>");
|
||||
} break;
|
||||
|
||||
// NB: startup explicitly handled in pier.c
|
||||
|
@ -33,7 +33,7 @@ typedef struct _u3_h2o_serv {
|
||||
void* gen_u; // response generator
|
||||
struct _u3_hcon* hon_u; // connection backlink
|
||||
struct _u3_hreq* nex_u; // next in connection's list
|
||||
struct _u3_hreq* pre_u; // next in connection's list
|
||||
struct _u3_hreq* pre_u; // prev in connection's list
|
||||
} u3_hreq;
|
||||
|
||||
/* u3_hcon: incoming http connection.
|
||||
@ -48,7 +48,7 @@ typedef struct _u3_h2o_serv {
|
||||
struct _u3_http* htp_u; // server backlink
|
||||
struct _u3_hreq* req_u; // request list
|
||||
struct _u3_hcon* nex_u; // next in server's list
|
||||
struct _u3_hcon* pre_u; // next in server's list
|
||||
struct _u3_hcon* pre_u; // prev in server's list
|
||||
} u3_hcon;
|
||||
|
||||
/* u3_http: http server.
|
||||
@ -639,10 +639,10 @@ _http_start_respond(u3_hreq* req_u,
|
||||
u3_noun data,
|
||||
u3_noun complete)
|
||||
{
|
||||
// u3l_log("start\n");
|
||||
// u3l_log("start");
|
||||
|
||||
if ( u3_rsat_plan != req_u->sat_e ) {
|
||||
//u3l_log("duplicate response\n");
|
||||
//u3l_log("duplicate response");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -715,14 +715,14 @@ _http_continue_respond(u3_hreq* req_u,
|
||||
u3_noun data,
|
||||
u3_noun complete)
|
||||
{
|
||||
// u3l_log("continue\n");
|
||||
// u3l_log("continue");
|
||||
|
||||
// XX add sequence numbers for %continue effects?
|
||||
// Arvo does not (currently) guarantee effect idempotence!!
|
||||
|
||||
// response has not yet been started
|
||||
if ( u3_rsat_ripe != req_u->sat_e ) {
|
||||
// u3l_log("duplicate response\n");
|
||||
// u3l_log("duplicate response");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -855,7 +855,7 @@ _http_seq_continue(void* vod_p, u3_noun nun)
|
||||
_http_start_respond(req_u, 403, u3_nul, u3_nul, c3y);
|
||||
}
|
||||
else if ( u3_none == aut ) {
|
||||
u3l_log("http: authentication scry failed\n");
|
||||
u3l_log("http: authentication scry failed");
|
||||
_http_start_respond(req_u, 500, u3_nul, u3_nul, c3y);
|
||||
}
|
||||
else {
|
||||
@ -917,7 +917,7 @@ _http_rec_accept(h2o_handler_t* han_u, h2o_req_t* rec_u)
|
||||
|
||||
if ( u3_none == req ) {
|
||||
if ( (u3C.wag_w & u3o_verbose) ) {
|
||||
u3l_log("strange %.*s request\n", (int)rec_u->method.len,
|
||||
u3l_log("strange %.*s request", (int)rec_u->method.len,
|
||||
rec_u->method.base);
|
||||
}
|
||||
c3_c* msg_c = "bad request";
|
||||
@ -1007,7 +1007,7 @@ _http_conn_free(uv_handle_t* han_t)
|
||||
noh_u = noh_u->nex_u;
|
||||
}
|
||||
|
||||
u3l_log("http conn free %d of %u server %d\n", hon_u->coq_l, len_w, htp_u->sev_l);
|
||||
u3l_log("http conn free %d of %u server %d", hon_u->coq_l, len_w, htp_u->sev_l);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1024,13 +1024,13 @@ _http_conn_free(uv_handle_t* han_t)
|
||||
noh_u = noh_u->nex_u;
|
||||
}
|
||||
|
||||
u3l_log("http conn free %u remaining\n", len_w);
|
||||
u3l_log("http conn free %u remaining", len_w);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( (0 == htp_u->hon_u) && (0 != h2o_u->ctx_u.shutdown_requested) ) {
|
||||
#if 0
|
||||
u3l_log("http conn free %d free server %d\n", hon_u->coq_l, htp_u->sev_l);
|
||||
u3l_log("http conn free %d free server %d", hon_u->coq_l, htp_u->sev_l);
|
||||
#endif
|
||||
_http_serv_free(htp_u);
|
||||
}
|
||||
@ -1054,7 +1054,7 @@ _http_conn_new(u3_http* htp_u)
|
||||
_http_conn_link(htp_u, hon_u);
|
||||
|
||||
#if 0
|
||||
u3l_log("http conn neww %d server %d\n", hon_u->coq_l, htp_u->sev_l);
|
||||
u3l_log("http conn neww %d server %d", hon_u->coq_l, htp_u->sev_l);
|
||||
#endif
|
||||
|
||||
return hon_u;
|
||||
@ -1104,7 +1104,7 @@ _http_serv_unlink(u3_http* htp_u)
|
||||
{
|
||||
// XX link elsewhere initially, relink on start?
|
||||
#if 0
|
||||
u3l_log("http serv unlink %d\n", htp_u->sev_l);
|
||||
u3l_log("http serv unlink %d", htp_u->sev_l);
|
||||
#endif
|
||||
u3_http* pre_u = htp_u->htd_u->htp_u;
|
||||
|
||||
@ -1213,7 +1213,7 @@ http_serv_free_cb(uv_timer_t* tim_u)
|
||||
u3_http* htp_u = tim_u->data;
|
||||
|
||||
#if 0
|
||||
u3l_log("http serv free cb %d\n", htp_u->sev_l);
|
||||
u3l_log("http serv free cb %d", htp_u->sev_l);
|
||||
#endif
|
||||
|
||||
_http_serv_really_free(htp_u);
|
||||
@ -1227,7 +1227,7 @@ static void
|
||||
_http_serv_free(u3_http* htp_u)
|
||||
{
|
||||
#if 0
|
||||
u3l_log("http serv free %d\n", htp_u->sev_l);
|
||||
u3l_log("http serv free %d", htp_u->sev_l);
|
||||
#endif
|
||||
|
||||
c3_assert( 0 == htp_u->hon_u );
|
||||
@ -1297,7 +1297,7 @@ _http_serv_close(u3_http* htp_u)
|
||||
h2o_context_request_shutdown(&h2o_u->ctx_u);
|
||||
|
||||
#if 0
|
||||
u3l_log("http serv close %d %p\n", htp_u->sev_l, &htp_u->wax_u);
|
||||
u3l_log("http serv close %d %p", htp_u->sev_l, &htp_u->wax_u);
|
||||
#endif
|
||||
|
||||
uv_close((uv_handle_t*)&htp_u->wax_u, _http_serv_close_cb);
|
||||
@ -1338,7 +1338,7 @@ _http_serv_accept(u3_http* htp_u)
|
||||
if ( 0 != (sas_i = uv_accept((uv_stream_t*)&htp_u->wax_u,
|
||||
(uv_stream_t*)&hon_u->wax_u)) ) {
|
||||
if ( (u3C.wag_w & u3o_verbose) ) {
|
||||
u3l_log("http: accept: %s\n", uv_strerror(sas_i));
|
||||
u3l_log("http: accept: %s", uv_strerror(sas_i));
|
||||
}
|
||||
|
||||
uv_close((uv_handle_t*)&hon_u->wax_u, _http_conn_free);
|
||||
@ -1367,7 +1367,7 @@ _http_serv_listen_cb(uv_stream_t* str_u, c3_i sas_i)
|
||||
u3_http* htp_u = (u3_http*)str_u;
|
||||
|
||||
if ( 0 != sas_i ) {
|
||||
u3l_log("http: listen_cb: %s\n", uv_strerror(sas_i));
|
||||
u3l_log("http: listen_cb: %s", uv_strerror(sas_i));
|
||||
}
|
||||
else {
|
||||
_http_serv_accept(htp_u);
|
||||
@ -1493,13 +1493,13 @@ _http_serv_start(u3_http* htp_u)
|
||||
continue;
|
||||
}
|
||||
|
||||
u3l_log("http: listen: %s\n", uv_strerror(sas_i));
|
||||
u3l_log("http: listen: %s", uv_strerror(sas_i));
|
||||
|
||||
_http_serv_free(htp_u);
|
||||
return;
|
||||
}
|
||||
|
||||
u3l_log("http: %s live on %s://localhost:%d\n",
|
||||
u3l_log("http: %s live on %s://localhost:%d",
|
||||
(c3y == htp_u->lop) ? "loopback" : "web interface",
|
||||
(c3y == htp_u->sec) ? "https" : "http",
|
||||
htp_u->por_s);
|
||||
@ -1557,9 +1557,10 @@ _http_init_tls(uv_buf_t key_u, uv_buf_t cer_u)
|
||||
BIO_free(bio_u);
|
||||
|
||||
if( 0 == sas_i ) {
|
||||
u3l_log("http: load private key failed:\n");
|
||||
ERR_print_errors_fp(u3_term_io_hija());
|
||||
u3_term_io_loja(1);
|
||||
u3l_log("http: load private key failed:");
|
||||
FILE* fil_u = u3_term_io_hija();
|
||||
ERR_print_errors_fp(fil_u);
|
||||
u3_term_io_loja(1, fil_u);
|
||||
|
||||
SSL_CTX_free(tls_u);
|
||||
|
||||
@ -1575,9 +1576,10 @@ _http_init_tls(uv_buf_t key_u, uv_buf_t cer_u)
|
||||
X509_free(xer_u);
|
||||
|
||||
if( 0 == sas_i ) {
|
||||
u3l_log("http: load certificate failed:\n");
|
||||
ERR_print_errors_fp(u3_term_io_hija());
|
||||
u3_term_io_loja(1);
|
||||
u3l_log("http: load certificate failed:");
|
||||
FILE* fil_u = u3_term_io_hija();
|
||||
ERR_print_errors_fp(fil_u);
|
||||
u3_term_io_loja(1,fil_u);
|
||||
|
||||
BIO_free(bio_u);
|
||||
SSL_CTX_free(tls_u);
|
||||
@ -1656,19 +1658,19 @@ _http_search_req(u3_httd* htd_u,
|
||||
|
||||
if ( !(htp_u = _http_serv_find(htd_u, sev_l)) ) {
|
||||
if ( bug_w ) {
|
||||
u3l_log("http: server not found: %x\r\n", sev_l);
|
||||
u3l_log("http: server not found: %x", sev_l);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if ( !(hon_u = _http_conn_find(htp_u, coq_l)) ) {
|
||||
if ( bug_w ) {
|
||||
u3l_log("http: connection not found: %x/%d\r\n", sev_l, coq_l);
|
||||
u3l_log("http: connection not found: %x/%d", sev_l, coq_l);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if ( !(req_u = _http_req_find(hon_u, seq_l)) ) {
|
||||
if ( bug_w ) {
|
||||
u3l_log("http: request not found: %x/%d/%d\r\n",
|
||||
u3l_log("http: request not found: %x/%d/%d",
|
||||
sev_l, coq_l, seq_l);
|
||||
}
|
||||
return 0;
|
||||
@ -1760,7 +1762,7 @@ _http_serv_restart(u3_httd* htd_u)
|
||||
_http_serv_start_all(htd_u);
|
||||
}
|
||||
else {
|
||||
u3l_log("http: restarting servers to apply configuration\n");
|
||||
u3l_log("http: restarting servers to apply configuration");
|
||||
|
||||
while ( 0 != htp_u ) {
|
||||
if ( c3y == htp_u->liv ) {
|
||||
@ -1812,7 +1814,7 @@ u3_http_ef_form(u3_httd* htd_u, u3_noun fig)
|
||||
!( c3y == pro || c3n == pro ) ||
|
||||
!( c3y == log || c3n == log ) ||
|
||||
!( c3y == red || c3n == red ) ) {
|
||||
u3l_log("http: form: invalid card\n");
|
||||
u3l_log("http: form: invalid card");
|
||||
u3z(fig);
|
||||
return;
|
||||
}
|
||||
@ -1907,14 +1909,14 @@ _http_ef_http_server(u3_httd* htd_u,
|
||||
_http_continue_respond(req_u, u3k(data), u3k(complete));
|
||||
}
|
||||
else if (c3y == u3r_sing_c("cancel", u3h(response))) {
|
||||
u3l_log("http: %%cancel not handled yet\n");
|
||||
u3l_log("http: %%cancel not handled yet");
|
||||
}
|
||||
else {
|
||||
u3l_log("http: strange response\n");
|
||||
u3l_log("http: strange response");
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3l_log("http: strange response\n");
|
||||
u3l_log("http: strange response");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2028,7 +2030,7 @@ _reck_mole(u3_noun fot,
|
||||
if ( (c3n == u3r_cell(uco, &p_uco, &q_uco)) ||
|
||||
(u3_nul != p_uco) )
|
||||
{
|
||||
u3l_log("strange mole %s\n", u3r_string(san));
|
||||
u3l_log("strange mole %s", u3r_string(san));
|
||||
|
||||
u3z(fot); u3z(uco); return c3n;
|
||||
}
|
||||
@ -2166,7 +2168,7 @@ _http_io_info(u3_auto* car_u)
|
||||
sec_y++;
|
||||
seq_u = seq_u->nex_u;
|
||||
}
|
||||
u3l_log(" open slogstreams: %d\n", sec_y);
|
||||
u3l_log(" open slogstreams: %d", sec_y);
|
||||
}
|
||||
|
||||
/* u3_http_io_init(): initialize http I/O.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -162,35 +162,35 @@ _unix_rm_r_cb(const c3_c* pax_c,
|
||||
{
|
||||
switch ( typeflag ) {
|
||||
default:
|
||||
u3l_log("bad file type in rm_r: %s\r\n", pax_c);
|
||||
u3l_log("bad file type in rm_r: %s", pax_c);
|
||||
break;
|
||||
case FTW_F:
|
||||
if ( 0 != unlink(pax_c) && ENOENT != errno ) {
|
||||
u3l_log("error unlinking (in rm_r) %s: %s\n",
|
||||
u3l_log("error unlinking (in rm_r) %s: %s",
|
||||
pax_c, strerror(errno));
|
||||
c3_assert(0);
|
||||
}
|
||||
break;
|
||||
case FTW_D:
|
||||
u3l_log("shouldn't have gotten pure directory: %s\r\n", pax_c);
|
||||
u3l_log("shouldn't have gotten pure directory: %s", pax_c);
|
||||
break;
|
||||
case FTW_DNR:
|
||||
u3l_log("couldn't read directory: %s\r\n", pax_c);
|
||||
u3l_log("couldn't read directory: %s", pax_c);
|
||||
break;
|
||||
case FTW_NS:
|
||||
u3l_log("couldn't stat path: %s\r\n", pax_c);
|
||||
u3l_log("couldn't stat path: %s", pax_c);
|
||||
break;
|
||||
case FTW_DP:
|
||||
if ( 0 != rmdir(pax_c) && ENOENT != errno ) {
|
||||
u3l_log("error rmdiring %s: %s\n", pax_c, strerror(errno));
|
||||
u3l_log("error rmdiring %s: %s", pax_c, strerror(errno));
|
||||
c3_assert(0);
|
||||
}
|
||||
break;
|
||||
case FTW_SL:
|
||||
u3l_log("got symbolic link: %s\r\n", pax_c);
|
||||
u3l_log("got symbolic link: %s", pax_c);
|
||||
break;
|
||||
case FTW_SLN:
|
||||
u3l_log("got nonexistent symbolic link: %s\r\n", pax_c);
|
||||
u3l_log("got nonexistent symbolic link: %s", pax_c);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ _unix_rm_r(c3_c* pax_c)
|
||||
{
|
||||
if ( 0 > nftw(pax_c, _unix_rm_r_cb, 100, FTW_DEPTH | FTW_PHYS )
|
||||
&& ENOENT != errno) {
|
||||
u3l_log("rm_r error on %s: %s\r\n", pax_c, strerror(errno));
|
||||
u3l_log("rm_r error on %s: %s", pax_c, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ static void
|
||||
_unix_mkdir(c3_c* pax_c)
|
||||
{
|
||||
if ( 0 != mkdir(pax_c, 0755) && EEXIST != errno) {
|
||||
u3l_log("error mkdiring %s: %s\n", pax_c, strerror(errno));
|
||||
u3l_log("error mkdiring %s: %s", pax_c, strerror(errno));
|
||||
c3_assert(0);
|
||||
}
|
||||
}
|
||||
@ -231,7 +231,7 @@ _unix_write_file_hard(c3_c* pax_c, u3_noun mim)
|
||||
u3_noun dat = u3t(u3t(mim));
|
||||
|
||||
if ( fid_i < 0 ) {
|
||||
u3l_log("error opening %s for writing: %s\r\n",
|
||||
u3l_log("error opening %s for writing: %s",
|
||||
pax_c, strerror(errno));
|
||||
u3z(mim);
|
||||
return 0;
|
||||
@ -247,7 +247,7 @@ _unix_write_file_hard(c3_c* pax_c, u3_noun mim)
|
||||
rit_w = write(fid_i, dat_y, siz_w);
|
||||
|
||||
if ( rit_w != siz_w ) {
|
||||
u3l_log("error writing %s: %s\r\n",
|
||||
u3l_log("error writing %s: %s",
|
||||
pax_c, strerror(errno));
|
||||
mug_w = 0;
|
||||
}
|
||||
@ -277,7 +277,7 @@ _unix_write_file_soft(u3_ufil* fil_u, u3_noun mim)
|
||||
goto _unix_write_file_soft_go;
|
||||
}
|
||||
else {
|
||||
u3l_log("error opening file (soft) %s: %s\r\n",
|
||||
u3l_log("error opening file (soft) %s: %s",
|
||||
fil_u->pax_c, strerror(errno));
|
||||
u3z(mim);
|
||||
return;
|
||||
@ -290,17 +290,17 @@ _unix_write_file_soft(u3_ufil* fil_u, u3_noun mim)
|
||||
red_ws = read(fid_i, old_y, len_ws);
|
||||
|
||||
if ( close(fid_i) < 0 ) {
|
||||
u3l_log("error closing file (soft) %s: %s\r\n",
|
||||
u3l_log("error closing file (soft) %s: %s",
|
||||
fil_u->pax_c, strerror(errno));
|
||||
}
|
||||
|
||||
if ( len_ws != red_ws ) {
|
||||
if ( red_ws < 0 ) {
|
||||
u3l_log("error reading file (soft) %s: %s\r\n",
|
||||
u3l_log("error reading file (soft) %s: %s",
|
||||
fil_u->pax_c, strerror(errno));
|
||||
}
|
||||
else {
|
||||
u3l_log("wrong # of bytes read in file %s: %d %d\r\n",
|
||||
u3l_log("wrong # of bytes read in file %s: %d %d",
|
||||
fil_u->pax_c, len_ws, red_ws);
|
||||
}
|
||||
c3_free(old_y);
|
||||
@ -376,7 +376,7 @@ _unix_scan_mount_point(u3_unix* unx_u, u3_umon* mon_u)
|
||||
{
|
||||
DIR* rid_u = opendir(mon_u->dir_u.pax_c);
|
||||
if ( !rid_u ) {
|
||||
u3l_log("error opening pier directory: %s: %s\r\n",
|
||||
u3l_log("error opening pier directory: %s: %s",
|
||||
mon_u->dir_u.pax_c, strerror(errno));
|
||||
return;
|
||||
}
|
||||
@ -389,7 +389,7 @@ _unix_scan_mount_point(u3_unix* unx_u, u3_umon* mon_u)
|
||||
c3_w err_w;
|
||||
|
||||
if ( 0 != (err_w = u3_readdir_r(rid_u, &ent_u, &out_u)) ) {
|
||||
u3l_log("erroring loading pier directory %s: %s\r\n",
|
||||
u3l_log("erroring loading pier directory %s: %s",
|
||||
mon_u->dir_u.pax_c, strerror(errno));
|
||||
|
||||
c3_assert(0);
|
||||
@ -409,7 +409,7 @@ _unix_scan_mount_point(u3_unix* unx_u, u3_umon* mon_u)
|
||||
struct stat buf_u;
|
||||
|
||||
if ( 0 != stat(pax_c, &buf_u) ) {
|
||||
u3l_log("can't stat pier directory %s: %s\r\n",
|
||||
u3l_log("can't stat pier directory %s: %s",
|
||||
mon_u->dir_u.pax_c, strerror(errno));
|
||||
c3_free(pax_c);
|
||||
continue;
|
||||
@ -453,7 +453,7 @@ static void
|
||||
_unix_free_file(u3_ufil *fil_u)
|
||||
{
|
||||
if ( 0 != unlink(fil_u->pax_c) && ENOENT != errno ) {
|
||||
u3l_log("error unlinking %s: %s\n", fil_u->pax_c, strerror(errno));
|
||||
u3l_log("error unlinking %s: %s", fil_u->pax_c, strerror(errno));
|
||||
c3_assert(0);
|
||||
}
|
||||
|
||||
@ -565,7 +565,7 @@ _unix_delete_mount_point(u3_unix* unx_u, u3_noun mon)
|
||||
|
||||
mon_u = unx_u->mon_u;
|
||||
if ( !mon_u ) {
|
||||
u3l_log("mount point already gone: %s\r\n", nam_c);
|
||||
u3l_log("mount point already gone: %s", nam_c);
|
||||
goto _delete_mount_point_out;
|
||||
}
|
||||
if ( 0 == strcmp(nam_c, mon_u->nam_c) ) {
|
||||
@ -581,7 +581,7 @@ _unix_delete_mount_point(u3_unix* unx_u, u3_noun mon)
|
||||
}
|
||||
|
||||
if ( !mon_u->nex_u ) {
|
||||
u3l_log("mount point already gone: %s\r\n", nam_c);
|
||||
u3l_log("mount point already gone: %s", nam_c);
|
||||
goto _delete_mount_point_out;
|
||||
}
|
||||
|
||||
@ -699,7 +699,7 @@ _unix_update_file(u3_unix* unx_u, u3_ufil* fil_u)
|
||||
return u3nc(u3nc(_unix_string_to_path(unx_u, fil_u->pax_c), u3_nul), u3_nul);
|
||||
}
|
||||
else {
|
||||
u3l_log("error opening file %s: %s\r\n",
|
||||
u3l_log("error opening file %s: %s",
|
||||
fil_u->pax_c, strerror(errno));
|
||||
return u3_nul;
|
||||
}
|
||||
@ -711,17 +711,17 @@ _unix_update_file(u3_unix* unx_u, u3_ufil* fil_u)
|
||||
red_ws = read(fid_i, dat_y, len_ws);
|
||||
|
||||
if ( close(fid_i) < 0 ) {
|
||||
u3l_log("error closing file %s: %s\r\n",
|
||||
u3l_log("error closing file %s: %s",
|
||||
fil_u->pax_c, strerror(errno));
|
||||
}
|
||||
|
||||
if ( len_ws != red_ws ) {
|
||||
if ( red_ws < 0 ) {
|
||||
u3l_log("error reading file %s: %s\r\n",
|
||||
u3l_log("error reading file %s: %s",
|
||||
fil_u->pax_c, strerror(errno));
|
||||
}
|
||||
else {
|
||||
u3l_log("wrong # of bytes read in file %s: %d %d\r\n",
|
||||
u3l_log("wrong # of bytes read in file %s: %d %d",
|
||||
fil_u->pax_c, len_ws, red_ws);
|
||||
}
|
||||
c3_free(dat_y);
|
||||
@ -790,7 +790,7 @@ _unix_update_dir(u3_unix* unx_u, u3_udir* dir_u)
|
||||
|
||||
if ( (fid_i < 0) || (fstat(fid_i, &buf_u) < 0) ) {
|
||||
if ( ENOENT != errno ) {
|
||||
u3l_log("_unix_update_dir: error opening file %s: %s\r\n",
|
||||
u3l_log("_unix_update_dir: error opening file %s: %s",
|
||||
nod_u->pax_c, strerror(errno));
|
||||
}
|
||||
|
||||
@ -800,7 +800,7 @@ _unix_update_dir(u3_unix* unx_u, u3_udir* dir_u)
|
||||
}
|
||||
else {
|
||||
if ( close(fid_i) < 0 ) {
|
||||
u3l_log("_unix_update_dir: error closing file %s: %s\r\n",
|
||||
u3l_log("_unix_update_dir: error closing file %s: %s",
|
||||
nod_u->pax_c, strerror(errno));
|
||||
}
|
||||
|
||||
@ -815,7 +815,7 @@ _unix_update_dir(u3_unix* unx_u, u3_udir* dir_u)
|
||||
|
||||
DIR* rid_u = opendir(dir_u->pax_c);
|
||||
if ( !rid_u ) {
|
||||
u3l_log("error opening directory %s: %s\r\n",
|
||||
u3l_log("error opening directory %s: %s",
|
||||
dir_u->pax_c, strerror(errno));
|
||||
c3_assert(0);
|
||||
}
|
||||
@ -827,7 +827,7 @@ _unix_update_dir(u3_unix* unx_u, u3_udir* dir_u)
|
||||
|
||||
|
||||
if ( (err_w = u3_readdir_r(rid_u, &ent_u, &out_u)) != 0 ) {
|
||||
u3l_log("error loading directory %s: %s\r\n",
|
||||
u3l_log("error loading directory %s: %s",
|
||||
dir_u->pax_c, strerror(err_w));
|
||||
c3_assert(0);
|
||||
}
|
||||
@ -843,7 +843,7 @@ _unix_update_dir(u3_unix* unx_u, u3_udir* dir_u)
|
||||
struct stat buf_u;
|
||||
|
||||
if ( 0 != stat(pax_c, &buf_u) ) {
|
||||
u3l_log("can't stat %s: %s\r\n", pax_c, strerror(errno));
|
||||
u3l_log("can't stat %s: %s", pax_c, strerror(errno));
|
||||
c3_free(pax_c);
|
||||
continue;
|
||||
}
|
||||
@ -853,13 +853,13 @@ _unix_update_dir(u3_unix* unx_u, u3_udir* dir_u)
|
||||
if ( 0 == strcmp(pax_c, nod_u->pax_c) ) {
|
||||
if ( S_ISDIR(buf_u.st_mode) ) {
|
||||
if ( c3n == nod_u->dir ) {
|
||||
u3l_log("not a directory: %s\r\n", nod_u->pax_c);
|
||||
u3l_log("not a directory: %s", nod_u->pax_c);
|
||||
c3_assert(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( c3y == nod_u->dir ) {
|
||||
u3l_log("not a file: %s\r\n", nod_u->pax_c);
|
||||
u3l_log("not a file: %s", nod_u->pax_c);
|
||||
c3_assert(0);
|
||||
}
|
||||
}
|
||||
@ -894,7 +894,7 @@ _unix_update_dir(u3_unix* unx_u, u3_udir* dir_u)
|
||||
}
|
||||
|
||||
if ( closedir(rid_u) < 0 ) {
|
||||
u3l_log("error closing directory %s: %s\r\n",
|
||||
u3l_log("error closing directory %s: %s",
|
||||
dir_u->pax_c, strerror(errno));
|
||||
}
|
||||
|
||||
@ -965,7 +965,7 @@ _unix_initial_update_file(c3_c* pax_c, c3_c* bas_c)
|
||||
return u3_nul;
|
||||
}
|
||||
else {
|
||||
u3l_log("error opening initial file %s: %s\r\n",
|
||||
u3l_log("error opening initial file %s: %s",
|
||||
pax_c, strerror(errno));
|
||||
return u3_nul;
|
||||
}
|
||||
@ -977,17 +977,17 @@ _unix_initial_update_file(c3_c* pax_c, c3_c* bas_c)
|
||||
red_ws = read(fid_i, dat_y, len_ws);
|
||||
|
||||
if ( close(fid_i) < 0 ) {
|
||||
u3l_log("error closing initial file %s: %s\r\n",
|
||||
u3l_log("error closing initial file %s: %s",
|
||||
pax_c, strerror(errno));
|
||||
}
|
||||
|
||||
if ( len_ws != red_ws ) {
|
||||
if ( red_ws < 0 ) {
|
||||
u3l_log("error reading initial file %s: %s\r\n",
|
||||
u3l_log("error reading initial file %s: %s",
|
||||
pax_c, strerror(errno));
|
||||
}
|
||||
else {
|
||||
u3l_log("wrong # of bytes read in initial file %s: %d %d\r\n",
|
||||
u3l_log("wrong # of bytes read in initial file %s: %d %d",
|
||||
pax_c, len_ws, red_ws);
|
||||
}
|
||||
c3_free(dat_y);
|
||||
@ -1015,7 +1015,7 @@ _unix_initial_update_dir(c3_c* pax_c, c3_c* bas_c)
|
||||
|
||||
DIR* rid_u = opendir(pax_c);
|
||||
if ( !rid_u ) {
|
||||
u3l_log("error opening initial directory: %s: %s\r\n",
|
||||
u3l_log("error opening initial directory: %s: %s",
|
||||
pax_c, strerror(errno));
|
||||
return u3_nul;
|
||||
}
|
||||
@ -1026,7 +1026,7 @@ _unix_initial_update_dir(c3_c* pax_c, c3_c* bas_c)
|
||||
c3_w err_w;
|
||||
|
||||
if ( 0 != (err_w = u3_readdir_r(rid_u, &ent_u, &out_u)) ) {
|
||||
u3l_log("error loading initial directory %s: %s\r\n",
|
||||
u3l_log("error loading initial directory %s: %s",
|
||||
pax_c, strerror(errno));
|
||||
|
||||
c3_assert(0);
|
||||
@ -1043,7 +1043,7 @@ _unix_initial_update_dir(c3_c* pax_c, c3_c* bas_c)
|
||||
struct stat buf_u;
|
||||
|
||||
if ( 0 != stat(pox_c, &buf_u) ) {
|
||||
u3l_log("initial can't stat %s: %s\r\n",
|
||||
u3l_log("initial can't stat %s: %s",
|
||||
pox_c, strerror(errno));
|
||||
c3_free(pox_c);
|
||||
continue;
|
||||
@ -1061,7 +1061,7 @@ _unix_initial_update_dir(c3_c* pax_c, c3_c* bas_c)
|
||||
}
|
||||
|
||||
if ( closedir(rid_u) < 0 ) {
|
||||
u3l_log("error closing initial directory %s: %s\r\n",
|
||||
u3l_log("error closing initial directory %s: %s",
|
||||
pax_c, strerror(errno));
|
||||
}
|
||||
|
||||
@ -1152,16 +1152,16 @@ _unix_sync_change(u3_unix* unx_u, u3_udir* dir_u, u3_noun pax, u3_noun mim)
|
||||
|
||||
if ( c3n == u3du(pax) ) {
|
||||
if ( u3_nul == pax ) {
|
||||
u3l_log("can't sync out file as top-level, strange\r\n");
|
||||
u3l_log("can't sync out file as top-level, strange");
|
||||
}
|
||||
else {
|
||||
u3l_log("sync out: bad path\r\n");
|
||||
u3l_log("sync out: bad path");
|
||||
}
|
||||
u3z(pax); u3z(mim);
|
||||
return;
|
||||
}
|
||||
else if ( c3n == u3du(u3t(pax)) ) {
|
||||
u3l_log("can't sync out file as top-level, strangely\r\n");
|
||||
u3l_log("can't sync out file as top-level, strangely");
|
||||
u3z(pax); u3z(mim);
|
||||
}
|
||||
else {
|
||||
@ -1191,7 +1191,7 @@ _unix_sync_change(u3_unix* unx_u, u3_udir* dir_u, u3_noun pax, u3_noun mim)
|
||||
}
|
||||
|
||||
if ( c3n == nod_u->dir ) {
|
||||
u3l_log("weird, we got a file when we weren't expecting to\r\n");
|
||||
u3l_log("weird, we got a file when we weren't expecting to");
|
||||
c3_assert(0);
|
||||
}
|
||||
|
||||
@ -1274,7 +1274,7 @@ u3_unix_acquire(c3_c* pax_c)
|
||||
|
||||
if ( NULL != (loq_u = fopen(paf_c, "r")) ) {
|
||||
if ( 1 != fscanf(loq_u, "%" SCNu32, &pid_w) ) {
|
||||
u3l_log("lockfile %s is corrupt!\n", paf_c);
|
||||
u3l_log("lockfile %s is corrupt!", paf_c);
|
||||
kill(getpid(), SIGTERM);
|
||||
sleep(1); c3_assert(0);
|
||||
}
|
||||
@ -1282,7 +1282,7 @@ u3_unix_acquire(c3_c* pax_c)
|
||||
c3_w i_w;
|
||||
|
||||
if ( -1 != kill(pid_w, SIGTERM) ) {
|
||||
u3l_log("unix: stopping process %d, live in %s...\n",
|
||||
u3l_log("unix: stopping process %d, live in %s...",
|
||||
pid_w, pax_c);
|
||||
|
||||
for ( i_w = 0; i_w < 16; i_w++ ) {
|
||||
@ -1300,10 +1300,10 @@ u3_unix_acquire(c3_c* pax_c)
|
||||
}
|
||||
}
|
||||
if ( 16 == i_w ) {
|
||||
u3l_log("unix: process %d seems unkillable!\n", pid_w);
|
||||
u3l_log("unix: process %d seems unkillable!", pid_w);
|
||||
c3_assert(0);
|
||||
}
|
||||
u3l_log("unix: stopped old process %u\n", pid_w);
|
||||
u3l_log("unix: stopped old process %u", pid_w);
|
||||
}
|
||||
}
|
||||
fclose(loq_u);
|
||||
@ -1311,7 +1311,7 @@ u3_unix_acquire(c3_c* pax_c)
|
||||
}
|
||||
|
||||
if ( NULL == (loq_u = fopen(paf_c, "w")) ) {
|
||||
u3l_log("unix: unable to open %s\n", paf_c);
|
||||
u3l_log("unix: unable to open %s", paf_c);
|
||||
c3_assert(0);
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ _king_get_atom(c3_c* url_c)
|
||||
uv_buf_t buf_u = uv_buf_init(c3_malloc(1), 0);
|
||||
|
||||
if ( !(curl = curl_easy_init()) ) {
|
||||
u3l_log("failed to initialize libcurl\n");
|
||||
u3l_log("failed to initialize libcurl");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -259,13 +259,13 @@ _king_get_atom(c3_c* url_c)
|
||||
// XX retry?
|
||||
//
|
||||
if ( CURLE_OK != result ) {
|
||||
u3l_log("failed to fetch %s: %s\n",
|
||||
u3l_log("failed to fetch %s: %s",
|
||||
url_c, curl_easy_strerror(result));
|
||||
u3_king_bail();
|
||||
exit(1);
|
||||
}
|
||||
if ( 300 <= cod_l ) {
|
||||
u3l_log("error fetching %s: HTTP %ld\n", url_c, cod_l);
|
||||
u3l_log("error fetching %s: HTTP %ld", url_c, cod_l);
|
||||
u3_king_bail();
|
||||
exit(1);
|
||||
}
|
||||
@ -291,12 +291,12 @@ _get_cmd_output(c3_c *cmd_c, c3_c *out_c, c3_w len_c)
|
||||
{
|
||||
FILE *fp = popen(cmd_c, "r");
|
||||
if ( NULL == fp ) {
|
||||
u3l_log("'%s' failed\n", cmd_c);
|
||||
u3l_log("'%s' failed", cmd_c);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ( NULL == fgets(out_c, len_c, fp) ) {
|
||||
u3l_log("'%s' produced no output\n", cmd_c);
|
||||
u3l_log("'%s' produced no output", cmd_c);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ _git_pill_url(c3_c *out_c, c3_c *arv_c)
|
||||
assert(NULL != arv_c);
|
||||
|
||||
if ( 0 != system("which git >> /dev/null") ) {
|
||||
u3l_log("boot: could not find git executable\r\n");
|
||||
u3l_log("boot: could not find git executable");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ _boothack_pill(void)
|
||||
u3_noun pil;
|
||||
|
||||
if ( 0 != u3_Host.ops_u.pil_c ) {
|
||||
u3l_log("boot: loading pill %s\r\n", u3_Host.ops_u.pil_c);
|
||||
u3l_log("boot: loading pill %s", u3_Host.ops_u.pil_c);
|
||||
pil = u3m_file(u3_Host.ops_u.pil_c);
|
||||
}
|
||||
else {
|
||||
@ -362,12 +362,12 @@ _boothack_pill(void)
|
||||
strcpy(url_c, u3_Host.ops_u.url_c);
|
||||
}
|
||||
|
||||
u3l_log("boot: downloading pill %s\r\n", url_c);
|
||||
u3l_log("boot: downloading pill %s", url_c);
|
||||
pil = _king_get_atom(url_c);
|
||||
}
|
||||
|
||||
if ( 0 != u3_Host.ops_u.arv_c ) {
|
||||
u3l_log("boot: preparing filesystem from %s\r\n",
|
||||
u3l_log("boot: preparing filesystem from %s",
|
||||
u3_Host.ops_u.arv_c);
|
||||
arv = u3nc(u3_nul, u3_unix_initial_into_card(u3_Host.ops_u.arv_c));
|
||||
}
|
||||
@ -388,7 +388,7 @@ _boothack_key(u3_noun kef)
|
||||
|
||||
if ( u3_nul == des ) {
|
||||
c3_c* kef_c = u3r_string(kef);
|
||||
u3l_log("dawn: invalid private keys: %s\r\n", kef_c);
|
||||
u3l_log("dawn: invalid private keys: %s", kef_c);
|
||||
c3_free(kef_c);
|
||||
exit(1);
|
||||
}
|
||||
@ -397,7 +397,7 @@ _boothack_key(u3_noun kef)
|
||||
//
|
||||
u3_noun pro = u3m_soft(0, u3ke_cue, u3k(u3t(des)));
|
||||
if ( u3_blip != u3h(pro) ) {
|
||||
u3l_log("dawn: unable to cue keyfile\r\n");
|
||||
u3l_log("dawn: unable to cue keyfile");
|
||||
exit(1);
|
||||
}
|
||||
seed = u3k(u3t(pro));
|
||||
@ -420,7 +420,7 @@ _boothack_key(u3_noun kef)
|
||||
u3_noun whu = u3dc("slaw", 'p', u3k(woh));
|
||||
|
||||
if ( u3_nul == whu ) {
|
||||
u3l_log("dawn: invalid ship specified with -w %s\r\n",
|
||||
u3l_log("dawn: invalid ship specified with -w %s",
|
||||
u3_Host.ops_u.who_c);
|
||||
exit(1);
|
||||
}
|
||||
@ -430,7 +430,7 @@ _boothack_key(u3_noun kef)
|
||||
{
|
||||
u3_noun how = u3dc("scot", 'p', u3k(ship));
|
||||
c3_c* how_c = u3r_string(u3k(how));
|
||||
u3l_log("dawn: mismatch between -w %s and -K %s\r\n",
|
||||
u3l_log("dawn: mismatch between -w %s and -K %s",
|
||||
u3_Host.ops_u.who_c, how_c);
|
||||
|
||||
u3z(how);
|
||||
@ -461,7 +461,7 @@ _boothack_doom(void)
|
||||
u3_noun whu = u3dc("slaw", 'p', u3k(fak));
|
||||
|
||||
if ( u3_nul == whu ) {
|
||||
u3l_log("boot: malformed -F ship %s\r\n", u3_Host.ops_u.fak_c);
|
||||
u3l_log("boot: malformed -F ship %s", u3_Host.ops_u.fak_c);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -495,7 +495,7 @@ _boothack_doom(void)
|
||||
kef = u3i_string(u3_Host.ops_u.gen_c);
|
||||
}
|
||||
else {
|
||||
u3l_log("boot: must specify a key with -k or -G\r\n");
|
||||
u3l_log("boot: must specify a key with -k or -G");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -590,7 +590,7 @@ _king_sign_cb(uv_signal_t* sil_u, c3_i num_i)
|
||||
{
|
||||
switch ( num_i ) {
|
||||
default: {
|
||||
u3l_log("\r\nmysterious signal %d\r\n", num_i);
|
||||
u3l_log("\r\nmysterious signal %d", num_i);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -600,7 +600,7 @@ _king_sign_cb(uv_signal_t* sil_u, c3_i num_i)
|
||||
}
|
||||
|
||||
case SIGINT: {
|
||||
u3l_log("\r\ninterrupt\r\n");
|
||||
u3l_log("\r\ninterrupt");
|
||||
u3_term_ef_ctlc();
|
||||
|
||||
#if defined(U3_OS_mingw)
|
||||
@ -703,7 +703,7 @@ _king_boot_ivory(void)
|
||||
|
||||
if ( u3_Host.ops_u.lit_c ) {
|
||||
if ( c3n == u3u_mmap_read("lite", u3_Host.ops_u.lit_c, &len_d, &byt_y) ) {
|
||||
u3l_log("lite: unable to load ivory pill at %s\n",
|
||||
u3l_log("lite: unable to load ivory pill at %s",
|
||||
u3_Host.ops_u.lit_c);
|
||||
exit(1);
|
||||
}
|
||||
@ -718,21 +718,21 @@ _king_boot_ivory(void)
|
||||
u3_weak pil;
|
||||
|
||||
if ( u3_none == (pil = u3s_cue_xeno_with(sil_u, len_d, byt_y)) ) {
|
||||
u3l_log("lite: unable to cue ivory pill\r\n");
|
||||
u3l_log("lite: unable to cue ivory pill");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
u3s_cue_xeno_done(sil_u);
|
||||
|
||||
if ( c3n == u3v_boot_lite(pil)) {
|
||||
u3l_log("lite: boot failed\r\n");
|
||||
u3l_log("lite: boot failed");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if ( u3_Host.ops_u.lit_c ) {
|
||||
if ( c3n == u3u_munmap(len_d, byt_y) ) {
|
||||
u3l_log("lite: unable to unmap ivory pill at %s\n",
|
||||
u3l_log("lite: unable to unmap ivory pill at %s",
|
||||
u3_Host.ops_u.lit_c);
|
||||
exit(1);
|
||||
}
|
||||
@ -786,7 +786,7 @@ u3_king_commence()
|
||||
rlm.rlim_cur = 0;
|
||||
|
||||
if ( 0 != setrlimit(RLIMIT_CORE, &rlm) ) {
|
||||
u3l_log("king: unable to disable core dumps: %s\r\n", strerror(errno));
|
||||
u3l_log("king: unable to disable core dumps: %s", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -954,7 +954,7 @@ u3_king_grab(void* vod_p)
|
||||
}
|
||||
#else
|
||||
{
|
||||
u3_term_io_loja(0);
|
||||
u3_term_io_loja(0, fil_u);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -267,13 +267,13 @@ _lord_plea_live(u3_lord* god_u, u3_noun dat)
|
||||
case u3_writ_meld: {
|
||||
// XX wire into cb
|
||||
//
|
||||
u3l_log("pier: meld complete\n");
|
||||
u3l_log("pier: meld complete");
|
||||
} break;
|
||||
|
||||
case u3_writ_pack: {
|
||||
// XX wire into cb
|
||||
//
|
||||
u3l_log("pier: pack complete\n");
|
||||
u3l_log("pier: pack complete");
|
||||
} break;
|
||||
}
|
||||
|
||||
@ -1098,10 +1098,10 @@ _lord_on_serf_bail(void* ptr_v,
|
||||
u3_lord* god_u = ptr_v;
|
||||
|
||||
if ( UV_EOF == err_i ) {
|
||||
u3l_log("pier: serf unexpectedly shut down\r\n");
|
||||
u3l_log("pier: serf unexpectedly shut down");
|
||||
}
|
||||
else {
|
||||
u3l_log("pier: serf error: %s\r\n", err_c);
|
||||
u3l_log("pier: serf error: %s", err_c);
|
||||
}
|
||||
|
||||
_lord_bail(god_u);
|
||||
@ -1112,7 +1112,7 @@ _lord_on_serf_bail(void* ptr_v,
|
||||
void
|
||||
u3_lord_info(u3_lord* god_u)
|
||||
{
|
||||
u3l_log(" lord: live=%s, event=%" PRIu64 ", mug=%x, queue=%u\n",
|
||||
u3l_log(" lord: live=%s, event=%" PRIu64 ", mug=%x, queue=%u",
|
||||
( c3y == god_u->liv_o ) ? "&" : "|",
|
||||
god_u->eve_d,
|
||||
god_u->mug_l,
|
||||
@ -1148,7 +1148,7 @@ u3_lord_init(c3_c* pax_c, c3_w wag_w, c3_d key_d[4], u3_lord_cb cb_u)
|
||||
c3_c cev_c[11];
|
||||
c3_i err_i;
|
||||
|
||||
sprintf(key_c, "%" PRIx64 ":%" PRIx64 ":%" PRIx64 ":%" PRIx64 "",
|
||||
sprintf(key_c, "%" PRIx64 ":%" PRIx64 ":%" PRIx64 ":%" PRIx64,
|
||||
god_u->key_d[0],
|
||||
god_u->key_d[1],
|
||||
god_u->key_d[2],
|
||||
|
@ -362,7 +362,7 @@ u3_newt_moat_info(u3_moat* mot_u)
|
||||
}
|
||||
|
||||
if ( len_w ) {
|
||||
u3l_log(" newt: %u inbound ipc messages pending\n", len_w);
|
||||
u3l_log(" newt: %u inbound ipc messages pending", len_w);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ _pier_work(u3_work* wok_u)
|
||||
// XX this is when "boot" is actually complete
|
||||
// XX even better would be after neighboring with our sponsor
|
||||
//
|
||||
u3l_log("pier (%" PRIu64 "): live\r\n", pir_u->god_u->eve_d);
|
||||
u3l_log("pier (%" PRIu64 "): live", pir_u->god_u->eve_d);
|
||||
|
||||
// XX move callbacking to king
|
||||
//
|
||||
@ -286,7 +286,7 @@ _pier_on_lord_work_spin(void* ptr_v, u3_atom pin, c3_o del_o)
|
||||
u3_term_start_spinner(pin, del_o);
|
||||
}
|
||||
|
||||
/* _pier_on_lord_work_spin(): stop spinner
|
||||
/* _pier_on_lord_work_spun(): stop spinner
|
||||
*/
|
||||
static void
|
||||
_pier_on_lord_work_spun(void* ptr_v)
|
||||
@ -472,13 +472,13 @@ _pier_on_scry_done(void* ptr_v, u3_noun nun)
|
||||
u3_weak res = u3r_at(7, nun);
|
||||
|
||||
if (u3_none == res) {
|
||||
u3l_log("pier: scry failed\n");
|
||||
u3l_log("pier: scry failed");
|
||||
}
|
||||
else {
|
||||
u3_weak out, pad;
|
||||
c3_c *ext_c, *pac_c;
|
||||
|
||||
u3l_log("pier: scry succeeded\n");
|
||||
u3l_log("pier: scry succeeded");
|
||||
|
||||
if ( u3_Host.ops_u.puk_c ) {
|
||||
pac_c = u3_Host.ops_u.puk_c;
|
||||
@ -531,11 +531,11 @@ _pier_on_scry_done(void* ptr_v, u3_noun nun)
|
||||
pir_u->pax_c, pac_c+1, ext_c);
|
||||
|
||||
u3_walk_save(fil_c, 0, out, pir_u->pax_c, pad);
|
||||
u3l_log("pier: scry result in %s\n", fil_c);
|
||||
u3l_log("pier: scry result in %s", fil_c);
|
||||
}
|
||||
}
|
||||
|
||||
u3l_log("pier: exit\n");
|
||||
u3l_log("pier: exit");
|
||||
u3_pier_exit(pir_u);
|
||||
|
||||
u3z(nun);
|
||||
@ -614,7 +614,7 @@ _pier_work_init(u3_pier* pir_u)
|
||||
} else {
|
||||
// run the requested scry, jam to disk, then exit
|
||||
//
|
||||
u3l_log("pier: scry\n");
|
||||
u3l_log("pier: scry");
|
||||
u3_pier_peek_last(pir_u, u3_nul, u3k(car), u3k(dek), u3k(pax),
|
||||
pir_u, _pier_on_scry_done);
|
||||
}
|
||||
@ -663,7 +663,7 @@ _pier_wyrd_fail(u3_pier* pir_u, u3_ovum* egg_u, u3_noun lud)
|
||||
{
|
||||
// XX version negotiation failed, print upgrade message
|
||||
//
|
||||
u3l_log("pier: version negotation failed\n\n");
|
||||
u3l_log("pier: version negotation failed");
|
||||
|
||||
// XX only print trace with -v ?
|
||||
//
|
||||
@ -749,7 +749,7 @@ _pier_on_lord_wyrd_done(void* ptr_v,
|
||||
|
||||
// XX messaging, cli argument to bypass
|
||||
//
|
||||
u3l_log("pier: version negotiation failed; downgrade\n");
|
||||
u3l_log("pier: version negotiation failed; downgrade");
|
||||
_pier_wyrd_fail(pir_u, egg_u, u3_nul);
|
||||
}
|
||||
else {
|
||||
@ -842,7 +842,7 @@ _pier_wyrd_init(u3_pier* pir_u)
|
||||
|
||||
pir_u->sat_e = u3_psat_wyrd;
|
||||
|
||||
u3l_log("vere: checking version compatibility\n");
|
||||
u3l_log("vere: checking version compatibility");
|
||||
|
||||
{
|
||||
u3_lord* god_u = pir_u->god_u;
|
||||
@ -1031,11 +1031,11 @@ _pier_play(u3_play* pay_u)
|
||||
if ( god_u->eve_d == pay_u->eve_d ) {
|
||||
// XX should be play_cb
|
||||
//
|
||||
u3l_log("---------------- playback complete ----------------\r\n");
|
||||
u3l_log("---------------- playback complete ----------------");
|
||||
u3_term_stop_spinner();
|
||||
|
||||
if ( pay_u->eve_d < log_u->dun_d ) {
|
||||
// u3l_log("pier: replay barrier reached, shutting down\r\n");
|
||||
// u3l_log("pier: replay barrier reached, shutting down");
|
||||
// // XX graceful shutdown
|
||||
// //
|
||||
// u3_lord_save(pir_u->god_u);
|
||||
@ -1044,7 +1044,7 @@ _pier_play(u3_play* pay_u)
|
||||
|
||||
// XX temporary hack
|
||||
//
|
||||
u3l_log("pier: replay barrier reached, cramming\r\n");
|
||||
u3l_log("pier: replay barrier reached, cramming");
|
||||
u3_pier_cram(pir_u);
|
||||
}
|
||||
else if ( pay_u->eve_d == log_u->dun_d ) {
|
||||
@ -1070,12 +1070,12 @@ _pier_on_lord_play_done(void* ptr_v, u3_info fon_u, c3_l mug_l)
|
||||
|
||||
c3_assert( u3_psat_play == pir_u->sat_e );
|
||||
|
||||
u3l_log("pier: (%" PRIu64 "): play: done\r\n", tac_u->eve_d);
|
||||
u3l_log("pier: (%" PRIu64 "): play: done", tac_u->eve_d);
|
||||
|
||||
// XX optional
|
||||
//
|
||||
if ( tac_u->mug_l && (tac_u->mug_l != mug_l) ) {
|
||||
u3l_log("pier: (%" PRIu64 "): play: mug mismatch %x %x\r\n",
|
||||
u3l_log("pier: (%" PRIu64 "): play: mug mismatch %x %x",
|
||||
tac_u->eve_d,
|
||||
tac_u->mug_l,
|
||||
mug_l);
|
||||
@ -1124,7 +1124,7 @@ _pier_on_lord_play_bail(void* ptr_v, u3_info fon_u,
|
||||
// XX optional
|
||||
//
|
||||
if ( las_l && (las_l != mug_l) ) {
|
||||
u3l_log("pier: (%" PRIu64 "): play bail: mug mismatch %x %x\r\n",
|
||||
u3l_log("pier: (%" PRIu64 "): play bail: mug mismatch %x %x",
|
||||
(c3_d)(eve_d - 1ULL),
|
||||
las_l,
|
||||
mug_l);
|
||||
@ -1135,7 +1135,7 @@ _pier_on_lord_play_bail(void* ptr_v, u3_info fon_u,
|
||||
//
|
||||
#if 0
|
||||
{
|
||||
u3l_log("pier: (%" PRIu64 "): play: retry\r\n", eve_d);
|
||||
u3l_log("pier: (%" PRIu64 "): play: retry", eve_d);
|
||||
|
||||
fon_u.ext_u = tac_u;
|
||||
|
||||
@ -1156,7 +1156,7 @@ _pier_on_lord_play_bail(void* ptr_v, u3_info fon_u,
|
||||
}
|
||||
#else
|
||||
{
|
||||
u3l_log("pier: (%" PRIu64 "): play: bail\r\n", eve_d);
|
||||
u3l_log("pier: (%" PRIu64 "): play: bail", eve_d);
|
||||
u3_pier_punt_goof("play", dud);
|
||||
{
|
||||
u3_noun wir, tag;
|
||||
@ -1192,12 +1192,12 @@ _pier_play_init(u3_pier* pir_u, c3_d eve_d)
|
||||
pay_u->eve_d = eve_d;
|
||||
pay_u->sen_d = god_u->eve_d;
|
||||
|
||||
u3l_log("---------------- playback starting ----------------\r\n");
|
||||
u3l_log("---------------- playback starting ----------------");
|
||||
if ( (1ULL + god_u->eve_d) == eve_d ) {
|
||||
u3l_log("pier: replaying event %" PRIu64 "\r\n", eve_d);
|
||||
u3l_log("pier: replaying event %" PRIu64, eve_d);
|
||||
}
|
||||
else {
|
||||
u3l_log("pier: replaying events %" PRIu64 "-%" PRIu64 "\r\n",
|
||||
u3l_log("pier: replaying events %" PRIu64 "-%" PRIu64,
|
||||
(c3_d)(1ULL + god_u->eve_d),
|
||||
eve_d);
|
||||
}
|
||||
@ -1326,7 +1326,7 @@ _pier_on_lord_cram(void* ptr_v)
|
||||
// XX temporary hack
|
||||
//
|
||||
if ( u3_psat_play == pir_u->sat_e ) {
|
||||
u3l_log("pier: cram complete, shutting down\r\n");
|
||||
u3l_log("pier: cram complete, shutting down");
|
||||
u3_pier_bail(pir_u);
|
||||
exit(0);
|
||||
}
|
||||
@ -1355,7 +1355,7 @@ _pier_on_lord_exit(void* ptr_v)
|
||||
pir_u->god_u = 0;
|
||||
|
||||
if ( u3_psat_done != pir_u->sat_e ) {
|
||||
u3l_log("pier: serf shutdown unexpected\r\n");
|
||||
u3l_log("pier: serf shutdown unexpected");
|
||||
u3_pier_bail(pir_u);
|
||||
}
|
||||
// if we made it all the way here, it's our jab to wrap up
|
||||
@ -1416,10 +1416,10 @@ _pier_on_lord_live(void* ptr_v)
|
||||
//
|
||||
if ( u3_Host.ops_u.til_c ) {
|
||||
if ( 1 == sscanf(u3_Host.ops_u.til_c, "%" PRIu64 "", &eve_d) ) {
|
||||
u3l_log("pier: replay till %" PRIu64 "\r\n", eve_d);
|
||||
u3l_log("pier: replay till %" PRIu64, eve_d);
|
||||
}
|
||||
else {
|
||||
u3l_log("pier: ignoring invalid replay barrier '%s'\r\n",
|
||||
u3l_log("pier: ignoring invalid replay barrier '%s'",
|
||||
u3_Host.ops_u.til_c);
|
||||
eve_d = log_u->dun_d;
|
||||
}
|
||||
@ -1443,51 +1443,51 @@ u3_pier_info(u3_pier* pir_u)
|
||||
{
|
||||
switch ( pir_u->sat_e ) {
|
||||
default: {
|
||||
u3l_log("pier: unknown state: %u\r\n", pir_u->sat_e);
|
||||
u3l_log("pier: unknown state: %u", pir_u->sat_e);
|
||||
} break;
|
||||
|
||||
case u3_psat_init: {
|
||||
u3l_log("pier: init\n");
|
||||
u3l_log("pier: init");
|
||||
} break;
|
||||
|
||||
case u3_psat_boot: {
|
||||
u3l_log("pier: boot\n");
|
||||
u3l_log("pier: boot");
|
||||
} break;
|
||||
|
||||
case u3_psat_play: {
|
||||
u3l_log("pier: play\n");
|
||||
u3l_log("pier: play");
|
||||
|
||||
{
|
||||
u3_play* pay_u = pir_u->pay_u;
|
||||
|
||||
u3l_log(" target: %" PRIu64 "\n", pay_u->eve_d);
|
||||
u3l_log(" sent: %" PRIu64 "\n", pay_u->sen_d);
|
||||
u3l_log(" read: %" PRIu64 "\n", pay_u->req_d);
|
||||
u3l_log(" target: %" PRIu64, pay_u->eve_d);
|
||||
u3l_log(" sent: %" PRIu64, pay_u->sen_d);
|
||||
u3l_log(" read: %" PRIu64, pay_u->req_d);
|
||||
}
|
||||
} break;
|
||||
|
||||
case u3_psat_work: {
|
||||
u3l_log("pier: work\n");
|
||||
u3l_log("pier: work");
|
||||
|
||||
{
|
||||
u3_work* wok_u = pir_u->wok_u;
|
||||
|
||||
u3l_log(" effects: released=%" PRIu64 "\n", wok_u->fec_u.rel_d);
|
||||
u3l_log(" effects: released=%" PRIu64, wok_u->fec_u.rel_d);
|
||||
|
||||
if ( wok_u->fec_u.ext_u ) {
|
||||
if ( wok_u->fec_u.ext_u != wok_u->fec_u.ent_u ) {
|
||||
u3l_log(" pending %" PRIu64 "-%" PRIu64 "\n",
|
||||
u3l_log(" pending %" PRIu64 "-%" PRIu64,
|
||||
wok_u->fec_u.ext_u->eve_d,
|
||||
wok_u->fec_u.ent_u->eve_d);
|
||||
|
||||
}
|
||||
else {
|
||||
u3l_log(" pending %" PRIu64 "\n", wok_u->fec_u.ext_u->eve_d);
|
||||
u3l_log(" pending %" PRIu64, wok_u->fec_u.ext_u->eve_d);
|
||||
}
|
||||
}
|
||||
|
||||
if ( wok_u->wal_u ) {
|
||||
u3l_log(" wall: %" PRIu64 "\n", wok_u->wal_u->eve_d);
|
||||
u3l_log(" wall: %" PRIu64, wok_u->wal_u->eve_d);
|
||||
}
|
||||
|
||||
if ( wok_u->car_u ) {
|
||||
@ -1497,7 +1497,7 @@ u3_pier_info(u3_pier* pir_u)
|
||||
} break;
|
||||
|
||||
case u3_psat_done: {
|
||||
u3l_log("pier: done\n");
|
||||
u3l_log("pier: done");
|
||||
} break;
|
||||
}
|
||||
|
||||
@ -1611,7 +1611,7 @@ u3_pier_stay(c3_w wag_w, u3_noun pax)
|
||||
if ( c3y == u3_Host.ops_u.veb ) {
|
||||
FILE* fil_u = u3_term_io_hija();
|
||||
u3_lmdb_stat(pir_u->log_u->mdb_u, fil_u);
|
||||
u3_term_io_loja(1);
|
||||
u3_term_io_loja(1, fil_u);
|
||||
}
|
||||
|
||||
u3z(pax);
|
||||
@ -2221,10 +2221,12 @@ _pier_dump_wall(FILE* fil_u, u3_noun wol)
|
||||
while ( u3_nul != wal ) {
|
||||
_pier_dump_tape(fil_u, u3k(u3h(wal)));
|
||||
|
||||
putc(13, fil_u);
|
||||
putc(10, fil_u);
|
||||
|
||||
wal = u3t(wal);
|
||||
|
||||
if ( u3_nul != wal ) {
|
||||
putc(13, fil_u);
|
||||
putc(10, fil_u);
|
||||
}
|
||||
}
|
||||
|
||||
u3z(wol);
|
||||
@ -2250,6 +2252,7 @@ u3_pier_tank(c3_l tab_l, c3_w pri_w, u3_noun tac)
|
||||
case 3: fprintf(fil_u, "\033[31m>>> "); break;
|
||||
case 2: fprintf(fil_u, "\033[33m>> "); break;
|
||||
case 1: fprintf(fil_u, "\033[32m> "); break;
|
||||
case 0: fprintf(fil_u, "\033[90m" ); break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -2266,8 +2269,6 @@ u3_pier_tank(c3_l tab_l, c3_w pri_w, u3_noun tac)
|
||||
if ( 0 == u3A->roc ) {
|
||||
if ( c3__leaf == u3h(tac) ) {
|
||||
_pier_dump_tape(fil_u, u3k(u3t(tac)));
|
||||
putc(13, fil_u);
|
||||
putc(10, fil_u);
|
||||
}
|
||||
}
|
||||
// We are calling nock here, but hopefully need no protection.
|
||||
@ -2284,7 +2285,7 @@ u3_pier_tank(c3_l tab_l, c3_w pri_w, u3_noun tac)
|
||||
|
||||
fflush(fil_u);
|
||||
|
||||
u3_term_io_loja(0);
|
||||
u3_term_io_loja(0, fil_u);
|
||||
u3z(blu);
|
||||
u3z(tac);
|
||||
}
|
||||
@ -2314,12 +2315,12 @@ u3_pier_punt_goof(const c3_c* cap_c, u3_noun dud)
|
||||
|
||||
u3x_cell(dud, &mot, &tan);
|
||||
|
||||
u3l_log("\n");
|
||||
u3l_log("");
|
||||
u3_pier_punt(0, u3qb_flop(tan));
|
||||
|
||||
{
|
||||
c3_c* mot_c = u3r_string(mot);
|
||||
u3l_log("%s: bail: %%%s\r\n", cap_c, mot_c);
|
||||
u3l_log("%s: bail: %%%s", cap_c, mot_c);
|
||||
c3_free(mot_c);
|
||||
}
|
||||
|
||||
@ -2335,7 +2336,7 @@ u3_pier_punt_ovum(const c3_c* cap_c, u3_noun wir, u3_noun tag)
|
||||
u3_noun riw = u3do("spat", wir);
|
||||
c3_c* wir_c = u3r_string(riw);
|
||||
|
||||
u3l_log("%s: %%%s event on %s failed\r\n\n", cap_c, tag_c, wir_c);
|
||||
u3l_log("%s: %%%s event on %s failed", cap_c, tag_c, wir_c);
|
||||
|
||||
c3_free(tag_c);
|
||||
c3_free(wir_c);
|
||||
|
@ -25,7 +25,7 @@ u3_save_ef_chld(u3_pier *pir_u)
|
||||
|
||||
/* modified for cases with no pid_w
|
||||
*/
|
||||
u3l_log("checkpoint: complete %d\n", sav_u->pid_w);
|
||||
u3l_log("checkpoint: complete %d", sav_u->pid_w);
|
||||
pid_w = wait(&loc_i);
|
||||
if (0 != sav_u->pid_w) {
|
||||
c3_assert(pid_w == sav_u->pid_w);
|
||||
|
@ -37,7 +37,7 @@ u3_walk_safe(c3_c* pas_c)
|
||||
c3_y* pad_y;
|
||||
|
||||
if ( (fid_i < 0) || (fstat(fid_i, &buf_b) < 0) ) {
|
||||
// u3l_log("%s: %s\n", pas_c, strerror(errno));
|
||||
// u3l_log("%s: %s", pas_c, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
fln_w = buf_b.st_size;
|
||||
@ -69,7 +69,7 @@ u3_walk_load(c3_c* pas_c)
|
||||
c3_y* pad_y;
|
||||
|
||||
if ( (fid_i < 0) || (fstat(fid_i, &buf_b) < 0) ) {
|
||||
u3l_log("%s: %s\n", pas_c, strerror(errno));
|
||||
u3l_log("%s: %s", pas_c, strerror(errno));
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
fln_w = buf_b.st_size;
|
||||
@ -117,7 +117,7 @@ _walk_mkdirp(c3_c* bas_c, u3_noun pax)
|
||||
pax_c[len_w] = '\0';
|
||||
|
||||
if ( 0 != mkdir(pax_c, 0755) && EEXIST != errno ) {
|
||||
u3l_log("error mkdiring %s: %s\n", pax_c, strerror(errno));
|
||||
u3l_log("error mkdiring %s: %s", pax_c, strerror(errno));
|
||||
u3m_bail(c3__fail);
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ u3_walk_save(c3_c* pas_c, u3_noun tim, u3_atom pad, c3_c* bas_c, u3_noun pax)
|
||||
return u3_walk_save(pas_c, tim, pad, 0, u3_nul);
|
||||
}
|
||||
|
||||
u3l_log("%s: %s\n", pas_c, strerror(errno));
|
||||
u3l_log("%s: %s", pas_c, strerror(errno));
|
||||
u3m_bail(c3__fail);
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ u3_walk_save(c3_c* pas_c, u3_noun tim, u3_atom pad, c3_c* bas_c, u3_noun pax)
|
||||
c3_free(pad_y);
|
||||
|
||||
if ( rit_w != fln_w ) {
|
||||
u3l_log("%s: %s\n", pas_c, strerror(errno));
|
||||
u3l_log("%s: %s", pas_c, strerror(errno));
|
||||
u3m_bail(c3__fail);
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ _walk_in(const c3_c* dir_c, c3_w len_w)
|
||||
struct dirent* out_n;
|
||||
|
||||
if ( u3_readdir_r(dir_d, &ent_n, &out_n) != 0 ) {
|
||||
u3l_log("%s: %s\n", dir_c, strerror(errno));
|
||||
u3l_log("%s: %s", dir_c, strerror(errno));
|
||||
break;
|
||||
}
|
||||
else if ( !out_n ) {
|
||||
@ -267,7 +267,7 @@ u3_walk(const c3_c* dir_c, u3_noun old)
|
||||
struct stat buf_b;
|
||||
|
||||
if ( 0 != stat(dir_c, &buf_b) ) {
|
||||
u3l_log("can't stat %s\n", dir_c);
|
||||
u3l_log("can't stat %s", dir_c);
|
||||
// return u3m_bail(c3__fail);
|
||||
c3_assert(0);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ _serf_grab(u3_serf* sef_u)
|
||||
u3z(sef_u->sac);
|
||||
sef_u->sac = u3_nul;
|
||||
|
||||
u3l_log("\n");
|
||||
u3l_log("");
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ u3_serf_post(u3_serf* sef_u)
|
||||
|
||||
if ( c3y == sef_u->pac_o ) {
|
||||
u3a_print_memory(stderr, "serf: pack: gained", u3m_pack());
|
||||
u3l_log("\n");
|
||||
u3l_log("");
|
||||
sef_u->pac_o = c3n;
|
||||
}
|
||||
}
|
||||
@ -464,7 +464,7 @@ _serf_poke(u3_serf* sef_u, c3_c* cap_c, c3_w mil_w, u3_noun job)
|
||||
if ( (c3__belt != tag)
|
||||
&& (c3__crud != tag) )
|
||||
{
|
||||
u3l_log("serf: %s (%" PRIu64 ") %s\r\n", cap_c, sef_u->sen_d, txt_c);
|
||||
u3l_log("serf: %s (%" PRIu64 ") %s", cap_c, sef_u->sen_d, txt_c);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -484,7 +484,7 @@ _serf_poke(u3_serf* sef_u, c3_c* cap_c, c3_w mil_w, u3_noun job)
|
||||
clr_w = ms_w > 1000 ? 1 : ms_w < 100 ? 2 : 3; // red, green, yellow
|
||||
|
||||
if ( clr_w != 2 ) {
|
||||
u3l_log("\x1b[3%dm%%%s (%" PRIu64 ") %4d.%02dms\x1b[0m\n",
|
||||
u3l_log("\x1b[3%dm%%%s (%" PRIu64 ") %4d.%02dms\x1b[0m",
|
||||
clr_w, txt_c, sef_u->sen_d, ms_w,
|
||||
(int) (d0.tv_usec % 1000) / 10);
|
||||
}
|
||||
@ -523,7 +523,7 @@ _serf_work(u3_serf* sef_u, c3_w mil_w, u3_noun job)
|
||||
//
|
||||
if ( u3_blip == u3h(gon) ) {
|
||||
u3_noun vir = _serf_sure(sef_u, pre_w, u3k(u3t(gon)));
|
||||
|
||||
|
||||
u3z(gon); u3z(job);
|
||||
return u3nc(c3__done, u3nt(u3i_chubs(1, &sef_u->dun_d),
|
||||
sef_u->mug_l,
|
||||
@ -901,7 +901,7 @@ u3_serf_live(u3_serf* sef_u, u3_noun com, u3_noun* ret)
|
||||
return c3n;
|
||||
}
|
||||
|
||||
u3l_log("serf (%" PRIu64 "): saving rock\r\n", sef_u->dun_d);
|
||||
u3l_log("serf (%" PRIu64 "): saving rock", sef_u->dun_d);
|
||||
|
||||
if ( c3n == u3u_cram(sef_u->dir_c, eve_d) ) {
|
||||
fprintf(stderr, "serf (%" PRIu64 "): unable to jam state\r\n", eve_d);
|
||||
@ -1045,7 +1045,7 @@ u3_serf_writ(u3_serf* sef_u, u3_noun wit, u3_noun* pel)
|
||||
static u3_noun
|
||||
_serf_ripe(u3_serf* sef_u)
|
||||
{
|
||||
// u3l_log("serf: ripe %" PRIu64 "\r\n", sef_u->dun_d);
|
||||
// u3l_log("serf: ripe %" PRIu64, sef_u->dun_d);
|
||||
|
||||
sef_u->mug_l = ( 0 == sef_u->dun_d )
|
||||
? 0
|
||||
|
Loading…
Reference in New Issue
Block a user