-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmrun.cpp
More file actions
33 lines (28 loc) · 807 Bytes
/
mrun.cpp
File metadata and controls
33 lines (28 loc) · 807 Bytes
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
#include "mrun.h"
bool Breakpoint::hit(int s, Environment& e) {
if (step >= 0 && step != s) return false;
return cond->eval(e).b();
}
int ExecutionContext::breakpoint() {
Environment& e = envs.back();
for (int i=0; i<brks.size(); i++)
if (brks[i].hit(step, e)) return i;
return 0;
}
// GOTO, GOSUB, RETURN, TGOTO, FGOTO,
// PCALL, PRETURN
int ExecutionContext::stepInto() {
int s = ++step;
Environment& e = envs.back();
Ast *a = prog->steps[s];
switch (a->t) {
// case GOTO: step = a->l;
// case GOTOC: if (a->c->eval().b()) step = a->l;
// case GOSUBC: if (a->c->eval().b()) { rets.push_back(step); step = a->l; }
// case RETURN: step = rets.size()? rets.back() : -1; rets.pop_back();
// case CALLP:
//
// case
}
return breakpoint();
}