https://github.com/akkartik/mu/blob/main/linux/400.mu
1
2
3
4
5
6 sig run-tests
7
8
9
10
11 sig syscall_exit
12 sig syscall_read
13 sig syscall_write
14 sig syscall_open
15 sig syscall_close
16 sig syscall_creat
17 sig syscall_unlink
18 sig syscall_rename
19 sig syscall_mmap
20 sig syscall_ioctl
21 sig syscall_nanosleep
22 sig syscall_clock_gettime
23
24
25
26
27
28
29 sig check-ints-equal a: int, b: int, msg: (addr array byte)
30 sig kernel-string-equal? s: (addr kernel-string), benchmark: (addr array byte) -> _/eax: boolean
31 sig new-segment len: int, ad: (addr allocation-descriptor)
32 sig string-equal? s: (addr array byte), benchmark: (addr array byte) -> _/eax: boolean
33 sig string-starts-with? s: (addr array byte), benchmark: (addr array byte) -> _/eax: boolean
34 sig check-strings-equal s: (addr array byte), expected: (addr array byte), msg: (addr array byte)
35 sig clear-stream f: (addr stream _)
36 sig rewind-stream f: (addr stream _)
37 sig initialize-trace-stream n: int
38 sig trace line: (addr array byte)
39 sig check-trace-contains line: (addr string), msg: (addr string)
40 sig check-trace-scans-to line: (addr string), msg: (addr string)
41 sig trace-scan line: (addr array byte) -> _/eax: boolean
42 sig next-line-matches? t: (addr stream byte), line: (addr array byte) -> _/eax: boolean
43 sig skip-next-line t: (addr stream byte)
44 sig clear-trace-stream
45 sig write f: (addr stream byte), s: (addr array byte)
46 sig stream-data-equal? f: (addr stream byte), s: (addr array byte) -> _/eax: boolean
47 sig check-stream-equal f: (addr stream byte), s: (addr array byte), msg: (addr array byte)
48 sig next-stream-line-equal? f: (addr stream byte), s: (addr array byte) -> _/eax: boolean
49 sig check-next-stream-line-equal f: (addr stream byte), s: (addr array byte), msg: (addr array byte)
50 sig tailor-exit-descriptor ed: (addr exit-descriptor), nbytes: int
51 sig stop ed: (addr exit-descriptor), value: int
52
53 sig read-byte-buffered f: (addr buffered-file) -> _/eax: byte
54 sig read-byte s: (addr stream byte) -> _/eax: byte
55
56
57 sig write-byte-buffered f: (addr buffered-file), n: int
58 sig flush f: (addr buffered-file)
59 sig append-byte f: (addr stream byte), n: int
60 sig write-buffered f: (addr buffered-file), msg: (addr array byte)
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - linux/tui.mu</title>
<meta name="Generator" content="Vim/8.1">
<meta name="plugin-version" content="vim8.1_v1">
<meta name="syntax" content="none">
<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
<meta name="colorscheme" content="minimal-dark">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #a8a8a8; }
body { font-size:12pt; font-family: monospace; color: #000000; background-color: #a8a8a8; }
a { color:inherit; }
* { font-size:12pt; font-size: 1em; }
.PreProc { color: #c000c0; }
.Special { color: #ff6060; }
.LineNr { }
.Delimiter { color: #c000c0; }
.Constant { color: #008787; }
.muFunction { color: #af5f00; text-decoration: underline; }
.muComment { color: #005faf; }
-->
</style>
<script type='text/javascript'>
<!--
/* function to open any folds containing a jumped-to line before jumping to it */
function JumpToLine()
{
var lineNum;
lineNum = window.location.hash;
lineNum = lineNum.substr(1); /* strip off '#' */
if (lineNum.indexOf('L') == -1) {
lineNum = 'L'+lineNum;
}
var lineElem = document.getElementById(lineNum);
/* Always jump to new location even if the line was hidden inside a fold, or
* we corrected the raw number to a line ID.
*/
if (lineElem) {
lineElem.scrollIntoView(true);
}
return true;
}
if ('onhashchange' in window) {
window.onhashchange = JumpToLine;
}
-->
</script>
</head>
<body onload='JumpToLine();'>
<a href='https://github.com/akkartik/mu/blob/main/linux/tui.mu'>https://github.com/akkartik/mu/blob/main/linux/tui.mu</a>
<pre id='vimCodeElement'>
<span id="L1" class="LineNr"> 1 </span><span class="muComment"># Test some primitives for text-mode.</span>
<span id="L2" class="LineNr"> 2 </span><span class="muComment">#</span>
<span id="L3" class="LineNr"> 3 </span><span class="muComment"># To run:</span>
<span id="L4" class="LineNr"> 4 </span><span class="muComment"># $ ./translate tui.mu</span>
<span id="L5" class="LineNr"> 5 </span><span class="muComment"># $ ./a.elf</span>
<span id="L6" class="LineNr"> 6 </span>
<span id="L7" class="LineNr"> 7 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='tui.mu.html#L7'>main</a></span><span class="PreProc"> -> </span>_/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L8" class="LineNr"> 8 </span> <span class="PreProc">var</span> nrows/<span class="Constant">eax</span>: int <span class="Special"><-</span> copy <span class="Constant">0</span>
<span id="L9" class="LineNr"> 9 </span> <span class="PreProc">var</span> ncols/<span class="Constant">ecx</span>: int <span class="Special"><-</span> copy <span class="Constant">0</span>
<span id="L10" class="LineNr">10 </span> nrows, ncols <span class="Special"><-</span> <a href='405screen.mu.html#L60'>screen-size</a> <span class="Constant">0</span>
<span id="L11" class="LineNr">11 </span> <a href='304screen.subx.html#L6'>enable-screen-grid-mode</a>
<span id="L12" class="LineNr">12 </span> <a href='405screen.mu.html#L109'>move-cursor</a> <span class="Constant">0</span>/screen, <span class="Constant">5</span>/row, <span class="Constant">0x22</span>/col
<span id="L13" class="LineNr">13 </span> <a href='405screen.mu.html#L523'>start-color</a> <span class="Constant">0</span>/screen, <span class="Constant">1</span>/fg, <span class="Constant&quo