https://github.com/akkartik/mu/blob/main/linux/tile/value-stack.mu
1
2
3 type value-stack {
4 data: (handle array value)
5 top: int
6 }
7
8 fn initialize-value-stack _self: (addr value-stack), n: int {
9 var self/esi: (addr value-stack) <- copy _self
10 var d/edi: (addr handle array value) <- get self, data
11 populate d, n
12 var top/eax: (addr int) <- get self, top
13 copy-to *top, 0
14 }
15
16 fn clear-value-stack _self: (addr value-stack) {
17 var self/esi: (addr value-stack) <- copy _self
18 var top/eax: (addr int) <- get self, top
19 copy-to *top, 0
20 }
21
22 fn push-number-to-value-stack _self: (addr value-stack), _val: float {
23 var self/esi: (addr value-stack) <- copy _self
24 var top-addr/ecx: (addr int) <- get self, top
25 var data-ah/edx: (addr handle array value) <- get self, data
26 var data/eax: (addr array value) <- lookup *data-ah
27 var top/edx: int <- copy *top-addr
28 var dest-offset/edx: (offset value) <- compute-offset data, top
29 var dest-addr/edx: (addr value) <- index data, dest-offset
30 var dest-addr2/eax: (addr float) <- get dest-addr, number-data
31 var val/xmm0: float <- copy _val
32
33 copy-to *dest-addr2, val
34 increment *top-addr
35 var type-addr/eax: (addr int) <- get dest-addr, type
36 copy-to *type-addr, 0/number
37 }
38
39 fn push-string-to-value-stack _self: (addr value-stack), val: (handle array byte) {
40 var self/esi: (addr value-stack) <- copy _self
41 var top-addr/ecx: (addr int) <- get self, top
42 var data-ah/edx: (addr handle array value) <- get self, data
43 var data/eax: (addr array value) <- lookup *data-ah
44 var top/edx: int <- copy *top-addr
45 var dest-offset/edx: (offset value) <- compute-offset data, top
46 var dest-addr/edx: (addr value) <- index data, dest-offset
47 var dest-addr2/eax: (addr handle array byte) <- get dest-addr, text-data
48 copy-handle val, dest-addr2
49 var dest-addr3/eax: (addr int) <- get dest-addr, type
50
51
52
53
54
55
56 copy-to *dest-addr3, 1/string
57 increment *top-addr
58 }
59
60 fn push-array-to-value-stack _self: (addr value-stack), val: (handle array value) {
61 var self/esi: (addr value-stack) <- copy _self
62 var top-addr/ecx: (addr int) <-RATIO = ( 3, 3, 12, 9 )
from ranger import log
from ranger.gui.ui import UI
class DefaultUI(UI):
def setup(self):
"""Build up the UI by initializing widgets."""
from ranger.gui.widgets.filelistcontainer import FileListContainer
from ranger.gui.widgets.titlebar import TitleBar
from ranger.gui.widgets.console import Console
from ranger.gui.widgets.statusbar import StatusBar
from ranger.gui.widgets.process_manager import ProcessManager
from ranger.gui.widgets.notify import Notify
from ranger.gui.widgets.pager import Pager
self.titlebar = TitleBar(self.win)
self.add_obj(self.titlebar)
self.filelist_container = FileListContainer(self.win, RATIO)
self.add_obj(self.filelist_container)
self.main_filelist = self.filelist_container.main_filelist
self.status = StatusBar(self.win, self.main_filelist)
self.add_obj(self.status)
self.console = Console(self.win)
self.add_obj(self.console)
self.console.visible = False
self.pman = ProcessManager(self.win)
self.pman.visible = False
self.add_obj(self.pman)
self.notify = Notify(self.win)
self.add_obj(self.notify)
self.pager = Pager(self.win)
self.add_obj(self.pager)
def update_size(self):
"""resize all widgets"""
UI.update_size(self)
y, x = self.env.termsize
notify_hei = self.notify.requested_height
self.filelist_container.resize(1, 0, y - 2 - notify_hei, x)
self.pman.resize(1, 0, y - 2 - notify_hei, x)
self.pager.resize(1, 0, y - 2 - notify_hei, x)
self.notify.resize(y - 1 - notify_hei, 0, notify_hei, x)
self.titlebar.resize(0, 0, 1, x)
self.status.resize(y - 1, 0, 1, x)
self.console.resize(y - 1, 0, 1, x)
def poke(self):
UI.poke(self)
if self.notify.requested_height != self.notify.hei:
self.update_size()
def display(self, *a, **k):
return self.notify.display(*a, **k)
def close_pager(self):
self.pager.visible = False
self.pager.focused = False
self.filelist_container.visible = True
def open_pager(self):
self.pager.visible = True
self.pager.focused = True
self.filelist_container.visible = False
def open_embedded_pager(self):
self.filelist_container.open_pager()
return self.filelist_container.pager
def close_embedded_pager(self):
self.filelist_container.close_pager()
def open_console(self,