about summary refs log tree commit diff stats
path: root/sandbox
Commit message (Expand)AuthorAgeFilesLines
...
* 3857Kartik K. Agaram2017-05-131-12/+0
* 3856Kartik K. Agaram2017-05-131-0/+1
* 3854Kartik K. Agaram2017-05-139-39/+39
* 3853Kartik K. Agaram2017-05-121-2/+13
* 3852Kartik K. Agaram2017-05-123-2/+35
* 3844Kartik K. Agaram2017-05-061-43/+4
* 3843Kartik K. Agaram2017-05-062-7/+10
* 3831Kartik K. Agaram2017-04-181-1/+1
* 3825Kartik K. Agaram2017-04-161-0/+6
* 3824 - experiment: stop buffering in termboxKartik K. Agaram2017-04-168-35/+0
* 3806Kartik K. Agaram2017-03-211-9/+4
* 3797Kartik K. Agaram2017-03-152-2/+0
* 3796Kartik K. Agaram2017-03-141-26/+30
* 3795Kartik K. Agaram2017-03-142-5/+5
* 3794Kartik K. Agaram2017-03-141-2/+2
* 3793Kartik K. Agaram2017-03-142-63/+63
* 3790Kartik K. Agaram2017-03-121-1/+4
* 3789Kartik K. Agaram2017-03-121-0/+1
* 3748Kartik K. Agaram2017-02-281-1/+1
* 3733Kartik K. Agaram2017-01-111-1/+1
* 3731Kartik K. Agaram2017-01-111-1/+2
* 3706Kartik K. Agaram2016-12-111-2/+2
* 3705 - switch to tested file-system primitivesKartik K. Agaram2016-12-118-256/+393
* 3700Kartik K. Agaram2016-11-284-89/+51
* 3699Kartik K. Agaram2016-11-284-13/+10
* 3698Kartik K. Agaram2016-11-276-142/+148
* 3656Kartik K. Agaram2016-11-103-5/+5
* 3599Kartik K. Agaram2016-10-271-2/+4
* 3565Kartik K. Agaram2016-10-232-2/+2
* 3561Kartik K. Agaram2016-10-224-9/+9
* 3552Kartik K. Agaram2016-10-2211-36/+36
* 3498Kartik K. Agaram2016-10-141-1/+1
* 3490Kartik K. Agaram2016-10-098-148/+148
* 3489Kartik K. Agaram2016-10-0811-264/+264
* 3457Kartik K. Agaram2016-10-0611-264/+264
* 3445Kartik K. Agaram2016-10-0611-395/+395
* 3429 - standardize Mu scenariosKartik K. Agaram2016-09-2811-814/+883
* 3428Kartik K. Agaram2016-09-281-2/+2
* 3396Kartik K. Agaram2016-09-1712-747/+747
* 3391 - type abbreviations everywhereKartik K. Agaram2016-09-1712-1485/+1485
* 3369Kartik K. Agaram2016-09-151-12/+0
* 3347Kartik K. Agaram2016-09-134-8/+8
* 3341Kartik K. Agaram2016-09-123-4/+4
* 3338Kartik K. Agaram2016-09-124-6/+6
* 3337 - first use of type abbreviations: textKartik K. Agaram2016-09-1212-352/+352
* 3234Kartik K. Agaram2016-08-202-1/+6
* 3233 - change how Mu escapes stringsKartik K. Agaram2016-08-201-4/+3
* 3168 - skip loading recipe 'main' in edit/Kartik K. Agaram2016-08-123-3/+3
* 3101 - purge .traces/ dir from repo historyKartik K. Agaram2016-07-051-4/+0
* 3067Kartik K. Agaram2016-06-255-69/+69
clarations") TRACE, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "trace", TRACE); :(before "End Primitive Recipe Checks") case TRACE: { if (SIZE(inst.ingredients) < 3) { raise << maybe(get(Recipe, r).name) << "'trace' takes three or more ingredients rather than '" << to_original_string(inst) << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { raise << maybe(get(Recipe, r).name) << "first ingredient of 'trace' should be a number (depth), but got '" << inst.ingredients.at(0).original_string << "'\n" << end(); break; } if (!is_literal_text(inst.ingredients.at(1))) { raise << maybe(get(Recipe, r).name) << "second ingredient of 'trace' should be a literal string (label), but got '" << inst.ingredients.at(1).original_string << "'\n" << end(); break; } break; } :(before "End Primitive Recipe Implementations") case TRACE: { int depth = ingredients.at(0).at(0); string label = current_instruction().ingredients.at(1).name; ostringstream out; for (int i = 2; i < SIZE(current_instruction().ingredients); ++i) { if (i > 2) out << ' '; out << inspect(current_instruction().ingredients.at(i), ingredients.at(i)); } trace(depth, label) << out.str() << end(); break; } //: simpler limited version of 'trace' :(before "End Primitive Recipe Declarations") STASH, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "stash", STASH); :(before "End Primitive Recipe Checks") case STASH: { break; } :(before "End Primitive Recipe Implementations") case STASH: { ostringstream out; for (int i = 0; i < SIZE(current_instruction().ingredients); ++i) { if (i) out << ' '; out << inspect(current_instruction().ingredients.at(i), ingredients.at(i)); } trace(2, "app") << out.str() << end(); break; } :(scenario stash_literal_string) def main [ stash [foo] ] +app: foo :(scenario stash_literal_number) def main [ stash [foo:], 4 ] +app: foo: 4 :(scenario stash_number) def main [ 1:num <- copy 34 stash [foo:], 1:num ] +app: foo: 34 :(code) string inspect(const reagent& r, const vector<double>& data) { if (is_literal(r)) return r.name; // End inspect Special-cases(r, data) ostringstream out; for (long long i = 0; i < SIZE(data); ++i) { if (i) out << ' '; out << no_scientific(data.at(i)); } return out.str(); } :(before "End Primitive Recipe Declarations") HIDE_ERRORS, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "hide-errors", HIDE_ERRORS); :(before "End Primitive Recipe Checks") case HIDE_ERRORS: { break; } :(before "End Primitive Recipe Implementations") case HIDE_ERRORS: { Hide_errors = true; break; } :(before "End Primitive Recipe Declarations") SHOW_ERRORS, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "show-errors", SHOW_ERRORS); :(before "End Primitive Recipe Checks") case SHOW_ERRORS: { break; } :(before "End Primitive Recipe Implementations") case SHOW_ERRORS: { Hide_errors = false; break; } :(before "End Primitive Recipe Declarations") TRACE_UNTIL, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "trace-until", TRACE_UNTIL); :(before "End Primitive Recipe Checks") case TRACE_UNTIL: { break; } :(before "End Primitive Recipe Implementations") case TRACE_UNTIL: { if (Trace_stream) { Trace_stream->collect_depth = ingredients.at(0).at(0); } break; } :(before "End Primitive Recipe Declarations") _DUMP_TRACE, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "$dump-trace", _DUMP_TRACE); :(before "End Primitive Recipe Checks") case _DUMP_TRACE: { break; } :(before "End Primitive Recipe Implementations") case _DUMP_TRACE: { if (ingredients.empty()) { DUMP(""); } else { DUMP(current_instruction().ingredients.at(0).name); } break; } :(before "End Primitive Recipe Declarations") _CLEAR_TRACE, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "$clear-trace", _CLEAR_TRACE); :(before "End Primitive Recipe Checks") case _CLEAR_TRACE: { break; } :(before "End Primitive Recipe Implementations") case _CLEAR_TRACE: { if (Trace_stream) Trace_stream->past_lines.clear(); break; } :(before "End Primitive Recipe Declarations") _SAVE_TRACE, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "$save-trace", _SAVE_TRACE); :(before "End Primitive Recipe Checks") case _SAVE_TRACE: { break; } :(before "End Primitive Recipe Implementations") case _SAVE_TRACE: { if (Save_trace) Trace_stream->save(); break; } //:: 'cheating' by using the host system :(before "End Primitive Recipe Declarations") _PRINT, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "$print", _PRINT); :(before "End Primitive Recipe Checks") case _PRINT: { break; } :(before "End Primitive Recipe Implementations") case _PRINT: { for (int i = 0; i < SIZE(ingredients); ++i) { if (is_literal(current_instruction().ingredients.at(i))) { trace(9998, "run") << "$print: " << current_instruction().ingredients.at(i).name << end(); if (!has_property(current_instruction().ingredients.at(i), "newline")) { cout << current_instruction().ingredients.at(i).name; } // hack: '$print 10' prints '10', but '$print 10/newline' prints '\n' // End $print 10/newline Special-cases else { cout << '\n'; } } // End $print Special-cases else { for (int j = 0; j < SIZE(ingredients.at(i)); ++j) { trace(9998, "run") << "$print: " << ingredients.at(i).at(j) << end(); if (j > 0) cout << " "; cout << no_scientific(ingredients.at(i).at(j)); } } } cout.flush(); break; } :(before "End Primitive Recipe Declarations") _EXIT, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "$exit", _EXIT); :(before "End Primitive Recipe Checks") case _EXIT: { break; } :(before "End Primitive Recipe Implementations") case _EXIT: { exit(0); break; } :(before "End Primitive Recipe Declarations") _SYSTEM, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "$system", _SYSTEM); :(before "End Primitive Recipe Checks") case _SYSTEM: { if (SIZE(inst.ingredients) != 1) { raise << maybe(get(Recipe, r).name) << "'$system' requires exactly one ingredient, but got '" << to_string(inst) << "'\n" << end(); break; } if (!is_literal_text(inst.ingredients.at(0))) { raise << maybe(get(Recipe, r).name) << "ingredient to '$system' must be a literal text, but got '" << to_string(inst) << "'\n" << end(); } break; } :(before "End Primitive Recipe Implementations") case _SYSTEM: { int status = system(current_instruction().ingredients.at(0).name.c_str()); products.resize(1); products.at(0).push_back(status); break; } :(before "End Primitive Recipe Declarations") _DUMP_MEMORY, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "$dump-memory", _DUMP_MEMORY); :(before "End Primitive Recipe Checks") case _DUMP_MEMORY: { break; } :(before "End Primitive Recipe Implementations") case _DUMP_MEMORY: { dump_memory(); break; } //: In times of real extremis we need to create a whole new modality for debug //: logs, independent of other changes to the screen or Trace_stream. :(before "End Globals") ofstream LOG; :(before "End One-time Setup") //? LOG.open("log"); :(before "End Primitive Recipe Declarations") _LOG, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "$log", _LOG); :(before "End Primitive Recipe Checks") case _LOG: { break; } :(before "End Primitive Recipe Implementations") case _LOG: { ostringstream out; for (int i = 0; i < SIZE(current_instruction().ingredients); ++i) { out << inspect(current_instruction().ingredients.at(i), ingredients.at(i)); } LOG << out.str() << '\n'; break; } //: set a variable from within Mu code //: useful for selectively tracing or printing after some point :(before "End Globals") bool Foo = false; :(before "End Primitive Recipe Declarations") _FOO, :(before "End Primitive Recipe Numbers") put(Recipe_ordinal, "$foo", _FOO); :(before "End Primitive Recipe Checks") case _FOO: { break; } :(before "End Primitive Recipe Implementations") case _FOO: { Foo = true; break; }