ACME Release 0.95.8: Errors in macros are now shown with call stack.

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@75 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye 2016-10-08 12:19:12 +00:00
parent 7fd4bc6539
commit 222f06c905
6 changed files with 45 additions and 11 deletions

View File

@ -12,6 +12,14 @@ platform used. There should be another help file in this archive
outlining the platform specific changes.
----------------------------------------------------------------------
Section: New in release 0.95.8
----------------------------------------------------------------------
Warnings and errors inside macros now cause the call stack to be
displayed as well (does not yet work for serious errors, though).
----------------------------------------------------------------------
Section: New in release 0.95.7
----------------------------------------------------------------------
@ -19,9 +27,9 @@ Section: New in release 0.95.7
New pseudo opcodes:
"!be16", "!be24" and "!be32" for big-endian byte order output.
"!le16", "!le24" and "!le32" for little-endian byte order output.
The old pseudo opcodes ("!16", "!24", "!32") will now use the correct
byte order for the chosen CPU (which is always little-endian, because
there is no support for any big-endian CPU yet. ;))
The old pseudo opcodes ("!16", "!24", "!32") will now use the
correct byte order for the chosen CPU (which is always little-
endian, because there is no support for any big-endian CPU yet.;))
----------------------------------------------------------------------
@ -214,8 +222,8 @@ Added "apple" output format.
Section: New in release 0.94.3
----------------------------------------------------------------------
"Target out of range" error now includes info on how much the range was
exceeded. Thanks to Bitbreaker/VOZ for the suggestion.
"Target out of range" error now includes info on how much the range
was exceeded. Thanks to Bitbreaker/VOZ for the suggestion.
----------------------------------------------------------------------
@ -223,12 +231,12 @@ Section: New in release 0.94.2
----------------------------------------------------------------------
Added missing newline after "no output file specified" message.
Fixed bug in "!to" and "!sl" (colon in filename is interpreted as command
separator in later passes).
Fixed bug in "!to" and "!sl" (colon in filename is interpreted as
command separator in later passes).
Changed verbose output hex prefix from $ to 0x.
Changed --help output
Changed EOR to XOR in docs and comments (the ACME operator, not the 6502
opcode)
Changed EOR to XOR in docs and comments (the ACME operator, not the
6502 opcode)
----------------------------------------------------------------------

View File

@ -149,6 +149,11 @@ Wrong type for loop's END value - must match type of START value.
In "!for" loops, START and END must have the same type, which then
gets used for the loop counter.
...called from here.
If warnings and/or errors are output during a macro call, messages
with this text are added to display the call stack (because you
might need to fix the call instead of the macro itself).
----------------------------------------------------------------------
Section: Errors during assembly

View File

@ -310,11 +310,19 @@ int Parse_optional_block(void)
// Error handling
// error/warning counter so macro calls can find out whether to show a call stack
static int throw_counter = 0;
int Throw_get_counter(void)
{
return throw_counter;
}
// This function will do the actual output for warnings, errors and serious
// errors. It shows the given message string, as well as the current
// context: file name, line number, source type and source title.
static void throw_message(const char *message, const char *type)
{
++throw_counter;
if (format_msvc)
fprintf(msg_stream, "%s(%d) : %s (%s %s): %s\n",
Input_now->original_filename, Input_now->line_number,
@ -366,6 +374,7 @@ void Throw_serious_error(const char *message)
{
PLATFORM_SERIOUS(message);
throw_message(message, "Serious error");
// FIXME - exiting immediately inhibits output of macro call stack!
exit(ACME_finalize(EXIT_FAILURE));
}

View File

@ -112,6 +112,8 @@ extern void Parse_until_eob_or_eof(void);
// Otherwise (if there is no block), return FALSE.
// Don't forget to call EnsureEOL() afterwards.
extern int Parse_optional_block(void);
// error/warning counter so macro calls can find out whether to show a call stack
extern int Throw_get_counter(void);
// Output a warning.
// This means the produced code looks as expected. But there has been a
// situation that should be reported to the user, for example ACME may have

View File

@ -236,6 +236,7 @@ void Macro_parse_call(void) // Now GotByte = dot or first char of macro name
scope_t macro_scope,
symbol_scope;
int arg_count = 0;
int outer_err_count;
// Enter deeper nesting level
// Quit program if recursion too deep.
@ -284,6 +285,7 @@ void Macro_parse_call(void) // Now GotByte = dot or first char of macro name
// make macro_node point to the macro struct
actual_macro = macro_node->body;
local_gotbyte = GotByte; // CAUTION - ugly kluge
// set up new input
new_input.original_filename = actual_macro->def_filename;
new_input.line_number = actual_macro->def_line_number;
@ -294,6 +296,9 @@ void Macro_parse_call(void) // Now GotByte = dot or first char of macro name
outer_input = Input_now;
// activate new input
Input_now = &new_input;
outer_err_count = Throw_get_counter(); // remember error count (for call stack decision)
// remember old section
outer_section = section_now;
// start new section (with new scope)
@ -342,6 +347,11 @@ void Macro_parse_call(void) // Now GotByte = dot or first char of macro name
Input_now = outer_input;
// restore old Gotbyte context
GotByte = local_gotbyte; // CAUTION - ugly kluge
// if needed, output call stack
if (Throw_get_counter() != outer_err_count)
Throw_warning("...called from here.");
Input_ensure_EOS();
}
++macro_recursions_left; // leave this nesting level

View File

@ -7,9 +7,9 @@
#define version_H
#define RELEASE "0.95.7" // update before release (FIXME)
#define RELEASE "0.95.8" // update before release (FIXME)
#define CODENAME "Fenchurch" // update before release
#define CHANGE_DATE "5 Aug" // update before release
#define CHANGE_DATE "8 Oct" // update before release
#define CHANGE_YEAR "2016" // update before release
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" // FIXME
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME