This commit is contained in:
Kartik Agaram 2020-07-11 00:02:29 -07:00
parent ec73ed1230
commit 1c349ac7c5
17 changed files with 341 additions and 22 deletions

218
html/400.mu.html generated Normal file
View File

@ -0,0 +1,218 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - 400.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-light">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #c6c6c6; }
body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; }
a { color:inherit; }
* { font-size:12pt; font-size: 1em; }
.LineNr { }
.Comment { color: #005faf; }
.Constant { color: #008787; }
.PreProc { color: #c000c0; }
-->
</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/master/400.mu'>https://github.com/akkartik/mu/blob/master/400.mu</a>
<pre id='vimCodeElement'>
<span id="L1" class="LineNr"> 1 </span><span class="Comment"># The 4xx series is for primitives implemented in Mu.</span>
<span id="L2" class="LineNr"> 2 </span>
<span id="L3" class="LineNr"> 3 </span><span class="Comment"># Signatures for major SubX functions defined so far.</span>
<span id="L4" class="LineNr"> 4 </span>
<span id="L5" class="LineNr"> 5 </span><span class="Comment"># autogenerated</span>
<span id="L6" class="LineNr"> 6 </span><span class="PreProc">sig</span> run-tests
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="Comment"># init.linux</span>
<span id="L9" class="LineNr"> 9 </span><span class="Comment"># TODO: make this OS-specific</span>
<span id="L10" class="LineNr"> 10 </span><span class="Comment"># TODO: include result type at least, even if register args are too much</span>
<span id="L11" class="LineNr"> 11 </span><span class="PreProc">sig</span> syscall_exit <span class="Comment"># status/ebx: int</span>
<span id="L12" class="LineNr"> 12 </span><span class="PreProc">sig</span> syscall_read <span class="Comment"># fd/ebx: int, buf/ecx: addr, size/edx: int -&gt; nbytes-or-error/eax: int</span>
<span id="L13" class="LineNr"> 13 </span><span class="PreProc">sig</span> syscall_write <span class="Comment"># fd/ebx: int, buf/ecx: addr, size/edx: int -&gt; nbytes-or-error/eax: int</span>
<span id="L14" class="LineNr"> 14 </span><span class="PreProc">sig</span> syscall_open <span class="Comment"># filename/ebx: (addr kernel-string), flags/ecx: int, dummy=0x180/edx -&gt; fd-or-error/eax: int</span>
<span id="L15" class="LineNr"> 15 </span><span class="PreProc">sig</span> syscall_close <span class="Comment"># fd/ebx: int -&gt; status/eax</span>
<span id="L16" class="LineNr"> 16 </span><span class="PreProc">sig</span> syscall_creat <span class="Comment"># filename/ebx: (addr kernel-string) -&gt; fd-or-error/eax: int</span>
<span id="L17" class="LineNr"> 17 </span><span class="PreProc">sig</span> syscall_unlink <span class="Comment"># filename/ebx: (addr kernel-string) -&gt; status/eax: int</span>
<span id="L18" class="LineNr"> 18 </span><span class="PreProc">sig</span> syscall_rename <span class="Comment"># source/ebx: (addr kernel-string), dest/ecx: (addr kernel-string) -&gt; status/eax: int</span>
<span id="L19" class="LineNr"> 19 </span><span class="PreProc">sig</span> syscall_mmap <span class="Comment"># arg/ebx: (addr mmap_arg_struct) -&gt; status/eax: int</span>
<span id="L20" class="LineNr"> 20 </span><span class="PreProc">sig</span> syscall_ioctl <span class="Comment"># fd/ebx: int, cmd/ecx: int, arg/edx: (addr _)</span>
<span id="L21" class="LineNr"> 21 </span><span class="PreProc">sig</span> syscall_nanosleep <span class="Comment"># req/ebx: (addr timespec)</span>
<span id="L22" class="LineNr"> 22 </span><span class="PreProc">sig</span> syscall_clock_gettime <span class="Comment"># clock/ebx: int, out/ecx: (addr timespec)</span>
<span id="L23" class="LineNr"> 23 </span>
<span id="L24" class="LineNr"> 24 </span><span class="Comment"># Generated using:</span>
<span id="L25" class="LineNr"> 25 </span><span class="Comment"># grep -h '^[a-z]' [0-9]*.subx |grep -v '^test-'</span>
<span id="L26" class="LineNr"> 26 </span><span class="Comment"># Functions we don't want to make accessible from Mu are commented out.</span>
<span id="L27" class="LineNr"> 27 </span><span class="Comment"># Many functions here may not be usable yet because of missing features</span>
<span id="L28" class="LineNr"> 28 </span><span class="Comment"># (global variable support, type definitions for stuff like `stream`)</span>
<span id="L29" class="LineNr"> 29 </span><span class="PreProc">sig</span> <a href='102test.subx.html#L23'>check-ints-equal</a> a: int, b: int, msg: (addr array byte)
<span id="L30" class="LineNr"> 30 </span><span class="PreProc">sig</span> <a href='103kernel-string-equal.subx.html#L31'>kernel-string-equal?</a> s: (addr kernel-string), benchmark: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L31" class="LineNr"> 31 </span><span class="PreProc">sig</span> <a href='104new-segment.subx.html#L40'>new-segment</a> len: int, ad: (addr allocation-descriptor)
<span id="L32" class="LineNr"> 32 </span><span class="PreProc">sig</span> <a href='105string-equal.subx.html#L15'>string-equal?</a> s: (addr array byte), benchmark: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L33" class="LineNr"> 33 </span><span class="PreProc">sig</span> <a href='105string-equal.subx.html#L57'>string-starts-with?</a> s: (addr array byte), benchmark: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L34" class="LineNr"> 34 </span><span class="PreProc">sig</span> <a href='105string-equal.subx.html#L220'>check-strings-equal</a> s: (addr array byte), expected: (addr array byte), msg: (addr array byte)
<span id="L35" class="LineNr"> 35 </span><span class="PreProc">sig</span> <a href='106stream.subx.html#L17'>clear-stream</a> f: (addr stream byte)
<span id="L36" class="LineNr"> 36 </span><span class="PreProc">sig</span> <a href='106stream.subx.html#L56'>rewind-stream</a> f: (addr stream byte)
<span id="L37" class="LineNr"> 37 </span><span class="PreProc">sig</span> <a href='107trace.subx.html#L48'>initialize-trace-stream</a> n: int
<span id="L38" class="LineNr"> 38 </span><span class="PreProc">sig</span> <a href='107trace.subx.html#L86'>trace</a> line: (addr array byte)
<span id="L39" class="LineNr"> 39 </span><span class="PreProc">sig</span> <a href='107trace.subx.html#L253'>check-trace-contains</a> line: (addr string), msg: (addr string)
<span id="L40" class="LineNr"> 40 </span><span class="PreProc">sig</span> <a href='107trace.subx.html#L278'>check-trace-scans-to</a> line: (addr string), msg: (addr string)
<span id="L41" class="LineNr"> 41 </span><span class="PreProc">sig</span> <a href='107trace.subx.html#L309'>trace-scan</a> line: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L42" class="LineNr"> 42 </span><span class="PreProc">sig</span> <a href='107trace.subx.html#L561'>next-line-matches?</a> t: (addr stream byte), line: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L43" class="LineNr"> 43 </span><span class="PreProc">sig</span> <a href='107trace.subx.html#L737'>skip-next-line</a> t: (addr stream byte)
<span id="L44" class="LineNr"> 44 </span><span class="PreProc">sig</span> <a href='107trace.subx.html#L845'>clear-trace-stream</a>
<span id="L45" class="LineNr"> 45 </span><span class="Comment">#sig write f: fd or (addr stream byte), s: (addr array byte)</span>
<span id="L46" class="LineNr"> 46 </span><span class="PreProc">sig</span> <a href='109stream-equal.subx.html#L9'>stream-data-equal?</a> f: (addr stream byte), s: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L47" class="LineNr"> 47 </span><span class="PreProc">sig</span> <a href='109stream-equal.subx.html#L194'>check-stream-equal</a> f: (addr stream byte), s: (addr array byte), msg: (addr array byte)
<span id="L48" class="LineNr"> 48 </span><span class="PreProc">sig</span> <a href='109stream-equal.subx.html#L230'>next-stream-line-equal?</a> f: (addr stream byte), s: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L49" class="LineNr"> 49 </span><span class="PreProc">sig</span> <a href='109stream-equal.subx.html#L565'>check-next-stream-line-equal</a>
<span id="L50" class="LineNr"> 50 </span><span class="PreProc">sig</span> <a href='110stop.subx.html#L44'>tailor-exit-descriptor</a> ed: (addr exit-descriptor), nbytes: int
<span id="L51" class="LineNr"> 51 </span><span class="PreProc">sig</span> <a href='110stop.subx.html#L92'>stop</a> ed: (addr exit-descriptor), value: int
<span id="L52" class="LineNr"> 52 </span><span class="Comment">#sig read f: fd or (addr stream byte), s: (addr stream byte) -&gt; num-bytes-read/eax: int</span>
<span id="L53" class="LineNr"> 53 </span><span class="PreProc">sig</span> <a href='112read-byte.subx.html#L38'>read-byte-buffered</a> f: (addr buffered-file)<span class="PreProc"> -&gt; </span>byte-or-Eof/<span class="Constant">eax</span>: int
<span id="L54" class="LineNr"> 54 </span><span class="Comment">#sig write-stream f: fd or (addr stream byte), s: (addr stream byte)</span>
<span id="L55" class="LineNr"> 55 </span><span class="Comment">#sig error ed: (addr exit-descriptor), out: fd or (addr stream byte), msg: (addr array byte)</span>
<span id="L56" class="LineNr"> 56 </span><span class="PreProc">sig</span> <a href='115write-byte.subx.html#L33'>write-byte-buffered</a> f: (addr buffered-file), n: int
<span id="L57" class="LineNr"> 57 </span><span class="PreProc">sig</span> <a href='115write-byte.subx.html#L81'>flush</a> f: (addr buffered-file)
<span id="L58" class="LineNr"> 58 </span><span class="PreProc">sig</span> <a href='115write-byte.subx.html#L208'>append-byte</a> f: (addr stream byte), n: int
<span id="L59" class="LineNr"> 59 </span><span class="PreProc">sig</span> <a href='116write-buffered.subx.html#L8'>write-buffered</a> f: (addr buffered-file), msg: (addr array byte)
<span id="L60" class="LineNr"> 60 </span><span class="Comment">#sig to-hex-char in/eax: int -&gt; out/eax: int</span>
<span id="L61" class="LineNr"> 61 </span><span class="PreProc">sig</span> <a href='117write-int-hex.subx.html#L21'>append-byte-hex</a> f: (addr stream byte), n: int
<span id="L62" class="LineNr"> 62 </span><span class="PreProc">sig</span> <a href='117write-int-hex.subx.html#L93'>write-byte-hex-buffered</a> f: (addr buffered-file), n: int
<span id="L63" class="LineNr"> 63 </span><span class="PreProc">sig</span> <a href='117write-int-hex.subx.html#L178'>write-int32-hex</a> f: (addr stream byte), n: int
<span id="L64" class="LineNr"> 64 </span><span class="PreProc">sig</span> <a href='117write-int-hex.subx.html#L266'>write-int32-hex-buffered</a> f: (addr buffered-file), n: int
<span id="L65" class="LineNr"> 65 </span><span class="PreProc">sig</span> <a href='118parse-hex.subx.html#L9'>is-hex-int?</a> in: (addr slice)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L66" class="LineNr"> 66 </span><span class="PreProc">sig</span> <a href='118parse-hex.subx.html#L354'>parse-hex-int</a> in: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: int
<span id="L67" class="LineNr"> 67 </span><span class="PreProc">sig</span> <a href='118parse-hex.subx.html#L387'>parse-hex-int-from-slice</a> in: (addr slice)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: int
<span id="L68" class="LineNr"> 68 </span><span class="Comment">#sig parse-hex-int-helper start: (addr byte), end: (addr byte) -&gt; result/eax: int</span>
<span id="L69" class="LineNr"> 69 </span><span class="PreProc">sig</span> <a href='118parse-hex.subx.html#L701'>is-hex-digit?</a> c: byte<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L70" class="LineNr"> 70 </span><span class="Comment">#sig from-hex-char in/eax: byte -&gt; out/eax: nibble</span>
<span id="L71" class="LineNr"> 71 </span><span class="PreProc">sig</span> <a href='119error-byte.subx.html#L26'>error-byte</a> ed: (addr exit-descriptor), out: (addr buffered-file), msg: (addr array byte), n: byte
<span id="L72" class="LineNr"> 72 </span><span class="Comment">#sig allocate ad: (addr allocation-descriptor), n: int, out: (addr handle)</span>
<span id="L73" class="LineNr"> 73 </span><span class="Comment">#sig allocate-raw ad: (addr allocation-descriptor), n: int, out: (addr handle)</span>
<span id="L74" class="LineNr"> 74 </span><span class="PreProc">sig</span> <a href='120allocate.subx.html#L256'>lookup</a> h: (handle T)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: (addr T)
<span id="L75" class="LineNr"> 75 </span><span class="PreProc">sig</span> <a href='120allocate.subx.html#L458'>handle-equal?</a> a: handle, b: handle<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L76" class="LineNr"> 76 </span><span class="PreProc">sig</span> <a href='120allocate.subx.html#L489'>copy-handle</a> src: handle, dest: (addr handle)
<span id="L77" class="LineNr"> 77 </span><span class="PreProc">sig</span> <a href='120allocate.subx.html#L513'>allocate-region</a> ad: (addr allocation-descriptor), n: int, out: (addr handle allocation-descriptor)
<span id="L78" class="LineNr"> 78 </span><span class="PreProc">sig</span> <a href='120allocate.subx.html#L576'>allocate-array</a> ad: (addr allocation-descriptor), n: int, out: (addr handle)
<span id="L79" class="LineNr"> 79 </span><span class="PreProc">sig</span> <a href='120allocate.subx.html#L710'>copy-array</a> ad: (addr allocation-descriptor), src: (addr array), out: (addr handle)
<span id="L80" class="LineNr"> 80 </span><span class="PreProc">sig</span> <a href='120allocate.subx.html#L877'>zero-out</a> start: (addr byte), len: int
<span id="L81" class="LineNr"> 81 </span><span class="PreProc">sig</span> <a href='121new-stream.subx.html#L8'>new-stream</a> ad: (addr allocation-descriptor), length: int, elemsize: int, out: (addr handle stream _)
<span id="L82" class="LineNr"> 82 </span><span class="PreProc">sig</span> <a href='122read-line.subx.html#L9'>read-line-buffered</a> f: (addr buffered-file), s: (addr stream byte)
<span id="L83" class="LineNr"> 83 </span><span class="PreProc">sig</span> <a href='122read-line.subx.html#L218'>read-line</a> f: (addr stream byte), s: (addr stream byte)
<span id="L84" class="LineNr"> 84 </span><span class="PreProc">sig</span> <a href='123slice.subx.html#L9'>slice-empty?</a> s: (addr slice)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L85" class="LineNr"> 85 </span><span class="PreProc">sig</span> <a href='123slice.subx.html#L120'>slice-equal?</a> s: (addr slice), p: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L86" class="LineNr"> 86 </span><span class="PreProc">sig</span> <a href='123slice.subx.html#L487'>slice-starts-with?</a> s: (addr slice), head: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L87" class="LineNr"> 87 </span><span class="PreProc">sig</span> <a href='123slice.subx.html#L793'>write-slice</a> out: (addr stream byte), s: (addr slice)
<span id="L88" class="LineNr"> 88 </span><span class="PreProc">sig</span> <a href='123slice.subx.html#L908'>write-slice-buffered</a> out: (addr buffered-file), s: (addr slice)
<span id="L89" class="LineNr"> 89 </span><span class="PreProc">sig</span> <a href='123slice.subx.html#L1043'>slice-to-string</a> ad: (addr allocation-descriptor), in: (addr slice), out: (addr handle array byte)
<span id="L90" class="LineNr"> 90 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L10'>next-token</a> in: (addr stream byte), delimiter: byte, out: (addr slice)
<span id="L91" class="LineNr"> 91 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L163'>next-token-from-slice</a> start: (addr byte), end: (addr byte), delimiter: byte, out: (addr slice)
<span id="L92" class="LineNr"> 92 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L341'>skip-chars-matching</a> in: (addr stream byte), delimiter: byte
<span id="L93" class="LineNr"> 93 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L464'>skip-chars-matching-whitespace</a> in: (addr stream byte)
<span id="L94" class="LineNr"> 94 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L554'>skip-chars-not-matching</a> in: (addr stream byte), delimiter: byte
<span id="L95" class="LineNr"> 95 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L716'>skip-chars-not-matching-whitespace</a> in: (addr stream byte)
<span id="L96" class="LineNr"> 96 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L804'>skip-chars-matching-in-slice</a> curr: (addr byte), end: (addr byte), delimiter: byte<span class="PreProc"> -&gt; </span>curr/<span class="Constant">eax</span>: (addr byte)
<span id="L97" class="LineNr"> 97 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L900'>skip-chars-matching-whitespace-in-slice</a> curr: (addr byte), end: (addr byte)<span class="PreProc"> -&gt; </span>curr/<span class="Constant">eax</span>: (addr byte)
<span id="L98" class="LineNr"> 98 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L973'>skip-chars-not-matching-in-slice</a> curr: (addr byte), end: (addr byte), delimiter: byte<span class="PreProc"> -&gt; </span>curr/<span class="Constant">eax</span>: (addr byte)
<span id="L99" class="LineNr"> 99 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L1098'>skip-chars-not-matching-whitespace-in-slice</a> curr: (addr byte), end: (addr byte)<span class="PreProc"> -&gt; </span>curr/<span class="Constant">eax</span>: (addr byte)
<span id="L100" class="LineNr">100 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L1171'>skip-string</a> line: (addr stream byte)
<span id="L101" class="LineNr">101 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L1413'>skip-string-in-slice</a> curr: (addr byte), end: (addr byte)<span class="PreProc"> -&gt; </span>new_curr/<span class="Constant">eax</span>: (addr byte)
<span id="L102" class="LineNr">102 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L1599'>skip-until-close-paren</a> line: (addr stream byte)
<span id="L103" class="LineNr">103 </span><span class="PreProc">sig</span> <a href='124next-token.subx.html#L1786'>skip-until-close-paren-in-slice</a> curr: (addr byte), end: (addr byte)<span class="PreProc"> -&gt; </span>new_curr/<span class="Constant">eax</span>: (addr byte)
<span id="L104" class="LineNr">104 </span><span class="PreProc">sig</span> <a href='125write-stream-data.subx.html#L11'>write-stream-data</a> f: (addr buffered-file), s: (addr stream byte)
<span id="L105" class="LineNr">105 </span><span class="PreProc">sig</span> <a href='126write-int-decimal.subx.html#L8'>write-int32-decimal</a> out: (addr stream byte), n: int32
<span id="L106" class="LineNr">106 </span><span class="PreProc">sig</span> <a href='126write-int-decimal.subx.html#L306'>is-decimal-digit?</a> c: byte<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L107" class="LineNr">107 </span><span class="PreProc">sig</span> <a href='126write-int-decimal.subx.html#L405'>to-decimal-digit</a> in: byte<span class="PreProc"> -&gt; </span>out/<span class="Constant">eax</span>: int
<span id="L108" class="LineNr">108 </span><span class="PreProc">sig</span> <a href='127next-word.subx.html#L10'>next-word</a> line: (addr stream byte), out: (addr slice)
<span id="L109" class="LineNr">109 </span><span class="PreProc">sig</span> <a href='128subx-words.subx.html#L8'>has-metadata?</a> word: (addr slice), s: (addr string)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L110" class="LineNr">110 </span><span class="PreProc">sig</span> <a href='128subx-words.subx.html#L278'>is-valid-name?</a> in: (addr slice)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L111" class="LineNr">111 </span><span class="PreProc">sig</span> <a href='128subx-words.subx.html#L535'>is-label?</a> word: (addr slice)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L112" class="LineNr">112 </span><span class="PreProc">sig</span> <a href='129emit-hex.subx.html#L7'>emit-hex</a> out: (addr buffered-file), n: int, width: int
<span id="L113" class="LineNr">113 </span><span class="PreProc">sig</span> <a href='130emit.subx.html#L10'>emit</a> out: (addr buffered-file), word: (addr slice), width: int
<span id="L114" class="LineNr">114 </span><span class="Comment">#sig get table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, abort-message-prefix: (addr array byte) -&gt; result/eax: (addr T)</span>
<span id="L115" class="LineNr">115 </span><span class="Comment">#sig get-slice table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, abort-message-prefix: (addr array byte) -&gt; result/eax: (addr T)</span>
<span id="L116" class="LineNr">116 </span><span class="Comment">#sig get-or-insert table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, ad: (addr allocation-descriptor) -&gt; result/eax: (addr T)</span>
<span id="L117" class="LineNr">117 </span><span class="Comment">#sig get-or-insert-handle table: (addr stream {(handle array byte), T}), key: (handle array byte), row-size: int -&gt; result/eax: (addr T)</span>
<span id="L118" class="LineNr">118 </span><span class="Comment">#sig get-or-insert-slice table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, ad: (addr allocation-descriptor) -&gt; result/eax: (addr T)</span>
<span id="L119" class="LineNr">119 </span><span class="Comment">#sig get-or-stop table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int,</span>
<span id="L120" class="LineNr">120 </span><span class="Comment">#sig get-slice-or-stop table: (addr stream {(handle array byte), _}), key: (addr slice), row-size: int,</span>
<span id="L121" class="LineNr">121 </span><span class="Comment">#sig maybe-get table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int -&gt; result/eax: (addr T)</span>
<span id="L122" class="LineNr">122 </span><span class="Comment">#sig maybe-get-slice table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int -&gt; result/eax: (addr T)</span>
<span id="L123" class="LineNr">123 </span><span class="PreProc">sig</span> <a href='132slurp.subx.html#L8'>slurp</a> f: (addr buffered-file), s: (addr stream byte)
<span id="L124" class="LineNr">124 </span><span class="PreProc">sig</span> <a href='133subx-widths.subx.html#L11'>compute-width</a> word: (addr array byte)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: int
<span id="L125" class="LineNr">125 </span><span class="PreProc">sig</span> <a href='133subx-widths.subx.html#L45'>compute-width-of-slice</a> s: (addr slice)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: int
<span id="L126" class="LineNr">126 </span><span class="PreProc">sig</span> <a href='134emit-hex-array.subx.html#L7'>emit-hex-array</a> out: (addr buffered-file), arr: (addr array byte)
<span id="L127" class="LineNr">127 </span><span class="PreProc">sig</span> <a href='135next-word-or-string.subx.html#L8'>next-word-or-string</a> line: (addr stream byte), out: (addr slice)
<span id="L128" class="LineNr">128 </span><span class="PreProc">sig</span> <a href='202write-int.subx.html#L8'>write-int</a> out: (addr stream byte), n: int
<span id="L129" class="LineNr">129 </span><span class="PreProc">sig</span> <a href='203stack.subx.html#L13'>clear-stack</a> s: (addr stack)
<span id="L130" class="LineNr">130 </span><span class="PreProc">sig</span> <a href='203stack.subx.html#L114'>push</a> s: (addr stack), n: int
<span id="L131" class="LineNr">131 </span><span class="PreProc">sig</span> <a href='203stack.subx.html#L234'>pop</a> s: (addr stack)<span class="PreProc"> -&gt; </span>n/<span class="Constant">eax</span>: int
<span id="L132" class="LineNr">132 </span><span class="PreProc">sig</span> <a href='203stack.subx.html#L338'>top</a> s: (addr stack)<span class="PreProc"> -&gt; </span>n/<span class="Constant">eax</span>: int
<span id="L133" class="LineNr">133 </span><span class="PreProc">sig</span> <a href='301array-equal.subx.html#L5'>array-equal?</a> a: (addr array int), b: (addr array int)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: boolean
<span id="L134" class="LineNr">134 </span><span class="PreProc">sig</span> <a href='301array-equal.subx.html#L174'>parse-array-of-ints</a> ad: (addr allocation-descriptor), s: (addr string), out: (addr handle array int)
<span id="L135" class="LineNr">135 </span><span class="PreProc">sig</span> <a href='301array-equal.subx.html#L370'>check-array-equal</a> a: (addr array int), expected: (addr string), msg: (addr string)
<span id="L136" class="LineNr">136 </span><span class="Comment">#sig push-n-zero-bytes n: int</span>
<span id="L137" class="LineNr">137 </span><span class="PreProc">sig</span> <a href='303kernel-string.subx.html#L7'>kernel-string-to-string</a> ad: (addr allocation-descriptor), in: (addr kernel-string), out: (addr handle array byte)
<span id="L138" class="LineNr">138 </span><span class="PreProc">sig</span> <a href='303kernel-string.subx.html#L57'>kernel-string-length</a> in: (addr kernel-string)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: int
<span id="L139" class="LineNr">139 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L6'>enable-screen-grid-mode</a>
<span id="L140" class="LineNr">140 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L24'>enable-screen-type-mode</a>
<span id="L141" class="LineNr">141 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L37'>screen-size</a><span class="PreProc"> -&gt; </span>nrows/<span class="Constant">eax</span>: int, ncols/<span class="Constant">ecx</span>: int
<span id="L142" class="LineNr">142 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L75'>clear-screen</a>
<span id="L143" class="LineNr">143 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L91'>move-cursor-on-screen</a> row: int, column: int
<span id="L144" class="LineNr">144 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L123'>print-string-to-screen</a> s: (addr array byte)
<span id="L145" class="LineNr">145 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L136'>print-byte-to-screen</a> c: byte
<span id="L146" class="LineNr">146 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L158'>print-int32-hex-to-screen</a> n: int
<span id="L147" class="LineNr">147 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L171'>reset-formatting-on-screen</a>
<span id="L148" class="LineNr">148 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L186'>start-color-on-screen</a> fg: int, bg: int
<span id="L149" class="LineNr">149 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L221'>start-bold-on-screen</a>
<span id="L150" class="LineNr">150 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L234'>start-underline-on-screen</a>
<span id="L151" class="LineNr">151 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L247'>start-reverse-video-on-screen</a>
<span id="L152" class="LineNr">152 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L261'>start-blinking-on-screen</a>
<span id="L153" class="LineNr">153 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L274'>hide-cursor-on-screen</a>
<span id="L154" class="LineNr">154 </span><span class="PreProc">sig</span> <a href='304screen.subx.html#L287'>show-cursor-on-screen</a>
<span id="L155" class="LineNr">155 </span><span class="PreProc">sig</span> <a href='305keyboard.subx.html#L6'>enable-keyboard-immediate-mode</a>
<span id="L156" class="LineNr">156 </span><span class="PreProc">sig</span> <a href='305keyboard.subx.html#L72'>enable-keyboard-type-mode</a>
<span id="L157" class="LineNr">157 </span><span class="PreProc">sig</span> <a href='305keyboard.subx.html#L122'>read-key</a><span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: byte
<span id="L158" class="LineNr">158 </span><span class="PreProc">sig</span> <a href='306files.subx.html#L3'>open</a> filename: (addr array byte), write?: boolean, out: (addr handle buffered-file)
<span id="L159" class="LineNr">159 </span><span class="PreProc">sig</span> <a href='307size.subx.html#L5'>size</a> in: (addr array _)<span class="PreProc"> -&gt; </span>result/<span class="Constant">eax</span>: int
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->

101
html/401time.mu.html generated Normal file
View File

@ -0,0 +1,101 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - 401time.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-light">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #c6c6c6; }
body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; }
a { color:inherit; }
* { font-size:12pt; font-size: 1em; }
.LineNr { }
.muFunction { color: #af5f00; text-decoration: underline; }
.SpecialChar { color: #d70000; }
.Comment { color: #005faf; }
.Delimiter { color: #c000c0; }
.Constant { color: #008787; }
.PreProc { color: #c000c0; }
-->
</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/master/401time.mu'>https://github.com/akkartik/mu/blob/master/401time.mu</a>
<pre id='vimCodeElement'>
<span id="L1" class="LineNr"> 1 </span><span class="PreProc">type</span> <a href='401time.mu.html#L1'>timespec</a> <span class="Delimiter">{</span>
<span id="L2" class="LineNr"> 2 </span> tv_sec: int
<span id="L3" class="LineNr"> 3 </span> tv_nsec: int
<span id="L4" class="LineNr"> 4 </span><span class="Delimiter">}</span>
<span id="L5" class="LineNr"> 5 </span>
<span id="L6" class="LineNr"> 6 </span><span class="Comment"># TODO: y2038</span>
<span id="L7" class="LineNr"> 7 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='401time.mu.html#L7'>time</a></span><span class="PreProc"> -&gt; </span>secs/<span class="Constant">eax</span>: int <span class="Delimiter">{</span>
<span id="L8" class="LineNr"> 8 </span> <span class="PreProc">var</span> t: <a href='401time.mu.html#L1'>timespec</a>
<span id="L9" class="LineNr"> 9 </span> <span class="PreProc">var</span> clock/<span class="Constant">ebx</span>: int <span class="SpecialChar">&lt;-</span> copy <span class="Constant">0</span> <span class="Comment"># CLOCK_MONOTONIC</span>
<span id="L10" class="LineNr">10 </span> <span class="PreProc">var</span> t-addr/<span class="Constant">ecx</span>: (addr <a href='401time.mu.html#L1'>timespec</a>) <span class="SpecialChar">&lt;-</span> address t
<span id="L11" class="LineNr">11 </span> syscall_clock_gettime
<span id="L12" class="LineNr">12 </span> <span class="PreProc">var</span> t-secs-addr/<span class="Constant">ecx</span>: (addr int) <span class="SpecialChar">&lt;-</span> <a href='131table.subx.html#L26'>get</a> t-addr, tv_sec
<span id="L13" class="LineNr">13 </span> secs <span class="SpecialChar">&lt;-</span> copy *t-secs-addr
<span id="L14" class="LineNr">14 </span><span class="Delimiter">}</span>
<span id="L15" class="LineNr">15 </span>
<span id="L16" class="LineNr">16 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='401time.mu.html#L16'>ntime</a></span><span class="PreProc"> -&gt; </span>nsecs/<span class="Constant">eax</span>: int <span class="Delimiter">{</span>
<span id="L17" class="LineNr">17 </span> <span class="PreProc">var</span> t: <a href='401time.mu.html#L1'>timespec</a>
<span id="L18" class="LineNr">18 </span> <span class="PreProc">var</span> clock/<span class="Constant">ebx</span>: int <span class="SpecialChar">&lt;-</span> copy <span class="Constant">0</span> <span class="Comment"># CLOCK_MONOTONIC</span>
<span id="L19" class="LineNr">19 </span> <span class="PreProc">var</span> t-addr/<span class="Constant">ecx</span>: (addr <a href='401time.mu.html#L1'>timespec</a>) <span class="SpecialChar">&lt;-</span> address t
<span id="L20" class="LineNr">20 </span> syscall_clock_gettime
<span id="L21" class="LineNr">21 </span> <span class="PreProc">var</span> t-nsecs-addr/<span class="Constant">ecx</span>: (addr int) <span class="SpecialChar">&lt;-</span> <a href='131table.subx.html#L26'>get</a> t-addr, tv_nsec
<span id="L22" class="LineNr">22 </span> nsecs <span class="SpecialChar">&lt;-</span> copy *t-nsecs-addr
<span id="L23" class="LineNr">23 </span><span class="Delimiter">}</span>
<span id="L24" class="LineNr">24 </span>
<span id="L25" class="LineNr">25 </span><span class="Comment"># nsecs must be less than 999999999 or 0x3b9ac9ff nanoseconds</span>
<span id="L26" class="LineNr">26 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='401time.mu.html#L26'>sleep</a></span> secs: int, nsecs: int <span class="Delimiter">{</span>
<span id="L27" class="LineNr">27 </span> <span class="PreProc">var</span> t: <a href='401time.mu.html#L1'>timespec</a>
<span id="L28" class="LineNr">28 </span> <span class="Comment"># initialize t</span>
<span id="L29" class="LineNr">29 </span> <span class="PreProc">var</span> tmp/<span class="Constant">eax</span>: (addr int) <span class="SpecialChar">&lt;-</span> <a href='131table.subx.html#L26'>get</a> t, tv_sec
<span id="L30" class="LineNr">30 </span> <span class="PreProc">var</span> tmp2/<span class="Constant">ecx</span>: int <span class="SpecialChar">&lt;-</span> copy secs
<span id="L31" class="LineNr">31 </span> copy-to *tmp, tmp2
<span id="L32" class="LineNr">32 </span> tmp <span class="SpecialChar">&lt;-</span> <a href='131table.subx.html#L26'>get</a> t, tv_nsec
<span id="L33" class="LineNr">33 </span> tmp2 <span class="SpecialChar">&lt;-</span> copy nsecs
<span id="L34" class="LineNr">34 </span> copy-to *tmp, tmp2
<span id="L35" class="LineNr">35 </span> <span class="Comment"># perform the syscall</span>
<span id="L36" class="LineNr">36 </span> <span class="PreProc">var</span> t-addr/<span class="Constant">ebx</span>: (addr <a href='401time.mu.html#L1'>timespec</a>) <span class="SpecialChar">&lt;-</span> address t
<span id="L37" class="LineNr">37 </span> <span class="PreProc">var</span> rem-addr/<span class="Constant">ecx</span>: (addr <a href='401time.mu.html#L1'>timespec</a>) <span class="SpecialChar">&lt;-</span> copy <span class="Constant">0</span>
<span id="L38" class="LineNr">38 </span> syscall_nanosleep
<span id="L39" class="LineNr">39 </span><span class="Delimiter">}</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->

View File

@ -91,7 +91,7 @@ if ('onhashchange' in window) {
<span id="L32" class="LineNr"> 32 </span><span class="Comment">#</span>
<span id="L33" class="LineNr"> 33 </span><span class="Comment"># Error handling is non-existent. This is just a prototype.</span>
<span id="L34" class="LineNr"> 34 </span>
<span id="L35" class="LineNr"> 35 </span><span class="PreProc">fn</span> <span class="muFunction">main</span><span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L35" class="LineNr"> 35 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='arith.mu.html#L35'>main</a></span><span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L36" class="LineNr"> 36 </span> <span class="PreProc">var</span> look/<span class="Constant">esi</span>: byte <span class="SpecialChar">&lt;-</span> copy <span class="Constant">0</span> <span class="Comment"># lookahead</span>
<span id="L37" class="LineNr"> 37 </span> <span class="PreProc">var</span> n/<span class="Constant">eax</span>: int <span class="SpecialChar">&lt;-</span> copy <span class="Constant">0</span> <span class="Comment"># result of each expression</span>
<span id="L38" class="LineNr"> 38 </span> <a href='../304screen.subx.html#L123'>print-string-to-screen</a> <span class="Constant">&quot;press ctrl-c or ctrl-d to exit\n&quot;</span>

View File

@ -65,7 +65,7 @@ if ('onhashchange' in window) {
<span id="L6" class="LineNr"> 6 </span><span class="Comment">#</span>
<span id="L7" class="LineNr"> 7 </span><span class="Comment"># Press 'q' to quit. All other keys scroll down.</span>
<span id="L8" class="LineNr"> 8 </span>
<span id="L9" class="LineNr"> 9 </span><span class="PreProc">fn</span> <span class="muFunction">main</span> args-on-stack: (addr array (addr array byte))<span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L9" class="LineNr"> 9 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='browse.mu.html#L9'>main</a></span> args-on-stack: (addr array (addr array byte))<span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L10" class="Folded"> 10 </span><span class="Folded">+-- 20 lines: # var file/esi: (addr buffered-file) = open args-on-stack[1] for reading --------------------------------------------------------------------------------------------------</span>
<span id="L30" class="LineNr"> 30 </span> <a href='../304screen.subx.html#L6'>enable-screen-grid-mode</a>
<span id="L31" class="LineNr"> 31 </span> <span class="PreProc">var</span> nrows/<span class="Constant">eax</span>: int <span class="SpecialChar">&lt;-</span> copy <span class="Constant">0</span>

View File

@ -278,7 +278,7 @@ if ('onhashchange' in window) {
<span id="L217" class="LineNr">217 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to esp</span>
<span id="L218" class="LineNr">218 </span> <span class="subxS1Comment"># . if (eax == false)</span>
<span id="L219" class="LineNr">219 </span> 3d/compare-eax-and 0/imm32/false
<span id="L220" class="LineNr">220 </span> 75/jump-if-!= $get-num:<a href='../mu-init-test.subx.html#L7'>main</a>/disp8
<span id="L220" class="LineNr">220 </span> 75/jump-if-!= $get-num:main/disp8
<span id="L221" class="LineNr">221 </span> <span class="subxS1Comment"># . expected(ed, err, &quot;integer&quot;)</span>
<span id="L222" class="LineNr">222 </span> <span class="subxS2Comment"># . . push args</span>
<span id="L223" class="LineNr">223 </span> 68/push <span class="Constant">&quot;integer&quot;</span>/imm32
@ -288,7 +288,7 @@ if ('onhashchange' in window) {
<span id="L227" class="LineNr">227 </span> e8/call <a href='crenshaw2-1.subx.html#L466'>expected</a>/disp32 <span class="subxComment"># never returns</span>
<span id="L228" class="LineNr">228 </span> <span class="subxS2Comment"># . . discard args</span>
<span id="L229" class="LineNr">229 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/imm32 <span class="subxComment"># add to esp</span>
<span id="L230" class="LineNr">230 </span><span class="Constant">$get-num:<a href='../mu-init-test.subx.html#L7'>main</a></span>:
<span id="L230" class="LineNr">230 </span><span class="Constant">$get-num:main</span>:
<span id="L231" class="LineNr">231 </span> <span class="subxH1Comment"># - otherwise read a digit</span>
<span id="L232" class="LineNr">232 </span> <span class="subxS1Comment"># . save registers</span>
<span id="L233" class="LineNr">233 </span> 50/push-eax

View File

@ -283,7 +283,7 @@ if ('onhashchange' in window) {
<span id="L222" class="LineNr">222 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to esp</span>
<span id="L223" class="LineNr">223 </span> <span class="subxS1Comment"># . if (eax == false)</span>
<span id="L224" class="LineNr">224 </span> 3d/compare-eax-and 0/imm32/false
<span id="L225" class="LineNr">225 </span> 75/jump-if-!= $get-num:<a href='../mu-init-test.subx.html#L7'>main</a>/disp8
<span id="L225" class="LineNr">225 </span> 75/jump-if-!= $get-num:main/disp8
<span id="L226" class="LineNr">226 </span> <span class="subxS1Comment"># . expected(ed, err, &quot;integer&quot;)</span>
<span id="L227" class="LineNr">227 </span> <span class="subxS2Comment"># . . push args</span>
<span id="L228" class="LineNr">228 </span> 68/push <span class="Constant">&quot;integer&quot;</span>/imm32
@ -293,7 +293,7 @@ if ('onhashchange' in window) {
<span id="L232" class="LineNr">232 </span> e8/call <a href='crenshaw2-1b.subx.html#L660'>expected</a>/disp32 <span class="subxComment"># never returns</span>
<span id="L233" class="LineNr">233 </span> <span class="subxS2Comment"># . . discard args</span>
<span id="L234" class="LineNr">234 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/imm32 <span class="subxComment"># add to esp</span>
<span id="L235" class="LineNr">235 </span><span class="Constant">$get-num:<a href='../mu-init-test.subx.html#L7'>main</a></span>:
<span id="L235" class="LineNr">235 </span><span class="Constant">$get-num:main</span>:
<span id="L236" class="LineNr">236 </span> <span class="subxH1Comment"># - otherwise read a digit</span>
<span id="L237" class="LineNr">237 </span> <span class="subxS1Comment"># . save registers</span>
<span id="L238" class="LineNr">238 </span> 50/push-eax

2
html/apps/ex1.mu.html generated
View File

@ -66,7 +66,7 @@ if ('onhashchange' in window) {
<span id="L8" class="LineNr"> 8 </span><span class="Comment"># $ echo $?</span>
<span id="L9" class="LineNr"> 9 </span><span class="Comment"># 42</span>
<span id="L10" class="LineNr">10 </span>
<span id="L11" class="LineNr">11 </span><span class="PreProc">fn</span> <span class="muFunction">main</span><span class="PreProc"> -&gt; </span>result/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L11" class="LineNr">11 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='ex1.mu.html#L11'>main</a></span><span class="PreProc"> -&gt; </span>result/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L12" class="LineNr">12 </span> result <span class="SpecialChar">&lt;-</span> copy <span class="Constant">0x2a</span> <span class="Comment"># Mu requires hexadecimal</span>
<span id="L13" class="LineNr">13 </span><span class="Delimiter">}</span>
</pre>

2
html/apps/ex2.mu.html generated
View File

@ -65,7 +65,7 @@ if ('onhashchange' in window) {
<span id="L7" class="LineNr"> 7 </span><span class="Comment"># $ echo $?</span>
<span id="L8" class="LineNr"> 8 </span><span class="Comment"># 7</span>
<span id="L9" class="LineNr"> 9 </span>
<span id="L10" class="LineNr">10 </span><span class="PreProc">fn</span> <span class="muFunction">main</span><span class="PreProc"> -&gt; </span>result/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L10" class="LineNr">10 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='ex2.mu.html#L10'>main</a></span><span class="PreProc"> -&gt; </span>result/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L11" class="LineNr">11 </span> result <span class="SpecialChar">&lt;-</span> <a href='ex2.mu.html#L14'>do-add</a> <span class="Constant">3</span> <span class="Constant">4</span>
<span id="L12" class="LineNr">12 </span><span class="Delimiter">}</span>
<span id="L13" class="LineNr">13 </span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L6" class="LineNr"> 6 </span><span class="Comment"># $ echo $?</span>
<span id="L7" class="LineNr"> 7 </span><span class="Comment"># 55</span>
<span id="L8" class="LineNr"> 8 </span>
<span id="L9" class="LineNr"> 9 </span><span class="PreProc">fn</span> <span class="muFunction">main</span><span class="PreProc"> -&gt; </span>result/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L9" class="LineNr"> 9 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='ex3.2.mu.html#L9'>main</a></span><span class="PreProc"> -&gt; </span>result/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L10" class="LineNr">10 </span> <span class="Comment"># populate a</span>
<span id="L11" class="LineNr">11 </span> <span class="PreProc">var</span> a: (array int <span class="Constant">0xb</span>) <span class="Comment"># 11; we waste index 0</span>
<span id="L12" class="LineNr">12 </span> <span class="PreProc">var</span> i/<span class="Constant">ecx</span>: int <span class="SpecialChar">&lt;-</span> copy <span class="Constant">1</span>

2
html/apps/ex3.mu.html generated
View File

@ -65,7 +65,7 @@ if ('onhashchange' in window) {
<span id="L7" class="LineNr"> 7 </span><span class="Comment"># $ echo $?</span>
<span id="L8" class="LineNr"> 8 </span><span class="Comment"># 55</span>
<span id="L9" class="LineNr"> 9 </span>
<span id="L10" class="LineNr">10 </span><span class="PreProc">fn</span> <span class="muFunction">main</span><span class="PreProc"> -&gt; </span>result/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L10" class="LineNr">10 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='ex3.mu.html#L10'>main</a></span><span class="PreProc"> -&gt; </span>result/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L11" class="LineNr">11 </span> result <span class="SpecialChar">&lt;-</span> copy <span class="Constant">0</span>
<span id="L12" class="LineNr">12 </span> <span class="PreProc">var</span> i/<span class="Constant">eax</span>: int <span class="SpecialChar">&lt;-</span> copy <span class="Constant">1</span>
<span id="L13" class="LineNr">13 </span> <span class="Delimiter">{</span>

View File

@ -90,7 +90,7 @@ if ('onhashchange' in window) {
<span id="L31" class="LineNr">31 </span> <a href='../102test.subx.html#L23'>check-ints-equal</a> result <span class="Constant">0x78</span> <span class="Constant">&quot;F - test-factorial&quot;</span>
<span id="L32" class="LineNr">32 </span><span class="Delimiter">}</span>
<span id="L33" class="LineNr">33 </span>
<span id="L34" class="LineNr">34 </span><span class="PreProc">fn</span> <span class="muFunction">main</span> args-on-stack: (addr array (addr array byte))<span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L34" class="LineNr">34 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='factorial.mu.html#L34'>main</a></span> args-on-stack: (addr array (addr array byte))<span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L35" class="LineNr">35 </span> <span class="PreProc">var</span> args/<span class="Constant">eax</span>: (addr array (addr array byte)) <span class="SpecialChar">&lt;-</span> copy args-on-stack
<span id="L36" class="LineNr">36 </span> <span class="PreProc">var</span> tmp/<span class="Constant">ecx</span>: int <span class="SpecialChar">&lt;-</span> length args
<span id="L37" class="LineNr">37 </span> $main-body: <span class="Delimiter">{</span>

View File

@ -886,7 +886,7 @@ if ('onhashchange' in window) {
<span id="L864" class="LineNr"> 864 </span> (<a href='../106stream.subx.html#L17'>clear-stream</a> <a href='../115write-byte.subx.html#L285'>_test-output-stream</a>)
<span id="L865" class="LineNr"> 865 </span> (<a href='../106stream.subx.html#L17'>clear-stream</a> $_test-output-buffered-file-&gt;buffer)
<span id="L866" class="LineNr"> 866 </span> <span class="subxComment">#</span>
<span id="L867" class="LineNr"> 867 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;fn <a href='../mu-init-test.subx.html#L7'>main</a> -&gt; result/ebx: int {\n&quot;</span>)
<span id="L867" class="LineNr"> 867 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;fn main -&gt; result/ebx: int {\n&quot;</span>)
<span id="L868" class="LineNr"> 868 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot; result &lt;- do-add 3 4\n&quot;</span>)
<span id="L869" class="LineNr"> 869 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;}\n&quot;</span>)
<span id="L870" class="LineNr"> 870 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;fn do-add a: int, b: int -&gt; result/ebx: int {\n&quot;</span>)
@ -940,7 +940,7 @@ if ('onhashchange' in window) {
<span id="L923" class="LineNr"> 923 </span> (<a href='../106stream.subx.html#L17'>clear-stream</a> <a href='../115write-byte.subx.html#L285'>_test-output-stream</a>)
<span id="L924" class="LineNr"> 924 </span> (<a href='../106stream.subx.html#L17'>clear-stream</a> $_test-output-buffered-file-&gt;buffer)
<span id="L925" class="LineNr"> 925 </span> <span class="subxComment">#</span>
<span id="L926" class="LineNr"> 926 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;fn <a href='../mu-init-test.subx.html#L7'>main</a> -&gt; result/ebx: int {\n&quot;</span>)
<span id="L926" class="LineNr"> 926 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;fn main -&gt; result/ebx: int {\n&quot;</span>)
<span id="L927" class="LineNr"> 927 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot; result &lt;- do-add 3 4\n&quot;</span>)
<span id="L928" class="LineNr"> 928 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;}\n&quot;</span>)
<span id="L929" class="LineNr"> 929 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;sig do-add a: int, b: int -&gt; result/ebx: int\n&quot;</span>)
@ -1218,7 +1218,7 @@ if ('onhashchange' in window) {
<span id="L1236" class="LineNr"> 1236 </span> (<a href='../106stream.subx.html#L17'>clear-stream</a> <a href='../115write-byte.subx.html#L285'>_test-output-stream</a>)
<span id="L1237" class="LineNr"> 1237 </span> (<a href='../106stream.subx.html#L17'>clear-stream</a> $_test-output-buffered-file-&gt;buffer)
<span id="L1238" class="LineNr"> 1238 </span> <span class="subxComment">#</span>
<span id="L1239" class="LineNr"> 1239 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;fn <a href='../mu-init-test.subx.html#L7'>main</a> -&gt; result/ebx: int {\n&quot;</span>)
<span id="L1239" class="LineNr"> 1239 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;fn main -&gt; result/ebx: int {\n&quot;</span>)
<span id="L1240" class="LineNr"> 1240 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot; result &lt;- foo\n&quot;</span>)
<span id="L1241" class="LineNr"> 1241 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;}\n&quot;</span>)
<span id="L1242" class="LineNr"> 1242 </span> (<a href='../108write.subx.html#L24'>write</a> <a href='../112read-byte.subx.html#L287'>_test-input-stream</a> <span class="Constant">&quot;fn foo -&gt; result/ebx: int {\n&quot;</span>)

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L6" class="LineNr"> 6 </span><span class="Comment"># $ echo $?</span>
<span id="L7" class="LineNr"> 7 </span><span class="Comment"># 123</span>
<span id="L8" class="LineNr"> 8 </span>
<span id="L9" class="LineNr"> 9 </span><span class="PreProc">fn</span> <span class="muFunction">main</span> _args: (addr array (addr array byte))<span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L9" class="LineNr"> 9 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='parse-int.mu.html#L9'>main</a></span> _args: (addr array (addr array byte))<span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L10" class="LineNr">10 </span>$main-body: <span class="Delimiter">{</span>
<span id="L11" class="LineNr">11 </span> <span class="Comment"># if no args, print a message and exit</span>
<span id="L12" class="LineNr">12 </span> <span class="PreProc">var</span> args/<span class="Constant">esi</span>: (addr array (addr array byte)) <span class="SpecialChar">&lt;-</span> copy _args

View File

@ -65,7 +65,7 @@ if ('onhashchange' in window) {
<span id="L7" class="LineNr"> 7 </span><span class="Comment"># $ ./a.elf x</span>
<span id="L8" class="LineNr"> 8 </span><span class="Comment"># abc</span>
<span id="L9" class="LineNr"> 9 </span>
<span id="L10" class="LineNr">10 </span><span class="PreProc">fn</span> <span class="muFunction">main</span> _args: (addr array (addr array byte))<span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L10" class="LineNr">10 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='print-file.mu.html#L10'>main</a></span> _args: (addr array (addr array byte))<span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span>
<span id="L11" class="LineNr">11 </span> <span class="PreProc">var</span> args/<span class="Constant">eax</span>: (addr array (addr array byte)) <span class="SpecialChar">&lt;-</span> copy _args
<span id="L12" class="LineNr">12 </span>$main-body: <span class="Delimiter">{</span>
<span id="L13" class="LineNr">13 </span> <span class="PreProc">var</span> n/<span class="Constant">ecx</span>: int <span class="SpecialChar">&lt;-</span> length args

2
html/apps/tui.mu.html generated
View File

@ -62,7 +62,7 @@ if ('onhashchange' in window) {
<span id="L4" class="LineNr"> 4 </span><span class="Comment"># $ ./translate_mu apps/tui.mu</span>
<span id="L5" class="LineNr"> 5 </span><span class="Comment"># $ ./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">main</span><span class="PreProc"> -&gt; </span>exit-status/<span class="Constant">ebx</span>: int <span class="Delimiter">{</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"> -&gt; </span>exit-status/<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="SpecialChar">&lt;-</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="SpecialChar">&lt;-</span> copy <span class="Constant">0</span>
<span id="L10" class="LineNr">10 </span> nrows, ncols <span class="SpecialChar">&lt;-</span> <a href='../304screen.subx.html#L37'>screen-size</a>

View File

@ -113,7 +113,7 @@ if ('onhashchange' in window) {
<span id="L57" class="LineNr">57 </span> eb/jump <span class="Constant">loop</span>/disp8
<span id="L58" class="LineNr">58 </span> }
<span id="L59" class="LineNr">59 </span> <span class="subxH1Comment"># - run Mu program</span>
<span id="L60" class="LineNr">60 </span> (<a href='mu-init-test.subx.html#L7'>main</a> %edi) <span class="subxComment"># =&gt; ebx</span>
<span id="L60" class="LineNr">60 </span> (main %edi) <span class="subxComment"># =&gt; ebx</span>
<span id="L61" class="LineNr">61 </span> <span class="subxH1Comment"># - exit</span>
<span id="L62" class="LineNr">62 </span> (syscall_exit)
</pre>

View File

@ -45,8 +45,8 @@ do
process $f
done
ctags -x *.subx > /tmp/tags
for f in *.subx
ctags -x [0-9]*.subx [0-9]*.mu > /tmp/tags
for f in *.subx *.mu
do
test $# -gt 0 && test $1 != $f && continue
process $f
@ -56,7 +56,7 @@ for f in apps/*.subx
do
test $# -gt 0 && test $1 != $f && continue
( cd apps
ctags -x ../*.subx `basename $f` > /tmp/tags
ctags -x ../[0-9]*.subx ../[0-9]*.mu `basename $f` > /tmp/tags
)
process $f
done
@ -65,7 +65,7 @@ for f in apps/*.mu
do
test $# -gt 0 && test $1 != $f && continue
( cd apps
ctags -x ../*.subx `basename $f` > /tmp/tags
ctags -x ../[0-9]*.subx ../[0-9]*.mu `basename $f` > /tmp/tags
)
process $f
done