diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-05-06 00:19:03 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-05-06 00:19:03 -0700 |
commit | 672e3e50c6ed6de161e40aa256c3fc0f2b1f7cf9 (patch) | |
tree | 5fa3d82e40137b15dec2941a3446e838ce43d3e5 /html/001help.cc.html | |
parent | 20d1c9057a559ce8db83bbc2787ca91348bcb16f (diff) | |
download | mu-672e3e50c6ed6de161e40aa256c3fc0f2b1f7cf9.tar.gz |
1279 - colorized rendering of the source files
Diffstat (limited to 'html/001help.cc.html')
-rw-r--r-- | html/001help.cc.html | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/html/001help.cc.html b/html/001help.cc.html new file mode 100644 index 00000000..80dc9e44 --- /dev/null +++ b/html/001help.cc.html @@ -0,0 +1,87 @@ +<!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>~/Desktop/s/mu/001help.cc.html</title> +<meta name="Generator" content="Vim/7.4"> +<meta name="plugin-version" content="vim7.4_v1"> +<meta name="syntax" content="cpp"> +<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy="> +<meta name="colorscheme" content="minimal"> +<style type="text/css"> +<!-- +pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #000000; } +body { font-family: monospace; color: #d0d0d0; background-color: #000000; } +* { font-size: 1em; } +.cSpecial { color: #008000; } +.Constant { color: #008080; } +.Comment { color: #8080ff; } +.Delimiter { color: #c000c0; } +.SalientComment { color: #00ffff; } +.Identifier { color: #008080; } +.PreProc { color: #c000c0; } +--> +</style> + +<script type='text/javascript'> +<!-- + +--> +</script> +</head> +<body> +<pre id='vimCodeElement'> +<span class="Comment">//: Everything this project/binary supports.</span> +<span class="Comment">//: This should give you a sense for what to look forward to in later layers.</span> + +<span class="Delimiter">:(before "End Commandline Parsing")</span> +if <span class="Delimiter">(</span>argc <= <span class="Constant">1</span> || is_equal<span class="Delimiter">(</span>argv[<span class="Constant">1</span>]<span class="Delimiter">,</span> <span class="Constant">"--help"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> + <span class="Comment">// this is the functionality later layers will provide</span> + <span class="Comment">// currently no automated tests for commandline arg parsing</span> + cerr << <span class="Constant">"To load files and run 'main':</span><span class="cSpecial">\n</span><span class="Constant">"</span> + << <span class="Constant">" mu file1.mu file2.mu ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> + << <span class="Constant">"To run all tests:</span><span class="cSpecial">\n</span><span class="Constant">"</span> + << <span class="Constant">" mu test</span><span class="cSpecial">\n</span><span class="Constant">"</span> + << <span class="Constant">"To load files and then run all tests:</span><span class="cSpecial">\n</span><span class="Constant">"</span> + << <span class="Constant">" mu test file1.mu file2.mu ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> + <span class="Delimiter">;</span> + <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> + +<span class="SalientComment">//:: Helper function used by the above fragment of code (and later layers too,</span> +<span class="SalientComment">//:: who knows?).</span> +<span class="Comment">//: The :(code) directive appends function definitions to the end of the</span> +<span class="Comment">//: project. Regardless of where functions are defined, we can call them</span> +<span class="Comment">//: anywhere we like as long as we format the function header in a specific</span> +<span class="Comment">//: way: put it all on a single line without indent, end the line with ') {'</span> +<span class="Comment">//: and no trailing whitespace. As long as functions uniformly start this</span> +<span class="Comment">//: way, our makefile contains a little command to automatically generate</span> +<span class="Comment">//: declarations for them.</span> +<span class="Delimiter">:(code)</span> +bool is_equal<span class="Delimiter">(</span>char* s<span class="Delimiter">,</span> const char* lit<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Identifier">return</span> strncmp<span class="Delimiter">(</span>s<span class="Delimiter">,</span> lit<span class="Delimiter">,</span> strlen<span class="Delimiter">(</span>lit<span class="Delimiter">))</span> == <span class="Constant">0</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> + +<span class="Delimiter">:(before "End Includes")</span> +<span class="PreProc">#include</span><span class="Constant"><assert.h></span> + +<span class="PreProc">#include</span><span class="Constant"><iostream></span> +using std::istream<span class="Delimiter">;</span> +using std::ostream<span class="Delimiter">;</span> +using std::iostream<span class="Delimiter">;</span> +using std::cin<span class="Delimiter">;</span> +using std::cout<span class="Delimiter">;</span> +using std::cerr<span class="Delimiter">;</span> + +<span class="PreProc">#include</span><span class="Constant"><cstring></span> +<span class="PreProc">#include</span><span class="Constant"><string></span> +using std::string<span class="Delimiter">;</span> +typedef size_t index_t<span class="Delimiter">;</span> +const index_t NOT_FOUND = string::npos<span class="Delimiter">;</span> +<span class="Delimiter">:(after "int main(int argc, char* argv[])")</span> +assert<span class="Delimiter">(</span>sizeof<span class="Delimiter">(</span>string::size_type<span class="Delimiter">)</span> == sizeof<span class="Delimiter">(</span>size_t<span class="Delimiter">));</span> +assert<span class="Delimiter">(</span>sizeof<span class="Delimiter">(</span>index_t<span class="Delimiter">)</span> == sizeof<span class="Delimiter">(</span>size_t<span class="Delimiter">));</span> +</pre> +</body> +</html> +<!-- vim: set foldmethod=manual : --> |