From 9bbac556d3d1b88ccc1e42475bf839efe2809a3d Mon Sep 17 00:00:00 2001 From: marcobaye Date: Fri, 29 May 2020 22:03:04 +0000 Subject: [PATCH] worked on error messages git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@202 4df02467-bbd4-4a76-a152-e7ce94205b78 --- docs/Errors.txt | 63 +++++++++++++++++++++++++++++++-------------- docs/Floats.txt | 2 +- src/alu.c | 4 +-- src/output.c | 2 +- src/pseudoopcodes.c | 8 +++--- src/version.h | 2 +- 6 files changed, 53 insertions(+), 28 deletions(-) diff --git a/docs/Errors.txt b/docs/Errors.txt index 5366022..0605fe9 100644 --- a/docs/Errors.txt +++ b/docs/Errors.txt @@ -200,6 +200,10 @@ Section: Errors during assembly This is given when the pseudo opcode "!error" is executed. The actual message varies according to the pseudo opcode's arguments. +After ELSE, expected block or IF/IFDEF/IFNDEF. + There is something strange after ELSE: It must be "if", "ifdef", + "ifndef" or an opening brace. + Argument out of range. You called arcsin/arccos with something not in the [-1, 1] range. @@ -214,6 +218,13 @@ Conversion table incomplete. Division by zero. Guess what - you attempted to divide by zero. +Expected ELSE or end-of-statement. + There is something after the closing brace of an IF block that is + not an ELSE. + +Expected end-of-statement after ELSE block. + There is something after the closing brace of an ELSE block. + Exponent is negative. Using negative exponents only give sensible results when using floating point maths. @@ -333,6 +344,17 @@ Too late for postfix. 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, it cannot be used on + the results of calculations. + +Un-pseudopc operator '&' has no !pseudopc context. + You tried to apply the operator '&' to a label that wasn't defined + in a !pseudopc block. + Or, more generally, you used more '&' characters on the label than + there were !pseudopc blocks around it. + Unknown encoding. You used the "!convtab" command with a keyword ACME does not know. @@ -441,21 +463,21 @@ No output file specified (use the "-o" option or the "!to" pseudo opcode). Section: Bugs in ACME ---------------------------------------------------------------------- - The warning "Bug in ACME, code follows" is always followed by a - serious error message, stopping assembly. The second message - actually gives a hint about the bug's location in the source code. - If you ever get this combination of warning and serious error, - please send me an e-mail and tell me about it. If possible, - include a piece of source code that triggers it. +The warning "Bug in ACME, code follows" is always followed by a +serious error message, stopping assembly. The second message actually +gives a hint about the bug's location in the source code. +If you ever get this combination of warning and serious error, please +send me an e-mail and tell me about it. If possible, include a piece +of source code that triggers it. +Please don't get this wrong - there are no known bugs. I just left +some debugging code in place in case there is a bug I failed to notice +during testing. In practice, this warning is not expected to be given +at all. That's the reason why I want to be notified if it *does* +decide to show up. - Please don't get this wrong - there are no known bugs. I just left - some debugging code in place in case there is a bug I failed to - notice during testing. In practice, this warning is not expected - to be given at all. That's the reason why I want to be notified if - it *does* decide to show up. +The hint messages are of no real interest to the end user, but here +they are for completeness' sake: - The hint messages are of no real interest to the end user, but here - they are for completeness' sake. ArgStackEmpty There was no data for a monadic operator to work on. @@ -464,20 +486,23 @@ ArgStackNotEmpty The expression parser has finished though there are still arguments left to process. -IllegalGroupIndex - The mnemonic tree contains a group that I didn't add. - IllegalBlockTerminator A RAM block (macro or loop) was terminated incorrectly. -IllegalOperatorId -IllegalOperatorGroup - The expression parser found an operator that does not exist. +IllegalGroupIndex + The mnemonic tree contains a group that I didn't add. + +IllegalIfMode + A sanity check in the if/ifdef/ifndef/else code failed. IllegalImmediateMode The mnemonic tree contains invalid info about the size of immediate arguments. +IllegalOperatorId +IllegalOperatorGroup + The expression parser found an operator that does not exist. + IllegalSymbolNameLength A sanity check on string lengths failed. diff --git a/docs/Floats.txt b/docs/Floats.txt index 99782a3..e235a28 100644 --- a/docs/Floats.txt +++ b/docs/Floats.txt @@ -17,7 +17,7 @@ with floats and returns a float. Applies to sin(), cos(), tan(), arcsin(), arccos(), arctan() and float(): These are always computed in float mode and always return floats. -b) if a maths operation is useles when done with floats, it is done +b) if a maths operation is useless when done with floats, it is done with integers and returns an integer. Applies to NOT, AND, OR, XOR, MOD, DIV, LSR, lowbyteof, highbyteof, bankbyteof and int(). These are always computed in integer mode and always return integers. diff --git a/src/alu.c b/src/alu.c index 834e7bf..f489647 100644 --- a/src/alu.c +++ b/src/alu.c @@ -360,7 +360,7 @@ static void get_symbol_value(scope_t scope, char optional_prefix_char, size_t na pseudopc_unpseudo(&arg->u.number, symbol->pseudopc, unpseudo_count); // TODO - check return value and enter error state if nonzero? } else { - Throw_error("Monadic '&' operator can only be applied to labels."); // TODO - add to docs + Throw_error("Un-pseudopc operator '&' can only be applied to labels."); // TODO - enter error state? } } @@ -1638,7 +1638,7 @@ static int get_valid_index(int *target, int length, struct object *self, struct if (index < 0) index += length; if ((index < 0) || (index >= length)) { - Throw_error("Index out of range."); // FIXME - add to docs + Throw_error("Index out of range."); return 1; } *target = index; diff --git a/src/output.c b/src/output.c index 63345a0..df96190 100644 --- a/src/output.c +++ b/src/output.c @@ -677,7 +677,7 @@ int pseudopc_unpseudo(struct number *target, struct pseudopc *context, unsigned return 0; // ok (no sense in trying to unpseudo this, and it might be an unresolved forward ref anway) if (context == NULL) { - Throw_error("Too many monadic '&' operators for this label."); // TODO - add to docs + Throw_error("Un-pseudopc operator '&' has no !pseudopc context."); return 1; // error } // FIXME - in future, check DEFINED flag of context! diff --git a/src/pseudoopcodes.c b/src/pseudoopcodes.c index dde1eca..633ff7a 100644 --- a/src/pseudoopcodes.c +++ b/src/pseudoopcodes.c @@ -921,7 +921,7 @@ static enum eos ifelse(enum ifmode mode) condition_met = TRUE; break; default: - Bug_found("IllegalIfMode", mode); // FIXME - put in docs! + Bug_found("IllegalIfMode", mode); condition_met = TRUE; // inhibit compiler warning ;) } SKIPSPACE(); @@ -949,7 +949,7 @@ static enum eos ifelse(enum ifmode mode) if (mode == IFMODE_ELSE) { // we could just return ENSURE_EOS, but checking here allows for better error message if (GotByte != CHAR_EOS) - Throw_error("Expected end-of-statement after ELSE block"); // FIXME - put in docs! + Throw_error("Expected end-of-statement after ELSE block."); return SKIP_REMAINDER; // normal exit after ELSE {...} } @@ -963,7 +963,7 @@ static enum eos ifelse(enum ifmode mode) // make sure it's "else" if (strcmp(GlobalDynaBuf->buffer, "else")) { - Throw_error("Expected ELSE or end-of-statement"); // FIXME - put in docs! + Throw_error("Expected ELSE or end-of-statement."); return SKIP_REMAINDER; // an error has been reported, so ignore rest of line } // anything more? @@ -986,7 +986,7 @@ static enum eos ifelse(enum ifmode mode) } else if (strcmp(GlobalDynaBuf->buffer, "ifndef") == 0) { mode = IFMODE_IFNDEF; } else { - Throw_error("After ELSE, expected block or IF/IFDEF/IFNDEF"); // FIXME - put in docs! + Throw_error("After ELSE, expected block or IF/IFDEF/IFNDEF."); return SKIP_REMAINDER; // an error has been reported, so ignore rest of line } } diff --git a/src/version.h b/src/version.h index ccd4163..4250749 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 "29 May" // update before release FIXME +#define CHANGE_DATE "30 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