DIRECTOR: LINGO: Remove unnecessary instructions

Global and instance vars are both just added to the respective vartables
on parse instead of upon execution.
This commit is contained in:
djsrv
2020-06-06 18:34:06 +02:00
committed by Eugene Sandulenko
parent be4c440128
commit 2d9dea678a
6 changed files with 359 additions and 396 deletions
-30
View File
@@ -80,14 +80,12 @@ static struct FuncDescr {
{ LC::c_exitRepeat, "c_exitRepeat", "" },
{ LC::c_floatpush, "c_floatpush", "f" },
{ LC::c_ge, "c_ge", "" },
{ LC::c_global, "c_global", "s" },
{ LC::c_goto, "c_goto", "" },
{ LC::c_gotoloop, "c_gotoloop", "" },
{ LC::c_gotonext, "c_gotonext", "" },
{ LC::c_gotoprevious, "c_gotoprevious", "" },
{ LC::c_gt, "c_gt", "" },
{ LC::c_hilite, "c_hilite", "" },
{ LC::c_instance, "c_instance", "s" }, // D2
{ LC::c_intersects, "c_intersects", "" },
{ LC::c_intpush, "c_intpush", "i" },
{ LC::c_itemOf, "c_itemOf", "" }, // D3
@@ -1474,40 +1472,12 @@ void LC::c_procret() {
}
}
void LC::c_global() {
Common::String name(g_lingo->readString());
if (!g_lingo->_globalvars.contains(name)) {
g_lingo->_globalvars[name] = Symbol();
g_lingo->_globalvars[name].name = new Common::String(name);
g_lingo->_globalvars[name].global = true;
}
}
void LC::c_property() {
Common::String name(g_lingo->readString());
warning("STUB: c_property()");
}
void LC::c_instance() {
Common::String name(g_lingo->readString());
warning("STUB: c_instance(%s)", name.c_str());
}
void LC::c_factory() {
Common::String name(g_lingo->readString());
Datum d;
warning("STUB: c_factory(%s)", name.c_str());
d.type = OBJECT;
d.u.s = new Common::String(name);
g_lingo->push(d);
}
void LC::c_open() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
-3
View File
@@ -128,9 +128,6 @@ namespace LC {
void c_gotoloop();
void c_gotonext();
void c_gotoprevious();
void c_global();
void c_instance();
void c_factory();
void c_property();
void c_play();
+1 -1
View File
@@ -454,7 +454,7 @@ void Lingo::varCreate(const Common::String &name, bool global, SymbolHash *local
if (global)
warning("varCreate: variable %s is instance or property, not global", name.c_str());
return;
} else if (_globalvars.contains(name)) {
} else if (_globalvars.contains(name)) {
if (!global)
warning("varCreate: variable %s is global, not local", name.c_str());
return;
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -147,7 +147,7 @@ extern int yydebug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 137 "engines/director/lingo/lingo-gr.y"
#line 139 "engines/director/lingo/lingo-gr.y"
Common::String *s;
int i;
+2 -4
View File
@@ -128,6 +128,8 @@ static void mVar(Common::String *s, VarType type) {
} else {
warning("Instance var '%s' defined outside factory", s->c_str());
}
} else if (type == kVarGlobal) {
g_lingo->varCreate(*s, true);
}
}
}
@@ -602,13 +604,9 @@ proc: tPUT expr { g_lingo->code1(LC::c_printtop); }
| tOPEN expr { g_lingo->code2(LC::c_voidpush, LC::c_open); }
globallist: ID {
g_lingo->code1(LC::c_global);
g_lingo->codeString($ID->c_str());
mVar($ID, kVarGlobal);
delete $ID; }
| globallist ',' ID {
g_lingo->code1(LC::c_global);
g_lingo->codeString($ID->c_str());
mVar($ID, kVarGlobal);
delete $ID; }