mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
PRIVATE: use more classes and avoid external
This commit is contained in:
parent
570a38ab04
commit
d0e43c93b5
@ -53,9 +53,6 @@
|
||||
|
||||
namespace Private {
|
||||
|
||||
Setting *setting;
|
||||
SettingMap settingMap;
|
||||
|
||||
Datum *stack = NULL; /* the stack */
|
||||
Datum *stackp = NULL; /* next free spot on stack */
|
||||
|
||||
@ -89,8 +86,8 @@ void initInsts() {
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize for code generation */
|
||||
void initSetting() {
|
||||
/* initialize setting for code generation */
|
||||
void SettingMaps::init() {
|
||||
setting = (Setting *)malloc(sizeof(Setting));
|
||||
memset((void *)setting, 0, sizeof(Setting));
|
||||
|
||||
@ -101,14 +98,13 @@ void initSetting() {
|
||||
progp = prog;
|
||||
}
|
||||
|
||||
void saveSetting(char *name) {
|
||||
//Common::String s(name);
|
||||
settingMap.setVal(name, setting);
|
||||
void SettingMaps::save(char *name) {
|
||||
map.setVal(name, setting);
|
||||
}
|
||||
|
||||
void loadSetting(Common::String *name) {
|
||||
assert(settingMap.contains(*name));
|
||||
setting = settingMap.getVal(*name);
|
||||
void SettingMaps::load(Common::String *name) {
|
||||
assert(map.contains(*name));
|
||||
setting = map.getVal(*name);
|
||||
|
||||
debugC(1, kPrivateDebugCode, "loading setting %s", name->c_str());
|
||||
|
||||
@ -155,7 +151,6 @@ int strpush() { /* push constant onto stack */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int varpush() { /* push variable onto stack */
|
||||
Datum d;
|
||||
d.type = NAME;
|
||||
@ -287,7 +282,6 @@ int lt() {
|
||||
d2.type = NUM;
|
||||
}
|
||||
|
||||
|
||||
d1.u.val = (int)(d1.u.val < d2.u.val);
|
||||
push(d1);
|
||||
return 0;
|
||||
@ -311,7 +305,6 @@ int ge() {
|
||||
d2.type = NUM;
|
||||
}
|
||||
|
||||
|
||||
d1.u.val = (int)(d1.u.val >= d2.u.val);
|
||||
push(d1);
|
||||
return 0;
|
||||
@ -335,7 +328,6 @@ int le() {
|
||||
d2.type = NUM;
|
||||
}
|
||||
|
||||
|
||||
d1.u.val = (int)(d1.u.val <= d2.u.val);
|
||||
push(d1);
|
||||
return 0;
|
||||
@ -359,7 +351,6 @@ int eq() {
|
||||
d2.type = NUM;
|
||||
}
|
||||
|
||||
|
||||
d1.u.val = (int)(d1.u.val == d2.u.val);
|
||||
push(d1);
|
||||
return 0;
|
||||
@ -379,7 +370,6 @@ int ne() {
|
||||
d2.type = NUM;
|
||||
}
|
||||
|
||||
|
||||
d1.u.val = (int)(d1.u.val != d2.u.val);
|
||||
push(d1);
|
||||
return 0;
|
||||
|
@ -68,7 +68,7 @@
|
||||
/* Substitute the variable and function names. */
|
||||
#define yyparse PRIVATE_parse
|
||||
#define yylex PRIVATE_lex
|
||||
#define yyerror PRIVATE_xerror
|
||||
#define yyerror PRIVATE_error
|
||||
#define yydebug PRIVATE_debug
|
||||
#define yynerrs PRIVATE_nerrs
|
||||
#define yylval PRIVATE_lval
|
||||
@ -81,6 +81,9 @@
|
||||
#include "private/private.h"
|
||||
#include "private/grammar.h"
|
||||
|
||||
#undef yyerror
|
||||
#define yyerror PRIVATE_xerror
|
||||
|
||||
#define code1(c1) Private::code(c1);
|
||||
#define code2(c1,c2) Private::code(c1); Private::code(c2)
|
||||
#define code3(c1,c2,c3) Private::code(c1); Private::code(c2); Private::code(c3)
|
||||
@ -99,7 +102,7 @@ int PRIVATE_wrap() {
|
||||
|
||||
|
||||
|
||||
#line 103 "engines/private/grammar.cpp"
|
||||
#line 106 "engines/private/grammar.cpp"
|
||||
|
||||
# ifndef YY_CAST
|
||||
# ifdef __cplusplus
|
||||
@ -544,12 +547,12 @@ static const yytype_int8 yytranslate[] =
|
||||
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
{
|
||||
0, 91, 91, 92, 95, 96, 97, 100, 101, 104,
|
||||
105, 108, 115, 116, 121, 129, 130, 133, 136, 139,
|
||||
142, 143, 148, 152, 153, 156, 164, 165, 173, 176,
|
||||
177, 178, 179, 180, 183, 184, 185, 186, 187, 188,
|
||||
191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
|
||||
201
|
||||
0, 94, 94, 95, 98, 99, 100, 104, 105, 108,
|
||||
109, 112, 119, 120, 125, 133, 134, 137, 140, 143,
|
||||
146, 147, 152, 156, 157, 160, 168, 169, 177, 180,
|
||||
181, 182, 183, 184, 187, 188, 189, 190, 191, 192,
|
||||
195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
|
||||
205
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -1196,31 +1199,32 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 4: /* line: DEBUGTOK '{' debug '}' */
|
||||
#line 95 "engines/private/grammar.y"
|
||||
#line 98 "engines/private/grammar.y"
|
||||
{ /* Not used in the game */ }
|
||||
#line 1202 "engines/private/grammar.cpp"
|
||||
#line 1205 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 5: /* line: DEFINETOK NAME '{' define '}' */
|
||||
#line 96 "engines/private/grammar.y"
|
||||
#line 99 "engines/private/grammar.y"
|
||||
{ g_private->maps.installAll((yyvsp[-3].s)); }
|
||||
#line 1208 "engines/private/grammar.cpp"
|
||||
#line 1211 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 6: /* line: SETTINGTOK NAME '{' statements '}' */
|
||||
#line 97 "engines/private/grammar.y"
|
||||
{ saveSetting((yyvsp[-3].s)); initSetting(); }
|
||||
#line 1214 "engines/private/grammar.cpp"
|
||||
#line 100 "engines/private/grammar.y"
|
||||
{ g_private->settings.save((yyvsp[-3].s));
|
||||
g_private->settings.init(); }
|
||||
#line 1218 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 9: /* statements: %empty */
|
||||
#line 104 "engines/private/grammar.y"
|
||||
#line 108 "engines/private/grammar.y"
|
||||
{ (yyval.inst) = progp; }
|
||||
#line 1220 "engines/private/grammar.cpp"
|
||||
#line 1224 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 11: /* statement: GOTOTOK NAME ';' */
|
||||
#line 108 "engines/private/grammar.y"
|
||||
#line 112 "engines/private/grammar.y"
|
||||
{
|
||||
(yyval.inst) = progp;
|
||||
code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
|
||||
@ -1228,99 +1232,99 @@ yyreduce:
|
||||
code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto"));
|
||||
code1(funcpush);
|
||||
}
|
||||
#line 1232 "engines/private/grammar.cpp"
|
||||
#line 1236 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 12: /* statement: fcall ';' */
|
||||
#line 115 "engines/private/grammar.y"
|
||||
#line 119 "engines/private/grammar.y"
|
||||
{ (yyval.inst) = (yyvsp[-1].inst); }
|
||||
#line 1238 "engines/private/grammar.cpp"
|
||||
#line 1242 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 13: /* statement: if cond body end */
|
||||
#line 116 "engines/private/grammar.y"
|
||||
#line 120 "engines/private/grammar.y"
|
||||
{
|
||||
/* else-less if */
|
||||
((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst); /* thenpart */
|
||||
((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst);
|
||||
}
|
||||
#line 1248 "engines/private/grammar.cpp"
|
||||
#line 1252 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 14: /* statement: if cond body end ELSETOK body end */
|
||||
#line 121 "engines/private/grammar.y"
|
||||
#line 125 "engines/private/grammar.y"
|
||||
{
|
||||
/* if with else */
|
||||
((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst); /* thenpart */
|
||||
((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst); /* elsepart */
|
||||
((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst);
|
||||
}
|
||||
#line 1259 "engines/private/grammar.cpp"
|
||||
#line 1263 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 15: /* body: statement */
|
||||
#line 129 "engines/private/grammar.y"
|
||||
#line 133 "engines/private/grammar.y"
|
||||
{ (yyval.inst) = (yyvsp[0].inst); }
|
||||
#line 1265 "engines/private/grammar.cpp"
|
||||
#line 1269 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 16: /* body: '{' statements '}' */
|
||||
#line 130 "engines/private/grammar.y"
|
||||
#line 134 "engines/private/grammar.y"
|
||||
{ (yyval.inst) = (yyvsp[-1].inst); }
|
||||
#line 1271 "engines/private/grammar.cpp"
|
||||
#line 1275 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 17: /* end: %empty */
|
||||
#line 133 "engines/private/grammar.y"
|
||||
#line 137 "engines/private/grammar.y"
|
||||
{ code(STOP); (yyval.inst) = progp; }
|
||||
#line 1277 "engines/private/grammar.cpp"
|
||||
#line 1281 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 18: /* if: IFTOK */
|
||||
#line 136 "engines/private/grammar.y"
|
||||
#line 140 "engines/private/grammar.y"
|
||||
{ (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
|
||||
#line 1283 "engines/private/grammar.cpp"
|
||||
#line 1287 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 19: /* cond: '(' expr ')' */
|
||||
#line 139 "engines/private/grammar.y"
|
||||
#line 143 "engines/private/grammar.y"
|
||||
{ code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
|
||||
#line 1289 "engines/private/grammar.cpp"
|
||||
#line 1293 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define */
|
||||
#line 143 "engines/private/grammar.y"
|
||||
#line 147 "engines/private/grammar.y"
|
||||
{
|
||||
Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
|
||||
assert(r->isValidRect());
|
||||
g_private->maps.defineSymbol((yyvsp[-13].s), r);
|
||||
}
|
||||
#line 1299 "engines/private/grammar.cpp"
|
||||
#line 1303 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' */
|
||||
#line 148 "engines/private/grammar.y"
|
||||
#line 152 "engines/private/grammar.y"
|
||||
{
|
||||
Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);
|
||||
g_private->maps.defineSymbol((yyvsp[-11].s), r);
|
||||
}
|
||||
#line 1308 "engines/private/grammar.cpp"
|
||||
#line 1312 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 23: /* define: NAME ',' define */
|
||||
#line 152 "engines/private/grammar.y"
|
||||
#line 156 "engines/private/grammar.y"
|
||||
{ g_private->maps.defineSymbol((yyvsp[-2].s), NULL); }
|
||||
#line 1314 "engines/private/grammar.cpp"
|
||||
#line 1318 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 24: /* define: NAME */
|
||||
#line 153 "engines/private/grammar.y"
|
||||
#line 157 "engines/private/grammar.y"
|
||||
{ g_private->maps.defineSymbol((yyvsp[0].s), NULL); }
|
||||
#line 1320 "engines/private/grammar.cpp"
|
||||
#line 1324 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 25: /* fcall: GOTOTOK '(' NAME ')' */
|
||||
#line 156 "engines/private/grammar.y"
|
||||
#line 160 "engines/private/grammar.y"
|
||||
{
|
||||
(yyval.inst) = progp;
|
||||
code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
|
||||
@ -1328,166 +1332,166 @@ yyreduce:
|
||||
code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto"));
|
||||
code1(funcpush);
|
||||
}
|
||||
#line 1332 "engines/private/grammar.cpp"
|
||||
#line 1336 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' */
|
||||
#line 164 "engines/private/grammar.y"
|
||||
#line 168 "engines/private/grammar.y"
|
||||
{ (yyval.inst) = progp; }
|
||||
#line 1338 "engines/private/grammar.cpp"
|
||||
#line 1342 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 27: /* fcall: NAME '(' startp params ')' */
|
||||
#line 165 "engines/private/grammar.y"
|
||||
#line 169 "engines/private/grammar.y"
|
||||
{
|
||||
(yyval.inst) = (yyvsp[-2].inst);
|
||||
code2(constpush, (Private::Inst) g_private->maps.constant(NUM, (yyvsp[-1].narg), NULL));
|
||||
code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-4].s)));
|
||||
code1(funcpush);
|
||||
}
|
||||
#line 1349 "engines/private/grammar.cpp"
|
||||
#line 1353 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 28: /* startp: %empty */
|
||||
#line 173 "engines/private/grammar.y"
|
||||
#line 177 "engines/private/grammar.y"
|
||||
{ (yyval.inst) = progp; }
|
||||
#line 1355 "engines/private/grammar.cpp"
|
||||
#line 1359 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 29: /* params: %empty */
|
||||
#line 176 "engines/private/grammar.y"
|
||||
#line 180 "engines/private/grammar.y"
|
||||
{ (yyval.narg) = 0; }
|
||||
#line 1361 "engines/private/grammar.cpp"
|
||||
#line 1365 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 30: /* params: fcall ',' params */
|
||||
#line 177 "engines/private/grammar.y"
|
||||
#line 181 "engines/private/grammar.y"
|
||||
{ (yyval.narg) = (yyvsp[0].narg) + 1; }
|
||||
#line 1367 "engines/private/grammar.cpp"
|
||||
#line 1371 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 31: /* params: expr ',' params */
|
||||
#line 178 "engines/private/grammar.y"
|
||||
#line 182 "engines/private/grammar.y"
|
||||
{ (yyval.narg) = (yyvsp[0].narg) + 1; }
|
||||
#line 1373 "engines/private/grammar.cpp"
|
||||
#line 1377 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 32: /* params: expr */
|
||||
#line 179 "engines/private/grammar.y"
|
||||
#line 183 "engines/private/grammar.y"
|
||||
{ (yyval.narg) = 1; }
|
||||
#line 1379 "engines/private/grammar.cpp"
|
||||
#line 1383 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 33: /* params: fcall */
|
||||
#line 180 "engines/private/grammar.y"
|
||||
#line 184 "engines/private/grammar.y"
|
||||
{ (yyval.narg) = 1; }
|
||||
#line 1385 "engines/private/grammar.cpp"
|
||||
#line 1389 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 34: /* value: NULLTOK */
|
||||
#line 183 "engines/private/grammar.y"
|
||||
#line 187 "engines/private/grammar.y"
|
||||
{ code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
|
||||
#line 1391 "engines/private/grammar.cpp"
|
||||
#line 1395 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 35: /* value: FALSETOK */
|
||||
#line 184 "engines/private/grammar.y"
|
||||
#line 188 "engines/private/grammar.y"
|
||||
{ code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
|
||||
#line 1397 "engines/private/grammar.cpp"
|
||||
#line 1401 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 36: /* value: TRUETOK */
|
||||
#line 185 "engines/private/grammar.y"
|
||||
#line 189 "engines/private/grammar.y"
|
||||
{ code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL)); }
|
||||
#line 1403 "engines/private/grammar.cpp"
|
||||
#line 1407 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 37: /* value: NUM */
|
||||
#line 186 "engines/private/grammar.y"
|
||||
#line 190 "engines/private/grammar.y"
|
||||
{ code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
|
||||
#line 1409 "engines/private/grammar.cpp"
|
||||
#line 1413 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 38: /* value: STRING */
|
||||
#line 187 "engines/private/grammar.y"
|
||||
#line 191 "engines/private/grammar.y"
|
||||
{ code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
|
||||
#line 1415 "engines/private/grammar.cpp"
|
||||
#line 1419 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 39: /* value: NAME */
|
||||
#line 188 "engines/private/grammar.y"
|
||||
#line 192 "engines/private/grammar.y"
|
||||
{ code1(Private::varpush); code1((Private::Inst) g_private->maps.lookupName((yyvsp[0].s))); code1(Private::eval); }
|
||||
#line 1421 "engines/private/grammar.cpp"
|
||||
#line 1425 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 40: /* expr: value */
|
||||
#line 191 "engines/private/grammar.y"
|
||||
#line 195 "engines/private/grammar.y"
|
||||
{ (yyval.inst) = (yyvsp[0].inst); }
|
||||
#line 1427 "engines/private/grammar.cpp"
|
||||
#line 1431 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 41: /* expr: '!' value */
|
||||
#line 192 "engines/private/grammar.y"
|
||||
#line 196 "engines/private/grammar.y"
|
||||
{ code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
|
||||
#line 1433 "engines/private/grammar.cpp"
|
||||
#line 1437 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 42: /* expr: value EQ value */
|
||||
#line 193 "engines/private/grammar.y"
|
||||
#line 197 "engines/private/grammar.y"
|
||||
{ code1(Private::eq); }
|
||||
#line 1439 "engines/private/grammar.cpp"
|
||||
#line 1443 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 43: /* expr: value NEQ value */
|
||||
#line 194 "engines/private/grammar.y"
|
||||
#line 198 "engines/private/grammar.y"
|
||||
{ code1(Private::ne); }
|
||||
#line 1445 "engines/private/grammar.cpp"
|
||||
#line 1449 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 44: /* expr: value '+' value */
|
||||
#line 195 "engines/private/grammar.y"
|
||||
#line 199 "engines/private/grammar.y"
|
||||
{ code1(Private::add); }
|
||||
#line 1451 "engines/private/grammar.cpp"
|
||||
#line 1455 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 45: /* expr: value '<' value */
|
||||
#line 196 "engines/private/grammar.y"
|
||||
#line 200 "engines/private/grammar.y"
|
||||
{ code1(Private::lt); }
|
||||
#line 1457 "engines/private/grammar.cpp"
|
||||
#line 1461 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 46: /* expr: value '>' value */
|
||||
#line 197 "engines/private/grammar.y"
|
||||
#line 201 "engines/private/grammar.y"
|
||||
{ code1(Private::gt); }
|
||||
#line 1463 "engines/private/grammar.cpp"
|
||||
#line 1467 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 47: /* expr: value LTE value */
|
||||
#line 198 "engines/private/grammar.y"
|
||||
#line 202 "engines/private/grammar.y"
|
||||
{ code1(Private::le); }
|
||||
#line 1469 "engines/private/grammar.cpp"
|
||||
#line 1473 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 48: /* expr: value GTE value */
|
||||
#line 199 "engines/private/grammar.y"
|
||||
#line 203 "engines/private/grammar.y"
|
||||
{ code1(Private::ge); }
|
||||
#line 1475 "engines/private/grammar.cpp"
|
||||
#line 1479 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 49: /* expr: value '+' */
|
||||
#line 200 "engines/private/grammar.y"
|
||||
#line 204 "engines/private/grammar.y"
|
||||
{ (yyval.inst) = (yyvsp[-1].inst); }
|
||||
#line 1481 "engines/private/grammar.cpp"
|
||||
#line 1485 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
case 50: /* expr: RANDOMTOK '(' NUM '%' ')' */
|
||||
#line 201 "engines/private/grammar.y"
|
||||
#line 205 "engines/private/grammar.y"
|
||||
{ code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
|
||||
#line 1487 "engines/private/grammar.cpp"
|
||||
#line 1491 "engines/private/grammar.cpp"
|
||||
break;
|
||||
|
||||
|
||||
#line 1491 "engines/private/grammar.cpp"
|
||||
#line 1495 "engines/private/grammar.cpp"
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
@ -75,10 +75,20 @@ typedef struct Setting {
|
||||
|
||||
// Settings
|
||||
|
||||
extern Setting *psetting;
|
||||
|
||||
typedef Common::HashMap<Common::String, Setting *> SettingMap;
|
||||
|
||||
class SettingMaps {
|
||||
public:
|
||||
Setting *psetting;
|
||||
Setting *setting;
|
||||
SettingMap map;
|
||||
|
||||
void init();
|
||||
void save(char *);
|
||||
void load(Common::String *);
|
||||
};
|
||||
|
||||
// Funtions
|
||||
|
||||
typedef Common::Array<Datum> ArgArray;
|
||||
@ -115,9 +125,6 @@ int randbool();
|
||||
|
||||
// Code Execution
|
||||
|
||||
void initSetting();
|
||||
void saveSetting(char *);
|
||||
void loadSetting(Common::String *);
|
||||
|
||||
void execute(Inst *);
|
||||
|
||||
|
@ -53,6 +53,9 @@
|
||||
#include "private/private.h"
|
||||
#include "private/grammar.h"
|
||||
|
||||
#undef yyerror
|
||||
#define yyerror PRIVATE_xerror
|
||||
|
||||
#define code1(c1) Private::code(c1);
|
||||
#define code2(c1,c2) Private::code(c1); Private::code(c2)
|
||||
#define code3(c1,c2,c3) Private::code(c1); Private::code(c2); Private::code(c3)
|
||||
@ -94,7 +97,8 @@ lines: line lines
|
||||
|
||||
line: DEBUGTOK '{' debug '}' { /* Not used in the game */ }
|
||||
| DEFINETOK NAME '{' define '}' { g_private->maps.installAll($NAME); }
|
||||
| SETTINGTOK NAME '{' statements '}' { saveSetting($NAME); initSetting(); }
|
||||
| SETTINGTOK NAME '{' statements '}' { g_private->settings.save($NAME);
|
||||
g_private->settings.init(); }
|
||||
;
|
||||
|
||||
debug: /* nothing */
|
||||
|
@ -2184,7 +2184,7 @@ void yyfree (void * ptr )
|
||||
namespace Private {
|
||||
|
||||
int parse(char *code) {
|
||||
initSetting();
|
||||
g_private->settings.init();
|
||||
YY_BUFFER_STATE bp;
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER);
|
||||
bp = yy_scan_string(code);
|
||||
|
@ -64,7 +64,7 @@ Random return RANDOMTOK;
|
||||
namespace Private {
|
||||
|
||||
int parse(char *code) {
|
||||
initSetting();
|
||||
g_private->settings.init();
|
||||
YY_BUFFER_STATE bp;
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER);
|
||||
bp = yy_scan_string(code);
|
||||
|
@ -277,7 +277,7 @@ Common::Error PrivateEngine::run() {
|
||||
debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting->c_str());
|
||||
clearAreas();
|
||||
_currentSetting = _nextSetting;
|
||||
loadSetting(_nextSetting);
|
||||
settings.load(_nextSetting);
|
||||
_nextSetting = NULL;
|
||||
execute(prog);
|
||||
changeCursor("default");
|
||||
|
@ -134,6 +134,7 @@ public:
|
||||
bool isDemo() const;
|
||||
|
||||
SymbolMaps maps;
|
||||
SettingMaps settings;
|
||||
|
||||
Audio::SoundHandle _fgSoundHandle;
|
||||
Audio::SoundHandle _bgSoundHandle;
|
||||
|
@ -88,7 +88,7 @@ extern int PRIVATE_debug;
|
||||
#if ! defined PRIVATE_STYPE && ! defined PRIVATE_STYPE_IS_DECLARED
|
||||
union PRIVATE_STYPE
|
||||
{
|
||||
#line 75 "engines/private/grammar.y"
|
||||
#line 78 "engines/private/grammar.y"
|
||||
|
||||
Private::Symbol *sym; /* symbol table pointer */
|
||||
int (**inst)(); /* machine instruction */
|
||||
|
Loading…
x
Reference in New Issue
Block a user