diff options
Diffstat (limited to 'html/046global.cc.html')
-rw-r--r-- | html/046global.cc.html | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/html/046global.cc.html b/html/046global.cc.html index c92132a0..6fce3f17 100644 --- a/html/046global.cc.html +++ b/html/046global.cc.html @@ -3,27 +3,35 @@ <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Mu - 046global.cc</title> -<meta name="Generator" content="Vim/7.3"> -<meta name="plugin-version" content="vim7.3_v6"> +<meta name="Generator" content="Vim/7.4"> +<meta name="plugin-version" content="vim7.4_v2"> <meta name="syntax" content="cpp"> -<meta name="settings" content="use_css"> +<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy="> +<meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { font-family: monospace; color: #eeeeee; background-color: #080808; } +pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } +* { font-size: 12pt; font-size: 1em; } +.Constant { color: #00a0a0; } .cSpecial { color: #008000; } -.Identifier { color: #fcb165; } .traceContains { color: #008000; } -.Normal { color: #eeeeee; background-color: #080808; } -.Special { color: #c00000; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } .Comment { color: #9090ff; } +.Delimiter { color: #800080; } +.Special { color: #c00000; } +.Identifier { color: #fcb165; } +.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } --> </style> + +<script type='text/javascript'> +<!-- + +--> +</script> </head> <body> -<pre> +<pre id='vimCodeElement'> <span class="Comment">//: So far we have local variables, and we can nest local variables of short</span> <span class="Comment">//: lifetimes inside longer ones. Now let's support 'global' variables that</span> <span class="Comment">//: last for the life of a routine. If we create multiple routines they won't</span> @@ -63,10 +71,10 @@ def main [ <span class="Comment">//: writes to this variable go to a field in the current routine</span> <span class="Delimiter">:(before "End routine Fields")</span> -<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> global_space<span class="Delimiter">;</span> +<span class="Normal">int</span> global_space<span class="Delimiter">;</span> <span class="Delimiter">:(before "End routine Constructor")</span> global_space = <span class="Constant">0</span><span class="Delimiter">;</span> -<span class="Delimiter">:(after "void write_memory(reagent x, vector<double> data)")</span> +<span class="Delimiter">:(after "void write_memory(reagent x, const vector<double>& data)")</span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>name == <span class="Constant">"global-space"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!scalar<span class="Delimiter">(</span>data<span class="Delimiter">)</span> || !x<span class="Delimiter">.</span>type @@ -87,7 +95,7 @@ global_space = <span class="Constant">0</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> <span class="Comment">//: now marking variables as /space:global looks them up inside this field</span> -<span class="Delimiter">:(after "long long int space_base(const reagent& x)")</span> +<span class="Delimiter">:(after "int space_base(const reagent& x)")</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_global<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Current_routine<span class="Delimiter">-></span>global_space<span class="Delimiter">)</span> raise << <span class="Constant">"routine has no global space</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> @@ -100,7 +108,7 @@ global_space = <span class="Constant">0</span><span class="Delimiter">;</span> <span class="Delimiter">:(scenario global_space_with_names)</span> def main [ global-space:address:shared:array:location<span class="Special"> <- </span><span class="Normal">new</span> location:type<span class="Delimiter">,</span> <span class="Constant">10</span> - x:number<span class="Special"> <- </span>copy <span class="Constant">23</span> + <span class="Normal">x</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span> <span class="Constant">1</span>:number/space:global<span class="Special"> <- </span>copy <span class="Constant">24</span> ] <span class="Comment"># don't complain about mixing numeric addresses and names</span> @@ -113,7 +121,7 @@ $error: <span class="Constant">0</span> <span class="Delimiter">:(code)</span> <span class="Normal">bool</span> is_global<span class="Delimiter">(</span><span class="Normal">const</span> reagent& x<span class="Delimiter">)</span> <span class="Delimiter">{</span> - <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>first == <span class="Constant">"space"</span><span class="Delimiter">)</span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>second && x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>second<span class="Delimiter">-></span>value == <span class="Constant">"global"</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -122,3 +130,4 @@ $error: <span class="Constant">0</span> </pre> </body> </html> +<!-- vim: set foldmethod=manual : --> |