diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-12-03 23:25:40 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-12-03 23:25:40 -0800 |
commit | 4a48bedcd1d708a43d43dc6259a4e45c52ea3d00 (patch) | |
tree | 85c1b7310cca932797d727a3de8da96eb175d8da | |
parent | ef7d834fdd826977cd8d43253052a7b8e1c5aa72 (diff) | |
download | mu-4a48bedcd1d708a43d43dc6259a4e45c52ea3d00.tar.gz |
4134 - 'input' = 'ingredient'
139 files changed, 1517 insertions, 1449 deletions
diff --git a/027call_ingredient.cc b/027call_ingredient.cc index ed0b8e5a..99d20b17 100644 --- a/027call_ingredient.cc +++ b/027call_ingredient.cc @@ -40,6 +40,7 @@ for (int i = 0; i < SIZE(ingredients); ++i) { NEXT_INGREDIENT, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "next-ingredient", NEXT_INGREDIENT); +put(Recipe_ordinal, "next-input", NEXT_INGREDIENT); :(before "End Primitive Recipe Checks") case NEXT_INGREDIENT: { if (!inst.ingredients.empty()) { @@ -112,6 +113,7 @@ def f [ REWIND_INGREDIENTS, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "rewind-ingredients", REWIND_INGREDIENTS); +put(Recipe_ordinal, "rewind-inputs", REWIND_INGREDIENTS); :(before "End Primitive Recipe Checks") case REWIND_INGREDIENTS: { break; @@ -137,6 +139,7 @@ def f [ INGREDIENT, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "ingredient", INGREDIENT); +put(Recipe_ordinal, "input", INGREDIENT); :(before "End Primitive Recipe Checks") case INGREDIENT: { if (SIZE(inst.ingredients) != 1) { diff --git a/028call_return.cc b/028call_return.cc index b9a1189c..c8c1bca6 100644 --- a/028call_return.cc +++ b/028call_return.cc @@ -29,6 +29,7 @@ RETURN, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "return", RETURN); put(Recipe_ordinal, "reply", RETURN); // synonym while teaching +put(Recipe_ordinal, "output", RETURN); // experiment :(before "End Primitive Recipe Checks") case RETURN: { break; // checks will be performed by a transform below diff --git a/053recipe_header.cc b/053recipe_header.cc index 16f30917..057234f9 100644 --- a/053recipe_header.cc +++ b/053recipe_header.cc @@ -176,7 +176,7 @@ for (long int i = 0; i < SIZE(caller.products); ++i) //: Rewrite 'load-ingredients' to instructions to create all reagents in the header. :(before "End Rewrite Instruction(curr, recipe result)") -if (curr.name == "load-ingredients") { +if (curr.name == "load-ingredients" || curr.name == "load-inputs") { curr.clear(); recipe_ordinal op = get(Recipe_ordinal, "next-ingredient-without-typechecking"); for (int i = 0; i < SIZE(result.ingredients); ++i) { diff --git a/059to_text.mu b/059to_text.mu index 520fab33..d45afb0a 100644 --- a/059to_text.mu +++ b/059to_text.mu @@ -8,14 +8,14 @@ # define it to be identical to 'to-text' by default def to-text-line x:_elem -> y:text [ local-scope - load-ingredients + load-inputs y <- to-text x ] # variant for arrays (since we can't pass them around otherwise) def array-to-text-line x:&:@:_elem -> y:text [ local-scope - load-ingredients + load-inputs y <- to-text *x ] @@ -33,7 +33,7 @@ scenario array-to-text-line-early-warning-for-static-dispatch [ # finally, a specialization for single characters def to-text c:char -> y:text [ local-scope - load-ingredients + load-inputs y <- new character:type, 1/capacity *y <- put-index *y, 0, c ] diff --git a/061text.mu b/061text.mu index 29529c12..c2c8915e 100644 --- a/061text.mu +++ b/061text.mu @@ -2,7 +2,7 @@ def equal a:text, b:text -> result:bool [ local-scope - load-ingredients + load-inputs an:num, bn:num <- copy a, b address-equal?:boolean <- equal an, bn return-if address-equal?, 1/true @@ -124,7 +124,7 @@ container buffer:_elem [ def new-buffer capacity:num -> result:&:buffer:_elem [ local-scope - load-ingredients + load-inputs result <- new {(buffer _elem): type} *result <- put *result, length:offset, 0 { @@ -139,7 +139,7 @@ def new-buffer capacity:num -> result:&:buffer:_elem [ def grow-buffer buf:&:buffer:_elem -> buf:&:buffer:_elem [ local-scope - load-ingredients + load-inputs # double buffer size olddata:&:@:_elem <- get *buf, data:offset oldlen:num <- length *olddata @@ -160,7 +160,7 @@ def grow-buffer buf:&:buffer:_elem -> buf:&:buffer:_elem [ def buffer-full? in:&:buffer:_elem -> result:bool [ local-scope - load-ingredients + load-inputs len:num <- get *in, length:offset s:&:@:_elem <- get *in, data:offset capacity:num <- length *s @@ -170,7 +170,7 @@ def buffer-full? in:&:buffer:_elem -> result:bool [ # most broadly applicable definition of append to a buffer def append buf:&:buffer:_elem, x:_elem -> buf:&:buffer:_elem [ local-scope - load-ingredients + load-inputs len:num <- get *buf, length:offset { # grow buffer if necessary @@ -188,7 +188,7 @@ def append buf:&:buffer:_elem, x:_elem -> buf:&:buffer:_elem [ # call to-text def append buf:&:buffer:char, x:_elem -> buf:&:buffer:char [ local-scope - load-ingredients + load-inputs text:text <- to-text x buf <- append buf, text ] @@ -196,7 +196,7 @@ def append buf:&:buffer:char, x:_elem -> buf:&:buffer:char [ # specialization for characters that is backspace-aware def append buf:&:buffer:char, c:char -> buf:&:buffer:char [ local-scope - load-ingredients + load-inputs len:num <- get *buf, length:offset { # backspace? just drop last character if it exists and return @@ -222,7 +222,7 @@ def append buf:&:buffer:char, c:char -> buf:&:buffer:char [ def append buf:&:buffer:_elem, t:&:@:_elem -> buf:&:buffer:_elem [ local-scope - load-ingredients + load-inputs len:num <- length *t i:num <- copy 0 { @@ -337,7 +337,7 @@ scenario append-to-buffer-of-non-characters [ def buffer-to-array in:&:buffer:_elem -> result:&:@:_elem [ local-scope - load-ingredients + load-inputs # propagate null buffer return-unless in, 0 len:num <- get *in, length:offset @@ -357,7 +357,7 @@ def buffer-to-array in:&:buffer:_elem -> result:&:@:_elem [ def blank? x:&:@:_elem -> result:bool [ local-scope - load-ingredients + load-inputs return-unless x, 1/true len:num <- length *x result <- equal len, 0 @@ -373,16 +373,16 @@ def blank? x:&:@:_elem -> result:bool [ # will never ever get used. def append first:text -> result:text [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 30 - # append first ingredient + # append first input { break-unless first buf <- append buf, first } - # append remaining ingredients + # append remaining inputs { - arg:text, arg-found?:bool <- next-ingredient + arg:text, arg-found?:bool <- next-input break-unless arg-found? loop-unless arg buf <- append buf, arg @@ -458,7 +458,7 @@ scenario replace-character-in-text [ def replace s:text, oldc:char, newc:char, from:num/optional -> s:text [ local-scope - load-ingredients + load-inputs len:num <- length *s i:num <- find-next s, oldc, from done?:bool <- greater-or-equal i, len @@ -519,13 +519,13 @@ scenario replace-all-characters [ # replace underscores in first with remaining args def interpolate template:text -> result:text [ local-scope - load-ingredients # consume just the template + load-inputs # consume just the template # compute result-len, space to allocate for result tem-len:num <- length *template result-len:num <- copy tem-len { - # while ingredients remain - a:text, arg-received?:bool <- next-ingredient + # while inputs remain + a:text, arg-received?:bool <- next-input break-unless arg-received? # result-len = result-len + arg.length - 1 (for the 'underscore' being replaced) a-len:num <- length *a @@ -533,15 +533,15 @@ def interpolate template:text -> result:text [ result-len <- subtract result-len, 1 loop } - rewind-ingredients - _ <- next-ingredient # skip template + rewind-inputs + _ <- next-input # skip template result <- new character:type, result-len # repeatedly copy sections of template and 'holes' into result result-idx:num <- copy 0 i:num <- copy 0 { # while arg received - a:text, arg-received?:bool <- next-ingredient + a:text, arg-received?:bool <- next-input break-unless arg-received? # copy template into result until '_' { @@ -633,7 +633,7 @@ scenario interpolate-at-end [ # result:bool <- space? c:char def space? c:char -> result:bool [ local-scope - load-ingredients + load-inputs # most common case first result <- equal c, 32/space return-if result @@ -694,7 +694,7 @@ def space? c:char -> result:bool [ def trim s:text -> result:text [ local-scope - load-ingredients + load-inputs len:num <- length *s # left trim: compute start start:num <- copy 0 @@ -804,7 +804,7 @@ scenario trim-newline-tab [ def find-next text:text, pattern:char, idx:num -> next-index:num [ local-scope - load-ingredients + load-inputs len:num <- length *text { eof?:bool <- greater-or-equal idx, len @@ -910,7 +910,7 @@ scenario text-find-next-second [ # fairly dumb algorithm def find-next text:text, pattern:text, idx:num -> next-index:num [ local-scope - load-ingredients + load-inputs first:char <- index *pattern, 0 # repeatedly check for match at current idx len:num <- length *text @@ -991,7 +991,7 @@ scenario find-next-suffix-match-2 [ # checks if pattern matches at index 'idx' def match-at text:text, pattern:text, idx:num -> result:bool [ local-scope - load-ingredients + load-inputs pattern-len:num <- length *pattern # check that there's space left for the pattern x:num <- length *text @@ -1122,7 +1122,7 @@ scenario match-at-inside-bounds-2 [ def split s:text, delim:char -> result:&:@:text [ local-scope - load-ingredients + load-inputs # empty text? return empty array len:num <- length *s { @@ -1254,7 +1254,7 @@ scenario text-split-empty-piece [ def split-first text:text, delim:char -> x:text, y:text [ local-scope - load-ingredients + load-inputs # empty text? return empty texts len:num <- length *text { @@ -1286,7 +1286,7 @@ scenario text-split-first [ def copy-range buf:text, start:num, end:num -> result:text [ local-scope - load-ingredients + load-inputs # if end is out of bounds, trim it len:num <- length *buf end:num <- min len, end @@ -1345,7 +1345,7 @@ scenario copy-range-out-of-bounds-2 [ def parse-whole-number in:text -> out:num, error?:bool [ local-scope - load-ingredients + load-inputs out <- copy 0 result:num <- copy 0 # temporary location i:num <- copy 0 @@ -1369,7 +1369,7 @@ def parse-whole-number in:text -> out:num, error?:bool [ # (contributed by Ella Couch) recipe character-code-to-digit character-code:number -> result:number, error?:boolean [ local-scope - load-ingredients + load-inputs result <- copy 0 error? <- lesser-than character-code, 48 # '0' return-if error? diff --git a/063array.mu b/063array.mu index 04e6e427..a56e87f0 100644 --- a/063array.mu +++ b/063array.mu @@ -18,20 +18,20 @@ def new-array -> result:&:@:_elem [ capacity:num <- copy 0 { # while read curr-value - curr-value:_elem, exists?:bool <- next-ingredient + curr-value:_elem, exists?:bool <- next-input break-unless exists? capacity <- add capacity, 1 loop } result <- new _elem:type, capacity - rewind-ingredients + rewind-inputs i:num <- copy 0 { # while read curr-value done?:bool <- greater-or-equal i, capacity break-if done? - curr-value:_elem, exists?:bool <- next-ingredient - assert exists?, [error in rewinding ingredients to new-array] + curr-value:_elem, exists?:bool <- next-input + assert exists?, [error in rewinding inputs to new-array] *result <- put-index *result, i, curr-value i <- add i, 1 loop @@ -43,13 +43,13 @@ def new-array -> result:&:@:_elem [ # (contributed by Caleb Couch) def fill array:&:@:num -> array:&:@:num [ local-scope - load-ingredients + load-inputs loopn:num <- copy 0 length:num <- length *array { length?:bool <- equal loopn, length break-if length? - object:num, arg-received?:bool <- next-ingredient + object:num, arg-received?:bool <- next-input break-unless arg-received? *array <- put-index *array, loopn, object loopn <- add loopn, 1 @@ -88,7 +88,7 @@ scenario fill-overwrites-existing-values [ ] ] -scenario fill-exits-gracefully-when-given-no-ingredients [ +scenario fill-exits-gracefully-when-given-no-inputs [ local-scope array:&:@:num <- new number:type, 3 run [ @@ -107,7 +107,7 @@ scenario fill-exits-gracefully-when-given-no-ingredients [ # (contributed by Caleb Couch) def swap array:&:@:num, index1:num, index2:num -> array:&:@:num [ local-scope - load-ingredients + load-inputs object1:num <- index *array, index1 object2:num <- index *array, index2 *array <- put-index *array, index1, object2 @@ -133,7 +133,7 @@ scenario swap-works [ # (contributed by Caleb Couch) def reverse array:&:@:_elem -> array:&:@:_elem [ local-scope - load-ingredients + load-inputs start:num <- copy 0 length:num <- length *array end:num <- subtract length, 1 diff --git a/064list.mu b/064list.mu index 1e10243a..6177e3f3 100644 --- a/064list.mu +++ b/064list.mu @@ -10,20 +10,20 @@ container list:_elem [ def push x:_elem, l:&:list:_elem -> result:&:list:_elem/contained-in:l [ local-scope - load-ingredients + load-inputs result <- new {(list _elem): type} *result <- merge x, l ] def first in:&:list:_elem -> result:_elem [ local-scope - load-ingredients + load-inputs result <- get *in, value:offset ] def rest in:&:list:_elem -> result:&:list:_elem/contained-in:in [ local-scope - load-ingredients + load-inputs result <- get *in, next:offset ] @@ -50,7 +50,7 @@ scenario list-handling [ def length l:&:list:_elem -> result:num [ local-scope - load-ingredients + load-inputs result <- copy 0 { break-unless l @@ -63,7 +63,7 @@ def length l:&:list:_elem -> result:num [ # insert 'x' after 'in' def insert x:_elem, in:&:list:_elem -> in:&:list:_elem [ local-scope - load-ingredients + load-inputs new-node:&:list:_elem <- new {(list _elem): type} *new-node <- put *new-node, value:offset, x next-node:&:list:_elem <- get *in, next:offset @@ -155,7 +155,7 @@ scenario inserting-after-start-of-list [ # pointers to the head are now invalid. def remove x:&:list:_elem/contained-in:in, in:&:list:_elem -> in:&:list:_elem [ local-scope - load-ingredients + load-inputs # if 'x' is null, return return-unless x next-node:&:list:_elem <- rest x @@ -265,7 +265,7 @@ scenario removing-from-singleton-list [ # (contributed by Caleb Couch) def reverse list:&:list:_elem temp:&:list:_elem/contained-in:result -> result:&:list:_elem [ local-scope - load-ingredients + load-inputs return-unless list, temp object:_elem <- first, list list <- rest list @@ -304,7 +304,7 @@ scenario stash-list [ def to-text in:&:list:_elem -> result:text [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 80 buf <- to-buffer in, buf result <- buffer-to-array buf @@ -313,7 +313,7 @@ def to-text in:&:list:_elem -> result:text [ # variant of 'to-text' which stops printing after a few elements (and so is robust to cycles) def to-text-line in:&:list:_elem -> result:text [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 80 buf <- to-buffer in, buf, 6 # max elements to display result <- buffer-to-array buf @@ -321,7 +321,7 @@ def to-text-line in:&:list:_elem -> result:text [ def to-buffer in:&:list:_elem, buf:&:buffer:char -> buf:&:buffer:char [ local-scope - load-ingredients + load-inputs { break-if in buf <- append buf, [[]] @@ -336,9 +336,9 @@ def to-buffer in:&:list:_elem, buf:&:buffer:char -> buf:&:buffer:char [ return-unless next buf <- append buf, [ -> ] # and recurse - remaining:num, optional-ingredient-found?:bool <- next-ingredient + remaining:num, optional-input-found?:bool <- next-input { - break-if optional-ingredient-found? + break-if optional-input-found? # unlimited recursion buf <- to-buffer next, buf return diff --git a/065duplex_list.mu b/065duplex_list.mu index 30552fb6..037cb923 100644 --- a/065duplex_list.mu +++ b/065duplex_list.mu @@ -8,7 +8,7 @@ container duplex-list:_elem [ def push x:_elem, in:&:duplex-list:_elem/contained-in:result -> result:&:duplex-list:_elem [ local-scope - load-ingredients + load-inputs result:&:duplex-list:_elem <- new {(duplex-list _elem): type} *result <- merge x, in, 0 return-unless in @@ -17,21 +17,21 @@ def push x:_elem, in:&:duplex-list:_elem/contained-in:result -> result:&:duplex- def first in:&:duplex-list:_elem -> result:_elem [ local-scope - load-ingredients + load-inputs return-unless in, 0 result <- get *in, value:offset ] def next in:&:duplex-list:_elem -> result:&:duplex-list:_elem/contained-in:in [ local-scope - load-ingredients + load-inputs return-unless in, 0 result <- get *in, next:offset ] def prev in:&:duplex-list:_elem -> result:&:duplex-list:_elem/contained-in:in [ local-scope - load-ingredients + load-inputs return-unless in, 0 result <- get *in, prev:offset return result @@ -81,7 +81,7 @@ scenario duplex-list-handling [ def length l:&:duplex-list:_elem -> result:num [ local-scope - load-ingredients + load-inputs result <- copy 0 { break-unless l @@ -94,7 +94,7 @@ def length l:&:duplex-list:_elem -> result:num [ # insert 'x' after 'in' def insert x:_elem, in:&:duplex-list:_elem -> in:&:duplex-list:_elem [ local-scope - load-ingredients + load-inputs new-node:&:duplex-list:_elem <- new {(duplex-list _elem): type} *new-node <- put *new-node, value:offset, x # save old next before changing it @@ -223,7 +223,7 @@ scenario inserting-after-start-of-duplex-list [ # pointers to the head are now invalid. def remove x:&:duplex-list:_elem/contained-in:in, in:&:duplex-list:_elem -> in:&:duplex-list:_elem [ local-scope - load-ingredients + load-inputs # if 'x' is null, return return-unless x next-node:&:duplex-list:_elem <- get *x, next:offset @@ -347,7 +347,7 @@ scenario removing-from-singleton-duplex-list [ def remove x:&:duplex-list:_elem/contained-in:in, n:num, in:&:duplex-list:_elem -> in:&:duplex-list:_elem [ local-scope - load-ingredients + load-inputs i:num <- copy 0 curr:&:duplex-list:_elem <- copy x { @@ -384,7 +384,7 @@ scenario removing-multiple-from-duplex-list [ # clean way to return the new head pointer. def remove-between start:&:duplex-list:_elem, end:&:duplex-list:_elem/contained-in:start -> start:&:duplex-list:_elem [ local-scope - load-ingredients + load-inputs next:&:duplex-list:_elem <- get *start, next:offset nothing-to-delete?:bool <- equal next, end return-if nothing-to-delete? @@ -524,7 +524,7 @@ scenario remove-range-to-end [ # insert list beginning at 'start' after 'in' def splice in:&:duplex-list:_elem, start:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ local-scope - load-ingredients + load-inputs return-unless in return-unless start end:&:duplex-list:_elem <- last start @@ -541,7 +541,7 @@ def splice in:&:duplex-list:_elem, start:&:duplex-list:_elem/contained-in:in -> # insert contents of 'new' after 'in' def insert in:&:duplex-list:_elem, new:&:@:_elem -> in:&:duplex-list:_elem [ local-scope - load-ingredients + load-inputs return-unless in return-unless new len:num <- length *new @@ -562,7 +562,7 @@ def insert in:&:duplex-list:_elem, new:&:@:_elem -> in:&:duplex-list:_elem [ def append in:&:duplex-list:_elem, new:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ local-scope - load-ingredients + load-inputs last:&:duplex-list:_elem <- last in *last <- put *last, next:offset, new return-unless new @@ -571,7 +571,7 @@ def append in:&:duplex-list:_elem, new:&:duplex-list:_elem/contained-in:in -> in def last in:&:duplex-list:_elem -> result:&:duplex-list:_elem [ local-scope - load-ingredients + load-inputs result <- copy in { next:&:duplex-list:_elem <- next result @@ -584,7 +584,7 @@ def last in:&:duplex-list:_elem -> result:&:duplex-list:_elem [ # does a duplex list start with a certain sequence of elements? def match x:&:duplex-list:_elem, y:&:@:_elem -> result:bool [ local-scope - load-ingredients + load-inputs i:num <- copy 0 max:num <- length *y { @@ -629,7 +629,7 @@ scenario duplex-list-match [ # helper for debugging def dump-from x:&:duplex-list:_elem [ local-scope - load-ingredients + load-inputs $print x, [: ] { break-unless x @@ -662,7 +662,7 @@ scenario stash-duplex-list [ def to-text in:&:duplex-list:_elem -> result:text [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 80 buf <- to-buffer in, buf result <- buffer-to-array buf @@ -671,7 +671,7 @@ def to-text in:&:duplex-list:_elem -> result:text [ # variant of 'to-text' which stops printing after a few elements (and so is robust to cycles) def to-text-line in:&:duplex-list:_elem -> result:text [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 80 buf <- to-buffer in, buf, 6 # max elements to display result <- buffer-to-array buf @@ -679,7 +679,7 @@ def to-text-line in:&:duplex-list:_elem -> result:text [ def to-buffer in:&:duplex-list:_elem, buf:&:buffer:char -> buf:&:buffer:char [ local-scope - load-ingredients + load-inputs { break-if in buf <- append buf, [[]] @@ -694,9 +694,9 @@ def to-buffer in:&:duplex-list:_elem, buf:&:buffer:char -> buf:&:buffer:char [ return-unless next buf <- append buf, [ <-> ] # and recurse - remaining:num, optional-ingredient-found?:bool <- next-ingredient + remaining:num, optional-input-found?:bool <- next-input { - break-if optional-ingredient-found? + break-if optional-input-found? # unlimited recursion buf <- to-buffer next, buf return diff --git a/066stream.mu b/066stream.mu index 9c7824dd..6d5d0520 100644 --- a/066stream.mu +++ b/066stream.mu @@ -6,7 +6,7 @@ container stream:_elem [ def new-stream s:&:@:_elem -> result:&:stream:_elem [ local-scope - load-ingredients + load-inputs return-unless s, 0/null result <- new {(stream _elem): type} *result <- put *result, index:offset, 0 @@ -15,14 +15,14 @@ def new-stream s:&:@:_elem -> result:&:stream:_elem [ def rewind in:&:stream:_elem -> in:&:stream:_elem [ local-scope - load-ingredients + load-inputs return-unless in *in <- put *in, index:offset, 0 ] def read in:&:stream:_elem -> result:_elem, empty?:bool, in:&:stream:_elem [ local-scope - load-ingredients + load-inputs assert in, [cannot read; stream has no data] empty? <- copy 0/false idx:num <- get *in, index:offset @@ -41,7 +41,7 @@ def read in:&:stream:_elem -> result:_elem, empty?:bool, in:&:stream:_elem [ def peek in:&:stream:_elem -> result:_elem, empty?:bool [ local-scope - load-ingredients + load-inputs assert in, [cannot peek; stream has no data] empty?:bool <- copy 0/false idx:num <- get *in, index:offset @@ -58,7 +58,7 @@ def peek in:&:stream:_elem -> result:_elem, empty?:bool [ def read-line in:&:stream:char -> result:text, in:&:stream:char [ local-scope - load-ingredients + load-inputs assert in, [cannot read-line; stream has no data] idx:num <- get *in, index:offset s:text <- get *in, data:offset @@ -71,7 +71,7 @@ def read-line in:&:stream:char -> result:text, in:&:stream:char [ def end-of-stream? in:&:stream:_elem -> result:bool [ local-scope - load-ingredients + load-inputs assert in, [cannot check end-of-stream?; stream has no data] idx:num <- get *in, index:offset s:&:@:_elem <- get *in, data:offset diff --git a/068random.mu b/068random.mu index f13df4f2..78c059de 100644 --- a/068random.mu +++ b/068random.mu @@ -1,6 +1,6 @@ def random generator:&:stream:num -> result:num, fail?:bool, generator:&:stream:num [ local-scope - load-ingredients + load-inputs { break-if generator # generator is 0? use real random-number generator @@ -13,20 +13,20 @@ def random generator:&:stream:num -> result:num, fail?:bool, generator:&:stream: # helper for tests def assume-random-numbers -> result:&:stream:num [ local-scope - load-ingredients + load-inputs # compute result-len, space to allocate in result result-len:num <- copy 0 { - _, arg-received?:bool <- next-ingredient + _, arg-received?:bool <- next-input break-unless arg-received? result-len <- add result-len, 1 loop } - rewind-ingredients + rewind-inputs result-data:&:@:num <- new number:type, result-len idx:num <- copy 0 { - curr:num, arg-received?:bool <- next-ingredient + curr:num, arg-received?:bool <- next-input break-unless arg-received? *result-data <- put-index *result-data, idx, curr idx <- add idx, 1 @@ -57,7 +57,7 @@ scenario random-numbers-in-scenario [ # generate a random integer in the semi-open interval [start, end) def random-in-range generator:&:stream:num, start:num, end:num -> result:num, fail?:bool, generator:&:stream:num [ local-scope - load-ingredients + load-inputs result, fail?, generator <- random generator return-if fail? delta:num <- subtract end, start diff --git a/070table.mu b/070table.mu index f82bb9c7..a4ec5afb 100644 --- a/070table.mu +++ b/070table.mu @@ -55,7 +55,7 @@ container table-row:_key:_value [ def new-table capacity:num -> result:&:table:_key:_value [ local-scope - load-ingredients + load-inputs result <- new {(table _key _value): type} data:&:@:table-row:_key:_value <- new {(table-row _key _value): type}, capacity *result <- merge 0/length, capacity, data @@ -65,7 +65,7 @@ def new-table capacity:num -> result:&:table:_key:_value [ # then we could handle conflicts simply by resizing the table def put-index table:&:table:_key:_value, key:_key, value:_value -> table:&:table:_key:_value [ local-scope - load-ingredients + load-inputs hash:num <- hash key hash <- abs hash capacity:num <- get *table, capacity:offset @@ -82,7 +82,7 @@ def put-index table:&:table:_key:_value, key:_key, value:_value -> table:&:table def index table:&:table:_key:_value, key:_key -> result:_value, found?:bool [ local-scope - load-ingredients + load-inputs hash:num <- hash key hash <- abs hash capacity:num <- get *table, capacity:offset @@ -102,7 +102,7 @@ def index table:&:table:_key:_value, key:_key -> result:_value, found?:bool [ def abs n:num -> result:num [ local-scope - load-ingredients + load-inputs positive?:bool <- greater-or-equal n, 0 return-if positive?, n result <- multiply n, -1 diff --git a/075channel.mu b/075channel.mu index 72fa0a6c..1f8248ef 100644 --- a/075channel.mu +++ b/075channel.mu @@ -10,9 +10,9 @@ # addresses from being shared between routines, and therefore eliminates all # possibility of race conditions. # -# There's still a narrow window for race conditions: the ingredients passed in +# There's still a narrow window for race conditions: the inputs passed in # to 'start-running'. Pass only channels into routines and you should be fine. -# Any other mutable ingredients will require locks. +# Any other mutable inputs will require locks. scenario channel [ run [ @@ -50,7 +50,7 @@ container sink:_elem [ def new-channel capacity:num -> in:&:source:_elem, out:&:sink:_elem [ local-scope - load-ingredients + load-inputs result:&:channel:_elem <- new {(channel _elem): type} *result <- put *result, first-full:offset, 0 *result <- put *result, first-free:offset, 0 @@ -66,7 +66,7 @@ def new-channel capacity:num -> in:&:source:_elem, out:&:sink:_elem [ # write a value to a channel def write out:&:sink:_elem, val:_elem -> out:&:sink:_elem [ local-scope - load-ingredients + load-inputs assert out, [write to null channel] chan:&:channel:_elem <- get *out, chan:offset <channel-write-initial> @@ -112,7 +112,7 @@ def write out:&:sink:_elem, val:_elem -> out:&:sink:_elem [ # read a value from a channel def read in:&:source:_elem -> result:_elem, eof?:bool, in:&:source:_elem [ local-scope - load-ingredients + load-inputs assert in, [read on null channel] eof? <- copy 0/false # default result chan:&:channel:_elem <- get *in, chan:offset @@ -311,7 +311,7 @@ scenario channel-clear [ def clear in:&:source:_elem -> in:&:source:_elem [ local-scope - load-ingredients + load-inputs chan:&:channel:_elem <- get *in, chan:offset { empty?:bool <- channel-empty? chan @@ -333,13 +333,13 @@ container channel:_elem [ # both routines can modify the 'closed?' bit, but they can only ever set it, so this is a benign race def close x:&:source:_elem -> x:&:source:_elem [ local-scope - load-ingredients + load-inputs chan:&:channel:_elem <- get *x, chan:offset *chan <- put *chan, closed?:offset, 1/true ] def close x:&:sink:_elem -> x:&:sink:_elem [ local-scope - load-ingredients + load-inputs chan:&:channel:_elem <- get *x, chan:offset *chan <- put *chan, closed?:offset, 1/true ] @@ -369,7 +369,7 @@ after <channel-read-empty> [ # An empty channel has first-free and first-full both at the same value. def channel-empty? chan:&:channel:_elem -> result:bool [ local-scope - load-ingredients + load-inputs # return chan.first-full == chan.first-free full:num <- get *chan, first-full:offset free:num <- get *chan, first-free:offset @@ -380,7 +380,7 @@ def channel-empty? chan:&:channel:_elem -> result:bool [ # (Other alternatives: https://www.snellman.net/blog/archive/2016-12-13-ring-buffers) def channel-full? chan:&:channel:_elem -> result:bool [ local-scope - load-ingredients + load-inputs # tmp = chan.first-free + 1 tmp:num <- get *chan, first-free:offset tmp <- add tmp, 1 @@ -398,7 +398,7 @@ def channel-full? chan:&:channel:_elem -> result:bool [ def capacity chan:&:channel:_elem -> result:num [ local-scope - load-ingredients + load-inputs q:&:@:_elem <- get *chan, data:offset result <- length *q ] @@ -407,7 +407,7 @@ def capacity chan:&:channel:_elem -> result:num [ def buffer-lines in:&:source:char, buffered-out:&:sink:char -> buffered-out:&:sink:char, in:&:source:char [ local-scope - load-ingredients + load-inputs # repeat forever eof?:bool <- copy 0/false { @@ -506,7 +506,7 @@ F buffer-lines-blocks-until-newline: channel should contain data after writing n def drain source:&:source:char -> result:text, source:&:source:char [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 30 { c:char, done?:bool <- read source diff --git a/081print.mu b/081print.mu index e1ea6069..50b6485a 100644 --- a/081print.mu +++ b/081print.mu @@ -31,7 +31,7 @@ container screen-cell [ def new-fake-screen w:num, h:num -> result:&:screen [ local-scope - load-ingredients + load-inputs result <- new screen:type non-zero-width?:bool <- greater-than w, 0 assert non-zero-width?, [screen can't have zero width] @@ -45,7 +45,7 @@ def new-fake-screen w:num, h:num -> result:&:screen [ def clear-screen screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [clear-screen] { break-if screen @@ -73,7 +73,7 @@ def clear-screen screen:&:screen -> screen:&:screen [ def fake-screen-is-empty? screen:&:screen -> result:bool [ local-scope - load-ingredients + load-inputs #? stash [fake-screen-is-empty?] return-unless screen, 1/true # do nothing for real screens buf:&:@:screen-cell <- get *screen, data:offset @@ -94,14 +94,14 @@ def fake-screen-is-empty? screen:&:screen -> result:bool [ def print screen:&:screen, c:char -> screen:&:screen [ local-scope - load-ingredients - color:num, color-found?:bool <- next-ingredient + load-inputs + color:num, color-found?:bool <- next-input { # default color to white break-if color-found? color <- copy 7/white } - bg-color:num, bg-color-found?:bool <- next-ingredient + bg-color:num, bg-color-found?:bool <- next-input { # default bg-color to black break-if bg-color-found? @@ -205,7 +205,7 @@ def print screen:&:screen, c:char -> screen:&:screen [ def cursor-down-on-fake-screen screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [cursor-down] row:num <- get *screen, cursor-row:offset height:num <- get *screen, num-rows:offset @@ -224,7 +224,7 @@ def cursor-down-on-fake-screen screen:&:screen -> screen:&:screen [ def scroll-fake-screen screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [scroll-fake-screen] width:num <- get *screen, num-columns:offset height:num <- get *screen, num-rows:offset @@ -252,7 +252,7 @@ def scroll-fake-screen screen:&:screen -> screen:&:screen [ # while accounting for scrolling (sliding top-idx) def data-index row:num, column:num, width:num, height:num, top-idx:num -> result:num [ local-scope - load-ingredients + load-inputs { overflow?:bool <- greater-or-equal row, height break-unless overflow? @@ -508,13 +508,13 @@ scenario print-character-at-bottom-right [ # these helpers help check for scrolling at development time def save-top-idx screen:&:screen -> result:num [ local-scope - load-ingredients + load-inputs return-unless screen, 0 # check is only for fake screens result <- get *screen, top-idx:offset ] def assert-no-scroll screen:&:screen, old-top-idx:num [ local-scope - load-ingredients + load-inputs return-unless screen new-top-idx:num <- get *screen, top-idx:offset no-scroll?:bool <- equal old-top-idx, new-top-idx @@ -523,7 +523,7 @@ def assert-no-scroll screen:&:screen, old-top-idx:num [ def clear-line screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [clear-line] space:char <- copy 0/nul { @@ -552,14 +552,14 @@ def clear-line screen:&:screen -> screen:&:screen [ # only for non-scrolling apps def clear-line-until screen:&:screen, right:num/inclusive -> screen:&:screen [ local-scope - load-ingredients + load-inputs row:num, column:num <- cursor-position screen #? stash [clear-line-until] row column height:num <- screen-height screen past-bottom?:bool <- greater-or-equal row, height return-if past-bottom? space:char <- copy 32/space - bg-color:num, bg-color-found?:bool <- next-ingredient + bg-color:num, bg-color-found?:bool <- next-input { # default bg-color to black break-if bg-color-found? @@ -576,7 +576,7 @@ def clear-line-until screen:&:screen, right:num/inclusive -> screen:&:screen [ def cursor-position screen:&:screen -> row:num, column:num [ local-scope - load-ingredients + load-inputs { break-if screen # real screen @@ -590,7 +590,7 @@ def cursor-position screen:&:screen -> row:num, column:num [ def move-cursor screen:&:screen, new-row:num, new-column:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [move-cursor] new-row new-column { break-if screen @@ -644,7 +644,7 @@ scenario clear-line-erases-printed-characters [ def cursor-down screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [cursor-down] { break-if screen @@ -687,7 +687,7 @@ scenario cursor-down-scrolls [ def cursor-up screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [cursor-up] { break-if screen @@ -705,7 +705,7 @@ def cursor-up screen:&:screen -> screen:&:screen [ def cursor-right screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [cursor-right] { break-if screen @@ -725,7 +725,7 @@ def cursor-right screen:&:screen -> screen:&:screen [ def cursor-left screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [cursor-left] { break-if screen @@ -743,7 +743,7 @@ def cursor-left screen:&:screen -> screen:&:screen [ def cursor-to-start-of-line screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [cursor-to-start-of-line] row:num <- cursor-position screen screen <- move-cursor screen, row, 0/column @@ -751,7 +751,7 @@ def cursor-to-start-of-line screen:&:screen -> screen:&:screen [ def cursor-to-next-line screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [cursor-to-next-line] screen <- cursor-down screen screen <- cursor-to-start-of-line screen @@ -759,7 +759,7 @@ def cursor-to-next-line screen:&:screen -> screen:&:screen [ def move-cursor-to-column screen:&:screen, column:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs row:num, _ <- cursor-position screen #? stash [move-cursor-to-column] row move-cursor screen, row, column @@ -767,7 +767,7 @@ def move-cursor-to-column screen:&:screen, column:num -> screen:&:screen [ def screen-width screen:&:screen -> width:num [ local-scope - load-ingredients + load-inputs #? stash [screen-width] { break-unless screen @@ -781,7 +781,7 @@ def screen-width screen:&:screen -> width:num [ def screen-height screen:&:screen -> height:num [ local-scope - load-ingredients + load-inputs #? stash [screen-height] { break-unless screen @@ -795,14 +795,14 @@ def screen-height screen:&:screen -> height:num [ def print screen:&:screen, s:text -> screen:&:screen [ local-scope - load-ingredients - color:num, color-found?:bool <- next-ingredient + load-inputs + color:num, color-found?:bool <- next-input { # default color to white break-if color-found? color <- copy 7/white } - bg-color:num, bg-color-found?:bool <- next-ingredient + bg-color:num, bg-color-found?:bool <- next-input { # default bg-color to black break-if bg-color-found? @@ -851,14 +851,14 @@ scenario print-text-wraps-past-right-margin [ def print screen:&:screen, n:num -> screen:&:screen [ local-scope - load-ingredients - color:num, color-found?:bool <- next-ingredient + load-inputs + color:num, color-found?:bool <- next-input { # default color to white break-if color-found? color <- copy 7/white } - bg-color:num, bg-color-found?:bool <- next-ingredient + bg-color:num, bg-color-found?:bool <- next-input { # default bg-color to black break-if bg-color-found? @@ -871,14 +871,14 @@ def print screen:&:screen, n:num -> screen:&:screen [ def print screen:&:screen, n:bool -> screen:&:screen [ local-scope - load-ingredients - color:num, color-found?:bool <- next-ingredient + load-inputs + color:num, color-found?:bool <- next-input { # default color to white break-if color-found? color <- copy 7/white } - bg-color:num, bg-color-found?:bool <- next-ingredient + bg-color:num, bg-color-found?:bool <- next-input { # default bg-color to black break-if bg-color-found? @@ -890,14 +890,14 @@ def print screen:&:screen, n:bool -> screen:&:screen [ def print screen:&:screen, n:&:_elem -> screen:&:screen [ local-scope - load-ingredients - color:num, color-found?:bool <- next-ingredient + load-inputs + color:num, color-found?:bool <- next-input { # default color to white break-if color-found? color <- copy 7/white } - bg-color:num, bg-color-found?:bool <- next-ingredient + bg-color:num, bg-color-found?:bool <- next-input { # default bg-color to black break-if bg-color-found? diff --git a/084console.mu b/084console.mu index 9f55ca91..6aee5702 100644 --- a/084console.mu +++ b/084console.mu @@ -27,14 +27,14 @@ container console [ def new-fake-console events:&:@:event -> result:&:console [ local-scope - load-ingredients + load-inputs result:&:console <- new console:type *result <- put *result, events:offset, events ] def read-event console:&:console -> result:event, found?:bool, quit?:bool, console:&:console [ local-scope - load-ingredients + load-inputs { break-unless console current-event-index:num <- get *console, current-event-index:offset @@ -61,7 +61,7 @@ def read-event console:&:console -> result:event, found?:bool, quit?:bool, conso # newlines, tabs, ctrl-d.. def read-key console:&:console -> result:char, found?:bool, quit?:bool, console:&:console [ local-scope - load-ingredients + load-inputs x:event, found?:bool, quit?:bool, console <- read-event console return-if quit?, 0, found?, quit? return-unless found?, 0, found?, quit? @@ -72,7 +72,7 @@ def read-key console:&:console -> result:char, found?:bool, quit?:bool, console: def send-keys-to-channel console:&:console, chan:&:sink:char, screen:&:screen -> console:&:console, chan:&:sink:char, screen:&:screen [ local-scope - load-ingredients + load-inputs { c:char, found?:bool, quit?:bool, console <- read-key console loop-unless found? @@ -87,7 +87,7 @@ def send-keys-to-channel console:&:console, chan:&:sink:char, screen:&:screen -> def wait-for-event console:&:console -> console:&:console [ local-scope - load-ingredients + load-inputs { _, found?:bool <- read-event console break-if found? @@ -98,7 +98,7 @@ def wait-for-event console:&:console -> console:&:console [ def has-more-events? console:&:console -> result:bool [ local-scope - load-ingredients + load-inputs return-if console, 0/false # fake events are processed as soon as they arrive result <- interactions-left? ] diff --git a/088file.mu b/088file.mu index f851acae..a7a3ba77 100644 --- a/088file.mu +++ b/088file.mu @@ -20,7 +20,7 @@ container resource [ def start-reading resources:&:resources, filename:text -> contents:&:source:char, error?:bool [ local-scope - load-ingredients + load-inputs error? <- copy 0/false { break-unless resources @@ -37,7 +37,7 @@ def start-reading resources:&:resources, filename:text -> contents:&:source:char def slurp resources:&:resources, filename:text -> contents:text, error?:bool [ local-scope - load-ingredients + load-inputs source:&:source:char, error?:bool <- start-reading resources, filename return-if error?, 0/contents buf:&:buffer:char <- new-buffer 30/capacity @@ -52,7 +52,7 @@ def slurp resources:&:resources, filename:text -> contents:text, error?:bool [ def start-reading-from-fake-resource resources:&:resources, resource:text -> contents:&:source:char, error?:bool [ local-scope - load-ingredients + load-inputs error? <- copy 0/no-error i:num <- copy 0 data:&:@:resource <- get *resources, data:offset @@ -75,7 +75,7 @@ def start-reading-from-fake-resource resources:&:resources, resource:text -> con def receive-from-file file:num, sink:&:sink:char -> sink:&:sink:char [ local-scope - load-ingredients + load-inputs { c:char, eof?:bool <- $read-from-file file break-if eof? @@ -88,7 +88,7 @@ def receive-from-file file:num, sink:&:sink:char -> sink:&:sink:char [ def receive-from-text contents:text, sink:&:sink:char -> sink:&:sink:char [ local-scope - load-ingredients + load-inputs i:num <- copy 0 len:num <- length *contents { @@ -104,7 +104,7 @@ def receive-from-text contents:text, sink:&:sink:char -> sink:&:sink:char [ def start-writing resources:&:resources, filename:text -> sink:&:sink:char, routine-id:num, error?:bool [ local-scope - load-ingredients + load-inputs error? <- copy 0/false source:&:source:char, sink:&:sink:char <- new-channel 30 { @@ -126,7 +126,7 @@ def start-writing resources:&:resources, filename:text -> sink:&:sink:char, rout def dump resources:&:resources, filename:text, contents:text -> resources:&:resources, error?:bool [ local-scope - load-ingredients + load-inputs # todo: really create an empty file return-unless contents, resources, 0/no-error sink-file:&:sink:char, write-routine:num, error?:bool <- start-writing resources, filename @@ -149,7 +149,7 @@ def dump resources:&:resources, filename:text, contents:text -> resources:&:reso def transmit-to-file file:num, source:&:source:char -> source:&:source:char [ local-scope - load-ingredients + load-inputs { c:char, done?:bool, source <- read source break-if done? @@ -161,7 +161,7 @@ def transmit-to-file file:num, source:&:source:char -> source:&:source:char [ def transmit-to-fake-resource resources:&:resources, filename:text, source:&:source:char -> resources:&:resources, source:&:source:char [ local-scope - load-ingredients + load-inputs lock:location <- get-location *resources, lock:offset wait-for-reset-then-set lock # compute new file contents diff --git a/092socket.mu b/092socket.mu index 1cf6930a..be4e5bb2 100644 --- a/092socket.mu +++ b/092socket.mu @@ -25,7 +25,7 @@ F - example-server-test: $open-server-socket failed] # helper just for this scenario def example-handler query:text -> response:text [ local-scope - load-ingredients + load-inputs return [abc] ] @@ -54,7 +54,7 @@ type request-handler = (recipe text -> text) def serve-one-request socket:num, request-handler:request-handler -> socket:num [ local-scope - load-ingredients + load-inputs session:num <- $accept socket assert session, [ F - example-server-test: $accept failed] @@ -68,9 +68,9 @@ F - example-server-test: $accept failed] def start-reading-from-network resources:&:resources, uri:text -> contents:&:source:char [ local-scope - load-ingredients + load-inputs { - port:num, port-found?:boolean <- next-ingredient + port:num, port-found?:boolean <- next-input break-if port-found? port <- copy 80/http-port } @@ -92,7 +92,7 @@ def start-reading-from-network resources:&:resources, uri:text -> contents:&:sou def request-socket socket:num, s:text -> socket:num [ local-scope - load-ingredients + load-inputs write-to-socket socket, s $write-to-socket socket, 13/cr $write-to-socket socket, 10/lf @@ -103,7 +103,7 @@ def request-socket socket:num, s:text -> socket:num [ def receive-from-socket socket:num, sink:&:sink:char -> sink:&:sink:char, socket:num [ local-scope - load-ingredients + load-inputs { +next-attempt c:char, found?:bool, eof?:bool, error:num <- $read-from-socket socket @@ -124,14 +124,14 @@ def receive-from-socket socket:num, sink:&:sink:char -> sink:&:sink:char, socket def receive-from-client-socket-and-close socket:num, sink:&:sink:char -> sink:&:sink:char, socket:num [ local-scope - load-ingredients + load-inputs sink <- receive-from-socket socket, sink socket <- $close-socket socket ] def write-to-socket socket:num, s:text [ local-scope - load-ingredients + load-inputs len:num <- length *s i:num <- copy 0 { @@ -147,7 +147,7 @@ def write-to-socket socket:num, s:text [ # like split-first, but don't eat the delimiter def split-at text:text, delim:char -> x:text, y:text [ local-scope - load-ingredients + load-inputs # empty text? return empty texts len:num <- length *text { diff --git a/channel.mu b/channel.mu index 66d0be79..4a553148 100644 --- a/channel.mu +++ b/channel.mu @@ -3,7 +3,7 @@ def producer sink:&:sink:char -> sink:&:sink:char [ # produce characters 1 to 5 on a channel local-scope - load-ingredients + load-inputs # n = 0 n:char <- copy 0 { @@ -22,7 +22,7 @@ def producer sink:&:sink:char -> sink:&:sink:char [ def consumer source:&:source:char -> source:&:source:char [ # consume and print integers from a channel local-scope - load-ingredients + load-inputs { # read an integer from the channel n:char, eof?:bool, source <- read source diff --git a/chessboard.mu b/chessboard.mu index 27e16fd8..c8ca6ba5 100644 --- a/chessboard.mu +++ b/chessboard.mu @@ -6,7 +6,7 @@ def main [ open-console # take control of screen, keyboard and mouse clear-screen 0/screen # non-scrolling app - # The chessboard function takes keyboard and screen objects as 'ingredients'. + # The chessboard function takes keyboard and screen objects as inputs. # # In Mu it is good form (though not required) to explicitly state what # hardware a function needs. @@ -68,7 +68,7 @@ type board = &:@:&:@:char # a 2-D array of arrays of characters def chessboard screen:&:screen, console:&:console -> screen:&:screen, console:&:console [ local-scope - load-ingredients + load-inputs board:board <- initial-position # hook up stdin stdin-in:&:source:char, stdin-out:&:sink:char <- new-channel 10/capacity @@ -106,7 +106,7 @@ def chessboard screen:&:screen, console:&:console -> screen:&:screen, console:&: def new-board initial-position:&:@:char -> board:board [ local-scope - load-ingredients + load-inputs # assert(length(initial-position) == 64) len:num <- length *initial-position correct-length?:bool <- equal len, 64 @@ -126,7 +126,7 @@ def new-board initial-position:&:@:char -> board:board [ def new-file position:&:@:char, index:num -> result:&:@:char [ local-scope - load-ingredients + load-inputs index <- multiply index, 8 result <- new character:type, 8 row:num <- copy 0 @@ -143,7 +143,7 @@ def new-file position:&:@:char, index:num -> result:&:@:char [ def print-board screen:&:screen, board:board -> screen:&:screen [ local-scope - load-ingredients + load-inputs row:num <- copy 7 # start printing from the top of the board space:char <- copy 32/space # print each row @@ -237,7 +237,7 @@ container move [ # prints only error messages to screen def read-move stdin:&:source:char, screen:&:screen -> result:&:move, quit?:bool, error?:bool, stdin:&:source:char, screen:&:screen [ local-scope - load-ingredients + load-inputs from-file:num, quit?:bool, error?:bool <- read-file stdin, screen return-if quit?, 0/dummy return-if error?, 0/dummy @@ -265,7 +265,7 @@ def read-move stdin:&:source:char, screen:&:screen -> result:&:move, quit?:bool, # valid values for file: 0-7 def read-file stdin:&:source:char, screen:&:screen -> file:num, quit:bool, error:bool, stdin:&:source:char, screen:&:screen [ local-scope - load-ingredients + load-inputs c:char, eof?:bool, stdin <- read stdin return-if eof?, 0/dummy, 1/quit, 0/error q-pressed?:bool <- equal c, 81/Q @@ -303,7 +303,7 @@ def read-file stdin:&:source:char, screen:&:screen -> file:num, quit:bool, error # valid values for rank: 0-7 def read-rank stdin:&:source:char, screen:&:screen -> rank:num, quit?:bool, error?:bool, stdin:&:source:char, screen:&:screen [ local-scope - load-ingredients + load-inputs c:char, eof?:bool, stdin <- read stdin return-if eof?, 0/dummy, 1/quit, 0/error q-pressed?:bool <- equal c, 81/Q @@ -341,7 +341,7 @@ def read-rank stdin:&:source:char, screen:&:screen -> rank:num, quit?:bool, erro # return true on error def expect-from-channel stdin:&:source:char, expected:char, screen:&:screen -> result:bool, stdin:&:source:char, screen:&:screen [ local-scope - load-ingredients + load-inputs c:char, eof?:bool, stdin <- read stdin return-if eof? 1/true { @@ -358,7 +358,7 @@ scenario read-move-blocking [ source:&:source:char, sink:&:sink:char <- new-channel 2/capacity read-move-routine:num/routine <- start-running read-move, source, screen:&:screen run [ - # 'read-move' is waiting for input + # 'read-move' is waiting for keypress wait-for-routine-to-block read-move-routine read-move-state:num <- routine-state read-move-routine waiting?:bool <- not-equal read-move-state, 2/discontinued @@ -367,7 +367,7 @@ F read-move-blocking: routine failed to pause after coming up (before any keys w # press 'a' sink <- write sink, 97/a restart read-move-routine - # 'read-move' still waiting for input + # 'read-move' still waiting for keypress wait-for-routine-to-block read-move-routine read-move-state <- routine-state read-move-routine waiting? <- not-equal read-move-state, 2/discontinued @@ -376,7 +376,7 @@ F read-move-blocking: routine failed to pause after rank 'a'] # press '2' sink <- write sink, 50/'2' restart read-move-routine - # 'read-move' still waiting for input + # 'read-move' still waiting for keypress wait-for-routine-to-block read-move-routine read-move-state <- routine-state read-move-routine waiting? <- not-equal read-move-state, 2/discontinued @@ -385,7 +385,7 @@ F read-move-blocking: routine failed to pause after file 'a2'] # press '-' sink <- write sink, 45/'-' restart read-move-routine - # 'read-move' still waiting for input + # 'read-move' still waiting for keypress wait-for-routine-to-block read-move-routine read-move-state <- routine-state read-move-routine waiting? <- not-equal read-move-state, 2/discontinued @@ -394,7 +394,7 @@ F read-move-blocking: routine failed to pause after hyphen 'a2-'] # press 'a' sink <- write sink, 97/a restart read-move-routine - # 'read-move' still waiting for input + # 'read-move' still waiting for keypress wait-for-routine-to-block read-move-routine read-move-state <- routine-state read-move-routine waiting? <- not-equal read-move-state, 2/discontinued @@ -403,7 +403,7 @@ F read-move-blocking: routine failed to pause after rank 'a2-a'] # press '4' sink <- write sink, 52/'4' restart read-move-routine - # 'read-move' still waiting for input + # 'read-move' still waiting for keypress wait-for-routine-to-block read-move-routine read-move-state <- routine-state read-move-routine waiting? <- not-equal read-move-state, 2/discontinued @@ -431,7 +431,7 @@ scenario read-move-quit [ source:&:source:char, sink:&:sink:char <- new-channel 2/capacity read-move-routine:num <- start-running read-move, source, screen:&:screen run [ - # 'read-move' is waiting for input + # 'read-move' is waiting for keypress wait-for-routine-to-block read-move-routine read-move-state:num <- routine-state read-move-routine waiting?:bool <- not-equal read-move-state, 2/discontinued @@ -459,7 +459,7 @@ scenario read-move-illegal-file [ source:&:source:char, sink:&:sink:char <- new-channel 2/capacity read-move-routine:num <- start-running read-move, source, screen:&:screen run [ - # 'read-move' is waiting for input + # 'read-move' is waiting for keypress wait-for-routine-to-block read-move-routine read-move-state:num <- routine-state read-move-routine waiting?:bool <- not-equal read-move-state, 2/discontinued @@ -481,7 +481,7 @@ scenario read-move-illegal-rank [ source:&:source:char, sink:&:sink:char <- new-channel 2/capacity read-move-routine:num <- start-running read-move, source, screen:&:screen run [ - # 'read-move' is waiting for input + # 'read-move' is waiting for keypress wait-for-routine-to-block read-move-routine read-move-state:num <- routine-state read-move-routine waiting?:bool <- not-equal read-move-state, 2/discontinued @@ -504,7 +504,7 @@ scenario read-move-empty [ source:&:source:char, sink:&:sink:char <- new-channel 2/capacity read-move-routine:num <- start-running read-move, source, screen:&:screen run [ - # 'read-move' is waiting for input + # 'read-move' is waiting for keypress wait-for-routine-to-block read-move-routine read-move-state:num <- routine-state read-move-routine waiting?:bool <- not-equal read-move-state, 2/discontinued @@ -523,7 +523,7 @@ F read-move-empty: routine failed to pause after coming up (before any keys were def make-move board:board, m:&:move -> board:board [ local-scope - load-ingredients + load-inputs from-file:num <- get *m, from-file:offset from-rank:num <- get *m, from-rank:offset to-file:num <- get *m, to-file:offset diff --git a/continuation1.mu b/continuation1.mu index 47d036fa..467b21f5 100644 --- a/continuation1.mu +++ b/continuation1.mu @@ -19,7 +19,7 @@ def main [ def create-yielder -> n:num [ local-scope - load-ingredients + load-inputs return-continuation-until-mark return 1 ] diff --git a/continuation2.mu b/continuation2.mu index 0e698aec..def83867 100644 --- a/continuation2.mu +++ b/continuation2.mu @@ -28,7 +28,7 @@ def main [ def create-yielder l:&:list:num -> n:num, done?:bool [ local-scope - load-ingredients + load-inputs return-continuation-until-mark done? <- equal l, 0 return-if done?, 0 diff --git a/continuation4.mu b/continuation4.mu index b8398945..215fc29d 100644 --- a/continuation4.mu +++ b/continuation4.mu @@ -30,7 +30,7 @@ def main [ def create-yielder l:&:list:num -> n:num, done?:bool [ local-scope - load-ingredients + load-inputs { done? <- equal l, 0 break-if done? diff --git a/continuation5.mu b/continuation5.mu index 9f9b87cb..e3030149 100644 --- a/continuation5.mu +++ b/continuation5.mu @@ -1,5 +1,5 @@ # Example program showing that a 'paused' continuation can be 'resumed' with -# ingredients. +# inputs. # # Print out a list of numbers, first adding 0 to the first, 1 to the second, 2 # to the third, and so on. @@ -33,7 +33,7 @@ def main [ def create-yielder l:&:list:num -> n:num, done?:bool [ local-scope - load-ingredients + load-inputs a:num <- copy 0 { done? <- equal l, 0 diff --git a/counters.mu b/counters.mu index dfa3e765..ea2fa77d 100644 --- a/counters.mu +++ b/counters.mu @@ -3,12 +3,12 @@ def new-counter n:num -> default-space:space [ default-space <- new location:type, 30 - load-ingredients # initialize n + load-inputs # initialize n ] def increment-counter outer:space/names:new-counter, x:num -> n:num/space:1 [ local-scope - load-ingredients + load-inputs 0:space/names:new-counter <- copy outer # setup outer space; it *must* come from 'new-counter' n/space:1 <- add n/space:1, x ] diff --git a/edit/001-editor.mu b/edit/001-editor.mu index 9e136b7e..74f0ab20 100644 --- a/edit/001-editor.mu +++ b/edit/001-editor.mu @@ -4,7 +4,7 @@ # screen dimensions, then stop def main text:text [ local-scope - load-ingredients + load-inputs open-console clear-screen 0/screen # non-scrolling app e:&:editor <- new-editor text, 0/left, 5/right @@ -50,7 +50,7 @@ container editor [ # right is exclusive def new-editor s:text, left:num, right:num -> result:&:editor [ local-scope - load-ingredients + load-inputs # no clipping of bounds right <- subtract right, 1 result <- new editor:type @@ -71,7 +71,7 @@ def new-editor s:text, left:num, right:num -> result:&:editor [ def insert-text editor:&:editor, text:text -> editor:&:editor [ local-scope - load-ingredients + load-inputs curr:&:duplex-list:char <- get *editor, data:offset insert curr, text ] @@ -106,7 +106,7 @@ scenario editor-initializes-without-data [ # outside text. def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor, 1/top, 0/left left:num <- get *editor, left:offset screen-height:num <- screen-height screen @@ -206,7 +206,7 @@ def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, sc def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs #? stash [clear-screen-from] row column [between] left [and] right # if it's the real screen, use the optimized primitive { @@ -222,7 +222,7 @@ def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num def clear-rest-of-screen screen:&:screen, row:num, left:num, right:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs row <- add row, 1 # if it's the real screen, use the optimized primitive { @@ -396,7 +396,7 @@ after <character-c-received> [ # so far the previous color is all the information we need; that may change def get-color color:num, c:char -> color:num [ local-scope - load-ingredients + load-inputs color-is-white?:bool <- equal color, 7/white # if color is white and next character is '#', switch color to blue { diff --git a/edit/002-typing.mu b/edit/002-typing.mu index f5bbeb6f..709e8d22 100644 --- a/edit/002-typing.mu +++ b/edit/002-typing.mu @@ -4,7 +4,7 @@ # hit ctrl-c to exit def! main text:text [ local-scope - load-ingredients + load-inputs open-console clear-screen 0/screen # non-scrolling app editor:&:editor <- new-editor text, 5/left, 45/right @@ -15,7 +15,7 @@ def! main text:text [ def editor-event-loop screen:&:screen, console:&:console, editor:&:editor -> screen:&:screen, console:&:console, editor:&:editor [ local-scope - load-ingredients + load-inputs { # looping over each (keyboard or touch) event as it occurs +next-event @@ -49,7 +49,7 @@ def editor-event-loop screen:&:screen, console:&:console, editor:&:editor -> scr # process click, return if it was on current editor def move-cursor editor:&:editor, screen:&:screen, t:touch-event -> in-focus?:bool, editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor, 0/false click-row:num <- get t, row:offset return-unless click-row, 0/false # ignore clicks on 'menu' @@ -74,7 +74,7 @@ def move-cursor editor:&:editor, screen:&:screen, t:touch-event -> in-focus?:boo # past the last line it positions at end of last line. def snap-cursor editor:&:editor, screen:&:screen, target-row:num, target-column:num -> editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor left:num <- get *editor, left:offset right:num <- get *editor, right:offset @@ -165,7 +165,7 @@ def snap-cursor editor:&:editor, screen:&:screen, target-row:num, target-column: # Set 'go-render?' to true to indicate the caller must perform a non-minimal update. def handle-keyboard-event screen:&:screen, editor:&:editor, e:event -> go-render?:bool, screen:&:screen, editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor, 0/don't-render screen-width:num <- screen-width screen screen-height:num <- screen-height screen @@ -202,7 +202,7 @@ def handle-keyboard-event screen:&:screen, editor:&:editor, e:event -> go-render def insert-at-cursor editor:&:editor, c:char, screen:&:screen -> go-render?:bool, editor:&:editor, screen:&:screen [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset insert c, before-cursor before-cursor <- next before-cursor @@ -264,7 +264,7 @@ def insert-at-cursor editor:&:editor, c:char, screen:&:screen -> go-render?:bool # helper for tests def editor-render screen:&:screen, editor:&:editor -> screen:&:screen, editor:&:editor [ local-scope - load-ingredients + load-inputs old-top-idx:num <- save-top-idx screen left:num <- get *editor, left:offset right:num <- get *editor, right:offset @@ -867,7 +867,7 @@ after <handle-special-character> [ def insert-new-line-and-indent editor:&:editor, screen:&:screen -> editor:&:editor, screen:&:screen [ local-scope - load-ingredients + load-inputs cursor-row:num <- get *editor, cursor-row:offset cursor-column:num <- get *editor, cursor-column:offset before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset @@ -913,7 +913,7 @@ def insert-new-line-and-indent editor:&:editor, screen:&:screen -> editor:&:edit def at-start-of-wrapped-line? editor:&:editor -> result:bool [ local-scope - load-ingredients + load-inputs left:num <- get *editor, left:offset cursor-column:num <- get *editor, cursor-column:offset cursor-at-left?:bool <- equal cursor-column, left @@ -933,7 +933,7 @@ def at-start-of-wrapped-line? editor:&:editor -> result:bool [ # the number of spaces at the start of the line containing 'curr'. def line-indent curr:&:duplex-list:char, start:&:duplex-list:char -> result:num [ local-scope - load-ingredients + load-inputs result:num <- copy 0 return-unless curr at-start?:bool <- equal curr, start @@ -1115,22 +1115,22 @@ after <handle-special-key> [ def draw-horizontal screen:&:screen, row:num, x:num, right:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs height:num <- screen-height screen past-bottom?:bool <- greater-or-equal row, height return-if past-bottom? - style:char, style-found?:bool <- next-ingredient + style:char, style-found?:bool <- next-input { break-if style-found? style <- copy 9472/horizontal } - color:num, color-found?:bool <- next-ingredient + color:num, color-found?:bool <- next-input { # default color to white break-if color-found? color <- copy 245/grey } - bg-color:num, bg-color-found?:bool <- next-ingredient + bg-color:num, bg-color-found?:bool <- next-input { break-if bg-color-found? bg-color <- copy 0/black diff --git a/edit/003-shortcuts.mu b/edit/003-shortcuts.mu index df40a6e4..e24f7e72 100644 --- a/edit/003-shortcuts.mu +++ b/edit/003-shortcuts.mu @@ -108,7 +108,7 @@ after <handle-special-character> [ # backspaced-cell - value deleted (or 0 if nothing was deleted) so we can save it for undo, etc. def delete-before-cursor editor:&:editor, screen:&:screen -> go-render?:bool, backspaced-cell:&:duplex-list:char, editor:&:editor, screen:&:screen [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset data:&:duplex-list:char <- get *editor, data:offset # if at start of text (before-cursor at § sentinel), return @@ -155,7 +155,7 @@ def delete-before-cursor editor:&:editor, screen:&:screen -> go-render?:bool, ba def move-cursor-coordinates-left editor:&:editor -> go-render?:bool, editor:&:editor [ local-scope - load-ingredients + load-inputs go-render?:bool <- copy 0/false before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset cursor-row:num <- get *editor, cursor-row:offset @@ -218,7 +218,7 @@ def move-cursor-coordinates-left editor:&:editor -> go-render?:bool, editor:&:ed # the length of the previous line before the 'curr' pointer. def previous-line-length curr:&:duplex-list:char, start:&:duplex-list:char -> result:num [ local-scope - load-ingredients + load-inputs result:num <- copy 0 return-unless curr at-start?:bool <- equal curr, start @@ -372,7 +372,7 @@ after <handle-special-key> [ def delete-at-cursor editor:&:editor, screen:&:screen -> go-render?:bool, deleted-cell:&:duplex-list:char, editor:&:editor, screen:&:screen [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset data:&:duplex-list:char <- get *editor, data:offset deleted-cell:&:duplex-list:char <- next before-cursor @@ -452,7 +452,7 @@ after <handle-special-key> [ def move-cursor-coordinates-right editor:&:editor, screen-height:num -> go-render?:bool, editor:&:editor [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor before-cursor:offset cursor-row:num <- get *editor, cursor-row:offset cursor-column:num <- get *editor, cursor-column:offset @@ -999,7 +999,7 @@ after <handle-special-key> [ def move-to-previous-line editor:&:editor -> go-render?:bool, editor:&:editor [ local-scope - load-ingredients + load-inputs go-render?:bool <- copy 0/false cursor-row:num <- get *editor, cursor-row:offset cursor-column:num <- get *editor, cursor-column:offset @@ -1353,7 +1353,7 @@ after <handle-special-key> [ def move-to-next-line editor:&:editor, screen-height:num -> go-render?:bool, editor:&:editor [ local-scope - load-ingredients + load-inputs cursor-row:num <- get *editor, cursor-row:offset cursor-column:num <- get *editor, cursor-column:offset before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset @@ -1564,7 +1564,7 @@ after <handle-special-key> [ # precondition: cursor-column should be in a consistent state def move-to-start-of-screen-line editor:&:editor -> editor:&:editor [ local-scope - load-ingredients + load-inputs # update cursor column left:num <- get *editor, left:offset col:num <- get *editor, cursor-column:offset @@ -1787,7 +1787,7 @@ after <handle-special-key> [ def move-to-end-of-line editor:&:editor -> editor:&:editor [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset cursor-column:num <- get *editor, cursor-column:offset right:num <- get *editor, right:offset @@ -1970,7 +1970,7 @@ after <handle-special-character> [ def minimal-render-for-ctrl-u screen:&:screen, editor:&:editor, deleted-cells:&:duplex-list:char -> go-render?:bool, screen:&:screen [ local-scope - load-ingredients + load-inputs curr-column:num <- get *editor, cursor-column:offset # accumulate the current line as text and render it buf:&:buffer:char <- new-buffer 30 # accumulator for the text we need to render @@ -2005,7 +2005,7 @@ def minimal-render-for-ctrl-u screen:&:screen, editor:&:editor, deleted-cells:&: def delete-to-start-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ local-scope - load-ingredients + load-inputs # compute range to delete init:&:duplex-list:char <- get *editor, data:offset top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset @@ -2061,7 +2061,7 @@ def delete-to-start-of-line editor:&:editor -> result:&:duplex-list:char, editor def render-code screen:&:screen, s:text, left:num, right:num, row:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs return-unless s color:num <- copy 7/white column:num <- copy left @@ -2548,7 +2548,7 @@ after <handle-special-character> [ def minimal-render-for-ctrl-k screen:&:screen, editor:&:editor, deleted-cells:&:duplex-list:char -> go-render?:bool, screen:&:screen [ local-scope - load-ingredients + load-inputs # if we deleted nothing, there's nothing to render return-unless deleted-cells, 0/dont-render # if the line used to wrap before, give up and render the whole screen @@ -2566,7 +2566,7 @@ def minimal-render-for-ctrl-k screen:&:screen, editor:&:editor, deleted-cells:&: def delete-to-end-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ local-scope - load-ingredients + load-inputs # compute range to delete start:&:duplex-list:char <- get *editor, before-cursor:offset end:&:duplex-list:char <- next start @@ -2803,7 +2803,7 @@ after <scroll-down> [ # Beware: never return null pointer. def before-start-of-next-line original:&:duplex-list:char, max:num -> curr:&:duplex-list:char [ local-scope - load-ingredients + load-inputs count:num <- copy 0 curr:&:duplex-list:char <- copy original # skip the initial newline if it exists @@ -3174,7 +3174,7 @@ after <scroll-up> [ # Beware: never return null pointer. def before-previous-screen-line in:&:duplex-list:char, editor:&:editor -> out:&:duplex-list:char [ local-scope - load-ingredients + load-inputs curr:&:duplex-list:char <- copy in c:char <- get *curr, value:offset # compute max, number of characters to skip @@ -3596,7 +3596,7 @@ after <handle-special-key> [ # taking up the entire screen def page-down editor:&:editor -> editor:&:editor [ local-scope - load-ingredients + load-inputs # if editor contents don't overflow screen, do nothing bottom-of-screen:&:duplex-list:char <- get *editor, bottom-of-screen:offset return-unless bottom-of-screen @@ -3621,7 +3621,7 @@ def page-down editor:&:editor -> editor:&:editor [ # jump to previous newline def move-to-start-of-line editor:&:editor -> editor:&:editor [ local-scope - load-ingredients + load-inputs # update cursor column left:num <- get *editor, left:offset cursor-column:num <- copy left @@ -3819,7 +3819,7 @@ after <handle-special-key> [ def page-up editor:&:editor, screen-height:num -> editor:&:editor [ local-scope - load-ingredients + load-inputs max:num <- subtract screen-height, 1/menu-bar, 1/overlapping-line count:num <- copy 0 top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset @@ -4148,7 +4148,7 @@ after <handle-special-character> [ def line-up editor:&:editor, screen-height:num -> go-render?:bool, editor:&:editor [ local-scope - load-ingredients + load-inputs left:num <- get *editor, left:offset right:num <- get *editor, right:offset max:num <- subtract right, left @@ -4179,7 +4179,7 @@ after <handle-special-character> [ def line-down editor:&:editor, screen-height:num -> go-render?:bool, editor:&:editor [ local-scope - load-ingredients + load-inputs old-top:&:duplex-list:char <- get *editor, top-of-screen:offset new-top:&:duplex-list:char <- before-previous-screen-line old-top, editor movement?:bool <- not-equal old-top, new-top @@ -4249,7 +4249,7 @@ after <handle-special-character> [ # the caller to go-render? the entire screen. def render-line-from-start screen:&:screen, editor:&:editor, right-margin:num -> go-render?:bool, screen:&:screen [ local-scope - load-ingredients + load-inputs before-line-start:&:duplex-list:char <- before-start-of-screen-line editor line-start:&:duplex-list:char <- next before-line-start color:num <- copy 7/white @@ -4279,7 +4279,7 @@ def render-line-from-start screen:&:screen, editor:&:editor, right-margin:num -> def before-start-of-screen-line editor:&:editor -> result:&:duplex-list:char [ local-scope - load-ingredients + load-inputs cursor:&:duplex-list:char <- get *editor, before-cursor:offset { next:&:duplex-list:char <- next cursor diff --git a/edit/004-programming-environment.mu b/edit/004-programming-environment.mu index 73d26d4d..cff42327 100644 --- a/edit/004-programming-environment.mu +++ b/edit/004-programming-environment.mu @@ -20,7 +20,7 @@ container environment [ def new-programming-environment resources:&:resources, screen:&:screen, test-sandbox-editor-contents:text -> result:&:environment [ local-scope - load-ingredients + load-inputs width:num <- screen-width screen result <- new environment:type # recipe editor on the left @@ -38,7 +38,7 @@ def new-programming-environment resources:&:resources, screen:&:screen, test-san def event-loop screen:&:screen, console:&:console, env:&:environment, resources:&:resources -> screen:&:screen, console:&:console, env:&:environment, resources:&:resources [ local-scope - load-ingredients + load-inputs recipes:&:editor <- get *env, recipes:offset current-sandbox:&:editor <- get *env, current-sandbox:offset sandbox-in-focus?:bool <- get *env, sandbox-in-focus?:offset @@ -130,7 +130,7 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources: def resize screen:&:screen, env:&:environment -> env:&:environment, screen:&:screen [ local-scope - load-ingredients + load-inputs clear-screen screen # update screen dimensions width:num <- screen-width screen divider:num, _ <- divide-with-remainder width, 2 @@ -157,7 +157,7 @@ def resize screen:&:screen, env:&:environment -> env:&:environment, screen:&:scr # off-screen, it resets cursor-row and cursor-column. def render-without-moving-cursor screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor, 1/top, 0/left left:num <- get *editor, left:offset screen-height:num <- screen-height screen @@ -401,7 +401,7 @@ type render-recipe = (recipe (address screen) (address editor) -> number number def render-all screen:&:screen, env:&:environment, render-editor:render-recipe -> screen:&:screen, env:&:environment [ local-scope - load-ingredients + load-inputs trace 10, [app], [render all] # top menu trace 11, [app], [render top menu] @@ -430,7 +430,7 @@ def render-all screen:&:screen, env:&:environment, render-editor:render-recipe - def render-recipes screen:&:screen, env:&:environment, render-editor:render-recipe -> screen:&:screen, env:&:environment [ local-scope - load-ingredients + load-inputs trace 11, [app], [render recipes] old-top-idx:num <- save-top-idx screen recipes:&:editor <- get *env, recipes:offset @@ -452,7 +452,7 @@ def render-recipes screen:&:screen, env:&:environment, render-editor:render-reci # replaced in a later layer def render-sandbox-side screen:&:screen, env:&:environment, render-editor:render-recipe -> screen:&:screen, env:&:environment [ local-scope - load-ingredients + load-inputs trace 11, [app], [render sandboxes] old-top-idx:num <- save-top-idx screen current-sandbox:&:editor <- get *env, current-sandbox:offset @@ -471,7 +471,7 @@ def render-sandbox-side screen:&:screen, env:&:environment, render-editor:render def update-cursor screen:&:screen, recipes:&:editor, current-sandbox:&:editor, sandbox-in-focus?:bool, env:&:environment -> screen:&:screen [ local-scope - load-ingredients + load-inputs <update-cursor-special-cases> { break-if sandbox-in-focus? @@ -505,13 +505,13 @@ after <global-type> [ def draw-vertical screen:&:screen, col:num, y:num, bottom:num -> screen:&:screen [ local-scope - load-ingredients - style:char, style-found?:bool <- next-ingredient + load-inputs + style:char, style-found?:bool <- next-input { break-if style-found? style <- copy 9474/vertical } - color:num, color-found?:bool <- next-ingredient + color:num, color-found?:bool <- next-input { # default color to white break-if color-found? diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu index 869b4ca4..bb991504 100644 --- a/edit/005-sandbox.mu +++ b/edit/005-sandbox.mu @@ -145,7 +145,7 @@ after <global-keypress> [ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> errors-found?:bool, env:&:environment, resources:&:resources, screen:&:screen [ local-scope - load-ingredients + load-inputs errors-found?:bool <- update-recipes env, resources, screen jump-if errors-found?, +return # check contents of right editor (sandbox) @@ -196,7 +196,7 @@ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> e # replaced in a later layer (whereupon errors-found? will actually be set) def update-recipes env:&:environment, resources:&:resources, screen:&:screen -> errors-found?:bool, env:&:environment, resources:&:resources, screen:&:screen [ local-scope - load-ingredients + load-inputs recipes:&:editor <- get *env, recipes:offset in:text <- editor-contents recipes resources <- dump resources, [lesson/recipes.mu], in @@ -207,7 +207,7 @@ def update-recipes env:&:environment, resources:&:resources, screen:&:screen -> # replaced in a later layer def update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sandbox, env:&:environment [ local-scope - load-ingredients + load-inputs data:text <- get *sandbox, data:offset response:text, _, fake-screen:&:screen <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response @@ -216,14 +216,14 @@ def update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sa def update-status screen:&:screen, msg:text, color:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs screen <- move-cursor screen, 0, 2 screen <- print screen, msg, color, 238/grey/background ] def save-sandboxes env:&:environment, resources:&:resources -> resources:&:resources [ local-scope - load-ingredients + load-inputs trace 11, [app], [save sandboxes] current-sandbox:&:editor <- get *env, current-sandbox:offset # first clear previous versions, in case we deleted some sandbox @@ -241,7 +241,7 @@ def save-sandboxes env:&:environment, resources:&:resources -> resources:&:resou def save-sandbox resources:&:resources, sandbox:&:sandbox, sandbox-index:num -> resources:&:resources [ local-scope - load-ingredients + load-inputs data:text <- get *sandbox, data:offset filename:text <- append [lesson/], sandbox-index resources <- dump resources, filename, data @@ -250,7 +250,7 @@ def save-sandbox resources:&:resources, sandbox:&:sandbox, sandbox-index:num -> def! render-sandbox-side screen:&:screen, env:&:environment, render-editor:render-recipe -> screen:&:screen, env:&:environment [ local-scope - load-ingredients + load-inputs trace 11, [app], [render sandbox side] old-top-idx:num <- save-top-idx screen current-sandbox:&:editor <- get *env, current-sandbox:offset @@ -277,7 +277,7 @@ def! render-sandbox-side screen:&:screen, env:&:environment, render-editor:rende def render-sandboxes screen:&:screen, sandbox:&:sandbox, left:num, right:num, row:num, render-from:num, idx:num -> row:num, screen:&:screen, sandbox:&:sandbox [ local-scope - load-ingredients + load-inputs return-unless sandbox screen-height:num <- screen-height screen hidden?:bool <- lesser-than idx, render-from @@ -332,7 +332,7 @@ def render-sandboxes screen:&:screen, sandbox:&:sandbox, left:num, right:num, ro def render-sandbox-menu screen:&:screen, sandbox-index:num, left:num, right:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs move-cursor-to-column screen, left edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, recipe-button-left:num, recipe-button-right:num, delete-button-left:num <- sandbox-menu-columns left, right print screen, sandbox-index, 232/dark-grey, 245/grey @@ -377,7 +377,7 @@ scenario skip-rendering-sandbox-menu-past-bottom-row [ # all left/right pairs are inclusive def sandbox-menu-columns left:num, right:num -> edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, recipe-button-left:num, recipe-button-right:num, delete-button-left:num [ local-scope - load-ingredients + load-inputs start-buttons:num <- add left, 4/space-for-sandbox-index buttons-space:num <- subtract right, start-buttons button-width:num <- divide-with-remainder buttons-space, 4 # integer division @@ -397,7 +397,7 @@ def sandbox-menu-columns left:num, right:num -> edit-button-left:num, edit-butto # like 'render-code' but without syntax-based colorization def render-text screen:&:screen, s:text, left:num, right:num, color:num, row:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs return-unless s column:num <- copy left screen <- move-cursor screen, row, column @@ -474,7 +474,7 @@ scenario render-text-wraps-barely-long-lines [ # assumes programming environment has no sandboxes; restores them from previous session def restore-sandboxes env:&:environment, resources:&:resources -> env:&:environment [ local-scope - load-ingredients + load-inputs # read all scenarios, pushing them to end of a list of scenarios idx:num <- copy 0 curr:&:sandbox <- copy 0 @@ -508,7 +508,7 @@ def restore-sandboxes env:&:environment, resources:&:resources -> env:&:environm # leave cursor at start of next line def render-screen screen:&:screen, sandbox-screen:&:screen, left:num, right:num, row:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs return-unless sandbox-screen # print 'screen:' row <- render-text screen, [screen:], left, right, 245/grey, row @@ -682,7 +682,7 @@ scenario run-instruction-manages-screen-per-sandbox [ def editor-contents editor:&:editor -> result:text [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 80 curr:&:duplex-list:char <- get *editor, data:offset # skip § sentinel @@ -944,7 +944,7 @@ after <global-keypress> [ # return 0 if there's no such sandbox, either because 'in' doesn't exist in 'env', or because it's the first sandbox def previous-sandbox env:&:environment, in:&:sandbox -> out:&:sandbox [ local-scope - load-ingredients + load-inputs curr:&:sandbox <- get *env, sandbox:offset return-unless curr, 0/nil next:&:sandbox <- get *curr, next-sandbox:offset diff --git a/edit/006-sandbox-copy.mu b/edit/006-sandbox-copy.mu index ef9bed24..72f320f6 100644 --- a/edit/006-sandbox-copy.mu +++ b/edit/006-sandbox-copy.mu @@ -139,7 +139,7 @@ after <global-touch> [ # some preconditions for attempting to copy a sandbox def should-attempt-copy? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, click-column, env return-unless click-sandbox-area?, 0/false @@ -158,7 +158,7 @@ def should-attempt-copy? click-row:num, click-column:num, env:&:environment -> r def try-copy-sandbox click-row:num, env:&:environment -> clicked-on-copy-button?:bool, env:&:environment [ local-scope - load-ingredients + load-inputs # identify the sandbox to copy, if the click was actually on the 'copy' button sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, 0/false @@ -174,7 +174,7 @@ def try-copy-sandbox click-row:num, env:&:environment -> clicked-on-copy-button? def find-sandbox env:&:environment, click-row:num -> result:&:sandbox [ local-scope - load-ingredients + load-inputs curr-sandbox:&:sandbox <- get *env, sandbox:offset { break-unless curr-sandbox @@ -189,7 +189,7 @@ def find-sandbox env:&:environment, click-row:num -> result:&:sandbox [ def click-on-sandbox-area? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs current-sandbox:&:editor <- get *env, current-sandbox:offset sandbox-left-margin:num <- get *current-sandbox, left:offset on-sandbox-side?:bool <- greater-or-equal click-column, sandbox-left-margin @@ -202,7 +202,7 @@ def click-on-sandbox-area? click-row:num, click-column:num, env:&:environment -> def empty-editor? editor:&:editor -> result:bool [ local-scope - load-ingredients + load-inputs head:&:duplex-list:char <- get *editor, data:offset first:&:duplex-list:char <- next head result <- not first @@ -210,7 +210,7 @@ def empty-editor? editor:&:editor -> result:bool [ def within-range? x:num, low:num, high:num -> result:bool [ local-scope - load-ingredients + load-inputs not-too-far-left?:bool <- greater-or-equal x, low not-too-far-right?:bool <- lesser-or-equal x, high result <- and not-too-far-left? not-too-far-right? @@ -359,7 +359,7 @@ after <global-touch> [ # some preconditions for attempting to copy a sandbox into the recipe side def should-copy-to-recipe? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, click-column, env return-unless click-sandbox-area?, 0/false @@ -374,7 +374,7 @@ def should-copy-to-recipe? click-row:num, click-column:num, env:&:environment -> def prepend-sandbox-into-recipe-side click-row:num, env:&:environment -> clicked-on-copy-to-recipe-button?:bool, env:&:environment [ local-scope - load-ingredients + load-inputs sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, 0/false recipe-editor:&:editor <- get *env, recipes:offset diff --git a/edit/007-sandbox-delete.mu b/edit/007-sandbox-delete.mu index 2db88964..0e599758 100644 --- a/edit/007-sandbox-delete.mu +++ b/edit/007-sandbox-delete.mu @@ -82,7 +82,7 @@ after <global-touch> [ # some preconditions for attempting to delete a sandbox def should-attempt-delete? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, click-column, env return-unless click-sandbox-area?, 0/false @@ -97,7 +97,7 @@ def should-attempt-delete? click-row:num, click-column:num, env:&:environment -> def try-delete-sandbox click-row:num, env:&:environment -> clicked-on-delete-button?:bool, env:&:environment [ local-scope - load-ingredients + load-inputs # identify the sandbox to delete, if the click was actually on the 'delete' button sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, 0/false @@ -107,7 +107,7 @@ def try-delete-sandbox click-row:num, env:&:environment -> clicked-on-delete-but def delete-sandbox env:&:environment, sandbox:&:sandbox -> env:&:environment [ local-scope - load-ingredients + load-inputs curr-sandbox:&:sandbox <- get *env, sandbox:offset first-sandbox?:bool <- equal curr-sandbox, sandbox { diff --git a/edit/008-sandbox-edit.mu b/edit/008-sandbox-edit.mu index eeb0cd69..ab4f1f63 100644 --- a/edit/008-sandbox-edit.mu +++ b/edit/008-sandbox-edit.mu @@ -122,7 +122,7 @@ after <global-touch> [ # some preconditions for attempting to edit a sandbox def should-attempt-edit? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, click-column, env return-unless click-sandbox-area?, 0/false @@ -141,7 +141,7 @@ def should-attempt-edit? click-row:num, click-column:num, env:&:environment -> r def try-edit-sandbox click-row:num, env:&:environment -> clicked-on-edit-button?:bool, env:&:environment [ local-scope - load-ingredients + load-inputs # identify the sandbox to edit, if the click was actually on the 'edit' button sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, 0/false diff --git a/edit/009-sandbox-test.mu b/edit/009-sandbox-test.mu index 4893e1ea..b871107e 100644 --- a/edit/009-sandbox-test.mu +++ b/edit/009-sandbox-test.mu @@ -151,7 +151,7 @@ after <global-touch> [ def find-click-in-sandbox-output env:&:environment, click-row:num -> sandbox:&:sandbox, sandbox-index:num [ local-scope - load-ingredients + load-inputs # assert click-row >= sandbox.starting-row-on-screen sandbox:&:sandbox <- get *env, sandbox:offset start:num <- get *sandbox, starting-row-on-screen:offset @@ -179,7 +179,7 @@ def find-click-in-sandbox-output env:&:environment, click-row:num -> sandbox:&:s def toggle-expected-response sandbox:&:sandbox -> sandbox:&:sandbox [ local-scope - load-ingredients + load-inputs expected-response:text <- get *sandbox, expected-response:offset { # if expected-response is set, reset @@ -206,7 +206,7 @@ after <render-sandbox-response> [ def render-sandbox-response screen:&:screen, sandbox:&:sandbox, left:num, right:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs sandbox-response:text <- get *sandbox, response:offset expected-response:text <- get *sandbox, expected-response:offset row:num <- get *sandbox response-starting-row-on-screen:offset diff --git a/edit/010-sandbox-trace.mu b/edit/010-sandbox-trace.mu index 2d681b8f..cc8b2805 100644 --- a/edit/010-sandbox-trace.mu +++ b/edit/010-sandbox-trace.mu @@ -174,7 +174,7 @@ container sandbox [ # replaced in a later layer def! update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sandbox, env:&:environment [ local-scope - load-ingredients + load-inputs data:text <- get *sandbox, data:offset response:text, _, fake-screen:&:screen, trace:text <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response @@ -211,7 +211,7 @@ after <global-touch> [ def find-click-in-sandbox-code env:&:environment, click-row:num -> sandbox:&:sandbox [ local-scope - load-ingredients + load-inputs # assert click-row >= sandbox.starting-row-on-screen sandbox <- get *env, sandbox:offset start:num <- get *sandbox, starting-row-on-screen:offset diff --git a/edit/011-errors.mu b/edit/011-errors.mu index 554130b5..af94c2ed 100644 --- a/edit/011-errors.mu +++ b/edit/011-errors.mu @@ -7,7 +7,7 @@ container environment [ # copy code from recipe editor, persist to disk, load, save any errors def! update-recipes env:&:environment, resources:&:resources, screen:&:screen -> errors-found?:bool, env:&:environment, resources:&:resources, screen:&:screen [ local-scope - load-ingredients + load-inputs recipes:&:editor <- get *env, recipes:offset in:text <- editor-contents recipes resources <- dump resources, [lesson/recipes.mu], in @@ -41,7 +41,7 @@ before <end-render-recipe-components> [ def render-recipe-errors env:&:environment, screen:&:screen -> screen:&:screen [ local-scope - load-ingredients + load-inputs recipe-errors:text <- get *env, recipe-errors:offset return-unless recipe-errors recipes:&:editor <- get *env, recipes:offset @@ -96,7 +96,7 @@ container sandbox [ def! update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sandbox, env:&:environment [ local-scope - load-ingredients + load-inputs data:text <- get *sandbox, data:offset response:text, errors:text, fake-screen:&:screen, trace:text, completed?:bool <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response diff --git a/edit/012-editor-undo.mu b/edit/012-editor-undo.mu index 024a0398..161e6843 100644 --- a/edit/012-editor-undo.mu +++ b/edit/012-editor-undo.mu @@ -201,7 +201,7 @@ before <end-insert-enter> [ # moving the cursor can lose work on the undo stack. def add-operation editor:&:editor, op:&:operation -> editor:&:editor [ local-scope - load-ingredients + load-inputs undo:&:list:&:operation <- get *editor, undo:offset undo <- push op undo *editor <- put *editor, undo:offset, undo diff --git a/factorial.mu b/factorial.mu index 8a261207..cf2284b2 100644 --- a/factorial.mu +++ b/factorial.mu @@ -9,7 +9,7 @@ def main [ def factorial n:num -> result:num [ local-scope - load-ingredients + load-inputs { # if n=0 return 1 zero?:bool <- equal n, 0 diff --git a/html/001help.cc.html b/html/001help.cc.html index f04fd9dd..16025a66 100644 --- a/html/001help.cc.html +++ b/html/001help.cc.html @@ -220,7 +220,7 @@ if ('onhashchange' in window) { <span id="L157" class="LineNr">157 </span> sigaction<span class="Delimiter">(</span><span class="Constant">SIGABRT</span><span class="Delimiter">,</span> &action<span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">);</span> <span class="Comment">// assert() failure or integer overflow on linux (with -ftrapv)</span> <span id="L158" class="LineNr">158 </span> sigaction<span class="Delimiter">(</span><span class="Constant">SIGILL</span><span class="Delimiter">,</span> &action<span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">);</span> <span class="Comment">// integer overflow on OS X (with -ftrapv)</span> <span id="L159" class="LineNr">159 </span><span class="Delimiter">}</span> -<span id="L160" class="LineNr">160 </span><span class="Normal">void</span> <a href='001help.cc.html#L160'>dump_and_exit</a><span class="Delimiter">(</span><span class="Normal">int</span> sig<span class="Delimiter">,</span> <a href='001help.cc.html#L258'>unused</a> siginfo_t* dummy1<span class="Delimiter">,</span> <a href='001help.cc.html#L258'>unused</a> <span class="Normal">void</span>* dummy2<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L160" class="LineNr">160 </span><span class="Normal">void</span> <a href='001help.cc.html#L160'>dump_and_exit</a><span class="Delimiter">(</span><span class="Normal">int</span> sig<span class="Delimiter">,</span> <a href='001help.cc.html#L259'>unused</a> siginfo_t* dummy1<span class="Delimiter">,</span> <a href='001help.cc.html#L259'>unused</a> <span class="Normal">void</span>* dummy2<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L161" class="LineNr">161 </span> <span class="Normal">switch</span> <span class="Delimiter">(</span>sig<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L162" class="LineNr">162 </span> <span class="Conceal">¦</span> <span class="Normal">case</span> <span class="Constant">SIGABRT</span>: <span id="L163" class="LineNr">163 </span><span class="PreProc"> </span><span class="Conceal">¦</span><span class="PreProc"> </span><span class="Conceal">¦</span><span class="PreProc"> #ifndef __APPLE__</span> @@ -282,47 +282,48 @@ if ('onhashchange' in window) { <span id="L219" class="LineNr">219 </span> <span class="Identifier">return</span> iter<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L220" class="LineNr">220 </span><span class="Delimiter">}</span> <span id="L221" class="LineNr">221 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type <span class="Normal">const</span>& <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">,</span> <span class="Normal">typename</span> T::mapped_type <span class="Normal">const</span>& value<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L222" class="LineNr">222 </span> map[key] = value<span class="Delimiter">;</span> -<span id="L223" class="LineNr">223 </span> <span class="Identifier">return</span> map[key]<span class="Delimiter">;</span> -<span id="L224" class="LineNr">224 </span><span class="Delimiter">}</span> -<span id="L225" class="LineNr">225 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">bool</span> contains_key<span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L226" class="LineNr">226 </span> <span class="Identifier">return</span> map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">)</span> != map<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L227" class="LineNr">227 </span><span class="Delimiter">}</span> -<span id="L228" class="LineNr">228 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type& <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L229" class="LineNr">229 </span> <span class="Identifier">return</span> map[key]<span class="Delimiter">;</span> -<span id="L230" class="LineNr">230 </span><span class="Delimiter">}</span> -<span id="L231" class="LineNr">231 </span><span class="Comment">//: The contract: any container that relies on get_or_insert should never call</span> -<span id="L232" class="LineNr">232 </span><span class="Comment">//: contains_key.</span> -<span id="L233" class="LineNr">233 </span> -<span id="L234" class="LineNr">234 </span><span class="Comment">//: 7. istreams are a royal pain in the arse. You have to be careful about</span> -<span id="L235" class="LineNr">235 </span><span class="Comment">//: what subclass you try to putback into. You have to watch out for the pesky</span> -<span id="L236" class="LineNr">236 </span><span class="Comment">//: failbit and badbit. Just avoid eof() and use this helper instead.</span> -<span id="L237" class="LineNr">237 </span><span class="Delimiter">:(code)</span> -<span id="L238" class="LineNr">238 </span><span class="Normal">bool</span> <a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L239" class="LineNr">239 </span> <span class="Identifier">return</span> in && !in<span class="Delimiter">.</span>eof<span class="Delimiter">();</span> -<span id="L240" class="LineNr">240 </span><span class="Delimiter">}</span> -<span id="L241" class="LineNr">241 </span> -<span id="L242" class="LineNr">242 </span><span class="Delimiter">:(before "End Includes")</span> -<span id="L243" class="LineNr">243 </span><span class="PreProc">#include </span><span class="Constant"><assert.h></span> -<span id="L244" class="LineNr">244 </span> -<span id="L245" class="LineNr">245 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span> -<span id="L246" class="LineNr">246 </span><span class="Normal">using</span> std::istream<span class="Delimiter">;</span> -<span id="L247" class="LineNr">247 </span><span class="Normal">using</span> std::ostream<span class="Delimiter">;</span> -<span id="L248" class="LineNr">248 </span><span class="Normal">using</span> std::iostream<span class="Delimiter">;</span> -<span id="L249" class="LineNr">249 </span><span class="Normal">using</span> std::cin<span class="Delimiter">;</span> -<span id="L250" class="LineNr">250 </span><span class="Normal">using</span> std::cout<span class="Delimiter">;</span> -<span id="L251" class="LineNr">251 </span><span class="Normal">using</span> std::cerr<span class="Delimiter">;</span> -<span id="L252" class="LineNr">252 </span><span class="PreProc">#include </span><span class="Constant"><iomanip></span> -<span id="L253" class="LineNr">253 </span> -<span id="L254" class="LineNr">254 </span><span class="PreProc">#include </span><span class="Constant"><string.h></span> -<span id="L255" class="LineNr">255 </span><span class="PreProc">#include </span><span class="Constant"><string></span> -<span id="L256" class="LineNr">256 </span><span class="Normal">using</span> std::string<span class="Delimiter">;</span> -<span id="L257" class="LineNr">257 </span> -<span id="L258" class="LineNr">258 </span><span class="PreProc">#define unused __attribute__((unused))</span> -<span id="L259" class="LineNr">259 </span> -<span id="L260" class="LineNr">260 </span><span class="PreProc">#include </span><span class="Constant"><algorithm></span> -<span id="L261" class="LineNr">261 </span><span class="Normal">using</span> std::min<span class="Delimiter">;</span> -<span id="L262" class="LineNr">262 </span><span class="Normal">using</span> std::max<span class="Delimiter">;</span> +<span id="L222" class="LineNr">222 </span> <span class="Comment">// map[key] requires mapped_type to have a zero-arg (default) constructor</span> +<span id="L223" class="LineNr">223 </span> map<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>std::make_pair<span class="Delimiter">(</span>key<span class="Delimiter">,</span> value<span class="Delimiter">)).</span>first<span class="Delimiter">-></span>second = value<span class="Delimiter">;</span> +<span id="L224" class="LineNr">224 </span> <span class="Identifier">return</span> value<span class="Delimiter">;</span> +<span id="L225" class="LineNr">225 </span><span class="Delimiter">}</span> +<span id="L226" class="LineNr">226 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">bool</span> contains_key<span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L227" class="LineNr">227 </span> <span class="Identifier">return</span> map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">)</span> != map<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L228" class="LineNr">228 </span><span class="Delimiter">}</span> +<span id="L229" class="LineNr">229 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type& <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L230" class="LineNr">230 </span> <span class="Identifier">return</span> map[key]<span class="Delimiter">;</span> +<span id="L231" class="LineNr">231 </span><span class="Delimiter">}</span> +<span id="L232" class="LineNr">232 </span><span class="Comment">//: The contract: any container that relies on get_or_insert should never call</span> +<span id="L233" class="LineNr">233 </span><span class="Comment">//: contains_key.</span> +<span id="L234" class="LineNr">234 </span> +<span id="L235" class="LineNr">235 </span><span class="Comment">//: 7. istreams are a royal pain in the arse. You have to be careful about</span> +<span id="L236" class="LineNr">236 </span><span class="Comment">//: what subclass you try to putback into. You have to watch out for the pesky</span> +<span id="L237" class="LineNr">237 </span><span class="Comment">//: failbit and badbit. Just avoid eof() and use this helper instead.</span> +<span id="L238" class="LineNr">238 </span><span class="Delimiter">:(code)</span> +<span id="L239" class="LineNr">239 </span><span class="Normal">bool</span> <a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L240" class="LineNr">240 </span> <span class="Identifier">return</span> in && !in<span class="Delimiter">.</span>eof<span class="Delimiter">();</span> +<span id="L241" class="LineNr">241 </span><span class="Delimiter">}</span> +<span id="L242" class="LineNr">242 </span> +<span id="L243" class="LineNr">243 </span><span class="Delimiter">:(before "End Includes")</span> +<span id="L244" class="LineNr">244 </span><span class="PreProc">#include </span><span class="Constant"><assert.h></span> +<span id="L245" class="LineNr">245 </span> +<span id="L246" class="LineNr">246 </span><span class="PreProc">#include </span><span class="Constant"><iostream></span> +<span id="L247" class="LineNr">247 </span><span class="Normal">using</span> std::istream<span class="Delimiter">;</span> +<span id="L248" class="LineNr">248 </span><span class="Normal">using</span> std::ostream<span class="Delimiter">;</span> +<span id="L249" class="LineNr">249 </span><span class="Normal">using</span> std::iostream<span class="Delimiter">;</span> +<span id="L250" class="LineNr">250 </span><span class="Normal">using</span> std::cin<span class="Delimiter">;</span> +<span id="L251" class="LineNr">251 </span><span class="Normal">using</span> std::cout<span class="Delimiter">;</span> +<span id="L252" class="LineNr">252 </span><span class="Normal">using</span> std::cerr<span class="Delimiter">;</span> +<span id="L253" class="LineNr">253 </span><span class="PreProc">#include </span><span class="Constant"><iomanip></span> +<span id="L254" class="LineNr">254 </span> +<span id="L255" class="LineNr">255 </span><span class="PreProc">#include </span><span class="Constant"><string.h></span> +<span id="L256" class="LineNr">256 </span><span class="PreProc">#include </span><span class="Constant"><string></span> +<span id="L257" class="LineNr">257 </span><span class="Normal">using</span> std::string<span class="Delimiter">;</span> +<span id="L258" class="LineNr">258 </span> +<span id="L259" class="LineNr">259 </span><span class="PreProc">#define unused __attribute__((unused))</span> +<span id="L260" class="LineNr">260 </span> +<span id="L261" class="LineNr">261 </span><span class="PreProc">#include </span><span class="Constant"><algorithm></span> +<span id="L262" class="LineNr">262 </span><span class="Normal">using</span> std::min<span class="Delimiter">;</span> +<span id="L263" class="LineNr">263 </span><span class="Normal">using</span> std::max<span class="Delimiter">;</span> </pre> </body> </html> diff --git a/html/003trace.cc.html b/html/003trace.cc.html index b374865a..5087f342 100644 --- a/html/003trace.cc.html +++ b/html/003trace.cc.html @@ -257,7 +257,7 @@ if ('onhashchange' in window) { <span id="L196" class="LineNr">196 </span><span class="Delimiter">:(before "End Types")</span> <span id="L197" class="LineNr">197 </span><span class="Normal">struct</span> <a href='003trace.cc.html#L197'>end</a> <span class="Delimiter">{};</span> <span id="L198" class="LineNr">198 </span><span class="Delimiter">:(code)</span> -<span id="L199" class="LineNr">199 </span>ostream& <span class="Normal">operator</span><<<span class="Delimiter">(</span>ostream& os<span class="Delimiter">,</span> <a href='001help.cc.html#L258'>unused</a> <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L199" class="LineNr">199 </span>ostream& <span class="Normal">operator</span><<<span class="Delimiter">(</span>ostream& os<span class="Delimiter">,</span> <a href='001help.cc.html#L259'>unused</a> <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L200" class="LineNr">200 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> Trace_stream<span class="Delimiter">-></span><a href='003trace.cc.html#L127'>newline</a><span class="Delimiter">();</span> <span id="L201" class="LineNr">201 </span> <span class="Identifier">return</span> os<span class="Delimiter">;</span> <span id="L202" class="LineNr">202 </span><span class="Delimiter">}</span> diff --git a/html/010vm.cc.html b/html/010vm.cc.html index c37b89f9..bc742c78 100644 --- a/html/010vm.cc.html +++ b/html/010vm.cc.html @@ -196,18 +196,18 @@ if ('onhashchange' in window) { <span id="L132" class="LineNr">132 </span> Next_type_ordinal = <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L133" class="LineNr">133 </span> <span class="Comment">// Mu Types Initialization</span> <span id="L134" class="LineNr">134 </span> <a href='010vm.cc.html#L123'>type_ordinal</a> number = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"number"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L135" class="LineNr">135 </span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> number<span class="Delimiter">).</span>name = <span class="Constant">"number"</span><span class="Delimiter">;</span> +<span id="L135" class="LineNr">135 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> number<span class="Delimiter">).</span>name = <span class="Constant">"number"</span><span class="Delimiter">;</span> <span id="L136" class="LineNr">136 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"location"</span><span class="Delimiter">,</span> number<span class="Delimiter">);</span> <span class="Comment">// synonym of number to indicate we only care about its size</span> <span id="L137" class="LineNr">137 </span> <a href='010vm.cc.html#L123'>type_ordinal</a> <a href='043space.cc.html#L82'>address</a> = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L138" class="LineNr">138 </span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">).</span>name = <span class="Constant">"address"</span><span class="Delimiter">;</span> +<span id="L138" class="LineNr">138 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">).</span>name = <span class="Constant">"address"</span><span class="Delimiter">;</span> <span id="L139" class="LineNr">139 </span> <a href='010vm.cc.html#L123'>type_ordinal</a> boolean = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"boolean"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L140" class="LineNr">140 </span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> boolean<span class="Delimiter">).</span>name = <span class="Constant">"boolean"</span><span class="Delimiter">;</span> +<span id="L140" class="LineNr">140 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> boolean<span class="Delimiter">).</span>name = <span class="Constant">"boolean"</span><span class="Delimiter">;</span> <span id="L141" class="LineNr">141 </span> <a href='010vm.cc.html#L123'>type_ordinal</a> character = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"character"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L142" class="LineNr">142 </span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> character<span class="Delimiter">).</span>name = <span class="Constant">"character"</span><span class="Delimiter">;</span> +<span id="L142" class="LineNr">142 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> character<span class="Delimiter">).</span>name = <span class="Constant">"character"</span><span class="Delimiter">;</span> <span id="L143" class="LineNr">143 </span> <span class="Comment">// Array types are a special modifier to any other type. For example,</span> <span id="L144" class="LineNr">144 </span> <span class="Comment">// array:number or array:address:boolean.</span> <span id="L145" class="LineNr">145 </span> <a href='010vm.cc.html#L123'>type_ordinal</a> array = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"array"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L146" class="LineNr">146 </span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> array<span class="Delimiter">).</span>name = <span class="Constant">"array"</span><span class="Delimiter">;</span> +<span id="L146" class="LineNr">146 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> array<span class="Delimiter">).</span>name = <span class="Constant">"array"</span><span class="Delimiter">;</span> <span id="L147" class="LineNr">147 </span> <span class="Comment">// End Mu Types Initialization</span> <span id="L148" class="LineNr">148 </span><span class="Delimiter">}</span> <span id="L149" class="LineNr">149 </span><span class="Normal">void</span> <a href='010vm.cc.html#L149'>teardown_types</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> @@ -361,7 +361,7 @@ if ('onhashchange' in window) { <span id="L297" class="LineNr">297 </span><span class="Delimiter">}</span> <span id="L298" class="LineNr">298 </span> <span id="L299" class="LineNr">299 </span><span class="Normal">void</span> slurp_properties<span class="Delimiter">(</span>istream& in<span class="Delimiter">,</span> vector<pair<string<span class="Delimiter">,</span> string_tree*> >& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L300" class="LineNr">300 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L300" class="LineNr">300 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L301" class="LineNr">301 </span> <span class="Conceal">¦</span> istringstream row<span class="Delimiter">(</span>slurp_until<span class="Delimiter">(</span>in<span class="Delimiter">,</span> <span class="Constant">'/'</span><span class="Delimiter">));</span> <span id="L302" class="LineNr">302 </span> <span class="Conceal">¦</span> row >> std::noskipws<span class="Delimiter">;</span> <span id="L303" class="LineNr">303 </span> <span class="Conceal">¦</span> string key = slurp_until<span class="Delimiter">(</span>row<span class="Delimiter">,</span> <span class="Constant">':'</span><span class="Delimiter">);</span> @@ -658,11 +658,11 @@ if ('onhashchange' in window) { <span id="L594" class="LineNr">594 </span><span class="Comment">//: Use inspect() only for emitting a canonical format that can be parsed back</span> <span id="L595" class="LineNr">595 </span><span class="Comment">//: into the value.</span> <span id="L596" class="LineNr">596 </span> -<span id="L597" class="LineNr">597 </span>string <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> recipe& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L597" class="LineNr">597 </span>string <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> recipe& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L598" class="LineNr">598 </span> ostringstream out<span class="Delimiter">;</span> <span id="L599" class="LineNr">599 </span> out << <span class="Constant">"recipe "</span> << r<span class="Delimiter">.</span>name << <span class="Constant">" [</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> <span id="L600" class="LineNr">600 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L601" class="LineNr">601 </span> <span class="Conceal">¦</span> out << <span class="Constant">" "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L601" class="LineNr">601 </span> <span class="Conceal">¦</span> out << <span class="Constant">" "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L602" class="LineNr">602 </span> out << <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> <span id="L603" class="LineNr">603 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L604" class="LineNr">604 </span><span class="Delimiter">}</span> @@ -682,7 +682,7 @@ if ('onhashchange' in window) { <span id="L618" class="LineNr">618 </span> <span class="Comment">// Begin debug_string(recipe x)</span> <span id="L619" class="LineNr">619 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L620" class="LineNr">620 </span> <span class="Conceal">¦</span> <span class="Normal">const</span> instruction& inst = x<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> -<span id="L621" class="LineNr">621 </span> <span class="Conceal">¦</span> out << <span class="Constant">"inst: "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L621" class="LineNr">621 </span> <span class="Conceal">¦</span> out << <span class="Constant">"inst: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L622" class="LineNr">622 </span> <span class="Conceal">¦</span> out << <span class="Constant">" ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> <span id="L623" class="LineNr">623 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L624" class="LineNr">624 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> out << <span class="Constant">" "</span> << debug_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> @@ -711,30 +711,30 @@ if ('onhashchange' in window) { <span id="L647" class="LineNr">647 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L648" class="LineNr">648 </span><span class="Delimiter">}</span> <span id="L649" class="LineNr">649 </span> -<span id="L650" class="LineNr">650 </span>string <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L650" class="LineNr">650 </span>string <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L651" class="LineNr">651 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">return</span> inst<span class="Delimiter">.</span>label<span class="Delimiter">;</span> <span id="L652" class="LineNr">652 </span> ostringstream out<span class="Delimiter">;</span> <span id="L653" class="LineNr">653 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L654" class="LineNr">654 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>i > <span class="Constant">0</span><span class="Delimiter">)</span> out << <span class="Constant">", "</span><span class="Delimiter">;</span> -<span id="L655" class="LineNr">655 </span> <span class="Conceal">¦</span> out << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L655" class="LineNr">655 </span> <span class="Conceal">¦</span> out << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L656" class="LineNr">656 </span> <span class="Delimiter">}</span> <span id="L657" class="LineNr">657 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> out << <span class="Constant">" <- "</span><span class="Delimiter">;</span> <span id="L658" class="LineNr">658 </span> out << inst<span class="Delimiter">.</span>name << <span class="Constant">' '</span><span class="Delimiter">;</span> <span id="L659" class="LineNr">659 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L660" class="LineNr">660 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>i > <span class="Constant">0</span><span class="Delimiter">)</span> out << <span class="Constant">", "</span><span class="Delimiter">;</span> -<span id="L661" class="LineNr">661 </span> <span class="Conceal">¦</span> out << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L661" class="LineNr">661 </span> <span class="Conceal">¦</span> out << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L662" class="LineNr">662 </span> <span class="Delimiter">}</span> <span id="L663" class="LineNr">663 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L664" class="LineNr">664 </span><span class="Delimiter">}</span> <span id="L665" class="LineNr">665 </span> -<span id="L666" class="LineNr">666 </span>string <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L666" class="LineNr">666 </span>string <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L667" class="LineNr">667 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_dummy<span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">"_"</span><span class="Delimiter">;</span> <span id="L668" class="LineNr">668 </span> ostringstream out<span class="Delimiter">;</span> <span id="L669" class="LineNr">669 </span> out << <span class="Constant">"{"</span><span class="Delimiter">;</span> <span id="L670" class="LineNr">670 </span> out << r<span class="Delimiter">.</span>name << <span class="Constant">": "</span> << names_to_string<span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">);</span> <span id="L671" class="LineNr">671 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L672" class="LineNr">672 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>properties<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L673" class="LineNr">673 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> out << <span class="Constant">", </span><span class="cSpecial">\"</span><span class="Constant">"</span> << r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>first << <span class="Constant">"</span><span class="cSpecial">\"</span><span class="Constant">: "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>second<span class="Delimiter">);</span> +<span id="L673" class="LineNr">673 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> out << <span class="Constant">", </span><span class="cSpecial">\"</span><span class="Constant">"</span> << r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>first << <span class="Constant">"</span><span class="cSpecial">\"</span><span class="Constant">: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>second<span class="Delimiter">);</span> <span id="L674" class="LineNr">674 </span> <span class="Delimiter">}</span> <span id="L675" class="LineNr">675 </span> out << <span class="Constant">"}"</span><span class="Delimiter">;</span> <span id="L676" class="LineNr">676 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> @@ -747,11 +747,11 @@ if ('onhashchange' in window) { <span id="L683" class="LineNr">683 </span> <span id="L684" class="LineNr">684 </span>string debug_string<span class="Delimiter">(</span><span class="Normal">const</span> reagent& x<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L685" class="LineNr">685 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L686" class="LineNr">686 </span> out << x<span class="Delimiter">.</span>name << <span class="Constant">": "</span> << x<span class="Delimiter">.</span>value << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">" -- "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">);</span> +<span id="L686" class="LineNr">686 </span> out << x<span class="Delimiter">.</span>name << <span class="Constant">": "</span> << x<span class="Delimiter">.</span>value << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">" -- "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L687" class="LineNr">687 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L688" class="LineNr">688 </span><span class="Delimiter">}</span> <span id="L689" class="LineNr">689 </span> -<span id="L690" class="LineNr">690 </span>string <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> string_tree* property<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L690" class="LineNr">690 </span>string <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> string_tree* property<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L691" class="LineNr">691 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!property<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">"()"</span><span class="Delimiter">;</span> <span id="L692" class="LineNr">692 </span> ostringstream out<span class="Delimiter">;</span> <span id="L693" class="LineNr">693 </span> dump<span class="Delimiter">(</span>property<span class="Delimiter">,</span> out<span class="Delimiter">);</span> @@ -779,7 +779,7 @@ if ('onhashchange' in window) { <span id="L715" class="LineNr">715 </span> out << <span class="Constant">')'</span><span class="Delimiter">;</span> <span id="L716" class="LineNr">716 </span><span class="Delimiter">}</span> <span id="L717" class="LineNr">717 </span> -<span id="L718" class="LineNr">718 </span>string <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L718" class="LineNr">718 </span>string <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L719" class="LineNr">719 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type == <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">"()"</span><span class="Delimiter">;</span> <span id="L720" class="LineNr">720 </span> ostringstream out<span class="Delimiter">;</span> <span id="L721" class="LineNr">721 </span> dump<span class="Delimiter">(</span>type<span class="Delimiter">,</span> out<span class="Delimiter">);</span> diff --git a/html/011load.cc.html b/html/011load.cc.html index 9a6ec529..bfc99952 100644 --- a/html/011load.cc.html +++ b/html/011load.cc.html @@ -86,7 +86,7 @@ if ('onhashchange' in window) { <span id="L22" class="LineNr"> 22 </span>vector<recipe_ordinal> load<span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L23" class="LineNr"> 23 </span> in >> std::noskipws<span class="Delimiter">;</span> <span id="L24" class="LineNr"> 24 </span> vector<recipe_ordinal> result<span class="Delimiter">;</span> -<span id="L25" class="LineNr"> 25 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L25" class="LineNr"> 25 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L26" class="LineNr"> 26 </span> <span class="Conceal">¦</span> <a href='011load.cc.html#L209'>skip_whitespace_and_comments</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L27" class="LineNr"> 27 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L28" class="LineNr"> 28 </span> <span class="Conceal">¦</span> string command = <a href='011load.cc.html#L167'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> @@ -152,7 +152,7 @@ if ('onhashchange' in window) { <span id="L88" class="LineNr"> 88 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='011load.cc.html#L96'>next_instruction</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> &curr<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L89" class="LineNr"> 89 </span> <span class="Conceal">¦</span> curr<span class="Delimiter">.</span>original_string = to_original_string<span class="Delimiter">(</span>curr<span class="Delimiter">);</span> <span id="L90" class="LineNr"> 90 </span> <span class="Conceal">¦</span> <span class="Comment">// End Rewrite Instruction(curr, recipe result)</span> -<span id="L91" class="LineNr"> 91 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"after rewriting: "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>curr<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L91" class="LineNr"> 91 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"after rewriting: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>curr<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L92" class="LineNr"> 92 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!curr<span class="Delimiter">.</span>is_empty<span class="Delimiter">())</span> result<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>curr<span class="Delimiter">);</span> <span id="L93" class="LineNr"> 93 </span> <span class="Delimiter">}</span> <span id="L94" class="LineNr"> 94 </span><span class="Delimiter">}</span> @@ -166,7 +166,7 @@ if ('onhashchange' in window) { <span id="L102" class="LineNr">102 </span> <span class="Delimiter">}</span> <span id="L103" class="LineNr">103 </span> <span id="L104" class="LineNr">104 </span> vector<string> words<span class="Delimiter">;</span> -<span id="L105" class="LineNr">105 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L105" class="LineNr">105 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L106" class="LineNr">106 </span> <span class="Conceal">¦</span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L107" class="LineNr">107 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L108" class="LineNr">108 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L197'>end</a> of file (1)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> @@ -216,9 +216,9 @@ if ('onhashchange' in window) { <span id="L152" class="LineNr">152 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"instruction: "</span> << curr<span class="Delimiter">-></span>name << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L153" class="LineNr">153 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" number of ingredients: "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>curr<span class="Delimiter">-></span>ingredients<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L154" class="LineNr">154 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<reagent>::iterator p = curr<span class="Delimiter">-></span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != curr<span class="Delimiter">-></span>ingredients<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> -<span id="L155" class="LineNr">155 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" ingredient: "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>*p<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L155" class="LineNr">155 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" ingredient: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>*p<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L156" class="LineNr">156 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<reagent>::iterator p = curr<span class="Delimiter">-></span>products<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != curr<span class="Delimiter">-></span>products<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> -<span id="L157" class="LineNr">157 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" product: "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>*p<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L157" class="LineNr">157 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" product: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>*p<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L158" class="LineNr">158 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L159" class="LineNr">159 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"9: unbalanced '[' for <a href='010vm.cc.html#L19'>recipe</a></span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L160" class="LineNr">160 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> @@ -256,7 +256,7 @@ if ('onhashchange' in window) { <span id="L192" class="LineNr">192 </span><span class="Delimiter">:(code)</span> <span id="L193" class="LineNr">193 </span><span class="Normal">void</span> <a href='011load.cc.html#L193'>slurp_word</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L194" class="LineNr">194 </span> <span class="Normal">char</span> c<span class="Delimiter">;</span> -<span id="L195" class="LineNr">195 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && Terminators<span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L195" class="LineNr">195 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && Terminators<span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L196" class="LineNr">196 </span> <span class="Conceal">¦</span> in >> c<span class="Delimiter">;</span> <span id="L197" class="LineNr">197 </span> <span class="Conceal">¦</span> out << c<span class="Delimiter">;</span> <span id="L198" class="LineNr">198 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> @@ -293,9 +293,9 @@ if ('onhashchange' in window) { <span id="L229" class="LineNr">229 </span><span class="Delimiter">}</span> <span id="L230" class="LineNr">230 </span> <span id="L231" class="LineNr">231 </span><span class="Normal">void</span> <a href='011load.cc.html#L231'>skip_comment</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L232" class="LineNr">232 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'#'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L232" class="LineNr">232 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'#'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L233" class="LineNr">233 </span> <span class="Conceal">¦</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> -<span id="L234" class="LineNr">234 </span> <span class="Conceal">¦</span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> +<span id="L234" class="LineNr">234 </span> <span class="Conceal">¦</span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span id="L235" class="LineNr">235 </span> <span class="Delimiter">}</span> <span id="L236" class="LineNr">236 </span><span class="Delimiter">}</span> <span id="L237" class="LineNr">237 </span> diff --git a/html/014literal_string.cc.html b/html/014literal_string.cc.html index 067f1ca4..07bfa932 100644 --- a/html/014literal_string.cc.html +++ b/html/014literal_string.cc.html @@ -95,7 +95,7 @@ if ('onhashchange' in window) { <span id="L32" class="LineNr"> 32 </span><span class="Delimiter">:(code)</span> <span id="L33" class="LineNr"> 33 </span>string <a href='014literal_string.cc.html#L33'>slurp_quoted</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L34" class="LineNr"> 34 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L35" class="LineNr"> 35 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">));</span> assert<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'['</span><span class="Delimiter">);</span> out << <span class="Normal">static_cast</span><<span class="Normal">char</span>><span class="Delimiter">(</span>in<span class="Delimiter">.</span>get<span class="Delimiter">());</span> <span class="Comment">// slurp the '['</span> +<span id="L35" class="LineNr"> 35 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">));</span> assert<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'['</span><span class="Delimiter">);</span> out << <span class="Normal">static_cast</span><<span class="Normal">char</span>><span class="Delimiter">(</span>in<span class="Delimiter">.</span>get<span class="Delimiter">());</span> <span class="Comment">// slurp the '['</span> <span id="L36" class="LineNr"> 36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='014literal_string.cc.html#L45'>is_code_string</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> out<span class="Delimiter">))</span> <span id="L37" class="LineNr"> 37 </span> <span class="Conceal">¦</span> <a href='014literal_string.cc.html#L82'>slurp_quoted_comment_aware</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> out<span class="Delimiter">);</span> <span id="L38" class="LineNr"> 38 </span> <span class="Normal">else</span> @@ -106,7 +106,7 @@ if ('onhashchange' in window) { <span id="L43" class="LineNr"> 43 </span><span class="Comment">// A string is a code string (ignores comments when scanning for matching</span> <span id="L44" class="LineNr"> 44 </span><span class="Comment">// brackets) if it contains a newline at the start before any non-whitespace.</span> <span id="L45" class="LineNr"> 45 </span><span class="Normal">bool</span> <a href='014literal_string.cc.html#L45'>is_code_string</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L46" class="LineNr"> 46 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L46" class="LineNr"> 46 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L47" class="LineNr"> 47 </span> <span class="Conceal">¦</span> <span class="Normal">char</span> c = in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span id="L48" class="LineNr"> 48 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!isspace<span class="Delimiter">(</span>c<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L49" class="LineNr"> 49 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> in<span class="Delimiter">.</span>putback<span class="Delimiter">(</span>c<span class="Delimiter">);</span> @@ -124,7 +124,7 @@ if ('onhashchange' in window) { <span id="L61" class="LineNr"> 61 </span><span class="Comment">// strings.</span> <span id="L62" class="LineNr"> 62 </span><span class="Normal">void</span> <a href='014literal_string.cc.html#L62'>slurp_quoted_comment_oblivious</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L63" class="LineNr"> 63 </span> <span class="Normal">int</span> brace_depth = <span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L64" class="LineNr"> 64 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L64" class="LineNr"> 64 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L65" class="LineNr"> 65 </span> <span class="Conceal">¦</span> <span class="Normal">char</span> c = in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span id="L66" class="LineNr"> 66 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="cSpecial">'\\'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L67" class="LineNr"> 67 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='014literal_string.cc.html#L148'>slurp_one_past_backslashes</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> out<span class="Delimiter">);</span> @@ -151,7 +151,7 @@ if ('onhashchange' in window) { <span id="L88" class="LineNr"> 88 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L89" class="LineNr"> 89 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="Constant">'#'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L90" class="LineNr"> 90 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> out << c<span class="Delimiter">;</span> -<span id="L91" class="LineNr"> 91 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> out << <span class="Normal">static_cast</span><<span class="Normal">char</span>><span class="Delimiter">(</span>in<span class="Delimiter">.</span>get<span class="Delimiter">());</span> +<span id="L91" class="LineNr"> 91 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> out << <span class="Normal">static_cast</span><<span class="Normal">char</span>><span class="Delimiter">(</span>in<span class="Delimiter">.</span>get<span class="Delimiter">());</span> <span id="L92" class="LineNr"> 92 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L93" class="LineNr"> 93 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L94" class="LineNr"> 94 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="Constant">'['</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -223,7 +223,7 @@ if ('onhashchange' in window) { <span id="L160" class="LineNr">160 </span> <span class="Comment">// special characters. So Mu doesn't follow C's approach of overloading</span> <span id="L161" class="LineNr">161 </span> <span class="Comment">// backslashes both to escape quote characters and also as a notation for</span> <span id="L162" class="LineNr">162 </span> <span class="Comment">// unprintable characters like '\n'.</span> -<span id="L163" class="LineNr">163 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L163" class="LineNr">163 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L164" class="LineNr">164 </span> <span class="Conceal">¦</span> <span class="Normal">char</span> c = in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span id="L165" class="LineNr">165 </span> <span class="Conceal">¦</span> out << c<span class="Delimiter">;</span> <span id="L166" class="LineNr">166 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>c != <span class="cSpecial">'\\'</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> diff --git a/html/016dilated_reagent.cc.html b/html/016dilated_reagent.cc.html index 80345d79..3a5278d8 100644 --- a/html/016dilated_reagent.cc.html +++ b/html/016dilated_reagent.cc.html @@ -183,7 +183,7 @@ if ('onhashchange' in window) { <span id="L118" class="LineNr">118 </span> <span class="Conceal">¦</span> type = <a href='018type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span>type_names<span class="Delimiter">);</span> <span id="L119" class="LineNr">119 </span> <span class="Conceal">¦</span> <span class="Normal">delete</span> type_names<span class="Delimiter">;</span> <span id="L120" class="LineNr">120 </span> <span class="Delimiter">}</span> -<span id="L121" class="LineNr">121 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L121" class="LineNr">121 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L122" class="LineNr">122 </span> <span class="Conceal">¦</span> string key = <a href='016dilated_reagent.cc.html#L139'>slurp_key</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L123" class="LineNr">123 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L124" class="LineNr">124 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">"}"</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> diff --git a/html/017parse_tree.cc.html b/html/017parse_tree.cc.html index cb0e91da..85b264e3 100644 --- a/html/017parse_tree.cc.html +++ b/html/017parse_tree.cc.html @@ -123,7 +123,7 @@ if ('onhashchange' in window) { <span id="L59" class="LineNr"> 59 </span> string_tree** curr = &result<span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><span class="Constant">true</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L61" class="LineNr"> 61 </span> <span class="Conceal">¦</span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> -<span id="L62" class="LineNr"> 62 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">));</span> +<span id="L62" class="LineNr"> 62 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">));</span> <span id="L63" class="LineNr"> 63 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">')'</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L64" class="LineNr"> 64 </span> <span class="Conceal">¦</span> *curr = <span class="Normal">new</span> string_tree<span class="Delimiter">(</span><span class="Constant">NULL</span><span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">);</span> <span id="L65" class="LineNr"> 65 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'('</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> diff --git a/html/018type_abbreviations.cc.html b/html/018type_abbreviations.cc.html index dd6954b0..01a8d73f 100644 --- a/html/018type_abbreviations.cc.html +++ b/html/018type_abbreviations.cc.html @@ -86,13 +86,13 @@ if ('onhashchange' in window) { <span id="L21" class="LineNr"> 21 </span><span class="Delimiter">:(code)</span> <span id="L22" class="LineNr"> 22 </span><span class="Normal">void</span> <a href='018type_abbreviations.cc.html#L22'>load_type_abbreviations</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L23" class="LineNr"> 23 </span> string new_type_name = <a href='011load.cc.html#L167'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> -<span id="L24" class="LineNr"> 24 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> || !new_type_name<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L24" class="LineNr"> 24 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> || !new_type_name<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> <span id="L25" class="LineNr"> 25 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">)</span> || new_type_name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L26" class="LineNr"> 26 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"incomplete 'type' statement; must be of the form 'type <new type name> = <type expression>'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L27" class="LineNr"> 27 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L28" class="LineNr"> 28 </span> <span class="Delimiter">}</span> <span id="L29" class="LineNr"> 29 </span> string arrow = <a href='011load.cc.html#L167'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> -<span id="L30" class="LineNr"> 30 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> || !arrow<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L30" class="LineNr"> 30 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> || !arrow<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> <span id="L31" class="LineNr"> 31 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>arrow<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L32" class="LineNr"> 32 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"incomplete 'type' statement 'type "</span> << new_type_name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L33" class="LineNr"> 33 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> diff --git a/html/020run.cc.html b/html/020run.cc.html index d288c1ef..48ff966f 100644 --- a/html/020run.cc.html +++ b/html/020run.cc.html @@ -130,9 +130,9 @@ if ('onhashchange' in window) { <span id="L63" class="LineNr"> 63 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='073scheduler.cc.html#L28'>should_continue_running</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// beware: may modify Current_routine</span> <span id="L64" class="LineNr"> 64 </span> <span class="Conceal">¦</span> <span class="Comment">// Running One Instruction</span> <span id="L65" class="LineNr"> 65 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>is_label<span class="Delimiter">)</span> <span class="Delimiter">{</span> ++current_step_index<span class="Delimiter">();</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> -<span id="L66" class="LineNr"> 66 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span>Initial_callstack_depth + Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">())</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L66" class="LineNr"> 66 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span>Initial_callstack_depth + Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">())</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L67" class="LineNr"> 67 </span><span class="CommentedCode">//? if (Foo) cerr << "run: " << to_string(current_instruction()) << '\n';</span> -<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L69" class="LineNr"> 69 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"something wrote to location 0; this should never happen</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L70" class="LineNr"> 70 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L71" class="LineNr"> 71 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> @@ -362,7 +362,7 @@ if ('onhashchange' in window) { <span id="L295" class="LineNr">295 </span> <span class="Comment">// End Preprocess read_memory(x)</span> <span id="L296" class="LineNr">296 </span> <span class="Normal">int</span> size = size_of<span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L297" class="LineNr">297 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> offset = <span class="Constant">0</span><span class="Delimiter">;</span> offset < size<span class="Delimiter">;</span> ++offset<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L298" class="LineNr">298 </span> <span class="Conceal">¦</span> <span class="Normal">double</span> val = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value+offset<span class="Delimiter">);</span> +<span id="L298" class="LineNr">298 </span> <span class="Conceal">¦</span> <span class="Normal">double</span> val = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value+offset<span class="Delimiter">);</span> <span id="L299" class="LineNr">299 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << x<span class="Delimiter">.</span>value+offset << <span class="Constant">" is "</span> << no_scientific<span class="Delimiter">(</span>val<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L300" class="LineNr">300 </span> <span class="Conceal">¦</span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>val<span class="Delimiter">);</span> <span id="L301" class="LineNr">301 </span> <span class="Delimiter">}</span> @@ -373,7 +373,7 @@ if ('onhashchange' in window) { <span id="L306" class="LineNr">306 </span> assert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">);</span> <span class="Comment">// run-time only</span> <span id="L307" class="LineNr">307 </span> <span class="Comment">// Begin Preprocess write_memory(x, data)</span> <span id="L308" class="LineNr">308 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L309" class="LineNr">309 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"can't write to '"</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">"'; no type</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L309" class="LineNr">309 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"can't write to '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">"'; no type</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> <span id="L310" class="LineNr">310 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L311" class="LineNr">311 </span> <span class="Delimiter">}</span> <span id="L312" class="LineNr">312 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_dummy<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> @@ -411,7 +411,7 @@ if ('onhashchange' in window) { <span id="L344" class="LineNr">344 </span> <span class="Delimiter">}</span> <span id="L345" class="LineNr">345 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L346" class="LineNr">346 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L347" class="LineNr">347 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L347" class="LineNr">347 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L348" class="LineNr">348 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L349" class="LineNr">349 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L350" class="LineNr">350 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">1</span><span class="Delimiter">;</span> diff --git a/html/021check_instruction.cc.html b/html/021check_instruction.cc.html index 2c6d23af..1bb63476 100644 --- a/html/021check_instruction.cc.html +++ b/html/021check_instruction.cc.html @@ -271,7 +271,7 @@ if ('onhashchange' in window) { <span id="L208" class="LineNr">208 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>type<span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L209" class="LineNr">209 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L210" class="LineNr">210 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L211" class="LineNr">211 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L211" class="LineNr">211 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L212" class="LineNr">212 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L213" class="LineNr">213 </span> <span class="Delimiter">}</span> <span id="L214" class="LineNr">214 </span> <span class="Identifier">return</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"array"</span><span class="Delimiter">);</span> @@ -286,7 +286,7 @@ if ('onhashchange' in window) { <span id="L223" class="LineNr">223 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>type<span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L224" class="LineNr">224 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L225" class="LineNr">225 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L226" class="LineNr">226 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L226" class="LineNr">226 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L227" class="LineNr">227 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L228" class="LineNr">228 </span> <span class="Delimiter">}</span> <span id="L229" class="LineNr">229 </span> <span class="Identifier">return</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">);</span> diff --git a/html/026call.cc.html b/html/026call.cc.html index 096383c6..35004151 100644 --- a/html/026call.cc.html +++ b/html/026call.cc.html @@ -269,6 +269,21 @@ if ('onhashchange' in window) { <span id="L203" class="LineNr">203 </span> <span class="Comment">// todo: fail if no products returned</span> <span id="L204" class="LineNr">204 </span> ++current_step_index<span class="Delimiter">();</span> <span id="L205" class="LineNr">205 </span><span class="Delimiter">}</span> +<span id="L206" class="LineNr">206 </span> +<span id="L207" class="LineNr">207 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +<span id="L208" class="LineNr">208 </span>_DUMP_CALL_STACK<span class="Delimiter">,</span> +<span id="L209" class="LineNr">209 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +<span id="L210" class="LineNr">210 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$dump-call-stack"</span><span class="Delimiter">,</span> _DUMP_CALL_STACK<span class="Delimiter">);</span> +<span id="L211" class="LineNr">211 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> +<span id="L212" class="LineNr">212 </span><span class="Normal">case</span> _DUMP_CALL_STACK: <span class="Delimiter">{</span> +<span id="L213" class="LineNr">213 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L214" class="LineNr">214 </span><span class="Delimiter">}</span> +<span id="L215" class="LineNr">215 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +<span id="L216" class="LineNr">216 </span><span class="Normal">case</span> _DUMP_CALL_STACK: <span class="Delimiter">{</span> +<span id="L217" class="LineNr">217 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_reverse_iterator p = Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>rbegin<span class="Delimiter">();</span> p != Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>rend<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> +<span id="L218" class="LineNr">218 </span> <span class="Conceal">¦</span> cerr << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="Constant">":"</span> << p<span class="Delimiter">-></span>running_step_index << <span class="Constant">" -- "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L86'>to_instruction</a><span class="Delimiter">(</span>*p<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L219" class="LineNr">219 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L220" class="LineNr">220 </span><span class="Delimiter">}</span> </pre> </body> </html> diff --git a/html/027call_ingredient.cc.html b/html/027call_ingredient.cc.html index 3353aadb..8137161c 100644 --- a/html/027call_ingredient.cc.html +++ b/html/027call_ingredient.cc.html @@ -103,152 +103,155 @@ if ('onhashchange' in window) { <span id="L40" class="LineNr"> 40 </span>NEXT_INGREDIENT<span class="Delimiter">,</span> <span id="L41" class="LineNr"> 41 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> <span id="L42" class="LineNr"> 42 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"next-ingredient"</span><span class="Delimiter">,</span> NEXT_INGREDIENT<span class="Delimiter">);</span> -<span id="L43" class="LineNr"> 43 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> -<span id="L44" class="LineNr"> 44 </span><span class="Normal">case</span> NEXT_INGREDIENT: <span class="Delimiter">{</span> -<span id="L45" class="LineNr"> 45 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L46" class="LineNr"> 46 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'next-ingredient' didn't expect any ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> -<span id="L47" class="LineNr"> 47 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L48" class="LineNr"> 48 </span> <span class="Delimiter">}</span> -<span id="L49" class="LineNr"> 49 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L50" class="LineNr"> 50 </span><span class="Delimiter">}</span> -<span id="L51" class="LineNr"> 51 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -<span id="L52" class="LineNr"> 52 </span><span class="Normal">case</span> NEXT_INGREDIENT: <span class="Delimiter">{</span> -<span id="L53" class="LineNr"> 53 </span> assert<span class="Delimiter">(</span>!Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L54" class="LineNr"> 54 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L55" class="LineNr"> 55 </span> <span class="Conceal">¦</span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> product = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L56" class="LineNr"> 56 </span> <span class="Conceal">¦</span> <span class="Comment">// End Preprocess NEXT_INGREDIENT product</span> -<span id="L57" class="LineNr"> 57 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">()</span> == <span class="Constant">"main"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L58" class="LineNr"> 58 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// no ingredient types since the call might be implicit; assume ingredients are always strings</span> -<span id="L59" class="LineNr"> 59 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// todo: how to test this?</span> -<span id="L60" class="LineNr"> 60 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_text<span class="Delimiter">(</span>product<span class="Delimiter">))</span> -<span id="L61" class="LineNr"> 61 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"main: wrong type for ingredient '"</span> << product<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L62" class="LineNr"> 62 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L63" class="LineNr"> 63 </span> <span class="Conceal">¦</span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>product<span class="Delimiter">,</span> -<span id="L64" class="LineNr"> 64 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L65" class="LineNr"> 65 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"wrong type for ingredient '"</span> << product<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L66" class="LineNr"> 66 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// End next-ingredient Type Mismatch Error</span> -<span id="L67" class="LineNr"> 67 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span> -<span id="L69" class="LineNr"> 69 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">));</span> -<span id="L70" class="LineNr"> 70 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>products<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">);</span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> <span class="Comment">// push a new vector</span> -<span id="L71" class="LineNr"> 71 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L72" class="LineNr"> 72 </span> <span class="Conceal">¦</span> ++current_call<span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">;</span> -<span id="L73" class="LineNr"> 73 </span> <span class="Delimiter">}</span> -<span id="L74" class="LineNr"> 74 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L75" class="LineNr"> 75 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">)</span> < <span class="Constant">2</span><span class="Delimiter">)</span> -<span id="L76" class="LineNr"> 76 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"no ingredient to save in '"</span> << current_instruction<span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L77" class="LineNr"> 77 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L78" class="LineNr"> 78 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> -<span id="L79" class="LineNr"> 79 </span> <span class="Conceal">¦</span> <span class="Comment">// pad the first product with sufficient zeros to match its type</span> -<span id="L80" class="LineNr"> 80 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>resize<span class="Delimiter">(</span>size_of<span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> -<span id="L81" class="LineNr"> 81 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L82" class="LineNr"> 82 </span> <span class="Delimiter">}</span> -<span id="L83" class="LineNr"> 83 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L84" class="LineNr"> 84 </span><span class="Delimiter">}</span> -<span id="L85" class="LineNr"> 85 </span> -<span id="L86" class="LineNr"> 86 </span><span class="Delimiter">:(scenario next_ingredient_fail_on_missing)</span> -<span id="L87" class="LineNr"> 87 </span><span class="Special">% Hide_errors = true;</span> -<span id="L88" class="LineNr"> 88 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L89" class="LineNr"> 89 </span> f -<span id="L90" class="LineNr"> 90 </span>] -<span id="L91" class="LineNr"> 91 </span><span class="muRecipe">def</span> f [ -<span id="L92" class="LineNr"> 92 </span> <span class="Constant">11</span>:num<span class="Special"> <- </span>next-ingredient -<span id="L93" class="LineNr"> 93 </span>] -<span id="L94" class="LineNr"> 94 </span><span class="traceContains">+error: f: no ingredient to save in '11:num'</span> -<span id="L95" class="LineNr"> 95 </span> -<span id="L96" class="LineNr"> 96 </span><span class="Delimiter">:(scenario rewind_ingredients)</span> -<span id="L97" class="LineNr"> 97 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L98" class="LineNr"> 98 </span> f <span class="Constant">2</span> -<span id="L99" class="LineNr"> 99 </span>] -<span id="L100" class="LineNr">100 </span><span class="muRecipe">def</span> f [ -<span id="L101" class="LineNr">101 </span> <span class="Constant">12</span>:num<span class="Special"> <- </span>next-ingredient <span class="Comment"># consume ingredient</span> -<span id="L102" class="LineNr">102 </span> _<span class="Delimiter">,</span> <span class="Constant">1</span>:<span class="Normal">bool</span><span class="Special"> <- </span>next-ingredient <span class="Comment"># will not find any ingredients</span> -<span id="L103" class="LineNr">103 </span> rewind-ingredients -<span id="L104" class="LineNr">104 </span> <span class="Constant">13</span>:num<span class="Delimiter">,</span> <span class="Constant">2</span>:<span class="Normal">bool</span><span class="Special"> <- </span>next-ingredient <span class="Comment"># will find ingredient again</span> -<span id="L105" class="LineNr">105 </span>] -<span id="L106" class="LineNr">106 </span><span class="traceContains">+mem: storing 2 in location 12</span> -<span id="L107" class="LineNr">107 </span><span class="traceContains">+mem: storing 0 in location 1</span> -<span id="L108" class="LineNr">108 </span><span class="traceContains">+mem: storing 2 in location 13</span> -<span id="L109" class="LineNr">109 </span><span class="traceContains">+mem: storing 1 in location 2</span> -<span id="L110" class="LineNr">110 </span> -<span id="L111" class="LineNr">111 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> -<span id="L112" class="LineNr">112 </span>REWIND_INGREDIENTS<span class="Delimiter">,</span> -<span id="L113" class="LineNr">113 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L114" class="LineNr">114 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"rewind-ingredients"</span><span class="Delimiter">,</span> REWIND_INGREDIENTS<span class="Delimiter">);</span> -<span id="L115" class="LineNr">115 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> -<span id="L116" class="LineNr">116 </span><span class="Normal">case</span> REWIND_INGREDIENTS: <span class="Delimiter">{</span> -<span id="L117" class="LineNr">117 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L118" class="LineNr">118 </span><span class="Delimiter">}</span> -<span id="L119" class="LineNr">119 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -<span id="L120" class="LineNr">120 </span><span class="Normal">case</span> REWIND_INGREDIENTS: <span class="Delimiter">{</span> -<span id="L121" class="LineNr">121 </span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L122" class="LineNr">122 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L123" class="LineNr">123 </span><span class="Delimiter">}</span> -<span id="L124" class="LineNr">124 </span> -<span id="L125" class="LineNr">125 </span><span class="Delimiter">:(scenario ingredient)</span> -<span id="L126" class="LineNr">126 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L127" class="LineNr">127 </span> f <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">2</span> -<span id="L128" class="LineNr">128 </span>] -<span id="L129" class="LineNr">129 </span><span class="muRecipe">def</span> f [ -<span id="L130" class="LineNr">130 </span> <span class="Constant">12</span>:num<span class="Special"> <- </span>ingredient <span class="Constant">1</span> <span class="Comment"># consume second ingredient first</span> -<span id="L131" class="LineNr">131 </span> <span class="Constant">13</span>:num<span class="Delimiter">,</span> <span class="Constant">1</span>:<span class="Normal">bool</span><span class="Special"> <- </span>next-ingredient <span class="Comment"># next-ingredient tries to scan past that</span> -<span id="L132" class="LineNr">132 </span>] -<span id="L133" class="LineNr">133 </span><span class="traceContains">+mem: storing 2 in location 12</span> -<span id="L134" class="LineNr">134 </span><span class="traceContains">+mem: storing 0 in location 1</span> -<span id="L135" class="LineNr">135 </span> -<span id="L136" class="LineNr">136 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> -<span id="L137" class="LineNr">137 </span>INGREDIENT<span class="Delimiter">,</span> -<span id="L138" class="LineNr">138 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L139" class="LineNr">139 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"ingredient"</span><span class="Delimiter">,</span> INGREDIENT<span class="Delimiter">);</span> -<span id="L140" class="LineNr">140 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> -<span id="L141" class="LineNr">141 </span><span class="Normal">case</span> INGREDIENT: <span class="Delimiter">{</span> -<span id="L142" class="LineNr">142 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L143" class="LineNr">143 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'ingredient' expects exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L144" class="LineNr">144 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L145" class="LineNr">145 </span> <span class="Delimiter">}</span> -<span id="L146" class="LineNr">146 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L147" class="LineNr">147 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'ingredient' expects a literal ingredient, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L148" class="LineNr">148 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L149" class="LineNr">149 </span> <span class="Delimiter">}</span> -<span id="L150" class="LineNr">150 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L151" class="LineNr">151 </span><span class="Delimiter">}</span> -<span id="L152" class="LineNr">152 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -<span id="L153" class="LineNr">153 </span><span class="Normal">case</span> INGREDIENT: <span class="Delimiter">{</span> -<span id="L154" class="LineNr">154 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L155" class="LineNr">155 </span> <span class="Conceal">¦</span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L156" class="LineNr">156 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span> -<span id="L157" class="LineNr">157 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">));</span> -<span id="L158" class="LineNr">158 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>products<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">);</span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> <span class="Comment">// push a new vector</span> -<span id="L159" class="LineNr">159 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L160" class="LineNr">160 </span> <span class="Conceal">¦</span> ++current_call<span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">;</span> -<span id="L161" class="LineNr">161 </span> <span class="Delimiter">}</span> -<span id="L162" class="LineNr">162 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L163" class="LineNr">163 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L164" class="LineNr">164 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> -<span id="L165" class="LineNr">165 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span class="Comment">// todo: will fail noisily if we try to read a compound value</span> -<span id="L166" class="LineNr">166 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L167" class="LineNr">167 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L168" class="LineNr">168 </span> <span class="Delimiter">}</span> -<span id="L169" class="LineNr">169 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L170" class="LineNr">170 </span><span class="Delimiter">}</span> -<span id="L171" class="LineNr">171 </span> -<span id="L172" class="LineNr">172 </span><span class="Comment">//: a particularly common array type is the text, or address:array:character</span> -<span id="L173" class="LineNr">173 </span><span class="Delimiter">:(code)</span> -<span id="L174" class="LineNr">174 </span><span class="Normal">bool</span> <a href='027call_ingredient.cc.html#L174'>is_mu_text</a><span class="Delimiter">(</span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> x<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L175" class="LineNr">175 </span> <span class="Comment">// End Preprocess is_mu_text(reagent x)</span> -<span id="L176" class="LineNr">176 </span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>type -<span id="L177" class="LineNr">177 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom -<span id="L178" class="LineNr">178 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom -<span id="L179" class="LineNr">179 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">)</span> -<span id="L180" class="LineNr">180 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right -<span id="L181" class="LineNr">181 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom -<span id="L182" class="LineNr">182 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom -<span id="L183" class="LineNr">183 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"array"</span><span class="Delimiter">)</span> -<span id="L184" class="LineNr">184 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right -<span id="L185" class="LineNr">185 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom -<span id="L186" class="LineNr">186 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"character"</span><span class="Delimiter">)</span> -<span id="L187" class="LineNr">187 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right == <span class="Constant">NULL</span><span class="Delimiter">;</span> -<span id="L188" class="LineNr">188 </span><span class="Delimiter">}</span> +<span id="L43" class="LineNr"> 43 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"next-input"</span><span class="Delimiter">,</span> NEXT_INGREDIENT<span class="Delimiter">);</span> +<span id="L44" class="LineNr"> 44 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> +<span id="L45" class="LineNr"> 45 </span><span class="Normal">case</span> NEXT_INGREDIENT: <span class="Delimiter">{</span> +<span id="L46" class="LineNr"> 46 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> +<span id="L47" class="LineNr"> 47 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'next-ingredient' didn't expect any ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L48" class="LineNr"> 48 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L49" class="LineNr"> 49 </span> <span class="Delimiter">}</span> +<span id="L50" class="LineNr"> 50 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L51" class="LineNr"> 51 </span><span class="Delimiter">}</span> +<span id="L52" class="LineNr"> 52 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +<span id="L53" class="LineNr"> 53 </span><span class="Normal">case</span> NEXT_INGREDIENT: <span class="Delimiter">{</span> +<span id="L54" class="LineNr"> 54 </span> assert<span class="Delimiter">(</span>!Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L55" class="LineNr"> 55 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L56" class="LineNr"> 56 </span> <span class="Conceal">¦</span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> product = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L57" class="LineNr"> 57 </span> <span class="Conceal">¦</span> <span class="Comment">// End Preprocess NEXT_INGREDIENT product</span> +<span id="L58" class="LineNr"> 58 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">()</span> == <span class="Constant">"main"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L59" class="LineNr"> 59 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// no ingredient types since the call might be implicit; assume ingredients are always strings</span> +<span id="L60" class="LineNr"> 60 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// todo: how to test this?</span> +<span id="L61" class="LineNr"> 61 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_text<span class="Delimiter">(</span>product<span class="Delimiter">))</span> +<span id="L62" class="LineNr"> 62 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"main: wrong type for ingredient '"</span> << product<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L63" class="LineNr"> 63 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L64" class="LineNr"> 64 </span> <span class="Conceal">¦</span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>product<span class="Delimiter">,</span> +<span id="L65" class="LineNr"> 65 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L66" class="LineNr"> 66 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"wrong type for ingredient '"</span> << product<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L67" class="LineNr"> 67 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// End next-ingredient Type Mismatch Error</span> +<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L69" class="LineNr"> 69 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span> +<span id="L70" class="LineNr"> 70 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">));</span> +<span id="L71" class="LineNr"> 71 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>products<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">);</span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> <span class="Comment">// push a new vector</span> +<span id="L72" class="LineNr"> 72 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L73" class="LineNr"> 73 </span> <span class="Conceal">¦</span> ++current_call<span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">;</span> +<span id="L74" class="LineNr"> 74 </span> <span class="Delimiter">}</span> +<span id="L75" class="LineNr"> 75 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> +<span id="L76" class="LineNr"> 76 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">)</span> < <span class="Constant">2</span><span class="Delimiter">)</span> +<span id="L77" class="LineNr"> 77 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"no ingredient to save in '"</span> << current_instruction<span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L78" class="LineNr"> 78 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L79" class="LineNr"> 79 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> +<span id="L80" class="LineNr"> 80 </span> <span class="Conceal">¦</span> <span class="Comment">// pad the first product with sufficient zeros to match its type</span> +<span id="L81" class="LineNr"> 81 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>resize<span class="Delimiter">(</span>size_of<span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> +<span id="L82" class="LineNr"> 82 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L83" class="LineNr"> 83 </span> <span class="Delimiter">}</span> +<span id="L84" class="LineNr"> 84 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L85" class="LineNr"> 85 </span><span class="Delimiter">}</span> +<span id="L86" class="LineNr"> 86 </span> +<span id="L87" class="LineNr"> 87 </span><span class="Delimiter">:(scenario next_ingredient_fail_on_missing)</span> +<span id="L88" class="LineNr"> 88 </span><span class="Special">% Hide_errors = true;</span> +<span id="L89" class="LineNr"> 89 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L90" class="LineNr"> 90 </span> f +<span id="L91" class="LineNr"> 91 </span>] +<span id="L92" class="LineNr"> 92 </span><span class="muRecipe">def</span> f [ +<span id="L93" class="LineNr"> 93 </span> <span class="Constant">11</span>:num<span class="Special"> <- </span>next-ingredient +<span id="L94" class="LineNr"> 94 </span>] +<span id="L95" class="LineNr"> 95 </span><span class="traceContains">+error: f: no ingredient to save in '11:num'</span> +<span id="L96" class="LineNr"> 96 </span> +<span id="L97" class="LineNr"> 97 </span><span class="Delimiter">:(scenario rewind_ingredients)</span> +<span id="L98" class="LineNr"> 98 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L99" class="LineNr"> 99 </span> f <span class="Constant">2</span> +<span id="L100" class="LineNr">100 </span>] +<span id="L101" class="LineNr">101 </span><span class="muRecipe">def</span> f [ +<span id="L102" class="LineNr">102 </span> <span class="Constant">12</span>:num<span class="Special"> <- </span>next-ingredient <span class="Comment"># consume ingredient</span> +<span id="L103" class="LineNr">103 </span> _<span class="Delimiter">,</span> <span class="Constant">1</span>:<span class="Normal">bool</span><span class="Special"> <- </span>next-ingredient <span class="Comment"># will not find any ingredients</span> +<span id="L104" class="LineNr">104 </span> rewind-ingredients +<span id="L105" class="LineNr">105 </span> <span class="Constant">13</span>:num<span class="Delimiter">,</span> <span class="Constant">2</span>:<span class="Normal">bool</span><span class="Special"> <- </span>next-ingredient <span class="Comment"># will find ingredient again</span> +<span id="L106" class="LineNr">106 </span>] +<span id="L107" class="LineNr">107 </span><span class="traceContains">+mem: storing 2 in location 12</span> +<span id="L108" class="LineNr">108 </span><span class="traceContains">+mem: storing 0 in location 1</span> +<span id="L109" class="LineNr">109 </span><span class="traceContains">+mem: storing 2 in location 13</span> +<span id="L110" class="LineNr">110 </span><span class="traceContains">+mem: storing 1 in location 2</span> +<span id="L111" class="LineNr">111 </span> +<span id="L112" class="LineNr">112 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +<span id="L113" class="LineNr">113 </span>REWIND_INGREDIENTS<span class="Delimiter">,</span> +<span id="L114" class="LineNr">114 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +<span id="L115" class="LineNr">115 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"rewind-ingredients"</span><span class="Delimiter">,</span> REWIND_INGREDIENTS<span class="Delimiter">);</span> +<span id="L116" class="LineNr">116 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"rewind-inputs"</span><span class="Delimiter">,</span> REWIND_INGREDIENTS<span class="Delimiter">);</span> +<span id="L117" class="LineNr">117 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> +<span id="L118" class="LineNr">118 </span><span class="Normal">case</span> REWIND_INGREDIENTS: <span class="Delimiter">{</span> +<span id="L119" class="LineNr">119 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L120" class="LineNr">120 </span><span class="Delimiter">}</span> +<span id="L121" class="LineNr">121 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +<span id="L122" class="LineNr">122 </span><span class="Normal">case</span> REWIND_INGREDIENTS: <span class="Delimiter">{</span> +<span id="L123" class="LineNr">123 </span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L124" class="LineNr">124 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L125" class="LineNr">125 </span><span class="Delimiter">}</span> +<span id="L126" class="LineNr">126 </span> +<span id="L127" class="LineNr">127 </span><span class="Delimiter">:(scenario ingredient)</span> +<span id="L128" class="LineNr">128 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L129" class="LineNr">129 </span> f <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">2</span> +<span id="L130" class="LineNr">130 </span>] +<span id="L131" class="LineNr">131 </span><span class="muRecipe">def</span> f [ +<span id="L132" class="LineNr">132 </span> <span class="Constant">12</span>:num<span class="Special"> <- </span>ingredient <span class="Constant">1</span> <span class="Comment"># consume second ingredient first</span> +<span id="L133" class="LineNr">133 </span> <span class="Constant">13</span>:num<span class="Delimiter">,</span> <span class="Constant">1</span>:<span class="Normal">bool</span><span class="Special"> <- </span>next-ingredient <span class="Comment"># next-ingredient tries to scan past that</span> +<span id="L134" class="LineNr">134 </span>] +<span id="L135" class="LineNr">135 </span><span class="traceContains">+mem: storing 2 in location 12</span> +<span id="L136" class="LineNr">136 </span><span class="traceContains">+mem: storing 0 in location 1</span> +<span id="L137" class="LineNr">137 </span> +<span id="L138" class="LineNr">138 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +<span id="L139" class="LineNr">139 </span>INGREDIENT<span class="Delimiter">,</span> +<span id="L140" class="LineNr">140 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +<span id="L141" class="LineNr">141 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"ingredient"</span><span class="Delimiter">,</span> INGREDIENT<span class="Delimiter">);</span> +<span id="L142" class="LineNr">142 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"input"</span><span class="Delimiter">,</span> INGREDIENT<span class="Delimiter">);</span> +<span id="L143" class="LineNr">143 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> +<span id="L144" class="LineNr">144 </span><span class="Normal">case</span> INGREDIENT: <span class="Delimiter">{</span> +<span id="L145" class="LineNr">145 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L146" class="LineNr">146 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'ingredient' expects exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L147" class="LineNr">147 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L148" class="LineNr">148 </span> <span class="Delimiter">}</span> +<span id="L149" class="LineNr">149 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L150" class="LineNr">150 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'ingredient' expects a literal ingredient, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L151" class="LineNr">151 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L152" class="LineNr">152 </span> <span class="Delimiter">}</span> +<span id="L153" class="LineNr">153 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L154" class="LineNr">154 </span><span class="Delimiter">}</span> +<span id="L155" class="LineNr">155 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +<span id="L156" class="LineNr">156 </span><span class="Normal">case</span> INGREDIENT: <span class="Delimiter">{</span> +<span id="L157" class="LineNr">157 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L158" class="LineNr">158 </span> <span class="Conceal">¦</span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L159" class="LineNr">159 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span> +<span id="L160" class="LineNr">160 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">));</span> +<span id="L161" class="LineNr">161 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>products<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">);</span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> <span class="Comment">// push a new vector</span> +<span id="L162" class="LineNr">162 </span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L163" class="LineNr">163 </span> <span class="Conceal">¦</span> ++current_call<span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">;</span> +<span id="L164" class="LineNr">164 </span> <span class="Delimiter">}</span> +<span id="L165" class="LineNr">165 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> +<span id="L166" class="LineNr">166 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L167" class="LineNr">167 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> +<span id="L168" class="LineNr">168 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span class="Comment">// todo: will fail noisily if we try to read a compound value</span> +<span id="L169" class="LineNr">169 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L170" class="LineNr">170 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L171" class="LineNr">171 </span> <span class="Delimiter">}</span> +<span id="L172" class="LineNr">172 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L173" class="LineNr">173 </span><span class="Delimiter">}</span> +<span id="L174" class="LineNr">174 </span> +<span id="L175" class="LineNr">175 </span><span class="Comment">//: a particularly common array type is the text, or address:array:character</span> +<span id="L176" class="LineNr">176 </span><span class="Delimiter">:(code)</span> +<span id="L177" class="LineNr">177 </span><span class="Normal">bool</span> <a href='027call_ingredient.cc.html#L177'>is_mu_text</a><span class="Delimiter">(</span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> x<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L178" class="LineNr">178 </span> <span class="Comment">// End Preprocess is_mu_text(reagent x)</span> +<span id="L179" class="LineNr">179 </span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>type +<span id="L180" class="LineNr">180 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom +<span id="L181" class="LineNr">181 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom +<span id="L182" class="LineNr">182 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">)</span> +<span id="L183" class="LineNr">183 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right +<span id="L184" class="LineNr">184 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom +<span id="L185" class="LineNr">185 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom +<span id="L186" class="LineNr">186 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"array"</span><span class="Delimiter">)</span> +<span id="L187" class="LineNr">187 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right +<span id="L188" class="LineNr">188 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom +<span id="L189" class="LineNr">189 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"character"</span><span class="Delimiter">)</span> +<span id="L190" class="LineNr">190 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right == <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L191" class="LineNr">191 </span><span class="Delimiter">}</span> </pre> </body> </html> diff --git a/html/028call_return.cc.html b/html/028call_return.cc.html index b5a3306c..493c5e24 100644 --- a/html/028call_return.cc.html +++ b/html/028call_return.cc.html @@ -92,151 +92,152 @@ if ('onhashchange' in window) { <span id="L29" class="LineNr"> 29 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> <span id="L30" class="LineNr"> 30 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"return"</span><span class="Delimiter">,</span> RETURN<span class="Delimiter">);</span> <span id="L31" class="LineNr"> 31 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"reply"</span><span class="Delimiter">,</span> RETURN<span class="Delimiter">);</span> <span class="Comment">// synonym while teaching</span> -<span id="L32" class="LineNr"> 32 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> -<span id="L33" class="LineNr"> 33 </span><span class="Normal">case</span> RETURN: <span class="Delimiter">{</span> -<span id="L34" class="LineNr"> 34 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// checks will be performed by a transform below</span> -<span id="L35" class="LineNr"> 35 </span><span class="Delimiter">}</span> -<span id="L36" class="LineNr"> 36 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -<span id="L37" class="LineNr"> 37 </span><span class="Normal">case</span> RETURN: <span class="Delimiter">{</span> -<span id="L38" class="LineNr"> 38 </span> <span class="Comment">// Begin Return</span> -<span id="L39" class="LineNr"> 39 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L40" class="LineNr"> 40 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>name << <span class="Constant">": decrementing callstack depth from "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L41" class="LineNr"> 41 </span> <span class="Conceal">¦</span> --Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L42" class="LineNr"> 42 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L43" class="LineNr"> 43 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L44" class="LineNr"> 44 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> -<span id="L45" class="LineNr"> 45 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L46" class="LineNr"> 46 </span> <span class="Delimiter">}</span> -<span id="L47" class="LineNr"> 47 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> -<span id="L48" class="LineNr"> 48 </span> <span class="Comment">// just in case 'main' returns a value, drop it for now</span> -<span id="L49" class="LineNr"> 49 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> -<span id="L50" class="LineNr"> 50 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L51" class="LineNr"> 51 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"result "</span> << i << <span class="Constant">" is "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L52" class="LineNr"> 52 </span> <span class="Comment">// make return products available to caller</span> -<span id="L53" class="LineNr"> 53 </span> copy<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> ingredients<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>products<span class="Delimiter">,</span> products<span class="Delimiter">.</span>begin<span class="Delimiter">()));</span> -<span id="L54" class="LineNr"> 54 </span> <span class="Comment">// End Return</span> -<span id="L55" class="LineNr"> 55 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// continue to process rest of *caller* instruction</span> -<span id="L56" class="LineNr"> 56 </span><span class="Delimiter">}</span> -<span id="L57" class="LineNr"> 57 </span> -<span id="L58" class="LineNr"> 58 </span><span class="Comment">//: Types in return instructions are checked ahead of time.</span> -<span id="L59" class="LineNr"> 59 </span> -<span id="L60" class="LineNr"> 60 </span><span class="Delimiter">:(before "End Checks")</span> -<span id="L61" class="LineNr"> 61 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='028call_return.cc.html#L63'>check_types_of_return_instructions</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> -<span id="L62" class="LineNr"> 62 </span><span class="Delimiter">:(code)</span> -<span id="L63" class="LineNr"> 63 </span><span class="Normal">void</span> <a href='028call_return.cc.html#L63'>check_types_of_return_instructions</a><span class="Delimiter">(</span><span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L64" class="LineNr"> 64 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> -<span id="L65" class="LineNr"> 65 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- check types of return instructions in <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L66" class="LineNr"> 66 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L67" class="LineNr"> 67 </span> <span class="Conceal">¦</span> <span class="Normal">const</span> instruction& caller_instruction = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L69" class="LineNr"> 69 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L70" class="LineNr"> 70 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='028call_return.cc.html#L114'>is_primitive</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L71" class="LineNr"> 71 </span> <span class="Conceal">¦</span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> caller_instruction<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> -<span id="L72" class="LineNr"> 72 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L73" class="LineNr"> 73 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">const</span> instruction& return_inst = callee<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L74" class="LineNr"> 74 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>operation != RETURN<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L75" class="LineNr"> 75 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// check types with the caller</span> -<span id="L76" class="LineNr"> 76 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L77" class="LineNr"> 77 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"too few values returned from "</span> << callee<span class="Delimiter">.</span>name << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L78" class="LineNr"> 78 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L79" class="LineNr"> 79 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L80" class="LineNr"> 80 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L81" class="LineNr"> 81 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> lhs = return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L82" class="LineNr"> 82 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> rhs = caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L83" class="LineNr"> 83 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// End Check RETURN Copy(lhs, rhs)</span> -<span id="L84" class="LineNr"> 84 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>rhs<span class="Delimiter">,</span> lhs<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L85" class="LineNr"> 85 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << return_inst<span class="Delimiter">.</span>name << <span class="Constant">" ingredient '"</span> << lhs<span class="Delimiter">.</span>original_string << <span class="Constant">"' can't be saved in '"</span> << rhs<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> -<span id="L86" class="LineNr"> 86 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">" ['"</span> << to_string<span class="Delimiter">(</span>lhs<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">"' vs '"</span> << to_string<span class="Delimiter">(</span>rhs<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">"']</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L87" class="LineNr"> 87 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">goto</span> finish_return_check<span class="Delimiter">;</span> -<span id="L88" class="LineNr"> 88 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L89" class="LineNr"> 89 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L90" class="LineNr"> 90 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// check that any return ingredients with /same-as-ingredient connect up</span> -<span id="L91" class="LineNr"> 91 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// the corresponding ingredient and product in the caller.</span> -<span id="L92" class="LineNr"> 92 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L93" class="LineNr"> 93 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>has_property<span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> <span class="Constant">"same-as-ingredient"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L94" class="LineNr"> 94 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> string_tree* tmp = property<span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> <span class="Constant">"same-as-ingredient"</span><span class="Delimiter">);</span> -<span id="L95" class="LineNr"> 95 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!tmp || !tmp<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L96" class="LineNr"> 96 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"'same-as-ingredient' metadata should take exactly one value in '"</span> << to_original_string<span class="Delimiter">(</span>return_inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L97" class="LineNr"> 97 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">goto</span> finish_return_check<span class="Delimiter">;</span> -<span id="L98" class="LineNr"> 98 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L99" class="LineNr"> 99 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">int</span> ingredient_index = <a href='002test.cc.html#L91'>to_integer</a><span class="Delimiter">(</span>tmp<span class="Delimiter">-></span>value<span class="Delimiter">);</span> -<span id="L100" class="LineNr">100 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>ingredient_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L101" class="LineNr">101 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"too few ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L102" class="LineNr">102 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">goto</span> finish_return_check<span class="Delimiter">;</span> -<span id="L103" class="LineNr">103 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L104" class="LineNr">104 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_dummy<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> && !is_literal<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">))</span> && caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name != caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">).</span>name<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L105" class="LineNr">105 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">)</span> << <span class="Constant">"' should write to '"</span> << caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">).</span>original_string << <span class="Constant">"' rather than '"</span> << caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L106" class="LineNr">106 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L107" class="LineNr">107 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L108" class="LineNr">108 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L109" class="LineNr">109 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">finish_return_check</span>:<span class="Delimiter">;</span> -<span id="L110" class="LineNr">110 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L111" class="LineNr">111 </span> <span class="Delimiter">}</span> -<span id="L112" class="LineNr">112 </span><span class="Delimiter">}</span> -<span id="L113" class="LineNr">113 </span> -<span id="L114" class="LineNr">114 </span><span class="Normal">bool</span> <a href='028call_return.cc.html#L114'>is_primitive</a><span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L115" class="LineNr">115 </span> <span class="Identifier">return</span> r < <a href='010vm.cc.html#L191'>MAX_PRIMITIVE_RECIPES</a><span class="Delimiter">;</span> -<span id="L116" class="LineNr">116 </span><span class="Delimiter">}</span> -<span id="L117" class="LineNr">117 </span> -<span id="L118" class="LineNr">118 </span><span class="Delimiter">:(scenario return_type_mismatch)</span> -<span id="L119" class="LineNr">119 </span><span class="Special">% Hide_errors = true;</span> -<span id="L120" class="LineNr">120 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L121" class="LineNr">121 </span> <span class="Constant">3</span>:num<span class="Special"> <- </span>f <span class="Constant">2</span> -<span id="L122" class="LineNr">122 </span>] -<span id="L123" class="LineNr">123 </span><span class="muRecipe">def</span> f [ -<span id="L124" class="LineNr">124 </span> <span class="Constant">12</span>:num<span class="Special"> <- </span>next-ingredient -<span id="L125" class="LineNr">125 </span> <span class="Constant">13</span>:num<span class="Special"> <- </span>copy <span class="Constant">35</span> -<span id="L126" class="LineNr">126 </span> <span class="Constant">14</span>:point<span class="Special"> <- </span>copy <span class="Constant">12</span>:point/<span class="Special">raw</span> -<span id="L127" class="LineNr">127 </span> <span class="Identifier">return</span> <span class="Constant">14</span>:point -<span id="L128" class="LineNr">128 </span>] -<span id="L129" class="LineNr">129 </span><span class="traceContains">+error: f: return ingredient '14:point' can't be saved in '3:num'</span> -<span id="L130" class="LineNr">130 </span> -<span id="L131" class="LineNr">131 </span><span class="Comment">//: In Mu we'd like to assume that any instruction doesn't modify its</span> -<span id="L132" class="LineNr">132 </span><span class="Comment">//: ingredients unless they're also products. The /same-as-ingredient inside</span> -<span id="L133" class="LineNr">133 </span><span class="Comment">//: the recipe's 'return' indicates that an ingredient is intended to be</span> -<span id="L134" class="LineNr">134 </span><span class="Comment">//: modified in place, and will help catch accidental misuse of such</span> -<span id="L135" class="LineNr">135 </span><span class="Comment">//: 'ingredient-products' (sometimes called in-out parameters in other</span> -<span id="L136" class="LineNr">136 </span><span class="Comment">//: languages).</span> -<span id="L137" class="LineNr">137 </span> -<span id="L138" class="LineNr">138 </span><span class="Delimiter">:(scenario return_same_as_ingredient)</span> -<span id="L139" class="LineNr">139 </span><span class="Special">% Hide_errors = true;</span> -<span id="L140" class="LineNr">140 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L141" class="LineNr">141 </span> <span class="Constant">1</span>:num<span class="Special"> <- </span>copy <span class="Constant">0</span> -<span id="L142" class="LineNr">142 </span> <span class="Constant">2</span>:num<span class="Special"> <- </span>test1 <span class="Constant">1</span>:num <span class="Comment"># call with different ingredient and product</span> -<span id="L143" class="LineNr">143 </span>] -<span id="L144" class="LineNr">144 </span><span class="muRecipe">def</span> test1 [ -<span id="L145" class="LineNr">145 </span> <span class="Constant">10</span>:num<span class="Special"> <- </span>next-ingredient -<span id="L146" class="LineNr">146 </span> <span class="Identifier">return</span> <span class="Constant">10</span>:num/same-as-ingredient:<span class="Constant">0</span> -<span id="L147" class="LineNr">147 </span>] -<span id="L148" class="LineNr">148 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: '2:num <- test1 1:num' should write to '1:num' rather than '2:num'</span> -<span id="L149" class="LineNr">149 </span> -<span id="L150" class="LineNr">150 </span><span class="Delimiter">:(scenario return_same_as_ingredient_dummy)</span> -<span id="L151" class="LineNr">151 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L152" class="LineNr">152 </span> <span class="Constant">1</span>:num<span class="Special"> <- </span>copy <span class="Constant">0</span> -<span id="L153" class="LineNr">153 </span> _<span class="Special"> <- </span>test1 <span class="Constant">1</span>:num <span class="Comment"># call with different ingredient and product</span> -<span id="L154" class="LineNr">154 </span>] -<span id="L155" class="LineNr">155 </span><span class="muRecipe">def</span> test1 [ -<span id="L156" class="LineNr">156 </span> <span class="Constant">10</span>:num<span class="Special"> <- </span>next-ingredient -<span id="L157" class="LineNr">157 </span> <span class="Identifier">return</span> <span class="Constant">10</span>:num/same-as-ingredient:<span class="Constant">0</span> -<span id="L158" class="LineNr">158 </span>] -<span id="L159" class="LineNr">159 </span>$error: <span class="Constant">0</span> -<span id="L160" class="LineNr">160 </span> -<span id="L161" class="LineNr">161 </span><span class="Delimiter">:(code)</span> -<span id="L162" class="LineNr">162 </span>string <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> vector<<span class="Normal">double</span>>& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L163" class="LineNr">163 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span> <span class="Constant">"[]"</span><span class="Delimiter">;</span> -<span id="L164" class="LineNr">164 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L165" class="LineNr">165 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L166" class="LineNr">166 </span> <span class="Conceal">¦</span> out << no_scientific<span class="Delimiter">(</span>in<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> -<span id="L167" class="LineNr">167 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> -<span id="L168" class="LineNr">168 </span> <span class="Delimiter">}</span> -<span id="L169" class="LineNr">169 </span> out << <span class="Constant">"["</span><span class="Delimiter">;</span> -<span id="L170" class="LineNr">170 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L171" class="LineNr">171 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>i > <span class="Constant">0</span><span class="Delimiter">)</span> out << <span class="Constant">", "</span><span class="Delimiter">;</span> -<span id="L172" class="LineNr">172 </span> <span class="Conceal">¦</span> out << no_scientific<span class="Delimiter">(</span>in<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> -<span id="L173" class="LineNr">173 </span> <span class="Delimiter">}</span> -<span id="L174" class="LineNr">174 </span> out << <span class="Constant">"]"</span><span class="Delimiter">;</span> -<span id="L175" class="LineNr">175 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> -<span id="L176" class="LineNr">176 </span><span class="Delimiter">}</span> +<span id="L32" class="LineNr"> 32 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"output"</span><span class="Delimiter">,</span> RETURN<span class="Delimiter">);</span> <span class="Comment">// experiment</span> +<span id="L33" class="LineNr"> 33 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> +<span id="L34" class="LineNr"> 34 </span><span class="Normal">case</span> RETURN: <span class="Delimiter">{</span> +<span id="L35" class="LineNr"> 35 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// checks will be performed by a transform below</span> +<span id="L36" class="LineNr"> 36 </span><span class="Delimiter">}</span> +<span id="L37" class="LineNr"> 37 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +<span id="L38" class="LineNr"> 38 </span><span class="Normal">case</span> RETURN: <span class="Delimiter">{</span> +<span id="L39" class="LineNr"> 39 </span> <span class="Comment">// Begin Return</span> +<span id="L40" class="LineNr"> 40 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L41" class="LineNr"> 41 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>name << <span class="Constant">": decrementing callstack depth from "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L42" class="LineNr"> 42 </span> <span class="Conceal">¦</span> --Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L43" class="LineNr"> 43 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L44" class="LineNr"> 44 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L45" class="LineNr"> 45 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> +<span id="L46" class="LineNr"> 46 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L47" class="LineNr"> 47 </span> <span class="Delimiter">}</span> +<span id="L48" class="LineNr"> 48 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> +<span id="L49" class="LineNr"> 49 </span> <span class="Comment">// just in case 'main' returns a value, drop it for now</span> +<span id="L50" class="LineNr"> 50 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> +<span id="L51" class="LineNr"> 51 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> +<span id="L52" class="LineNr"> 52 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"result "</span> << i << <span class="Constant">" is "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L53" class="LineNr"> 53 </span> <span class="Comment">// make return products available to caller</span> +<span id="L54" class="LineNr"> 54 </span> copy<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> ingredients<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>products<span class="Delimiter">,</span> products<span class="Delimiter">.</span>begin<span class="Delimiter">()));</span> +<span id="L55" class="LineNr"> 55 </span> <span class="Comment">// End Return</span> +<span id="L56" class="LineNr"> 56 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// continue to process rest of *caller* instruction</span> +<span id="L57" class="LineNr"> 57 </span><span class="Delimiter">}</span> +<span id="L58" class="LineNr"> 58 </span> +<span id="L59" class="LineNr"> 59 </span><span class="Comment">//: Types in return instructions are checked ahead of time.</span> +<span id="L60" class="LineNr"> 60 </span> +<span id="L61" class="LineNr"> 61 </span><span class="Delimiter">:(before "End Checks")</span> +<span id="L62" class="LineNr"> 62 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='028call_return.cc.html#L64'>check_types_of_return_instructions</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L63" class="LineNr"> 63 </span><span class="Delimiter">:(code)</span> +<span id="L64" class="LineNr"> 64 </span><span class="Normal">void</span> <a href='028call_return.cc.html#L64'>check_types_of_return_instructions</a><span class="Delimiter">(</span><span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L65" class="LineNr"> 65 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L66" class="LineNr"> 66 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- check types of return instructions in <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L67" class="LineNr"> 67 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> <span class="Normal">const</span> instruction& caller_instruction = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L69" class="LineNr"> 69 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L70" class="LineNr"> 70 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L71" class="LineNr"> 71 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='028call_return.cc.html#L115'>is_primitive</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L72" class="LineNr"> 72 </span> <span class="Conceal">¦</span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> caller_instruction<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> +<span id="L73" class="LineNr"> 73 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L74" class="LineNr"> 74 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">const</span> instruction& return_inst = callee<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L75" class="LineNr"> 75 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>operation != RETURN<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L76" class="LineNr"> 76 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// check types with the caller</span> +<span id="L77" class="LineNr"> 77 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L78" class="LineNr"> 78 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"too few values returned from "</span> << callee<span class="Delimiter">.</span>name << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L79" class="LineNr"> 79 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L80" class="LineNr"> 80 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L81" class="LineNr"> 81 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L82" class="LineNr"> 82 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> lhs = return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L83" class="LineNr"> 83 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> rhs = caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L84" class="LineNr"> 84 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// End Check RETURN Copy(lhs, rhs)</span> +<span id="L85" class="LineNr"> 85 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>rhs<span class="Delimiter">,</span> lhs<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L86" class="LineNr"> 86 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << return_inst<span class="Delimiter">.</span>name << <span class="Constant">" ingredient '"</span> << lhs<span class="Delimiter">.</span>original_string << <span class="Constant">"' can't be saved in '"</span> << rhs<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L87" class="LineNr"> 87 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">" ['"</span> << to_string<span class="Delimiter">(</span>lhs<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">"' vs '"</span> << to_string<span class="Delimiter">(</span>rhs<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">"']</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L88" class="LineNr"> 88 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">goto</span> finish_return_check<span class="Delimiter">;</span> +<span id="L89" class="LineNr"> 89 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L90" class="LineNr"> 90 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L91" class="LineNr"> 91 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// check that any return ingredients with /same-as-ingredient connect up</span> +<span id="L92" class="LineNr"> 92 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// the corresponding ingredient and product in the caller.</span> +<span id="L93" class="LineNr"> 93 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L94" class="LineNr"> 94 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>has_property<span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> <span class="Constant">"same-as-ingredient"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L95" class="LineNr"> 95 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> string_tree* tmp = property<span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> <span class="Constant">"same-as-ingredient"</span><span class="Delimiter">);</span> +<span id="L96" class="LineNr"> 96 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!tmp || !tmp<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L97" class="LineNr"> 97 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"'same-as-ingredient' metadata should take exactly one value in '"</span> << to_original_string<span class="Delimiter">(</span>return_inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L98" class="LineNr"> 98 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">goto</span> finish_return_check<span class="Delimiter">;</span> +<span id="L99" class="LineNr"> 99 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L100" class="LineNr">100 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">int</span> ingredient_index = <a href='002test.cc.html#L91'>to_integer</a><span class="Delimiter">(</span>tmp<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L101" class="LineNr">101 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>ingredient_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L102" class="LineNr">102 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"too few ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L103" class="LineNr">103 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">goto</span> finish_return_check<span class="Delimiter">;</span> +<span id="L104" class="LineNr">104 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L105" class="LineNr">105 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_dummy<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> && !is_literal<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">))</span> && caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name != caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">).</span>name<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L106" class="LineNr">106 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">)</span> << <span class="Constant">"' should write to '"</span> << caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">).</span>original_string << <span class="Constant">"' rather than '"</span> << caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L107" class="LineNr">107 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L108" class="LineNr">108 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L109" class="LineNr">109 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L110" class="LineNr">110 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">finish_return_check</span>:<span class="Delimiter">;</span> +<span id="L111" class="LineNr">111 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L112" class="LineNr">112 </span> <span class="Delimiter">}</span> +<span id="L113" class="LineNr">113 </span><span class="Delimiter">}</span> +<span id="L114" class="LineNr">114 </span> +<span id="L115" class="LineNr">115 </span><span class="Normal">bool</span> <a href='028call_return.cc.html#L115'>is_primitive</a><span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L116" class="LineNr">116 </span> <span class="Identifier">return</span> r < <a href='010vm.cc.html#L191'>MAX_PRIMITIVE_RECIPES</a><span class="Delimiter">;</span> +<span id="L117" class="LineNr">117 </span><span class="Delimiter">}</span> +<span id="L118" class="LineNr">118 </span> +<span id="L119" class="LineNr">119 </span><span class="Delimiter">:(scenario return_type_mismatch)</span> +<span id="L120" class="LineNr">120 </span><span class="Special">% Hide_errors = true;</span> +<span id="L121" class="LineNr">121 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L122" class="LineNr">122 </span> <span class="Constant">3</span>:num<span class="Special"> <- </span>f <span class="Constant">2</span> +<span id="L123" class="LineNr">123 </span>] +<span id="L124" class="LineNr">124 </span><span class="muRecipe">def</span> f [ +<span id="L125" class="LineNr">125 </span> <span class="Constant">12</span>:num<span class="Special"> <- </span>next-ingredient +<span id="L126" class="LineNr">126 </span> <span class="Constant">13</span>:num<span class="Special"> <- </span>copy <span class="Constant">35</span> +<span id="L127" class="LineNr">127 </span> <span class="Constant">14</span>:point<span class="Special"> <- </span>copy <span class="Constant">12</span>:point/<span class="Special">raw</span> +<span id="L128" class="LineNr">128 </span> <span class="Identifier">return</span> <span class="Constant">14</span>:point +<span id="L129" class="LineNr">129 </span>] +<span id="L130" class="LineNr">130 </span><span class="traceContains">+error: f: return ingredient '14:point' can't be saved in '3:num'</span> +<span id="L131" class="LineNr">131 </span> +<span id="L132" class="LineNr">132 </span><span class="Comment">//: In Mu we'd like to assume that any instruction doesn't modify its</span> +<span id="L133" class="LineNr">133 </span><span class="Comment">//: ingredients unless they're also products. The /same-as-ingredient inside</span> +<span id="L134" class="LineNr">134 </span><span class="Comment">//: the recipe's 'return' indicates that an ingredient is intended to be</span> +<span id="L135" class="LineNr">135 </span><span class="Comment">//: modified in place, and will help catch accidental misuse of such</span> +<span id="L136" class="LineNr">136 </span><span class="Comment">//: 'ingredient-products' (sometimes called in-out parameters in other</span> +<span id="L137" class="LineNr">137 </span><span class="Comment">//: languages).</span> +<span id="L138" class="LineNr">138 </span> +<span id="L139" class="LineNr">139 </span><span class="Delimiter">:(scenario return_same_as_ingredient)</span> +<span id="L140" class="LineNr">140 </span><span class="Special">% Hide_errors = true;</span> +<span id="L141" class="LineNr">141 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L142" class="LineNr">142 </span> <span class="Constant">1</span>:num<span class="Special"> <- </span>copy <span class="Constant">0</span> +<span id="L143" class="LineNr">143 </span> <span class="Constant">2</span>:num<span class="Special"> <- </span>test1 <span class="Constant">1</span>:num <span class="Comment"># call with different ingredient and product</span> +<span id="L144" class="LineNr">144 </span>] +<span id="L145" class="LineNr">145 </span><span class="muRecipe">def</span> test1 [ +<span id="L146" class="LineNr">146 </span> <span class="Constant">10</span>:num<span class="Special"> <- </span>next-ingredient +<span id="L147" class="LineNr">147 </span> <span class="Identifier">return</span> <span class="Constant">10</span>:num/same-as-ingredient:<span class="Constant">0</span> +<span id="L148" class="LineNr">148 </span>] +<span id="L149" class="LineNr">149 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: '2:num <- test1 1:num' should write to '1:num' rather than '2:num'</span> +<span id="L150" class="LineNr">150 </span> +<span id="L151" class="LineNr">151 </span><span class="Delimiter">:(scenario return_same_as_ingredient_dummy)</span> +<span id="L152" class="LineNr">152 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L153" class="LineNr">153 </span> <span class="Constant">1</span>:num<span class="Special"> <- </span>copy <span class="Constant">0</span> +<span id="L154" class="LineNr">154 </span> _<span class="Special"> <- </span>test1 <span class="Constant">1</span>:num <span class="Comment"># call with different ingredient and product</span> +<span id="L155" class="LineNr">155 </span>] +<span id="L156" class="LineNr">156 </span><span class="muRecipe">def</span> test1 [ +<span id="L157" class="LineNr">157 </span> <span class="Constant">10</span>:num<span class="Special"> <- </span>next-ingredient +<span id="L158" class="LineNr">158 </span> <span class="Identifier">return</span> <span class="Constant">10</span>:num/same-as-ingredient:<span class="Constant">0</span> +<span id="L159" class="LineNr">159 </span>] +<span id="L160" class="LineNr">160 </span>$error: <span class="Constant">0</span> +<span id="L161" class="LineNr">161 </span> +<span id="L162" class="LineNr">162 </span><span class="Delimiter">:(code)</span> +<span id="L163" class="LineNr">163 </span>string <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> vector<<span class="Normal">double</span>>& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L164" class="LineNr">164 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span> <span class="Constant">"[]"</span><span class="Delimiter">;</span> +<span id="L165" class="LineNr">165 </span> ostringstream out<span class="Delimiter">;</span> +<span id="L166" class="LineNr">166 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L167" class="LineNr">167 </span> <span class="Conceal">¦</span> out << no_scientific<span class="Delimiter">(</span>in<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> +<span id="L168" class="LineNr">168 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> +<span id="L169" class="LineNr">169 </span> <span class="Delimiter">}</span> +<span id="L170" class="LineNr">170 </span> out << <span class="Constant">"["</span><span class="Delimiter">;</span> +<span id="L171" class="LineNr">171 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L172" class="LineNr">172 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>i > <span class="Constant">0</span><span class="Delimiter">)</span> out << <span class="Constant">", "</span><span class="Delimiter">;</span> +<span id="L173" class="LineNr">173 </span> <span class="Conceal">¦</span> out << no_scientific<span class="Delimiter">(</span>in<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L174" class="LineNr">174 </span> <span class="Delimiter">}</span> +<span id="L175" class="LineNr">175 </span> out << <span class="Constant">"]"</span><span class="Delimiter">;</span> +<span id="L176" class="LineNr">176 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> +<span id="L177" class="LineNr">177 </span><span class="Delimiter">}</span> </pre> </body> </html> diff --git a/html/030container.cc.html b/html/030container.cc.html index 4008d4bd..0482bdaf 100644 --- a/html/030container.cc.html +++ b/html/030container.cc.html @@ -70,7 +70,7 @@ if ('onhashchange' in window) { <span id="L3" class="LineNr"> 3 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> <span id="L4" class="LineNr"> 4 </span><span class="Comment">//: We'll use this container as a running example in scenarios below.</span> <span id="L5" class="LineNr"> 5 </span><a href='010vm.cc.html#L123'>type_ordinal</a> point = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"point"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point<span class="Delimiter">);</span> <span class="Comment">// initialize</span> +<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point<span class="Delimiter">);</span> <span class="Comment">// initialize</span> <span id="L7" class="LineNr"> 7 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point<span class="Delimiter">).</span>kind = <a href='010vm.cc.html#L173'>CONTAINER</a><span class="Delimiter">;</span> <span id="L8" class="LineNr"> 8 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point<span class="Delimiter">).</span>name = <span class="Constant">"point"</span><span class="Delimiter">;</span> <span id="L9" class="LineNr"> 9 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"x:number"</span><span class="Delimiter">));</span> @@ -103,7 +103,7 @@ if ('onhashchange' in window) { <span id="L36" class="LineNr"> 36 </span><span class="Comment">// A more complex example container, containing another container as one of</span> <span id="L37" class="LineNr"> 37 </span><span class="Comment">// its elements.</span> <span id="L38" class="LineNr"> 38 </span><a href='010vm.cc.html#L123'>type_ordinal</a> point_number = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"point-number"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L39" class="LineNr"> 39 </span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point_number<span class="Delimiter">);</span> <span class="Comment">// initialize</span> +<span id="L39" class="LineNr"> 39 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point_number<span class="Delimiter">);</span> <span class="Comment">// initialize</span> <span id="L40" class="LineNr"> 40 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>kind = <a href='010vm.cc.html#L173'>CONTAINER</a><span class="Delimiter">;</span> <span id="L41" class="LineNr"> 41 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>name = <span class="Constant">"point-number"</span><span class="Delimiter">;</span> <span id="L42" class="LineNr"> 42 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"xy:point"</span><span class="Delimiter">));</span> @@ -243,7 +243,7 @@ if ('onhashchange' in window) { <span id="L176" class="LineNr">176 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- compute container sizes for "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L177" class="LineNr">177 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L178" class="LineNr">178 </span> <span class="Conceal">¦</span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L179" class="LineNr">179 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"- compute container sizes for "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L179" class="LineNr">179 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"- compute container sizes for "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L180" class="LineNr">180 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L181" class="LineNr">181 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> compute_container_sizes<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> <span class="Constant">" in '"</span>+to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span>+<span class="Constant">"'"</span><span class="Delimiter">);</span> <span id="L182" class="LineNr">182 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> @@ -264,13 +264,13 @@ if ('onhashchange' in window) { <span id="L197" class="LineNr">197 </span> <span id="L198" class="LineNr">198 </span><span class="Normal">void</span> compute_container_sizes<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">,</span> set<type_tree>& pending_metadata<span class="Delimiter">,</span> <span class="Normal">const</span> string& location_for_error_messages<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L199" class="LineNr">199 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L200" class="LineNr">200 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"compute container sizes for "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L200" class="LineNr">200 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"compute container sizes for "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L201" class="LineNr">201 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Container_metadata<span class="Delimiter">,</span> type<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L202" class="LineNr">202 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>pending_metadata<span class="Delimiter">,</span> *type<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L203" class="LineNr">203 </span> pending_metadata<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>*type<span class="Delimiter">);</span> <span id="L204" class="LineNr">204 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L205" class="LineNr">205 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L206" class="LineNr">206 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << location_for_error_messages << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L206" class="LineNr">206 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << location_for_error_messages << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L207" class="LineNr">207 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L208" class="LineNr">208 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L209" class="LineNr">209 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>name == <span class="Constant">"address"</span><span class="Delimiter">)</span> @@ -741,7 +741,7 @@ if ('onhashchange' in window) { <span id="L674" class="LineNr">674 </span> <span class="Delimiter">}</span> <span id="L675" class="LineNr">675 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"type number: "</span> << get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L676" class="LineNr">676 </span> <a href='030container.cc.html#L733'>skip_bracket</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> <span class="Constant">"'"</span>+command+<span class="Constant">"' must begin with '['"</span><span class="Delimiter">);</span> -<span id="L677" class="LineNr">677 </span> type_info& info = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">));</span> +<span id="L677" class="LineNr">677 </span> type_info& info = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">));</span> <span id="L678" class="LineNr">678 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>info<span class="Delimiter">.</span>Num_calls_to_transform_all_at_first_definition == -<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L679" class="LineNr">679 </span> <span class="Conceal">¦</span> <span class="Comment">// initial definition of this container</span> <span id="L680" class="LineNr">680 </span> <span class="Conceal">¦</span> info<span class="Delimiter">.</span>Num_calls_to_transform_all_at_first_definition = Num_calls_to_transform_all<span class="Delimiter">;</span> @@ -753,7 +753,7 @@ if ('onhashchange' in window) { <span id="L686" class="LineNr">686 </span> <span class="Delimiter">}</span> <span id="L687" class="LineNr">687 </span> info<span class="Delimiter">.</span>name = name<span class="Delimiter">;</span> <span id="L688" class="LineNr">688 </span> info<span class="Delimiter">.</span>kind = kind<span class="Delimiter">;</span> -<span id="L689" class="LineNr">689 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L689" class="LineNr">689 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L690" class="LineNr">690 </span> <span class="Conceal">¦</span> <a href='011load.cc.html#L209'>skip_whitespace_and_comments</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L691" class="LineNr">691 </span> <span class="Conceal">¦</span> string element = <a href='011load.cc.html#L167'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L692" class="LineNr">692 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>element<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> @@ -765,7 +765,7 @@ if ('onhashchange' in window) { <span id="L698" class="LineNr">698 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L699" class="LineNr">699 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << command << <span class="Constant">" '"</span> << name << <span class="Constant">"' contains multiple elements on a single line. Containers and exclusive containers must only contain elements, one to a line, no code.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L700" class="LineNr">700 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// skip rest of container declaration</span> -<span id="L701" class="LineNr">701 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L701" class="LineNr">701 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L702" class="LineNr">702 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='011load.cc.html#L209'>skip_whitespace_and_comments</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L703" class="LineNr">703 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='011load.cc.html#L167'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> == <span class="Constant">"]"</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L704" class="LineNr">704 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> @@ -774,7 +774,7 @@ if ('onhashchange' in window) { <span id="L707" class="LineNr">707 </span> <span class="Conceal">¦</span> info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span>element<span class="Delimiter">));</span> <span id="L708" class="LineNr">708 </span> <span class="Conceal">¦</span> expand_type_abbreviations<span class="Delimiter">(</span>info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">().</span>type<span class="Delimiter">);</span> <span class="Comment">// todo: use abbreviation before declaration</span> <span id="L709" class="LineNr">709 </span> <span class="Conceal">¦</span> <a href='030container.cc.html#L715'>replace_unknown_types_with_unique_ordinals</a><span class="Delimiter">(</span>info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">().</span>type<span class="Delimiter">,</span> info<span class="Delimiter">);</span> -<span id="L710" class="LineNr">710 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" element: "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">())</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L710" class="LineNr">710 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" element: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">())</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L711" class="LineNr">711 </span> <span class="Conceal">¦</span> <span class="Comment">// End Load Container Element Definition</span> <span id="L712" class="LineNr">712 </span> <span class="Delimiter">}</span> <span id="L713" class="LineNr">713 </span><span class="Delimiter">}</span> @@ -828,7 +828,7 @@ if ('onhashchange' in window) { <span id="L761" class="LineNr">761 </span><span class="Delimiter">:(code)</span> <span id="L762" class="LineNr">762 </span><span class="Comment">// extremely inefficient; we process all types over and over again, once for every single recipe</span> <span id="L763" class="LineNr">763 </span><span class="Comment">// but it doesn't seem to cause any noticeable slowdown</span> -<span id="L764" class="LineNr">764 </span><span class="Normal">void</span> <a href='030container.cc.html#L764'>expand_type_abbreviations_in_containers</a><span class="Delimiter">(</span><a href='001help.cc.html#L258'>unused</a> <span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L764" class="LineNr">764 </span><span class="Normal">void</span> <a href='030container.cc.html#L764'>expand_type_abbreviations_in_containers</a><span class="Delimiter">(</span><a href='001help.cc.html#L259'>unused</a> <span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L765" class="LineNr">765 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<type_ordinal<span class="Delimiter">,</span> type_info>::iterator p = Type<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Type<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L766" class="LineNr">766 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>second<span class="Delimiter">.</span>elements<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L767" class="LineNr">767 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> expand_type_abbreviations<span class="Delimiter">(</span>p<span class="Delimiter">-></span>second<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">);</span> diff --git a/html/031merge.cc.html b/html/031merge.cc.html index be3d7a8a..8901967a 100644 --- a/html/031merge.cc.html +++ b/html/031merge.cc.html @@ -226,7 +226,7 @@ if ('onhashchange' in window) { <span id="L161" class="LineNr">161 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container_element_index == <span class="Constant">0</span> && <a href='021check_instruction.cc.html#L115'>types_coercible</a><span class="Delimiter">(</span>container<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">)))</span> <span id="L162" class="LineNr">162 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L163" class="LineNr">163 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">const</span> reagent& expected_ingredient = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>container<span class="Delimiter">.</span>type<span class="Delimiter">,</span> state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container_element_index<span class="Delimiter">);</span> -<span id="L164" class="LineNr">164 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"checking container "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>container<span class="Delimiter">)</span> << <span class="Constant">" || "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>expected_ingredient<span class="Delimiter">)</span> << <span class="Constant">" vs ingredient "</span> << ingredient_index << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L164" class="LineNr">164 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"checking container "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>container<span class="Delimiter">)</span> << <span class="Constant">" || "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>expected_ingredient<span class="Delimiter">)</span> << <span class="Constant">" vs ingredient "</span> << ingredient_index << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L165" class="LineNr">165 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// if the current element is the ingredient we expect, move on to the next element/ingredient</span> <span id="L166" class="LineNr">166 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='021check_instruction.cc.html#L115'>types_coercible</a><span class="Delimiter">(</span>expected_ingredient<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span id="L167" class="LineNr">167 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> ++ingredient_index<span class="Delimiter">;</span> diff --git a/html/032array.cc.html b/html/032array.cc.html index 1ae8a45f..66e5c949 100644 --- a/html/032array.cc.html +++ b/html/032array.cc.html @@ -185,7 +185,7 @@ if ('onhashchange' in window) { <span id="L120" class="LineNr">120 </span> <span class="Conceal">¦</span> <span class="Comment">// get size from type</span> <span id="L121" class="LineNr">121 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <a href='002test.cc.html#L91'>to_integer</a><span class="Delimiter">(</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L122" class="LineNr">122 </span> <span class="Delimiter">}</span> -<span id="L123" class="LineNr">123 </span> cerr << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L123" class="LineNr">123 </span> cerr << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L124" class="LineNr">124 </span> assert<span class="Delimiter">(</span><span class="Constant">false</span><span class="Delimiter">);</span> <span id="L125" class="LineNr">125 </span><span class="Delimiter">}</span> <span id="L126" class="LineNr">126 </span> @@ -424,7 +424,7 @@ if ('onhashchange' in window) { <span id="L359" class="LineNr">359 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> index = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L360" class="LineNr">360 </span> <span class="Comment">// Update INDEX index in Run</span> <span id="L361" class="LineNr">361 </span> vector<<span class="Normal">double</span>> index_val<span class="Delimiter">(</span>read_memory<span class="Delimiter">(</span>index<span class="Delimiter">));</span> -<span id="L362" class="LineNr">362 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < <span class="Constant">0</span> || index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L362" class="LineNr">362 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < <span class="Constant">0</span> || index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L363" class="LineNr">363 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"invalid index "</span> << no_scientific<span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L364" class="LineNr">364 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L365" class="LineNr">365 </span> <span class="Delimiter">}</span> @@ -432,7 +432,7 @@ if ('onhashchange' in window) { <span id="L367" class="LineNr">367 </span> element<span class="Delimiter">.</span>type = <a href='032array.cc.html#L377'>copy_array_element</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">);</span> <span id="L368" class="LineNr">368 </span> element<span class="Delimiter">.</span><a href='010vm.cc.html#L65'>set_value</a><span class="Delimiter">(</span>base_address + <span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span> + index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span>*size_of<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">));</span> <span id="L369" class="LineNr">369 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"address to copy is "</span> << element<span class="Delimiter">.</span>value << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L370" class="LineNr">370 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"its type is "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L370" class="LineNr">370 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"its type is "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L371" class="LineNr">371 </span> <span class="Comment">// Read element</span> <span id="L372" class="LineNr">372 </span> products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>read_memory<span class="Delimiter">(</span>element<span class="Delimiter">));</span> <span id="L373" class="LineNr">373 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -468,7 +468,7 @@ if ('onhashchange' in window) { <span id="L403" class="LineNr">403 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <a href='002test.cc.html#L91'>to_integer</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L404" class="LineNr">404 </span> <span class="Delimiter">}</span> <span id="L405" class="LineNr">405 </span> <span class="Comment">// this should never happen at transform time</span> -<span id="L406" class="LineNr">406 </span> <span class="Identifier">return</span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L406" class="LineNr">406 </span> <span class="Identifier">return</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span id="L407" class="LineNr">407 </span><span class="Delimiter">}</span> <span id="L408" class="LineNr">408 </span> <span id="L409" class="LineNr">409 </span><span class="Delimiter">:(before "End Unit Tests")</span> @@ -614,7 +614,7 @@ if ('onhashchange' in window) { <span id="L549" class="LineNr">549 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> index = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L550" class="LineNr">550 </span> <span class="Comment">// Update PUT_INDEX index in Run</span> <span id="L551" class="LineNr">551 </span> vector<<span class="Normal">double</span>> index_val<span class="Delimiter">(</span>read_memory<span class="Delimiter">(</span>index<span class="Delimiter">));</span> -<span id="L552" class="LineNr">552 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < <span class="Constant">0</span> || index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L552" class="LineNr">552 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < <span class="Constant">0</span> || index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L553" class="LineNr">553 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"invalid index "</span> << no_scientific<span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L554" class="LineNr">554 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L555" class="LineNr">555 </span> <span class="Delimiter">}</span> @@ -711,7 +711,7 @@ if ('onhashchange' in window) { <span id="L646" class="LineNr">646 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L647" class="LineNr">647 </span> <span class="Delimiter">}</span> <span id="L648" class="LineNr">648 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L649" class="LineNr">649 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> array<span class="Delimiter">.</span>value<span class="Delimiter">));</span> +<span id="L649" class="LineNr">649 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> array<span class="Delimiter">.</span>value<span class="Delimiter">));</span> <span id="L650" class="LineNr">650 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L651" class="LineNr">651 </span><span class="Delimiter">}</span> <span id="L652" class="LineNr">652 </span> diff --git a/html/033exclusive_container.cc.html b/html/033exclusive_container.cc.html index ae11dfd7..6c5e11d2 100644 --- a/html/033exclusive_container.cc.html +++ b/html/033exclusive_container.cc.html @@ -73,7 +73,7 @@ if ('onhashchange' in window) { <span id="L8" class="LineNr"> 8 </span><span class="Comment">//: We'll use this container as a running example, with two number elements.</span> <span id="L9" class="LineNr"> 9 </span><span class="Delimiter">{</span> <span id="L10" class="LineNr"> 10 </span><a href='010vm.cc.html#L123'>type_ordinal</a> tmp = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"number-or-point"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L11" class="LineNr"> 11 </span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> tmp<span class="Delimiter">);</span> <span class="Comment">// initialize</span> +<span id="L11" class="LineNr"> 11 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> tmp<span class="Delimiter">);</span> <span class="Comment">// initialize</span> <span id="L12" class="LineNr"> 12 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>kind = <a href='010vm.cc.html#L174'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">;</span> <span id="L13" class="LineNr"> 13 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>name = <span class="Constant">"number-or-point"</span><span class="Delimiter">;</span> <span id="L14" class="LineNr"> 14 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"i:number"</span><span class="Delimiter">));</span> @@ -199,7 +199,7 @@ if ('onhashchange' in window) { <span id="L134" class="LineNr">134 </span> <span class="Delimiter">}</span> <span id="L135" class="LineNr">135 </span> <span class="Normal">const</span> reagent& variant = variant_type<span class="Delimiter">(</span>base<span class="Delimiter">,</span> offset<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span id="L136" class="LineNr">136 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>product<span class="Delimiter">,</span> variant<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L137" class="LineNr">137 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"'maybe-convert "</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">", "</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>original_string << <span class="Constant">"' should write to "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">" but '"</span> << product<span class="Delimiter">.</span>name << <span class="Constant">"' has type "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>product<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L137" class="LineNr">137 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"'maybe-convert "</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">", "</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>original_string << <span class="Constant">"' should write to "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">" but '"</span> << product<span class="Delimiter">.</span>name << <span class="Constant">"' has type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>product<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L138" class="LineNr">138 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L139" class="LineNr">139 </span> <span class="Delimiter">}</span> <span id="L140" class="LineNr">140 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> status = inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> @@ -226,14 +226,14 @@ if ('onhashchange' in window) { <span id="L161" class="LineNr">161 </span> <span class="Comment">// Update MAYBE_CONVERT status in Run</span> <span id="L162" class="LineNr">162 </span> <span class="Comment">// optimization: directly write results to only update first product when necessary</span> <span id="L163" class="LineNr">163 </span> write_products = <span class="Constant">false</span><span class="Delimiter">;</span> -<span id="L164" class="LineNr">164 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>tag == <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L164" class="LineNr">164 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>tag == <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span id="L165" class="LineNr">165 </span> <span class="Conceal">¦</span> <span class="Normal">const</span> reagent& variant = variant_type<span class="Delimiter">(</span>base<span class="Delimiter">,</span> tag<span class="Delimiter">);</span> <span id="L166" class="LineNr">166 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing 1 in location "</span> << status<span class="Delimiter">.</span>value << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L167" class="LineNr">167 </span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> status<span class="Delimiter">.</span>value<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> <span id="L168" class="LineNr">168 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_dummy<span class="Delimiter">(</span>product<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L169" class="LineNr">169 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// Write Memory in Successful MAYBE_CONVERT in Run</span> <span id="L170" class="LineNr">170 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</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_of<span class="Delimiter">(</span>variant<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L171" class="LineNr">171 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">double</span> val = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+i<span class="Delimiter">);</span> +<span id="L171" class="LineNr">171 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">double</span> val = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+i<span class="Delimiter">);</span> <span id="L172" class="LineNr">172 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing "</span> << no_scientific<span class="Delimiter">(</span>val<span class="Delimiter">)</span> << <span class="Constant">" in location "</span> << product<span class="Delimiter">.</span>value+i << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L173" class="LineNr">173 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> product<span class="Delimiter">.</span>value+i<span class="Delimiter">,</span> val<span class="Delimiter">);</span> <span id="L174" class="LineNr">174 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> @@ -383,7 +383,7 @@ if ('onhashchange' in window) { <span id="L318" class="LineNr">318 </span><span class="Delimiter">:(before "End <a href='031merge.cc.html#L142'>check_merge_call</a> Special-cases")</span> <span id="L319" class="LineNr">319 </span><span class="Normal">case</span> <a href='010vm.cc.html#L174'>EXCLUSIVE_CONTAINER</a>: <span class="Delimiter">{</span> <span id="L320" class="LineNr">320 </span> assert<span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container_element_index == <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L321" class="LineNr">321 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"checking exclusive container "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>container<span class="Delimiter">)</span> << <span class="Constant">" vs ingredient "</span> << ingredient_index << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L321" class="LineNr">321 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"checking exclusive container "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>container<span class="Delimiter">)</span> << <span class="Constant">" vs ingredient "</span> << ingredient_index << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L322" class="LineNr">322 </span> <span class="Comment">// easy case: exact match</span> <span id="L323" class="LineNr">323 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>types_strictly_match<span class="Delimiter">(</span>container<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">)))</span> <span id="L324" class="LineNr">324 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> diff --git a/html/034address.cc.html b/html/034address.cc.html index 83e47f3e..6f4d708e 100644 --- a/html/034address.cc.html +++ b/html/034address.cc.html @@ -271,7 +271,7 @@ if ('onhashchange' in window) { <span id="L207" class="LineNr">207 </span><span class="Normal">void</span> drop_from_type<span class="Delimiter">(</span>reagent& r<span class="Delimiter">,</span> string expected_type<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L208" class="LineNr">208 </span> assert<span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom<span class="Delimiter">);</span> <span id="L209" class="LineNr">209 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>name != expected_type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L210" class="LineNr">210 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"can't drop2 "</span> << expected_type << <span class="Constant">" from '"</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L210" class="LineNr">210 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"can't drop2 "</span> << expected_type << <span class="Constant">" from '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> <span id="L211" class="LineNr">211 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L212" class="LineNr">212 </span> <span class="Delimiter">}</span> <span id="L213" class="LineNr">213 </span> <span class="Comment">// r.type = r.type->right</span> diff --git a/html/035lookup.cc.html b/html/035lookup.cc.html index d888828a..e7fdca04 100644 --- a/html/035lookup.cc.html +++ b/html/035lookup.cc.html @@ -164,8 +164,8 @@ if ('onhashchange' in window) { <span id="L99" class="LineNr"> 99 </span> <span id="L100" class="LineNr">100 </span><span class="Normal">void</span> lookup_memory_core<span class="Delimiter">(</span>reagent& x<span class="Delimiter">,</span> <span class="Normal">bool</span> check_for_null<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L101" class="LineNr">101 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << x<span class="Delimiter">.</span>value << <span class="Constant">" is "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">))</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L103" class="LineNr">103 </span> x<span class="Delimiter">.</span><a href='010vm.cc.html#L65'>set_value</a><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">));</span> +<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << x<span class="Delimiter">.</span>value << <span class="Constant">" is "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">))</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L103" class="LineNr">103 </span> x<span class="Delimiter">.</span><a href='010vm.cc.html#L65'>set_value</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">));</span> <span id="L104" class="LineNr">104 </span> drop_from_type<span class="Delimiter">(</span>x<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">);</span> <span id="L105" class="LineNr">105 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>value<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L106" class="LineNr">106 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"skipping refcount at "</span> << x<span class="Delimiter">.</span>value << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> @@ -239,7 +239,7 @@ if ('onhashchange' in window) { <span id="L174" class="LineNr">174 </span><span class="Normal">bool</span> canonize_type<span class="Delimiter">(</span>reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L175" class="LineNr">175 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>has_property<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">"lookup"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L176" class="LineNr">176 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type || r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || !r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left || !r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom || r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value != get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L177" class="LineNr">177 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"cannot perform lookup on '"</span> << r<span class="Delimiter">.</span>name << <span class="Constant">"' because it has non-address type "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L177" class="LineNr">177 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"cannot perform lookup on '"</span> << r<span class="Delimiter">.</span>name << <span class="Constant">"' because it has non-address type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L178" class="LineNr">178 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L179" class="LineNr">179 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L180" class="LineNr">180 </span> <span class="Conceal">¦</span> drop_from_type<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">);</span> @@ -578,7 +578,7 @@ if ('onhashchange' in window) { <span id="L513" class="LineNr">513 </span><span class="Normal">case</span> _DUMP: <span class="Delimiter">{</span> <span id="L514" class="LineNr">514 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> after_canonize = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L515" class="LineNr">515 </span> canonize<span class="Delimiter">(</span>after_canonize<span class="Delimiter">);</span> -<span id="L516" class="LineNr">516 </span> cerr << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name << <span class="Constant">' '</span> << no_scientific<span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>value<span class="Delimiter">)</span> << <span class="Constant">" => "</span> << no_scientific<span class="Delimiter">(</span>after_canonize<span class="Delimiter">.</span>value<span class="Delimiter">)</span> << <span class="Constant">" => "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> after_canonize<span class="Delimiter">.</span>value<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L516" class="LineNr">516 </span> cerr << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name << <span class="Constant">' '</span> << no_scientific<span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>value<span class="Delimiter">)</span> << <span class="Constant">" => "</span> << no_scientific<span class="Delimiter">(</span>after_canonize<span class="Delimiter">.</span>value<span class="Delimiter">)</span> << <span class="Constant">" => "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> after_canonize<span class="Delimiter">.</span>value<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L517" class="LineNr">517 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L518" class="LineNr">518 </span><span class="Delimiter">}</span> <span id="L519" class="LineNr">519 </span> @@ -593,7 +593,7 @@ if ('onhashchange' in window) { <span id="L528" class="LineNr">528 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L529" class="LineNr">529 </span><span class="Normal">case</span> _BAR: <span class="Delimiter">{</span> <span id="L530" class="LineNr">530 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L531" class="LineNr">531 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Bar != -<span class="Constant">1</span><span class="Delimiter">)</span> cerr << Bar << <span class="Constant">": "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> Bar<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L531" class="LineNr">531 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Bar != -<span class="Constant">1</span><span class="Delimiter">)</span> cerr << Bar << <span class="Constant">": "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> Bar<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L532" class="LineNr">532 </span> <span class="Conceal">¦</span> <span class="Normal">else</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L533" class="LineNr">533 </span> <span class="Delimiter">}</span> <span id="L534" class="LineNr">534 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> diff --git a/html/036refcount.cc.html b/html/036refcount.cc.html index 8cb40e7a..e0d525af 100644 --- a/html/036refcount.cc.html +++ b/html/036refcount.cc.html @@ -83,7 +83,7 @@ if ('onhashchange' in window) { <span id="L18" class="LineNr"> 18 </span><span class="traceContains">+mem: decrementing refcount of 1000: 1 -> 0</span> <span id="L19" class="LineNr"> 19 </span> <span id="L20" class="LineNr"> 20 </span><span class="Delimiter">:(after "Writing Instruction Product(i)")</span> -<span id="L21" class="LineNr"> 21 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='028call_return.cc.html#L114'>is_primitive</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L21" class="LineNr"> 21 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='028call_return.cc.html#L115'>is_primitive</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L22" class="LineNr"> 22 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> tmp = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L23" class="LineNr"> 23 </span> canonize<span class="Delimiter">(</span>tmp<span class="Delimiter">);</span> <span id="L24" class="LineNr"> 24 </span> <a href='036refcount.cc.html#L35'>update_any_refcounts</a><span class="Delimiter">(</span>tmp<span class="Delimiter">,</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> @@ -116,7 +116,7 @@ if ('onhashchange' in window) { <span id="L51" class="LineNr"> 51 </span> assert<span class="Delimiter">(</span>new_address >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L52" class="LineNr"> 52 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>new_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L53" class="LineNr"> 53 </span> ++Total_refcount_updates<span class="Delimiter">;</span> -<span id="L54" class="LineNr"> 54 </span> <span class="Normal">int</span> new_refcount = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> new_address<span class="Delimiter">);</span> +<span id="L54" class="LineNr"> 54 </span> <span class="Normal">int</span> new_refcount = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> new_address<span class="Delimiter">);</span> <span id="L55" class="LineNr"> 55 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"incrementing refcount of "</span> << new_address << <span class="Constant">": "</span> << new_refcount << <span class="Constant">" -> "</span> << new_refcount+<span class="Constant">1</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L56" class="LineNr"> 56 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> new_address<span class="Delimiter">,</span> new_refcount+<span class="Constant">1</span><span class="Delimiter">);</span> <span id="L57" class="LineNr"> 57 </span><span class="Delimiter">}</span> @@ -125,7 +125,7 @@ if ('onhashchange' in window) { <span id="L60" class="LineNr"> 60 </span> <span class="Comment">// Begin Decrement Refcounts(canonized_x)</span> <span id="L61" class="LineNr"> 61 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_address<span class="Delimiter">(</span>canonized_x<span class="Delimiter">)</span> && canonized_x<span class="Delimiter">.</span>value != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L62" class="LineNr"> 62 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span>!canonized_x<span class="Delimiter">.</span>metadata<span class="Delimiter">.</span>size<span class="Delimiter">);</span> -<span id="L63" class="LineNr"> 63 </span> <span class="Conceal">¦</span> <a href='036refcount.cc.html#L68'>decrement_refcount</a><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> canonized_x<span class="Delimiter">.</span>value<span class="Delimiter">),</span> <a href='030container.cc.html#L238'>payload_type</a><span class="Delimiter">(</span>canonized_x<span class="Delimiter">.</span>type<span class="Delimiter">),</span> <a href='036refcount.cc.html#L89'>payload_size</a><span class="Delimiter">(</span>canonized_x<span class="Delimiter">));</span> +<span id="L63" class="LineNr"> 63 </span> <span class="Conceal">¦</span> <a href='036refcount.cc.html#L68'>decrement_refcount</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> canonized_x<span class="Delimiter">.</span>value<span class="Delimiter">),</span> <a href='030container.cc.html#L238'>payload_type</a><span class="Delimiter">(</span>canonized_x<span class="Delimiter">.</span>type<span class="Delimiter">),</span> <a href='036refcount.cc.html#L89'>payload_size</a><span class="Delimiter">(</span>canonized_x<span class="Delimiter">));</span> <span id="L64" class="LineNr"> 64 </span> <span class="Delimiter">}</span> <span id="L65" class="LineNr"> 65 </span> <span class="Comment">// End Decrement Refcounts(canonized_x)</span> <span id="L66" class="LineNr"> 66 </span><span class="Delimiter">}</span> @@ -134,7 +134,7 @@ if ('onhashchange' in window) { <span id="L69" class="LineNr"> 69 </span> assert<span class="Delimiter">(</span>old_address >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L70" class="LineNr"> 70 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>old_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L71" class="LineNr"> 71 </span> ++Total_refcount_updates<span class="Delimiter">;</span> -<span id="L72" class="LineNr"> 72 </span> <span class="Normal">int</span> old_refcount = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> old_address<span class="Delimiter">);</span> +<span id="L72" class="LineNr"> 72 </span> <span class="Normal">int</span> old_refcount = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> old_address<span class="Delimiter">);</span> <span id="L73" class="LineNr"> 73 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"decrementing refcount of "</span> << old_address << <span class="Constant">": "</span> << old_refcount << <span class="Constant">" -> "</span> << old_refcount-<span class="Constant">1</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L74" class="LineNr"> 74 </span> --old_refcount<span class="Delimiter">;</span> <span id="L75" class="LineNr"> 75 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> old_address<span class="Delimiter">,</span> old_refcount<span class="Delimiter">);</span> @@ -257,7 +257,7 @@ if ('onhashchange' in window) { <span id="L192" class="LineNr"> 192 </span><span class="Comment">// todo: double-check data here as well</span> <span id="L193" class="LineNr"> 193 </span>vector<<span class="Normal">double</span>> data<span class="Delimiter">;</span> <span id="L194" class="LineNr"> 194 </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_of<span class="Delimiter">(</span>product<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L195" class="LineNr"> 195 </span> data<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+i<span class="Delimiter">));</span> +<span id="L195" class="LineNr"> 195 </span> data<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+i<span class="Delimiter">));</span> <span id="L196" class="LineNr"> 196 </span><a href='036refcount.cc.html#L35'>update_any_refcounts</a><span class="Delimiter">(</span>product<span class="Delimiter">,</span> data<span class="Delimiter">);</span> <span id="L197" class="LineNr"> 197 </span> <span id="L198" class="LineNr"> 198 </span><span class="SalientComment">//:: manage refcounts in instructions that copy multiple locations at a time</span> @@ -377,7 +377,7 @@ if ('onhashchange' in window) { <span id="L312" class="LineNr"> 312 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- compute <a href='043space.cc.html#L82'>address</a> offsets for "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L313" class="LineNr"> 313 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L314" class="LineNr"> 314 </span> <span class="Conceal">¦</span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L315" class="LineNr"> 315 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"- compute <a href='043space.cc.html#L82'>address</a> offsets for "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L315" class="LineNr"> 315 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"- compute <a href='043space.cc.html#L82'>address</a> offsets for "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L316" class="LineNr"> 316 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L317" class="LineNr"> 317 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> compute_container_address_offsets<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> <span class="Constant">" in '"</span>+inst<span class="Delimiter">.</span>original_string+<span class="Constant">"'"</span><span class="Delimiter">);</span> <span id="L318" class="LineNr"> 318 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> @@ -398,7 +398,7 @@ if ('onhashchange' in window) { <span id="L333" class="LineNr"> 333 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L334" class="LineNr"> 334 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L335" class="LineNr"> 335 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L336" class="LineNr"> 336 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << location_for_error_messages << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L336" class="LineNr"> 336 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << location_for_error_messages << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L337" class="LineNr"> 337 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L338" class="LineNr"> 338 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L339" class="LineNr"> 339 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>name == <span class="Constant">"address"</span><span class="Delimiter">)</span> @@ -438,7 +438,7 @@ if ('onhashchange' in window) { <span id="L373" class="LineNr"> 373 </span> <span id="L374" class="LineNr"> 374 </span><span class="Normal">void</span> <a href='036refcount.cc.html#L374'>append_addresses</a><span class="Delimiter">(</span><span class="Normal">int</span> base_offset<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree* type<span class="Delimiter">,</span> map<set<tag_condition_info><span class="Delimiter">,</span> set<address_element_info> >& out<span class="Delimiter">,</span> <span class="Normal">const</span> set<tag_condition_info>& key<span class="Delimiter">,</span> <span class="Normal">const</span> string& location_for_error_messages<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L375" class="LineNr"> 375 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_address<span class="Delimiter">(</span>type<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L376" class="LineNr"> 376 </span> <span class="Conceal">¦</span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>out<span class="Delimiter">,</span> key<span class="Delimiter">).</span>insert<span class="Delimiter">(</span>address_element_info<span class="Delimiter">(</span>base_offset<span class="Delimiter">,</span> <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*payload_type<span class="Delimiter">(</span>type<span class="Delimiter">))));</span> +<span id="L376" class="LineNr"> 376 </span> <span class="Conceal">¦</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>out<span class="Delimiter">,</span> key<span class="Delimiter">).</span>insert<span class="Delimiter">(</span>address_element_info<span class="Delimiter">(</span>base_offset<span class="Delimiter">,</span> <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*payload_type<span class="Delimiter">(</span>type<span class="Delimiter">))));</span> <span id="L377" class="LineNr"> 377 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L378" class="LineNr"> 378 </span> <span class="Delimiter">}</span> <span id="L379" class="LineNr"> 379 </span> <span class="Normal">const</span> type_tree* base_type = type<span class="Delimiter">;</span> @@ -451,7 +451,7 @@ if ('onhashchange' in window) { <span id="L386" class="LineNr"> 386 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// Compute Container Address Offset(element)</span> <span id="L387" class="LineNr"> 387 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_address<span class="Delimiter">(</span>element<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L388" class="LineNr"> 388 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"address at offset "</span> << curr_offset << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L389" class="LineNr"> 389 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>out<span class="Delimiter">,</span> key<span class="Delimiter">).</span>insert<span class="Delimiter">(</span>address_element_info<span class="Delimiter">(</span>curr_offset<span class="Delimiter">,</span> <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*payload_type<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">))));</span> +<span id="L389" class="LineNr"> 389 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>out<span class="Delimiter">,</span> key<span class="Delimiter">).</span>insert<span class="Delimiter">(</span>address_element_info<span class="Delimiter">(</span>curr_offset<span class="Delimiter">,</span> <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*payload_type<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">))));</span> <span id="L390" class="LineNr"> 390 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> ++curr_offset<span class="Delimiter">;</span> <span id="L391" class="LineNr"> 391 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L392" class="LineNr"> 392 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_array<span class="Delimiter">(</span>element<span class="Delimiter">))</span> <span class="Delimiter">{</span> @@ -794,7 +794,7 @@ if ('onhashchange' in window) { <span id="L729" class="LineNr"> 729 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<set<tag_condition_info><span class="Delimiter">,</span> set<address_element_info> >::const_iterator p = metadata<span class="Delimiter">.</span><a href='043space.cc.html#L82'>address</a><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != metadata<span class="Delimiter">.</span><a href='043space.cc.html#L82'>address</a><span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L730" class="LineNr"> 730 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!all_match<span class="Delimiter">(</span>data<span class="Delimiter">,</span> p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L731" class="LineNr"> 731 </span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span>set<address_element_info>::const_iterator info = p<span class="Delimiter">-></span>second<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> info != p<span class="Delimiter">-></span>second<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++info<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L732" class="LineNr"> 732 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">int</span> element_address = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> canonized_x<span class="Delimiter">.</span>value + info<span class="Delimiter">-></span>offset<span class="Delimiter">);</span> +<span id="L732" class="LineNr"> 732 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">int</span> element_address = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> canonized_x<span class="Delimiter">.</span>value + info<span class="Delimiter">-></span>offset<span class="Delimiter">);</span> <span id="L733" class="LineNr"> 733 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> element<span class="Delimiter">;</span> <span id="L734" class="LineNr"> 734 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> element<span class="Delimiter">.</span><a href='010vm.cc.html#L65'>set_value</a><span class="Delimiter">(</span>element_address+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L735" class="LineNr"> 735 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> element<span class="Delimiter">.</span>type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*info<span class="Delimiter">-></span><a href='030container.cc.html#L238'>payload_type</a><span class="Delimiter">);</span> @@ -1138,7 +1138,7 @@ if ('onhashchange' in window) { <span id="L1073" class="LineNr">1073 </span><span class="Normal">void</span> <a href='036refcount.cc.html#L1073'>dump_recipe_profile</a><span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> ridx<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& r<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L1074" class="LineNr">1074 </span> out << <span class="Constant">"recipe "</span> << r<span class="Delimiter">.</span>name << <span class="Constant">" [</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> <span id="L1075" class="LineNr">1075 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L1076" class="LineNr">1076 </span> <span class="Conceal">¦</span> out << std::setw<span class="Delimiter">(</span><span class="Constant">6</span><span class="Delimiter">)</span> << Num_refcount_updates[ridx][i] << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L1076" class="LineNr">1076 </span> <span class="Conceal">¦</span> out << std::setw<span class="Delimiter">(</span><span class="Constant">6</span><span class="Delimiter">)</span> << Num_refcount_updates[ridx][i] << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L1077" class="LineNr">1077 </span> <span class="Delimiter">}</span> <span id="L1078" class="LineNr">1078 </span> out << <span class="Constant">"]</span><span class="cSpecial">\n\n</span><span class="Constant">"</span><span class="Delimiter">;</span> <span id="L1079" class="LineNr">1079 </span><span class="Delimiter">}</span> diff --git a/html/037abandon.cc.html b/html/037abandon.cc.html index 848bbc41..c073c216 100644 --- a/html/037abandon.cc.html +++ b/html/037abandon.cc.html @@ -91,7 +91,7 @@ if ('onhashchange' in window) { <span id="L26" class="LineNr"> 26 </span> <span id="L27" class="LineNr"> 27 </span><span class="Delimiter">:(code)</span> <span id="L28" class="LineNr"> 28 </span><span class="Normal">void</span> <a href='037abandon.cc.html#L28'>abandon</a><span class="Delimiter">(</span><span class="Normal">int</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">,</span> <span class="Normal">const</span> type_tree* <a href='030container.cc.html#L238'>payload_type</a><span class="Delimiter">,</span> <span class="Normal">int</span> <a href='036refcount.cc.html#L89'>payload_size</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L29" class="LineNr"> 29 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"abandon"</span><span class="Delimiter">)</span> << <span class="Constant">"updating refcounts inside "</span> << <a href='043space.cc.html#L82'>address</a> << <span class="Constant">": "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><a href='030container.cc.html#L238'>payload_type</a><span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L29" class="LineNr"> 29 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"abandon"</span><span class="Delimiter">)</span> << <span class="Constant">"updating refcounts inside "</span> << <a href='043space.cc.html#L82'>address</a> << <span class="Constant">": "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='030container.cc.html#L238'>payload_type</a><span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L30" class="LineNr"> 30 </span><span class="CommentedCode">//? Total_free += size;</span> <span id="L31" class="LineNr"> 31 </span><span class="CommentedCode">//? ++Num_free;</span> <span id="L32" class="LineNr"> 32 </span><span class="CommentedCode">//? cerr << "abandon: " << size << '\n';</span> @@ -99,7 +99,7 @@ if ('onhashchange' in window) { <span id="L34" class="LineNr"> 34 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_array<span class="Delimiter">(</span><a href='030container.cc.html#L238'>payload_type</a><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L35" class="LineNr"> 35 </span> <span class="Conceal">¦</span> reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> element<span class="Delimiter">;</span> <span id="L36" class="LineNr"> 36 </span> <span class="Conceal">¦</span> element<span class="Delimiter">.</span>type = <a href='032array.cc.html#L377'>copy_array_element</a><span class="Delimiter">(</span><a href='030container.cc.html#L238'>payload_type</a><span class="Delimiter">);</span> -<span id="L37" class="LineNr"> 37 </span> <span class="Conceal">¦</span> <span class="Normal">int</span> <a href='032array.cc.html#L397'>array_length</a> = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> address+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L37" class="LineNr"> 37 </span> <span class="Conceal">¦</span> <span class="Normal">int</span> <a href='032array.cc.html#L397'>array_length</a> = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> address+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L38" class="LineNr"> 38 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name != <span class="Constant">"array"</span><span class="Delimiter">);</span> <span id="L39" class="LineNr"> 39 </span> <span class="Conceal">¦</span> <span class="Normal">int</span> element_size = size_of<span class="Delimiter">(</span>element<span class="Delimiter">);</span> <span id="L40" class="LineNr"> 40 </span> <span class="Conceal">¦</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 < <a href='032array.cc.html#L397'>array_length</a><span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -118,19 +118,19 @@ if ('onhashchange' in window) { <span id="L53" class="LineNr"> 53 </span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L54" class="LineNr"> 54 </span> <span class="Comment">// append existing free list to address</span> <span id="L55" class="LineNr"> 55 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"abandon"</span><span class="Delimiter">)</span> << <span class="Constant">"saving "</span> << <a href='043space.cc.html#L82'>address</a> << <span class="Constant">" in free-list of size "</span> << <a href='036refcount.cc.html#L89'>payload_size</a> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L56" class="LineNr"> 56 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">,</span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> <a href='036refcount.cc.html#L89'>payload_size</a><span class="Delimiter">));</span> +<span id="L56" class="LineNr"> 56 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">,</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> <a href='036refcount.cc.html#L89'>payload_size</a><span class="Delimiter">));</span> <span id="L57" class="LineNr"> 57 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> <a href='036refcount.cc.html#L89'>payload_size</a><span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">);</span> <span id="L58" class="LineNr"> 58 </span><span class="Delimiter">}</span> <span id="L59" class="LineNr"> 59 </span> <span id="L60" class="LineNr"> 60 </span><span class="Delimiter">:(after "Allocate Special-cases")</span> -<span id="L61" class="LineNr"> 61 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L61" class="LineNr"> 61 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L62" class="LineNr"> 62 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"abandon"</span><span class="Delimiter">)</span> << <span class="Constant">"picking up space from free-list of size "</span> << size << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L63" class="LineNr"> 63 </span> <span class="Normal">int</span> result = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">);</span> +<span id="L63" class="LineNr"> 63 </span> <span class="Normal">int</span> result = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">);</span> <span id="L64" class="LineNr"> 64 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"new alloc from free list: "</span> << result << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L65" class="LineNr"> 65 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">,</span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> result<span class="Delimiter">));</span> +<span id="L65" class="LineNr"> 65 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">,</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> result<span class="Delimiter">));</span> <span id="L66" class="LineNr"> 66 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> result<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L67" class="LineNr"> 67 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> curr = result<span class="Delimiter">;</span> curr < result+size<span class="Delimiter">;</span> ++curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L69" class="LineNr"> 69 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"memory in free list was not zeroed out: "</span> << curr << <span class="Constant">'/'</span> << result << <span class="Constant">"; somebody wrote to us after free!!!</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L70" class="LineNr"> 70 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// always fatal</span> <span id="L71" class="LineNr"> 71 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> diff --git a/html/038new_text.cc.html b/html/038new_text.cc.html index 6b422c40..ba71f478 100644 --- a/html/038new_text.cc.html +++ b/html/038new_text.cc.html @@ -146,13 +146,13 @@ if ('onhashchange' in window) { <span id="L81" class="LineNr"> 81 </span><span class="traceContains">+app: foo: abc</span> <span id="L82" class="LineNr"> 82 </span> <span id="L83" class="LineNr"> 83 </span><span class="Delimiter">:(before "End inspect Special-cases(r, data)")</span> -<span id="L84" class="LineNr"> 84 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='027call_ingredient.cc.html#L174'>is_mu_text</a><span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L84" class="LineNr"> 84 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='027call_ingredient.cc.html#L177'>is_mu_text</a><span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L85" class="LineNr"> 85 </span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>data<span class="Delimiter">));</span> <span id="L86" class="LineNr"> 86 </span> <span class="Identifier">return</span> <a href='038new_text.cc.html#L143'>read_mu_text</a><span class="Delimiter">(</span>data<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> <span id="L87" class="LineNr"> 87 </span><span class="Delimiter">}</span> <span id="L88" class="LineNr"> 88 </span> <span id="L89" class="LineNr"> 89 </span><span class="Delimiter">:(before "End $print Special-cases")</span> -<span id="L90" class="LineNr"> 90 </span><span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='027call_ingredient.cc.html#L174'>is_mu_text</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L90" class="LineNr"> 90 </span><span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='027call_ingredient.cc.html#L177'>is_mu_text</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span id="L91" class="LineNr"> 91 </span> cout << <a href='038new_text.cc.html#L143'>read_mu_text</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> <span id="L92" class="LineNr"> 92 </span><span class="Delimiter">}</span> <span id="L93" class="LineNr"> 93 </span> @@ -208,7 +208,7 @@ if ('onhashchange' in window) { <span id="L143" class="LineNr">143 </span>string <a href='038new_text.cc.html#L143'>read_mu_text</a><span class="Delimiter">(</span><span class="Normal">int</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L144" class="LineNr">144 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='043space.cc.html#L82'>address</a> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">""</span><span class="Delimiter">;</span> <span id="L145" class="LineNr">145 </span> ++address<span class="Delimiter">;</span> <span class="Comment">// skip refcount</span> -<span id="L146" class="LineNr">146 </span> <span class="Normal">int</span> length = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">);</span> +<span id="L146" class="LineNr">146 </span> <span class="Normal">int</span> length = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">);</span> <span id="L147" class="LineNr">147 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>length == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">""</span><span class="Delimiter">;</span> <span id="L148" class="LineNr">148 </span> <span class="Identifier">return</span> <a href='038new_text.cc.html#L151'>read_mu_characters</a><span class="Delimiter">(</span>address+<span class="Constant">1</span><span class="Delimiter">,</span> length<span class="Delimiter">);</span> <span id="L149" class="LineNr">149 </span><span class="Delimiter">}</span> @@ -216,7 +216,7 @@ if ('onhashchange' in window) { <span id="L151" class="LineNr">151 </span>string <a href='038new_text.cc.html#L151'>read_mu_characters</a><span class="Delimiter">(</span><span class="Normal">int</span> start<span class="Delimiter">,</span> <span class="Normal">int</span> length<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L152" class="LineNr">152 </span> ostringstream tmp<span class="Delimiter">;</span> <span id="L153" class="LineNr">153 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> curr = start<span class="Delimiter">;</span> curr < start+length<span class="Delimiter">;</span> ++curr<span class="Delimiter">)</span> -<span id="L154" class="LineNr">154 </span> <span class="Conceal">¦</span> tmp << to_unicode<span class="Delimiter">(</span><span class="Normal">static_cast</span><<span class="Normal">uint32_t</span>><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)));</span> +<span id="L154" class="LineNr">154 </span> <span class="Conceal">¦</span> tmp << to_unicode<span class="Delimiter">(</span><span class="Normal">static_cast</span><<span class="Normal">uint32_t</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)));</span> <span id="L155" class="LineNr">155 </span> <span class="Identifier">return</span> tmp<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L156" class="LineNr">156 </span><span class="Delimiter">}</span> <span id="L157" class="LineNr">157 </span> @@ -277,7 +277,7 @@ if ('onhashchange' in window) { <span id="L212" class="LineNr">212 </span><span class="Normal">case</span> _READ: <span class="Delimiter">{</span> <span id="L213" class="LineNr">213 </span> <a href='038new_text.cc.html#L223'>skip_whitespace</a><span class="Delimiter">(</span>cin<span class="Delimiter">);</span> <span id="L214" class="LineNr">214 </span> string result<span class="Delimiter">;</span> -<span id="L215" class="LineNr">215 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>cin<span class="Delimiter">))</span> +<span id="L215" class="LineNr">215 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>cin<span class="Delimiter">))</span> <span id="L216" class="LineNr">216 </span> <span class="Conceal">¦</span> cin >> result<span class="Delimiter">;</span> <span id="L217" class="LineNr">217 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L218" class="LineNr">218 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><a href='038new_text.cc.html#L38'>new_mu_text</a><span class="Delimiter">(</span>result<span class="Delimiter">));</span> diff --git a/html/043space.cc.html b/html/043space.cc.html index ac9c1f97..c7e94729 100644 --- a/html/043space.cc.html +++ b/html/043space.cc.html @@ -148,7 +148,7 @@ if ('onhashchange' in window) { <span id="L82" class="LineNr"> 82 </span><span class="Normal">int</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">(</span><span class="Normal">int</span> offset<span class="Delimiter">,</span> <span class="Normal">int</span> base<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L83" class="LineNr"> 83 </span> assert<span class="Delimiter">(</span>offset >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L84" class="LineNr"> 84 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> offset<span class="Delimiter">;</span> <span class="Comment">// raw</span> -<span id="L85" class="LineNr"> 85 </span> <span class="Normal">int</span> size = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base<span class="Delimiter">);</span> +<span id="L85" class="LineNr"> 85 </span> <span class="Normal">int</span> size = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base<span class="Delimiter">);</span> <span id="L86" class="LineNr"> 86 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset >= size<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L87" class="LineNr"> 87 </span> <span class="Conceal">¦</span> <span class="Comment">// todo: test</span> <span id="L88" class="LineNr"> 88 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="Constant">": location "</span> << offset << <span class="Constant">" is out of bounds "</span> << size << <span class="Constant">" at "</span> << base << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> @@ -164,7 +164,7 @@ if ('onhashchange' in window) { <span id="L98" class="LineNr"> 98 </span><span class="Delimiter">:(after "Begin Preprocess write_memory(x, data)")</span> <span id="L99" class="LineNr"> 99 </span><span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>name == <span class="Constant">"default-space"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L100" class="LineNr">100 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!scalar<span class="Delimiter">(</span>data<span class="Delimiter">)</span> || !is_mu_space<span class="Delimiter">(</span>x<span class="Delimiter">))</span> -<span id="L101" class="LineNr">101 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"'default-space' should be of type <a href='043space.cc.html#L82'>address</a>:array:location, but is "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L101" class="LineNr">101 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"'default-space' should be of type <a href='043space.cc.html#L82'>address</a>:array:location, but is "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L102" class="LineNr">102 </span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>default_space = data<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L103" class="LineNr">103 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L104" class="LineNr">104 </span><span class="Delimiter">}</span> @@ -314,7 +314,7 @@ if ('onhashchange' in window) { <span id="L248" class="LineNr">248 </span><span class="Delimiter">}</span> <span id="L249" class="LineNr">249 </span><span class="Delimiter">:(after "Begin Decrement Refcounts(canonized_x)")</span> <span id="L250" class="LineNr">250 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='043space.cc.html#L106'>is_mu_space</a><span class="Delimiter">(</span>canonized_x<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L251" class="LineNr">251 </span> <span class="Normal">int</span> space_address = <span class="Delimiter">(</span>canonized_x<span class="Delimiter">.</span>name == <span class="Constant">"default-space"</span><span class="Delimiter">)</span> ? <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>default_space : <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> canonized_x<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L251" class="LineNr">251 </span> <span class="Normal">int</span> space_address = <span class="Delimiter">(</span>canonized_x<span class="Delimiter">.</span>name == <span class="Constant">"default-space"</span><span class="Delimiter">)</span> ? <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>default_space : <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> canonized_x<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span id="L252" class="LineNr">252 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>space_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L253" class="LineNr">253 </span> <span class="Comment">// this branch relies on global state</span> <span id="L254" class="LineNr">254 </span> string recipe_name<span class="Delimiter">;</span> @@ -324,7 +324,7 @@ if ('onhashchange' in window) { <span id="L258" class="LineNr">258 </span> <span class="Delimiter">}</span> <span id="L259" class="LineNr">259 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L260" class="LineNr">260 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>canonized_x<span class="Delimiter">.</span>name != <span class="Constant">"default-space"</span><span class="Delimiter">)</span> -<span id="L261" class="LineNr">261 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> cerr << <a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="Constant">": "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>canonized_x<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L261" class="LineNr">261 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> cerr << <a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="Constant">": "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>canonized_x<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L262" class="LineNr">262 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span>canonized_x<span class="Delimiter">.</span>name == <span class="Constant">"default-space"</span><span class="Delimiter">);</span> <span id="L263" class="LineNr">263 </span> <span class="Conceal">¦</span> recipe_name = <a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">();</span> <span id="L264" class="LineNr">264 </span> <span class="Delimiter">}</span> @@ -356,7 +356,7 @@ if ('onhashchange' in window) { <span id="L290" class="LineNr">290 </span><span class="traceContains">+mem: automatically abandoning 1000</span> <span id="L291" class="LineNr">291 </span> <span id="L292" class="LineNr">292 </span><span class="Delimiter">:(before "Reclaim Space(space_address, space_recipe_ordinal, space_recipe)")</span> -<span id="L293" class="LineNr">293 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> space_address<span class="Delimiter">)</span> <= <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L293" class="LineNr">293 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> space_address<span class="Delimiter">)</span> <= <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L294" class="LineNr">294 </span> set<string> reclaimed_locals<span class="Delimiter">;</span> <span id="L295" class="LineNr">295 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"trying to reclaim locals"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L296" class="LineNr">296 </span> <span class="Comment">// update any refcounts for variables in the space -- in the context of the space</span> diff --git a/html/044space_surround.cc.html b/html/044space_surround.cc.html index c6291f2e..312a9293 100644 --- a/html/044space_surround.cc.html +++ b/html/044space_surround.cc.html @@ -108,7 +108,7 @@ if ('onhashchange' in window) { <span id="L45" class="LineNr">45 </span><span class="Normal">int</span> <a href='043space.cc.html#L78'>space_base</a><span class="Delimiter">(</span><span class="Normal">const</span> reagent& x<span class="Delimiter">,</span> <span class="Normal">int</span> space_index<span class="Delimiter">,</span> <span class="Normal">int</span> base<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L46" class="LineNr">46 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>space_index == <span class="Constant">0</span><span class="Delimiter">)</span> <span id="L47" class="LineNr">47 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> base<span class="Delimiter">;</span> -<span id="L48" class="LineNr">48 </span> <span class="Normal">int</span> result = <a href='043space.cc.html#L78'>space_base</a><span class="Delimiter">(</span>x<span class="Delimiter">,</span> space_index-<span class="Constant">1</span><span class="Delimiter">,</span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base+<span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">))</span>+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L48" class="LineNr">48 </span> <span class="Normal">int</span> result = <a href='043space.cc.html#L78'>space_base</a><span class="Delimiter">(</span>x<span class="Delimiter">,</span> space_index-<span class="Constant">1</span><span class="Delimiter">,</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base+<span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">))</span>+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span id="L49" class="LineNr">49 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L50" class="LineNr">50 </span><span class="Delimiter">}</span> <span id="L51" class="LineNr">51 </span> diff --git a/html/045closure_name.cc.html b/html/045closure_name.cc.html index 1740cdf2..579fb9ef 100644 --- a/html/045closure_name.cc.html +++ b/html/045closure_name.cc.html @@ -165,7 +165,7 @@ if ('onhashchange' in window) { <span id="L102" class="LineNr">102 </span><span class="Normal">int</span> lookup_name<span class="Delimiter">(</span><span class="Normal">const</span> reagent& x<span class="Delimiter">,</span> <span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">,</span> set<recipe_ordinal>& done<span class="Delimiter">,</span> vector<recipe_ordinal>& path<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L103" class="LineNr">103 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Name[r]<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span> Name[r][x<span class="Delimiter">.</span>name]<span class="Delimiter">;</span> <span id="L104" class="LineNr">104 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>done<span class="Delimiter">,</span> r<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L105" class="LineNr">105 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"can't compute address of '"</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">"' because</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L105" class="LineNr">105 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"can't compute address of '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">"' because</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> <span id="L106" class="LineNr">106 </span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">1</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>path<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L107" class="LineNr">107 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << path<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i-<span class="Constant">1</span><span class="Delimiter">)</span> << <span class="Constant">" requires computing names of "</span> << path<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L108" class="LineNr">108 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> diff --git a/html/050scenario.cc.html b/html/050scenario.cc.html index e47925c1..0cffb879 100644 --- a/html/050scenario.cc.html +++ b/html/050scenario.cc.html @@ -499,9 +499,9 @@ if ('onhashchange' in window) { <span id="L432" class="LineNr">432 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>locations_checked<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">))</span> <span id="L433" class="LineNr">433 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"duplicate expectation for location '"</span> << address << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L434" class="LineNr">434 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"checking location "</span> << <a href='043space.cc.html#L82'>address</a> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L435" class="LineNr">435 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">)</span> != value<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L435" class="LineNr">435 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">)</span> != value<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L436" class="LineNr">436 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L437" class="LineNr">437 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location '"</span> << address << <span class="Constant">"' to contain "</span> << no_scientific<span class="Delimiter">(</span>value<span class="Delimiter">)</span> << <span class="Constant">" but saw "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L437" class="LineNr">437 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location '"</span> << address << <span class="Constant">"' to contain "</span> << no_scientific<span class="Delimiter">(</span>value<span class="Delimiter">)</span> << <span class="Constant">" but saw "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L438" class="LineNr">438 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed = <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L439" class="LineNr">439 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L440" class="LineNr">440 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> @@ -545,7 +545,7 @@ if ('onhashchange' in window) { <span id="L478" class="LineNr">478 </span> <span id="L479" class="LineNr">479 </span><span class="Normal">void</span> check_mu_text<span class="Delimiter">(</span><span class="Normal">int</span> start<span class="Delimiter">,</span> <span class="Normal">const</span> string& literal<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L480" class="LineNr">480 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"checking text length at "</span> << start << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L481" class="LineNr">481 </span> <span class="Normal">int</span> <a href='032array.cc.html#L397'>array_length</a> = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> start<span class="Delimiter">));</span> +<span id="L481" class="LineNr">481 </span> <span class="Normal">int</span> <a href='032array.cc.html#L397'>array_length</a> = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> start<span class="Delimiter">));</span> <span id="L482" class="LineNr">482 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='032array.cc.html#L397'>array_length</a> != <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>literal<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L483" class="LineNr">483 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L484" class="LineNr">484 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location '"</span> << start << <span class="Constant">"' to contain length "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>literal<span class="Delimiter">)</span> << <span class="Constant">" of text ["</span> << literal << <span class="Constant">"] but saw "</span> << <a href='032array.cc.html#L397'>array_length</a> << <span class="Constant">" (for text ["</span> << <a href='038new_text.cc.html#L151'>read_mu_characters</a><span class="Delimiter">(</span>start+<span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> <a href='032array.cc.html#L397'>array_length</a><span class="Delimiter">)</span> << <span class="Constant">"])</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> @@ -555,9 +555,9 @@ if ('onhashchange' in window) { <span id="L488" class="LineNr">488 </span> <span class="Normal">int</span> curr = start+<span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// now skip length</span> <span id="L489" class="LineNr">489 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>literal<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L490" class="LineNr">490 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"checking location "</span> << curr+i << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L491" class="LineNr">491 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+i<span class="Delimiter">)</span> != literal<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L491" class="LineNr">491 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+i<span class="Delimiter">)</span> != literal<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L492" class="LineNr">492 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L493" class="LineNr">493 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location "</span> << <span class="Delimiter">(</span>curr+i<span class="Delimiter">)</span> << <span class="Constant">" to contain "</span> << literal<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> << <span class="Constant">" but saw "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L493" class="LineNr">493 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location "</span> << <span class="Delimiter">(</span>curr+i<span class="Delimiter">)</span> << <span class="Constant">" to contain "</span> << literal<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> << <span class="Constant">" but saw "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L494" class="LineNr">494 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed = <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L495" class="LineNr">495 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L496" class="LineNr">496 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> diff --git a/html/053recipe_header.cc.html b/html/053recipe_header.cc.html index 3d30ac4c..09471737 100644 --- a/html/053recipe_header.cc.html +++ b/html/053recipe_header.cc.html @@ -97,7 +97,7 @@ if ('onhashchange' in window) { <span id="L31" class="LineNr"> 31 </span><span class="Delimiter">:(code)</span> <span id="L32" class="LineNr"> 32 </span><span class="Normal">void</span> <a href='053recipe_header.cc.html#L32'>load_recipe_header</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">,</span> recipe& result<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L33" class="LineNr"> 33 </span> result<span class="Delimiter">.</span>has_header = <span class="Constant">true</span><span class="Delimiter">;</span> -<span id="L34" class="LineNr"> 34 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="Constant">'['</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L34" class="LineNr"> 34 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="Constant">'['</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L35" class="LineNr"> 35 </span> <span class="Conceal">¦</span> string s = <a href='011load.cc.html#L167'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L36" class="LineNr"> 36 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>s<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L37" class="LineNr"> 37 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> @@ -111,7 +111,7 @@ if ('onhashchange' in window) { <span id="L45" class="LineNr"> 45 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"header ingredient: "</span> << result<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>back<span class="Delimiter">().</span>original_string << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L46" class="LineNr"> 46 </span> <span class="Conceal">¦</span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L47" class="LineNr"> 47 </span> <span class="Delimiter">}</span> -<span id="L48" class="LineNr"> 48 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="Constant">'['</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L48" class="LineNr"> 48 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="Constant">'['</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L49" class="LineNr"> 49 </span> <span class="Conceal">¦</span> string s = <a href='011load.cc.html#L167'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L50" class="LineNr"> 50 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>s<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L51" class="LineNr"> 51 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> @@ -242,7 +242,7 @@ if ('onhashchange' in window) { <span id="L176" class="LineNr">176 </span><span class="Comment">//: Rewrite 'load-ingredients' to instructions to create all reagents in the header.</span> <span id="L177" class="LineNr">177 </span> <span id="L178" class="LineNr">178 </span><span class="Delimiter">:(before "End Rewrite Instruction(curr, <a href='010vm.cc.html#L19'>recipe</a> result)")</span> -<span id="L179" class="LineNr">179 </span><span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>name == <span class="Constant">"load-ingredients"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L179" class="LineNr">179 </span><span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>name == <span class="Constant">"load-ingredients"</span> || curr<span class="Delimiter">.</span>name == <span class="Constant">"load-inputs"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L180" class="LineNr">180 </span> curr<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L181" class="LineNr">181 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> op = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"next-ingredient-without-typechecking"</span><span class="Delimiter">);</span> <span id="L182" class="LineNr">182 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>result<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -357,7 +357,7 @@ if ('onhashchange' in window) { <span id="L291" class="LineNr">291 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- type-check calls inside <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L292" class="LineNr">292 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L293" class="LineNr">293 </span> <span class="Conceal">¦</span> <span class="Normal">const</span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L294" class="LineNr">294 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='028call_return.cc.html#L114'>is_primitive</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L294" class="LineNr">294 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='028call_return.cc.html#L115'>is_primitive</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L295" class="LineNr">295 </span> <span class="Conceal">¦</span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> <span id="L296" class="LineNr">296 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!callee<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L297" class="LineNr">297 </span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</span> <span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < min<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">),</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">));</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -515,7 +515,7 @@ if ('onhashchange' in window) { <span id="L449" class="LineNr">449 </span> <span class="Delimiter">}</span> <span id="L450" class="LineNr">450 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L451" class="LineNr">451 </span> <span class="Conceal">¦</span> instruction& inst = caller_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L452" class="LineNr">452 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"instruction: "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L452" class="LineNr">452 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"instruction: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L453" class="LineNr">453 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L454" class="LineNr">454 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L455" class="LineNr">455 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>header_type<span class="Delimiter">.</span>find<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">)</span> == header_type<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">())</span> @@ -525,7 +525,7 @@ if ('onhashchange' in window) { <span id="L459" class="LineNr">459 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"type of "</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">" is "</span> << names_to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L460" class="LineNr">460 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L461" class="LineNr">461 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L462" class="LineNr">462 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" product: "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L462" class="LineNr">462 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" product: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L463" class="LineNr">463 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L464" class="LineNr">464 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>header_type<span class="Delimiter">.</span>find<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">)</span> == header_type<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">())</span> <span id="L465" class="LineNr">465 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> diff --git a/html/054static_dispatch.cc.html b/html/054static_dispatch.cc.html index a9e8e183..42003df2 100644 --- a/html/054static_dispatch.cc.html +++ b/html/054static_dispatch.cc.html @@ -105,7 +105,7 @@ if ('onhashchange' in window) { <span id="L39" class="LineNr"> 39 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// variant doesn't already exist</span> <span id="L40" class="LineNr"> 40 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> new_name = <a href='054static_dispatch.cc.html#L111'>next_unused_recipe_name</a><span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> <span id="L41" class="LineNr"> 41 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">,</span> Next_recipe_ordinal++<span class="Delimiter">);</span> -<span id="L42" class="LineNr"> 42 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">));</span> +<span id="L42" class="LineNr"> 42 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">));</span> <span id="L43" class="LineNr"> 43 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L44" class="LineNr"> 44 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"switching "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">" to "</span> << new_name << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L45" class="LineNr"> 45 </span> <span class="Conceal">¦</span> result<span class="Delimiter">.</span>name = new_name<span class="Delimiter">;</span> @@ -115,12 +115,12 @@ if ('onhashchange' in window) { <span id="L49" class="LineNr"> 49 </span><span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L50" class="LineNr"> 50 </span> <span class="Comment">// save first variant</span> <span id="L51" class="LineNr"> 51 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">,</span> Next_recipe_ordinal++<span class="Delimiter">);</span> -<span id="L52" class="LineNr"> 52 </span> <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">));</span> +<span id="L52" class="LineNr"> 52 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">));</span> <span id="L53" class="LineNr"> 53 </span><span class="Delimiter">}</span> <span id="L54" class="LineNr"> 54 </span> <span id="L55" class="LineNr"> 55 </span><span class="Delimiter">:(code)</span> <span id="L56" class="LineNr"> 56 </span>string <a href='054static_dispatch.cc.html#L56'>matching_variant_name</a><span class="Delimiter">(</span><span class="Normal">const</span> recipe& rr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L57" class="LineNr"> 57 </span> <span class="Normal">const</span> vector<recipe_ordinal>& variants = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> rr<span class="Delimiter">.</span>name<span class="Delimiter">);</span> +<span id="L57" class="LineNr"> 57 </span> <span class="Normal">const</span> vector<recipe_ordinal>& variants = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> rr<span class="Delimiter">.</span>name<span class="Delimiter">);</span> <span id="L58" class="LineNr"> 58 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>variants<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L59" class="LineNr"> 59 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span> <span class="Conceal">¦</span> <span class="Normal">const</span> recipe& candidate = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> @@ -232,7 +232,7 @@ if ('onhashchange' in window) { <span id="L166" class="LineNr">166 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L167" class="LineNr">167 </span> <span class="Conceal">¦</span> instruction& inst = caller_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> <span id="L168" class="LineNr">168 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L169" class="LineNr">169 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L366'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">))</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L169" class="LineNr">169 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L366'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">))</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L170" class="LineNr">170 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"instruction "</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L171" class="LineNr">171 </span> <span class="Conceal">¦</span> Resolve_stack<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span>r<span class="Delimiter">));</span> <span id="L172" class="LineNr">172 </span> <span class="Conceal">¦</span> Resolve_stack<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_step_index = index<span class="Delimiter">;</span> @@ -646,10 +646,10 @@ if ('onhashchange' in window) { <span id="L580" class="LineNr">580 </span> ostringstream out<span class="Delimiter">;</span> <span id="L581" class="LineNr">581 </span> out << <span class="Constant">"recipe "</span> << caller<span class="Delimiter">.</span>name<span class="Delimiter">;</span> <span id="L582" class="LineNr">582 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L583" class="LineNr">583 </span> <span class="Conceal">¦</span> out << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L583" class="LineNr">583 </span> <span class="Conceal">¦</span> out << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L584" class="LineNr">584 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!caller<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> out << <span class="Constant">" ->"</span><span class="Delimiter">;</span> <span id="L585" class="LineNr">585 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L586" class="LineNr">586 </span> <span class="Conceal">¦</span> out << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L586" class="LineNr">586 </span> <span class="Conceal">¦</span> out << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L587" class="LineNr">587 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L588" class="LineNr">588 </span><span class="Delimiter">}</span> <span id="L589" class="LineNr">589 </span> diff --git a/html/055shape_shifting_container.cc.html b/html/055shape_shifting_container.cc.html index b7a86272..5fce35b6 100644 --- a/html/055shape_shifting_container.cc.html +++ b/html/055shape_shifting_container.cc.html @@ -100,7 +100,7 @@ if ('onhashchange' in window) { <span id="L34" class="LineNr"> 34 </span><span class="Normal">const</span> type_tree* get_base_type<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* t<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L35" class="LineNr"> 35 </span> <span class="Normal">const</span> type_tree* result = t<span class="Delimiter">-></span>atom ? t : t<span class="Delimiter">-></span>left<span class="Delimiter">;</span> <span id="L36" class="LineNr"> 36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!result<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> -<span id="L37" class="LineNr"> 37 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>t<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L37" class="LineNr"> 37 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>t<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L38" class="LineNr"> 38 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L39" class="LineNr"> 39 </span><span class="Delimiter">}</span> <span id="L40" class="LineNr"> 40 </span> @@ -240,14 +240,14 @@ if ('onhashchange' in window) { <span id="L174" class="LineNr">174 </span> <span class="Comment">// we haven't seen this container before</span> <span id="L175" class="LineNr">175 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)</span> || get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span id="L176" class="LineNr">176 </span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L177" class="LineNr">177 </span> type_info& info = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">));</span> +<span id="L177" class="LineNr">177 </span> type_info& info = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">));</span> <span id="L178" class="LineNr">178 </span> info<span class="Delimiter">.</span>type_ingredient_names<span class="Delimiter">.</span>swap<span class="Delimiter">(</span>type_ingredient_names<span class="Delimiter">);</span> <span id="L179" class="LineNr">179 </span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> <span id="L180" class="LineNr">180 </span><span class="Delimiter">}</span> <span id="L181" class="LineNr">181 </span> <span id="L182" class="LineNr">182 </span><span class="Normal">bool</span> slurp_type_ingredients<span class="Delimiter">(</span>istream& in<span class="Delimiter">,</span> map<string<span class="Delimiter">,</span> type_ordinal>& out<span class="Delimiter">,</span> <span class="Normal">const</span> string& container_name<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L183" class="LineNr">183 </span> <span class="Normal">int</span> next_type_ordinal = START_TYPE_INGREDIENTS<span class="Delimiter">;</span> -<span id="L184" class="LineNr">184 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L184" class="LineNr">184 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L185" class="LineNr">185 </span> <span class="Conceal">¦</span> string curr = slurp_until<span class="Delimiter">(</span>in<span class="Delimiter">,</span> <span class="Constant">':'</span><span class="Delimiter">);</span> <span id="L186" class="LineNr">186 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L187" class="LineNr">187 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << container_name << <span class="Constant">": empty type ingredients not permitted</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> @@ -494,7 +494,7 @@ if ('onhashchange' in window) { <span id="L428" class="LineNr">428 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> <span id="L429" class="LineNr">429 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"x:foo:point"</span><span class="Delimiter">);</span> <span id="L430" class="LineNr">430 </span> reagent element = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L431" class="LineNr">431 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: </span><span class="cSpecial">\"</span><span class="Constant">point</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> +<span id="L431" class="LineNr">431 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: </span><span class="cSpecial">\"</span><span class="Constant">point</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> <span id="L432" class="LineNr">432 </span><span class="Delimiter">}</span> <span id="L433" class="LineNr">433 </span> <span id="L434" class="LineNr">434 </span><span class="Normal">void</span> test_replace_type_ingredients_tail<span class="Delimiter">()</span> <span class="Delimiter">{</span> @@ -506,7 +506,7 @@ if ('onhashchange' in window) { <span id="L440" class="LineNr">440 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> <span id="L441" class="LineNr">441 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"x:bar:point"</span><span class="Delimiter">);</span> <span id="L442" class="LineNr">442 </span> reagent element = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L443" class="LineNr">443 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (</span><span class="cSpecial">\"</span><span class="Constant">foo</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">point</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L443" class="LineNr">443 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (</span><span class="cSpecial">\"</span><span class="Constant">foo</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">point</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> <span id="L444" class="LineNr">444 </span><span class="Delimiter">}</span> <span id="L445" class="LineNr">445 </span> <span id="L446" class="LineNr">446 </span><span class="Normal">void</span> test_replace_type_ingredients_head_tail_multiple<span class="Delimiter">()</span> <span class="Delimiter">{</span> @@ -518,7 +518,7 @@ if ('onhashchange' in window) { <span id="L452" class="LineNr">452 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> <span id="L453" class="LineNr">453 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"x:bar:<a href='043space.cc.html#L82'>address</a>:array:character"</span><span class="Delimiter">);</span> <span id="L454" class="LineNr">454 </span> reagent element = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L455" class="LineNr">455 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (</span><span class="cSpecial">\"</span><span class="Constant">foo</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L455" class="LineNr">455 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (</span><span class="cSpecial">\"</span><span class="Constant">foo</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> <span id="L456" class="LineNr">456 </span><span class="Delimiter">}</span> <span id="L457" class="LineNr">457 </span> <span id="L458" class="LineNr">458 </span><span class="Normal">void</span> test_replace_type_ingredients_head_middle<span class="Delimiter">()</span> <span class="Delimiter">{</span> @@ -530,7 +530,7 @@ if ('onhashchange' in window) { <span id="L464" class="LineNr">464 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> <span id="L465" class="LineNr">465 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"x:bar:address"</span><span class="Delimiter">);</span> <span id="L466" class="LineNr">466 </span> reagent element = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L467" class="LineNr">467 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (</span><span class="cSpecial">\"</span><span class="Constant">foo</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L467" class="LineNr">467 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (</span><span class="cSpecial">\"</span><span class="Constant">foo</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> <span id="L468" class="LineNr">468 </span><span class="Delimiter">}</span> <span id="L469" class="LineNr">469 </span> <span id="L470" class="LineNr">470 </span><span class="Normal">void</span> test_replace_last_type_ingredient_with_multiple<span class="Delimiter">()</span> <span class="Delimiter">{</span> @@ -540,9 +540,9 @@ if ('onhashchange' in window) { <span id="L474" class="LineNr">474 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> <span id="L475" class="LineNr">475 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"{f: (foo number (address array character))}"</span><span class="Delimiter">);</span> <span id="L476" class="LineNr">476 </span> reagent element1 = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L477" class="LineNr">477 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element1<span class="Delimiter">),</span> <span class="Constant">"{x: </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> +<span id="L477" class="LineNr">477 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element1<span class="Delimiter">),</span> <span class="Constant">"{x: </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> <span id="L478" class="LineNr">478 </span> reagent element2 = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L479" class="LineNr">479 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element2<span class="Delimiter">),</span> <span class="Constant">"{y: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L479" class="LineNr">479 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element2<span class="Delimiter">),</span> <span class="Constant">"{y: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> <span id="L480" class="LineNr">480 </span><span class="Delimiter">}</span> <span id="L481" class="LineNr">481 </span> <span id="L482" class="LineNr">482 </span><span class="Normal">void</span> test_replace_last_type_ingredient_inside_compound<span class="Delimiter">()</span> <span class="Delimiter">{</span> @@ -562,11 +562,11 @@ if ('onhashchange' in window) { <span id="L496" class="LineNr">496 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> <span id="L497" class="LineNr">497 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"{f: (foo number (address array character) boolean)}"</span><span class="Delimiter">);</span> <span id="L498" class="LineNr">498 </span> reagent element1 = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L499" class="LineNr">499 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element1<span class="Delimiter">),</span> <span class="Constant">"{x: </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> +<span id="L499" class="LineNr">499 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element1<span class="Delimiter">),</span> <span class="Constant">"{x: </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> <span id="L500" class="LineNr">500 </span> reagent element2 = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L501" class="LineNr">501 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element2<span class="Delimiter">),</span> <span class="Constant">"{y: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L501" class="LineNr">501 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element2<span class="Delimiter">),</span> <span class="Constant">"{y: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> <span id="L502" class="LineNr">502 </span> reagent element3 = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">2</span><span class="Delimiter">);</span> -<span id="L503" class="LineNr">503 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element3<span class="Delimiter">),</span> <span class="Constant">"{z: </span><span class="cSpecial">\"</span><span class="Constant">boolean</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> +<span id="L503" class="LineNr">503 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element3<span class="Delimiter">),</span> <span class="Constant">"{z: </span><span class="cSpecial">\"</span><span class="Constant">boolean</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> <span id="L504" class="LineNr">504 </span><span class="Delimiter">}</span> <span id="L505" class="LineNr">505 </span> <span id="L506" class="LineNr">506 </span><span class="Normal">void</span> test_replace_middle_type_ingredient_with_multiple2<span class="Delimiter">()</span> <span class="Delimiter">{</span> @@ -576,7 +576,7 @@ if ('onhashchange' in window) { <span id="L510" class="LineNr">510 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> <span id="L511" class="LineNr">511 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"{f: (foo (address array character) number)}"</span><span class="Delimiter">);</span> <span id="L512" class="LineNr">512 </span> reagent element = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L513" class="LineNr">513 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{key: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L513" class="LineNr">513 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{key: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> <span id="L514" class="LineNr">514 </span><span class="Delimiter">}</span> <span id="L515" class="LineNr">515 </span> <span id="L516" class="LineNr">516 </span><span class="Normal">void</span> test_replace_middle_type_ingredient_with_multiple3<span class="Delimiter">()</span> <span class="Delimiter">{</span> @@ -590,7 +590,7 @@ if ('onhashchange' in window) { <span id="L524" class="LineNr">524 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> <span id="L525" class="LineNr">525 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"{f: (foo_table (address array character) number)}"</span><span class="Delimiter">);</span> <span id="L526" class="LineNr">526 </span> reagent element = <a href='030container.cc.html#L429'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L527" class="LineNr">527 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{data: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">foo_table_row</span><span class="cSpecial">\"</span><span class="Constant"> (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">) </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L527" class="LineNr">527 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{data: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">foo_table_row</span><span class="cSpecial">\"</span><span class="Constant"> (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L82'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">) </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> <span id="L528" class="LineNr">528 </span><span class="Delimiter">}</span> <span id="L529" class="LineNr">529 </span> <span id="L530" class="LineNr">530 </span><span class="Delimiter">:(code)</span> diff --git a/html/056shape_shifting_recipe.cc.html b/html/056shape_shifting_recipe.cc.html index b1de6ae2..c087b354 100644 --- a/html/056shape_shifting_recipe.cc.html +++ b/html/056shape_shifting_recipe.cc.html @@ -285,7 +285,7 @@ if ('onhashchange' in window) { <span id="L218" class="LineNr"> 218 </span> <span class="Identifier">return</span> contains_type_ingredient_name<span class="Delimiter">(</span>type<span class="Delimiter">-></span>left<span class="Delimiter">)</span> || contains_type_ingredient_name<span class="Delimiter">(</span>type<span class="Delimiter">-></span>right<span class="Delimiter">);</span> <span id="L219" class="LineNr"> 219 </span><span class="Delimiter">}</span> <span id="L220" class="LineNr"> 220 </span> -<span id="L221" class="LineNr"> 221 </span><span class="Normal">int</span> number_of_concrete_type_names<span class="Delimiter">(</span><a href='001help.cc.html#L258'>unused</a> <span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L221" class="LineNr"> 221 </span><span class="Normal">int</span> number_of_concrete_type_names<span class="Delimiter">(</span><a href='001help.cc.html#L259'>unused</a> <span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L222" class="LineNr"> 222 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L223" class="LineNr"> 223 </span> <span class="Normal">int</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L224" class="LineNr"> 224 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> @@ -303,7 +303,7 @@ if ('onhashchange' in window) { <span id="L236" class="LineNr"> 236 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span>+ number_of_concrete_type_names<span class="Delimiter">(</span>type<span class="Delimiter">-></span>right<span class="Delimiter">);</span> <span id="L237" class="LineNr"> 237 </span><span class="Delimiter">}</span> <span id="L238" class="LineNr"> 238 </span> -<span id="L239" class="LineNr"> 239 </span><span class="Normal">int</span> number_of_type_ingredients<span class="Delimiter">(</span><a href='001help.cc.html#L258'>unused</a> <span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L239" class="LineNr"> 239 </span><span class="Normal">int</span> number_of_type_ingredients<span class="Delimiter">(</span><a href='001help.cc.html#L259'>unused</a> <span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L240" class="LineNr"> 240 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L241" class="LineNr"> 241 </span> <span class="Normal">int</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L242" class="LineNr"> 242 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> @@ -368,7 +368,7 @@ if ('onhashchange' in window) { <span id="L301" class="LineNr"> 301 </span> <span class="Conceal">¦</span> <a href='056shape_shifting_recipe.cc.html#L312'>save_or_deduce_type_name</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> type_names<span class="Delimiter">,</span> variant<span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> <span id="L302" class="LineNr"> 302 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L303" class="LineNr"> 303 </span> <span class="Conceal">¦</span> instruction& inst = variant<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L304" class="LineNr"> 304 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" <a href='010vm.cc.html#L32'>instruction</a>: "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L304" class="LineNr"> 304 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" <a href='010vm.cc.html#L32'>instruction</a>: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L305" class="LineNr"> 305 </span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> in = <span class="Constant">0</span><span class="Delimiter">;</span> in < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++in<span class="Delimiter">)</span> <span id="L306" class="LineNr"> 306 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='056shape_shifting_recipe.cc.html#L312'>save_or_deduce_type_name</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>in<span class="Delimiter">),</span> type_names<span class="Delimiter">,</span> variant<span class="Delimiter">,</span> <span class="Constant">" in '"</span> + to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> + <span class="Constant">"'"</span><span class="Delimiter">);</span> <span id="L307" class="LineNr"> 307 </span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> out = <span class="Constant">0</span><span class="Delimiter">;</span> out < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++out<span class="Delimiter">)</span> @@ -377,7 +377,7 @@ if ('onhashchange' in window) { <span id="L310" class="LineNr"> 310 </span><span class="Delimiter">}</span> <span id="L311" class="LineNr"> 311 </span> <span id="L312" class="LineNr"> 312 </span><span class="Normal">void</span> <a href='056shape_shifting_recipe.cc.html#L312'>save_or_deduce_type_name</a><span class="Delimiter">(</span>reagent& x<span class="Delimiter">,</span> map<string<span class="Delimiter">,</span> type_tree*>& type<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& variant<span class="Delimiter">,</span> <span class="Normal">const</span> string& context<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L313" class="LineNr"> 313 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9994</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" checking "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">": "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L313" class="LineNr"> 313 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9994</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" checking "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">": "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L314" class="LineNr"> 314 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type && contains_key<span class="Delimiter">(</span>type<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L315" class="LineNr"> 315 </span> <span class="Conceal">¦</span> x<span class="Delimiter">.</span>type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*get<span class="Delimiter">(</span>type<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">));</span> <span id="L316" class="LineNr"> 316 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9994</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" deducing type to "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> @@ -440,7 +440,7 @@ if ('onhashchange' in window) { <span id="L373" class="LineNr"> 373 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> curr_refinement_type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*refinement_type<span class="Delimiter">-></span>left<span class="Delimiter">);</span> <span id="L374" class="LineNr"> 374 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L375" class="LineNr"> 375 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>mappings<span class="Delimiter">,</span> exemplar_type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L376" class="LineNr"> 376 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"adding mapping from "</span> << exemplar_type<span class="Delimiter">-></span>name << <span class="Constant">" to "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>curr_refinement_type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L376" class="LineNr"> 376 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"adding mapping from "</span> << exemplar_type<span class="Delimiter">-></span>name << <span class="Constant">" to "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>curr_refinement_type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L377" class="LineNr"> 377 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>mappings<span class="Delimiter">,</span> exemplar_type<span class="Delimiter">-></span>name<span class="Delimiter">,</span> <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*curr_refinement_type<span class="Delimiter">));</span> <span id="L378" class="LineNr"> 378 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L379" class="LineNr"> 379 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">else</span> <span class="Delimiter">{</span> @@ -492,7 +492,7 @@ if ('onhashchange' in window) { <span id="L425" class="LineNr"> 425 </span><span class="Delimiter">}</span> <span id="L426" class="LineNr"> 426 </span> <span id="L427" class="LineNr"> 427 </span><span class="Normal">void</span> replace_type_ingredients<span class="Delimiter">(</span>reagent& x<span class="Delimiter">,</span> <span class="Normal">const</span> map<string<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree*>& mappings<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L428" class="LineNr"> 428 </span> string before = <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">);</span> +<span id="L428" class="LineNr"> 428 </span> string before = <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L429" class="LineNr"> 429 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"replacing in ingredient "</span> << x<span class="Delimiter">.</span>original_string << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L430" class="LineNr"> 430 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L431" class="LineNr"> 431 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"specializing "</span> << caller<span class="Delimiter">.</span>original_name << <span class="Constant">": missing type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> diff --git a/html/059to_text.mu.html b/html/059to_text.mu.html index 9f51fded..e4d0da79 100644 --- a/html/059to_text.mu.html +++ b/html/059to_text.mu.html @@ -67,14 +67,14 @@ if ('onhashchange' in window) { <span id="L8" class="LineNr"> 8 </span><span class="Comment"># define it to be identical to 'to-text' by default</span> <span id="L9" class="LineNr"> 9 </span><span class="muRecipe">def</span> to-text-line x:_elem<span class="muRecipe"> -> </span>y:text [ <span id="L10" class="LineNr">10 </span> <span class="Constant">local-scope</span> -<span id="L11" class="LineNr">11 </span> <span class="Constant">load-ingredients</span> +<span id="L11" class="LineNr">11 </span> <span class="Constant">load-inputs</span> <span id="L12" class="LineNr">12 </span> y <span class="Special"><-</span> to-text x <span id="L13" class="LineNr">13 </span>] <span id="L14" class="LineNr">14 </span> <span id="L15" class="LineNr">15 </span><span class="Comment"># variant for arrays (since we can't pass them around otherwise)</span> <span id="L16" class="LineNr">16 </span><span class="muRecipe">def</span> <a href='059to_text.mu.html#L16'>array-to-text-line</a> x:&:@:_elem<span class="muRecipe"> -> </span>y:text [ <span id="L17" class="LineNr">17 </span> <span class="Constant">local-scope</span> -<span id="L18" class="LineNr">18 </span> <span class="Constant">load-ingredients</span> +<span id="L18" class="LineNr">18 </span> <span class="Constant">load-inputs</span> <span id="L19" class="LineNr">19 </span> y <span class="Special"><-</span> to-text *x <span id="L20" class="LineNr">20 </span>] <span id="L21" class="LineNr">21 </span> @@ -92,7 +92,7 @@ if ('onhashchange' in window) { <span id="L33" class="LineNr">33 </span><span class="Comment"># finally, a specialization for single characters</span> <span id="L34" class="LineNr">34 </span><span class="muRecipe">def</span> to-text c:char<span class="muRecipe"> -> </span>y:text [ <span id="L35" class="LineNr">35 </span> <span class="Constant">local-scope</span> -<span id="L36" class="LineNr">36 </span> <span class="Constant">load-ingredients</span> +<span id="L36" class="LineNr">36 </span> <span class="Constant">load-inputs</span> <span id="L37" class="LineNr">37 </span> y <span class="Special"><-</span> new <span class="Constant">character:type</span>, <span class="Constant">1/capacity</span> <span id="L38" class="LineNr">38 </span> *y <span class="Special"><-</span> put-index *y,<span class="Constant"> 0</span>, c <span id="L39" class="LineNr">39 </span>] diff --git a/html/061text.mu.html b/html/061text.mu.html index f8cb25e4..cb9ca6d3 100644 --- a/html/061text.mu.html +++ b/html/061text.mu.html @@ -64,7 +64,7 @@ if ('onhashchange' in window) { <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span><span class="muRecipe">def</span> equal a:text, b:text<span class="muRecipe"> -> </span>result:bool [ <span id="L4" class="LineNr"> 4 </span> <span class="Constant">local-scope</span> -<span id="L5" class="LineNr"> 5 </span> <span class="Constant">load-ingredients</span> +<span id="L5" class="LineNr"> 5 </span> <span class="Constant">load-inputs</span> <span id="L6" class="LineNr"> 6 </span> an:num, bn:num <span class="Special"><-</span> copy a, b <span id="L7" class="LineNr"> 7 </span> address-equal?:boolean <span class="Special"><-</span> equal an, bn <span id="L8" class="LineNr"> 8 </span> <span class="muControl">return-if</span> address-equal?, <span class="Constant">1/true</span> @@ -186,7 +186,7 @@ if ('onhashchange' in window) { <span id="L124" class="LineNr"> 124 </span> <span id="L125" class="LineNr"> 125 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L125'>new-buffer</a> <a href='075channel.mu.html#L399'>capacity</a>:num<span class="muRecipe"> -> </span>result:&:<a href='061text.mu.html#L120'>buffer</a>:_elem [ <span id="L126" class="LineNr"> 126 </span> <span class="Constant">local-scope</span> -<span id="L127" class="LineNr"> 127 </span> <span class="Constant">load-ingredients</span> +<span id="L127" class="LineNr"> 127 </span> <span class="Constant">load-inputs</span> <span id="L128" class="LineNr"> 128 </span> result <span class="Special"><-</span> new <span class="Delimiter">{</span>(buffer _elem): type<span class="Delimiter">}</span> <span id="L129" class="LineNr"> 129 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">length:offset</span>,<span class="Constant"> 0</span> <span id="L130" class="LineNr"> 130 </span> <span class="Delimiter">{</span> @@ -201,7 +201,7 @@ if ('onhashchange' in window) { <span id="L139" class="LineNr"> 139 </span> <span id="L140" class="LineNr"> 140 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L140'>grow-buffer</a> buf:&:<a href='061text.mu.html#L120'>buffer</a>:_elem<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L120'>buffer</a>:_elem [ <span id="L141" class="LineNr"> 141 </span> <span class="Constant">local-scope</span> -<span id="L142" class="LineNr"> 142 </span> <span class="Constant">load-ingredients</span> +<span id="L142" class="LineNr"> 142 </span> <span class="Constant">load-inputs</span> <span id="L143" class="LineNr"> 143 </span> <span class="Comment"># double buffer size</span> <span id="L144" class="LineNr"> 144 </span> olddata:&:@:_elem <span class="Special"><-</span> get *buf, <span class="Constant">data:offset</span> <span id="L145" class="LineNr"> 145 </span> oldlen:num <span class="Special"><-</span> length *olddata @@ -222,7 +222,7 @@ if ('onhashchange' in window) { <span id="L160" class="LineNr"> 160 </span> <span id="L161" class="LineNr"> 161 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L161'>buffer-full?</a> in:&:<a href='061text.mu.html#L120'>buffer</a>:_elem<span class="muRecipe"> -> </span>result:bool [ <span id="L162" class="LineNr"> 162 </span> <span class="Constant">local-scope</span> -<span id="L163" class="LineNr"> 163 </span> <span class="Constant">load-ingredients</span> +<span id="L163" class="LineNr"> 163 </span> <span class="Constant">load-inputs</span> <span id="L164" class="LineNr"> 164 </span> len:num <span class="Special"><-</span> get *in, <span class="Constant">length:offset</span> <span id="L165" class="LineNr"> 165 </span> s:&:@:_elem <span class="Special"><-</span> get *in, <span class="Constant">data:offset</span> <span id="L166" class="LineNr"> 166 </span> <a href='075channel.mu.html#L399'>capacity</a>:num <span class="Special"><-</span> length *s @@ -232,7 +232,7 @@ if ('onhashchange' in window) { <span id="L170" class="LineNr"> 170 </span><span class="Comment"># most broadly applicable definition of append to a buffer</span> <span id="L171" class="LineNr"> 171 </span><span class="muRecipe">def</span> append buf:&:<a href='061text.mu.html#L120'>buffer</a>:_elem, x:_elem<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L120'>buffer</a>:_elem [ <span id="L172" class="LineNr"> 172 </span> <span class="Constant">local-scope</span> -<span id="L173" class="LineNr"> 173 </span> <span class="Constant">load-ingredients</span> +<span id="L173" class="LineNr"> 173 </span> <span class="Constant">load-inputs</span> <span id="L174" class="LineNr"> 174 </span> len:num <span class="Special"><-</span> get *buf, <span class="Constant">length:offset</span> <span id="L175" class="LineNr"> 175 </span> <span class="Delimiter">{</span> <span id="L176" class="LineNr"> 176 </span> <span class="Conceal">¦</span> <span class="Comment"># grow buffer if necessary</span> @@ -250,7 +250,7 @@ if ('onhashchange' in window) { <span id="L188" class="LineNr"> 188 </span><span class="Comment"># call to-text</span> <span id="L189" class="LineNr"> 189 </span><span class="muRecipe">def</span> append buf:&:<a href='061text.mu.html#L120'>buffer</a>:char, x:_elem<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L120'>buffer</a>:char [ <span id="L190" class="LineNr"> 190 </span> <span class="Constant">local-scope</span> -<span id="L191" class="LineNr"> 191 </span> <span class="Constant">load-ingredients</span> +<span id="L191" class="LineNr"> 191 </span> <span class="Constant">load-inputs</span> <span id="L192" class="LineNr"> 192 </span> text:text <span class="Special"><-</span> to-text x <span id="L193" class="LineNr"> 193 </span> buf <span class="Special"><-</span> append buf, text <span id="L194" class="LineNr"> 194 </span>] @@ -258,7 +258,7 @@ if ('onhashchange' in window) { <span id="L196" class="LineNr"> 196 </span><span class="Comment"># specialization for characters that is backspace-aware</span> <span id="L197" class="LineNr"> 197 </span><span class="muRecipe">def</span> append buf:&:<a href='061text.mu.html#L120'>buffer</a>:char, c:char<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L120'>buffer</a>:char [ <span id="L198" class="LineNr"> 198 </span> <span class="Constant">local-scope</span> -<span id="L199" class="LineNr"> 199 </span> <span class="Constant">load-ingredients</span> +<span id="L199" class="LineNr"> 199 </span> <span class="Constant">load-inputs</span> <span id="L200" class="LineNr"> 200 </span> len:num <span class="Special"><-</span> get *buf, <span class="Constant">length:offset</span> <span id="L201" class="LineNr"> 201 </span> <span class="Delimiter">{</span> <span id="L202" class="LineNr"> 202 </span> <span class="Conceal">¦</span> <span class="Comment"># backspace? just drop last character if it exists and return</span> @@ -284,7 +284,7 @@ if ('onhashchange' in window) { <span id="L222" class="LineNr"> 222 </span> <span id="L223" class="LineNr"> 223 </span><span class="muRecipe">def</span> append buf:&:<a href='061text.mu.html#L120'>buffer</a>:_elem, t:&:@:_elem<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L120'>buffer</a>:_elem [ <span id="L224" class="LineNr"> 224 </span> <span class="Constant">local-scope</span> -<span id="L225" class="LineNr"> 225 </span> <span class="Constant">load-ingredients</span> +<span id="L225" class="LineNr"> 225 </span> <span class="Constant">load-inputs</span> <span id="L226" class="LineNr"> 226 </span> len:num <span class="Special"><-</span> length *t <span id="L227" class="LineNr"> 227 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L228" class="LineNr"> 228 </span> <span class="Delimiter">{</span> @@ -399,7 +399,7 @@ if ('onhashchange' in window) { <span id="L337" class="LineNr"> 337 </span> <span id="L338" class="LineNr"> 338 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L338'>buffer-to-array</a> in:&:<a href='061text.mu.html#L120'>buffer</a>:_elem<span class="muRecipe"> -> </span>result:&:@:_elem [ <span id="L339" class="LineNr"> 339 </span> <span class="Constant">local-scope</span> -<span id="L340" class="LineNr"> 340 </span> <span class="Constant">load-ingredients</span> +<span id="L340" class="LineNr"> 340 </span> <span class="Constant">load-inputs</span> <span id="L341" class="LineNr"> 341 </span> <span class="Comment"># propagate null buffer</span> <span id="L342" class="LineNr"> 342 </span> <span class="muControl">return-unless</span> in,<span class="Constant"> 0</span> <span id="L343" class="LineNr"> 343 </span> len:num <span class="Special"><-</span> get *in, <span class="Constant">length:offset</span> @@ -419,7 +419,7 @@ if ('onhashchange' in window) { <span id="L357" class="LineNr"> 357 </span> <span id="L358" class="LineNr"> 358 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L358'>blank?</a> x:&:@:_elem<span class="muRecipe"> -> </span>result:bool [ <span id="L359" class="LineNr"> 359 </span> <span class="Constant">local-scope</span> -<span id="L360" class="LineNr"> 360 </span> <span class="Constant">load-ingredients</span> +<span id="L360" class="LineNr"> 360 </span> <span class="Constant">load-inputs</span> <span id="L361" class="LineNr"> 361 </span> <span class="muControl">return-unless</span> x, <span class="Constant">1/true</span> <span id="L362" class="LineNr"> 362 </span> len:num <span class="Special"><-</span> length *x <span id="L363" class="LineNr"> 363 </span> result <span class="Special"><-</span> equal len,<span class="Constant"> 0</span> @@ -435,16 +435,16 @@ if ('onhashchange' in window) { <span id="L373" class="LineNr"> 373 </span><span class="Comment"># will never ever get used.</span> <span id="L374" class="LineNr"> 374 </span><span class="muRecipe">def</span> append first:text<span class="muRecipe"> -> </span>result:text [ <span id="L375" class="LineNr"> 375 </span> <span class="Constant">local-scope</span> -<span id="L376" class="LineNr"> 376 </span> <span class="Constant">load-ingredients</span> +<span id="L376" class="LineNr"> 376 </span> <span class="Constant">load-inputs</span> <span id="L377" class="LineNr"> 377 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 30</span> -<span id="L378" class="LineNr"> 378 </span> <span class="Comment"># append first ingredient</span> +<span id="L378" class="LineNr"> 378 </span> <span class="Comment"># append first input</span> <span id="L379" class="LineNr"> 379 </span> <span class="Delimiter">{</span> <span id="L380" class="LineNr"> 380 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> first <span id="L381" class="LineNr"> 381 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> append buf, first <span id="L382" class="LineNr"> 382 </span> <span class="Delimiter">}</span> -<span id="L383" class="LineNr"> 383 </span> <span class="Comment"># append remaining ingredients</span> +<span id="L383" class="LineNr"> 383 </span> <span class="Comment"># append remaining inputs</span> <span id="L384" class="LineNr"> 384 </span> <span class="Delimiter">{</span> -<span id="L385" class="LineNr"> 385 </span> <span class="Conceal">¦</span> arg:text, arg-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L385" class="LineNr"> 385 </span> <span class="Conceal">¦</span> arg:text, arg-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L386" class="LineNr"> 386 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> arg-found? <span id="L387" class="LineNr"> 387 </span> <span class="Conceal">¦</span> <span class="muControl">loop-unless</span> arg <span id="L388" class="LineNr"> 388 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> append buf, arg @@ -520,7 +520,7 @@ if ('onhashchange' in window) { <span id="L458" class="LineNr"> 458 </span> <span id="L459" class="LineNr"> 459 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L459'>replace</a> s:text, oldc:char, newc:char, from:num/optional<span class="muRecipe"> -> </span>s:text [ <span id="L460" class="LineNr"> 460 </span> <span class="Constant">local-scope</span> -<span id="L461" class="LineNr"> 461 </span> <span class="Constant">load-ingredients</span> +<span id="L461" class="LineNr"> 461 </span> <span class="Constant">load-inputs</span> <span id="L462" class="LineNr"> 462 </span> len:num <span class="Special"><-</span> length *s <span id="L463" class="LineNr"> 463 </span> i:num <span class="Special"><-</span> find-next s, oldc, from <span id="L464" class="LineNr"> 464 </span> done?:bool <span class="Special"><-</span> greater-or-equal i, len @@ -581,13 +581,13 @@ if ('onhashchange' in window) { <span id="L519" class="LineNr"> 519 </span><span class="Comment"># replace underscores in first with remaining args</span> <span id="L520" class="LineNr"> 520 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L520'>interpolate</a> template:text<span class="muRecipe"> -> </span>result:text [ <span id="L521" class="LineNr"> 521 </span> <span class="Constant">local-scope</span> -<span id="L522" class="LineNr"> 522 </span> <span class="Constant">load-ingredients</span> <span class="Comment"># consume just the template</span> +<span id="L522" class="LineNr"> 522 </span> <span class="Constant">load-inputs</span> <span class="Comment"># consume just the template</span> <span id="L523" class="LineNr"> 523 </span> <span class="Comment"># compute result-len, space to allocate for result</span> <span id="L524" class="LineNr"> 524 </span> tem-len:num <span class="Special"><-</span> length *template <span id="L525" class="LineNr"> 525 </span> result-len:num <span class="Special"><-</span> copy tem-len <span id="L526" class="LineNr"> 526 </span> <span class="Delimiter">{</span> -<span id="L527" class="LineNr"> 527 </span> <span class="Conceal">¦</span> <span class="Comment"># while ingredients remain</span> -<span id="L528" class="LineNr"> 528 </span> <span class="Conceal">¦</span> a:text, arg-received?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L527" class="LineNr"> 527 </span> <span class="Conceal">¦</span> <span class="Comment"># while inputs remain</span> +<span id="L528" class="LineNr"> 528 </span> <span class="Conceal">¦</span> a:text, arg-received?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L529" class="LineNr"> 529 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> arg-received? <span id="L530" class="LineNr"> 530 </span> <span class="Conceal">¦</span> <span class="Comment"># result-len = result-len + arg.length - 1 (for the 'underscore' being replaced)</span> <span id="L531" class="LineNr"> 531 </span> <span class="Conceal">¦</span> a-len:num <span class="Special"><-</span> length *a @@ -595,15 +595,15 @@ if ('onhashchange' in window) { <span id="L533" class="LineNr"> 533 </span> <span class="Conceal">¦</span> result-len <span class="Special"><-</span> subtract result-len,<span class="Constant"> 1</span> <span id="L534" class="LineNr"> 534 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span id="L535" class="LineNr"> 535 </span> <span class="Delimiter">}</span> -<span id="L536" class="LineNr"> 536 </span> <span class="Constant">rewind-ingredients</span> -<span id="L537" class="LineNr"> 537 </span> _ <span class="Special"><-</span> <span class="Constant">next-ingredient</span> <span class="Comment"># skip template</span> +<span id="L536" class="LineNr"> 536 </span> <span class="Constant">rewind-inputs</span> +<span id="L537" class="LineNr"> 537 </span> _ <span class="Special"><-</span> <span class="Constant">next-input</span> <span class="Comment"># skip template</span> <span id="L538" class="LineNr"> 538 </span> result <span class="Special"><-</span> new <span class="Constant">character:type</span>, result-len <span id="L539" class="LineNr"> 539 </span> <span class="Comment"># repeatedly copy sections of template and 'holes' into result</span> <span id="L540" class="LineNr"> 540 </span> result-idx:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L541" class="LineNr"> 541 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L542" class="LineNr"> 542 </span> <span class="Delimiter">{</span> <span id="L543" class="LineNr"> 543 </span> <span class="Conceal">¦</span> <span class="Comment"># while arg received</span> -<span id="L544" class="LineNr"> 544 </span> <span class="Conceal">¦</span> a:text, arg-received?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L544" class="LineNr"> 544 </span> <span class="Conceal">¦</span> a:text, arg-received?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L545" class="LineNr"> 545 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> arg-received? <span id="L546" class="LineNr"> 546 </span> <span class="Conceal">¦</span> <span class="Comment"># copy template into result until '_'</span> <span id="L547" class="LineNr"> 547 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> @@ -695,7 +695,7 @@ if ('onhashchange' in window) { <span id="L633" class="LineNr"> 633 </span><span class="Comment"># result:bool <- space? c:char</span> <span id="L634" class="LineNr"> 634 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L634'>space?</a> c:char<span class="muRecipe"> -> </span>result:bool [ <span id="L635" class="LineNr"> 635 </span> <span class="Constant">local-scope</span> -<span id="L636" class="LineNr"> 636 </span> <span class="Constant">load-ingredients</span> +<span id="L636" class="LineNr"> 636 </span> <span class="Constant">load-inputs</span> <span id="L637" class="LineNr"> 637 </span> <span class="Comment"># most common case first</span> <span id="L638" class="LineNr"> 638 </span> result <span class="Special"><-</span> equal c, <span class="Constant">32/space</span> <span id="L639" class="LineNr"> 639 </span> <span class="muControl">return-if</span> result @@ -756,7 +756,7 @@ if ('onhashchange' in window) { <span id="L694" class="LineNr"> 694 </span> <span id="L695" class="LineNr"> 695 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L695'>trim</a> s:text<span class="muRecipe"> -> </span>result:text [ <span id="L696" class="LineNr"> 696 </span> <span class="Constant">local-scope</span> -<span id="L697" class="LineNr"> 697 </span> <span class="Constant">load-ingredients</span> +<span id="L697" class="LineNr"> 697 </span> <span class="Constant">load-inputs</span> <span id="L698" class="LineNr"> 698 </span> len:num <span class="Special"><-</span> length *s <span id="L699" class="LineNr"> 699 </span> <span class="Comment"># left trim: compute start</span> <span id="L700" class="LineNr"> 700 </span> start:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> @@ -866,7 +866,7 @@ if ('onhashchange' in window) { <span id="L804" class="LineNr"> 804 </span> <span id="L805" class="LineNr"> 805 </span><span class="muRecipe">def</span> find-next text:text, pattern:char, idx:num<span class="muRecipe"> -> </span>next-index:num [ <span id="L806" class="LineNr"> 806 </span> <span class="Constant">local-scope</span> -<span id="L807" class="LineNr"> 807 </span> <span class="Constant">load-ingredients</span> +<span id="L807" class="LineNr"> 807 </span> <span class="Constant">load-inputs</span> <span id="L808" class="LineNr"> 808 </span> len:num <span class="Special"><-</span> length *text <span id="L809" class="LineNr"> 809 </span> <span class="Delimiter">{</span> <span id="L810" class="LineNr"> 810 </span> <span class="Conceal">¦</span> eof?:bool <span class="Special"><-</span> greater-or-equal idx, len @@ -972,7 +972,7 @@ if ('onhashchange' in window) { <span id="L910" class="LineNr"> 910 </span><span class="Comment"># fairly dumb algorithm</span> <span id="L911" class="LineNr"> 911 </span><span class="muRecipe">def</span> find-next text:text, pattern:text, idx:num<span class="muRecipe"> -> </span>next-index:num [ <span id="L912" class="LineNr"> 912 </span> <span class="Constant">local-scope</span> -<span id="L913" class="LineNr"> 913 </span> <span class="Constant">load-ingredients</span> +<span id="L913" class="LineNr"> 913 </span> <span class="Constant">load-inputs</span> <span id="L914" class="LineNr"> 914 </span> first:char <span class="Special"><-</span> index *pattern,<span class="Constant"> 0</span> <span id="L915" class="LineNr"> 915 </span> <span class="Comment"># repeatedly check for match at current idx</span> <span id="L916" class="LineNr"> 916 </span> len:num <span class="Special"><-</span> length *text @@ -1053,7 +1053,7 @@ if ('onhashchange' in window) { <span id="L991" class="LineNr"> 991 </span><span class="Comment"># checks if pattern matches at index 'idx'</span> <span id="L992" class="LineNr"> 992 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L992'>match-at</a> text:text, pattern:text, idx:num<span class="muRecipe"> -> </span>result:bool [ <span id="L993" class="LineNr"> 993 </span> <span class="Constant">local-scope</span> -<span id="L994" class="LineNr"> 994 </span> <span class="Constant">load-ingredients</span> +<span id="L994" class="LineNr"> 994 </span> <span class="Constant">load-inputs</span> <span id="L995" class="LineNr"> 995 </span> pattern-len:num <span class="Special"><-</span> length *pattern <span id="L996" class="LineNr"> 996 </span> <span class="Comment"># check that there's space left for the pattern</span> <span id="L997" class="LineNr"> 997 </span> x:num <span class="Special"><-</span> length *text @@ -1184,7 +1184,7 @@ if ('onhashchange' in window) { <span id="L1122" class="LineNr">1122 </span> <span id="L1123" class="LineNr">1123 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L1123'>split</a> s:text, delim:char<span class="muRecipe"> -> </span>result:&:@:text [ <span id="L1124" class="LineNr">1124 </span> <span class="Constant">local-scope</span> -<span id="L1125" class="LineNr">1125 </span> <span class="Constant">load-ingredients</span> +<span id="L1125" class="LineNr">1125 </span> <span class="Constant">load-inputs</span> <span id="L1126" class="LineNr">1126 </span> <span class="Comment"># empty text? return empty array</span> <span id="L1127" class="LineNr">1127 </span> len:num <span class="Special"><-</span> length *s <span id="L1128" class="LineNr">1128 </span> <span class="Delimiter">{</span> @@ -1316,7 +1316,7 @@ if ('onhashchange' in window) { <span id="L1254" class="LineNr">1254 </span> <span id="L1255" class="LineNr">1255 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L1255'>split-first</a> text:text, delim:char<span class="muRecipe"> -> </span>x:text, y:text [ <span id="L1256" class="LineNr">1256 </span> <span class="Constant">local-scope</span> -<span id="L1257" class="LineNr">1257 </span> <span class="Constant">load-ingredients</span> +<span id="L1257" class="LineNr">1257 </span> <span class="Constant">load-inputs</span> <span id="L1258" class="LineNr">1258 </span> <span class="Comment"># empty text? return empty texts</span> <span id="L1259" class="LineNr">1259 </span> len:num <span class="Special"><-</span> length *text <span id="L1260" class="LineNr">1260 </span> <span class="Delimiter">{</span> @@ -1348,7 +1348,7 @@ if ('onhashchange' in window) { <span id="L1286" class="LineNr">1286 </span> <span id="L1287" class="LineNr">1287 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L1287'>copy-range</a> buf:text, start:num, end:num<span class="muRecipe"> -> </span>result:text [ <span id="L1288" class="LineNr">1288 </span> <span class="Constant">local-scope</span> -<span id="L1289" class="LineNr">1289 </span> <span class="Constant">load-ingredients</span> +<span id="L1289" class="LineNr">1289 </span> <span class="Constant">load-inputs</span> <span id="L1290" class="LineNr">1290 </span> <span class="Comment"># if end is out of bounds, trim it</span> <span id="L1291" class="LineNr">1291 </span> len:num <span class="Special"><-</span> length *buf <span id="L1292" class="LineNr">1292 </span> end:num <span class="Special"><-</span> min len, end @@ -1407,7 +1407,7 @@ if ('onhashchange' in window) { <span id="L1345" class="LineNr">1345 </span> <span id="L1346" class="LineNr">1346 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L1346'>parse-whole-number</a> in:text<span class="muRecipe"> -> </span>out:num, error?:bool [ <span id="L1347" class="LineNr">1347 </span> <span class="Constant">local-scope</span> -<span id="L1348" class="LineNr">1348 </span> <span class="Constant">load-ingredients</span> +<span id="L1348" class="LineNr">1348 </span> <span class="Constant">load-inputs</span> <span id="L1349" class="LineNr">1349 </span> out <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L1350" class="LineNr">1350 </span> result:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span class="Comment"># temporary location</span> <span id="L1351" class="LineNr">1351 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> @@ -1431,7 +1431,7 @@ if ('onhashchange' in window) { <span id="L1369" class="LineNr">1369 </span><span class="Comment"># (contributed by Ella Couch)</span> <span id="L1370" class="LineNr">1370 </span><span class="muRecipe">recipe</span> <a href='061text.mu.html#L1370'>character-code-to-digit</a> character-code:number<span class="muRecipe"> -> </span>result:number, error?:boolean [ <span id="L1371" class="LineNr">1371 </span> <span class="Constant">local-scope</span> -<span id="L1372" class="LineNr">1372 </span> <span class="Constant">load-ingredients</span> +<span id="L1372" class="LineNr">1372 </span> <span class="Constant">load-inputs</span> <span id="L1373" class="LineNr">1373 </span> result <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L1374" class="LineNr">1374 </span> error? <span class="Special"><-</span> lesser-than character-code,<span class="Constant"> 48</span> <span class="Comment"># '0'</span> <span id="L1375" class="LineNr">1375 </span> <span class="muControl">return-if</span> error? diff --git a/html/062convert_ingredients_to_text.cc.html b/html/062convert_ingredients_to_text.cc.html index eda38d88..be118d13 100644 --- a/html/062convert_ingredients_to_text.cc.html +++ b/html/062convert_ingredients_to_text.cc.html @@ -155,7 +155,7 @@ if ('onhashchange' in window) { <span id="L92" class="LineNr"> 92 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// new variants that match:</span> <span id="L93" class="LineNr"> 93 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// append _:text, ___</span> <span id="L94" class="LineNr"> 94 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// will never ever get used.</span> -<span id="L95" class="LineNr"> 95 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='014literal_string.cc.html#L126'>is_literal_text</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> || <a href='027call_ingredient.cc.html#L174'>is_mu_text</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L95" class="LineNr"> 95 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='014literal_string.cc.html#L126'>is_literal_text</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> || <a href='027call_ingredient.cc.html#L177'>is_mu_text</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span id="L96" class="LineNr"> 96 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> j = <span class="Comment">/*</span><span class="Comment">skip base</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> j < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L97" class="LineNr"> 97 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> ostringstream ingredient_name<span class="Delimiter">;</span> <span id="L98" class="LineNr"> 98 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> ingredient_name << <span class="Constant">"append_"</span> << i << <span class="Constant">'_'</span> << j << <span class="Constant">":<a href='043space.cc.html#L82'>address</a>:array:character"</span><span class="Delimiter">;</span> @@ -163,7 +163,7 @@ if ('onhashchange' in window) { <span id="L100" class="LineNr">100 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L101" class="LineNr">101 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L102" class="LineNr">102 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L103" class="LineNr">103 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L103" class="LineNr">103 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L104" class="LineNr">104 </span> <span class="Conceal">¦</span> new_instructions<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>inst<span class="Delimiter">);</span> <span id="L105" class="LineNr">105 </span> <span class="Delimiter">}</span> <span id="L106" class="LineNr">106 </span> caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>swap<span class="Delimiter">(</span>new_instructions<span class="Delimiter">);</span> @@ -173,7 +173,7 @@ if ('onhashchange' in window) { <span id="L110" class="LineNr">110 </span><span class="Comment">// replace r with converted text</span> <span id="L111" class="LineNr">111 </span><span class="Normal">void</span> convert_ingredient_to_text<span class="Delimiter">(</span>reagent& r<span class="Delimiter">,</span> vector<instruction>& out<span class="Delimiter">,</span> <span class="Normal">const</span> string& tmp_var<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L112" class="LineNr">112 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// error; will be handled elsewhere</span> -<span id="L113" class="LineNr">113 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='027call_ingredient.cc.html#L174'>is_mu_text</a><span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L113" class="LineNr">113 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='027call_ingredient.cc.html#L177'>is_mu_text</a><span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L114" class="LineNr">114 </span> <span class="Comment">// don't try to extend static arrays</span> <span id="L115" class="LineNr">115 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_static_array<span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L116" class="LineNr">116 </span> <a href='010vm.cc.html#L32'>instruction</a> def<span class="Delimiter">;</span> @@ -188,7 +188,7 @@ if ('onhashchange' in window) { <span id="L125" class="LineNr">125 </span> <span class="Conceal">¦</span> def<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span id="L126" class="LineNr">126 </span> <span class="Delimiter">}</span> <span id="L127" class="LineNr">127 </span> def<span class="Delimiter">.</span>products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span>tmp_var<span class="Delimiter">));</span> -<span id="L128" class="LineNr">128 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>def<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L128" class="LineNr">128 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>def<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L129" class="LineNr">129 </span> out<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>def<span class="Delimiter">);</span> <span id="L130" class="LineNr">130 </span> r<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span class="Comment">// reclaim old memory</span> <span id="L131" class="LineNr">131 </span> r = reagent<span class="Delimiter">(</span>tmp_var<span class="Delimiter">);</span> diff --git a/html/063array.mu.html b/html/063array.mu.html index 8ec4072b..aa51fc06 100644 --- a/html/063array.mu.html +++ b/html/063array.mu.html @@ -79,20 +79,20 @@ if ('onhashchange' in window) { <span id="L18" class="LineNr"> 18 </span> <a href='075channel.mu.html#L399'>capacity</a>:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L19" class="LineNr"> 19 </span> <span class="Delimiter">{</span> <span id="L20" class="LineNr"> 20 </span> <span class="Conceal">¦</span> <span class="Comment"># while read curr-value</span> -<span id="L21" class="LineNr"> 21 </span> <span class="Conceal">¦</span> curr-value:_elem, exists?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L21" class="LineNr"> 21 </span> <span class="Conceal">¦</span> curr-value:_elem, exists?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L22" class="LineNr"> 22 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> exists? <span id="L23" class="LineNr"> 23 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L399'>capacity</a> <span class="Special"><-</span> add <a href='075channel.mu.html#L399'>capacity</a>,<span class="Constant"> 1</span> <span id="L24" class="LineNr"> 24 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span id="L25" class="LineNr"> 25 </span> <span class="Delimiter">}</span> <span id="L26" class="LineNr"> 26 </span> result <span class="Special"><-</span> new <span class="Constant">_elem:type</span>, <a href='075channel.mu.html#L399'>capacity</a> -<span id="L27" class="LineNr"> 27 </span> <span class="Constant">rewind-ingredients</span> +<span id="L27" class="LineNr"> 27 </span> <span class="Constant">rewind-inputs</span> <span id="L28" class="LineNr"> 28 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L29" class="LineNr"> 29 </span> <span class="Delimiter">{</span> <span id="L30" class="LineNr"> 30 </span> <span class="Conceal">¦</span> <span class="Comment"># while read curr-value</span> <span id="L31" class="LineNr"> 31 </span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> greater-or-equal i, <a href='075channel.mu.html#L399'>capacity</a> <span id="L32" class="LineNr"> 32 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? -<span id="L33" class="LineNr"> 33 </span> <span class="Conceal">¦</span> curr-value:_elem, exists?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> -<span id="L34" class="LineNr"> 34 </span> <span class="Conceal">¦</span> assert exists?, <span class="Constant">[error in rewinding ingredients to new-array]</span> +<span id="L33" class="LineNr"> 33 </span> <span class="Conceal">¦</span> curr-value:_elem, exists?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> +<span id="L34" class="LineNr"> 34 </span> <span class="Conceal">¦</span> assert exists?, <span class="Constant">[error in rewinding inputs to new-array]</span> <span id="L35" class="LineNr"> 35 </span> <span class="Conceal">¦</span> *result <span class="Special"><-</span> put-index *result, i, curr-value <span id="L36" class="LineNr"> 36 </span> <span class="Conceal">¦</span> i <span class="Special"><-</span> add i,<span class="Constant"> 1</span> <span id="L37" class="LineNr"> 37 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> @@ -104,13 +104,13 @@ if ('onhashchange' in window) { <span id="L43" class="LineNr"> 43 </span><span class="Comment"># (contributed by Caleb Couch)</span> <span id="L44" class="LineNr"> 44 </span><span class="muRecipe">def</span> <a href='063array.mu.html#L44'>fill</a> array:&:@:num<span class="muRecipe"> -> </span>array:&:@:num [ <span id="L45" class="LineNr"> 45 </span> <span class="Constant">local-scope</span> -<span id="L46" class="LineNr"> 46 </span> <span class="Constant">load-ingredients</span> +<span id="L46" class="LineNr"> 46 </span> <span class="Constant">load-inputs</span> <span id="L47" class="LineNr"> 47 </span> loopn:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L48" class="LineNr"> 48 </span> length:num <span class="Special"><-</span> length *array <span id="L49" class="LineNr"> 49 </span> <span class="Delimiter">{</span> <span id="L50" class="LineNr"> 50 </span> <span class="Conceal">¦</span> length?:bool <span class="Special"><-</span> equal loopn, length <span id="L51" class="LineNr"> 51 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> length? -<span id="L52" class="LineNr"> 52 </span> <span class="Conceal">¦</span> object:num, arg-received?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L52" class="LineNr"> 52 </span> <span class="Conceal">¦</span> object:num, arg-received?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L53" class="LineNr"> 53 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> arg-received? <span id="L54" class="LineNr"> 54 </span> <span class="Conceal">¦</span> *array <span class="Special"><-</span> put-index *array, loopn, object <span id="L55" class="LineNr"> 55 </span> <span class="Conceal">¦</span> loopn <span class="Special"><-</span> add loopn,<span class="Constant"> 1</span> @@ -149,7 +149,7 @@ if ('onhashchange' in window) { <span id="L88" class="LineNr"> 88 </span> ] <span id="L89" class="LineNr"> 89 </span>] <span id="L90" class="LineNr"> 90 </span> -<span id="L91" class="LineNr"> 91 </span><span class="muScenario">scenario</span> fill-exits-gracefully-when-given-no-ingredients [ +<span id="L91" class="LineNr"> 91 </span><span class="muScenario">scenario</span> fill-exits-gracefully-when-given-no-inputs [ <span id="L92" class="LineNr"> 92 </span> <span class="Constant">local-scope</span> <span id="L93" class="LineNr"> 93 </span> array:&:@:num <span class="Special"><-</span> new <span class="Constant">number:type</span>,<span class="Constant"> 3</span> <span id="L94" class="LineNr"> 94 </span> run [ @@ -168,7 +168,7 @@ if ('onhashchange' in window) { <span id="L107" class="LineNr">107 </span><span class="Comment"># (contributed by Caleb Couch)</span> <span id="L108" class="LineNr">108 </span><span class="muRecipe">def</span> <a href='063array.mu.html#L108'>swap</a> array:&:@:num, index1:num, index2:num<span class="muRecipe"> -> </span>array:&:@:num [ <span id="L109" class="LineNr">109 </span> <span class="Constant">local-scope</span> -<span id="L110" class="LineNr">110 </span> <span class="Constant">load-ingredients</span> +<span id="L110" class="LineNr">110 </span> <span class="Constant">load-inputs</span> <span id="L111" class="LineNr">111 </span> object1:num <span class="Special"><-</span> index *array, index1 <span id="L112" class="LineNr">112 </span> object2:num <span class="Special"><-</span> index *array, index2 <span id="L113" class="LineNr">113 </span> *array <span class="Special"><-</span> put-index *array, index1, object2 @@ -194,7 +194,7 @@ if ('onhashchange' in window) { <span id="L133" class="LineNr">133 </span><span class="Comment"># (contributed by Caleb Couch)</span> <span id="L134" class="LineNr">134 </span><span class="muRecipe">def</span> reverse array:&:@:_elem<span class="muRecipe"> -> </span>array:&:@:_elem [ <span id="L135" class="LineNr">135 </span> <span class="Constant">local-scope</span> -<span id="L136" class="LineNr">136 </span> <span class="Constant">load-ingredients</span> +<span id="L136" class="LineNr">136 </span> <span class="Constant">load-inputs</span> <span id="L137" class="LineNr">137 </span> start:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L138" class="LineNr">138 </span> length:num <span class="Special"><-</span> length *array <span id="L139" class="LineNr">139 </span> end:num <span class="Special"><-</span> subtract length,<span class="Constant"> 1</span> diff --git a/html/064list.mu.html b/html/064list.mu.html index 937bf0b9..d9552c9a 100644 --- a/html/064list.mu.html +++ b/html/064list.mu.html @@ -72,20 +72,20 @@ if ('onhashchange' in window) { <span id="L10" class="LineNr"> 10 </span> <span id="L11" class="LineNr"> 11 </span><span class="muRecipe">def</span> push x:_elem, l:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='064list.mu.html#L6'>list</a>:_elem/contained-in:l [ <span id="L12" class="LineNr"> 12 </span> <span class="Constant">local-scope</span> -<span id="L13" class="LineNr"> 13 </span> <span class="Constant">load-ingredients</span> +<span id="L13" class="LineNr"> 13 </span> <span class="Constant">load-inputs</span> <span id="L14" class="LineNr"> 14 </span> result <span class="Special"><-</span> new <span class="Delimiter">{</span>(list _elem): type<span class="Delimiter">}</span> <span id="L15" class="LineNr"> 15 </span> *result <span class="Special"><-</span> merge x, l <span id="L16" class="LineNr"> 16 </span>] <span id="L17" class="LineNr"> 17 </span> <span id="L18" class="LineNr"> 18 </span><span class="muRecipe">def</span> first in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:_elem [ <span id="L19" class="LineNr"> 19 </span> <span class="Constant">local-scope</span> -<span id="L20" class="LineNr"> 20 </span> <span class="Constant">load-ingredients</span> +<span id="L20" class="LineNr"> 20 </span> <span class="Constant">load-inputs</span> <span id="L21" class="LineNr"> 21 </span> result <span class="Special"><-</span> get *in, <span class="Constant">value:offset</span> <span id="L22" class="LineNr"> 22 </span>] <span id="L23" class="LineNr"> 23 </span> <span id="L24" class="LineNr"> 24 </span><span class="muRecipe">def</span> <a href='064list.mu.html#L24'>rest</a> in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='064list.mu.html#L6'>list</a>:_elem/contained-in:in [ <span id="L25" class="LineNr"> 25 </span> <span class="Constant">local-scope</span> -<span id="L26" class="LineNr"> 26 </span> <span class="Constant">load-ingredients</span> +<span id="L26" class="LineNr"> 26 </span> <span class="Constant">load-inputs</span> <span id="L27" class="LineNr"> 27 </span> result <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L25'>next</a>:offset</span> <span id="L28" class="LineNr"> 28 </span>] <span id="L29" class="LineNr"> 29 </span> @@ -112,7 +112,7 @@ if ('onhashchange' in window) { <span id="L50" class="LineNr"> 50 </span> <span id="L51" class="LineNr"> 51 </span><span class="muRecipe">def</span> length l:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:num [ <span id="L52" class="LineNr"> 52 </span> <span class="Constant">local-scope</span> -<span id="L53" class="LineNr"> 53 </span> <span class="Constant">load-ingredients</span> +<span id="L53" class="LineNr"> 53 </span> <span class="Constant">load-inputs</span> <span id="L54" class="LineNr"> 54 </span> result <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L55" class="LineNr"> 55 </span> <span class="Delimiter">{</span> <span id="L56" class="LineNr"> 56 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> l @@ -125,7 +125,7 @@ if ('onhashchange' in window) { <span id="L63" class="LineNr"> 63 </span><span class="Comment"># insert 'x' after 'in'</span> <span id="L64" class="LineNr"> 64 </span><span class="muRecipe">def</span> insert x:_elem, in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='064list.mu.html#L6'>list</a>:_elem [ <span id="L65" class="LineNr"> 65 </span> <span class="Constant">local-scope</span> -<span id="L66" class="LineNr"> 66 </span> <span class="Constant">load-ingredients</span> +<span id="L66" class="LineNr"> 66 </span> <span class="Constant">load-inputs</span> <span id="L67" class="LineNr"> 67 </span> new-node:&:<a href='064list.mu.html#L6'>list</a>:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(list _elem): type<span class="Delimiter">}</span> <span id="L68" class="LineNr"> 68 </span> *new-node <span class="Special"><-</span> put *new-node, <span class="Constant">value:offset</span>, x <span id="L69" class="LineNr"> 69 </span> next-node:&:<a href='064list.mu.html#L6'>list</a>:_elem <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L25'>next</a>:offset</span> @@ -217,7 +217,7 @@ if ('onhashchange' in window) { <span id="L155" class="LineNr">155 </span><span class="Comment"># pointers to the head are now invalid.</span> <span id="L156" class="LineNr">156 </span><span class="muRecipe">def</span> remove x:&:<a href='064list.mu.html#L6'>list</a>:_elem/contained-in:in, in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='064list.mu.html#L6'>list</a>:_elem [ <span id="L157" class="LineNr">157 </span> <span class="Constant">local-scope</span> -<span id="L158" class="LineNr">158 </span> <span class="Constant">load-ingredients</span> +<span id="L158" class="LineNr">158 </span> <span class="Constant">load-inputs</span> <span id="L159" class="LineNr">159 </span> <span class="Comment"># if 'x' is null, return</span> <span id="L160" class="LineNr">160 </span> <span class="muControl">return-unless</span> x <span id="L161" class="LineNr">161 </span> next-node:&:<a href='064list.mu.html#L6'>list</a>:_elem <span class="Special"><-</span> <a href='064list.mu.html#L24'>rest</a> x @@ -327,7 +327,7 @@ if ('onhashchange' in window) { <span id="L265" class="LineNr">265 </span><span class="Comment"># (contributed by Caleb Couch)</span> <span id="L266" class="LineNr">266 </span><span class="muRecipe">def</span> reverse <a href='064list.mu.html#L6'>list</a>:&:<a href='064list.mu.html#L6'>list</a>:_elem temp:&:<a href='064list.mu.html#L6'>list</a>:_elem/contained-in:result<span class="muRecipe"> -> </span>result:&:<a href='064list.mu.html#L6'>list</a>:_elem [ <span id="L267" class="LineNr">267 </span> <span class="Constant">local-scope</span> -<span id="L268" class="LineNr">268 </span> <span class="Constant">load-ingredients</span> +<span id="L268" class="LineNr">268 </span> <span class="Constant">load-inputs</span> <span id="L269" class="LineNr">269 </span> <span class="muControl">return-unless</span> <a href='064list.mu.html#L6'>list</a>, temp <span id="L270" class="LineNr">270 </span> object:_elem <span class="Special"><-</span> first, <a href='064list.mu.html#L6'>list</a> <span id="L271" class="LineNr">271 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> <a href='064list.mu.html#L24'>rest</a> <a href='064list.mu.html#L6'>list</a> @@ -366,7 +366,7 @@ if ('onhashchange' in window) { <span id="L304" class="LineNr">304 </span> <span id="L305" class="LineNr">305 </span><span class="muRecipe">def</span> to-text in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:text [ <span id="L306" class="LineNr">306 </span> <span class="Constant">local-scope</span> -<span id="L307" class="LineNr">307 </span> <span class="Constant">load-ingredients</span> +<span id="L307" class="LineNr">307 </span> <span class="Constant">load-inputs</span> <span id="L308" class="LineNr">308 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 80</span> <span id="L309" class="LineNr">309 </span> buf <span class="Special"><-</span> to-buffer in, buf <span id="L310" class="LineNr">310 </span> result <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf @@ -375,7 +375,7 @@ if ('onhashchange' in window) { <span id="L313" class="LineNr">313 </span><span class="Comment"># variant of 'to-text' which stops printing after a few elements (and so is robust to cycles)</span> <span id="L314" class="LineNr">314 </span><span class="muRecipe">def</span> to-text-line in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:text [ <span id="L315" class="LineNr">315 </span> <span class="Constant">local-scope</span> -<span id="L316" class="LineNr">316 </span> <span class="Constant">load-ingredients</span> +<span id="L316" class="LineNr">316 </span> <span class="Constant">load-inputs</span> <span id="L317" class="LineNr">317 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 80</span> <span id="L318" class="LineNr">318 </span> buf <span class="Special"><-</span> to-buffer in, buf,<span class="Constant"> 6</span> <span class="Comment"># max elements to display</span> <span id="L319" class="LineNr">319 </span> result <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf @@ -383,7 +383,7 @@ if ('onhashchange' in window) { <span id="L321" class="LineNr">321 </span> <span id="L322" class="LineNr">322 </span><span class="muRecipe">def</span> to-buffer in:&:<a href='064list.mu.html#L6'>list</a>:_elem, buf:&:<a href='061text.mu.html#L120'>buffer</a>:char<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L120'>buffer</a>:char [ <span id="L323" class="LineNr">323 </span> <span class="Constant">local-scope</span> -<span id="L324" class="LineNr">324 </span> <span class="Constant">load-ingredients</span> +<span id="L324" class="LineNr">324 </span> <span class="Constant">load-inputs</span> <span id="L325" class="LineNr">325 </span> <span class="Delimiter">{</span> <span id="L326" class="LineNr">326 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> in <span id="L327" class="LineNr">327 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> append buf, <span class="Constant">[[]</span>] @@ -398,9 +398,9 @@ if ('onhashchange' in window) { <span id="L336" class="LineNr">336 </span> <span class="muControl">return-unless</span> <a href='065duplex_list.mu.html#L25'>next</a> <span id="L337" class="LineNr">337 </span> buf <span class="Special"><-</span> append buf, <span class="Constant">[ -> ]</span> <span id="L338" class="LineNr">338 </span> <span class="Comment"># and recurse</span> -<span id="L339" class="LineNr">339 </span> remaining:num, optional-ingredient-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L339" class="LineNr">339 </span> remaining:num, optional-input-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L340" class="LineNr">340 </span> <span class="Delimiter">{</span> -<span id="L341" class="LineNr">341 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> optional-ingredient-found? +<span id="L341" class="LineNr">341 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> optional-input-found? <span id="L342" class="LineNr">342 </span> <span class="Conceal">¦</span> <span class="Comment"># unlimited recursion</span> <span id="L343" class="LineNr">343 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> to-buffer <a href='065duplex_list.mu.html#L25'>next</a>, buf <span id="L344" class="LineNr">344 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> diff --git a/html/065duplex_list.mu.html b/html/065duplex_list.mu.html index d01d6819..e0bde027 100644 --- a/html/065duplex_list.mu.html +++ b/html/065duplex_list.mu.html @@ -70,7 +70,7 @@ if ('onhashchange' in window) { <span id="L8" class="LineNr"> 8 </span> <span id="L9" class="LineNr"> 9 </span><span class="muRecipe">def</span> push x:_elem, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:result<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L10" class="LineNr"> 10 </span> <span class="Constant">local-scope</span> -<span id="L11" class="LineNr"> 11 </span> <span class="Constant">load-ingredients</span> +<span id="L11" class="LineNr"> 11 </span> <span class="Constant">load-inputs</span> <span id="L12" class="LineNr"> 12 </span> result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(duplex-list _elem): type<span class="Delimiter">}</span> <span id="L13" class="LineNr"> 13 </span> *result <span class="Special"><-</span> merge x, in,<span class="Constant"> 0</span> <span id="L14" class="LineNr"> 14 </span> <span class="muControl">return-unless</span> in @@ -79,21 +79,21 @@ if ('onhashchange' in window) { <span id="L17" class="LineNr"> 17 </span> <span id="L18" class="LineNr"> 18 </span><span class="muRecipe">def</span> first in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:_elem [ <span id="L19" class="LineNr"> 19 </span> <span class="Constant">local-scope</span> -<span id="L20" class="LineNr"> 20 </span> <span class="Constant">load-ingredients</span> +<span id="L20" class="LineNr"> 20 </span> <span class="Constant">load-inputs</span> <span id="L21" class="LineNr"> 21 </span> <span class="muControl">return-unless</span> in,<span class="Constant"> 0</span> <span id="L22" class="LineNr"> 22 </span> result <span class="Special"><-</span> get *in, <span class="Constant">value:offset</span> <span id="L23" class="LineNr"> 23 </span>] <span id="L24" class="LineNr"> 24 </span> <span id="L25" class="LineNr"> 25 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L25'>next</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in [ <span id="L26" class="LineNr"> 26 </span> <span class="Constant">local-scope</span> -<span id="L27" class="LineNr"> 27 </span> <span class="Constant">load-ingredients</span> +<span id="L27" class="LineNr"> 27 </span> <span class="Constant">load-inputs</span> <span id="L28" class="LineNr"> 28 </span> <span class="muControl">return-unless</span> in,<span class="Constant"> 0</span> <span id="L29" class="LineNr"> 29 </span> result <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L25'>next</a>:offset</span> <span id="L30" class="LineNr"> 30 </span>] <span id="L31" class="LineNr"> 31 </span> <span id="L32" class="LineNr"> 32 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L32'>prev</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in [ <span id="L33" class="LineNr"> 33 </span> <span class="Constant">local-scope</span> -<span id="L34" class="LineNr"> 34 </span> <span class="Constant">load-ingredients</span> +<span id="L34" class="LineNr"> 34 </span> <span class="Constant">load-inputs</span> <span id="L35" class="LineNr"> 35 </span> <span class="muControl">return-unless</span> in,<span class="Constant"> 0</span> <span id="L36" class="LineNr"> 36 </span> result <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L32'>prev</a>:offset</span> <span id="L37" class="LineNr"> 37 </span> <span class="muControl">return</span> result @@ -143,7 +143,7 @@ if ('onhashchange' in window) { <span id="L81" class="LineNr"> 81 </span> <span id="L82" class="LineNr"> 82 </span><span class="muRecipe">def</span> length l:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:num [ <span id="L83" class="LineNr"> 83 </span> <span class="Constant">local-scope</span> -<span id="L84" class="LineNr"> 84 </span> <span class="Constant">load-ingredients</span> +<span id="L84" class="LineNr"> 84 </span> <span class="Constant">load-inputs</span> <span id="L85" class="LineNr"> 85 </span> result <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L86" class="LineNr"> 86 </span> <span class="Delimiter">{</span> <span id="L87" class="LineNr"> 87 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> l @@ -156,7 +156,7 @@ if ('onhashchange' in window) { <span id="L94" class="LineNr"> 94 </span><span class="Comment"># insert 'x' after 'in'</span> <span id="L95" class="LineNr"> 95 </span><span class="muRecipe">def</span> insert x:_elem, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L96" class="LineNr"> 96 </span> <span class="Constant">local-scope</span> -<span id="L97" class="LineNr"> 97 </span> <span class="Constant">load-ingredients</span> +<span id="L97" class="LineNr"> 97 </span> <span class="Constant">load-inputs</span> <span id="L98" class="LineNr"> 98 </span> new-node:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(duplex-list _elem): type<span class="Delimiter">}</span> <span id="L99" class="LineNr"> 99 </span> *new-node <span class="Special"><-</span> put *new-node, <span class="Constant">value:offset</span>, x <span id="L100" class="LineNr">100 </span> <span class="Comment"># save old next before changing it</span> @@ -285,7 +285,7 @@ if ('onhashchange' in window) { <span id="L223" class="LineNr">223 </span><span class="Comment"># pointers to the head are now invalid.</span> <span id="L224" class="LineNr">224 </span><span class="muRecipe">def</span> remove x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L225" class="LineNr">225 </span> <span class="Constant">local-scope</span> -<span id="L226" class="LineNr">226 </span> <span class="Constant">load-ingredients</span> +<span id="L226" class="LineNr">226 </span> <span class="Constant">load-inputs</span> <span id="L227" class="LineNr">227 </span> <span class="Comment"># if 'x' is null, return</span> <span id="L228" class="LineNr">228 </span> <span class="muControl">return-unless</span> x <span id="L229" class="LineNr">229 </span> next-node:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> get *x, <span class="Constant"><a href='065duplex_list.mu.html#L25'>next</a>:offset</span> @@ -409,7 +409,7 @@ if ('onhashchange' in window) { <span id="L347" class="LineNr">347 </span> <span id="L348" class="LineNr">348 </span><span class="muRecipe">def</span> remove x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in, n:num, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L349" class="LineNr">349 </span> <span class="Constant">local-scope</span> -<span id="L350" class="LineNr">350 </span> <span class="Constant">load-ingredients</span> +<span id="L350" class="LineNr">350 </span> <span class="Constant">load-inputs</span> <span id="L351" class="LineNr">351 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L352" class="LineNr">352 </span> curr:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> copy x <span id="L353" class="LineNr">353 </span> <span class="Delimiter">{</span> @@ -446,7 +446,7 @@ if ('onhashchange' in window) { <span id="L384" class="LineNr">384 </span><span class="Comment"># clean way to return the new head pointer.</span> <span id="L385" class="LineNr">385 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L385'>remove-between</a> start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, end:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:start<span class="muRecipe"> -> </span>start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L386" class="LineNr">386 </span> <span class="Constant">local-scope</span> -<span id="L387" class="LineNr">387 </span> <span class="Constant">load-ingredients</span> +<span id="L387" class="LineNr">387 </span> <span class="Constant">load-inputs</span> <span id="L388" class="LineNr">388 </span> <a href='065duplex_list.mu.html#L25'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> get *start, <span class="Constant"><a href='065duplex_list.mu.html#L25'>next</a>:offset</span> <span id="L389" class="LineNr">389 </span> nothing-to-delete?:bool <span class="Special"><-</span> equal <a href='065duplex_list.mu.html#L25'>next</a>, end <span id="L390" class="LineNr">390 </span> <span class="muControl">return-if</span> nothing-to-delete? @@ -586,7 +586,7 @@ if ('onhashchange' in window) { <span id="L524" class="LineNr">524 </span><span class="Comment"># insert list beginning at 'start' after 'in'</span> <span id="L525" class="LineNr">525 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L525'>splice</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L526" class="LineNr">526 </span> <span class="Constant">local-scope</span> -<span id="L527" class="LineNr">527 </span> <span class="Constant">load-ingredients</span> +<span id="L527" class="LineNr">527 </span> <span class="Constant">load-inputs</span> <span id="L528" class="LineNr">528 </span> <span class="muControl">return-unless</span> in <span id="L529" class="LineNr">529 </span> <span class="muControl">return-unless</span> start <span id="L530" class="LineNr">530 </span> end:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L572'>last</a> start @@ -603,7 +603,7 @@ if ('onhashchange' in window) { <span id="L541" class="LineNr">541 </span><span class="Comment"># insert contents of 'new' after 'in'</span> <span id="L542" class="LineNr">542 </span><span class="muRecipe">def</span> insert in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, new:&:@:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L543" class="LineNr">543 </span> <span class="Constant">local-scope</span> -<span id="L544" class="LineNr">544 </span> <span class="Constant">load-ingredients</span> +<span id="L544" class="LineNr">544 </span> <span class="Constant">load-inputs</span> <span id="L545" class="LineNr">545 </span> <span class="muControl">return-unless</span> in <span id="L546" class="LineNr">546 </span> <span class="muControl">return-unless</span> new <span id="L547" class="LineNr">547 </span> len:num <span class="Special"><-</span> length *new @@ -624,7 +624,7 @@ if ('onhashchange' in window) { <span id="L562" class="LineNr">562 </span> <span id="L563" class="LineNr">563 </span><span class="muRecipe">def</span> append in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, new:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L564" class="LineNr">564 </span> <span class="Constant">local-scope</span> -<span id="L565" class="LineNr">565 </span> <span class="Constant">load-ingredients</span> +<span id="L565" class="LineNr">565 </span> <span class="Constant">load-inputs</span> <span id="L566" class="LineNr">566 </span> <a href='065duplex_list.mu.html#L572'>last</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L572'>last</a> in <span id="L567" class="LineNr">567 </span> *last <span class="Special"><-</span> put *last, <span class="Constant"><a href='065duplex_list.mu.html#L25'>next</a>:offset</span>, new <span id="L568" class="LineNr">568 </span> <span class="muControl">return-unless</span> new @@ -633,7 +633,7 @@ if ('onhashchange' in window) { <span id="L571" class="LineNr">571 </span> <span id="L572" class="LineNr">572 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L572'>last</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L573" class="LineNr">573 </span> <span class="Constant">local-scope</span> -<span id="L574" class="LineNr">574 </span> <span class="Constant">load-ingredients</span> +<span id="L574" class="LineNr">574 </span> <span class="Constant">load-inputs</span> <span id="L575" class="LineNr">575 </span> result <span class="Special"><-</span> copy in <span id="L576" class="LineNr">576 </span> <span class="Delimiter">{</span> <span id="L577" class="LineNr">577 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L25'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L25'>next</a> result @@ -646,7 +646,7 @@ if ('onhashchange' in window) { <span id="L584" class="LineNr">584 </span><span class="Comment"># does a duplex list start with a certain sequence of elements?</span> <span id="L585" class="LineNr">585 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L585'>match</a> x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, y:&:@:_elem<span class="muRecipe"> -> </span>result:bool [ <span id="L586" class="LineNr">586 </span> <span class="Constant">local-scope</span> -<span id="L587" class="LineNr">587 </span> <span class="Constant">load-ingredients</span> +<span id="L587" class="LineNr">587 </span> <span class="Constant">load-inputs</span> <span id="L588" class="LineNr">588 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L589" class="LineNr">589 </span> max:num <span class="Special"><-</span> length *y <span id="L590" class="LineNr">590 </span> <span class="Delimiter">{</span> @@ -691,7 +691,7 @@ if ('onhashchange' in window) { <span id="L629" class="LineNr">629 </span><span class="Comment"># helper for debugging</span> <span id="L630" class="LineNr">630 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L630'>dump-from</a> x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L631" class="LineNr">631 </span> <span class="Constant">local-scope</span> -<span id="L632" class="LineNr">632 </span> <span class="Constant">load-ingredients</span> +<span id="L632" class="LineNr">632 </span> <span class="Constant">load-inputs</span> <span id="L633" class="LineNr">633 </span> $print x, <span class="Constant">[: ]</span> <span id="L634" class="LineNr">634 </span> <span class="Delimiter">{</span> <span id="L635" class="LineNr">635 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> x @@ -724,7 +724,7 @@ if ('onhashchange' in window) { <span id="L662" class="LineNr">662 </span> <span id="L663" class="LineNr">663 </span><span class="muRecipe">def</span> to-text in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:text [ <span id="L664" class="LineNr">664 </span> <span class="Constant">local-scope</span> -<span id="L665" class="LineNr">665 </span> <span class="Constant">load-ingredients</span> +<span id="L665" class="LineNr">665 </span> <span class="Constant">load-inputs</span> <span id="L666" class="LineNr">666 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 80</span> <span id="L667" class="LineNr">667 </span> buf <span class="Special"><-</span> to-buffer in, buf <span id="L668" class="LineNr">668 </span> result <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf @@ -733,7 +733,7 @@ if ('onhashchange' in window) { <span id="L671" class="LineNr">671 </span><span class="Comment"># variant of 'to-text' which stops printing after a few elements (and so is robust to cycles)</span> <span id="L672" class="LineNr">672 </span><span class="muRecipe">def</span> to-text-line in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:text [ <span id="L673" class="LineNr">673 </span> <span class="Constant">local-scope</span> -<span id="L674" class="LineNr">674 </span> <span class="Constant">load-ingredients</span> +<span id="L674" class="LineNr">674 </span> <span class="Constant">load-inputs</span> <span id="L675" class="LineNr">675 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 80</span> <span id="L676" class="LineNr">676 </span> buf <span class="Special"><-</span> to-buffer in, buf,<span class="Constant"> 6</span> <span class="Comment"># max elements to display</span> <span id="L677" class="LineNr">677 </span> result <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf @@ -741,7 +741,7 @@ if ('onhashchange' in window) { <span id="L679" class="LineNr">679 </span> <span id="L680" class="LineNr">680 </span><span class="muRecipe">def</span> to-buffer in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, buf:&:<a href='061text.mu.html#L120'>buffer</a>:char<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L120'>buffer</a>:char [ <span id="L681" class="LineNr">681 </span> <span class="Constant">local-scope</span> -<span id="L682" class="LineNr">682 </span> <span class="Constant">load-ingredients</span> +<span id="L682" class="LineNr">682 </span> <span class="Constant">load-inputs</span> <span id="L683" class="LineNr">683 </span> <span class="Delimiter">{</span> <span id="L684" class="LineNr">684 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> in <span id="L685" class="LineNr">685 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> append buf, <span class="Constant">[[]</span>] @@ -756,9 +756,9 @@ if ('onhashchange' in window) { <span id="L694" class="LineNr">694 </span> <span class="muControl">return-unless</span> <a href='065duplex_list.mu.html#L25'>next</a> <span id="L695" class="LineNr">695 </span> buf <span class="Special"><-</span> append buf, <span class="Constant">[ <-> ]</span> <span id="L696" class="LineNr">696 </span> <span class="Comment"># and recurse</span> -<span id="L697" class="LineNr">697 </span> remaining:num, optional-ingredient-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L697" class="LineNr">697 </span> remaining:num, optional-input-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L698" class="LineNr">698 </span> <span class="Delimiter">{</span> -<span id="L699" class="LineNr">699 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> optional-ingredient-found? +<span id="L699" class="LineNr">699 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> optional-input-found? <span id="L700" class="LineNr">700 </span> <span class="Conceal">¦</span> <span class="Comment"># unlimited recursion</span> <span id="L701" class="LineNr">701 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> to-buffer <a href='065duplex_list.mu.html#L25'>next</a>, buf <span id="L702" class="LineNr">702 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> diff --git a/html/066stream.mu.html b/html/066stream.mu.html index 217095ac..4c80df9d 100644 --- a/html/066stream.mu.html +++ b/html/066stream.mu.html @@ -67,7 +67,7 @@ if ('onhashchange' in window) { <span id="L6" class="LineNr"> 6 </span> <span id="L7" class="LineNr"> 7 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L7'>new-stream</a> s:&:@:_elem<span class="muRecipe"> -> </span>result:&:<a href='066stream.mu.html#L2'>stream</a>:_elem [ <span id="L8" class="LineNr"> 8 </span> <span class="Constant">local-scope</span> -<span id="L9" class="LineNr"> 9 </span> <span class="Constant">load-ingredients</span> +<span id="L9" class="LineNr"> 9 </span> <span class="Constant">load-inputs</span> <span id="L10" class="LineNr">10 </span> <span class="muControl">return-unless</span> s, <span class="Constant">0/null</span> <span id="L11" class="LineNr">11 </span> result <span class="Special"><-</span> new <span class="Delimiter">{</span>(stream _elem): type<span class="Delimiter">}</span> <span id="L12" class="LineNr">12 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">index:offset</span>,<span class="Constant"> 0</span> @@ -76,14 +76,14 @@ if ('onhashchange' in window) { <span id="L15" class="LineNr">15 </span> <span id="L16" class="LineNr">16 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L16'>rewind</a> in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem [ <span id="L17" class="LineNr">17 </span> <span class="Constant">local-scope</span> -<span id="L18" class="LineNr">18 </span> <span class="Constant">load-ingredients</span> +<span id="L18" class="LineNr">18 </span> <span class="Constant">load-inputs</span> <span id="L19" class="LineNr">19 </span> <span class="muControl">return-unless</span> in <span id="L20" class="LineNr">20 </span> *in <span class="Special"><-</span> put *in, <span class="Constant">index:offset</span>,<span class="Constant"> 0</span> <span id="L21" class="LineNr">21 </span>] <span id="L22" class="LineNr">22 </span> <span id="L23" class="LineNr">23 </span><span class="muRecipe">def</span> read in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem<span class="muRecipe"> -> </span>result:_elem, empty?:bool, in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem [ <span id="L24" class="LineNr">24 </span> <span class="Constant">local-scope</span> -<span id="L25" class="LineNr">25 </span> <span class="Constant">load-ingredients</span> +<span id="L25" class="LineNr">25 </span> <span class="Constant">load-inputs</span> <span id="L26" class="LineNr">26 </span> assert in, <span class="Constant">[cannot read; <a href='066stream.mu.html#L2'>stream</a> has no data]</span> <span id="L27" class="LineNr">27 </span> empty? <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L28" class="LineNr">28 </span> idx:num <span class="Special"><-</span> get *in, <span class="Constant">index:offset</span> @@ -102,7 +102,7 @@ if ('onhashchange' in window) { <span id="L41" class="LineNr">41 </span> <span id="L42" class="LineNr">42 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L42'>peek</a> in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem<span class="muRecipe"> -> </span>result:_elem, empty?:bool [ <span id="L43" class="LineNr">43 </span> <span class="Constant">local-scope</span> -<span id="L44" class="LineNr">44 </span> <span class="Constant">load-ingredients</span> +<span id="L44" class="LineNr">44 </span> <span class="Constant">load-inputs</span> <span id="L45" class="LineNr">45 </span> assert in, <span class="Constant">[cannot peek; <a href='066stream.mu.html#L2'>stream</a> has no data]</span> <span id="L46" class="LineNr">46 </span> empty?:bool <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L47" class="LineNr">47 </span> idx:num <span class="Special"><-</span> get *in, <span class="Constant">index:offset</span> @@ -119,7 +119,7 @@ if ('onhashchange' in window) { <span id="L58" class="LineNr">58 </span> <span id="L59" class="LineNr">59 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L59'>read-line</a> in:&:<a href='066stream.mu.html#L2'>stream</a>:char<span class="muRecipe"> -> </span>result:text, in:&:<a href='066stream.mu.html#L2'>stream</a>:char [ <span id="L60" class="LineNr">60 </span> <span class="Constant">local-scope</span> -<span id="L61" class="LineNr">61 </span> <span class="Constant">load-ingredients</span> +<span id="L61" class="LineNr">61 </span> <span class="Constant">load-inputs</span> <span id="L62" class="LineNr">62 </span> assert in, <span class="Constant">[cannot read-line; <a href='066stream.mu.html#L2'>stream</a> has no data]</span> <span id="L63" class="LineNr">63 </span> idx:num <span class="Special"><-</span> get *in, <span class="Constant">index:offset</span> <span id="L64" class="LineNr">64 </span> s:text <span class="Special"><-</span> get *in, <span class="Constant">data:offset</span> @@ -132,7 +132,7 @@ if ('onhashchange' in window) { <span id="L71" class="LineNr">71 </span> <span id="L72" class="LineNr">72 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L72'>end-of-stream?</a> in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem<span class="muRecipe"> -> </span>result:bool [ <span id="L73" class="LineNr">73 </span> <span class="Constant">local-scope</span> -<span id="L74" class="LineNr">74 </span> <span class="Constant">load-ingredients</span> +<span id="L74" class="LineNr">74 </span> <span class="Constant">load-inputs</span> <span id="L75" class="LineNr">75 </span> assert in, <span class="Constant">[cannot check end-of-stream?; <a href='066stream.mu.html#L2'>stream</a> has no data]</span> <span id="L76" class="LineNr">76 </span> idx:num <span class="Special"><-</span> get *in, <span class="Constant">index:offset</span> <span id="L77" class="LineNr">77 </span> s:&:@:_elem <span class="Special"><-</span> get *in, <span class="Constant">data:offset</span> diff --git a/html/068random.mu.html b/html/068random.mu.html index 2c695c2f..dbe3bc66 100644 --- a/html/068random.mu.html +++ b/html/068random.mu.html @@ -61,7 +61,7 @@ if ('onhashchange' in window) { <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="muRecipe">def</span> <a href='068random.mu.html#L1'>random</a> generator:&:<a href='066stream.mu.html#L2'>stream</a>:num<span class="muRecipe"> -> </span>result:num, fail?:bool, generator:&:<a href='066stream.mu.html#L2'>stream</a>:num [ <span id="L2" class="LineNr"> 2 </span> <span class="Constant">local-scope</span> -<span id="L3" class="LineNr"> 3 </span> <span class="Constant">load-ingredients</span> +<span id="L3" class="LineNr"> 3 </span> <span class="Constant">load-inputs</span> <span id="L4" class="LineNr"> 4 </span> <span class="Delimiter">{</span> <span id="L5" class="LineNr"> 5 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> generator <span id="L6" class="LineNr"> 6 </span> <span class="Conceal">¦</span> <span class="Comment"># generator is 0? use real random-number generator</span> @@ -74,20 +74,20 @@ if ('onhashchange' in window) { <span id="L13" class="LineNr">13 </span><span class="Comment"># helper for tests</span> <span id="L14" class="LineNr">14 </span><span class="muRecipe">def</span> <a href='068random.mu.html#L14'>assume-random-numbers</a><span class="muRecipe"> -> </span>result:&:<a href='066stream.mu.html#L2'>stream</a>:num [ <span id="L15" class="LineNr">15 </span> <span class="Constant">local-scope</span> -<span id="L16" class="LineNr">16 </span> <span class="Constant">load-ingredients</span> +<span id="L16" class="LineNr">16 </span> <span class="Constant">load-inputs</span> <span id="L17" class="LineNr">17 </span> <span class="Comment"># compute result-len, space to allocate in result</span> <span id="L18" class="LineNr">18 </span> result-len:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L19" class="LineNr">19 </span> <span class="Delimiter">{</span> -<span id="L20" class="LineNr">20 </span> <span class="Conceal">¦</span> _, arg-received?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L20" class="LineNr">20 </span> <span class="Conceal">¦</span> _, arg-received?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L21" class="LineNr">21 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> arg-received? <span id="L22" class="LineNr">22 </span> <span class="Conceal">¦</span> result-len <span class="Special"><-</span> add result-len,<span class="Constant"> 1</span> <span id="L23" class="LineNr">23 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span id="L24" class="LineNr">24 </span> <span class="Delimiter">}</span> -<span id="L25" class="LineNr">25 </span> <span class="Constant">rewind-ingredients</span> +<span id="L25" class="LineNr">25 </span> <span class="Constant">rewind-inputs</span> <span id="L26" class="LineNr">26 </span> result-data:&:@:num <span class="Special"><-</span> new <span class="Constant">number:type</span>, result-len <span id="L27" class="LineNr">27 </span> idx:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L28" class="LineNr">28 </span> <span class="Delimiter">{</span> -<span id="L29" class="LineNr">29 </span> <span class="Conceal">¦</span> curr:num, arg-received?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L29" class="LineNr">29 </span> <span class="Conceal">¦</span> curr:num, arg-received?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L30" class="LineNr">30 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> arg-received? <span id="L31" class="LineNr">31 </span> <span class="Conceal">¦</span> *result-data <span class="Special"><-</span> put-index *result-data, idx, curr <span id="L32" class="LineNr">32 </span> <span class="Conceal">¦</span> idx <span class="Special"><-</span> add idx,<span class="Constant"> 1</span> @@ -118,7 +118,7 @@ if ('onhashchange' in window) { <span id="L57" class="LineNr">57 </span><span class="Comment"># generate a random integer in the semi-open interval [start, end)</span> <span id="L58" class="LineNr">58 </span><span class="muRecipe">def</span> <a href='068random.mu.html#L58'>random-in-range</a> generator:&:<a href='066stream.mu.html#L2'>stream</a>:num, start:num, end:num<span class="muRecipe"> -> </span>result:num, fail?:bool, generator:&:<a href='066stream.mu.html#L2'>stream</a>:num [ <span id="L59" class="LineNr">59 </span> <span class="Constant">local-scope</span> -<span id="L60" class="LineNr">60 </span> <span class="Constant">load-ingredients</span> +<span id="L60" class="LineNr">60 </span> <span class="Constant">load-inputs</span> <span id="L61" class="LineNr">61 </span> result, fail?, generator <span class="Special"><-</span> <a href='068random.mu.html#L1'>random</a> generator <span id="L62" class="LineNr">62 </span> <span class="muControl">return-if</span> fail? <span id="L63" class="LineNr">63 </span> delta:num <span class="Special"><-</span> subtract end, start diff --git a/html/069hash.cc.html b/html/069hash.cc.html index 00d88349..defa9784 100644 --- a/html/069hash.cc.html +++ b/html/069hash.cc.html @@ -98,7 +98,7 @@ if ('onhashchange' in window) { <span id="L33" class="LineNr"> 33 </span><span class="Delimiter">:(code)</span> <span id="L34" class="LineNr"> 34 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L34'>hash</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L35" class="LineNr"> 35 </span> canonize<span class="Delimiter">(</span>r<span class="Delimiter">);</span> -<span id="L36" class="LineNr"> 36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='027call_ingredient.cc.html#L174'>is_mu_text</a><span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Comment">// optimization</span> +<span id="L36" class="LineNr"> 36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='027call_ingredient.cc.html#L177'>is_mu_text</a><span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Comment">// optimization</span> <span id="L37" class="LineNr"> 37 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <a href='069hash.cc.html#L68'>hash_mu_text</a><span class="Delimiter">(</span>h<span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L38" class="LineNr"> 38 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_address<span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span id="L39" class="LineNr"> 39 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <a href='069hash.cc.html#L56'>hash_mu_address</a><span class="Delimiter">(</span>h<span class="Delimiter">,</span> r<span class="Delimiter">);</span> @@ -114,14 +114,14 @@ if ('onhashchange' in window) { <span id="L49" class="LineNr"> 49 </span><span class="Delimiter">}</span> <span id="L50" class="LineNr"> 50 </span> <span id="L51" class="LineNr"> 51 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L51'>hash_mu_scalar</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L52" class="LineNr"> 52 </span> <span class="Normal">double</span> input = is_literal<span class="Delimiter">(</span>r<span class="Delimiter">)</span> ? r<span class="Delimiter">.</span>value : <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L52" class="LineNr"> 52 </span> <span class="Normal">double</span> input = is_literal<span class="Delimiter">(</span>r<span class="Delimiter">)</span> ? r<span class="Delimiter">.</span>value : <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span id="L53" class="LineNr"> 53 </span> <span class="Identifier">return</span> <a href='069hash.cc.html#L119'>hash_iter</a><span class="Delimiter">(</span>h<span class="Delimiter">,</span> <span class="Normal">static_cast</span><<span class="Normal">size_t</span>><span class="Delimiter">(</span>input<span class="Delimiter">));</span> <span id="L54" class="LineNr"> 54 </span><span class="Delimiter">}</span> <span id="L55" class="LineNr"> 55 </span> <span id="L56" class="LineNr"> 56 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L56'>hash_mu_address</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L57" class="LineNr"> 57 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">.</span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << r<span class="Delimiter">.</span>value << <span class="Constant">" is "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">))</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L59" class="LineNr"> 59 </span> r<span class="Delimiter">.</span><a href='010vm.cc.html#L65'>set_value</a><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">));</span> +<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << r<span class="Delimiter">.</span>value << <span class="Constant">" is "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">))</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L59" class="LineNr"> 59 </span> r<span class="Delimiter">.</span><a href='010vm.cc.html#L65'>set_value</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">));</span> <span id="L60" class="LineNr"> 60 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">.</span>value != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L61" class="LineNr"> 61 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"skipping refcount at "</span> << r<span class="Delimiter">.</span>value << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L62" class="LineNr"> 62 </span> <span class="Conceal">¦</span> r<span class="Delimiter">.</span><a href='010vm.cc.html#L65'>set_value</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>value+<span class="Constant">1</span><span class="Delimiter">);</span> <span class="Comment">// skip refcount</span> @@ -131,7 +131,7 @@ if ('onhashchange' in window) { <span id="L66" class="LineNr"> 66 </span><span class="Delimiter">}</span> <span id="L67" class="LineNr"> 67 </span> <span id="L68" class="LineNr"> 68 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L68'>hash_mu_text</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L69" class="LineNr"> 69 </span> string input = <a href='038new_text.cc.html#L143'>read_mu_text</a><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">));</span> +<span id="L69" class="LineNr"> 69 </span> string input = <a href='038new_text.cc.html#L143'>read_mu_text</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">));</span> <span id="L70" class="LineNr"> 70 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>input<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L71" class="LineNr"> 71 </span> <span class="Conceal">¦</span> h = <a href='069hash.cc.html#L119'>hash_iter</a><span class="Delimiter">(</span>h<span class="Delimiter">,</span> <span class="Normal">static_cast</span><<span class="Normal">size_t</span>><span class="Delimiter">(</span>input<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)));</span> <span id="L72" class="LineNr"> 72 </span><span class="CommentedCode">//? cerr << i << ": " << h << '\n';</span> @@ -140,7 +140,7 @@ if ('onhashchange' in window) { <span id="L75" class="LineNr"> 75 </span><span class="Delimiter">}</span> <span id="L76" class="LineNr"> 76 </span> <span id="L77" class="LineNr"> 77 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L77'>hash_mu_array</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L78" class="LineNr"> 78 </span> <span class="Normal">int</span> size = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L78" class="LineNr"> 78 </span> <span class="Normal">int</span> size = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span id="L79" class="LineNr"> 79 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> elem = r<span class="Delimiter">;</span> <span id="L80" class="LineNr"> 80 </span> <span class="Normal">delete</span> elem<span class="Delimiter">.</span>type<span class="Delimiter">;</span> <span id="L81" class="LineNr"> 81 </span> elem<span class="Delimiter">.</span>type = <a href='032array.cc.html#L377'>copy_array_element</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">);</span> diff --git a/html/070table.mu.html b/html/070table.mu.html index c5d0c6ac..620dab6b 100644 --- a/html/070table.mu.html +++ b/html/070table.mu.html @@ -117,7 +117,7 @@ if ('onhashchange' in window) { <span id="L55" class="LineNr"> 55 </span> <span id="L56" class="LineNr"> 56 </span><span class="muRecipe">def</span> <a href='070table.mu.html#L56'>new-table</a> <a href='075channel.mu.html#L399'>capacity</a>:num<span class="muRecipe"> -> </span>result:&:<a href='070table.mu.html#L44'>table</a>:_key:_value [ <span id="L57" class="LineNr"> 57 </span> <span class="Constant">local-scope</span> -<span id="L58" class="LineNr"> 58 </span> <span class="Constant">load-ingredients</span> +<span id="L58" class="LineNr"> 58 </span> <span class="Constant">load-inputs</span> <span id="L59" class="LineNr"> 59 </span> result <span class="Special"><-</span> new <span class="Delimiter">{</span>(table _key _value): type<span class="Delimiter">}</span> <span id="L60" class="LineNr"> 60 </span> data:&:@:<a href='070table.mu.html#L50'>table-row</a>:_key:_value <span class="Special"><-</span> new <span class="Delimiter">{</span>(table-row _key _value): type<span class="Delimiter">}</span>, <a href='075channel.mu.html#L399'>capacity</a> <span id="L61" class="LineNr"> 61 </span> *result <span class="Special"><-</span> merge <span class="Constant">0/length</span>, <a href='075channel.mu.html#L399'>capacity</a>, data @@ -127,7 +127,7 @@ if ('onhashchange' in window) { <span id="L65" class="LineNr"> 65 </span><span class="Comment"># then we could handle conflicts simply by resizing the table</span> <span id="L66" class="LineNr"> 66 </span><span class="muRecipe">def</span> put-index <a href='070table.mu.html#L44'>table</a>:&:<a href='070table.mu.html#L44'>table</a>:_key:_value, key:_key, value:_value<span class="muRecipe"> -> </span><a href='070table.mu.html#L44'>table</a>:&:<a href='070table.mu.html#L44'>table</a>:_key:_value [ <span id="L67" class="LineNr"> 67 </span> <span class="Constant">local-scope</span> -<span id="L68" class="LineNr"> 68 </span> <span class="Constant">load-ingredients</span> +<span id="L68" class="LineNr"> 68 </span> <span class="Constant">load-inputs</span> <span id="L69" class="LineNr"> 69 </span> hash:num <span class="Special"><-</span> hash key <span id="L70" class="LineNr"> 70 </span> hash <span class="Special"><-</span> <a href='070table.mu.html#L103'>abs</a> hash <span id="L71" class="LineNr"> 71 </span> <a href='075channel.mu.html#L399'>capacity</a>:num <span class="Special"><-</span> get *table, <span class="Constant"><a href='075channel.mu.html#L399'>capacity</a>:offset</span> @@ -144,7 +144,7 @@ if ('onhashchange' in window) { <span id="L82" class="LineNr"> 82 </span> <span id="L83" class="LineNr"> 83 </span><span class="muRecipe">def</span> index <a href='070table.mu.html#L44'>table</a>:&:<a href='070table.mu.html#L44'>table</a>:_key:_value, key:_key<span class="muRecipe"> -> </span>result:_value, found?:bool [ <span id="L84" class="LineNr"> 84 </span> <span class="Constant">local-scope</span> -<span id="L85" class="LineNr"> 85 </span> <span class="Constant">load-ingredients</span> +<span id="L85" class="LineNr"> 85 </span> <span class="Constant">load-inputs</span> <span id="L86" class="LineNr"> 86 </span> hash:num <span class="Special"><-</span> hash key <span id="L87" class="LineNr"> 87 </span> hash <span class="Special"><-</span> <a href='070table.mu.html#L103'>abs</a> hash <span id="L88" class="LineNr"> 88 </span> <a href='075channel.mu.html#L399'>capacity</a>:num <span class="Special"><-</span> get *table, <span class="Constant"><a href='075channel.mu.html#L399'>capacity</a>:offset</span> @@ -164,7 +164,7 @@ if ('onhashchange' in window) { <span id="L102" class="LineNr">102 </span> <span id="L103" class="LineNr">103 </span><span class="muRecipe">def</span> <a href='070table.mu.html#L103'>abs</a> n:num<span class="muRecipe"> -> </span>result:num [ <span id="L104" class="LineNr">104 </span> <span class="Constant">local-scope</span> -<span id="L105" class="LineNr">105 </span> <span class="Constant">load-ingredients</span> +<span id="L105" class="LineNr">105 </span> <span class="Constant">load-inputs</span> <span id="L106" class="LineNr">106 </span> positive?:bool <span class="Special"><-</span> greater-or-equal n,<span class="Constant"> 0</span> <span id="L107" class="LineNr">107 </span> <span class="muControl">return-if</span> positive?, n <span id="L108" class="LineNr">108 </span> result <span class="Special"><-</span> multiply n,<span class="Constant"> -1</span> diff --git a/html/071deep_copy.cc.html b/html/071deep_copy.cc.html index 641d493b..6a4b577e 100644 --- a/html/071deep_copy.cc.html +++ b/html/071deep_copy.cc.html @@ -336,18 +336,18 @@ if ('onhashchange' in window) { <span id="L272" class="LineNr">272 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>addresses_copied<span class="Delimiter">,</span> in_address<span class="Delimiter">,</span> out<span class="Delimiter">);</span> <span id="L273" class="LineNr">273 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> payload = canonized_in<span class="Delimiter">;</span> <span id="L274" class="LineNr">274 </span> payload<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>pair<string<span class="Delimiter">,</span> string_tree*><span class="Delimiter">(</span><span class="Constant">"lookup"</span><span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">));</span> -<span id="L275" class="LineNr">275 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"recursing on payload "</span> << payload<span class="Delimiter">.</span>value << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>payload<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L275" class="LineNr">275 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"recursing on payload "</span> << payload<span class="Delimiter">.</span>value << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>payload<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L276" class="LineNr">276 </span> vector<<span class="Normal">double</span>> data = deep_copy<span class="Delimiter">(</span>payload<span class="Delimiter">,</span> addresses_copied<span class="Delimiter">,</span> tmp<span class="Delimiter">);</span> -<span id="L277" class="LineNr">277 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"deep-copy: writing result "</span> << out << <span class="Constant">": "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L277" class="LineNr">277 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"deep-copy: writing result "</span> << out << <span class="Constant">": "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L278" class="LineNr">278 </span> <span class="Comment">// HACK: write_memory interface isn't ideal for this situation; we need</span> <span id="L279" class="LineNr">279 </span> <span class="Comment">// a temporary location to help copy the payload.</span> <span id="L280" class="LineNr">280 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"deep-copy: writing temporary "</span> << tmp<span class="Delimiter">.</span>value << <span class="Constant">": "</span> << out << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L281" class="LineNr">281 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> tmp<span class="Delimiter">.</span>value<span class="Delimiter">,</span> out<span class="Delimiter">);</span> <span id="L282" class="LineNr">282 </span> payload<span class="Delimiter">.</span><a href='010vm.cc.html#L65'>set_value</a><span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span class="Comment">// now modified for output</span> <span id="L283" class="LineNr">283 </span> vector<<span class="Normal">double</span>> old_data = read_memory<span class="Delimiter">(</span>payload<span class="Delimiter">);</span> -<span id="L284" class="LineNr">284 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"deep-copy: really writing to "</span> << payload<span class="Delimiter">.</span>value << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>payload<span class="Delimiter">)</span> << <span class="Constant">" (old value "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>old_data<span class="Delimiter">)</span> << <span class="Constant">" new value "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> << <span class="Constant">")"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L284" class="LineNr">284 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"deep-copy: really writing to "</span> << payload<span class="Delimiter">.</span>value << <span class="Constant">' '</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>payload<span class="Delimiter">)</span> << <span class="Constant">" (old value "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>old_data<span class="Delimiter">)</span> << <span class="Constant">" new value "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> << <span class="Constant">")"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L285" class="LineNr">285 </span> write_memory<span class="Delimiter">(</span>payload<span class="Delimiter">,</span> data<span class="Delimiter">);</span> -<span id="L286" class="LineNr">286 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"deep-copy: output is "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L286" class="LineNr">286 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"deep-copy: output is "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L287" class="LineNr">287 </span> <span class="Identifier">return</span> out<span class="Delimiter">;</span> <span id="L288" class="LineNr">288 </span><span class="Delimiter">}</span> <span id="L289" class="LineNr">289 </span> @@ -357,7 +357,7 @@ if ('onhashchange' in window) { <span id="L293" class="LineNr">293 </span> vector<<span class="Normal">double</span>> data = read_memory<span class="Delimiter">(</span>canonized_in<span class="Delimiter">);</span> <span id="L294" class="LineNr">294 </span> out<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>out<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">(),</span> data<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> data<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">());</span> <span id="L295" class="LineNr">295 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Container_metadata<span class="Delimiter">,</span> canonized_in<span class="Delimiter">.</span>type<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L296" class="LineNr">296 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"deep-copy: scanning for addresses in "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L296" class="LineNr">296 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"deep-copy: scanning for addresses in "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L297" class="LineNr">297 </span> <span class="Normal">const</span> container_metadata& metadata = get<span class="Delimiter">(</span>Container_metadata<span class="Delimiter">,</span> canonized_in<span class="Delimiter">.</span>type<span class="Delimiter">);</span> <span id="L298" class="LineNr">298 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<set<tag_condition_info><span class="Delimiter">,</span> set<address_element_info> >::const_iterator p = metadata<span class="Delimiter">.</span><a href='043space.cc.html#L82'>address</a><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != metadata<span class="Delimiter">.</span><a href='043space.cc.html#L82'>address</a><span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L299" class="LineNr">299 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!all_match<span class="Delimiter">(</span>data<span class="Delimiter">,</span> p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> diff --git a/html/072recipe.cc.html b/html/072recipe.cc.html index 32f77078..fc52668a 100644 --- a/html/072recipe.cc.html +++ b/html/072recipe.cc.html @@ -95,7 +95,7 @@ if ('onhashchange' in window) { <span id="L31" class="LineNr"> 31 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"recipe-literal"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L32" class="LineNr"> 32 </span><span class="Comment">// 'recipe' variables can store recipe-literal</span> <span id="L33" class="LineNr"> 33 </span><a href='010vm.cc.html#L123'>type_ordinal</a> <a href='010vm.cc.html#L19'>recipe</a> = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"recipe"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L34" class="LineNr"> 34 </span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> <a href='010vm.cc.html#L19'>recipe</a><span class="Delimiter">).</span>name = <span class="Constant">"recipe"</span><span class="Delimiter">;</span> +<span id="L34" class="LineNr"> 34 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> <a href='010vm.cc.html#L19'>recipe</a><span class="Delimiter">).</span>name = <span class="Constant">"recipe"</span><span class="Delimiter">;</span> <span id="L35" class="LineNr"> 35 </span> <span id="L36" class="LineNr"> 36 </span><span class="Delimiter">:(after "Begin <a href='042name.cc.html#L37'>transform_names</a> Ingredient Special-cases(ingredient, inst, caller)")</span> <span id="L37" class="LineNr"> 37 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='072recipe.cc.html#L47'>is_recipe_literal</a><span class="Delimiter">(</span>ingredient<span class="Delimiter">,</span> caller<span class="Delimiter">))</span> <span class="Delimiter">{</span> @@ -376,7 +376,7 @@ if ('onhashchange' in window) { <span id="L312" class="LineNr">312 </span><span class="Delimiter">:(before "End Matching Types For Literal(to)")</span> <span id="L313" class="LineNr">313 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='072recipe.cc.html#L277'>is_mu_recipe</a><span class="Delimiter">(</span>to<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L314" class="LineNr">314 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> from<span class="Delimiter">.</span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L315" class="LineNr">315 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"trying to store <a href='010vm.cc.html#L19'>recipe</a> "</span> << from<span class="Delimiter">.</span>name << <span class="Constant">" into "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>to<span class="Delimiter">)</span> << <span class="Constant">" but there's no such recipe</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L315" class="LineNr">315 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"trying to store <a href='010vm.cc.html#L19'>recipe</a> "</span> << from<span class="Delimiter">.</span>name << <span class="Constant">" into "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>to<span class="Delimiter">)</span> << <span class="Constant">" but there's no such recipe</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> <span id="L316" class="LineNr">316 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L317" class="LineNr">317 </span> <span class="Delimiter">}</span> <span id="L318" class="LineNr">318 </span> <span class="Normal">const</span> recipe& rrhs = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> from<span class="Delimiter">.</span>value<span class="Delimiter">);</span> diff --git a/html/073scheduler.cc.html b/html/073scheduler.cc.html index 094a8a8b..af9330ba 100644 --- a/html/073scheduler.cc.html +++ b/html/073scheduler.cc.html @@ -446,7 +446,7 @@ if ('onhashchange' in window) { <span id="L381" class="LineNr">381 </span><span class="traceContains">+error: f2: divide by zero in '3:num <- divide-with-remainder 4, 0'</span> <span id="L382" class="LineNr">382 </span><span class="traceAbsent">-error: f2: divide by zero in '4:num <- divide-with-remainder 4, 0'</span> <span id="L383" class="LineNr">383 </span> -<span id="L384" class="LineNr">384 </span><span class="Delimiter">:(after "operator<<(ostream& os, <a href='001help.cc.html#L258'>unused</a> end)")</span> +<span id="L384" class="LineNr">384 </span><span class="Delimiter">:(after "operator<<(ostream& os, <a href='001help.cc.html#L259'>unused</a> end)")</span> <span id="L385" class="LineNr">385 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream && Trace_stream<span class="Delimiter">-></span>curr_label == <span class="Constant">"error"</span> && Current_routine<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L386" class="LineNr">386 </span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>state = <a href='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> <span id="L387" class="LineNr">387 </span> <span class="Delimiter">}</span> diff --git a/html/074wait.cc.html b/html/074wait.cc.html index 661da8b1..945940f8 100644 --- a/html/074wait.cc.html +++ b/html/074wait.cc.html @@ -154,8 +154,8 @@ if ('onhashchange' in window) { <span id="L89" class="LineNr"> 89 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L90" class="LineNr"> 90 </span><span class="Normal">case</span> WAIT_FOR_RESET_THEN_SET: <span class="Delimiter">{</span> <span id="L91" class="LineNr"> 91 </span> <span class="Normal">int</span> loc = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> -<span id="L92" class="LineNr"> 92 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"wait: *"</span> << loc << <span class="Constant">" = "</span> << <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L93" class="LineNr"> 93 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L92" class="LineNr"> 92 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"wait: *"</span> << loc << <span class="Constant">" = "</span> << <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L93" class="LineNr"> 93 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L94" class="LineNr"> 94 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << loc << <span class="Constant">" is already 0; setting"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L95" class="LineNr"> 95 </span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> <span id="L96" class="LineNr"> 96 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -186,7 +186,7 @@ if ('onhashchange' in window) { <span id="L121" class="LineNr">121 </span><span class="Normal">case</span> RESET: <span class="Delimiter">{</span> <span id="L122" class="LineNr">122 </span> <span class="Normal">int</span> loc = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> <span id="L123" class="LineNr">123 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L124" class="LineNr">124 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"reset: *"</span> << loc << <span class="Constant">" = "</span> << <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L124" class="LineNr">124 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"reset: *"</span> << loc << <span class="Constant">" = "</span> << <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L125" class="LineNr">125 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L126" class="LineNr">126 </span><span class="Delimiter">}</span> <span id="L127" class="LineNr">127 </span> @@ -196,7 +196,7 @@ if ('onhashchange' in window) { <span id="L131" class="LineNr">131 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L132" class="LineNr">132 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state != WAITING<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L133" class="LineNr">133 </span> <span class="Normal">int</span> loc = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>waiting_on_location<span class="Delimiter">;</span> -<span id="L134" class="LineNr">134 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>loc && <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L134" class="LineNr">134 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>loc && <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L135" class="LineNr">135 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"schedule"</span><span class="Delimiter">)</span> << <span class="Constant">"waking up routine "</span> << Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>id << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L136" class="LineNr">136 </span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> <span id="L137" class="LineNr">137 </span> <span class="Conceal">¦</span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">;</span> diff --git a/html/075channel.mu.html b/html/075channel.mu.html index 91122080..c543311e 100644 --- a/html/075channel.mu.html +++ b/html/075channel.mu.html @@ -74,9 +74,9 @@ if ('onhashchange' in window) { <span id="L10" class="LineNr"> 10 </span><span class="Comment"># addresses from being shared between routines, and therefore eliminates all</span> <span id="L11" class="LineNr"> 11 </span><span class="Comment"># possibility of race conditions.</span> <span id="L12" class="LineNr"> 12 </span><span class="Comment">#</span> -<span id="L13" class="LineNr"> 13 </span><span class="Comment"># There's still a narrow window for race conditions: the ingredients passed in</span> +<span id="L13" class="LineNr"> 13 </span><span class="Comment"># There's still a narrow window for race conditions: the inputs passed in</span> <span id="L14" class="LineNr"> 14 </span><span class="Comment"># to 'start-running'. Pass only channels into routines and you should be fine.</span> -<span id="L15" class="LineNr"> 15 </span><span class="Comment"># Any other mutable ingredients will require locks.</span> +<span id="L15" class="LineNr"> 15 </span><span class="Comment"># Any other mutable inputs will require locks.</span> <span id="L16" class="LineNr"> 16 </span> <span id="L17" class="LineNr"> 17 </span><span class="muScenario">scenario</span> channel [ <span id="L18" class="LineNr"> 18 </span> run [ @@ -114,7 +114,7 @@ if ('onhashchange' in window) { <span id="L50" class="LineNr"> 50 </span> <span id="L51" class="LineNr"> 51 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L51'>new-channel</a> <a href='075channel.mu.html#L399'>capacity</a>:num<span class="muRecipe"> -> </span>in:&:<a href='075channel.mu.html#L43'>source</a>:_elem, out:&:<a href='075channel.mu.html#L47'>sink</a>:_elem [ <span id="L52" class="LineNr"> 52 </span> <span class="Constant">local-scope</span> -<span id="L53" class="LineNr"> 53 </span> <span class="Constant">load-ingredients</span> +<span id="L53" class="LineNr"> 53 </span> <span class="Constant">load-inputs</span> <span id="L54" class="LineNr"> 54 </span> result:&:channel:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(channel _elem): type<span class="Delimiter">}</span> <span id="L55" class="LineNr"> 55 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">first-full:offset</span>,<span class="Constant"> 0</span> <span id="L56" class="LineNr"> 56 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">first-free:offset</span>,<span class="Constant"> 0</span> @@ -130,7 +130,7 @@ if ('onhashchange' in window) { <span id="L66" class="LineNr"> 66 </span><span class="Comment"># write a value to a channel</span> <span id="L67" class="LineNr"> 67 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L67'>write</a> out:&:<a href='075channel.mu.html#L47'>sink</a>:_elem, val:_elem<span class="muRecipe"> -> </span>out:&:<a href='075channel.mu.html#L47'>sink</a>:_elem [ <span id="L68" class="LineNr"> 68 </span> <span class="Constant">local-scope</span> -<span id="L69" class="LineNr"> 69 </span> <span class="Constant">load-ingredients</span> +<span id="L69" class="LineNr"> 69 </span> <span class="Constant">load-inputs</span> <span id="L70" class="LineNr"> 70 </span> assert out, <span class="Constant">[write to null channel]</span> <span id="L71" class="LineNr"> 71 </span> chan:&:channel:_elem <span class="Special"><-</span> get *out, <span class="Constant">chan:offset</span> <span id="L72" class="LineNr"> 72 </span><span class="Constant"> <a href='075channel.mu.html#L72'><channel-write-initial></a></span> @@ -176,7 +176,7 @@ if ('onhashchange' in window) { <span id="L112" class="LineNr">112 </span><span class="Comment"># read a value from a channel</span> <span id="L113" class="LineNr">113 </span><span class="muRecipe">def</span> read in:&:<a href='075channel.mu.html#L43'>source</a>:_elem<span class="muRecipe"> -> </span>result:_elem, eof?:bool, in:&:<a href='075channel.mu.html#L43'>source</a>:_elem [ <span id="L114" class="LineNr">114 </span> <span class="Constant">local-scope</span> -<span id="L115" class="LineNr">115 </span> <span class="Constant">load-ingredients</span> +<span id="L115" class="LineNr">115 </span> <span class="Constant">load-inputs</span> <span id="L116" class="LineNr">116 </span> assert in, <span class="Constant">[read on null channel]</span> <span id="L117" class="LineNr">117 </span> eof? <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span class="Comment"># default result</span> <span id="L118" class="LineNr">118 </span> chan:&:channel:_elem <span class="Special"><-</span> get *in, <span class="Constant">chan:offset</span> @@ -375,7 +375,7 @@ if ('onhashchange' in window) { <span id="L311" class="LineNr">311 </span> <span id="L312" class="LineNr">312 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L312'>clear</a> in:&:<a href='075channel.mu.html#L43'>source</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='075channel.mu.html#L43'>source</a>:_elem [ <span id="L313" class="LineNr">313 </span> <span class="Constant">local-scope</span> -<span id="L314" class="LineNr">314 </span> <span class="Constant">load-ingredients</span> +<span id="L314" class="LineNr">314 </span> <span class="Constant">load-inputs</span> <span id="L315" class="LineNr">315 </span> chan:&:channel:_elem <span class="Special"><-</span> get *in, <span class="Constant">chan:offset</span> <span id="L316" class="LineNr">316 </span> <span class="Delimiter">{</span> <span id="L317" class="LineNr">317 </span> <span class="Conceal">¦</span> empty?:bool <span class="Special"><-</span> <a href='075channel.mu.html#L370'>channel-empty?</a> chan @@ -397,13 +397,13 @@ if ('onhashchange' in window) { <span id="L333" class="LineNr">333 </span><span class="Comment"># both routines can modify the 'closed?' bit, but they can only ever set it, so this is a benign race</span> <span id="L334" class="LineNr">334 </span><span class="muRecipe">def</span> close x:&:<a href='075channel.mu.html#L43'>source</a>:_elem<span class="muRecipe"> -> </span>x:&:<a href='075channel.mu.html#L43'>source</a>:_elem [ <span id="L335" class="LineNr">335 </span> <span class="Constant">local-scope</span> -<span id="L336" class="LineNr">336 </span> <span class="Constant">load-ingredients</span> +<span id="L336" class="LineNr">336 </span> <span class="Constant">load-inputs</span> <span id="L337" class="LineNr">337 </span> chan:&:channel:_elem <span class="Special"><-</span> get *x, <span class="Constant">chan:offset</span> <span id="L338" class="LineNr">338 </span> *chan <span class="Special"><-</span> put *chan, <span class="Constant">closed?:offset</span>, <span class="Constant">1/true</span> <span id="L339" class="LineNr">339 </span>] <span id="L340" class="LineNr">340 </span><span class="muRecipe">def</span> close x:&:<a href='075channel.mu.html#L47'>sink</a>:_elem<span class="muRecipe"> -> </span>x:&:<a href='075channel.mu.html#L47'>sink</a>:_elem [ <span id="L341" class="LineNr">341 </span> <span class="Constant">local-scope</span> -<span id="L342" class="LineNr">342 </span> <span class="Constant">load-ingredients</span> +<span id="L342" class="LineNr">342 </span> <span class="Constant">load-inputs</span> <span id="L343" class="LineNr">343 </span> chan:&:channel:_elem <span class="Special"><-</span> get *x, <span class="Constant">chan:offset</span> <span id="L344" class="LineNr">344 </span> *chan <span class="Special"><-</span> put *chan, <span class="Constant">closed?:offset</span>, <span class="Constant">1/true</span> <span id="L345" class="LineNr">345 </span>] @@ -433,7 +433,7 @@ if ('onhashchange' in window) { <span id="L369" class="LineNr">369 </span><span class="Comment"># An empty channel has first-free and first-full both at the same value.</span> <span id="L370" class="LineNr">370 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L370'>channel-empty?</a> chan:&:channel:_elem<span class="muRecipe"> -> </span>result:bool [ <span id="L371" class="LineNr">371 </span> <span class="Constant">local-scope</span> -<span id="L372" class="LineNr">372 </span> <span class="Constant">load-ingredients</span> +<span id="L372" class="LineNr">372 </span> <span class="Constant">load-inputs</span> <span id="L373" class="LineNr">373 </span> <span class="Comment"># return chan.first-full == chan.first-free</span> <span id="L374" class="LineNr">374 </span> full:num <span class="Special"><-</span> get *chan, <span class="Constant">first-full:offset</span> <span id="L375" class="LineNr">375 </span> free:num <span class="Special"><-</span> get *chan, <span class="Constant">first-free:offset</span> @@ -444,7 +444,7 @@ if ('onhashchange' in window) { <span id="L380" class="LineNr">380 </span><span class="Comment"># (Other alternatives: <a href="https://www.snellman.net/blog/archive/2016-12-13-ring-buffers">https://www.snellman.net/blog/archive/2016-12-13-ring-buffers</a>)</span> <span id="L381" class="LineNr">381 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L381'>channel-full?</a> chan:&:channel:_elem<span class="muRecipe"> -> </span>result:bool [ <span id="L382" class="LineNr">382 </span> <span class="Constant">local-scope</span> -<span id="L383" class="LineNr">383 </span> <span class="Constant">load-ingredients</span> +<span id="L383" class="LineNr">383 </span> <span class="Constant">load-inputs</span> <span id="L384" class="LineNr">384 </span> <span class="Comment"># tmp = chan.first-free + 1</span> <span id="L385" class="LineNr">385 </span> tmp:num <span class="Special"><-</span> get *chan, <span class="Constant">first-free:offset</span> <span id="L386" class="LineNr">386 </span> tmp <span class="Special"><-</span> add tmp,<span class="Constant"> 1</span> @@ -462,7 +462,7 @@ if ('onhashchange' in window) { <span id="L398" class="LineNr">398 </span> <span id="L399" class="LineNr">399 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L399'>capacity</a> chan:&:channel:_elem<span class="muRecipe"> -> </span>result:num [ <span id="L400" class="LineNr">400 </span> <span class="Constant">local-scope</span> -<span id="L401" class="LineNr">401 </span> <span class="Constant">load-ingredients</span> +<span id="L401" class="LineNr">401 </span> <span class="Constant">load-inputs</span> <span id="L402" class="LineNr">402 </span> q:&:@:_elem <span class="Special"><-</span> get *chan, <span class="Constant">data:offset</span> <span id="L403" class="LineNr">403 </span> result <span class="Special"><-</span> length *q <span id="L404" class="LineNr">404 </span>] @@ -471,7 +471,7 @@ if ('onhashchange' in window) { <span id="L407" class="LineNr">407 </span> <span id="L408" class="LineNr">408 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L408'>buffer-lines</a> in:&:<a href='075channel.mu.html#L43'>source</a>:char, buffered-out:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span>buffered-out:&:<a href='075channel.mu.html#L47'>sink</a>:char, in:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L409" class="LineNr">409 </span> <span class="Constant">local-scope</span> -<span id="L410" class="LineNr">410 </span> <span class="Constant">load-ingredients</span> +<span id="L410" class="LineNr">410 </span> <span class="Constant">load-inputs</span> <span id="L411" class="LineNr">411 </span> <span class="Comment"># repeat forever</span> <span id="L412" class="LineNr">412 </span> eof?:bool <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L413" class="LineNr">413 </span> <span class="Delimiter">{</span> @@ -570,7 +570,7 @@ if ('onhashchange' in window) { <span id="L506" class="LineNr">506 </span> <span id="L507" class="LineNr">507 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L507'>drain</a> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char<span class="muRecipe"> -> </span>result:text, <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L508" class="LineNr">508 </span> <span class="Constant">local-scope</span> -<span id="L509" class="LineNr">509 </span> <span class="Constant">load-ingredients</span> +<span id="L509" class="LineNr">509 </span> <span class="Constant">load-inputs</span> <span id="L510" class="LineNr">510 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 30</span> <span id="L511" class="LineNr">511 </span> <span class="Delimiter">{</span> <span id="L512" class="LineNr">512 </span> <span class="Conceal">¦</span> c:char, done?:bool <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> diff --git a/html/076continuation.cc.html b/html/076continuation.cc.html index c95bd2af..ee34e992 100644 --- a/html/076continuation.cc.html +++ b/html/076continuation.cc.html @@ -204,191 +204,221 @@ if ('onhashchange' in window) { <span id="L140" class="LineNr">140 </span><span class="Comment">//: save the slice of current call stack until the 'call-with-continuation-mark'</span> <span id="L141" class="LineNr">141 </span><span class="Comment">//: call, and return it as the result.</span> <span id="L142" class="LineNr">142 </span><span class="Comment">//: todo: implement delimited continuations in Mu's memory</span> -<span id="L143" class="LineNr">143 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L144" class="LineNr">144 </span>map<<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span><span class="Delimiter">,</span> call_stack> Delimited_continuation<span class="Delimiter">;</span> -<span id="L145" class="LineNr">145 </span><span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> Next_delimited_continuation_id = <span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// 0 is null just like an address</span> -<span id="L146" class="LineNr">146 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L147" class="LineNr">147 </span>Delimited_continuation<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L148" class="LineNr">148 </span>Next_delimited_continuation_id = <span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L149" class="LineNr">149 </span> -<span id="L150" class="LineNr">150 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> -<span id="L151" class="LineNr">151 </span>RETURN_CONTINUATION_UNTIL_MARK<span class="Delimiter">,</span> -<span id="L152" class="LineNr">152 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L153" class="LineNr">153 </span>Recipe_ordinal[<span class="Constant">"return-continuation-until-mark"</span>] = RETURN_CONTINUATION_UNTIL_MARK<span class="Delimiter">;</span> -<span id="L154" class="LineNr">154 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> -<span id="L155" class="LineNr">155 </span><span class="Normal">case</span> RETURN_CONTINUATION_UNTIL_MARK: <span class="Delimiter">{</span> -<span id="L156" class="LineNr">156 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L157" class="LineNr">157 </span><span class="Delimiter">}</span> -<span id="L158" class="LineNr">158 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -<span id="L159" class="LineNr">159 </span><span class="Normal">case</span> RETURN_CONTINUATION_UNTIL_MARK: <span class="Delimiter">{</span> -<span id="L160" class="LineNr">160 </span> <span class="Comment">// first clear any existing ingredients, to isolate the creation of the</span> -<span id="L161" class="LineNr">161 </span> <span class="Comment">// continuation from its calls</span> -<span id="L162" class="LineNr">162 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L163" class="LineNr">163 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>next_ingredient_to_process = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L164" class="LineNr">164 </span> <span class="Comment">// copy the current call stack until the most recent marked call</span> -<span id="L165" class="LineNr">165 </span> call_stack::iterator find_base_of_continuation<span class="Delimiter">(</span>call_stack& c<span class="Delimiter">);</span> <span class="Comment">// manual prototype containing '::'</span> -<span id="L166" class="LineNr">166 </span> call_stack::iterator base = find_base_of_continuation<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">);</span> -<span id="L167" class="LineNr">167 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base == Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L168" class="LineNr">168 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't find a 'call-with-continuation-mark' to return to</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> -<span id="L169" class="LineNr">169 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"call stack:</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L170" class="LineNr">170 </span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::iterator p = Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> -<span id="L171" class="LineNr">171 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">" "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L172" class="LineNr">172 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L173" class="LineNr">173 </span> <span class="Delimiter">}</span> -<span id="L174" class="LineNr">174 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"creating continuation "</span> << Next_delimited_continuation_id << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L175" class="LineNr">175 </span> Delimited_continuation[Next_delimited_continuation_id] = call_stack<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> base<span class="Delimiter">);</span> -<span id="L176" class="LineNr">176 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">()</span> != base<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L177" class="LineNr">177 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L178" class="LineNr">178 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> --Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L179" class="LineNr">179 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth >= <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L180" class="LineNr">180 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L181" class="LineNr">181 </span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> -<span id="L182" class="LineNr">182 </span> <span class="Delimiter">}</span> -<span id="L183" class="LineNr">183 </span> <span class="Comment">// return it as the result of the marked call</span> -<span id="L184" class="LineNr">184 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L185" class="LineNr">185 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>Next_delimited_continuation_id<span class="Delimiter">);</span> -<span id="L186" class="LineNr">186 </span> <span class="Comment">// return any other ingredients passed in</span> -<span id="L187" class="LineNr">187 </span> copy<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> ingredients<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>products<span class="Delimiter">,</span> products<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">()));</span> -<span id="L188" class="LineNr">188 </span> ++Next_delimited_continuation_id<span class="Delimiter">;</span> -<span id="L189" class="LineNr">189 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// continue to process rest of marked call</span> -<span id="L190" class="LineNr">190 </span><span class="Delimiter">}</span> -<span id="L191" class="LineNr">191 </span> -<span id="L192" class="LineNr">192 </span><span class="Delimiter">:(code)</span> -<span id="L193" class="LineNr">193 </span>call_stack::iterator find_base_of_continuation<span class="Delimiter">(</span>call_stack& c<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L194" class="LineNr">194 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::iterator p = c<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != c<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> -<span id="L195" class="LineNr">195 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>p<span class="Delimiter">-></span>is_base_of_continuation<span class="Delimiter">)</span> <span class="Identifier">return</span> p<span class="Delimiter">;</span> -<span id="L196" class="LineNr">196 </span> <span class="Identifier">return</span> c<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L197" class="LineNr">197 </span><span class="Delimiter">}</span> -<span id="L198" class="LineNr">198 </span> -<span id="L199" class="LineNr">199 </span><span class="Comment">//: overload 'call' for continuations</span> -<span id="L200" class="LineNr">200 </span><span class="Delimiter">:(after "Begin Call")</span> -<span id="L201" class="LineNr">201 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>type<span class="Delimiter">-></span>atom -<span id="L202" class="LineNr">202 </span> <span class="Conceal">¦</span> && <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>type<span class="Delimiter">-></span>name == <span class="Constant">"continuation"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L203" class="LineNr">203 </span> <span class="Comment">// copy multiple calls on to current call stack</span> -<span id="L204" class="LineNr">204 </span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> -<span id="L205" class="LineNr">205 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"calling continuation "</span> << ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L206" class="LineNr">206 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">.</span>find<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> == Delimited_continuation<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">())</span> -<span id="L207" class="LineNr">207 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"no such delimited continuation "</span> << <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L208" class="LineNr">208 </span> <span class="Normal">const</span> call_stack& new_calls = Delimited_continuation[ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span>]<span class="Delimiter">;</span> -<span id="L209" class="LineNr">209 </span> <span class="Normal">const</span> call& caller = <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>new_calls<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> ? *++new_calls<span class="Delimiter">.</span>begin<span class="Delimiter">()</span> : Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">();</span> -<span id="L210" class="LineNr">210 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_reverse_iterator p = new_calls<span class="Delimiter">.</span>rbegin<span class="Delimiter">();</span> p != new_calls<span class="Delimiter">.</span>rend<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L211" class="LineNr">211 </span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>*p<span class="Delimiter">);</span> -<span id="L212" class="LineNr">212 </span> <span class="Conceal">¦</span> <span class="Comment">// ensure that the presence of a continuation keeps its stack frames from being reclaimed</span> -<span id="L213" class="LineNr">213 </span> <span class="Conceal">¦</span> <span class="Normal">int</span> space_address = Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>default_space<span class="Delimiter">;</span> -<span id="L214" class="LineNr">214 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>space_address != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L215" class="LineNr">215 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">int</span> refcount = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> space_address<span class="Delimiter">);</span> -<span id="L216" class="LineNr">216 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"incrementing refcount of "</span> << space_address << <span class="Constant">": "</span> << refcount << <span class="Constant">" -> "</span> << refcount+<span class="Constant">1</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L217" class="LineNr">217 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> space_address<span class="Delimiter">,</span> refcount+<span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L218" class="LineNr">218 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L219" class="LineNr">219 </span> <span class="Delimiter">}</span> -<span id="L220" class="LineNr">220 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L221" class="LineNr">221 </span> <span class="Conceal">¦</span> Trace_stream<span class="Delimiter">-></span>callstack_depth += <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>new_calls<span class="Delimiter">);</span> -<span id="L222" class="LineNr">222 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"calling delimited continuation; growing callstack depth to "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L223" class="LineNr">223 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> -<span id="L224" class="LineNr">224 </span> <span class="Delimiter">}</span> -<span id="L225" class="LineNr">225 </span> ingredients<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">());</span> <span class="Comment">// drop the callee</span> -<span id="L226" class="LineNr">226 </span> finish_call_housekeeping<span class="Delimiter">(</span><a href='026call.cc.html#L86'>to_instruction</a><span class="Delimiter">(</span>caller<span class="Delimiter">),</span> ingredients<span class="Delimiter">);</span> -<span id="L227" class="LineNr">227 </span> copy<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> ingredients<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>products<span class="Delimiter">,</span> products<span class="Delimiter">.</span>begin<span class="Delimiter">()));</span> -<span id="L228" class="LineNr">228 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// record results of resuming 'return-continuation-until-mark' instruction</span> -<span id="L229" class="LineNr">229 </span><span class="Delimiter">}</span> -<span id="L230" class="LineNr">230 </span> -<span id="L231" class="LineNr">231 </span><span class="Comment">//: Ensure that the presence of a continuation keeps its stack frames from being reclaimed.</span> -<span id="L232" class="LineNr">232 </span> -<span id="L233" class="LineNr">233 </span><span class="Delimiter">:(scenario continuations_preserve_local_scopes)</span> -<span id="L234" class="LineNr">234 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L143" class="LineNr">143 </span><span class="Delimiter">:(before "End Types")</span> +<span id="L144" class="LineNr">144 </span><span class="Normal">struct</span> delimited_continuation <span class="Delimiter">{</span> +<span id="L145" class="LineNr">145 </span> call_stack frames<span class="Delimiter">;</span> +<span id="L146" class="LineNr">146 </span> <span class="Normal">int</span> nrefs<span class="Delimiter">;</span> +<span id="L147" class="LineNr">147 </span> delimited_continuation<span class="Delimiter">(</span>call_stack::iterator begin<span class="Delimiter">,</span> call_stack::iterator <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">)</span> :frames<span class="Delimiter">(</span>call_stack<span class="Delimiter">(</span>begin<span class="Delimiter">,</span> <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">)),</span> nrefs<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{}</span> +<span id="L148" class="LineNr">148 </span><span class="Delimiter">};</span> +<span id="L149" class="LineNr">149 </span><span class="Delimiter">:(before "End Globals")</span> +<span id="L150" class="LineNr">150 </span>map<<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span><span class="Delimiter">,</span> delimited_continuation> Delimited_continuation<span class="Delimiter">;</span> +<span id="L151" class="LineNr">151 </span><span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> Next_delimited_continuation_id = <span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// 0 is null just like an address</span> +<span id="L152" class="LineNr">152 </span><span class="Delimiter">:(before "End Reset")</span> +<span id="L153" class="LineNr">153 </span>Delimited_continuation<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L154" class="LineNr">154 </span>Next_delimited_continuation_id = <span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L155" class="LineNr">155 </span> +<span id="L156" class="LineNr">156 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +<span id="L157" class="LineNr">157 </span>RETURN_CONTINUATION_UNTIL_MARK<span class="Delimiter">,</span> +<span id="L158" class="LineNr">158 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +<span id="L159" class="LineNr">159 </span>Recipe_ordinal[<span class="Constant">"return-continuation-until-mark"</span>] = RETURN_CONTINUATION_UNTIL_MARK<span class="Delimiter">;</span> +<span id="L160" class="LineNr">160 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> +<span id="L161" class="LineNr">161 </span><span class="Normal">case</span> RETURN_CONTINUATION_UNTIL_MARK: <span class="Delimiter">{</span> +<span id="L162" class="LineNr">162 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L163" class="LineNr">163 </span><span class="Delimiter">}</span> +<span id="L164" class="LineNr">164 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +<span id="L165" class="LineNr">165 </span><span class="Normal">case</span> RETURN_CONTINUATION_UNTIL_MARK: <span class="Delimiter">{</span> +<span id="L166" class="LineNr">166 </span> <span class="Comment">// first clear any existing ingredients, to isolate the creation of the</span> +<span id="L167" class="LineNr">167 </span> <span class="Comment">// continuation from its calls</span> +<span id="L168" class="LineNr">168 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L169" class="LineNr">169 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>next_ingredient_to_process = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L170" class="LineNr">170 </span> <span class="Comment">// copy the current call stack until the most recent marked call</span> +<span id="L171" class="LineNr">171 </span> call_stack::iterator find_base_of_continuation<span class="Delimiter">(</span>call_stack& c<span class="Delimiter">);</span> <span class="Comment">// manual prototype containing '::'</span> +<span id="L172" class="LineNr">172 </span> call_stack::iterator base = find_base_of_continuation<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">);</span> +<span id="L173" class="LineNr">173 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base == Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> +<span id="L174" class="LineNr">174 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't find a 'call-with-continuation-mark' to return to</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L175" class="LineNr">175 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"call stack:</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L176" class="LineNr">176 </span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::iterator p = Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> +<span id="L177" class="LineNr">177 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">" "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L178" class="LineNr">178 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L179" class="LineNr">179 </span> <span class="Delimiter">}</span> +<span id="L180" class="LineNr">180 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"creating continuation "</span> << Next_delimited_continuation_id << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L181" class="LineNr">181 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">,</span> Next_delimited_continuation_id<span class="Delimiter">,</span> delimited_continuation<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> base<span class="Delimiter">));</span> +<span id="L182" class="LineNr">182 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">()</span> != base<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L183" class="LineNr">183 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L184" class="LineNr">184 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> --Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L185" class="LineNr">185 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth >= <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L186" class="LineNr">186 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L187" class="LineNr">187 </span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> +<span id="L188" class="LineNr">188 </span> <span class="Delimiter">}</span> +<span id="L189" class="LineNr">189 </span> <span class="Comment">// return it as the result of the marked call</span> +<span id="L190" class="LineNr">190 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L191" class="LineNr">191 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>Next_delimited_continuation_id<span class="Delimiter">);</span> +<span id="L192" class="LineNr">192 </span> <span class="Comment">// return any other ingredients passed in</span> +<span id="L193" class="LineNr">193 </span> copy<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> ingredients<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>products<span class="Delimiter">,</span> products<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">()));</span> +<span id="L194" class="LineNr">194 </span> ++Next_delimited_continuation_id<span class="Delimiter">;</span> +<span id="L195" class="LineNr">195 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// continue to process rest of marked call</span> +<span id="L196" class="LineNr">196 </span><span class="Delimiter">}</span> +<span id="L197" class="LineNr">197 </span> +<span id="L198" class="LineNr">198 </span><span class="Delimiter">:(code)</span> +<span id="L199" class="LineNr">199 </span>call_stack::iterator find_base_of_continuation<span class="Delimiter">(</span>call_stack& c<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L200" class="LineNr">200 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::iterator p = c<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != c<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> +<span id="L201" class="LineNr">201 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>p<span class="Delimiter">-></span>is_base_of_continuation<span class="Delimiter">)</span> <span class="Identifier">return</span> p<span class="Delimiter">;</span> +<span id="L202" class="LineNr">202 </span> <span class="Identifier">return</span> c<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L203" class="LineNr">203 </span><span class="Delimiter">}</span> +<span id="L204" class="LineNr">204 </span> +<span id="L205" class="LineNr">205 </span><span class="Comment">//: overload 'call' for continuations</span> +<span id="L206" class="LineNr">206 </span><span class="Delimiter">:(after "Begin Call")</span> +<span id="L207" class="LineNr">207 </span><span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_continuation<span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L208" class="LineNr">208 </span> <span class="Comment">// copy multiple calls on to current call stack</span> +<span id="L209" class="LineNr">209 </span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> +<span id="L210" class="LineNr">210 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"calling continuation "</span> << ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L211" class="LineNr">211 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> +<span id="L212" class="LineNr">212 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"no such delimited continuation "</span> << <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L213" class="LineNr">213 </span> <span class="Normal">const</span> call_stack& new_frames = get<span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)).</span>frames<span class="Delimiter">;</span> +<span id="L214" class="LineNr">214 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_reverse_iterator p = new_frames<span class="Delimiter">.</span>rbegin<span class="Delimiter">();</span> p != new_frames<span class="Delimiter">.</span>rend<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L215" class="LineNr">215 </span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>*p<span class="Delimiter">);</span> +<span id="L216" class="LineNr">216 </span> <span class="Conceal">¦</span> <span class="Comment">// ensure that the presence of a continuation keeps its stack frames from being reclaimed</span> +<span id="L217" class="LineNr">217 </span> <span class="Conceal">¦</span> <a href='036refcount.cc.html#L50'>increment_refcount</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>default_space<span class="Delimiter">);</span> +<span id="L218" class="LineNr">218 </span> <span class="Delimiter">}</span> +<span id="L219" class="LineNr">219 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L220" class="LineNr">220 </span> <span class="Conceal">¦</span> Trace_stream<span class="Delimiter">-></span>callstack_depth += <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>new_frames<span class="Delimiter">);</span> +<span id="L221" class="LineNr">221 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"calling delimited continuation; growing callstack depth to "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L222" class="LineNr">222 </span> <span class="Conceal">¦</span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> +<span id="L223" class="LineNr">223 </span> <span class="Delimiter">}</span> +<span id="L224" class="LineNr">224 </span> <span class="Comment">// no call housekeeping; continuations don't support next-ingredient</span> +<span id="L225" class="LineNr">225 </span> copy<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">drop continuation</span><span class="Comment">*/</span>++ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> ingredients<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>products<span class="Delimiter">,</span> products<span class="Delimiter">.</span>begin<span class="Delimiter">()));</span> +<span id="L226" class="LineNr">226 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// record results of resuming 'return-continuation-until-mark' instruction</span> +<span id="L227" class="LineNr">227 </span><span class="Delimiter">}</span> +<span id="L228" class="LineNr">228 </span> +<span id="L229" class="LineNr">229 </span><span class="Delimiter">:(scenario continuations_can_return_values)</span> +<span id="L230" class="LineNr">230 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L231" class="LineNr">231 </span> local-scope +<span id="L232" class="LineNr">232 </span> <span class="Normal">k</span>:continuation<span class="Delimiter">,</span> <span class="Constant">1</span>:num/<span class="Special">raw <- </span>call-with-continuation-mark f +<span id="L233" class="LineNr">233 </span>] +<span id="L234" class="LineNr">234 </span><span class="muRecipe">def</span> f [ <span id="L235" class="LineNr">235 </span> local-scope -<span id="L236" class="LineNr">236 </span> <span class="Normal">k</span>:continuation<span class="Special"> <- </span>call-with-continuation-mark f -<span id="L237" class="LineNr">237 </span> call k -<span id="L238" class="LineNr">238 </span> <span class="Identifier">return</span> <span class="Constant">34</span> -<span id="L239" class="LineNr">239 </span>] -<span id="L240" class="LineNr">240 </span><span class="muRecipe">def</span> f [ -<span id="L241" class="LineNr">241 </span> local-scope -<span id="L242" class="LineNr">242 </span> g -<span id="L243" class="LineNr">243 </span>] -<span id="L244" class="LineNr">244 </span><span class="muRecipe">def</span> g [ -<span id="L245" class="LineNr">245 </span> local-scope -<span id="L246" class="LineNr">246 </span> <span class="Identifier">return</span>-continuation-until-mark -<span id="L247" class="LineNr">247 </span> add <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">1</span> -<span id="L248" class="LineNr">248 </span>] -<span id="L249" class="LineNr">249 </span><span class="Comment"># entering main</span> -<span id="L250" class="LineNr">250 </span><span class="traceContains">+mem: new alloc: 1000</span> -<span id="L251" class="LineNr">251 </span><span class="traceContains">+run: {k: "continuation"} <- call-with-continuation-mark {f: "recipe-literal"}</span> -<span id="L252" class="LineNr">252 </span><span class="Comment"># entering f</span> -<span id="L253" class="LineNr">253 </span><span class="traceContains">+mem: new alloc: 1004</span> -<span id="L254" class="LineNr">254 </span><span class="Comment"># entering g</span> -<span id="L255" class="LineNr">255 </span><span class="traceContains">+mem: new alloc: 1007</span> -<span id="L256" class="LineNr">256 </span><span class="Comment"># return control to main</span> -<span id="L257" class="LineNr">257 </span><span class="traceContains">+run: return-continuation-until-mark</span> -<span id="L258" class="LineNr">258 </span><span class="Comment"># no allocs abandoned yet</span> -<span id="L259" class="LineNr">259 </span><span class="Comment"># finish running main</span> -<span id="L260" class="LineNr">260 </span><span class="traceContains">+run: call {k: "continuation"}</span> -<span id="L261" class="LineNr">261 </span><span class="traceContains">+run: add {1: "literal"}, {1: "literal"}</span> -<span id="L262" class="LineNr">262 </span><span class="traceContains">+run: return {34: "literal"}</span> -<span id="L263" class="LineNr">263 </span><span class="Comment"># now k is reclaimed</span> -<span id="L264" class="LineNr">264 </span><span class="traceContains">+mem: trying to reclaim local k:continuation</span> -<span id="L265" class="LineNr">265 </span><span class="Comment"># at this point all allocs in the continuation are abandoned</span> -<span id="L266" class="LineNr">266 </span><span class="traceContains">+mem: automatically abandoning 1007</span> -<span id="L267" class="LineNr">267 </span><span class="traceContains">+mem: automatically abandoning 1004</span> -<span id="L268" class="LineNr">268 </span><span class="Comment"># finally the alloc for main is abandoned</span> -<span id="L269" class="LineNr">269 </span><span class="traceContains">+mem: automatically abandoning 1000</span> -<span id="L270" class="LineNr">270 </span> -<span id="L271" class="LineNr">271 </span><span class="Delimiter">:(after "Begin Decrement Refcounts(canonized_x)")</span> -<span id="L272" class="LineNr">272 </span><span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_continuation<span class="Delimiter">(</span>canonized_x<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L273" class="LineNr">273 </span> <span class="Normal">int</span> continuation_id = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> canonized_x<span class="Delimiter">.</span>value<span class="Delimiter">);</span> -<span id="L274" class="LineNr">274 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"reclaiming continuation "</span> << continuation_id << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L275" class="LineNr">275 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>continuation_id == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L276" class="LineNr">276 </span> <span class="Normal">const</span> call_stack& continuation_calls = get<span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">,</span> continuation_id<span class="Delimiter">);</span> -<span id="L277" class="LineNr">277 </span> <span class="Comment">// temporarily push the stack frames for the continuation one last time on to the call stack</span> -<span id="L278" class="LineNr">278 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_reverse_iterator p = continuation_calls<span class="Delimiter">.</span>rbegin<span class="Delimiter">();</span> p != continuation_calls<span class="Delimiter">.</span>rend<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> -<span id="L279" class="LineNr">279 </span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>*p<span class="Delimiter">);</span> -<span id="L280" class="LineNr">280 </span> <span class="Comment">// reclaim their spaces while popping them</span> -<span id="L281" class="LineNr">281 </span> <span class="Comment">// (because reclaim_default_space() relies on the default-space being reclaimed being at the top of the stack)</span> -<span id="L282" class="LineNr">282 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_iterator p = continuation_calls<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != continuation_calls<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L283" class="LineNr">283 </span> <span class="Conceal">¦</span> <a href='043space.cc.html#L244'>reclaim_default_space</a><span class="Delimiter">();</span> -<span id="L284" class="LineNr">284 </span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> -<span id="L285" class="LineNr">285 </span> <span class="Delimiter">}</span> -<span id="L286" class="LineNr">286 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L287" class="LineNr">287 </span><span class="Delimiter">}</span> -<span id="L288" class="LineNr">288 </span> -<span id="L289" class="LineNr">289 </span><span class="Delimiter">:(code)</span> -<span id="L290" class="LineNr">290 </span><span class="Normal">bool</span> is_mu_continuation<span class="Delimiter">(</span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> x<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L291" class="LineNr">291 </span> canonize_type<span class="Delimiter">(</span>x<span class="Delimiter">);</span> -<span id="L292" class="LineNr">292 </span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>type && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"continuation"</span><span class="Delimiter">);</span> -<span id="L293" class="LineNr">293 </span><span class="Delimiter">}</span> -<span id="L294" class="LineNr">294 </span> -<span id="L295" class="LineNr">295 </span><span class="Delimiter">:(scenario continuations_can_return_values)</span> -<span id="L296" class="LineNr">296 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L297" class="LineNr">297 </span> local-scope -<span id="L298" class="LineNr">298 </span> <span class="Normal">k</span>:continuation<span class="Delimiter">,</span> <span class="Constant">1</span>:num/<span class="Special">raw <- </span>call-with-continuation-mark f -<span id="L299" class="LineNr">299 </span>] -<span id="L300" class="LineNr">300 </span><span class="muRecipe">def</span> f [ -<span id="L301" class="LineNr">301 </span> local-scope -<span id="L302" class="LineNr">302 </span> g -<span id="L303" class="LineNr">303 </span>] -<span id="L304" class="LineNr">304 </span><span class="muRecipe">def</span> g [ -<span id="L305" class="LineNr">305 </span> local-scope -<span id="L306" class="LineNr">306 </span> <span class="Identifier">return</span>-continuation-until-mark <span class="Constant">34</span> -<span id="L307" class="LineNr">307 </span> stash [continuation called] -<span id="L308" class="LineNr">308 </span>] -<span id="L309" class="LineNr">309 </span><span class="Comment"># entering main</span> -<span id="L310" class="LineNr">310 </span><span class="traceContains">+mem: new alloc: 1000</span> -<span id="L311" class="LineNr">311 </span><span class="traceContains">+run: {k: "continuation"}, {1: "number", "raw": ()} <- call-with-continuation-mark {f: "recipe-literal"}</span> -<span id="L312" class="LineNr">312 </span><span class="Comment"># entering f</span> -<span id="L313" class="LineNr">313 </span><span class="traceContains">+mem: new alloc: 1004</span> -<span id="L314" class="LineNr">314 </span><span class="Comment"># entering g</span> -<span id="L315" class="LineNr">315 </span><span class="traceContains">+mem: new alloc: 1007</span> -<span id="L316" class="LineNr">316 </span><span class="Comment"># return control to main</span> -<span id="L317" class="LineNr">317 </span><span class="traceContains">+run: return-continuation-until-mark {34: "literal"}</span> -<span id="L318" class="LineNr">318 </span><span class="Comment"># no allocs abandoned yet</span> -<span id="L319" class="LineNr">319 </span><span class="traceContains">+mem: storing 34 in location 1</span> -<span id="L320" class="LineNr">320 </span><span class="Comment"># end of main</span> -<span id="L321" class="LineNr">321 </span><span class="Comment"># make sure no memory leaks..</span> -<span id="L322" class="LineNr">322 </span><span class="traceContains">+mem: trying to reclaim local k:continuation</span> -<span id="L323" class="LineNr">323 </span><span class="traceContains">+mem: automatically abandoning 1007</span> -<span id="L324" class="LineNr">324 </span><span class="traceContains">+mem: automatically abandoning 1004</span> -<span id="L325" class="LineNr">325 </span><span class="traceContains">+mem: automatically abandoning 1000</span> -<span id="L326" class="LineNr">326 </span><span class="Comment"># ..even though we never called the continuation</span> -<span id="L327" class="LineNr">327 </span><span class="traceAbsent">-app: continuation called</span> +<span id="L236" class="LineNr">236 </span> g +<span id="L237" class="LineNr">237 </span>] +<span id="L238" class="LineNr">238 </span><span class="muRecipe">def</span> g [ +<span id="L239" class="LineNr">239 </span> local-scope +<span id="L240" class="LineNr">240 </span> <span class="Identifier">return</span>-continuation-until-mark <span class="Constant">34</span> +<span id="L241" class="LineNr">241 </span> stash [continuation called] +<span id="L242" class="LineNr">242 </span>] +<span id="L243" class="LineNr">243 </span><span class="Comment"># entering main</span> +<span id="L244" class="LineNr">244 </span><span class="traceContains">+mem: new alloc: 1000</span> +<span id="L245" class="LineNr">245 </span><span class="traceContains">+run: {k: "continuation"}, {1: "number", "raw": ()} <- call-with-continuation-mark {f: "recipe-literal"}</span> +<span id="L246" class="LineNr">246 </span><span class="Comment"># entering f</span> +<span id="L247" class="LineNr">247 </span><span class="traceContains">+mem: new alloc: 1004</span> +<span id="L248" class="LineNr">248 </span><span class="Comment"># entering g</span> +<span id="L249" class="LineNr">249 </span><span class="traceContains">+mem: new alloc: 1007</span> +<span id="L250" class="LineNr">250 </span><span class="Comment"># return control to main</span> +<span id="L251" class="LineNr">251 </span><span class="traceContains">+run: return-continuation-until-mark {34: "literal"}</span> +<span id="L252" class="LineNr">252 </span><span class="Comment"># no allocs abandoned yet</span> +<span id="L253" class="LineNr">253 </span><span class="traceContains">+mem: storing 34 in location 1</span> +<span id="L254" class="LineNr">254 </span><span class="Comment"># end of main</span> +<span id="L255" class="LineNr">255 </span><span class="Comment"># make sure no memory leaks..</span> +<span id="L256" class="LineNr">256 </span><span class="traceContains">+mem: trying to reclaim local k:continuation</span> +<span id="L257" class="LineNr">257 </span><span class="traceContains">+mem: automatically abandoning 1007</span> +<span id="L258" class="LineNr">258 </span><span class="traceContains">+mem: automatically abandoning 1004</span> +<span id="L259" class="LineNr">259 </span><span class="traceContains">+mem: automatically abandoning 1000</span> +<span id="L260" class="LineNr">260 </span><span class="Comment"># ..even though we never called the continuation</span> +<span id="L261" class="LineNr">261 </span><span class="traceAbsent">-app: continuation called</span> +<span id="L262" class="LineNr">262 </span> +<span id="L263" class="LineNr">263 </span><span class="Comment">//: Ensure that the presence of a continuation keeps its stack frames from being reclaimed.</span> +<span id="L264" class="LineNr">264 </span> +<span id="L265" class="LineNr">265 </span><span class="Delimiter">:(scenario continuations_preserve_local_scopes)</span> +<span id="L266" class="LineNr">266 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L267" class="LineNr">267 </span> local-scope +<span id="L268" class="LineNr">268 </span> <span class="Normal">k</span>:continuation<span class="Special"> <- </span>call-with-continuation-mark f +<span id="L269" class="LineNr">269 </span> call k +<span id="L270" class="LineNr">270 </span> <span class="Identifier">return</span> <span class="Constant">34</span> +<span id="L271" class="LineNr">271 </span>] +<span id="L272" class="LineNr">272 </span><span class="muRecipe">def</span> f [ +<span id="L273" class="LineNr">273 </span> local-scope +<span id="L274" class="LineNr">274 </span> g +<span id="L275" class="LineNr">275 </span>] +<span id="L276" class="LineNr">276 </span><span class="muRecipe">def</span> g [ +<span id="L277" class="LineNr">277 </span> local-scope +<span id="L278" class="LineNr">278 </span> <span class="Identifier">return</span>-continuation-until-mark +<span id="L279" class="LineNr">279 </span> add <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">1</span> +<span id="L280" class="LineNr">280 </span>] +<span id="L281" class="LineNr">281 </span><span class="Comment"># entering main</span> +<span id="L282" class="LineNr">282 </span><span class="traceContains">+mem: new alloc: 1000</span> +<span id="L283" class="LineNr">283 </span><span class="traceContains">+run: {k: "continuation"} <- call-with-continuation-mark {f: "recipe-literal"}</span> +<span id="L284" class="LineNr">284 </span><span class="Comment"># entering f</span> +<span id="L285" class="LineNr">285 </span><span class="traceContains">+mem: new alloc: 1004</span> +<span id="L286" class="LineNr">286 </span><span class="Comment"># entering g</span> +<span id="L287" class="LineNr">287 </span><span class="traceContains">+mem: new alloc: 1007</span> +<span id="L288" class="LineNr">288 </span><span class="Comment"># return control to main</span> +<span id="L289" class="LineNr">289 </span><span class="traceContains">+run: return-continuation-until-mark</span> +<span id="L290" class="LineNr">290 </span><span class="Comment"># no allocs abandoned yet</span> +<span id="L291" class="LineNr">291 </span><span class="Comment"># finish running main</span> +<span id="L292" class="LineNr">292 </span><span class="traceContains">+run: call {k: "continuation"}</span> +<span id="L293" class="LineNr">293 </span><span class="traceContains">+run: add {1: "literal"}, {1: "literal"}</span> +<span id="L294" class="LineNr">294 </span><span class="traceContains">+run: return {34: "literal"}</span> +<span id="L295" class="LineNr">295 </span><span class="Comment"># now k is reclaimed</span> +<span id="L296" class="LineNr">296 </span><span class="traceContains">+mem: trying to reclaim local k:continuation</span> +<span id="L297" class="LineNr">297 </span><span class="Comment"># at this point all allocs in the continuation are abandoned</span> +<span id="L298" class="LineNr">298 </span><span class="traceContains">+mem: automatically abandoning 1007</span> +<span id="L299" class="LineNr">299 </span><span class="traceContains">+mem: automatically abandoning 1004</span> +<span id="L300" class="LineNr">300 </span><span class="Comment"># finally the alloc for main is abandoned</span> +<span id="L301" class="LineNr">301 </span><span class="traceContains">+mem: automatically abandoning 1000</span> +<span id="L302" class="LineNr">302 </span> +<span id="L303" class="LineNr">303 </span><span class="Delimiter">:(before "End Increment Refcounts(canonized_x)")</span> +<span id="L304" class="LineNr">304 </span><span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_continuation<span class="Delimiter">(</span>canonized_x<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L305" class="LineNr">305 </span> <span class="Normal">int</span> continuation_id = data<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L306" class="LineNr">306 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>continuation_id == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L307" class="LineNr">307 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">,</span> continuation_id<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L308" class="LineNr">308 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"missing delimited continuation: "</span> << canonized_x<span class="Delimiter">.</span>name << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L309" class="LineNr">309 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L310" class="LineNr">310 </span> <span class="Delimiter">}</span> +<span id="L311" class="LineNr">311 </span> delimited_continuation& curr = get<span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">,</span> continuation_id<span class="Delimiter">);</span> +<span id="L312" class="LineNr">312 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"incrementing refcount of continuation "</span> << continuation_id << <span class="Constant">": "</span> << curr<span class="Delimiter">.</span>nrefs << <span class="Constant">" -> "</span> << <span class="Constant">1</span>+curr<span class="Delimiter">.</span>nrefs << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L313" class="LineNr">313 </span> ++curr<span class="Delimiter">.</span>nrefs<span class="Delimiter">;</span> +<span id="L314" class="LineNr">314 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L315" class="LineNr">315 </span><span class="Delimiter">}</span> +<span id="L316" class="LineNr">316 </span> +<span id="L317" class="LineNr">317 </span><span class="Delimiter">:(before "End Decrement Refcounts(canonized_x)")</span> +<span id="L318" class="LineNr">318 </span><span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_continuation<span class="Delimiter">(</span>canonized_x<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L319" class="LineNr">319 </span> <span class="Normal">int</span> continuation_id = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> canonized_x<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L320" class="LineNr">320 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>continuation_id == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L321" class="LineNr">321 </span> delimited_continuation& curr = get<span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">,</span> continuation_id<span class="Delimiter">);</span> +<span id="L322" class="LineNr">322 </span> assert<span class="Delimiter">(</span>curr<span class="Delimiter">.</span>nrefs > <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L323" class="LineNr">323 </span> --curr<span class="Delimiter">.</span>nrefs<span class="Delimiter">;</span> +<span id="L324" class="LineNr">324 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"decrementing refcount of continuation "</span> << continuation_id << <span class="Constant">": "</span> << <span class="Constant">1</span>+curr<span class="Delimiter">.</span>nrefs << <span class="Constant">" -> "</span> << curr<span class="Delimiter">.</span>nrefs << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L325" class="LineNr">325 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>nrefs > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L326" class="LineNr">326 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"reclaiming continuation "</span> << continuation_id << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L327" class="LineNr">327 </span> <span class="Comment">// temporarily push the stack frames for the continuation to the call stack before reclaiming their spaces</span> +<span id="L328" class="LineNr">328 </span> <span class="Comment">// (because reclaim_default_space() relies on the default-space being reclaimed being at the top of the stack)</span> +<span id="L329" class="LineNr">329 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_iterator p = curr<span class="Delimiter">.</span>frames<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != curr<span class="Delimiter">.</span>frames<span class="Delimiter">.</span><a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L330" class="LineNr">330 </span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>*p<span class="Delimiter">);</span> +<span id="L331" class="LineNr">331 </span> <span class="Conceal">¦</span> <a href='043space.cc.html#L244'>reclaim_default_space</a><span class="Delimiter">();</span> +<span id="L332" class="LineNr">332 </span> <span class="Conceal">¦</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> +<span id="L333" class="LineNr">333 </span> <span class="Delimiter">}</span> +<span id="L334" class="LineNr">334 </span> Delimited_continuation<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>continuation_id<span class="Delimiter">);</span> +<span id="L335" class="LineNr">335 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L336" class="LineNr">336 </span><span class="Delimiter">}</span> +<span id="L337" class="LineNr">337 </span> +<span id="L338" class="LineNr">338 </span><span class="Delimiter">:(code)</span> +<span id="L339" class="LineNr">339 </span><span class="Normal">bool</span> is_mu_continuation<span class="Delimiter">(</span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> x<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L340" class="LineNr">340 </span> canonize_type<span class="Delimiter">(</span>x<span class="Delimiter">);</span> +<span id="L341" class="LineNr">341 </span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>type && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"continuation"</span><span class="Delimiter">);</span> +<span id="L342" class="LineNr">342 </span><span class="Delimiter">}</span> +<span id="L343" class="LineNr">343 </span> +<span id="L344" class="LineNr">344 </span><span class="Delimiter">:(scenario continuations_can_be_copied)</span> +<span id="L345" class="LineNr">345 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L346" class="LineNr">346 </span> local-scope +<span id="L347" class="LineNr">347 </span> <span class="Normal">k</span>:continuation<span class="Special"> <- </span>call-with-continuation-mark f +<span id="L348" class="LineNr">348 </span> <span class="Normal">k2</span>:continuation<span class="Special"> <- </span>copy k +<span id="L349" class="LineNr">349 </span> <span class="Comment"># reclaiming k and k2 shouldn't delete f's local scope twice</span> +<span id="L350" class="LineNr">350 </span>] +<span id="L351" class="LineNr">351 </span><span class="muRecipe">def</span> f [ +<span id="L352" class="LineNr">352 </span> local-scope +<span id="L353" class="LineNr">353 </span> load-ingredients +<span id="L354" class="LineNr">354 </span> <span class="Identifier">return</span>-continuation-until-mark +<span id="L355" class="LineNr">355 </span> <span class="Identifier">return</span> <span class="Constant">0</span> +<span id="L356" class="LineNr">356 </span>] +<span id="L357" class="LineNr">357 </span>$error: <span class="Constant">0</span> </pre> </body> </html> diff --git a/html/081print.mu.html b/html/081print.mu.html index eb9b8867..253d913e 100644 --- a/html/081print.mu.html +++ b/html/081print.mu.html @@ -94,7 +94,7 @@ if ('onhashchange' in window) { <span id="L31" class="LineNr"> 31 </span> <span id="L32" class="LineNr"> 32 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L32'>new-fake-screen</a> w:num, h:num<span class="muRecipe"> -> </span>result:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L33" class="LineNr"> 33 </span> <span class="Constant">local-scope</span> -<span id="L34" class="LineNr"> 34 </span> <span class="Constant">load-ingredients</span> +<span id="L34" class="LineNr"> 34 </span> <span class="Constant">load-inputs</span> <span id="L35" class="LineNr"> 35 </span> result <span class="Special"><-</span> new <span class="Constant"><a href='081print.mu.html#L16'>screen</a>:type</span> <span id="L36" class="LineNr"> 36 </span> non-zero-width?:bool <span class="Special"><-</span> greater-than w,<span class="Constant"> 0</span> <span id="L37" class="LineNr"> 37 </span> assert non-zero-width?, <span class="Constant">[screen can't have zero width]</span> @@ -108,7 +108,7 @@ if ('onhashchange' in window) { <span id="L45" class="LineNr"> 45 </span> <span id="L46" class="LineNr"> 46 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L46'>clear-screen</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L47" class="LineNr"> 47 </span> <span class="Constant">local-scope</span> -<span id="L48" class="LineNr"> 48 </span> <span class="Constant">load-ingredients</span> +<span id="L48" class="LineNr"> 48 </span> <span class="Constant">load-inputs</span> <span id="L49" class="LineNr"> 49 </span><span class="CommentedCode">#? stash [clear-screen]</span> <span id="L50" class="LineNr"> 50 </span> <span class="Delimiter">{</span> <span id="L51" class="LineNr"> 51 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L16'>screen</a> @@ -136,7 +136,7 @@ if ('onhashchange' in window) { <span id="L73" class="LineNr"> 73 </span> <span id="L74" class="LineNr"> 74 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L74'>fake-screen-is-empty?</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>result:bool [ <span id="L75" class="LineNr"> 75 </span> <span class="Constant">local-scope</span> -<span id="L76" class="LineNr"> 76 </span> <span class="Constant">load-ingredients</span> +<span id="L76" class="LineNr"> 76 </span> <span class="Constant">load-inputs</span> <span id="L77" class="LineNr"> 77 </span><span class="CommentedCode">#? stash [fake-screen-is-empty?]</span> <span id="L78" class="LineNr"> 78 </span> <span class="muControl">return-unless</span> <a href='081print.mu.html#L16'>screen</a>, <span class="Constant">1/true</span> <span class="Comment"># do nothing for real screens</span> <span id="L79" class="LineNr"> 79 </span> buf:&:@:<a href='081print.mu.html#L27'>screen-cell</a> <span class="Special"><-</span> get *screen, <span class="Constant">data:offset</span> @@ -157,14 +157,14 @@ if ('onhashchange' in window) { <span id="L94" class="LineNr"> 94 </span> <span id="L95" class="LineNr"> 95 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, c:char<span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L96" class="LineNr"> 96 </span> <span class="Constant">local-scope</span> -<span id="L97" class="LineNr"> 97 </span> <span class="Constant">load-ingredients</span> -<span id="L98" class="LineNr"> 98 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L97" class="LineNr"> 97 </span> <span class="Constant">load-inputs</span> +<span id="L98" class="LineNr"> 98 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L99" class="LineNr"> 99 </span> <span class="Delimiter">{</span> <span id="L100" class="LineNr">100 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> <span id="L101" class="LineNr">101 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? <span id="L102" class="LineNr">102 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> <span id="L103" class="LineNr">103 </span> <span class="Delimiter">}</span> -<span id="L104" class="LineNr">104 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L104" class="LineNr">104 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L105" class="LineNr">105 </span> <span class="Delimiter">{</span> <span id="L106" class="LineNr">106 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> <span id="L107" class="LineNr">107 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? @@ -268,7 +268,7 @@ if ('onhashchange' in window) { <span id="L205" class="LineNr">205 </span> <span id="L206" class="LineNr">206 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L206'>cursor-down-on-fake-screen</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L207" class="LineNr">207 </span> <span class="Constant">local-scope</span> -<span id="L208" class="LineNr">208 </span> <span class="Constant">load-ingredients</span> +<span id="L208" class="LineNr">208 </span> <span class="Constant">load-inputs</span> <span id="L209" class="LineNr">209 </span><span class="CommentedCode">#? stash [cursor-down]</span> <span id="L210" class="LineNr">210 </span> row:num <span class="Special"><-</span> get *screen, <span class="Constant">cursor-row:offset</span> <span id="L211" class="LineNr">211 </span> height:num <span class="Special"><-</span> get *screen, <span class="Constant">num-rows:offset</span> @@ -287,7 +287,7 @@ if ('onhashchange' in window) { <span id="L224" class="LineNr">224 </span> <span id="L225" class="LineNr">225 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L225'>scroll-fake-screen</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L226" class="LineNr">226 </span> <span class="Constant">local-scope</span> -<span id="L227" class="LineNr">227 </span> <span class="Constant">load-ingredients</span> +<span id="L227" class="LineNr">227 </span> <span class="Constant">load-inputs</span> <span id="L228" class="LineNr">228 </span><span class="CommentedCode">#? stash [scroll-fake-screen]</span> <span id="L229" class="LineNr">229 </span> width:num <span class="Special"><-</span> get *screen, <span class="Constant">num-columns:offset</span> <span id="L230" class="LineNr">230 </span> height:num <span class="Special"><-</span> get *screen, <span class="Constant">num-rows:offset</span> @@ -315,7 +315,7 @@ if ('onhashchange' in window) { <span id="L252" class="LineNr">252 </span><span class="Comment"># while accounting for scrolling (sliding top-idx)</span> <span id="L253" class="LineNr">253 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L253'>data-index</a> row:num, column:num, width:num, height:num, top-idx:num<span class="muRecipe"> -> </span>result:num [ <span id="L254" class="LineNr">254 </span> <span class="Constant">local-scope</span> -<span id="L255" class="LineNr">255 </span> <span class="Constant">load-ingredients</span> +<span id="L255" class="LineNr">255 </span> <span class="Constant">load-inputs</span> <span id="L256" class="LineNr">256 </span> <span class="Delimiter">{</span> <span id="L257" class="LineNr">257 </span> <span class="Conceal">¦</span> overflow?:bool <span class="Special"><-</span> greater-or-equal row, height <span id="L258" class="LineNr">258 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> overflow? @@ -571,13 +571,13 @@ if ('onhashchange' in window) { <span id="L508" class="LineNr">508 </span><span class="Comment"># these helpers help check for scrolling at development time</span> <span id="L509" class="LineNr">509 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L509'>save-top-idx</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>result:num [ <span id="L510" class="LineNr">510 </span> <span class="Constant">local-scope</span> -<span id="L511" class="LineNr">511 </span> <span class="Constant">load-ingredients</span> +<span id="L511" class="LineNr">511 </span> <span class="Constant">load-inputs</span> <span id="L512" class="LineNr">512 </span> <span class="muControl">return-unless</span> <a href='081print.mu.html#L16'>screen</a>,<span class="Constant"> 0</span> <span class="Comment"># check is only for fake screens</span> <span id="L513" class="LineNr">513 </span> result <span class="Special"><-</span> get *screen, <span class="Constant">top-idx:offset</span> <span id="L514" class="LineNr">514 </span>] <span id="L515" class="LineNr">515 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L515'>assert-no-scroll</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, old-top-idx:num [ <span id="L516" class="LineNr">516 </span> <span class="Constant">local-scope</span> -<span id="L517" class="LineNr">517 </span> <span class="Constant">load-ingredients</span> +<span id="L517" class="LineNr">517 </span> <span class="Constant">load-inputs</span> <span id="L518" class="LineNr">518 </span> <span class="muControl">return-unless</span> <a href='081print.mu.html#L16'>screen</a> <span id="L519" class="LineNr">519 </span> new-top-idx:num <span class="Special"><-</span> get *screen, <span class="Constant">top-idx:offset</span> <span id="L520" class="LineNr">520 </span> no-scroll?:bool <span class="Special"><-</span> equal old-top-idx, new-top-idx @@ -586,7 +586,7 @@ if ('onhashchange' in window) { <span id="L523" class="LineNr">523 </span> <span id="L524" class="LineNr">524 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L524'>clear-line</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L525" class="LineNr">525 </span> <span class="Constant">local-scope</span> -<span id="L526" class="LineNr">526 </span> <span class="Constant">load-ingredients</span> +<span id="L526" class="LineNr">526 </span> <span class="Constant">load-inputs</span> <span id="L527" class="LineNr">527 </span><span class="CommentedCode">#? stash [clear-line]</span> <span id="L528" class="LineNr">528 </span> space:char <span class="Special"><-</span> copy <span class="Constant">0/nul</span> <span id="L529" class="LineNr">529 </span> <span class="Delimiter">{</span> @@ -615,14 +615,14 @@ if ('onhashchange' in window) { <span id="L552" class="LineNr">552 </span><span class="Comment"># only for non-scrolling apps</span> <span id="L553" class="LineNr">553 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L553'>clear-line-until</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, right:num/inclusive<span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L554" class="LineNr">554 </span> <span class="Constant">local-scope</span> -<span id="L555" class="LineNr">555 </span> <span class="Constant">load-ingredients</span> +<span id="L555" class="LineNr">555 </span> <span class="Constant">load-inputs</span> <span id="L556" class="LineNr">556 </span> row:num, column:num <span class="Special"><-</span> <a href='081print.mu.html#L577'>cursor-position</a> <a href='081print.mu.html#L16'>screen</a> <span id="L557" class="LineNr">557 </span><span class="CommentedCode">#? stash [clear-line-until] row column</span> <span id="L558" class="LineNr">558 </span> height:num <span class="Special"><-</span> <a href='081print.mu.html#L782'>screen-height</a> <a href='081print.mu.html#L16'>screen</a> <span id="L559" class="LineNr">559 </span> past-bottom?:bool <span class="Special"><-</span> greater-or-equal row, height <span id="L560" class="LineNr">560 </span> <span class="muControl">return-if</span> past-bottom? <span id="L561" class="LineNr">561 </span> space:char <span class="Special"><-</span> copy <span class="Constant">32/space</span> -<span id="L562" class="LineNr">562 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L562" class="LineNr">562 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L563" class="LineNr">563 </span> <span class="Delimiter">{</span> <span id="L564" class="LineNr">564 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> <span id="L565" class="LineNr">565 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? @@ -639,7 +639,7 @@ if ('onhashchange' in window) { <span id="L576" class="LineNr">576 </span> <span id="L577" class="LineNr">577 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L577'>cursor-position</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>row:num, column:num [ <span id="L578" class="LineNr">578 </span> <span class="Constant">local-scope</span> -<span id="L579" class="LineNr">579 </span> <span class="Constant">load-ingredients</span> +<span id="L579" class="LineNr">579 </span> <span class="Constant">load-inputs</span> <span id="L580" class="LineNr">580 </span> <span class="Delimiter">{</span> <span id="L581" class="LineNr">581 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L16'>screen</a> <span id="L582" class="LineNr">582 </span> <span class="Conceal">¦</span> <span class="Comment"># real screen</span> @@ -653,7 +653,7 @@ if ('onhashchange' in window) { <span id="L590" class="LineNr">590 </span> <span id="L591" class="LineNr">591 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L591'>move-cursor</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, new-row:num, new-column:num<span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L592" class="LineNr">592 </span> <span class="Constant">local-scope</span> -<span id="L593" class="LineNr">593 </span> <span class="Constant">load-ingredients</span> +<span id="L593" class="LineNr">593 </span> <span class="Constant">load-inputs</span> <span id="L594" class="LineNr">594 </span><span class="CommentedCode">#? stash [move-cursor] new-row new-column</span> <span id="L595" class="LineNr">595 </span> <span class="Delimiter">{</span> <span id="L596" class="LineNr">596 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L16'>screen</a> @@ -707,7 +707,7 @@ if ('onhashchange' in window) { <span id="L644" class="LineNr">644 </span> <span id="L645" class="LineNr">645 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L645'>cursor-down</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L646" class="LineNr">646 </span> <span class="Constant">local-scope</span> -<span id="L647" class="LineNr">647 </span> <span class="Constant">load-ingredients</span> +<span id="L647" class="LineNr">647 </span> <span class="Constant">load-inputs</span> <span id="L648" class="LineNr">648 </span><span class="CommentedCode">#? stash [cursor-down]</span> <span id="L649" class="LineNr">649 </span> <span class="Delimiter">{</span> <span id="L650" class="LineNr">650 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L16'>screen</a> @@ -750,7 +750,7 @@ if ('onhashchange' in window) { <span id="L687" class="LineNr">687 </span> <span id="L688" class="LineNr">688 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L688'>cursor-up</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L689" class="LineNr">689 </span> <span class="Constant">local-scope</span> -<span id="L690" class="LineNr">690 </span> <span class="Constant">load-ingredients</span> +<span id="L690" class="LineNr">690 </span> <span class="Constant">load-inputs</span> <span id="L691" class="LineNr">691 </span><span class="CommentedCode">#? stash [cursor-up]</span> <span id="L692" class="LineNr">692 </span> <span class="Delimiter">{</span> <span id="L693" class="LineNr">693 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L16'>screen</a> @@ -768,7 +768,7 @@ if ('onhashchange' in window) { <span id="L705" class="LineNr">705 </span> <span id="L706" class="LineNr">706 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L706'>cursor-right</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L707" class="LineNr">707 </span> <span class="Constant">local-scope</span> -<span id="L708" class="LineNr">708 </span> <span class="Constant">load-ingredients</span> +<span id="L708" class="LineNr">708 </span> <span class="Constant">load-inputs</span> <span id="L709" class="LineNr">709 </span><span class="CommentedCode">#? stash [cursor-right]</span> <span id="L710" class="LineNr">710 </span> <span class="Delimiter">{</span> <span id="L711" class="LineNr">711 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L16'>screen</a> @@ -788,7 +788,7 @@ if ('onhashchange' in window) { <span id="L725" class="LineNr">725 </span> <span id="L726" class="LineNr">726 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L726'>cursor-left</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L727" class="LineNr">727 </span> <span class="Constant">local-scope</span> -<span id="L728" class="LineNr">728 </span> <span class="Constant">load-ingredients</span> +<span id="L728" class="LineNr">728 </span> <span class="Constant">load-inputs</span> <span id="L729" class="LineNr">729 </span><span class="CommentedCode">#? stash [cursor-left]</span> <span id="L730" class="LineNr">730 </span> <span class="Delimiter">{</span> <span id="L731" class="LineNr">731 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L16'>screen</a> @@ -806,7 +806,7 @@ if ('onhashchange' in window) { <span id="L743" class="LineNr">743 </span> <span id="L744" class="LineNr">744 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L744'>cursor-to-start-of-line</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L745" class="LineNr">745 </span> <span class="Constant">local-scope</span> -<span id="L746" class="LineNr">746 </span> <span class="Constant">load-ingredients</span> +<span id="L746" class="LineNr">746 </span> <span class="Constant">load-inputs</span> <span id="L747" class="LineNr">747 </span><span class="CommentedCode">#? stash [cursor-to-start-of-line]</span> <span id="L748" class="LineNr">748 </span> row:num <span class="Special"><-</span> <a href='081print.mu.html#L577'>cursor-position</a> <a href='081print.mu.html#L16'>screen</a> <span id="L749" class="LineNr">749 </span> <a href='081print.mu.html#L16'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L591'>move-cursor</a> <a href='081print.mu.html#L16'>screen</a>, row, <span class="Constant">0/column</span> @@ -814,7 +814,7 @@ if ('onhashchange' in window) { <span id="L751" class="LineNr">751 </span> <span id="L752" class="LineNr">752 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L752'>cursor-to-next-line</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L753" class="LineNr">753 </span> <span class="Constant">local-scope</span> -<span id="L754" class="LineNr">754 </span> <span class="Constant">load-ingredients</span> +<span id="L754" class="LineNr">754 </span> <span class="Constant">load-inputs</span> <span id="L755" class="LineNr">755 </span><span class="CommentedCode">#? stash [cursor-to-next-line]</span> <span id="L756" class="LineNr">756 </span> <a href='081print.mu.html#L16'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L645'>cursor-down</a> <a href='081print.mu.html#L16'>screen</a> <span id="L757" class="LineNr">757 </span> <a href='081print.mu.html#L16'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L744'>cursor-to-start-of-line</a> <a href='081print.mu.html#L16'>screen</a> @@ -822,7 +822,7 @@ if ('onhashchange' in window) { <span id="L759" class="LineNr">759 </span> <span id="L760" class="LineNr">760 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L760'>move-cursor-to-column</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, column:num<span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L761" class="LineNr">761 </span> <span class="Constant">local-scope</span> -<span id="L762" class="LineNr">762 </span> <span class="Constant">load-ingredients</span> +<span id="L762" class="LineNr">762 </span> <span class="Constant">load-inputs</span> <span id="L763" class="LineNr">763 </span> row:num, _ <span class="Special"><-</span> <a href='081print.mu.html#L577'>cursor-position</a> <a href='081print.mu.html#L16'>screen</a> <span id="L764" class="LineNr">764 </span><span class="CommentedCode">#? stash [move-cursor-to-column] row</span> <span id="L765" class="LineNr">765 </span> <a href='081print.mu.html#L591'>move-cursor</a> <a href='081print.mu.html#L16'>screen</a>, row, column @@ -830,7 +830,7 @@ if ('onhashchange' in window) { <span id="L767" class="LineNr">767 </span> <span id="L768" class="LineNr">768 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L768'>screen-width</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>width:num [ <span id="L769" class="LineNr">769 </span> <span class="Constant">local-scope</span> -<span id="L770" class="LineNr">770 </span> <span class="Constant">load-ingredients</span> +<span id="L770" class="LineNr">770 </span> <span class="Constant">load-inputs</span> <span id="L771" class="LineNr">771 </span><span class="CommentedCode">#? stash [screen-width]</span> <span id="L772" class="LineNr">772 </span> <span class="Delimiter">{</span> <span id="L773" class="LineNr">773 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='081print.mu.html#L16'>screen</a> @@ -844,7 +844,7 @@ if ('onhashchange' in window) { <span id="L781" class="LineNr">781 </span> <span id="L782" class="LineNr">782 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L782'>screen-height</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>height:num [ <span id="L783" class="LineNr">783 </span> <span class="Constant">local-scope</span> -<span id="L784" class="LineNr">784 </span> <span class="Constant">load-ingredients</span> +<span id="L784" class="LineNr">784 </span> <span class="Constant">load-inputs</span> <span id="L785" class="LineNr">785 </span><span class="CommentedCode">#? stash [screen-height]</span> <span id="L786" class="LineNr">786 </span> <span class="Delimiter">{</span> <span id="L787" class="LineNr">787 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='081print.mu.html#L16'>screen</a> @@ -858,14 +858,14 @@ if ('onhashchange' in window) { <span id="L795" class="LineNr">795 </span> <span id="L796" class="LineNr">796 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, s:text<span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L797" class="LineNr">797 </span> <span class="Constant">local-scope</span> -<span id="L798" class="LineNr">798 </span> <span class="Constant">load-ingredients</span> -<span id="L799" class="LineNr">799 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L798" class="LineNr">798 </span> <span class="Constant">load-inputs</span> +<span id="L799" class="LineNr">799 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L800" class="LineNr">800 </span> <span class="Delimiter">{</span> <span id="L801" class="LineNr">801 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> <span id="L802" class="LineNr">802 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? <span id="L803" class="LineNr">803 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> <span id="L804" class="LineNr">804 </span> <span class="Delimiter">}</span> -<span id="L805" class="LineNr">805 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L805" class="LineNr">805 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L806" class="LineNr">806 </span> <span class="Delimiter">{</span> <span id="L807" class="LineNr">807 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> <span id="L808" class="LineNr">808 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? @@ -914,14 +914,14 @@ if ('onhashchange' in window) { <span id="L851" class="LineNr">851 </span> <span id="L852" class="LineNr">852 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, n:num<span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L853" class="LineNr">853 </span> <span class="Constant">local-scope</span> -<span id="L854" class="LineNr">854 </span> <span class="Constant">load-ingredients</span> -<span id="L855" class="LineNr">855 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L854" class="LineNr">854 </span> <span class="Constant">load-inputs</span> +<span id="L855" class="LineNr">855 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L856" class="LineNr">856 </span> <span class="Delimiter">{</span> <span id="L857" class="LineNr">857 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> <span id="L858" class="LineNr">858 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? <span id="L859" class="LineNr">859 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> <span id="L860" class="LineNr">860 </span> <span class="Delimiter">}</span> -<span id="L861" class="LineNr">861 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L861" class="LineNr">861 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L862" class="LineNr">862 </span> <span class="Delimiter">{</span> <span id="L863" class="LineNr">863 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> <span id="L864" class="LineNr">864 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? @@ -934,14 +934,14 @@ if ('onhashchange' in window) { <span id="L871" class="LineNr">871 </span> <span id="L872" class="LineNr">872 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, n:bool<span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L873" class="LineNr">873 </span> <span class="Constant">local-scope</span> -<span id="L874" class="LineNr">874 </span> <span class="Constant">load-ingredients</span> -<span id="L875" class="LineNr">875 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L874" class="LineNr">874 </span> <span class="Constant">load-inputs</span> +<span id="L875" class="LineNr">875 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L876" class="LineNr">876 </span> <span class="Delimiter">{</span> <span id="L877" class="LineNr">877 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> <span id="L878" class="LineNr">878 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? <span id="L879" class="LineNr">879 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> <span id="L880" class="LineNr">880 </span> <span class="Delimiter">}</span> -<span id="L881" class="LineNr">881 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L881" class="LineNr">881 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L882" class="LineNr">882 </span> <span class="Delimiter">{</span> <span id="L883" class="LineNr">883 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> <span id="L884" class="LineNr">884 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? @@ -953,14 +953,14 @@ if ('onhashchange' in window) { <span id="L890" class="LineNr">890 </span> <span id="L891" class="LineNr">891 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, n:&:_elem<span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L892" class="LineNr">892 </span> <span class="Constant">local-scope</span> -<span id="L893" class="LineNr">893 </span> <span class="Constant">load-ingredients</span> -<span id="L894" class="LineNr">894 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L893" class="LineNr">893 </span> <span class="Constant">load-inputs</span> +<span id="L894" class="LineNr">894 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L895" class="LineNr">895 </span> <span class="Delimiter">{</span> <span id="L896" class="LineNr">896 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> <span id="L897" class="LineNr">897 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? <span id="L898" class="LineNr">898 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> <span id="L899" class="LineNr">899 </span> <span class="Delimiter">}</span> -<span id="L900" class="LineNr">900 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L900" class="LineNr">900 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L901" class="LineNr">901 </span> <span class="Delimiter">{</span> <span id="L902" class="LineNr">902 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> <span id="L903" class="LineNr">903 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? diff --git a/html/082scenario_screen.cc.html b/html/082scenario_screen.cc.html index cde419df..37b9d73c 100644 --- a/html/082scenario_screen.cc.html +++ b/html/082scenario_screen.cc.html @@ -315,19 +315,19 @@ if ('onhashchange' in window) { <span id="L250" class="LineNr">250 </span> <span id="L251" class="LineNr">251 </span><span class="Delimiter">:(code)</span> <span id="L252" class="LineNr">252 </span><span class="Normal">void</span> check_screen<span class="Delimiter">(</span><span class="Normal">const</span> string& expected_contents<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">int</span> color<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L253" class="LineNr">253 </span> <span class="Normal">int</span> screen_location = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> SCREEN<span class="Delimiter">)</span>+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L253" class="LineNr">253 </span> <span class="Normal">int</span> screen_location = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> SCREEN<span class="Delimiter">)</span>+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span id="L254" class="LineNr">254 </span> <span class="Normal">int</span> data_offset = <a href='042name.cc.html#L140'>find_element_name</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"screen"</span><span class="Delimiter">),</span> <span class="Constant">"data"</span><span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> <span id="L255" class="LineNr">255 </span> assert<span class="Delimiter">(</span>data_offset >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L256" class="LineNr">256 </span> <span class="Normal">int</span> screen_data_location = screen_location+data_offset<span class="Delimiter">;</span> <span class="Comment">// type: address:array:character</span> -<span id="L257" class="LineNr">257 </span> <span class="Normal">int</span> screen_data_start = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_data_location<span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// type: array:character</span> +<span id="L257" class="LineNr">257 </span> <span class="Normal">int</span> screen_data_start = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_data_location<span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// type: array:character</span> <span id="L258" class="LineNr">258 </span> <span class="Normal">int</span> width_offset = <a href='042name.cc.html#L140'>find_element_name</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"screen"</span><span class="Delimiter">),</span> <span class="Constant">"num-columns"</span><span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> -<span id="L259" class="LineNr">259 </span> <span class="Normal">int</span> screen_width = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+width_offset<span class="Delimiter">);</span> +<span id="L259" class="LineNr">259 </span> <span class="Normal">int</span> screen_width = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+width_offset<span class="Delimiter">);</span> <span id="L260" class="LineNr">260 </span> <span class="Normal">int</span> height_offset = <a href='042name.cc.html#L140'>find_element_name</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"screen"</span><span class="Delimiter">),</span> <span class="Constant">"num-rows"</span><span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> -<span id="L261" class="LineNr">261 </span> <span class="Normal">int</span> screen_height = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+height_offset<span class="Delimiter">);</span> +<span id="L261" class="LineNr">261 </span> <span class="Normal">int</span> screen_height = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+height_offset<span class="Delimiter">);</span> <span id="L262" class="LineNr">262 </span> raw_string_stream cursor<span class="Delimiter">(</span>expected_contents<span class="Delimiter">);</span> <span id="L263" class="LineNr">263 </span> <span class="Comment">// todo: too-long expected_contents should fail</span> <span id="L264" class="LineNr">264 </span> <span class="Normal">int</span> top_index_offset = <a href='042name.cc.html#L140'>find_element_name</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"screen"</span><span class="Delimiter">),</span> <span class="Constant">"top-idx"</span><span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> -<span id="L265" class="LineNr">265 </span> <span class="Normal">int</span> top_index = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+top_index_offset<span class="Delimiter">);</span> +<span id="L265" class="LineNr">265 </span> <span class="Normal">int</span> top_index = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+top_index_offset<span class="Delimiter">);</span> <span id="L266" class="LineNr">266 </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> row=top_index/screen_width<span class="Delimiter">;</span> i < screen_height<span class="Delimiter">;</span> ++i<span class="Delimiter">,</span> row=<span class="Delimiter">(</span>row+<span class="Constant">1</span><span class="Delimiter">)</span>%screen_height<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L267" class="LineNr">267 </span> <span class="Conceal">¦</span> cursor<span class="Delimiter">.</span><a href='011load.cc.html#L209'>skip_whitespace_and_comments</a><span class="Delimiter">();</span> <span id="L268" class="LineNr">268 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>cursor<span class="Delimiter">.</span>at_end<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -340,16 +340,16 @@ if ('onhashchange' in window) { <span id="L275" class="LineNr">275 </span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> column = <span class="Constant">0</span><span class="Delimiter">;</span> column < screen_width<span class="Delimiter">;</span> ++column<span class="Delimiter">,</span> addr+= <span class="Comment">/*</span><span class="Comment">size of screen-cell</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L276" class="LineNr">276 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">const</span> <span class="Normal">int</span> cell_color_offset = <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L277" class="LineNr">277 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">uint32_t</span> curr = cursor<span class="Delimiter">.</span>get<span class="Delimiter">();</span> -<span id="L278" class="LineNr">278 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> == <span class="Constant">0</span> && isspace<span class="Delimiter">(</span>curr<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L279" class="LineNr">279 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr == <span class="Constant">' '</span> && color != -<span class="Constant">1</span> && color != <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L278" class="LineNr">278 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> == <span class="Constant">0</span> && isspace<span class="Delimiter">(</span>curr<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L279" class="LineNr">279 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr == <span class="Constant">' '</span> && color != -<span class="Constant">1</span> && color != <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L280" class="LineNr">280 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// filter out other colors</span> <span id="L281" class="LineNr">281 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L282" class="LineNr">282 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L283" class="LineNr">283 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> != <span class="Constant">0</span> && <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> == curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L284" class="LineNr">284 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>color == -<span class="Constant">1</span> || color == <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L283" class="LineNr">283 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> != <span class="Constant">0</span> && <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> == curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L284" class="LineNr">284 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>color == -<span class="Constant">1</span> || color == <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L285" class="LineNr">285 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// contents match but color is off</span> <span id="L286" class="LineNr">286 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L287" class="LineNr">287 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected screen location ("</span> << row << <span class="Constant">", "</span> << column << <span class="Constant">") to contain '"</span> << unicode_character_at<span class="Delimiter">(</span>addr<span class="Delimiter">)</span> << <span class="Constant">"' in color "</span> << color << <span class="Constant">" instead of "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L287" class="LineNr">287 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected screen location ("</span> << row << <span class="Constant">", "</span> << column << <span class="Constant">") to contain '"</span> << unicode_character_at<span class="Delimiter">(</span>addr<span class="Delimiter">)</span> << <span class="Constant">"' in color "</span> << color << <span class="Constant">" instead of "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L288" class="LineNr">288 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> dump_screen<span class="Delimiter">();</span> <span id="L289" class="LineNr">289 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed = <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L290" class="LineNr">290 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> @@ -363,15 +363,15 @@ if ('onhashchange' in window) { <span id="L298" class="LineNr">298 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> expected_pretty[<span class="Constant">0</span>] = <span class="Constant">' '</span><span class="Delimiter">,</span> expected_pretty[<span class="Constant">1</span>] = <span class="Constant">'('</span><span class="Delimiter">,</span> expected_pretty[<span class="Constant">2</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> expected_pretty[<span class="Constant">3</span>] = <span class="Normal">static_cast</span><<span class="Normal">unsigned</span> <span class="Normal">char</span>><span class="Delimiter">(</span>curr<span class="Delimiter">),</span> expected_pretty[<span class="Constant">4</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> expected_pretty[<span class="Constant">5</span>] = <span class="Constant">')'</span><span class="Delimiter">,</span> expected_pretty[<span class="Constant">6</span>] = <span class="cSpecial">'\0'</span><span class="Delimiter">;</span> <span id="L299" class="LineNr">299 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L300" class="LineNr">300 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">char</span> actual_pretty[<span class="Constant">10</span>] = <span class="Delimiter">{</span><span class="Constant">0</span><span class="Delimiter">};</span> -<span id="L301" class="LineNr">301 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> < <span class="Constant">256</span> && !iscntrl<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L301" class="LineNr">301 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> < <span class="Constant">256</span> && !iscntrl<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span id="L302" class="LineNr">302 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// " ('<curr>')"</span> -<span id="L303" class="LineNr">303 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> actual_pretty[<span class="Constant">0</span>] = <span class="Constant">' '</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">1</span>] = <span class="Constant">'('</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">2</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">3</span>] = <span class="Normal">static_cast</span><<span class="Normal">unsigned</span> <span class="Normal">char</span>><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)),</span> actual_pretty[<span class="Constant">4</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">5</span>] = <span class="Constant">')'</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">6</span>] = <span class="cSpecial">'\0'</span><span class="Delimiter">;</span> +<span id="L303" class="LineNr">303 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> actual_pretty[<span class="Constant">0</span>] = <span class="Constant">' '</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">1</span>] = <span class="Constant">'('</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">2</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">3</span>] = <span class="Normal">static_cast</span><<span class="Normal">unsigned</span> <span class="Normal">char</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)),</span> actual_pretty[<span class="Constant">4</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">5</span>] = <span class="Constant">')'</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">6</span>] = <span class="cSpecial">'\0'</span><span class="Delimiter">;</span> <span id="L304" class="LineNr">304 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L305" class="LineNr">305 </span> <span id="L306" class="LineNr">306 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> ostringstream color_phrase<span class="Delimiter">;</span> <span id="L307" class="LineNr">307 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>color != -<span class="Constant">1</span><span class="Delimiter">)</span> color_phrase << <span class="Constant">" in color "</span> << color<span class="Delimiter">;</span> <span id="L308" class="LineNr">308 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L309" class="LineNr">309 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected screen location ("</span> << row << <span class="Constant">", "</span> << column << <span class="Constant">") to contain "</span> << curr << expected_pretty << color_phrase<span class="Delimiter">.</span>str<span class="Delimiter">()</span> << <span class="Constant">" instead of "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">))</span> << actual_pretty << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L309" class="LineNr">309 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected screen location ("</span> << row << <span class="Constant">", "</span> << column << <span class="Constant">") to contain "</span> << curr << expected_pretty << color_phrase<span class="Delimiter">.</span>str<span class="Delimiter">()</span> << <span class="Constant">" instead of "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">))</span> << actual_pretty << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L310" class="LineNr">310 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> dump_screen<span class="Delimiter">();</span> <span id="L311" class="LineNr">311 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed = <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L312" class="LineNr">312 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> @@ -390,7 +390,7 @@ if ('onhashchange' in window) { <span id="L325" class="LineNr">325 </span><span class="Delimiter">}</span> <span id="L326" class="LineNr">326 </span> <span id="L327" class="LineNr">327 </span><span class="Normal">const</span> <span class="Normal">char</span>* unicode_character_at<span class="Delimiter">(</span><span class="Normal">int</span> addr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L328" class="LineNr">328 </span> <span class="Normal">int</span> unicode_code_point = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">));</span> +<span id="L328" class="LineNr">328 </span> <span class="Normal">int</span> unicode_code_point = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">));</span> <span id="L329" class="LineNr">329 </span> <span class="Identifier">return</span> to_unicode<span class="Delimiter">(</span>unicode_code_point<span class="Delimiter">);</span> <span id="L330" class="LineNr">330 </span><span class="Delimiter">}</span> <span id="L331" class="LineNr">331 </span> @@ -450,24 +450,24 @@ if ('onhashchange' in window) { <span id="L385" class="LineNr">385 </span> <span id="L386" class="LineNr">386 </span><span class="Delimiter">:(code)</span> <span id="L387" class="LineNr">387 </span><span class="Normal">void</span> dump_screen<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L388" class="LineNr">388 </span> <span class="Normal">int</span> screen_location = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> SCREEN<span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L388" class="LineNr">388 </span> <span class="Normal">int</span> screen_location = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> SCREEN<span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span id="L389" class="LineNr">389 </span> <span class="Normal">int</span> width_offset = <a href='042name.cc.html#L140'>find_element_name</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"screen"</span><span class="Delimiter">),</span> <span class="Constant">"num-columns"</span><span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> -<span id="L390" class="LineNr">390 </span> <span class="Normal">int</span> screen_width = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+width_offset<span class="Delimiter">);</span> +<span id="L390" class="LineNr">390 </span> <span class="Normal">int</span> screen_width = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+width_offset<span class="Delimiter">);</span> <span id="L391" class="LineNr">391 </span> <span class="Normal">int</span> height_offset = <a href='042name.cc.html#L140'>find_element_name</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"screen"</span><span class="Delimiter">),</span> <span class="Constant">"num-rows"</span><span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> -<span id="L392" class="LineNr">392 </span> <span class="Normal">int</span> screen_height = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+height_offset<span class="Delimiter">);</span> +<span id="L392" class="LineNr">392 </span> <span class="Normal">int</span> screen_height = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+height_offset<span class="Delimiter">);</span> <span id="L393" class="LineNr">393 </span> <span class="Normal">int</span> data_offset = <a href='042name.cc.html#L140'>find_element_name</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"screen"</span><span class="Delimiter">),</span> <span class="Constant">"data"</span><span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> <span id="L394" class="LineNr">394 </span> assert<span class="Delimiter">(</span>data_offset >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L395" class="LineNr">395 </span> <span class="Normal">int</span> screen_data_location = screen_location+data_offset<span class="Delimiter">;</span> <span class="Comment">// type: address:array:character</span> -<span id="L396" class="LineNr">396 </span> <span class="Normal">int</span> screen_data_start = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_data_location<span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// type: array:character</span> -<span id="L397" class="LineNr">397 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_data_start<span class="Delimiter">)</span> == screen_width*screen_height<span class="Delimiter">);</span> +<span id="L396" class="LineNr">396 </span> <span class="Normal">int</span> screen_data_start = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_data_location<span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// type: array:character</span> +<span id="L397" class="LineNr">397 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_data_start<span class="Delimiter">)</span> == screen_width*screen_height<span class="Delimiter">);</span> <span id="L398" class="LineNr">398 </span> <span class="Normal">int</span> top_index_offset = <a href='042name.cc.html#L140'>find_element_name</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"screen"</span><span class="Delimiter">),</span> <span class="Constant">"top-idx"</span><span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> -<span id="L399" class="LineNr">399 </span> <span class="Normal">int</span> top_index = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+top_index_offset<span class="Delimiter">);</span> +<span id="L399" class="LineNr">399 </span> <span class="Normal">int</span> top_index = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_location+top_index_offset<span class="Delimiter">);</span> <span id="L400" class="LineNr">400 </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> row=top_index/screen_width<span class="Delimiter">;</span> i < screen_height<span class="Delimiter">;</span> ++i<span class="Delimiter">,</span> row=<span class="Delimiter">(</span>row+<span class="Constant">1</span><span class="Delimiter">)</span>%screen_height<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L401" class="LineNr">401 </span> <span class="Conceal">¦</span> cerr << <span class="Constant">'.'</span><span class="Delimiter">;</span> <span id="L402" class="LineNr">402 </span> <span class="Conceal">¦</span> <span class="Normal">int</span> curr = screen_data_start+<span class="Comment">/*</span><span class="Comment">length</span><span class="Comment">*/</span><span class="Constant">1</span>+row*screen_width* <span class="Comment">/*</span><span class="Comment">size of screen-cell</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">;</span> <span id="L403" class="LineNr">403 </span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> col = <span class="Constant">0</span><span class="Delimiter">;</span> col < screen_width<span class="Delimiter">;</span> ++col<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L404" class="LineNr">404 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">))</span> -<span id="L405" class="LineNr">405 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> cerr << to_unicode<span class="Delimiter">(</span><span class="Normal">static_cast</span><<span class="Normal">uint32_t</span>><span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)));</span> +<span id="L404" class="LineNr">404 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">))</span> +<span id="L405" class="LineNr">405 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> cerr << to_unicode<span class="Delimiter">(</span><span class="Normal">static_cast</span><<span class="Normal">uint32_t</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)));</span> <span id="L406" class="LineNr">406 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">else</span> <span id="L407" class="LineNr">407 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> cerr << <span class="Constant">' '</span><span class="Delimiter">;</span> <span id="L408" class="LineNr">408 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> curr += <span class="Comment">/*</span><span class="Comment">size of screen-cell</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">;</span> diff --git a/html/084console.mu.html b/html/084console.mu.html index 952c646e..42963a93 100644 --- a/html/084console.mu.html +++ b/html/084console.mu.html @@ -88,14 +88,14 @@ if ('onhashchange' in window) { <span id="L27" class="LineNr"> 27 </span> <span id="L28" class="LineNr"> 28 </span><span class="muRecipe">def</span> <a href='084console.mu.html#L28'>new-fake-console</a> events:&:@:<a href='084console.mu.html#L4'>event</a><span class="muRecipe"> -> </span>result:&:<a href='084console.mu.html#L23'>console</a> [ <span id="L29" class="LineNr"> 29 </span> <span class="Constant">local-scope</span> -<span id="L30" class="LineNr"> 30 </span> <span class="Constant">load-ingredients</span> +<span id="L30" class="LineNr"> 30 </span> <span class="Constant">load-inputs</span> <span id="L31" class="LineNr"> 31 </span> result:&:<a href='084console.mu.html#L23'>console</a> <span class="Special"><-</span> new <span class="Constant"><a href='084console.mu.html#L23'>console</a>:type</span> <span id="L32" class="LineNr"> 32 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">events:offset</span>, events <span id="L33" class="LineNr"> 33 </span>] <span id="L34" class="LineNr"> 34 </span> <span id="L35" class="LineNr"> 35 </span><span class="muRecipe">def</span> <a href='084console.mu.html#L35'>read-event</a> <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a><span class="muRecipe"> -> </span>result:<a href='084console.mu.html#L4'>event</a>, found?:bool, quit?:bool, <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a> [ <span id="L36" class="LineNr"> 36 </span> <span class="Constant">local-scope</span> -<span id="L37" class="LineNr"> 37 </span> <span class="Constant">load-ingredients</span> +<span id="L37" class="LineNr"> 37 </span> <span class="Constant">load-inputs</span> <span id="L38" class="LineNr"> 38 </span> <span class="Delimiter">{</span> <span id="L39" class="LineNr"> 39 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='084console.mu.html#L23'>console</a> <span id="L40" class="LineNr"> 40 </span> <span class="Conceal">¦</span> current-event-index:num <span class="Special"><-</span> get *console, <span class="Constant">current-event-index:offset</span> @@ -122,7 +122,7 @@ if ('onhashchange' in window) { <span id="L61" class="LineNr"> 61 </span><span class="Comment"># newlines, tabs, ctrl-d..</span> <span id="L62" class="LineNr"> 62 </span><span class="muRecipe">def</span> <a href='084console.mu.html#L62'>read-key</a> <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a><span class="muRecipe"> -> </span>result:char, found?:bool, quit?:bool, <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a> [ <span id="L63" class="LineNr"> 63 </span> <span class="Constant">local-scope</span> -<span id="L64" class="LineNr"> 64 </span> <span class="Constant">load-ingredients</span> +<span id="L64" class="LineNr"> 64 </span> <span class="Constant">load-inputs</span> <span id="L65" class="LineNr"> 65 </span> x:<a href='084console.mu.html#L4'>event</a>, found?:bool, quit?:bool, <a href='084console.mu.html#L23'>console</a> <span class="Special"><-</span> <a href='084console.mu.html#L35'>read-event</a> <a href='084console.mu.html#L23'>console</a> <span id="L66" class="LineNr"> 66 </span> <span class="muControl">return-if</span> quit?,<span class="Constant"> 0</span>, found?, quit? <span id="L67" class="LineNr"> 67 </span> <span class="muControl">return-unless</span> found?,<span class="Constant"> 0</span>, found?, quit? @@ -133,7 +133,7 @@ if ('onhashchange' in window) { <span id="L72" class="LineNr"> 72 </span> <span id="L73" class="LineNr"> 73 </span><span class="muRecipe">def</span> <a href='084console.mu.html#L73'>send-keys-to-channel</a> <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a>, chan:&:<a href='075channel.mu.html#L47'>sink</a>:char, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a>, chan:&:<a href='075channel.mu.html#L47'>sink</a>:char, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L74" class="LineNr"> 74 </span> <span class="Constant">local-scope</span> -<span id="L75" class="LineNr"> 75 </span> <span class="Constant">load-ingredients</span> +<span id="L75" class="LineNr"> 75 </span> <span class="Constant">load-inputs</span> <span id="L76" class="LineNr"> 76 </span> <span class="Delimiter">{</span> <span id="L77" class="LineNr"> 77 </span> <span class="Conceal">¦</span> c:char, found?:bool, quit?:bool, <a href='084console.mu.html#L23'>console</a> <span class="Special"><-</span> <a href='084console.mu.html#L62'>read-key</a> <a href='084console.mu.html#L23'>console</a> <span id="L78" class="LineNr"> 78 </span> <span class="Conceal">¦</span> <span class="muControl">loop-unless</span> found? @@ -148,7 +148,7 @@ if ('onhashchange' in window) { <span id="L87" class="LineNr"> 87 </span> <span id="L88" class="LineNr"> 88 </span><span class="muRecipe">def</span> <a href='084console.mu.html#L88'>wait-for-event</a> <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a><span class="muRecipe"> -> </span><a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a> [ <span id="L89" class="LineNr"> 89 </span> <span class="Constant">local-scope</span> -<span id="L90" class="LineNr"> 90 </span> <span class="Constant">load-ingredients</span> +<span id="L90" class="LineNr"> 90 </span> <span class="Constant">load-inputs</span> <span id="L91" class="LineNr"> 91 </span> <span class="Delimiter">{</span> <span id="L92" class="LineNr"> 92 </span> <span class="Conceal">¦</span> _, found?:bool <span class="Special"><-</span> <a href='084console.mu.html#L35'>read-event</a> <a href='084console.mu.html#L23'>console</a> <span id="L93" class="LineNr"> 93 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> found? @@ -159,7 +159,7 @@ if ('onhashchange' in window) { <span id="L98" class="LineNr"> 98 </span> <span id="L99" class="LineNr"> 99 </span><span class="muRecipe">def</span> <a href='084console.mu.html#L99'>has-more-events?</a> <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a><span class="muRecipe"> -> </span>result:bool [ <span id="L100" class="LineNr">100 </span> <span class="Constant">local-scope</span> -<span id="L101" class="LineNr">101 </span> <span class="Constant">load-ingredients</span> +<span id="L101" class="LineNr">101 </span> <span class="Constant">load-inputs</span> <span id="L102" class="LineNr">102 </span> <span class="muControl">return-if</span> <a href='084console.mu.html#L23'>console</a>, <span class="Constant">0/false</span> <span class="Comment"># fake events are processed as soon as they arrive</span> <span id="L103" class="LineNr">103 </span> result <span class="Special"><-</span> interactions-left? <span id="L104" class="LineNr">104 </span>] diff --git a/html/085scenario_console.cc.html b/html/085scenario_console.cc.html index 67b651cc..c36eb9b8 100644 --- a/html/085scenario_console.cc.html +++ b/html/085scenario_console.cc.html @@ -144,7 +144,7 @@ if ('onhashchange' in window) { <span id="L82" class="LineNr"> 82 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address+<span class="Constant">1</span><span class="Delimiter">,</span> Key[key]<span class="Delimiter">);</span> <span id="L83" class="LineNr"> 83 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">else</span> <span id="L84" class="LineNr"> 84 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"assume-console: can't press '"</span> << key << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> -<span id="L85" class="LineNr"> 85 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address+<span class="Constant">1</span><span class="Delimiter">)</span> < <span class="Constant">256</span><span class="Delimiter">)</span> +<span id="L85" class="LineNr"> 85 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address+<span class="Constant">1</span><span class="Delimiter">)</span> < <span class="Constant">256</span><span class="Delimiter">)</span> <span id="L86" class="LineNr"> 86 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment">// these keys are in ascii</span> <span id="L87" class="LineNr"> 87 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">tag for 'text' variant of 'event' exclusive-container</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L88" class="LineNr"> 88 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">else</span> <span class="Delimiter">{</span> @@ -330,12 +330,12 @@ if ('onhashchange' in window) { <span id="L268" class="LineNr">268 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"console not initialized</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L269" class="LineNr">269 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L270" class="LineNr">270 </span> <span class="Delimiter">}</span> -<span id="L271" class="LineNr">271 </span> <span class="Normal">int</span> console_address = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> CONSOLE<span class="Delimiter">);</span> -<span id="L272" class="LineNr">272 </span> <span class="Normal">int</span> console_data = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> console_address+<span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L273" class="LineNr">273 </span> <span class="Normal">int</span> length = <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> console_data<span class="Delimiter">);</span> <span class="Comment">// array length</span> +<span id="L271" class="LineNr">271 </span> <span class="Normal">int</span> console_address = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> CONSOLE<span class="Delimiter">);</span> +<span id="L272" class="LineNr">272 </span> <span class="Normal">int</span> console_data = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> console_address+<span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L273" class="LineNr">273 </span> <span class="Normal">int</span> length = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> console_data<span class="Delimiter">);</span> <span class="Comment">// array length</span> <span id="L274" class="LineNr">274 </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> curr = console_data+<span class="Constant">1</span><span class="Delimiter">;</span> i < length<span class="Delimiter">;</span> ++i<span class="Delimiter">,</span> curr+=size_of_event<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L275" class="LineNr">275 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)</span> != <span class="Comment">/*</span><span class="Comment">text</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L276" class="LineNr">276 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+<span class="Constant">1</span><span class="Delimiter">)</span> != ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L275" class="LineNr">275 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)</span> != <span class="Comment">/*</span><span class="Comment">text</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L276" class="LineNr">276 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+<span class="Constant">1</span><span class="Delimiter">)</span> != ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L277" class="LineNr">277 </span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> n = <span class="Constant">0</span><span class="Delimiter">;</span> n < <a href='085scenario_console.cc.html#L296'>size_of_event</a><span class="Delimiter">();</span> ++n<span class="Delimiter">)</span> <span id="L278" class="LineNr">278 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+n<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span>n<span class="Delimiter">));</span> <span id="L279" class="LineNr">279 </span> <span class="Delimiter">}</span> diff --git a/html/087file.cc.html b/html/087file.cc.html index 25952ce2..a42e29b4 100644 --- a/html/087file.cc.html +++ b/html/087file.cc.html @@ -172,7 +172,7 @@ if ('onhashchange' in window) { <span id="L111" class="LineNr">111 </span> <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> x = <span class="Normal">static_cast</span><<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span>><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> <span id="L112" class="LineNr">112 </span> <span class="Normal">FILE</span>* f = <span class="Normal">reinterpret_cast</span><<span class="Normal">FILE</span>*><span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L113" class="LineNr">113 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>f == <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L114" class="LineNr">114 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"can't read from null file in '"</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L114" class="LineNr">114 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"can't read from null file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> <span id="L115" class="LineNr">115 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L116" class="LineNr">116 </span> <span class="Delimiter">}</span> <span id="L117" class="LineNr">117 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> @@ -192,7 +192,7 @@ if ('onhashchange' in window) { <span id="L131" class="LineNr">131 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L132" class="LineNr">132 </span> <span class="Delimiter">}</span> <span id="L133" class="LineNr">133 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ferror<span class="Delimiter">(</span>f<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L134" class="LineNr">134 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't read from file in '"</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L134" class="LineNr">134 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't read from file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> <span id="L135" class="LineNr">135 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">" errno: "</span> << errno << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L136" class="LineNr">136 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L137" class="LineNr">137 </span> <span class="Delimiter">}</span> @@ -232,7 +232,7 @@ if ('onhashchange' in window) { <span id="L171" class="LineNr">171 </span> <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> x = <span class="Normal">static_cast</span><<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span>><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> <span id="L172" class="LineNr">172 </span> <span class="Normal">FILE</span>* f = <span class="Normal">reinterpret_cast</span><<span class="Normal">FILE</span>*><span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L173" class="LineNr">173 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>f == <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L174" class="LineNr">174 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"can't write to null file in '"</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L174" class="LineNr">174 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"can't write to null file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> <span id="L175" class="LineNr">175 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L176" class="LineNr">176 </span> <span class="Delimiter">}</span> <span id="L177" class="LineNr">177 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>feof<span class="Delimiter">(</span>f<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -244,7 +244,7 @@ if ('onhashchange' in window) { <span id="L183" class="LineNr">183 </span> <span class="Normal">char</span> c = <span class="Normal">static_cast</span><<span class="Normal">char</span>><span class="Delimiter">(</span>y<span class="Delimiter">);</span> <span id="L184" class="LineNr">184 </span> putc<span class="Delimiter">(</span>c<span class="Delimiter">,</span> f<span class="Delimiter">);</span> <span class="Comment">// todo: unicode</span> <span id="L185" class="LineNr">185 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ferror<span class="Delimiter">(</span>f<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L186" class="LineNr">186 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't write to file in '"</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L186" class="LineNr">186 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't write to file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> <span id="L187" class="LineNr">187 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">" errno: "</span> << errno << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L188" class="LineNr">188 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L189" class="LineNr">189 </span> <span class="Delimiter">}</span> diff --git a/html/088file.mu.html b/html/088file.mu.html index 88c45143..f4b0be86 100644 --- a/html/088file.mu.html +++ b/html/088file.mu.html @@ -81,7 +81,7 @@ if ('onhashchange' in window) { <span id="L20" class="LineNr"> 20 </span> <span id="L21" class="LineNr"> 21 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L21'>start-reading</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text<span class="muRecipe"> -> </span>contents:&:<a href='075channel.mu.html#L43'>source</a>:char, error?:bool [ <span id="L22" class="LineNr"> 22 </span> <span class="Constant">local-scope</span> -<span id="L23" class="LineNr"> 23 </span> <span class="Constant">load-ingredients</span> +<span id="L23" class="LineNr"> 23 </span> <span class="Constant">load-inputs</span> <span id="L24" class="LineNr"> 24 </span> error? <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L25" class="LineNr"> 25 </span> <span class="Delimiter">{</span> <span id="L26" class="LineNr"> 26 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='088file.mu.html#L11'>resources</a> @@ -98,7 +98,7 @@ if ('onhashchange' in window) { <span id="L37" class="LineNr"> 37 </span> <span id="L38" class="LineNr"> 38 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L38'>slurp</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text<span class="muRecipe"> -> </span>contents:text, error?:bool [ <span id="L39" class="LineNr"> 39 </span> <span class="Constant">local-scope</span> -<span id="L40" class="LineNr"> 40 </span> <span class="Constant">load-ingredients</span> +<span id="L40" class="LineNr"> 40 </span> <span class="Constant">load-inputs</span> <span id="L41" class="LineNr"> 41 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, error?:bool <span class="Special"><-</span> <a href='088file.mu.html#L21'>start-reading</a> <a href='088file.mu.html#L11'>resources</a>, filename <span id="L42" class="LineNr"> 42 </span> <span class="muControl">return-if</span> error?, <span class="Constant">0/contents</span> <span id="L43" class="LineNr"> 43 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a> <span class="Constant">30/capacity</span> @@ -113,7 +113,7 @@ if ('onhashchange' in window) { <span id="L52" class="LineNr"> 52 </span> <span id="L53" class="LineNr"> 53 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L53'>start-reading-from-fake-resource</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, <a href='088file.mu.html#L16'>resource</a>:text<span class="muRecipe"> -> </span>contents:&:<a href='075channel.mu.html#L43'>source</a>:char, error?:bool [ <span id="L54" class="LineNr"> 54 </span> <span class="Constant">local-scope</span> -<span id="L55" class="LineNr"> 55 </span> <span class="Constant">load-ingredients</span> +<span id="L55" class="LineNr"> 55 </span> <span class="Constant">load-inputs</span> <span id="L56" class="LineNr"> 56 </span> error? <span class="Special"><-</span> copy <span class="Constant">0/no-error</span> <span id="L57" class="LineNr"> 57 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L58" class="LineNr"> 58 </span> data:&:@:<a href='088file.mu.html#L16'>resource</a> <span class="Special"><-</span> get *resources, <span class="Constant">data:offset</span> @@ -136,7 +136,7 @@ if ('onhashchange' in window) { <span id="L75" class="LineNr"> 75 </span> <span id="L76" class="LineNr"> 76 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L76'>receive-from-file</a> file:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char [ <span id="L77" class="LineNr"> 77 </span> <span class="Constant">local-scope</span> -<span id="L78" class="LineNr"> 78 </span> <span class="Constant">load-ingredients</span> +<span id="L78" class="LineNr"> 78 </span> <span class="Constant">load-inputs</span> <span id="L79" class="LineNr"> 79 </span> <span class="Delimiter">{</span> <span id="L80" class="LineNr"> 80 </span> <span class="Conceal">¦</span> c:char, eof?:bool <span class="Special"><-</span> $read-from-file file <span id="L81" class="LineNr"> 81 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> eof? @@ -149,7 +149,7 @@ if ('onhashchange' in window) { <span id="L88" class="LineNr"> 88 </span> <span id="L89" class="LineNr"> 89 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L89'>receive-from-text</a> contents:text, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char [ <span id="L90" class="LineNr"> 90 </span> <span class="Constant">local-scope</span> -<span id="L91" class="LineNr"> 91 </span> <span class="Constant">load-ingredients</span> +<span id="L91" class="LineNr"> 91 </span> <span class="Constant">load-inputs</span> <span id="L92" class="LineNr"> 92 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L93" class="LineNr"> 93 </span> len:num <span class="Special"><-</span> length *contents <span id="L94" class="LineNr"> 94 </span> <span class="Delimiter">{</span> @@ -165,7 +165,7 @@ if ('onhashchange' in window) { <span id="L104" class="LineNr">104 </span> <span id="L105" class="LineNr">105 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char, routine-id:num, error?:bool [ <span id="L106" class="LineNr">106 </span> <span class="Constant">local-scope</span> -<span id="L107" class="LineNr">107 </span> <span class="Constant">load-ingredients</span> +<span id="L107" class="LineNr">107 </span> <span class="Constant">load-inputs</span> <span id="L108" class="LineNr">108 </span> error? <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L109" class="LineNr">109 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> <span id="L110" class="LineNr">110 </span> <span class="Delimiter">{</span> @@ -187,7 +187,7 @@ if ('onhashchange' in window) { <span id="L126" class="LineNr">126 </span> <span id="L127" class="LineNr">127 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L127'>dump</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text, contents:text<span class="muRecipe"> -> </span><a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, error?:bool [ <span id="L128" class="LineNr">128 </span> <span class="Constant">local-scope</span> -<span id="L129" class="LineNr">129 </span> <span class="Constant">load-ingredients</span> +<span id="L129" class="LineNr">129 </span> <span class="Constant">load-inputs</span> <span id="L130" class="LineNr">130 </span> <span class="Comment"># todo: really create an empty file</span> <span id="L131" class="LineNr">131 </span> <span class="muControl">return-unless</span> contents, <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">0/no-error</span> <span id="L132" class="LineNr">132 </span> sink-file:&:<a href='075channel.mu.html#L47'>sink</a>:char, write-routine:num, error?:bool <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, filename @@ -210,7 +210,7 @@ if ('onhashchange' in window) { <span id="L149" class="LineNr">149 </span> <span id="L150" class="LineNr">150 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L150'>transmit-to-file</a> file:num, <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L151" class="LineNr">151 </span> <span class="Constant">local-scope</span> -<span id="L152" class="LineNr">152 </span> <span class="Constant">load-ingredients</span> +<span id="L152" class="LineNr">152 </span> <span class="Constant">load-inputs</span> <span id="L153" class="LineNr">153 </span> <span class="Delimiter">{</span> <span id="L154" class="LineNr">154 </span> <span class="Conceal">¦</span> c:char, done?:bool, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L155" class="LineNr">155 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? @@ -222,7 +222,7 @@ if ('onhashchange' in window) { <span id="L161" class="LineNr">161 </span> <span id="L162" class="LineNr">162 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L162'>transmit-to-fake-resource</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text, <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char<span class="muRecipe"> -> </span><a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L163" class="LineNr">163 </span> <span class="Constant">local-scope</span> -<span id="L164" class="LineNr">164 </span> <span class="Constant">load-ingredients</span> +<span id="L164" class="LineNr">164 </span> <span class="Constant">load-inputs</span> <span id="L165" class="LineNr">165 </span> lock:location <span class="Special"><-</span> get-location *resources, <span class="Constant">lock:offset</span> <span id="L166" class="LineNr">166 </span> wait-for-reset-then-set lock <span id="L167" class="LineNr">167 </span> <span class="Comment"># compute new file contents</span> diff --git a/html/092socket.mu.html b/html/092socket.mu.html index 2c3412a3..10daadb9 100644 --- a/html/092socket.mu.html +++ b/html/092socket.mu.html @@ -87,7 +87,7 @@ if ('onhashchange' in window) { <span id="L25" class="LineNr"> 25 </span><span class="Comment"># helper just for this scenario</span> <span id="L26" class="LineNr"> 26 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L26'>example-handler</a> query:text<span class="muRecipe"> -> </span>response:text [ <span id="L27" class="LineNr"> 27 </span> <span class="Constant">local-scope</span> -<span id="L28" class="LineNr"> 28 </span> <span class="Constant">load-ingredients</span> +<span id="L28" class="LineNr"> 28 </span> <span class="Constant">load-inputs</span> <span id="L29" class="LineNr"> 29 </span> <span class="muControl">return</span> <span class="Constant">[abc]</span> <span id="L30" class="LineNr"> 30 </span>] <span id="L31" class="LineNr"> 31 </span> @@ -116,7 +116,7 @@ if ('onhashchange' in window) { <span id="L54" class="LineNr"> 54 </span> <span id="L55" class="LineNr"> 55 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L55'>serve-one-request</a> socket:num, <a href='092socket.mu.html#L53'>request-handler</a>:<a href='092socket.mu.html#L53'>request-handler</a><span class="muRecipe"> -> </span>socket:num [ <span id="L56" class="LineNr"> 56 </span> <span class="Constant">local-scope</span> -<span id="L57" class="LineNr"> 57 </span> <span class="Constant">load-ingredients</span> +<span id="L57" class="LineNr"> 57 </span> <span class="Constant">load-inputs</span> <span id="L58" class="LineNr"> 58 </span> session:num <span class="Special"><-</span> $accept socket <span id="L59" class="LineNr"> 59 </span> assert session, <span class="Constant">[ </span> <span id="L60" class="LineNr"> 60 </span><span class="Constant">F - example-server-test: $accept failed]</span> @@ -130,9 +130,9 @@ if ('onhashchange' in window) { <span id="L68" class="LineNr"> 68 </span> <span id="L69" class="LineNr"> 69 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, uri:text<span class="muRecipe"> -> </span>contents:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L70" class="LineNr"> 70 </span> <span class="Constant">local-scope</span> -<span id="L71" class="LineNr"> 71 </span> <span class="Constant">load-ingredients</span> +<span id="L71" class="LineNr"> 71 </span> <span class="Constant">load-inputs</span> <span id="L72" class="LineNr"> 72 </span> <span class="Delimiter">{</span> -<span id="L73" class="LineNr"> 73 </span> <span class="Conceal">¦</span> port:num, port-found?:boolean <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L73" class="LineNr"> 73 </span> <span class="Conceal">¦</span> port:num, port-found?:boolean <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L74" class="LineNr"> 74 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> port-found? <span id="L75" class="LineNr"> 75 </span> <span class="Conceal">¦</span> port <span class="Special"><-</span> copy <span class="Constant">80/http-port</span> <span id="L76" class="LineNr"> 76 </span> <span class="Delimiter">}</span> @@ -154,7 +154,7 @@ if ('onhashchange' in window) { <span id="L92" class="LineNr"> 92 </span> <span id="L93" class="LineNr"> 93 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L93'>request-socket</a> socket:num, s:text<span class="muRecipe"> -> </span>socket:num [ <span id="L94" class="LineNr"> 94 </span> <span class="Constant">local-scope</span> -<span id="L95" class="LineNr"> 95 </span> <span class="Constant">load-ingredients</span> +<span id="L95" class="LineNr"> 95 </span> <span class="Constant">load-inputs</span> <span id="L96" class="LineNr"> 96 </span> <a href='092socket.mu.html#L132'>write-to-socket</a> socket, s <span id="L97" class="LineNr"> 97 </span> $write-to-socket socket, <span class="Constant">13/cr</span> <span id="L98" class="LineNr"> 98 </span> $write-to-socket socket, <span class="Constant">10/lf</span> @@ -165,7 +165,7 @@ if ('onhashchange' in window) { <span id="L103" class="LineNr">103 </span> <span id="L104" class="LineNr">104 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L104'>receive-from-socket</a> socket:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char, socket:num [ <span id="L105" class="LineNr">105 </span> <span class="Constant">local-scope</span> -<span id="L106" class="LineNr">106 </span> <span class="Constant">load-ingredients</span> +<span id="L106" class="LineNr">106 </span> <span class="Constant">load-inputs</span> <span id="L107" class="LineNr">107 </span> <span class="Delimiter">{</span> <span id="L108" class="LineNr">108 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> +next-attempt</span> <span id="L109" class="LineNr">109 </span> <span class="Conceal">¦</span> c:char, found?:bool, eof?:bool, error:num <span class="Special"><-</span> $read-from-socket socket @@ -186,14 +186,14 @@ if ('onhashchange' in window) { <span id="L124" class="LineNr">124 </span> <span id="L125" class="LineNr">125 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L125'>receive-from-client-socket-and-close</a> socket:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char, socket:num [ <span id="L126" class="LineNr">126 </span> <span class="Constant">local-scope</span> -<span id="L127" class="LineNr">127 </span> <span class="Constant">load-ingredients</span> +<span id="L127" class="LineNr">127 </span> <span class="Constant">load-inputs</span> <span id="L128" class="LineNr">128 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='092socket.mu.html#L104'>receive-from-socket</a> socket, <a href='075channel.mu.html#L47'>sink</a> <span id="L129" class="LineNr">129 </span> socket <span class="Special"><-</span> $close-socket socket <span id="L130" class="LineNr">130 </span>] <span id="L131" class="LineNr">131 </span> <span id="L132" class="LineNr">132 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L132'>write-to-socket</a> socket:num, s:text [ <span id="L133" class="LineNr">133 </span> <span class="Constant">local-scope</span> -<span id="L134" class="LineNr">134 </span> <span class="Constant">load-ingredients</span> +<span id="L134" class="LineNr">134 </span> <span class="Constant">load-inputs</span> <span id="L135" class="LineNr">135 </span> len:num <span class="Special"><-</span> length *s <span id="L136" class="LineNr">136 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L137" class="LineNr">137 </span> <span class="Delimiter">{</span> @@ -209,7 +209,7 @@ if ('onhashchange' in window) { <span id="L147" class="LineNr">147 </span><span class="Comment"># like split-first, but don't eat the delimiter</span> <span id="L148" class="LineNr">148 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L148'>split-at</a> text:text, delim:char<span class="muRecipe"> -> </span>x:text, y:text [ <span id="L149" class="LineNr">149 </span> <span class="Constant">local-scope</span> -<span id="L150" class="LineNr">150 </span> <span class="Constant">load-ingredients</span> +<span id="L150" class="LineNr">150 </span> <span class="Constant">load-inputs</span> <span id="L151" class="LineNr">151 </span> <span class="Comment"># empty text? return empty texts</span> <span id="L152" class="LineNr">152 </span> len:num <span class="Special"><-</span> length *text <span id="L153" class="LineNr">153 </span> <span class="Delimiter">{</span> diff --git a/html/099hardware_checks.cc.html b/html/099hardware_checks.cc.html index 80835903..d844615a 100644 --- a/html/099hardware_checks.cc.html +++ b/html/099hardware_checks.cc.html @@ -101,7 +101,7 @@ if ('onhashchange' in window) { <span id="L38" class="LineNr">38 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- check if <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" has any dependency-injection mistakes"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L39" class="LineNr">39 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L40" class="LineNr">40 </span> <span class="Conceal">¦</span> <span class="Normal">const</span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> -<span id="L41" class="LineNr">41 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='028call_return.cc.html#L114'>is_primitive</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L41" class="LineNr">41 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='028call_return.cc.html#L115'>is_primitive</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L42" class="LineNr">42 </span> <span class="Conceal">¦</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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L43" class="LineNr">43 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">const</span> reagent& ing = inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L44" class="LineNr">44 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>ing<span class="Delimiter">)</span> || ing<span class="Delimiter">.</span>name != <span class="Constant">"0"</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> @@ -111,7 +111,7 @@ if ('onhashchange' in window) { <span id="L48" class="LineNr">48 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">const</span> reagent& expected_ing = callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L49" class="LineNr">49 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> j = <span class="Constant">0</span><span class="Delimiter">;</span> j < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Real_hardware_types<span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L50" class="LineNr">50 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>*Real_hardware_types<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">)</span> == *expected_ing<span class="Delimiter">.</span>type<span class="Delimiter">)</span> -<span id="L51" class="LineNr">51 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"': only 'main' can pass 0 into a "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>expected_ing<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L51" class="LineNr">51 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"': only 'main' can pass 0 into a "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>expected_ing<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L52" class="LineNr">52 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L53" class="LineNr">53 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L54" class="LineNr">54 </span> <span class="Delimiter">}</span> diff --git a/html/100trace_browser.cc.html b/html/100trace_browser.cc.html index b452edf2..20d31092 100644 --- a/html/100trace_browser.cc.html +++ b/html/100trace_browser.cc.html @@ -558,7 +558,7 @@ if ('onhashchange' in window) { <span id="L498" class="LineNr">498 </span> <span class="Conceal">¦</span> exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L499" class="LineNr">499 </span> <span class="Delimiter">}</span> <span id="L500" class="LineNr">500 </span> Trace_stream = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> -<span id="L501" class="LineNr">501 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L238'>has_data</a><span class="Delimiter">(</span>tin<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L501" class="LineNr">501 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>tin<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L502" class="LineNr">502 </span> <span class="Conceal">¦</span> tin >> std::noskipws<span class="Delimiter">;</span> <span id="L503" class="LineNr">503 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>tin<span class="Delimiter">);</span> <span id="L504" class="LineNr">504 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!isdigit<span class="Delimiter">(</span>tin<span class="Delimiter">.</span>peek<span class="Delimiter">()))</span> <span class="Delimiter">{</span> diff --git a/html/101run_sandboxed.cc.html b/html/101run_sandboxed.cc.html index 0dde51a3..2a5da79f 100644 --- a/html/101run_sandboxed.cc.html +++ b/html/101run_sandboxed.cc.html @@ -521,7 +521,7 @@ if ('onhashchange' in window) { <span id="L457" class="LineNr">457 </span> <span class="Conceal">¦</span> <span class="Comment">// x:text <- new [abc]</span> <span id="L458" class="LineNr">458 </span> <span class="Conceal">¦</span> <span class="Comment">// => abc</span> <span id="L459" class="LineNr">459 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='010vm.cc.html#L32'>instruction</a><span class="Delimiter">.</span>products<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L460" class="LineNr">460 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='027call_ingredient.cc.html#L174'>is_mu_text</a><span class="Delimiter">(</span><a href='010vm.cc.html#L32'>instruction</a><span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L460" class="LineNr">460 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='027call_ingredient.cc.html#L177'>is_mu_text</a><span class="Delimiter">(</span><a href='010vm.cc.html#L32'>instruction</a><span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span id="L461" class="LineNr">461 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!scalar<span class="Delimiter">(</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// error handled elsewhere</span> <span id="L462" class="LineNr">462 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> out << <a href='038new_text.cc.html#L143'>read_mu_text</a><span class="Delimiter">(</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L463" class="LineNr">463 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> @@ -552,7 +552,7 @@ if ('onhashchange' in window) { <span id="L488" class="LineNr">488 </span><span class="Normal">int</span> <a href='101run_sandboxed.cc.html#L488'>stringified_value_of_location</a><span class="Delimiter">(</span><span class="Normal">int</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L489" class="LineNr">489 </span> <span class="Comment">// convert to string</span> <span id="L490" class="LineNr">490 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L491" class="LineNr">491 </span> out << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">));</span> +<span id="L491" class="LineNr">491 </span> out << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L82'>address</a><span class="Delimiter">));</span> <span id="L492" class="LineNr">492 </span> <span class="Identifier">return</span> <a href='038new_text.cc.html#L38'>new_mu_text</a><span class="Delimiter">(</span>out<span class="Delimiter">.</span>str<span class="Delimiter">());</span> <span id="L493" class="LineNr">493 </span><span class="Delimiter">}</span> <span id="L494" class="LineNr">494 </span> diff --git a/html/channel.mu.html b/html/channel.mu.html index 8144078a..13dd7638 100644 --- a/html/channel.mu.html +++ b/html/channel.mu.html @@ -63,7 +63,7 @@ if ('onhashchange' in window) { <span id="L3" class="LineNr"> 3 </span><span class="muRecipe">def</span> <a href='channel.mu.html#L3'>producer</a> <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char [ <span id="L4" class="LineNr"> 4 </span> <span class="Comment"># produce characters 1 to 5 on a channel</span> <span id="L5" class="LineNr"> 5 </span> <span class="Constant">local-scope</span> -<span id="L6" class="LineNr"> 6 </span> <span class="Constant">load-ingredients</span> +<span id="L6" class="LineNr"> 6 </span> <span class="Constant">load-inputs</span> <span id="L7" class="LineNr"> 7 </span> <span class="Comment"># n = 0</span> <span id="L8" class="LineNr"> 8 </span> n:char <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L9" class="LineNr"> 9 </span> <span class="Delimiter">{</span> @@ -82,7 +82,7 @@ if ('onhashchange' in window) { <span id="L22" class="LineNr">22 </span><span class="muRecipe">def</span> <a href='channel.mu.html#L22'>consumer</a> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L23" class="LineNr">23 </span> <span class="Comment"># consume and print integers from a channel</span> <span id="L24" class="LineNr">24 </span> <span class="Constant">local-scope</span> -<span id="L25" class="LineNr">25 </span> <span class="Constant">load-ingredients</span> +<span id="L25" class="LineNr">25 </span> <span class="Constant">load-inputs</span> <span id="L26" class="LineNr">26 </span> <span class="Delimiter">{</span> <span id="L27" class="LineNr">27 </span> <span class="Conceal">¦</span> <span class="Comment"># read an integer from the channel</span> <span id="L28" class="LineNr">28 </span> <span class="Conceal">¦</span> n:char, eof?:bool, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> diff --git a/html/chessboard.mu.html b/html/chessboard.mu.html index 7376039a..77d0c653 100644 --- a/html/chessboard.mu.html +++ b/html/chessboard.mu.html @@ -70,7 +70,7 @@ if ('onhashchange' in window) { <span id="L6" class="LineNr"> 6 </span> open-console <span class="Comment"># take control of screen, keyboard and mouse</span> <span id="L7" class="LineNr"> 7 </span> <a href='081print.mu.html#L46'>clear-screen</a> <span class="Constant">0/screen</span> <span class="Comment"># non-scrolling app</span> <span id="L8" class="LineNr"> 8 </span> -<span id="L9" class="LineNr"> 9 </span> <span class="Comment"># The chessboard function takes keyboard and screen objects as 'ingredients'.</span> +<span id="L9" class="LineNr"> 9 </span> <span class="Comment"># The chessboard function takes keyboard and screen objects as inputs.</span> <span id="L10" class="LineNr"> 10 </span> <span class="Comment">#</span> <span id="L11" class="LineNr"> 11 </span> <span class="Comment"># In Mu it is good form (though not required) to explicitly state what</span> <span id="L12" class="LineNr"> 12 </span> <span class="Comment"># hardware a function needs.</span> @@ -132,7 +132,7 @@ if ('onhashchange' in window) { <span id="L68" class="LineNr"> 68 </span> <span id="L69" class="LineNr"> 69 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L69'>chessboard</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a> [ <span id="L70" class="LineNr"> 70 </span> <span class="Constant">local-scope</span> -<span id="L71" class="LineNr"> 71 </span> <span class="Constant">load-ingredients</span> +<span id="L71" class="LineNr"> 71 </span> <span class="Constant">load-inputs</span> <span id="L72" class="LineNr"> 72 </span> <a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L180'>initial-position</a> <span id="L73" class="LineNr"> 73 </span> <span class="Comment"># hook up stdin</span> <span id="L74" class="LineNr"> 74 </span> stdin-in:&:<a href='075channel.mu.html#L43'>source</a>:char, stdin-out:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">10/capacity</span> @@ -170,7 +170,7 @@ if ('onhashchange' in window) { <span id="L106" class="LineNr">106 </span> <span id="L107" class="LineNr">107 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L107'>new-board</a> <a href='chessboard.mu.html#L180'>initial-position</a>:&:@:char<span class="muRecipe"> -> </span><a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a> [ <span id="L108" class="LineNr">108 </span> <span class="Constant">local-scope</span> -<span id="L109" class="LineNr">109 </span> <span class="Constant">load-ingredients</span> +<span id="L109" class="LineNr">109 </span> <span class="Constant">load-inputs</span> <span id="L110" class="LineNr">110 </span> <span class="Comment"># assert(length(initial-position) == 64)</span> <span id="L111" class="LineNr">111 </span> len:num <span class="Special"><-</span> length *initial-position <span id="L112" class="LineNr">112 </span> correct-length?:bool <span class="Special"><-</span> equal len,<span class="Constant"> 64</span> @@ -190,7 +190,7 @@ if ('onhashchange' in window) { <span id="L126" class="LineNr">126 </span> <span id="L127" class="LineNr">127 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L127'>new-file</a> position:&:@:char, index:num<span class="muRecipe"> -> </span>result:&:@:char [ <span id="L128" class="LineNr">128 </span> <span class="Constant">local-scope</span> -<span id="L129" class="LineNr">129 </span> <span class="Constant">load-ingredients</span> +<span id="L129" class="LineNr">129 </span> <span class="Constant">load-inputs</span> <span id="L130" class="LineNr">130 </span> index <span class="Special"><-</span> multiply index,<span class="Constant"> 8</span> <span id="L131" class="LineNr">131 </span> result <span class="Special"><-</span> new <span class="Constant">character:type</span>,<span class="Constant"> 8</span> <span id="L132" class="LineNr">132 </span> row:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> @@ -207,7 +207,7 @@ if ('onhashchange' in window) { <span id="L143" class="LineNr">143 </span> <span id="L144" class="LineNr">144 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L144'>print-board</a> <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a>, <a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L145" class="LineNr">145 </span> <span class="Constant">local-scope</span> -<span id="L146" class="LineNr">146 </span> <span class="Constant">load-ingredients</span> +<span id="L146" class="LineNr">146 </span> <span class="Constant">load-inputs</span> <span id="L147" class="LineNr">147 </span> row:num <span class="Special"><-</span> copy<span class="Constant"> 7</span> <span class="Comment"># start printing from the top of the board</span> <span id="L148" class="LineNr">148 </span> space:char <span class="Special"><-</span> copy <span class="Constant">32/space</span> <span id="L149" class="LineNr">149 </span> <span class="Comment"># print each row</span> @@ -301,7 +301,7 @@ if ('onhashchange' in window) { <span id="L237" class="LineNr">237 </span><span class="Comment"># prints only error messages to screen</span> <span id="L238" class="LineNr">238 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L238'>read-move</a> stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>result:&:<a href='chessboard.mu.html#L229'>move</a>, quit?:bool, error?:bool, stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L239" class="LineNr">239 </span> <span class="Constant">local-scope</span> -<span id="L240" class="LineNr">240 </span> <span class="Constant">load-ingredients</span> +<span id="L240" class="LineNr">240 </span> <span class="Constant">load-inputs</span> <span id="L241" class="LineNr">241 </span> from-file:num, quit?:bool, error?:bool <span class="Special"><-</span> <a href='chessboard.mu.html#L266'>read-file</a> stdin, <a href='081print.mu.html#L16'>screen</a> <span id="L242" class="LineNr">242 </span> <span class="muControl">return-if</span> quit?, <span class="Constant">0/dummy</span> <span id="L243" class="LineNr">243 </span> <span class="muControl">return-if</span> error?, <span class="Constant">0/dummy</span> @@ -329,7 +329,7 @@ if ('onhashchange' in window) { <span id="L265" class="LineNr">265 </span><span class="Comment"># valid values for file: 0-7</span> <span id="L266" class="LineNr">266 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L266'>read-file</a> stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>file:num, quit:bool, error:bool, stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L267" class="LineNr">267 </span> <span class="Constant">local-scope</span> -<span id="L268" class="LineNr">268 </span> <span class="Constant">load-ingredients</span> +<span id="L268" class="LineNr">268 </span> <span class="Constant">load-inputs</span> <span id="L269" class="LineNr">269 </span> c:char, eof?:bool, stdin <span class="Special"><-</span> read stdin <span id="L270" class="LineNr">270 </span> <span class="muControl">return-if</span> eof?, <span class="Constant">0/dummy</span>, <span class="Constant">1/quit</span>, <span class="Constant">0/error</span> <span id="L271" class="LineNr">271 </span> q-pressed?:bool <span class="Special"><-</span> equal c, <span class="Constant">81/Q</span> @@ -367,7 +367,7 @@ if ('onhashchange' in window) { <span id="L303" class="LineNr">303 </span><span class="Comment"># valid values for rank: 0-7</span> <span id="L304" class="LineNr">304 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L304'>read-rank</a> stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>rank:num, quit?:bool, error?:bool, stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L305" class="LineNr">305 </span> <span class="Constant">local-scope</span> -<span id="L306" class="LineNr">306 </span> <span class="Constant">load-ingredients</span> +<span id="L306" class="LineNr">306 </span> <span class="Constant">load-inputs</span> <span id="L307" class="LineNr">307 </span> c:char, eof?:bool, stdin <span class="Special"><-</span> read stdin <span id="L308" class="LineNr">308 </span> <span class="muControl">return-if</span> eof?, <span class="Constant">0/dummy</span>, <span class="Constant">1/quit</span>, <span class="Constant">0/error</span> <span id="L309" class="LineNr">309 </span> q-pressed?:bool <span class="Special"><-</span> equal c, <span class="Constant">81/Q</span> @@ -405,7 +405,7 @@ if ('onhashchange' in window) { <span id="L341" class="LineNr">341 </span><span class="Comment"># return true on error</span> <span id="L342" class="LineNr">342 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L342'>expect-from-channel</a> stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, expected:char, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>result:bool, stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> [ <span id="L343" class="LineNr">343 </span> <span class="Constant">local-scope</span> -<span id="L344" class="LineNr">344 </span> <span class="Constant">load-ingredients</span> +<span id="L344" class="LineNr">344 </span> <span class="Constant">load-inputs</span> <span id="L345" class="LineNr">345 </span> c:char, eof?:bool, stdin <span class="Special"><-</span> read stdin <span id="L346" class="LineNr">346 </span> <span class="muControl">return-if</span> eof? <span class="Constant">1/true</span> <span id="L347" class="LineNr">347 </span> <span class="Delimiter">{</span> @@ -422,7 +422,7 @@ if ('onhashchange' in window) { <span id="L358" class="LineNr">358 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> <span id="L359" class="LineNr">359 </span> read-move-routine:num/routine <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L238'>read-move</a>, <a href='075channel.mu.html#L43'>source</a>, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> <span id="L360" class="LineNr">360 </span> run [ -<span id="L361" class="LineNr">361 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for input</span> +<span id="L361" class="LineNr">361 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for keypress</span> <span id="L362" class="LineNr">362 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L363" class="LineNr">363 </span> <span class="Conceal">¦</span> read-move-state:num <span class="Special"><-</span> routine-state read-move-routine <span id="L364" class="LineNr">364 </span> <span class="Conceal">¦</span> waiting?:bool <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> @@ -431,7 +431,7 @@ if ('onhashchange' in window) { <span id="L367" class="LineNr">367 </span> <span class="Conceal">¦</span> <span class="Comment"># press 'a'</span> <span id="L368" class="LineNr">368 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L67'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">97/a</span> <span id="L369" class="LineNr">369 </span> <span class="Conceal">¦</span> restart read-move-routine -<span id="L370" class="LineNr">370 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for input</span> +<span id="L370" class="LineNr">370 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for keypress</span> <span id="L371" class="LineNr">371 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L372" class="LineNr">372 </span> <span class="Conceal">¦</span> read-move-state <span class="Special"><-</span> routine-state read-move-routine <span id="L373" class="LineNr">373 </span> <span class="Conceal">¦</span> waiting? <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> @@ -440,7 +440,7 @@ if ('onhashchange' in window) { <span id="L376" class="LineNr">376 </span> <span class="Conceal">¦</span> <span class="Comment"># press '2'</span> <span id="L377" class="LineNr">377 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L67'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">50/'2'</span> <span id="L378" class="LineNr">378 </span> <span class="Conceal">¦</span> restart read-move-routine -<span id="L379" class="LineNr">379 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for input</span> +<span id="L379" class="LineNr">379 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for keypress</span> <span id="L380" class="LineNr">380 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L381" class="LineNr">381 </span> <span class="Conceal">¦</span> read-move-state <span class="Special"><-</span> routine-state read-move-routine <span id="L382" class="LineNr">382 </span> <span class="Conceal">¦</span> waiting? <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> @@ -449,7 +449,7 @@ if ('onhashchange' in window) { <span id="L385" class="LineNr">385 </span> <span class="Conceal">¦</span> <span class="Comment"># press '-'</span> <span id="L386" class="LineNr">386 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L67'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">45/'-'</span> <span id="L387" class="LineNr">387 </span> <span class="Conceal">¦</span> restart read-move-routine -<span id="L388" class="LineNr">388 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for input</span> +<span id="L388" class="LineNr">388 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for keypress</span> <span id="L389" class="LineNr">389 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L390" class="LineNr">390 </span> <span class="Conceal">¦</span> read-move-state <span class="Special"><-</span> routine-state read-move-routine <span id="L391" class="LineNr">391 </span> <span class="Conceal">¦</span> waiting? <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> @@ -458,7 +458,7 @@ if ('onhashchange' in window) { <span id="L394" class="LineNr">394 </span> <span class="Conceal">¦</span> <span class="Comment"># press 'a'</span> <span id="L395" class="LineNr">395 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L67'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">97/a</span> <span id="L396" class="LineNr">396 </span> <span class="Conceal">¦</span> restart read-move-routine -<span id="L397" class="LineNr">397 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for input</span> +<span id="L397" class="LineNr">397 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for keypress</span> <span id="L398" class="LineNr">398 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L399" class="LineNr">399 </span> <span class="Conceal">¦</span> read-move-state <span class="Special"><-</span> routine-state read-move-routine <span id="L400" class="LineNr">400 </span> <span class="Conceal">¦</span> waiting? <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> @@ -467,7 +467,7 @@ if ('onhashchange' in window) { <span id="L403" class="LineNr">403 </span> <span class="Conceal">¦</span> <span class="Comment"># press '4'</span> <span id="L404" class="LineNr">404 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L67'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">52/'4'</span> <span id="L405" class="LineNr">405 </span> <span class="Conceal">¦</span> restart read-move-routine -<span id="L406" class="LineNr">406 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for input</span> +<span id="L406" class="LineNr">406 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for keypress</span> <span id="L407" class="LineNr">407 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L408" class="LineNr">408 </span> <span class="Conceal">¦</span> read-move-state <span class="Special"><-</span> routine-state read-move-routine <span id="L409" class="LineNr">409 </span> <span class="Conceal">¦</span> waiting? <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> @@ -495,7 +495,7 @@ if ('onhashchange' in window) { <span id="L431" class="LineNr">431 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> <span id="L432" class="LineNr">432 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L238'>read-move</a>, <a href='075channel.mu.html#L43'>source</a>, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> <span id="L433" class="LineNr">433 </span> run [ -<span id="L434" class="LineNr">434 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for input</span> +<span id="L434" class="LineNr">434 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for keypress</span> <span id="L435" class="LineNr">435 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L436" class="LineNr">436 </span> <span class="Conceal">¦</span> read-move-state:num <span class="Special"><-</span> routine-state read-move-routine <span id="L437" class="LineNr">437 </span> <span class="Conceal">¦</span> waiting?:bool <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> @@ -523,7 +523,7 @@ if ('onhashchange' in window) { <span id="L459" class="LineNr">459 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> <span id="L460" class="LineNr">460 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L238'>read-move</a>, <a href='075channel.mu.html#L43'>source</a>, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> <span id="L461" class="LineNr">461 </span> run [ -<span id="L462" class="LineNr">462 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for input</span> +<span id="L462" class="LineNr">462 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for keypress</span> <span id="L463" class="LineNr">463 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L464" class="LineNr">464 </span> <span class="Conceal">¦</span> read-move-state:num <span class="Special"><-</span> routine-state read-move-routine <span id="L465" class="LineNr">465 </span> <span class="Conceal">¦</span> waiting?:bool <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> @@ -545,7 +545,7 @@ if ('onhashchange' in window) { <span id="L481" class="LineNr">481 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> <span id="L482" class="LineNr">482 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L238'>read-move</a>, <a href='075channel.mu.html#L43'>source</a>, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> <span id="L483" class="LineNr">483 </span> run [ -<span id="L484" class="LineNr">484 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for input</span> +<span id="L484" class="LineNr">484 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for keypress</span> <span id="L485" class="LineNr">485 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L486" class="LineNr">486 </span> <span class="Conceal">¦</span> read-move-state:num <span class="Special"><-</span> routine-state read-move-routine <span id="L487" class="LineNr">487 </span> <span class="Conceal">¦</span> waiting?:bool <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> @@ -568,7 +568,7 @@ if ('onhashchange' in window) { <span id="L504" class="LineNr">504 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> <span id="L505" class="LineNr">505 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L238'>read-move</a>, <a href='075channel.mu.html#L43'>source</a>, <a href='081print.mu.html#L16'>screen</a>:&:<a href='081print.mu.html#L16'>screen</a> <span id="L506" class="LineNr">506 </span> run [ -<span id="L507" class="LineNr">507 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for input</span> +<span id="L507" class="LineNr">507 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for keypress</span> <span id="L508" class="LineNr">508 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L509" class="LineNr">509 </span> <span class="Conceal">¦</span> read-move-state:num <span class="Special"><-</span> routine-state read-move-routine <span id="L510" class="LineNr">510 </span> <span class="Conceal">¦</span> waiting?:bool <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> @@ -587,7 +587,7 @@ if ('onhashchange' in window) { <span id="L523" class="LineNr">523 </span> <span id="L524" class="LineNr">524 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L524'>make-move</a> <a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a>, m:&:<a href='chessboard.mu.html#L229'>move</a><span class="muRecipe"> -> </span><a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a> [ <span id="L525" class="LineNr">525 </span> <span class="Constant">local-scope</span> -<span id="L526" class="LineNr">526 </span> <span class="Constant">load-ingredients</span> +<span id="L526" class="LineNr">526 </span> <span class="Constant">load-inputs</span> <span id="L527" class="LineNr">527 </span> from-file:num <span class="Special"><-</span> get *m, <span class="Constant">from-file:offset</span> <span id="L528" class="LineNr">528 </span> from-rank:num <span class="Special"><-</span> get *m, <span class="Constant">from-rank:offset</span> <span id="L529" class="LineNr">529 </span> to-file:num <span class="Special"><-</span> get *m, <span class="Constant">to-file:offset</span> diff --git a/html/continuation1.mu.html b/html/continuation1.mu.html index 2a63f0bb..d0ec20a1 100644 --- a/html/continuation1.mu.html +++ b/html/continuation1.mu.html @@ -77,7 +77,7 @@ if ('onhashchange' in window) { <span id="L19" class="LineNr">19 </span> <span id="L20" class="LineNr">20 </span><span class="muRecipe">def</span> <a href='continuation1.mu.html#L20'>create-yielder</a><span class="muRecipe"> -> </span>n:num [ <span id="L21" class="LineNr">21 </span> <span class="Constant">local-scope</span> -<span id="L22" class="LineNr">22 </span> <span class="Constant">load-ingredients</span> +<span id="L22" class="LineNr">22 </span> <span class="Constant">load-inputs</span> <span id="L23" class="LineNr">23 </span> return-continuation-until-mark <span id="L24" class="LineNr">24 </span> <span class="muControl">return</span><span class="Constant"> 1</span> <span id="L25" class="LineNr">25 </span>] diff --git a/html/continuation2.mu.html b/html/continuation2.mu.html index 95756684..823b5227 100644 --- a/html/continuation2.mu.html +++ b/html/continuation2.mu.html @@ -88,7 +88,7 @@ if ('onhashchange' in window) { <span id="L28" class="LineNr">28 </span> <span id="L29" class="LineNr">29 </span><span class="muRecipe">def</span> <a href='continuation2.mu.html#L29'>create-yielder</a> l:&:<a href='064list.mu.html#L6'>list</a>:num<span class="muRecipe"> -> </span>n:num, done?:bool [ <span id="L30" class="LineNr">30 </span> <span class="Constant">local-scope</span> -<span id="L31" class="LineNr">31 </span> <span class="Constant">load-ingredients</span> +<span id="L31" class="LineNr">31 </span> <span class="Constant">load-inputs</span> <span id="L32" class="LineNr">32 </span> return-continuation-until-mark <span id="L33" class="LineNr">33 </span> done? <span class="Special"><-</span> equal l,<span class="Constant"> 0</span> <span id="L34" class="LineNr">34 </span> <span class="muControl">return-if</span> done?,<span class="Constant"> 0</span> diff --git a/html/continuation4.mu.html b/html/continuation4.mu.html index 2a1cd000..89fbcd3a 100644 --- a/html/continuation4.mu.html +++ b/html/continuation4.mu.html @@ -90,7 +90,7 @@ if ('onhashchange' in window) { <span id="L30" class="LineNr">30 </span> <span id="L31" class="LineNr">31 </span><span class="muRecipe">def</span> <a href='continuation4.mu.html#L31'>create-yielder</a> l:&:<a href='064list.mu.html#L6'>list</a>:num<span class="muRecipe"> -> </span>n:num, done?:bool [ <span id="L32" class="LineNr">32 </span> <span class="Constant">local-scope</span> -<span id="L33" class="LineNr">33 </span> <span class="Constant">load-ingredients</span> +<span id="L33" class="LineNr">33 </span> <span class="Constant">load-inputs</span> <span id="L34" class="LineNr">34 </span> <span class="Delimiter">{</span> <span id="L35" class="LineNr">35 </span> <span class="Conceal">¦</span> done? <span class="Special"><-</span> equal l,<span class="Constant"> 0</span> <span id="L36" class="LineNr">36 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? diff --git a/html/continuation5.mu.html b/html/continuation5.mu.html index 500e926f..961eea7a 100644 --- a/html/continuation5.mu.html +++ b/html/continuation5.mu.html @@ -59,7 +59,7 @@ if ('onhashchange' in window) { <body onload='JumpToLine();'> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Example program showing that a 'paused' continuation can be 'resumed' with</span> -<span id="L2" class="LineNr"> 2 </span><span class="Comment"># ingredients.</span> +<span id="L2" class="LineNr"> 2 </span><span class="Comment"># inputs.</span> <span id="L3" class="LineNr"> 3 </span><span class="Comment">#</span> <span id="L4" class="LineNr"> 4 </span><span class="Comment"># Print out a list of numbers, first adding 0 to the first, 1 to the second, 2</span> <span id="L5" class="LineNr"> 5 </span><span class="Comment"># to the third, and so on.</span> @@ -93,7 +93,7 @@ if ('onhashchange' in window) { <span id="L33" class="LineNr">33 </span> <span id="L34" class="LineNr">34 </span><span class="muRecipe">def</span> <a href='continuation5.mu.html#L34'>create-yielder</a> l:&:<a href='064list.mu.html#L6'>list</a>:num<span class="muRecipe"> -> </span>n:num, done?:bool [ <span id="L35" class="LineNr">35 </span> <span class="Constant">local-scope</span> -<span id="L36" class="LineNr">36 </span> <span class="Constant">load-ingredients</span> +<span id="L36" class="LineNr">36 </span> <span class="Constant">load-inputs</span> <span id="L37" class="LineNr">37 </span> a:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L38" class="LineNr">38 </span> <span class="Delimiter">{</span> <span id="L39" class="LineNr">39 </span> <span class="Conceal">¦</span> done? <span class="Special"><-</span> equal l,<span class="Constant"> 0</span> diff --git a/html/counters.mu.html b/html/counters.mu.html index a0eaed37..bc824899 100644 --- a/html/counters.mu.html +++ b/html/counters.mu.html @@ -60,12 +60,12 @@ if ('onhashchange' in window) { <span id="L3" class="LineNr"> 3 </span> <span id="L4" class="LineNr"> 4 </span><span class="muRecipe">def</span> <a href='counters.mu.html#L4'>new-counter</a> n:num<span class="muRecipe"> -> </span><span class="Constant">default-space</span>:space [ <span id="L5" class="LineNr"> 5 </span> <span class="Constant">default-space</span> <span class="Special"><-</span> new <span class="Constant">location:type</span>,<span class="Constant"> 30</span> -<span id="L6" class="LineNr"> 6 </span> <span class="Constant">load-ingredients</span> <span class="Comment"># initialize n</span> +<span id="L6" class="LineNr"> 6 </span> <span class="Constant">load-inputs</span> <span class="Comment"># initialize n</span> <span id="L7" class="LineNr"> 7 </span>] <span id="L8" class="LineNr"> 8 </span> <span id="L9" class="LineNr"> 9 </span><span class="muRecipe">def</span> <a href='counters.mu.html#L9'>increment-counter</a> outer:space/names:<a href='counters.mu.html#L4'>new-counter</a>, x:num<span class="muRecipe"> -> </span>n:num/space:1 [ <span id="L10" class="LineNr">10 </span> <span class="Constant">local-scope</span> -<span id="L11" class="LineNr">11 </span> <span class="Constant">load-ingredients</span> +<span id="L11" class="LineNr">11 </span> <span class="Constant">load-inputs</span> <span id="L12" class="LineNr">12 </span> 0:space/names:<a href='counters.mu.html#L4'>new-counter</a> <span class="Special"><-</span> copy outer <span class="Comment"># setup outer space; it *must* come from 'new-counter'</span> <span id="L13" class="LineNr">13 </span> n/space:1 <span class="Special"><-</span> add n/space:1, x <span id="L14" class="LineNr">14 </span>] diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index 215debfd..2f22aa64 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -68,7 +68,7 @@ if ('onhashchange' in window) { <span id="L4" class="LineNr"> 4 </span><span class="Comment"># screen dimensions, then stop</span> <span id="L5" class="LineNr"> 5 </span><span class="muRecipe">def</span> main text:text [ <span id="L6" class="LineNr"> 6 </span> <span class="Constant">local-scope</span> -<span id="L7" class="LineNr"> 7 </span> <span class="Constant">load-ingredients</span> +<span id="L7" class="LineNr"> 7 </span> <span class="Constant">load-inputs</span> <span id="L8" class="LineNr"> 8 </span> open-console <span id="L9" class="LineNr"> 9 </span> <a href='../081print.mu.html#L46'>clear-screen</a> <span class="Constant">0/screen</span> <span class="Comment"># non-scrolling app</span> <span id="L10" class="LineNr"> 10 </span> e:&:editor <span class="Special"><-</span> <a href='001-editor.mu.html#L51'>new-editor</a> text, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> @@ -114,7 +114,7 @@ if ('onhashchange' in window) { <span id="L50" class="LineNr"> 50 </span><span class="Comment"># right is exclusive</span> <span id="L51" class="LineNr"> 51 </span><span class="muRecipe">def</span> <a href='001-editor.mu.html#L51'>new-editor</a> s:text, left:num, right:num<span class="muRecipe"> -> </span>result:&:editor [ <span id="L52" class="LineNr"> 52 </span> <span class="Constant">local-scope</span> -<span id="L53" class="LineNr"> 53 </span> <span class="Constant">load-ingredients</span> +<span id="L53" class="LineNr"> 53 </span> <span class="Constant">load-inputs</span> <span id="L54" class="LineNr"> 54 </span> <span class="Comment"># no clipping of bounds</span> <span id="L55" class="LineNr"> 55 </span> right <span class="Special"><-</span> subtract right,<span class="Constant"> 1</span> <span id="L56" class="LineNr"> 56 </span> result <span class="Special"><-</span> new <span class="Constant">editor:type</span> @@ -135,7 +135,7 @@ if ('onhashchange' in window) { <span id="L71" class="LineNr"> 71 </span> <span id="L72" class="LineNr"> 72 </span><span class="muRecipe">def</span> <a href='001-editor.mu.html#L72'>insert-text</a> editor:&:editor, text:text<span class="muRecipe"> -> </span>editor:&:editor [ <span id="L73" class="LineNr"> 73 </span> <span class="Constant">local-scope</span> -<span id="L74" class="LineNr"> 74 </span> <span class="Constant">load-ingredients</span> +<span id="L74" class="LineNr"> 74 </span> <span class="Constant">load-inputs</span> <span id="L75" class="LineNr"> 75 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L76" class="LineNr"> 76 </span> insert curr, text <span id="L77" class="LineNr"> 77 </span>] @@ -170,7 +170,7 @@ if ('onhashchange' in window) { <span id="L106" class="LineNr">106 </span><span class="Comment"># outside text.</span> <span id="L107" class="LineNr">107 </span><span class="muRecipe">def</span> <a href='001-editor.mu.html#L107'>render</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor<span class="muRecipe"> -> </span>last-row:num, last-column:num, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor [ <span id="L108" class="LineNr">108 </span> <span class="Constant">local-scope</span> -<span id="L109" class="LineNr">109 </span> <span class="Constant">load-ingredients</span> +<span id="L109" class="LineNr">109 </span> <span class="Constant">load-inputs</span> <span id="L110" class="LineNr">110 </span> <span class="muControl">return-unless</span> editor, <span class="Constant">1/top</span>, <span class="Constant">0/left</span> <span id="L111" class="LineNr">111 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L112" class="LineNr">112 </span> <a href='../081print.mu.html#L782'>screen-height</a>:num <span class="Special"><-</span> <a href='../081print.mu.html#L782'>screen-height</a> <a href='../081print.mu.html#L16'>screen</a> @@ -270,7 +270,7 @@ if ('onhashchange' in window) { <span id="L206" class="LineNr">206 </span> <span id="L207" class="LineNr">207 </span><span class="muRecipe">def</span> <a href='001-editor.mu.html#L207'>clear-screen-from</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, row:num, column:num, left:num, right:num<span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L208" class="LineNr">208 </span> <span class="Constant">local-scope</span> -<span id="L209" class="LineNr">209 </span> <span class="Constant">load-ingredients</span> +<span id="L209" class="LineNr">209 </span> <span class="Constant">load-inputs</span> <span id="L210" class="LineNr">210 </span><span class="CommentedCode">#? stash [clear-screen-from] row column [between] left [and] right</span> <span id="L211" class="LineNr">211 </span> <span class="Comment"># if it's the real screen, use the optimized primitive</span> <span id="L212" class="LineNr">212 </span> <span class="Delimiter">{</span> @@ -286,7 +286,7 @@ if ('onhashchange' in window) { <span id="L222" class="LineNr">222 </span> <span id="L223" class="LineNr">223 </span><span class="muRecipe">def</span> <a href='001-editor.mu.html#L223'>clear-rest-of-screen</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, row:num, left:num, right:num<span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L224" class="LineNr">224 </span> <span class="Constant">local-scope</span> -<span id="L225" class="LineNr">225 </span> <span class="Constant">load-ingredients</span> +<span id="L225" class="LineNr">225 </span> <span class="Constant">load-inputs</span> <span id="L226" class="LineNr">226 </span> row <span class="Special"><-</span> add row,<span class="Constant"> 1</span> <span id="L227" class="LineNr">227 </span> <span class="Comment"># if it's the real screen, use the optimized primitive</span> <span id="L228" class="LineNr">228 </span> <span class="Delimiter">{</span> @@ -460,7 +460,7 @@ if ('onhashchange' in window) { <span id="L396" class="LineNr">396 </span><span class="Comment"># so far the previous color is all the information we need; that may change</span> <span id="L397" class="LineNr">397 </span><span class="muRecipe">def</span> <a href='001-editor.mu.html#L397'>get-color</a> color:num, c:char<span class="muRecipe"> -> </span>color:num [ <span id="L398" class="LineNr">398 </span> <span class="Constant">local-scope</span> -<span id="L399" class="LineNr">399 </span> <span class="Constant">load-ingredients</span> +<span id="L399" class="LineNr">399 </span> <span class="Constant">load-inputs</span> <span id="L400" class="LineNr">400 </span> color-is-white?:bool <span class="Special"><-</span> equal color, <span class="Constant">7/white</span> <span id="L401" class="LineNr">401 </span> <span class="Comment"># if color is white and next character is '#', switch color to blue</span> <span id="L402" class="LineNr">402 </span> <span class="Delimiter">{</span> diff --git a/html/edit/002-typing.mu.html b/html/edit/002-typing.mu.html index eb828377..459e32c0 100644 --- a/html/edit/002-typing.mu.html +++ b/html/edit/002-typing.mu.html @@ -67,7 +67,7 @@ if ('onhashchange' in window) { <span id="L4" class="LineNr"> 4 </span><span class="Comment"># hit ctrl-c to exit</span> <span id="L5" class="LineNr"> 5 </span><span class="muRecipe">def!</span> main text:text [ <span id="L6" class="LineNr"> 6 </span> <span class="Constant">local-scope</span> -<span id="L7" class="LineNr"> 7 </span> <span class="Constant">load-ingredients</span> +<span id="L7" class="LineNr"> 7 </span> <span class="Constant">load-inputs</span> <span id="L8" class="LineNr"> 8 </span> open-console <span id="L9" class="LineNr"> 9 </span> <a href='../081print.mu.html#L46'>clear-screen</a> <span class="Constant">0/screen</span> <span class="Comment"># non-scrolling app</span> <span id="L10" class="LineNr"> 10 </span> editor:&:editor <span class="Special"><-</span> <a href='001-editor.mu.html#L51'>new-editor</a> text, <span class="Constant">5/left</span>, <span class="Constant">45/right</span> @@ -78,7 +78,7 @@ if ('onhashchange' in window) { <span id="L15" class="LineNr"> 15 </span> <span id="L16" class="LineNr"> 16 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L16'>editor-event-loop</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, <a href='../084console.mu.html#L23'>console</a>:&:<a href='../084console.mu.html#L23'>console</a>, editor:&:editor<span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, <a href='../084console.mu.html#L23'>console</a>:&:<a href='../084console.mu.html#L23'>console</a>, editor:&:editor [ <span id="L17" class="LineNr"> 17 </span> <span class="Constant">local-scope</span> -<span id="L18" class="LineNr"> 18 </span> <span class="Constant">load-ingredients</span> +<span id="L18" class="LineNr"> 18 </span> <span class="Constant">load-inputs</span> <span id="L19" class="LineNr"> 19 </span> <span class="Delimiter">{</span> <span id="L20" class="LineNr"> 20 </span> <span class="Conceal">¦</span> <span class="Comment"># looping over each (keyboard or touch) event as it occurs</span> <span id="L21" class="LineNr"> 21 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> +next-event</span> @@ -112,7 +112,7 @@ if ('onhashchange' in window) { <span id="L49" class="LineNr"> 49 </span><span class="Comment"># process click, return if it was on current editor</span> <span id="L50" class="LineNr"> 50 </span><span class="muRecipe">def</span> move-cursor editor:&:editor, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, t:<a href='../084console.mu.html#L12'>touch-event</a><span class="muRecipe"> -> </span>in-focus?:bool, editor:&:editor [ <span id="L51" class="LineNr"> 51 </span> <span class="Constant">local-scope</span> -<span id="L52" class="LineNr"> 52 </span> <span class="Constant">load-ingredients</span> +<span id="L52" class="LineNr"> 52 </span> <span class="Constant">load-inputs</span> <span id="L53" class="LineNr"> 53 </span> <span class="muControl">return-unless</span> editor, <span class="Constant">0/false</span> <span id="L54" class="LineNr"> 54 </span> click-row:num <span class="Special"><-</span> get t, <span class="Constant">row:offset</span> <span id="L55" class="LineNr"> 55 </span> <span class="muControl">return-unless</span> click-row, <span class="Constant">0/false</span> <span class="Comment"># ignore clicks on 'menu'</span> @@ -137,7 +137,7 @@ if ('onhashchange' in window) { <span id="L74" class="LineNr"> 74 </span><span class="Comment"># past the last line it positions at end of last line.</span> <span id="L75" class="LineNr"> 75 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L75'>snap-cursor</a> editor:&:editor, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, target-row:num, target-column:num<span class="muRecipe"> -> </span>editor:&:editor [ <span id="L76" class="LineNr"> 76 </span> <span class="Constant">local-scope</span> -<span id="L77" class="LineNr"> 77 </span> <span class="Constant">load-ingredients</span> +<span id="L77" class="LineNr"> 77 </span> <span class="Constant">load-inputs</span> <span id="L78" class="LineNr"> 78 </span> <span class="muControl">return-unless</span> editor <span id="L79" class="LineNr"> 79 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L80" class="LineNr"> 80 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> @@ -228,7 +228,7 @@ if ('onhashchange' in window) { <span id="L165" class="LineNr"> 165 </span><span class="Comment"># Set 'go-render?' to true to indicate the caller must perform a non-minimal update.</span> <span id="L166" class="LineNr"> 166 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L166'>handle-keyboard-event</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor, e:<a href='../084console.mu.html#L4'>event</a><span class="muRecipe"> -> </span>go-render?:bool, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor [ <span id="L167" class="LineNr"> 167 </span> <span class="Constant">local-scope</span> -<span id="L168" class="LineNr"> 168 </span> <span class="Constant">load-ingredients</span> +<span id="L168" class="LineNr"> 168 </span> <span class="Constant">load-inputs</span> <span id="L169" class="LineNr"> 169 </span> <span class="muControl">return-unless</span> editor, <span class="Constant">0/don't-render</span> <span id="L170" class="LineNr"> 170 </span> <a href='../081print.mu.html#L768'>screen-width</a>:num <span class="Special"><-</span> <a href='../081print.mu.html#L768'>screen-width</a> <a href='../081print.mu.html#L16'>screen</a> <span id="L171" class="LineNr"> 171 </span> <a href='../081print.mu.html#L782'>screen-height</a>:num <span class="Special"><-</span> <a href='../081print.mu.html#L782'>screen-height</a> <a href='../081print.mu.html#L16'>screen</a> @@ -265,7 +265,7 @@ if ('onhashchange' in window) { <span id="L202" class="LineNr"> 202 </span> <span id="L203" class="LineNr"> 203 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L203'>insert-at-cursor</a> editor:&:editor, c:char, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L204" class="LineNr"> 204 </span> <span class="Constant">local-scope</span> -<span id="L205" class="LineNr"> 205 </span> <span class="Constant">load-ingredients</span> +<span id="L205" class="LineNr"> 205 </span> <span class="Constant">load-inputs</span> <span id="L206" class="LineNr"> 206 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L207" class="LineNr"> 207 </span> insert c, before-cursor <span id="L208" class="LineNr"> 208 </span> before-cursor <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L25'>next</a> before-cursor @@ -327,7 +327,7 @@ if ('onhashchange' in window) { <span id="L264" class="LineNr"> 264 </span><span class="Comment"># helper for tests</span> <span id="L265" class="LineNr"> 265 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L265'>editor-render</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor<span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor [ <span id="L266" class="LineNr"> 266 </span> <span class="Constant">local-scope</span> -<span id="L267" class="LineNr"> 267 </span> <span class="Constant">load-ingredients</span> +<span id="L267" class="LineNr"> 267 </span> <span class="Constant">load-inputs</span> <span id="L268" class="LineNr"> 268 </span> old-top-idx:num <span class="Special"><-</span> <a href='../081print.mu.html#L509'>save-top-idx</a> <a href='../081print.mu.html#L16'>screen</a> <span id="L269" class="LineNr"> 269 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L270" class="LineNr"> 270 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> @@ -930,7 +930,7 @@ if ('onhashchange' in window) { <span id="L867" class="LineNr"> 867 </span> <span id="L868" class="LineNr"> 868 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L868'>insert-new-line-and-indent</a> editor:&:editor, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>editor:&:editor, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L869" class="LineNr"> 869 </span> <span class="Constant">local-scope</span> -<span id="L870" class="LineNr"> 870 </span> <span class="Constant">load-ingredients</span> +<span id="L870" class="LineNr"> 870 </span> <span class="Constant">load-inputs</span> <span id="L871" class="LineNr"> 871 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L872" class="LineNr"> 872 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L873" class="LineNr"> 873 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> @@ -976,7 +976,7 @@ if ('onhashchange' in window) { <span id="L913" class="LineNr"> 913 </span> <span id="L914" class="LineNr"> 914 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L914'>at-start-of-wrapped-line?</a> editor:&:editor<span class="muRecipe"> -> </span>result:bool [ <span id="L915" class="LineNr"> 915 </span> <span class="Constant">local-scope</span> -<span id="L916" class="LineNr"> 916 </span> <span class="Constant">load-ingredients</span> +<span id="L916" class="LineNr"> 916 </span> <span class="Constant">load-inputs</span> <span id="L917" class="LineNr"> 917 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L918" class="LineNr"> 918 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L919" class="LineNr"> 919 </span> cursor-at-left?:bool <span class="Special"><-</span> equal cursor-column, left @@ -996,7 +996,7 @@ if ('onhashchange' in window) { <span id="L933" class="LineNr"> 933 </span><span class="Comment"># the number of spaces at the start of the line containing 'curr'.</span> <span id="L934" class="LineNr"> 934 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L934'>line-indent</a> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char<span class="muRecipe"> -> </span>result:num [ <span id="L935" class="LineNr"> 935 </span> <span class="Constant">local-scope</span> -<span id="L936" class="LineNr"> 936 </span> <span class="Constant">load-ingredients</span> +<span id="L936" class="LineNr"> 936 </span> <span class="Constant">load-inputs</span> <span id="L937" class="LineNr"> 937 </span> result:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L938" class="LineNr"> 938 </span> <span class="muControl">return-unless</span> curr <span id="L939" class="LineNr"> 939 </span> at-start?:bool <span class="Special"><-</span> equal curr, start @@ -1178,22 +1178,22 @@ if ('onhashchange' in window) { <span id="L1115" class="LineNr">1115 </span> <span id="L1116" class="LineNr">1116 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L1116'>draw-horizontal</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, row:num, x:num, right:num<span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L1117" class="LineNr">1117 </span> <span class="Constant">local-scope</span> -<span id="L1118" class="LineNr">1118 </span> <span class="Constant">load-ingredients</span> +<span id="L1118" class="LineNr">1118 </span> <span class="Constant">load-inputs</span> <span id="L1119" class="LineNr">1119 </span> height:num <span class="Special"><-</span> <a href='../081print.mu.html#L782'>screen-height</a> <a href='../081print.mu.html#L16'>screen</a> <span id="L1120" class="LineNr">1120 </span> past-bottom?:bool <span class="Special"><-</span> greater-or-equal row, height <span id="L1121" class="LineNr">1121 </span> <span class="muControl">return-if</span> past-bottom? -<span id="L1122" class="LineNr">1122 </span> style:char, style-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L1122" class="LineNr">1122 </span> style:char, style-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L1123" class="LineNr">1123 </span> <span class="Delimiter">{</span> <span id="L1124" class="LineNr">1124 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> style-found? <span id="L1125" class="LineNr">1125 </span> <span class="Conceal">¦</span> style <span class="Special"><-</span> copy <span class="Constant">9472/horizontal</span> <span id="L1126" class="LineNr">1126 </span> <span class="Delimiter">}</span> -<span id="L1127" class="LineNr">1127 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L1127" class="LineNr">1127 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L1128" class="LineNr">1128 </span> <span class="Delimiter">{</span> <span id="L1129" class="LineNr">1129 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> <span id="L1130" class="LineNr">1130 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? <span id="L1131" class="LineNr">1131 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">245/grey</span> <span id="L1132" class="LineNr">1132 </span> <span class="Delimiter">}</span> -<span id="L1133" class="LineNr">1133 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L1133" class="LineNr">1133 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L1134" class="LineNr">1134 </span> <span class="Delimiter">{</span> <span id="L1135" class="LineNr">1135 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? <span id="L1136" class="LineNr">1136 </span> <span class="Conceal">¦</span> bg-color <span class="Special"><-</span> copy <span class="Constant">0/black</span> diff --git a/html/edit/003-shortcuts.mu.html b/html/edit/003-shortcuts.mu.html index 4d24c08d..68459fda 100644 --- a/html/edit/003-shortcuts.mu.html +++ b/html/edit/003-shortcuts.mu.html @@ -170,7 +170,7 @@ if ('onhashchange' in window) { <span id="L108" class="LineNr"> 108 </span><span class="Comment"># backspaced-cell - value deleted (or 0 if nothing was deleted) so we can save it for undo, etc.</span> <span id="L109" class="LineNr"> 109 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L109'>delete-before-cursor</a> editor:&:editor, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>go-render?:bool, backspaced-cell:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, editor:&:editor, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L110" class="LineNr"> 110 </span> <span class="Constant">local-scope</span> -<span id="L111" class="LineNr"> 111 </span> <span class="Constant">load-ingredients</span> +<span id="L111" class="LineNr"> 111 </span> <span class="Constant">load-inputs</span> <span id="L112" class="LineNr"> 112 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L113" class="LineNr"> 113 </span> data:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L114" class="LineNr"> 114 </span> <span class="Comment"># if at start of text (before-cursor at § sentinel), return</span> @@ -217,7 +217,7 @@ if ('onhashchange' in window) { <span id="L155" class="LineNr"> 155 </span> <span id="L156" class="LineNr"> 156 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L156'>move-cursor-coordinates-left</a> editor:&:editor<span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor [ <span id="L157" class="LineNr"> 157 </span> <span class="Constant">local-scope</span> -<span id="L158" class="LineNr"> 158 </span> <span class="Constant">load-ingredients</span> +<span id="L158" class="LineNr"> 158 </span> <span class="Constant">load-inputs</span> <span id="L159" class="LineNr"> 159 </span> go-render?:bool <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L160" class="LineNr"> 160 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L161" class="LineNr"> 161 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> @@ -280,7 +280,7 @@ if ('onhashchange' in window) { <span id="L218" class="LineNr"> 218 </span><span class="Comment"># the length of the previous line before the 'curr' pointer.</span> <span id="L219" class="LineNr"> 219 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L219'>previous-line-length</a> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char<span class="muRecipe"> -> </span>result:num [ <span id="L220" class="LineNr"> 220 </span> <span class="Constant">local-scope</span> -<span id="L221" class="LineNr"> 221 </span> <span class="Constant">load-ingredients</span> +<span id="L221" class="LineNr"> 221 </span> <span class="Constant">load-inputs</span> <span id="L222" class="LineNr"> 222 </span> result:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L223" class="LineNr"> 223 </span> <span class="muControl">return-unless</span> curr <span id="L224" class="LineNr"> 224 </span> at-start?:bool <span class="Special"><-</span> equal curr, start @@ -434,7 +434,7 @@ if ('onhashchange' in window) { <span id="L372" class="LineNr"> 372 </span> <span id="L373" class="LineNr"> 373 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L373'>delete-at-cursor</a> editor:&:editor, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>go-render?:bool, deleted-cell:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, editor:&:editor, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L374" class="LineNr"> 374 </span> <span class="Constant">local-scope</span> -<span id="L375" class="LineNr"> 375 </span> <span class="Constant">load-ingredients</span> +<span id="L375" class="LineNr"> 375 </span> <span class="Constant">load-inputs</span> <span id="L376" class="LineNr"> 376 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L377" class="LineNr"> 377 </span> data:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L378" class="LineNr"> 378 </span> deleted-cell:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L25'>next</a> before-cursor @@ -514,7 +514,7 @@ if ('onhashchange' in window) { <span id="L452" class="LineNr"> 452 </span> <span id="L453" class="LineNr"> 453 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L453'>move-cursor-coordinates-right</a> editor:&:editor, <a href='../081print.mu.html#L782'>screen-height</a>:num<span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor [ <span id="L454" class="LineNr"> 454 </span> <span class="Constant">local-scope</span> -<span id="L455" class="LineNr"> 455 </span> <span class="Constant">load-ingredients</span> +<span id="L455" class="LineNr"> 455 </span> <span class="Constant">load-inputs</span> <span id="L456" class="LineNr"> 456 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor <span class="Constant">before-cursor:offset</span> <span id="L457" class="LineNr"> 457 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L458" class="LineNr"> 458 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> @@ -1061,7 +1061,7 @@ if ('onhashchange' in window) { <span id="L999" class="LineNr"> 999 </span> <span id="L1000" class="LineNr">1000 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1000'>move-to-previous-line</a> editor:&:editor<span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor [ <span id="L1001" class="LineNr">1001 </span> <span class="Constant">local-scope</span> -<span id="L1002" class="LineNr">1002 </span> <span class="Constant">load-ingredients</span> +<span id="L1002" class="LineNr">1002 </span> <span class="Constant">load-inputs</span> <span id="L1003" class="LineNr">1003 </span> go-render?:bool <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L1004" class="LineNr">1004 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L1005" class="LineNr">1005 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> @@ -1415,7 +1415,7 @@ if ('onhashchange' in window) { <span id="L1353" class="LineNr">1353 </span> <span id="L1354" class="LineNr">1354 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1354'>move-to-next-line</a> editor:&:editor, <a href='../081print.mu.html#L782'>screen-height</a>:num<span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor [ <span id="L1355" class="LineNr">1355 </span> <span class="Constant">local-scope</span> -<span id="L1356" class="LineNr">1356 </span> <span class="Constant">load-ingredients</span> +<span id="L1356" class="LineNr">1356 </span> <span class="Constant">load-inputs</span> <span id="L1357" class="LineNr">1357 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L1358" class="LineNr">1358 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L1359" class="LineNr">1359 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> @@ -1626,7 +1626,7 @@ if ('onhashchange' in window) { <span id="L1564" class="LineNr">1564 </span><span class="Comment"># precondition: cursor-column should be in a consistent state</span> <span id="L1565" class="LineNr">1565 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1565'>move-to-start-of-screen-line</a> editor:&:editor<span class="muRecipe"> -> </span>editor:&:editor [ <span id="L1566" class="LineNr">1566 </span> <span class="Constant">local-scope</span> -<span id="L1567" class="LineNr">1567 </span> <span class="Constant">load-ingredients</span> +<span id="L1567" class="LineNr">1567 </span> <span class="Constant">load-inputs</span> <span id="L1568" class="LineNr">1568 </span> <span class="Comment"># update cursor column</span> <span id="L1569" class="LineNr">1569 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L1570" class="LineNr">1570 </span> col:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> @@ -1849,7 +1849,7 @@ if ('onhashchange' in window) { <span id="L1787" class="LineNr">1787 </span> <span id="L1788" class="LineNr">1788 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1788'>move-to-end-of-line</a> editor:&:editor<span class="muRecipe"> -> </span>editor:&:editor [ <span id="L1789" class="LineNr">1789 </span> <span class="Constant">local-scope</span> -<span id="L1790" class="LineNr">1790 </span> <span class="Constant">load-ingredients</span> +<span id="L1790" class="LineNr">1790 </span> <span class="Constant">load-inputs</span> <span id="L1791" class="LineNr">1791 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L1792" class="LineNr">1792 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L1793" class="LineNr">1793 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> @@ -2032,7 +2032,7 @@ if ('onhashchange' in window) { <span id="L1970" class="LineNr">1970 </span> <span id="L1971" class="LineNr">1971 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1971'>minimal-render-for-ctrl-u</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor, deleted-cells:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char<span class="muRecipe"> -> </span>go-render?:bool, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L1972" class="LineNr">1972 </span> <span class="Constant">local-scope</span> -<span id="L1973" class="LineNr">1973 </span> <span class="Constant">load-ingredients</span> +<span id="L1973" class="LineNr">1973 </span> <span class="Constant">load-inputs</span> <span id="L1974" class="LineNr">1974 </span> curr-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L1975" class="LineNr">1975 </span> <span class="Comment"># accumulate the current line as text and render it</span> <span id="L1976" class="LineNr">1976 </span> buf:&:<a href='../061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='../061text.mu.html#L125'>new-buffer</a><span class="Constant"> 30</span> <span class="Comment"># accumulator for the text we need to render</span> @@ -2067,7 +2067,7 @@ if ('onhashchange' in window) { <span id="L2005" class="LineNr">2005 </span> <span id="L2006" class="LineNr">2006 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L2006'>delete-to-start-of-line</a> editor:&:editor<span class="muRecipe"> -> </span>result:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, editor:&:editor [ <span id="L2007" class="LineNr">2007 </span> <span class="Constant">local-scope</span> -<span id="L2008" class="LineNr">2008 </span> <span class="Constant">load-ingredients</span> +<span id="L2008" class="LineNr">2008 </span> <span class="Constant">load-inputs</span> <span id="L2009" class="LineNr">2009 </span> <span class="Comment"># compute range to delete</span> <span id="L2010" class="LineNr">2010 </span> init:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L2011" class="LineNr">2011 </span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> @@ -2123,7 +2123,7 @@ if ('onhashchange' in window) { <span id="L2061" class="LineNr">2061 </span> <span id="L2062" class="LineNr">2062 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L2062'>render-code</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, s:text, left:num, right:num, row:num<span class="muRecipe"> -> </span>row:num, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L2063" class="LineNr">2063 </span> <span class="Constant">local-scope</span> -<span id="L2064" class="LineNr">2064 </span> <span class="Constant">load-ingredients</span> +<span id="L2064" class="LineNr">2064 </span> <span class="Constant">load-inputs</span> <span id="L2065" class="LineNr">2065 </span> <span class="muControl">return-unless</span> s <span id="L2066" class="LineNr">2066 </span> color:num <span class="Special"><-</span> copy <span class="Constant">7/white</span> <span id="L2067" class="LineNr">2067 </span> column:num <span class="Special"><-</span> copy left @@ -2610,7 +2610,7 @@ if ('onhashchange' in window) { <span id="L2548" class="LineNr">2548 </span> <span id="L2549" class="LineNr">2549 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L2549'>minimal-render-for-ctrl-k</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor, deleted-cells:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char<span class="muRecipe"> -> </span>go-render?:bool, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L2550" class="LineNr">2550 </span> <span class="Constant">local-scope</span> -<span id="L2551" class="LineNr">2551 </span> <span class="Constant">load-ingredients</span> +<span id="L2551" class="LineNr">2551 </span> <span class="Constant">load-inputs</span> <span id="L2552" class="LineNr">2552 </span> <span class="Comment"># if we deleted nothing, there's nothing to render</span> <span id="L2553" class="LineNr">2553 </span> <span class="muControl">return-unless</span> deleted-cells, <span class="Constant">0/dont-render</span> <span id="L2554" class="LineNr">2554 </span> <span class="Comment"># if the line used to wrap before, give up and render the whole screen</span> @@ -2628,7 +2628,7 @@ if ('onhashchange' in window) { <span id="L2566" class="LineNr">2566 </span> <span id="L2567" class="LineNr">2567 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L2567'>delete-to-end-of-line</a> editor:&:editor<span class="muRecipe"> -> </span>result:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, editor:&:editor [ <span id="L2568" class="LineNr">2568 </span> <span class="Constant">local-scope</span> -<span id="L2569" class="LineNr">2569 </span> <span class="Constant">load-ingredients</span> +<span id="L2569" class="LineNr">2569 </span> <span class="Constant">load-inputs</span> <span id="L2570" class="LineNr">2570 </span> <span class="Comment"># compute range to delete</span> <span id="L2571" class="LineNr">2571 </span> start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L2572" class="LineNr">2572 </span> end:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L25'>next</a> start @@ -2865,7 +2865,7 @@ if ('onhashchange' in window) { <span id="L2803" class="LineNr">2803 </span><span class="Comment"># Beware: never return null pointer.</span> <span id="L2804" class="LineNr">2804 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L2804'>before-start-of-next-line</a> original:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, max:num<span class="muRecipe"> -> </span>curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char [ <span id="L2805" class="LineNr">2805 </span> <span class="Constant">local-scope</span> -<span id="L2806" class="LineNr">2806 </span> <span class="Constant">load-ingredients</span> +<span id="L2806" class="LineNr">2806 </span> <span class="Constant">load-inputs</span> <span id="L2807" class="LineNr">2807 </span> count:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L2808" class="LineNr">2808 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy original <span id="L2809" class="LineNr">2809 </span> <span class="Comment"># skip the initial newline if it exists</span> @@ -3236,7 +3236,7 @@ if ('onhashchange' in window) { <span id="L3174" class="LineNr">3174 </span><span class="Comment"># Beware: never return null pointer.</span> <span id="L3175" class="LineNr">3175 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L3175'>before-previous-screen-line</a> in:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, editor:&:editor<span class="muRecipe"> -> </span>out:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char [ <span id="L3176" class="LineNr">3176 </span> <span class="Constant">local-scope</span> -<span id="L3177" class="LineNr">3177 </span> <span class="Constant">load-ingredients</span> +<span id="L3177" class="LineNr">3177 </span> <span class="Constant">load-inputs</span> <span id="L3178" class="LineNr">3178 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy in <span id="L3179" class="LineNr">3179 </span> c:char <span class="Special"><-</span> get *curr, <span class="Constant">value:offset</span> <span id="L3180" class="LineNr">3180 </span> <span class="Comment"># compute max, number of characters to skip</span> @@ -3658,7 +3658,7 @@ if ('onhashchange' in window) { <span id="L3596" class="LineNr">3596 </span><span class="Comment"># taking up the entire screen</span> <span id="L3597" class="LineNr">3597 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L3597'>page-down</a> editor:&:editor<span class="muRecipe"> -> </span>editor:&:editor [ <span id="L3598" class="LineNr">3598 </span> <span class="Constant">local-scope</span> -<span id="L3599" class="LineNr">3599 </span> <span class="Constant">load-ingredients</span> +<span id="L3599" class="LineNr">3599 </span> <span class="Constant">load-inputs</span> <span id="L3600" class="LineNr">3600 </span> <span class="Comment"># if editor contents don't overflow screen, do nothing</span> <span id="L3601" class="LineNr">3601 </span> bottom-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">bottom-of-screen:offset</span> <span id="L3602" class="LineNr">3602 </span> <span class="muControl">return-unless</span> bottom-of-screen @@ -3683,7 +3683,7 @@ if ('onhashchange' in window) { <span id="L3621" class="LineNr">3621 </span><span class="Comment"># jump to previous newline</span> <span id="L3622" class="LineNr">3622 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L3622'>move-to-start-of-line</a> editor:&:editor<span class="muRecipe"> -> </span>editor:&:editor [ <span id="L3623" class="LineNr">3623 </span> <span class="Constant">local-scope</span> -<span id="L3624" class="LineNr">3624 </span> <span class="Constant">load-ingredients</span> +<span id="L3624" class="LineNr">3624 </span> <span class="Constant">load-inputs</span> <span id="L3625" class="LineNr">3625 </span> <span class="Comment"># update cursor column</span> <span id="L3626" class="LineNr">3626 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L3627" class="LineNr">3627 </span> cursor-column:num <span class="Special"><-</span> copy left @@ -3881,7 +3881,7 @@ if ('onhashchange' in window) { <span id="L3819" class="LineNr">3819 </span> <span id="L3820" class="LineNr">3820 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L3820'>page-up</a> editor:&:editor, <a href='../081print.mu.html#L782'>screen-height</a>:num<span class="muRecipe"> -> </span>editor:&:editor [ <span id="L3821" class="LineNr">3821 </span> <span class="Constant">local-scope</span> -<span id="L3822" class="LineNr">3822 </span> <span class="Constant">load-ingredients</span> +<span id="L3822" class="LineNr">3822 </span> <span class="Constant">load-inputs</span> <span id="L3823" class="LineNr">3823 </span> max:num <span class="Special"><-</span> subtract <a href='../081print.mu.html#L782'>screen-height</a>, <span class="Constant">1/menu-bar</span>, <span class="Constant">1/overlapping-line</span> <span id="L3824" class="LineNr">3824 </span> count:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L3825" class="LineNr">3825 </span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> @@ -4210,7 +4210,7 @@ if ('onhashchange' in window) { <span id="L4148" class="LineNr">4148 </span> <span id="L4149" class="LineNr">4149 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L4149'>line-up</a> editor:&:editor, <a href='../081print.mu.html#L782'>screen-height</a>:num<span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor [ <span id="L4150" class="LineNr">4150 </span> <span class="Constant">local-scope</span> -<span id="L4151" class="LineNr">4151 </span> <span class="Constant">load-ingredients</span> +<span id="L4151" class="LineNr">4151 </span> <span class="Constant">load-inputs</span> <span id="L4152" class="LineNr">4152 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L4153" class="LineNr">4153 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L4154" class="LineNr">4154 </span> max:num <span class="Special"><-</span> subtract right, left @@ -4241,7 +4241,7 @@ if ('onhashchange' in window) { <span id="L4179" class="LineNr">4179 </span> <span id="L4180" class="LineNr">4180 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L4180'>line-down</a> editor:&:editor, <a href='../081print.mu.html#L782'>screen-height</a>:num<span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor [ <span id="L4181" class="LineNr">4181 </span> <span class="Constant">local-scope</span> -<span id="L4182" class="LineNr">4182 </span> <span class="Constant">load-ingredients</span> +<span id="L4182" class="LineNr">4182 </span> <span class="Constant">load-inputs</span> <span id="L4183" class="LineNr">4183 </span> old-top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L4184" class="LineNr">4184 </span> new-top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L3175'>before-previous-screen-line</a> old-top, editor <span id="L4185" class="LineNr">4185 </span> movement?:bool <span class="Special"><-</span> not-equal old-top, new-top @@ -4311,7 +4311,7 @@ if ('onhashchange' in window) { <span id="L4249" class="LineNr">4249 </span><span class="Comment"># the caller to go-render? the entire screen.</span> <span id="L4250" class="LineNr">4250 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L4250'>render-line-from-start</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor, right-margin:num<span class="muRecipe"> -> </span>go-render?:bool, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L4251" class="LineNr">4251 </span> <span class="Constant">local-scope</span> -<span id="L4252" class="LineNr">4252 </span> <span class="Constant">load-ingredients</span> +<span id="L4252" class="LineNr">4252 </span> <span class="Constant">load-inputs</span> <span id="L4253" class="LineNr">4253 </span> before-line-start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L4280'>before-start-of-screen-line</a> editor <span id="L4254" class="LineNr">4254 </span> line-start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L25'>next</a> before-line-start <span id="L4255" class="LineNr">4255 </span> color:num <span class="Special"><-</span> copy <span class="Constant">7/white</span> @@ -4341,7 +4341,7 @@ if ('onhashchange' in window) { <span id="L4279" class="LineNr">4279 </span> <span id="L4280" class="LineNr">4280 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L4280'>before-start-of-screen-line</a> editor:&:editor<span class="muRecipe"> -> </span>result:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char [ <span id="L4281" class="LineNr">4281 </span> <span class="Constant">local-scope</span> -<span id="L4282" class="LineNr">4282 </span> <span class="Constant">load-ingredients</span> +<span id="L4282" class="LineNr">4282 </span> <span class="Constant">load-inputs</span> <span id="L4283" class="LineNr">4283 </span> cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L4284" class="LineNr">4284 </span> <span class="Delimiter">{</span> <span id="L4285" class="LineNr">4285 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L25'>next</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L25'>next</a> cursor diff --git a/html/edit/004-programming-environment.mu.html b/html/edit/004-programming-environment.mu.html index 6179ca5e..703e71e6 100644 --- a/html/edit/004-programming-environment.mu.html +++ b/html/edit/004-programming-environment.mu.html @@ -83,7 +83,7 @@ if ('onhashchange' in window) { <span id="L20" class="LineNr"> 20 </span> <span id="L21" class="LineNr"> 21 </span><span class="muRecipe">def</span> <a href='004-programming-environment.mu.html#L21'>new-programming-environment</a> <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, test-sandbox-editor-contents:text<span class="muRecipe"> -> </span>result:&:environment [ <span id="L22" class="LineNr"> 22 </span> <span class="Constant">local-scope</span> -<span id="L23" class="LineNr"> 23 </span> <span class="Constant">load-ingredients</span> +<span id="L23" class="LineNr"> 23 </span> <span class="Constant">load-inputs</span> <span id="L24" class="LineNr"> 24 </span> width:num <span class="Special"><-</span> <a href='../081print.mu.html#L768'>screen-width</a> <a href='../081print.mu.html#L16'>screen</a> <span id="L25" class="LineNr"> 25 </span> result <span class="Special"><-</span> new <span class="Constant">environment:type</span> <span id="L26" class="LineNr"> 26 </span> <span class="Comment"># recipe editor on the left</span> @@ -101,7 +101,7 @@ if ('onhashchange' in window) { <span id="L38" class="LineNr"> 38 </span> <span id="L39" class="LineNr"> 39 </span><span class="muRecipe">def</span> <a href='004-programming-environment.mu.html#L39'>event-loop</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, <a href='../084console.mu.html#L23'>console</a>:&:<a href='../084console.mu.html#L23'>console</a>, env:&:environment, <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a><span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, <a href='../084console.mu.html#L23'>console</a>:&:<a href='../084console.mu.html#L23'>console</a>, env:&:environment, <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a> [ <span id="L40" class="LineNr"> 40 </span> <span class="Constant">local-scope</span> -<span id="L41" class="LineNr"> 41 </span> <span class="Constant">load-ingredients</span> +<span id="L41" class="LineNr"> 41 </span> <span class="Constant">load-inputs</span> <span id="L42" class="LineNr"> 42 </span> recipes:&:editor <span class="Special"><-</span> get *env, <span class="Constant">recipes:offset</span> <span id="L43" class="LineNr"> 43 </span> current-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> <span id="L44" class="LineNr"> 44 </span> sandbox-in-focus?:bool <span class="Special"><-</span> get *env, <span class="Constant">sandbox-in-focus?:offset</span> @@ -193,7 +193,7 @@ if ('onhashchange' in window) { <span id="L130" class="LineNr">130 </span> <span id="L131" class="LineNr">131 </span><span class="muRecipe">def</span> <a href='004-programming-environment.mu.html#L131'>resize</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, env:&:environment<span class="muRecipe"> -> </span>env:&:environment, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L132" class="LineNr">132 </span> <span class="Constant">local-scope</span> -<span id="L133" class="LineNr">133 </span> <span class="Constant">load-ingredients</span> +<span id="L133" class="LineNr">133 </span> <span class="Constant">load-inputs</span> <span id="L134" class="LineNr">134 </span> <a href='../081print.mu.html#L46'>clear-screen</a> <a href='../081print.mu.html#L16'>screen</a> <span class="Comment"># update screen dimensions</span> <span id="L135" class="LineNr">135 </span> width:num <span class="Special"><-</span> <a href='../081print.mu.html#L768'>screen-width</a> <a href='../081print.mu.html#L16'>screen</a> <span id="L136" class="LineNr">136 </span> divider:num, _ <span class="Special"><-</span> divide-with-remainder width,<span class="Constant"> 2</span> @@ -220,7 +220,7 @@ if ('onhashchange' in window) { <span id="L157" class="LineNr">157 </span><span class="Comment"># off-screen, it resets cursor-row and cursor-column.</span> <span id="L158" class="LineNr">158 </span><span class="muRecipe">def</span> <a href='004-programming-environment.mu.html#L158'>render-without-moving-cursor</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor<span class="muRecipe"> -> </span>last-row:num, last-column:num, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, editor:&:editor [ <span id="L159" class="LineNr">159 </span> <span class="Constant">local-scope</span> -<span id="L160" class="LineNr">160 </span> <span class="Constant">load-ingredients</span> +<span id="L160" class="LineNr">160 </span> <span class="Constant">load-inputs</span> <span id="L161" class="LineNr">161 </span> <span class="muControl">return-unless</span> editor, <span class="Constant">1/top</span>, <span class="Constant">0/left</span> <span id="L162" class="LineNr">162 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L163" class="LineNr">163 </span> <a href='../081print.mu.html#L782'>screen-height</a>:num <span class="Special"><-</span> <a href='../081print.mu.html#L782'>screen-height</a> <a href='../081print.mu.html#L16'>screen</a> @@ -464,7 +464,7 @@ if ('onhashchange' in window) { <span id="L401" class="LineNr">401 </span> <span id="L402" class="LineNr">402 </span><span class="muRecipe">def</span> <a href='004-programming-environment.mu.html#L402'>render-all</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, env:&:environment, render-editor:<a href='004-programming-environment.mu.html#L400'>render-recipe</a><span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, env:&:environment [ <span id="L403" class="LineNr">403 </span> <span class="Constant">local-scope</span> -<span id="L404" class="LineNr">404 </span> <span class="Constant">load-ingredients</span> +<span id="L404" class="LineNr">404 </span> <span class="Constant">load-inputs</span> <span id="L405" class="LineNr">405 </span> trace<span class="Constant"> 10</span>, <span class="Constant">[app]</span>, <span class="Constant">[render all]</span> <span id="L406" class="LineNr">406 </span> <span class="Comment"># top menu</span> <span id="L407" class="LineNr">407 </span> trace<span class="Constant"> 11</span>, <span class="Constant">[app]</span>, <span class="Constant">[render top menu]</span> @@ -493,7 +493,7 @@ if ('onhashchange' in window) { <span id="L430" class="LineNr">430 </span> <span id="L431" class="LineNr">431 </span><span class="muRecipe">def</span> <a href='004-programming-environment.mu.html#L431'>render-recipes</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, env:&:environment, render-editor:<a href='004-programming-environment.mu.html#L400'>render-recipe</a><span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, env:&:environment [ <span id="L432" class="LineNr">432 </span> <span class="Constant">local-scope</span> -<span id="L433" class="LineNr">433 </span> <span class="Constant">load-ingredients</span> +<span id="L433" class="LineNr">433 </span> <span class="Constant">load-inputs</span> <span id="L434" class="LineNr">434 </span> trace<span class="Constant"> 11</span>, <span class="Constant">[app]</span>, <span class="Constant">[render recipes]</span> <span id="L435" class="LineNr">435 </span> old-top-idx:num <span class="Special"><-</span> <a href='../081print.mu.html#L509'>save-top-idx</a> <a href='../081print.mu.html#L16'>screen</a> <span id="L436" class="LineNr">436 </span> recipes:&:editor <span class="Special"><-</span> get *env, <span class="Constant">recipes:offset</span> @@ -515,7 +515,7 @@ if ('onhashchange' in window) { <span id="L452" class="LineNr">452 </span><span class="Comment"># replaced in a later layer</span> <span id="L453" class="LineNr">453 </span><span class="muRecipe">def</span> render-sandbox-side <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, env:&:environment, render-editor:<a href='004-programming-environment.mu.html#L400'>render-recipe</a><span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, env:&:environment [ <span id="L454" class="LineNr">454 </span> <span class="Constant">local-scope</span> -<span id="L455" class="LineNr">455 </span> <span class="Constant">load-ingredients</span> +<span id="L455" class="LineNr">455 </span> <span class="Constant">load-inputs</span> <span id="L456" class="LineNr">456 </span> trace<span class="Constant"> 11</span>, <span class="Constant">[app]</span>, <span class="Constant">[render sandboxes]</span> <span id="L457" class="LineNr">457 </span> old-top-idx:num <span class="Special"><-</span> <a href='../081print.mu.html#L509'>save-top-idx</a> <a href='../081print.mu.html#L16'>screen</a> <span id="L458" class="LineNr">458 </span> current-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> @@ -534,7 +534,7 @@ if ('onhashchange' in window) { <span id="L471" class="LineNr">471 </span> <span id="L472" class="LineNr">472 </span><span class="muRecipe">def</span> <a href='004-programming-environment.mu.html#L472'>update-cursor</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, recipes:&:editor, current-sandbox:&:editor, sandbox-in-focus?:bool, env:&:environment<span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L473" class="LineNr">473 </span> <span class="Constant">local-scope</span> -<span id="L474" class="LineNr">474 </span> <span class="Constant">load-ingredients</span> +<span id="L474" class="LineNr">474 </span> <span class="Constant">load-inputs</span> <span id="L475" class="LineNr">475 </span><span class="Constant"> <a href='004-programming-environment.mu.html#L475'><update-cursor-special-cases></a></span> <span id="L476" class="LineNr">476 </span> <span class="Delimiter">{</span> <span id="L477" class="LineNr">477 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> sandbox-in-focus? @@ -568,13 +568,13 @@ if ('onhashchange' in window) { <span id="L505" class="LineNr">505 </span> <span id="L506" class="LineNr">506 </span><span class="muRecipe">def</span> <a href='004-programming-environment.mu.html#L506'>draw-vertical</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, col:num, y:num, bottom:num<span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L507" class="LineNr">507 </span> <span class="Constant">local-scope</span> -<span id="L508" class="LineNr">508 </span> <span class="Constant">load-ingredients</span> -<span id="L509" class="LineNr">509 </span> style:char, style-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L508" class="LineNr">508 </span> <span class="Constant">load-inputs</span> +<span id="L509" class="LineNr">509 </span> style:char, style-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L510" class="LineNr">510 </span> <span class="Delimiter">{</span> <span id="L511" class="LineNr">511 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> style-found? <span id="L512" class="LineNr">512 </span> <span class="Conceal">¦</span> style <span class="Special"><-</span> copy <span class="Constant">9474/vertical</span> <span id="L513" class="LineNr">513 </span> <span class="Delimiter">}</span> -<span id="L514" class="LineNr">514 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L514" class="LineNr">514 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L515" class="LineNr">515 </span> <span class="Delimiter">{</span> <span id="L516" class="LineNr">516 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> <span id="L517" class="LineNr">517 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? diff --git a/html/edit/005-sandbox.mu.html b/html/edit/005-sandbox.mu.html index 1c6ab31c..51d920f8 100644 --- a/html/edit/005-sandbox.mu.html +++ b/html/edit/005-sandbox.mu.html @@ -208,7 +208,7 @@ if ('onhashchange' in window) { <span id="L145" class="LineNr"> 145 </span> <span id="L146" class="LineNr"> 146 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L146'>run-sandboxes</a> env:&:environment, <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>errors-found?:bool, env:&:environment, <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L147" class="LineNr"> 147 </span> <span class="Constant">local-scope</span> -<span id="L148" class="LineNr"> 148 </span> <span class="Constant">load-ingredients</span> +<span id="L148" class="LineNr"> 148 </span> <span class="Constant">load-inputs</span> <span id="L149" class="LineNr"> 149 </span> errors-found?:bool <span class="Special"><-</span> update-recipes env, <a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a> <span id="L150" class="LineNr"> 150 </span> <span class="muControl">jump-if</span> errors-found?, <span class="Constant">+return</span> <span id="L151" class="LineNr"> 151 </span> <span class="Comment"># check contents of right editor (sandbox)</span> @@ -259,7 +259,7 @@ if ('onhashchange' in window) { <span id="L196" class="LineNr"> 196 </span><span class="Comment"># replaced in a later layer (whereupon errors-found? will actually be set)</span> <span id="L197" class="LineNr"> 197 </span><span class="muRecipe">def</span> update-recipes env:&:environment, <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>errors-found?:bool, env:&:environment, <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L198" class="LineNr"> 198 </span> <span class="Constant">local-scope</span> -<span id="L199" class="LineNr"> 199 </span> <span class="Constant">load-ingredients</span> +<span id="L199" class="LineNr"> 199 </span> <span class="Constant">load-inputs</span> <span id="L200" class="LineNr"> 200 </span> recipes:&:editor <span class="Special"><-</span> get *env, <span class="Constant">recipes:offset</span> <span id="L201" class="LineNr"> 201 </span> in:text <span class="Special"><-</span> <a href='005-sandbox.mu.html#L683'>editor-contents</a> recipes <span id="L202" class="LineNr"> 202 </span> <a href='../088file.mu.html#L11'>resources</a> <span class="Special"><-</span> <a href='../088file.mu.html#L127'>dump</a> <a href='../088file.mu.html#L11'>resources</a>, <span class="Constant">[lesson/recipes.mu]</span>, in @@ -270,7 +270,7 @@ if ('onhashchange' in window) { <span id="L207" class="LineNr"> 207 </span><span class="Comment"># replaced in a later layer</span> <span id="L208" class="LineNr"> 208 </span><span class="muRecipe">def</span> update-sandbox sandbox:&:sandbox, env:&:environment, idx:num<span class="muRecipe"> -> </span>sandbox:&:sandbox, env:&:environment [ <span id="L209" class="LineNr"> 209 </span> <span class="Constant">local-scope</span> -<span id="L210" class="LineNr"> 210 </span> <span class="Constant">load-ingredients</span> +<span id="L210" class="LineNr"> 210 </span> <span class="Constant">load-inputs</span> <span id="L211" class="LineNr"> 211 </span> data:text <span class="Special"><-</span> get *sandbox, <span class="Constant">data:offset</span> <span id="L212" class="LineNr"> 212 </span> response:text, _, fake-screen:&:<a href='../081print.mu.html#L16'>screen</a> <span class="Special"><-</span> run-sandboxed data <span id="L213" class="LineNr"> 213 </span> *sandbox <span class="Special"><-</span> put *sandbox, <span class="Constant">response:offset</span>, response @@ -279,14 +279,14 @@ if ('onhashchange' in window) { <span id="L216" class="LineNr"> 216 </span> <span id="L217" class="LineNr"> 217 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L217'>update-status</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, msg:text, color:num<span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L218" class="LineNr"> 218 </span> <span class="Constant">local-scope</span> -<span id="L219" class="LineNr"> 219 </span> <span class="Constant">load-ingredients</span> +<span id="L219" class="LineNr"> 219 </span> <span class="Constant">load-inputs</span> <span id="L220" class="LineNr"> 220 </span> <a href='../081print.mu.html#L16'>screen</a> <span class="Special"><-</span> move-cursor <a href='../081print.mu.html#L16'>screen</a>,<span class="Constant"> 0</span>,<span class="Constant"> 2</span> <span id="L221" class="LineNr"> 221 </span> <a href='../081print.mu.html#L16'>screen</a> <span class="Special"><-</span> print <a href='../081print.mu.html#L16'>screen</a>, msg, color, <span class="Constant">238/grey/background</span> <span id="L222" class="LineNr"> 222 </span>] <span id="L223" class="LineNr"> 223 </span> <span id="L224" class="LineNr"> 224 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L224'>save-sandboxes</a> env:&:environment, <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a><span class="muRecipe"> -> </span><a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a> [ <span id="L225" class="LineNr"> 225 </span> <span class="Constant">local-scope</span> -<span id="L226" class="LineNr"> 226 </span> <span class="Constant">load-ingredients</span> +<span id="L226" class="LineNr"> 226 </span> <span class="Constant">load-inputs</span> <span id="L227" class="LineNr"> 227 </span> trace<span class="Constant"> 11</span>, <span class="Constant">[app]</span>, <span class="Constant">[save sandboxes]</span> <span id="L228" class="LineNr"> 228 </span> current-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> <span id="L229" class="LineNr"> 229 </span> <span class="Comment"># first clear previous versions, in case we deleted some sandbox</span> @@ -304,7 +304,7 @@ if ('onhashchange' in window) { <span id="L241" class="LineNr"> 241 </span> <span id="L242" class="LineNr"> 242 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L242'>save-sandbox</a> <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a>, sandbox:&:sandbox, sandbox-index:num<span class="muRecipe"> -> </span><a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a> [ <span id="L243" class="LineNr"> 243 </span> <span class="Constant">local-scope</span> -<span id="L244" class="LineNr"> 244 </span> <span class="Constant">load-ingredients</span> +<span id="L244" class="LineNr"> 244 </span> <span class="Constant">load-inputs</span> <span id="L245" class="LineNr"> 245 </span> data:text <span class="Special"><-</span> get *sandbox, <span class="Constant">data:offset</span> <span id="L246" class="LineNr"> 246 </span> filename:text <span class="Special"><-</span> append <span class="Constant">[lesson/]</span>, sandbox-index <span id="L247" class="LineNr"> 247 </span> <a href='../088file.mu.html#L11'>resources</a> <span class="Special"><-</span> <a href='../088file.mu.html#L127'>dump</a> <a href='../088file.mu.html#L11'>resources</a>, filename, data @@ -313,7 +313,7 @@ if ('onhashchange' in window) { <span id="L250" class="LineNr"> 250 </span> <span id="L251" class="LineNr"> 251 </span><span class="muRecipe">def!</span> render-sandbox-side <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, env:&:environment, render-editor:<a href='004-programming-environment.mu.html#L400'>render-recipe</a><span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, env:&:environment [ <span id="L252" class="LineNr"> 252 </span> <span class="Constant">local-scope</span> -<span id="L253" class="LineNr"> 253 </span> <span class="Constant">load-ingredients</span> +<span id="L253" class="LineNr"> 253 </span> <span class="Constant">load-inputs</span> <span id="L254" class="LineNr"> 254 </span> trace<span class="Constant"> 11</span>, <span class="Constant">[app]</span>, <span class="Constant">[render sandbox side]</span> <span id="L255" class="LineNr"> 255 </span> old-top-idx:num <span class="Special"><-</span> <a href='../081print.mu.html#L509'>save-top-idx</a> <a href='../081print.mu.html#L16'>screen</a> <span id="L256" class="LineNr"> 256 </span> current-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> @@ -340,7 +340,7 @@ if ('onhashchange' in window) { <span id="L277" class="LineNr"> 277 </span> <span id="L278" class="LineNr"> 278 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L278'>render-sandboxes</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, sandbox:&:sandbox, left:num, right:num, row:num, render-from:num, idx:num<span class="muRecipe"> -> </span>row:num, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, sandbox:&:sandbox [ <span id="L279" class="LineNr"> 279 </span> <span class="Constant">local-scope</span> -<span id="L280" class="LineNr"> 280 </span> <span class="Constant">load-ingredients</span> +<span id="L280" class="LineNr"> 280 </span> <span class="Constant">load-inputs</span> <span id="L281" class="LineNr"> 281 </span> <span class="muControl">return-unless</span> sandbox <span id="L282" class="LineNr"> 282 </span> <a href='../081print.mu.html#L782'>screen-height</a>:num <span class="Special"><-</span> <a href='../081print.mu.html#L782'>screen-height</a> <a href='../081print.mu.html#L16'>screen</a> <span id="L283" class="LineNr"> 283 </span> hidden?:bool <span class="Special"><-</span> lesser-than idx, render-from @@ -395,7 +395,7 @@ if ('onhashchange' in window) { <span id="L332" class="LineNr"> 332 </span> <span id="L333" class="LineNr"> 333 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L333'>render-sandbox-menu</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, sandbox-index:num, left:num, right:num<span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L334" class="LineNr"> 334 </span> <span class="Constant">local-scope</span> -<span id="L335" class="LineNr"> 335 </span> <span class="Constant">load-ingredients</span> +<span id="L335" class="LineNr"> 335 </span> <span class="Constant">load-inputs</span> <span id="L336" class="LineNr"> 336 </span> <a href='../081print.mu.html#L760'>move-cursor-to-column</a> <a href='../081print.mu.html#L16'>screen</a>, left <span id="L337" class="LineNr"> 337 </span> edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, recipe-button-left:num, recipe-button-right:num, delete-button-left:num <span class="Special"><-</span> <a href='005-sandbox.mu.html#L378'>sandbox-menu-columns</a> left, right <span id="L338" class="LineNr"> 338 </span> print <a href='../081print.mu.html#L16'>screen</a>, sandbox-index, <span class="Constant">232/dark-grey</span>, <span class="Constant">245/grey</span> @@ -440,7 +440,7 @@ if ('onhashchange' in window) { <span id="L377" class="LineNr"> 377 </span><span class="Comment"># all left/right pairs are inclusive</span> <span id="L378" class="LineNr"> 378 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L378'>sandbox-menu-columns</a> left:num, right:num<span class="muRecipe"> -> </span>edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, recipe-button-left:num, recipe-button-right:num, delete-button-left:num [ <span id="L379" class="LineNr"> 379 </span> <span class="Constant">local-scope</span> -<span id="L380" class="LineNr"> 380 </span> <span class="Constant">load-ingredients</span> +<span id="L380" class="LineNr"> 380 </span> <span class="Constant">load-inputs</span> <span id="L381" class="LineNr"> 381 </span> start-buttons:num <span class="Special"><-</span> add left, <span class="Constant">4/space-for-sandbox-index</span> <span id="L382" class="LineNr"> 382 </span> buttons-space:num <span class="Special"><-</span> subtract right, start-buttons <span id="L383" class="LineNr"> 383 </span> button-width:num <span class="Special"><-</span> divide-with-remainder buttons-space,<span class="Constant"> 4</span> <span class="Comment"># integer division</span> @@ -460,7 +460,7 @@ if ('onhashchange' in window) { <span id="L397" class="LineNr"> 397 </span><span class="Comment"># like 'render-code' but without syntax-based colorization</span> <span id="L398" class="LineNr"> 398 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L398'>render-text</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, s:text, left:num, right:num, color:num, row:num<span class="muRecipe"> -> </span>row:num, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L399" class="LineNr"> 399 </span> <span class="Constant">local-scope</span> -<span id="L400" class="LineNr"> 400 </span> <span class="Constant">load-ingredients</span> +<span id="L400" class="LineNr"> 400 </span> <span class="Constant">load-inputs</span> <span id="L401" class="LineNr"> 401 </span> <span class="muControl">return-unless</span> s <span id="L402" class="LineNr"> 402 </span> column:num <span class="Special"><-</span> copy left <span id="L403" class="LineNr"> 403 </span> <a href='../081print.mu.html#L16'>screen</a> <span class="Special"><-</span> move-cursor <a href='../081print.mu.html#L16'>screen</a>, row, column @@ -537,7 +537,7 @@ if ('onhashchange' in window) { <span id="L474" class="LineNr"> 474 </span><span class="Comment"># assumes programming environment has no sandboxes; restores them from previous session</span> <span id="L475" class="LineNr"> 475 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L475'>restore-sandboxes</a> env:&:environment, <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a><span class="muRecipe"> -> </span>env:&:environment [ <span id="L476" class="LineNr"> 476 </span> <span class="Constant">local-scope</span> -<span id="L477" class="LineNr"> 477 </span> <span class="Constant">load-ingredients</span> +<span id="L477" class="LineNr"> 477 </span> <span class="Constant">load-inputs</span> <span id="L478" class="LineNr"> 478 </span> <span class="Comment"># read all scenarios, pushing them to end of a list of scenarios</span> <span id="L479" class="LineNr"> 479 </span> idx:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L480" class="LineNr"> 480 </span> curr:&:sandbox <span class="Special"><-</span> copy<span class="Constant"> 0</span> @@ -571,7 +571,7 @@ if ('onhashchange' in window) { <span id="L508" class="LineNr"> 508 </span><span class="Comment"># leave cursor at start of next line</span> <span id="L509" class="LineNr"> 509 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L509'>render-screen</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, sandbox-screen:&:<a href='../081print.mu.html#L16'>screen</a>, left:num, right:num, row:num<span class="muRecipe"> -> </span>row:num, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L510" class="LineNr"> 510 </span> <span class="Constant">local-scope</span> -<span id="L511" class="LineNr"> 511 </span> <span class="Constant">load-ingredients</span> +<span id="L511" class="LineNr"> 511 </span> <span class="Constant">load-inputs</span> <span id="L512" class="LineNr"> 512 </span> <span class="muControl">return-unless</span> sandbox-screen <span id="L513" class="LineNr"> 513 </span> <span class="Comment"># print 'screen:'</span> <span id="L514" class="LineNr"> 514 </span> row <span class="Special"><-</span> <a href='005-sandbox.mu.html#L398'>render-text</a> <a href='../081print.mu.html#L16'>screen</a>, <span class="Constant">[screen:]</span>, left, right, <span class="Constant">245/grey</span>, row @@ -745,7 +745,7 @@ if ('onhashchange' in window) { <span id="L682" class="LineNr"> 682 </span> <span id="L683" class="LineNr"> 683 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L683'>editor-contents</a> editor:&:editor<span class="muRecipe"> -> </span>result:text [ <span id="L684" class="LineNr"> 684 </span> <span class="Constant">local-scope</span> -<span id="L685" class="LineNr"> 685 </span> <span class="Constant">load-ingredients</span> +<span id="L685" class="LineNr"> 685 </span> <span class="Constant">load-inputs</span> <span id="L686" class="LineNr"> 686 </span> buf:&:<a href='../061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='../061text.mu.html#L125'>new-buffer</a><span class="Constant"> 80</span> <span id="L687" class="LineNr"> 687 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L688" class="LineNr"> 688 </span> <span class="Comment"># skip § sentinel</span> @@ -1007,7 +1007,7 @@ if ('onhashchange' in window) { <span id="L944" class="LineNr"> 944 </span><span class="Comment"># return 0 if there's no such sandbox, either because 'in' doesn't exist in 'env', or because it's the first sandbox</span> <span id="L945" class="LineNr"> 945 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L945'>previous-sandbox</a> env:&:environment, in:&:sandbox<span class="muRecipe"> -> </span>out:&:sandbox [ <span id="L946" class="LineNr"> 946 </span> <span class="Constant">local-scope</span> -<span id="L947" class="LineNr"> 947 </span> <span class="Constant">load-ingredients</span> +<span id="L947" class="LineNr"> 947 </span> <span class="Constant">load-inputs</span> <span id="L948" class="LineNr"> 948 </span> curr:&:sandbox <span class="Special"><-</span> get *env, <span class="Constant">sandbox:offset</span> <span id="L949" class="LineNr"> 949 </span> <span class="muControl">return-unless</span> curr, <span class="Constant">0/nil</span> <span id="L950" class="LineNr"> 950 </span> <a href='../065duplex_list.mu.html#L25'>next</a>:&:sandbox <span class="Special"><-</span> get *curr, <span class="Constant">next-sandbox:offset</span> diff --git a/html/edit/006-sandbox-copy.mu.html b/html/edit/006-sandbox-copy.mu.html index 64332fb3..fc003903 100644 --- a/html/edit/006-sandbox-copy.mu.html +++ b/html/edit/006-sandbox-copy.mu.html @@ -201,7 +201,7 @@ if ('onhashchange' in window) { <span id="L139" class="LineNr">139 </span><span class="Comment"># some preconditions for attempting to copy a sandbox</span> <span id="L140" class="LineNr">140 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L140'>should-attempt-copy?</a> click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ <span id="L141" class="LineNr">141 </span> <span class="Constant">local-scope</span> -<span id="L142" class="LineNr">142 </span> <span class="Constant">load-ingredients</span> +<span id="L142" class="LineNr">142 </span> <span class="Constant">load-inputs</span> <span id="L143" class="LineNr">143 </span> <span class="Comment"># are we below the sandbox editor?</span> <span id="L144" class="LineNr">144 </span> click-sandbox-area?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L190'>click-on-sandbox-area?</a> click-row, click-column, env <span id="L145" class="LineNr">145 </span> <span class="muControl">return-unless</span> click-sandbox-area?, <span class="Constant">0/false</span> @@ -220,7 +220,7 @@ if ('onhashchange' in window) { <span id="L158" class="LineNr">158 </span> <span id="L159" class="LineNr">159 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L159'>try-copy-sandbox</a> click-row:num, env:&:environment<span class="muRecipe"> -> </span>clicked-on-copy-button?:bool, env:&:environment [ <span id="L160" class="LineNr">160 </span> <span class="Constant">local-scope</span> -<span id="L161" class="LineNr">161 </span> <span class="Constant">load-ingredients</span> +<span id="L161" class="LineNr">161 </span> <span class="Constant">load-inputs</span> <span id="L162" class="LineNr">162 </span> <span class="Comment"># identify the sandbox to copy, if the click was actually on the 'copy' button</span> <span id="L163" class="LineNr">163 </span> sandbox:&:sandbox <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L175'>find-sandbox</a> env, click-row <span id="L164" class="LineNr">164 </span> <span class="muControl">return-unless</span> sandbox, <span class="Constant">0/false</span> @@ -236,7 +236,7 @@ if ('onhashchange' in window) { <span id="L174" class="LineNr">174 </span> <span id="L175" class="LineNr">175 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L175'>find-sandbox</a> env:&:environment, click-row:num<span class="muRecipe"> -> </span>result:&:sandbox [ <span id="L176" class="LineNr">176 </span> <span class="Constant">local-scope</span> -<span id="L177" class="LineNr">177 </span> <span class="Constant">load-ingredients</span> +<span id="L177" class="LineNr">177 </span> <span class="Constant">load-inputs</span> <span id="L178" class="LineNr">178 </span> curr-sandbox:&:sandbox <span class="Special"><-</span> get *env, <span class="Constant">sandbox:offset</span> <span id="L179" class="LineNr">179 </span> <span class="Delimiter">{</span> <span id="L180" class="LineNr">180 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> curr-sandbox @@ -251,7 +251,7 @@ if ('onhashchange' in window) { <span id="L189" class="LineNr">189 </span> <span id="L190" class="LineNr">190 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L190'>click-on-sandbox-area?</a> click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ <span id="L191" class="LineNr">191 </span> <span class="Constant">local-scope</span> -<span id="L192" class="LineNr">192 </span> <span class="Constant">load-ingredients</span> +<span id="L192" class="LineNr">192 </span> <span class="Constant">load-inputs</span> <span id="L193" class="LineNr">193 </span> current-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> <span id="L194" class="LineNr">194 </span> sandbox-left-margin:num <span class="Special"><-</span> get *current-sandbox, <span class="Constant">left:offset</span> <span id="L195" class="LineNr">195 </span> on-sandbox-side?:bool <span class="Special"><-</span> greater-or-equal click-column, sandbox-left-margin @@ -264,7 +264,7 @@ if ('onhashchange' in window) { <span id="L202" class="LineNr">202 </span> <span id="L203" class="LineNr">203 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L203'>empty-editor?</a> editor:&:editor<span class="muRecipe"> -> </span>result:bool [ <span id="L204" class="LineNr">204 </span> <span class="Constant">local-scope</span> -<span id="L205" class="LineNr">205 </span> <span class="Constant">load-ingredients</span> +<span id="L205" class="LineNr">205 </span> <span class="Constant">load-inputs</span> <span id="L206" class="LineNr">206 </span> head:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L207" class="LineNr">207 </span> first:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L25'>next</a> head <span id="L208" class="LineNr">208 </span> result <span class="Special"><-</span> not first @@ -272,7 +272,7 @@ if ('onhashchange' in window) { <span id="L210" class="LineNr">210 </span> <span id="L211" class="LineNr">211 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L211'>within-range?</a> x:num, low:num, high:num<span class="muRecipe"> -> </span>result:bool [ <span id="L212" class="LineNr">212 </span> <span class="Constant">local-scope</span> -<span id="L213" class="LineNr">213 </span> <span class="Constant">load-ingredients</span> +<span id="L213" class="LineNr">213 </span> <span class="Constant">load-inputs</span> <span id="L214" class="LineNr">214 </span> not-too-far-left?:bool <span class="Special"><-</span> greater-or-equal x, low <span id="L215" class="LineNr">215 </span> not-too-far-right?:bool <span class="Special"><-</span> lesser-or-equal x, high <span id="L216" class="LineNr">216 </span> result <span class="Special"><-</span> and not-too-far-left? not-too-far-right? @@ -421,7 +421,7 @@ if ('onhashchange' in window) { <span id="L359" class="LineNr">359 </span><span class="Comment"># some preconditions for attempting to copy a sandbox into the recipe side</span> <span id="L360" class="LineNr">360 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L360'>should-copy-to-recipe?</a> click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ <span id="L361" class="LineNr">361 </span> <span class="Constant">local-scope</span> -<span id="L362" class="LineNr">362 </span> <span class="Constant">load-ingredients</span> +<span id="L362" class="LineNr">362 </span> <span class="Constant">load-inputs</span> <span id="L363" class="LineNr">363 </span> <span class="Comment"># are we below the sandbox editor?</span> <span id="L364" class="LineNr">364 </span> click-sandbox-area?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L190'>click-on-sandbox-area?</a> click-row, click-column, env <span id="L365" class="LineNr">365 </span> <span class="muControl">return-unless</span> click-sandbox-area?, <span class="Constant">0/false</span> @@ -436,7 +436,7 @@ if ('onhashchange' in window) { <span id="L374" class="LineNr">374 </span> <span id="L375" class="LineNr">375 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L375'>prepend-sandbox-into-recipe-side</a> click-row:num, env:&:environment<span class="muRecipe"> -> </span>clicked-on-copy-to-recipe-button?:bool, env:&:environment [ <span id="L376" class="LineNr">376 </span> <span class="Constant">local-scope</span> -<span id="L377" class="LineNr">377 </span> <span class="Constant">load-ingredients</span> +<span id="L377" class="LineNr">377 </span> <span class="Constant">load-inputs</span> <span id="L378" class="LineNr">378 </span> sandbox:&:sandbox <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L175'>find-sandbox</a> env, click-row <span id="L379" class="LineNr">379 </span> <span class="muControl">return-unless</span> sandbox, <span class="Constant">0/false</span> <span id="L380" class="LineNr">380 </span> recipe-editor:&:editor <span class="Special"><-</span> get *env, <span class="Constant">recipes:offset</span> diff --git a/html/edit/007-sandbox-delete.mu.html b/html/edit/007-sandbox-delete.mu.html index 6bdae16e..c8fde128 100644 --- a/html/edit/007-sandbox-delete.mu.html +++ b/html/edit/007-sandbox-delete.mu.html @@ -144,7 +144,7 @@ if ('onhashchange' in window) { <span id="L82" class="LineNr"> 82 </span><span class="Comment"># some preconditions for attempting to delete a sandbox</span> <span id="L83" class="LineNr"> 83 </span><span class="muRecipe">def</span> <a href='007-sandbox-delete.mu.html#L83'>should-attempt-delete?</a> click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ <span id="L84" class="LineNr"> 84 </span> <span class="Constant">local-scope</span> -<span id="L85" class="LineNr"> 85 </span> <span class="Constant">load-ingredients</span> +<span id="L85" class="LineNr"> 85 </span> <span class="Constant">load-inputs</span> <span id="L86" class="LineNr"> 86 </span> <span class="Comment"># are we below the sandbox editor?</span> <span id="L87" class="LineNr"> 87 </span> click-sandbox-area?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L190'>click-on-sandbox-area?</a> click-row, click-column, env <span id="L88" class="LineNr"> 88 </span> <span class="muControl">return-unless</span> click-sandbox-area?, <span class="Constant">0/false</span> @@ -159,7 +159,7 @@ if ('onhashchange' in window) { <span id="L97" class="LineNr"> 97 </span> <span id="L98" class="LineNr"> 98 </span><span class="muRecipe">def</span> <a href='007-sandbox-delete.mu.html#L98'>try-delete-sandbox</a> click-row:num, env:&:environment<span class="muRecipe"> -> </span>clicked-on-delete-button?:bool, env:&:environment [ <span id="L99" class="LineNr"> 99 </span> <span class="Constant">local-scope</span> -<span id="L100" class="LineNr">100 </span> <span class="Constant">load-ingredients</span> +<span id="L100" class="LineNr">100 </span> <span class="Constant">load-inputs</span> <span id="L101" class="LineNr">101 </span> <span class="Comment"># identify the sandbox to delete, if the click was actually on the 'delete' button</span> <span id="L102" class="LineNr">102 </span> sandbox:&:sandbox <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L175'>find-sandbox</a> env, click-row <span id="L103" class="LineNr">103 </span> <span class="muControl">return-unless</span> sandbox, <span class="Constant">0/false</span> @@ -169,7 +169,7 @@ if ('onhashchange' in window) { <span id="L107" class="LineNr">107 </span> <span id="L108" class="LineNr">108 </span><span class="muRecipe">def</span> <a href='007-sandbox-delete.mu.html#L108'>delete-sandbox</a> env:&:environment, sandbox:&:sandbox<span class="muRecipe"> -> </span>env:&:environment [ <span id="L109" class="LineNr">109 </span> <span class="Constant">local-scope</span> -<span id="L110" class="LineNr">110 </span> <span class="Constant">load-ingredients</span> +<span id="L110" class="LineNr">110 </span> <span class="Constant">load-inputs</span> <span id="L111" class="LineNr">111 </span> curr-sandbox:&:sandbox <span class="Special"><-</span> get *env, <span class="Constant">sandbox:offset</span> <span id="L112" class="LineNr">112 </span> first-sandbox?:bool <span class="Special"><-</span> equal curr-sandbox, sandbox <span id="L113" class="LineNr">113 </span> <span class="Delimiter">{</span> diff --git a/html/edit/008-sandbox-edit.mu.html b/html/edit/008-sandbox-edit.mu.html index 4c8025ab..7f6028a7 100644 --- a/html/edit/008-sandbox-edit.mu.html +++ b/html/edit/008-sandbox-edit.mu.html @@ -184,7 +184,7 @@ if ('onhashchange' in window) { <span id="L122" class="LineNr">122 </span><span class="Comment"># some preconditions for attempting to edit a sandbox</span> <span id="L123" class="LineNr">123 </span><span class="muRecipe">def</span> <a href='008-sandbox-edit.mu.html#L123'>should-attempt-edit?</a> click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ <span id="L124" class="LineNr">124 </span> <span class="Constant">local-scope</span> -<span id="L125" class="LineNr">125 </span> <span class="Constant">load-ingredients</span> +<span id="L125" class="LineNr">125 </span> <span class="Constant">load-inputs</span> <span id="L126" class="LineNr">126 </span> <span class="Comment"># are we below the sandbox editor?</span> <span id="L127" class="LineNr">127 </span> click-sandbox-area?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L190'>click-on-sandbox-area?</a> click-row, click-column, env <span id="L128" class="LineNr">128 </span> <span class="muControl">return-unless</span> click-sandbox-area?, <span class="Constant">0/false</span> @@ -203,7 +203,7 @@ if ('onhashchange' in window) { <span id="L141" class="LineNr">141 </span> <span id="L142" class="LineNr">142 </span><span class="muRecipe">def</span> <a href='008-sandbox-edit.mu.html#L142'>try-edit-sandbox</a> click-row:num, env:&:environment<span class="muRecipe"> -> </span>clicked-on-edit-button?:bool, env:&:environment [ <span id="L143" class="LineNr">143 </span> <span class="Constant">local-scope</span> -<span id="L144" class="LineNr">144 </span> <span class="Constant">load-ingredients</span> +<span id="L144" class="LineNr">144 </span> <span class="Constant">load-inputs</span> <span id="L145" class="LineNr">145 </span> <span class="Comment"># identify the sandbox to edit, if the click was actually on the 'edit' button</span> <span id="L146" class="LineNr">146 </span> sandbox:&:sandbox <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L175'>find-sandbox</a> env, click-row <span id="L147" class="LineNr">147 </span> <span class="muControl">return-unless</span> sandbox, <span class="Constant">0/false</span> diff --git a/html/edit/009-sandbox-test.mu.html b/html/edit/009-sandbox-test.mu.html index c6ef7017..e311f2c0 100644 --- a/html/edit/009-sandbox-test.mu.html +++ b/html/edit/009-sandbox-test.mu.html @@ -214,7 +214,7 @@ if ('onhashchange' in window) { <span id="L151" class="LineNr">151 </span> <span id="L152" class="LineNr">152 </span><span class="muRecipe">def</span> <a href='009-sandbox-test.mu.html#L152'>find-click-in-sandbox-output</a> env:&:environment, click-row:num<span class="muRecipe"> -> </span>sandbox:&:sandbox, sandbox-index:num [ <span id="L153" class="LineNr">153 </span> <span class="Constant">local-scope</span> -<span id="L154" class="LineNr">154 </span> <span class="Constant">load-ingredients</span> +<span id="L154" class="LineNr">154 </span> <span class="Constant">load-inputs</span> <span id="L155" class="LineNr">155 </span> <span class="Comment"># assert click-row >= sandbox.starting-row-on-screen</span> <span id="L156" class="LineNr">156 </span> sandbox:&:sandbox <span class="Special"><-</span> get *env, <span class="Constant">sandbox:offset</span> <span id="L157" class="LineNr">157 </span> start:num <span class="Special"><-</span> get *sandbox, <span class="Constant">starting-row-on-screen:offset</span> @@ -242,7 +242,7 @@ if ('onhashchange' in window) { <span id="L179" class="LineNr">179 </span> <span id="L180" class="LineNr">180 </span><span class="muRecipe">def</span> <a href='009-sandbox-test.mu.html#L180'>toggle-expected-response</a> sandbox:&:sandbox<span class="muRecipe"> -> </span>sandbox:&:sandbox [ <span id="L181" class="LineNr">181 </span> <span class="Constant">local-scope</span> -<span id="L182" class="LineNr">182 </span> <span class="Constant">load-ingredients</span> +<span id="L182" class="LineNr">182 </span> <span class="Constant">load-inputs</span> <span id="L183" class="LineNr">183 </span> expected-response:text <span class="Special"><-</span> get *sandbox, <span class="Constant">expected-response:offset</span> <span id="L184" class="LineNr">184 </span> <span class="Delimiter">{</span> <span id="L185" class="LineNr">185 </span> <span class="Conceal">¦</span> <span class="Comment"># if expected-response is set, reset</span> @@ -269,7 +269,7 @@ if ('onhashchange' in window) { <span id="L206" class="LineNr">206 </span> <span id="L207" class="LineNr">207 </span><span class="muRecipe">def</span> <a href='009-sandbox-test.mu.html#L207'>render-sandbox-response</a> <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a>, sandbox:&:sandbox, left:num, right:num<span class="muRecipe"> -> </span>row:num, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L208" class="LineNr">208 </span> <span class="Constant">local-scope</span> -<span id="L209" class="LineNr">209 </span> <span class="Constant">load-ingredients</span> +<span id="L209" class="LineNr">209 </span> <span class="Constant">load-inputs</span> <span id="L210" class="LineNr">210 </span> sandbox-response:text <span class="Special"><-</span> get *sandbox, <span class="Constant">response:offset</span> <span id="L211" class="LineNr">211 </span> expected-response:text <span class="Special"><-</span> get *sandbox, <span class="Constant">expected-response:offset</span> <span id="L212" class="LineNr">212 </span> row:num <span class="Special"><-</span> get *sandbox <span class="Constant">response-starting-row-on-screen:offset</span> diff --git a/html/edit/010-sandbox-trace.mu.html b/html/edit/010-sandbox-trace.mu.html index 892be6eb..8f907fa7 100644 --- a/html/edit/010-sandbox-trace.mu.html +++ b/html/edit/010-sandbox-trace.mu.html @@ -237,7 +237,7 @@ if ('onhashchange' in window) { <span id="L174" class="LineNr">174 </span><span class="Comment"># replaced in a later layer</span> <span id="L175" class="LineNr">175 </span><span class="muRecipe">def!</span> update-sandbox sandbox:&:sandbox, env:&:environment, idx:num<span class="muRecipe"> -> </span>sandbox:&:sandbox, env:&:environment [ <span id="L176" class="LineNr">176 </span> <span class="Constant">local-scope</span> -<span id="L177" class="LineNr">177 </span> <span class="Constant">load-ingredients</span> +<span id="L177" class="LineNr">177 </span> <span class="Constant">load-inputs</span> <span id="L178" class="LineNr">178 </span> data:text <span class="Special"><-</span> get *sandbox, <span class="Constant">data:offset</span> <span id="L179" class="LineNr">179 </span> response:text, _, fake-screen:&:<a href='../081print.mu.html#L16'>screen</a>, trace:text <span class="Special"><-</span> run-sandboxed data <span id="L180" class="LineNr">180 </span> *sandbox <span class="Special"><-</span> put *sandbox, <span class="Constant">response:offset</span>, response @@ -274,7 +274,7 @@ if ('onhashchange' in window) { <span id="L211" class="LineNr">211 </span> <span id="L212" class="LineNr">212 </span><span class="muRecipe">def</span> <a href='010-sandbox-trace.mu.html#L212'>find-click-in-sandbox-code</a> env:&:environment, click-row:num<span class="muRecipe"> -> </span>sandbox:&:sandbox [ <span id="L213" class="LineNr">213 </span> <span class="Constant">local-scope</span> -<span id="L214" class="LineNr">214 </span> <span class="Constant">load-ingredients</span> +<span id="L214" class="LineNr">214 </span> <span class="Constant">load-inputs</span> <span id="L215" class="LineNr">215 </span> <span class="Comment"># assert click-row >= sandbox.starting-row-on-screen</span> <span id="L216" class="LineNr">216 </span> sandbox <span class="Special"><-</span> get *env, <span class="Constant">sandbox:offset</span> <span id="L217" class="LineNr">217 </span> start:num <span class="Special"><-</span> get *sandbox, <span class="Constant">starting-row-on-screen:offset</span> diff --git a/html/edit/011-errors.mu.html b/html/edit/011-errors.mu.html index 136fc31f..8519462b 100644 --- a/html/edit/011-errors.mu.html +++ b/html/edit/011-errors.mu.html @@ -70,7 +70,7 @@ if ('onhashchange' in window) { <span id="L7" class="LineNr"> 7 </span><span class="Comment"># copy code from recipe editor, persist to disk, load, save any errors</span> <span id="L8" class="LineNr"> 8 </span><span class="muRecipe">def!</span> update-recipes env:&:environment, <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span>errors-found?:bool, env:&:environment, <a href='../088file.mu.html#L11'>resources</a>:&:<a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L9" class="LineNr"> 9 </span> <span class="Constant">local-scope</span> -<span id="L10" class="LineNr"> 10 </span> <span class="Constant">load-ingredients</span> +<span id="L10" class="LineNr"> 10 </span> <span class="Constant">load-inputs</span> <span id="L11" class="LineNr"> 11 </span> recipes:&:editor <span class="Special"><-</span> get *env, <span class="Constant">recipes:offset</span> <span id="L12" class="LineNr"> 12 </span> in:text <span class="Special"><-</span> <a href='005-sandbox.mu.html#L683'>editor-contents</a> recipes <span id="L13" class="LineNr"> 13 </span> <a href='../088file.mu.html#L11'>resources</a> <span class="Special"><-</span> <a href='../088file.mu.html#L127'>dump</a> <a href='../088file.mu.html#L11'>resources</a>, <span class="Constant">[lesson/recipes.mu]</span>, in @@ -104,7 +104,7 @@ if ('onhashchange' in window) { <span id="L41" class="LineNr"> 41 </span> <span id="L42" class="LineNr"> 42 </span><span class="muRecipe">def</span> <a href='011-errors.mu.html#L42'>render-recipe-errors</a> env:&:environment, <a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a><span class="muRecipe"> -> </span><a href='../081print.mu.html#L16'>screen</a>:&:<a href='../081print.mu.html#L16'>screen</a> [ <span id="L43" class="LineNr"> 43 </span> <span class="Constant">local-scope</span> -<span id="L44" class="LineNr"> 44 </span> <span class="Constant">load-ingredients</span> +<span id="L44" class="LineNr"> 44 </span> <span class="Constant">load-inputs</span> <span id="L45" class="LineNr"> 45 </span> recipe-errors:text <span class="Special"><-</span> get *env, <span class="Constant">recipe-errors:offset</span> <span id="L46" class="LineNr"> 46 </span> <span class="muControl">return-unless</span> recipe-errors <span id="L47" class="LineNr"> 47 </span> recipes:&:editor <span class="Special"><-</span> get *env, <span class="Constant">recipes:offset</span> @@ -159,7 +159,7 @@ if ('onhashchange' in window) { <span id="L96" class="LineNr"> 96 </span> <span id="L97" class="LineNr"> 97 </span><span class="muRecipe">def!</span> update-sandbox sandbox:&:sandbox, env:&:environment, idx:num<span class="muRecipe"> -> </span>sandbox:&:sandbox, env:&:environment [ <span id="L98" class="LineNr"> 98 </span> <span class="Constant">local-scope</span> -<span id="L99" class="LineNr"> 99 </span> <span class="Constant">load-ingredients</span> +<span id="L99" class="LineNr"> 99 </span> <span class="Constant">load-inputs</span> <span id="L100" class="LineNr">100 </span> data:text <span class="Special"><-</span> get *sandbox, <span class="Constant">data:offset</span> <span id="L101" class="LineNr">101 </span> response:text, errors:text, fake-screen:&:<a href='../081print.mu.html#L16'>screen</a>, trace:text, completed?:bool <span class="Special"><-</span> run-sandboxed data <span id="L102" class="LineNr">102 </span> *sandbox <span class="Special"><-</span> put *sandbox, <span class="Constant">response:offset</span>, response diff --git a/html/edit/012-editor-undo.mu.html b/html/edit/012-editor-undo.mu.html index dcf95a50..0bda1aaf 100644 --- a/html/edit/012-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -264,7 +264,7 @@ if ('onhashchange' in window) { <span id="L201" class="LineNr"> 201 </span><span class="Comment"># moving the cursor can lose work on the undo stack.</span> <span id="L202" class="LineNr"> 202 </span><span class="muRecipe">def</span> <a href='012-editor-undo.mu.html#L202'>add-operation</a> editor:&:editor, op:&:<a href='012-editor-undo.mu.html#L5'>operation</a><span class="muRecipe"> -> </span>editor:&:editor [ <span id="L203" class="LineNr"> 203 </span> <span class="Constant">local-scope</span> -<span id="L204" class="LineNr"> 204 </span> <span class="Constant">load-ingredients</span> +<span id="L204" class="LineNr"> 204 </span> <span class="Constant">load-inputs</span> <span id="L205" class="LineNr"> 205 </span> undo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> <span id="L206" class="LineNr"> 206 </span> undo <span class="Special"><-</span> push op undo <span id="L207" class="LineNr"> 207 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">undo:offset</span>, undo diff --git a/html/factorial.mu.html b/html/factorial.mu.html index db134e8f..9a02e01f 100644 --- a/html/factorial.mu.html +++ b/html/factorial.mu.html @@ -70,7 +70,7 @@ if ('onhashchange' in window) { <span id="L9" class="LineNr"> 9 </span> <span id="L10" class="LineNr">10 </span><span class="muRecipe">def</span> <a href='factorial.mu.html#L10'>factorial</a> n:num<span class="muRecipe"> -> </span>result:num [ <span id="L11" class="LineNr">11 </span> <span class="Constant">local-scope</span> -<span id="L12" class="LineNr">12 </span> <span class="Constant">load-ingredients</span> +<span id="L12" class="LineNr">12 </span> <span class="Constant">load-inputs</span> <span id="L13" class="LineNr">13 </span> <span class="Delimiter">{</span> <span id="L14" class="LineNr">14 </span> <span class="Conceal">¦</span> <span class="Comment"># if n=0 return 1</span> <span id="L15" class="LineNr">15 </span> <span class="Conceal">¦</span> zero?:bool <span class="Special"><-</span> equal n,<span class="Constant"> 0</span> diff --git a/html/http-client.mu.html b/html/http-client.mu.html index 119a9b6d..91e04cbe 100644 --- a/html/http-client.mu.html +++ b/html/http-client.mu.html @@ -62,24 +62,31 @@ if ('onhashchange' in window) { <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span><span class="muRecipe">def</span> <a href='http-client.mu.html#L3'>main</a> [ <span id="L4" class="LineNr"> 4 </span> <span class="Constant">local-scope</span> -<span id="L5" class="LineNr"> 5 </span> google:&:<a href='075channel.mu.html#L43'>source</a>:char <span class="Special"><-</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <span class="Constant">0/real-resources</span>, <span class="Constant">[google.com/]</span> -<span id="L6" class="LineNr"> 6 </span> n:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> -<span id="L7" class="LineNr"> 7 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 30</span> -<span id="L8" class="LineNr"> 8 </span> <span class="Delimiter">{</span> -<span id="L9" class="LineNr"> 9 </span> <span class="Conceal">¦</span> c:char, done?:bool <span class="Special"><-</span> read google -<span id="L10" class="LineNr">10 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? -<span id="L11" class="LineNr">11 </span> <span class="Conceal">¦</span> n <span class="Special"><-</span> add n,<span class="Constant"> 1</span> -<span id="L12" class="LineNr">12 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> append buf, c -<span id="L13" class="LineNr">13 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> -<span id="L14" class="LineNr">14 </span> <span class="Delimiter">}</span> -<span id="L15" class="LineNr">15 </span> result:text <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf -<span id="L16" class="LineNr">16 </span> open-console -<span id="L17" class="LineNr">17 </span> <a href='081print.mu.html#L46'>clear-screen</a> <span class="Constant">0/screen</span> <span class="Comment"># non-scrolling app</span> -<span id="L18" class="LineNr">18 </span> len:num <span class="Special"><-</span> length *result -<span id="L19" class="LineNr">19 </span> print <span class="Constant">0/real-screen</span>, result -<span id="L20" class="LineNr">20 </span> wait-for-some-interaction -<span id="L21" class="LineNr">21 </span> close-console -<span id="L22" class="LineNr">22 </span>] +<span id="L5" class="LineNr"> 5 </span> $print <span class="Constant">[aaa]</span> <span class="Constant">10/newline</span> +<span id="L6" class="LineNr"> 6 </span> google:&:<a href='075channel.mu.html#L43'>source</a>:char <span class="Special"><-</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <span class="Constant">0/real-resources</span>, <span class="Constant">[google.com/]</span> +<span id="L7" class="LineNr"> 7 </span> $print <span class="Constant">[bbb]</span> <span class="Constant">10/newline</span> +<span id="L8" class="LineNr"> 8 </span> n:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> +<span id="L9" class="LineNr"> 9 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 30</span> +<span id="L10" class="LineNr">10 </span> <span class="Delimiter">{</span> +<span id="L11" class="LineNr">11 </span> <span class="Conceal">¦</span> c:char, done?:bool <span class="Special"><-</span> read google +<span id="L12" class="LineNr">12 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? +<span id="L13" class="LineNr">13 </span> <span class="Conceal">¦</span> n <span class="Special"><-</span> add n,<span class="Constant"> 1</span> +<span id="L14" class="LineNr">14 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> append buf, c +<span id="L15" class="LineNr">15 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> +<span id="L16" class="LineNr">16 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> _, a:num <span class="Special"><-</span> divide-with-remainder n,<span class="Constant"> 100</span> +<span id="L17" class="LineNr">17 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> a +<span id="L18" class="LineNr">18 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> $print n <span class="Constant">10/newline</span> +<span id="L19" class="LineNr">19 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L20" class="LineNr">20 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> +<span id="L21" class="LineNr">21 </span> <span class="Delimiter">}</span> +<span id="L22" class="LineNr">22 </span> result:text <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf +<span id="L23" class="LineNr">23 </span> open-console +<span id="L24" class="LineNr">24 </span> <a href='081print.mu.html#L46'>clear-screen</a> <span class="Constant">0/screen</span> <span class="Comment"># non-scrolling app</span> +<span id="L25" class="LineNr">25 </span> len:num <span class="Special"><-</span> length *result +<span id="L26" class="LineNr">26 </span> print <span class="Constant">0/real-screen</span>, result +<span id="L27" class="LineNr">27 </span> wait-for-some-interaction +<span id="L28" class="LineNr">28 </span> close-console +<span id="L29" class="LineNr">29 </span>] </pre> </body> </html> diff --git a/html/immutable-error.mu.html b/html/immutable-error.mu.html index 07457b69..92113108 100644 --- a/html/immutable-error.mu.html +++ b/html/immutable-error.mu.html @@ -65,7 +65,7 @@ if ('onhashchange' in window) { <span id="L8" class="LineNr"> 8 </span> <span id="L9" class="LineNr"> 9 </span><span class="muRecipe">def</span> <a href='immutable-error.mu.html#L9'>foo</a> x:&:num [ <span id="L10" class="LineNr">10 </span> <span class="Constant">local-scope</span> -<span id="L11" class="LineNr">11 </span> <span class="Constant">load-ingredients</span> +<span id="L11" class="LineNr">11 </span> <span class="Constant">load-inputs</span> <span id="L12" class="LineNr">12 </span> *x <span class="Special"><-</span> copy<span class="Constant"> 34</span> <span class="Comment"># will cause an error because x is immutable in this function</span> <span id="L13" class="LineNr">13 </span>] </pre> diff --git a/html/lambda-to-mu.mu.html b/html/lambda-to-mu.mu.html index 91c9984b..c6502d25 100644 --- a/html/lambda-to-mu.mu.html +++ b/html/lambda-to-mu.mu.html @@ -69,7 +69,7 @@ if ('onhashchange' in window) { <span id="L5" class="LineNr"> 5 </span><span class="Comment"># potential enhancements:</span> <span id="L6" class="LineNr"> 6 </span><span class="Comment"># symbol table</span> <span id="L7" class="LineNr"> 7 </span><span class="Comment"># poor man's macros</span> -<span id="L8" class="LineNr"> 8 </span><span class="Comment"># substitute one instruction with multiple, parameterized by ingredients and products</span> +<span id="L8" class="LineNr"> 8 </span><span class="Comment"># substitute one instruction with multiple, parameterized by inputs and products</span> <span id="L9" class="LineNr"> 9 </span> <span id="L10" class="LineNr"> 10 </span><span class="muScenario">scenario</span> convert-lambda [ <span id="L11" class="LineNr"> 11 </span> run [ @@ -85,7 +85,7 @@ if ('onhashchange' in window) { <span id="L21" class="LineNr"> 21 </span> <span id="L22" class="LineNr"> 22 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L22'>lambda-to-mu</a> in:text<span class="muRecipe"> -> </span>out:text [ <span id="L23" class="LineNr"> 23 </span> <span class="Constant">local-scope</span> -<span id="L24" class="LineNr"> 24 </span> <span class="Constant">load-ingredients</span> +<span id="L24" class="LineNr"> 24 </span> <span class="Constant">load-inputs</span> <span id="L25" class="LineNr"> 25 </span> out <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L26" class="LineNr"> 26 </span> cells:&:<a href='lambda-to-mu.mu.html#L31'>cell</a> <span class="Special"><-</span> parse in <span id="L27" class="LineNr"> 27 </span> out <span class="Special"><-</span> to-mu cells @@ -105,28 +105,28 @@ if ('onhashchange' in window) { <span id="L41" class="LineNr"> 41 </span> <span id="L42" class="LineNr"> 42 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L42'>new-atom</a> name:text<span class="muRecipe"> -> </span>result:&:<a href='lambda-to-mu.mu.html#L31'>cell</a> [ <span id="L43" class="LineNr"> 43 </span> <span class="Constant">local-scope</span> -<span id="L44" class="LineNr"> 44 </span> <span class="Constant">load-ingredients</span> +<span id="L44" class="LineNr"> 44 </span> <span class="Constant">load-inputs</span> <span id="L45" class="LineNr"> 45 </span> result <span class="Special"><-</span> new <span class="Constant"><a href='lambda-to-mu.mu.html#L31'>cell</a>:type</span> <span id="L46" class="LineNr"> 46 </span> *result <span class="Special"><-</span> merge <span class="Constant">0/tag:atom</span>, name <span id="L47" class="LineNr"> 47 </span>] <span id="L48" class="LineNr"> 48 </span> <span id="L49" class="LineNr"> 49 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L49'>new-pair</a> a:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, b:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>result:&:<a href='lambda-to-mu.mu.html#L31'>cell</a> [ <span id="L50" class="LineNr"> 50 </span> <span class="Constant">local-scope</span> -<span id="L51" class="LineNr"> 51 </span> <span class="Constant">load-ingredients</span> +<span id="L51" class="LineNr"> 51 </span> <span class="Constant">load-inputs</span> <span id="L52" class="LineNr"> 52 </span> result <span class="Special"><-</span> new <span class="Constant"><a href='lambda-to-mu.mu.html#L31'>cell</a>:type</span> <span id="L53" class="LineNr"> 53 </span> *result <span class="Special"><-</span> merge <span class="Constant">1/tag:<a href='lambda-to-mu.mu.html#L37'>pair</a></span>, a/first, b/rest <span id="L54" class="LineNr"> 54 </span>] <span id="L55" class="LineNr"> 55 </span> <span id="L56" class="LineNr"> 56 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L56'>is-atom?</a> x:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>result:bool [ <span id="L57" class="LineNr"> 57 </span> <span class="Constant">local-scope</span> -<span id="L58" class="LineNr"> 58 </span> <span class="Constant">load-ingredients</span> +<span id="L58" class="LineNr"> 58 </span> <span class="Constant">load-inputs</span> <span id="L59" class="LineNr"> 59 </span> <span class="muControl">return-unless</span> x, <span class="Constant">0/false</span> <span id="L60" class="LineNr"> 60 </span> _, result <span class="Special"><-</span> maybe-convert *x, <span class="Constant">atom:variant</span> <span id="L61" class="LineNr"> 61 </span>] <span id="L62" class="LineNr"> 62 </span> <span id="L63" class="LineNr"> 63 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L63'>is-pair?</a> x:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>result:bool [ <span id="L64" class="LineNr"> 64 </span> <span class="Constant">local-scope</span> -<span id="L65" class="LineNr"> 65 </span> <span class="Constant">load-ingredients</span> +<span id="L65" class="LineNr"> 65 </span> <span class="Constant">load-inputs</span> <span id="L66" class="LineNr"> 66 </span> <span class="muControl">return-unless</span> x, <span class="Constant">0/false</span> <span id="L67" class="LineNr"> 67 </span> _, result <span class="Special"><-</span> maybe-convert *x, <span class="Constant"><a href='lambda-to-mu.mu.html#L37'>pair</a>:variant</span> <span id="L68" class="LineNr"> 68 </span>] @@ -159,7 +159,7 @@ if ('onhashchange' in window) { <span id="L95" class="LineNr"> 95 </span> <span id="L96" class="LineNr"> 96 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L96'>atom-match?</a> x:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, pat:text<span class="muRecipe"> -> </span>result:bool [ <span id="L97" class="LineNr"> 97 </span> <span class="Constant">local-scope</span> -<span id="L98" class="LineNr"> 98 </span> <span class="Constant">load-ingredients</span> +<span id="L98" class="LineNr"> 98 </span> <span class="Constant">load-inputs</span> <span id="L99" class="LineNr"> 99 </span> s:text, <a href='lambda-to-mu.mu.html#L56'>is-atom?</a>:bool <span class="Special"><-</span> maybe-convert *x, <span class="Constant">atom:variant</span> <span id="L100" class="LineNr">100 </span> <span class="muControl">return-unless</span> <a href='lambda-to-mu.mu.html#L56'>is-atom?</a>, <span class="Constant">0/false</span> <span id="L101" class="LineNr">101 </span> result <span class="Special"><-</span> equal pat, s @@ -176,7 +176,7 @@ if ('onhashchange' in window) { <span id="L112" class="LineNr">112 </span> <span id="L113" class="LineNr">113 </span><span class="muRecipe">def</span> first x:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>result:&:<a href='lambda-to-mu.mu.html#L31'>cell</a> [ <span id="L114" class="LineNr">114 </span> <span class="Constant">local-scope</span> -<span id="L115" class="LineNr">115 </span> <span class="Constant">load-ingredients</span> +<span id="L115" class="LineNr">115 </span> <span class="Constant">load-inputs</span> <span id="L116" class="LineNr">116 </span> <a href='lambda-to-mu.mu.html#L37'>pair</a>:<a href='lambda-to-mu.mu.html#L37'>pair</a>, pair?:bool <span class="Special"><-</span> maybe-convert *x, <span class="Constant"><a href='lambda-to-mu.mu.html#L37'>pair</a>:variant</span> <span id="L117" class="LineNr">117 </span> <span class="muControl">return-unless</span> pair?, <span class="Constant">0/nil</span> <span id="L118" class="LineNr">118 </span> result <span class="Special"><-</span> get <a href='lambda-to-mu.mu.html#L37'>pair</a>, <span class="Constant">first:offset</span> @@ -184,7 +184,7 @@ if ('onhashchange' in window) { <span id="L120" class="LineNr">120 </span> <span id="L121" class="LineNr">121 </span><span class="muRecipe">def</span> rest x:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>result:&:<a href='lambda-to-mu.mu.html#L31'>cell</a> [ <span id="L122" class="LineNr">122 </span> <span class="Constant">local-scope</span> -<span id="L123" class="LineNr">123 </span> <span class="Constant">load-ingredients</span> +<span id="L123" class="LineNr">123 </span> <span class="Constant">load-inputs</span> <span id="L124" class="LineNr">124 </span> <a href='lambda-to-mu.mu.html#L37'>pair</a>:<a href='lambda-to-mu.mu.html#L37'>pair</a>, pair?:bool <span class="Special"><-</span> maybe-convert *x, <span class="Constant"><a href='lambda-to-mu.mu.html#L37'>pair</a>:variant</span> <span id="L125" class="LineNr">125 </span> <span class="muControl">return-unless</span> pair?, <span class="Constant">0/nil</span> <span id="L126" class="LineNr">126 </span> result <span class="Special"><-</span> get <a href='lambda-to-mu.mu.html#L37'>pair</a>, <span class="Constant">rest:offset</span> @@ -192,7 +192,7 @@ if ('onhashchange' in window) { <span id="L128" class="LineNr">128 </span> <span id="L129" class="LineNr">129 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L129'>set-first</a> base:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, new-first:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>base:&:<a href='lambda-to-mu.mu.html#L31'>cell</a> [ <span id="L130" class="LineNr">130 </span> <span class="Constant">local-scope</span> -<span id="L131" class="LineNr">131 </span> <span class="Constant">load-ingredients</span> +<span id="L131" class="LineNr">131 </span> <span class="Constant">load-inputs</span> <span id="L132" class="LineNr">132 </span> <a href='lambda-to-mu.mu.html#L37'>pair</a>:<a href='lambda-to-mu.mu.html#L37'>pair</a>, <a href='lambda-to-mu.mu.html#L63'>is-pair?</a>:bool <span class="Special"><-</span> maybe-convert *base, <span class="Constant"><a href='lambda-to-mu.mu.html#L37'>pair</a>:variant</span> <span id="L133" class="LineNr">133 </span> <span class="muControl">return-unless</span> <a href='lambda-to-mu.mu.html#L63'>is-pair?</a> <span id="L134" class="LineNr">134 </span> <a href='lambda-to-mu.mu.html#L37'>pair</a> <span class="Special"><-</span> put <a href='lambda-to-mu.mu.html#L37'>pair</a>, <span class="Constant">first:offset</span>, new-first @@ -201,7 +201,7 @@ if ('onhashchange' in window) { <span id="L137" class="LineNr">137 </span> <span id="L138" class="LineNr">138 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L138'>set-rest</a> base:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, new-rest:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>base:&:<a href='lambda-to-mu.mu.html#L31'>cell</a> [ <span id="L139" class="LineNr">139 </span> <span class="Constant">local-scope</span> -<span id="L140" class="LineNr">140 </span> <span class="Constant">load-ingredients</span> +<span id="L140" class="LineNr">140 </span> <span class="Constant">load-inputs</span> <span id="L141" class="LineNr">141 </span> <a href='lambda-to-mu.mu.html#L37'>pair</a>:<a href='lambda-to-mu.mu.html#L37'>pair</a>, <a href='lambda-to-mu.mu.html#L63'>is-pair?</a>:bool <span class="Special"><-</span> maybe-convert *base, <span class="Constant"><a href='lambda-to-mu.mu.html#L37'>pair</a>:variant</span> <span id="L142" class="LineNr">142 </span> <span class="muControl">return-unless</span> <a href='lambda-to-mu.mu.html#L63'>is-pair?</a> <span id="L143" class="LineNr">143 </span> <a href='lambda-to-mu.mu.html#L37'>pair</a> <span class="Special"><-</span> put <a href='lambda-to-mu.mu.html#L37'>pair</a>, <span class="Constant">rest:offset</span>, new-rest @@ -239,7 +239,7 @@ if ('onhashchange' in window) { <span id="L175" class="LineNr">175 </span> <span id="L176" class="LineNr">176 </span><span class="muRecipe">def</span> parse in:text<span class="muRecipe"> -> </span>out:&:<a href='lambda-to-mu.mu.html#L31'>cell</a> [ <span id="L177" class="LineNr">177 </span> <span class="Constant">local-scope</span> -<span id="L178" class="LineNr">178 </span> <span class="Constant">load-ingredients</span> +<span id="L178" class="LineNr">178 </span> <span class="Constant">load-inputs</span> <span id="L179" class="LineNr">179 </span> s:&:<a href='066stream.mu.html#L2'>stream</a>:char <span class="Special"><-</span> <a href='066stream.mu.html#L7'>new-stream</a> in <span id="L180" class="LineNr">180 </span> out, s <span class="Special"><-</span> parse s <span id="L181" class="LineNr">181 </span> trace<span class="Constant"> 2</span>, <span class="Constant">[app/parse]</span>, out @@ -247,7 +247,7 @@ if ('onhashchange' in window) { <span id="L183" class="LineNr">183 </span> <span id="L184" class="LineNr">184 </span><span class="muRecipe">def</span> parse in:&:<a href='066stream.mu.html#L2'>stream</a>:char<span class="muRecipe"> -> </span>out:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, in:&:<a href='066stream.mu.html#L2'>stream</a>:char [ <span id="L185" class="LineNr">185 </span> <span class="Constant">local-scope</span> -<span id="L186" class="LineNr">186 </span> <span class="Constant">load-ingredients</span> +<span id="L186" class="LineNr">186 </span> <span class="Constant">load-inputs</span> <span id="L187" class="LineNr">187 </span> <span class="Comment"># skip whitespace</span> <span id="L188" class="LineNr">188 </span> in <span class="Special"><-</span> <a href='lambda-to-mu.mu.html#L274'>skip-whitespace</a> in <span id="L189" class="LineNr">189 </span> c:char, eof?:bool <span class="Special"><-</span> <a href='066stream.mu.html#L42'>peek</a> in @@ -337,7 +337,7 @@ if ('onhashchange' in window) { <span id="L273" class="LineNr">273 </span> <span id="L274" class="LineNr">274 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L274'>skip-whitespace</a> in:&:<a href='066stream.mu.html#L2'>stream</a>:char<span class="muRecipe"> -> </span>in:&:<a href='066stream.mu.html#L2'>stream</a>:char [ <span id="L275" class="LineNr">275 </span> <span class="Constant">local-scope</span> -<span id="L276" class="LineNr">276 </span> <span class="Constant">load-ingredients</span> +<span id="L276" class="LineNr">276 </span> <span class="Constant">load-inputs</span> <span id="L277" class="LineNr">277 </span> <span class="Delimiter">{</span> <span id="L278" class="LineNr">278 </span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> <a href='066stream.mu.html#L72'>end-of-stream?</a> in <span id="L279" class="LineNr">279 </span> <span class="Conceal">¦</span> <span class="muControl">return-if</span> done?, <span class="Constant">0/null</span> @@ -351,7 +351,7 @@ if ('onhashchange' in window) { <span id="L287" class="LineNr">287 </span> <span id="L288" class="LineNr">288 </span><span class="muRecipe">def</span> to-text x:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>out:text [ <span id="L289" class="LineNr">289 </span> <span class="Constant">local-scope</span> -<span id="L290" class="LineNr">290 </span> <span class="Constant">load-ingredients</span> +<span id="L290" class="LineNr">290 </span> <span class="Constant">load-inputs</span> <span id="L291" class="LineNr">291 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 30</span> <span id="L292" class="LineNr">292 </span> buf <span class="Special"><-</span> to-buffer x, buf <span id="L293" class="LineNr">293 </span> out <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf @@ -359,7 +359,7 @@ if ('onhashchange' in window) { <span id="L295" class="LineNr">295 </span> <span id="L296" class="LineNr">296 </span><span class="muRecipe">def</span> to-buffer x:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, buf:&:<a href='061text.mu.html#L120'>buffer</a>:char<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L120'>buffer</a>:char [ <span id="L297" class="LineNr">297 </span> <span class="Constant">local-scope</span> -<span id="L298" class="LineNr">298 </span> <span class="Constant">load-ingredients</span> +<span id="L298" class="LineNr">298 </span> <span class="Constant">load-inputs</span> <span id="L299" class="LineNr">299 </span> <span class="Comment"># base case: empty cell</span> <span id="L300" class="LineNr">300 </span> <span class="Delimiter">{</span> <span id="L301" class="LineNr">301 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> x @@ -638,7 +638,7 @@ if ('onhashchange' in window) { <span id="L574" class="LineNr">574 </span> <span id="L575" class="LineNr">575 </span><span class="muRecipe">def</span> to-mu in:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>out:text [ <span id="L576" class="LineNr">576 </span> <span class="Constant">local-scope</span> -<span id="L577" class="LineNr">577 </span> <span class="Constant">load-ingredients</span> +<span id="L577" class="LineNr">577 </span> <span class="Constant">load-inputs</span> <span id="L578" class="LineNr">578 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 30</span> <span id="L579" class="LineNr">579 </span> buf <span class="Special"><-</span> to-mu in, buf <span id="L580" class="LineNr">580 </span> out <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf @@ -646,7 +646,7 @@ if ('onhashchange' in window) { <span id="L582" class="LineNr">582 </span> <span id="L583" class="LineNr">583 </span><span class="muRecipe">def</span> to-mu in:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, buf:&:<a href='061text.mu.html#L120'>buffer</a>:char<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L120'>buffer</a>:char, result-name:text [ <span id="L584" class="LineNr">584 </span> <span class="Constant">local-scope</span> -<span id="L585" class="LineNr">585 </span> <span class="Constant">load-ingredients</span> +<span id="L585" class="LineNr">585 </span> <span class="Constant">load-inputs</span> <span id="L586" class="LineNr">586 </span> <span class="Comment"># null cell? no change.</span> <span id="L587" class="LineNr">587 </span> <span class="Comment"># pair with all atoms? gensym a new variable</span> <span id="L588" class="LineNr">588 </span> <span class="Comment"># pair containing other pairs? recurse</span> diff --git a/html/mutable.mu.html b/html/mutable.mu.html index 22ab4368..eea20c1b 100644 --- a/html/mutable.mu.html +++ b/html/mutable.mu.html @@ -65,7 +65,7 @@ if ('onhashchange' in window) { <span id="L8" class="LineNr"> 8 </span> <span id="L9" class="LineNr"> 9 </span><span class="muRecipe">def</span> <a href='mutable.mu.html#L9'>foo</a> x:&:num<span class="muRecipe"> -> </span>x:&:num [ <span id="L10" class="LineNr">10 </span> <span class="Constant">local-scope</span> -<span id="L11" class="LineNr">11 </span> <span class="Constant">load-ingredients</span> +<span id="L11" class="LineNr">11 </span> <span class="Constant">load-inputs</span> <span id="L12" class="LineNr">12 </span> *x <span class="Special"><-</span> copy<span class="Constant"> 34</span> <span id="L13" class="LineNr">13 </span>] </pre> diff --git a/html/nqueens.mu.html b/html/nqueens.mu.html index 441561b2..4fc263e0 100644 --- a/html/nqueens.mu.html +++ b/html/nqueens.mu.html @@ -71,7 +71,7 @@ if ('onhashchange' in window) { <span id="L10" class="LineNr"> 10 </span> <span id="L11" class="LineNr"> 11 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L11'>nqueens</a> n:num, queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:num, queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a> [ <span id="L12" class="LineNr"> 12 </span> <span class="Constant">local-scope</span> -<span id="L13" class="LineNr"> 13 </span> <span class="Constant">load-ingredients</span> +<span id="L13" class="LineNr"> 13 </span> <span class="Constant">load-inputs</span> <span id="L14" class="LineNr"> 14 </span> <span class="Comment"># if 'queens' is already long enough, print it and return</span> <span id="L15" class="LineNr"> 15 </span> added-so-far:num <span class="Special"><-</span> length queens <span id="L16" class="LineNr"> 16 </span> <span class="Delimiter">{</span> @@ -112,7 +112,7 @@ if ('onhashchange' in window) { <span id="L51" class="LineNr"> 51 </span><span class="Comment"># only in files and diagonals</span> <span id="L52" class="LineNr"> 52 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L52'>conflict?</a> curr:<a href='nqueens.mu.html#L6'>square</a>, queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:bool [ <span id="L53" class="LineNr"> 53 </span> <span class="Constant">local-scope</span> -<span id="L54" class="LineNr"> 54 </span> <span class="Constant">load-ingredients</span> +<span id="L54" class="LineNr"> 54 </span> <span class="Constant">load-inputs</span> <span id="L55" class="LineNr"> 55 </span> result <span class="Special"><-</span> <a href='nqueens.mu.html#L60'>conflicting-file?</a> curr, queens <span id="L56" class="LineNr"> 56 </span> <span class="muControl">return-if</span> result <span id="L57" class="LineNr"> 57 </span> result <span class="Special"><-</span> <a href='nqueens.mu.html#L76'>conflicting-diagonal?</a> curr, queens @@ -120,7 +120,7 @@ if ('onhashchange' in window) { <span id="L59" class="LineNr"> 59 </span> <span id="L60" class="LineNr"> 60 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L60'>conflicting-file?</a> curr:<a href='nqueens.mu.html#L6'>square</a>, queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:bool [ <span id="L61" class="LineNr"> 61 </span> <span class="Constant">local-scope</span> -<span id="L62" class="LineNr"> 62 </span> <span class="Constant">load-ingredients</span> +<span id="L62" class="LineNr"> 62 </span> <span class="Constant">load-inputs</span> <span id="L63" class="LineNr"> 63 </span> curr-file:num <span class="Special"><-</span> get curr, <span class="Constant">file:offset</span> <span id="L64" class="LineNr"> 64 </span> <span class="Delimiter">{</span> <span id="L65" class="LineNr"> 65 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> queens @@ -136,7 +136,7 @@ if ('onhashchange' in window) { <span id="L75" class="LineNr"> 75 </span> <span id="L76" class="LineNr"> 76 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L76'>conflicting-diagonal?</a> curr:<a href='nqueens.mu.html#L6'>square</a>, queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:bool [ <span id="L77" class="LineNr"> 77 </span> <span class="Constant">local-scope</span> -<span id="L78" class="LineNr"> 78 </span> <span class="Constant">load-ingredients</span> +<span id="L78" class="LineNr"> 78 </span> <span class="Constant">load-inputs</span> <span id="L79" class="LineNr"> 79 </span> curr-rank:num <span class="Special"><-</span> get curr, <span class="Constant">rank:offset</span> <span id="L80" class="LineNr"> 80 </span> curr-file:num <span class="Special"><-</span> get curr, <span class="Constant">file:offset</span> <span id="L81" class="LineNr"> 81 </span> <span class="Delimiter">{</span> diff --git a/html/static-dispatch.mu.html b/html/static-dispatch.mu.html index ee734f6b..26aa6263 100644 --- a/html/static-dispatch.mu.html +++ b/html/static-dispatch.mu.html @@ -65,23 +65,23 @@ if ('onhashchange' in window) { <span id="L8" class="LineNr"> 8 </span> <span id="L9" class="LineNr"> 9 </span><span class="muRecipe">def</span> test a:num<span class="muRecipe"> -> </span>b:num [ <span id="L10" class="LineNr">10 </span> <span class="Constant">local-scope</span> -<span id="L11" class="LineNr">11 </span> <span class="Constant">load-ingredients</span> +<span id="L11" class="LineNr">11 </span> <span class="Constant">load-inputs</span> <span id="L12" class="LineNr">12 </span> b <span class="Special"><-</span> add a,<span class="Constant"> 1</span> <span id="L13" class="LineNr">13 </span>] <span id="L14" class="LineNr">14 </span> <span id="L15" class="LineNr">15 </span><span class="muRecipe">def</span> test a:num, b:num<span class="muRecipe"> -> </span>c:num [ <span id="L16" class="LineNr">16 </span> <span class="Constant">local-scope</span> -<span id="L17" class="LineNr">17 </span> <span class="Constant">load-ingredients</span> +<span id="L17" class="LineNr">17 </span> <span class="Constant">load-inputs</span> <span id="L18" class="LineNr">18 </span> c <span class="Special"><-</span> add a, b <span id="L19" class="LineNr">19 </span>] <span id="L20" class="LineNr">20 </span> <span id="L21" class="LineNr">21 </span><span class="muRecipe">def</span> <a href='static-dispatch.mu.html#L21'>main</a> [ <span id="L22" class="LineNr">22 </span> <span class="Constant">local-scope</span> -<span id="L23" class="LineNr">23 </span> a:num <span class="Special"><-</span> test<span class="Constant"> 3</span> <span class="Comment"># selects single-ingredient version</span> +<span id="L23" class="LineNr">23 </span> a:num <span class="Special"><-</span> test<span class="Constant"> 3</span> <span class="Comment"># selects single-input version</span> <span id="L24" class="LineNr">24 </span> $print a, <span class="Constant">10/newline</span> -<span id="L25" class="LineNr">25 </span> b:num <span class="Special"><-</span> test<span class="Constant"> 3</span>,<span class="Constant"> 4</span> <span class="Comment"># selects double-ingredient version</span> +<span id="L25" class="LineNr">25 </span> b:num <span class="Special"><-</span> test<span class="Constant"> 3</span>,<span class="Constant"> 4</span> <span class="Comment"># selects double-input version</span> <span id="L26" class="LineNr">26 </span> $print b, <span class="Constant">10/newline</span> -<span id="L27" class="LineNr">27 </span> c:num <span class="Special"><-</span> test<span class="Constant"> 3</span>,<span class="Constant"> 4</span>,<span class="Constant"> 5</span> <span class="Comment"># prefers double- to single-ingredient version</span> +<span id="L27" class="LineNr">27 </span> c:num <span class="Special"><-</span> test<span class="Constant"> 3</span>,<span class="Constant"> 4</span>,<span class="Constant"> 5</span> <span class="Comment"># prefers double- to single-input version</span> <span id="L28" class="LineNr">28 </span> $print c, <span class="Constant">10/newline</span> <span id="L29" class="LineNr">29 </span>] </pre> diff --git a/html/tangle.mu.html b/html/tangle.mu.html index f00b1093..65336b80 100644 --- a/html/tangle.mu.html +++ b/html/tangle.mu.html @@ -68,7 +68,7 @@ if ('onhashchange' in window) { <span id="L8" class="LineNr"> 8 </span> <span id="L9" class="LineNr"> 9 </span><span class="muRecipe">def</span> <a href='tangle.mu.html#L9'>factorial</a> n:num<span class="muRecipe"> -> </span>result:num [ <span id="L10" class="LineNr">10 </span> <span class="Constant">local-scope</span> -<span id="L11" class="LineNr">11 </span> <span class="Constant">load-ingredients</span> +<span id="L11" class="LineNr">11 </span> <span class="Constant">load-inputs</span> <span id="L12" class="LineNr">12 </span><span class="Constant"> <a href='tangle.mu.html#L12'><factorial-cases></a></span> <span id="L13" class="LineNr">13 </span>] <span id="L14" class="LineNr">14 </span> diff --git a/http-client.mu b/http-client.mu index 681b4738..9219a76f 100644 --- a/http-client.mu +++ b/http-client.mu @@ -2,7 +2,9 @@ def main [ local-scope + $print [aaa] 10/newline google:&:source:char <- start-reading-from-network 0/real-resources, [google.com/] + $print [bbb] 10/newline n:num <- copy 0 buf:&:buffer:char <- new-buffer 30 { @@ -10,6 +12,11 @@ def main [ break-if done? n <- add n, 1 buf <- append buf, c + { + _, a:num <- divide-with-remainder n, 100 + break-if a + $print n 10/newline + } loop } result:text <- buffer-to-array buf diff --git a/immutable-error.mu b/immutable-error.mu index 2d25d56e..25554b2f 100644 --- a/immutable-error.mu +++ b/immutable-error.mu @@ -8,6 +8,6 @@ def main [ def foo x:&:num [ local-scope - load-ingredients + load-inputs *x <- copy 34 # will cause an error because x is immutable in this function ] diff --git a/lambda-to-mu.mu b/lambda-to-mu.mu index 2bd74974..31edaf34 100644 --- a/lambda-to-mu.mu +++ b/lambda-to-mu.mu @@ -5,7 +5,7 @@ # potential enhancements: # symbol table # poor man's macros -# substitute one instruction with multiple, parameterized by ingredients and products +# substitute one instruction with multiple, parameterized by inputs and products scenario convert-lambda [ run [ @@ -21,7 +21,7 @@ result <- add a t1] def lambda-to-mu in:text -> out:text [ local-scope - load-ingredients + load-inputs out <- copy 0 cells:&:cell <- parse in out <- to-mu cells @@ -41,28 +41,28 @@ container pair [ def new-atom name:text -> result:&:cell [ local-scope - load-ingredients + load-inputs result <- new cell:type *result <- merge 0/tag:atom, name ] def new-pair a:&:cell, b:&:cell -> result:&:cell [ local-scope - load-ingredients + load-inputs result <- new cell:type *result <- merge 1/tag:pair, a/first, b/rest ] def is-atom? x:&:cell -> result:bool [ local-scope - load-ingredients + load-inputs return-unless x, 0/false _, result <- maybe-convert *x, atom:variant ] def is-pair? x:&:cell -> result:bool [ local-scope - load-ingredients + load-inputs return-unless x, 0/false _, result <- maybe-convert *x, pair:variant ] @@ -95,7 +95,7 @@ scenario pair-is-not-atom [ def atom-match? x:&:cell, pat:text -> result:bool [ local-scope - load-ingredients + load-inputs s:text, is-atom?:bool <- maybe-convert *x, atom:variant return-unless is-atom?, 0/false result <- equal pat, s @@ -112,7 +112,7 @@ scenario atom-match [ def first x:&:cell -> result:&:cell [ local-scope - load-ingredients + load-inputs pair:pair, pair?:bool <- maybe-convert *x, pair:variant return-unless pair?, 0/nil result <- get pair, first:offset @@ -120,7 +120,7 @@ def first x:&:cell -> result:&:cell [ def rest x:&:cell -> result:&:cell [ local-scope - load-ingredients + load-inputs pair:pair, pair?:bool <- maybe-convert *x, pair:variant return-unless pair?, 0/nil result <- get pair, rest:offset @@ -128,7 +128,7 @@ def rest x:&:cell -> result:&:cell [ def set-first base:&:cell, new-first:&:cell -> base:&:cell [ local-scope - load-ingredients + load-inputs pair:pair, is-pair?:bool <- maybe-convert *base, pair:variant return-unless is-pair? pair <- put pair, first:offset, new-first @@ -137,7 +137,7 @@ def set-first base:&:cell, new-first:&:cell -> base:&:cell [ def set-rest base:&:cell, new-rest:&:cell -> base:&:cell [ local-scope - load-ingredients + load-inputs pair:pair, is-pair?:bool <- maybe-convert *base, pair:variant return-unless is-pair? pair <- put pair, rest:offset, new-rest @@ -175,7 +175,7 @@ scenario cell-operations-on-pair [ def parse in:text -> out:&:cell [ local-scope - load-ingredients + load-inputs s:&:stream:char <- new-stream in out, s <- parse s trace 2, [app/parse], out @@ -183,7 +183,7 @@ def parse in:text -> out:&:cell [ def parse in:&:stream:char -> out:&:cell, in:&:stream:char [ local-scope - load-ingredients + load-inputs # skip whitespace in <- skip-whitespace in c:char, eof?:bool <- peek in @@ -273,7 +273,7 @@ def parse in:&:stream:char -> out:&:cell, in:&:stream:char [ def skip-whitespace in:&:stream:char -> in:&:stream:char [ local-scope - load-ingredients + load-inputs { done?:bool <- end-of-stream? in return-if done?, 0/null @@ -287,7 +287,7 @@ def skip-whitespace in:&:stream:char -> in:&:stream:char [ def to-text x:&:cell -> out:text [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 30 buf <- to-buffer x, buf out <- buffer-to-array buf @@ -295,7 +295,7 @@ def to-text x:&:cell -> out:text [ def to-buffer x:&:cell, buf:&:buffer:char -> buf:&:buffer:char [ local-scope - load-ingredients + load-inputs # base case: empty cell { break-if x @@ -574,7 +574,7 @@ scenario parse-dotted-list-of-more-than-two-atoms [ def to-mu in:&:cell -> out:text [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 30 buf <- to-mu in, buf out <- buffer-to-array buf @@ -582,7 +582,7 @@ def to-mu in:&:cell -> out:text [ def to-mu in:&:cell, buf:&:buffer:char -> buf:&:buffer:char, result-name:text [ local-scope - load-ingredients + load-inputs # null cell? no change. # pair with all atoms? gensym a new variable # pair containing other pairs? recurse diff --git a/mu.vim b/mu.vim index 83a1f683..9c3106cc 100644 --- a/mu.vim +++ b/mu.vim @@ -53,14 +53,14 @@ syntax match muLiteral %[^ ]\+:type/[^ ,]*\|[^ ]\+:type\>% syntax match muLiteral %[^ ]\+:offset/[^ ,]*\|[^ ]\+:offset\>% syntax match muLiteral %[^ ]\+:variant/[^ ,]*\|[^ ]\+:variant\>% highlight link muLiteral Constant -syntax keyword muKeyword default-space new-default-space local-scope next-ingredient ingredient rewind-ingredients load-ingredients | highlight link muKeyword Constant +syntax keyword muKeyword default-space new-default-space local-scope next-ingredient next-input ingredient input rewind-ingredients rewind-inputs load-ingredients load-inputs | highlight link muKeyword Constant syntax match muDelimiter "[{}]" | highlight link muDelimiter Delimiter syntax match muAssign "<-" syntax match muAssign "\<raw\>" highlight link muAssign SpecialChar syntax match muGlobal %[^ ]\+:global/\?[^ ,]*% | highlight link muGlobal SpecialChar -syntax keyword muControl reply reply-if reply-unless return return-if return-unless jump jump-if jump-unless loop loop-if loop-unless break break-if break-unless current-continuation continue-from create-delimited-continuation reply-delimited-continuation | highlight muControl ctermfg=3 +syntax keyword muControl reply reply-if reply-unless return return-if return-unless output output-if output-unless jump jump-if jump-unless loop loop-if loop-unless break break-if break-unless current-continuation continue-from create-delimited-continuation reply-delimited-continuation | highlight muControl ctermfg=3 " common keywords syntax match muRecipe "^recipe\>\|^recipe!\>\|^def\>\|^def!\>\|^before\>\|^after\>\| -> " | highlight muRecipe ctermfg=208 syntax match muScenario "^scenario\>" | highlight muScenario ctermfg=34 diff --git a/mutable.mu b/mutable.mu index dced29b6..1a1ec7f0 100644 --- a/mutable.mu +++ b/mutable.mu @@ -8,6 +8,6 @@ def main [ def foo x:&:num -> x:&:num [ local-scope - load-ingredients + load-inputs *x <- copy 34 ] diff --git a/nqueens.mu b/nqueens.mu index e566e474..030ba28b 100644 --- a/nqueens.mu +++ b/nqueens.mu @@ -10,7 +10,7 @@ container square [ def nqueens n:num, queens:&:list:square -> result:num, queens:&:list:square [ local-scope - load-ingredients + load-inputs # if 'queens' is already long enough, print it and return added-so-far:num <- length queens { @@ -51,7 +51,7 @@ def nqueens n:num, queens:&:list:square -> result:num, queens:&:list:square [ # only in files and diagonals def conflict? curr:square, queens:&:list:square -> result:bool [ local-scope - load-ingredients + load-inputs result <- conflicting-file? curr, queens return-if result result <- conflicting-diagonal? curr, queens @@ -59,7 +59,7 @@ def conflict? curr:square, queens:&:list:square -> result:bool [ def conflicting-file? curr:square, queens:&:list:square -> result:bool [ local-scope - load-ingredients + load-inputs curr-file:num <- get curr, file:offset { break-unless queens @@ -75,7 +75,7 @@ def conflicting-file? curr:square, queens:&:list:square -> result:bool [ def conflicting-diagonal? curr:square, queens:&:list:square -> result:bool [ local-scope - load-ingredients + load-inputs curr-rank:num <- get curr, rank:offset curr-file:num <- get curr, file:offset { diff --git a/sandbox/001-editor.mu b/sandbox/001-editor.mu index 807cf442..9f1adbe7 100644 --- a/sandbox/001-editor.mu +++ b/sandbox/001-editor.mu @@ -4,7 +4,7 @@ # screen dimensions, then stop def main text:text [ local-scope - load-ingredients + load-inputs open-console clear-screen 0/screen # non-scrolling app e:&:editor <- new-editor text, 0/left, 5/right @@ -50,7 +50,7 @@ container editor [ # right is exclusive def new-editor s:text, left:num, right:num -> result:&:editor [ local-scope - load-ingredients + load-inputs # no clipping of bounds right <- subtract right, 1 result <- new editor:type @@ -71,7 +71,7 @@ def new-editor s:text, left:num, right:num -> result:&:editor [ def insert-text editor:&:editor, text:text -> editor:&:editor [ local-scope - load-ingredients + load-inputs curr:&:duplex-list:char <- get *editor, data:offset insert curr, text ] @@ -106,7 +106,7 @@ scenario editor-initializes-without-data [ # outside text. def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor, 1/top, 0/left left:num <- get *editor, left:offset screen-height:num <- screen-height screen @@ -206,7 +206,7 @@ def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, sc def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs # if it's the real screen, use the optimized primitive { break-if screen @@ -221,7 +221,7 @@ def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num def clear-rest-of-screen screen:&:screen, row:num, left:num, right:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs row <- add row, 1 # if it's the real screen, use the optimized primitive { @@ -395,7 +395,7 @@ after <character-c-received> [ # so far the previous color is all the information we need; that may change def get-color color:num, c:char -> color:num [ local-scope - load-ingredients + load-inputs color-is-white?:bool <- equal color, 7/white # if color is white and next character is '#', switch color to blue { diff --git a/sandbox/002-typing.mu b/sandbox/002-typing.mu index f5bbeb6f..709e8d22 100644 --- a/sandbox/002-typing.mu +++ b/sandbox/002-typing.mu @@ -4,7 +4,7 @@ # hit ctrl-c to exit def! main text:text [ local-scope - load-ingredients + load-inputs open-console clear-screen 0/screen # non-scrolling app editor:&:editor <- new-editor text, 5/left, 45/right @@ -15,7 +15,7 @@ def! main text:text [ def editor-event-loop screen:&:screen, console:&:console, editor:&:editor -> screen:&:screen, console:&:console, editor:&:editor [ local-scope - load-ingredients + load-inputs { # looping over each (keyboard or touch) event as it occurs +next-event @@ -49,7 +49,7 @@ def editor-event-loop screen:&:screen, console:&:console, editor:&:editor -> scr # process click, return if it was on current editor def move-cursor editor:&:editor, screen:&:screen, t:touch-event -> in-focus?:bool, editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor, 0/false click-row:num <- get t, row:offset return-unless click-row, 0/false # ignore clicks on 'menu' @@ -74,7 +74,7 @@ def move-cursor editor:&:editor, screen:&:screen, t:touch-event -> in-focus?:boo # past the last line it positions at end of last line. def snap-cursor editor:&:editor, screen:&:screen, target-row:num, target-column:num -> editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor left:num <- get *editor, left:offset right:num <- get *editor, right:offset @@ -165,7 +165,7 @@ def snap-cursor editor:&:editor, screen:&:screen, target-row:num, target-column: # Set 'go-render?' to true to indicate the caller must perform a non-minimal update. def handle-keyboard-event screen:&:screen, editor:&:editor, e:event -> go-render?:bool, screen:&:screen, editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor, 0/don't-render screen-width:num <- screen-width screen screen-height:num <- screen-height screen @@ -202,7 +202,7 @@ def handle-keyboard-event screen:&:screen, editor:&:editor, e:event -> go-render def insert-at-cursor editor:&:editor, c:char, screen:&:screen -> go-render?:bool, editor:&:editor, screen:&:screen [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset insert c, before-cursor before-cursor <- next before-cursor @@ -264,7 +264,7 @@ def insert-at-cursor editor:&:editor, c:char, screen:&:screen -> go-render?:bool # helper for tests def editor-render screen:&:screen, editor:&:editor -> screen:&:screen, editor:&:editor [ local-scope - load-ingredients + load-inputs old-top-idx:num <- save-top-idx screen left:num <- get *editor, left:offset right:num <- get *editor, right:offset @@ -867,7 +867,7 @@ after <handle-special-character> [ def insert-new-line-and-indent editor:&:editor, screen:&:screen -> editor:&:editor, screen:&:screen [ local-scope - load-ingredients + load-inputs cursor-row:num <- get *editor, cursor-row:offset cursor-column:num <- get *editor, cursor-column:offset before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset @@ -913,7 +913,7 @@ def insert-new-line-and-indent editor:&:editor, screen:&:screen -> editor:&:edit def at-start-of-wrapped-line? editor:&:editor -> result:bool [ local-scope - load-ingredients + load-inputs left:num <- get *editor, left:offset cursor-column:num <- get *editor, cursor-column:offset cursor-at-left?:bool <- equal cursor-column, left @@ -933,7 +933,7 @@ def at-start-of-wrapped-line? editor:&:editor -> result:bool [ # the number of spaces at the start of the line containing 'curr'. def line-indent curr:&:duplex-list:char, start:&:duplex-list:char -> result:num [ local-scope - load-ingredients + load-inputs result:num <- copy 0 return-unless curr at-start?:bool <- equal curr, start @@ -1115,22 +1115,22 @@ after <handle-special-key> [ def draw-horizontal screen:&:screen, row:num, x:num, right:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs height:num <- screen-height screen past-bottom?:bool <- greater-or-equal row, height return-if past-bottom? - style:char, style-found?:bool <- next-ingredient + style:char, style-found?:bool <- next-input { break-if style-found? style <- copy 9472/horizontal } - color:num, color-found?:bool <- next-ingredient + color:num, color-found?:bool <- next-input { # default color to white break-if color-found? color <- copy 245/grey } - bg-color:num, bg-color-found?:bool <- next-ingredient + bg-color:num, bg-color-found?:bool <- next-input { break-if bg-color-found? bg-color <- copy 0/black diff --git a/sandbox/003-shortcuts.mu b/sandbox/003-shortcuts.mu index 919a1870..c152f504 100644 --- a/sandbox/003-shortcuts.mu +++ b/sandbox/003-shortcuts.mu @@ -108,7 +108,7 @@ after <handle-special-character> [ # backspaced-cell - value deleted (or 0 if nothing was deleted) so we can save it for undo, etc. def delete-before-cursor editor:&:editor, screen:&:screen -> go-render?:bool, backspaced-cell:&:duplex-list:char, editor:&:editor, screen:&:screen [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset data:&:duplex-list:char <- get *editor, data:offset # if at start of text (before-cursor at § sentinel), return @@ -154,7 +154,7 @@ def delete-before-cursor editor:&:editor, screen:&:screen -> go-render?:bool, ba def move-cursor-coordinates-left editor:&:editor -> editor:&:editor [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset cursor-row:num <- get *editor, cursor-row:offset cursor-column:num <- get *editor, cursor-column:offset @@ -215,7 +215,7 @@ def move-cursor-coordinates-left editor:&:editor -> editor:&:editor [ # the length of the previous line before the 'curr' pointer. def previous-line-length curr:&:duplex-list:char, start:&:duplex-list:char -> result:num [ local-scope - load-ingredients + load-inputs result:num <- copy 0 return-unless curr at-start?:bool <- equal curr, start @@ -369,7 +369,7 @@ after <handle-special-key> [ def delete-at-cursor editor:&:editor, screen:&:screen -> go-render?:bool, deleted-cell:&:duplex-list:char, editor:&:editor, screen:&:screen [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset data:&:duplex-list:char <- get *editor, data:offset deleted-cell:&:duplex-list:char <- next before-cursor @@ -449,7 +449,7 @@ after <handle-special-key> [ def move-cursor-coordinates-right editor:&:editor, screen-height:num -> go-render?:bool, editor:&:editor [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor before-cursor:offset cursor-row:num <- get *editor, cursor-row:offset cursor-column:num <- get *editor, cursor-column:offset @@ -994,7 +994,7 @@ after <handle-special-key> [ def move-to-previous-line editor:&:editor -> editor:&:editor [ local-scope - load-ingredients + load-inputs cursor-row:num <- get *editor, cursor-row:offset cursor-column:num <- get *editor, cursor-column:offset before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset @@ -1340,7 +1340,7 @@ after <handle-special-key> [ def move-to-next-line editor:&:editor, screen-height:num -> editor:&:editor [ local-scope - load-ingredients + load-inputs cursor-row:num <- get *editor, cursor-row:offset cursor-column:num <- get *editor, cursor-column:offset before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset @@ -1486,7 +1486,7 @@ after <handle-special-key> [ # precondition: cursor-column should be in a consistent state def move-to-start-of-screen-line editor:&:editor -> editor:&:editor [ local-scope - load-ingredients + load-inputs # update cursor column left:num <- get *editor, left:offset col:num <- get *editor, cursor-column:offset @@ -1709,7 +1709,7 @@ after <handle-special-key> [ def move-to-end-of-line editor:&:editor -> editor:&:editor [ local-scope - load-ingredients + load-inputs before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset cursor-column:num <- get *editor, cursor-column:offset right:num <- get *editor, right:offset @@ -1892,7 +1892,7 @@ after <handle-special-character> [ def minimal-render-for-ctrl-u screen:&:screen, editor:&:editor, deleted-cells:&:duplex-list:char -> go-render?:bool, screen:&:screen [ local-scope - load-ingredients + load-inputs curr-column:num <- get *editor, cursor-column:offset # accumulate the current line as text and render it buf:&:buffer:char <- new-buffer 30 # accumulator for the text we need to render @@ -1927,7 +1927,7 @@ def minimal-render-for-ctrl-u screen:&:screen, editor:&:editor, deleted-cells:&: def delete-to-start-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ local-scope - load-ingredients + load-inputs # compute range to delete init:&:duplex-list:char <- get *editor, data:offset before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset @@ -1964,7 +1964,7 @@ def delete-to-start-of-line editor:&:editor -> result:&:duplex-list:char, editor def render-code screen:&:screen, s:text, left:num, right:num, row:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs return-unless s color:num <- copy 7/white column:num <- copy left @@ -2285,7 +2285,7 @@ after <handle-special-character> [ def minimal-render-for-ctrl-k screen:&:screen, editor:&:editor, deleted-cells:&:duplex-list:char -> go-render?:bool, screen:&:screen [ local-scope - load-ingredients + load-inputs # if we deleted nothing, there's nothing to render return-unless deleted-cells, 0/dont-render # if the line used to wrap before, give up and render the whole screen @@ -2303,7 +2303,7 @@ def minimal-render-for-ctrl-k screen:&:screen, editor:&:editor, deleted-cells:&: def delete-to-end-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ local-scope - load-ingredients + load-inputs # compute range to delete start:&:duplex-list:char <- get *editor, before-cursor:offset end:&:duplex-list:char <- next start @@ -2491,7 +2491,7 @@ scenario editor-deletes-to-end-of-wrapped-line-with-ctrl-k [ # beware: never return null pointer. def before-start-of-next-line original:&:duplex-list:char, max:num -> curr:&:duplex-list:char [ local-scope - load-ingredients + load-inputs count:num <- copy 0 curr:&:duplex-list:char <- copy original # skip the initial newline if it exists @@ -2523,7 +2523,7 @@ def before-start-of-next-line original:&:duplex-list:char, max:num -> curr:&:dup # beware: never return null pointer def before-previous-screen-line in:&:duplex-list:char, editor:&:editor -> out:&:duplex-list:char [ local-scope - load-ingredients + load-inputs curr:&:duplex-list:char <- copy in c:char <- get *curr, value:offset # compute max, number of characters to skip @@ -2600,7 +2600,7 @@ after <handle-special-character> [ # the caller to go-render? the entire screen. def render-line-from-start screen:&:screen, editor:&:editor, right-margin:num -> go-render?:bool, screen:&:screen [ local-scope - load-ingredients + load-inputs before-line-start:&:duplex-list:char <- before-start-of-screen-line editor line-start:&:duplex-list:char <- next before-line-start color:num <- copy 7/white @@ -2630,7 +2630,7 @@ def render-line-from-start screen:&:screen, editor:&:editor, right-margin:num -> def before-start-of-screen-line editor:&:editor -> result:&:duplex-list:char [ local-scope - load-ingredients + load-inputs cursor:&:duplex-list:char <- get *editor, before-cursor:offset { next:&:duplex-list:char <- next cursor diff --git a/sandbox/004-programming-environment.mu b/sandbox/004-programming-environment.mu index d79272a8..68d6ef24 100644 --- a/sandbox/004-programming-environment.mu +++ b/sandbox/004-programming-environment.mu @@ -15,7 +15,7 @@ container environment [ def new-programming-environment resources:&:resources, screen:&:screen, test-sandbox-editor-contents:text -> result:&:environment [ local-scope - load-ingredients + load-inputs width:num <- screen-width screen result <- new environment:type # sandbox editor @@ -26,7 +26,7 @@ def new-programming-environment resources:&:resources, screen:&:screen, test-san def event-loop screen:&:screen, console:&:console, env:&:environment, resources:&:resources -> screen:&:screen, console:&:console, env:&:environment, resources:&:resources [ local-scope - load-ingredients + load-inputs current-sandbox:&:editor <- get *env, current-sandbox:offset # if we fall behind we'll stop updating the screen, but then we have to # render the entire screen when we catch up. @@ -97,7 +97,7 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources: def resize screen:&:screen, env:&:environment -> env:&:environment, screen:&:screen [ local-scope - load-ingredients + load-inputs clear-screen screen # update screen dimensions width:num <- screen-width screen # update sandbox editor @@ -114,7 +114,7 @@ def resize screen:&:screen, env:&:environment -> env:&:environment, screen:&:scr # off-screen, it resets cursor-row and cursor-column. def render-without-moving-cursor screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor, 1/top, 0/left left:num <- get *editor, left:offset screen-height:num <- screen-height screen @@ -195,7 +195,7 @@ type render-recipe = (recipe (address screen) (address editor) -> number number def render-all screen:&:screen, env:&:environment, render-editor:render-recipe -> screen:&:screen, env:&:environment [ local-scope - load-ingredients + load-inputs trace 10, [app], [render all] # top menu trace 11, [app], [render top menu] @@ -217,7 +217,7 @@ def render-all screen:&:screen, env:&:environment, render-editor:render-recipe - # replaced in a later layer def render-sandbox-side screen:&:screen, env:&:environment, render-editor:render-recipe -> screen:&:screen, env:&:environment [ local-scope - load-ingredients + load-inputs trace 11, [app], [render sandboxes] old-top-idx:num <- save-top-idx screen current-sandbox:&:editor <- get *env, current-sandbox:offset @@ -236,7 +236,7 @@ def render-sandbox-side screen:&:screen, env:&:environment, render-editor:render def update-cursor screen:&:screen, current-sandbox:&:editor, env:&:environment -> screen:&:screen [ local-scope - load-ingredients + load-inputs <update-cursor-special-cases> cursor-row:num <- get *current-sandbox, cursor-row:offset cursor-column:num <- get *current-sandbox, cursor-column:offset diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu index ee58638b..89ebf3ca 100644 --- a/sandbox/005-sandbox.mu +++ b/sandbox/005-sandbox.mu @@ -136,7 +136,7 @@ after <global-keypress> [ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> errors-found?:bool, env:&:environment, resources:&:resources, screen:&:screen [ local-scope - load-ingredients + load-inputs errors-found?:bool <- update-recipes env, resources, screen # check contents of editor <begin-run-sandboxes> @@ -185,7 +185,7 @@ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> e # replaced in a later layer (whereupon errors-found? will actually be set) def update-recipes env:&:environment, resources:&:resources, screen:&:screen -> errors-found?:bool, env:&:environment, screen:&:screen [ local-scope - load-ingredients + load-inputs in:text <- slurp resources, [lesson/recipes.mu] reload in errors-found? <- copy 0/false @@ -194,7 +194,7 @@ def update-recipes env:&:environment, resources:&:resources, screen:&:screen -> # replaced in a later layer def update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sandbox, env:&:environment [ local-scope - load-ingredients + load-inputs data:text <- get *sandbox, data:offset response:text, _, fake-screen:&:screen <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response @@ -203,14 +203,14 @@ def update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sa def update-status screen:&:screen, msg:text, color:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs screen <- move-cursor screen, 0, 2 screen <- print screen, msg, color, 238/grey/background ] def save-sandboxes env:&:environment, resources:&:resources -> resources:&:resources [ local-scope - load-ingredients + load-inputs trace 11, [app], [save sandboxes] current-sandbox:&:editor <- get *env, current-sandbox:offset # first clear previous versions, in case we deleted some sandbox @@ -228,7 +228,7 @@ def save-sandboxes env:&:environment, resources:&:resources -> resources:&:resou def save-sandbox resources:&:resources, sandbox:&:sandbox, sandbox-index:num -> resources:&:resources [ local-scope - load-ingredients + load-inputs data:text <- get *sandbox, data:offset filename:text <- append [lesson/], sandbox-index resources <- dump resources, filename, data @@ -237,7 +237,7 @@ def save-sandbox resources:&:resources, sandbox:&:sandbox, sandbox-index:num -> def! render-sandbox-side screen:&:screen, env:&:environment, render-editor:render-recipe -> screen:&:screen, env:&:environment [ local-scope - load-ingredients + load-inputs trace 11, [app], [render sandbox side] old-top-idx:num <- save-top-idx screen current-sandbox:&:editor <- get *env, current-sandbox:offset @@ -264,8 +264,8 @@ def! render-sandbox-side screen:&:screen, env:&:environment, render-editor:rende def render-sandboxes screen:&:screen, sandbox:&:sandbox, left:num, right:num, row:num, render-from:num, idx:num -> row:num, screen:&:screen, sandbox:&:sandbox [ local-scope - load-ingredients - env:&:environment, _/optional <- next-ingredient + load-inputs + env:&:environment, _/optional <- next-input return-unless sandbox screen-height:num <- screen-height screen hidden?:bool <- lesser-than idx, render-from @@ -320,7 +320,7 @@ def render-sandboxes screen:&:screen, sandbox:&:sandbox, left:num, right:num, ro def render-sandbox-menu screen:&:screen, sandbox-index:num, left:num, right:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs move-cursor-to-column screen, left edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, delete-button-left:num <- sandbox-menu-columns left, right print screen, sandbox-index, 232/dark-grey, 245/grey @@ -363,7 +363,7 @@ scenario skip-rendering-sandbox-menu-past-bottom-row [ # all left/right pairs are inclusive def sandbox-menu-columns left:num, right:num -> edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, delete-button-left:num [ local-scope - load-ingredients + load-inputs start-buttons:num <- add left, 4/space-for-sandbox-index buttons-space:num <- subtract right, start-buttons button-width:num <- divide-with-remainder buttons-space, 3 # integer division @@ -380,7 +380,7 @@ def sandbox-menu-columns left:num, right:num -> edit-button-left:num, edit-butto # clear rest of last line, move cursor to next line def render-text screen:&:screen, s:text, left:num, right:num, color:num, row:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs return-unless s column:num <- copy left screen <- move-cursor screen, row, column @@ -457,7 +457,7 @@ scenario render-text-wraps-barely-long-lines [ # assumes programming environment has no sandboxes; restores them from previous session def restore-sandboxes env:&:environment, resources:&:resources -> env:&:environment [ local-scope - load-ingredients + load-inputs # read all scenarios, pushing them to end of a list of scenarios idx:num <- copy 0 curr:&:sandbox <- copy 0 @@ -491,7 +491,7 @@ def restore-sandboxes env:&:environment, resources:&:resources -> env:&:environm # leave cursor at start of next line def render-screen screen:&:screen, sandbox-screen:&:screen, left:num, right:num, row:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs return-unless sandbox-screen # print 'screen:' row <- render-text screen, [screen:], left, right, 245/grey, row @@ -664,7 +664,7 @@ scenario run-instruction-manages-screen-per-sandbox [ def editor-contents editor:&:editor -> result:text [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 80 curr:&:duplex-list:char <- get *editor, data:offset # skip § sentinel @@ -822,7 +822,7 @@ after <global-keypress> [ # return 0 if there's no such sandbox, either because 'in' doesn't exist in 'env', or because it's the first sandbox def previous-sandbox env:&:environment, in:&:sandbox -> out:&:sandbox [ local-scope - load-ingredients + load-inputs curr:&:sandbox <- get *env, sandbox:offset return-unless curr, 0/nil next:&:sandbox <- get *curr, next-sandbox:offset diff --git a/sandbox/006-sandbox-copy.mu b/sandbox/006-sandbox-copy.mu index 33e31cc9..541618e6 100644 --- a/sandbox/006-sandbox-copy.mu +++ b/sandbox/006-sandbox-copy.mu @@ -151,7 +151,7 @@ after <global-touch> [ # some preconditions for attempting to copy a sandbox def should-attempt-copy? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, env return-unless click-sandbox-area?, 0/false @@ -170,7 +170,7 @@ def should-attempt-copy? click-row:num, click-column:num, env:&:environment -> r def try-copy-sandbox click-row:num, env:&:environment -> clicked-on-copy-button?:bool, env:&:environment [ local-scope - load-ingredients + load-inputs # identify the sandbox to copy, if the click was actually on the 'copy' button sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, 0/false @@ -184,7 +184,7 @@ def try-copy-sandbox click-row:num, env:&:environment -> clicked-on-copy-button? def find-sandbox env:&:environment, click-row:num -> result:&:sandbox [ local-scope - load-ingredients + load-inputs curr-sandbox:&:sandbox <- get *env, sandbox:offset { break-unless curr-sandbox @@ -199,7 +199,7 @@ def find-sandbox env:&:environment, click-row:num -> result:&:sandbox [ def click-on-sandbox-area? click-row:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs first-sandbox:&:sandbox <- get *env, sandbox:offset return-unless first-sandbox, 0/false first-sandbox-begins:num <- get *first-sandbox, starting-row-on-screen:offset @@ -208,7 +208,7 @@ def click-on-sandbox-area? click-row:num, env:&:environment -> result:bool [ def empty-editor? editor:&:editor -> result:bool [ local-scope - load-ingredients + load-inputs head:&:duplex-list:char <- get *editor, data:offset first:&:duplex-list:char <- next head result <- not first @@ -216,7 +216,7 @@ def empty-editor? editor:&:editor -> result:bool [ def within-range? x:num, low:num, high:num -> result:bool [ local-scope - load-ingredients + load-inputs not-too-far-left?:bool <- greater-or-equal x, low not-too-far-right?:bool <- lesser-or-equal x, high result <- and not-too-far-left? not-too-far-right? diff --git a/sandbox/007-sandbox-delete.mu b/sandbox/007-sandbox-delete.mu index 955eac8f..2e8ab759 100644 --- a/sandbox/007-sandbox-delete.mu +++ b/sandbox/007-sandbox-delete.mu @@ -79,7 +79,7 @@ after <global-touch> [ # some preconditions for attempting to delete a sandbox def should-attempt-delete? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, env return-unless click-sandbox-area?, 0/false @@ -94,7 +94,7 @@ def should-attempt-delete? click-row:num, click-column:num, env:&:environment -> def try-delete-sandbox click-row:num, env:&:environment -> clicked-on-delete-button?:bool, env:&:environment [ local-scope - load-ingredients + load-inputs # identify the sandbox to delete, if the click was actually on the 'delete' button sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, 0/false @@ -104,7 +104,7 @@ def try-delete-sandbox click-row:num, env:&:environment -> clicked-on-delete-but def delete-sandbox env:&:environment, sandbox:&:sandbox -> env:&:environment [ local-scope - load-ingredients + load-inputs curr-sandbox:&:sandbox <- get *env, sandbox:offset first-sandbox?:bool <- equal curr-sandbox, sandbox { diff --git a/sandbox/008-sandbox-edit.mu b/sandbox/008-sandbox-edit.mu index aef61619..3cef65ce 100644 --- a/sandbox/008-sandbox-edit.mu +++ b/sandbox/008-sandbox-edit.mu @@ -122,7 +122,7 @@ after <global-touch> [ # some preconditions for attempting to edit a sandbox def should-attempt-edit? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, env return-unless click-sandbox-area?, 0/false @@ -141,7 +141,7 @@ def should-attempt-edit? click-row:num, click-column:num, env:&:environment -> r def try-edit-sandbox click-row:num, env:&:environment -> clicked-on-edit-button?:bool, env:&:environment [ local-scope - load-ingredients + load-inputs # identify the sandbox to edit, if the click was actually on the 'edit' button sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, 0/false diff --git a/sandbox/009-sandbox-test.mu b/sandbox/009-sandbox-test.mu index 2bd3aac9..3fd4dafc 100644 --- a/sandbox/009-sandbox-test.mu +++ b/sandbox/009-sandbox-test.mu @@ -153,7 +153,7 @@ after <global-touch> [ def find-click-in-sandbox-output env:&:environment, click-row:num -> sandbox:&:sandbox, sandbox-index:num [ local-scope - load-ingredients + load-inputs # assert click-row >= sandbox.starting-row-on-screen sandbox:&:sandbox <- get *env, sandbox:offset start:num <- get *sandbox, starting-row-on-screen:offset @@ -181,7 +181,7 @@ def find-click-in-sandbox-output env:&:environment, click-row:num -> sandbox:&:s def toggle-expected-response sandbox:&:sandbox -> sandbox:&:sandbox [ local-scope - load-ingredients + load-inputs expected-response:text <- get *sandbox, expected-response:offset { # if expected-response is set, reset @@ -208,7 +208,7 @@ after <render-sandbox-response> [ def render-sandbox-response screen:&:screen, sandbox:&:sandbox, left:num, right:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs sandbox-response:text <- get *sandbox, response:offset expected-response:text <- get *sandbox, expected-response:offset row:num <- get *sandbox response-starting-row-on-screen:offset diff --git a/sandbox/010-sandbox-trace.mu b/sandbox/010-sandbox-trace.mu index 2c4e40cc..6d775322 100644 --- a/sandbox/010-sandbox-trace.mu +++ b/sandbox/010-sandbox-trace.mu @@ -164,7 +164,7 @@ container sandbox [ # replaced in a later layer def! update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sandbox, env:&:environment [ local-scope - load-ingredients + load-inputs data:text <- get *sandbox, data:offset response:text, _, fake-screen:&:screen, trace:text <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response @@ -201,7 +201,7 @@ after <global-touch> [ def find-click-in-sandbox-code env:&:environment, click-row:num -> sandbox:&:sandbox [ local-scope - load-ingredients + load-inputs # assert click-row >= sandbox.starting-row-on-screen sandbox <- get *env, sandbox:offset start:num <- get *sandbox, starting-row-on-screen:offset diff --git a/sandbox/011-errors.mu b/sandbox/011-errors.mu index 05f6a0af..893515bf 100644 --- a/sandbox/011-errors.mu +++ b/sandbox/011-errors.mu @@ -7,7 +7,7 @@ container environment [ # load code from disk, save any errors def! update-recipes env:&:environment, resources:&:resources, screen:&:screen -> errors-found?:bool, env:&:environment, screen:&:screen [ local-scope - load-ingredients + load-inputs in:text <- slurp resources, [lesson/recipes.mu] recipe-errors:text <- reload in *env <- put *env, recipe-errors:offset, recipe-errors @@ -69,7 +69,7 @@ container sandbox [ def! update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sandbox, env:&:environment [ local-scope - load-ingredients + load-inputs { recipe-errors:text <- get *env, recipe-errors:offset break-unless recipe-errors diff --git a/sandbox/012-editor-undo.mu b/sandbox/012-editor-undo.mu index 20d53f5c..e5782f0c 100644 --- a/sandbox/012-editor-undo.mu +++ b/sandbox/012-editor-undo.mu @@ -199,7 +199,7 @@ before <end-insert-enter> [ # moving the cursor can lose work on the undo stack. def add-operation editor:&:editor, op:&:operation -> editor:&:editor [ local-scope - load-ingredients + load-inputs undo:&:list:&:operation <- get *editor, undo:offset undo <- push op undo *editor <- put *editor, undo:offset, undo diff --git a/static-dispatch.mu b/static-dispatch.mu index ccb3de6a..a0157d13 100644 --- a/static-dispatch.mu +++ b/static-dispatch.mu @@ -8,22 +8,22 @@ def test a:num -> b:num [ local-scope - load-ingredients + load-inputs b <- add a, 1 ] def test a:num, b:num -> c:num [ local-scope - load-ingredients + load-inputs c <- add a, b ] def main [ local-scope - a:num <- test 3 # selects single-ingredient version + a:num <- test 3 # selects single-input version $print a, 10/newline - b:num <- test 3, 4 # selects double-ingredient version + b:num <- test 3, 4 # selects double-input version $print b, 10/newline - c:num <- test 3, 4, 5 # prefers double- to single-ingredient version + c:num <- test 3, 4, 5 # prefers double- to single-input version $print c, 10/newline ] diff --git a/tangle.mu b/tangle.mu index e8388a72..91f12dea 100644 --- a/tangle.mu +++ b/tangle.mu @@ -8,7 +8,7 @@ def factorial n:num -> result:num [ local-scope - load-ingredients + load-inputs <factorial-cases> ] |