about summary refs log tree commit diff stats
path: root/html/411string.mu.html
diff options
context:
space:
mode:
Diffstat (limited to 'html/411string.mu.html')
-rw-r--r--html/411string.mu.html42
1 files changed, 21 insertions, 21 deletions
diff --git a/html/411string.mu.html b/html/411string.mu.html
index c552176e..03911fbb 100644
--- a/html/411string.mu.html
+++ b/html/411string.mu.html
@@ -1,35 +1,35 @@
-<!DOCTYPE html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html>
 <head>
-<meta charset="UTF-8">
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
 <title>Mu - 411string.mu</title>
-<meta name="Generator" content="Vim/8.2">
-<meta name="plugin-version" content="vim8.1_v2">
+<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=,use_input_for_pc=fallback">
+<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>
+<style type="text/css">
 <!--
 pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffd7; }
 body { font-size:12pt; font-family: monospace; color: #000000; background-color: #ffffd7; }
 a { color:inherit; }
 * { font-size:12pt; font-size: 1em; }
 .PreProc { color: #c000c0; }
-.CommentedCode { color: #8a8a8a; }
 .muRegEcx { color: #870000; }
+.Special { color: #ff6060; }
 .LineNr { }
 .muRegEsi { color: #005faf; }
-.muRegEdi { color: #00af00; }
 .Constant { color: #008787; }
+.muRegEdi { color: #00af00; }
+.CommentedCode { color: #8a8a8a; }
+.Delimiter { color: #c000c0; }
 .muFunction { color: #af5f00; text-decoration: underline; }
 .muTest { color: #5f8700; }
-.Delimiter { color: #c000c0; }
 .muComment { color: #005faf; }
-.Special { color: #ff6060; }
 -->
 </style>
 
-<script>
+<script type='text/javascript'>
 <!--
 
 /* function to open any folds containing a jumped-to line before jumping to it */
@@ -105,46 +105,46 @@ if ('onhashchange' in window) {
 <span id="L42" class="LineNr"> 42 </span>  <span class="PreProc">var</span> out-ah/<span class="muRegEdi">edi</span>: (addr handle array byte) <span class="Special">&lt;-</span> address out-h
 <span id="L43" class="LineNr"> 43 </span>  <span class="muComment"># prefix substrings</span>
 <span id="L44" class="LineNr"> 44 </span>  <a href='411string.mu.html#L2'>substring</a> <span class="Constant">0</span>, <span class="Constant">0</span>, <span class="Constant">3</span>, out-ah
-<span id="L45" class="LineNr"> 45 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L223'>lookup</a> *out-ah
+<span id="L45" class="LineNr"> 45 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L235'>lookup</a> *out-ah
 <span id="L46" class="LineNr"> 46 </span>  <a href='105string-equal.subx.html#L213'>check-strings-equal</a> out, <span class="Constant">&quot;&quot;</span>, <span class="Constant">&quot;F - <a href='411string.mu.html#L40'>test-substring</a>/null&quot;</span>
 <span id="L47" class="LineNr"> 47 </span>  <a href='411string.mu.html#L2'>substring</a> <span class="Constant">&quot;&quot;</span>, <span class="Constant">0</span>, <span class="Constant">3</span>, out-ah
-<span id="L48" class="LineNr"> 48 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L223'>lookup</a> *out-ah
+<span id="L48" class="LineNr"> 48 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L235'>lookup</a> *out-ah
 <span id="L49" class="LineNr"> 49 </span><span class="CommentedCode">#?   print-string-to-real-screen out</span>
 <span id="L50" class="LineNr"> 50 </span><span class="CommentedCode">#?   print-string-to-real-screen &quot;\n&quot;</span>
 <span id="L51" class="LineNr"> 51 </span>  <a href='105string-equal.subx.html#L213'>check-strings-equal</a> out, <span class="Constant">&quot;&quot;</span>, <span class="Constant">&quot;F - <a href='411string.mu.html#L40'>test-substring</a>/empty&quot;</span>
 <span id="L52" class="LineNr"> 52 </span>  <span class="muComment">#</span>
 <span id="L53" class="LineNr"> 53 </span>  <a href='411string.mu.html#L2'>substring</a> <span class="Constant">&quot;abcde&quot;</span>, <span class="Constant">0</span>, <span class="Constant">3</span>, out-ah
-<span id="L54" class="LineNr"> 54 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L223'>lookup</a> *out-ah
+<span id="L54" class="LineNr"> 54 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L235'>lookup</a> *out-ah
 <span id="L55" class="LineNr"> 55 </span><span class="CommentedCode">#?   print-string-to-real-screen out</span>
 <span id="L56" class="LineNr"> 56 </span><span class="CommentedCode">#?   print-string-to-real-screen &quot;\n&quot;</span>
 <span id="L57" class="LineNr"> 57 </span>  <a href='105string-equal.subx.html#L213'>check-strings-equal</a> out, <span class="Constant">&quot;abc&quot;</span>, <span class="Constant">&quot;F - <a href='411string.mu.html#L40'>test-substring</a>/truncate&quot;</span>
 <span id="L58" class="LineNr"> 58 </span>  <span class="muComment">#</span>
 <span id="L59" class="LineNr"> 59 </span>  <a href='411string.mu.html#L2'>substring</a> <span class="Constant">&quot;abcde&quot;</span>, <span class="Constant">0</span>, <span class="Constant">5</span>, out-ah
-<span id="L60" class="LineNr"> 60 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L223'>lookup</a> *out-ah
+<span id="L60" class="LineNr"> 60 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L235'>lookup</a> *out-ah
 <span id="L61" class="LineNr"> 61 </span>  <a href='105string-equal.subx.html#L213'>check-strings-equal</a> out, <span class="Constant">&quot;abcde&quot;</span>, <span class="Constant">&quot;F - <a href='411string.mu.html#L40'>test-substring</a>/all&quot;</span>
 <span id="L62" class="LineNr"> 62 </span>  <span class="muComment">#</span>
 <span id="L63" class="LineNr"> 63 </span>  <a href='411string.mu.html#L2'>substring</a> <span class="Constant">&quot;abcde&quot;</span>, <span class="Constant">0</span>, <span class="Constant">7</span>, out-ah
-<span id="L64" class="LineNr"> 64 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L223'>lookup</a> *out-ah
+<span id="L64" class="LineNr"> 64 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L235'>lookup</a> *out-ah
 <span id="L65" class="LineNr"> 65 </span>  <a href='105string-equal.subx.html#L213'>check-strings-equal</a> out, <span class="Constant">&quot;abcde&quot;</span>, <span class="Constant">&quot;F - <a href='411string.mu.html#L40'>test-substring</a>/too-small&quot;</span>
 <span id="L66" class="LineNr"> 66 </span>  <span class="muComment"># substrings outside string</span>
 <span id="L67" class="LineNr"> 67 </span>  <a href='411string.mu.html#L2'>substring</a> <span class="Constant">&quot;abcde&quot;</span>, <span class="Constant">6</span>, <span class="Constant">1</span>, out-ah
-<span id="L68" class="LineNr"> 68 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L223'>lookup</a> *out-ah
+<span id="L68" class="LineNr"> 68 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L235'>lookup</a> *out-ah
 <span id="L69" class="LineNr"> 69 </span>  <a href='105string-equal.subx.html#L213'>check-strings-equal</a> out, <span class="Constant">&quot;&quot;</span>, <span class="Constant">&quot;F - <a href='411string.mu.html#L40'>test-substring</a>/start-too-large&quot;</span>
 <span id="L70" class="LineNr"> 70 </span>  <span class="muComment"># trim prefix</span>
 <span id="L71" class="LineNr"> 71 </span>  <a href='411string.mu.html#L2'>substring</a> <span class="Constant">&quot;&quot;</span>, <span class="Constant">2</span>, <span class="Constant">3</span>, out-ah
-<span id="L72" class="LineNr"> 72 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L223'>lookup</a> *out-ah
+<span id="L72" class="LineNr"> 72 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L235'>lookup</a> *out-ah
 <span id="L73" class="LineNr"> 73 </span>  <a href='105string-equal.subx.html#L213'>check-strings-equal</a> out, <span class="Constant">&quot;&quot;</span>, <span class="Constant">&quot;F - <a href='411string.mu.html#L40'>test-substring</a>/middle-empty&quot;</span>
 <span id="L74" class="LineNr"> 74 </span>  <span class="muComment">#</span>
 <span id="L75" class="LineNr"> 75 </span>  <a href='411string.mu.html#L2'>substring</a> <span class="Constant">&quot;abcde&quot;</span>, <span class="Constant">1</span>, <span class="Constant">2</span>, out-ah
-<span id="L76" class="LineNr"> 76 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L223'>lookup</a> *out-ah
+<span id="L76" class="LineNr"> 76 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L235'>lookup</a> *out-ah
 <span id="L77" class="LineNr"> 77 </span>  <a href='105string-equal.subx.html#L213'>check-strings-equal</a> out, <span class="Constant">&quot;bc&quot;</span>, <span class="Constant">&quot;F - <a href='411string.mu.html#L40'>test-substring</a>/middle-truncate&quot;</span>
 <span id="L78" class="LineNr"> 78 </span>  <span class="muComment">#</span>
 <span id="L79" class="LineNr"> 79 </span>  <a href='411string.mu.html#L2'>substring</a> <span class="Constant">&quot;abcde&quot;</span>, <span class="Constant">1</span>, <span class="Constant">4</span>, out-ah
-<span id="L80" class="LineNr"> 80 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L223'>lookup</a> *out-ah
+<span id="L80" class="LineNr"> 80 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L235'>lookup</a> *out-ah
 <span id="L81" class="LineNr"> 81 </span>  <a href='105string-equal.subx.html#L213'>check-strings-equal</a> out, <span class="Constant">&quot;bcde&quot;</span>, <span class="Constant">&quot;F - <a href='411string.mu.html#L40'>test-substring</a>/middle-all&quot;</span>
 <span id="L82" class="LineNr"> 82 </span>  <span class="muComment">#</span>
 <span id="L83" class="LineNr"> 83 </span>  <a href='411string.mu.html#L2'>substring</a> <span class="Constant">&quot;abcde&quot;</span>, <span class="Constant">1</span>, <span class="Constant">5</span>, out-ah
-<span id="L84" class="LineNr"> 84 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L223'>lookup</a> *out-ah
+<span id="L84" class="LineNr"> 84 </span>  <span class="PreProc">var</span> out/eax: (addr array byte) <span class="Special">&lt;-</span> <a href='120allocate.subx.html#L235'>lookup</a> *out-ah
 <span id="L85" class="LineNr"> 85 </span>  <a href='105string-equal.subx.html#L213'>check-strings-equal</a> out, <span class="Constant">&quot;bcde&quot;</span>, <span class="Constant">&quot;F - <a href='411string.mu.html#L40'>test-substring</a>/middle-too-small&quot;</span>
 <span id="L86" class="LineNr"> 86 </span><span class="Delimiter">}</span>
 <span id="L87" class="LineNr"> 87 </span>
dient?h=main&id=88be3dbc0c996490dbac97538f4d712a5b4f6f07'>88be3dbc ^
717ab659 ^















0487a30e ^







b75e94b3 ^
717ab659 ^

dcfca05e ^
0487a30e ^


717ab659 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
                                                                         
                                       
 
                           



             
                               



                                         
                              
 
                                   







                                  
                           
                                                
                                   
                                    
                                                                                                 
 

                                                                                                                                

                                                       
 
                                    
 

                                             
                                        
                                                   

                                                
                                                                                                                       



                                                                                                                   
                                                              
   
        


                                                                                               
   

        
 
                              



















                                                                        
                                                              


        
                      















                                                                                     







                                                                                                                   
                                                              

        
                                                    


                                                                                                 



        
//: Calls can take ingredients just like primitives. To access a recipe's
//: ingredients, use 'next-ingredient'.

:(scenario next_ingredient)
recipe main [
  f 2:literal
]
recipe f [
  12:integer <- next-ingredient
  13:integer <- add 1:literal, 12:integer
]
+run: instruction f/1
+mem: location 12 is 2
+mem: storing 3 in location 13

:(scenario next_ingredient_missing)
recipe main [
  f
]
recipe f [
  _, 12:integer <- next-ingredient
]
+mem: storing 0 in location 12

:(before "End call Fields")
vector<vector<long long int> > ingredient_atoms;
index_t next_ingredient_to_process;
:(replace{} "call(recipe_number r)")
call(recipe_number r) :running_recipe(r), running_step_index(0), next_ingredient_to_process(0) {}

:(replace "Current_routine->calls.push(call(current_instruction().operation))" following "End Primitive Recipe Implementations")
call callee(current_instruction().operation);
for (size_t i = 0; i < ingredients.size(); ++i) {
  callee.ingredient_atoms.push_back(ingredients.at(i));
}
Current_routine->calls.push(callee);

:(before "End Primitive Recipe Declarations")
NEXT_INGREDIENT,
:(before "End Primitive Recipe Numbers")
Recipe_number["next-ingredient"] = NEXT_INGREDIENT;
:(before "End Primitive Recipe Implementations")
case NEXT_INGREDIENT: {
  if (Current_routine->calls.top().next_ingredient_to_process < Current_routine->calls.top().ingredient_atoms.size()) {
    products.push_back(
        Current_routine->calls.top().ingredient_atoms.at(Current_routine->calls.top().next_ingredient_to_process));
    assert(products.size() == 1);  products.resize(2);  // push a new vector
    products.at(1).push_back(1);
    ++Current_routine->calls.top().next_ingredient_to_process;
  }
  else {
    products.resize(2);
    products.at(0).push_back(0);  // todo: will fail noisily if we try to read a compound value
    products.at(1).push_back(0);
  }
  break;
}

:(scenario rewind_ingredients)
recipe main [
  f 2:literal
]
recipe f [
  12:integer <- next-ingredient  # consume ingredient
  _, 1:boolean <- next-ingredient  # will not find any ingredients
  rewind-ingredients
  13:integer, 2:boolean <- next-ingredient  # will find ingredient again
]
+mem: storing 2 in location 12
+mem: storing 0 in location 1
+mem: storing 2 in location 13
+mem: storing 1 in location 2

:(before "End Primitive Recipe Declarations")
REWIND_INGREDIENTS,
:(before "End Primitive Recipe Numbers")
Recipe_number["rewind-ingredients"] = REWIND_INGREDIENTS;
:(before "End Primitive Recipe Implementations")
case REWIND_INGREDIENTS: {
  Current_routine->calls.top().next_ingredient_to_process = 0;
  break;
}

:(scenario ingredient)
recipe main [
  f 1:literal, 2:literal
]
recipe f [
  12:integer <- ingredient 1:literal  # consume second ingredient first
  13:integer, 1:boolean <- next-ingredient  # next-ingredient tries to scan past that
]
+mem: storing 2 in location 12
+mem: storing 0 in location 1

:(before "End Primitive Recipe Declarations")
INGREDIENT,
:(before "End Primitive Recipe Numbers")
Recipe_number["ingredient"] = INGREDIENT;
:(before "End Primitive Recipe Implementations")
case INGREDIENT: {
  assert(isa_literal(current_instruction().ingredients.at(0)));
  assert(ingredients.at(0).size() == 1);  // scalar
  if (static_cast<index_t>(ingredients.at(0).at(0)) < Current_routine->calls.top().ingredient_atoms.size()) {
    Current_routine->calls.top().next_ingredient_to_process = ingredients.at(0).at(0);
    products.push_back(
        Current_routine->calls.top().ingredient_atoms.at(Current_routine->calls.top().next_ingredient_to_process));
    assert(products.size() == 1);  products.resize(2);  // push a new vector
    products.at(1).push_back(1);
    ++Current_routine->calls.top().next_ingredient_to_process;
  }
  else {
    if (current_instruction().products.size() > 1) {
      products.resize(2);
      products.at(0).push_back(0);  // todo: will fail noisily if we try to read a compound value
      products.at(1).push_back(0);
    }
  }
  break;
}