From dbe124108b7a3529feeeba91339928c4ac737072 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 23 Jun 2015 14:02:12 -0700 Subject: 1631 - update html versions Html is a little more readable thanks to feedback from J David Eisenberg (https://news.ycombinator.com/item?id=9766330), in particular the suggestion to use https://addons.mozilla.org/En-us/firefox/addon/wcag-contrast-checker. --- html/030container.cc.html | 49 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) (limited to 'html/030container.cc.html') diff --git a/html/030container.cc.html b/html/030container.cc.html index 851c5357..4531e5da 100644 --- a/html/030container.cc.html +++ b/html/030container.cc.html @@ -12,17 +12,17 @@ @@ -143,8 +143,9 @@ case GET: { reagent base = current_instruction().ingredients.at(0); long long int base_address = base.value; type_number base_type = base.types.at(0); - assert(Type[base_type].kind == container); - assert(isa_literal(current_instruction().ingredients.at(1))); + if (Type[base_type].kind != container) + raise << "'get' on a non-container in " << current_recipe_name () << ": " << current_instruction().to_string() << '\n' << die(); + assert(is_literal(current_instruction().ingredients.at(1))); assert(scalar(ingredients.at(1))); long long int offset = ingredients.at(1).at(0); long long int src = base_address; @@ -155,7 +156,7 @@ case GET: { assert(Type[base_type].kind == container); assert(SIZE(Type[base_type].elements) > offset); type_number src_type = Type[base_type].elements.at(offset).at(0); - trace(Primitive_recipe_depth, "run") << "its type is " << src_type; + trace(Primitive_recipe_depth, "run") << "its type is " << Type[src_type].name; reagent tmp; tmp.set_value(src); tmp.types.push_back(src_type); @@ -191,8 +192,9 @@ case GET_ADDRESS: { reagent base = current_instruction().ingredients.at(0); long long int base_address = base.value; type_number base_type = base.types.at(0); - assert(Type[base_type].kind == container); - assert(isa_literal(current_instruction().ingredients.at(1))); + if (Type[base_type].kind != container) + raise << "'get' on a non-container in " << current_recipe_name () << ": " << current_instruction().to_string() << '\n' << die(); + assert(is_literal(current_instruction().ingredients.at(1))); assert(scalar(ingredients.at(1))); long long int offset = ingredients.at(1).at(0); long long int result = base_address; @@ -405,6 +407,33 @@ void check_container_field_types() } } +//:: Construct types out of their constituent fields. Doesn't currently do +//:: type-checking but *does* match sizes. +:(before "End Primitive Recipe Declarations") +MERGE, +:(before "End Primitive Recipe Numbers") +Recipe_number["merge"] = MERGE; +:(before "End Primitive Recipe Implementations") +case MERGE: { + products.resize(1); + for (long long int i = 0; i < SIZE(ingredients); ++i) + for (long long int j = 0; j < SIZE(ingredients.at(i)); ++j) + products.at(0).push_back(ingredients.at(i).at(j)); + break; +} + +:(scenario merge) +container foo [ + x:number + y:number +] + +recipe main [ + 1:foo <- merge 3:literal, 4:literal +] ++mem: storing 3 in location 1 ++mem: storing 4 in location 2 + //:: helpers :(code) -- cgit 1.4.1-2-gfad0