diff options
Diffstat (limited to 'html/000organization.cc.html')
-rw-r--r-- | html/000organization.cc.html | 91 |
1 files changed, 59 insertions, 32 deletions
diff --git a/html/000organization.cc.html b/html/000organization.cc.html index bcbae00b..87c51792 100644 --- a/html/000organization.cc.html +++ b/html/000organization.cc.html @@ -2,9 +2,9 @@ <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> -<title>Mu - 000organization.cc</title> -<meta name="Generator" content="Vim/8.0"> -<meta name="plugin-version" content="vim7.4_v2"> +<title>Mu - subx/000organization.cc</title> +<meta name="Generator" content="Vim/8.1"> +<meta name="plugin-version" content="vim8.1_v1"> <meta name="syntax" content="cpp"> <meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy="> <meta name="colorscheme" content="minimal-light"> @@ -14,12 +14,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #000000; background- body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } +.Delimiter { color: #c000c0; } .LineNr { } +.Comment { color: #005faf; } .Constant { color: #008787; } -.Delimiter { color: #c000c0; } .Identifier { color: #af5f00; } .Normal { color: #000000; background-color: #c6c6c6; padding-bottom: 1px; } -.Comment { color: #005faf; } +.PreProc { color: #c000c0; } --> </style> @@ -36,7 +37,7 @@ function JumpToLine() if (lineNum.indexOf('L') == -1) { lineNum = 'L'+lineNum; } - lineElem = document.getElementById(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. */ @@ -53,7 +54,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> -<a href='https://github.com/akkartik/mu/blob/master/000organization.cc'>https://github.com/akkartik/mu/blob/master/000organization.cc</a> +<a href='https://github.com/akkartik/mu/blob/master/subx/000organization.cc'>https://github.com/akkartik/mu/blob/master/subx/000organization.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: You guessed right: the '000' prefix means you should start reading here.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> @@ -151,16 +152,16 @@ if ('onhashchange' in window) { <span id="L94" class="LineNr"> 94 </span><span class="Comment">// Types</span> <span id="L95" class="LineNr"> 95 </span><span class="Comment">// End Types</span> <span id="L96" class="LineNr"> 96 </span> -<span id="L97" class="LineNr"> 97 </span><span class="Comment">// Function prototypes are auto-generated in the 'build*' scripts; define your</span> +<span id="L97" class="LineNr"> 97 </span><span class="Comment">// Function prototypes are auto-generated in the 'build' script; define your</span> <span id="L98" class="LineNr"> 98 </span><span class="Comment">// functions in any order. Just be sure to declare each function header all on</span> <span id="L99" class="LineNr"> 99 </span><span class="Comment">// one line, ending with the '{'. Our auto-generation scripts are too minimal</span> <span id="L100" class="LineNr">100 </span><span class="Comment">// and simple-minded to handle anything else.</span> -<span id="L101" class="LineNr">101 </span><span class="Comment">#include "function_list" // by convention, files ending with '_list' are auto-generated</span> +<span id="L101" class="LineNr">101 </span><span class="PreProc">#include </span><span class="Constant">"function_list"</span> <span class="Comment">// by convention, files ending with '_list' are auto-generated</span> <span id="L102" class="LineNr">102 </span> <span id="L103" class="LineNr">103 </span><span class="Comment">// Globals</span> <span id="L104" class="LineNr">104 </span><span class="Comment">//</span> <span id="L105" class="LineNr">105 </span><span class="Comment">// All statements in this section should always define a single variable on a</span> -<span id="L106" class="LineNr">106 </span><span class="Comment">// single line. The 'build*' scripts will simple-mindedly auto-generate extern</span> +<span id="L106" class="LineNr">106 </span><span class="Comment">// single line. The 'build' script will simple-mindedly auto-generate extern</span> <span id="L107" class="LineNr">107 </span><span class="Comment">// declarations for them. Remember to define (not just declare) constants with</span> <span id="L108" class="LineNr">108 </span><span class="Comment">// extern linkage in this section, since C++ global constants have internal</span> <span id="L109" class="LineNr">109 </span><span class="Comment">// linkage by default.</span> @@ -168,29 +169,55 @@ if ('onhashchange' in window) { <span id="L111" class="LineNr">111 </span><span class="Comment">// End Globals</span> <span id="L112" class="LineNr">112 </span> <span id="L113" class="LineNr">113 </span><span class="Normal">int</span> <a href='000organization.cc.html#L113'>main</a><span class="Delimiter">(</span><span class="Normal">int</span> argc<span class="Delimiter">,</span> <span class="Normal">char</span>* argv[]<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L114" class="LineNr">114 </span> atexit<span class="Delimiter">(</span><a href='000organization.cc.html#L134'>reset</a><span class="Delimiter">);</span> -<span id="L115" class="LineNr">115 </span> -<span id="L116" class="LineNr">116 </span> <span class="Comment">// End One-time Setup</span> -<span id="L117" class="LineNr">117 </span> -<span id="L118" class="LineNr">118 </span> <span class="Comment">// Commandline Parsing</span> -<span id="L119" class="LineNr">119 </span> <span class="Comment">// End Commandline Parsing</span> -<span id="L120" class="LineNr">120 </span> -<span id="L121" class="LineNr">121 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span class="Comment">// End Main</span> -<span id="L122" class="LineNr">122 </span><span class="Delimiter">}</span> -<span id="L123" class="LineNr">123 </span> -<span id="L124" class="LineNr">124 </span><span class="Comment">// Unit Tests</span> -<span id="L125" class="LineNr">125 </span><span class="Comment">// End Unit Tests</span> +<span id="L114" class="LineNr">114 </span> atexit<span class="Delimiter">(</span><a href='000organization.cc.html#L148'>reset</a><span class="Delimiter">);</span> +<span id="L115" class="LineNr">115 </span> <span class="Comment">// we require a 32-bit little-endian system</span> +<span id="L116" class="LineNr">116 </span> assert<span class="Delimiter">(</span><span class="Normal">sizeof</span><span class="Delimiter">(</span><span class="Normal">int</span><span class="Delimiter">)</span> == <span class="Constant">4</span><span class="Delimiter">);</span> +<span id="L117" class="LineNr">117 </span> assert<span class="Delimiter">(</span><span class="Normal">sizeof</span><span class="Delimiter">(</span><span class="Normal">float</span><span class="Delimiter">)</span> == <span class="Constant">4</span><span class="Delimiter">);</span> +<span id="L118" class="LineNr">118 </span> <a href='000organization.cc.html#L152'>assert_little_endian</a><span class="Delimiter">();</span> +<span id="L119" class="LineNr">119 </span> +<span id="L120" class="LineNr">120 </span> <span class="Comment">// End One-time Setup</span> +<span id="L121" class="LineNr">121 </span> +<span id="L122" class="LineNr">122 </span> <span class="Comment">// Commandline Parsing</span> +<span id="L123" class="LineNr">123 </span> <span class="Comment">// End Commandline Parsing</span> +<span id="L124" class="LineNr">124 </span> +<span id="L125" class="LineNr">125 </span> <span class="Comment">// End Main</span> <span id="L126" class="LineNr">126 </span> -<span id="L127" class="LineNr">127 </span><span class="Comment">//: our first directive; insert the following header at the start of the program</span> -<span id="L128" class="LineNr">128 </span><span class="Delimiter">:(before "End Includes")</span> -<span id="L129" class="LineNr">129 </span><span class="Comment">#include <stdlib.h></span> -<span id="L130" class="LineNr">130 </span> -<span id="L131" class="LineNr">131 </span><span class="Comment">//: Without directives or with the :(code) directive, lines get added at the</span> -<span id="L132" class="LineNr">132 </span><span class="Comment">//: end.</span> -<span id="L133" class="LineNr">133 </span><span class="Delimiter">:(code)</span> -<span id="L134" class="LineNr">134 </span><span class="Normal">void</span> <a href='000organization.cc.html#L134'>reset</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L135" class="LineNr">135 </span> <span class="Comment">// End Reset</span> -<span id="L136" class="LineNr">136 </span><span class="Delimiter">}</span> +<span id="L127" class="LineNr">127 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L128" class="LineNr">128 </span><span class="Delimiter">}</span> +<span id="L129" class="LineNr">129 </span> +<span id="L130" class="LineNr">130 </span><span class="Comment">// Unit Tests</span> +<span id="L131" class="LineNr">131 </span><span class="Comment">// End Unit Tests</span> +<span id="L132" class="LineNr">132 </span> +<span id="L133" class="LineNr">133 </span><span class="Comment">//: our first directive; insert the following headers at the start of the program</span> +<span id="L134" class="LineNr">134 </span><span class="Delimiter">:(before "End Includes")</span> +<span id="L135" class="LineNr">135 </span><span class="PreProc">#include </span><span class="Constant"><assert.h></span> +<span id="L136" class="LineNr">136 </span><span class="PreProc">#include </span><span class="Constant"><stdlib.h></span> +<span id="L137" class="LineNr">137 </span> +<span id="L138" class="LineNr">138 </span><span class="Comment">//: Without directives or with the :(code) directive, lines get added at the</span> +<span id="L139" class="LineNr">139 </span><span class="Comment">//: end.</span> +<span id="L140" class="LineNr">140 </span><span class="Comment">//:</span> +<span id="L141" class="LineNr">141 </span><span class="Comment">//: Regardless of where functions are defined, we can call them anywhere we</span> +<span id="L142" class="LineNr">142 </span><span class="Comment">//: like as long as we format the function header in a specific way: put it</span> +<span id="L143" class="LineNr">143 </span><span class="Comment">//: all on a single line without indent, end the line with ') {' and no</span> +<span id="L144" class="LineNr">144 </span><span class="Comment">//: trailing whitespace. As long as functions uniformly start this way, our</span> +<span id="L145" class="LineNr">145 </span><span class="Comment">//: 'build' script contains a little command to automatically generate</span> +<span id="L146" class="LineNr">146 </span><span class="Comment">//: declarations for them.</span> +<span id="L147" class="LineNr">147 </span><span class="Delimiter">:(code)</span> +<span id="L148" class="LineNr">148 </span><span class="Normal">void</span> <a href='000organization.cc.html#L148'>reset</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> +<span id="L149" class="LineNr">149 </span> <span class="Comment">// End Reset</span> +<span id="L150" class="LineNr">150 </span><span class="Delimiter">}</span> +<span id="L151" class="LineNr">151 </span> +<span id="L152" class="LineNr">152 </span><span class="Normal">void</span> <a href='000organization.cc.html#L152'>assert_little_endian</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> +<span id="L153" class="LineNr">153 </span> <span class="Normal">const</span> <span class="Normal">int</span> x = <span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L154" class="LineNr">154 </span> <span class="Normal">const</span> <span class="Normal">char</span>* y = <span class="Normal">reinterpret_cast</span><<span class="Normal">const</span> <span class="Normal">char</span>*><span class="Delimiter">(</span>&x<span class="Delimiter">);</span> +<span id="L155" class="LineNr">155 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*y != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L156" class="LineNr">156 </span> cerr << <span class="Constant">"SubX requires a little-endian processor. Do you have Intel (or AMD or Atom) inside?\n"</span><span class="Delimiter">;</span> +<span id="L157" class="LineNr">157 </span> exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L158" class="LineNr">158 </span> <span class="Delimiter">}</span> +<span id="L159" class="LineNr">159 </span><span class="Delimiter">}</span> +<span id="L160" class="LineNr">160 </span><span class="Delimiter">:(before "End Includes")</span> +<span id="L161" class="LineNr">161 </span><span class="PreProc">#include</span><span class="Constant"><iostream></span> +<span id="L162" class="LineNr">162 </span><span class="Normal">using</span> std::cerr<span class="Delimiter">;</span> </pre> </body> </html> |