From 60603c73502e52031ee8b59417cb27feb65159ac Mon Sep 17 00:00:00 2001 From: marcobaye Date: Thu, 7 May 2020 23:32:06 +0000 Subject: [PATCH] step 1 to fix ALU_* calls git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@140 4df02467-bbd4-4a76-a152-e7ce94205b78 --- src/alu.c | 9 +++++---- src/alu.h | 4 ++-- src/mnemo.c | 2 +- src/version.h | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/alu.c b/src/alu.c index c802cad..50b0b73 100644 --- a/src/alu.c +++ b/src/alu.c @@ -1566,6 +1566,7 @@ void ALU_int_result(struct number *intresult) // ACCEPT_UNDEFINED } if (expression.is_empty) Throw_error(exception_no_value); + // FIXME - add warning for unneeded "()" } @@ -1621,14 +1622,14 @@ void ALU_defined_int(struct number *intresult) // no ACCEPT constants? // Store int value and flags. -// This function allows for one '(' too many. Needed when parsing indirect +// This function allows for "paren" '(' too many. Needed when parsing indirect // addressing modes where internal indices have to be possible. // For empty expressions, an error is thrown. // OPEN_PARENTHESIS: allow // UNDEFINED: allow // EMPTY: complain // FLOAT: convert to int -void ALU_liberal_int(struct expression *expression) // ACCEPT_UNDEFINED | ACCEPT_OPENPARENTHESIS +void ALU_addrmode_int(struct expression *expression, int paren) // ACCEPT_UNDEFINED | ACCEPT_OPENPARENTHESIS { struct number *intresult = &expression->number; @@ -1638,7 +1639,7 @@ void ALU_liberal_int(struct expression *expression) // ACCEPT_UNDEFINED | ACCEPT intresult->val.intval = intresult->val.fpval; intresult->flags &= ~NUMBER_IS_FLOAT; } - if (expression->open_parentheses > 1) { + if (expression->open_parentheses > paren) { expression->open_parentheses = 0; Throw_error(exception_paren_open); } @@ -1669,7 +1670,7 @@ void ALU_any_result(struct number *result) // ACCEPT_UNDEFINED | ACCEPT_FLOAT /* TODO // stores int value and flags, allowing for one '(' too many (x-indirect addr). -void ALU_liberal_int(struct expression *expression) +void ALU_addrmode_int(struct expression *expression, int paren) mnemo.c when parsing addressing mode (except after '#' and '[') needvalue! diff --git a/src/alu.h b/src/alu.h index ac2f5c9..b2c30dd 100644 --- a/src/alu.h +++ b/src/alu.h @@ -70,8 +70,8 @@ extern void ALU_int_result(struct number *intresult); // stores int value and flags (floats are transformed to int) // if result was undefined, serious error is thrown extern void ALU_defined_int(struct number *intresult); -// stores int value and flags, allowing for one '(' too many (x-indirect addr). -extern void ALU_liberal_int(struct expression *expression); +// stores int value and flags, allowing for "paren" '(' too many (x-indirect addr). +extern void ALU_addrmode_int(struct expression *expression, int paren); // stores value and flags (result may be either int or float) extern void ALU_any_result(struct number *result); diff --git a/src/mnemo.c b/src/mnemo.c index 2ec550c..6bc1cc3 100644 --- a/src/mnemo.c +++ b/src/mnemo.c @@ -543,7 +543,7 @@ static int get_argument(struct number *result) break; default: // liberal, to allow for "(...," - ALU_liberal_int(&expression); + ALU_addrmode_int(&expression, 1); *result = expression.number; typesystem_want_addr(result); // check for indirect addressing diff --git a/src/version.h b/src/version.h index 19f12f5..12f899a 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ #define RELEASE "0.96.5" // update before release FIXME #define CODENAME "Fenchurch" // update before release -#define CHANGE_DATE "6 May" // update before release FIXME +#define CHANGE_DATE "8 May" // update before release FIXME #define CHANGE_YEAR "2020" // update before release //#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" #define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME