DIRECTOR: LINGO: Add ignoreGlobal flag to Datum

This commit is contained in:
djsrv 2022-06-27 23:58:51 -05:00
parent 2fb1abebe5
commit c38ac3ed1a
3 changed files with 18 additions and 2 deletions

View File

@ -1660,7 +1660,11 @@ void LB::b_alert(int nargs) {
}
void LB::b_clearGlobals(int nargs) {
g_lingo->_globalvars.clear();
for (DatumHash::iterator it = g_lingo->_globalvars.begin(); it != g_lingo->_globalvars.end(); it++) {
if (!it->_value.ignoreGlobal) {
g_lingo->_globalvars.erase(it);
}
}
}
void LB::b_cursor(int nargs) {
@ -1691,7 +1695,9 @@ void LB::b_showGlobals(int nargs) {
global_out += ver.asString() + "\n";
if (g_lingo->_globalvars.size()) {
for (auto it = g_lingo->_globalvars.begin(); it != g_lingo->_globalvars.end(); it++) {
global_out += it->_key + " = " + it->_value.asString() + "\n";
if (!it->_value.ignoreGlobal) {
global_out += it->_key + " = " + it->_value.asString() + "\n";
}
}
}
g_debugger->debugPrintf("%s", global_out.c_str());

View File

@ -622,6 +622,7 @@ Datum::Datum() {
type = VOID;
refCount = new int;
*refCount = 1;
ignoreGlobal = false;
}
Datum::Datum(const Datum &d) {
@ -629,6 +630,7 @@ Datum::Datum(const Datum &d) {
u = d.u;
refCount = d.refCount;
*refCount += 1;
ignoreGlobal = false;
}
Datum& Datum::operator=(const Datum &d) {
@ -639,6 +641,7 @@ Datum& Datum::operator=(const Datum &d) {
refCount = d.refCount;
*refCount += 1;
}
ignoreGlobal = false;
return *this;
}
@ -654,6 +657,7 @@ Datum::Datum(double val) {
type = FLOAT;
refCount = new int;
*refCount = 1;
ignoreGlobal = false;
}
Datum::Datum(const Common::String &val) {
@ -661,6 +665,7 @@ Datum::Datum(const Common::String &val) {
type = STRING;
refCount = new int;
*refCount = 1;
ignoreGlobal = false;
}
Datum::Datum(AbstractObject *val) {
@ -674,6 +679,7 @@ Datum::Datum(AbstractObject *val) {
refCount = new int;
*refCount = 1;
}
ignoreGlobal = false;
}
Datum::Datum(const CastMemberID &val) {
@ -681,6 +687,7 @@ Datum::Datum(const CastMemberID &val) {
type = CASTREF;
refCount = new int;
*refCount = 1;
ignoreGlobal = false;
}
Datum::Datum(const Common::Rect &rect) {
@ -690,6 +697,7 @@ Datum::Datum(const Common::Rect &rect) {
u.farr->arr.push_back(Datum(rect.top));
u.farr->arr.push_back(Datum(rect.right));
u.farr->arr.push_back(Datum(rect.bottom));
ignoreGlobal = false;
}
void Datum::reset() {

View File

@ -147,6 +147,8 @@ struct Datum { /* interpreter stack type */
int *refCount;
bool ignoreGlobal; // True if this Datum should be ignored by showGlobals and clearGlobals
Datum();
Datum(const Datum &d);
Datum& operator=(const Datum &d);