From 20a7d37f74625962c946f027074031d7cd2cbbcb Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 13 Nov 2016 09:37:50 -0800 Subject: 3673 --- html/038new_text.cc.html | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'html/038new_text.cc.html') diff --git a/html/038new_text.cc.html b/html/038new_text.cc.html index 0cd1e165..f86c1683 100644 --- a/html/038new_text.cc.html +++ b/html/038new_text.cc.html @@ -16,6 +16,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color .Constant { color: #00a0a0; } .CommentedCode { color: #6c6c6c; } .muRecipe { color: #ff8700; } +.SalientComment { color: #00ffff; } .Comment { color: #9090ff; } .Delimiter { color: #800080; } .Special { color: #c00000; } @@ -106,12 +107,17 @@ put(Type_abbreviations,+app: foo: abc -:(before "End print Special-cases(r, data)") +:(before "End inspect Special-cases(r, data)") if (is_mu_text(r)) { assert(scalar(data)); return read_mu_text(data.at(0)); } +:(before "End $print Special-cases") +else if (is_mu_text(current_instruction().ingredients.at(i))) { + cout << read_mu_text(ingredients.at(i).at(0)); +} + :(scenario unicode_string) def main [ 1:text <- new [♠] @@ -172,6 +178,36 @@ string read_mu_text(int} return tmp.str(); } + +//:: 'cheating' by using the host system + +:(before "End Primitive Recipe Declarations") +_READ, +:(before "End Primitive Recipe Numbers") +put(Recipe_ordinal, "$read", _READ); +:(before "End Primitive Recipe Checks") +case _READ: { + break; +} +:(before "End Primitive Recipe Implementations") +case _READ: { + skip_whitespace(cin); + string result; + if (has_data(cin)) + cin >> result; + products.resize(1); + products.at(0).push_back(new_mu_text(result)); + break; +} + +:(code) +void skip_whitespace(istream& in) { + while (true) { + if (!has_data(in)) break; + if (isspace(in.peek())) in.get(); + else break; + } +} -- cgit 1.4.1-2-gfad0