on 492ae2f help sign in
73 lines 2.0 kB history raw
1### `++mook`
3Intelligently render crash annotation
5Converts a `%2` `++tone` nock stack trace to a list of `++tank`.
6Each may be a tank, cord, `++spot`, or trapped tank.
8Accepts
9-------
11`ton` is a `++tone`.
13Produces
14--------
16A `++toon`.
18Source
19------
21 ++ mook
22 |= ton/tone
23 ^- toon
24 ?. ?=({$2 *} ton) ton
25 :- %2
26 :: =. p.ton (moop p.ton)
27 =+ yel=(lent p.ton)
28 =. p.ton
29 ?. (gth yel 256) p.ton
30 %+ weld
31 (scag 128 p.ton)
32 ^- (list {@ta *})
33 :_ (slag (sub yel 128) p.ton)
34 :- %lose
35 %+ rap 3
36 "[skipped {(scow %ud (sub yel 256))} frames]"
37 |- ^- (list tank)
38 ?~ p.ton ~
39 =+ rep=$(p.ton t.p.ton)
40 ?+ -.i.p.ton rep
41 $hunk [(tank +.i.p.ton) rep]
42 $lose [[%leaf (rip 3 (@ +.i.p.ton))] rep]
43 $hand [[%leaf (scow %p (mug +.i.p.ton))] rep]
44 $mean :_ rep
45 ?@ +.i.p.ton [%leaf (rip 3 (@ +.i.p.ton))]
46 =+ mac=(mack +.i.p.ton +<.i.p.ton)
47 ?~(mac [%leaf "####"] (tank u.mac))
48 $spot :_ rep
49 =+ sot=(spot +.i.p.ton)
50 :+ %rose [":" ~ ~]
51 :~ (smyt p.sot)
52 => [ud=|=(a/@u (scow %ud a)) q.sot]
53 leaf+"<[{(ud p.p)} {(ud q.p)}].[{(ud p.q)} {(ud q.q)}]>"
54 == ==
55 ::
57Examples
58--------
60 ~zod/try=> (mook [%0 5 4 5 1])
61 [%0 p=[5 4 5 1]]
62 ~zod/try=> (mook [%2 ~[[%hunk %rose ["<" "," ">"] ~[[%leaf "err"]]]]])
63 [%2 p=~[[%rose p=[p="<" q="," r=">"] q=[i=[%leaf p="err"] t=~]]]]
64 ~zod/try=> (mook [%2 ~[[%malformed %elem] [%lose 'do print']]])
65 [%2 p=~[[%leaf p="do print"]]]
66 ~zod/try=> (mook [%2 ~[[%mean |.(>(add 5 6)<)]]])
67 [%2 p=~[[%leaf p="11"]]]
68 ~zod/try=> (mook [%2 ~[[%spot /b/repl [1 1]^[1 2]] [%mean |.(!!)]]])
69 [%2 p=~[[%leaf p="/b/repl/:<[1 1].[1 2]>"] [%leaf p="####"]]]
73***