blob: 301cd01aaf87a8194fbd3520e5f95a8436878b76 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
//: Recipe to look at elements of containers.
:(before "End Primitive Recipe Declarations")
_PRINT,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["$print"] = _PRINT;
:(before "End Primitive Recipe Implementations")
case _PRINT: {
for (long long int i = 0; i < SIZE(ingredients); ++i) {
if (is_literal(current_instruction().ingredients.at(i))) {
trace(Primitive_recipe_depth, "run") << "$print: " << current_instruction().ingredients.at(i).name;
cout << current_instruction().ingredients.at(i).name;
}
else {
for (long long int j = 0; j < SIZE(ingredients.at(i)); ++j) {
trace(Primitive_recipe_depth, "run") << "$print: " << ingredients.at(i).at(j);
if (j > 0) cout << " ";
cout << ingredients.at(i).at(j);
}
}
}
break;
}
:(before "End Primitive Recipe Declarations")
_START_TRACING,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["$start-tracing"] = _START_TRACING;
:(before "End Primitive Recipe Implementations")
case _START_TRACING: {
if (current_instruction().ingredients.empty())
Trace_stream->dump_layer = "all";
else
Trace_stream->dump_layer = current_instruction().ingredients.at(0).name;
//? cout << Trace_stream << ": " << Trace_stream->dump_layer << '\n'; //? 1
break;
}
:(before "End Primitive Recipe Declarations")
_STOP_TRACING,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["$stop-tracing"] = _STOP_TRACING;
:(before "End Primitive Recipe Implementations")
case _STOP_TRACING: {
Trace_stream->dump_layer = "";
break;
}
:(before "End Primitive Recipe Declarations")
_CLOSE_TRACE,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["$close-trace"] = _CLOSE_TRACE;
:(before "End Primitive Recipe Implementations")
case _CLOSE_TRACE: {
if (Trace_stream) {
delete Trace_stream;
Trace_stream = NULL;
}
break;
}
:(before "End Primitive Recipe Declarations")
_EXIT,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["$exit"] = _EXIT;
:(before "End Primitive Recipe Implementations")
case _EXIT: {
exit(0);
break;
}
:(before "End Primitive Recipe Declarations")
_DUMP_TRACE,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["$dump-trace"] = _DUMP_TRACE;
:(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")
Recipe_ordinal["$clear-trace"] = _CLEAR_TRACE;
:(before "End Primitive Recipe Implementations")
case _CLEAR_TRACE: {
CLEAR_TRACE;
break;
}
:(before "End Primitive Recipe Declarations")
_DUMP_MEMORY,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["$dump-memory"] = _DUMP_MEMORY;
:(before "End Primitive Recipe Implementations")
case _DUMP_MEMORY: {
dump_memory();
break;
}
|