DIRECTOR: LINGO: Add string support to c_eq and c_neq

This commit is contained in:
Scott Percival 2019-12-22 15:51:28 +08:00
parent 1c13d5d605
commit afea378714

View File

@ -817,7 +817,10 @@ void Lingo::c_eq() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
if (g_lingo->alignTypes(d1, d2) == FLOAT) {
if (d1.type == STRING && d2.type == STRING) {
d1.u.i = (*d1.u.s == *d2.u.s) ? 1 : 0;
d1.type = INT;
} else if (g_lingo->alignTypes(d1, d2) == FLOAT) {
d1.u.i = (d1.u.f == d2.u.f) ? 1 : 0;
d1.type = INT;
} else {
@ -830,7 +833,10 @@ void Lingo::c_neq() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
if (g_lingo->alignTypes(d1, d2) == FLOAT) {
if (d1.type == STRING && d2.type == STRING) {
d1.u.i = (*d1.u.s != *d2.u.s) ? 1 : 0;
d1.type = INT;
} else if (g_lingo->alignTypes(d1, d2) == FLOAT) {
d1.u.i = (d1.u.f != d2.u.f) ? 1 : 0;
d1.type = INT;
} else {