https://github.com/akkartik/mu/blob/master/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) -> result/eax: boolean
31 sig new-segment len: int, ad: (addr allocation-descriptor)
32 sig string-equal? s: (addr array byte), benchmark: (addr array byte) -> result/eax: boolean
33 sig string-starts-with? s: (addr array byte), benchmark: (addr array byte) -> result/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) -> result/eax: boolean
42 sig next-line-matches? t: (addr stream byte), line: (addr array byte) -> result/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) -> result/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) -> result/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) -> byte-or-Eof/eax: byte
54 sig read-byte s: (addr stream byte) -> result/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)
61
62 sig append-byte-hex f: (addr stream byte), n: int
63 sig write-byte-hex-buffered f: (addr buffered-file), n: int
64 sig write-int32-hex f: (addr stream byte), n: int
65 sig write-int32-hex-bits f: (addr stream byte), n: int, bits: int
66 sig write-int32-hex-buffered f: (addr buffered-file), n: int
67 sig write-int32-hex-bits-buffered f: (addr buffered-file), n: int, bits: int
68 sig is-hex-int? in: (addr slice) -> result/eax: boolean
69 sig parse-hex-int in: (addr array byte) -> result/eax: int
70 sig parse-hex-int-from-slice in: (addr slice) -> result/eax: int
71
72 sig is-hex-digit? c: byte -> result/eax: boolean
73
74 sig parse-decimal-int in: (addr array byte) -> result/eax: int
75 sig parse-decimal-int-from-slice in: (addr slice) -> result/eax: int
76 sig parse-decimal-int-from-stream in: (addr stream byte) -> result/eax: int
77
78 sig decimal-size n: int -> result/eax: int
79 sig error-byte ed: (addr exit-descriptor), out: (addr buffered-file), msg: (addr array byte), n: byte
80
81
82 sig lookup h: (handle _T) -> result/eax: (addr _T)
83 sig handle-equal? a: (handle _T), b: (handle _T) -> result/eax: boolean
84 sig copy-handle src: (handle _T), dest: (addr handle _T)
85
86
87 sig copy-array ad: (addr allocation-descriptor), src: (addr array _T), out: (addr handle array _T)
88
89
90 sig read-line-buffered f: (addr buffered-file), s: (addr stream byte)
91 sig read-line f: (addr stream byte), s: (addr stream byte)
92 sig slice-empty? s: (addr slice) -> result/eax: boolean
93 sig slice-equal? s: (addr slice), p: (addr array byte) -> result/eax: boolean
94 sig slice-starts-with? s: (addr slice), head: (addr array byte) -> result/eax: boolean
95 sig write-slice out: (addr stream byte), s: (addr slice)
96 sig write-slice-buffered out: (addr buffered-file), s: (addr slice)
97 sig slice-to-string ad: (addr allocation-descriptor), in: (addr slice), out: (addr handle array byte)
98 sig next-token in: (addr stream byte), delimiter: byte, out: (addr slice)
99 sig next-token-from-slice start: (addr byte), end: (addr byte), delimiter: byte, out: (addr slice)
100 sig skip-chars-matching in: (addr stream byte), delimiter: byte
101 sig skip-chars-matching-whitespace in: (addr stream byte)
102 sig skip-chars-not-matching in: (addr stream byte), delimiter: byte
103 sig skip-chars-not-matching-whitespace in: (addr stream byte)
104
105
106
107
108 sig skip-string line: (addr stream byte)
109
110 sig skip-until-close-paren line: (addr stream byte)
111
112 sig write-stream-data f: (addr buffered-file), s: (addr stream byte)
113 sig write-int32-decimal out: (addr stream byte), n: int
114 sig is-decimal-digit? c: grapheme -> result/eax: boolean
115 sig to-decimal-digit in: grapheme -> out/eax: int
116 sig next-word line: (addr stream byte), out: (addr slice)
117 sig has-metadata? word: (addr slice), s: (addr string) -> result/eax: boolean
118 sig is-valid-name? in: (addr slice) -> result/eax: boolean
119 sig is-label? word: (addr slice) -> result/eax: boolean
120 sig emit-hex out: (addr buffered-file), n: int, width: int
121 sig emit out: (addr buffered-file), word: (addr slice), width: int
122
123
124
125
126
127
128
129
130
131 sig slurp f: (addr buffered-file), s: (addr stream byte)
132 sig compute-width word: (addr array byte) -> result/eax: int
133 sig compute-width-of-slice s: (addr slice) -> result/eax: int
134 sig emit-hex-array out: (addr buffered-file), arr: (addr array byte)
135 sig next-word-or-string line: (addr stream byte), out: (addr slice)
136 sig write-int out: (addr stream byte), n: int
137
138
139
140
141 sig array-equal? a: (addr array int), b: (addr array int) -> result/eax: boolean
142 sig parse-array-of-ints s: (addr array byte), out: (addr handle array int)
143 sig parse-array-of-decimal-ints s: (addr array byte), out: (addr handle array int)
144 sig check-array-equal a: (addr array int), expected: (addr string), msg: (addr string)
145
146 sig kernel-string-to-string ad: (addr allocation-descriptor), in: (addr kernel-string), out: (addr handle array byte)
147 sig kernel-string-length in: (addr kernel-string) -> result/eax: int
148 sig enable-screen-grid-mode
149 sig enable-screen-type-mode
150 sig real-screen-size -> nrows/eax: int, ncols/ecx: int
151 sig clear-real-screen
152 sig move-cursor-on-real-screen row: int, column: int
153 sig print-string-to-real-screen s: (addr array byte)
154 sig print-slice-to-real-screen s: (addr slice)
155 sig print-stream-to-real-screen s: (addr stream byte)
156 sig print-grapheme-to-real-screen c: grapheme
157 sig print-int32-hex-to-real-screen n: int
158 sig print-int32-hex-bits-to-real-screen n: int, bits: int
159 sig print-int32-decimal-to-real-screen n: int
160 sig write-int32-decimal-buffered f: (addr buffered-file), n: int
161 sig reset-formatting-on-real-screen
162 sig start-color-on-real-screen fg: int, bg: int
163 sig start-bold-on-real-screen
164 sig start-underline-on-real-screen
165 sig start-reverse-video-on-real-screen
166 sig start-blinking-on-real-screen
167 sig hide-cursor-on-real-screen
168 sig show-cursor-on-real-screen
169 sig enable-keyboard-immediate-mode
170 sig enable-keyboard-type-mode
171 sig read-key-from-real-keyboard -> result/eax: grapheme
172 sig read-line-from-real-keyboard out: (addr stream byte)
173 sig open filename: (addr array byte), write?: boolean, out: (addr handle buffered-file)
174 sig populate-buffered-file-containing contents: (addr array byte), out: (addr handle buffered-file)
175 sig new-buffered-file out: (addr handle buffered-file)
176
177
178 sig stream-empty? s: (addr stream _) -> result/eax: boolean
179 sig stream-full? s: (addr stream _) -> result/eax: boolean
180 sig stream-to-array in: (addr stream _), out: (addr handle array _)
181 sig unquote-stream-to-array in: (addr stream _), out: (addr handle array _)
182 sig stream-first s: (addr stream byte) -> result/eax: byte
183 sig stream-final s: (addr stream byte) -> result/eax: byte
184
185