diff options
author | Eugene Sandulenko | 2020-01-01 02:38:58 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2020-01-01 02:38:58 +0100 |
commit | bedd04f3965c30fbd30aca0737969d132db797a6 (patch) | |
tree | b727c8efab43f1ce03dd40f1789bd9803b95cfaa /engines/director | |
parent | d0d7d0899f5878341275d181ff5e89cbfc29bb5e (diff) | |
download | scummvm-rg350-bedd04f3965c30fbd30aca0737969d132db797a6.tar.gz scummvm-rg350-bedd04f3965c30fbd30aca0737969d132db797a6.tar.bz2 scummvm-rg350-bedd04f3965c30fbd30aca0737969d132db797a6.zip |
DIRECTOR: LINGO: Replace LC class with namespace
Diffstat (limited to 'engines/director')
-rw-r--r-- | engines/director/lingo/lingo-builtins.cpp | 6 | ||||
-rw-r--r-- | engines/director/lingo/lingo-bytecode.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 10 | ||||
-rw-r--r-- | engines/director/lingo/lingo-code.h | 211 | ||||
-rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 12 | ||||
-rw-r--r-- | engines/director/lingo/lingo-events.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 192 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 192 | ||||
-rw-r--r-- | engines/director/lingo/lingo.cpp | 4 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 9 |
10 files changed, 312 insertions, 328 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp index b0cfef469f..654ffedb67 100644 --- a/engines/director/lingo/lingo-builtins.cpp +++ b/engines/director/lingo/lingo-builtins.cpp @@ -936,7 +936,7 @@ void Lingo::b_quit(int nargs) { void Lingo::b_return(int nargs) { // We do not touch the top of the stack, it will be returned - g_lc->c_procret(); + LC::c_procret(); } void Lingo::b_restart(int nargs) { @@ -1136,7 +1136,7 @@ void Lingo::b_importFileInto(int nargs) { void menuCommandsCallback(int action, Common::String &text, void *data) { Common::String name = Common::String::format("scummvmMenu%d", action); - g_lc->call(name, 0); + LC::call(name, 0); } void Lingo::b_installMenu(int nargs) { @@ -1687,7 +1687,7 @@ void Lingo::factoryCall(Common::String &name, int nargs) { s = name + "-" + *method.u.s; debugC(3, kDebugLingoExec, "Stack size before call: %d, nargs: %d", _stack.size(), nargs); - _lc->call(s, nargs); + LC::call(s, nargs); debugC(3, kDebugLingoExec, "Stack size after call: %d", _stack.size()); if (!method.u.s->compareToIgnoreCase("mNew")) { diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp index b6d3939d5f..c980d51082 100644 --- a/engines/director/lingo/lingo-bytecode.cpp +++ b/engines/director/lingo/lingo-bytecode.cpp @@ -214,7 +214,7 @@ void LC::cb_call() { Datum nargs = g_lingo->pop(); if ((nargs.type == ARGC) || (nargs.type == ARGCNORET)) { - g_lc->call(name, nargs.u.i); + LC::call(name, nargs.u.i); } else { warning("cb_call: first arg should be of type ARGC or ARGCNORET, not %s", nargs.type2str()); diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index a4e314a9cc..97c8050bde 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -52,8 +52,6 @@ namespace Director { -LC *g_lc; - static struct FuncDescr { const inst func; const char *name; @@ -408,13 +406,13 @@ bool LC::verify(Symbol *s) { } void LC::c_eval() { - g_lc->c_varpush(); + LC::c_varpush(); Datum d; d = g_lingo->pop(); if (d.type == HANDLER) { - g_lc->call(*d.u.s, 0); + LC::call(*d.u.s, 0); delete d.u.s; return; } @@ -424,7 +422,7 @@ void LC::c_eval() { return; } - if (!g_lc->verify(d.u.sym)) + if (!LC::verify(d.u.sym)) return; d.type = d.u.sym->type; @@ -1131,7 +1129,7 @@ void LC::c_call() { int nargs = g_lingo->readInt(); - g_lc->call(name, nargs); + LC::call(name, nargs); } void LC::call(Common::String name, int nargs) { diff --git a/engines/director/lingo/lingo-code.h b/engines/director/lingo/lingo-code.h index d4107e828c..87051a8cca 100644 --- a/engines/director/lingo/lingo-code.h +++ b/engines/director/lingo/lingo-code.h @@ -25,118 +25,115 @@ namespace Director { -class LC { -public: - static void c_xpop(); - static void c_printtop(); - - static void c_add(); - static void c_sub(); - static void c_mul(); - static void c_div(); - static void c_mod(); - static void c_negate(); - - static void c_and(); - static void c_or(); - static void c_not(); - - static void c_ampersand(); - static void c_after(); - static void c_before(); - static void c_concat(); - static void c_contains(); - static void c_starts(); - - static void c_intersects(); - static void c_within(); - static void c_field(); - static void c_of(); - static void c_charOf(); - static void c_charToOf(); - static void c_itemOf(); - static void c_itemToOf(); - static void c_lineOf(); - static void c_lineToOf(); - static void c_wordOf(); - static void c_wordToOf(); - - static void c_intpush(); - static void c_voidpush(); - static void c_floatpush(); - static void c_stringpush(); - static void c_symbolpush(); - static void c_namepush(); - static void c_varpush(); - static void c_argcpush(); - static void c_argcnoretpush(); - static void c_arraypush(); - static void c_assign(); - static bool verify(Symbol *s); - static void c_eval(); - static void c_setImmediate(); - - static void c_swap(); - - static void c_theentitypush(); - static void c_theentityassign(); - static void c_objectfieldpush(); - static void c_objectfieldassign(); - - static void c_repeatwhilecode(); - static void c_repeatwithcode(); - static void c_ifcode(); - static void c_whencode(); - static void c_tellcode(); - static void c_tell(); - static void c_telldone(); - static void c_exitRepeat(); - static void c_eq(); - static void c_neq(); - static void c_gt(); - static void c_lt(); - static void c_ge(); - static void c_le(); - static void c_jump(); - static void c_jumpifz(); - static void c_call(); - - static void call(Common::String name, int nargs); - - static void c_procret(); - - static void c_mci(); - static void c_mciwait(); - static void c_goto(); - static void c_gotoloop(); - static void c_gotonext(); - static void c_gotoprevious(); - static void c_global(); - static void c_instance(); - static void c_factory(); - static void c_property(); - - static void c_play(); - static void c_playdone(); - - static void c_open(); - static void c_hilite(); +namespace LC { + void c_xpop(); + void c_printtop(); + + void c_add(); + void c_sub(); + void c_mul(); + void c_div(); + void c_mod(); + void c_negate(); + + void c_and(); + void c_or(); + void c_not(); + + void c_ampersand(); + void c_after(); + void c_before(); + void c_concat(); + void c_contains(); + void c_starts(); + + void c_intersects(); + void c_within(); + void c_field(); + void c_of(); + void c_charOf(); + void c_charToOf(); + void c_itemOf(); + void c_itemToOf(); + void c_lineOf(); + void c_lineToOf(); + void c_wordOf(); + void c_wordToOf(); + + void c_intpush(); + void c_voidpush(); + void c_floatpush(); + void c_stringpush(); + void c_symbolpush(); + void c_namepush(); + void c_varpush(); + void c_argcpush(); + void c_argcnoretpush(); + void c_arraypush(); + void c_assign(); + bool verify(Symbol *s); + void c_eval(); + void c_setImmediate(); + + void c_swap(); + + void c_theentitypush(); + void c_theentityassign(); + void c_objectfieldpush(); + void c_objectfieldassign(); + + void c_repeatwhilecode(); + void c_repeatwithcode(); + void c_ifcode(); + void c_whencode(); + void c_tellcode(); + void c_tell(); + void c_telldone(); + void c_exitRepeat(); + void c_eq(); + void c_neq(); + void c_gt(); + void c_lt(); + void c_ge(); + void c_le(); + void c_jump(); + void c_jumpifz(); + void c_call(); + + void call(Common::String name, int nargs); + + void c_procret(); + + void c_mci(); + void c_mciwait(); + void c_goto(); + void c_gotoloop(); + void c_gotonext(); + void c_gotoprevious(); + void c_global(); + void c_instance(); + void c_factory(); + void c_property(); + + void c_play(); + void c_playdone(); + + void c_open(); + void c_hilite(); // stubs for unknown instructions - static void c_unk(); - static void c_unk1(); - static void c_unk2(); + void c_unk(); + void c_unk1(); + void c_unk2(); // bytecode-related instructions - static void cb_localcall(); - static void cb_call(); - static void cb_v4theentitypush(); - static void cb_v4theentitynamepush(); - static void cb_v4theentityassign(); + void cb_localcall(); + void cb_call(); + void cb_v4theentitypush(); + void cb_v4theentitynamepush(); + void cb_v4theentityassign(); -}; - -extern LC *g_lc; +} // End of namespace LC } // End of namespace Director diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index fe452b277d..10254c3df3 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -356,16 +356,16 @@ void Lingo::clearArgStack() { void Lingo::codeArgStore() { for (int i = _argstack.size() - 1; i >= 0; i--) { - code1(g_lc->c_varpush); + code1(LC::c_varpush); codeString(_argstack[i]->c_str()); - code1(g_lc->c_assign); + code1(LC::c_assign); } } int Lingo::codeSetImmediate(bool state) { g_lingo->_immediateMode = state; - int res = g_lingo->code1(g_lc->c_setImmediate); + int res = g_lingo->code1(LC::c_setImmediate); inst i = 0; WRITE_UINT32(&i, state); g_lingo->code1(i); @@ -374,7 +374,7 @@ int Lingo::codeSetImmediate(bool state) { } int Lingo::codeFunc(Common::String *s, int numpar) { - int ret = g_lingo->code1(g_lc->c_call); + int ret = g_lingo->code1(LC::c_call); g_lingo->codeString(s->c_str()); @@ -388,13 +388,13 @@ int Lingo::codeFunc(Common::String *s, int numpar) { int Lingo::codeMe(Common::String *method, int numpar) { // Check if need to encode reference to the factory if (method == nullptr) { - int ret = g_lingo->code1(g_lc->c_factory); + int ret = g_lingo->code1(LC::c_factory); g_lingo->codeString(g_lingo->_currentFactory.c_str()); return ret; } - int ret = g_lingo->code1(g_lc->c_call); + int ret = g_lingo->code1(LC::c_call); Common::String m(g_lingo->_currentFactory); diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp index 3436d68ede..4aeed4cc38 100644 --- a/engines/director/lingo/lingo-events.cpp +++ b/engines/director/lingo/lingo-events.cpp @@ -316,7 +316,7 @@ void Lingo::processEvent(LEvent event, ScriptType st, int entityId) { if (_handlers.contains(ENTITY_INDEX(event, entityId))) { debugC(1, kDebugEvents, "Lingo::processEvent(%s, %s, %d), _eventHandler", _eventHandlerTypes[event], scriptType2str(st), entityId); - g_lc->call(_eventHandlerTypes[event], 0); // D4+ Events + LC::call(_eventHandlerTypes[event], 0); // D4+ Events } else if (event == kEventNone && _scriptContexts[st].contains(entityId)) { debugC(1, kDebugEvents, "Lingo::processEvent(%s, %s, %d), script", _eventHandlerTypes[event], scriptType2str(st), entityId); diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index 9df284f47b..d4448546ee 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -2121,9 +2121,9 @@ yyreduce: case 8: #line 142 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_varpush); + g_lingo->code1(LC::c_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); - g_lingo->code1(g_lc->c_assign); + g_lingo->code1(LC::c_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;} break; @@ -2131,26 +2131,26 @@ yyreduce: case 9: #line 148 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_assign); + g_lingo->code1(LC::c_assign); (yyval.code) = (yyvsp[(2) - (4)].code); ;} break; case 10: #line 151 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = g_lingo->code1(g_lc->c_after); ;} + { (yyval.code) = g_lingo->code1(LC::c_after); ;} break; case 11: #line 152 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = g_lingo->code1(g_lc->c_before); ;} + { (yyval.code) = g_lingo->code1(LC::c_before); ;} break; case 12: #line 153 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_varpush); + g_lingo->code1(LC::c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); - g_lingo->code1(g_lc->c_assign); + g_lingo->code1(LC::c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;} break; @@ -2158,9 +2158,9 @@ yyreduce: case 13: #line 159 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(0); // Put dummy id - g_lingo->code1(g_lc->c_theentityassign); + g_lingo->code1(LC::c_theentityassign); g_lingo->codeInt((yyvsp[(2) - (4)].e)[0]); g_lingo->codeInt((yyvsp[(2) - (4)].e)[1]); (yyval.code) = (yyvsp[(4) - (4)].code); ;} @@ -2169,9 +2169,9 @@ yyreduce: case 14: #line 166 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_varpush); + g_lingo->code1(LC::c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); - g_lingo->code1(g_lc->c_assign); + g_lingo->code1(LC::c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;} break; @@ -2179,9 +2179,9 @@ yyreduce: case 15: #line 172 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(0); // Put dummy id - g_lingo->code1(g_lc->c_theentityassign); + g_lingo->code1(LC::c_theentityassign); g_lingo->codeInt((yyvsp[(2) - (4)].e)[0]); g_lingo->codeInt((yyvsp[(2) - (4)].e)[1]); (yyval.code) = (yyvsp[(4) - (4)].code); ;} @@ -2190,8 +2190,8 @@ yyreduce: case 16: #line 179 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_swap); - g_lingo->code1(g_lc->c_theentityassign); + g_lingo->code1(LC::c_swap); + g_lingo->code1(LC::c_theentityassign); g_lingo->codeInt((yyvsp[(2) - (5)].e)[0]); g_lingo->codeInt((yyvsp[(2) - (5)].e)[1]); (yyval.code) = (yyvsp[(5) - (5)].code); ;} @@ -2200,8 +2200,8 @@ yyreduce: case 17: #line 185 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_swap); - g_lingo->code1(g_lc->c_theentityassign); + g_lingo->code1(LC::c_swap); + g_lingo->code1(LC::c_theentityassign); g_lingo->codeInt((yyvsp[(2) - (5)].e)[0]); g_lingo->codeInt((yyvsp[(2) - (5)].e)[1]); (yyval.code) = (yyvsp[(5) - (5)].code); ;} @@ -2210,7 +2210,7 @@ yyreduce: case 18: #line 191 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_objectfieldassign); + g_lingo->code1(LC::c_objectfieldassign); g_lingo->codeString((yyvsp[(2) - (4)].objectfield).s->c_str()); g_lingo->codeInt((yyvsp[(2) - (4)].objectfield).e); (yyval.code) = (yyvsp[(4) - (4)].code); ;} @@ -2348,13 +2348,13 @@ yyreduce: case 41: #line 324 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = g_lingo->code3(g_lc->c_repeatwhilecode, STOP, STOP); ;} + { (yyval.code) = g_lingo->code3(LC::c_repeatwhilecode, STOP, STOP); ;} break; case 42: #line 327 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code3(g_lc->c_repeatwithcode, STOP, STOP); + (yyval.code) = g_lingo->code3(LC::c_repeatwithcode, STOP, STOP); g_lingo->code3(STOP, STOP, STOP); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} @@ -2363,7 +2363,7 @@ yyreduce: case 43: #line 334 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code1(g_lc->c_ifcode); + (yyval.code) = g_lingo->code1(LC::c_ifcode); g_lingo->code3(STOP, STOP, STOP); g_lingo->code1(0); // Do not skip end g_lingo->codeLabel(0); ;} @@ -2374,7 +2374,7 @@ yyreduce: { inst skipEnd; WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions - (yyval.code) = g_lingo->code1(g_lc->c_ifcode); + (yyval.code) = g_lingo->code1(LC::c_ifcode); g_lingo->code3(STOP, STOP, STOP); g_lingo->code1(skipEnd); ;} break; @@ -2397,7 +2397,7 @@ yyreduce: case 50: #line 360 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code1(g_lc->c_whencode); + (yyval.code) = g_lingo->code1(LC::c_whencode); g_lingo->code1(STOP); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); ;} @@ -2406,42 +2406,42 @@ yyreduce: case 51: #line 366 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code1(g_lc->c_tellcode); + (yyval.code) = g_lingo->code1(LC::c_tellcode); g_lingo->code1(STOP); ;} break; case 52: #line 370 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code1(g_lc->c_intpush); + (yyval.code) = g_lingo->code1(LC::c_intpush); g_lingo->codeInt((yyvsp[(1) - (1)].i)); ;} break; case 53: #line 373 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code1(g_lc->c_floatpush); + (yyval.code) = g_lingo->code1(LC::c_floatpush); g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;} break; case 54: #line 376 "engines/director/lingo/lingo-gr.y" { // D3 - (yyval.code) = g_lingo->code1(g_lc->c_symbolpush); + (yyval.code) = g_lingo->code1(LC::c_symbolpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;} break; case 55: #line 379 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code1(g_lc->c_stringpush); + (yyval.code) = g_lingo->code1(LC::c_stringpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;} break; case 56: #line 382 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code1(g_lc->c_eval); + (yyval.code) = g_lingo->code1(LC::c_eval); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} break; @@ -2480,9 +2480,9 @@ yyreduce: case 63: #line 400 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code1(g_lc->c_intpush); + (yyval.code) = g_lingo->code1(LC::c_intpush); g_lingo->codeInt(0); // Put dummy id - g_lingo->code1(g_lc->c_theentitypush); + g_lingo->code1(LC::c_theentitypush); inst e = 0, f = 0; WRITE_UINT32(&e, (yyvsp[(1) - (1)].e)[0]); WRITE_UINT32(&f, (yyvsp[(1) - (1)].e)[1]); @@ -2492,7 +2492,7 @@ yyreduce: case 64: #line 408 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code1(g_lc->c_theentitypush); + (yyval.code) = g_lingo->code1(LC::c_theentitypush); inst e = 0, f = 0; WRITE_UINT32(&e, (yyvsp[(1) - (2)].e)[0]); WRITE_UINT32(&f, (yyvsp[(1) - (2)].e)[1]); @@ -2502,99 +2502,99 @@ yyreduce: case 65: #line 414 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_objectfieldpush); + g_lingo->code1(LC::c_objectfieldpush); g_lingo->codeString((yyvsp[(1) - (1)].objectfield).s->c_str()); g_lingo->codeInt((yyvsp[(1) - (1)].objectfield).e); ;} break; case 67: #line 419 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_add); ;} + { g_lingo->code1(LC::c_add); ;} break; case 68: #line 420 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_sub); ;} + { g_lingo->code1(LC::c_sub); ;} break; case 69: #line 421 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_mul); ;} + { g_lingo->code1(LC::c_mul); ;} break; case 70: #line 422 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_div); ;} + { g_lingo->code1(LC::c_div); ;} break; case 71: #line 423 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_mod); ;} + { g_lingo->code1(LC::c_mod); ;} break; case 72: #line 424 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_gt); ;} + { g_lingo->code1(LC::c_gt); ;} break; case 73: #line 425 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_lt); ;} + { g_lingo->code1(LC::c_lt); ;} break; case 74: #line 426 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_eq); ;} + { g_lingo->code1(LC::c_eq); ;} break; case 75: #line 427 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_neq); ;} + { g_lingo->code1(LC::c_neq); ;} break; case 76: #line 428 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_ge); ;} + { g_lingo->code1(LC::c_ge); ;} break; case 77: #line 429 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_le); ;} + { g_lingo->code1(LC::c_le); ;} break; case 78: #line 430 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_and); ;} + { g_lingo->code1(LC::c_and); ;} break; case 79: #line 431 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_or); ;} + { g_lingo->code1(LC::c_or); ;} break; case 80: #line 432 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_not); ;} + { g_lingo->code1(LC::c_not); ;} break; case 81: #line 433 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_ampersand); ;} + { g_lingo->code1(LC::c_ampersand); ;} break; case 82: #line 434 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_concat); ;} + { g_lingo->code1(LC::c_concat); ;} break; case 83: #line 435 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_contains); ;} + { g_lingo->code1(LC::c_contains); ;} break; case 84: #line 436 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_starts); ;} + { g_lingo->code1(LC::c_starts); ;} break; case 85: @@ -2604,7 +2604,7 @@ yyreduce: case 86: #line 438 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lc->c_negate); ;} + { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(LC::c_negate); ;} break; case 87: @@ -2614,57 +2614,57 @@ yyreduce: case 88: #line 440 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = g_lingo->code1(g_lc->c_arraypush); g_lingo->codeArray((yyvsp[(2) - (3)].narg)); ;} + { (yyval.code) = g_lingo->code1(LC::c_arraypush); g_lingo->codeArray((yyvsp[(2) - (3)].narg)); ;} break; case 89: #line 441 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_intersects); ;} + { g_lingo->code1(LC::c_intersects); ;} break; case 90: #line 442 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_within); ;} + { g_lingo->code1(LC::c_within); ;} break; case 91: #line 443 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_charOf); ;} + { g_lingo->code1(LC::c_charOf); ;} break; case 92: #line 444 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_charToOf); ;} + { g_lingo->code1(LC::c_charToOf); ;} break; case 93: #line 445 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_itemOf); ;} + { g_lingo->code1(LC::c_itemOf); ;} break; case 94: #line 446 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_itemToOf); ;} + { g_lingo->code1(LC::c_itemToOf); ;} break; case 95: #line 447 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_lineOf); ;} + { g_lingo->code1(LC::c_lineOf); ;} break; case 96: #line 448 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_lineToOf); ;} + { g_lingo->code1(LC::c_lineToOf); ;} break; case 97: #line 449 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_wordOf); ;} + { g_lingo->code1(LC::c_wordOf); ;} break; case 98: #line 450 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_wordToOf); ;} + { g_lingo->code1(LC::c_wordToOf); ;} break; case 99: @@ -2691,17 +2691,17 @@ yyreduce: case 103: #line 461 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_printtop); ;} + { g_lingo->code1(LC::c_printtop); ;} break; case 106: #line 464 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_exitRepeat); ;} + { g_lingo->code1(LC::c_exitRepeat); ;} break; case 107: #line 465 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_procret); ;} + { g_lingo->code1(LC::c_procret); ;} break; case 111: @@ -2728,7 +2728,7 @@ yyreduce: case 114: #line 478 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_voidpush); + g_lingo->code1(LC::c_voidpush); g_lingo->codeFunc((yyvsp[(1) - (1)].s), 1); delete (yyvsp[(1) - (1)].s); ;} break; @@ -2740,12 +2740,12 @@ yyreduce: case 116: #line 483 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_open); ;} + { g_lingo->code1(LC::c_open); ;} break; case 117: #line 484 "engines/director/lingo/lingo-gr.y" - { g_lingo->code2(g_lc->c_voidpush, g_lc->c_open); ;} + { g_lingo->code2(LC::c_voidpush, LC::c_open); ;} break; case 118: @@ -2755,100 +2755,100 @@ yyreduce: case 119: #line 488 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_global); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} + { g_lingo->code1(LC::c_global); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} break; case 120: #line 489 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_global); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} + { g_lingo->code1(LC::c_global); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} break; case 121: #line 492 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_property); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} + { g_lingo->code1(LC::c_property); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} break; case 122: #line 493 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_property); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} + { g_lingo->code1(LC::c_property); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} break; case 123: #line 496 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_instance); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} + { g_lingo->code1(LC::c_instance); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} break; case 124: #line 497 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_instance); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} + { g_lingo->code1(LC::c_instance); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} break; case 125: #line 508 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_gotoloop); ;} + { g_lingo->code1(LC::c_gotoloop); ;} break; case 126: #line 509 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_gotonext); ;} + { g_lingo->code1(LC::c_gotonext); ;} break; case 127: #line 510 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_gotoprevious); ;} + { g_lingo->code1(LC::c_gotoprevious); ;} break; case 128: #line 511 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(1); - g_lingo->code1(g_lc->c_goto); ;} + g_lingo->code1(LC::c_goto); ;} break; case 129: #line 515 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(3); - g_lingo->code1(g_lc->c_goto); ;} + g_lingo->code1(LC::c_goto); ;} break; case 130: #line 519 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(2); - g_lingo->code1(g_lc->c_goto); ;} + g_lingo->code1(LC::c_goto); ;} break; case 133: #line 529 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lc->c_playdone); ;} + { g_lingo->code1(LC::c_playdone); ;} break; case 134: #line 530 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(1); - g_lingo->code1(g_lc->c_play); ;} + g_lingo->code1(LC::c_play); ;} break; case 135: #line 534 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(3); - g_lingo->code1(g_lc->c_play); ;} + g_lingo->code1(LC::c_play); ;} break; case 136: #line 538 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(2); - g_lingo->code1(g_lc->c_play); ;} + g_lingo->code1(LC::c_play); ;} break; case 137: @@ -2871,7 +2871,7 @@ yyreduce: case 140: #line 573 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_procret); + g_lingo->code1(LC::c_procret); g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg)); g_lingo->clearArgStack(); g_lingo->_indef = kStateNone; ;} @@ -2890,7 +2890,7 @@ yyreduce: case 143: #line 580 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_procret); + g_lingo->code1(LC::c_procret); g_lingo->define(*(yyvsp[(1) - (7)].s), (yyvsp[(3) - (7)].code), (yyvsp[(4) - (7)].narg) + 1, &g_lingo->_currentFactory); g_lingo->clearArgStack(); g_lingo->_indef = kStateNone; ;} @@ -2899,7 +2899,7 @@ yyreduce: case 144: #line 585 "engines/director/lingo/lingo-gr.y" { // D3 - g_lingo->code1(g_lc->c_procret); + g_lingo->code1(LC::c_procret); g_lingo->define(*(yyvsp[(1) - (8)].s), (yyvsp[(2) - (8)].code), (yyvsp[(3) - (8)].narg)); g_lingo->clearArgStack(); g_lingo->_indef = kStateNone; @@ -2911,7 +2911,7 @@ yyreduce: case 145: #line 593 "engines/director/lingo/lingo-gr.y" { // D4. No 'end' clause - g_lingo->code1(g_lc->c_procret); + g_lingo->code1(LC::c_procret); g_lingo->define(*(yyvsp[(1) - (6)].s), (yyvsp[(2) - (6)].code), (yyvsp[(3) - (6)].narg)); g_lingo->_indef = kStateNone; g_lingo->clearArgStack(); @@ -2951,7 +2951,7 @@ yyreduce: case 155: #line 616 "engines/director/lingo/lingo-gr.y" { - g_lingo->code1(g_lc->c_call); + g_lingo->code1(LC::c_call); g_lingo->codeString((yyvsp[(1) - (2)].s)->c_str()); inst numpar = 0; WRITE_UINT32(&numpar, (yyvsp[(2) - (2)].narg)); diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index 697d6f1e7e..a818cf41fe 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -140,56 +140,56 @@ programline: /* empty */ ; asgn: tPUT expr tINTO ID { - g_lingo->code1(g_lc->c_varpush); + g_lingo->code1(LC::c_varpush); g_lingo->codeString($4->c_str()); - g_lingo->code1(g_lc->c_assign); + g_lingo->code1(LC::c_assign); $$ = $2; delete $4; } | tPUT expr tINTO reference { - g_lingo->code1(g_lc->c_assign); + g_lingo->code1(LC::c_assign); $$ = $2; } - | tPUT expr tAFTER expr { $$ = g_lingo->code1(g_lc->c_after); } // D3 - | tPUT expr tBEFORE expr { $$ = g_lingo->code1(g_lc->c_before); } // D3 + | tPUT expr tAFTER expr { $$ = g_lingo->code1(LC::c_after); } // D3 + | tPUT expr tBEFORE expr { $$ = g_lingo->code1(LC::c_before); } // D3 | tSET ID tEQ expr { - g_lingo->code1(g_lc->c_varpush); + g_lingo->code1(LC::c_varpush); g_lingo->codeString($2->c_str()); - g_lingo->code1(g_lc->c_assign); + g_lingo->code1(LC::c_assign); $$ = $4; delete $2; } | tSET THEENTITY tEQ expr { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(0); // Put dummy id - g_lingo->code1(g_lc->c_theentityassign); + g_lingo->code1(LC::c_theentityassign); g_lingo->codeInt($2[0]); g_lingo->codeInt($2[1]); $$ = $4; } | tSET ID tTO expr { - g_lingo->code1(g_lc->c_varpush); + g_lingo->code1(LC::c_varpush); g_lingo->codeString($2->c_str()); - g_lingo->code1(g_lc->c_assign); + g_lingo->code1(LC::c_assign); $$ = $4; delete $2; } | tSET THEENTITY tTO expr { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(0); // Put dummy id - g_lingo->code1(g_lc->c_theentityassign); + g_lingo->code1(LC::c_theentityassign); g_lingo->codeInt($2[0]); g_lingo->codeInt($2[1]); $$ = $4; } | tSET THEENTITYWITHID expr tTO expr { - g_lingo->code1(g_lc->c_swap); - g_lingo->code1(g_lc->c_theentityassign); + g_lingo->code1(LC::c_swap); + g_lingo->code1(LC::c_theentityassign); g_lingo->codeInt($2[0]); g_lingo->codeInt($2[1]); $$ = $5; } | tSET THEENTITYWITHID simpleexpr tEQ expr { - g_lingo->code1(g_lc->c_swap); - g_lingo->code1(g_lc->c_theentityassign); + g_lingo->code1(LC::c_swap); + g_lingo->code1(LC::c_theentityassign); g_lingo->codeInt($2[0]); g_lingo->codeInt($2[1]); $$ = $5; } | tSET THEOBJECTFIELD tTO expr { - g_lingo->code1(g_lc->c_objectfieldassign); + g_lingo->code1(LC::c_objectfieldassign); g_lingo->codeString($2.s->c_str()); g_lingo->codeInt($2.e); $$ = $4; } @@ -321,18 +321,18 @@ ifoneliner: if expr end tTHEN stmtoneliner end tELSE begin stmtoneliner end tEND ; -repeatwhile: tREPEAT tWHILE { $$ = g_lingo->code3(g_lc->c_repeatwhilecode, STOP, STOP); } +repeatwhile: tREPEAT tWHILE { $$ = g_lingo->code3(LC::c_repeatwhilecode, STOP, STOP); } ; repeatwith: tREPEAT tWITH ID { - $$ = g_lingo->code3(g_lc->c_repeatwithcode, STOP, STOP); + $$ = g_lingo->code3(LC::c_repeatwithcode, STOP, STOP); g_lingo->code3(STOP, STOP, STOP); g_lingo->codeString($3->c_str()); delete $3; } ; if: tIF { - $$ = g_lingo->code1(g_lc->c_ifcode); + $$ = g_lingo->code1(LC::c_ifcode); g_lingo->code3(STOP, STOP, STOP); g_lingo->code1(0); // Do not skip end g_lingo->codeLabel(0); } // Mark beginning of the if() statement @@ -341,7 +341,7 @@ if: tIF { elseif: tELSIF { inst skipEnd; WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions - $$ = g_lingo->code1(g_lc->c_ifcode); + $$ = g_lingo->code1(LC::c_ifcode); g_lingo->code3(STOP, STOP, STOP); g_lingo->code1(skipEnd); } ; @@ -358,29 +358,29 @@ stmtlist: { $$ = g_lingo->_currentScript->size(); } ; when: tWHEN ID tTHEN { - $$ = g_lingo->code1(g_lc->c_whencode); + $$ = g_lingo->code1(LC::c_whencode); g_lingo->code1(STOP); g_lingo->codeString($2->c_str()); delete $2; } tell: tTELL { - $$ = g_lingo->code1(g_lc->c_tellcode); + $$ = g_lingo->code1(LC::c_tellcode); g_lingo->code1(STOP); } simpleexpr: INT { - $$ = g_lingo->code1(g_lc->c_intpush); + $$ = g_lingo->code1(LC::c_intpush); g_lingo->codeInt($1); } | FLOAT { - $$ = g_lingo->code1(g_lc->c_floatpush); + $$ = g_lingo->code1(LC::c_floatpush); g_lingo->codeFloat($1); } | SYMBOL { // D3 - $$ = g_lingo->code1(g_lc->c_symbolpush); + $$ = g_lingo->code1(LC::c_symbolpush); g_lingo->codeString($1->c_str()); } | STRING { - $$ = g_lingo->code1(g_lc->c_stringpush); + $$ = g_lingo->code1(LC::c_stringpush); g_lingo->codeString($1->c_str()); } | ID { - $$ = g_lingo->code1(g_lc->c_eval); + $$ = g_lingo->code1(LC::c_eval); g_lingo->codeString($1->c_str()); delete $1; } ; @@ -398,56 +398,56 @@ expr: simpleexpr { $$ = $1; } $$ = g_lingo->codeFunc($1, $3); delete $1; } | THEENTITY { - $$ = g_lingo->code1(g_lc->c_intpush); + $$ = g_lingo->code1(LC::c_intpush); g_lingo->codeInt(0); // Put dummy id - g_lingo->code1(g_lc->c_theentitypush); + g_lingo->code1(LC::c_theentitypush); inst e = 0, f = 0; WRITE_UINT32(&e, $1[0]); WRITE_UINT32(&f, $1[1]); g_lingo->code2(e, f); } | THEENTITYWITHID expr { - $$ = g_lingo->code1(g_lc->c_theentitypush); + $$ = g_lingo->code1(LC::c_theentitypush); inst e = 0, f = 0; WRITE_UINT32(&e, $1[0]); WRITE_UINT32(&f, $1[1]); g_lingo->code2(e, f); } | THEOBJECTFIELD { - g_lingo->code1(g_lc->c_objectfieldpush); + g_lingo->code1(LC::c_objectfieldpush); g_lingo->codeString($1.s->c_str()); g_lingo->codeInt($1.e); } | asgn - | expr '+' expr { g_lingo->code1(g_lc->c_add); } - | expr '-' expr { g_lingo->code1(g_lc->c_sub); } - | expr '*' expr { g_lingo->code1(g_lc->c_mul); } - | expr '/' expr { g_lingo->code1(g_lc->c_div); } - | expr tMOD expr { g_lingo->code1(g_lc->c_mod); } - | expr '>' expr { g_lingo->code1(g_lc->c_gt); } - | expr '<' expr { g_lingo->code1(g_lc->c_lt); } - | expr tEQ expr { g_lingo->code1(g_lc->c_eq); } - | expr tNEQ expr { g_lingo->code1(g_lc->c_neq); } - | expr tGE expr { g_lingo->code1(g_lc->c_ge); } - | expr tLE expr { g_lingo->code1(g_lc->c_le); } - | expr tAND expr { g_lingo->code1(g_lc->c_and); } - | expr tOR expr { g_lingo->code1(g_lc->c_or); } - | tNOT expr %prec UNARY { g_lingo->code1(g_lc->c_not); } - | expr '&' expr { g_lingo->code1(g_lc->c_ampersand); } - | expr tCONCAT expr { g_lingo->code1(g_lc->c_concat); } - | expr tCONTAINS expr { g_lingo->code1(g_lc->c_contains); } - | expr tSTARTS expr { g_lingo->code1(g_lc->c_starts); } + | expr '+' expr { g_lingo->code1(LC::c_add); } + | expr '-' expr { g_lingo->code1(LC::c_sub); } + | expr '*' expr { g_lingo->code1(LC::c_mul); } + | expr '/' expr { g_lingo->code1(LC::c_div); } + | expr tMOD expr { g_lingo->code1(LC::c_mod); } + | expr '>' expr { g_lingo->code1(LC::c_gt); } + | expr '<' expr { g_lingo->code1(LC::c_lt); } + | expr tEQ expr { g_lingo->code1(LC::c_eq); } + | expr tNEQ expr { g_lingo->code1(LC::c_neq); } + | expr tGE expr { g_lingo->code1(LC::c_ge); } + | expr tLE expr { g_lingo->code1(LC::c_le); } + | expr tAND expr { g_lingo->code1(LC::c_and); } + | expr tOR expr { g_lingo->code1(LC::c_or); } + | tNOT expr %prec UNARY { g_lingo->code1(LC::c_not); } + | expr '&' expr { g_lingo->code1(LC::c_ampersand); } + | expr tCONCAT expr { g_lingo->code1(LC::c_concat); } + | expr tCONTAINS expr { g_lingo->code1(LC::c_contains); } + | expr tSTARTS expr { g_lingo->code1(LC::c_starts); } | '+' expr %prec UNARY { $$ = $2; } - | '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lc->c_negate); } + | '-' expr %prec UNARY { $$ = $2; g_lingo->code1(LC::c_negate); } | '(' expr ')' { $$ = $2; } - | '[' arglist ']' { $$ = g_lingo->code1(g_lc->c_arraypush); g_lingo->codeArray($2); } - | tSPRITE expr tINTERSECTS expr { g_lingo->code1(g_lc->c_intersects); } - | tSPRITE expr tWITHIN expr { g_lingo->code1(g_lc->c_within); } - | tCHAR expr tOF expr { g_lingo->code1(g_lc->c_charOf); } - | tCHAR expr tTO expr tOF expr { g_lingo->code1(g_lc->c_charToOf); } - | tITEM expr tOF expr { g_lingo->code1(g_lc->c_itemOf); } - | tITEM expr tTO expr tOF expr { g_lingo->code1(g_lc->c_itemToOf); } - | tLINE expr tOF expr { g_lingo->code1(g_lc->c_lineOf); } - | tLINE expr tTO expr tOF expr { g_lingo->code1(g_lc->c_lineToOf); } - | tWORD expr tOF expr { g_lingo->code1(g_lc->c_wordOf); } - | tWORD expr tTO expr tOF expr { g_lingo->code1(g_lc->c_wordToOf); } + | '[' arglist ']' { $$ = g_lingo->code1(LC::c_arraypush); g_lingo->codeArray($2); } + | tSPRITE expr tINTERSECTS expr { g_lingo->code1(LC::c_intersects); } + | tSPRITE expr tWITHIN expr { g_lingo->code1(LC::c_within); } + | tCHAR expr tOF expr { g_lingo->code1(LC::c_charOf); } + | tCHAR expr tTO expr tOF expr { g_lingo->code1(LC::c_charToOf); } + | tITEM expr tOF expr { g_lingo->code1(LC::c_itemOf); } + | tITEM expr tTO expr tOF expr { g_lingo->code1(LC::c_itemToOf); } + | tLINE expr tOF expr { g_lingo->code1(LC::c_lineOf); } + | tLINE expr tTO expr tOF expr { g_lingo->code1(LC::c_lineToOf); } + | tWORD expr tOF expr { g_lingo->code1(LC::c_wordOf); } + | tWORD expr tTO expr tOF expr { g_lingo->code1(LC::c_wordToOf); } | tME '(' ID ')' { g_lingo->codeMe($3, 0); } | tME '(' ID ',' arglist ')' { g_lingo->codeMe($3, $5); } | tME { g_lingo->codeMe(nullptr, 0); } @@ -458,11 +458,11 @@ reference: RBLTINONEARG simpleexpr { delete $1; } ; -proc: tPUT expr { g_lingo->code1(g_lc->c_printtop); } +proc: tPUT expr { g_lingo->code1(LC::c_printtop); } | gotofunc | playfunc - | tEXIT tREPEAT { g_lingo->code1(g_lc->c_exitRepeat); } - | tEXIT { g_lingo->code1(g_lc->c_procret); } + | tEXIT tREPEAT { g_lingo->code1(LC::c_exitRepeat); } + | tEXIT { g_lingo->code1(LC::c_procret); } | tGLOBAL globallist | tPROPERTY propertylist | tINSTANCE instancelist @@ -476,25 +476,25 @@ proc: tPUT expr { g_lingo->code1(g_lc->c_printtop); } g_lingo->codeFunc($1, 1); delete $1; } | BLTINNOARGSORONE { - g_lingo->code1(g_lc->c_voidpush); + g_lingo->code1(LC::c_voidpush); g_lingo->codeFunc($1, 1); delete $1; } | BLTINARGLIST arglist { g_lingo->codeFunc($1, $2); } - | tOPEN expr tWITH expr { g_lingo->code1(g_lc->c_open); } - | tOPEN expr { g_lingo->code2(g_lc->c_voidpush, g_lc->c_open); } + | tOPEN expr tWITH expr { g_lingo->code1(LC::c_open); } + | tOPEN expr { g_lingo->code2(LC::c_voidpush, LC::c_open); } | TWOWORDBUILTIN ID arglist { Common::String s(*$1); s += '-'; s += *$2; g_lingo->codeFunc(&s, $3); } ; -globallist: ID { g_lingo->code1(g_lc->c_global); g_lingo->codeString($1->c_str()); delete $1; } - | globallist ',' ID { g_lingo->code1(g_lc->c_global); g_lingo->codeString($3->c_str()); delete $3; } +globallist: ID { g_lingo->code1(LC::c_global); g_lingo->codeString($1->c_str()); delete $1; } + | globallist ',' ID { g_lingo->code1(LC::c_global); g_lingo->codeString($3->c_str()); delete $3; } ; -propertylist: ID { g_lingo->code1(g_lc->c_property); g_lingo->codeString($1->c_str()); delete $1; } - | propertylist ',' ID { g_lingo->code1(g_lc->c_property); g_lingo->codeString($3->c_str()); delete $3; } +propertylist: ID { g_lingo->code1(LC::c_property); g_lingo->codeString($1->c_str()); delete $1; } + | propertylist ',' ID { g_lingo->code1(LC::c_property); g_lingo->codeString($3->c_str()); delete $3; } ; -instancelist: ID { g_lingo->code1(g_lc->c_instance); g_lingo->codeString($1->c_str()); delete $1; } - | instancelist ',' ID { g_lingo->code1(g_lc->c_instance); g_lingo->codeString($3->c_str()); delete $3; } +instancelist: ID { g_lingo->code1(LC::c_instance); g_lingo->codeString($1->c_str()); delete $1; } + | instancelist ',' ID { g_lingo->code1(LC::c_instance); g_lingo->codeString($3->c_str()); delete $3; } ; // go {to} {frame} whichFrame {of movie whichMovie} @@ -505,40 +505,40 @@ instancelist: ID { g_lingo->code1(g_lc->c_instance); g_lingo->codeString($1-> // go to {frame} whichFrame {of movie whichMovie} // go to {frame whichFrame of} movie whichMovie -gotofunc: tGO tLOOP { g_lingo->code1(g_lc->c_gotoloop); } - | tGO tNEXT { g_lingo->code1(g_lc->c_gotonext); } - | tGO tPREVIOUS { g_lingo->code1(g_lc->c_gotoprevious); } +gotofunc: tGO tLOOP { g_lingo->code1(LC::c_gotoloop); } + | tGO tNEXT { g_lingo->code1(LC::c_gotonext); } + | tGO tPREVIOUS { g_lingo->code1(LC::c_gotoprevious); } | tGO expr { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(1); - g_lingo->code1(g_lc->c_goto); } + g_lingo->code1(LC::c_goto); } | tGO expr gotomovie { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(3); - g_lingo->code1(g_lc->c_goto); } + g_lingo->code1(LC::c_goto); } | tGO gotomovie { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(2); - g_lingo->code1(g_lc->c_goto); } + g_lingo->code1(LC::c_goto); } ; gotomovie: tOF tMOVIE expr | tMOVIE expr ; -playfunc: tPLAY tDONE { g_lingo->code1(g_lc->c_playdone); } +playfunc: tPLAY tDONE { g_lingo->code1(LC::c_playdone); } | tPLAY expr { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(1); - g_lingo->code1(g_lc->c_play); } + g_lingo->code1(LC::c_play); } | tPLAY expr gotomovie { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(3); - g_lingo->code1(g_lc->c_play); } + g_lingo->code1(LC::c_play); } | tPLAY gotomovie { - g_lingo->code1(g_lc->c_intpush); + g_lingo->code1(LC::c_intpush); g_lingo->codeInt(2); - g_lingo->code1(g_lc->c_play); } + g_lingo->code1(LC::c_play); } | tPLAYACCEL { g_lingo->codeSetImmediate(true); } arglist { g_lingo->codeSetImmediate(false); g_lingo->codeFunc($1, $3); } @@ -571,19 +571,19 @@ playfunc: tPLAY tDONE { g_lingo->code1(g_lc->c_playdone); } // on keyword defn: tMACRO ID { g_lingo->_indef = kStateInArgs; g_lingo->_currentFactory.clear(); } begin argdef '\n' argstore stmtlist { - g_lingo->code1(g_lc->c_procret); + g_lingo->code1(LC::c_procret); g_lingo->define(*$2, $4, $5); g_lingo->clearArgStack(); g_lingo->_indef = kStateNone; } | tFACTORY ID { g_lingo->codeFactory(*$2); } | tMETHOD { g_lingo->_indef = kStateInArgs; } begin argdef '\n' argstore stmtlist { - g_lingo->code1(g_lc->c_procret); + g_lingo->code1(LC::c_procret); g_lingo->define(*$1, $3, $4 + 1, &g_lingo->_currentFactory); g_lingo->clearArgStack(); g_lingo->_indef = kStateNone; } | on begin argdef '\n' argstore stmtlist ENDCLAUSE endargdef { // D3 - g_lingo->code1(g_lc->c_procret); + g_lingo->code1(LC::c_procret); g_lingo->define(*$1, $2, $3); g_lingo->clearArgStack(); g_lingo->_indef = kStateNone; @@ -591,7 +591,7 @@ defn: tMACRO ID { g_lingo->_indef = kStateInArgs; g_lingo->_currentFactory.clear checkEnd($7, $1->c_str(), false); } | on begin argdef '\n' argstore stmtlist { // D4. No 'end' clause - g_lingo->code1(g_lc->c_procret); + g_lingo->code1(LC::c_procret); g_lingo->define(*$1, $2, $3); g_lingo->_indef = kStateNone; g_lingo->clearArgStack(); @@ -614,7 +614,7 @@ argstore: /* nothing */ { g_lingo->codeArgStore(); g_lingo->_indef = kStateIn ; macro: ID nonemptyarglist { - g_lingo->code1(g_lc->c_call); + g_lingo->code1(LC::c_call); g_lingo->codeString($1->c_str()); inst numpar = 0; WRITE_UINT32(&numpar, $2); diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 1db39272f0..2200276526 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -47,10 +47,6 @@ Symbol::Symbol() { Lingo::Lingo(DirectorEngine *vm) : _vm(vm) { g_lingo = this; - _lc = new LC; - - g_lc = _lc; - _currentScript = 0; _currentScriptType = kMovieScript; _currentEntityId = 0; diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 264ceb30d4..09476e7b1c 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -42,8 +42,6 @@ struct TheEntityField; struct LingoV4Bytecode; struct LingoV4TheEntity; class DirectorEngine; -class LC; - class Frame; enum LEvent { @@ -180,8 +178,6 @@ struct CFrame { /* proc/func call stack frame */ class Lingo { -friend class LC; - public: Lingo(DirectorEngine *vm); ~Lingo(); @@ -532,7 +528,7 @@ public: void push(Datum d); Datum pop(void); -private: +public: Common::HashMap<uint32, const char *> _eventHandlerTypes; Common::HashMap<Common::String, uint32, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _eventHandlerTypeIds; Common::HashMap<Common::String, Audio::AudioStream *> _audioAliases; @@ -544,17 +540,14 @@ private: FuncHash _functions; -protected: Common::HashMap<int, LingoV4Bytecode *> _lingoV4; Common::HashMap<int, LingoV4TheEntity *> _lingoV4TheEntity; -private: uint _pc; StackData _stack; DirectorEngine *_vm; - LC *_lc; int _floatPrecision; |