|
|
1.1 root 1: run_ctrlat = proc (e: env, c: char) signals (errmsg(string), stop(env, string))
2: if e.this_arg > 1 cor e.this_arg < 0
3: then top_display(e, "GCing")
4: secs1, msecs1, usecs1: int := _get_runtime()
5: freed: int := gc()
6: left: int := _heap_size()
7: secs2, msecs2, usecs2: int := _get_runtime()
8: secs2, msecs2, usecs2 := _longsub(secs2, msecs2, usecs2,
9: secs1, msecs1, usecs1)
10: top_display(e, "GC #" || int$unparse(_gc$count()) || ": " ||
11: int$unparse(freed) || " freed, " ||
12: int$unparse(left) || " left, " ||
13: _time_format(secs2, msecs2, usecs2))
14: elseif e.this_arg = 0
15: then if env$fetch_num(e, "careful", 0) ~= 0
16: then cnt: int := 0
17: nms: string := ""
18: for b: buf, bnm, fnm: string in bufset$all_buffers() do
19: if buf$any_changed(b)
20: then if cnt = 2
21: then nms := nms || ", ..."
22: break
23: elseif cnt = 1
24: then nms := string$append("s" || nms, ',')
25: end
26: nms := string$append(nms, ' ') || bnm
27: cnt := cnt + 1
28: end
29: end
30: if cnt > 0 cand
31: ~mconfirm(e, "Buffer" || nms || " changed, quit anyway", true)
32: then return end
33: end
34: keypad: int := env$fetch_num(e, "keypad", 0)
35: if keypad ~= 0
36: then _set_keypad_mode(false) end
37: _normal_chars()
38: screen$destroy()
39: quit_()
40: else olines, ochars: int := _get_screen_size()
41: _normal_chars()
42: _ted_chars()
43: nlines, nchars: int := _get_screen_size()
44: if nlines ~= olines cor nchars ~= ochars
45: then n: int := 1
46: otop: int := 0
47: ntop: int := 0
48: for ee: env in winset$all() do
49: ee.size := (ee.size * nlines) / olines
50: ee.width := nchars - 1
51: if ee.top_line = otop
52: then ee.top_line := ntop
53: else otop := ee.top_line
54: ntop := n
55: ee.top_line := n
56: n := n + ee.size + 1
57: end
58: if env$is_argenv(ee)
59: then continue end
60: title: string := ee.title
61: i: int := string$size(title)
62: while title[i] = '-' cor title[i] = ' ' do
63: i := i - 1
64: end except when bounds: end
65: update_title(ee, string$substr(title, 1, i))
66: end
67: if n < nlines
68: then n := nlines - n
69: for ee: env in winset$all() do
70: if ee.top_line = 1
71: then ee.size := ee.size + n
72: else ee.top_line := ee.top_line + n
73: end
74: end
75: end
76: end
77: env$clear(e)
78: end resignal errmsg
79: end run_ctrlat
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.