diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-07-27 17:07:52 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-07-27 17:08:29 -0700 |
commit | 5fe060d582d4a82444243a28b18085c971a85628 (patch) | |
tree | 7a13eb020d0a9cab5d4195da931a373f575229ab /html/subx/000organization.cc.html | |
parent | 013d95266d563a3f531c13eba6d2a6bfe18f8808 (diff) | |
download | mu-5fe060d582d4a82444243a28b18085c971a85628.tar.gz |
4447
Diffstat (limited to 'html/subx/000organization.cc.html')
-rw-r--r-- | html/subx/000organization.cc.html | 78 |
1 files changed, 43 insertions, 35 deletions
diff --git a/html/subx/000organization.cc.html b/html/subx/000organization.cc.html index 7bc3557c..2c0c0877 100644 --- a/html/subx/000organization.cc.html +++ b/html/subx/000organization.cc.html @@ -15,14 +15,13 @@ body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color a { color:#eeeeee; text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } -.Delimiter { color: #800080; } +.Constant { color: #00a0a0; } .Comment { color: #9090ff; } .Comment a { color:#0000ee; text-decoration:underline; } -.Constant { color: #00a0a0; } +.Delimiter { color: #800080; } .LineNr { color: #444444; } .Identifier { color: #c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.PreProc { color: #800080; } .cSpecial { color: #008000; } --> </style> @@ -158,7 +157,7 @@ if ('onhashchange' in window) { <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="PreProc">#include </span><span class="Constant">"function_list"</span> <span class="Comment">// by convention, files ending with '_list' are auto-generated</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="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> @@ -171,46 +170,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#L139'>reset</a><span class="Delimiter">);</span> -<span id="L115" class="LineNr">115 </span> <span class="Comment">// run on a 32-bit system</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#L143'>assert_little_endian</a><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="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span class="Comment">// End Main</span> -<span id="L126" class="LineNr">126 </span><span class="Delimiter">}</span> -<span id="L127" class="LineNr">127 </span> -<span id="L128" class="LineNr">128 </span><span class="Comment">// Unit Tests</span> -<span id="L129" class="LineNr">129 </span><span class="Comment">// End Unit Tests</span> -<span id="L130" class="LineNr">130 </span> -<span id="L131" class="LineNr">131 </span><span class="Comment">//: our first directive; insert the following headers at the start of the program</span> -<span id="L132" class="LineNr">132 </span><span class="Delimiter">:(before "End Includes")</span> -<span id="L133" class="LineNr">133 </span><span class="PreProc">#include </span><span class="Constant"><assert.h></span> -<span id="L134" class="LineNr">134 </span><span class="PreProc">#include </span><span class="Constant"><stdlib.h></span> -<span id="L135" class="LineNr">135 </span> -<span id="L136" class="LineNr">136 </span><span class="Comment">//: Without directives or with the :(code) directive, lines get added at the</span> -<span id="L137" class="LineNr">137 </span><span class="Comment">//: end.</span> -<span id="L138" class="LineNr">138 </span><span class="Delimiter">:(code)</span> -<span id="L139" class="LineNr">139 </span><span class="Normal">void</span> <a href='000organization.cc.html#L139'>reset</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L140" class="LineNr">140 </span> <span class="Comment">// End Reset</span> -<span id="L141" class="LineNr">141 </span><span class="Delimiter">}</span> -<span id="L142" class="LineNr">142 </span> -<span id="L143" class="LineNr">143 </span><span class="Normal">void</span> <a href='000organization.cc.html#L143'>assert_little_endian</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L144" class="LineNr">144 </span> <span class="Normal">const</span> <span class="Normal">int</span> x = <span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L145" class="LineNr">145 </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="L146" class="LineNr">146 </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="L147" class="LineNr">147 </span> cerr << <span class="Constant">"the SubX VM only runs on little-endian processors. Do you have Intel (or AMD or Atom) inside?</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> -<span id="L148" class="LineNr">148 </span> exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L149" class="LineNr">149 </span> <span class="Delimiter">}</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="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="Comment">#include <assert.h></span> +<span id="L136" class="LineNr">136 </span><span class="Comment">#include <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 class="Delimiter">:(before "End Includes")</span> -<span id="L152" class="LineNr">152 </span><span class="PreProc">#include</span><span class="Constant"><iostream></span> -<span id="L153" class="LineNr">153 </span><span class="Normal">using</span> std::cerr<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?</span><span class="cSpecial">\n</span><span class="Constant">"</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="Comment">#include<iostream></span> +<span id="L162" class="LineNr">162 </span><span class="Normal">using</span> std::cerr<span class="Delimiter">;</span> </pre> </body> </html> |