From 5fc6a8a5e36922dbf470baa9df8bed17a5f2fc09 Mon Sep 17 00:00:00 2001 From: marcobaye Date: Fri, 1 Mar 2024 10:16:48 +0000 Subject: [PATCH] fixed bug introduced in previous commit git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@352 4df02467-bbd4-4a76-a152-e7ce94205b78 --- docs/Errors.txt | 29 +++++++++++++++++------------ src/alu.c | 2 +- src/output.c | 6 ++++-- src/version.h | 2 +- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/docs/Errors.txt b/docs/Errors.txt index 20b94ff..4fc4d8d 100644 --- a/docs/Errors.txt +++ b/docs/Errors.txt @@ -381,24 +381,29 @@ There's more than one character. situation where only a string with length one is allowed. Too late for postfix. - You can only postfix symbols at the start, before they are used for - the first time. + You can only postfix symbols at the start, before they are used + for the first time. Too many '('. A formula ends before all parentheses were closed. -Un-pseudopc operator '&' can only be applied to labels. - You tried to apply the operator '&' to something that is not a - label. This operator only works on labels and on '*' (the program - counter), it cannot be used on other objects. +Un-pseudopc operator '&' can only be applied to number symbols. + You tried to use the operator '&' on a list or a string. This + operator only works on labels and on '*' (the program counter), it + cannot be used on other objects. + +Un-pseudopc operator '&' only works on labels. + You tried to apply the operator '&' to something that is not an + implicitly defined label, but the result of an explicit symbol + assignment (like the result of a calculation). Example: + argument = * + 1 +label lda #$ff + You can use '&' on "label", but not on "argument". Un-pseudopc operator '&' has no !pseudopc context. - You either tried to apply the operator '&' to something that is - not an implicitly defined label, but the result of an explicit - symbol assignment (like the result of a calculation). - Or you applied the operator to a label that was defined outside of - a !pseudopc block, or, more generally, the number of '&' - characters used was larger than the number of !pseudopc blocks + You tried to apply the operator '&' to a label that was defined + outside of a !pseudopc block, or, more generally, the number of + '&' characters used was larger than the number of !pseudopc blocks around the definition. Unknown encoding. diff --git a/src/alu.c b/src/alu.c index ba135e9..841e620 100644 --- a/src/alu.c +++ b/src/alu.c @@ -367,7 +367,7 @@ static void get_symbol_value(scope_t scope, size_t name_length, unsigned int unp if (arg->type == &type_number) { pseudopc_unpseudo(&arg->u.number, symbol->pseudopc, unpseudo_count); } else { - Throw_error("Un-pseudopc operator '&' can only be applied to labels."); + Throw_error("Un-pseudopc operator '&' can only be applied to number symbols."); } } // if needed, output "value not defined" error diff --git a/src/output.c b/src/output.c index 078f619..422a6fe 100644 --- a/src/output.c +++ b/src/output.c @@ -573,8 +573,10 @@ int pseudopc_unpseudo(struct number *target, struct pseudopc *context, unsigned if (target->ntype == NUMTYPE_UNDEFINED) return 0; // ok (no sense in trying to unpseudo this, and it might be an unresolved forward ref anyway) - if (context == NULL) - BUG("PseudoPCContext", 1); + if (context == NULL) { + Throw_error("Un-pseudopc operator '&' only works on labels."); + return 1; // error + } if (context == &outermost_pseudopc_context) { Throw_error("Un-pseudopc operator '&' has no !pseudopc context."); return 1; // error diff --git a/src/version.h b/src/version.h index a844970..5dc60d2 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ #define RELEASE "0.97" // update before release FIXME #define CODENAME "Zem" // update before release -#define CHANGE_DATE "24 Feb" // update before release FIXME +#define CHANGE_DATE "25 Feb" // update before release FIXME #define CHANGE_YEAR "2024" // update before release //#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" #define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME