From de269aeb45d5831ea3f147aba9d1cc3f755e3ea3 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Fri, 15 May 2009 05:29:09 +0000 Subject: [PATCH] Sent: Monday, May 11, 2009 10:32 PM To: submit@mamedev.org Subject: LSHIFT/<< expression diff fix Tafoid pointed out that it's currently impossible to use '<<' in a cheat xml file, this fix adds an alternate LSHIFT to cheat.c and express.c and also adds the working '>>' as an alternate RSHIFT to express.c (not needed in cheat.c as >> parses fine) diff file attached --- src/emu/cheat.c | 5 +++++ src/emu/debug/express.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/emu/cheat.c b/src/emu/cheat.c index 57e1b23cdad..acba835716b 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -1706,6 +1706,11 @@ static astring *quote_astring_expression(astring *string, int isattribute) astring_replacec(string, 0, " <", " lt "); astring_replacec(string, 0, "< ", " lt "); astring_replacec(string, 0, "<", " lt "); + + astring_replacec(string, 0, " << ", " lshift "); + astring_replacec(string, 0, " <<", " lshift "); + astring_replacec(string, 0, "<< ", " lshift "); + astring_replacec(string, 0, "<<", " lshift "); return string; } diff --git a/src/emu/debug/express.c b/src/emu/debug/express.c index 98284bf4bda..867372fe505 100644 --- a/src/emu/debug/express.c +++ b/src/emu/debug/express.c @@ -887,6 +887,10 @@ static EXPRERR parse_string_into_tokens(const char *stringstart, parsed_expressi SET_TOKEN_INFO(0, TOK_OPERATOR, TVL_BOR, TIN_PRECEDENCE_10); else if (strcmp(buffer, "bxor") == 0) SET_TOKEN_INFO(0, TOK_OPERATOR, TVL_BXOR, TIN_PRECEDENCE_9); + else if (strcmp(buffer, "lshift") == 0) + SET_TOKEN_INFO(0, TOK_OPERATOR, TVL_LSHIFT, TIN_PRECEDENCE_5); + else if (strcmp(buffer, "rshift") == 0) + SET_TOKEN_INFO(0, TOK_OPERATOR, TVL_RSHIFT, TIN_PRECEDENCE_5); /* process anything else as a number or string */ else