From 4938a720b31ebaf49a33b4c3ba1d7b772b7c6592 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 23 Jun 2015 11:51:17 -0700 Subject: 1628 --- 075scenario_console.cc | 74 +++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/075scenario_console.cc b/075scenario_console.cc index 214b7621..f776f6b2 100644 --- a/075scenario_console.cc +++ b/075scenario_console.cc @@ -107,43 +107,6 @@ case ASSUME_CONSOLE: { break; } -:(code) -long long int count_events(const recipe& r) { - long long int result = 0; - for (long long int i = 0; i < SIZE(r.steps); ++i) { - const instruction& curr = r.steps.at(i); -//? cerr << "aa: " << curr.name << '\n'; //? 3 -//? cerr << "bb: " << curr.ingredients.at(0).name << '\n'; //? 1 - if (curr.name == "type") - result += unicode_length(curr.ingredients.at(0).name); - else - result++; -//? cerr << "cc: " << result << '\n'; //? 1 - } - return result; -} - -long long int size_of_event() { - // memoize result if already computed - static long long int result = 0; - if (result) return result; - vector type; - type.push_back(Type_number["event"]); - result = size_of(type); - return result; -} - -long long int size_of_events() { - // memoize result if already computed - static long long int result = 0; - if (result) return result; - vector type; - assert(Type_number["console"]); - type.push_back(Type_number["console"]); - result = size_of(type); - return result; -} - :(scenario events_in_scenario) scenario events-in-scenario [ assume-console [ @@ -193,3 +156,40 @@ scenario events-in-scenario [ 25 <- 0 ] ] + +:(code) +long long int count_events(const recipe& r) { + long long int result = 0; + for (long long int i = 0; i < SIZE(r.steps); ++i) { + const instruction& curr = r.steps.at(i); +//? cerr << "aa: " << curr.name << '\n'; //? 3 +//? cerr << "bb: " << curr.ingredients.at(0).name << '\n'; //? 1 + if (curr.name == "type") + result += unicode_length(curr.ingredients.at(0).name); + else + result++; +//? cerr << "cc: " << result << '\n'; //? 1 + } + return result; +} + +long long int size_of_event() { + // memoize result if already computed + static long long int result = 0; + if (result) return result; + vector type; + type.push_back(Type_number["event"]); + result = size_of(type); + return result; +} + +long long int size_of_events() { + // memoize result if already computed + static long long int result = 0; + if (result) return result; + vector type; + assert(Type_number["console"]); + type.push_back(Type_number["console"]); + result = size_of(type); + return result; +} -- cgit 1.4.1-2-gfad0