diff options
author | Eugene Sandulenko | 2016-06-12 23:07:57 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 4e2b3f449e3ad7b15842067ce4ec5907bb4165b2 (patch) | |
tree | d59f04c0c3f73f41f1e1e8899e39b0b5e979aff5 /engines/director/lingo | |
parent | 45a57ce9b7387d74db20d7c260495d7fa9466d7c (diff) | |
download | scummvm-rg350-4e2b3f449e3ad7b15842067ce4ec5907bb4165b2.tar.gz scummvm-rg350-4e2b3f449e3ad7b15842067ce4ec5907bb4165b2.tar.bz2 scummvm-rg350-4e2b3f449e3ad7b15842067ce4ec5907bb4165b2.zip |
DIRECTOR: Lingo: Moved func_mci() to a separate file
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-funcs.cpp | 33 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 58 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.h | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 14 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.l | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo.cpp | 4 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 2 |
8 files changed, 76 insertions, 41 deletions
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp new file mode 100644 index 0000000000..641a617f9d --- /dev/null +++ b/engines/director/lingo/lingo-funcs.cpp @@ -0,0 +1,33 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "engines/director/lingo/lingo.h" + +namespace Director { + +int Lingo::func_mci(Common::String *s) { + warning("STUB: mci(\"%s\")", s->c_str()); + + return 0; +} + +} diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index 79b953186c..343817c2b1 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -107,7 +107,11 @@ extern int yylex(); extern int yyparse(); void yyerror(char *s) { error("%s", s); } -int func_mci(Common::String *s); +using namespace Director; + +namespace Director { +extern Lingo *g_lingo; +} @@ -131,10 +135,10 @@ int func_mci(Common::String *s); #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 39 "engines/director/lingo/lingo-gr.y" +#line 43 "engines/director/lingo/lingo-gr.y" { float f; int i; Common::String *s; } /* Line 193 of yacc.c. */ -#line 138 "engines/director/lingo/lingo-gr.cpp" +#line 142 "engines/director/lingo/lingo-gr.cpp" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -147,7 +151,7 @@ typedef union YYSTYPE /* Line 216 of yacc.c. */ -#line 151 "engines/director/lingo/lingo-gr.cpp" +#line 155 "engines/director/lingo/lingo-gr.cpp" #ifdef short # undef short @@ -436,8 +440,8 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 62, 62, 63, 66, 67, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 82, 83, 84, 85 + 0, 66, 66, 67, 70, 71, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 86, 87, 88, 89 }; #endif @@ -1359,83 +1363,83 @@ yyreduce: switch (yyn) { case 4: -#line 66 "engines/director/lingo/lingo-gr.y" +#line 70 "engines/director/lingo/lingo-gr.y" { warning("%d", (yyvsp[(1) - (1)].i)); ;} break; case 5: -#line 67 "engines/director/lingo/lingo-gr.y" +#line 71 "engines/director/lingo/lingo-gr.y" { warning("%d", (yyvsp[(1) - (1)].i)); ;} break; case 6: -#line 70 "engines/director/lingo/lingo-gr.y" +#line 74 "engines/director/lingo/lingo-gr.y" { (yyval.i) = (yyvsp[(1) - (1)].i); ;} break; case 7: -#line 71 "engines/director/lingo/lingo-gr.y" +#line 75 "engines/director/lingo/lingo-gr.y" { (yyval.i) = vars[*(yyvsp[(1) - (1)].s)]; delete (yyvsp[(1) - (1)].s); ;} break; case 8: -#line 72 "engines/director/lingo/lingo-gr.y" +#line 76 "engines/director/lingo/lingo-gr.y" { (yyval.i) = (yyvsp[(1) - (3)].i) + (yyvsp[(3) - (3)].i); ;} break; case 9: -#line 73 "engines/director/lingo/lingo-gr.y" +#line 77 "engines/director/lingo/lingo-gr.y" { (yyval.i) = (yyvsp[(1) - (3)].i) - (yyvsp[(3) - (3)].i); ;} break; case 10: -#line 74 "engines/director/lingo/lingo-gr.y" +#line 78 "engines/director/lingo/lingo-gr.y" { (yyval.i) = (yyvsp[(1) - (3)].i) * (yyvsp[(3) - (3)].i); ;} break; case 11: -#line 75 "engines/director/lingo/lingo-gr.y" +#line 79 "engines/director/lingo/lingo-gr.y" { (yyval.i) = (yyvsp[(1) - (3)].i) / (yyvsp[(3) - (3)].i); ;} break; case 12: -#line 76 "engines/director/lingo/lingo-gr.y" +#line 80 "engines/director/lingo/lingo-gr.y" { (yyval.i) = (yyvsp[(2) - (2)].i); ;} break; case 13: -#line 77 "engines/director/lingo/lingo-gr.y" +#line 81 "engines/director/lingo/lingo-gr.y" { (yyval.i) = -(yyvsp[(2) - (2)].i); ;} break; case 14: -#line 78 "engines/director/lingo/lingo-gr.y" +#line 82 "engines/director/lingo/lingo-gr.y" { (yyval.i) = (yyvsp[(2) - (3)].i); ;} break; case 16: -#line 82 "engines/director/lingo/lingo-gr.y" - { func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;} +#line 86 "engines/director/lingo/lingo-gr.y" + { g_lingo->func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;} break; case 17: -#line 83 "engines/director/lingo/lingo-gr.y" +#line 87 "engines/director/lingo/lingo-gr.y" { (yyval.i) = vars[*(yyvsp[(4) - (4)].s)] = (yyvsp[(2) - (4)].i); delete (yyvsp[(4) - (4)].s); ;} break; case 18: -#line 84 "engines/director/lingo/lingo-gr.y" +#line 88 "engines/director/lingo/lingo-gr.y" { (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;} break; case 19: -#line 85 "engines/director/lingo/lingo-gr.y" +#line 89 "engines/director/lingo/lingo-gr.y" { (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;} break; /* Line 1267 of yacc.c. */ -#line 1439 "engines/director/lingo/lingo-gr.cpp" +#line 1443 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1649,12 +1653,6 @@ yyreturn: } -#line 88 "engines/director/lingo/lingo-gr.y" - +#line 92 "engines/director/lingo/lingo-gr.y" -int func_mci(Common::String *s) { - warning("STUB: mci(\"%s\")", s->c_str()); - - return 0; -} diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h index 1cf31e05c0..ae10d1f618 100644 --- a/engines/director/lingo/lingo-gr.h +++ b/engines/director/lingo/lingo-gr.h @@ -68,7 +68,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 39 "engines/director/lingo/lingo-gr.y" +#line 43 "engines/director/lingo/lingo-gr.y" { float f; int i; Common::String *s; } /* Line 1529 of yacc.c. */ #line 75 "engines/director/lingo/lingo-gr.hpp" diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index af0ad42824..f6968b8b4d 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -32,7 +32,11 @@ extern int yylex(); extern int yyparse(); void yyerror(char *s) { error("%s", s); } -int func_mci(Common::String *s); +using namespace Director; + +namespace Director { +extern Lingo *g_lingo; +} %} @@ -79,16 +83,10 @@ expr: INT { $$ = $1; } | ; -func: FUNC_MCI STRING { func_mci($2); delete $2; } +func: FUNC_MCI STRING { g_lingo->func_mci($2); delete $2; } | FUNC_PUT expr OP_INTO VAR { $$ = vars[*$4] = $2; delete $4; } | FUNC_SET VAR '=' expr { $$ = vars[*$2] = $4; delete $2; } | FUNC_SET VAR OP_TO expr { $$ = vars[*$2] = $4; delete $2; } ; %% - -int func_mci(Common::String *s) { - warning("STUB: mci(\"%s\")", s->c_str()); - - return 0; -} diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index 57202f0c6a..1c69d3f23e 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -502,7 +502,7 @@ char *yytext; #include "director/lingo/lingo.h" #include "director/lingo/lingo-gr.h" -void yyparse(); +int yyparse(); #line 508 "engines/director/lingo/lingo-lex.cpp" diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index c0d104fb77..7eb3810e28 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -30,7 +30,7 @@ #include "director/lingo/lingo.h" #include "director/lingo/lingo-gr.h" -void yyparse(); +int yyparse(); %} diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 2bbf5f8271..3c80608685 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -24,6 +24,8 @@ namespace Director { +Lingo *g_lingo; + struct EventHandlerType { LEvent handler; const char *name; @@ -65,6 +67,8 @@ struct EventHandlerType { }; Lingo::Lingo() { + g_lingo = this; + for (const EventHandlerType *t = &eventHanlerDescs[0]; t->handler != kEventNone; ++t) _eventHandlerTypes[t->handler] = t->name; } diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 4cb175b03e..4f66cee0b0 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -74,6 +74,8 @@ public: int parse(char *code); + int func_mci(Common::String *s); + private: Common::HashMap<uint32, const char *> _eventHandlerTypes; }; |