about summary refs log tree commit diff stats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* snapshot of project "lynx", label v2-8-5dev_7Thomas E. Dickey2002-01-061-2/+3
|
* snapshot of project "lynx", label v2-8-5dev_6Thomas E. Dickey2002-01-0226-2598/+2015
|
* snapshot of project "lynx", label v2-8-5dev_5Thomas E. Dickey2001-11-1914-536/+921
|
* snapshot of project "lynx", label v2-8-5dev_4Thomas E. Dickey2001-11-0822-773/+672
|
* snapshot of project "lynx", label v2-8-5dev_3Thomas E. Dickey2001-10-0615-220/+392
|
* snapshot of project "lynx", label v2-8-5dev_2Thomas E. Dickey2001-08-1515-156/+108
|
* snapshot of project "lynx", label v2-8-5dev_1Thomas E. Dickey2001-07-255-8/+48
|
* snapshot of project "lynx", label v2-8-4rel_1Thomas E. Dickey2001-07-171-1/+1
|
* snapshot of project "lynx", label v2-8-4pre_5Thomas E. Dickey2001-07-152-19/+24
|
* snapshot of project "lynx", label v2-8-4pre_4Thomas E. Dickey2001-07-102-7/+7
|
* snapshot of project "lynx", label v2-8-4pre_3Thomas E. Dickey2001-07-0815-160/+300
|
* snapshot of project "lynx", label v2-8-4pre_2Thomas E. Dickey2001-06-118-25/+17
|
* snapshot of project "lynx", label v2-8-4dev_21Thomas E. Dickey2001-06-0358-5124/+3630
|
* snapshot of project "lynx", label v2-8-4dev_20Thomas E. Dickey2001-04-0242-1739/+1452
|
* snapshot of project "lynx", label v2-8-4dev_19Thomas E. Dickey2001-02-2731-793/+1849
|
* snapshot of project "lynx", label v2-8-4dev_18Thomas E. Dickey2001-02-1323-184/+271
|
* snapshot of project "lynx", label v2-8-4dev_17Thomas E. Dickey2001-02-0939-1501/+2198
|
* snapshot of project "lynx", label v2-8-4dev_16Thomas E. Dickey2001-01-022-1/+47
|
* snapshot of project "lynx", label v2-8-4dev_15Thomas E. Dickey2000-12-2222-84/+93
|
* snapshot of project "lynx", label v2-8-4dev_14Thomas E. Dickey2000-11-037-14/+55
|
* snapshot of project "lynx", label v2-8-4dev_13Thomas E. Dickey2000-10-261-0/+2
|
* snapshot of project "lynx", label v2-8-4dev_12Thomas E. Dickey2000-10-2534-656/+750
|
* snapshot of project "lynx", label v2-8-4dev_11Thomas E. Dickey2000-10-194-19/+27
|
* snapshot of project "lynx", label v2-8-4dev_10Thomas E. Dickey2000-09-2214-1225/+885
|
* snapshot of project "lynx", label v2-8-4dev_9Thomas E. Dickey2000-09-012-10/+22
|
* snapshot of project "lynx", label v2-8-4dev_8Thomas E. Dickey2000-08-2524-269/+413
|
* snapshot of project "lynx", label v2-8-4dev_7Thomas E. Dickey2000-08-038-2083/+1150
|
* snapshot of project "lynx", label v2-8-4dev_6Thomas E. Dickey2000-07-183-4/+4
|
* snapshot of project "lynx", label v2-8-4dev_5Thomas E. Dickey2000-07-1720-725/+1217
|
* snapshot of project "lynx", label v2-8-4dev_4Thomas E. Dickey2000-06-2330-258/+813
|
* snapshot of project "lynx", label v2-8-4dev_3Thomas E. Dickey2000-06-0313-145/+191
|
* snapshot of project "lynx", label v2-8-4dev_2Thomas E. Dickey2000-05-226-473/+334
|
* snapshot of project "lynx", label v2-8-4dev_1Thomas E. Dickey2000-05-055-9/+12
|
* snapshot of project "lynx", label v2-8-3rel_1Thomas E. Dickey2000-04-243-9/+42
|
* snapshot of project "lynx", label v2-8-3pre_8Thomas E. Dickey2000-04-231-43/+43
|
* snapshot of project "lynx", label v2-8-3pre_7Thomas E. Dickey2000-04-208-234/+286
|
* snapshot of project "lynx", label v2-8-3pre_6Thomas E. Dickey2000-04-176-38/+34
|
* snapshot of project "lynx", label v2-8-3pre_5Thomas E. Dickey2000-04-146-7/+8
|
* snapshot of project "lynx", label v2-8-3pre_4Thomas E. Dickey2000-04-111-1/+1
|
* snapshot of project "lynx", label v2-8-3pre_3Thomas E. Dickey2000-04-079-51/+116
|
* snapshot of project "lynx", label v2-8-3pre_2Thomas E. Dickey2000-04-036-26/+44
|
* snapshot of project "lynx", label v2-8-3pre_1Thomas E. Dickey2000-04-0114-121/+132
|
* snapshot of project "lynx", label v2-8-3dev_23Thomas E. Dickey2000-03-2745-713/+692
|
* snapshot of project "lynx", label v2-8-3dev_22Thomas E. Dickey2000-03-1328-443/+429
|
* snapshot of project "lynx", label v2-8-3dev_21Thomas E. Dickey2000-02-2516-170/+200
|
* snapshot of project "lynx", label v2-8-3dev_20Thomas E. Dickey2000-02-154-9/+110
|
* snapshot of project "lynx", label v2-8-3dev_19Thomas E. Dickey2000-02-1536-689/+901
|
* snapshot of project "lynx", label v2-8-3dev_18Thomas E. Dickey2000-01-0715-244/+418
|
* snapshot of project "lynx", label v2-8-3dev_17Thomas E. Dickey1999-12-1534-478/+973
|
* snapshot of project "lynx", label v2-8-3dev_16Thomas E. Dickey1999-12-0145-919/+1896
|
merge_check_recursive_containers_2) % Hide_errors = true; def main [ 1:point <- merge 3, 4 2:point-number <- merge 1:point ] +error: main: too few ingredients in '2:point-number <- merge 1:point' :(scenario merge_check_recursive_containers_3) def main [ 1:point-number <- merge 3, 4, 5 ] $error: 0 :(scenario merge_check_recursive_containers_4) % Hide_errors = true; def main [ 1:point-number <- merge 3, 4 ] +error: main: too few ingredients in '1:point-number <- merge 3, 4' :(scenario merge_check_reflexive) % Hide_errors = true; def main [ 1:point <- merge 3, 4 2:point <- merge 1:point ] $error: 0 //: Since a container can be merged in several ways, we need to be able to //: backtrack through different possibilities. Later we'll allow creating //: exclusive containers which contain just one of rather than all of their //: elements. That will also require backtracking capabilities. Here's the //: state we need to maintain for backtracking: :(before "End Types") struct merge_check_point { reagent container; int container_element_index; merge_check_point(const reagent& c, int i) :container(c), container_element_index(i) {} }; struct merge_check_state { stack<merge_check_point> data; }; :(before "End Checks") Transform.push_back(check_merge_calls); :(code) void check_merge_calls(const recipe_ordinal r) { const recipe& caller = get(Recipe, r); trace(9991, "transform") << "--- type-check merge instructions in recipe " << caller.name << end(); for (int i = 0; i < SIZE(caller.steps); ++i) { const instruction& inst = caller.steps.at(i); if (inst.name != "merge") continue; if (SIZE(inst.products) != 1) { raise << maybe(caller.name) << "'merge' should yield a single product in '" << to_original_string(inst) << "'\n" << end(); continue; } reagent/*copy*/ product = inst.products.at(0); // Update product While Type-checking Merge type_ordinal product_type = product.type->value; if (product_type == 0 || !contains_key(Type, product_type)) { raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end(); continue; } const type_info& info = get(Type, product_type); if (info.kind != CONTAINER && info.kind != EXCLUSIVE_CONTAINER) { raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end(); continue; } check_merge_call(inst.ingredients, product, caller, inst); } } void check_merge_call(const vector<reagent>& ingredients, const reagent& product, const recipe& caller, const instruction& inst) { int ingredient_index = 0; merge_check_state state; state.data.push(merge_check_point(product, 0)); while (true) { assert(!state.data.empty()); trace(9999, "transform") << ingredient_index << " vs " << SIZE(ingredients) << end(); if (ingredient_index >= SIZE(ingredients)) { raise << maybe(caller.name) << "too few ingredients in '" << to_original_string(inst) << "'\n" << end(); return; } reagent& container = state.data.top().container; type_info& container_info = get(Type, container.type->value); switch (container_info.kind) { case CONTAINER: { // degenerate case: merge with the same type always succeeds if (state.data.top().container_element_index == 0 && types_coercible(container, inst.ingredients.at(ingredient_index))) return; const reagent& expected_ingredient = element_type(container.type, state.data.top().container_element_index); trace(9999, "transform") << "checking container " << to_string(container) << " || " << to_string(expected_ingredient) << " vs ingredient " << ingredient_index << end(); // if the current element is the ingredient we expect, move on to the next element/ingredient if (types_coercible(expected_ingredient, ingredients.at(ingredient_index))) { ++ingredient_index; ++state.data.top().container_element_index; while (state.data.top().container_element_index >= SIZE(get(Type, state.data.top().container.type->value).elements)) { state.data.pop(); if (state.data.empty()) { if (ingredient_index < SIZE(ingredients)) raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end(); return; } ++state.data.top().container_element_index; } } // if not, maybe it's a field of the current element else { // no change to ingredient_index state.data.push(merge_check_point(expected_ingredient, 0)); } break; } // End valid_merge Cases default: { if (!types_coercible(container, ingredients.at(ingredient_index))) { raise << maybe(caller.name) << "incorrect type of ingredient " << ingredient_index << " in '" << to_original_string(inst) << "'\n" << end(); raise << " (expected " << debug_string(container) << ")\n" << end(); raise << " (got " << debug_string(ingredients.at(ingredient_index)) << ")\n" << end(); return; } ++ingredient_index; // ++state.data.top().container_element_index; // unnecessary, but wouldn't do any harm do { state.data.pop(); if (state.data.empty()) { if (ingredient_index < SIZE(ingredients)) raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end(); return; } ++state.data.top().container_element_index; } while (state.data.top().container_element_index >= SIZE(get(Type, state.data.top().container.type->value).elements)); } } } // never gets here assert(false); } :(scenario merge_check_product) % Hide_errors = true; def main [ 1:number <- merge 3 ] +error: main: 'merge' should yield a container in '1:number <- merge 3' :(before "End Includes") #include <stack> using std::stack;